SettingExplorer.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. MWF.xApplication.Execution = MWF.xApplication.Execution || {};
  2. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  3. MWF.require("MWF.widget.Identity", null,false);
  4. MWF.xApplication.Execution.SettingExplorer = new Class({
  5. Extends: MWF.widget.Common,
  6. Implements: [Options, Events],
  7. options: {
  8. "style": "default"
  9. },
  10. initialize: function (node, app, actions, options) {
  11. this.setOptions(options);
  12. this.app = app;
  13. this.lp = app.lp;
  14. this.path = "/x_component_Execution/$SettingExplorer/";
  15. this.loadCss();
  16. this.actions = actions;
  17. this.node = $(node);
  18. },
  19. loadCss: function () {
  20. this.cssPath = "/x_component_Execution/$SettingExplorer/" + this.options.style + "/css.wcss";
  21. this._loadCss();
  22. },
  23. load: function () {
  24. this.middleContent = this.app.middleContent;
  25. //this.middleContent.setStyles({"margin-top":"0px","border":"0px solid #f00"});
  26. this.createNaviContent();
  27. this.createContentDiv();
  28. this.resizeWindow();
  29. this.app.addEvent("resize", function(){
  30. this.resizeWindow();
  31. }.bind(this));
  32. },
  33. resizeWindow: function(){
  34. var size = this.app.middleContent.getSize();
  35. this.naviDiv.setStyles({"height":(size.y-40)+"px"});
  36. this.naviContentDiv.setStyles({"height":(size.y-180)+"px"});
  37. this.contentDiv.setStyles({"height":(size.y-40)+"px"});
  38. },
  39. createNaviContent: function(){
  40. this.naviDiv = new Element("div.naviDiv",{
  41. "styles":this.css.naviDiv
  42. }).inject(this.middleContent);
  43. this.naviTitleDiv = new Element("div.naviTitleDiv",{
  44. "styles":this.css.naviTitleDiv,
  45. "text": this.lp.systemSetting
  46. }).inject(this.naviDiv);
  47. this.naviContentDiv = new Element("div.naviContentDiv",{"styles":this.css.naviContentDiv}).inject(this.naviDiv);
  48. this.naviBottomDiv = new Element("div.naviBottomDiv",{"styles":this.css.naviBottomDiv}).inject(this.naviDiv);
  49. var jsonUrl = this.path+"navi.json";
  50. MWF.getJSON(jsonUrl, function(json){
  51. json.each(function(data, i){
  52. var naviContentLi = new Element("li.naviContentLi",{"styles":this.css.naviContentLi}).inject(this.naviContentDiv);
  53. naviContentLi.addEvents({
  54. "mouseover" : function(ev){
  55. if(this.bindObj.currentNaviItem != this.node)this.node.setStyles( this.styles )
  56. }.bind({"styles": this.css.naviContentLi_over, "node":naviContentLi, "bindObj": this }) ,
  57. "mouseout" : function(ev){
  58. if(this.bindObj.currentNaviItem != this.node)this.node.setStyles( this.styles )
  59. }.bind({"styles": this.css.naviContentLi, "node":naviContentLi, "bindObj": this }) ,
  60. "click" : function(ev){
  61. if( this.bindObj.currentNaviItem )this.bindObj.currentNaviItem.setStyles( this.bindObj.css.naviContentLi );
  62. this.node.setStyles( this.styles );
  63. this.bindObj.currentNaviItem = this.node;
  64. if( this.action && this.bindObj[this.action] )this.bindObj[this.action]();
  65. }.bind({"styles": this.css.naviContentLi_current, "node":naviContentLi, "bindObj": this, "action" : data.action }) ,
  66. })
  67. var naviContentImg = new Element("img.naviContentImg",{
  68. "styles":this.css.naviContentImg,
  69. "src":"/x_component_Execution/$Main/"+this.options.style+"/icon/"+data.icon
  70. }).inject(naviContentLi);
  71. var naviContentSpan = new Element("span.naviContentSpan",{
  72. "styles":this.css.naviContentSpan,
  73. "text":data.title
  74. }).inject(naviContentLi);
  75. if( i == 0 )naviContentLi.click();
  76. }.bind(this));
  77. }.bind(this));
  78. },
  79. createContentDiv: function(){
  80. this.contentDiv = new Element("div.contentDiv",{"styles":this.css.contentDiv}).inject(this.middleContent);
  81. },
  82. openSystemConfig: function(){
  83. if( this.contentDiv )this.contentDiv.empty();
  84. if( this.explorer ){
  85. this.explorer.destroy();
  86. delete this.explorer;
  87. }
  88. this.explorer = new MWF.xApplication.Execution.SettingExplorer.SystemConfigExplorer(this.contentDiv, this.app, this,{style:this.options.style});
  89. this.explorer.load();
  90. },
  91. openSecretarySetting: function(){
  92. if( this.contentDiv )this.contentDiv.empty();
  93. if( this.explorer ){
  94. this.explorer.destroy();
  95. delete this.explorer;
  96. }
  97. this.explorer = new MWF.xApplication.Execution.SettingExplorer.SecretarySettingExplorer(this.contentDiv, this.app, this,{style:this.options.style});
  98. this.explorer.load();
  99. },
  100. openCategorySetting: function(){
  101. if( this.contentDiv )this.contentDiv.empty();
  102. if( this.explorer ){
  103. this.explorer.destroy();
  104. delete this.explorer;
  105. }
  106. this.explorer = new MWF.xApplication.Execution.SettingExplorer.CategorySettingExplorer(this.contentDiv, this.app, this,{style:this.options.style});
  107. this.explorer.load();
  108. }
  109. })
  110. MWF.xApplication.Execution.SettingExplorer.SystemConfigExplorer = new Class({
  111. Extends: MWF.widget.Common,
  112. Implements: [Options, Events],
  113. options: {
  114. "style": "default",
  115. },
  116. initialize: function (container, app, parent, options) {
  117. this.container = container;
  118. this.parent = parent;
  119. this.app = app;
  120. this.css = this.parent.css;
  121. this.lp = this.app.lp;
  122. },
  123. load: function () {
  124. this.container.empty();
  125. //this.loadToolbar();
  126. this.loadView();
  127. },
  128. destroy : function(){
  129. if(this.resizeWindowFun)this.app.removeEvent("resize",this.resizeWindowFun)
  130. this.view.destroy();
  131. },
  132. loadToolbar: function(){
  133. this.toolbar = new Element("div",{
  134. styles : this.css.toolbar
  135. }).inject(this.container)
  136. this.createActionNode = new Element("div",{
  137. styles : this.css.toolbarActionNode,
  138. text: this.lp.createConfig
  139. }).inject(this.toolbar);
  140. this.createActionNode.addEvent("click",function(){
  141. var form = new MWF.xApplication.Execution.SettingExplorer.SystemConfigForm(this, {}, {
  142. onPostOk : function(){
  143. this.view.reload();
  144. }.bind(this)})
  145. form.create();
  146. }.bind(this))
  147. this.fileterNode = new Element("div",{
  148. styles : this.css.fileterNode
  149. }).inject(this.toolbar);
  150. },
  151. loadView : function(){
  152. this.viewContainer = Element("div",{
  153. "styles" : this.css.viewContainer
  154. }).inject(this.container);
  155. this.resizeWindow();
  156. this.resizeWindowFun = this.resizeWindow.bind(this)
  157. this.app.addEvent("resize", this.resizeWindowFun );
  158. this.view = new MWF.xApplication.Execution.SettingExplorer.SystemConfigView( this.viewContainer, this.app, this, {
  159. templateUrl : this.parent.path+"listItem_config.json",
  160. scrollEnable : true
  161. } )
  162. this.view.load();
  163. },
  164. resizeWindow: function(){
  165. var size = this.app.content.getSize();
  166. this.viewContainer.setStyles({"height":(size.y-65)+"px"});
  167. }
  168. })
  169. MWF.xApplication.Execution.SettingExplorer.SystemConfigView = new Class({
  170. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  171. _createDocument: function(data){
  172. return new MWF.xApplication.Execution.SettingExplorer.SystemConfigDocument(this.viewNode, data, this.explorer, this);
  173. },
  174. _getCurrentPageData: function(callback, count){
  175. if (!count)count = 20;
  176. //var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  177. //var filter = this.filterData || {};
  178. this.actions.listConfigAll( function (json) {
  179. if (callback)callback(json);
  180. }.bind(this))
  181. },
  182. _removeDocument: function(documentData, all){
  183. this.actions.deleteConfig(documentData.id, function(json){
  184. this.reload();
  185. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  186. }.bind(this));
  187. },
  188. _create: function(){
  189. },
  190. _openDocument: function( documentData ){
  191. var form = new MWF.xApplication.Execution.SettingExplorer.SystemConfigForm(this, documentData, {
  192. onPostOk : function(){
  193. this.reload();
  194. }.bind(this)
  195. })
  196. form.edit();
  197. },
  198. _queryCreateViewNode: function(){
  199. },
  200. _postCreateViewNode: function( viewNode ){
  201. },
  202. _queryCreateViewHead:function(){
  203. },
  204. _postCreateViewHead: function( headNode ){
  205. }
  206. })
  207. MWF.xApplication.Execution.SettingExplorer.SystemConfigDocument = new Class({
  208. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  209. _queryCreateDocumentNode:function( itemData ){
  210. },
  211. _postCreateDocumentNode: function( itemNode, itemData ){
  212. }
  213. })
  214. MWF.xApplication.Execution.SettingExplorer.SystemConfigForm = new Class({
  215. Extends: MWF.xApplication.Template.Explorer.PopupForm,
  216. Implements: [Options, Events],
  217. options: {
  218. "style": "default",
  219. "width": "600",
  220. "height": "290",
  221. "hasTop": true,
  222. "hasIcon": false,
  223. "hasTopIcon" : true,
  224. "hasTopContent" : true,
  225. "hasBottom": true,
  226. "title": MWF.xApplication.Execution.LP.categoryFormTitle,
  227. "draggable": true,
  228. "closeAction": true
  229. },
  230. _createTableContent: function () {
  231. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
  232. "<tr><td styles='formTableTitle' lable='configName' width='20%'></td>" +
  233. " <td styles='formTableValue' item='configName' width='80%'></td></tr>" +
  234. "<tr><td styles='formTableTitle' lable='configValue'></td>" +
  235. " <td styles='formTableValue' item='configValue'></td></tr>" +
  236. "<tr><td styles='formTableTitle' lable='orderNumber'></td>" +
  237. " <td styles='formTableValue' item='orderNumber'></td></tr>" +
  238. "<tr><td styles='formTableTitle' lable='description'></td>" +
  239. " <td styles='formTableValue' item='description'></td></tr>" +
  240. "</table>"
  241. this.formTableArea.set("html", html);
  242. var configValueSetting = {text: this.lp.configValue };
  243. //alert(JSON.stringify(this.data))
  244. //alert(this.data.valueType)
  245. //if( this.data.configCode == "REPORT_WORKFLOW_TYPE" ){
  246. // configValueSetting.type = "select";
  247. // configValueSetting.selectValue = ["ADMIN_AND_ALLLEADER","DEPLOYER"];
  248. //}else if( this.data.configCode == "REPORT_SUPERVISOR" ){
  249. // configValueSetting.tType = "identity";
  250. // configValueSetting.count = 1;
  251. //}else if( this.data.configCode == "REPORT_AUDIT_LEADER" ){
  252. // configValueSetting.tType = "identity";
  253. // configValueSetting.count = 0;
  254. //}else if( this.data.configCode == "COMPANY_WORK_ADMIN" ){
  255. // configValueSetting.tType = "identity";
  256. // configValueSetting.count = 0;
  257. //}else if( this.data.configCode == "ARCHIVEMANAGER" ){
  258. // configValueSetting.tType = "identity";
  259. // configValueSetting.count = 0;
  260. //}else if( this.data.configCode == "REPORT_AUDIT_LEVEL" ){
  261. // configValueSetting.tType = "number";
  262. //}
  263. configValueSetting.tType = this.data.valueType
  264. if(configValueSetting.tType=="select"){
  265. configValueSetting.type = "select"
  266. configValueSetting.selectValue = this.data.selectContent.split("|")
  267. }else if(configValueSetting.tType=="identity"){
  268. if(this.data.isMultiple){
  269. configValueSetting.count = 0
  270. }
  271. }else{
  272. }
  273. MWF.xDesktop.requireApp("Template", "MForm", function () {
  274. this.form = new MForm(this.formTableArea, this.data, {
  275. style: "execution",
  276. isEdited: this.isEdited || this.isNew,
  277. itemTemplate: {
  278. configName: {text: this.lp.configName, type : "innerText" },
  279. configValue : configValueSetting,
  280. orderNumber: {text: this.lp.orderNumber, type : "innerText" },
  281. description: {text: this.lp.description, type : "innerText" }
  282. }
  283. }, this.app);
  284. this.form.load();
  285. }.bind(this), true);
  286. },
  287. _ok: function (data, callback) {
  288. this.app.restActions.saveConfig( data, function(json){
  289. if( callback )callback(json);
  290. this.fireEvent("postOk")
  291. }.bind(this));
  292. }
  293. });
  294. MWF.xApplication.Execution.SettingExplorer.SecretarySettingExplorer = new Class({
  295. Extends: MWF.widget.Common,
  296. Implements: [Options, Events],
  297. options: {
  298. "style": "default",
  299. },
  300. initialize: function (container, app, parent, options) {
  301. this.container = container;
  302. this.parent = parent;
  303. this.app = app;
  304. this.css = this.parent.css;
  305. this.lp = this.app.lp;
  306. },
  307. load: function () {
  308. this.container.empty();
  309. this.loadToolbar();
  310. this.loadView();
  311. },
  312. destroy : function(){
  313. if(this.resizeWindowFun)this.app.removeEvent("resize",this.resizeWindowFun)
  314. this.view.destroy();
  315. },
  316. loadToolbar: function(){
  317. this.toolbar = new Element("div",{
  318. styles : this.css.toolbar
  319. }).inject(this.container)
  320. this.createActionNode = new Element("div",{
  321. styles : this.css.toolbarActionNode,
  322. text: this.lp.createSecretary
  323. }).inject(this.toolbar);
  324. this.createActionNode.addEvent("click",function(){
  325. var form = new MWF.xApplication.Execution.SettingExplorer.SecretarySettingForm(this, {}, {
  326. onPostOk : function(){
  327. this.view.reload();
  328. }.bind(this)})
  329. form.create();
  330. }.bind(this))
  331. this.fileterNode = new Element("div",{
  332. styles : this.css.fileterNode
  333. }).inject(this.toolbar);
  334. },
  335. loadView : function(){
  336. this.viewContainer = Element("div",{
  337. "styles" : this.css.viewContainer
  338. }).inject(this.container);
  339. this.resizeWindow();
  340. this.resizeWindowFun = this.resizeWindow.bind(this)
  341. this.app.addEvent("resize", this.resizeWindowFun );
  342. this.view = new MWF.xApplication.Execution.SettingExplorer.SecretarySettingView( this.viewContainer, this.app, this, {
  343. templateUrl : this.parent.path+"listItem_secretary.json",
  344. scrollEnable : true
  345. } )
  346. this.view.load();
  347. },
  348. resizeWindow: function(){
  349. var size = this.app.content.getSize();
  350. this.viewContainer.setStyles({"height":(size.y-121)+"px"});
  351. }
  352. })
  353. MWF.xApplication.Execution.SettingExplorer.SecretarySettingView = new Class({
  354. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  355. _createDocument: function(data){
  356. return new MWF.xApplication.Execution.SettingExplorer.SecretarySettingDocument(this.viewNode, data, this.explorer, this);
  357. },
  358. _getCurrentPageData: function(callback, count){
  359. if (!count)count = 20;
  360. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  361. var filter = this.filterData || {};
  362. this.actions.listSecretaryNext(id, count, filter, function (json) {
  363. if (callback)callback(json);
  364. }.bind(this))
  365. },
  366. _removeDocument: function(documentData, all){
  367. this.actions.deleteSecretary(documentData.id, function(json){
  368. this.reload();
  369. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  370. }.bind(this));
  371. },
  372. _create: function(){
  373. },
  374. _openDocument: function( documentData ){
  375. var form = new MWF.xApplication.Execution.SettingExplorer.SecretarySettingForm(this, documentData, {
  376. onPostOk : function(){
  377. this.reload();
  378. }.bind(this)
  379. })
  380. form.edit();
  381. },
  382. _queryCreateViewNode: function(){
  383. },
  384. _postCreateViewNode: function( viewNode ){
  385. },
  386. _queryCreateViewHead:function(){
  387. },
  388. _postCreateViewHead: function( headNode ){
  389. }
  390. })
  391. MWF.xApplication.Execution.SettingExplorer.SecretarySettingDocument = new Class({
  392. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  393. _queryCreateDocumentNode:function( itemData ){
  394. },
  395. _postCreateDocumentNode: function( itemNode, itemData ){
  396. }
  397. })
  398. MWF.xApplication.Execution.SettingExplorer.SecretarySettingForm = new Class({
  399. Extends: MWF.xApplication.Template.Explorer.PopupForm,
  400. Implements: [Options, Events],
  401. options: {
  402. "style": "default",
  403. "width": "600",
  404. "height": "260",
  405. "hasTop": true,
  406. "hasIcon": false,
  407. "hasTopIcon" : true,
  408. "hasTopContent" : true,
  409. "hasBottom": true,
  410. "title": MWF.xApplication.Execution.LP.secretaryFormTitle,
  411. "draggable": true,
  412. "closeAction": true
  413. },
  414. _createTableContent: function () {
  415. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
  416. "<tr><td styles='formTableTitle' lable='secretaryName'></td>" +
  417. " <td styles='formTableValue' item='secretaryName'></td></tr>" +
  418. "<tr><td styles='formTableTitle' lable='leaderIdentity'></td>" +
  419. " <td styles='formTableValue' item='leaderIdentity'></td></tr>" +
  420. "<tr><td styles='formTableTitle' lable='description'></td>" +
  421. " <td styles='formTableValue' item='description'></td></tr>" +
  422. "</table>"
  423. this.formTableArea.set("html", html);
  424. MWF.xDesktop.requireApp("Template", "MForm", function () {
  425. this.form = new MForm(this.formTableArea, this.data, {
  426. style: "execution",
  427. isEdited: this.isEdited || this.isNew,
  428. itemTemplate: {
  429. secretaryName: {text: this.lp.secretaryName, tType: "person", notEmpty: true},
  430. leaderIdentity: {text: this.lp.leaderIdentity, tType: "identity", notEmpty: true},
  431. description: {text: this.lp.description, type: "textarea"}
  432. }
  433. }, this.app);
  434. this.form.load();
  435. }.bind(this), true);
  436. },
  437. _ok: function (data, callback) {
  438. this.app.restActions.saveSecretary( data, function(json){
  439. if( callback )callback(json);
  440. this.fireEvent("postOk")
  441. }.bind(this));
  442. }
  443. });
  444. MWF.xApplication.Execution.SettingExplorer.CategorySettingExplorer = new Class({
  445. Extends: MWF.widget.Common,
  446. Implements: [Options, Events],
  447. options: {
  448. "style": "default",
  449. },
  450. initialize: function (container, app, parent, options) {
  451. this.container = container;
  452. this.parent = parent;
  453. this.app = app;
  454. this.css = this.parent.css;
  455. this.lp = this.app.lp;
  456. },
  457. load: function () {
  458. this.container.empty();
  459. this.loadToolbar();
  460. this.loadView();
  461. },
  462. destroy : function(){
  463. if(this.resizeWindowFun)this.app.removeEvent("resize",this.resizeWindowFun)
  464. this.view.destroy();
  465. },
  466. loadToolbar: function(){
  467. this.toolbar = new Element("div",{
  468. styles : this.css.toolbar
  469. }).inject(this.container)
  470. this.createActionNode = new Element("div",{
  471. styles : this.css.toolbarActionNode,
  472. text: this.lp.createCategory
  473. }).inject(this.toolbar);
  474. this.createActionNode.addEvent("click",function(){
  475. var form = new MWF.xApplication.Execution.SettingExplorer.CategorySettingForm(this, {}, {
  476. onPostOk : function(){
  477. this.view.reload();
  478. }.bind(this)})
  479. form.create();
  480. }.bind(this))
  481. this.fileterNode = new Element("div",{
  482. styles : this.css.fileterNode
  483. }).inject(this.toolbar);
  484. },
  485. loadView : function(){
  486. this.viewContainer = Element("div",{
  487. "styles" : this.css.viewContainer
  488. }).inject(this.container);
  489. this.resizeWindow();
  490. this.resizeWindowFun = this.resizeWindow.bind(this)
  491. this.app.addEvent("resize", this.resizeWindowFun );
  492. this.view = new MWF.xApplication.Execution.SettingExplorer.CategorySettingView( this.viewContainer, this.app, this, {
  493. templateUrl : this.parent.path+"listItem_category.json",
  494. scrollEnable : true
  495. } )
  496. this.view.load();
  497. },
  498. resizeWindow: function(){
  499. var size = this.app.content.getSize();
  500. this.viewContainer.setStyles({"height":(size.y-121)+"px"});
  501. }
  502. })
  503. MWF.xApplication.Execution.SettingExplorer.CategorySettingView = new Class({
  504. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  505. _createDocument: function(data){
  506. return new MWF.xApplication.Execution.SettingExplorer.CategorySettingDocument(this.viewNode, data, this.explorer, this);
  507. },
  508. _getCurrentPageData: function(callback, count){
  509. if (!count)count = 20;
  510. //var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  511. //var filter = this.filterData || {};
  512. this.actions.listCategoryAll( function (json) {
  513. if (callback)callback(json);
  514. }.bind(this))
  515. },
  516. _removeDocument: function(documentData, all){
  517. this.actions.deleteCategory(documentData.id, function(json){
  518. this.reload();
  519. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  520. }.bind(this));
  521. },
  522. _create: function(){
  523. },
  524. _openDocument: function( documentData ){
  525. var form = new MWF.xApplication.Execution.SettingExplorer.CategorySettingForm(this, documentData, {
  526. onPostOk : function(){
  527. this.reload();
  528. }.bind(this)
  529. })
  530. form.edit();
  531. },
  532. _queryCreateViewNode: function(){
  533. },
  534. _postCreateViewNode: function( viewNode ){
  535. },
  536. _queryCreateViewHead:function(){
  537. },
  538. _postCreateViewHead: function( headNode ){
  539. }
  540. })
  541. MWF.xApplication.Execution.SettingExplorer.CategorySettingDocument = new Class({
  542. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  543. _queryCreateDocumentNode:function( itemData ){
  544. },
  545. _postCreateDocumentNode: function( itemNode, itemData ){
  546. }
  547. })
  548. MWF.xApplication.Execution.SettingExplorer.CategorySettingForm = new Class({
  549. Extends: MWF.xApplication.Template.Explorer.PopupForm,
  550. Implements: [Options, Events],
  551. options: {
  552. "style": "default",
  553. "width": "600",
  554. "height": "260",
  555. "hasTop": true,
  556. "hasIcon": false,
  557. "hasTopIcon" : true,
  558. "hasTopContent" : true,
  559. "hasBottom": true,
  560. "title": MWF.xApplication.Execution.LP.categoryFormTitle,
  561. "draggable": true,
  562. "closeAction": true
  563. },
  564. _createTableContent: function () {
  565. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
  566. "<tr><td styles='formTableTitle' lable='workTypeName'></td>" +
  567. " <td styles='formTableValue' item='workTypeName'></td></tr>" +
  568. "<tr><td styles='formTableTitle' lable='orderNumber'></td>" +
  569. " <td styles='formTableValue' item='orderNumber'></td></tr>" +
  570. "<tr><td styles='formTableTitle' lable='description'></td>" +
  571. " <td styles='formTableValue' item='description'></td></tr>" +
  572. "</table>"
  573. this.formTableArea.set("html", html);
  574. MWF.xDesktop.requireApp("Template", "MForm", function () {
  575. this.form = new MForm(this.formTableArea, this.data, {
  576. style: "execution",
  577. isEdited: this.isEdited || this.isNew,
  578. itemTemplate: {
  579. workTypeName: {text: this.lp.workTypeName, notEmpty: true},
  580. orderNumber: {text: this.lp.orderNumber, tType : "number" },
  581. description: {text: this.lp.description, type: "textarea"}
  582. }
  583. }, this.app);
  584. this.form.load();
  585. }.bind(this), true);
  586. },
  587. _ok: function (data, callback) {
  588. this.app.restActions.saveCategory( data, function(json){
  589. if( callback )callback(json);
  590. this.fireEvent("postOk")
  591. }.bind(this));
  592. }
  593. });