Main.js 49 KB

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