Fix workspace restore from 2.5.2 to 2.9/3.0

This commit is contained in:
Julio Cesar Laura
2015-05-10 17:16:34 -04:00
parent 5c82af6582
commit e2e45a38a4
6 changed files with 30 additions and 12 deletions

View File

@@ -919,7 +919,8 @@ var r2=new leimnud.module.rpc.xmlhttp({url:this.options.dataServer,args:"action=
else{var msg=_("ID_TASK_CANT_DELETE");msg=msg.replace("{0}",data.label);msg=msg.replace("{1}",casesNumRec);new this.parent.module.app.info().make({label:msg});}}.extend(this);r.make();return;if(confirm(G_STRINGS.ID_PROCESSMAP_CONFIRM_DELETE_TASK+" "+data.label))
{data.object.drag.flush();this.dropables.derivation.unregister(data.object.dropIndex);this.data.render.deleteDerivation(data.uid);this.parent.dom.remove(data.object.elements);var r=new leimnud.module.rpc.xmlhttp({url:this.options.dataServer,args:"action=deleteTask&data="+{pro_uid:this.options.uid,tas_uid:data.uid}.toJSONString()});r.make();}},args:index})},{simage:"/images/properties.png",text:G_STRINGS.ID_PROCESSMAP_PROPERTIES,launch:this.parent.closure({instance:this,method:function(index){var panel;var iForm=function(panel,index,ifo){if(typeof(panel.flag)=='undefined'){if(!saveDataTaskTemporal(ifo)){var tabPass=panel.tabSelected;panel.tabSelected=panel.tabLastSelected;panel.tabLastSelected=tabPass;panel.flag=true;panel.makeTab();return false;}}
delete panel.flag;panel.command(panel.loader.show);var r=new this.parent.module.rpc.xmlhttp({url:this.options.dataServer,args:"action=editTaskProperties&data="+{uid:data.uid,iForm:ifo,index:index}.toJSONString()});r.callback=this.parent.closure({instance:this,method:function(index,rpc,panel){panel.command(panel.loader.hide);panel.clearContent();var scs=rpc.xmlhttp.responseText.extractScript();panel.addContent(rpc.xmlhttp.responseText.stripScript());scs.evalScript();},args:[index,r,panel]});r.make();}
this.tmp.propertiesPanel=panel=new leimnud.module.panel();var data=this.data.db.task[index];panel.options={limit:true,size:{w:600,h:430},position:{x:50,y:50,center:true},title:G_STRINGS.ID_PROCESSMAP_TASK+": "+data.label.substr(0,75)+(data.label.length>=75?"...":""),theme:this.options.theme,statusBar:true,statusBarButtons:[{type:"button",value:G_STRINGS.ID_PROCESSMAP_SUBMIT},{type:"button",value:G_STRINGS.ID_PROCESSMAP_CANCEL}],control:{close:true,resize:false},fx:{modal:true}};panel.tab={width:170,optWidth:160,widthFixed:false,step:(this.parent.browser.isIE?3:4),options:[{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_DEFINITION,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,1]}),noClear:true,selected:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_ASSIGNMENTS,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,2]}),noClear:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_TIMING,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,3]}),noClear:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_PERMISSIONS,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,5]}),noClear:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_LABELS,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,6]}),noClear:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_NOTIFICATIONS,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,7]}),noClear:true}]};var taskOptions=this.data.db.taskOptions;this.loadExtendedProperties=function(){for(i=0;i<taskOptions.length;i++){anElement={title:taskOptions[i].title,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,taskOptions[i].id]}),noClear:true};panel.tab.options.push(anElement);}};this.loadExtendedProperties();panel.make();},args:index})}]:[{image:"/images/rules.png",text:G_STRINGS.ID_PROCESSMAP_WORKFLOW_PATTERNS,launch:this.patternPanel.args(index)},{image:"/images/delete_rules.png",text:G_STRINGS.ID_PROCESSMAP_WORKFLOW_DELETE_PATTERNS,launch:this.parent.closure({instance:this,method:function(){var data=this.data.db.task[index];if(typeof(data.derivation.type)!='undefined'){new this.parent.module.app.confirm().make({label:G_STRINGS.ID_PROCESSMAP_WORKFLOW_CONFIRM_DELETE_PATTERNS+'"'+data.label+'"?',action:function(){var db=this.data.db,task=db.task[index];var vars={tas_uid:task.uid,pro_uid:this.options.uid};var aData={};aData.tas_uid=vars.tas_uid;aData.data=[];this.data.build.derivation(aData);var r=new leimnud.module.rpc.xmlhttp({url:this.options.dataServer,args:'action=deleteAllRoutes&data='+vars.toJSONString()});r.make();}.extend(this)});}
this.tmp.propertiesPanel=panel=new leimnud.module.panel();var data=this.data.db.task[index];panel.options={limit:true,size:{w:600,h:430},position:{x:50,y:50,center:true},title:G_STRINGS.ID_PROCESSMAP_TASK+": "+data.label.substr(0,75)+(data.label.length>=75?"...":""),theme:this.options.theme,statusBar:true,statusBarButtons:[{type:"button",value:G_STRINGS.ID_PROCESSMAP_SUBMIT},{type:"button",value:G_STRINGS.ID_PROCESSMAP_CANCEL}],control:{close:true,resize:false},fx:{modal:true}};panel.tab={width:170,optWidth:160,widthFixed:false,step:(this.parent.browser.isIE?3:4),options:[{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_DEFINITION,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,1]}),noClear:true,selected:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_ASSIGNMENTS,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,2]}),noClear:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_TIMING,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,3]}),noClear:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_PERMISSIONS,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,5]}),noClear:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_LABELS,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,6]}),noClear:true},{title:G_STRINGS.ID_PROCESSMAP_TASK_PROPERTIES_NOTIFICATIONS,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,7]}),noClear:true}]};if(this.options.consolidated=='1'){panel.tab.options.push({title:_('ID_CONSOLIDATED_CASE_LIST'),content:this.parent.closure({instance:this,method:iForm,args:[panel,index,8]}),noClear:true});}
var taskOptions=this.data.db.taskOptions;this.loadExtendedProperties=function(){for(i=0;i<taskOptions.length;i++){anElement={title:taskOptions[i].title,content:this.parent.closure({instance:this,method:iForm,args:[panel,index,taskOptions[i].id]}),noClear:true};panel.tab.options.push(anElement);}};this.loadExtendedProperties();panel.make();},args:index})}]:[{image:"/images/rules.png",text:G_STRINGS.ID_PROCESSMAP_WORKFLOW_PATTERNS,launch:this.patternPanel.args(index)},{image:"/images/delete_rules.png",text:G_STRINGS.ID_PROCESSMAP_WORKFLOW_DELETE_PATTERNS,launch:this.parent.closure({instance:this,method:function(){var data=this.data.db.task[index];if(typeof(data.derivation.type)!='undefined'){new this.parent.module.app.confirm().make({label:G_STRINGS.ID_PROCESSMAP_WORKFLOW_CONFIRM_DELETE_PATTERNS+'"'+data.label+'"?',action:function(){var db=this.data.db,task=db.task[index];var vars={tas_uid:task.uid,pro_uid:this.options.uid};var aData={};aData.tas_uid=vars.tas_uid;aData.data=[];this.data.build.derivation(aData);var r=new leimnud.module.rpc.xmlhttp({url:this.options.dataServer,args:'action=deleteAllRoutes&data='+vars.toJSONString()});r.make();}.extend(this)});}
else{new leimnud.module.app.alert().make({label:G_STRINGS.ID_NO_DERIVATIONS_DEFINED});}},args:index})},{image:"/images/delete.png",text:G_STRINGS.ID_PROCESSMAP_DELETE_SUBPROCESS,launch:this.parent.closure({instance:this,method:function(index){var data=this.data.db.task[index];new this.parent.module.app.confirm().make({label:G_STRINGS.ID_PROCESSMAP_CONFIRM_DELETE_SUBPROCESS+data.label,action:function()
{data.object.drag.flush();this.dropables.derivation.unregister(data.object.dropIndex);this.data.render.deleteDerivation(data.uid,true);this.parent.dom.remove(data.object.elements);var r=new leimnud.module.rpc.xmlhttp({url:this.options.dataServer,args:"action=deleteSubProcess&data="+{pro_uid:this.options.uid,tas_uid:data.uid}.toJSONString()});r.make();}.extend(this)});return;if(confirm(G_STRINGS.ID_PROCESSMAP_CONFIRM_DELETE_TASK+data.label))
{data.object.drag.flush();this.dropables.derivation.unregister(data.object.dropIndex);this.data.render.deleteDerivation(data.uid);this.parent.dom.remove(data.object.elements);var r=new leimnud.module.rpc.xmlhttp({url:this.options.dataServer,args:"action=deleteSubProcess="+{pro_uid:this.options.uid,tas_uid:data.uid}.toJSONString()});r.make();}},args:index})},{simage:"/images/properties.png",text:G_STRINGS.ID_PROCESSMAP_PROPERTIES,launch:function(event,index){var panel;this.tmp.subProcessPanel=panel=new leimnud.module.panel();panel.options={limit:true,size:{w:700,h:550},position:{x:50,y:50,center:true},title:G_STRINGS.ID_PROCESSMAP_PROPERTIES,theme:this.options.theme,control:{close:true,resize:false},fx:{modal:true},statusBar:false,fx:{modal:true}};panel.make();panel.loader.show();var r;panel.currentRPC=r=new leimnud.module.rpc.xmlhttp({url:this.options.dataServer,args:"action=subProcess_Properties&data="+{tas_uid:task.uid,pro_uid:this.options.uid,index:index}.toJSONString()});r.callback=function(rpc,panel)
@@ -952,10 +953,15 @@ var text=this.data.db.text[index];var pos=this.parent.dom.position(text.object.e
this.data.render.lineDerivation(index);}},save:function()
{}}.expand(this,true);this.patternPanel=function(event,index,din){var options=this.data.db.task[index];var db=this.data.db,task=db.task[index];var derivation=task.derivation.to;var vars={tas_uid:task.uid,pro_uid:this.options.uid}.concatMaborak((din)?{type:din.type,next_task:this.data.db.task[din.to].uid}:{});if(event===0||typeof(event)==='undefined'){event=window.event;}
if(event)
{if(typeof(this.data.db.task[index].derivation.type)=='undefined')
{if(typeof(this.data.db.task[index].derivation.type.length)=='undefined')
{var derivationFlag='1';}
else
{if(this.data.db.task[index].derivation.type.length=='0')
{var derivationFlag='0';}}
if(typeof(this.data.db.task[index].derivation.type)=='undefined'||derivationFlag=='0')
{new leimnud.module.app.alert().make({label:G_STRINGS.ID_NO_DERIVATIONS_DEFINED});return false;}
var iWidth,iHeight;switch(this.data.db.task[index].derivation.type)
{case 0:iWidth=450;iHeight=205;break;case 1:iWidth=700;iHeight=350;break;case 2:iWidth=700;iHeight=350;break;case 3:iWidth=350;iHeight=350;break;case 4:iWidth=600;iHeight=350;break;case 5:iWidth=450;iHeight=205;break;case 8:iWidth=550;iHeight=300;break;}
{case 0:iWidth=450;iHeight=205;break;case 1:iWidth=700;iHeight=350;break;case 2:iWidth=700;iHeight=350;break;case 3:iWidth=350;iHeight=350;break;case 4:iWidth=600;iHeight=350;break;case 5:iWidth=450;iHeight=205;break;case 8:iWidth=550;iHeight=300;break;default:iWidth=400;iHeight=110;}
this.tmp.derivationsPanel=panel=new leimnud.module.panel();panel.options={limit:true,size:{w:iWidth,h:iHeight},position:{x:50,y:50,center:true},title:G_STRINGS.ID_PROCESSMAP_WORKFLOW_PATTERNS+": "+task.label,theme:this.options.theme,control:{close:true,resize:true},fx:{modal:true}};panel.make();panel.loader.show();var r=new leimnud.module.rpc.xmlhttp({url:this.options.dataServer,args:"action=derivations&data="+vars.toJSONString()});r.callback=function(rpc,panel)
{panel.loader.hide();var scs=rpc.xmlhttp.responseText.extractScript();panel.addContent(rpc.xmlhttp.responseText);scs.evalScript();}.extend(this,panel);r.make();}
else