| 1 |
- bind={};var library={version:"4.0",defineProperties:Object.defineProperties||function(o,t){function e(t){function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function i(t){return typeof t==="function"}if(typeof t!=="object"||t===null)throw new TypeError("bad desc");var n={};if(e(t,"enumerable"))n.enumerable=!!o.enumerable;if(e(t,"configurable"))n.configurable=!!o.configurable;if(e(t,"value"))n.value=o.value;if(e(t,"writable"))n.writable=!!t.writable;if(e(t,"get")){var r=t.get;if(!i(r)&&typeof r!=="undefined")throw new TypeError("bad get");n.get=r}if(e(t,"set")){var s=t.set;if(!i(s)&&typeof s!=="undefined")throw new TypeError("bad set");n.set=s}if(("get"in n||"set"in n)&&("value"in n||"writable"in n))throw new TypeError("identity-confused descriptor");return n}if(typeof o!=="object"||o===null)throw new TypeError("bad obj");t=Object(t);var i=Object.keys(t);var n=[];for(var r=0;r<i.length;r++)n.push([i[r],e(t[i[r]])]);for(var r=0;r<n.length;r++)Object.defineProperty(o,n[r][0],n[r][1]);return o},typeOf:function(t){if(t==null)return"null";if(t.$family!=null)return t.$family();if(t.constructor==Array)return"array";if(t.nodeName){if(t.nodeType==1)return"element";if(t.nodeType==3)return/\S/.test(t.nodeValue)?"textnode":"whitespace"}else if(typeof t.length=="number"){if(t.callee)return"arguments"}return typeof t},JSONDecode:function(string,secure){if(!string||library.typeOf(string)!="string")return null;return eval("("+string+")")},JSONEncode:function(t){if(t&&t.toJSON)t=t.toJSON();switch(library.typeOf(t)){case"string":return'"'+t.replace(/[\x00-\x1f\\"]/g,escape)+'"';case"array":var e=[];for(var i=0;i<t.length;i++){var n=library.JSONEncode(t[i]);if(n)e.push(n)}return"["+e+"]";case"object":case"hash":var e=[];for(key in t){var n=library.JSONEncode(t[key]);if(n)e.push(library.JSONEncode(key)+":"+n)}return"{"+e+"}";case"number":case"boolean":return""+t;case"null":return"null"}return null}};(function(){var t={indexOf:{value:function(t,e){var i=this.length>>>0;for(var n=e<0?Math.max(0,i+e):e||0;n<i;n++){if(this[n]===t)return n}return-1}}};library.defineProperties(Array.prototype,t)})();var wrapWorkContext={getTask:function(){return library.JSONDecode(workContext.getCurrentTaskCompleted())},getWork:function(){return library.JSONDecode(workContext.getWork())},getActivity:function(){return library.JSONDecode(workContext.getActivity())},getTaskList:function(){return library.JSONDecode(workContext.getTaskList())},getTaskCompletedList:function(){return library.JSONDecode(workContext.getTaskCompletedList())},getReadList:function(){return library.JSONDecode(workContext.getReadList())},getReadCompletedList:function(){return library.JSONDecode(workContext.getReadCompletedList())},getReviewList:function(){return library.JSONDecode(workContext.getReviewList())},getWorkLogList:function(){return library.JSONDecode(workContext.getWorkLogList())},getAttachmentList:function(){return library.JSONDecode(workContext.getAttachmentList())},getRouteList:function(){return library.JSONDecode(workContext.getRouteList())},setTitle:function(t){workContext.setTitle(t)},getControl:function(){return null},getInquiredRouteList:function(){return null}};var includedScripts=[];var _self=this;var include=function(t,e){if(includedScripts.indexOf(t)==-1){var i=library.JSONDecode(_self.workContext.getScript(t,includedScripts));includedScripts=includedScripts.concat(i.importedList);if(i.text){MWF.Macro.exec(i.data.text,bind);if(e)e.apply(bind)}}};var define=function(t,e,i){var n=true;if(i===false)n=false;var r={};r[t]={value:e,configurable:n};library.defineProperties(bind,r)};var Dict=function(t){var i=_self.dictionary;this.name=t;this.get=function(t){return library.JSONDecode(i.select(this.name,t))};this.set=function(t,e){try{i.update(this.name,library.JSONEncode(e),t);return true}catch(t){return false}};this.add=function(t,e){try{i.insert(this.name,library.JSONEncode(e),t);return true}catch(t){return false}}};if(typeof JSON=="undefined"){JSON={}}JSON.validate=function(t){t=t.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"");return/^[\],:{}\s]*$/.test(t)};JSON.encode=JSON.stringify?function(t){return JSON.stringify(t)}:function(t){if(t&&t.toJSON)t=t.toJSON();switch(typeof t){case"string":return'"'+t.replace(/[\x00-\x1f\\"]/g,escape)+'"';case"array":var e=[];for(var i=0;i<t.length;i++){var n=JSON.encode(t[i]);if(n)e.push(n)}return"["+e+"]";case"object":case"hash":var e=[];for(key in t){var n=JSON.encode(t[key]);if(n)e.push(JSON.encode(key)+":"+n)}return"{"+e+"}";case"number":case"boolean":return""+t;case"null":return"null"}return null};JSON.decode=function(string,secure){if(!string||typeof string!=="string")return null;if(secure||JSON.secure){if(JSON.parse)return JSON.parse(string);if(!JSON.validate(string))throw new Error("JSON could not decode the input; security is enabled and the value is not secure.")}return eval("("+string+")")};var body={set:function(t){if(typeof t=="string"){if(jaxrsBody)jaxrsBody.set(t)}else{if(jaxrsBody)jaxrsBody.set(JSON.encode(t))}}};var getNameFlag=function(t){var e=library.typeOf(t);if(e==="array"){var i=[];t.forEach(function(t){i.push(library.typeOf(t)==="object"?t.distinguishedName||t.id||t.unique||t.name:t)});return i}else{return[e==="object"?t.distinguishedName||t.id||t.unique||t.name:t]}};var org={oGroup:this.organization.group(),oIdentity:this.organization.identity(),oPerson:this.organization.person(),oPersonAttribute:this.organization.personAttribute(),oRole:this.organization.role(),oUnit:this.organization.unit(),oUnitAttribute:this.organization.unitAttribute(),oUnitDuty:this.organization.unitDuty(),group:function(){return this.oGroup},identity:function(){return this.oIdentity},person:function(){return this.oPerson},personAttribute:function(){return this.oPersonAttribute},role:function(){return this.oRole},unit:function(){return this.oUnit},unitAttribute:function(){return this.oUnitAttribute},unitDuty:function(){return this.oUnitDuty},getObject:function(t,e){var i=[];if(!e||!e.length){return null}else{for(var n=0;n<e.length;n++){var r=t.getObject(e[n]);if(r)i.push(r)}}return i},getGroup:function(t){var e=this.oGroup.listObject(getNameFlag(t));if(!e||!e.length)e=null;return e&&e.length===1?e[0]:e},listSubGroup:function(t,e){var i=null;if(e){i=this.oGroup.listWithGroupSubNested(getNameFlag(t))}else{i=this.oGroup.listWithGroupSubDirect(getNameFlag(t))}return this.getObject(this.oGroup,i)},listSupGroup:function(t,e){var i=null;if(e){i=this.oGroup.listWithGroupSupNested(getNameFlag(t))}else{i=this.oGroup.listWithGroupSupDirect(getNameFlag(t))}return this.getObject(this.oGroup,i)},listGroupWithPerson:function(t){var e=this.oGroup.listWithPerson(getNameFlag(t));return this.getObject(this.oGroup,e)},groupHasRole:function(t,e){nameFlag=library.typeOf(t)==="object"?t.distinguishedName||t.id||t.unique||t.name:t;return this.oGroup.hasRole(nameFlag,getNameFlag(e))},getRole:function(t){var e=this.oRole.listObject(getNameFlag(t));if(!e||!e.length)e=null;return e&&e.length===1?e[0]:e},listRoleWithPerson:function(t){var e=this.oRole.listWithPerson(getNameFlag(t));return this.getObject(this.oRole,e)},personHasRole:function(t,e){nameFlag=library.typeOf(t)==="object"?t.distinguishedName||t.id||t.unique||t.name:t;return this.oPerson.hasRole(nameFlag,getNameFlag(e))},getPerson:function(t){var e=this.oPerson.listObject(getNameFlag(t));if(!e||!e.length)e=null;return e&&e.length===1?e[0]:e},listSubPerson:function(t,e){var i=null;if(e){i=this.oPerson.listWithPersonSubNested(getNameFlag(t))}else{i=this.oPerson.listWithPersonSubDirect(getNameFlag(t))}return this.getObject(this.oPerson,i)},listSupPerson:function(t,e){var i=null;if(e){i=this.oPerson.listWithPersonSupNested(getNameFlag(t))}else{i=this.oPerson.listWithPersonSupDirect(getNameFlag(t))}return this.getObject(this.oPerson,i)},listPersonWithGroup:function(t){var e=this.oPerson.listWithGroup(getNameFlag(t));if(!e||!e.length)e=null;return e},listPersonWithRole:function(t){var e=this.oPerson.listWithRole(getNameFlag(t));return this.getObject(this.oPerson,e)},listPersonWithIdentity:function(t){var e=this.oPerson.listWithIdentity(getNameFlag(t));return this.getObject(this.oPerson,e)},getPersonWithIdentity:function(t){var e=this.oPerson.listWithIdentity(getNameFlag(t));var i=this.getObject(this.oPerson,e);return i&&i.length?i[0]:null},listPersonWithUnit:function(t,e){var i=null;if(e){i=this.oPerson.listWithUnitSubNested(getNameFlag(t))}else{i=this.oPerson.listWithUnitSubDirect(getNameFlag(t))}return this.getObject(this.oPerson,i)},appendPersonAttribute:function(t,e,i){var n=library.typeOf(t)==="object"?t.distinguishedName||t.id||t.unique||t.name:t;return this.oPersonAttribute.appendWithPersonWithName(n,e,i)},setPersonAttribute:function(t,e,i){var n=library.typeOf(t)==="object"?t.distinguishedName||t.id||t.unique||t.name:t;return this.oPersonAttribute.setWithPersonWithName(n,e,i)},getPersonAttribute:function(t,e){var i=library.typeOf(t)==="object"?t.distinguishedName||t.id||t.unique||t.name:t;return this.oPersonAttribute.listAttributeWithPersonWithName(i,e)},listPersonAttributeName:function(t){var e=getNameFlag(t);var i=[];for(var n=0;n<e.length;n++){var r=this.oPersonAttribute.listNameWithPerson(e[n]);if(r&&r.length){for(var s=0;s<r.length;s++){if(i.indexOf(r[s])==-1)i.push(r[s])}}}return i},listPersonAllAttribute:function(t){},getIdentity:function(t){var e=this.oIdentity.listObject(getNameFlag(t));if(!e||!e.length)e=null;return e&&e.length===1?e[0]:e},listIdentityWithPerson:function(t){var e=this.oIdentity.listWithPerson(getNameFlag(t));return this.getObject(this.oIdentity,e)},listIdentityWithUnit:function(t,e){var i=null;if(e){i=this.oIdentity.listWithUnitSubNested(getNameFlag(t))}else{i=this.oIdentity.listWithUnitSubDirect(getNameFlag(t))}return this.getObject(this.oIdentity,i)},getUnit:function(t){var e=this.oUnit.listObject(getNameFlag(t));if(!e||!e.length)e=null;return e&&e.length===1?e[0]:e},listSubUnit:function(t,e){var i=null;if(e){i=this.oUnit.listWithUnitSubNested(getNameFlag(t))}else{i=this.oUnit.listWithUnitSubDirect(getNameFlag(t))}return this.getObject(this.oUnit,i)},listSupUnit:function(t,e){var i=null;if(e){i=this.oUnit.listWithUnitSupNested(getNameFlag(t))}else{i=this.oUnit.listWithUnitSupDirect(getNameFlag(t))}return this.getObject(this.oUnit,i)},getUnitByIdentity:function(t,e){getOrgActions();var i="current";var n;if(e){if(library.typeOf(e)==="string")i="type";if(library.typeOf(e)==="number")i="level"}var r=getNameFlag(t)[0];switch(i){case"current":n=this.oUnit.getWithIdentity(r);break;case"type":n=this.oUnit.getWithIdentityWithType(r,e);break;case"level":n=this.oUnit.getWithIdentityWithLevel(r,e);break}return this.oUnit.getObject(n)},listAllSupUnitWithIdentity:function(t){var e=this.oUnit.listWithIdentitySupNested(getNameFlag(t));return this.getObject(this.oUnit,e)},listUnitWithPerson:function(t){var e=this.oUnit.listWithPerson(getNameFlag(t));return this.getObject(this.oUnit,e)},listAllSupUnitWithPerson:function(t){var e=this.oUnit.listWithPersonSupNested(getNameFlag(t));return this.getObject(this.oUnit,e)},listUnitWithAttribute:function(t,e){var i=this.oUnit.listWithUnitAttribute(t,e);return this.getObject(this.oUnit,i)},listUnitWithDuty:function(t,e){var i=library.typeOf(e)==="object"?e.distinguishedName||e.id||e.unique||e.name:e;var n=this.oUnit.listWithUnitDuty(t,i);return this.getObject(this.oUnit,n)},getDuty:function(t,e){var i=library.typeOf(e)==="object"?e.distinguishedName||e.id||e.unique||e.name:e;var n=this.oUnitDuty.listIdentityWithUnitWithName(i,t);return this.getObject(this.oIdentity,n)},listDutyNameWithIdentity:function(t){var e=getNameFlag(t);var i=[];for(var n=0;n<e.length;n++){var r=this.oUnitDuty.listNameWithIdentity(e[n]);if(r&&r.length){for(var s=0;s<r.length;s++){if(i.indexOf(r[s])==-1)i.push(r[s])}}}return i},listDutyNameWithUnit:function(t){var e=getNameFlag(t);var i=[];for(var n=0;n<e.length;n++){var r=this.oUnitDuty.listNameWithUnit(e[n]);if(r&&r.length){for(var s=0;s<r.length;s++){if(i.indexOf(r[s])==-1)i.push(r[s])}}}return i},listUnitAllDuty:function(t){},appendUnitAttribute:function(t,e,i){var n=library.typeOf(t)==="object"?t.distinguishedName||t.id||t.unique||t.name:t;return this.oUnitAttribute.appendWithUnitWithName(n,e,i)},setUnitAttribute:function(t,e,i){var n=library.typeOf(t)==="object"?t.distinguishedName||t.id||t.unique||t.name:t;return this.oUnitAttribute.setWithUnitWithName(n,e,i)},getUnitAttribute:function(t,e){var i=library.typeOf(t)==="object"?t.distinguishedName||t.id||t.unique||t.name:t;return this.oUnitAttribute.listAttributeWithUnitWithName(i,e)},listUnitAttributeName:function(t){var e=getNameFlag(t);var i=[];for(var n=0;n<e.length;n++){var r=this.oUnitAttribute.listNameWithUnit(e[n]);if(r&&r.length){for(var s=0;s<r.length;s++){if(i.indexOf(r[s])==-1)i.push(r[s])}}}return i},listUnitAllAttribute:function(t){}};var restfulAcpplication=this.applications;var Action=function(){var n=[];return function(e,i){if(!n[e])n[e]={};Object.keys(i).forEach(function(t){n[e][t]=i[t]});this.root=e;this.actions=n[e];this.invoke=function(i){if(this.actions[i.name]){var n=this.actions[i.name].uri;var t=this.actions[i.name].method||"get";if(i.parameter){Object.keys(i.parameter).forEach(function(t){var e=i.parameter[t];n=n.replace("{"+t+"}",e)})}var e=null;try{switch(t.toLowerCase()){case"get":e=restfulAcpplication.getQuery(this.root,n);break;case"post":e=restfulAcpplication.postQuery(this.root,n,JSON.stringify(i.data));break;case"put":e=restfulAcpplication.putQuery(this.root,n,JSON.stringify(i.data));break;case"delete":e=restfulAcpplication.deleteQuery(this.root,n);break;default:e=restfulAcpplication.getQuery(this.root,n)}if(e){var r=JSON.parse(e.toString());if(i.success)i.success(r)}else{if(i.failure)i.failure()}}catch(t){if(i.failure)i.failure(t)}}}}}();Action.applications=this.applications;bind.library=library;bind.data=this.data;bind.workContext=wrapWorkContext;bind.service=this.webservicesClient;bind.org=org;bind.Action=Action;bind.include=include;bind.define=define;bind.Dict=Dict;bind.form=null;bind.body={set:function(t){if(typeof t==="string"){body.set(t)}if(typeof t==="object"){body.set(JSON.encode(t))}}};bind.parameters=this.parameters||null;bind.response=function(){if(this.jaxrsResponse){if(this.jaxrsResponse.get()){if(JSON.validate(this.jaxrsResponse.get())){return{status:this.jaxrsResponse.status,value:JSON.decode(this.jaxrsResponse.get())}}else{return{status:this.jaxrsResponse.status,value:this.jaxrsResponse.value}}}else{return{status:this.jaxrsResponse.status}}}return null}.apply(this);bind.assginData={data:null,get:function(){this.data=JSON.decode(assginData.get());return this.data},set:function(t){assginData.set(JSON.encode(t||this.data))}};bind.expire={setHour:function(t){try{expire.setHour(t)}catch(t){}},setWorkHour:function(t){try{expire.setWorkHour(t)}catch(t){}},setDate:function(t){try{expire.setDate(t)}catch(t){}}};
|