Main.js 59 KB

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