Main.js 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138
  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. this.clearContent();
  255. if( this.categoryConfiguratorContent ) {
  256. this.categoryConfiguratorContent.setStyle("display","");
  257. if( this.menu.itemObject["categoryConfig"] ){
  258. this.menu.expend( this.menu.itemObject["categoryConfig"] );
  259. }
  260. if(!noRefresh)this.categoryConfigurator.refresh();
  261. }else{
  262. this.categoryConfiguratorContent = new Element("div", {
  263. "styles": this.css.rightContentNode
  264. }).inject(this.node);
  265. this.loadCategoryConfig();
  266. }
  267. },
  268. loadCategoryConfig: function(){
  269. MWF.xDesktop.requireApp("cms.ColumnManager", "CategoryExplorer", function(){
  270. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  271. var navi = this.menu.itemObject.categoryConfig;
  272. var subNode = navi.retrieve( "subNode" );
  273. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  274. this.categoryConfigurator = new MWF.xApplication.cms.ColumnManager.CategoryExplorer(this.categoryConfiguratorContent, subNode, this.restActions, {
  275. "currentCategoryId" : this.options.currentCategoryId,
  276. "onPostLoadCategoryList" : function(){
  277. }.bind(this),
  278. "onPostClickSub" : function(){
  279. this.menu.cancelCurrentNavi();
  280. }.bind(this)
  281. });
  282. this.categoryConfigurator.app = this;
  283. //this.categoryConfigurator.categoryScrollWrapNode = this.menu.naviNode;
  284. //this.categoryConfigurator.categoryScrollContentNode = this.menu.areaNode;
  285. this.categoryConfigurator.load();
  286. this.options.currentCategoryId = "";
  287. //}.bind(this));
  288. }.bind(this));
  289. },
  290. createCategory : function(){
  291. this.cagetoryConfig( true );
  292. if( this.categoryConfigurator ){
  293. this.categoryConfigurator.categoryList.newCategory();
  294. }
  295. },
  296. setCategory : function( categoryId ){
  297. this.cagetoryConfig( true );
  298. if( this.categoryConfigurator ){
  299. this.categoryConfigurator.categoryList.setCurrentCategoryById( categoryId );
  300. }
  301. },
  302. formConfig: function(){
  303. this.clearContent();
  304. this.formConfiguratorContent = new Element("div", {
  305. "styles": this.css.rightContentNode
  306. }).inject(this.node);
  307. this.loadFormConfig();
  308. },
  309. loadFormConfig: function(){
  310. MWF.xDesktop.requireApp("cms.ColumnManager", "FormExplorer", function(){
  311. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  312. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  313. this.formConfigurator = new MWF.xApplication.cms.ColumnManager.FormExplorer(this.formConfiguratorContent, this.restActions, { "title" : "表单配置" });
  314. this.formConfigurator.app = this;
  315. this.formConfigurator.load();
  316. //}.bind(this));
  317. }.bind(this));
  318. },
  319. createForm : function(){
  320. if( this.formConfigurator ){
  321. this.formConfigurator._createElement();
  322. }else{
  323. MWF.xDesktop.requireApp("cms.ColumnManager", "FormExplorer", function(){
  324. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  325. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  326. this.formConfigurator = new MWF.xApplication.cms.ColumnManager.FormExplorer(this.formConfiguratorContent, this.restActions);
  327. this.formConfigurator.app = this;
  328. this.formConfigurator._createElement();
  329. //}.bind(this));
  330. }.bind(this));
  331. }
  332. },
  333. dataConfig: function(){
  334. this.clearContent();
  335. this.dataConfiguratorContent = new Element("div", {
  336. "styles": this.css.rightContentNode
  337. }).inject(this.node);
  338. this.loadDataConfig();
  339. },
  340. loadDataConfig: function(){
  341. MWF.xDesktop.requireApp("cms.ColumnManager", "DictionaryExplorer", function(){
  342. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  343. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  344. this.dataConfigurator = new MWF.xApplication.cms.ColumnManager.DictionaryExplorer(this.dataConfiguratorContent, this.restActions, { "title" : "数据配置" });
  345. this.dataConfigurator.app = this;
  346. this.dataConfigurator.load();
  347. //}.bind(this));
  348. }.bind(this));
  349. },
  350. createDataConfig : function(){
  351. if( this.dataConfigurator ){
  352. this.dataConfigurator._createElement();
  353. }else{
  354. MWF.xDesktop.requireApp("cms.ColumnManager", "DictionaryExplorer", function(){
  355. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  356. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  357. this.dataConfigurator = new MWF.xApplication.cms.ColumnManager.DictionaryExplorer(this.dataConfiguratorContent, this.restActions);
  358. this.dataConfigurator.app = this;
  359. this.dataConfigurator._createElement();
  360. //}.bind(this));
  361. }.bind(this));
  362. }
  363. },
  364. scriptConfig: function(){
  365. this.clearContent();
  366. this.oContent = new Element("div", {
  367. "styles": this.css.rightContentNode
  368. }).inject(this.node);
  369. this.loadScriptConfig();
  370. },
  371. loadScriptConfig: function(){
  372. MWF.xDesktop.requireApp("cms.ColumnManager", "ScriptExplorer", function(){
  373. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  374. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  375. this.scriptConfigurator = new MWF.xApplication.cms.ColumnManager.ScriptExplorer(this.scriptConfiguratorContent, this.restActions, { "title" : "脚本配置" });
  376. this.scriptConfigurator.app = this;
  377. this.scriptConfigurator.load();
  378. //}.bind(this));
  379. }.bind(this));
  380. },
  381. createScriptConfig : function(){
  382. if( this.scriptConfigurator ){
  383. this.scriptConfigurator._createElement();
  384. }else{
  385. MWF.xDesktop.requireApp("cms.ColumnManager", "ScriptExplorer", function(){
  386. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  387. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  388. this.scriptConfigurator = new MWF.xApplication.cms.ColumnManager.ScriptExplorer(this.scriptConfiguratorContent, this.restActions);
  389. this.scriptConfigurator.app = this;
  390. this.scriptConfigurator._createElement();
  391. //}.bind(this));
  392. }.bind(this));
  393. }
  394. },
  395. viewConfig: function(){
  396. this.clearContent();
  397. this.viewConfiguratorContent = new Element("div", {
  398. "styles": this.css.rightContentNode
  399. }).inject(this.node);
  400. this.loadViewConfig();
  401. },
  402. loadViewConfig: function(){
  403. MWF.xDesktop.requireApp("cms.ColumnManager", "ViewExplorer", function(){
  404. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  405. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  406. this.viewConfigurator = new MWF.xApplication.cms.ColumnManager.ViewExplorer(this.viewConfiguratorContent, this.restActions, { "title" : "列表配置" });
  407. this.viewConfigurator.app = this;
  408. this.viewConfigurator.load();
  409. //}.bind(this));
  410. }.bind(this));
  411. },
  412. createView : function(){
  413. if( this.viewConfigurator ){
  414. this.viewConfigurator._createElement();
  415. }else{
  416. MWF.xDesktop.requireApp("cms.ColumnManager", "ViewExplorer", function(){
  417. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  418. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  419. this.viewConfigurator = new MWF.xApplication.cms.ColumnManager.ViewExplorer(this.viewConfiguratorContent, this.restActions);
  420. this.viewConfigurator.app = this;
  421. this.viewConfigurator._createElement();
  422. //}.bind(this));
  423. }.bind(this));
  424. }
  425. },
  426. queryViewConfig: function(){
  427. this.clearContent();
  428. this.queryViewConfiguratorContent = new Element("div", {
  429. "styles": this.css.rightContentNode
  430. }).inject(this.node);
  431. this.loadQueryViewConfig();
  432. },
  433. loadQueryViewConfig: function(){
  434. MWF.xDesktop.requireApp("cms.ColumnManager", "QueryViewExplorer", function(){
  435. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  436. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  437. this.queryViewConfigurator = new MWF.xApplication.cms.ColumnManager.QueryViewExplorer(this.queryViewConfiguratorContent, this.restActions, { "title" : "数据视图配置" });
  438. this.queryViewConfigurator.app = this;
  439. this.queryViewConfigurator.load();
  440. //}.bind(this));
  441. }.bind(this));
  442. },
  443. createQueryView : function(){
  444. if( this.queryViewConfigurator ){
  445. this.queryViewConfigurator._createElement();
  446. }else{
  447. MWF.xDesktop.requireApp("cms.ColumnManager", "QueryViewExplorer", function(){
  448. //MWF.xDesktop.requireApp("cms.ColumnManager", "Actions.RestActions", function(){
  449. //if (!this.restActions) this.restActions = new MWF.xApplication.cms.ColumnManager.Actions.RestActions();
  450. this.queryViewConfigurator = new MWF.xApplication.cms.ColumnManager.QueryViewExplorer(this.queryViewConfiguratorContent, this.restActions);
  451. this.queryViewConfigurator.app = this;
  452. this.queryViewConfigurator._createElement();
  453. // }.bind(this));
  454. }.bind(this));
  455. }
  456. },
  457. //getCategoryCount: function(){
  458. // var size = this.categoryConfiguratorContent.getSize();
  459. // categoryCount = parseInt(size.x/182)+5;
  460. // return categoryCount;
  461. //},
  462. getCategoryCount: function(){
  463. if (this.categoryConfigurator){
  464. var size = this.categoryConfigurator.categoryNode.getSize();
  465. categoryCount = (parseInt(size.x/401)*parseInt(size.y/101))+10;
  466. return categoryCount;
  467. }
  468. return 20;
  469. },
  470. showContentNode: function(node){
  471. if (this.currentContentNode){
  472. // this.currentContentNode.setStyles({
  473. // "position": "absolute"
  474. // });
  475. this.currentContentNode.fade("hide");
  476. node.fade("show");
  477. node.setStyle("display", "node");
  478. this.currentContentNode = null;
  479. }
  480. node.setStyle("display", "block");
  481. node.fade("show");
  482. this.currentContentNode = node;
  483. },
  484. recordStatus: function(){
  485. var id = null;
  486. var categoryId = "";
  487. if (this.menu.currentNavi){
  488. var naviData = this.menu.currentNavi.retrieve( "naviData" );
  489. id = naviData.id;
  490. }
  491. if( id == "categoryConfig" ){
  492. if( this.categoryConfigurator && this.categoryConfigurator.categoryList ){
  493. var list = this.categoryConfigurator.categoryList;
  494. if( list.currentCategory && list.currentCategory.data ){
  495. categoryId = list.currentCategory.data.id;
  496. }
  497. }
  498. }
  499. return {
  500. "navi": id,
  501. "column": this.options.column.id,
  502. "categoryId" : categoryId
  503. };
  504. }
  505. // onResize: function(){
  506. // if (this.menu) this.menu.onResize();
  507. // }
  508. });
  509. MWF.xApplication.cms.ColumnManager.Menu = new Class({
  510. Implements: [Options, Events],
  511. initialize: function(app, node, options){
  512. this.setOptions(options);
  513. this.app = app;
  514. this.node = $(node);
  515. this.currentNavi = null;
  516. this.status = "start";
  517. this.startNavis = [];
  518. this.itemObject = {};
  519. //this.
  520. this.load();
  521. },
  522. load: function(){
  523. this.areaNode = new Element("div.startMenuAreaNode", this.app.css.startMenuAreaNode).inject( this.node );
  524. MWF.require("MWF.widget.ScrollBar", function(){
  525. new MWF.widget.ScrollBar(this.node, {
  526. "style":"xApp_ProcessManager_StartMenu", "distance": 100, "friction": 4, "axis": {"x": false, "y": true}
  527. });
  528. }.bind(this));
  529. var menuUrl = this.app.path+"startMenu.json";
  530. MWF.getJSON(menuUrl, function(json){
  531. json.each(function(navi){
  532. var naviNode = new Element("div", {
  533. "styles": this.app.css.startMenuNaviNode
  534. });
  535. naviNode.store("naviData", navi);
  536. if( navi.expand ){
  537. var expandNode = new Element("div", {
  538. "styles": this.app.css.startMenuExpandNode
  539. });
  540. expandNode.inject(naviNode);
  541. naviNode.store("expandNode", expandNode );
  542. }else{
  543. new Element("div", {
  544. "styles": this.app.css.startMenuEmptyNode
  545. }).inject(naviNode);
  546. }
  547. var iconNode = new Element("div", {
  548. "styles": this.app.css.startMenuIconNode
  549. }).inject(naviNode);
  550. iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+navi.icon+")");
  551. naviNode.store("iconNode", iconNode );
  552. var textNode = new Element("div", {
  553. "styles": this.app.css.startMenuTextNode,
  554. "text": navi.title
  555. });
  556. textNode.inject(naviNode);
  557. if( navi.create ){
  558. var createNode = new Element("div", {
  559. "styles": this.app.css.startMenuCreateNode,
  560. "title" : "新建"+navi.title
  561. });
  562. createNode.inject(naviNode);
  563. naviNode.store("createNode", createNode );
  564. createNode.addEvents({
  565. "click" : function(ev){
  566. this.obj.app[ this.navi.createAction ]();
  567. ev.stopPropagation();
  568. }.bind( { obj : this, navi : navi } ),
  569. "mouseover" : function(ev){
  570. if( this.obj.currentNavi == this.naviNode && !this.naviData.unselected ){
  571. this.createNode.setStyles( this.obj.app.css.startMenuCreateNode_current_over )
  572. }else{
  573. this.createNode.setStyles( this.obj.app.css.startMenuCreateNode_over )
  574. }
  575. }.bind({ obj : this, createNode : createNode, naviNode : naviNode , naviData : navi}),
  576. "mouseout" : function(ev){
  577. if( this.obj.currentNavi == this.naviNode && !this.naviData.unselected ){
  578. this.createNode.setStyles( this.obj.app.css.startMenuCreateNode_current )
  579. }else{
  580. this.createNode.setStyles( this.obj.app.css.startMenuCreateNode )
  581. }
  582. }.bind({ obj : this, createNode : createNode, naviNode : naviNode, naviData : navi })
  583. })
  584. }
  585. naviNode.inject(this.areaNode);
  586. if( navi.expand ){
  587. var subNode = new Element("div", {
  588. "styles": this.app.css.startMenuSubContentNode
  589. });
  590. subNode.inject(this.areaNode);
  591. naviNode.store("subNode", subNode );
  592. }
  593. this.startNavis.push(naviNode);
  594. this.itemObject[ navi.id ] = naviNode;
  595. this.setStartNaviEvent(naviNode, navi);
  596. //this.setNodeCenter(this.node);
  597. }.bind(this));
  598. //this.setStartMenuWidth();
  599. this.setContentSize();
  600. this.app.addEvent("resize", this.setContentSize.bind(this));
  601. this.fireEvent("postLoad");
  602. }.bind(this));
  603. },
  604. setStartNaviEvent: function(naviNode){
  605. var _self = this;
  606. naviNode.addEvents({
  607. "mouseover": function(){ if (_self.currentNavi!=this) this.setStyles(_self.app.css.startMenuNaviNode_over);},
  608. "mouseout": function(){if (_self.currentNavi!=this) this.setStyles(_self.app.css.startMenuNaviNode);},
  609. "mousedown": function(){if (_self.currentNavi!=this) this.setStyles(_self.app.css.startMenuNaviNode_down);},
  610. "mouseup": function(){if (_self.currentNavi!=this) this.setStyles(_self.app.css.startMenuNaviNode_over);},
  611. "click": function(){
  612. //if (_self.currentNavi!=this) _self.doAction.apply(_self, [this]);
  613. _self.doAction.apply(_self, [this]);
  614. }
  615. });
  616. },
  617. expend : function( naviNode ){
  618. var isExpand = naviNode.retrieve("isExpand");
  619. if( !isExpand ){
  620. var expandNode = naviNode.retrieve("expandNode");
  621. expandNode.setStyles(this.app.css.startMenuCollapseNode);
  622. var subNode = naviNode.retrieve("subNode");
  623. subNode.setStyle( "display" , "" );
  624. naviNode.store("isExpand",true);
  625. }
  626. },
  627. collapse : function( naviNode ){
  628. var isExpand = naviNode.retrieve("isExpand");
  629. if( isExpand ){
  630. var expandNode = naviNode.retrieve("expandNode");
  631. expandNode.setStyles(this.app.css.startMenuExpandNode);
  632. var subNode = naviNode.retrieve("subNode");
  633. subNode.setStyle( "display" , "none" );
  634. naviNode.store("isExpand",false);
  635. }
  636. },
  637. cancelCurrentNavi: function(){
  638. if( this.currentNavi ){
  639. this.currentNavi.setStyles(this.app.css.startMenuNaviNode);
  640. var iconNode = this.currentNavi.retrieve("iconNode");
  641. var navi = this.currentNavi.retrieve("naviData");
  642. iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+navi.icon+")");
  643. }
  644. },
  645. doAction: function( naviNode ){
  646. if( this.currentNavi && this.currentNavi == naviNode ){
  647. var navi = this.currentNavi.retrieve("naviData");
  648. if( navi.expand ){
  649. var isExpand = this.currentNavi.retrieve("isExpand");
  650. if( isExpand ){
  651. var expandNode = this.currentNavi.retrieve("expandNode");
  652. expandNode.setStyles(this.app.css.startMenuExpandNode);
  653. var subNode = this.currentNavi.retrieve("subNode");
  654. subNode.setStyle( "display" , "none" );
  655. this.currentNavi.store("isExpand",false);
  656. }else{
  657. var expandNode = this.currentNavi.retrieve("expandNode");
  658. expandNode.setStyles(this.app.css.startMenuCollapseNode);
  659. var subNode = this.currentNavi.retrieve("subNode");
  660. subNode.setStyle( "display" , "" );
  661. this.currentNavi.store("isExpand",true);
  662. }
  663. }
  664. return;
  665. }
  666. if (this.currentNavi){
  667. this.currentNavi.setStyles(this.app.css.startMenuNaviNode);
  668. var iconNode = this.currentNavi.retrieve("iconNode");
  669. var navi = this.currentNavi.retrieve("naviData");
  670. iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+navi.icon+")");
  671. if( navi.expand ){
  672. var expandNode = this.currentNavi.retrieve("expandNode");
  673. expandNode.setStyles(this.app.css.startMenuExpandNode);
  674. var subNode = this.currentNavi.retrieve("subNode");
  675. subNode.setStyle( "display" , "none" );
  676. this.currentNavi.store("isExpand",false);
  677. }
  678. if( navi.create ){
  679. var createNode = this.currentNavi.retrieve("createNode");
  680. createNode.setStyles(this.app.css.startMenuCreateNode);
  681. }
  682. }
  683. if( naviNode ){
  684. var navi = naviNode.retrieve("naviData");
  685. var action = navi.action;
  686. if( !navi.unselected ){
  687. naviNode.setStyles(this.app.css.startMenuNaviNode_current);
  688. var iconNode = naviNode.retrieve("iconNode");
  689. iconNode.setStyle("background-image", "url("+this.app.path+this.app.options.style+"/icon/"+navi.selectedIcon+")");
  690. }
  691. if( navi.expand ){
  692. if( !navi.unselected ){
  693. var expandNode = naviNode.retrieve("expandNode");
  694. expandNode.setStyles(this.app.css.startMenuCollapseNode_current);
  695. }else{
  696. var expandNode = naviNode.retrieve("expandNode");
  697. expandNode.setStyles(this.app.css.startMenuCollapseNode );
  698. }
  699. var subNode = naviNode.retrieve("subNode");
  700. subNode.setStyle( "display" , "" );
  701. naviNode.store("isExpand",true);
  702. }
  703. if( navi.create ){
  704. var createNode = naviNode.retrieve("createNode");
  705. if( !navi.unselected ){
  706. createNode.setStyles(this.app.css.startMenuCreateNode_current);
  707. }else{
  708. createNode.setStyles(this.app.css.startMenuCreateNode);
  709. }
  710. }
  711. if (this.app[action]) this.app[action].apply( this.app );
  712. }
  713. this.currentNavi = naviNode;
  714. },
  715. setContentSize : function(){
  716. var size = this.app.content.getSize();
  717. this.node.setStyle("height", size.y - 82);
  718. }
  719. });
  720. MWF.xApplication.cms.ColumnManager.ApplicationProperty = new Class({
  721. initialize: function(app, node){
  722. this.app = app;
  723. this.node = $(node);
  724. this.data = this.app.options.application;
  725. this.controllerData = [];
  726. this.controllerList = [];
  727. },
  728. load: function(){
  729. this.propertyTitleBar = new Element("div.propertyTitleBar", {
  730. "styles": this.app.css.propertyTitleBar,
  731. "text": "栏目属性" //this.data.name || this.data.appName
  732. }).inject(this.node);
  733. this.contentNode = new Element("div.propertyContentNode", {
  734. "styles": this.app.css.propertyContentNode
  735. }).inject(this.node);
  736. this.contentAreaNode = new Element("div.propertyContentAreaNode", {
  737. "styles": this.app.css.propertyContentAreaNode
  738. }).inject(this.contentNode);
  739. this.setContentHeight();
  740. this.setContentHeightFun = this.setContentHeight.bind(this);
  741. this.app.addEvent("resize", this.setContentHeightFun);
  742. MWF.require("MWF.widget.ScrollBar", function(){
  743. new MWF.widget.ScrollBar(this.contentNode, {"indent": false});
  744. }.bind(this));
  745. this.baseActionAreaNode = new Element("div.baseActionAreaNode", {
  746. "styles": this.app.css.baseActionAreaNode
  747. }).inject(this.contentAreaNode);
  748. this.baseActionNode = new Element("div.propertyInforActionNode", {
  749. "styles": this.app.css.propertyInforActionNode
  750. }).inject(this.baseActionAreaNode);
  751. this.baseTextNode = new Element("div.baseTextNode", {
  752. "styles": this.app.css.baseTextNode,
  753. "text": this.app.lp.application.property
  754. }).inject(this.baseActionAreaNode);
  755. this.createEditBaseNode();
  756. this.createPropertyContentNode();
  757. this.createIconContentNode();
  758. this.viewerContainer = new Element( "div").inject( this.contentAreaNode );
  759. MWF.xDesktop.requireApp("cms.ColumnManager", "widget.ColumnViewerSetting", null, false);
  760. this.viewerSetting = new MWF.xApplication.cms.ColumnManager.ColumnViewerSetting( this.app,
  761. this.app.lp.application.viewerSetting, this.viewerContainer, {
  762. objectId : this.data.id
  763. }
  764. );
  765. this.viewerSetting.dataParent = this;
  766. this.viewerSetting.load();
  767. this.publisherContainer = new Element( "div").inject( this.contentAreaNode );
  768. MWF.xDesktop.requireApp("cms.ColumnManager", "widget.ColumnPublisherSetting", null, false);
  769. this.publisherSetting = new MWF.xApplication.cms.ColumnManager.ColumnPublisherSetting( this.app,
  770. this.app.lp.application.publisherSetting, this.publisherContainer, {
  771. objectId : this.data.id
  772. }
  773. );
  774. this.publisherSetting.dataParent = this;
  775. this.publisherSetting.load();
  776. this.managerContainer = new Element( "div").inject( this.contentAreaNode );
  777. MWF.xDesktop.requireApp("cms.ColumnManager", "widget.ColumnManagerSetting", null, false);
  778. this.viewerSetting = new MWF.xApplication.cms.ColumnManager.ColumnManagerSetting( this.app,
  779. this.app.lp.application.managerSetting, this.managerContainer, {
  780. objectId : this.data.id
  781. }
  782. );
  783. this.viewerSetting.dataParent = this;
  784. this.viewerSetting.load();
  785. },
  786. setContentHeight: function(){
  787. var size = this.app.content.getSize();
  788. var titleSize = this.propertyTitleBar.getSize();
  789. var y = size.y-titleSize.y;
  790. this.contentNode.setStyle("height", ""+y+"px");
  791. },
  792. createIconContentNode: function(){
  793. this.iconContentTitleNode = new Element("div.iconContentTitleNode", {
  794. "styles": this.app.css.iconContentTitleNode,
  795. "text": this.app.lp.application.icon
  796. }).inject(this.contentAreaNode);
  797. this.iconContentNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentAreaNode);
  798. var html = "<table cellspacing='0' cellpadding='0' border='0' width='95%' align='center' style='margin-top: 20px'>";
  799. html += "<tr><td class='formTitle'><div id='formIconPreview'></div></td><td id='formChangeIconAction'></td></tr>";
  800. html += "</table>";
  801. this.iconContentNode.set("html", html);
  802. this.iconContentNode.getElements("td.formTitle").setStyles(this.app.css.propertyBaseContentTdTitle);
  803. this.iconPreviewNode = this.iconContentNode.getElement("div#formIconPreview");
  804. this.iconActionNode = this.iconContentNode.getElement("td#formChangeIconAction");
  805. this.iconPreviewNode.setStyles({
  806. "height": "72px",
  807. "width": "72px",
  808. "float": "right"
  809. });
  810. var icon = this.data.icon || this.data.appIcon;
  811. if (icon){
  812. this.iconPreviewNode.setStyle("background", "url(data:image/png;base64,"+icon+") center center no-repeat");
  813. }else{
  814. this.iconPreviewNode.setStyle("background", "url("+"/x_component_cms_Column/$Main/default/icon/column.png) center center no-repeat")
  815. }
  816. var changeIconAction = new Element("div", {
  817. "styles": this.app.css.selectButtonStyle,
  818. "text": "更改图标"
  819. }).inject(this.iconActionNode);
  820. changeIconAction.addEvent("click", function(){
  821. this.changeIcon();
  822. }.bind(this));
  823. },
  824. changeIcon: function(){
  825. if (!this.uploadFileAreaNode){
  826. this.uploadFileAreaNode = new Element("div");
  827. var html = "<input name=\"file\" type=\"file\"/>";
  828. this.uploadFileAreaNode.set("html", html);
  829. this.fileUploadNode = this.uploadFileAreaNode.getFirst();
  830. this.fileUploadNode.addEvent("change", function(){
  831. var files = fileNode.files;
  832. if (files.length){
  833. for (var i = 0; i < files.length; i++) {
  834. var file = files.item(i);
  835. var formData = new FormData();
  836. formData.append('file', file);
  837. //formData.append('name', file.name);
  838. //formData.append('folder', folderId);
  839. this.app.restActions.updataColumnIcon(this.data.id ,function(){
  840. this.app.restActions.getColumn(this.data.id, function(json){
  841. if (json.data){
  842. this.data = json.data;
  843. if (this.data.appIcon){
  844. this.iconPreviewNode.setStyle("background", "url(data:image/png;base64,"+this.data.appIcon+") center center no-repeat");
  845. }else{
  846. this.iconPreviewNode.setStyle("background", "url("+"/x_component_cms_Column/$Main/default/icon/category2.png) center center no-repeat")
  847. }
  848. }
  849. }.bind(this), false)
  850. }.bind(this), null, formData, file);
  851. }
  852. }
  853. }.bind(this));
  854. }
  855. var fileNode = this.uploadFileAreaNode.getFirst();
  856. fileNode.click();
  857. },
  858. createPropertyContentNode: function(){
  859. this.propertyContentNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentAreaNode);
  860. var html = "<table cellspacing='0' cellpadding='0' border='0' width='95%' align='center' style='margin-top: 20px'>";
  861. html += "<tr><td class='formTitle'>"+this.app.lp.application.id +"</td><td id='formApplicationId' class='formValue'>"+this.data.id+"</td></tr>";
  862. html += "<tr><td class='formTitle'>"+this.app.lp.application.name+"</td><td id='formApplicationName'></td></tr>";
  863. html += "<tr><td class='formTitle'>"+this.app.lp.application.sign+"</td><td id='formApplicationAlias' class='formValue'>"+(this.data.alias||this.data.appAlias||'')+"</td></tr>";
  864. html += "<tr><td class='formTitle'>"+this.app.lp.application.documentType+"</td><td id='formApplicationType' class='formValue'>"+(this.data.documentType || "信息" )+"</td></tr>";
  865. html += "<tr><td class='formTitle'>"+this.app.lp.application.description+"</td><td id='formApplicationDescription'></td></tr>";
  866. html += "<tr><td class='formTitle'>"+this.app.lp.application.sort+"</td><td id='formApplicationSort'></td></tr>";
  867. // html += "<tr><td class='formTitle'>"+this.app.lp.application.type+"</td><td id='formApplicationType'></td></tr>";
  868. // html += "<tr><td class='formTitle'>"+this.app.lp.application.icon+"</td><td id='formApplicationIcon'></td></tr>";
  869. html += "</table>";
  870. this.propertyContentNode.set("html", html);
  871. this.propertyContentNode.getElements("td.formTitle").setStyles(this.app.css.propertyBaseContentTdTitle);
  872. this.propertyContentNode.getElements("td.formValue").setStyles(this.app.css.propertyBaseContentTdValue);
  873. this.nameInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationName"), this.data.name || this.data.appName, this.app.css.formInput);
  874. //this.aliasInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationAlias"), this.data.alias, this.app.css.formInput);
  875. this.typeSelect = new MDomItem( this.propertyContentNode.getElement("#formApplicationType"), {
  876. type : "select",
  877. value : this.data.documentType || "信息",
  878. selectValue : [ "信息", "数据" ]
  879. });
  880. this.descriptionInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationDescription"), this.data.description, this.app.css.formInput);
  881. this.sortInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationSort"), this.data.appInfoSeq, this.app.css.formInput);
  882. //this.typeInput = new MWF.xApplication.cms.ColumnManager.Input(this.propertyContentNode.getElement("#formApplicationType"), this.data.applicationCategory, this.app.css.formInput);
  883. },
  884. createEditBaseNode: function(){
  885. this.editBaseNode = new Element("button.editBaseNode", {
  886. "styles": this.app.css.editBaseNode,
  887. "text": this.app.lp.edit,
  888. "events": {"click": this.editBaseInfor.bind(this)}
  889. }).inject(this.baseActionNode);
  890. },
  891. createCancelBaseNode: function(){
  892. this.cancelBaseNode = new Element("button.cancelBaseNode", {
  893. "styles": this.app.css.cancelBaseNode,
  894. "text": this.app.lp.cancel,
  895. "events": {"click": this.cancelBaseInfor.bind(this)}
  896. }).inject(this.baseActionNode);
  897. },
  898. createSaveBaseNode: function(){
  899. this.saveBaseNode = new Element("button.saveBaseNode", {
  900. "styles": this.app.css.saveBaseNode,
  901. "text": this.app.lp.save,
  902. "events": {"click": this.saveBaseInfor.bind(this)}
  903. }).inject(this.baseActionNode);
  904. },
  905. editBaseInfor: function(){
  906. this.baseActionNode.empty();
  907. this.editBaseNode = null;
  908. this.createCancelBaseNode();
  909. this.createSaveBaseNode();
  910. this.editMode();
  911. },
  912. editMode: function(){
  913. this.nameInput.editMode();
  914. //this.aliasInput.editMode();
  915. this.descriptionInput.editMode();
  916. this.sortInput.editMode();
  917. this.typeSelect.editMode();
  918. //this.typeInput.editMode();
  919. this.isEdit = true;
  920. },
  921. readMode: function(){
  922. this.nameInput.readMode();
  923. //this.aliasInput.readMode();
  924. this.descriptionInput.readMode();
  925. this.sortInput.readMode();
  926. this.typeSelect.readMode();
  927. //this.typeInput.readMode();
  928. this.isEdit = false;
  929. },
  930. cancelBaseInfor: function(){
  931. if (this.data.name || this.data.appName || this.data.id ){
  932. this.baseActionNode.empty();
  933. this.cancelBaseNode = null;
  934. this.saveBaseNode = null;
  935. this.createEditBaseNode();
  936. this.readMode();
  937. }else{
  938. this.destroy();
  939. }
  940. },
  941. saveBaseInfor: function(){
  942. if (!this.nameInput.input.get("value")){
  943. this.app.notice(this.app.lp.application.inputApplicationName, "error", this.node);
  944. return false;
  945. }
  946. //this.node.mask({
  947. // "style": {
  948. // "opacity": 0.7,
  949. // "background-color": "#999"
  950. // }
  951. //});
  952. this.save(function(){
  953. this.baseActionNode.empty();
  954. this.cancelBaseNode = null;
  955. this.saveBaseNode = null;
  956. this.createEditBaseNode();
  957. this.readMode();
  958. //this.node.unmask();
  959. }.bind(this), function(xhr, text, error){
  960. var errorText = error;
  961. if (xhr) errorText = xhr.responseText;
  962. this.app.notice("request json error: "+errorText, "error");
  963. //this.node.unmask();
  964. }.bind(this));
  965. },
  966. save: function(callback, cancel){
  967. this.data.name = this.nameInput.input.get("value");
  968. this.data.appName = this.data.name;
  969. //this.data.alias = this.aliasInput.input.get("value");
  970. //this.data.appAlias = this.data.alias;
  971. this.data.description = this.descriptionInput.input.get("value");
  972. this.data.appInfoSeq = this.sortInput.input.get("value");
  973. this.data.documentType = this.typeSelect.getValue();
  974. //this.data.applicationCategory = this.typeInput.input.get("value");
  975. this.app.restActions.saveColumn(this.data, function(json){
  976. this.propertyTitleBar.set("text", this.data.name);
  977. this.data.id = json.data.id;
  978. this.nameInput.save();
  979. //this.aliasInput.save();
  980. this.descriptionInput.save();
  981. this.sortInput.save();
  982. this.typeSelect.save();
  983. //this.typeInput.save();
  984. this.app.notice( this.app.lp.application.saveSuccess, "success");
  985. if (callback) callback();
  986. }.bind(this), function(xhr, text, error){
  987. if (cancel) cancel(xhr, text, error);
  988. }.bind(this));
  989. }
  990. });
  991. MWF.xApplication.cms.ColumnManager.Input = new Class({
  992. Implements: [Events],
  993. initialize: function(node, value, style){
  994. this.node = $(node);
  995. this.value = value || "";
  996. this.style = style;
  997. this.load();
  998. },
  999. load: function(){
  1000. this.content = new Element("div", {
  1001. "styles": this.style.content,
  1002. "text": this.value
  1003. }).inject(this.node);
  1004. },
  1005. editMode: function(){
  1006. this.content.empty();
  1007. this.input = new Element("input",{
  1008. "styles": this.style.input,
  1009. "value": this.value
  1010. }).inject(this.content);
  1011. this.input.addEvents({
  1012. "focus": function(){
  1013. this.input.setStyles(this.style.input_focus);
  1014. }.bind(this),
  1015. "blur": function(){
  1016. this.input.setStyles(this.style.input);
  1017. }.bind(this)
  1018. });
  1019. },
  1020. readMode: function(){
  1021. this.content.empty();
  1022. this.input = null;
  1023. this.content.set("text", this.value);
  1024. },
  1025. save: function(){
  1026. if (this.input) this.value = this.input.get("value");
  1027. return this.value;
  1028. }
  1029. });
  1030. //MWF.xDesktop.requireApp("Template", "MTooltips", null, false);
  1031. //MWF.xApplication.cms.ColumnManager.TypeTooltip = new Class({
  1032. // Extends: MTooltips,
  1033. // _loadCustom : function( callback ){
  1034. // if(callback)callback();
  1035. // },
  1036. // _getHtml : function(){
  1037. // var data = this.data;
  1038. // var titleStyle = "font-size:12px;color:#333";
  1039. // var valueStyle = "font-size:12px;color:#666;padding-right:20px";
  1040. //
  1041. // var html =
  1042. // "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' style='margin:13px 13px 13px 13px;'>" +
  1043. // "<tr><td style='"+valueStyle+";' width='70'>"+"栏目类型设置为“数据存储”时,将不在信息中心中展现。"+":</td>" +
  1044. // " </tr>" +
  1045. // "</table>";
  1046. // return html;
  1047. // }
  1048. //});