Explorar el Código

流程版本功能(未完)

huqi hace 5 años
padre
commit
26b7483905

+ 15 - 1
o2web/source/o2_core/o2/widget/$Dialog/user/css.wcss

@@ -59,11 +59,25 @@
 	},
 	"closeAction": {
 	    "height": "40px",
-	    "width": "40px",
+	    "width": "30px",
 	    "float": "right",
 	    "cursor": "pointer",
 	    "background": "url("+o2.session.path+"/widget/$Dialog/user/img/close.png) center center no-repeat",
 	},
+	"maxAction": {
+	    "height": "40px",
+        "width": "20px",
+        "float": "right",
+        "cursor": "pointer",
+        "background": "url("+o2.session.path+"/widget/$Dialog/user/img/max.png) center center no-repeat"
+	},
+	"restoreAction": {
+        "height": "40px",
+        "width": "20px",
+        "float": "right",
+        "cursor": "pointer",
+        "background": "url("+o2.session.path+"/widget/$Dialog/user/img/return.png) center center no-repeat"
+    },
 	"MWF_dialod_bottom_resize": {
 	    "height": "8px",
         "width": "8px",

BIN
o2web/source/o2_core/o2/widget/$Dialog/user/img/max.gif


BIN
o2web/source/o2_core/o2/widget/$Dialog/user/img/max.png


BIN
o2web/source/o2_core/o2/widget/$Dialog/user/img/return.gif


BIN
o2web/source/o2_core/o2/widget/$Dialog/user/img/return.png


+ 2 - 2
o2web/source/o2_core/o2/widget/$Panel/default/css.wcss

@@ -12,7 +12,7 @@
 
 	//	"box-shadow": "0px 2px 5px #999", 
 		
-		"z-index": "10000"
+		"z-index": "200"
 	},
 	"container": {
 		"border-top": "1px solid #999",
@@ -27,7 +27,7 @@
 
 	//	"box-shadow": "0px 2px 5px #999", 
 		
-		"z-index": "10000"
+		"z-index": "200"
 	},
 	"panelTitleNode": {
 		"display":"block",

+ 18 - 0
o2web/source/x_component_process_ProcessDesigner/$Main/default/css.wcss

@@ -140,5 +140,23 @@
 	},
 	"paperInNode": {
 	    "height": "100%"
+	},
+	"saveNewEditionNode": {
+	    "padding": "10px 10px 10px 30px",
+	    "overflow": "hidden",
+	    "width": "500px"
+	},
+	"editionDescriptionNode": {
+	    "padding": "10px 0px",
+	    "overflow": "hidden"
+	},
+	"descriptionTitleNode": {
+	    "color": "#666666",
+	    "font-weight": "bold"
+	},
+	"descriptionTextAreaNode": {
+	    "width": "95%",
+	    "height": "80px",
+	    "overflow": "auto"
 	}
 }

+ 8 - 4
o2web/source/x_component_process_ProcessDesigner/$Process/process.html

@@ -5,10 +5,6 @@
                 <td class="editTableTitle">标识:</td>
                 <td class="editTableValue">text{$.id}</td>
             </tr>
-            <tr>
-                <td class="editTableTitle">版本:</td>
-                <td class="editTableValue">text{$.editionName}</td>
-            </tr>
             <tr>
                 <td class="editTableTitle">创建人:</td>
                 <td class="editTableValue">text{$.creatorPerson}</td>
@@ -42,6 +38,14 @@
                 <td class="editTableTitle">描述:</td>
                 <td class="editTableValue"><textarea  name="description" class="editTableTextarea">text{$.description}</textarea></td>
             </tr>
+            <tr>
+                <td class="editTableTitle">版本:</td>
+                <td class="editTableValue">text{$.editionName}</td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">版本描述:</td>
+                <td class="editTableValue"><textarea  name="description" class="editTableTextarea">text{$.editionDes}</textarea></td>
+            </tr>
             <tr>
                 <td class="editTableTitle">图标:</td>
                 <td class="editTableValue"><div class="MWFIcon" name="icon"></div></td>

+ 3 - 1
o2web/source/x_component_process_ProcessDesigner/Main.js

@@ -792,7 +792,9 @@ MWF.xApplication.process.ProcessDesigner.Main = new Class({
     saveNewEdition: function(el, e){
         this.process.saveNewEdition(e);
     },
-
+    listEdition: function(el, e){
+        this.process.listEdition(e);
+    },
 
     onPostClose: function() {
         if (this.process) {

+ 66 - 10
o2web/source/x_component_process_ProcessDesigner/Process.js

@@ -383,7 +383,7 @@ MWF.xApplication.process.ProcessDesigner.Process = new Class({
 				}.bind(this));
 			}
 			if (this.designer.processEditionInforNode){
-				var text = this.designer.lp.currentEdition+": <span class='mainColor_color'>"+this.process.editionName+"</span> "+"("+this.process.lastUpdatePerson+")";
+				var text = this.designer.lp.currentEdition+": <span class='mainColor_color'>"+this.process.editionNumber+"</span> "+this.designer.lp.editionUpdate+": <span class='mainColor_color'>"+o2.name.cn(this.process.lastUpdatePerson)+" ("+this.process.updateTime+")</span>";
 				this.designer.processEditionInforNode.set("html", text);
 			}
 		}
@@ -399,7 +399,7 @@ MWF.xApplication.process.ProcessDesigner.Process = new Class({
 			this.unSelectedAll();
 			this.showProperty();
 	//		if (this.currentSelected){
-	//			this.currentSelected.unSelected();		
+	//			this.currentSelected.unSelected();
 	//		} 
 		}
 	},
@@ -513,20 +513,57 @@ MWF.xApplication.process.ProcessDesigner.Process = new Class({
 		if (this.process.isNewProcess){
 			this.save();
 		}else{
+			var node = new Element("div", {"styles":this.designer.css.saveNewEditionNode});
+			var inforNode = new Element("div", {"html":this.designer.lp.upgradeInfor}).inject(node);
+			var descriptionNode = new Element("div", {"styles": this.designer.css.editionDescriptionNode}).inject(node);
+			var descriptionTitleNode = new Element("div", {"styles": this.designer.css.descriptionTitleNode, "text": this.designer.lp.editionDiscription}).inject(descriptionNode);
+			var descriptionTextAreaNode = new Element("textarea", {"styles": this.designer.css.descriptionTextAreaNode}).inject(descriptionNode);
+
 			var _self = this;
-			this.designer.confirm("infor", e, this.designer.lp.upgradeConfirm, {"html": this.designer.lp.upgradeInfor}, 520, 210, function(){
-				var checkbox = this.content.getElement("input");
-				var enable = (!!checkbox && checkbox.get("checked"));
-				_self.doSaveNewEdition(enable);
-				this.close();
-			}, function(){
-				this.close();
+			o2.DL.open({
+				"content": node,
+				"title": this.designer.lp.upgradeConfirm,
+				"offset": {"y": -100},
+				"height": 330,
+				"buttonList": [{
+					"type": "ok",
+					"text": this.designer.lp.ok,
+					"action": function(){
+						var textarea = this.content.getElement("textarea");
+						var discription = textarea.get("value");
+						if (!discription) {
+							_self.designer.notice(_self.designer.lp.inputDiscription, "error", descriptionNode);
+						}else{
+							var checkbox = this.content.getElement("input");
+							var enable = (!!checkbox && checkbox.get("checked"));
+
+							_self.doSaveNewEdition(enable, discription);
+							this.close();
+						}
+					}
+				},{
+					"text": this.designer.lp.cancel,
+					"action": function(){
+						this.close();
+					}
+				}]
 			});
+
+			// var _self = this;
+			// this.designer.confirm("infor", e, this.designer.lp.upgradeConfirm, {"html": this.designer.lp.upgradeInfor}, 520, 210, function(){
+			// 	var checkbox = this.content.getElement("input");
+			// 	var enable = (!!checkbox && checkbox.get("checked"));
+			// 	_self.doSaveNewEdition(enable);
+			// 	this.close();
+			// }, function(){
+			// 	this.close();
+			// });
 		}
 	},
-	doSaveNewEdition: function(enable){
+	doSaveNewEdition: function(enable, description){
 		debugger;
 		var process = Object.clone(this.process);
+		process.editionDes = description;
 		var oldIds = [];
 		oldIds.push(process.id);
 		if (process.begin) oldIds.push(process.begin.id);
@@ -572,6 +609,25 @@ MWF.xApplication.process.ProcessDesigner.Process = new Class({
 		}.bind(this));
 	},
 
+	listEdition: function(){
+		if (this.process.edition){
+			MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.EditionList", function(){
+				var list = new MWF.xApplication.process.ProcessDesigner.widget.EditionList(this.process.application, this.process.edition);
+				list.load();
+			}.bind(this));
+
+			// o2.Actions.load("x_processplatform_assemble_designer").ProcessAction.listEdition(this.process.application, this.process.edition, function(json){
+			// 	var editionList = json.data;
+			// 	this.listEditionDlg(json.data);
+			// }.bind(this));
+		}else{
+			this.designer.notice("infor", this.designer.lp.save_process);
+		}
+	},
+	listEditionDlg: function(editionList){
+
+		//var node = new Element("div", )
+	},
 
 	switchGrid: function(item){
 		if (this.isGrid){

+ 15 - 1
o2web/source/x_component_process_ProcessDesigner/lp/zh-cn.js

@@ -17,10 +17,13 @@ MWF.xApplication.process.ProcessDesigner.LP = {
     "selectScript": "点击选择脚本: ",
     "condition": "条件",
     "unCategory": "未分类",
+	"ok": "确定",
+	"cancel": "取消",
 
 	"notice":{
         "no_name": "请先输入流程名称",
 		"save_success": "流程保存成功!",
+		"save_process": "请先保存流程!",
 		"one_begin": "每个流程只允许有一个“开始”活动",
 		"deleteRoute": "您确定要删除选中的路由吗?",
 		"deleteRouteTitle": "删除路由确认",
@@ -119,7 +122,18 @@ MWF.xApplication.process.ProcessDesigner.LP = {
 	"enable": "已启用",
 	"notEnable": "未启用",
 	"currentEdition": "当前版本",
+	"editionUpdate": "最后修改",
+	"editionDiscription":"请输入版本描述",
 
 	"upgradeConfirm": "保存为新版本确认",
-	"upgradeInfor": "<div style='overflow: hidden; line-height: 26px'>您是否确定要将当前流程保存为新版?<br/>选中\"同时启用新版本\"在保存完成之后,会将新版本设置为启用版本.</div><div style='margin-top:10px'><input type='checkbox' checked>同时启用新版本</div>"
+	"upgradeInfor": "<div style='overflow: hidden; line-height: 26px'>您是否确定要将当前流程保存为新版?<br/>选中\"同时启用新版本\"在保存完成之后,会将新版本设置为启用版本.</div><div style='margin-top:10px'><input type='checkbox' checked>同时启用新版本</div>",
+	"inputDiscription": "请先输入版本描述",
+
+	"edition_list":{
+		"number": "版本号",
+		"update": "更新时间",
+		"updatePerson": "更新人",
+		"description": "版本描述"
+	}
+
 };

+ 36 - 0
o2web/source/x_component_process_ProcessDesigner/widget/$EditionList/default/css.wcss

@@ -0,0 +1,36 @@
+{
+    "node": {
+        "min-height": "300px",
+        "margin": "20px",
+        "min-width": "500px",
+        "height": "90%"
+    },
+    "leftNode": {
+        "height": "100%",
+        "float": "left",
+        "width": "60%"
+    },
+    "rightNode": {
+        "height": "100%",
+        "float": "right",
+        "width": "40%"
+    },
+    "listNode": {
+        "height": "100%",
+        "background-color": "#ffffff",
+        "border": "1px solid #cccccc"
+    },
+    "resizeNode": {
+        "float": "left",
+        "width": "10px",
+        "height": "100%",
+        "cursor": "col-resize"
+    },
+    "diffNode": {
+        "height": "100%",
+        "background-color": "#ffffff",
+        "border": "1px solid #cccccc",
+        "float-left": "20px",
+        "margin-left": "10px"
+    }
+}

+ 529 - 0
o2web/source/x_component_process_ProcessDesigner/widget/EditionList.js

@@ -0,0 +1,529 @@
+MWF.xApplication.process.ProcessDesigner.widget = MWF.xApplication.process.ProcessDesigner.widget || {};
+MWF.xApplication.process.ProcessDesigner.widget.EditionList = new Class({
+	Implements: [Options, Events],
+	Extends: MWF.widget.Common,
+	options: {
+		"style": "default"
+	},
+	initialize: function(application, edition, options){
+		this.setOptions(options);
+		this.application = application;
+        this.edition = edition;
+		this.path = "/x_component_process_ProcessDesigner/widget/$EditionList/";
+		this.cssPath = "/x_component_process_ProcessDesigner/widget/$EditionList/"+this.options.style+"/css.wcss";
+		this._loadCss();
+        this.selectedItem = null;
+        this.items = {};
+	},
+    load: function(){
+        o2.Actions.load("x_processplatform_assemble_designer").ProcessAction.listEdition(this.application, this.edition, function(json){
+            this.editionList = json.data;
+            this.listEditionDlg();
+        }.bind(this));
+
+        this.node = new Element("div", {"styles": this.css.node});
+        this.leftNode = new Element("div", {"styles": this.css.leftNode}).inject(this.node);
+        this.rightNode = new Element("div", {"styles": this.css.rightNode}).inject(this.node);
+
+        this.listNode = new Element("div", {"styles": this.css.listNode}).inject(this.leftNode);
+
+        this.resizeNode = new Element("div", {"styles": this.css.resizeNode}).inject(this.rightNode);
+        this.diffNode = new Element("div", {"styles": this.css.diffNode}).inject(this.rightNode);
+
+        this.show();
+    },
+    show: function(){
+	    if (!this.dlg){
+	        this.dlg = o2.DL.open({
+                "content": this.node,
+                "isMax": true,
+                "width": 700,
+                "height": 500,
+                "buttonList": [{
+                    "text": MWF.xApplication.process.ProcessDesigner.LP.ok,
+                    "action": function(){ this.close(); }
+                }]
+            });
+        }
+    },
+    listEditionDlg: function(){
+        this.editionList.each(function(edition){
+
+        }.bind(this));
+    },
+
+
+
+
+
+    loadSelectNode: function(){
+        this.getSerialRule(function(){
+            this.loadSelectNodeItems();
+            this.loadSelectedNodeItems();
+        }.bind(this));
+    },
+
+    loadSelectedNodeItems: function(){
+        this.data.each(function(itemData){
+            this.selectedItems.push(new MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem[itemData.key.capitalize()](this.items[itemData.key], itemData));
+        }.bind(this));
+        this.fireEvent("change");
+    },
+
+    loadSelectNodeItems: function(){
+        Object.each(this.serialRuleJson, function(v, k){
+            this.loadSelectNodeItem(v, k);
+        }.bind(this));
+    },
+
+    loadSelectNodeItem: function(v, k){
+        this.items[k] = new MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.Item(v, k, this);
+    },
+
+    getSerialRule: function(callback){
+        if (!this.serialRuleJson){
+            var serialConifgUrl = "/x_component_process_ProcessDesigner/$Process/serialRule.json";
+            MWF.getJSON(serialConifgUrl, function(json){
+                this.serialRuleJson = json;
+                if (callback) callback();
+            }.bind(this));
+        }else{
+            if (callback) callback();
+        }
+    },
+    getData: function(){
+        var data = [];
+        this.selectedItems.each(function(item){
+            data.push(item.getData());
+        });
+        this.data = data;
+        return data;
+    }
+});
+
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.Item = new Class({
+    initialize: function(value, key, editor){
+        this.editor = editor;
+        this.json = value;
+        this.key = key;
+        this.css = this.editor.css;
+        this.load();
+    },
+    load: function(){
+        this.node = new Element("div", {"styles": this.css.itemNode}).inject(this.editor.selectNode);
+        this.iconNode = new Element("div", {"styles": this.css.itemIconNode}).inject(this.node);
+        this.textNode = new Element("div", {"styles": this.css.itemTextNode}).inject(this.node);
+
+
+        this.textNode.set({
+            "text": this.json.text,
+            "title": this.json.description
+        });
+        this.node.addEvents({
+            "mouseover": function(){this.node.setStyles(this.css.itemNode_over); this.iconNode.setStyles(this.css.itemIconNode_over);}.bind(this),
+            "mouseout": function(){this.node.setStyles(this.css.itemNode); this.iconNode.setStyles(this.css.itemIconNode);}.bind(this),
+            "click": function(){this.selectNumberItem();}.bind(this)
+        });
+    },
+    selectNumberItem: function(){
+        this.editor.selectedItems.push(new MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem[this.key.capitalize()](this));
+        this.editor.fireEvent("change");
+    }
+});
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem = new Class({
+    initialize: function(item, itemData){
+        this.item = item;
+        this.json = item.json;
+        this.key = item.key;
+        this.editor = item.editor;
+        this.css = this.editor.css;
+        this.data = itemData;
+        this.load();
+    },
+    load: function(){
+        this.node = new Element("div", {"styles": this.css.selectedItemNode}).inject(this.editor.showNode);
+
+        this.textNode = new Element("div", {"styles": this.css.selectedItemTextNode}).inject(this.node);
+        this.textNode.set({
+            "text": this.json.text,
+            "title": this.json.description
+        });
+
+        this.node.addEvents({
+            "mouseover": function(){
+                if (this.editor.currentItem!=this) this.node.setStyles(this.css.selectedItemNode_over);
+            }.bind(this),
+            "mouseout": function(){
+                if (this.editor.currentItem!=this) this.node.setStyles(this.css.selectedItemNode);
+            }.bind(this),
+
+            "click": function(){this.selectItem();}.bind(this)
+        });
+
+        this.closeNode = new Element("div", {"styles": this.css.selectedItemCloseNode}).inject(this.node);
+        this.closeNode.addEvent("click", function(){
+            this.deleteItem();
+        }.bind(this));
+
+        this.loadProperty();
+        this.selectItem();
+    },
+    loadProperty: function(){},
+
+    deleteItem: function(){
+        this.node.destroy();
+        if (this.propertyNode) this.propertyNode.destroy();
+        this.editor.selectedItems.erase(this);
+        if (this.editor.currentItem === this) this.editor.currentItem = null;
+        this.editor.fireEvent("change");
+        MWF.release(this);
+    },
+    selectItem: function(){
+        if (this.editor.currentItem) this.editor.currentItem.unSelectItem();
+        if (this.propertyNode){
+            this.propertyNode.setStyle("display", "block");
+            if (this.key==="number"){
+                this.loadNumberBy();
+            }
+        }
+        this.node.setStyles(this.css.selectedItemNode_check);
+        this.editor.currentItem = this;
+    },
+    unSelectItem: function(){
+        this.node.setStyles(this.css.selectedItemNode);
+        if (this.propertyNode) this.propertyNode.setStyle("display", "none");
+        this.editor.currentItem = null;
+    }
+});
+
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Text = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem,
+
+    loadProperty: function(){
+        this.propertyNode = new Element("div", {"styles": this.css.itemPropertyNode}).inject(this.editor.propertyNode);
+        this.propertyTitleNode = new Element("div", {"styles": this.css.propertyTitleNode}).inject(this.propertyNode);
+        this.propertyTitleNode.set("text", MWF.xApplication.process.ProcessDesigner.LP.serialTextTitle);
+        this.propertyInputDivNode = new Element("div", {"styles": this.css.propertyInputDivNode}).inject(this.propertyNode);
+        this.propertyInputNode = new Element("input", {
+            "type": "text",
+            "value": (this.data) ? this.data.value: "",
+            "styles": this.css.propertyInputNode
+        }).inject(this.propertyInputDivNode);
+        this.changeText();
+
+        this.propertyInputNode.addEvents({
+            "change": function(){
+                this.changeText();
+            }.bind(this),
+            "blur": function(){},
+        });
+    },
+    changeText: function(){
+        var value = this.propertyInputNode.get("value");
+        if (value){
+            this.textNode.set("text", "\""+value+"\"");
+        }else{
+            this.textNode.set("text", this.json.text);
+        }
+        this.editor.fireEvent("change");
+    },
+    getData: function(){
+        var value = this.propertyInputNode.get("value");
+        var key = this.key;
+        var script = "return serial.text(\""+value+"\")";
+        return {
+            "key": key,
+            "value": value,
+            "script": script
+        }
+    }
+});
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Year = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem,
+    loadProperty: function(){
+        this.value = "created";
+        var i = Math.random();
+        this.propertyNode = new Element("div", {"styles": this.css.itemPropertyNode}).inject(this.editor.propertyNode);
+        var propertyTitleNode = new Element("div", {"styles": this.css.propertyTitleNode}).inject(this.propertyNode);
+        propertyTitleNode.set("text", MWF.xApplication.process.ProcessDesigner.LP.serialDateTitle);
+        var propertyInputDivNode = new Element("div", {"styles": this.css.propertyInputDivNode}).inject(this.propertyNode);
+
+        var v = (this.data) ? this.data.value: "created";
+        html = "<input name=\"serialDateSelect"+i+"\" "+((v=="created") ? "checked" : "")+" type=\"radio\" value=\"created\"/>" + MWF.xApplication.process.ProcessDesigner.LP.serialCreatedDateTitle;
+        html += "<input name=\"serialDateSelect"+i+"\" "+((v=="current") ? "checked" : "")+" type=\"radio\" value=\"current\"/>" + MWF.xApplication.process.ProcessDesigner.LP.serialCurrentDateTitle;
+        propertyInputDivNode.set("html", html);
+        this.changeText((this.data) ? this.data.value: "created");
+        propertyInputDivNode.getElements("input").addEvent("click", function(e){
+            if (e.target.checked){
+                var v = e.target.get("value");
+                this.changeText(v);
+            }
+        }.bind(this));
+    },
+    changeText: function(v){
+        var text = MWF.xApplication.process.ProcessDesigner.LP.serialCreated;
+        if (v=="current"){
+            text = MWF.xApplication.process.ProcessDesigner.LP.serialCurrent;
+        }
+        this.value = v;
+        this.textNode.set("text", this.json.text+"("+text+")");
+        this.editor.fireEvent("change");
+    },
+    getData: function(){
+        var key = this.key;
+        var f = (this.value=="current") ? "year" : "createYear";
+        var script = "return serial."+f+"(\"yyyy\")";
+        return {
+            "key": key,
+            "value": this.value,
+            "script": script
+        }
+    }
+});
+
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Month = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Year,
+    getData: function(){
+        var key = this.key;
+        var f = (this.value=="current") ? "month" : "createMonth";
+        var script = "return serial."+f+"(\"MM\")";
+        return {
+            "key": key,
+            "value": this.value,
+            "script": script
+        }
+    }
+});
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Day = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Year,
+    getData: function(){
+        var key = this.key;
+        var f = (this.value=="current") ? "day" : "createDay";
+        var script = "return serial."+f+"(\"dd\")";
+        return {
+            "key": key,
+            "value": this.value,
+            "script": script
+        }
+    }
+});
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Company = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem,
+    getData: function(){
+        var key = this.key;
+        var script = "return serial.company()";
+        return {
+            "key": key,
+            "value": "",
+            "script": script
+        }
+    }
+});
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Department = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem,
+    getData: function(){
+        var key = this.key;
+        var script = "return serial.department()";
+        return {
+            "key": key,
+            "value": "",
+            "script": script
+        }
+    }
+});
+
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.CompanyAttribute = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem,
+
+    loadProperty: function(){
+        this.propertyNode = new Element("div", {"styles": this.css.itemPropertyNode}).inject(this.editor.propertyNode);
+        this.propertyTitleNode = new Element("div", {"styles": this.css.propertyTitleNode}).inject(this.propertyNode);
+        this.propertyTitleNode.set("text", MWF.xApplication.process.ProcessDesigner.LP.serialAttributeTitle);
+        this.propertyInputDivNode = new Element("div", {"styles": this.css.propertyInputDivNode}).inject(this.propertyNode);
+        this.propertyInputNode = new Element("input", {
+            "type": "text",
+            "value": (this.data) ? this.data.value: "",
+            "styles": this.css.propertyInputNode
+        }).inject(this.propertyInputDivNode);
+        this.changeText();
+
+        this.propertyInputNode.addEvents({
+            "change": function(){
+                this.changeText();
+            }.bind(this),
+            "blur": function(){},
+        });
+    },
+    changeText: function(){
+        var value = this.propertyInputNode.get("value");
+        if (value){
+            this.textNode.set("text", this.json.text+"("+value+")");
+        }else{
+            this.textNode.set("text", this.json.text);
+        }
+        this.editor.fireEvent("change");
+    },
+    getData: function(){
+        var value = this.propertyInputNode.get("value");
+        var key = this.key;
+        var script = "return serial.companyAttribute(\""+value+"\")";
+        return {
+            "key": key,
+            "value": value,
+            "script": script
+        }
+    }
+});
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.DepartmentAttribute = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.CompanyAttribute,
+    getData: function(){
+        var value = this.propertyInputNode.get("value");
+        var key = this.key;
+        var script = "return serial.departmentAttribute(\""+value+"\")";
+        return {
+            "key": key,
+            "value": value,
+            "script": script
+        }
+    }
+});
+
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Number = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem,
+    loadProperty: function(){
+        this.propertyNode = new Element("div", {"styles": this.css.itemPropertyNode}).inject(this.editor.propertyNode);
+
+        var lineNode = new Element("div", {"styles": this.css.lineNode}).inject(this.propertyNode);
+        var propertyTitleNode = new Element("div", {"styles": this.css.propertyTitleNode}).inject(lineNode);
+        propertyTitleNode.set("text", MWF.xApplication.process.ProcessDesigner.LP.serialNumberByTitle);
+        this.propertyNumberByDivNode = new Element("div", {"styles": this.css.propertyInputDivNode}).inject(lineNode);
+        this.loadNumberBy();
+
+        lineNode = new Element("div", {"styles": this.css.lineNode}).inject(this.propertyNode);
+        propertyTitleNode = new Element("div", {"styles": this.css.propertyTitleNode}).inject(lineNode);
+        propertyTitleNode.set("text", MWF.xApplication.process.ProcessDesigner.LP.serialNumberLongTitle);
+        this.propertyInputDivNode = new Element("div", {"styles": this.css.propertyInputDivNode}).inject(lineNode);
+        this.propertyInputNode = new Element("select").inject(this.propertyInputDivNode);
+        var value = (this.data) ? this.data.value: {};
+        var numberLong = value.lng || 0;
+        var optionsHtml = "<option "+((numberLong==0) ? "selected": "")+" value=\"0\">auto</option>";
+        optionsHtml += "<option "+((numberLong==2) ? "selected": "")+" value=\"2\">2</option>";
+        optionsHtml += "<option "+((numberLong==3) ? "selected": "")+" value=\"3\">3</option>";
+        optionsHtml += "<option "+((numberLong==4) ? "selected": "")+" value=\"4\">4</option>";
+        optionsHtml += "<option "+((numberLong==5) ? "selected": "")+" value=\"5\">5</option>";
+        optionsHtml += "<option "+((numberLong==6) ? "selected": "")+" value=\"6\">6</option>";
+        optionsHtml += "<option "+((numberLong==7) ? "selected": "")+" value=\"7\">7</option>";
+        optionsHtml += "<option "+((numberLong==8) ? "selected": "")+" value=\"8\">8</option>";
+        optionsHtml += "<option "+((numberLong==9) ? "selected": "")+" value=\"9\">9</option>";
+        this.propertyInputNode.set("html", optionsHtml);
+        this.propertyInputNode.addEvents({
+            "change": function(){
+                this.editor.fireEvent("change");
+            }.bind(this)
+        });
+
+    },
+    loadNumberBy: function(){
+        this.propertyNumberByDivNode.empty();
+        var i = Math.random();
+
+        var value = (this.data) ? this.data.value: {};
+        var numberBy = value.by || [];
+
+        var html = "";
+        this.editor.selectedItems.each(function(item, n){
+            if (item.key!="number"){
+                var check = (numberBy.indexOf(n)==-1)? "" : "checked"
+                html += "<input "+check+" name=\"serialNumberBySelect"+i+"\" type=\"checkbox\" value=\""+n+"\"/>" + item.json.text;
+            }
+        });
+        this.propertyNumberByDivNode.set("html", html);
+        this.propertyNumberByDivNode.getElements("input").addEvent("click", function(e){
+            this.editor.fireEvent("change");
+        }.bind(this));
+
+    },
+    getData: function(){
+        var numberLong = this.propertyInputNode.options[this.propertyInputNode.selectedIndex].value;
+        var numberBy = [];
+        var inputs = this.propertyNumberByDivNode.getElements("input");
+        inputs.each(function(input){
+            if (input.checked) numberBy.push(input.get("value").toInt());
+        }.bind(this));
+        var value = {"lng": numberLong, "by": numberBy};
+        var code = "return serial.nextSerialNumber("+JSON.encode(numberBy)+", "+numberLong+")"
+
+        return {
+            "key": this.key,
+            "value": value,
+            "script": code
+        }
+    }
+
+});
+
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Script = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem,
+    loadProperty: function(){
+        debugger;
+        this.code = (this.data) ? this.data.value: "";
+        this.propertyNode = new Element("div", {"styles": this.css.itemPropertyNode}).inject(this.editor.propertyNode);
+        this.scriptNode = new Element("div", {"styles": this.css.scriptNode}).inject(this.propertyNode);
+        this.scriptNode.set("title", MWF.xApplication.process.ProcessDesigner.LP.serialScriptTitle);
+
+        this.scriptArea = new MWF.xApplication.process.ProcessDesigner.widget.ScriptText(this.scriptNode, (this.data) ? this.data.value: "", this.editor.process.designer, {
+            "maskNode": this.editor.process.designer.content,
+            "maxObj": this.editor.process.designer.paperNode,
+            "onChange": function(code){
+                this.code = code;
+                this.editor.fireEvent("change");
+            }.bind(this)
+        });
+    },
+    getData: function(){
+        var value = this.code;
+        var key = this.key;
+        return {
+            "key": key,
+            "value": value,
+            "script": value
+        }
+    }
+});
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Unit = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem,
+    getData: function(){
+        var key = this.key;
+        var script = "return serial.unit()";
+        return {
+            "key": key,
+            "value": "",
+            "script": script
+        }
+    }
+});
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.Unit = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem,
+    getData: function(){
+        var key = this.key;
+        var script = "return serial.unit()";
+        return {
+            "key": key,
+            "value": "",
+            "script": script
+        }
+    }
+});
+MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.UnitAttribute = new Class({
+    Extends: MWF.xApplication.process.ProcessDesigner.widget.SerialEditor.SelectedItem.CompanyAttribute,
+    getData: function(){
+        var value = this.propertyInputNode.get("value");
+        var key = this.key;
+        var script = "return serial.unitAttribute(\""+value+"\")";
+        return {
+            "key": key,
+            "value": value,
+            "script": script
+        }
+    }
+});