PermissionView.js 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572
  1. MWF.xApplication.ThreeMember = MWF.xApplication.ThreeMember || {};
  2. MWF.require("MWF.widget.O2Identity", null, false);
  3. //MWF.xDesktop.requireApp("ThreeMember", "Access", null, false);
  4. //MWF.xDesktop.requireApp("ThreeMember", "Actions.RestActions", null, false);
  5. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  6. MWF.xDesktop.requireApp("Template", "MForm", null, false);
  7. var TMPermissionView = MWF.xApplication.ThreeMember.PermissionView = new Class({
  8. Extends: MWF.widget.Common,
  9. Implements: [Options, Events],
  10. options: {
  11. "style": "default",
  12. "title": MWF.xApplication.ThreeMember.LP.title
  13. },
  14. initialize: function(node, app, options){
  15. this.setOptions(options);
  16. this.path = "../x_component_ThreeMember/$PermissionView/";
  17. this.cssPath = "../x_component_ThreeMember/$PermissionView/"+this.options.style+"/css.wcss";
  18. this._loadCss();
  19. this.app = app;
  20. this.content = $(node);
  21. this.lp = MWF.xApplication.ThreeMember.LP;
  22. this.load();
  23. },
  24. reload: function () {
  25. this.clear();
  26. this.load();
  27. },
  28. load: function () {
  29. this.content.setStyle("overflow", "hidden");
  30. this.node = new Element("div", {
  31. "styles": this.css.node
  32. }).inject(this.content);
  33. this.naviNode = new Element("div.naviNode", {
  34. "styles": this.css.naviNode
  35. }).inject(this.node);
  36. this.contentContainerNode = new Element("div.contentContainerNode", {
  37. "styles": this.css.contentContainerNode
  38. }).inject(this.node);
  39. this.createTop();
  40. this.createContent();
  41. this.loaNavi();
  42. },
  43. loaNavi: function (callback) {
  44. debugger;
  45. var naviOpt = {};
  46. naviOpt.category = this.options.category || "";
  47. naviOpt.application = this.options.application;
  48. this.navi = new TMPermissionView.Navi(this, this.naviNode, naviOpt);
  49. },
  50. createTop: function () {
  51. this.topContainerNode = new Element("div.topContainerNode", {
  52. "styles": this.css.topContainerNode
  53. }).inject(this.contentContainerNode);
  54. this.topNode = new Element("div.topNode", {
  55. "styles": this.css.topNode
  56. }).inject(this.topContainerNode);
  57. this.topContentNode = new Element("div", {
  58. "styles": this.css.topContentNode
  59. }).inject(this.topNode);
  60. },
  61. createContent: function () {
  62. this.middleNode = new Element("div.middleNode", {
  63. "styles": this.css.middleNode
  64. }).inject(this.contentContainerNode);
  65. this.contentScrollNode = new Element("div.contentScrollNode", {
  66. "styles": this.css.contentScrollNode
  67. }).inject(this.middleNode);
  68. this.contentNode = new Element("div.contentNode", {
  69. "styles": this.css.contentNode
  70. }).inject(this.contentScrollNode);
  71. // this.loadView();
  72. this.setContentSizeFun = this.setContentSize.bind(this);
  73. this.app.addEvent("resize", this.setContentSizeFun);
  74. this.setContentSize();
  75. },
  76. getOffsetY: function (node) {
  77. return (node.getStyle("margin-top").toInt() || 0) +
  78. (node.getStyle("margin-bottom").toInt() || 0) +
  79. (node.getStyle("padding-top").toInt() || 0) +
  80. (node.getStyle("padding-bottom").toInt() || 0) +
  81. (node.getStyle("border-top-width").toInt() || 0) +
  82. (node.getStyle("border-bottom-width").toInt() || 0);
  83. },
  84. setContentSize: function () {
  85. var nodeSize = this.content.getSize();
  86. var h = nodeSize.y - this.getOffsetY(this.content);
  87. var topY = this.topContainerNode ? (this.getOffsetY(this.topContainerNode) + this.topContainerNode.getSize().y) : 0;
  88. h = h - topY;
  89. h = h - this.getOffsetY(this.contentScrollNode);
  90. this.contentScrollNode.setStyles({
  91. "height": "" + h + "px",
  92. "overflow": "auto"
  93. });
  94. },
  95. clear: function () {
  96. if (this.setContentSizeFun) this.removeEvent("resize", this.setContentSizeFun);
  97. if( this.navi )this.navi.destroy();
  98. if( this.naviNode ){
  99. this.naviNode.destroy();
  100. }
  101. if (this.contentContainerNode) {
  102. this.contentContainerNode.destroy();
  103. }
  104. this.node.destroy();
  105. },
  106. getCategories: function(){
  107. return [
  108. {"id":"process", "text": this.lp.process,
  109. "action": o2.Actions.load("x_processplatform_assemble_designer").ApplicationAction.list },
  110. {"id":"cms", "text": this.lp.cms,
  111. "action": o2.Actions.load("x_cms_assemble_control").AppInfoAction.listAllAppInfo },
  112. {"id":"portal", "text": this.lp.portal,
  113. "action": o2.Actions.load("x_portal_assemble_designer").PortalAction.list },
  114. {"id":"query", "text": this.lp.query1,
  115. "action": o2.Actions.load("x_query_assemble_designer").QueryAction.listAll }
  116. ];
  117. },
  118. loadView: function(object){
  119. if(this.contentView)this.contentView.clear();
  120. switch (object.category.id) {
  121. case "process":
  122. this.contentView = new TMPermissionView.ProcessApplication(this, { id: object.application.id }, object);
  123. this.contentView.load();
  124. break;
  125. case "cms":
  126. this.contentView = new TMPermissionView.CMSApplication(this, { id: object.application.id } , object);
  127. this.contentView.load();
  128. break;
  129. case "portal":
  130. this.contentView = new TMPermissionView.PortalApplication(this, { id: object.application.id }, object);
  131. this.contentView.load();
  132. break;
  133. case "query":
  134. this.contentView = new TMPermissionView.QueryApplication(this,{ id: object.application.id }, object);
  135. this.contentView.load();
  136. break;
  137. }
  138. },
  139. recordStatus: function () {
  140. var status = this.navi.currentStatus || {};
  141. status.explorer = "permissionview";
  142. return status;
  143. }
  144. });
  145. TMPermissionView.Navi = new Class({
  146. Implements: [Options, Events],
  147. options: {
  148. "category": "process"
  149. },
  150. initialize: function (explorer, node, options) {
  151. this.setOptions(options);
  152. this.app = explorer.app;
  153. this.explorer = explorer;
  154. this.node = $(node);
  155. this.css = this.explorer.css;
  156. this.currentMenu = null;
  157. this.currentItem = null;
  158. this.menuObjList = [];
  159. this.load();
  160. },
  161. load: function () {
  162. this.searchInputNode = new Element("input.searchInputNode", {
  163. "styles": this.css.searchInputNode,
  164. "placeholder": this.explorer.lp.search,
  165. "events":{
  166. "keydown": function(e){
  167. if (e.code==13){
  168. this.search();
  169. e.preventDefault();
  170. }
  171. }.bind(this)
  172. }
  173. }).inject(this.node);
  174. this.searchActionNode = new Element("div.searchActionNode", {
  175. "styles": this.css.searchActionNode,
  176. "events":{
  177. "click": function () {
  178. this.search()
  179. }.bind(this)
  180. }
  181. }).inject(this.node);
  182. this.scrollNode = new Element("div.naviScrollNode", {"styles": this.css.naviScrollNode}).inject(this.node);
  183. this.areaNode = new Element("div.naviAreaNode", {"styles": this.css.naviAreaNode}).inject(this.scrollNode);
  184. // this.naviTopNode = new Element("div.naviTopNode", {
  185. // "styles": this.css.naviTopNode,
  186. // "text": this.explorer.lp.title
  187. // }).inject(this.areaNode);
  188. this.explorer.getCategories().each(function (category) {
  189. debugger;
  190. this.createMenuNode(category);
  191. }.bind(this));
  192. this.setContentSize();
  193. this.setContentSizeFun = this.setContentSize.bind(this);
  194. this.app.addEvent("resize", this.setContentSizeFun);
  195. },
  196. search: function(){
  197. var value = this.searchInputNode.get("value");
  198. if( this.searchValue === value )return;
  199. this.searchValue = value;
  200. if( value === "" ){
  201. this.menuObjList.each(function (menuObj) {
  202. if (menuObj.itemContainer) {
  203. menuObj.itemContainer.getElements(".item").each(function (itemNode) {
  204. itemNode.setStyle("display", "");
  205. })
  206. menuObj.itemContainer.setStyle("display", "none");
  207. }
  208. menuObj.iconNode.setStyles( this.css.naviMenuIconNode_collapse );
  209. menuObj.collapse = true;
  210. }.bind(this))
  211. }else{
  212. this.menuObjList.each(function (menuObj) {
  213. if (!menuObj.itemContainer) {
  214. menuObj.itemContainer = new Element("div").inject(menuObj.node, "after");
  215. menuObj.category.action(function (json) {
  216. json.data.each(function (application) {
  217. var hidden = !(application.appName || application.applicationName || application.name).contains(value);
  218. this.createItemNode(application, menuObj, hidden);
  219. }.bind(this))
  220. }.bind(this));
  221. } else {
  222. menuObj.itemContainer.setStyle("display", "");
  223. menuObj.itemContainer.getElements(".item").each(function (itemNode) {
  224. var hidden = !itemNode.get("text").contains(value);
  225. itemNode.setStyle("display", hidden ? "none" : "");
  226. })
  227. }
  228. menuObj.iconNode.setStyles( this.css.naviMenuIconNode_expand );
  229. menuObj.collapse = false;
  230. }.bind(this))
  231. }
  232. },
  233. destroy: function(){
  234. if(this.setContentSizeFun)this.app.removeEvent("resize", this.setContentSizeFun );
  235. this.scrollNode.destroy();
  236. },
  237. createMenuNode: function (category) {
  238. var _self = this;
  239. var menuNode = new Element("div", {
  240. "styles": this.css.naviMenuNode
  241. });
  242. menuNode.store("data", category);
  243. menuNode.setStyles(this.css.naviMenuNode_collapse);
  244. var iconNode = new Element("div", {
  245. "styles": this.css.naviMenuIconNode_collapse
  246. }).inject(menuNode);
  247. var textNode = new Element("div", {
  248. "styles": this.css.naviMenuTextNode,
  249. "text": category.text
  250. }).inject(menuNode);
  251. menuNode.inject(this.areaNode);
  252. var menuObj = {
  253. "category": category,
  254. "collapse": true,
  255. "node": menuNode,
  256. "iconNode": iconNode
  257. };
  258. this.menuObjList.push(menuObj);
  259. iconNode.addEvents({
  260. click: function (ev) {
  261. _self.expandOrCollapse(menuObj);
  262. ev.stopPropagation();
  263. }
  264. });
  265. menuNode.addEvents({
  266. "mouseover": function () {
  267. if (_self.currentMenu != this) this.setStyles(_self.explorer.css.naviMenuNode_over);
  268. },
  269. "mouseout": function () {
  270. if (_self.currentMenu != this) this.setStyles(_self.explorer.css.naviMenuNode_normal);
  271. },
  272. "click": function (ev) {
  273. _self.expandOrCollapse(menuObj);
  274. ev.stopPropagation();
  275. }
  276. });
  277. if( this.options.category === category.id ){
  278. menuNode.click();
  279. }
  280. },
  281. cancelCurrent: function () {
  282. if (this.currentItem) {
  283. this.currentItem.setStyles(this.css.naviItemNode);
  284. this.currentItem = false;
  285. }
  286. this.currentStatus = null;
  287. },
  288. expandOrCollapse: function (menuObj) {
  289. if (!menuObj.itemContainer) {
  290. menuObj.itemContainer = new Element("div").inject(menuObj.node, "after");
  291. menuObj.category.action(function (json) {
  292. json.data.each(function (application) {
  293. this.createItemNode(application, menuObj);
  294. }.bind(this))
  295. }.bind(this));
  296. } else {
  297. menuObj.itemContainer.setStyle("display", menuObj.collapse ? "" : "none");
  298. }
  299. menuObj.iconNode.setStyles(menuObj.collapse ? this.css.naviMenuIconNode_expand : this.css.naviMenuIconNode_collapse);
  300. menuObj.collapse = !menuObj.collapse;
  301. },
  302. createItemNode: function (application, menuObj, hidden) {
  303. var _self = this;
  304. var itemNode = new Element("div.item", {
  305. "styles": this.css.naviItemNode
  306. });
  307. if(hidden)itemNode.hide();
  308. var itemObj = {
  309. "category": menuObj.category,
  310. "application": application,
  311. "node": itemNode
  312. };
  313. var textNode = new Element("div", {
  314. "styles": this.css.naviItemTextNode,
  315. "text": application.appName || application.applicationName || application.name
  316. });
  317. textNode.inject(itemNode);
  318. itemNode.inject(menuObj.itemContainer);
  319. itemNode.addEvents({
  320. "mouseover": function () {
  321. if (_self.currentItem != this) this.setStyles(_self.explorer.css.naviItemNode_over);
  322. },
  323. "mouseout": function () {
  324. if (_self.currentItem != this) this.setStyles(_self.explorer.css.naviItemNode);
  325. },
  326. "mousedown": function () {
  327. if (_self.currentItem != this) this.setStyles(_self.explorer.css.naviItemNode_down);
  328. },
  329. "mouseup": function () {
  330. if (_self.currentItem != this) this.setStyles(_self.explorer.css.naviItemNode_over);
  331. },
  332. "click": function () {
  333. _self.setCurrentItem(itemObj);
  334. }
  335. });
  336. if (application.id === this.options.application) {
  337. itemNode.click();
  338. }
  339. },
  340. setCurrentItem: function (itemObj) {
  341. this.cancelCurrent();
  342. this.currentStatus = {
  343. category: itemObj.category.id,
  344. application: itemObj.application.id
  345. };
  346. this.currentItem = itemObj.node;
  347. itemObj.node.setStyles(this.css.naviItemNode_current);
  348. this.explorer.loadView(itemObj);
  349. },
  350. setContentSize: function () {
  351. var nodeSize = this.explorer.node.getSize();
  352. var h = nodeSize.y - this.explorer.getOffsetY(this.explorer.node);
  353. this.node.setStyle("height", h);
  354. h = h - this.searchInputNode.getSize().y - this.explorer.getOffsetY(this.searchInputNode);
  355. this.scrollNode.setStyle("height", h);
  356. }
  357. });
  358. TMPermissionView.ProcessApplication = new Class({
  359. Implements: [Options, Events],
  360. options: {
  361. "id": ""
  362. },
  363. initialize: function (explorer, options, data) {
  364. this.setOptions(options);
  365. this.app = explorer.app;
  366. this.explorer = explorer;
  367. this.topNode = explorer.topContentNode;
  368. this.contentNode = explorer.contentNode;
  369. this.data = data;
  370. this.css = this.explorer.css;
  371. this.lp = MWF.xApplication.ThreeMember.LP;
  372. },
  373. clear: function () {
  374. this.topNode.empty();
  375. this.contentNode.empty();
  376. },
  377. load: function () {
  378. new Element("div", {
  379. styles : this.css.topNaviTitleNode,
  380. text: this.data.category.text + "-" +
  381. (this.data.application.name || this.data.application.appName || this.data.application.applicationName)
  382. }).inject(this.topNode);
  383. this.getNaviData().each(function (data, i) {
  384. var naviNode = new Element("div", {
  385. styles : this.css.topNaviItemNode,
  386. text: data.text
  387. }).inject(this.topNode);
  388. naviNode.store("data", data);
  389. naviNode.addEvent("click", function () {
  390. this.setCurrent( naviNode );
  391. }.bind(this))
  392. if( i === 0 )naviNode.click();
  393. }.bind(this));
  394. },
  395. setCurrent: function (naviNode) {
  396. if( this.currentNaviNode )this.currentNaviNode.setStyles(this.css.topNaviItemNode);
  397. this.currentNaviNode = naviNode;
  398. naviNode.setStyles( this.css.topNaviItemNode_current );
  399. var data = naviNode.retrieve("data");
  400. this.contentNode.empty();
  401. if(this[data.action])this[data.action]();
  402. },
  403. getNaviData: function () {
  404. return [{
  405. "action": "loadApplication",
  406. "text": this.lp.permission.application
  407. },{
  408. "action": "loadProcess",
  409. "text": this.lp.permission.process
  410. }]
  411. },
  412. loadApplication: function () {
  413. o2.Actions.load("x_processplatform_assemble_designer").ApplicationAction.get(this.options.id, function (json) {
  414. this.data = json.data;
  415. new TMPermissionView.ProcessAppUser(this.explorer, this.contentNode, { id: this.options.id }, this.data);
  416. new TMPermissionView.ProcessAppManager(this.explorer, this.contentNode, { id: this.options.id }, this.data);
  417. }.bind(this))
  418. },
  419. loadProcess: function () {
  420. o2.Actions.load("x_processplatform_assemble_designer").ProcessAction.listWithApplication(this.options.id, function (json) {
  421. if( !json.data || !json.data.length ){
  422. new Element("div", {
  423. styles : this.css.noDataTextNode,
  424. text: this.lp.noDataText.process
  425. }).inject(this.contentNode);
  426. }else{
  427. json.data.each(function (d) {
  428. new Element("div", {
  429. styles: this.css.propertyTitleNode,
  430. text: d.name
  431. }).inject(this.contentNode);
  432. var table = new Element("table", this.css.tableProperty).inject(this.contentNode);
  433. var tr;
  434. tr = new Element("tr").inject(table);
  435. new TMPermissionView.ProcessProcessStarter(this.explorer, tr, { id: d.id }, d);
  436. tr = new Element("tr").inject(table);
  437. new TMPermissionView.ProcessProcessManager(this.explorer, tr, { id: d.id }, d);
  438. }.bind(this))
  439. }
  440. }.bind(this))
  441. }
  442. });
  443. TMPermissionView.CMSApplication = new Class({
  444. Extends: TMPermissionView.ProcessApplication,
  445. getNaviData: function () {
  446. return [{
  447. "action": "loadColumn",
  448. "text": this.lp.permission.column
  449. },{
  450. "action": "loadCategory",
  451. "text": this.lp.permission.category
  452. }]
  453. },
  454. loadColumn: function () {
  455. debugger;
  456. o2.Actions.load("x_cms_assemble_control").AppInfoAction.get(this.options.id, function (json) {
  457. this.data = json.data;
  458. new TMPermissionView.CMSAppViewer(this.explorer, this.contentNode, { id: this.options.id }, this.data);
  459. new TMPermissionView.CMSAppPublisher(this.explorer, this.contentNode, { id: this.options.id }, this.data);
  460. new TMPermissionView.CMSAppManager(this.explorer, this.contentNode, { id: this.options.id }, this.data);
  461. }.bind(this))
  462. },
  463. loadCategory: function () {
  464. debugger;
  465. o2.Actions.load("x_cms_assemble_control").CategoryInfoAction.listNextWithFilter("(0)", 1000, this.options.id, {
  466. appIdList: [this.options.id]
  467. }, function (json) {
  468. if( !json.data || !json.data.length ){
  469. new Element("div", {
  470. styles : this.css.noDataTextNode,
  471. text: this.lp.noDataText.category
  472. }).inject(this.contentNode);
  473. }else{
  474. json.data.each(function (d) {
  475. new Element("div", {
  476. styles: this.css.propertyTitleNode,
  477. text: d.name || d.categoryName
  478. }).inject(this.contentNode);
  479. var table = new Element("table", this.css.tableProperty).inject(this.contentNode);
  480. var tr;
  481. tr = new Element("tr").inject(table);
  482. new TMPermissionView.CMSCateViewer(this.explorer, tr, { id: d.id }, d);
  483. tr = new Element("tr").inject(table);
  484. new TMPermissionView.CMSCatePublisher(this.explorer, tr, { id: d.id }, d);
  485. tr = new Element("tr").inject(table);
  486. new TMPermissionView.CMSCateManager(this.explorer, tr, { id: d.id }, d);
  487. }.bind(this))
  488. }
  489. }.bind(this))
  490. }
  491. });
  492. TMPermissionView.PortalApplication = new Class({
  493. Extends: TMPermissionView.ProcessApplication,
  494. getNaviData: function () {
  495. return [{
  496. "action": "loadPortal",
  497. "text": this.lp.permission.portal
  498. }]
  499. },
  500. loadPortal: function () {
  501. o2.Actions.load("x_portal_assemble_designer").PortalAction.get(this.options.id, function (json) {
  502. this.data = json.data;
  503. new TMPermissionView.PortalAppUser(this.explorer, this.contentNode, { id: this.options.id }, this.data);
  504. new TMPermissionView.PortalAppManager(this.explorer, this.contentNode, { id: this.options.id }, this.data);
  505. }.bind(this))
  506. }
  507. });
  508. TMPermissionView.QueryApplication = new Class({
  509. Extends: TMPermissionView.ProcessApplication,
  510. getNaviData: function () {
  511. return [{
  512. "action": "loadQuery",
  513. "text": this.lp.permission.query
  514. },{
  515. "action": "loadView",
  516. "text": this.lp.permission.view
  517. },{
  518. "action": "loadStat",
  519. "text": this.lp.permission.stat
  520. },{
  521. "action": "loadTable",
  522. "text": this.lp.permission.table
  523. },{
  524. "action": "loadStatement",
  525. "text": this.lp.permission.statement
  526. },{
  527. "action": "loadImporter",
  528. "text": this.lp.permission.importer
  529. }]
  530. },
  531. loadQuery: function () {
  532. o2.Actions.load("x_query_assemble_designer").QueryAction.get(this.options.id, function (json) {
  533. this.data = json.data;
  534. new TMPermissionView.QueryAppUser(this.explorer, this.contentNode, { id: this.options.id }, this.data);
  535. new TMPermissionView.QueryAppManager(this.explorer, this.contentNode, { id: this.options.id }, this.data);
  536. }.bind(this))
  537. },
  538. loadView: function () {
  539. o2.Actions.load("x_query_assemble_designer").ViewAction.listWithQuery(this.options.id, function (json) {
  540. if( !json.data || !json.data.length ){
  541. new Element("div", {
  542. styles : this.css.noDataTextNode,
  543. text: this.lp.noDataText.view
  544. }).inject(this.contentNode);
  545. }else{
  546. json.data.each(function (d) {
  547. new Element("div", {
  548. styles: this.css.propertyTitleNode,
  549. text: d.name
  550. }).inject(this.contentNode);
  551. var table = new Element("table", this.css.tableProperty).inject(this.contentNode);
  552. var tr;
  553. tr = new Element("tr").inject(table);
  554. new TMPermissionView.QueryViewExecutor(this.explorer, tr, { id: d.id }, d);
  555. }.bind(this))
  556. }
  557. }.bind(this))
  558. },
  559. loadStat: function () {
  560. o2.Actions.load("x_query_assemble_designer").StatAction.listWithQuery(this.options.id, function (json) {
  561. debugger;
  562. if( !json.data || !json.data.length ){
  563. new Element("div", {
  564. styles : this.css.noDataTextNode,
  565. text: this.lp.noDataText.stat
  566. }).inject(this.contentNode);
  567. }else{
  568. json.data.each(function (d) {
  569. new Element("div", {
  570. styles: this.css.propertyTitleNode,
  571. text: d.name
  572. }).inject(this.contentNode);
  573. var table = new Element("table", this.css.tableProperty).inject(this.contentNode);
  574. var tr;
  575. tr = new Element("tr").inject(table);
  576. new TMPermissionView.QueryStatExecutor(this.explorer, tr, { id: d.id }, d);
  577. }.bind(this))
  578. }
  579. }.bind(this))
  580. },
  581. loadTable: function () {
  582. o2.Actions.load("x_query_assemble_designer").TableAction.listWithQuery(this.options.id, function (json) {
  583. if( !json.data || !json.data.length ){
  584. new Element("div", {
  585. styles : this.css.noDataTextNode,
  586. text: this.lp.noDataText.table
  587. }).inject(this.contentNode);
  588. }else{
  589. json.data.each(function (d) {
  590. new Element("div", {
  591. styles: this.css.propertyTitleNode,
  592. text: d.name
  593. }).inject(this.contentNode);
  594. var table = new Element("table", this.css.tableProperty).inject(this.contentNode);
  595. var tr;
  596. tr = new Element("tr").inject(table);
  597. new TMPermissionView.QueryTableReader(this.explorer, tr, { id: d.id }, d);
  598. tr = new Element("tr").inject(table);
  599. new TMPermissionView.QueryTableEditor(this.explorer, tr, { id: d.id }, d);
  600. }.bind(this))
  601. }
  602. }.bind(this))
  603. },
  604. loadStatement: function () {
  605. o2.Actions.load("x_query_assemble_designer").StatementAction.listWithQuery(this.options.id, function (json) {
  606. if( !json.data || !json.data.length ){
  607. new Element("div", {
  608. styles : this.css.noDataTextNode,
  609. text: this.lp.noDataText.statement
  610. }).inject(this.contentNode);
  611. }else{
  612. MWF.xDesktop.requireApp("Template", "MDomItem", null, false);
  613. json.data.each(function (d) {
  614. new Element("div", {
  615. styles: this.css.propertyTitleNode,
  616. text: d.name
  617. }).inject(this.contentNode);
  618. var table = new Element("table", this.css.tableProperty).inject(this.contentNode);
  619. var tr = new Element("tr").inject(table);
  620. var td = new Element("td", {
  621. styles : this.css.propertyTitleTd,
  622. "text": this.lp.anonymousAccessible
  623. }).inject(tr);
  624. td.setStyles({ "height": "36px", "line-height": "36px" });
  625. var td = new Element("td", {
  626. styles : this.css.propertyContentTd,
  627. colspan : 2
  628. }).inject(tr);
  629. td.setStyles({ "height": "36px", "line-height": "36px" });
  630. var value = (o2.typeOf(d.anonymousAccessible) === "boolean" ? d.anonymousAccessible : true).toString();
  631. var anonymousAccessibleItem = new MDomItem(td, {
  632. "formStyle": "setting",
  633. "name": d.id+"anonymousAccessible",
  634. "type": "radio",
  635. "selectValue": ["true", "false"],
  636. "selectText": [this.lp.yes, this.lp.no],
  637. "value": value,
  638. "event": {
  639. "change": function (item) {
  640. executorTr.setStyle( "display", item.getValue() === "true" ? "none" : "" );
  641. d.anonymousAccessible = item.getValue() === "true";
  642. o2.Actions.load("x_query_assemble_designer").StatementAction.updatePermission(d.id, d);
  643. }
  644. }
  645. }).load();
  646. var executorTr = new Element("tr").inject(table);
  647. new TMPermissionView.QueryStatementExecutor(this.explorer, executorTr, { id: d.id }, d);
  648. if( value === "true" )executorTr.hide();
  649. }.bind(this))
  650. }
  651. }.bind(this))
  652. },
  653. loadImporter: function () {
  654. o2.Actions.load("x_query_assemble_designer").ImportModelAction.listWithQuery(this.options.id, function (json) {
  655. if( !json.data || !json.data.length ){
  656. new Element("div", {
  657. styles : this.css.noDataTextNode,
  658. text: this.lp.noDataText.importer
  659. }).inject(this.contentNode);
  660. }else{
  661. json.data.each(function (d) {
  662. new Element("div", {
  663. styles: this.css.propertyTitleNode,
  664. text: d.name
  665. }).inject(this.contentNode);
  666. var table = new Element("table", this.css.tableProperty).inject(this.contentNode);
  667. var tr;
  668. tr = new Element("tr").inject(table);
  669. new TMPermissionView.QueryImportModelExecutor(this.explorer, tr, { id: d.id }, d);
  670. }.bind(this))
  671. }
  672. }.bind(this))
  673. }
  674. });
  675. MWF.require("MWF.widget.O2Identity", null, false);
  676. TMPermissionView.CMSAppViewer = new Class({
  677. Implements: [Options],
  678. options : {
  679. id : "", //对象或分类的ID
  680. orgTypes: ["person","unit","group"],
  681. title: MWF.xApplication.ThreeMember.LP.viewer
  682. },
  683. initialize: function(explorer, node, options, data){
  684. this.explorer = explorer;
  685. this.node = $(node);
  686. this.app = explorer.app;
  687. this.lp = explorer.lp;
  688. this.css = explorer.css;
  689. if(data)this.data = data;
  690. this.setOptions( options );
  691. this.load();
  692. },
  693. load: function(){
  694. this.createNode();
  695. this.listData( function(){
  696. this.loadOrg();
  697. }.bind(this));
  698. },
  699. createNode: function(){
  700. this.titleNode = new Element("div.availableTitleNode", {
  701. "styles": this.css.itemTitleNode,
  702. "text": this.options.title
  703. }).inject(this.node);
  704. this.contentNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.node);
  705. this.itemsContentNode = new Element("div", {"styles": this.css.itemsContentNode}).inject(this.contentNode);
  706. this.actionAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.node);
  707. var changeAction = new Element("div.selectButtonStyle", {
  708. "styles": this.css.selectButtonStyle,
  709. "text": this.lp.set + this.options.title
  710. }).inject(this.actionAreaNode);
  711. changeAction.addEvent("click", function(){
  712. this.change();
  713. }.bind(this));
  714. },
  715. loadOrg : function( data ){
  716. this.itemsContentNode.empty();
  717. // this.loadOrgWidget( this.data.personList );
  718. // this.loadOrgWidget( this.data.unitList );
  719. // this.loadOrgWidget( this.data.groupList );
  720. this.loadOrgWidget( data || this.values );
  721. },
  722. loadOrgWidget: function(value ){
  723. this.OrgWidgetList = this.OrgWidgetList || [];
  724. var options = { "style": "xform", "canRemove": false, "lazy": true };
  725. var node = this.itemsContentNode;
  726. (value || []).each(function( item ){
  727. var dn, data;
  728. if( o2.typeOf( item ) === "object" ){
  729. dn = item.distinguishedName;
  730. data = item;
  731. }else if( o2.typeOf( item ) === "string" ){
  732. dn = item;
  733. data = {
  734. "displayName": o2.name.cn(dn),
  735. "distinguishedName" : dn,
  736. "name": dn
  737. }
  738. }
  739. var flag = dn.substr( dn.length-1, 1 );
  740. var widget;
  741. switch (flag.toLowerCase()){
  742. case "i":
  743. widget = new MWF.widget.O2Identity( data, node, options );
  744. break;
  745. case "p":
  746. widget = new MWF.widget.O2Person(data, node, options);
  747. break;
  748. case "u":
  749. widget = new MWF.widget.O2Unit(data, node, options);
  750. break;
  751. case "g":
  752. widget = new MWF.widget.O2Group(data, node, options);
  753. break;
  754. default:
  755. widget = new MWF.widget.O2Other( data, node, options);
  756. }
  757. this.OrgWidgetList.push( widget );
  758. }.bind(this));
  759. },
  760. change: function(){
  761. MWF.xDesktop.requireApp("Selector", "package", null, false);
  762. var opt = {
  763. "type" : "",
  764. "types" : this.options.orgTypes,
  765. "title": this.options.title,
  766. "count" : 0,
  767. "values": this.values,
  768. "expand": false,
  769. "onComplete": function( array ){
  770. this.selectData( array );
  771. }.bind(this)
  772. };
  773. var selector = new MWF.O2Selector(this.app.content, opt );
  774. },
  775. listData: function( callback ){
  776. // o2.Actions.load("x_cms_assemble_control").PermissionAction.listAppInfoViewers(this.options.id, function(json){
  777. // this.data = json.data;
  778. // this.values = ( this.data.personList || [] ).combine( this.data.unitList || []).combine( this.data.groupList || [] );
  779. // if( callback )callback( json );
  780. // }.bind(this), null ,false)
  781. this.values = ( this.data.viewablePersonList || [] )
  782. .combine( this.data.viewableUnitList || [])
  783. .combine( this.data.viewableGroupList || [] );
  784. if( callback )callback();
  785. },
  786. selectData: function(array){
  787. this.data.viewablePersonList = [];
  788. this.data.viewableUnitList = [];
  789. this.data.viewableGroupList = [];
  790. array.each( function( a ){
  791. var dn = a.data.distinguishedName;
  792. var flag = dn.substr(dn.length-1, 1);
  793. switch (flag.toLowerCase()){
  794. case "p":
  795. this.data.viewablePersonList.push( dn );
  796. break;
  797. case "u":
  798. this.data.viewableUnitList.push( dn );
  799. break;
  800. case "g":
  801. this.data.viewableGroupList.push( dn );
  802. break;
  803. }
  804. }.bind(this));
  805. this.saveData( this.data, function(){
  806. this.listData( function(){
  807. this.loadOrg();
  808. }.bind(this));
  809. }.bind(this))
  810. },
  811. saveData: function( data, callback ){
  812. o2.Actions.load("x_cms_assemble_control").AppInfoAction
  813. .updatePermission(this.options.id, data, function (json) {
  814. if(callback)callback()
  815. }.bind(this));
  816. }
  817. });
  818. TMPermissionView.CMSAppPublisher = new Class({
  819. Extends: TMPermissionView.CMSAppViewer,
  820. options: {
  821. title: MWF.xApplication.ThreeMember.LP.publisher
  822. },
  823. listData: function( callback ){
  824. this.values = ( this.data.publishablePersonList || [] )
  825. .combine( this.data.publishableUnitList || [])
  826. .combine( this.data.publishableGroupList || [] );
  827. if( callback )callback();
  828. },
  829. selectData: function(array){
  830. this.data.publishablePersonList = [];
  831. this.data.publishableUnitList = [];
  832. this.data.publishableGroupList = [];
  833. array.each( function( a ){
  834. var dn = a.data.distinguishedName;
  835. var flag = dn.substr(dn.length-1, 1);
  836. switch (flag.toLowerCase()){
  837. case "p":
  838. this.data.publishablePersonList.push( dn );
  839. break;
  840. case "u":
  841. this.data.publishableUnitList.push( dn );
  842. break;
  843. case "g":
  844. this.data.publishableGroupList.push( dn );
  845. break;
  846. }
  847. }.bind(this));
  848. this.saveData( this.data, function(){
  849. this.listData( function(){
  850. this.loadOrg();
  851. }.bind(this));
  852. }.bind(this))
  853. },
  854. saveData: function( data, callback ){
  855. o2.Actions.load("x_cms_assemble_control").AppInfoAction
  856. .updatePermission(this.options.id, data, function (json) {
  857. if(callback)callback()
  858. }.bind(this));
  859. }
  860. // listData: function (callback) {
  861. // o2.Actions.load("x_cms_assemble_control").PermissionAction.listAppInfoPublishers(this.options.id, function (json) {
  862. // this.data = json.data;
  863. // this.values = (this.data.personList || []).combine(this.data.unitList || []).combine(this.data.groupList || []);
  864. // if (callback) callback(json);
  865. // }.bind(this), null, false)
  866. // },
  867. // saveData: function (data, callback) {
  868. // o2.Actions.load("x_cms_assemble_control").PermissionAction.saveAppInfoPublisher(this.options.id, data, function (json) {
  869. // if (callback) callback()
  870. // }.bind(this));
  871. // }
  872. });
  873. TMPermissionView.CMSAppManager = new Class({
  874. Extends: TMPermissionView.CMSAppViewer,
  875. options: {
  876. title: MWF.xApplication.ThreeMember.LP.manager
  877. },
  878. listData: function( callback ){
  879. this.values = ( this.data.manageablePersonList || [] )
  880. .combine( this.data.manageableUnitList || [])
  881. .combine( this.data.manageableGroupList || [] );
  882. if( callback )callback();
  883. },
  884. selectData: function(array){
  885. this.data.manageablePersonList = [];
  886. this.data.manageableUnitList = [];
  887. this.data.manageableGroupList = [];
  888. array.each( function( a ){
  889. var dn = a.data.distinguishedName;
  890. var flag = dn.substr(dn.length-1, 1);
  891. switch (flag.toLowerCase()){
  892. case "p":
  893. this.data.manageablePersonList.push( dn );
  894. break;
  895. case "u":
  896. this.data.manageableUnitList.push( dn );
  897. break;
  898. case "g":
  899. this.data.manageableGroupList.push( dn );
  900. break;
  901. }
  902. }.bind(this));
  903. this.saveData( this.data, function(){
  904. this.listData( function(){
  905. this.loadOrg();
  906. }.bind(this));
  907. }.bind(this))
  908. },
  909. saveData: function( data, callback ){
  910. o2.Actions.load("x_cms_assemble_control").AppInfoAction
  911. .updatePermission(this.options.id, data, function (json) {
  912. if(callback)callback()
  913. }.bind(this));
  914. }
  915. // listData: function (callback) {
  916. // o2.Actions.load("x_cms_assemble_control").PermissionAction.listAppInfoManagers(this.options.id, function (json) {
  917. // this.data = json.data;
  918. // this.values = (this.data.personList || []).combine(this.data.unitList || []).combine(this.data.groupList || []);
  919. // if (callback) callback(json);
  920. // }.bind(this), null, false)
  921. // },
  922. // saveData: function (data, callback) {
  923. // o2.Actions.load("x_cms_assemble_control").PermissionAction.saveAppInfoPublisher(this.options.id, data, function (json) {
  924. // if (callback) callback()
  925. // }.bind(this));
  926. // }
  927. });
  928. TMPermissionView.CMSCateViewer = new Class({
  929. Extends: TMPermissionView.CMSAppViewer,
  930. options: {
  931. title: MWF.xApplication.ThreeMember.LP.viewer
  932. },
  933. createNode: function(){
  934. var td = new Element("td", {
  935. styles : this.css.propertyTitleTd,
  936. "text": this.options.title
  937. }).inject(this.node);
  938. var td = new Element("td", {
  939. styles : this.css.propertyContentTd
  940. }).inject(this.node);
  941. this.contentNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(td);
  942. this.itemsContentNode = new Element("div", {"styles": this.css.propertyContentNode}).inject(this.contentNode);
  943. var td = new Element("td", {
  944. styles : this.css.propertyActionTd
  945. }).inject(this.node);
  946. this.actionAreaNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(td);
  947. var changeAction = new Element("div.selectButtonStyle", {
  948. "styles": this.css.propertyButtonStyle,
  949. "text": this.lp.set + this.options.title
  950. }).inject(this.actionAreaNode);
  951. changeAction.addEvent("click", function(){
  952. this.change();
  953. }.bind(this));
  954. },
  955. listData: function( callback ){
  956. this.values = ( this.data.viewablePersonList || [] )
  957. .combine( this.data.viewableUnitList || [])
  958. .combine( this.data.viewableGroupList || [] );
  959. if( callback )callback();
  960. },
  961. selectData: function(array){
  962. this.data.viewablePersonList = [];
  963. this.data.viewableUnitList = [];
  964. this.data.viewableGroupList = [];
  965. array.each( function( a ){
  966. var dn = a.data.distinguishedName;
  967. var flag = dn.substr(dn.length-1, 1);
  968. switch (flag.toLowerCase()){
  969. case "p":
  970. this.data.viewablePersonList.push( dn );
  971. break;
  972. case "u":
  973. this.data.viewableUnitList.push( dn );
  974. break;
  975. case "g":
  976. this.data.viewableGroupList.push( dn );
  977. break;
  978. }
  979. }.bind(this));
  980. this.saveData( this.data, function(){
  981. this.listData( function(){
  982. this.loadOrg();
  983. }.bind(this));
  984. }.bind(this))
  985. },
  986. saveData: function( data, callback ){
  987. o2.Actions.load("x_cms_assemble_control").CategoryInfoAction
  988. .updatePermission(this.options.id, data, function (json) {
  989. if(callback)callback()
  990. }.bind(this));
  991. }
  992. // listData: function (callback) {
  993. // o2.Actions.load("x_cms_assemble_control").PermissionAction.listCategoryInfoViewers(this.options.id, function (json) {
  994. // this.data = json.data;
  995. // this.values = (this.data.personList || []).combine(this.data.unitList || []).combine(this.data.groupList || []);
  996. // if (callback) callback(json);
  997. // }.bind(this), null, false)
  998. // },
  999. // saveData: function (data, callback) {
  1000. // o2.Actions.load("x_cms_assemble_control").PermissionAction.saveCategoryInfoViewer(this.options.id, data, function (json) {
  1001. // if (callback) callback()
  1002. // }.bind(this));
  1003. // }
  1004. });
  1005. TMPermissionView.CMSCatePublisher = new Class({
  1006. Extends: TMPermissionView.CMSCateViewer,
  1007. options: {
  1008. title: MWF.xApplication.ThreeMember.LP.publisher
  1009. },
  1010. listData: function( callback ){
  1011. this.values = ( this.data.publishablePersonList || [] )
  1012. .combine( this.data.publishableUnitList || [])
  1013. .combine( this.data.publishableGroupList || [] );
  1014. if( callback )callback();
  1015. },
  1016. selectData: function(array){
  1017. this.data.publishablePersonList = [];
  1018. this.data.publishableUnitList = [];
  1019. this.data.publishableGroupList = [];
  1020. array.each( function( a ){
  1021. var dn = a.data.distinguishedName;
  1022. var flag = dn.substr(dn.length-1, 1);
  1023. switch (flag.toLowerCase()){
  1024. case "p":
  1025. this.data.publishablePersonList.push( dn );
  1026. break;
  1027. case "u":
  1028. this.data.publishableUnitList.push( dn );
  1029. break;
  1030. case "g":
  1031. this.data.publishableGroupList.push( dn );
  1032. break;
  1033. }
  1034. }.bind(this));
  1035. this.saveData( this.data, function(){
  1036. this.listData( function(){
  1037. this.loadOrg();
  1038. }.bind(this));
  1039. }.bind(this))
  1040. },
  1041. saveData: function( data, callback ){
  1042. o2.Actions.load("x_cms_assemble_control").CategoryInfoAction
  1043. .updatePermission(this.options.id, data, function (json) {
  1044. if(callback)callback()
  1045. }.bind(this));
  1046. }
  1047. // listData: function (callback) {
  1048. // o2.Actions.load("x_cms_assemble_control").PermissionAction.listCategoryInfoPublishers(this.options.id, function (json) {
  1049. // this.data = json.data;
  1050. // this.values = (this.data.personList || []).combine(this.data.unitList || []).combine(this.data.groupList || []);
  1051. // if (callback) callback(json);
  1052. // }.bind(this), null, false)
  1053. // },
  1054. // saveData: function (data, callback) {
  1055. // o2.Actions.load("x_cms_assemble_control").PermissionAction.saveCategoryInfoPublisher(this.options.id, data, function (json) {
  1056. // if (callback) callback()
  1057. // }.bind(this));
  1058. // }
  1059. });
  1060. TMPermissionView.CMSCateManager = new Class({
  1061. Extends: TMPermissionView.CMSCateViewer,
  1062. options: {
  1063. title: MWF.xApplication.ThreeMember.LP.manager
  1064. },
  1065. listData: function( callback ){
  1066. this.values = ( this.data.manageablePersonList || [] )
  1067. .combine( this.data.manageableUnitList || [])
  1068. .combine( this.data.manageableGroupList || [] );
  1069. if( callback )callback();
  1070. },
  1071. selectData: function(array){
  1072. this.data.manageablePersonList = [];
  1073. this.data.manageableUnitList = [];
  1074. this.data.manageableGroupList = [];
  1075. array.each( function( a ){
  1076. var dn = a.data.distinguishedName;
  1077. var flag = dn.substr(dn.length-1, 1);
  1078. switch (flag.toLowerCase()){
  1079. case "p":
  1080. this.data.manageablePersonList.push( dn );
  1081. break;
  1082. case "u":
  1083. this.data.manageableUnitList.push( dn );
  1084. break;
  1085. case "g":
  1086. this.data.manageableGroupList.push( dn );
  1087. break;
  1088. }
  1089. }.bind(this));
  1090. this.saveData( this.data, function(){
  1091. this.listData( function(){
  1092. this.loadOrg();
  1093. }.bind(this));
  1094. }.bind(this))
  1095. },
  1096. saveData: function( data, callback ){
  1097. o2.Actions.load("x_cms_assemble_control").CategoryInfoAction
  1098. .updatePermission(this.options.id, data, function (json) {
  1099. if(callback)callback()
  1100. }.bind(this));
  1101. }
  1102. // listData: function (callback) {
  1103. // o2.Actions.load("x_cms_assemble_control").PermissionAction.listCategoryInfoManagers(this.options.id, function (json) {
  1104. // this.data = json.data;
  1105. // this.values = (this.data.personList || []).combine(this.data.unitList || []).combine(this.data.groupList || []);
  1106. // if (callback) callback(json);
  1107. // }.bind(this), null, false)
  1108. // },
  1109. // saveData: function (data, callback) {
  1110. // o2.Actions.load("x_cms_assemble_control").PermissionAction.saveCategoryInfoManager(this.options.id, data, function (json) {
  1111. // if (callback) callback()
  1112. // }.bind(this));
  1113. // }
  1114. });
  1115. TMPermissionView.ProcessAppUser = new Class({
  1116. Extends: TMPermissionView.CMSAppViewer,
  1117. options: {
  1118. orgTypes: ["identity","unit"],
  1119. title: MWF.xApplication.ThreeMember.LP.viewer
  1120. },
  1121. selectData: function(array){
  1122. this.data.availableIdentityList = [];
  1123. this.data.availableUnitList = [];
  1124. this.data.availableGroupList = [];
  1125. array.each( function( a ){
  1126. var dn = a.data.distinguishedName;
  1127. var flag = dn.substr(dn.length-1, 1);
  1128. switch (flag.toLowerCase()){
  1129. case "i":
  1130. this.data.availableIdentityList.push( dn );
  1131. break;
  1132. case "u":
  1133. this.data.availableUnitList.push( dn );
  1134. break;
  1135. case "g":
  1136. this.data.availableGroupList.push( dn );
  1137. break;
  1138. }
  1139. }.bind(this));
  1140. this.saveData( this.data, function(){
  1141. this.values = ( this.data.availableIdentityList || [] )
  1142. .combine( this.data.availableUnitList || [])
  1143. .combine( this.data.availableGroupList || []);
  1144. this.loadOrg();
  1145. }.bind(this))
  1146. },
  1147. listData: function (callback) {
  1148. this.values = ( this.data.availableIdentityList || [] )
  1149. .combine( this.data.availableUnitList || [])
  1150. .combine( this.data.availableGroupList || []);
  1151. if( callback )callback();
  1152. },
  1153. saveData: function (data, callback) {
  1154. o2.Actions.load("x_processplatform_assemble_designer").ApplicationAction
  1155. .updatePermission(this.data.id, data, function (json) {
  1156. if (callback) callback()
  1157. }.bind(this));
  1158. }
  1159. });
  1160. TMPermissionView.ProcessAppManager = new Class({
  1161. Extends: TMPermissionView.ProcessAppUser,
  1162. options: {
  1163. orgTypes: ["person"],
  1164. title: MWF.xApplication.ThreeMember.LP.manager
  1165. },
  1166. selectData: function(array){
  1167. this.data.controllerList = [];
  1168. array.each( function( a ){
  1169. var dn = a.data.distinguishedName;
  1170. var flag = dn.substr(dn.length-1, 1);
  1171. switch (flag.toLowerCase()){
  1172. case "p":
  1173. this.data.controllerList.push( dn );
  1174. break;
  1175. }
  1176. }.bind(this));
  1177. this.saveData( this.data, function(){
  1178. this.values = this.data.controllerList || [];
  1179. this.loadOrg();
  1180. }.bind(this))
  1181. },
  1182. listData: function (callback) {
  1183. this.values = this.data.controllerList || [];
  1184. if( callback )callback();
  1185. },
  1186. saveData: function (data, callback) {
  1187. o2.Actions.load("x_processplatform_assemble_designer").ApplicationAction
  1188. .updatePermission(this.data.id, data, function (json) {
  1189. if (callback) callback()
  1190. }.bind(this));
  1191. }
  1192. });
  1193. TMPermissionView.ProcessProcessStarter = new Class({
  1194. Extends: TMPermissionView.CMSCateViewer,
  1195. options: {
  1196. orgTypes: ["identity","unit", "group"],
  1197. title: MWF.xApplication.ThreeMember.LP.starter
  1198. },
  1199. selectData: function(array){
  1200. this.data.startableIdentityList = [];
  1201. this.data.startableUnitList = [];
  1202. this.data.startableGroupList = [];
  1203. array.each( function( a ){
  1204. var dn = a.data.distinguishedName;
  1205. var flag = dn.substr(dn.length-1, 1);
  1206. switch (flag.toLowerCase()){
  1207. case "i":
  1208. this.data.startableIdentityList.push( dn );
  1209. break;
  1210. case "u":
  1211. this.data.startableUnitList.push( dn );
  1212. break;
  1213. case "g":
  1214. this.data.startableGroupList.push( dn );
  1215. break;
  1216. }
  1217. }.bind(this));
  1218. this.saveData( this.data, function(){
  1219. this.values = (this.data.startableIdentityList || [])
  1220. .combine(this.data.startableUnitList || [])
  1221. .combine(this.data.startableGroupList || []);
  1222. this.loadOrg();
  1223. }.bind(this))
  1224. },
  1225. listData: function (callback) {
  1226. this.values = (this.data.startableIdentityList || [])
  1227. .combine(this.data.startableUnitList || [])
  1228. .combine(this.data.startableGroupList || []);
  1229. if (callback) callback();
  1230. },
  1231. saveData: function (data, callback) {
  1232. o2.Actions.load("x_processplatform_assemble_designer").ProcessAction
  1233. .updatePermission(this.options.id, data, function (json) {
  1234. if (callback) callback()
  1235. }.bind(this));
  1236. }
  1237. });
  1238. TMPermissionView.ProcessProcessManager = new Class({
  1239. Extends: TMPermissionView.CMSCateViewer,
  1240. options: {
  1241. orgTypes: ["person"],
  1242. title: MWF.xApplication.ThreeMember.LP.manager
  1243. },
  1244. selectData: function(array){
  1245. this.data.controllerList = [];
  1246. array.each( function( a ){
  1247. var dn = a.data.distinguishedName;
  1248. var flag = dn.substr(dn.length-1, 1);
  1249. switch (flag.toLowerCase()){
  1250. case "p":
  1251. this.data.controllerList.push( dn );
  1252. break;
  1253. }
  1254. }.bind(this));
  1255. this.saveData( this.data, function(){
  1256. this.values = this.data.controllerList || [];
  1257. this.loadOrg();
  1258. }.bind(this))
  1259. },
  1260. listData: function (callback) {
  1261. this.values = this.data.controllerList || [];
  1262. if (callback) callback();
  1263. },
  1264. saveData: function (data, callback) {
  1265. o2.Actions.load("x_processplatform_assemble_designer").ProcessAction
  1266. .updatePermission(this.options.id, data, function (json) {
  1267. if (callback) callback()
  1268. }.bind(this));
  1269. }
  1270. });
  1271. TMPermissionView.PortalAppUser = new Class({
  1272. Extends: TMPermissionView.ProcessAppUser,
  1273. saveData: function (data, callback) {
  1274. o2.Actions.load("x_portal_assemble_designer").PortalAction
  1275. .updatePermission(this.data.id, data, function (json) {
  1276. if (callback) callback()
  1277. }.bind(this));
  1278. }
  1279. });
  1280. TMPermissionView.PortalAppManager = new Class({
  1281. Extends: TMPermissionView.ProcessAppManager,
  1282. saveData: function (data, callback) {
  1283. o2.Actions.load("x_portal_assemble_designer").PortalAction
  1284. .updatePermission(this.data.id, data, function (json) {
  1285. if (callback) callback()
  1286. }.bind(this));
  1287. }
  1288. });
  1289. TMPermissionView.QueryAppUser = new Class({
  1290. Extends: TMPermissionView.ProcessAppUser,
  1291. saveData: function (data, callback) {
  1292. o2.Actions.load("x_query_assemble_designer").QueryAction
  1293. .updatePermission(this.data.id, data, function (json){
  1294. if (callback) callback()
  1295. }.bind(this));
  1296. }
  1297. });
  1298. TMPermissionView.QueryAppManager = new Class({
  1299. Extends: TMPermissionView.ProcessAppManager,
  1300. saveData: function (data, callback) {
  1301. o2.Actions.load("x_query_assemble_designer").QueryAction
  1302. .updatePermission(this.data.id, data, function (json) {
  1303. if (callback) callback()
  1304. }.bind(this));
  1305. }
  1306. });
  1307. TMPermissionView.QueryViewExecutor = new Class({
  1308. Extends: TMPermissionView.CMSCateViewer,
  1309. options: {
  1310. orgTypes: ["identity","unit"],
  1311. title: MWF.xApplication.ThreeMember.LP.executor
  1312. },
  1313. selectData: function(array){
  1314. this.data.availableIdentityList = [];
  1315. this.data.availableUnitList = [];
  1316. this.data.availableGroupList = [];
  1317. array.each( function( a ){
  1318. var dn = a.data.distinguishedName;
  1319. var flag = dn.substr(dn.length-1, 1);
  1320. switch (flag.toLowerCase()){
  1321. case "i":
  1322. this.data.availableIdentityList.push( dn );
  1323. break;
  1324. case "u":
  1325. this.data.availableUnitList.push( dn );
  1326. break;
  1327. case "g":
  1328. this.data.availableGroupList.push( dn );
  1329. break;
  1330. }
  1331. }.bind(this));
  1332. this.saveData( this.data, function(){
  1333. this.values = (this.data.availableIdentityList || [])
  1334. .combine(this.data.availableUnitList || [])
  1335. .combine(this.data.availableGroupList || []);
  1336. this.loadOrg();
  1337. }.bind(this))
  1338. },
  1339. listData: function (callback) {
  1340. this.values = (this.data.availableIdentityList || [])
  1341. .combine(this.data.availableUnitList || [])
  1342. .combine(this.data.availableGroupList || []);
  1343. if (callback) callback();
  1344. },
  1345. saveData: function (data, callback) {
  1346. o2.Actions.load("x_query_assemble_designer").ViewAction
  1347. .updatePermission(this.options.id, data, function (json) {
  1348. if (callback) callback()
  1349. }.bind(this));
  1350. }
  1351. });
  1352. TMPermissionView.QueryStatExecutor = new Class({
  1353. Extends: TMPermissionView.QueryViewExecutor,
  1354. saveData: function (data, callback) {
  1355. o2.Actions.load("x_query_assemble_designer").StatAction
  1356. .updatePermission(this.options.id, data, function (json) {
  1357. if (callback) callback()
  1358. }.bind(this));
  1359. }
  1360. });
  1361. TMPermissionView.QueryImportModelExecutor = new Class({
  1362. Extends: TMPermissionView.QueryViewExecutor,
  1363. saveData: function (data, callback) {
  1364. o2.Actions.load("x_query_assemble_designer").ImportModelAction
  1365. .updatePermission(this.options.id, data, function (json) {
  1366. if (callback) callback()
  1367. }.bind(this));
  1368. }
  1369. });
  1370. TMPermissionView.QueryTableReader = new Class({
  1371. Extends: TMPermissionView.CMSCateViewer,
  1372. options: {
  1373. orgTypes: ["person","unit"],
  1374. title: MWF.xApplication.ThreeMember.LP.dataViewer
  1375. },
  1376. selectData: function(array){
  1377. this.data.readPersonList = [];
  1378. this.data.readUnitList = [];
  1379. this.data.readGroupList = [];
  1380. array.each( function( a ){
  1381. var dn = a.data.distinguishedName;
  1382. var flag = dn.substr(dn.length-1, 1);
  1383. switch (flag.toLowerCase()){
  1384. case "p":
  1385. this.data.readPersonList.push( dn );
  1386. break;
  1387. case "u":
  1388. this.data.readUnitList.push( dn );
  1389. break;
  1390. case "g":
  1391. this.data.readGroupList.push( dn );
  1392. break;
  1393. }
  1394. }.bind(this));
  1395. this.saveData( this.data, function(){
  1396. this.values = (this.data.readPersonList || [])
  1397. .combine(this.data.readUnitList || [])
  1398. .combine(this.data.readGroupList || []);
  1399. this.loadOrg();
  1400. }.bind(this))
  1401. },
  1402. listData: function (callback) {
  1403. this.values = (this.data.readPersonList || [])
  1404. .combine(this.data.readUnitList || [])
  1405. .combine(this.data.readGroupList || []);
  1406. if (callback) callback();
  1407. },
  1408. saveData: function (data, callback) {
  1409. o2.Actions.load("x_query_assemble_designer").TableAction
  1410. .updatePermission(this.options.id, data, function (json) {
  1411. if (callback) callback()
  1412. }.bind(this));
  1413. }
  1414. });
  1415. TMPermissionView.QueryTableEditor = new Class({
  1416. Extends: TMPermissionView.CMSCateViewer,
  1417. options: {
  1418. orgTypes: ["person","unit"],
  1419. title: MWF.xApplication.ThreeMember.LP.dataEditor
  1420. },
  1421. selectData: function(array){
  1422. this.data.editPersonList = [];
  1423. this.data.editUnitList = [];
  1424. this.data.editGroupList = [];
  1425. array.each( function( a ){
  1426. var dn = a.data.distinguishedName;
  1427. var flag = dn.substr(dn.length-1, 1);
  1428. switch (flag.toLowerCase()){
  1429. case "p":
  1430. this.data.editPersonList.push( dn );
  1431. break;
  1432. case "u":
  1433. this.data.editUnitList.push( dn );
  1434. break;
  1435. case "g":
  1436. this.data.editGroupList.push( dn );
  1437. break;
  1438. }
  1439. }.bind(this));
  1440. this.saveData( this.data, function(){
  1441. this.values = (this.data.editPersonList || [])
  1442. .combine(this.data.editUnitList || [])
  1443. .combine(this.data.editGroupList || []);
  1444. this.loadOrg();
  1445. }.bind(this))
  1446. },
  1447. listData: function (callback) {
  1448. this.values = (this.data.editPersonList || [])
  1449. .combine(this.data.editUnitList || [])
  1450. .combine(this.data.editGroupList || []);
  1451. if (callback) callback();
  1452. },
  1453. saveData: function (data, callback) {
  1454. o2.Actions.load("x_query_assemble_designer").TableAction
  1455. .updatePermission(this.options.id, data, function (json) {
  1456. if (callback) callback()
  1457. }.bind(this));
  1458. }
  1459. });
  1460. TMPermissionView.QueryStatementExecutor = new Class({
  1461. Extends: TMPermissionView.CMSCateViewer,
  1462. options: {
  1463. orgTypes: ["person","unit"],
  1464. title: MWF.xApplication.ThreeMember.LP.executor
  1465. },
  1466. selectData: function(array){
  1467. this.data.executePersonList = [];
  1468. this.data.executeUnitList = [];
  1469. this.data.executeGroupList = [];
  1470. array.each( function( a ){
  1471. var dn = a.data.distinguishedName;
  1472. var flag = dn.substr(dn.length-1, 1);
  1473. switch (flag.toLowerCase()){
  1474. case "p":
  1475. this.data.executePersonList.push( dn );
  1476. break;
  1477. case "u":
  1478. this.data.executeUnitList.push( dn );
  1479. break;
  1480. case "g":
  1481. this.data.executeGroupList.push( dn );
  1482. break;
  1483. }
  1484. }.bind(this));
  1485. this.saveData( this.data, function(){
  1486. this.values = (this.data.executePersonList || [])
  1487. .combine(this.data.executeUnitList || [])
  1488. .combine(this.data.executeGroupList || []);
  1489. this.loadOrg();
  1490. }.bind(this))
  1491. },
  1492. listData: function (callback) {
  1493. this.values = (this.data.executePersonList || [])
  1494. .combine(this.data.executeUnitList || [])
  1495. .combine(this.data.executeGroupList || []);
  1496. if (callback) callback();
  1497. },
  1498. saveData: function (data, callback) {
  1499. o2.Actions.load("x_query_assemble_designer").StatementAction
  1500. .updatePermission(this.options.id, data, function (json) {
  1501. if (callback) callback()
  1502. }.bind(this));
  1503. }
  1504. });