Main.js 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. MWF.xDesktop.requireApp("cms.ColumnManager", "package", null, false);
  2. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", null, false);
  3. MWF.xDesktop.requireApp("Template", "MDomItem", null, false);
  4. MWF.xDesktop.requireApp("Selector", "package", null, false);
  5. MWF.require("MWF.xAction.org.express.RestActions", null,false);
  6. MWF.require("MWF.widget.O2Identity", null,false);
  7. MWF.xApplication.cms.ColumnManager.Main = new Class({
  8. Extends: MWF.xApplication.Common.Main,
  9. Implements: [Options, Events],
  10. options: {
  11. "column": null,
  12. "application" : null,
  13. "style": "default",
  14. "name": "cms.ColumnManager",
  15. "icon": "icon.png",
  16. "width": "1100",
  17. "height": "700",
  18. "title": MWF.xApplication.cms.ColumnManager.LP.title,
  19. "currentCategoryId" : ""
  20. },
  21. onQueryLoad: function(){
  22. if(this.options.column)this.options.column.icon = this.options.column.appIcon;
  23. if(!this.options.application) this.options.application = this.options.column;
  24. this.lp = MWF.xApplication.cms.ColumnManager.LP;
  25. this.currentContentNode = null;
  26. },
  27. loadApplication: function(callback){
  28. this.restActions = MWF.Actions.get("x_cms_assemble_control"); //new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  29. if (this.status && !this.options.currentCategoryId ){
  30. if( this.status.categoryId ){
  31. this.options.currentCategoryId = this.status.categoryId;
  32. }
  33. }
  34. this.getColumn(function(){
  35. this.setTitle( this.options.column.appName +this.lp.setting );
  36. this.loadController(function(){
  37. if( !this.isAdmin ){
  38. this.notice( MWF.CMSCM.LP.noAdministratorAccess , "error");
  39. this.close();
  40. }else{
  41. this.createNode();
  42. this.loadApplicationContent();
  43. if (window.clipboardData){
  44. this.addKeyboardEvents();
  45. }else{
  46. this.keyCopyItemsFun = this.keyCopyItems.bind(this);
  47. this.keyPasteItemsFun = this.keyPasteItems.bind(this);
  48. document.addEventListener('copy', this.keyCopyItemsFun);
  49. document.addEventListener('paste', this.keyPasteItemsFun);
  50. this.addEvent("queryClose", function(){
  51. debugger;
  52. if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
  53. if (this.keyPasteItemsFun) document.removeEventListener('paste', this.keyPasteItemsFun);
  54. }.bind(this));
  55. }
  56. if (callback) callback();
  57. }
  58. }.bind(this))
  59. }.bind(this), function(){
  60. this.close();
  61. }.bind(this));
  62. },
  63. addKeyboardEvents: function(){
  64. this.addEvent("copy", function(){
  65. this.keyCopyItems();
  66. }.bind(this));
  67. this.addEvent("paste", function(){
  68. this.keyPasteItems();
  69. }.bind(this));
  70. },
  71. keyCopyItems: function(e){
  72. debugger;
  73. if (layout.desktop.currentApp && layout.desktop.currentApp.appId===this.appId){
  74. if (this.formConfigurator){
  75. this.formConfigurator.keyCopy(e);
  76. }
  77. if (this.processConfigurator){
  78. this.processConfigurator.keyCopy(e);
  79. }
  80. if (this.dataConfigurator){
  81. this.dataConfigurator.keyCopy(e);
  82. }
  83. if (this.scriptConfigurator){
  84. this.scriptConfigurator.keyCopy(e);
  85. }
  86. }
  87. if (e) e.preventDefault();
  88. },
  89. keyPasteItems: function(e){
  90. debugger;
  91. if (layout.desktop.currentApp && layout.desktop.currentApp.appId===this.appId) {
  92. if (this.formConfigurator) {
  93. this.formConfigurator.keyPaste(e);
  94. }
  95. if (this.processConfigurator) {
  96. this.processConfigurator.keyPaste(e);
  97. }
  98. if (this.dataConfigurator) {
  99. this.dataConfigurator.keyPaste(e);
  100. }
  101. if (this.scriptConfigurator) {
  102. this.scriptConfigurator.keyPaste(e);
  103. }
  104. }
  105. if (e) e.preventDefault();
  106. },
  107. loadController: function(callback){
  108. //this.controllers = [];
  109. //this.restActions.listColumnController(this.options.column.id, function( json ){
  110. // json.data = json.data || [];
  111. // json.data.each(function(item){
  112. // this.controllers.push(item.adminUid)
  113. // }.bind(this));
  114. // this.isAdmin = MWF.AC.isCMSManager() || this.controllers.contains(layout.desktop.session.user.distinguishedName);
  115. // if(callback)callback(this.isAdmin);
  116. //}.bind(this));
  117. this.restActions.isAppInfoManager(this.options.column.id, function( json ){
  118. this.isAdmin = MWF.AC.isCMSManager() || json.data.value;
  119. if(callback)callback(this.isAdmin);
  120. }.bind(this));
  121. },
  122. getColumn: function(success, failure){
  123. if (!this.options.column){
  124. if (this.status) {
  125. if (this.status.column){
  126. this.restActions.getColumn(this.status.column, function(json){
  127. if (json.data){
  128. this.options.column = json.data;
  129. this.options.application = json.data;
  130. if (success) success();
  131. }else{
  132. if (failure) failure();
  133. }
  134. }.bind(this), function(){if (failure) failure();}.bind(this), false)
  135. }else{
  136. if (failure) failure();
  137. }
  138. }else{
  139. if (failure) failure();
  140. }
  141. }else{
  142. if (success) success();
  143. }
  144. },
  145. loadApplicationContent: function(){
  146. this.loadStartMenu();
  147. this.loadApplicationLayout();
  148. },
  149. createNode: function(){
  150. this.content.setStyle("overflow", "hidden");
  151. this.node = new Element("div", {
  152. "styles": {"width": "100%", "height": "100%", "overflow": "hidden"}
  153. }).inject(this.content);
  154. },
  155. loadApplicationLayout: function(){
  156. // this.topMenuNode = new Element("div").inject(this.node);
  157. // MWF.require("MWF.widget.Toolbar", function(){
  158. // this.toobar = new MWF.widget.Toolbar(this.topMenuNode);
  159. // this.toobar.load();
  160. // alert("ok")
  161. // }.bind(this));
  162. },
  163. loadStartMenu: function(callback){
  164. this.leftContentNode = new Element("div", {
  165. "styles": this.css.leftContentNode
  166. }).inject(this.node);
  167. this.leftTitleNode = new Element("div", {
  168. "styles": this.css.leftTitleNode
  169. }).inject(this.leftContentNode);
  170. this.leftTitleIconNode = new Element("div", {
  171. "styles": this.css.leftTitleIconNode
  172. }).inject(this.leftTitleNode);
  173. if (this.options.column){
  174. var icon = this.options.column.icon || this.options.column.appIcon;
  175. if (icon){
  176. this.leftTitleIconNode.setStyle("background-image", "url(data:image/png;base64,"+icon+")");
  177. }else{
  178. this.leftTitleIconNode.setStyle("background-image", "url("+"/x_component_cms_Column/$Main/default/icon/column.png)");
  179. }
  180. }
  181. this.leftTitleTextNode = new Element("div", {
  182. "styles": this.css.leftTitleTextNode,
  183. "text" : this.options.column.appName + this.lp.setting,
  184. "title" : this.options.column.appName + this.lp.setting
  185. }).inject(this.leftTitleNode);
  186. this.startMenuNode = new Element("div", {
  187. "styles": this.css.normalStartMenuNode
  188. }).inject(this.leftContentNode);
  189. this.menu = new MWF.xApplication.cms.ColumnManager.Menu(this, this.startMenuNode, {
  190. "onPostLoad": function(){
  191. var defaultId = "categoryConfig";
  192. if (this.status){
  193. if (this.status.navi!=null && this.menu.itemObject[this.status.navi]){
  194. this.menu.doAction(this.menu.itemObject[this.status.navi]);
  195. }else{
  196. this.menu.doAction(this.menu.itemObject[defaultId]);
  197. }
  198. }else{
  199. this.menu.doAction(this.menu.startNavis[0]);
  200. }
  201. }.bind(this)
  202. });
  203. //this.addEvent("resize", function(){
  204. // if (this.menu) this.menu.onResize();
  205. //}.bind(this));
  206. },
  207. clearContent: function(){
  208. if (this.categoryConfiguratorContent){
  209. this.categoryConfiguratorContent.setStyle("display","none");
  210. //if (this.categoryConfigurator) delete this.categoryConfigurator;
  211. //this.categoryConfiguratorContent.destroy();
  212. //this.categoryConfiguratorContent = null;
  213. }
  214. if (this.formConfiguratorContent){
  215. if (this.formConfigurator) delete this.formConfigurator;
  216. this.formConfiguratorContent.destroy();
  217. this.formConfiguratorContent = null;
  218. }
  219. if (this.propertyConfiguratorContent){
  220. if (this.property) delete this.property;
  221. this.propertyConfiguratorContent.destroy();
  222. this.propertyConfiguratorContent = null;
  223. }
  224. if (this.dataConfiguratorContent){
  225. if (this.dataConfigurator) delete this.dataConfigurator;
  226. this.dataConfiguratorContent.destroy();
  227. this.dataConfiguratorContent = null;
  228. }
  229. if (this.scriptConfiguratorContent){
  230. if (this.scriptConfigurator) delete this.scriptConfigurator;
  231. this.scriptConfiguratorContent.destroy();
  232. this.scriptConfiguratorContent = null;
  233. }
  234. if (this.viewConfiguratorContent){
  235. if (this.viewConfigurator) delete this.viewConfigurator;
  236. this.viewConfiguratorContent.destroy();
  237. this.viewConfiguratorContent = null;
  238. }
  239. if (this.queryViewConfiguratorContent){
  240. if (this.queryViewConfigurator) delete this.queryViewConfigurator;
  241. this.queryViewConfiguratorContent.destroy();
  242. this.queryViewConfiguratorContent = null;
  243. }
  244. },
  245. applicationProperty: function(){
  246. this.clearContent();
  247. this.propertyConfiguratorContent = new Element("div", {
  248. "styles": this.css.rightContentNode
  249. }).inject(this.node);
  250. this.property = new MWF.xApplication.cms.ColumnManager.ApplicationProperty(this, this.propertyConfiguratorContent);
  251. this.property.load();
  252. },
  253. cagetoryConfig: function( noRefresh ){
  254. debugger;
  255. this.clearContent();
  256. if( this.categoryConfiguratorContent ) {
  257. this.categoryConfiguratorContent.setStyle("display","");
  258. if( this.menu.itemObject["categoryConfig"] ){
  259. this.menu.expend( this.menu.itemObject["categoryConfig"] );
  260. }
  261. if(!noRefresh)this.categoryConfigurator.refresh();
  262. }else{
  263. this.categoryConfiguratorContent = new Element("div", {
  264. "styles": this.css.rightContentNode
  265. }).inject(this.node);
  266. this.loadCategoryConfig();
  267. }
  268. },
  269. loadCategoryConfig: function(){
  270. MWF.xDesktop.requireApp("cms.ColumnManager", "CategoryExplorer", function(){
  271. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  272. var navi = this.menu.itemObject.categoryConfig;
  273. var subNode = navi.retrieve( "subNode" );
  274. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  275. this.categoryConfigurator = new MWF.xApplication.cms.ColumnManager.CategoryExplorer(this.categoryConfiguratorContent, subNode, this.restActions, {
  276. "currentCategoryId" : this.options.currentCategoryId,
  277. "onPostLoadCategoryList" : function(){
  278. }.bind(this),
  279. "onPostClickSub" : function(){
  280. this.menu.cancelCurrentNavi();
  281. }.bind(this)
  282. });
  283. this.categoryConfigurator.app = this;
  284. //this.categoryConfigurator.categoryScrollWrapNode = this.menu.naviNode;
  285. //this.categoryConfigurator.categoryScrollContentNode = this.menu.areaNode;
  286. this.categoryConfigurator.load();
  287. this.options.currentCategoryId = "";
  288. //}.bind(this));
  289. }.bind(this));
  290. },
  291. createCategory : function(){
  292. this.cagetoryConfig( true );
  293. if( this.categoryConfigurator ){
  294. this.categoryConfigurator.categoryList.newCategory();
  295. }
  296. },
  297. setCategory : function( categoryId ){
  298. this.cagetoryConfig( true );
  299. if( this.categoryConfigurator ){
  300. this.categoryConfigurator.categoryList.setCurrentCategoryById( categoryId );
  301. }
  302. },
  303. formConfig: function(){
  304. this.clearContent();
  305. this.formConfiguratorContent = new Element("div", {
  306. "styles": this.css.rightContentNode
  307. }).inject(this.node);
  308. this.loadFormConfig();
  309. },
  310. loadFormConfig: function(){
  311. MWF.xDesktop.requireApp("cms.ColumnManager", "FormExplorer", function(){
  312. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  313. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  314. this.formConfigurator = new MWF.xApplication.cms.ColumnManager.FormExplorer(this.formConfiguratorContent, this.restActions, { "title" : "表单配置" });
  315. this.formConfigurator.app = this;
  316. this.formConfigurator.load();
  317. //}.bind(this));
  318. }.bind(this));
  319. },
  320. createForm : function(){
  321. if( this.formConfigurator ){
  322. this.formConfigurator._createElement();
  323. }else{
  324. MWF.xDesktop.requireApp("cms.ColumnManager", "FormExplorer", function(){
  325. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  326. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  327. this.formConfigurator = new MWF.xApplication.cms.ColumnManager.FormExplorer(this.formConfiguratorContent, this.restActions);
  328. this.formConfigurator.app = this;
  329. this.formConfigurator._createElement();
  330. //}.bind(this));
  331. }.bind(this));
  332. }
  333. },
  334. dataConfig: function(){
  335. this.clearContent();
  336. this.dataConfiguratorContent = new Element("div", {
  337. "styles": this.css.rightContentNode
  338. }).inject(this.node);
  339. this.loadDataConfig();
  340. },
  341. loadDataConfig: function(){
  342. MWF.xDesktop.requireApp("cms.ColumnManager", "DictionaryExplorer", function(){
  343. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  344. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  345. this.dataConfigurator = new MWF.xApplication.cms.ColumnManager.DictionaryExplorer(this.dataConfiguratorContent, this.restActions, { "title" : "数据配置" });
  346. this.dataConfigurator.app = this;
  347. this.dataConfigurator.load();
  348. //}.bind(this));
  349. }.bind(this));
  350. },
  351. createDataConfig : function(){
  352. if( this.dataConfigurator ){
  353. this.dataConfigurator._createElement();
  354. }else{
  355. MWF.xDesktop.requireApp("cms.ColumnManager", "DictionaryExplorer", function(){
  356. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  357. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  358. this.dataConfigurator = new MWF.xApplication.cms.ColumnManager.DictionaryExplorer(this.dataConfiguratorContent, this.restActions);
  359. this.dataConfigurator.app = this;
  360. this.dataConfigurator._createElement();
  361. //}.bind(this));
  362. }.bind(this));
  363. }
  364. },
  365. scriptConfig: function(){
  366. this.clearContent();
  367. this.oContent = new Element("div", {
  368. "styles": this.css.rightContentNode
  369. }).inject(this.node);
  370. this.loadScriptConfig();
  371. },
  372. loadScriptConfig: function(){
  373. MWF.xDesktop.requireApp("cms.ColumnManager", "ScriptExplorer", function(){
  374. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  375. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  376. this.scriptConfigurator = new MWF.xApplication.cms.ColumnManager.ScriptExplorer(this.scriptConfiguratorContent, this.restActions, { "title" : "脚本配置" });
  377. this.scriptConfigurator.app = this;
  378. this.scriptConfigurator.load();
  379. //}.bind(this));
  380. }.bind(this));
  381. },
  382. createScriptConfig : function(){
  383. if( this.scriptConfigurator ){
  384. this.scriptConfigurator._createElement();
  385. }else{
  386. MWF.xDesktop.requireApp("cms.ColumnManager", "ScriptExplorer", function(){
  387. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  388. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  389. this.scriptConfigurator = new MWF.xApplication.cms.ColumnManager.ScriptExplorer(this.scriptConfiguratorContent, this.restActions);
  390. this.scriptConfigurator.app = this;
  391. this.scriptConfigurator._createElement();
  392. //}.bind(this));
  393. }.bind(this));
  394. }
  395. },
  396. viewConfig: function(){
  397. this.clearContent();
  398. this.viewConfiguratorContent = new Element("div", {
  399. "styles": this.css.rightContentNode
  400. }).inject(this.node);
  401. this.loadViewConfig();
  402. },
  403. loadViewConfig: function(){
  404. MWF.xDesktop.requireApp("cms.ColumnManager", "ViewExplorer", function(){
  405. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  406. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  407. this.viewConfigurator = new MWF.xApplication.cms.ColumnManager.ViewExplorer(this.viewConfiguratorContent, this.restActions, { "title" : "列表配置" });
  408. this.viewConfigurator.app = this;
  409. this.viewConfigurator.load();
  410. //}.bind(this));
  411. }.bind(this));
  412. },
  413. createView : function(){
  414. if( this.viewConfigurator ){
  415. this.viewConfigurator._createElement();
  416. }else{
  417. MWF.xDesktop.requireApp("cms.ColumnManager", "ViewExplorer", function(){
  418. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  419. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  420. this.viewConfigurator = new MWF.xApplication.cms.ColumnManager.ViewExplorer(this.viewConfiguratorContent, this.restActions);
  421. this.viewConfigurator.app = this;
  422. this.viewConfigurator._createElement();
  423. //}.bind(this));
  424. }.bind(this));
  425. }
  426. },
  427. queryViewConfig: function(){
  428. this.clearContent();
  429. this.queryViewConfiguratorContent = new Element("div", {
  430. "styles": this.css.rightContentNode
  431. }).inject(this.node);
  432. this.loadQueryViewConfig();
  433. },
  434. loadQueryViewConfig: function(){
  435. MWF.xDesktop.requireApp("cms.ColumnManager", "QueryViewExplorer", function(){
  436. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  437. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  438. this.queryViewConfigurator = new MWF.xApplication.cms.ColumnManager.QueryViewExplorer(this.queryViewConfiguratorContent, this.restActions, { "title" : "数据视图配置" });
  439. this.queryViewConfigurator.app = this;
  440. this.queryViewConfigurator.load();
  441. //}.bind(this));
  442. }.bind(this));
  443. },
  444. createQueryView : function(){
  445. if( this.queryViewConfigurator ){
  446. this.queryViewConfigurator._createElement();
  447. }else{
  448. MWF.xDesktop.requireApp("cms.ColumnManager", "QueryViewExplorer", function(){
  449. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  450. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  451. this.queryViewConfigurator = new MWF.xApplication.cms.ColumnManager.QueryViewExplorer(this.queryViewConfiguratorContent, this.restActions);
  452. this.queryViewConfigurator.app = this;
  453. this.queryViewConfigurator._createElement();
  454. // }.bind(this));
  455. }.bind(this));
  456. }
  457. },
  458. //getCategoryCount: function(){
  459. // var size = this.categoryConfiguratorContent.getSize();
  460. // categoryCount = parseInt(size.x/182)+5;
  461. // return categoryCount;
  462. //},
  463. getCategoryCount: function(){
  464. if (this.categoryConfigurator){
  465. var size = this.categoryConfigurator.categoryNode.getSize();
  466. categoryCount = (parseInt(size.x/401)*parseInt(size.y/101))+10;
  467. return categoryCount;
  468. }
  469. return 20;
  470. },
  471. showContentNode: function(node){
  472. if (this.currentContentNode){
  473. // this.currentContentNode.setStyles({
  474. // "position": "absolute"
  475. // });
  476. this.currentContentNode.fade("hide");
  477. node.fade("show");
  478. node.setStyle("display", "node");
  479. this.currentContentNode = null;
  480. }
  481. node.setStyle("display", "block");
  482. node.fade("show");
  483. this.currentContentNode = node;
  484. },
  485. recordStatus: function(){
  486. var id = null;
  487. var categoryId = "";
  488. if (this.menu.currentNavi){
  489. var naviData = this.menu.currentNavi.retrieve( "naviData" );
  490. id = naviData.id;
  491. }
  492. if( id == "categoryConfig" ){
  493. if( this.categoryConfigurator && this.categoryConfigurator.categoryList ){
  494. var list = this.categoryConfigurator.categoryList;
  495. if( list.currentCategory && list.currentCategory.data ){
  496. categoryId = list.currentCategory.data.id;
  497. }
  498. }
  499. }
  500. return {
  501. "navi": id,
  502. "column": this.options.column.id,
  503. "categoryId" : categoryId
  504. };
  505. }
  506. // onResize: function(){
  507. // if (this.menu) this.menu.onResize();
  508. // }
  509. });
  510. MWF.xApplication.cms.ColumnManager.Menu = new Class({
  511. Implements: [Options, Events],
  512. initialize: function(app, node, options){
  513. this.setOptions(options);
  514. this.app = app;
  515. this.node = $(node);
  516. this.currentNavi = null;
  517. this.status = "start";
  518. this.startNavis = [];
  519. this.itemObject = {};
  520. //this.
  521. this.load();
  522. },
  523. load: function(){
  524. this.areaNode = new Element("div.startMenuAreaNode", this.app.css.startMenuAreaNode).inject( this.node );
  525. MWF.require("MWF.widget.ScrollBar", function(){
  526. new MWF.widget.ScrollBar(this.node, {
  527. "style":"xApp_ProcessManager_StartMenu", "distance": 100, "friction": 4, "axis": {"x": false, "y": true}
  528. });
  529. }.bind(this));
  530. var menuUrl = this.app.path+"startMenu.json";
  531. MWF.getJSON(menuUrl, function(json){
  532. json.each(function(navi){
  533. var naviNode = new Element("div", {
  534. "styles": this.app.css.startMenuNaviNode
  535. });
  536. naviNode.store("naviData", navi);
  537. if( navi.expand ){
  538. var expandNode = new Element("div", {
  539. "styles": this.app.css.startMenuExpandNode
  540. });
  541. expandNode.inject(naviNode);
  542. naviNode.store("expandNode", expandNode );
  543. }else{
  544. new Element("div", {
  545. "styles": this.app.css.startMenuEmptyNode
  546. }).inject(naviNode);
  547. }
  548. var iconNode = new Element("div", {
  549. "styles": this.app.css.startMenuIconNode
  550. }).inject(naviNode);
  551. iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+navi.icon+")");
  552. naviNode.store("iconNode", iconNode );
  553. var textNode = new Element("div", {
  554. "styles": this.app.css.startMenuTextNode,
  555. "text": navi.title
  556. });
  557. textNode.inject(naviNode);
  558. if( navi.create ){
  559. var createNode = new Element("div", {
  560. "styles": this.app.css.startMenuCreateNode,
  561. "title" : "新建"+navi.title
  562. });
  563. createNode.inject(naviNode);
  564. naviNode.store("createNode", createNode );
  565. createNode.addEvents({
  566. "click" : function(ev){
  567. this.obj.app[ this.navi.createAction ]();
  568. ev.stopPropagation();
  569. }.bind( { obj : this, navi : navi } ),
  570. "mouseover" : function(ev){
  571. if( this.obj.currentNavi == this.naviNode && !this.naviData.unselected ){
  572. this.createNode.setStyles( this.obj.app.css.startMenuCreateNode_current_over )
  573. }else{
  574. this.createNode.setStyles( this.obj.app.css.startMenuCreateNode_over )
  575. }
  576. }.bind({ obj : this, createNode : createNode, naviNode : naviNode , naviData : navi}),
  577. "mouseout" : function(ev){
  578. if( this.obj.currentNavi == this.naviNode && !this.naviData.unselected ){
  579. this.createNode.setStyles( this.obj.app.css.startMenuCreateNode_current )
  580. }else{
  581. this.createNode.setStyles( this.obj.app.css.startMenuCreateNode )
  582. }
  583. }.bind({ obj : this, createNode : createNode, naviNode : naviNode, naviData : navi })
  584. })
  585. }
  586. naviNode.inject(this.areaNode);
  587. if( navi.expand ){
  588. var subNode = new Element("div", {
  589. "styles": this.app.css.startMenuSubContentNode
  590. });
  591. subNode.inject(this.areaNode);
  592. naviNode.store("subNode", subNode );
  593. }
  594. this.startNavis.push(naviNode);
  595. this.itemObject[ navi.id ] = naviNode;
  596. this.setStartNaviEvent(naviNode, navi);
  597. //this.setNodeCenter(this.node);
  598. }.bind(this));
  599. //this.setStartMenuWidth();
  600. this.setContentSize();
  601. this.app.addEvent("resize", this.setContentSize.bind(this));
  602. this.fireEvent("postLoad");
  603. }.bind(this));
  604. },
  605. setStartNaviEvent: function(naviNode){
  606. var _self = this;
  607. naviNode.addEvents({
  608. "mouseover": function(){ if (_self.currentNavi!=this) this.setStyles(_self.app.css.startMenuNaviNode_over);},
  609. "mouseout": function(){if (_self.currentNavi!=this) this.setStyles(_self.app.css.startMenuNaviNode);},
  610. "mousedown": function(){if (_self.currentNavi!=this) this.setStyles(_self.app.css.startMenuNaviNode_down);},
  611. "mouseup": function(){if (_self.currentNavi!=this) this.setStyles(_self.app.css.startMenuNaviNode_over);},
  612. "click": function(){
  613. //if (_self.currentNavi!=this) _self.doAction.apply(_self, [this]);
  614. _self.doAction.apply(_self, [this]);
  615. }
  616. });
  617. },
  618. expend : function( naviNode ){
  619. var isExpand = naviNode.retrieve("isExpand");
  620. if( !isExpand ){
  621. var expandNode = naviNode.retrieve("expandNode");
  622. expandNode.setStyles(this.app.css.startMenuCollapseNode);
  623. var subNode = naviNode.retrieve("subNode");
  624. subNode.setStyle( "display" , "" );
  625. naviNode.store("isExpand",true);
  626. }
  627. },
  628. collapse : function( naviNode ){
  629. var isExpand = naviNode.retrieve("isExpand");
  630. if( isExpand ){
  631. var expandNode = naviNode.retrieve("expandNode");
  632. expandNode.setStyles(this.app.css.startMenuExpandNode);
  633. var subNode = naviNode.retrieve("subNode");
  634. subNode.setStyle( "display" , "none" );
  635. naviNode.store("isExpand",false);
  636. }
  637. },
  638. cancelCurrentNavi: function(){
  639. if( this.currentNavi ){
  640. this.currentNavi.setStyles(this.app.css.startMenuNaviNode);
  641. var iconNode = this.currentNavi.retrieve("iconNode");
  642. var navi = this.currentNavi.retrieve("naviData");
  643. iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+navi.icon+")");
  644. }
  645. },
  646. doAction: function( naviNode ){
  647. if( this.currentNavi && this.currentNavi == naviNode ){
  648. var navi = this.currentNavi.retrieve("naviData");
  649. if( navi.expand ){
  650. var isExpand = this.currentNavi.retrieve("isExpand");
  651. if( isExpand ){
  652. var expandNode = this.currentNavi.retrieve("expandNode");
  653. expandNode.setStyles(this.app.css.startMenuExpandNode);
  654. var subNode = this.currentNavi.retrieve("subNode");
  655. subNode.setStyle( "display" , "none" );
  656. this.currentNavi.store("isExpand",false);
  657. }else{
  658. var expandNode = this.currentNavi.retrieve("expandNode");
  659. expandNode.setStyles(this.app.css.startMenuCollapseNode);
  660. var subNode = this.currentNavi.retrieve("subNode");
  661. subNode.setStyle( "display" , "" );
  662. this.currentNavi.store("isExpand",true);
  663. }
  664. }
  665. return;
  666. }
  667. if (this.currentNavi){
  668. this.currentNavi.setStyles(this.app.css.startMenuNaviNode);
  669. var iconNode = this.currentNavi.retrieve("iconNode");
  670. var navi = this.currentNavi.retrieve("naviData");
  671. iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+navi.icon+")");
  672. if( navi.expand ){
  673. var expandNode = this.currentNavi.retrieve("expandNode");
  674. expandNode.setStyles(this.app.css.startMenuExpandNode);
  675. var subNode = this.currentNavi.retrieve("subNode");
  676. subNode.setStyle( "display" , "none" );
  677. this.currentNavi.store("isExpand",false);
  678. }
  679. if( navi.create ){
  680. var createNode = this.currentNavi.retrieve("createNode");
  681. createNode.setStyles(this.app.css.startMenuCreateNode);
  682. }
  683. }
  684. if( naviNode ){
  685. var navi = naviNode.retrieve("naviData");
  686. var action = navi.action;
  687. if( !navi.unselected ){
  688. naviNode.setStyles(this.app.css.startMenuNaviNode_current);
  689. var iconNode = naviNode.retrieve("iconNode");
  690. iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+navi.selectedIcon+")");
  691. }
  692. if( navi.expand ){
  693. if( !navi.unselected ){
  694. var expandNode = naviNode.retrieve("expandNode");
  695. expandNode.setStyles(this.app.css.startMenuCollapseNode_current);
  696. }else{
  697. var expandNode = naviNode.retrieve("expandNode");
  698. expandNode.setStyles(this.app.css.startMenuCollapseNode );
  699. }
  700. var subNode = naviNode.retrieve("subNode");
  701. subNode.setStyle( "display" , "" );
  702. naviNode.store("isExpand",true);
  703. }
  704. if( navi.create ){
  705. var createNode = naviNode.retrieve("createNode");
  706. if( !navi.unselected ){
  707. createNode.setStyles(this.app.css.startMenuCreateNode_current);
  708. }else{
  709. createNode.setStyles(this.app.css.startMenuCreateNode);
  710. }
  711. }
  712. if (this.app[action]) this.app[action].apply( this.app );
  713. }
  714. this.currentNavi = naviNode;
  715. },
  716. setContentSize : function(){
  717. var size = this.app.content.getSize();
  718. this.node.setStyle("height", size.y - 82);
  719. }
  720. });
  721. MWF.xApplication.cms.ColumnManager.ApplicationProperty = new Class({
  722. initialize: function(app, node){
  723. this.app = app;
  724. this.node = $(node);
  725. this.data = this.app.options.application;
  726. this.controllerData = [];
  727. this.controllerList = [];
  728. },
  729. load: function(){
  730. this.propertyTitleBar = new Element("div.propertyTitleBar", {
  731. "styles": this.app.css.propertyTitleBar,
  732. "text": "栏目属性" //this.data.name || this.data.appName
  733. }).inject(this.node);
  734. this.contentNode = new Element("div.propertyContentNode", {
  735. "styles": this.app.css.propertyContentNode
  736. }).inject(this.node);
  737. this.contentAreaNode = new Element("div.propertyContentAreaNode", {
  738. "styles": this.app.css.propertyContentAreaNode
  739. }).inject(this.contentNode);
  740. this.setContentHeight();
  741. this.setContentHeightFun = this.setContentHeight.bind(this);
  742. this.app.addEvent("resize", this.setContentHeightFun);
  743. MWF.require("MWF.widget.ScrollBar", function(){
  744. new MWF.widget.ScrollBar(this.contentNode, {"indent": false});
  745. }.bind(this));
  746. this.baseActionAreaNode = new Element("div.baseActionAreaNode", {
  747. "styles": this.app.css.baseActionAreaNode
  748. }).inject(this.contentAreaNode);
  749. this.baseActionNode = new Element("div.propertyInforActionNode", {
  750. "styles": this.app.css.propertyInforActionNode
  751. }).inject(this.baseActionAreaNode);
  752. this.baseTextNode = new Element("div.baseTextNode", {
  753. "styles": this.app.css.baseTextNode,
  754. "text": this.app.lp.application.property
  755. }).inject(this.baseActionAreaNode);
  756. this.createEditBaseNode();
  757. this.createPropertyContentNode();
  758. this.createIconContentNode();
  759. this.viewerContainer = new Element( "div").inject( this.contentAreaNode );
  760. MWF.xDesktop.requireApp("cms.ColumnManager", "widget.ColumnViewerSetting", null, false);
  761. this.viewerSetting = new MWF.xApplication.cms.ColumnManager.ColumnViewerSetting( this.app,
  762. this.app.lp.application.viewerSetting, this.viewerContainer, {
  763. objectId : this.data.id
  764. }
  765. );
  766. this.viewerSetting.dataParent = this;
  767. this.viewerSetting.load();
  768. this.publisherContainer = new Element( "div").inject( this.contentAreaNode );
  769. MWF.xDesktop.requireApp("cms.ColumnManager", "widget.ColumnPublisherSetting", null, false);
  770. this.publisherSetting = new MWF.xApplication.cms.ColumnManager.ColumnPublisherSetting( this.app,
  771. this.app.lp.application.publisherSetting, this.publisherContainer, {
  772. objectId : this.data.id
  773. }
  774. );
  775. this.publisherSetting.dataParent = this;
  776. this.publisherSetting.load();
  777. this.managerContainer = new Element( "div").inject( this.contentAreaNode );
  778. MWF.xDesktop.requireApp("cms.ColumnManager", "widget.ColumnManagerSetting", null, false);
  779. this.viewerSetting = new MWF.xApplication.cms.ColumnManager.ColumnManagerSetting( this.app,
  780. this.app.lp.application.managerSetting, this.managerContainer, {
  781. objectId : this.data.id
  782. }
  783. );
  784. this.viewerSetting.dataParent = this;
  785. this.viewerSetting.load();
  786. },
  787. setContentHeight: function(){
  788. var size = this.app.content.getSize();
  789. var titleSize = this.propertyTitleBar.getSize();
  790. var y = size.y-titleSize.y;
  791. this.contentNode.setStyle("height", ""+y+"px");
  792. },
  793. createIconContentNode: function(){
  794. this.iconContentTitleNode = new Element("div.iconContentTitleNode", {
  795. "styles": this.app.css.iconContentTitleNode,
  796. "text": this.app.lp.application.icon
  797. }).inject(this.contentAreaNode);
  798. this.iconContentNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentAreaNode);
  799. var html = "<table cellspacing='0' cellpadding='0' border='0' width='95%' align='center' style='margin-top: 20px'>";
  800. html += "<tr><td class='formTitle'><div id='formIconPreview'></div></td><td id='formChangeIconAction'></td></tr>";
  801. html += "</table>";
  802. this.iconContentNode.set("html", html);
  803. this.iconContentNode.getElements("td.formTitle").setStyles(this.app.css.propertyBaseContentTdTitle);
  804. this.iconPreviewNode = this.iconContentNode.getElement("div#formIconPreview");
  805. this.iconActionNode = this.iconContentNode.getElement("td#formChangeIconAction");
  806. this.iconPreviewNode.setStyles({
  807. "height": "72px",
  808. "width": "72px",
  809. "float": "right"
  810. });
  811. var icon = this.data.icon || this.data.appIcon;
  812. if (icon){
  813. this.iconPreviewNode.setStyle("background", "url(data:image/png;base64,"+icon+") center center no-repeat");
  814. }else{
  815. this.iconPreviewNode.setStyle("background", "url("+"/x_component_cms_Column/$Main/default/icon/column.png) center center no-repeat")
  816. }
  817. var changeIconAction = new Element("div", {
  818. "styles": this.app.css.selectButtonStyle,
  819. "text": "更改图标"
  820. }).inject(this.iconActionNode);
  821. changeIconAction.addEvent("click", function(){
  822. this.changeIcon();
  823. }.bind(this));
  824. },
  825. changeIcon: function(){
  826. if (!this.uploadFileAreaNode){
  827. this.uploadFileAreaNode = new Element("div");
  828. var html = "<input name=\"file\" type=\"file\"/>";
  829. this.uploadFileAreaNode.set("html", html);
  830. this.fileUploadNode = this.uploadFileAreaNode.getFirst();
  831. this.fileUploadNode.addEvent("change", function(){
  832. var files = fileNode.files;
  833. if (files.length){
  834. for (var i = 0; i < files.length; i++) {
  835. var file = files.item(i);
  836. var formData = new FormData();
  837. formData.append('file', file);
  838. //formData.append('name', file.name);
  839. //formData.append('folder', folderId);
  840. this.app.restActions.updataColumnIcon(this.data.id ,function(){
  841. this.app.restActions.getColumn(this.data.id, function(json){
  842. if (json.data){
  843. this.data = json.data;
  844. if (this.data.appIcon){
  845. this.iconPreviewNode.setStyle("background", "url(data:image/png;base64,"+this.data.appIcon+") center center no-repeat");
  846. }else{
  847. this.iconPreviewNode.setStyle("background", "url("+"/x_component_cms_Column/$Main/default/icon/category2.png) center center no-repeat")
  848. }
  849. }
  850. }.bind(this), false)
  851. }.bind(this), null, formData, file);
  852. }
  853. }
  854. }.bind(this));
  855. }
  856. var fileNode = this.uploadFileAreaNode.getFirst();
  857. fileNode.click();
  858. },
  859. createPropertyContentNode: function(){
  860. this.propertyContentNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentAreaNode);
  861. var html = "<table cellspacing='0' cellpadding='0' border='0' width='95%' align='center' style='margin-top: 20px'>";
  862. html += "<tr><td class='formTitle'>"+this.app.lp.application.id +"</td><td id='formApplicationId' class='formValue'>"+this.data.id+"</td></tr>";
  863. html += "<tr><td class='formTitle'>"+this.app.lp.application.name+"</td><td id='formApplicationName'></td></tr>";
  864. html += "<tr><td class='formTitle'>"+this.app.lp.application.sign+"</td><td id='formApplicationAlias' class='formValue'>"+(this.data.alias||this.data.appAlias||'')+"</td></tr>";
  865. html += "<tr><td class='formTitle'>"+this.app.lp.application.documentType+"</td><td id='formApplicationType' class='formValue'>"+(this.data.documentType || "信息" )+"</td></tr>";
  866. html += "<tr><td class='formTitle'>"+this.app.lp.application.description+"</td><td id='formApplicationDescription'></td></tr>";
  867. html += "<tr><td class='formTitle'>"+this.app.lp.application.sort+"</td><td id='formApplicationSort'></td></tr>";
  868. // html += "<tr><td class='formTitle'>"+this.app.lp.application.type+"</td><td id='formApplicationType'></td></tr>";
  869. // html += "<tr><td class='formTitle'>"+this.app.lp.application.icon+"</td><td id='formApplicationIcon'></td></tr>";
  870. html += "</table>";
  871. this.propertyContentNode.set("html", html);
  872. this.propertyContentNode.getElements("td.formTitle").setStyles(this.app.css.propertyBaseContentTdTitle);
  873. this.propertyContentNode.getElements("td.formValue").setStyles(this.app.css.propertyBaseContentTdValue);
  874. this.nameInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationName"), this.data.name || this.data.appName, this.app.css.formInput);
  875. //this.aliasInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationAlias"), this.data.alias, this.app.css.formInput);
  876. this.typeSelect = new MDomItem( this.propertyContentNode.getElement("#formApplicationType"), {
  877. type : "select",
  878. value : this.data.documentType || "信息",
  879. selectValue : [ "信息", "数据" ]
  880. });
  881. this.descriptionInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationDescription"), this.data.description, this.app.css.formInput);
  882. this.sortInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationSort"), this.data.appInfoSeq, this.app.css.formInput);
  883. //this.typeInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationType"), this.data.applicationCategory, this.app.css.formInput);
  884. },
  885. createEditBaseNode: function(){
  886. this.editBaseNode = new Element("button.editBaseNode", {
  887. "styles": this.app.css.editBaseNode,
  888. "text": this.app.lp.edit,
  889. "events": {"click": this.editBaseInfor.bind(this)}
  890. }).inject(this.baseActionNode);
  891. },
  892. createCancelBaseNode: function(){
  893. this.cancelBaseNode = new Element("button.cancelBaseNode", {
  894. "styles": this.app.css.cancelBaseNode,
  895. "text": this.app.lp.cancel,
  896. "events": {"click": this.cancelBaseInfor.bind(this)}
  897. }).inject(this.baseActionNode);
  898. },
  899. createSaveBaseNode: function(){
  900. this.saveBaseNode = new Element("button.saveBaseNode", {
  901. "styles": this.app.css.saveBaseNode,
  902. "text": this.app.lp.save,
  903. "events": {"click": this.saveBaseInfor.bind(this)}
  904. }).inject(this.baseActionNode);
  905. },
  906. editBaseInfor: function(){
  907. this.baseActionNode.empty();
  908. this.editBaseNode = null;
  909. this.createCancelBaseNode();
  910. this.createSaveBaseNode();
  911. this.editMode();
  912. },
  913. editMode: function(){
  914. this.nameInput.editMode();
  915. //this.aliasInput.editMode();
  916. this.descriptionInput.editMode();
  917. this.sortInput.editMode();
  918. this.typeSelect.editMode();
  919. //this.typeInput.editMode();
  920. this.isEdit = true;
  921. },
  922. readMode: function(){
  923. this.nameInput.readMode();
  924. //this.aliasInput.readMode();
  925. this.descriptionInput.readMode();
  926. this.sortInput.readMode();
  927. this.typeSelect.readMode();
  928. //this.typeInput.readMode();
  929. this.isEdit = false;
  930. },
  931. cancelBaseInfor: function(){
  932. if (this.data.name || this.data.appName || this.data.id ){
  933. this.baseActionNode.empty();
  934. this.cancelBaseNode = null;
  935. this.saveBaseNode = null;
  936. this.createEditBaseNode();
  937. this.readMode();
  938. }else{
  939. this.destroy();
  940. }
  941. },
  942. saveBaseInfor: function(){
  943. if (!this.nameInput.input.get("value")){
  944. this.app.notice(this.app.lp.application.inputApplicationName, "error", this.node);
  945. return false;
  946. }
  947. //this.node.mask({
  948. // "style": {
  949. // "opacity": 0.7,
  950. // "background-color": "#999"
  951. // }
  952. //});
  953. this.save(function(){
  954. this.baseActionNode.empty();
  955. this.cancelBaseNode = null;
  956. this.saveBaseNode = null;
  957. this.createEditBaseNode();
  958. this.readMode();
  959. //this.node.unmask();
  960. }.bind(this), function(xhr, text, error){
  961. var errorText = error;
  962. if (xhr) errorText = xhr.responseText;
  963. this.app.notice("request json error: "+errorText, "error");
  964. //this.node.unmask();
  965. }.bind(this));
  966. },
  967. save: function(callback, cancel){
  968. this.data.name = this.nameInput.input.get("value");
  969. this.data.appName = this.data.name;
  970. //this.data.alias = this.aliasInput.input.get("value");
  971. //this.data.appAlias = this.data.alias;
  972. this.data.description = this.descriptionInput.input.get("value");
  973. this.data.appInfoSeq = this.sortInput.input.get("value");
  974. this.data.documentType = this.typeSelect.getValue();
  975. //this.data.applicationCategory = this.typeInput.input.get("value");
  976. this.app.restActions.saveColumn(this.data, function(json){
  977. this.propertyTitleBar.set("text", this.data.name);
  978. this.data.id = json.data.id;
  979. this.nameInput.save();
  980. //this.aliasInput.save();
  981. this.descriptionInput.save();
  982. this.sortInput.save();
  983. this.typeSelect.save();
  984. //this.typeInput.save();
  985. this.app.notice( this.app.lp.application.saveSuccess, "success");
  986. if (callback) callback();
  987. }.bind(this), function(xhr, text, error){
  988. if (cancel) cancel(xhr, text, error);
  989. }.bind(this));
  990. }
  991. });
  992. MWF.xApplication.cms.ColumnManager.Input = new Class({
  993. Implements: [Events],
  994. initialize: function(node, value, style){
  995. this.node = $(node);
  996. this.value = value || "";
  997. this.style = style;
  998. this.load();
  999. },
  1000. load: function(){
  1001. this.content = new Element("div", {
  1002. "styles": this.style.content,
  1003. "text": this.value
  1004. }).inject(this.node);
  1005. },
  1006. editMode: function(){
  1007. this.content.empty();
  1008. this.input = new Element("input",{
  1009. "styles": this.style.input,
  1010. "value": this.value
  1011. }).inject(this.content);
  1012. this.input.addEvents({
  1013. "focus": function(){
  1014. this.input.setStyles(this.style.input_focus);
  1015. }.bind(this),
  1016. "blur": function(){
  1017. this.input.setStyles(this.style.input);
  1018. }.bind(this)
  1019. });
  1020. },
  1021. readMode: function(){
  1022. this.content.empty();
  1023. this.input = null;
  1024. this.content.set("text", this.value);
  1025. },
  1026. save: function(){
  1027. if (this.input) this.value = this.input.get("value");
  1028. return this.value;
  1029. }
  1030. });
  1031. //MWF.xDesktop.requireApp("Template", "MTooltips", null, false);
  1032. //MWF.xApplication.cms.ColumnManager.TypeTooltip = new Class({
  1033. // Extends: MTooltips,
  1034. // _loadCustom : function( callback ){
  1035. // if(callback)callback();
  1036. // },
  1037. // _getHtml : function(){
  1038. // var data = this.data;
  1039. // var titleStyle = "font-size:12px;color:#333";
  1040. // var valueStyle = "font-size:12px;color:#666;padding-right:20px";
  1041. //
  1042. // var html =
  1043. // "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' style='margin:13px 13px 13px 13px;'>" +
  1044. // "<tr><td style='"+valueStyle+";' width='70'>"+"栏目类型设置为“数据存储”时,将不在信息中心中展现。"+":</td>" +
  1045. // " </tr>" +
  1046. // "</table>";
  1047. // return html;
  1048. // }
  1049. //});