/** * Conditional show hide class * * @Author Erik A. Ortiz. * @date Feb 22, 2010 */ var conditionEditorPanel; var Conditional = function(DYN_UID){ this.DYN_UID = DYN_UID; this.client = getBrowserClient(); this.dynavarsPanel = null; this.dynavarsPanelNew = null; this.fields = Array(); this.conditionVariables = new Object(); this.conditionVariables.___IsSET___ = false; this.conditionVariablesFromSetup = new Object(); this.conditionVariablesFromSetup.___IsSET___ = false; this.aConditionVariablesFromSetup = new Array(); this.canSave = false; this.conditionTested = false; this.setDynUid = function(id){ this.DYN_UID = id; } this.showID = function(){ alert('DYN_UID: '+this.DYN_UID); } this.editor = function(sType){ oPanel = new leimnud.module.panel(); oPanel.options = { size : {w:730, h:595}, position : {x:0, y:0, center:true}, title : G_STRINGS.CONDITIONAL_TITLE, statusBar: false, control : {resize:false,roll:false,drag:true}, fx : {modal:true,opacity:true,blinkToFront:false,fadeIn:false,drag:true} }; oPanel.events = { remove: function() {delete(oPanel);}.extend(this) }; oPanel.make(); oPanel.loader.show(); sExtra = ''; if(sType != 'new'){ FCD_UID = sType; sType = 'edit'; sExtra = '&FCD_UID='+FCD_UID; } var oRPC = new leimnud.module.rpc.xmlhttp({ url : 'conditionalShowHide_Ajax', args: 'request='+sType+sExtra }); oRPC.callback = function(rpc) { oPanel.loader.hide(); var scs = rpc.xmlhttp.responseText.extractScript(); oPanel.addContent(rpc.xmlhttp.responseText); scs.evalScript(); }.extend(this); oRPC.make(); conditionEditorPanel = this.dynavarsPanelNew = oPanel; } this.populate = function(filter){ if( typeof(filter) != 'undefined' ){ if( filter.IN ){ // } } var oRPC = new leimnud.module.rpc.xmlhttp({ url : 'conditionalShowHide_Ajax', args: 'request=getDynaFieds' }); oRPC.callback = function(rpc) { var scs = rpc.xmlhttp.responseText.extractScript(); scs.evalScript(); oFields = getField('fields'); oEventOwner = getField('event_owner'); var response = eval(oRPC.xmlhttp.responseText); for(i=0; i 0 ){ if(o.options.length == 0){ return false; } for(i=0; i= 0 && selectedIndex < o.options.length ){ o.options[selectedIndex].selected = true; } else if( selectedIndex >= 0 && o.options.length > 0 ){ o.options[selectedIndex-1].selected = true; } } } this.deselectAll = function(list){ for(i=0; i max){ max = x.length; } uppercase_letters="ABCDEFGHYJKLMNÑOPQRSTUVWXYZ_"; may = 0; for(k=0; k maymax){ maymax = may; } } max = (max < 15)? 140 : ((max > maymax)? (((max - maymax)*6) + (maymax*9) + 15) : ((maymax*9) + 15)); sel.style.width = ((max-13)+'px'); oPanel.resize({w:(max),h:215}); oPanel.addContent(sel); }.extend(this); oRPC.make(); } this.testCondition = function(saving){ var oCondition = getField('FCD_CONDITION'); var sCondition = oCondition.value; var sError; var result; sCondition = sCondition.replace(/@#/g, ''); sCondition = sCondition.replace(/\n/gi, ''); saving = (typeof(saving) != 'undefined')? true: false; this.createConditionVariables(); this.mergeConditionVariables(); var aCVariables = this.getConditionVariables(); this.conditionTested = true; for(i=0; i