123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005 |
- o2.widget = o2.widget || {};
- o2.require("o2.widget.Common", null, false);
- o2.require("o2.xDesktop.Common", null, false);
- o2.require("o2.xDesktop.Actions.RestActions", null, false);
- o2.widget.O2Identity = new Class({
- Implements: [Options, Events],
- Extends: o2.widget.Common,
- options: {
- "style": "default",
- "canRemove": false,
- "lazy": false,
- "disableInfor" : false,
- "removeByClick": false,
- "styles": "",
- "delay": false
- },
- initialize: function(data, container, options){
- this.setOptions(options);
- this.loadedInfor = false;
- this.path = o2.session.path+"/widget/$O2Identity/";
- this.cssPath = o2.session.path+"/widget/$O2Identity/"+this.options.style+"/css.wcss";
- this._loadCss();
- this.container = $(container);
- this.data = data;
- this.style = this.css;
- this.action = new o2.xDesktop.Actions.RestActions("", "x_organization_assemble_control", "x_component_Org");
- // this.explorer = explorer;
- // this.removeAction = removeAction;
- if(!this.options.delay)this.load();
- //o2.widget.O2Identity.iditems.push(this);
- },
- setText: function(){
- var disply;
- if( this.data.displayName ){
- disply = this.data.displayName;
- }else{
- var name = this.data.name || o2.name.cn(this.data.distinguishedName);
- var unit;
- if(this.data.unitName){
- unit = this.data.unitName;
- }else if( this.data.unitLevelName ){
- var list = this.data.unitLevelName.split("/");
- unit = list[ list.length - 1 ];
- }
- disply = name + (unit ? "("+unit+")" : "")
- }
- this.node.set("text", this.data.displayName || disply );
- },
- load: function(){
- this.fireEvent("queryLoad");
- var style = ( layout.mobile && this.style.identityNode_mobile ) ?
- this.style.identityNode_mobile : this.style.identityNode;
- if (!this.options.lazy && !this.options.disableInfor) this.getPersonData();
- this.node = new Element("div", {"styles": style }).inject(this.container);
- if( this.options.styles ){
- this.node.setStyles( this.options.styles );
- }
- this.setText();
- if( this.options.removeByClick ){
- this.node.addEvent("click", function(e){
- this.fireEvent("remove", [this, e]);
- e.stopPropagation();
- }.bind(this));
- }
- if (this.options.canRemove){
- this.removeNode = new Element("div", {"styles": this.style.identityRemoveNode}).inject(this.node);
- this.removeNode.addEvent("click", function(e){
- this.fireEvent("remove", [this, e]);
- e.stopPropagation();
- }.bind(this));
- }
- if( !this.options.disableInfor && !layout.mobile){
- if (!this.options.lazy ){
- this.createInforNode(function(){
- this.fireEvent("loadedInfor", [this]);
- }.bind(this));
- }else{
- this.node.addEvents({
- "mouseover": function(){
- if (!this.loadedInfor){
- this.getPersonData();
- this.createInforNode(function(){
- this.fireEvent("loadedInfor", [this]);
- }.bind(this));
- }
- }.bind(this)
- });
- }
- }
- this.setEvent();
- if( !layout.mobile ){
- this.node.addEvents({
- "mouseover": function(){
- // var style_over = ( layout.mobile && this.style.identityNode_over_mobile ) ?
- // this.style.identityNode_over_mobile : this.style.identityNode_over;
- this.node.setStyles( this.style.identityNode_over ); //style_over
- if( this.options.styles ){
- this.node.setStyles( this.options.styles );
- }
- }.bind(this),
- "mouseout": function(){
- // var style = ( layout.mobile && this.style.identityNode_mobile ) ?
- // this.style.identityNode_mobile : this.style.identityNode;
- this.node.setStyles( this.style.identityNode ); //style
- if( this.options.styles ){
- this.node.setStyles( this.options.styles );
- }
- }.bind(this)
- });
- }
- this.fireEvent("postLoad");
- },
- setEvent: function(){
- if( this.open ){
- this.node.addEvents({
- "click": function(ev){
- this.open(ev);
- ev.stopPropagation();
- }.bind(this)
- });
- }
- },
- getPersonData: function(){
- if (!this.data.dutys){
- var action = o2.Actions.get("x_organization_assemble_control");
- var id = this.data.distinguishedName || this.data.id || this.data.unique;
- if (id) action.listUnitdutyByIdentity(id, function(json){
- this.data.dutys = json.data;
- }.bind(this), null, false);
- }
- if (!this.data.woPerson){
- // var uri = "/jaxrs/person/{flag}";
- // //uri = uri.replace("{flag}", this.data.person);
- // var uriIdentity = "/jaxrs/identity/{id}";
- this.action.actions = {
- "getPerson": {"uri": "/jaxrs/person/{flag}"},
- "getIdentity": {"uri": "/jaxrs/identity/{id}"}
- };
- var woPerson;
- if (this.data.person){
- this.action.invoke({"name": "getPerson", "async": false, "parameter": {"flag": this.data.person}, "success": function(json){
- this.data.woPerson = woPerson;
- woPerson = json.data;
- }.bind(this)});
- }else{
- this.action.invoke({"name": "getIdentity", "async": false, "parameter": {"id": this.data.distinguishedName || this.data.id || this.data.name}, "success": function(json){
- this.data = json.data;
- woPerson = json.data.woPerson;
- }.bind(this)});
- }
- return woPerson;
- }else{
- return this.data.woPerson;
- }
- //listDutyNameWithIdentity
- },
- createInforNode: function(callback){
- var person = this.getPersonData();
- if (person){
- this.inforNode = new Element("div", {
- "styles": this.style.identityInforNode
- });
- var nameNode = new Element("div", {
- "styles": this.style.identityInforNameNode
- }).inject(this.inforNode);
- var uri = "/jaxrs/person/{flag}/icon";
- uri = uri.replace("{flag}", person.id || person.unique || person.distinguishedName );
- this.action.getAddress();
- uri = this.action.address+uri;
- uri = o2.filterUrl(uri);
- img = "<img width='50' height='50' border='0' src='"+uri+"' style='border-radius:25px'/>";
- var picNode = new Element("div", {
- "styles": this.style.identityInforPicNode,
- "html": img
- }).inject(nameNode);
- var rightNode = new Element("div", {
- "styles": this.style.identityInforRightTextNode
- }).inject(nameNode);
- var nameTextNode = new Element("div", {
- "styles": this.style.identityInforNameTextNode,
- "text": person.name
- }).inject(rightNode);
- var employeeTextNode = new Element("div", {
- "styles": this.style.identityInforEmployeeTextNode,
- "text": person.employee || ""
- }).inject(rightNode);
- // var phoneNode = new Element("div", {
- // "styles": this.style.identityInforPhoneNode,
- // "html": "<div style='width:30px; float:left'>"+o2.LP.desktop.person.personMobile+": </div><div style='width:90px; float:left; margin-left:10px'>"+(person.mobile || "")+"</div>"
- // }).inject(this.inforNode);
- // var mailNode = new Element("div", {
- // "styles": this.style.identityInforPhoneNode,
- // "html": "<div style='width:30px; float:left'>"+o2.LP.desktop.person.personMail+": </div><div style='width:90px; float:left; margin-left:10px'>"+(person.mail || "")+"</div>"
- // }).inject(this.inforNode);
- var dutys = [];
- if (this.data.dutys && this.data.dutys.length){
- this.data.dutys.each(function(d){
- var n = d.name+"("+d.woUnit.levelName+")";
- dutys.push(n);
- });
- }
- var dutyNode = new Element("div", {
- "styles": this.style.identityInforPhoneNode,
- "html": "<div style='width:30px; float:left'>"+o2.LP.desktop.person.duty+": </div><div style='width:160px; float:left; margin-left:10px'>"+(dutys.join(","))+"</div>"
- }).inject(this.inforNode);
- this.loadedInfor = true;
- this.tooltip = new mBox.Tooltip({
- content: this.inforNode,
- setStyles: {content: {padding: 15, lineHeight: 20}},
- attach: this.node,
- transition: 'flyin'
- });
- }
- if (callback) callback();
- },
- destroy: function(){
- if (this.tooltip) this.tooltip.destroy();
- this.node.destroy();
- o2.release(this);
- }
- });
- // o2.widget.Person = new Class({
- // Implements: [Options, Events],
- // Extends: o2.widget.Identity,
- // getPerson: function(callback){
- // if (this.data.name && this.data.id){
- // if (callback) callback({"data": this.data});
- // }else{
- // var key = this.data.name;
- // this.explorer.actions["getPerson"](function(json){
- // if (callback) callback(json);
- // }, null, key);
- // }
- // }
- // });
- o2.widget.O2Person = new Class({
- Extends: o2.widget.O2Identity,
- options: {
- "lazy": true
- },
- getPersonData: function(){
- if (!this.data.distinguishedName || !this.data.dutys ){
- this.action.actions = {"getPerson": {"uri": "/jaxrs/person/{id}"}};
- this.action.invoke({"name": "getPerson", "async": false, "parameter": {"id": (this.data.distinguishedName || this.data.id || this.data.name)}, "success": function(json){
- this.data = json.data;
- var dutyList = [];
- if( this.data.woIdentityList && this.data.woIdentityList.length ){
- this.data.woIdentityList.each(function (id) {
- if(id.woUnitDutyList && id.woUnitDutyList.length)dutyList = dutyList.concat(id.woUnitDutyList);
- })
- }
- this.data.dutys = dutyList;
- }.bind(this)});
- }
- return this.data;
- },
- setText: function(){
- var displayName;
- if(this.data.displayName){
- displayName = this.data.displayName;
- }else if(this.data.name && this.data.name.indexOf("@") > -1){
- displayName = this.data.name.split("@")[0];
- }else if( this.data.name && this.data.name.length === 36 ){
- this.data.id = this.data.name;
- this.getPersonData();
- displayName = this.data.name || this.data.distinguishedName.split("@")[0];
- }else{
- displayName = this.data.name || "";
- }
- this.node.set("text", displayName);
- }
- });
- o2.widget.O2Unit = new Class({
- Extends: o2.widget.O2Identity,
- getPersonData: function(){
- if (!this.data.distinguishedName || !this.data.levelName){
- this.action.actions = {"getUnit": {"uri": "/jaxrs/unit/{id}"}};
- this.action.invoke({"name": "getUnit", "async": false, "parameter": {"id": (this.data.id || this.data.distinguishedName || this.data.name)}, "success": function(json){
- this.data = json.data;
- }.bind(this)});
- }
- },
- createInforNode: function(){
- this.inforNode = new Element("div", {
- "styles": this.style.identityInforNode
- });
- var nameNode = new Element("div", {
- "styles": this.style.identityInforNameNode,
- "text": this.data.levelName
- }).inject(this.inforNode);
- this.tooltip = new mBox.Tooltip({
- content: this.inforNode,
- setStyles: {content: {padding: 15, lineHeight: 20}},
- attach: this.node,
- transition: 'flyin'
- });
- },
- setText: function(){
- this.node.set("text", this.data.displayName || this.data.name);
- }
- });
- o2.widget.O2Duty = new Class({
- Extends: o2.widget.O2Identity,
- getPersonData: function(){
- return this.data;
- // if (!this.data.woUnit){
- // this.action.actions = {"getUnitduty": {"uri": "/jaxrs/unitduty/{id}"}};
- // this.action.invoke({"name": "getUnitduty", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
- // this.data = json.data;
- // }.bind(this)});
- // }
- },
- createInforNode: function(){
- if( this.options.showUnit && this.data.woUnit && this.data.woUnit.levelName ){
- this.inforNode = new Element("div", {
- "styles": this.style.identityInforNode
- });
- var nameNode = new Element("div", {
- "text": this.data.displayName || this.data.name
- }).inject(this.inforNode);
- var nameTextNode = new Element("div", {
- "text": this.data.woUnit.levelName
- }).inject(this.inforNode);
- this.tooltip = new mBox.Tooltip({
- content: this.inforNode,
- setStyles: {content: {padding: 15, lineHeight: 20}},
- attach: this.node,
- transition: 'flyin'
- });
- }else{
- return false;
- }
- // this.inforNode = new Element("div", {
- // "styles": this.style.identityInforNode
- // });
- // var nameNode = new Element("div", {
- // "styles": this.style.identityInforNameNode,
- // "text": this.data.woUnit.levelName
- // }).inject(this.inforNode);
- // this.tooltip = new mBox.Tooltip({
- // content: this.inforNode,
- // setStyles: {content: {padding: 15, lineHeight: 20}},
- // attach: this.node,
- // transition: 'flyin'
- // });
- },
- setText: function(){
- if( this.options.showUnit && this.data.woUnit ){
- var unit = this.data.woUnit.name ? ("("+this.data.woUnit.name+")") : "";
- this.node.set("text", (this.data.displayName || this.data.name)+unit);
- }else{
- this.node.set("text", this.data.displayName || this.data.name);
- }
- }
- });
- o2.widget.O2Group = new Class({
- Extends: o2.widget.O2Unit,
- getPersonData: function(){
- if (!this.data.distinguishedName){
- this.action.actions = {"getGroup": {"uri": "/jaxrs/group/{id}"}};
- this.action.invoke({"name": "getGroup", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
- this.data = json.data;
- }.bind(this)});
- }
- },
- setText: function(){
- this.node.set("text", this.data.displayName || this.data.name);
- },
- createInforNode: function(){
- return false;
- }
- });
- o2.widget.O2Application = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- if (!this.data.name){
- this.action = new o2.xDesktop.Actions.RestActions("", "x_processplatform_assemble_surface", "");
- this.action.actions = {"getApplication": {"uri": "/jaxrs/application/{id}"}};
- this.action.invoke({"name": "getApplication", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
- this.data = json.data;
- }.bind(this)});
- }
- }
- });
- o2.widget.O2Portal = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- if (!this.data.name){
- this.action = new o2.xDesktop.Actions.RestActions("", "x_portal_assemble_surface", "");
- this.action.actions = {"getPortal": {"uri": "/jaxrs/portal/{id}"}};
- this.action.invoke({"name": "getPortal", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
- this.data = json.data;
- }.bind(this)});
- }
- }
- });
- o2.widget.O2CMSApplication = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- if (!this.data.name){
- o2.Actions.get("x_cms_assemble_control").getApplication((this.data.id || this.data.name), function(json){
- this.data = json.data;
- }.bind(this), null, false);
- // this.action = new o2.xDesktop.Actions.RestActions("", "x_cms_assemble_control", "");
- // this.action.actions = {"getApplication": {"uri": "/jaxrs/application/{id}"}};
- // this.action.invoke({"name": "getApplication", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
- // this.data = json.data;
- // }.bind(this)});
- }
- }
- });
- o2.widget.O2Process = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- if (!this.data.name){
- this.action = new o2.xDesktop.Actions.RestActions("", "x_processplatform_assemble_surface", "");
- this.action.actions = {"getProces": {"uri": "/jaxrs/process/{id}/complex"}};
- this.action.invoke({"name": "getProces", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
- this.data = json.data;
- }.bind(this)});
- }
- },
- createInforNode: function(){
- this.inforNode = new Element("div", {
- "styles": this.style.identityInforNode
- });
- var nameNode = new Element("div", {
- "styles": this.style.identityInforNameNode,
- "text": this.data.name || this.data.applicationName || this.data.appName
- }).inject(this.inforNode);
- this.tooltip = new mBox.Tooltip({
- content: this.inforNode,
- setStyles: {content: {padding: 15, lineHeight: 20}},
- attach: this.node,
- transition: 'flyin'
- });
- },
- open : function (e) {
- debugger;
- if( this.data.id && this.data.application ){
- var appId = "process.ProcessManager" + this.data.application;
- if (layout.desktop.apps[appId]){
- layout.desktop.apps[appId].setCurrent();
- }else {
- var options = { "application": {
- "id": this.data.application,
- "name": this.data.applicationName || ""
- }};
- layout.desktop.openApplication(e, "process.ProcessManager", options);
- }
- }
- }
- });
- o2.widget.O2CMSCategory = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- if (!this.data.name){
- o2.Actions.get("x_cms_assemble_control").getCategory((this.data.id || this.data.name), function(json){
- this.data = json.data;
- this.data.name = this.data.categoryName;
- }.bind(this), null, false);
- }
- },
- createInforNode: function(){
- this.inforNode = new Element("div", {
- "styles": this.style.identityInforNode
- });
- var nameNode = new Element("div", {
- "styles": this.style.identityInforNameNode,
- "text": this.data.applicationName || this.data.appName
- }).inject(this.inforNode);
- this.tooltip = new mBox.Tooltip({
- content: this.inforNode,
- setStyles: {content: {padding: 15, lineHeight: 20}},
- attach: this.node,
- transition: 'flyin'
- });
- },
- open : function (e) {
- debugger;
- if( this.data.id && this.data.appId ){
- // var appId = "cms.ColumnManager" + this.data.id;
- // if (layout.desktop.apps[appId]){
- // layout.desktop.apps[appId].setCurrent();
- // }else {
- var options = {
- "navi":"categoryConfig",
- "column":{
- "id" : this.data.appId,
- "appName": this.data.appName || ""
- },
- "currentCategoryId":this.data.id
- };
- layout.desktop.openApplication(e, "cms.ColumnManager", options);
- // }
- }
- }
- });
- o2.widget.O2View = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- if (!this.data.query && this.data.id){
- var data = null;
- o2.Actions.get("x_query_assemble_surface").getStatById(this.data.id, function(json){
- data = json.data
- }, null, false);
- this.data = data;
- return data;
- }else{
- return this.data;
- }
- },
- createInforNode: function(){
- this.inforNode = new Element("div", {
- "styles": this.style.identityInforNode
- });
- var nameNode = new Element("div", {
- "styles": this.style.identityInforNameNode,
- "text": this.data.applicationName || this.data.appName || this.data.name
- }).inject(this.inforNode);
- this.tooltip = new mBox.Tooltip({
- content: this.inforNode,
- setStyles: {content: {padding: 15, lineHeight: 20}},
- attach: this.node,
- transition: 'flyin'
- });
- }
- });
- o2.widget.O2CMSView = new Class({
- Extends: o2.widget.O2View
- });
- o2.widget.O2QueryView = new Class({
- Extends: o2.widget.O2View,
- getPersonData: function(){
- if (!this.data.query && this.data.id){
- var data = null;
- o2.Actions.get("x_query_assemble_surface").getViewById(this.data.id, function(json){
- data = json.data;
- }, function(){
- data = {};
- return true;
- }, false);
- this.data = data;
- return data;
- }else{
- return this.data;
- }
- },
- open : function (e) {
- if( this.data.id && this.data.query ){
- var appId = "query.ViewDesigner" + this.data.id;
- if (layout.desktop.apps[appId]){
- layout.desktop.apps[appId].setCurrent();
- }else {
- var options = {
- "id": this.data.id,
- "application": {
- "id": this.data.query,
- "name": this.data.name || this.data.queryName || ""
- },
- "appId": appId
- };
- layout.desktop.openApplication(e, "query.ViewDesigner", options);
- }
- }
- }
- });
- o2.widget.O2QueryStatement = new Class({
- Extends: o2.widget.O2View,
- getPersonData: function(){
- if (!this.data.query && this.data.id){
- var data = null;
- o2.Actions.load("x_query_assemble_designer").StatementAction.get(this.data.id, function(json){
- data = json.data;
- }, function () {
- data = {};
- return true;
- }, false);
- this.data = data;
- return data;
- }else{
- return this.data;
- }
- },
- open : function (e) {
- if( this.data.id && this.data.query ){
- var appId = "query.StatementDesigner" + this.data.id;
- if (layout.desktop.apps[appId]){
- layout.desktop.apps[appId].setCurrent();
- }else {
- var options = {
- "id": this.data.id,
- "application": {
- "id": this.data.query,
- "name": this.data.name || this.data.queryName || ""
- },
- "appId": appId};
- layout.desktop.openApplication(e, "query.StatementDesigner", options);
- }
- }
- }
- });
- o2.widget.O2QueryStat = new Class({
- Extends: o2.widget.O2View,
- getPersonData: function(){
- if (!this.data.query && this.data.id){
- var data = null;
- o2.Actions.get("x_query_assemble_surface").getStatById(this.data.id, function(json){
- data = json.data
- }, null, false);
- this.data = data;
- return data;
- }else{
- return this.data;
- }
- },
- open : function (e) {
- if( this.data.id && this.data.query){
- var appId = "query.StatDesigner" + this.data.id;
- if (layout.desktop.apps[appId]){
- layout.desktop.apps[appId].setCurrent();
- }else {
- var options = {
- "id": this.data.id,
- "application": {
- "id": this.data.query,
- "name": this.data.name || this.data.queryName
- },
- "appId": appId
- };
- layout.desktop.openApplication(e, "query.StatDesigner", options);
- }
- }
- }
- });
- o2.widget.O2QueryTable = new Class({
- Extends: o2.widget.O2View,
- getPersonData: function(){
- if (!this.data.query && this.data.id){
- var data = null;
- o2.Actions.get("x_query_assemble_surface").getTableById(this.data.id, function(json){
- data = json.data
- }, null, false);
- this.data = data;
- return data;
- }else{
- return this.data;
- }
- },
- open : function (e) {
- if( this.data.id && this.data.query){
- var appId = "query.TableDesigner" + this.data.id;
- if (layout.desktop.apps[appId]){
- layout.desktop.apps[appId].setCurrent();
- }else {
- var options = {
- "id": this.data.id,
- "application": {
- "id": this.data.query,
- "name": this.data.name || this.data.queryName
- },
- "appId": appId};
- layout.desktop.openApplication(e, "query.TableDesigner", options);
- }
- }
- }
- });
- o2.widget.O2QueryImportModel = new Class({
- Extends: o2.widget.O2View,
- getPersonData: function(){
- if (!this.data.query && this.data.id){
- var data = null;
- o2.Actions.get("x_query_assemble_surface").getImportModelById(this.data.id, function(json){
- data = json.data
- }, null, false);
- this.data = data;
- return data;
- }else{
- return this.data;
- }
- },
- open : function (e) {
- if( this.data.id && this.data.query){
- var appId = "query.ImporterDesigner" + this.data.id;
- if (layout.desktop.apps[appId]){
- layout.desktop.apps[appId].setCurrent();
- }else {
- var options = {
- "id": this.data.id,
- "application": {
- "id": this.data.query,
- "name": this.data.name || this.data.queryName || ""
- },
- "appId": appId};
- layout.desktop.openApplication(e, "query.ImporterDesigner", options);
- }
- }
- }
- });
- o2.widget.O2FormField = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- return this.data;
- }
- });
- o2.widget.O2Role = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- if (!this.data.distinguishedName){
- this.action.actions = {"getRole": {"uri": "/jaxrs/role/{id}"}};
- this.action.invoke({"name": "getRole", "async": false, "parameter": {"id": (this.data.id || this.data.name)}, "success": function(json){
- this.data = json.data;
- }.bind(this)});
- }
- }
- });
- o2.widget.O2File = new Class({
- Extends: o2.widget.O2Group,
- createInforNode: function(){
- this.inforNode = new Element("div", {
- "styles": this.style.identityInforNode
- });
- var extName = this.data.fileName.substring(this.data.fileName.lastIndexOf(".")+1, this.data.fileName.length).toLowerCase();
- if (["png","jpg","bmp","gif","jpeg","jpe"].indexOf(extName)!==-1){
- var url;
- if(this.data.portal) {
- url = MWF.xDesktop.getPortalFileUr(this.data.id, this.data.portal);
- }else if( this.data.appId ){
- url = MWF.xDesktop.getCMSFileUr(this.data.id, this.data.appId);
- }else{
- url = MWF.xDesktop.getProcessFileUr(this.data.id, this.data.application)
- };
- var img = new Element("img", {"src": url, "styles": {"max-width": "280px", "max-height": "140px"}}).inject(this.inforNode);
- }else{
- var nameNode = new Element("div", {
- "styles": this.style.identityInforNameNode,
- "text": this.data.applicationName || this.data.appName || this.data.name
- }).inject(this.inforNode);
- }
- this.tooltip = new mBox.Tooltip({
- content: this.inforNode,
- setStyles: {content: {padding: 15, lineHeight: 20}},
- attach: this.node,
- transition: 'flyin'
- });
- },
- getPersonData: function(){
- return this.data;
- }
- });
- o2.widget.O2Script = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- return this.data;
- },
- createInforNode: function(){
- if( !this.data.appType )return false;
- this.inforNode = new Element("div", {
- "styles": this.style.identityInforNode
- });
- var nameNode = new Element("div", {
- "text": o2.LP[this.data.appType+"Name"]
- }).inject(this.inforNode);
- var nameTextNode = new Element("div", {
- "text": this.data.applicationName || this.data.appName
- }).inject(this.inforNode);
- this.tooltip = new mBox.Tooltip({
- content: this.inforNode,
- setStyles: {content: {padding: 15, lineHeight: 20}},
- attach: this.node,
- transition: 'flyin'
- });
- },
- open: function(e){
- if( this.data.id && this.data.appId && this.data.appType) {
- this._open();
- }else{
- var app = this.data.appId || this.data.application || this.data.appName || this.data.applicationName;
- var name = this.data.id || this.data.name;
- if( this.data.appType === "service" )app = "service";
- if( name && app && this.data.appType ){
- var p, type = this.data.appType;
- if( type === "process" ){
- p = o2.Actions.load("x_processplatform_assemble_surface").ScriptAction.getImported(this.data.name, app);
- }else if( type === "portal" ){
- p = o2.Actions.load("x_portal_assemble_surface").ScriptAction.getImported(app, this.data.name);
- }else if( type === "cms" ){
- p = o2.Actions.load("x_cms_assemble_control").ScriptAction.load(this.data.name, app);
- }else if( type === "service" ){
- p = o2.Actions.load("x_program_center").ScriptAction.getImported(this.data.name);
- }
- p.then(function (json) {
- if( json.data.importedList && json.data.importedList.length ){
- this.data.id = json.data.importedList[0];
- this._open(e);
- }
- }.bind(this))
- }
- }
- },
- _open : function (e) {
- var appName;
- if( this.data.appType === "cms" ){
- appName = "cms.ScriptDesigner";
- }else if( this.data.appType === "portal" ){
- appName = "portal.ScriptDesigner";
- }else if( this.data.appType === "process" ) {
- appName = "process.ScriptDesigner";
- }else if( this.data.appType === "service" ) {
- appName = "service.ScriptDesigner";
- }
- var appId = appName + this.data.id;
- if (layout.desktop.apps[appId]){
- layout.desktop.apps[appId].setCurrent();
- }else {
- var options = {
- "id": this.data.id,
- "appId": appId,
- "application":{
- "name": this.data.appName || this.data.applicationName || "",
- "id": this.data.appId
- }
- };
- layout.desktop.openApplication(e, appName, options);
- }
- }
- });
- o2.widget.O2FormStyle = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- return this.data;
- },
- open : function (e) {
- if( typeOf(this.data)==="object" && this.data.id && this.data.appId && this.data.type === "script"){
- var appName;
- if( this.data.appType === "cms" ){
- appName = "cms.ScriptDesigner";
- }else{
- appName = "process.ScriptDesigner";
- }
- var appId = appName + this.data.id;
- if (layout.desktop.apps[appId]){
- layout.desktop.apps[appId].setCurrent();
- }else {
- var options = {
- "id": this.data.id,
- "appId": appId,
- "application":{
- "name": this.data.appName || this.data.applicationName || "",
- "id": this.data.appId
- }
- };
- layout.desktop.openApplication(e, appName, options);
- }
- }
- }
- });
- o2.widget.O2Dictionary = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- return this.data;
- },
- createInforNode: function(){
- if( !this.data.appType )return false;
- this.inforNode = new Element("div", {
- "styles": this.style.identityInforNode
- });
- var nameNode = new Element("div", {
- "text": o2.LP[this.data.appType+"Name"]
- }).inject(this.inforNode);
- var nameTextNode = new Element("div", {
- "text": this.data.applicationName || this.data.appName
- }).inject(this.inforNode);
- this.tooltip = new mBox.Tooltip({
- content: this.inforNode,
- setStyles: {content: {padding: 15, lineHeight: 20}},
- attach: this.node,
- transition: 'flyin'
- });
- },
- open : function (e) {
- if( this.data.id && this.data.appId && this.data.appType){
- var appName;
- switch (this.data.appType) {
- case "cms":
- appName = "cms.DictionaryDesigner"; break;
- case "process":
- appName = "process.DictionaryDesigner"; break;
- case "portal":
- appName = "portal.DictionaryDesigner"; break;
- default:
- appName = "service.DictionaryDesigner"; break;
- }
- var appId = appName + this.data.id;
- if (layout.desktop.apps[appId]){
- layout.desktop.apps[appId].setCurrent();
- }else {
- var options = {
- "id": this.data.id
- };
- if( this.data.appType !== "service" ){
- options.appId = appId;
- options.application = {
- "id": this.data.appId,
- "name": this.data.appName || this.data.applicationName || ""
- };
- }
- layout.desktop.openApplication(e, appName, options);
- }
- }
- }
- });
- o2.widget.O2Other = new Class({
- Extends: o2.widget.O2Group,
- getPersonData: function(){
- return this.data;
- }
- });
- /**
- * @return {null}
- */
- o2.widget.O2Org = function(value, container, options){
- var v = (o2.typeOf(value)==="string") ? {"name": value} : value.distinguishedName;
- var t = v.distinguishedName || v.name || "";
- if (t) {
- var flag = t.substr(t.length - 1, 1);
- switch (flag.toLowerCase()) {
- case "i":
- return new o2.widget.O2Identity(v, container, options);
- case "p":
- return new o2.widget.O2Person(v, container, options);
- case "u":
- return new o2.widget.O2Unit(v, container, options);
- case "g":
- return new o2.widget.O2Group(v, container, options);
- case "r":
- return new o2.widget.O2Role(v, container, options);
- case "d":
- return new o2.widget.O2Duty(v, container, options);
- default:
- return new o2.widget.O2Other(v, container, options);
- }
- }
- return null;
- };
- // o2.widget.O2Identity.iditems = o2.widget.O2Identity.iditems || [];
- // o2.widget.O2Identity.intervalId = window.setInterval(function(){
- // if (o2.widget.O2Identity.iditems && o2.widget.O2Identity.iditems.length){
- // o2.widget.O2Identity.iditems.each(function(item){
- // if (item.tooltip){
- // debugger;
- // if (item.tooltip.options.attach){
- //
- // }
- // }
- // });
- // }
- // }, 10000);
|