123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
- MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
- MWF.xApplication.process.FormDesigner.Module.AssociatedDocument = MWF.FCAssociatedDocument = new Class({
- Extends: MWF.FC$Element,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "propertyPath": "../x_component_process_FormDesigner/Module/AssociatedDocument/associateddocument.html"
- },
-
- initialize: function(form, options){
- this.setOptions(options);
-
- this.path = "../x_component_process_FormDesigner/Module/AssociatedDocument/";
- this.cssPath = "../x_component_process_FormDesigner/Module/AssociatedDocument/"+this.options.style+"/css.wcss";
- this._loadCss();
- this.moduleType = "element";
- this.moduleName = "associatedDocument";
- this.form = form;
- this.container = null;
- this.containerNode = null;
- },
- _resetModuleDomNode: function(){
- // this.contentNode = this.node.getElement(".MWFADContent");
- // this.buttonContainer = this.node.getElement(".MWFADButtonContainer");
- // this.buttonArea = this.node.getElement(".MWFADButtonArea");
- // this.buttonNode = this.node.getElement(".MWFADBbutton");
- debugger;
- this.node.empty();
- this.loadContent();
- this.loadButton();
- },
- _createMoveNode: function(){
- this.moveNode = new Element("div", {
- "MWFType": "associatedDocument",
- "id": this.json.id,
- "styles": this.css.moduleNodeMove,
- "events": {
- "selectstart": function(){
- return false;
- }
- }
- }).inject(this.form.container);
- },
- _createNode: function(){
- this.node = this.moveNode.clone(true, true);
- this.node.setStyles(this.css.moduleNode);
- this.node.set("id", this.json.id);
- this.node.addEvent("selectstart", function(){
- return false;
- });
- this.loadContent();
- this.loadButton();
- },
- loadContent: function(){
- this.contentNode = new Element("div.MWFADContent", {
- "styles": this.json.documentListNodeStyles
- }).inject(this.node);
- this.contentArea = new Element("div", {
- "styles": this.css.contentArea
- }).inject(this.contentNode);
- this.loadIcon();
- },
- loadIcon: function(){
- this.iconNode = new Element("div", {
- "styles": this.css.iconNode
- }).inject(this.contentArea);
- new Element("div", {
- "styles": this.css.iconNodeIcon
- }).inject(this.iconNode);
- new Element("div", {
- "styles": this.css.iconNodeText,
- "text": "associatedDocument"
- }).inject(this.iconNode);
- },
- loadButton: function(){
- this.buttonContainer = new Element("div.MWFADButtonContainer", {
- styles : { "width" : "100%", "overflow" : "hidden", "text-align":"center" }
- });
- this.buttonArea = new Element("div.MWFADButtonArea").inject( this.buttonContainer );
- this.buttonNode = new Element("button.MWFADBbutton", {
- "styles": this.json.buttonStyles || {},
- "text": this.json.buttonText
- }).inject( this.buttonArea );
- this.setButtonPosition();
- },
- clearTemplateStyles: function(styles){
- if (styles){
- if (styles.styles) this.removeStyles(styles.styles, "styles");
- if (styles.buttonStyles) this.removeStyles(styles.buttonStyles, "buttonStyles");
- }
- },
- setTemplateStyles: function(styles){
- if (styles.styles) this.copyStyles(styles.styles, "styles");
- if (styles.buttonStyles) this.copyStyles(styles.buttonStyles, "buttonStyles");
- },
- setAllStyles: function(){
- this.setPropertiesOrStyles("styles");
- this.setPropertiesOrStyles("properties");
- this.setPropertiesOrStyles("buttonStyles");
- this.reloadMaplist();
- },
- setPropertiesOrStyles: function(name){
- debugger;
- switch (name) {
- case "styles":
- try{
- this.setCustomStyles();
- }catch(e){}
- break;
- case "properties":
- try{
- this.setCustomProperties();
- }catch(e){}
- break;
- case "buttonStyles":
- try{
- if( this.buttonNode ){
- this.buttonNode.clearStyles();
- this.buttonNode.setStyles(this.json.buttonStyles||{});
- }
- }catch(e){}
- break;
- case "documentListNodeStyles":
- this.contentNode.setStyles( this.json.contentStyle );
- }
- },
- _setEditStyle_custom: function(name, obj, oldValue){
- switch ( name ){
- case "buttonText":
- this.buttonNode.set("text", this.json.buttonText);
- break;
- case "buttonPosition":
- this.setButtonPosition();
- break;
- }
- },
- _checkView: function(callback, name, oldValue, newValue){
- debugger;
- if( name !== "queryView" )return;
- if( !oldValue ){
- oldValue = [];
- }else{
- oldValue = typeOf(oldValue) === "array" ? oldValue : [oldValue];
- }
- if( !newValue ){
- newValue = [];
- }else{
- newValue = typeOf(newValue) === "array" ? newValue : [newValue];
- }
- if( !this.json.viewFilterScriptList )this.json.viewFilterScriptList = [];
- var list = [];
- newValue.each(function (n) {
- var vf = this.json.viewFilterScriptList.filter(function (viewFilter) {
- return n.id === viewFilter.id;
- }.bind(this));
- if( vf.length ){
- list.push( vf[0] );
- }else{
- list.push({
- id: n.id,
- title: n.name + MWF.xApplication.process.FormDesigner.LP.propertyTemplate.filterCond,
- script: {"code": "", "html": ""}
- })
- }
- }.bind(this));
- this.json.viewFilterScriptList.each(function (vf) {
- var ns = newValue.filter(function (n) {
- return n.id === vf.id;
- });
- if( !ns.length ){
- var id1 = "scriptArea_"+vf.id;
- if( this.property[ id1 ] ){
- this.property[ id1 ].destroy();
- this.property[ id1 ] = null;
- }
- }
- }.bind(this))
- this.json.viewFilterScriptList = list;
- this.property.loadScriptListArea();
- },
- setButtonPosition: function () {
- var position = ["leftTop","centerTop","rightTop"].contains( this.json.buttonPosition ) ? "top" : "bottom";
- this.buttonContainer.inject(this.node, position);
- switch ( this.json.buttonPosition ) {
- case "leftTop":
- case "leftBottom":
- this.buttonArea.setStyles({ "float" : "left", "margin" : "0px" });
- break;
- case "rightTop":
- case "rightBottom":
- this.buttonArea.setStyles({ "float" : "right", "margin" : "0px" });
- break;
- default:
- this.buttonArea.setStyles({ "float" : "none", "margin" : "0px auto" });
- break;
- }
- }
- });
|