123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- MWF.xDesktop.requireApp("process.Xform", "$Input", null, false);
- if( !MWF.CMS$Input_Process ){
- MWF.CMS$Input_Process = {
- validationConfigItem : MWF.xApplication.process.Xform.$Input.prototype.validationConfigItem.$origin,
- _loadStyles : MWF.xApplication.process.Xform.$Input.prototype._loadStyles.$origin
- };
- MWF.xApplication.process.Xform.$Input.implement({
- _loadStyles: function(){
- //var isCMS = layout.desktop.currentApp.options.name.toLowerCase().contains("cms");
- var isCMS = this.form.app.options.name.toLowerCase().contains("cms");
- if( isCMS ){
- return this._loadStyles_CMS();
- }else{
- return this._loadStyles_Process();
- }
- },
- _loadStyles_Process : MWF.CMS$Input_Process._loadStyles,
- _loadStyles_CMS: function(){
- if (this.json.styles) this.node.setStyles(this.json.styles);
- if( this.readonly ){
- var parent = this.node.parentNode;
- if( parent.tagName.toLowerCase() == "td" ){
- var border = parent.getStyle("borderBottomWidth");
- if( border.toInt() > 0 ){
- this.node.setStyle("border","0px");
- }
- }
- }
- if (this.json.inputStyles) if (this.node.getFirst()) this.node.getFirst().setStyles(this.json.inputStyles);
- if (this.iconNode && this.iconNode.offsetParent !== null ){
- var size = this.node.getSize();
- this.iconNode.setStyle("height", ""+size.y+"px");
- }
- },
- validationConfigItem: function(routeName, data){
- //var isCMS = layout.desktop.currentApp.options.name.toLowerCase().contains("cms");
- var isCMS = this.form.app.options.name.toLowerCase().contains("cms");
- if( isCMS ){
- return this.validationConfigItem_CMS( routeName, data );
- }else{
- return this.validationConfigItem_Process( routeName, data );
- }
- },
- validationConfigItem_Process : MWF.CMS$Input_Process.validationConfigItem,
- validationConfigItem_CMS: function(routeName, data){
- var flag = (data.status=="all") ? true: ( routeName == "publish");
- if (flag){
- var n = this.getInputData();
- var v = (data.valueType=="value") ? n : n.length;
- switch (data.operateor){
- case "isnull":
- if (!v){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "notnull":
- if (v){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "gt":
- if (v>data.value){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "lt":
- if (v<data.value){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "equal":
- if (v==data.value){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "neq":
- if (v!=data.value){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "contain":
- if (v.indexOf(data.value)!=-1){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- case "notcontain":
- if (v.indexOf(data.value)==-1){
- this.notValidationMode(data.prompt);
- return false;
- }
- break;
- }
- }
- return true;
- }
- });
- }
- MWF.xApplication.cms = MWF.xApplication.cms || {};
- MWF.xApplication.cms.Xform = MWF.xApplication.cms.Xform || {};
- MWF.xApplication.cms.Xform.ModuleImplements = {};
|