GI-26 Drive - Evaluar y revisar la implementación de EndPoints

This commit is contained in:
Marco A. Nina Mena
2015-11-16 15:10:57 -04:00
parent 1edc723b1e
commit b242ac1544
5 changed files with 278 additions and 43 deletions

View File

@@ -66,15 +66,15 @@ if(this.options.control.resize)
else
{this.parent.dom.setStyle(this.elements.resize,{background:"transparent"});}};this.makeTab=function(dynamic)
{if(this.loading===true){return false;}
var thm=this.tab.display==="vertical"?"":"H";var tb=this.elements.tabOptions[this.tabSelected];tb.className="panel_tabOptionSelected"+thm+"___"+this.getTheme("tabOptionSelected");tb.onmouseover=function(o,j){o=window.event?o:j;o.a.className=o.b;}.args({a:tb,b:"panel_tabOptionSelectedOver"+thm+"___"+this.getTheme("tabOptionSelectedOver")});tb.onmouseout=function(o,j){o=window.event?o:j;o.a.className=o.b;}.args({a:tb,b:"panel_tabOptionSelected"+thm+"___"+this.getTheme("tabOptionSelected")});var tc=(typeof this.tab.options[this.tabSelected].content);if(!dynamic)
var thm=this.tab.display==="vertical"?"":"H";var tb=this.elements.tabOptions[this.tabSelected];tb.className="panel_tabOptionSelected"+thm+"___"+this.getTheme("tabOptionSelected");tb.onmouseover=function(o,j){o=window.event?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?j:o):j;o.a.className=o.b;}.args({a:tb,b:"panel_tabOptionSelectedOver"+thm+"___"+this.getTheme("tabOptionSelectedOver")});tb.onmouseout=function(o,j){o=window.event?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?j:o):j;o.a.className=o.b;}.args({a:tb,b:"panel_tabOptionSelected"+thm+"___"+this.getTheme("tabOptionSelected")});var tc=(typeof this.tab.options[this.tabSelected].content);if(!dynamic)
{if(this.tab.display==="vertical")
{var hj=(parseInt(this.parent.dom.getStyle(tb,"width"),10)-((!this.parent.browser.isIE)?3:0));this.parent.dom.setStyle(tb,{width:hj,borderLeftWidth:4});}
{var hj=(parseInt(this.parent.dom.getStyle(tb,"width"),10)-((!this.parent.browser.isIE)?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?0:3):0));this.parent.dom.setStyle(tb,{width:hj,borderLeftWidth:4});}
else
{this.parent.dom.setStyle(tb,{});}}
tb.onmouseup=function(){return false;};if(this.tabLastSelected!==false)
{var tls=this.elements.tabOptions[this.tabLastSelected];tls.className="panel_tabOption"+thm+"___"+this.getTheme("tabOption");tls.onmouseover=function(o,j){o=window.event?o:j;o.a.className=o.b;}.args({a:tls,b:"panel_tabOptionOver"+thm+"___"+this.getTheme("tabOptionOver")});tls.onmouseout=function(o,j){o=window.event?o:j;o.a.className=o.b;}.args({a:tls,b:"panel_tabOption"+thm+"___"+this.getTheme("tabOption")});tls.onmouseup=function(event,tabID){if(this.tab.manualDisabled){return false;}
this.tabSelected=(this.parent.browser.isIE)?event:tabID;this.makeTab();return false;}.extend(this,this.tabLastSelected);if(this.tab.display==="vertical")
{this.parent.dom.setStyle(tls,{width:parseInt(this.parent.dom.getStyle(tb,"width"),10)+((!this.parent.browser.isIE)?3:0),borderLeftWidth:1});}
{var tls=this.elements.tabOptions[this.tabLastSelected];tls.className="panel_tabOption"+thm+"___"+this.getTheme("tabOption");tls.onmouseover=function(o,j){o=window.event?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?j:o):j;o.a.className=o.b;}.args({a:tls,b:"panel_tabOptionOver"+thm+"___"+this.getTheme("tabOptionOver")});tls.onmouseout=function(o,j){o=window.event?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?j:o):j;o.a.className=o.b;}.args({a:tls,b:"panel_tabOption"+thm+"___"+this.getTheme("tabOption")});tls.onmouseup=function(event,tabID){if(this.tab.manualDisabled){return false;}
this.tabSelected=(this.parent.browser.isIE)?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?tabID:event):tabID;this.makeTab();return false;}.extend(this,this.tabLastSelected);if(this.tab.display==="vertical")
{this.parent.dom.setStyle(tls,{width:parseInt(this.parent.dom.getStyle(tb,"width"),10)+((!this.parent.browser.isIE)?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?0:3):0),borderLeftWidth:1});}
else
{this.parent.dom.setStyle(tls,{});}
this.parent.dom.setStyle(tls,this.setStyle.tabOption||{});}
@@ -175,7 +175,7 @@ else
if(this.options.strict_position)
{this.options.position.x=(this.options.position.x<0)?0:this.options.position.x;this.options.position.y=(this.options.position.y<0)?0:this.options.position.y;}
this.zIndex=this.options.zIndex||this.makezIndex();this.parent.dom.setStyle(this.elements.containerWindow,{width:this.options.size.w,height:this.options.size.h,position:"absolute",left:this.options.position.x,top:this.options.position.y,opacity:this.styles.fx.opacityPanel.Static/100,filter:"alpha(opacity="+this.styles.fx.opacityPanel.Static+")",zIndex:this.zIndex});this.parent.dom.setStyle(this.elements.containerWindow,this.setStyle.containerWindow||{});},frontend:function()
{this.parent.dom.setStyle(this.elements.frontend,{width:(this.parent.browser.isIE)?"auto":"100%"});this.parent.dom.setStyle(this.elements.frontend,this.setStyle.frontend||{});},backend:function()
{this.parent.dom.setStyle(this.elements.frontend,{width:(this.parent.browser.isIE)?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?"100%":"auto"):"100%"});this.parent.dom.setStyle(this.elements.frontend,this.setStyle.frontend||{});},backend:function()
{this.parent.dom.setStyle(this.elements.backend,{});this.parent.dom.setStyle(this.elements.backend,this.setStyle.backend||{});},loader:function()
{this.parent.dom.setStyle(this.elements.loader,{background:"url('/images/classic/loader_B.gif')",backgroundRepeat:"no-repeat",width:32,height:32,position:"absolute",display:"none"});this.parent.dom.setStyle(this.elements.loader,this.setStyle.loader||{});},iframe:function()
{this.parent.dom.setStyle(this.elements.iframe,{});this.parent.dom.setStyle(this.elements.iframe,this.setStyle.iframe||{});},titleBar:function()
@@ -186,18 +186,19 @@ this.zIndex=this.options.zIndex||this.makezIndex();this.parent.dom.setStyle(this
{this.parent.dom.setStyle(this.elements.close,{height:this.controlSize.h,right:this.controlPosition(),width:this.controlSize.w});this.parent.dom.setStyle(this.elements.close,this.setStyle.close||{});this.parent.event.add(this.elements.close,"mouseup",this.remove,false);},headerBar:function()
{this.parent.dom.setStyle(this.elements.headerBar,{display:((!this.options.headerBar)?"none":"block")});this.parent.dom.setStyle(this.elements.headerBar,this.setStyle.headerBar||{});},shadow:function()
{this.parent.dom.setStyle(this.elements.shadow,{width:this.elements.containerWindow.offsetWidth,height:this.elements.containerWindow.offsetHeight,top:(parseInt(this.parent.dom.getStyle(this.elements.containerWindow,"top"),10)+2),left:(parseInt(this.parent.dom.getStyle(this.elements.containerWindow,"left"),10)+2),opacity:this.styles.fx.opacityShadow.Static/100,filter:"alpha(opacity="+this.styles.fx.opacityShadow.Static+")",zIndex:this.zIndex-2});this.parent.dom.setStyle(this.elements.shadow,this.setStyle.shadow||{});},modal:function()
{var ps=[this.parent.dom.get_doc().scrollWidth,this.parent.dom.get_doc().scrollHeight];this.parent.dom.setStyle(this.elements.modal,{height:ps[1],width:ps[0],position:"absolute",zIndex:this.zIndex-3});if(this.options.fx.fadeIn===true)
{var ps=[this.parent.dom.get_doc().scrollWidth,this.parent.dom.get_doc().scrollHeight];this.parent.dom.setStyle(this.elements.modal,{height:ps[1],width:ps[0],position:"absolute",zIndex:this.zIndex-3});if(!!navigator.userAgent.match(/Trident.*rv[ :]*11\./)){this.parent.dom.setStyle(this.elements.modal,{opacity:this.styles.fx.opacityShadow.Static/100});}
if(this.options.fx.fadeIn===true)
{new this.parent.module.fx.fade().make({duration:1000,end:this.styles.fx.opacityModal.Static/100,dom:this.elements.modal});}
else
{this.parent.dom.opacity(this.elements.modal,this.styles.fx.opacityModal.Static);}
this.parent.dom.setStyle(this.elements.modal,this.setStyle.modal||{});},tab:function()
{this.tab={display:"horizontal",initIn:20,step:5,optHeight:20,widthFixed:true,optWidth:this.tab.width-4}.concatMaborak(this.tab);var thm=this.tab.display==="vertical"?"":"H";var heightContent=this.options.size.h-(this.elements.titleBar.offsetHeight+this.elements.statusBar.offsetHeight);var beginTop=this.elements.titleBar.offsetHeight+this.elements.headerBar.offsetHeight;var beginLeft=4;var space=this.spaceOutPanel();this.tab.width=(this.tab.display==="vertical")?((this.tab.options)?((this.tab.width)?this.tab.width:80):0):4;this.parent.dom.setStyle(this.elements.tab,this.setStyle.tab||{});if(this.tab.options)
{this.parent.dom.setStyle(this.elements.tab,{height:((this.tab.display==="vertical")?heightContent:this.tab.optHeight+4+(this.parent.browser.isIE?14:0)),width:((this.tab.display==="vertical")?this.tab.width:this.options.size.w-8),top:beginTop,left:((this.tab.display==="vertical")?0:4)});this.tabSelected=false;this.tabLastSelected=false;this.tab.diffWidthBugPadding=((this.parent.browser.isIE)?0:20);this.elements.tabOptions=[];var lastBul=0;for(var i=0;i<this.tab.options.length;i++)
{var opH=this.tab.initIn+(this.tab.step*i)+(this.tab.optHeight*i);var opW=(this.tab.initIn+((this.tab.widthFixed===true)?(this.tab.optWidth*i):lastBul))+(this.tab.step*i);var tb=$dce("div");this.parent.dom.setStyle(tb,{padding:5,paddingLeft:((this.tab.display==="vertical")?15:5),paddingTop:((this.tab.display==="vertical")?5:4),width:((this.tab.widthFixed)?this.tab.optWidth-((this.tab.display==="vertical")?this.tab.diffWidthBugPadding:10):(typeof(mb_strlen)!=='undefined'?(mb_strlen(this.tab.options[i].title||'')*0.60)+'em':'auto')),position:"absolute",left:((this.tab.display==="vertical")?((this.tab.width-this.tab.optWidth)-((this.parent.browser.isIE)?-1:1)):opW),top:((this.tab.display==="vertical")?opH:0),bottom:((this.tab.display==="vertical")?"auto":0)});tb.innerHTML=this.tab.options[i].title||"";if(this.tab.options[i].selected===true)
{this.parent.dom.setStyle(this.elements.tab,{height:((this.tab.display==="vertical")?heightContent:this.tab.optHeight+4+(this.parent.browser.isIE?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?0:14):0)),width:((this.tab.display==="vertical")?this.tab.width:this.options.size.w-8),top:beginTop,left:((this.tab.display==="vertical")?0:4)});this.tabSelected=false;this.tabLastSelected=false;this.tab.diffWidthBugPadding=((this.parent.browser.isIE)?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?20:0):20);this.elements.tabOptions=[];var lastBul=0;for(var i=0;i<this.tab.options.length;i++)
{var opH=this.tab.initIn+(this.tab.step*i)+(this.tab.optHeight*i);var opW=(this.tab.initIn+((this.tab.widthFixed===true)?(this.tab.optWidth*i):lastBul))+(this.tab.step*i);var tb=$dce("div");this.parent.dom.setStyle(tb,{padding:5,paddingLeft:((this.tab.display==="vertical")?15:5),paddingTop:((this.tab.display==="vertical")?5:4),width:((this.tab.widthFixed)?this.tab.optWidth-((this.tab.display==="vertical")?this.tab.diffWidthBugPadding:10):(typeof(mb_strlen)!=='undefined'?(mb_strlen(this.tab.options[i].title||'')*0.60)+'em':'auto')),position:"absolute",left:((this.tab.display==="vertical")?((this.tab.width-this.tab.optWidth)-((this.parent.browser.isIE)?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?1:-1):1)):opW),top:((this.tab.display==="vertical")?opH:0),bottom:((this.tab.display==="vertical")?"auto":0)});tb.innerHTML=this.tab.options[i].title||"";if(this.tab.options[i].selected===true)
{this.tabSelected=i;tb.className="panel_tabOptionSelected"+thm+"___"+this.getTheme("tabOptionSelected");}
else
{tb.className="panel_tabOption"+thm+"___"+this.getTheme("tabOption");tb.onmouseover=function(o,j){o=window.event?o:j;o.a.className=o.b;}.args({a:tb,b:"panel_tabOptionOver"+thm+"___"+this.getTheme("tabOptionOver")});tb.onmouseout=function(o,j){o=window.event?o:j;o.a.className=o.b;}.args({a:tb,b:"panel_tabOption"+thm+"___"+this.getTheme("tabOption")});this.parent.dom.setStyle(tb,this.setStyle.tabOption||{});tb.onmouseup=function(event,tabID){if(this.tab.manualDisabled){return false;}
this.tabSelected=(this.parent.browser.isIE)?event:tabID;this.makeTab();return false;}.extend(this,i);}
{tb.className="panel_tabOption"+thm+"___"+this.getTheme("tabOption");tb.onmouseover=function(o,j){o=window.event?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?j:o):j;o.a.className=o.b;}.args({a:tb,b:"panel_tabOptionOver"+thm+"___"+this.getTheme("tabOptionOver")});tb.onmouseout=function(o,j){o=window.event?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?j:o):j;o.a.className=o.b;}.args({a:tb,b:"panel_tabOption"+thm+"___"+this.getTheme("tabOption")});this.parent.dom.setStyle(tb,this.setStyle.tabOption||{});tb.onmouseup=function(event,tabID){if(this.tab.manualDisabled){return false;}
this.tabSelected=(this.parent.browser.isIE)?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?tabID:event):tabID;this.makeTab();return false;}.extend(this,i);}
this.elements.tab.appendChild(tb);lastBul+=tb.clientWidth;this.elements.tabOptions.push(tb);}
this.tabSelected=(this.tabSelected===false)?0:this.tabSelected;this.makeTab();}},content:function()
{var mgLeft=((this.tab.options)?parseInt(this.parent.dom.getStyle(this.elements.tab,"width"),10):4);var mgTop=((this.tab.options)?parseInt(this.parent.dom.getStyle(this.elements.tab,"height"),10)-1:4);this.parent.dom.setStyle(this.elements.content,{borderTopWidth:(!this.options.titleBar)?0:'auto',margin:4,marginLeft:((this.tab.display==="vertical")?mgLeft:4),marginTop:((this.tab.display==="vertical")?4:mgTop)});var tamH=this.elements.titleBar.offsetHeight+this.elements.statusBar.offsetHeight+this.elements.headerBar.offsetHeight;var heightContent=this.options.size.h-tamH-(this.tab.options?20:0);this.parent.dom.setStyle(this.elements.content,this.setStyle.content||{});var space=this.spaceOutPanel();var hC=(heightContent-space.y);var wC=(this.options.size.w-space.x);this.parent.dom.setStyle(this.elements.content,{height:hC,width:wC});this.originalContent={w:wC,h:hC};},statusBar:function()
@@ -206,7 +207,7 @@ this.tabSelected=(this.tabSelected===false)?0:this.tabSelected;this.makeTab();}}
this.parent.dom.setStyle(this.elements.statusBar,this.setStyle.statusBar||{});},status:function()
{this.parent.dom.setStyle(this.elements.status,{display:((this.options.control.resize&&!this.options.statusBarButtons)?"":"none")});this.parent.dom.setStyle(this.elements.status,this.setStyle.status||{});},statusButtons:function()
{this.parent.dom.setStyle(this.elements.statusButtons,{position:"relative",textAlign:"center",display:((this.options.statusBarButtons)?"":"none")});this.parent.dom.setStyle(this.elements.statusButtons,this.setStyle.statusButtons||{});},resize:function()
{this.parent.dom.setStyle(this.elements.resize,{});this.parent.dom.setStyle(this.elements.resize,this.setStyle.resize||{});},fx:{opacityShadow:{Static:20,Move:5},opacityModal:{Static:40,Move:10},opacityPanel:{Static:100,Move:50}},tabCSS:{over:function(event,obj){obj=this.parent.browser.isIE?event:obj;this.parent.dom.setStyle(obj,{});},out:function(event,obj){obj=this.parent.browser.isIE?event:obj;this.parent.dom.setStyle(obj,{});},sover:function(event,obj){obj=this.parent.browser.isIE?event:obj;this.parent.dom.setStyle(obj,{cursor:"default"});},sout:function(event,obj){obj=this.parent.browser.isIE?event:obj;this.parent.dom.setStyle(obj,{});},sel:{font:"normal 8pt Tahoma,MiscFixed",border:"1px solid #A3A2BC",borderRight:"1px solid #FFF",backgroundColor:"white",fontWeight:"bold",textAlign:"left",color:"#000000"},def:{font:"normal 8pt Tahoma,Miscfixed",border:"1px solid #A3A2BC",margin:0,fontWeight:"normal",color:"#000000",backgroundColor:"EEEEEE",textAlign:"left",cursor:"default"}}}.expand(this,true);this.makeTheme=function()
{this.parent.dom.setStyle(this.elements.resize,{});this.parent.dom.setStyle(this.elements.resize,this.setStyle.resize||{});},fx:{opacityShadow:{Static:20,Move:5},opacityModal:{Static:40,Move:10},opacityPanel:{Static:100,Move:50}},tabCSS:{over:function(event,obj){obj=this.parent.browser.isIE?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?obj:event):obj;this.parent.dom.setStyle(obj,{});},out:function(event,obj){obj=this.parent.browser.isIE?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?obj:event):obj;this.parent.dom.setStyle(obj,{});},sover:function(event,obj){obj=this.parent.browser.isIE?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?obj:event):obj;this.parent.dom.setStyle(obj,{cursor:"default"});},sout:function(event,obj){obj=this.parent.browser.isIE?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?obj:event):obj;this.parent.dom.setStyle(obj,{});},sel:{font:"normal 8pt Tahoma,MiscFixed",border:"1px solid #A3A2BC",borderRight:"1px solid #FFF",backgroundColor:"white",fontWeight:"bold",textAlign:"left",color:"#000000"},def:{font:"normal 8pt Tahoma,Miscfixed",border:"1px solid #A3A2BC",margin:0,fontWeight:"normal",color:"#000000",backgroundColor:"EEEEEE",textAlign:"left",cursor:"default"}}}.expand(this,true);this.makeTheme=function()
{this.themesDefault=["processmaker_fixed","panel","firefox"];this.theme=this.options.theme||"firefox";if(this.themesDefault.inArray(this.theme))
{this.theme="processmaker";}};this.getTheme=function(obj)
{return(this.customTheme&&this.customTheme[obj])?this.customTheme[obj]:this.theme;};this.command=function(fn,args,ret)
@@ -304,12 +305,12 @@ var spT=$dce("div");spT.className="app_menuRight_option_text___"+this.options.th
{}
else
{dv.onclick=this.launch.args(i);}
dv.onmouseover=function(evt,el){dv=(this.parent.browser.isIE?evt:el);var i=dv.i;dv.a.className="app_menuRight_option_over___"+this.options.theme;dv.b.className="app_menuRight_option_image_over___"+this.options.theme;if(this.submenu&&this.submenu_current_i!=i)
dv.onmouseover=function(evt,el){dv=(this.parent.browser.isIE?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?el:evt):el);var i=dv.i;dv.a.className="app_menuRight_option_over___"+this.options.theme;dv.b.className="app_menuRight_option_image_over___"+this.options.theme;if(this.submenu&&this.submenu_current_i!=i)
{this.submenu.remove();delete this.submenu;this.submenu_current_d.a.className="app_menuRight_option___"+this.options.theme;this.submenu_current_d.b.className="app_menuRight_option_image___"+this.options.theme;}
if(this.submenu&&this.submenu_current_i==i)
{return false;}
if(this.options.menu[i].submenu)
{var m=this.parent.dom.mouse(this.evt);var m=this.cursor;var n=this.parent.dom.position(dv.a,true);this.submenu_current_i=i;this.submenu_current_d=dv;this.submenu=new this.parent.module.app.menuRight();this.submenu.make({target:dv.a,width:201,auto_event:this.evt,auto_position:{x:n.x-5,y:n.y-15},parent_menu:this,theme:this.options.theme,menu:this.options.menu[i].submenu});this.submenu.menu();this.parent.event.add(this.options.targetRemove||this.options.target,"click",this.submenu.updateObservers);}}.extend(this,{a:dv,b:spI,i:i});dv.onmouseout=function(evt,el){var dv=(this.parent.browser.isIE?evt:el);if(this.submenu)
{var m=this.parent.dom.mouse(this.evt);var m=this.cursor;var n=this.parent.dom.position(dv.a,true);this.submenu_current_i=i;this.submenu_current_d=dv;this.submenu=new this.parent.module.app.menuRight();this.submenu.make({target:dv.a,width:201,auto_event:this.evt,auto_position:{x:n.x-5,y:n.y-15},parent_menu:this,theme:this.options.theme,menu:this.options.menu[i].submenu});this.submenu.menu();this.parent.event.add(this.options.targetRemove||this.options.target,"click",this.submenu.updateObservers);}}.extend(this,{a:dv,b:spI,i:i});dv.onmouseout=function(evt,el){var dv=(this.parent.browser.isIE?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?el:evt):el);if(this.submenu)
{return false;}
dv.a.className="app_menuRight_option___"+this.options.theme;dv.b.className="app_menuRight_option_image___"+this.options.theme;}.extend(this,{a:dv,b:spI});this.parent.dom.nullContextMenu([spI,spT,dv]);}
else
@@ -317,7 +318,7 @@ else
ii++;}};this.launch=function(evt,opt)
{if(this.options.parent_menu)
{this.options.parent_menu.updateObservers();}
this.remove();opt=this.parent.browser.isIE?evt:opt;var lch=this.options.menu[opt];if(lch&&typeof lch.launch=="function")
this.remove();opt=this.parent.browser.isIE?((!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))?opt:evt):opt;var lch=this.options.menu[opt];if(lch&&typeof lch.launch=="function")
{lch.launch(evt);}};this.validate=function()
{this.options.target=this.parent.dom.element(this.options.target);return(!this.options.target||!this.options.menu)?false:true;};this.updateObservers=function()
{try{this.observer.update();}catch(e){this.remove();}};this.remove=function()
@@ -799,8 +800,8 @@ var deleteUploadedDocument=function(APP_DOC_UID){new leimnud.module.app.confirm(
else{cases_AllInputdocsList.refresh();}}.extend(this);oRPC.make();}.extend(this)});};var deleteGeneratedDocument=function(APP_DOC_UID){new leimnud.module.app.confirm().make({label:G_STRINGS.ID_MSG_CONFIRM_DELETE_FILE,action:function(){var oRPC=new leimnud.module.rpc.xmlhttp({url:'cases_Ajax',args:'action=deleteGeneratedDocument&DOC='+APP_DOC_UID});oRPC.callback=function(oRPC){if((window.location.href.indexOf('/cases/cases_Step')>-1)&&(window.location.href.indexOf('?TYPE=OUTPUT_DOCUMENT&UID=')>-1)&&(window.location.href.indexOf('&ACTION=VIEW&')>-1)&&(window.location.href.indexOf('&DOC='+APP_DOC_UID)>-1)){window.location=getField('DYN_FORWARD');}
else{cases_AllOutputdocsList.refresh();}}.extend(this);oRPC.make();}.extend(this)});};var resendMessage=function(APP_UID,APP_MSG_UID)
{new leimnud.module.app.confirm().make({label:G_STRINGS.ID_MSG_CONFIRM_RESENDMSG,action:function(){var oRPC=new leimnud.module.rpc.xmlhttp({url:'cases_Ajax',args:'action=resendMessage&APP_UID='+APP_UID+'&APP_MSG_UID='+APP_MSG_UID});oRPC.callback=function(rpc){messagesListPanel.clearContent();messagesListPanel.loader.show();var oRPC2=new leimnud.module.rpc.xmlhttp({url:'cases_Ajax',args:'action=showHistoryMessages'});oRPC2.callback=function(rpc){messagesListPanel.loader.hide();var scs=rpc.xmlhttp.responseText.extractScript();messagesListPanel.addContent(rpc.xmlhttp.responseText);scs.evalScript();}.extend(this);oRPC2.make();}.extend(this);oRPC.make();}.extend(this)});};function showdebug()
{if(typeof parent!='undefined'&&typeof parent.parent!='undefined'){if(typeof parent.parent.Ext!='undefined'){if(!parent.parent.PANEL_EAST_OPEN){var debugPanel=parent.parent.Ext.getCmp('debugPanel');parent.parent.PANEL_EAST_OPEN=true;debugPanel.show();debugPanel.ownerCt.doLayout();debugPanel.expand();}
parent.parent.propStore.load();parent.parent.triggerStore.load();}}}
{try{if(typeof(parent)!="undefined"&&typeof(parent.parent)!="undefined"&&typeof(parent.parent.Ext)!="undefined"){if(!parent.parent.PANEL_EAST_OPEN){var debugPanel=parent.parent.Ext.getCmp("debugPanel");parent.parent.PANEL_EAST_OPEN=true;debugPanel.show();debugPanel.ownerCt.doLayout();debugPanel.expand();}
parent.parent.propStore.load();parent.parent.triggerStore.load();}}catch(e){}}
var uploadInputDocument=function(docID,appDocId,docVersion,actionType){if(actionType){if(actionType=="R"){windowTitle=G_STRINGS.ID_UPLOAD_REPLACE_INPUT;}
if(actionType=="NV"){windowTitle=G_STRINGS.ID_UPLOAD_NEW_INPUT_VERSION;}}else{windowTitle=G_STRINGS.ID_UPLOAD_NEW_INPUT;docVersion=1;actionType="";appDocId="";}
oPanel=new leimnud.module.panel();oPanel.options={size:{w:550,h:355},position:{x:0,y:0,center:true},title:windowTitle,theme:"processmaker",statusBar:false,control:{resize:true,roll:false},fx:{modal:true,opacity:true,blinkToFront:true,fadeIn:false}};oPanel.events={remove:function(){delete(oPanel);}.extend(this)};oPanel.make();oPanel.loader.show();var oRPC=new leimnud.module.rpc.xmlhttp({url:'cases_Ajax',args:"action=uploadInputDocument&docID="+docID+"&appDocId="+appDocId+"&docVersion="+docVersion+"&actionType="+actionType});oRPC.callback=function(rpc){oPanel.loader.hide();var scs=rpc.xmlhttp.responseText.extractScript();oPanel.addContent(rpc.xmlhttp.responseText);scs.evalScript();}.extend(this);oRPC.make();};var uploadToReviseInputDocument=function(docID,appDocId,docVersion,actionType){if(actionType){if(actionType=="R"){windowTitle=G_STRINGS.ID_UPLOAD_REPLACE_INPUT;}

View File

@@ -16,6 +16,12 @@ class PMGoogleApi
private $domain;
private $user;
private $typeAuthentication;
private $clientId;
private $clientSecret;
private $redirectUrl = 'http://localhost/index.html';
private $accountJson;
public function __construct()
{
$licensedFeatures = &PMLicensedFeatures::getSingleton();
@@ -114,6 +120,81 @@ class PMGoogleApi
return $this->domain;
}
public function setTypeAuthentication($type)
{
$conf = $this->getConfigGmail();
$conf->aConfig['typeAuthentication'] = $type;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->typeAuthentication = $type;
}
public function getTypeAuthentication()
{
return $this->typeAuthentication;
}
public function setAccountJson($accountJson)
{
$conf = $this->getConfigGmail();
$conf->aConfig['accountJson'] = $accountJson;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->accountJson = $accountJson;
}
public function getAccountJson()
{
return $this->accountJson;
}
public function setClientId($clientId)
{
$conf = $this->getConfigGmail();
$conf->aConfig['clientId'] = $clientId;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->clientId = $clientId;
}
public function getClientId()
{
return $this->clientId;
}
public function setClientSecret($clientSecret)
{
$conf = $this->getConfigGmail();
$conf->aConfig['clientSecret'] = $clientSecret;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->clientSecret = $clientSecret;
}
public function getClientSecret()
{
return $this->clientSecret;
}
public function setRedirectUrl($redirectUrl)
{
$conf = $this->getConfigGmail();
$conf->aConfig['redirectUrl'] = $redirectUrl;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->redirectUrl = $redirectUrl;
}
public function getRedirectUrl()
{
return $this->redirectUrl;
}
/**
* load configuration gmail service account
*
@@ -122,11 +203,25 @@ class PMGoogleApi
{
$conf = $this->getConfigGmail();
$typeAuthentication = empty($conf->aConfig['typeAuthentication']) ? '' : $conf->aConfig['typeAuthentication'];
$clientId = empty($conf->aConfig['clientId']) ? '' : $conf->aConfig['clientId'];
$clientSecret = empty($conf->aConfig['clientSecret']) ? '' : $conf->aConfig['clientSecret'];
$redirectUrl = empty($conf->aConfig['redirectUrl']) ? 'http://localhost/index.html' : $conf->aConfig['redirectUrl'];
$accountJson = empty($conf->aConfig['accountJson']) ? '' : $conf->aConfig['accountJson'];
$serviceAccountP12 = empty($conf->aConfig['serviceAccountP12']) ? '' : $conf->aConfig['serviceAccountP12'];
$serviceAccountEmail = empty($conf->aConfig['serviceAccountEmail']) ? '' : $conf->aConfig['serviceAccountEmail'];
$statusService = empty($conf->aConfig['statusService']) ? '' : $conf->aConfig['statusService'];
$this->scope = array();
$this->setRedirectUrl($accountJson);
$this->setTypeAuthentication($typeAuthentication);
//$this->setClientId($clientId);
//$this->setClientSecret($clientSecret);
$this->setAccountJson($accountJson);
$this->setRedirectUrl($redirectUrl);
$this->setServiceAccountEmail($serviceAccountEmail);
$this->setServiceAccountP12($serviceAccountP12);
$this->setStatusService($statusService);
@@ -139,6 +234,24 @@ class PMGoogleApi
*/
public function serviceClient()
{
$client = null;
if ($this->getTypeAuthentication == 'webApplication') {
$key = file_get_contents(PATH_DATA_SITE . $this->accountJson);
$client = new Google_Client();
$client->setAuthConfig($key);
$client->setRedirectUri($this->redirectUrl);
if (!empty($_SESSION['google_token'])) {
$client->setAccessToken($_SESSION['google_token']);
if ($client->isAccessTokenExpired()) {
unset($_SESSION['google_token']);
}
} else {
$authUrl = $client->createAuthUrl();
print_r($authUrl);
}
} else if ($this->getTypeAuthentication == 'serviceAccount') {
$key = file_get_contents(PATH_DATA_SITE . $this->serviceAccountP12);
$assertionCredentials = new Google_Auth_AssertionCredentials(
@@ -151,6 +264,9 @@ class PMGoogleApi
$client = new Google_Client();
$client->setApplicationName("PMDrive");
$client->setAssertionCredentials($assertionCredentials);
} else {
throw new Exception(G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR'));
}
return $client;
}

View File

@@ -20,6 +20,9 @@ class pmGmail extends Controller
$httpData->status_pmgmail = $httpData->status_pmgmail == 1 ? true : false;
$pmGoogle->setStatusService($httpData->status_pmgmail);
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . ($httpData->status_pmgmail ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
$pmGoogle->setTypeAuthentication($httpData->typeAuth);
if (!empty($httpData->email_service_account)) {
$pmGoogle->setServiceAccountEmail($httpData->email_service_account);
$message .= ', ' . G::LoadTranslation('ID_PMG_EMAIL') . ': ' . $httpData->email_service_account;
@@ -31,6 +34,12 @@ class pmGmail extends Controller
$pmGoogle->setServiceAccountP12($_FILES['file_p12']['name']);
$message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_p12']['name'];
}
} if ($_FILES['file_json']['error'] != 1) {
if ($_FILES['file_json']['tmp_name'] != '') {
G::uploadFile($_FILES['file_json']['tmp_name'], PATH_DATA_SITE, $_FILES['file_json']['name']);
$pmGoogle->setAccountJson($_FILES['file_json']['name']);
$message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_json']['name'];
}
} else {
$result->success = false;
$result->fileError = true;
@@ -59,11 +68,16 @@ class pmGmail extends Controller
$pmGoogle = new PMGoogleApi();
$accountEmail = $pmGoogle->getServiceAccountEmail();
$fileP12 = $pmGoogle->getServiceAccountP12();
$fileJson = $pmGoogle->getAccountJson();
$fileJson = $fileJson == null ? '' : $fileJson;
$type = $pmGoogle->getTypeAuthentication();
$enablePMGmail = $pmGoogle->getStatusService();
$this->setJSVar('accountEmail', $accountEmail);
$this->setJSVar('fileP12', $fileP12);
$this->setJSVar('enablePMGmail', $enablePMGmail);
$this->setJSVar('fileJson', $fileJson);
$this->setJSVar('typeAuthentication', $type);
G::RenderPage('publish', 'extJs');

View File

@@ -43,11 +43,17 @@ Ext.onReady(function(){
if (btn == "yes") {
Ext.getCmp('email_service_account').disable();
Ext.getCmp('file_p12').disable();
Ext.getCmp('typeAuthentication').disable();
Ext.getCmp('file_json').disable();
Ext.getCmp('fileJson').disable();
Ext.getCmp('listUsers').hide();
testButton.disable();
saveButton.disable();
saveSettings();
} else {
Ext.getCmp('typeAuthentication').enable();
Ext.getCmp('file_json').enable();
Ext.getCmp('fileJson').enable();
Ext.getCmp('status_pmgmail').enable();
Ext.getCmp('email_service_account').enable();
Ext.getCmp('file_p12').enable();
@@ -60,6 +66,62 @@ Ext.onReady(function(){
}
}
},
{
xtype : 'combo',
id : 'typeAuthentication',
name : 'typeAuthentication',
xtype : 'combo',
fieldLabel : _('GMAIL_TYPE_AUTH'),
//typeAhead : false,
hiddenName: 'typeAuth',
mode : 'local',
triggerAction : 'all',
forceSelection: true,
store: new Ext.data.SimpleStore({
fields: ['value','type'],
data: [['webApplication','Web Application'],['serviceAccount', 'Service Account']],
autoLoad: true
}),
submitValue : true,
value: typeAuthentication,
valueField: 'value',
displayField: 'type',
width: 250,
editable: false,
listeners:{
afterRender: function () {
Ext.getCmp('email_service_account').hide();
Ext.getCmp('file_p12').hide();
Ext.getCmp('labelFileP12').hide();
Ext.getCmp('file_json').hide();
Ext.getCmp('fileJson').hide();
if (typeAuthentication == 'webApplication' ) {
Ext.getCmp('file_json').show();
Ext.getCmp('fileJson').show();
} else if (typeAuthentication == 'serviceAccount' ) {
Ext.getCmp('email_service_account').show();
Ext.getCmp('file_p12').show();
Ext.getCmp('labelFileP12').show();
}
},
select: function(combo){
var value = combo.getValue();
if (value == 'webApplication' ) {
Ext.getCmp('email_service_account').hide();
Ext.getCmp('file_p12').hide();
Ext.getCmp('labelFileP12').hide();
Ext.getCmp('file_json').show();
Ext.getCmp('fileJson').show();
} else {
Ext.getCmp('email_service_account').show();
Ext.getCmp('file_p12').show();
Ext.getCmp('labelFileP12').show();
Ext.getCmp('file_json').hide();
Ext.getCmp('fileJson').hide();
}
}
}
},
{
xtype : 'textfield',
id : 'email_service_account',
@@ -110,11 +172,49 @@ Ext.onReady(function(){
},
{
xtype : 'label',
id : 'labelFileP12',
name : 'labelFileP12',
labelAlign : 'right',
fieldLabel : '',
text : fileP12,
width : 400,
style : "padding-left:180px;"
},
{
xtype : 'fileuploadfield',
id : 'file_json',
emptyText : _('ID_PMG_SELECT_FILE_JSON'),
fieldLabel : _('ID_PMG_FILE_JSON'),
name : 'file_json',
buttonText : '',
width : 400,
disabled : !enablePMGmail,
buttonCfg : {
iconCls : 'upload-icon'
},
listeners:{
change : function(){
changeSettings();
},
afterrender:function(cmp){
changeSettings();
cmp.fileInput.set({
accept:'*/json'
});
}
},
regex : /(.)+((\.json)(\w)?)$/i,
regexText : _('ID_PMG_TYPE_ACCEPT')
},
{
xtype : 'label',
id : 'fileJson',
name : 'fileJson',
labelAlign : 'right',
fieldLabel : '',
text : fileJson,
width : 400,
style : "padding-left:180px;"
}
]
});

View File

@@ -16,6 +16,7 @@ $gCurl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegrat
curl_setopt( $gCurl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
curl_setopt( $gCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $gCurl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $gCurl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt( $gCurl, CURLOPT_CONNECTTIMEOUT, 0);
$gCurl_response = curl_exec( $gCurl );
@@ -33,6 +34,7 @@ $curl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegrati
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
$curl_response = curl_exec( $curl );
@@ -54,6 +56,7 @@ if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp
$optArray = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYHOST, false,
CURLOPT_SSL_VERIFYPEER => false
);
// apply those options
@@ -107,6 +110,7 @@ if ($action == "draft"){
curl_setopt( $curlApp, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt( $curlApp, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $curlApp, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt( $curlApp, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt( $curlApp, CURLOPT_CONNECTTIMEOUT, 0);
$curl_response_app = curl_exec( $curlApp );