|
@@ -16,28 +16,26 @@ MWF.xApplication.Selector.FormStyle = new Class({
|
|
|
var stylesUrl = "../x_component_process_FormDesigner/Module/Form/skin/config.json";
|
|
var stylesUrl = "../x_component_process_FormDesigner/Module/Form/skin/config.json";
|
|
|
MWF.getJSON(stylesUrl,{
|
|
MWF.getJSON(stylesUrl,{
|
|
|
"onSuccess": function(json){
|
|
"onSuccess": function(json){
|
|
|
- var category = this._newItemCategory({
|
|
|
|
|
- name : "系统样式",
|
|
|
|
|
- id : "stystem"
|
|
|
|
|
- }, this, this.itemAreaNode);
|
|
|
|
|
|
|
+ debugger;
|
|
|
|
|
+ var subItemList = [];
|
|
|
Object.each(json, function(s, key){
|
|
Object.each(json, function(s, key){
|
|
|
if( s.mode.contains( this.options.mode ) ){
|
|
if( s.mode.contains( this.options.mode ) ){
|
|
|
- var d = {
|
|
|
|
|
|
|
+ subItemList.push({
|
|
|
name : s.name,
|
|
name : s.name,
|
|
|
id : key
|
|
id : key
|
|
|
- };
|
|
|
|
|
- var item = this._newItem(d, this, category.children);
|
|
|
|
|
- this.items.push(item);
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
-
|
|
|
|
|
var category = this._newItemCategory({
|
|
var category = this._newItemCategory({
|
|
|
- name : "脚本",
|
|
|
|
|
- id : "script"
|
|
|
|
|
|
|
+ name : "系统样式",
|
|
|
|
|
+ id : "stystem",
|
|
|
|
|
+ subItemList : subItemList
|
|
|
}, this, this.itemAreaNode);
|
|
}, this, this.itemAreaNode);
|
|
|
|
|
|
|
|
var json = {};
|
|
var json = {};
|
|
|
var appJs = {};
|
|
var appJs = {};
|
|
|
|
|
+ var array = [];
|
|
|
o2.Actions.load("x_processplatform_assemble_designer").ScriptAction.listNext("(0)", 500, function (scriptJson) {
|
|
o2.Actions.load("x_processplatform_assemble_designer").ScriptAction.listNext("(0)", 500, function (scriptJson) {
|
|
|
o2.Actions.load("x_processplatform_assemble_designer").ApplicationAction.list(function (appJson) {
|
|
o2.Actions.load("x_processplatform_assemble_designer").ApplicationAction.list(function (appJson) {
|
|
|
appJson.data.each( function (app) {
|
|
appJson.data.each( function (app) {
|
|
@@ -54,12 +52,16 @@ MWF.xApplication.Selector.FormStyle = new Class({
|
|
|
json[script.application].scriptList.push( script )
|
|
json[script.application].scriptList.push( script )
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
for( var application in json ){
|
|
for( var application in json ){
|
|
|
- var category = this._newItemCategory(json[application], this, category.children);
|
|
|
|
|
- json[application].scriptList.each(function(d){
|
|
|
|
|
- var item = this._newItem(d, this, category.children);
|
|
|
|
|
- this.items.push(item);
|
|
|
|
|
- }.bind(this));
|
|
|
|
|
|
|
+ if( json[application].scriptList && json[application].scriptList.length ){
|
|
|
|
|
+ array.push( json[application] );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ var category = this._newItemCategory({
|
|
|
|
|
+ name : "自定义样式(脚本)",
|
|
|
|
|
+ id : "script",
|
|
|
|
|
+ applicationList : array
|
|
|
|
|
+ }, this, this.itemAreaNode);
|
|
|
}.bind(this))
|
|
}.bind(this))
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
}.bind(this)
|
|
}.bind(this)
|
|
@@ -87,7 +89,7 @@ MWF.xApplication.Selector.FormStyle = new Class({
|
|
|
return true;
|
|
return true;
|
|
|
},
|
|
},
|
|
|
_getChildrenItemIds: function(data){
|
|
_getChildrenItemIds: function(data){
|
|
|
- return data.scriptList || [];
|
|
|
|
|
|
|
+ return data.scriptList || data.subItemList || data.applicationList;
|
|
|
},
|
|
},
|
|
|
_newItemCategory: function(data, selector, item, level){
|
|
_newItemCategory: function(data, selector, item, level){
|
|
|
return new MWF.xApplication.Selector.FormStyle.ItemCategory(data, selector, item, level)
|
|
return new MWF.xApplication.Selector.FormStyle.ItemCategory(data, selector, item, level)
|
|
@@ -143,8 +145,6 @@ MWF.xApplication.Selector.FormStyle.Item = new Class({
|
|
|
var selectedItem = this.selector.selectedItems.filter(function(item, index){
|
|
var selectedItem = this.selector.selectedItems.filter(function(item, index){
|
|
|
if( item.data.id && this.data.id){
|
|
if( item.data.id && this.data.id){
|
|
|
return item.data.id === this.data.id;
|
|
return item.data.id === this.data.id;
|
|
|
- }else{
|
|
|
|
|
- return item.data.name === this.data.name;
|
|
|
|
|
}
|
|
}
|
|
|
//return (item.data.id === this.data.id) || (item.data.name === this.data.name);
|
|
//return (item.data.id === this.data.id) || (item.data.name === this.data.name);
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
@@ -171,8 +171,6 @@ MWF.xApplication.Selector.FormStyle.ItemSelected = new Class({
|
|
|
//return (item.data.id === this.data.id) || (item.data.name === this.data.name);
|
|
//return (item.data.id === this.data.id) || (item.data.name === this.data.name);
|
|
|
if( item.data.id && this.data.id){
|
|
if( item.data.id && this.data.id){
|
|
|
return item.data.id === this.data.id;
|
|
return item.data.id === this.data.id;
|
|
|
- }else{
|
|
|
|
|
- return item.data.name === this.data.name;
|
|
|
|
|
}
|
|
}
|
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
this.items = items;
|
|
this.items = items;
|
|
@@ -188,9 +186,69 @@ MWF.xApplication.Selector.FormStyle.ItemSelected = new Class({
|
|
|
|
|
|
|
|
MWF.xApplication.Selector.FormStyle.ItemCategory = new Class({
|
|
MWF.xApplication.Selector.FormStyle.ItemCategory = new Class({
|
|
|
Extends: MWF.xApplication.Selector.Person.ItemCategory,
|
|
Extends: MWF.xApplication.Selector.Person.ItemCategory,
|
|
|
|
|
+ clickItem: function (callback) {
|
|
|
|
|
+ if (this._hasChild() ) {
|
|
|
|
|
+ var firstLoaded = !this.loaded;
|
|
|
|
|
+ this.loadSub(function () {
|
|
|
|
|
+ if (firstLoaded && this._hasChild() ) {
|
|
|
|
|
+ if (!this.selector.isFlatCategory) {
|
|
|
|
|
+ this.children.setStyles({"display": "block", "height": "auto"});
|
|
|
|
|
+ this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_expand);
|
|
|
|
|
+ this.isExpand = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // this.checkSelectAll();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ var display = this.children.getStyle("display");
|
|
|
|
|
+ if (display === "none") {
|
|
|
|
|
+ // this.selector.fireEvent("expand", [this] );
|
|
|
|
|
+ this.children.setStyles({"display": "block", "height": "auto"});
|
|
|
|
|
+ this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_expand);
|
|
|
|
|
+ this.isExpand = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // this.selector.fireEvent("collapse", [this] );
|
|
|
|
|
+ this.children.setStyles({"display": "none", "height": "0px"});
|
|
|
|
|
+ this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_collapse);
|
|
|
|
|
+ this.isExpand = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (callback) callback();
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ loadSub: function (callback) {
|
|
|
|
|
+ if (!this.loaded) {
|
|
|
|
|
+ if( this.data.subItemList ){
|
|
|
|
|
+ this.data.subItemList.each(function (subItem, index) {
|
|
|
|
|
+ var item = this.selector._newItem(subItem, this.selector, this.children, this.level + 1, this);
|
|
|
|
|
+ this.selector.items.push(item);
|
|
|
|
|
+ if(this.subItems)this.subItems.push( item );
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ }
|
|
|
|
|
+ if( this.data.scriptList ){
|
|
|
|
|
+ this.data.scriptList.each(function (subItem, index) {
|
|
|
|
|
+ var item = this.selector._newItem(subItem, this.selector, this.children, this.level + 1, this);
|
|
|
|
|
+ this.selector.items.push(item);
|
|
|
|
|
+ if(this.subItems)this.subItems.push( item );
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( this.data.applicationList ) {
|
|
|
|
|
+ this.data.applicationList.each(function (subCategory, index) {
|
|
|
|
|
+ var category = this.selector._newItemCategory(subCategory, this.selector, this.children, this.level + 1, this);
|
|
|
|
|
+ this.subCategorys.push( category );
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ }
|
|
|
|
|
+ this.loaded = true;
|
|
|
|
|
+ if (callback) callback();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (callback) callback();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
_getShowName: function(){
|
|
_getShowName: function(){
|
|
|
return this.data.name;
|
|
return this.data.name;
|
|
|
},
|
|
},
|
|
|
|
|
+ _getTtiteText: function () {
|
|
|
|
|
+ return this.data.name;
|
|
|
|
|
+ },
|
|
|
createNode: function(){
|
|
createNode: function(){
|
|
|
this.node = new Element("div", {
|
|
this.node = new Element("div", {
|
|
|
"styles": this.selector.css.selectorItemCategory_department
|
|
"styles": this.selector.css.selectorItemCategory_department
|
|
@@ -200,7 +258,14 @@ MWF.xApplication.Selector.FormStyle.ItemCategory = new Class({
|
|
|
this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/default/icon/applicationicon.png)");
|
|
this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/default/icon/applicationicon.png)");
|
|
|
},
|
|
},
|
|
|
_hasChild: function(){
|
|
_hasChild: function(){
|
|
|
- return (this.data.scriptList && this.data.scriptList.length);
|
|
|
|
|
|
|
+ return ( this.data.scriptList && this.data.scriptList.length ) ||
|
|
|
|
|
+ ( this.data.subItemList && this.data.subItemList.length) ||
|
|
|
|
|
+ ( this.data.applicationList && this.data.applicationList.length);
|
|
|
|
|
+ },
|
|
|
|
|
+ afterLoad: function(){
|
|
|
|
|
+ if ( this._hasChild() ){
|
|
|
|
|
+ this.clickItem();
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
check: function(){}
|
|
check: function(){}
|
|
|
});
|
|
});
|