Main.js 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851
  1. MWF.xApplication.cms = MWF.xApplication.cms || {};
  2. MWF.CMSE = MWF.xApplication.cms.Module = MWF.xApplication.cms.Module ||{};
  3. MWF.require("MWF.widget.O2Identity", null,false);
  4. //MWF.xDesktop.requireApp("cms.Module", "Actions.RestActions", null, false);
  5. MWF.xApplication.cms.Module.options = {
  6. multitask: false,
  7. executable: true
  8. };
  9. MWF.xApplication.cms.Module.Main = new Class({
  10. Extends: MWF.xApplication.Common.Main,
  11. Implements: [Options, Events],
  12. options: {
  13. "style": "default",
  14. "name": "cms.Module",
  15. "icon": "icon.png",
  16. "width": "1200",
  17. "height": "700",
  18. "isResize": true,
  19. "isMax": true,
  20. "isCategory" : false,
  21. "searchKey" : "",
  22. "title": MWF.xApplication.cms.Module.LP.title
  23. },
  24. onQueryLoad: function(){
  25. this.lp = MWF.xApplication.cms.Module.LP;
  26. },
  27. onQueryClose : function(){
  28. if (window.clipboardData){
  29. if (this.keyCopyItemsFun)this.removeEvent("copy", this.keyCopyItemsFun);
  30. if (this.keyPasteItemsFun)this.removeEvent("paste", this.keyPasteItemsFun);
  31. }else{
  32. if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
  33. if (this.keyPasteItemsFun) document.removeEventListener('paste', this.keyPasteItemsFun);
  34. }
  35. },
  36. loadApplication: function(callback){
  37. //this.controllers = [];
  38. this.content.loadCss("../x_component_cms_Module/$Main/default/style.css");
  39. this.isAdmin = false;
  40. this.restActions = MWF.Actions.get("x_cms_assemble_control"); //new MWF.xApplication.cms.Module.Actions.RestActions();
  41. this.createNode();
  42. this.loadApplicationContent();
  43. // if(!MWF.shortcut){
  44. // MWF.require("MWF.xDesktop.shortcut");
  45. // }
  46. },
  47. createNode: function(){
  48. this.content.setStyle("overflow", "hidden");
  49. this.node = new Element("div", {
  50. "styles": this.css.node
  51. }).inject(this.content);
  52. this.naviContainerNode = new Element("div.naviContainerNode", {
  53. "styles": this.css.naviContainerNode
  54. }).inject(this.node);
  55. this.leftTitleNode = new Element("div.leftTitleNode", {
  56. "styles": this.css.leftTitleNode
  57. }).inject(this.naviContainerNode);
  58. this.leftTitleNode.addClass("mainColor_border");
  59. this.rightContentNode = new Element("div", {
  60. "styles":this.css.rightContentNode
  61. }).inject(this.node);
  62. this.titleBar = new Element("div", {
  63. "styles": this.css.titleBar
  64. }).inject(this.rightContentNode );
  65. this.titleActionBar = new Element("div", {
  66. "styles": this.css.titleActionBar
  67. }).inject(this.titleBar );
  68. },
  69. loadApplicationContent: function(){
  70. var columnId = (this.options.columnData && this.options.columnData.id ) ||
  71. (this.status && this.status.columnId) || this.options.columnId;
  72. var columnAlias = this.options.columnAlias || (this.options.columnData && this.options.columnData.columnAlias ) ||
  73. (this.status && this.status.columnAlias );
  74. // if( this.options.columnData ){
  75. // this.setColumnDataConfig();
  76. // this.setTitle(this.options.columnData.appName);
  77. // this.loadController(function(){
  78. // this.loadTitle(function(){
  79. // this.loadMenu();
  80. // }.bind(this));
  81. // }.bind(this))
  82. // }else
  83. if( columnId ){
  84. this.loadColumnData( columnId, function(){
  85. this.loadController(function(){
  86. this.loadTitle(function(){
  87. this.loadMenu();
  88. }.bind(this));
  89. }.bind(this))
  90. }.bind(this))
  91. }else if( columnAlias ){
  92. this.restActions.getColumnByAlias( columnAlias, function( json ){
  93. this.columnData = json.data;
  94. this.setColumnDataConfig();
  95. this.setTitle(this.columnData.appName);
  96. this.loadController(function(){
  97. this.loadTitle(function(){
  98. this.loadMenu();
  99. }.bind(this));
  100. }.bind(this))
  101. }.bind(this))
  102. }
  103. },
  104. setColumnDataConfig : function(){
  105. if( !this.columnData.config ){
  106. this.columnData.config = {};
  107. }else if( typeOf(this.columnData.config) === "string" ){
  108. this.columnData.config = JSON.parse( this.columnData.config || {} );
  109. }
  110. },
  111. loadColumnData : function(columnId, callback){
  112. this.restActions.getColumn( columnId, function( json ){
  113. this.columnData = json.data;
  114. this.setTitle(this.columnData.appName);
  115. this.setColumnDataConfig();
  116. //MWF.require("MWF.xScript.Actions.CMSScriptActions", null, false);
  117. //MWF.require("o2.xScript.Macro", null, false);
  118. //var scriptAction = new MWF.xScript.Actions.CMSScriptActions();
  119. //scriptAction.getScriptByName( this.columnData.id, "_config", [], function(json){
  120. // if (json.data){
  121. // try{
  122. // this.columnData = Object.merge(this.columnData,JSON.parse(json.data.text));
  123. // }catch(e){
  124. // }
  125. // }
  126. //}.bind(this), null, false);
  127. if(callback)callback()
  128. }.bind(this))
  129. },
  130. loadController: function(callback){
  131. //this.restActions.listColumnController(this.columnData.id, function( json ){
  132. // json.data = json.data || [];
  133. // json.data.each(function(item){
  134. // this.controllers.push(item.adminUid)
  135. // }.bind(this));
  136. // this.isAdmin = MWF.AC.isCMSManager() || this.controllers.contains(layout.desktop.session.user.distinguishedName);
  137. // if(callback)callback(json);
  138. //}.bind(this));
  139. this.restActions.isAppInfoManager( this.columnData.id, function( json ){
  140. this.isAdmin = MWF.AC.isCMSManager() || json.data.value;
  141. if(callback)callback(json);
  142. }.bind(this))
  143. },
  144. loadTitle : function(callback){
  145. if( this.isAdmin ){
  146. //this.loadImportActionNode();
  147. //this.loadExportActionNode();
  148. }
  149. this.loadCreateDocumentActionNode(
  150. function(){
  151. this.loadTitleIconNode();
  152. this.loadTitleContentNode();
  153. this.loadBatchAction();
  154. this.loadPastEvent();
  155. this.loadSearchNode();
  156. if(callback)callback();
  157. }.bind(this)
  158. );
  159. },
  160. loadBatchAction: function(){
  161. if( !this.isAdmin )return;
  162. this.batchAction = new Element("div", {
  163. "styles": this.css.batchAction
  164. }).inject(this.titleActionBar);
  165. this.batchIcon = new Element("i.o2icon-folder-select", {
  166. "styles": this.css.actionIcon
  167. }).inject(this.batchAction, "top");
  168. this.batchText = new Element("div", {
  169. "styles": this.css.batchText,
  170. "text" : this.lp.select
  171. }).inject(this.batchAction);
  172. this.batchAction.addEvents({
  173. "click": function(e){
  174. if( this.view ){
  175. if( this.view.selectEnable ){
  176. this.selectEnable = false;
  177. this.batchAction.setStyles( this.css.batchAction );
  178. this.batchAction.removeClass("mainColor_color");
  179. this.batchText.set("text",this.lp.select);
  180. this.batchIcon.setStyles( this.css.actionIcon );
  181. this.batchIcon.removeClass("mainColor_color");
  182. this.view.disableSelectMode();
  183. this.cancelBatchRemoveAction();
  184. this.cancelChangeCategoryAction();
  185. this.cancelCopyActionNode();
  186. }else{
  187. this.selectEnable = true;
  188. this.batchAction.setStyles( this.css.batchAction_over );
  189. this.batchAction.addClass("mainColor_color");
  190. this.batchText.set("text", this.lp.cancelSelect);
  191. this.batchIcon.setStyles( this.css.actionIcon_over );
  192. this.batchIcon.addClass("mainColor_color");
  193. this.view.selectMode();
  194. this.loadCopyActionNode();
  195. this.loadChangeCategoryAction();
  196. this.loadBatchRemoveAction();
  197. }
  198. }
  199. }.bind(this),
  200. "mouseover" : function(e){
  201. if( this.view.selectEnable )return;
  202. this.batchAction.setStyles( this.css.batchAction_over );
  203. this.batchAction.addClass("mainColor_color");
  204. this.batchIcon.setStyles( this.css.actionIcon_over );
  205. this.batchIcon.addClass("mainColor_color");
  206. }.bind(this),
  207. "mouseout" : function(e){
  208. if( this.view.selectEnable )return;
  209. this.batchAction.setStyles( this.css.batchAction );
  210. this.batchAction.removeClass("mainColor_color");
  211. this.batchIcon.setStyles( this.css.actionIcon );
  212. this.batchIcon.removeClass("mainColor_color");
  213. }.bind(this)
  214. });
  215. },
  216. getSearchBarSize : function(){
  217. var x_action = this.titleActionBar.getSize().x;
  218. var x_titlebar = this.titleBar.getSize().x;
  219. return x_titlebar - x_action;
  220. },
  221. loadPastEvent : function(){
  222. if( !this.isAdmin )return;
  223. this.keyPasteItemsFun = this.keyPasteItems.bind(this);
  224. if (window.clipboardData){
  225. this.addEvent("paste", this.keyPasteItemsFun);
  226. }else{
  227. document.addEventListener('paste', this.keyPasteItemsFun);
  228. //this.addEvent("queryClose", function(){
  229. // if (this.keyPasteItemsFun) document.removeEventListener('paste', this.keyPasteItemsFun);
  230. //}.bind(this));
  231. }
  232. },
  233. loadCreateDocumentActionNode: function( callback ){
  234. this.restActions.listCategoryByPublisher( this.columnData.id, function( json ){
  235. if( json.data && json.data.length ){
  236. this.createDocumentAction = new Element("div", {
  237. "styles": this.css.createDocumentAction,
  238. "text" : this.lp.start
  239. }).inject(this.titleActionBar);
  240. this.createDocumentIcon = new Element("i.o2icon-newfiles", {
  241. "styles": this.css.actionIcon
  242. }).inject(this.createDocumentAction, "top");
  243. this.createDocumentAction.addEvents({
  244. "click": function(e){
  245. MWF.xDesktop.requireApp("cms.Index", "Newer", null, false);
  246. //if(this.columnData.latest===undefined) this.columnData.latest = true;
  247. //if(this.columnData.ignoreTitle===undefined) this.columnData.ignoreTitle = false;
  248. this.creater = new MWF.xApplication.cms.Index.Newer( this.columnData, null, this, this.view, {
  249. restrictToColumn : true
  250. // onAfterPublish : function () {
  251. // try{
  252. // if(this.view && this.view.reload){
  253. // this.view.reload();
  254. // }
  255. // }catch (e) {
  256. // }
  257. // }.bind(this)
  258. //ignoreTitle : this.columnData.ignoreTitle,
  259. //latest : this.columnData.latest
  260. });
  261. this.creater.load();
  262. }.bind(this),
  263. "mouseover" : function(e){
  264. this.createDocumentAction.setStyles( this.css.createDocumentAction_over );
  265. this.createDocumentAction.addClass("mainColor_color");
  266. this.createDocumentIcon.setStyles( this.css.actionIcon_over );
  267. this.createDocumentIcon.addClass("mainColor_color");
  268. }.bind(this),
  269. "mouseout" : function(e){
  270. this.createDocumentAction.setStyles( this.css.createDocumentAction );
  271. this.createDocumentAction.removeClass("mainColor_color");
  272. this.createDocumentIcon.setStyles( this.css.actionIcon );
  273. this.createDocumentIcon.removeClass("mainColor_color");
  274. }.bind(this)
  275. });
  276. }
  277. if(callback)callback();
  278. }.bind(this));
  279. },
  280. cancelChangeCategoryAction : function(){
  281. if(this.moveAction)this.moveAction.destroy();
  282. this.moveAction = null;
  283. },
  284. loadChangeCategoryAction : function(){
  285. if( !this.isAdmin )return;
  286. this.moveAction = new Element("div", {
  287. "styles": this.css.moveDocumentAction,
  288. "text" : this.lp.move //"移动"
  289. }).inject(this.titleActionBar);
  290. this.moveIcon = new Element("i.o2icon-folder-move", {
  291. "styles": this.css.actionIcon
  292. }).inject(this.moveAction, "top");
  293. this.moveAction.addEvents({
  294. "click": function(e){
  295. var _self = this;
  296. if( this.view ){
  297. var itemIds = this.view.getSelectedIds();
  298. if (!itemIds.length) {
  299. this.notice( _self.lp.selectDocNotice, "error"); //"请先选择文档"
  300. return;
  301. }
  302. this.loadSelectColumnDialog( function( data ){
  303. if( data && data.id ){
  304. var text = _self.lp.moveDocConfirmContent.replace("{count}", itemIds.length ).replace("{category}", data.categoryName);
  305. //"移动后将在本分类删除,确定要移动选中的"+itemIds.length+"个文档到"+data.categoryName+"?";
  306. this.confirm("warn", e, _self.lp.moveDocConfirmTitle, text, 350, 120, function(){
  307. _self.restActions.moveDocumentToCategory({
  308. ids : itemIds,
  309. categoryId : data.id
  310. }, function(){
  311. _self.notice( _self.lp.moveDocSuccessNotice, "success"); //"移动成功"
  312. _self.view.reload();
  313. this.close();
  314. }.bind(this))
  315. }, function(){
  316. this.close();
  317. });
  318. }
  319. }.bind(this))
  320. }
  321. }.bind(this),
  322. "mouseover" : function(e){
  323. this.moveAction.setStyles( this.css.moveDocumentAction_over );
  324. this.moveAction.addClass("mainColor_color");
  325. this.moveIcon.setStyles( this.css.actionIcon_over );
  326. this.moveIcon.addClass("mainColor_color");
  327. }.bind(this),
  328. "mouseout" : function(e){
  329. this.moveAction.setStyles( this.css.moveDocumentAction );
  330. this.moveAction.removeClass("mainColor_color");
  331. this.moveIcon.setStyles( this.css.actionIcon );
  332. this.moveIcon.removeClass("mainColor_color");
  333. }.bind(this)
  334. });
  335. },
  336. cancelBatchRemoveAction : function(){
  337. if(this.batchRemoveAction)this.batchRemoveAction.destroy();
  338. this.batchRemoveAction = null;
  339. },
  340. loadBatchRemoveAction : function(){
  341. if( !this.isAdmin )return;
  342. var _self = this;
  343. this.batchRemoveAction = new Element("div", {
  344. "styles": this.css.batchRemoveDocumentAction,
  345. "text" : this.lp.batchRemove
  346. }).inject(this.titleActionBar);
  347. this.batchRemoveIcon = new Element("i.o2icon-delete", {
  348. "styles": this.css.actionIcon
  349. }).inject(this.batchRemoveAction, "top");
  350. this.batchRemoveAction.addEvents({
  351. "click": function(e){
  352. var _self = this;
  353. if( this.view ){
  354. var itemIds = this.view.getSelectedIds();
  355. if (itemIds.length) {
  356. _self.readyRemove = true;
  357. var text = _self.lp.clearDocConfirmContent.replace("{count}", itemIds.length);
  358. // var text = "删除后无法恢复,确定要删除选中的"+itemIds.length+"个文档?";
  359. this.confirm("warn", e, _self.lp.clearDocConfirmTitle, text, 350, 120, function(){
  360. _self.removeDocumentList(itemIds);
  361. this.close();
  362. }, function(){
  363. _self.readyRemove = false;
  364. this.close();
  365. });
  366. }else{
  367. this.notice( _self.lp.selectDocNotice,"error")
  368. }
  369. }
  370. }.bind(this),
  371. "mouseover" : function(e){
  372. this.batchRemoveAction.setStyles( this.css.batchRemoveDocumentAction_over )
  373. this.batchRemoveAction.addClass("mainColor_color");
  374. this.batchRemoveIcon.setStyles( this.css.actionIcon_over );
  375. this.batchRemoveIcon.addClass("mainColor_color");
  376. }.bind(this),
  377. "mouseout" : function(e){
  378. this.batchRemoveAction.setStyles( this.css.batchRemoveDocumentAction );
  379. this.batchRemoveAction.removeClass("mainColor_color");
  380. this.batchRemoveIcon.setStyles( this.css.actionIcon );
  381. this.batchRemoveIcon.removeClass("mainColor_color");
  382. }.bind(this)
  383. });
  384. },
  385. //loadBatchRemoveAction : function(){
  386. // if( !this.isAdmin )return;
  387. //
  388. // this.batchRemoveAction = new Element("div", {
  389. // "styles": this.css.batchRemoveDocumentAction,
  390. // "text" : this.lp.batchRemove
  391. // }).inject(this.titleBar);
  392. // this.batchRemoveAction.addEvents({
  393. // "click": function(e){
  394. // if( this.view ){
  395. // if( this.view.selectEnable ){
  396. // this.view.disableSelectMode();
  397. // this.batchRemoveConfirmAction.setStyle("display","none");
  398. // //this.batchRemoveAction.set("text",this.lp.batchRemove);
  399. // }else{
  400. // this.view.selectMode();
  401. // this.batchRemoveConfirmAction.setStyle("display","");
  402. // //this.batchRemoveAction.set("text",this.lp.cancel);
  403. // }
  404. // }
  405. // }.bind(this),
  406. // "mouseover" : function(e){
  407. // this.batchRemoveAction.setStyles( this.css.batchRemoveDocumentAction_over )
  408. // }.bind(this),
  409. // "mouseout" : function(e){
  410. // this.batchRemoveAction.setStyles( this.css.batchRemoveDocumentAction )
  411. // }.bind(this)
  412. // });
  413. //
  414. //
  415. // this.batchRemoveConfirmAction = new Element("div", {
  416. // "styles": this.css.batchRemoveConfirmDocumentAction,
  417. // "text" : this.lp.batchRemoveConfirm
  418. // }).inject(this.titleBar);
  419. // var _self = this;
  420. // this.batchRemoveConfirmAction.addEvents({
  421. // "click": function (e) {
  422. // var itemIds = this.view.getSelectedIds();
  423. // if (itemIds.length) {
  424. // _self.readyRemove = true;
  425. // var text = "删除后无法恢复,确定要删除选中的"+itemIds.length+"个文档?";
  426. // this.confirm("warn", e, "清除确认", text, 350, 120, function(){
  427. //
  428. // _self.removeDocumentList(itemIds);
  429. //
  430. // this.close();
  431. //
  432. // }, function(){
  433. // _self.readyRemove = false;
  434. // this.close();
  435. // });
  436. // }else{
  437. // this.notice("请先选择文档","error")
  438. // }
  439. // }.bind(this)
  440. // });
  441. // this.batchRemoveConfirmAction.setStyle("display","none");
  442. //},
  443. removeDocumentList : function( itemIds ){
  444. var count = 0;
  445. itemIds.each( function(id){
  446. this.restActions.removeDocument(id, function(json){
  447. count++;
  448. if( count === itemIds.length ){
  449. this.notice( this.lp.clearDocSuccessNotice, "success");
  450. //this.view.disableSelectMode();
  451. this.view.reload();
  452. }
  453. }.bind(this));
  454. }.bind(this))
  455. },
  456. cancelCopyActionNode : function(){
  457. if (window.clipboardData){
  458. if (this.keyCopyItemsFun)this.removeEvent("copy", this.keyCopyItemsFun);
  459. }else{
  460. if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
  461. }
  462. this.keyCopyItemsFun = null;
  463. if(this.copyAction)this.copyAction.destroy();
  464. this.copyAction = null;
  465. },
  466. loadCopyActionNode : function(){
  467. if( !this.isAdmin )return;
  468. this.copyAction = new Element("div", {
  469. "styles": this.css.copyDocumentAction,
  470. "text" : this.lp.enableCopy
  471. }).inject(this.titleActionBar);
  472. this.copyIcon = new Element("i.o2icon-document-copy", {
  473. "styles": this.css.actionIcon
  474. }).inject(this.copyAction, "top");
  475. this.copyAction.addEvents({
  476. "click": function(e){
  477. debugger;
  478. if( this.view ){
  479. if( this.keyCopyItemsFun )return;
  480. this.keyCopyItemsFun = this.keyCopyItems.bind(this);
  481. if (window.clipboardData){
  482. this.addEvent("copy", this.keyCopyItemsFun);
  483. }else{
  484. document.addEventListener('copy', this.keyCopyItemsFun);
  485. //this.addEvent("queryClose", function(){
  486. // if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
  487. //}.bind(this));
  488. }
  489. this.notice( this.lp.copyInfor );
  490. }
  491. }.bind(this),
  492. "mouseover" : function(e){
  493. this.copyAction.setStyles( this.css.copyDocumentAction_over );
  494. this.copyAction.addClass("mainColor_color");
  495. this.copyIcon.setStyles( this.css.actionIcon_over );
  496. this.copyIcon.addClass("mainColor_color");
  497. }.bind(this),
  498. "mouseout" : function(e){
  499. this.copyAction.setStyles( this.css.copyDocumentAction );
  500. this.copyAction.removeClass("mainColor_color");
  501. this.copyIcon.setStyles( this.css.actionIcon );
  502. this.copyIcon.removeClass("mainColor_color");
  503. }.bind(this)
  504. });
  505. },
  506. //loadCopyActionNode : function(){
  507. // if( !this.isAdmin )return;
  508. // this.copyAction = new Element("div", {
  509. // "styles": this.css.copyDocumentAction,
  510. // "text" : this.lp.copy
  511. // }).inject(this.titleBar);
  512. // this.copyAction.addEvents({
  513. // "click": function(e){
  514. // if( this.view ){
  515. // if( this.view.selectEnable ){
  516. // this.view.disableSelectMode();
  517. // if (window.clipboardData){
  518. // if (this.keyCopyItemsFun)this.removeEvent("copy", this.keyCopyItemsFun);
  519. // }else{
  520. // if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
  521. // }
  522. // this.keyCopyItemsFun = null;
  523. // }else{
  524. // this.view.selectMode();
  525. // this.keyCopyItemsFun = this.keyCopyItems.bind(this);
  526. // if (window.clipboardData){
  527. // this.addEvent("copy", this.keyCopyItemsFun);
  528. // }else{
  529. // document.addEventListener('copy', this.keyCopyItemsFun);
  530. // //this.addEvent("queryClose", function(){
  531. // // if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
  532. // //}.bind(this));
  533. // }
  534. // this.notice( this.lp.copyInfor );
  535. // }
  536. // }
  537. // }.bind(this),
  538. // "mouseover" : function(e){
  539. // this.copyAction.setStyles( this.css.copyDocumentAction_over )
  540. // }.bind(this),
  541. // "mouseout" : function(e){
  542. // this.copyAction.setStyles( this.css.copyDocumentAction )
  543. // }.bind(this)
  544. // });
  545. //},
  546. keyCopyItems: function(e){
  547. var app = layout.desktop.currentApp || layout.desktop.app;
  548. if (app && app.appId===this.appId) {
  549. var itemIds = this.view.getSelectedIds();
  550. if (itemIds.length) {
  551. var items = [];
  552. var i = 0;
  553. var checkItems = function (e) {
  554. if (i >= itemIds.length) {
  555. if (items.length) {
  556. var str = JSON.encode(items);
  557. if (e && e.clipboardData) {
  558. e.clipboardData.setData('text/plain', str);
  559. e.preventDefault();
  560. } else {
  561. window.clipboardData.setData("Text", str);
  562. }
  563. this.notice(this.lp.copyed, "success");
  564. }
  565. }
  566. }.bind(this);
  567. itemIds.each(function (id) {
  568. this.restActions.getDocument(id, function (json) {
  569. json.data.elementType = "cmsDocument";
  570. items.push(json.data);
  571. i++;
  572. checkItems(e);
  573. }.bind(this), null, false)
  574. }.bind(this));
  575. }
  576. }
  577. },
  578. keyPasteItems: function(e){
  579. var app = layout.desktop.currentApp || layout.desktop.app;
  580. if (app && app.appId===this.appId) {
  581. var dataStr = "";
  582. if (e && e.clipboardData) {
  583. dataStr = e.clipboardData.getData('text/plain');
  584. } else {
  585. dataStr = window.clipboardData.getData("Text");
  586. }
  587. if( !dataStr.contains("elementType") )return;
  588. if( !dataStr.contains("cmsDocument") )return;
  589. if( dataStr.contains("eval(\"") || dataStr.contains("eval('") )return;
  590. var data = JSON.decode(dataStr);
  591. this.listPublishableCategoryInfo(function(){
  592. this.pasteItem(data, 0);
  593. }.bind(this))
  594. }
  595. },
  596. listPublishableCategoryInfo : function( callback ){
  597. this.publishableCategoryInfoObject_id = {};
  598. this.publishableCategoryInfoObject_alias = {};
  599. this.publishableCategoryInfoObject_name = {};
  600. this.categoryTransformMap = {};
  601. this.categoryRadioHtml = "";
  602. o2.Actions.load("x_cms_assemble_control").CategoryInfoAction.listPublishableCategoryInfo( this.columnData.id, function(json){
  603. ( json.data || [] ).each( function(c){
  604. this.publishableCategoryInfoObject_id[c.id] = c;
  605. this.publishableCategoryInfoObject_alias[c.categoryAlias] = c;
  606. this.publishableCategoryInfoObject_name[c.categoryName] = c;
  607. this.categoryRadioHtml += "<div><input type='radio' name='categoryRadio' value='"+ c.id+"'/>" + c.categoryName + "(" + c.categoryAlias +")</div>"
  608. }.bind(this));
  609. this.categoryRadioHtml = "<div style='overflow: hidden; margin: 10px 0px; padding: 5px 10px; background-color: #ffffff; border-radius: 6px;'>" +
  610. this.categoryRadioHtml + "</div>";
  611. if(callback)callback();
  612. }.bind(this));
  613. },
  614. pasteItem: function(data, i){
  615. if (i<data.length){
  616. var item = data[i];
  617. if (item.elementType==="cmsDocument"){
  618. this.saveItemAs(item, function(){
  619. i++;
  620. this.pasteItem(data, i);
  621. }.bind(this), function(){
  622. i++;
  623. this.pasteItem(data, i);
  624. }.bind(this), function(){
  625. this.view.reload();
  626. }.bind(this));
  627. }else{
  628. i++;
  629. this.pasteItem(data, i);
  630. }
  631. }else{
  632. this.view.reload();
  633. }
  634. },
  635. saveItemAs: function(data, success, failure, cancel){
  636. var lp = this.lp;
  637. var _self = this;
  638. if( this.publishableCategoryInfoObject_id[ data.document.categoryId ] ){
  639. this._saveItemAs(data, success, failure, cancel );
  640. }else if( this.categoryTransformMap[ data.document.categoryId ] ){
  641. this._saveItemAs(data, success, failure, cancel, this.categoryTransformMap[ data.document.categoryId ] );
  642. }else{
  643. var text;
  644. if( this.publishableCategoryInfoObject_alias[ data.document.categoryAlias ] ){
  645. text = lp.copyConfirmCategoryInfor_hasSameAlias + "。<br/>" + lp.copyConfirmCateogyrInfor_withChoice
  646. }else if( this.publishableCategoryInfoObject_name[ data.document.categoryName ] ){
  647. text = lp.copyConfirmCategoryInfor_hasSameName + "。<br/>" + lp.copyConfirmCateogyrInfor_withChoice
  648. }else{
  649. text = lp.copyConfirmCategoryInfor_noCategory + ":"
  650. }
  651. text = text.replace("{alias}", "(<span style='color:red;'>" + data.document.categoryAlias + "</span>)" );
  652. text = text.replace("{name}", "(<span style='color:red;'>" + data.document.categoryName + "</span>)" );
  653. var html = "<div style='overflow-y:auto;height:300px'>";
  654. html += "<div style='overflow: hidden; margin: 10px 0px; padding: 5px 10px; background-color: #ffffff; border-radius: 6px;'>";
  655. html += " <div style='clear: both;font-weight: bold; font-size:14px;'>"+lp.copyTarget+" "+data.document.title+"</div>";
  656. html += " <div style='font-size:12px; color: #666666; float: left;'>"+data.document.publishTime+"</div>";
  657. html += " <div style='font-size:12px; color: #666666; float: left; margin-left: 20px;'>"+MWF.name.cn(data.document.creatorPersonShort)+"</div>";
  658. html += "</div>";
  659. html += "<div>" + text + "</div>" + this.categoryRadioHtml;
  660. html += "<div><input type='checkbox' value='true' name='useSameChoice'>"+lp.copyConfirm_SameCategory+"</div>";
  661. html += "</div>";
  662. // html += "<>"
  663. this.dlg("inofr", null, lp.copyConfirmCategoryTitle, {"html": html}, 500, 450, [
  664. {
  665. "text": lp.copy,
  666. "action": function(){
  667. var categoryRadio = this.node.getElements("[name='categoryRadio']");
  668. var checkbox = this.node.getElement("[name='useSameChoice']");
  669. var newCategory;
  670. for( var i=0; i<categoryRadio.length; i++ ){
  671. if( categoryRadio[i].checked ){
  672. newCategory = _self.publishableCategoryInfoObject_id[ categoryRadio[i].get("value") ];
  673. }
  674. }
  675. if( !newCategory ){
  676. if( _self.publishableCategoryInfoObject_alias[ data.document.categoryAlias ] ){
  677. newCategory = _self.publishableCategoryInfoObject_alias[ data.document.categoryAlias ];
  678. }else if( _self.publishableCategoryInfoObject_name[ data.document.categoryName ] ){
  679. newCategory = _self.publishableCategoryInfoObject_name[ data.document.categoryName ];
  680. }
  681. }
  682. if( newCategory ){
  683. if( checkbox.checked )_self.categoryTransformMap[ data.document.categoryId ] = newCategory;
  684. this.close();
  685. _self._saveItemAs(data, success, failure, cancel, newCategory );
  686. }else{
  687. _self.notice( lp.notSelectCategory, "error" )
  688. }
  689. //_self.saveItemAsUpdate(someItem, data, success, failure);
  690. }
  691. },
  692. {
  693. "text": lp.copyConfirm_skip,
  694. "action": function(){/*nothing*/ this.close(); if (success) success();}
  695. },
  696. {
  697. "text": lp.copyConfirm_cancel,
  698. "action": function(){this.close(); if (cancel) cancel();}
  699. }
  700. ]);
  701. }
  702. },
  703. _saveItemAs: function(data, success, failure, cancel, newCategory ){
  704. this.restActions.getDocument(data.document.id, function(dJson){
  705. var someItem = dJson.data;
  706. var flag = false;
  707. if (someItem){
  708. if( newCategory ){
  709. if( newCategory.id !== someItem.document.categoryId ){ //如果已有文档的分类和新分类不一样,直接新建
  710. this.saveItemAsNew(data, success, failure, true, newCategory)
  711. }else{ //如果已有文档的分类和新分类一样,需要询问
  712. flag = true;
  713. }
  714. }else{ //如果使用原有分类,需要询问
  715. flag = true;
  716. }
  717. if( flag ){
  718. var lp = this.lp;
  719. var _self = this;
  720. var d1 = new Date().parse(data.document.publishTime);
  721. var d2 = new Date().parse(someItem.document.publishTime);
  722. var html = "<div>"+lp.copyConfirmInfor+"</div>";
  723. html += "<div style='overflow: hidden; margin: 10px 0px; padding: 5px 10px; background-color: #ffffff; border-radius: 6px;'><div style='font-weight: bold; font-size:14px;'>"+lp.copySource+" "+someItem.document.title+"</div>";
  724. html += "<div style='font-size:12px; color: #666666; float: left'>"+someItem.document.publishTime+"</div>" +
  725. "<div style='font-size:12px; color: #666666; float: left; margin-left: 20px;'>"+MWF.name.cn(someItem.document.creatorPersonShort)+"</div>" +
  726. "<div style='color: red; float: right;'>"+((d1>=d2) ? "": lp.copynew)+"</div></div>";
  727. html += "<div style='overflow: hidden; margin: 10px 0px; padding: 5px 10px; background-color: #ffffff; border-radius: 6px;'><div style='clear: both;font-weight: bold; font-size:14px;'>"+lp.copyTarget+" "+data.document.title+"</div>";
  728. html += "<div style='font-size:12px; color: #666666; float: left;'>"+data.document.publishTime+"</div>" +
  729. "<div style='font-size:12px; color: #666666; float: left; margin-left: 20px;'>"+MWF.name.cn(data.document.creatorPersonShort)+"</div>" +
  730. "<div style='color: red; float: right;'>"+((d1<=d2) ? "": lp.copynew)+"</div></div>";
  731. // html += "<>"
  732. this.dlg("inofr", null, lp.copyConfirmTitle, {"html": html}, 500, 290, [
  733. {
  734. "text": lp.copyConfirm_overwrite,
  735. "action": function(){_self.saveItemAsUpdate(someItem, data, success, failure);this.close();}
  736. },
  737. {
  738. "text": lp.copyConfirm_new,
  739. "action": function(){_self.saveItemAsNew( data, success, failure, true, newCategory );this.close();}
  740. },
  741. {
  742. "text": lp.copyConfirm_skip,
  743. "action": function(){/*nothing*/ this.close(); if (success) success();}
  744. },
  745. {
  746. "text": lp.copyConfirm_cancel,
  747. "action": function(){this.close(); if (cancel) cancel();}
  748. }
  749. ]);
  750. }
  751. }
  752. }.bind(this), function(){
  753. //if (failure) failure();
  754. this.saveItemAsNew(data, success, failure, false, newCategory);
  755. return true;
  756. }.bind(this));
  757. },
  758. saveItemAsUpdate: function(someItem, data, success, failure){
  759. var doc = data.document;
  760. doc.id = someItem.document.id;
  761. doc.isNewDocument = false;
  762. doc.appId = someItem.document.appId;
  763. doc.appName = someItem.document.appName;
  764. doc.categoryId = someItem.document.categoryId;
  765. doc.categoryName = someItem.document.categoryName;
  766. doc.categoryAlias = someItem.document.categoryAlias;
  767. doc.form = someItem.document.form;
  768. doc.formName = someItem.document.formName;
  769. doc.readFormId = someItem.document.readFormId;
  770. doc.readFormName = someItem.document.readFormName;
  771. doc.docData = data.data;
  772. this.restActions.saveDocument(doc, function(){
  773. if (success) success();
  774. }.bind(this), function(){
  775. if (failure) failure();
  776. }.bind(this));
  777. },
  778. saveItemAsNew: function(data, success, failure, clearId, newCategory){
  779. var columnData = this.columnData;
  780. var doc = data.document;
  781. if( clearId ){
  782. delete doc.id;
  783. }
  784. delete doc.documentType;
  785. delete doc.appId;
  786. delete doc.appName;
  787. delete doc.appAlias;
  788. // delete doc.categoryId;
  789. delete doc.categoryName;
  790. delete doc.categoryAlias;
  791. delete doc.form;
  792. delete doc.formName;
  793. delete doc.readFormId;
  794. delete doc.readFormName;
  795. doc.appId = columnData.id;
  796. doc.docData = data.data;
  797. delete doc.docData.$document;
  798. var callback = function(data){
  799. this.restActions.publishDocumentComplex(data, function(){
  800. if (success) success();
  801. }.bind(this), function(){
  802. if (failure) failure();
  803. }.bind(this));
  804. }.bind(this);
  805. debugger;
  806. if( newCategory ){
  807. doc.categoryId = newCategory.id;
  808. callback( doc );
  809. }else{
  810. this.restActions.getCategory( data.document.categoryId, function( json ){
  811. if( json.data.appId === columnData.id ){
  812. doc.categoryId = data.document.categoryId;
  813. callback( doc );
  814. }else{
  815. this.loadSelectCategoryDialog( this.lp.selectCategoryText.replace("{title}", data.document.title ), function(id){
  816. doc.categoryId = id;
  817. callback( doc );
  818. }.bind(this))
  819. }
  820. }.bind(this), function(){
  821. this.loadSelectCategoryDialog( this.lp.selectCategoryText.replace("{title}", data.document.title), function(id){
  822. doc.categoryId = id;
  823. callback( doc );
  824. }.bind(this))
  825. }.bind(this))
  826. }
  827. },
  828. loadSelectColumnDialog : function( callback){
  829. MWF.xDesktop.requireApp("Selector", "package", null, false);
  830. var options = {
  831. "type": "CMSCategory",
  832. "count": 1,
  833. "onComplete": function(items){
  834. items.each(function(item){
  835. if( callback )callback( item.data );
  836. }.bind(this));
  837. }.bind(this)
  838. };
  839. var selector = new MWF.O2Selector(this.content, options);
  840. },
  841. loadSelectCategoryDialog : function(title, callback){
  842. if( !this.categoryList ){
  843. this.categoryList = [];
  844. this.restActions.listCategory( this.columnData.id, function( json ){
  845. json.data.each( function(d){
  846. this.categoryList.push( {
  847. name : d.categoryName,
  848. id : d.id
  849. })
  850. }.bind(this))
  851. }.bind(this), null, false)
  852. }
  853. MWF.xDesktop.requireApp("Template", "Selector.Custom", null, false);
  854. var opt = {
  855. "count": 1,
  856. "title": this.lp.selectCategory,
  857. "selectableItems" : this.categoryList,
  858. "values": [],
  859. "onComplete": function( array ){
  860. if( !array || array.length == 0 )return;
  861. var id = array[0].data.id;
  862. callback( id )
  863. }.bind(this)
  864. };
  865. var selector = new MWF.xApplication.Template.Selector.Custom(this.content, opt );
  866. selector.load();
  867. },
  868. loadImportActionNode : function(){
  869. this.importAction = new Element("div", {
  870. "styles": this.css.importAction,
  871. "text" : this.lp.import
  872. }).inject(this.titleActionBar);
  873. this.importAction.setStyle("display","none");
  874. this.importAction.addEvents({
  875. "click": function(e){
  876. MWF.xDesktop.requireApp("cms.Module", "ExcelForm", null, false);
  877. var categoryData = this.navi.currentObject.isCategory ? this.navi.currentObject.data : this.navi.currentObject.category.data ;
  878. this.import = new MWF.xApplication.cms.Module.ImportForm( { app : this }, categoryData, {} );
  879. this.import.edit();
  880. }.bind(this),
  881. "mouseover" : function(e){
  882. this.importAction.setStyles( this.css.importAction_over )
  883. }.bind(this),
  884. "mouseout" : function(e){
  885. this.importAction.setStyles( this.css.importAction )
  886. }.bind(this)
  887. });
  888. },
  889. loadExportActionNode : function(){
  890. this.exportAction = new Element("div", {
  891. "styles": this.css.exportAction,
  892. "text" : this.lp.export
  893. }).inject(this.titleActionBar);
  894. this.exportAction.setStyle("display","none");
  895. this.exportAction.addEvents({
  896. "click": function(e){
  897. MWF.xDesktop.requireApp("cms.Module", "ExcelForm", null, false);
  898. var categoryData = this.navi.currentObject.isCategory ? this.navi.currentObject.data : this.navi.currentObject.category.data ;
  899. this.export = new MWF.xApplication.cms.Module.ExportForm ( { app : this }, categoryData, {} );
  900. this.export.edit();
  901. }.bind(this),
  902. "mouseover" : function(e){
  903. this.exportAction.setStyles( this.css.exportAction_over )
  904. }.bind(this),
  905. "mouseout" : function(e){
  906. this.exportAction.setStyles( this.css.exportAction )
  907. }.bind(this)
  908. });
  909. },
  910. loadTitleIconNode : function(){
  911. this.defaultColumnIcon = "../x_component_cms_Index/$Main/"+this.options.style+"/icon/column.png";
  912. var iconAreaNode = this.iconAreaNode = new Element("div",{
  913. "styles" : this.css.titleIconAreaNode
  914. }).inject(this.leftTitleNode);
  915. var iconNode = this.iconNode = new Element("img",{
  916. "styles" : this.css.titleIconNode
  917. }).inject(iconAreaNode);
  918. if (this.columnData.appIcon){
  919. this.iconNode.set("src", "data:image/png;base64,"+this.columnData.appIcon+"");
  920. }else{
  921. this.iconNode.set("src", this.defaultColumnIcon)
  922. }
  923. iconNode.makeLnk({
  924. "par": this._getLnkPar()
  925. });
  926. },
  927. _getLnkPar: function(){
  928. var lnkIcon = this.defaultColumnIcon;
  929. if (this.columnData.appIcon) lnkIcon = "data:image/png;base64,"+this.columnData.appIcon;
  930. var appId = "cms.Module"+this.columnData.id;
  931. return {
  932. "icon": lnkIcon,
  933. "title": this.columnData.appName,
  934. "par": "cms.Module#{\"columnId\": \""+this.columnData.id+"\", \"appId\": \""+appId+"\"}"
  935. };
  936. },
  937. loadTitleContentNode: function(){
  938. this.titleContentNode = new Element("div.titleContentNode", {
  939. "styles": this.css.titleContentNode
  940. }).inject(this.leftTitleNode);
  941. this.titleTextNode = new Element("div.titleTextNode", {
  942. "styles": this.css.titleTextNode,
  943. "text": this.columnData.appName,
  944. "title": this.columnData.appName
  945. }).inject(this.titleContentNode);
  946. this.titleDescriptionNode = new Element("div.titleDescriptionNode", {
  947. "styles": this.css.titleDescriptionNode,
  948. "text": this.columnData.description ? this.columnData.description : this.lp.noDescription,
  949. "title": this.columnData.description ? this.columnData.description : this.lp.noDescription
  950. }).inject(this.titleContentNode);
  951. },
  952. loadSearchNode : function(){
  953. this.searchNode = new Element("div").inject( this.titleBar );
  954. },
  955. loadMenu: function(callback){
  956. this.naviNode = new Element("div.naviNode", {
  957. "styles": this.css.naviNode
  958. }).inject(this.naviContainerNode);
  959. //this.setScrollBar(this.naviNode,{"where": "before"});
  960. MWF.require("MWF.widget.ScrollBar", function(){
  961. new MWF.widget.ScrollBar(this.naviContainerNode, {
  962. "style":"xApp_ProcessManager_StartMenu", "distance": 100, "friction": 4, "axis": {"x": false, "y": true}
  963. });
  964. }.bind(this));
  965. this.addEvent("resize", function(){this.setNaviSize();}.bind(this));
  966. //MWF.require("MWF.widget.ScrollBar", function(){
  967. // new MWF.widget.ScrollBar(this.menuNode, {
  968. // "style":"xApp_CMSModule_StartMenu", "distance": 100, "friction": 4, "axis": {"x": false, "y": true}
  969. // });
  970. //}.bind(this));
  971. if( this.options.categoryId == "all" ){
  972. this.options.categoryId = "whole";
  973. }
  974. if( this.status && this.status.categoryId ){
  975. this._loadMenu( this.status );
  976. }else if( this.options.categoryId && this.options.categoryId != "" ){
  977. if( this.options.viewId && this.options.viewId!="" ){
  978. this._loadMenu( { "categoryId" :this.options.categoryId , "viewId" : this.options.viewId } )
  979. }else{
  980. //this.getCategoryDefaultList(this.options.categoryId , function(viewId){
  981. // if( viewId ){
  982. // this._loadMenu( { "categoryId" :this.options.categoryId , "viewId" : viewId, "isCategory" : this.options.isCategory } );
  983. // }else{
  984. // this._loadMenu( { "categoryId" :this.options.categoryId , "isCategory" : this.options.isCategory, "naviIndex" : (this.options.naviIndex || 0) } );
  985. // }
  986. //}.bind(this))
  987. this._loadMenu( { "categoryId" :this.options.categoryId , "isCategory" : true, "naviIndex" : (this.options.naviIndex || 0) } ); //this.options.isCategory
  988. }
  989. }else if( this.options.categoryAlias && this.options.categoryAlias != "" ){
  990. this.restActions.getCategoryByAlias( this.options.categoryAlias, function( json ){
  991. this.options.categoryId = json.data.id;
  992. if( this.options.viewId && this.options.viewId!="" ){
  993. this._loadMenu( { "categoryId" :this.options.categoryId , "viewId" : this.options.viewId } )
  994. }else{
  995. this._loadMenu( { "categoryId" :this.options.categoryId , "isCategory" : true, "naviIndex" : (this.options.naviIndex || 0) } ); //this.options.isCategory
  996. }
  997. }.bind(this))
  998. }else{
  999. this._loadMenu( { "categoryId" :"whole" } )
  1000. }
  1001. },
  1002. _loadMenu : function( options ){
  1003. this.navi = new MWF.xApplication.cms.Module.Navi(this, this.naviNode, this.columnData, options );
  1004. this.setNaviSize();
  1005. },
  1006. clearContent: function(){
  1007. //debugger;
  1008. if (this.moduleContent){
  1009. if (this.view) delete this.view;
  1010. this.moduleContent.destroy();
  1011. this.searchNode.empty();
  1012. this.moduleContent = null;
  1013. }
  1014. },
  1015. openView : function(el, categoryData, revealData, searchKey, navi){
  1016. if( revealData && revealData.type == "queryview" ){
  1017. this.loadQueryView(el, categoryData, revealData, searchKey, navi);
  1018. }else{
  1019. this.loadList(el, categoryData, revealData, searchKey, navi);
  1020. }
  1021. },
  1022. loadQueryView : function(el, categoryData, revealData, searchKey, navi){
  1023. MWF.xDesktop.requireApp("cms.Module", "ViewExplorer", function(){
  1024. this.clearContent();
  1025. this.moduleContent = new Element("div", {
  1026. "styles": this.css.moduleContent
  1027. }).inject(this.rightContentNode);
  1028. this.view = new MWF.xApplication.cms.Module.ViewExplorer(
  1029. this.moduleContent,
  1030. this,
  1031. this.columnData,
  1032. categoryData,
  1033. revealData,
  1034. {"isAdmin": this.isAdmin, "searchKey" : searchKey },
  1035. this.searchNode
  1036. );
  1037. this.view.selectEnable = this.selectEnable;
  1038. this.view.load();
  1039. }.bind(this))
  1040. },
  1041. loadList : function(el, categoryData, revealData, searchKey, navi){
  1042. MWF.xDesktop.requireApp("cms.Module", "ListExplorer", function(){
  1043. this.clearContent();
  1044. this.moduleContent = new Element("div", {
  1045. "styles": this.css.moduleContent
  1046. }).inject(this.rightContentNode);
  1047. if (!this.restActions) this.restActions = MWF.Actions.get("x_cms_assemble_control"); //new MWF.xApplication.cms.Module.Actions.RestActions();
  1048. this.view = new MWF.xApplication.cms.Module.ListExplorer(
  1049. this.moduleContent,
  1050. this.restActions,
  1051. this.columnData,
  1052. categoryData,
  1053. revealData,
  1054. {"isAdmin": this.isAdmin, "searchKey" : searchKey },
  1055. this.searchNode
  1056. );
  1057. this.view.app = this;
  1058. this.view.selectEnable = this.selectEnable;
  1059. this.view.load();
  1060. }.bind(this));
  1061. },
  1062. recordStatus: function(){
  1063. var currentObject = this.navi.currentObject;
  1064. if( currentObject ){
  1065. var categoryId = currentObject.getCategoryId();
  1066. if (categoryId){
  1067. return {
  1068. "columnId" : this.columnData.id,
  1069. "categoryId" :categoryId,
  1070. "isCategory" : currentObject.isCategory,
  1071. "viewId" : currentObject.data.id
  1072. };
  1073. }else{
  1074. return { "columnId" : this.columnData.id , "categoryId" : "whole"}
  1075. }
  1076. }else{
  1077. return { "columnId" : this.columnData.id , "categoryId" : "whole" }
  1078. }
  1079. },
  1080. setNaviSize: function(){
  1081. //var titlebarSize = this.titleBar ? this.titleBar.getSize() : {"x":0,"y":0};
  1082. var nodeSize = this.node.getSize();
  1083. //var pt = this.naviContainerNode.getStyle("padding-top").toFloat();
  1084. //var pb = this.naviContainerNode.getStyle("padding-bottom").toFloat();
  1085. //var height = nodeSize.y-pt-pb-titlebarSize.y;
  1086. this.naviContainerNode.setStyle("height", ""+nodeSize.y+"px");
  1087. }
  1088. });
  1089. MWF.xApplication.cms.Module.Navi = new Class({
  1090. Implements: [Options, Events],
  1091. options : {
  1092. "categoryId" :"" ,
  1093. "viewId" : "",
  1094. "isCategory" : false,
  1095. "navi" : -1
  1096. },
  1097. initialize: function(app, node, columnData, options){
  1098. this.setOptions(options);
  1099. this.app = app;
  1100. this.node = $(node);
  1101. this.columnData = columnData;
  1102. this.categoryList = [];
  1103. this.css = this.app.css;
  1104. this.load();
  1105. },
  1106. load: function(){
  1107. var self = this;
  1108. var showAll = (typeOf(this.columnData.showAllDocuments) === "boolean" ? this.columnData.showAllDocuments : true).toString();
  1109. if( showAll !== "false" ){
  1110. this.allView = new MWF.xApplication.cms.Module.NaviAllView( this, this.node, {} );
  1111. }
  1112. if( this.columnData.config.latest === false ){
  1113. this.draftView = new MWF.xApplication.cms.Module.NaviDraftView( this, this.node, {} );
  1114. }
  1115. var allowWaitPublish = (typeOf(this.columnData.allowWaitPublish) === "boolean" ? this.columnData.allowWaitPublish : false).toString();
  1116. if( allowWaitPublish === "true" ){
  1117. this.delayView = new MWF.xApplication.cms.Module.NaviDelayView( this, this.node, {} );
  1118. }
  1119. new Element("div",{
  1120. "styles" : this.css.viewNaviBottom
  1121. }).inject(this.node);
  1122. this.app.restActions.listCategory( this.columnData.id, function( json ) {
  1123. json.data.each(function (d, idx) {
  1124. var isCurrent = false;
  1125. var category = new MWF.xApplication.cms.Module.NaviCategory(this, this.node,d, {} );
  1126. this.categoryList.push( category );
  1127. if( showAll == "false" && idx === 0 ){
  1128. category.setCurrent();
  1129. }
  1130. this.fireEvent("postLoad");
  1131. }.bind(this))
  1132. }.bind(this))
  1133. }
  1134. });
  1135. MWF.xApplication.cms.Module.NaviCategory = new Class({
  1136. Implements: [Options, Events],
  1137. options: {
  1138. "style": "default"
  1139. },
  1140. initialize: function ( navi, container, data, options) {
  1141. this.setOptions(options);
  1142. this.navi = navi;
  1143. this.app = navi.app;
  1144. this.container = $(container);
  1145. this.data = data;
  1146. this.css = this.app.css;
  1147. this.load();
  1148. },
  1149. load: function () {
  1150. var _self = this;
  1151. this.isCategory = true;
  1152. this.isCurrent = false;
  1153. this.isExpended = false;
  1154. this.hasSub = false;
  1155. this.naviViewList = [];
  1156. if( this.navi.options.categoryId == this.data.id && this.navi.options.isCategory ){
  1157. this.isCurrent = true;
  1158. }
  1159. this.reveal = this.getRevealData();
  1160. this.node = new Element("div.categoryNaviNode", {
  1161. "styles": this.css.categoryNaviNode
  1162. }).inject(this.container);
  1163. this.iconNode = new Element("i.o2icon-files", {
  1164. "styles": this.css.categoryNaviIcon
  1165. }).inject(this.node);
  1166. this.expendNode = new Element("div").inject(this.node);
  1167. this.setExpendNodeStyle();
  1168. if( this.hasSub ){
  1169. this.expendNode.addEvent( "click" , function(ev){
  1170. this.triggerExpend();
  1171. ev.stopPropagation();
  1172. }.bind(this));
  1173. }
  1174. this.textNode = new Element("div.categoryNaviTextNode",{
  1175. "styles": this.css.categoryNaviTextNode,
  1176. "text": this.data.name //this.defaultRevealData.id == "defaultList" ? this.data.name : this.defaultRevealData.showName
  1177. }).inject(this.node);
  1178. this.node.addEvents({
  1179. "mouseover": function(){ if ( !_self.isCurrent ){
  1180. this.setStyles(_self.app.css.categoryNaviNode_over);
  1181. this.addClass("mainColor_bg_opacity");
  1182. } },
  1183. "mouseout": function(){ if ( !_self.isCurrent ){
  1184. this.setStyles( _self.app.css.categoryNaviNode );
  1185. this.removeClass("mainColor_bg_opacity");
  1186. } },
  1187. click : function(){ _self.setCurrent(this);}
  1188. });
  1189. this.listNode = new Element("div.viewNaviListNode",{
  1190. "styles" : this.css.viewNaviListNode
  1191. }).inject(this.container);
  1192. this.loadListContent();
  1193. if( this.isCurrent ){
  1194. this.setCurrent();
  1195. }
  1196. },
  1197. getRevealData: function(){
  1198. debugger;
  1199. var j = this.data.extContent;
  1200. if( j ){
  1201. this.extContent = JSON.parse( j );
  1202. }
  1203. if( !this.extContent || !this.extContent.reveal || this.extContent.reveal.length == 0 ){ //兼容以前的设置
  1204. this.extContent = { reveal : [] };
  1205. this.app.restActions.listViewByCategory( this.data.id, function(json){
  1206. ( json.data || [] ).each( function(d){
  1207. var itemData = {
  1208. "type" : "list",
  1209. "name" : d.name,
  1210. "showName" : d.name,
  1211. "id" : d.id,
  1212. "alias" : d.alias,
  1213. "appId" : d.appId,
  1214. "formId" : d.formId,
  1215. "formName" : d.formName
  1216. };
  1217. this.extContent.reveal.push( itemData );
  1218. }.bind(this));
  1219. }.bind(this), null, false );
  1220. }
  1221. this.extContent.reveal.each( function( r, i ){
  1222. if(this.data.defaultViewName && r.id == this.data.defaultViewName ){
  1223. this.defaultRevealData = r;
  1224. }else if( i>0 ){
  1225. this.isExpended = true;
  1226. this.hasSub = true;
  1227. }
  1228. }.bind(this));
  1229. if( !this.extContent || !this.extContent.reveal || this.extContent.reveal.length == 0 ){
  1230. this.extContent = { reveal : [{
  1231. id : "defaultList",
  1232. showName : this.app.lp.systemList,
  1233. name : this.app.lp.systemList
  1234. }] };
  1235. }
  1236. this.revealData = this.extContent.reveal;
  1237. if( !this.defaultRevealData ){
  1238. this.defaultRevealData = {
  1239. id : "defaultList",
  1240. showName : this.app.lp.systemList,
  1241. name : this.app.lp.systemList
  1242. }
  1243. }
  1244. },
  1245. setExpendNodeStyle : function(){
  1246. var style;
  1247. if( this.hasSub ){
  1248. if( this.isExpended ){
  1249. if( this.isCurrent ){
  1250. style = this.css.categoryExpendNode_selected;
  1251. this.expendNode.addClass("mainColor_color");
  1252. }else{
  1253. style = this.css.categoryExpendNode;
  1254. this.expendNode.removeClass("mainColor_color");
  1255. }
  1256. this.expendNode.removeClass("o2icon-triangle_right").addClass("o2icon-triangle_down");
  1257. }else{
  1258. if( this.isCurrent ){
  1259. style = this.css.categoryCollapseNode_selected;
  1260. this.expendNode.addClass("mainColor_color");
  1261. }else{
  1262. style = this.css.categoryCollapseNode;
  1263. this.expendNode.removeClass("mainColor_color");
  1264. }
  1265. this.expendNode.removeClass("o2icon-triangle_down").addClass("o2icon-triangle_right");
  1266. }
  1267. }else{
  1268. style = this.css.emptyExpendNode;
  1269. }
  1270. this.expendNode.setStyles( style );
  1271. },
  1272. triggerExpend : function(){
  1273. if( this.hasSub ){
  1274. if( this.isExpended ){
  1275. this.isExpended = false;
  1276. this.listNode.setStyle("display","none")
  1277. }else{
  1278. this.isExpended = true;
  1279. this.listNode.setStyle("display","")
  1280. }
  1281. this.setExpendNodeStyle();
  1282. }
  1283. },
  1284. setCurrent : function(){
  1285. if( this.navi.currentObject ){
  1286. this.navi.currentObject.cancelCurrent();
  1287. }
  1288. this.node.setStyles( this.css.categoryNaviNode_selected );
  1289. this.node.addClass( "mainColor_color" );
  1290. this.node.addClass( "mainColor_bg_opacity" );
  1291. this.iconNode.setStyles( this.css.categoryNaviIcon_selected );
  1292. this.iconNode.addClass( "mainColor_color" );
  1293. if( this.hasSub ){
  1294. if( this.isExpended ){
  1295. this.expendNode.setStyles( this.css.categoryExpendNode_selected );
  1296. }else{
  1297. this.expendNode.setStyles( this.css.categoryCollapseNode_selected );
  1298. }
  1299. this.expendNode.addClass("mainColor_color");
  1300. }
  1301. this.isCurrent = true;
  1302. this.navi.currentObject = this;
  1303. var action = this.app.importAction;
  1304. if( action ){
  1305. action.setStyle("display", (this.data.importViewId && this.app.isAdmin) ? "" : "none");
  1306. }
  1307. action = this.app.exportAction;
  1308. if( action ){
  1309. action.setStyle("display", (this.data.importViewId && this.app.isAdmin) ? "" : "none");
  1310. }
  1311. this.loadView();
  1312. },
  1313. cancelCurrent : function(){
  1314. this.isCurrent = false;
  1315. this.node.setStyles( this.css.categoryNaviNode );
  1316. this.node.removeClass( "mainColor_color" );
  1317. this.node.removeClass( "mainColor_bg_opacity" );
  1318. this.iconNode.setStyles( this.css.categoryNaviIcon );
  1319. this.iconNode.removeClass( "mainColor_color" );
  1320. if( this.hasSub ){
  1321. if( this.isExpended ){
  1322. this.expendNode.setStyles( this.css.categoryExpendNode );
  1323. }else{
  1324. this.expendNode.setStyles( this.css.categoryCollapseNode );
  1325. }
  1326. this.expendNode.removeClass("mainColor_color");
  1327. }
  1328. },
  1329. loadView: function( searchkey ){
  1330. this.app.openView( this, this.data, this.viewData || this.defaultRevealData, searchkey || "", this );
  1331. },
  1332. loadListContent : function(){
  1333. this.revealData.each( function( d , i){
  1334. if( d.id != this.defaultRevealData.id ){
  1335. var naviView = new MWF.xApplication.cms.Module.NaviView(this.navi, this, this.listNode, d, {
  1336. "style": this.options.style,
  1337. "index" : i
  1338. });
  1339. this.naviViewList.push( naviView );
  1340. }
  1341. }.bind(this));
  1342. new Element("div", {
  1343. "styles": this.css.viewNaviSepartorNode
  1344. }).inject( this.listNode );
  1345. },
  1346. getCategoryId : function(){
  1347. return this.data.id;
  1348. }
  1349. });
  1350. MWF.xApplication.cms.Module.NaviView = new Class({
  1351. Implements: [Options, Events],
  1352. options: {
  1353. "style": "default",
  1354. "index" : 0
  1355. },
  1356. initialize: function ( navi, category, container, data, options) {
  1357. this.setOptions(options);
  1358. this.navi = navi;
  1359. this.category = category;
  1360. this.app = navi.app;
  1361. this.data = data;
  1362. this.container = $(container);
  1363. this.css = this.app.css;
  1364. this.load();
  1365. },
  1366. load: function(){
  1367. this.isDefault = this.data.id == "defaultList";
  1368. this.isCurrent = false;
  1369. this.isCategory = false;
  1370. if( this.navi.options.categoryId == this.category.data.id && !this.navi.options.isCategory ){
  1371. if( this.navi.options.viewId == "defaultList" && this.isDefault ){
  1372. this.isCurrent = true;
  1373. }else if( this.navi.options.viewId == this.data.id ){
  1374. this.isCurrent = true;
  1375. }else if( this.navi.options.naviIndex == this.options.index ){
  1376. this.isCurrent = true;
  1377. }
  1378. }
  1379. var _self = this;
  1380. this.node = new Element("div.viewNaviNode", {
  1381. "styles": this.css.viewNaviNode,
  1382. "text" : (this.isDefault && !this.data.showName) ? this.app.lp.defaultView : this.data.showName
  1383. }).inject(this.container);
  1384. this.node.addEvents({
  1385. "mouseover": function(){ if (!_self.isCurrent){
  1386. this.setStyles(_self.css.viewNaviNode_over);
  1387. this.addClass("mainColor_bg_opacity");
  1388. } },
  1389. "mouseout": function(){ if (!_self.isCurrent){
  1390. this.setStyles( _self.css.viewNaviNode )
  1391. this.removeClass("mainColor_bg_opacity");
  1392. } },
  1393. "click": function (el) {
  1394. _self.setCurrent();
  1395. }
  1396. });
  1397. if( this.isCurrent ){
  1398. this.setCurrent()
  1399. }
  1400. },
  1401. setCurrent : function(){
  1402. if( this.navi.currentObject ){
  1403. this.navi.currentObject.cancelCurrent();
  1404. }
  1405. this.node.setStyles( this.css.viewNaviNode_selected );
  1406. this.node.addClass( "mainColor_color" );
  1407. this.node.addClass( "mainColor_bg_opacity" );
  1408. this.isCurrent = true;
  1409. this.navi.currentObject = this;
  1410. var action = this.app.importAction;
  1411. if( action ){
  1412. action.setStyle("display", (this.category.data.importViewId && this.app.isAdmin) ? "" : "none");
  1413. }
  1414. action = this.app.exportAction;
  1415. if( action ){
  1416. action.setStyle("display", (this.category.data.importViewId && this.app.isAdmin) ? "" : "none");
  1417. }
  1418. this.loadView();
  1419. },
  1420. cancelCurrent : function(){
  1421. this.isCurrent = false;
  1422. this.node.setStyles( this.css.viewNaviNode );
  1423. this.node.removeClass( "mainColor_color" );
  1424. this.node.removeClass( "mainColor_bg_opacity" );
  1425. },
  1426. getCategoryId : function(){
  1427. return this.category.data.id;
  1428. },
  1429. loadView : function( searchKey ){
  1430. this.app.openView( this, this.category.data, this.data, searchKey || "", this );
  1431. }
  1432. });
  1433. MWF.xApplication.cms.Module.NaviAllView = new Class({
  1434. Implements: [Options, Events],
  1435. options: {
  1436. "style": "default"
  1437. },
  1438. initialize: function ( navi, container, options) {
  1439. this.setOptions(options);
  1440. this.navi = navi;
  1441. this.app = navi.app;
  1442. this.container = $(container);
  1443. this.css = this.app.css;
  1444. this.data = {
  1445. "isAll" : true,
  1446. "id" : "defaultList"
  1447. };
  1448. this.load();
  1449. },
  1450. load: function(){
  1451. var _self = this;
  1452. this.isDefault = true;
  1453. this.isAll = true;
  1454. this.isCurrent = false;
  1455. this.isCategory = false;
  1456. if( this.navi.options.categoryId == "whole" ){
  1457. this.isCurrent = true;
  1458. }
  1459. this.listNode = new Element("div.viewNaviListNode_all",{
  1460. "styles" : this.css.viewNaviListNode_all
  1461. }).inject(this.container);
  1462. this.node = new Element("div.viewNaviNode_all", {
  1463. "styles": this.css.viewNaviNode_all,
  1464. "text" : this.app.lp.allDocument
  1465. }).inject(this.listNode);
  1466. this.iconNode = new Element("i.o2icon-list4", {
  1467. "styles": this.css.viewNaviIcon_all
  1468. }).inject(this.node, "top");
  1469. this.node.addEvents({
  1470. "mouseover": function(){ if ( !_self.isCurrent ){
  1471. this.setStyles(_self.css.viewNaviNode_all_over);
  1472. this.addClass( "mainColor_bg_opacity" );
  1473. }},
  1474. "mouseout": function(){ if ( !_self.isCurrent ){
  1475. this.setStyles( _self.css.viewNaviNode_all );
  1476. this.removeClass( "mainColor_bg_opacity" );
  1477. }},
  1478. "click": function (el) {
  1479. _self.setCurrent();
  1480. }
  1481. });
  1482. new Element("div", {
  1483. "styles": this.css.viewNaviSepartorNode
  1484. }).inject(this.listNode);
  1485. if( this.isCurrent ){
  1486. this.setCurrent()
  1487. }
  1488. },
  1489. setCurrent : function(){
  1490. if( this.navi.currentObject ){
  1491. this.navi.currentObject.cancelCurrent();
  1492. }
  1493. this.node.setStyles( this.css.viewNaviNode_all_selected );
  1494. this.node.addClass( "mainColor_color" );
  1495. this.node.addClass( "mainColor_bg_opacity" );
  1496. this.iconNode.setStyles( this.css.viewNaviIcon_all_selected );
  1497. this.iconNode.addClass( "mainColor_color" );
  1498. this.isCurrent = true;
  1499. this.navi.currentObject = this;
  1500. var action = this.app.importAction;
  1501. if( action ){
  1502. action.setStyle("display","none");
  1503. }
  1504. var action = this.app.exportAction;
  1505. if( action ){
  1506. action.setStyle("display","none");
  1507. }
  1508. this.loadView();
  1509. },
  1510. cancelCurrent : function(){
  1511. this.isCurrent = false;
  1512. this.node.setStyles( this.css.viewNaviNode_all );
  1513. this.node.removeClass( "mainColor_color" );
  1514. this.node.removeClass( "mainColor_bg_opacity" );
  1515. this.iconNode.setStyles( this.css.viewNaviIcon_all );
  1516. this.iconNode.removeClass( "mainColor_color" );
  1517. },
  1518. getCategoryId : function(){
  1519. return null;
  1520. },
  1521. loadView : function( searchKey ){
  1522. this.app.openView( this, null, this.data, searchKey || "", this );
  1523. }
  1524. });
  1525. MWF.xApplication.cms.Module.NaviDraftView = new Class({
  1526. Implements: [Options, Events],
  1527. options: {
  1528. "style": "default"
  1529. },
  1530. initialize: function ( navi, container, options) {
  1531. this.setOptions(options);
  1532. this.navi = navi;
  1533. this.app = navi.app;
  1534. this.container = $(container);
  1535. this.css = this.app.css;
  1536. this.data = {
  1537. "isDraft" : true,
  1538. "id" : "defaultList"
  1539. };
  1540. this.load();
  1541. },
  1542. load: function(){
  1543. var _self = this;
  1544. this.isDefault = true;
  1545. this.isAll = true;
  1546. this.isCurrent = false;
  1547. this.isCategory = false;
  1548. this.listNode = new Element("div.viewNaviListNode_all",{
  1549. "styles" : this.css.viewNaviListNode_all
  1550. }).inject(this.container);
  1551. this.node = new Element("div.viewNaviNode_all", {
  1552. "styles": this.css.viewNaviNode_all,
  1553. "text" : this.app.lp.draftStatus
  1554. }).inject(this.listNode);
  1555. this.iconNode = new Element("i.o2icon-list3", {
  1556. "styles": this.css.viewNaviIcon_all
  1557. }).inject(this.node, "top");
  1558. this.node.addEvents({
  1559. "mouseover": function(){ if ( !_self.isCurrent ){
  1560. this.setStyles(_self.css.viewNaviNode_all_over);
  1561. this.addClass( "mainColor_bg_opacity" );
  1562. } },
  1563. "mouseout": function(){ if ( !_self.isCurrent ){
  1564. this.setStyles( _self.css.viewNaviNode_all );
  1565. this.removeClass( "mainColor_bg_opacity" );
  1566. } },
  1567. "click": function (el) {
  1568. _self.setCurrent();
  1569. }
  1570. });
  1571. new Element("div", {
  1572. "styles": this.css.viewNaviSepartorNode
  1573. }).inject(this.listNode);
  1574. if( this.isCurrent ){
  1575. this.setCurrent()
  1576. }
  1577. },
  1578. setCurrent : function(){
  1579. if( this.navi.currentObject ){
  1580. this.navi.currentObject.cancelCurrent();
  1581. }
  1582. this.node.setStyles( this.css.viewNaviNode_all_selected );
  1583. this.node.addClass( "mainColor_color" );
  1584. this.node.addClass( "mainColor_bg_opacity" );
  1585. this.iconNode.setStyles( this.css.viewNaviIcon_all_selected );
  1586. this.iconNode.addClass( "mainColor_color" );
  1587. this.isCurrent = true;
  1588. this.navi.currentObject = this;
  1589. var action = this.app.importAction;
  1590. if( action ){
  1591. action.setStyle("display","none");
  1592. }
  1593. var action = this.app.exportAction;
  1594. if( action ){
  1595. action.setStyle("display","none");
  1596. }
  1597. this.loadView();
  1598. },
  1599. cancelCurrent : function(){
  1600. this.isCurrent = false;
  1601. this.node.setStyles( this.css.viewNaviNode_all );
  1602. this.node.removeClass( "mainColor_color" );
  1603. this.node.removeClass( "mainColor_bg_opacity" );
  1604. this.iconNode.setStyles( this.css.viewNaviIcon_all );
  1605. this.iconNode.removeClass( "mainColor_color" );
  1606. },
  1607. getCategoryId : function(){
  1608. return null;
  1609. },
  1610. loadView : function( searchKey ){
  1611. this.app.openView( this, null, this.data, searchKey || "", this );
  1612. }
  1613. });
  1614. MWF.xApplication.cms.Module.NaviDelayView = new Class({
  1615. Implements: [Options, Events],
  1616. options: {
  1617. "style": "default"
  1618. },
  1619. initialize: function ( navi, container, options) {
  1620. this.setOptions(options);
  1621. this.navi = navi;
  1622. this.app = navi.app;
  1623. this.container = $(container);
  1624. this.css = this.app.css;
  1625. this.data = {
  1626. "isDelay" : true,
  1627. "id" : "defaultList"
  1628. };
  1629. this.load();
  1630. },
  1631. load: function(){
  1632. var _self = this;
  1633. this.isDefault = true;
  1634. this.isAll = true;
  1635. this.isCurrent = false;
  1636. this.isCategory = false;
  1637. this.listNode = new Element("div.viewNaviListNode_all",{
  1638. "styles" : this.css.viewNaviListNode_all
  1639. }).inject(this.container);
  1640. this.node = new Element("div.viewNaviNode_all", {
  1641. "styles": this.css.viewNaviNode_all,
  1642. "text" : this.app.lp.delayStatus
  1643. }).inject(this.listNode);
  1644. this.iconNode = new Element("i.o2icon-clock2", {
  1645. "styles": this.css.viewNaviIcon_all
  1646. }).inject(this.node, "top");
  1647. this.node.addEvents({
  1648. "mouseover": function(){ if ( !_self.isCurrent ){
  1649. this.setStyles(_self.css.viewNaviNode_all_over);
  1650. this.addClass( "mainColor_bg_opacity" );
  1651. } },
  1652. "mouseout": function(){ if ( !_self.isCurrent ){
  1653. this.setStyles( _self.css.viewNaviNode_all );
  1654. this.removeClass( "mainColor_bg_opacity" );
  1655. } },
  1656. "click": function (el) {
  1657. _self.setCurrent();
  1658. }
  1659. });
  1660. new Element("div", {
  1661. "styles": this.css.viewNaviSepartorNode
  1662. }).inject(this.listNode);
  1663. if( this.isCurrent ){
  1664. this.setCurrent()
  1665. }
  1666. },
  1667. setCurrent : function(){
  1668. if( this.navi.currentObject ){
  1669. this.navi.currentObject.cancelCurrent();
  1670. }
  1671. this.node.setStyles( this.css.viewNaviNode_all_selected );
  1672. this.node.addClass( "mainColor_color" );
  1673. this.node.addClass( "mainColor_bg_opacity" );
  1674. this.iconNode.setStyles( this.css.viewNaviIcon_all_selected );
  1675. this.iconNode.addClass( "mainColor_color" );
  1676. this.isCurrent = true;
  1677. this.navi.currentObject = this;
  1678. var action = this.app.importAction;
  1679. if( action ){
  1680. action.setStyle("display","none");
  1681. }
  1682. var action = this.app.exportAction;
  1683. if( action ){
  1684. action.setStyle("display","none");
  1685. }
  1686. this.loadView();
  1687. },
  1688. cancelCurrent : function(){
  1689. this.isCurrent = false;
  1690. this.node.setStyles( this.css.viewNaviNode_all );
  1691. this.node.removeClass( "mainColor_color" );
  1692. this.node.removeClass( "mainColor_bg_opacity" );
  1693. this.iconNode.setStyles( this.css.viewNaviIcon_all );
  1694. this.iconNode.removeClass( "mainColor_color" );
  1695. },
  1696. getCategoryId : function(){
  1697. return null;
  1698. },
  1699. loadView : function( searchKey ){
  1700. this.app.openView( this, null, this.data, searchKey || "", this );
  1701. }
  1702. });