|
|
@@ -69,6 +69,20 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
},
|
|
|
parseData: function(){
|
|
|
this.json = this.data;
|
|
|
+ if( !this.json.data.events ){
|
|
|
+ var url = "/x_component_query_ViewDesigner/$View/view.json";
|
|
|
+ MWF.getJSON(url, {
|
|
|
+ "onSuccess": function(obj){
|
|
|
+ this.json.data.events = obj.data.events;
|
|
|
+ }.bind(this),
|
|
|
+ "onerror": function(text){
|
|
|
+ this.notice(text, "error");
|
|
|
+ }.bind(this),
|
|
|
+ "onRequestFailure": function(xhr){
|
|
|
+ this.notice(xhr.responseText, "error");
|
|
|
+ }.bind(this)
|
|
|
+ },false);
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
showProperty: function(){
|
|
|
@@ -107,6 +121,8 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
|
|
|
this.domListNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.designer.propertyDomArea);
|
|
|
|
|
|
+ this.loadActionbar();
|
|
|
+
|
|
|
this.loadView();
|
|
|
|
|
|
this.selected();
|
|
|
@@ -140,6 +156,7 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
|
|
|
this.designer.actions.loadView(this.data.id, null,function(json){
|
|
|
var entries = {};
|
|
|
+
|
|
|
json.data.selectList.each(function(entry){entries[entry.column] = entry;}.bind(this));
|
|
|
|
|
|
if (this.json.data.group.column){
|
|
|
@@ -154,7 +171,7 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
|
|
|
json.data.groupGrid.each(function(line, idx){
|
|
|
var groupTr = new Element("tr", {"styles": this.css.viewContentTrNode}).inject(this.viewContentTableNode);
|
|
|
- var colSpan = this.items.length;
|
|
|
+ var colSpan = this.items.length + 1 ;
|
|
|
var td = new Element("td", {"styles": this.css.viewContentGroupTdNode, "colSpan": colSpan}).inject(groupTr);
|
|
|
var groupAreaNode = new Element("div", {"styles": this.css.viewContentTdGroupNode}).inject(td);
|
|
|
var groupIconNode = new Element("div", {"styles": this.css.viewContentTdGroupIconNode}).inject(groupAreaNode);
|
|
|
@@ -172,6 +189,9 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
line.list.each(function(entry){
|
|
|
var tr = new Element("tr", {"styles": this.css.viewContentTrNode}).inject(this.viewContentTableNode);
|
|
|
tr.setStyle("display", "none");
|
|
|
+
|
|
|
+ //this.createViewCheckboxTd( tr );
|
|
|
+
|
|
|
var td = new Element("td", {"styles": this.css.viewContentTdNode}).inject(tr);
|
|
|
|
|
|
Object.each(entries, function(c, k){
|
|
|
@@ -228,6 +248,8 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
json.data.grid.each(function(line, idx){
|
|
|
var tr = new Element("tr", {"styles": this.css.viewContentTrNode}).inject(this.viewContentTableNode);
|
|
|
|
|
|
+ //this.createViewCheckboxTd( tr );
|
|
|
+
|
|
|
Object.each(entries, function(c, k){
|
|
|
var d = line.data[k];
|
|
|
if (d!=undefined){
|
|
|
@@ -401,7 +423,8 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
setContentHeight: function(){
|
|
|
var size = this.areaNode.getSize();
|
|
|
var titleSize = this.viewTitleNode.getSize();
|
|
|
- var height = size.y-titleSize.y-2;
|
|
|
+ var actionbarSize = this.actionbarNode ? this.actionbarNode.getSize() : {x:0, y:0};
|
|
|
+ var height = size.y-titleSize.y-actionbarSize.y-2;
|
|
|
|
|
|
this.viewContentScrollNode.setStyle("height", height);
|
|
|
|
|
|
@@ -415,20 +438,72 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
},
|
|
|
|
|
|
loadViewColumns: function(){
|
|
|
- // for (var i=0; i<10; i++){
|
|
|
+ // for (var i=0; i<10; i++){
|
|
|
if (this.json.data.selectList) {
|
|
|
this.json.data.selectList.each(function (json) {
|
|
|
this.items.push(new MWF.xApplication.query.ViewDesigner.View.Column(json, this));
|
|
|
|
|
|
}.bind(this));
|
|
|
}
|
|
|
- // }
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ loadViewSelectAllNode : function(){
|
|
|
+ var _self = this;
|
|
|
+ var td = new Element("td.viewTitleCheckboxTd",{ "styles": this.css.viewTitleColumnAreaNode }).inject( this.viewTitleTrNode );
|
|
|
+ td.setStyles({
|
|
|
+ "width":"30px", "text-align" : "center",
|
|
|
+ "display" : this.json.data.selectAllEnable ? "table-cell" : "none"
|
|
|
+ });
|
|
|
+ new Element("input",{
|
|
|
+ "type" : "checkbox",
|
|
|
+ "events" : {
|
|
|
+ "change" : function(){
|
|
|
+ _self.viewContentTableNode.getElements(".viewContentCheckbox").set("checked", this.checked )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).inject(td);
|
|
|
+ },
|
|
|
+ createViewCheckboxTd : function( tr ){
|
|
|
+ var td = new Element("td.viewContentCheckboxTd", {"styles": this.css.viewContentTdNode}).inject(tr, "top");
|
|
|
+ td.setStyles({
|
|
|
+ "width":"30px", "text-align" : "center",
|
|
|
+ "display" : this.json.data.selectAllEnable ? "table-cell" : "none"
|
|
|
+ });
|
|
|
+ new Element("input.viewContentCheckbox",{
|
|
|
+ "type" : "checkbox"
|
|
|
+ }).inject(td);
|
|
|
},
|
|
|
loadView: function(){
|
|
|
this.loadViewNodes();
|
|
|
+ //this.loadViewSelectAllNode();
|
|
|
this.loadViewColumns();
|
|
|
// this.addTopItemNode.addEvent("click", this.addTopItem.bind(this));
|
|
|
},
|
|
|
+ loadActionbar: function(){
|
|
|
+ this.actionbarNode = new Element("div#actionbarNode", {"styles": this.css.actionbarNode}).inject(this.areaNode);
|
|
|
+ this.actionbarList = [];
|
|
|
+ if( !this.json.data.actionbarHidden ){
|
|
|
+ this.showActionbar( true );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ hideActionbar : function(){
|
|
|
+ this.actionbarNode.hide();
|
|
|
+ this.setContentHeight();
|
|
|
+ },
|
|
|
+ showActionbar : function( noSetHeight ){
|
|
|
+ this.actionbarNode.show();
|
|
|
+ if( !this.json.data.actionbarList )this.json.data.actionbarList = [];
|
|
|
+ if( !this.actionbarList || this.actionbarList.length == 0 ){
|
|
|
+ if( this.json.data.actionbarList.length ){
|
|
|
+ this.json.data.actionbarList.each( function(json){
|
|
|
+ this.actionbarList.push( new MWF.xApplication.query.ViewDesigner.View.Actionbar( json, this.json.data.actionbarList, this) )
|
|
|
+ }.bind(this));
|
|
|
+ }else{
|
|
|
+ this.actionbarList.push( new MWF.xApplication.query.ViewDesigner.View.Actionbar( null, this.json.data.actionbarList, this) )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( !noSetHeight )this.setContentHeight();
|
|
|
+ },
|
|
|
setViewWidth: function(){
|
|
|
this.viewAreaNode.setStyle("width", "auto");
|
|
|
this.viewTitleNode.setStyle("width", "auto");
|
|
|
@@ -494,10 +569,10 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
},
|
|
|
save: function(callback){
|
|
|
//if (this.designer.tab.showPage==this.page){
|
|
|
- if (!this.data.name){
|
|
|
- this.designer.notice(this.designer.lp.notice.inputName, "error");
|
|
|
- return false;
|
|
|
- }
|
|
|
+ if (!this.data.name){
|
|
|
+ this.designer.notice(this.designer.lp.notice.inputName, "error");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
//}
|
|
|
this.designer.actions.saveView(this.data, function(json){
|
|
|
this.designer.notice(this.designer.lp.notice.save_success, "success", this.node, {"x": "left", "y": "bottom"});
|
|
|
@@ -528,6 +603,22 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
}
|
|
|
}.bind(this));
|
|
|
}
|
|
|
+ if( name=="data.actionbarHidden" ){
|
|
|
+ if( this.json.data.actionbarHidden ){
|
|
|
+ this.hideActionbar()
|
|
|
+ }else{
|
|
|
+ this.showActionbar()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( name=="data.selectAllEnable" ){
|
|
|
+ if( this.json.data.selectAllEnable ){
|
|
|
+ this.viewTitleTrNode.getElement(".viewTitleCheckboxTd").setStyle("display","table-cell");
|
|
|
+ this.viewContentTableNode.getElements(".viewContentCheckboxTd").setStyle("display","table-cell");
|
|
|
+ }else{
|
|
|
+ this.viewTitleTrNode.getElement(".viewTitleCheckboxTd").setStyle("display","none");
|
|
|
+ this.viewContentTableNode.getElements(".viewContentCheckboxTd").setStyle("display","none");
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
saveAs: function(){
|
|
|
@@ -594,16 +685,16 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
|
|
|
|
|
|
|
|
|
MWF.xApplication.query.ViewDesigner.View.Column = new Class({
|
|
|
- initialize: function(json, view, next){
|
|
|
+ initialize: function(json, view, next){
|
|
|
this.propertyPath = "/x_component_query_ViewDesigner/$View/column.html";
|
|
|
- this.view = view;
|
|
|
+ this.view = view;
|
|
|
this.json = json;
|
|
|
this.next = next;
|
|
|
this.css = this.view.css;
|
|
|
this.content = this.view.viewTitleTrNode;
|
|
|
this.domListNode = this.view.domListNode;
|
|
|
this.load();
|
|
|
- },
|
|
|
+ },
|
|
|
load: function(){
|
|
|
this.areaNode = new Element("td", {"styles": this.css.viewTitleColumnAreaNode});
|
|
|
this.areaNode.store("column", this);
|
|
|
@@ -966,4 +1057,615 @@ MWF.xApplication.query.ViewDesigner.View.Column = new Class({
|
|
|
|
|
|
});
|
|
|
|
|
|
+MWF.require("MWF.widget.Toolbar", null, false);
|
|
|
+MWF.xApplication.query.ViewDesigner.View.Actionbar = new Class({
|
|
|
+ Implements: [Options, Events],
|
|
|
+ options : {
|
|
|
+ "style" : "default",
|
|
|
+ "customImageStyle" : "default"
|
|
|
+ },
|
|
|
+ initialize: function(json, jsonList, view, options){
|
|
|
+ this.setOptions( options );
|
|
|
+ this.propertyPath = "/x_component_query_ViewDesigner/$View/actionbar.html";
|
|
|
+ this.path = "/x_component_query_ViewDesigner/$View/";
|
|
|
+ this.imagePath_default = "/x_component_query_ViewDesigner/$View/";
|
|
|
+ this.imagePath_custom = "/x_component_process_FormDesigner/Module/Actionbar/";
|
|
|
+ this.cssPath = "/x_component_query_ViewDesigner/$View/"+this.options.style+"/actionbar.wcss";
|
|
|
+
|
|
|
+ this.view = view;
|
|
|
+ this.json = json;
|
|
|
+ this.jsonList = jsonList;
|
|
|
+ this.css = this.view.css;
|
|
|
+ this.container = this.view.actionbarNode;
|
|
|
+ this.load();
|
|
|
+ },
|
|
|
+ load: function(){
|
|
|
+ this.systemTools = [];
|
|
|
+ this.customTools = [];
|
|
|
+ if( !this.json ){
|
|
|
+ this.loadDefaultJson(function(){
|
|
|
+ this._load()
|
|
|
+ }.bind(this));
|
|
|
+ }else{
|
|
|
+ this._load()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _load : function(){
|
|
|
+ this._createNode();
|
|
|
+ //this._createIconAction();
|
|
|
+ //if (!this.json.export) this.hideMode();
|
|
|
+ this.setEvent();
|
|
|
+ },
|
|
|
+ loadDefaultJson: function(callback){
|
|
|
+ var url = this.path+"actionbar.json";
|
|
|
+ MWF.getJSON(url, {
|
|
|
+ "onSuccess": function(obj){
|
|
|
+ this.view.designer.actions.getUUID(function(id){
|
|
|
+ obj.id=id;
|
|
|
+ //obj.isNewView = true;
|
|
|
+ //obj.application = this.view.designer.application.id;
|
|
|
+ this.json = obj;
|
|
|
+ this.jsonList.push( this.json );
|
|
|
+ if (callback) callback(obj);
|
|
|
+ }.bind(this));
|
|
|
+ }.bind(this),
|
|
|
+ "onerror": function(text){
|
|
|
+ this.view.designer.notice(text, "error");
|
|
|
+ }.bind(this),
|
|
|
+ "onRequestFailure": function(xhr){
|
|
|
+ this.view.designer.notice(xhr.responseText, "error");
|
|
|
+ }.bind(this)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ setEvent: function(){
|
|
|
+ this.node.addEvents({
|
|
|
+ "click": function(e){this.selected(); e.stopPropagation();}.bind(this),
|
|
|
+ "mouseover": function(){if (!this.isSelected) this.node.setStyles(this.css.toolbarWarpNode_over)}.bind(this),
|
|
|
+ "mouseout": function(){if (!this.isSelected) this.node.setStyles(this.css.toolbarWarpNode) }.bind(this)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //_createIconAction: function(){
|
|
|
+ // if (!this.actionArea){
|
|
|
+ // this.actionArea = new Element("div", {"styles": this.css.actionAreaNode}).inject(this.container, "after");
|
|
|
+ //
|
|
|
+ // //this._createAction({
|
|
|
+ // // "name": "move",
|
|
|
+ // // "icon": "move1.png",
|
|
|
+ // // "event": "mousedown",
|
|
|
+ // // "action": "move",
|
|
|
+ // // "title": MWF.APPDVD.LP.action.move
|
|
|
+ // //});
|
|
|
+ // //this._createAction({
|
|
|
+ // // "name": "add",
|
|
|
+ // // "icon": "add.png",
|
|
|
+ // // "event": "click",
|
|
|
+ // // "action": "addColumn",
|
|
|
+ // // "title": MWF.APPDVD.LP.action.add
|
|
|
+ // //});
|
|
|
+ // this._createAction({
|
|
|
+ // "name": "delete",
|
|
|
+ // "icon": "delete1.png",
|
|
|
+ // "event": "click",
|
|
|
+ // "action": "delete",
|
|
|
+ // "title": MWF.APPDVD.LP.action["delete"]
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ //},
|
|
|
+ //_createAction: function(action){
|
|
|
+ // var actionNode = new Element("div", {
|
|
|
+ // "styles": this.css.actionNodeStyles,
|
|
|
+ // "title": action.title
|
|
|
+ // }).inject(this.actionArea);
|
|
|
+ // actionNode.setStyle("background", "url("+this.view.path+this.view.options.style+"/action/"+action.icon+") no-repeat left center");
|
|
|
+ // actionNode.addEvent(action.event, function(e){
|
|
|
+ // this[action.action](e);
|
|
|
+ // }.bind(this));
|
|
|
+ // actionNode.addEvents({
|
|
|
+ // "mouseover": function(e){
|
|
|
+ // e.target.setStyle("border", "1px solid #999");
|
|
|
+ // }.bind(this),
|
|
|
+ // "mouseout": function(e){
|
|
|
+ // e.target.setStyle("border", "1px solid #F1F1F1");
|
|
|
+ // }.bind(this)
|
|
|
+ // });
|
|
|
+ //},
|
|
|
+ //_setActionAreaPosition: function(){
|
|
|
+ // var p = this.node.getPosition(this.view.areaNode.getOffsetParent());
|
|
|
+ // var y = p.y-25;
|
|
|
+ // var x = p.x;
|
|
|
+ // this.actionArea.setPosition({"x": x, "y": y});
|
|
|
+ //},
|
|
|
+ //_showActions: function(){
|
|
|
+ // if (this.actionArea){
|
|
|
+ // this._setActionAreaPosition();
|
|
|
+ // this.actionArea.setStyle("display", "block");
|
|
|
+ // }
|
|
|
+ //},
|
|
|
+ //_hideActions: function(){
|
|
|
+ // if (this.actionArea) this.actionArea.setStyle("display", "none");
|
|
|
+ //},
|
|
|
+
|
|
|
+ selected: function(){
|
|
|
+ if (this.view.currentSelectedModule){
|
|
|
+ if (this.view.currentSelectedModule==this){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ this.view.currentSelectedModule.unSelected();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.node.setStyles(this.css.toolbarWarpNode_selected);
|
|
|
+ //this.listNode.setStyles(this.css.cloumnListNode_selected);
|
|
|
+ new Fx.Scroll(this.view.areaNode, {"wheelStops": false, "duration": 100}).toElementEdge(this.node);
|
|
|
+ //new Fx.Scroll(this.view.designer.propertyDomArea, {"wheelStops": false, "duration": 100}).toElement(this.listNode);
|
|
|
+
|
|
|
+ this.view.currentSelectedModule = this;
|
|
|
+ this.isSelected = true;
|
|
|
+ //this._showActions();
|
|
|
+ this.showProperty();
|
|
|
+ },
|
|
|
+ unSelected: function(){
|
|
|
+ this.view.currentSelectedModule = null;
|
|
|
+ this.node.setStyles(this.css.toolbarWarpNode)
|
|
|
+
|
|
|
+ //this.listNode.setStyles(this.css.cloumnListNode);
|
|
|
+ this.isSelected = false;
|
|
|
+ //this._hideActions();
|
|
|
+ this.hideProperty();
|
|
|
+ },
|
|
|
+
|
|
|
+ showProperty: function(){
|
|
|
+ if (!this.property){
|
|
|
+ this.property = new MWF.xApplication.query.ViewDesigner.Property(this, this.view.designer.propertyContentArea, this.view.designer, {
|
|
|
+ "path": this.propertyPath,
|
|
|
+ "onPostLoad": function(){
|
|
|
+ this.property.show();
|
|
|
+ //var processDiv = this.property.propertyContent.getElements("#"+this.json.id+"dataPathSelectedProcessArea");
|
|
|
+ //var cmsDiv = this.property.propertyContent.getElements("#"+this.json.id+"dataPathSelectedCMSArea");
|
|
|
+ //
|
|
|
+ //if (this.view.json.type=="cms"){
|
|
|
+ // processDiv.setStyle("display", "none");
|
|
|
+ // cmsDiv.setStyle("display", "block");
|
|
|
+ //}else{
|
|
|
+ // processDiv.setStyle("display", "block");
|
|
|
+ // cmsDiv.setStyle("display", "none");
|
|
|
+ //}
|
|
|
+ }.bind(this)
|
|
|
+ });
|
|
|
+ this.property.load();
|
|
|
+ }else{
|
|
|
+ this.property.show();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ hideProperty: function(){
|
|
|
+ if (this.property) this.property.hide();
|
|
|
+ },
|
|
|
+
|
|
|
+ resetTextNode: function(){
|
|
|
+ var listText = (this.json.selectType=="attribute") ? (this.json.attribute || "") : (this.json.path || "");
|
|
|
+ if (!listText) listText = "unnamed";
|
|
|
+
|
|
|
+ this.textNode.set("text", this.json.displayName);
|
|
|
+ this.listNode.getLast().set("text", this.json.displayName+"("+listText+")");
|
|
|
+ },
|
|
|
+ //"delete": function(e){
|
|
|
+ // var _self = this;
|
|
|
+ // if (!e) e = this.node;
|
|
|
+ // this.view.designer.confirm("warn", e, MWF.APPDVD.LP.notice.deleteColumnTitle, MWF.APPDVD.LP.notice.deleteColumn, 300, 120, function(){
|
|
|
+ // _self.destroy();
|
|
|
+ //
|
|
|
+ // this.close();
|
|
|
+ // }, function(){
|
|
|
+ // this.close();
|
|
|
+ // }, null);
|
|
|
+ //},
|
|
|
+ //destroy: function(){
|
|
|
+ // if (this.view.currentSelectedModule==this) this.view.currentSelectedModule = null;
|
|
|
+ // if (this.actionArea) this.actionArea.destroy();
|
|
|
+ // if (this.listNode) this.listNode.destroy();
|
|
|
+ // if (this.property) this.property.propertyContent.destroy();
|
|
|
+ //
|
|
|
+ // var idx = this.view.items.indexOf(this);
|
|
|
+ //
|
|
|
+ // if (this.view.viewContentTableNode){
|
|
|
+ // var trs = this.view.viewContentTableNode.getElements("tr");
|
|
|
+ // trs.each(function(tr){
|
|
|
+ // tr.deleteCell(idx);
|
|
|
+ // }.bind(this));
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // if (this.view.json.data.selectList) this.view.json.data.selectList.erase(this.json);
|
|
|
+ // if (this.view.json.data.calculate) if (this.view.json.data.calculate.calculateList) this.view.json.data.calculate.calculateList.erase(this.json);
|
|
|
+ // this.view.items.erase(this);
|
|
|
+ // if (this.view.property) this.view.property.loadStatColumnSelect();
|
|
|
+ //
|
|
|
+ // this.areaNode.destroy();
|
|
|
+ // this.view.selected();
|
|
|
+ //
|
|
|
+ // this.view.setViewWidth();
|
|
|
+ //
|
|
|
+ // MWF.release(this);
|
|
|
+ // delete this;
|
|
|
+ //},
|
|
|
+
|
|
|
+ //move: function(e){
|
|
|
+ // this._createMoveNode();
|
|
|
+ //
|
|
|
+ // //this._setNodeMove(columnNodes, e);
|
|
|
+ //},
|
|
|
+ //_createMoveNode: function(){
|
|
|
+ // this.moveNode = new Element("div", {"text": this.node.get("text")});
|
|
|
+ // this.moveNode.inject(this.view.designer.content);
|
|
|
+ // this.moveNode.setStyles({
|
|
|
+ // "border": "2px dashed #ffa200",
|
|
|
+ // "opacity": 0.7,
|
|
|
+ // "height": "30px",
|
|
|
+ // "line-height": "30px",
|
|
|
+ // "padding": "0px 10px",
|
|
|
+ // "position": "absolute"
|
|
|
+ // });
|
|
|
+ //},
|
|
|
+ //_setMoveNodePosition: function(e){
|
|
|
+ // var x = e.page.x+2;
|
|
|
+ // var y = e.page.y+2;
|
|
|
+ // this.moveNode.positionTo(x, y);
|
|
|
+ //},
|
|
|
+ //createMoveFlagNode: function(){
|
|
|
+ // this.moveFlagNode = new Element("td", {"styles": this.css.moveFlagNode});
|
|
|
+ //},
|
|
|
+ //_setNodeMove: function(droppables, e){
|
|
|
+ // this._setMoveNodePosition(e);
|
|
|
+ // var movePosition = this.moveNode.getPosition();
|
|
|
+ // var moveSize = this.moveNode.getSize();
|
|
|
+ // var contentPosition = this.content.getPosition();
|
|
|
+ // var contentSize = this.content.getSize();
|
|
|
+ //
|
|
|
+ // var nodeDrag = new Drag.Move(this.moveNode, {
|
|
|
+ // "droppables": droppables,
|
|
|
+ // "limit": {
|
|
|
+ // "x": [contentPosition.x, contentPosition.x+contentSize.x],
|
|
|
+ // "y": [movePosition.y, movePosition.y+moveSize.y]
|
|
|
+ // },
|
|
|
+ // "onEnter": function(dragging, inObj){
|
|
|
+ // if (!this.moveFlagNode) this.createMoveFlagNode();
|
|
|
+ // this.moveFlagNode.inject(inObj, "before");
|
|
|
+ // }.bind(this),
|
|
|
+ // "onLeave": function(dragging, inObj){
|
|
|
+ // if (this.moveFlagNode){
|
|
|
+ // this.moveFlagNode.dispose();
|
|
|
+ // }
|
|
|
+ // }.bind(this),
|
|
|
+ // "onDrop": function(dragging, inObj){
|
|
|
+ // if (inObj){
|
|
|
+ // this.areaNode.inject(inObj, "before");
|
|
|
+ // var column = inObj.retrieve("column");
|
|
|
+ // this.listNode.inject(column.listNode, "before");
|
|
|
+ // var idx = this.view.json.data.selectList.indexOf(column.json);
|
|
|
+ //
|
|
|
+ // this.view.json.data.selectList.erase(this.json);
|
|
|
+ // this.view.items.erase(this);
|
|
|
+ //
|
|
|
+ // this.view.json.data.selectList.splice(idx, 0, this.json);
|
|
|
+ // this.view.items.splice(idx, 0, this);
|
|
|
+ //
|
|
|
+ // if (this.moveNode) this.moveNode.destroy();
|
|
|
+ // if (this.moveFlagNode) this.moveFlagNode.destroy();
|
|
|
+ // this._setActionAreaPosition();
|
|
|
+ // }else{
|
|
|
+ // if (this.moveNode) this.moveNode.destroy();
|
|
|
+ // if (this.moveFlagNode) this.moveFlagNode.destroy();
|
|
|
+ // }
|
|
|
+ // }.bind(this),
|
|
|
+ // "onCancel": function(dragging){
|
|
|
+ // if (this.moveNode) this.moveNode.destroy();
|
|
|
+ // if (this.moveFlagNode) this.moveFlagNode.destroy();
|
|
|
+ // }.bind(this)
|
|
|
+ // });
|
|
|
+ // nodeDrag.start(e);
|
|
|
+ //},
|
|
|
+
|
|
|
+ deletePropertiesOrStyles: function(name, key){
|
|
|
+ if (name=="properties"){
|
|
|
+ try{
|
|
|
+ this.node.removeProperty(key);
|
|
|
+ }catch(e){}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setPropertiesOrStyles: function(name){
|
|
|
+ if (name=="styles"){
|
|
|
+ try{
|
|
|
+ this.setCustomStyles();
|
|
|
+ }catch(e){}
|
|
|
+ }
|
|
|
+ if (name=="properties"){
|
|
|
+ try{
|
|
|
+ this.node.setProperties(this.json.properties);
|
|
|
+ }catch(e){}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setCustomNodeStyles: function(node, styles){
|
|
|
+ var border = node.getStyle("border");
|
|
|
+ node.clearStyles();
|
|
|
+ //node.setStyles(styles);
|
|
|
+ node.setStyle("border", border);
|
|
|
+
|
|
|
+ Object.each(styles, function(value, key){
|
|
|
+ var reg = /^border\w*/ig;
|
|
|
+ if (!key.test(reg)){
|
|
|
+ node.setStyle(key, value);
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ setCustomStyles: function(){
|
|
|
+ var border = this.node.getStyle("border");
|
|
|
+ this.node.clearStyles();
|
|
|
+ this.node.setStyles(this.css.moduleNode);
|
|
|
+
|
|
|
+ if (this.initialStyles) this.node.setStyles(this.initialStyles);
|
|
|
+ this.node.setStyle("border", border);
|
|
|
+
|
|
|
+ if (this.json.styles) Object.each(this.json.styles, function(value, key){
|
|
|
+ if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
|
|
|
+ var host1 = MWF.Actions.getHost("x_processplatform_assemble_surface");
|
|
|
+ var host2 = MWF.Actions.getHost("x_portal_assemble_surface");
|
|
|
+ if (value.indexOf("/x_processplatform_assemble_surface")!==-1){
|
|
|
+ value = value.replace("/x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
|
|
|
+ }else if (value.indexOf("x_processplatform_assemble_surface")!==-1){
|
|
|
+ value = value.replace("x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
|
|
|
+ }
|
|
|
+ if (value.indexOf("/x_portal_assemble_surface")!==-1){
|
|
|
+ value = value.replace("/x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
|
|
|
+ }else if (value.indexOf("x_portal_assemble_surface")!==-1){
|
|
|
+ value = value.replace("x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var reg = /^border\w*/ig;
|
|
|
+ if (!key.test(reg)){
|
|
|
+ if (key){
|
|
|
+ if (key.toString().toLowerCase()==="display"){
|
|
|
+ if (value.toString().toLowerCase()==="none"){
|
|
|
+ this.node.setStyle("opacity", 0.3);
|
|
|
+ }else{
|
|
|
+ this.node.setStyle("opacity", 1);
|
|
|
+ this.node.setStyle(key, value);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.node.setStyle(key, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //this.node.setStyle(key, value);
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+
|
|
|
+ _setEditStyle: function(name, obj, oldValue){
|
|
|
+ var title = "";
|
|
|
+ var text = "";
|
|
|
+ if (name==="name"){
|
|
|
+ title = this.json.name || this.json.id;
|
|
|
+ text = this.json.type.substr(this.json.type.lastIndexOf("$")+1, this.json.type.length);
|
|
|
+ this.treeNode.setText("<"+text+"> "+title);
|
|
|
+ }
|
|
|
+ if (name==="id"){
|
|
|
+ title = this.json.name || this.json.id;
|
|
|
+ if (!this.json.name){
|
|
|
+ text = this.json.type.substr(this.json.type.lastIndexOf("$")+1, this.json.type.length);
|
|
|
+ this.treeNode.setText("<"+text+"> "+this.json.id);
|
|
|
+ }
|
|
|
+ this.treeNode.setTitle(this.json.id);
|
|
|
+ this.node.set("id", this.json.id);
|
|
|
+ }
|
|
|
+
|
|
|
+ this._setEditStyle_custom(name, obj, oldValue);
|
|
|
+ },
|
|
|
+ reloadMaplist: function(){
|
|
|
+ if (this.property) Object.each(this.property.maplists, function(map, name){ map.reload(this.json[name]);}.bind(this));
|
|
|
+ },
|
|
|
+
|
|
|
+ getHtml: function(){
|
|
|
+ var copy = this.node.clone(true, true);
|
|
|
+ copy.clearStyles(true);
|
|
|
+
|
|
|
+ var html = copy.outerHTML;
|
|
|
+ copy.destroy();
|
|
|
+
|
|
|
+ return html;
|
|
|
+ },
|
|
|
+ getJson: function(){
|
|
|
+ var json = Object.clone(this.json);
|
|
|
+ var o = {};
|
|
|
+ o[json.id] = json;
|
|
|
+ return o;
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ _createNode: function(callback){
|
|
|
+ this.node = new Element("div", {
|
|
|
+ "id": this.json.id,
|
|
|
+ "MWFType": "actionbar",
|
|
|
+ "styles": this.css.toolbarWarpNode,
|
|
|
+ "events": {
|
|
|
+ "selectstart": function(e){
|
|
|
+ e.preventDefault();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }).inject(this.container );
|
|
|
+
|
|
|
+ this.toolbarNode = new Element("div").inject(this.node);
|
|
|
+
|
|
|
+ this.toolbarWidget = new MWF.widget.Toolbar(this.toolbarNode, {"style": this.json.style}, this);
|
|
|
+ if (!this.json.actionStyles){
|
|
|
+ this.json.actionStyles = Object.clone(this.toolbarWidget.css);
|
|
|
+ }
|
|
|
+
|
|
|
+ //MWF.getJSON(this.path+"toolbars.json", function(json){
|
|
|
+ // this.json.defaultTools = json;
|
|
|
+ // this.setToolbars(json, this.toolbarNode);
|
|
|
+ // debugger;
|
|
|
+ // this.toolbarWidget.load();
|
|
|
+ //}.bind(this), false);
|
|
|
+ if (this.json.defaultTools){
|
|
|
+ var json = Array.clone(this.json.defaultTools);
|
|
|
+ //if (this.json.tools) json.append(this.json.tools);
|
|
|
+ this.setToolbars(json, this.toolbarNode);
|
|
|
+ if (this.json.tools){
|
|
|
+ this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
|
|
|
+ }
|
|
|
+ this.toolbarWidget.load();
|
|
|
+ this._setEditStyle_custom("hideSystemTools");
|
|
|
+ //json = null;
|
|
|
+ }else{
|
|
|
+ MWF.getJSON(this.path+"toolbars.json", function(json){
|
|
|
+ this.json.defaultTools = json;
|
|
|
+ var json = Array.clone(this.json.defaultTools);
|
|
|
+ //if (this.json.tools) json.append(this.json.tools);
|
|
|
+ this.setToolbars(json, this.toolbarNode);
|
|
|
+ if (this.json.tools){
|
|
|
+ this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
|
|
|
+ }
|
|
|
+ this.toolbarWidget.load();
|
|
|
+ this._setEditStyle_custom("hideSystemTools");
|
|
|
+ //json = null;
|
|
|
+ }.bind(this), false);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ _refreshActionbar: function(){
|
|
|
+ //if (this.form.options.mode == "Mobile"){
|
|
|
+ // this.node.set("text", MWF.APPFD.LP.notice.notUseModuleInMobile+"("+this.moduleName+")");
|
|
|
+ // this.node.setStyles({"height": "24px", "line-height": "24px", "background-color": "#999"});
|
|
|
+ //}else{
|
|
|
+ this.toolbarNode = this.node.getFirst("div");
|
|
|
+ this.toolbarNode.empty();
|
|
|
+ this.toolbarWidget = new MWF.widget.Toolbar(this.toolbarNode, {"style": this.json.style}, this);
|
|
|
+ if (!this.json.actionStyles) this.json.actionStyles = Object.clone(this.toolbarWidget.css);
|
|
|
+ this.toolbarWidget.css = this.json.actionStyles;
|
|
|
+
|
|
|
+ if (this.json.defaultTools){
|
|
|
+ var json = Array.clone(this.json.defaultTools);
|
|
|
+ //if (this.json.tools) json.append(this.json.tools);
|
|
|
+ this.setToolbars(json, this.toolbarNode);
|
|
|
+ if (this.json.tools){
|
|
|
+ this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
|
|
|
+ }
|
|
|
+ this.toolbarWidget.load();
|
|
|
+ //json = null;
|
|
|
+ }else{
|
|
|
+ MWF.getJSON(this.path+"toolbars.json", function(json){
|
|
|
+ this.json.defaultTools = json;
|
|
|
+ var json = Array.clone(this.json.defaultTools);
|
|
|
+ //if (this.json.tools) json.append(this.json.tools);
|
|
|
+ this.setToolbars(json, this.toolbarNode);
|
|
|
+ if (this.json.tools){
|
|
|
+ this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
|
|
|
+ }
|
|
|
+ this.toolbarWidget.load();
|
|
|
+ //json = null;
|
|
|
+ }.bind(this), false);
|
|
|
+ }
|
|
|
+ //}
|
|
|
+
|
|
|
+ },
|
|
|
+ _resetActionbar: function(){
|
|
|
+ //if (this.form.options.mode == "Mobile"){
|
|
|
+ // this.node.set("text", MWF.APPFD.LP.notice.notUseModuleInMobile+"("+this.moduleName+")");
|
|
|
+ // this.node.setStyles({"height": "24px", "line-height": "24px", "background-color": "#999"});
|
|
|
+ //}else{
|
|
|
+ this.toolbarNode = this.node.getFirst("div");
|
|
|
+ this.toolbarNode.empty();
|
|
|
+ this.toolbarWidget = new MWF.widget.Toolbar(this.toolbarNode, {"style": this.json.style}, this);
|
|
|
+ if (!this.json.actionStyles){
|
|
|
+ this.json.actionStyles = Object.clone(this.toolbarWidget.css);
|
|
|
+ }else{
|
|
|
+ this.toolbarWidget.css = Object.merge( Object.clone(this.json.actionStyles), this.toolbarWidget.css );
|
|
|
+ this.json.actionStyles = Object.clone(this.toolbarWidget.css);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.json.defaultTools){
|
|
|
+ var json = Array.clone(this.json.defaultTools);
|
|
|
+ //if (this.json.tools) json.append(this.json.tools);
|
|
|
+ this.setToolbars(json, this.toolbarNode);
|
|
|
+ if (this.json.tools){
|
|
|
+ this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
|
|
|
+ }
|
|
|
+ this.toolbarWidget.load();
|
|
|
+ //json = null;
|
|
|
+ }else{
|
|
|
+ MWF.getJSON(this.path+"toolbars.json", function(json){
|
|
|
+ this.json.defaultTools = json;
|
|
|
+ var json = Array.clone(this.json.defaultTools);
|
|
|
+ //if (this.json.tools) json.append(this.json.tools);
|
|
|
+ this.setToolbars(json, this.toolbarNode);
|
|
|
+ if (this.json.tools){
|
|
|
+ this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
|
|
|
+ }
|
|
|
+ this.toolbarWidget.load();
|
|
|
+ //json = null;
|
|
|
+ }.bind(this), false);
|
|
|
+ }
|
|
|
+ //}
|
|
|
+ },
|
|
|
+ setToolbars: function(tools, node){
|
|
|
+ tools.each(function(tool){
|
|
|
+ var actionNode = new Element("div", {
|
|
|
+ "MWFnodetype": tool.type,
|
|
|
+ "MWFButtonImage": this.imagePath_default+""+this.options.style+"/actionbar/"+tool.img,
|
|
|
+ "title": tool.title,
|
|
|
+ "MWFButtonAction": tool.action,
|
|
|
+ "MWFButtonText": tool.text
|
|
|
+ }).inject(node);
|
|
|
+ if( this.json.iconOverStyle ){
|
|
|
+ actionNode.set("MWFButtonImageOver" , this.imagePath_default+""+this.options.style+"/actionbar/"+this.json.iconOverStyle+"/"+tool.img );
|
|
|
+ }
|
|
|
+ this.systemTools.push(actionNode);
|
|
|
+ if (tool.sub){
|
|
|
+ var subNode = node.getLast();
|
|
|
+ this.setToolbars(tool.sub, subNode);
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ setCustomToolbars: function(tools, node){
|
|
|
+ //var style = (this.json.style || "default").indexOf("red") > -1 ? "red" : "blue";
|
|
|
+ var path = "";
|
|
|
+ if( this.json.customIconStyle ){
|
|
|
+ path = this.json.customIconStyle+ "/";
|
|
|
+ }
|
|
|
+
|
|
|
+ tools.each(function(tool){
|
|
|
+ var actionNode = new Element("div", {
|
|
|
+ "MWFnodetype": tool.type,
|
|
|
+ "MWFButtonImage": this.imagePath_custom+""+this.options.customImageStyle +"/custom/"+path+tool.img,
|
|
|
+ "title": tool.title,
|
|
|
+ "MWFButtonAction": tool.action,
|
|
|
+ "MWFButtonText": tool.text
|
|
|
+ }).inject(node);
|
|
|
+ if( this.json.customIconOverStyle ){
|
|
|
+ actionNode.set("MWFButtonImageOver" , this.imagePath_custom+""+this.options.customImageStyle +"/custom/"+this.json.customIconOverStyle+ "/" +tool.img );
|
|
|
+ }
|
|
|
+ this.customTools.push(actionNode);
|
|
|
+ if (tool.sub){
|
|
|
+ var subNode = node.getLast();
|
|
|
+ this.setToolbars(tool.sub, subNode);
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ _setEditStyle_custom: function(name){
|
|
|
+ if (name=="hideSystemTools"){
|
|
|
+ if (this.json.hideSystemTools){
|
|
|
+ this.systemTools.each(function(tool){
|
|
|
+ tool.setStyle("display", "none");
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.systemTools.each(function(tool){
|
|
|
+ tool.setStyle("display", "block");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (name=="defaultTools" || name=="tools" || name==="actionStyles"){
|
|
|
+ this._refreshActionbar();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+});
|