Main.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. MWF.xApplication.HotArticle.options.multitask = false;
  2. MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
  3. MWF.xDesktop.requireApp("Template", "MForm", null, false);
  4. MWF.xApplication.HotArticle.Main = new Class({
  5. Extends: MWF.xApplication.Common.Main,
  6. Implements: [Options, Events],
  7. options: {
  8. "style1": "default",
  9. "style": "default",
  10. "name": "HotArticle",
  11. "mvcStyle": "style.css",
  12. "icon": "icon.png",
  13. "title": MWF.xApplication.HotArticle.LP.title,
  14. "key" : ""
  15. },
  16. onQueryLoad: function(){
  17. this.lp = MWF.xApplication.HotArticle.LP;
  18. this.action = o2.Actions.load("x_hotpic_assemble_control");
  19. },
  20. loadApplication: function(callback){
  21. var url = this.path+this.options.style+"/view/view.html";
  22. this.content.loadHtml(url, {"bind": {"lp": this.lp,"data":{}}, "module": this}, function(){
  23. this.setLayout();
  24. this.loadList("all");
  25. if (callback) callback();
  26. }.bind(this));
  27. },
  28. loadList: function(type){
  29. if (this.currentMenu) this.setMenuItemStyleDefault(this.currentMenu);
  30. this.setMenuItemStyleCurrent(this[type+"MenuNode"]);
  31. this.currentMenu = this[type+"MenuNode"];
  32. this._loadListContent(type);
  33. },
  34. _loadListContent: function(type){
  35. this.mainNode.empty();
  36. list = new MWF.xApplication.HotArticle[type.capitalize() +"List"](this.mainNode,this, {
  37. "onLoadData": function (){
  38. this.hideSkeleton();
  39. },
  40. "type" : type,
  41. "key" : this.options.key
  42. });
  43. this.currentList = list;
  44. },
  45. setMenuItemStyleDefault: function(node){
  46. node.removeClass("mainColor_bg_opacity");
  47. node.getFirst().removeClass("mainColor_color");
  48. node.getLast().removeClass("mainColor_color");
  49. },
  50. setMenuItemStyleCurrent: function(node){
  51. node.addClass("mainColor_bg_opacity");
  52. node.getFirst().addClass("mainColor_color");
  53. node.getLast().addClass("mainColor_color");
  54. },
  55. setLayout: function(){
  56. },
  57. recordStatus: function(){
  58. // return {"navi": this.currentList.options.type};
  59. }
  60. });
  61. MWF.xApplication.HotArticle.List = new Class({
  62. Implements: [Options, Events],
  63. options: {
  64. "type": "all",
  65. "defaultViewType" : "list",
  66. "key" : ""
  67. },
  68. initialize: function (node,app, options) {
  69. this.setOptions(options);
  70. this.app = app;
  71. this.container = node;
  72. this.lp = this.app.lp;
  73. this.action = app.action;
  74. this.type = this.options.type;
  75. var url = this.app.path + this.app.options.style + "/view/content.html";
  76. this.container.loadHtml(url, {"bind": {"lp": this.lp,"data":{"type":this.type}}, "module": this}, function(){
  77. this.content = this.listContentNode;
  78. this.bottomNode = this.listBottomNode;
  79. this.pageNode = this.pageNumberAreaNode;
  80. this.init();
  81. this.load();
  82. }.bind(this));
  83. },
  84. showSkeleton: function(){
  85. if (this.skeletonNode) this.skeletonNode.inject(this.listContentNode);
  86. },
  87. hideSkeleton: function(){
  88. if (this.skeletonNode) this.skeletonNode.dispose();
  89. },
  90. inputFilter: function(e){
  91. if (e.keyCode==13) this.doFilter();
  92. },
  93. doFilter: function(){
  94. var key = this.searchKeyNode.get("value");
  95. this.searchKeyNode.set("value","");
  96. this.app.options.key = key;
  97. this.app.loadList("all");
  98. },
  99. loadListTitle : function (){
  100. this.listTitleNode.empty();
  101. this.listTitleNode.loadHtml(this.titleTempleteUrl, {"bind": {"lp": this.lp}, "module": this}, function(){
  102. this.currentSortNode = this.sortUpdateTimeNode;
  103. this.currentSortKey = "name";
  104. }.bind(this));
  105. },
  106. selectAllFile : function (e){
  107. if (e.currentTarget.get("disabled").toString()!="true"){
  108. var itemNode = e.currentTarget.getParent(".listItem");
  109. var iconNode = e.currentTarget.getElement(".selectFlagIcon");
  110. if (itemNode){
  111. if (itemNode.hasClass("mainColor_bg_opacity")){
  112. itemNode.removeClass("mainColor_bg_opacity");
  113. iconNode.removeClass("iconfont-workCompleted");
  114. iconNode.removeClass("selectFlagIcon_select");
  115. iconNode.removeClass("mainColor_color");
  116. this.listContentNode.getElements(this.toolbar.options.viewType === "list"?"tr":".listItem").each(function (tr){
  117. tr.removeClass("mainColor_bg_opacity");
  118. var ss = tr.getElement(".selectFlagIcon");
  119. tr.getElement(".selectFlag").hide();
  120. ss.removeClass("iconfont-workCompleted");
  121. ss.removeClass("selectFlagIcon_select");
  122. ss.removeClass("mainColor_color");
  123. })
  124. this.selectedList = [];
  125. }else{
  126. itemNode.addClass("mainColor_bg_opacity");
  127. iconNode.addClass("iconfont-workCompleted");
  128. iconNode.addClass("selectFlagIcon_select");
  129. iconNode.addClass("mainColor_color");
  130. this.listContentNode.getElements(this.toolbar.options.viewType === "list"?"tr":".listItem").each(function (tr){
  131. tr.getElement(".selectFlag").show();
  132. tr.addClass("mainColor_bg_opacity");
  133. var ss = tr.getElement(".selectFlagIcon");
  134. ss.addClass("iconfont-workCompleted");
  135. ss.addClass("selectFlagIcon_select");
  136. ss.addClass("mainColor_color");
  137. })
  138. this.selectedList = this.dataList;
  139. }
  140. }
  141. }
  142. this._setToolBar();
  143. },
  144. loadItems: function(data){
  145. this.dataList = data;
  146. this.content.loadHtml(this.listTempleteUrl, {"bind": {"lp": this.lp, "type": this.options.type, "data": data}, "module": this}, function(){
  147. this.node = this.content.getFirst();
  148. }.bind(this));
  149. },
  150. init: function(){
  151. this.size = 20;
  152. this.page = 1;
  153. if(this.options.key!==""){
  154. var keyContainer = new Element("div.ft_filterItem").inject(this.pathNode);
  155. new Element("div",{"class":"ft_filterItemTitle mainColor_color","text": this.lp.key + ":"}).inject(keyContainer);
  156. new Element("div",{"class":"ft_filterItemName","text":this.options.key}).inject(keyContainer);
  157. var iconNode = new Element("icon",{"class":"iconfont-off ft_filterItemDel"}).inject(keyContainer);
  158. iconNode.addEvent("click",function (ev){
  159. ev.target.getParent().hide();
  160. this.app.options.key = "";
  161. this.app.loadList(this.options.type);
  162. }.bind(this))
  163. }
  164. },
  165. _initTempate: function (){
  166. this.titleTempleteUrl = this.app.path+this.app.options.style+"/view/all/"+this.options.defaultViewType+"_title.html";
  167. this.listTempleteUrl = this.app.path+this.app.options.style+"/view/all/" +this.options.defaultViewType + ".html";
  168. },
  169. load: function(){
  170. var _self = this;
  171. this._initToolBar();
  172. this._initTempate();
  173. this.loadListTitle();
  174. this.loadToolBar(this.toolbarItems.unSelect);
  175. this.selectedList = [];
  176. this.loadData().then(function(data){
  177. _self.hide();
  178. _self.loadItems(data);
  179. });
  180. },
  181. _initToolBar : function (){
  182. this.toolbarItems = {
  183. "unSelect":[
  184. ["rename", "delete"]
  185. ],
  186. "selected":[
  187. ["rename", "delete"]
  188. ],
  189. "mulSelect":[
  190. ["delete"]
  191. ]
  192. }
  193. },
  194. loadToolBar : function (availableTool){
  195. this.toolBarNode.empty();
  196. this.toolbar = new MWF.xApplication.HotArticle.Toolbar(this.toolBarNode, this, {
  197. viewType : this.options.defaultViewType,
  198. type : this.type,
  199. availableTool : availableTool
  200. });
  201. this.toolbar.load();
  202. },
  203. refresh: function(){
  204. this.hide();
  205. this.load();
  206. },
  207. hide: function(){
  208. if (this.node) this.node.destroy();
  209. },
  210. loadData: function(){
  211. var _self = this;
  212. var data = {}
  213. if(this.options.key!==""){
  214. data.title = this.options.key;
  215. }
  216. return this.action.HotPictureInfoAction.listForPage(this.page,this.size,data).then(function(json){
  217. _self.fireEvent("loadData");
  218. _self.total = json.count;
  219. _self.loadPage();
  220. return _self._fixData(json.data);
  221. });
  222. },
  223. _fixData : function (dataList){
  224. dataList.each(function (data){
  225. if(data.application === "BBS"){
  226. data.applicationName = this.lp.bbsHotArticele;
  227. }
  228. if(data.application === "CMS"){
  229. data.applicationName = this.lp.infoHotArticele;
  230. }
  231. }.bind(this));
  232. return dataList;
  233. },
  234. overTaskItem: function(e){
  235. e.currentTarget.addClass("listItem_over");
  236. var iconNode = e.currentTarget.getElement(".selectFlagIcon");
  237. if (iconNode.hasClass("selectFlagIcon_select")){
  238. }else{
  239. e.currentTarget.getElement(".selectFlag").show();
  240. }
  241. },
  242. outTaskItem: function(e){
  243. e.currentTarget.removeClass("listItem_over");
  244. var iconNode = e.currentTarget.getElement(".selectFlagIcon");
  245. if (iconNode.hasClass("selectFlagIcon_select")){
  246. }else{
  247. e.currentTarget.getElement(".selectFlag").hide();
  248. }
  249. },
  250. open: function(id,e){
  251. var data ;
  252. for(var i = 0 ; i < this.dataList.length;i++){
  253. if(this.dataList[i].id === id){
  254. data = this.dataList[i];
  255. break ;
  256. }
  257. }
  258. if( data.application == "BBS" ){
  259. var appId = "ForumDocument"+data.infoId;
  260. if (this.app.desktop.apps[appId]){
  261. this.app.desktop.apps[appId].setCurrent();
  262. }else {
  263. this.app.desktop.openApplication(null, "ForumDocument", {
  264. "id" : data.infoId,
  265. "appId": appId,
  266. "isEdited" : false,
  267. "isNew" : false
  268. });
  269. }
  270. }else{
  271. var appId = "cms.Document"+data.infoId;
  272. if (this.app.desktop.apps[appId]){
  273. this.app.desktop.apps[appId].setCurrent();
  274. }else {
  275. this.app.desktop.openApplication(null, "cms.Document", {
  276. "documentId" : data.infoId,
  277. "appId": appId,
  278. "readonly" : true
  279. });
  280. }
  281. }
  282. },
  283. selectFile: function(id,e, dataList){
  284. e.stopPropagation()
  285. var data ;
  286. for(var i = 0 ; i < this.dataList.length;i++){
  287. if(this.dataList[i].id === id){
  288. data = this.dataList[i];
  289. break ;
  290. }
  291. }
  292. if (e.currentTarget.get("disabled").toString()!="true"){
  293. var itemNode = e.currentTarget.getParent(".listItem");
  294. var iconNode = e.currentTarget.getElement(".selectFlagIcon");
  295. if (itemNode){
  296. if (itemNode.hasClass("mainColor_bg_opacity")){
  297. itemNode.removeClass("mainColor_bg_opacity");
  298. iconNode.removeClass("iconfont-workCompleted");
  299. iconNode.removeClass("selectFlagIcon_select");
  300. iconNode.removeClass("mainColor_color");
  301. this.unselectedFile(data);
  302. }else{
  303. itemNode.addClass("mainColor_bg_opacity");
  304. iconNode.addClass("iconfont-workCompleted");
  305. iconNode.addClass("selectFlagIcon_select");
  306. iconNode.addClass("mainColor_color");
  307. this.selectedFile(data);
  308. }
  309. }
  310. }
  311. this._setToolBar();
  312. },
  313. _setToolBar : function (){
  314. if(this.selectedList.length === 0 ){
  315. this.loadToolBar(this.toolbarItems.unSelect);
  316. } else if (this.selectedList.length === 1){
  317. this.loadToolBar(this.toolbarItems.selected);
  318. }else{
  319. this.loadToolBar(this.toolbarItems.mulSelect);
  320. }
  321. },
  322. selectedFile: function(data){
  323. if (!this.selectedList) this.selectedList = [];
  324. var idx = this.selectedList.findIndex(function(t){
  325. return t.id == data.id;
  326. });
  327. if (idx===-1) this.selectedList.push(data);
  328. },
  329. unselectedFile: function(data){
  330. // delete data._;
  331. if (!this.selectedList) this.selectedList = [];
  332. var idx = this.selectedList.findIndex(function(t){
  333. return t.id == data.id;
  334. });
  335. if (idx!==-1) this.selectedList.splice(idx, 1);
  336. },
  337. loadPage: function(){
  338. var totalCount = this.total;
  339. var pages = totalCount/this.size;
  340. var pageCount = pages.toInt();
  341. if (pages !== pageCount) pageCount = pageCount+1;
  342. this.pageCount = pageCount;
  343. var size = this.bottomNode.getSize();
  344. var maxPageSize = 500;//size.x*0.8;
  345. maxPageSize = maxPageSize - 80*2-24*2-10*3;
  346. var maxPageCount = (maxPageSize/34).toInt();
  347. this.loadPageNode(pageCount, maxPageCount);
  348. },
  349. loadPageNode: function(pageCount, maxPageCount){
  350. var pageStart = 1;
  351. var pageEnd = pageCount;
  352. if (pageCount>maxPageCount){
  353. var halfCount = (maxPageCount/2).toInt();
  354. pageStart = Math.max(this.page-halfCount, 1);
  355. pageEnd = pageStart+maxPageCount-1;
  356. pageEnd = Math.min(pageEnd, pageCount);
  357. pageStart = pageEnd - maxPageCount+1;
  358. }
  359. this.pageNode.empty();
  360. var _self = this;
  361. for (var i=pageStart; i<=pageEnd; i++){
  362. var node = new Element("div.pageItem", {
  363. "text": i,
  364. "events": { "click": function(){_self.gotoPage(this.get("text"));} }
  365. }).inject(this.pageNode);
  366. if (i==this.page) node.addClass("mainColor_bg");
  367. }
  368. },
  369. nextPage: function(){
  370. this.page++;
  371. if (this.page>this.pageCount) this.page = this.pageCount;
  372. this.gotoPage(this.page);
  373. },
  374. prevPage: function(){
  375. this.page--;
  376. if (this.page<1) this.page = 1;
  377. this.gotoPage(this.page);
  378. },
  379. firstPage: function(){
  380. this.gotoPage(1);
  381. },
  382. lastPage: function(){
  383. this.gotoPage(this.pageCount);
  384. },
  385. gotoPage: function(page){
  386. this.page = page;
  387. this.hide();
  388. this.showSkeleton();
  389. this.load();
  390. },
  391. });
  392. MWF.xApplication.HotArticle.AllList = new Class({
  393. Extends: MWF.xApplication.HotArticle.List
  394. });
  395. MWF.xApplication.HotArticle.CMSList = new Class({
  396. Extends: MWF.xApplication.HotArticle.AllList,
  397. loadData: function(){
  398. var _self = this;
  399. var data = {}
  400. if(this.options.key!==""){
  401. data.title = this.options.key;
  402. }
  403. data.application = "CMS";
  404. return this.action.HotPictureInfoAction.listForPage(this.page,this.size,data).then(function(json){
  405. _self.fireEvent("loadData");
  406. _self.total = json.count;
  407. _self.loadPage();
  408. return _self._fixData(json.data);
  409. });
  410. }
  411. });
  412. MWF.xApplication.HotArticle.BBSList = new Class({
  413. Extends: MWF.xApplication.HotArticle.AllList,
  414. loadData: function(){
  415. var _self = this;
  416. var data = {}
  417. if(this.options.key!==""){
  418. data.title = this.options.key;
  419. }
  420. data.application = "BBS";
  421. return this.action.HotPictureInfoAction.listForPage(this.page,this.size,data).then(function(json){
  422. _self.fireEvent("loadData");
  423. _self.total = json.count;
  424. _self.loadPage();
  425. return _self._fixData(json.data);
  426. });
  427. }
  428. });
  429. MWF.xApplication.HotArticle.Toolbar = new Class({
  430. Extends: MWF.widget.Common,
  431. Implements: [Options, Events],
  432. options: {
  433. "style": "default",
  434. "viewType" : "list",
  435. "type" : "all"
  436. },
  437. initialize : function( container, explorer, options ) {
  438. this.container = container;
  439. this.explorer = explorer;
  440. this.app = explorer.app;
  441. this.lp = explorer.app.lp;
  442. this.action = explorer.action;
  443. this.setOptions(options);
  444. this._initTools();
  445. this.type = this.options.type;
  446. this.availableTool = this.options.availableTool;
  447. },
  448. _initTools : function (){
  449. this.tools = {
  450. rename : {
  451. action : "rename",
  452. text : this.lp.button.rename,
  453. icon : "iconfont-edit"
  454. },
  455. delete : {
  456. action : "delete",
  457. text : this.lp.button.delete,
  458. icon : "iconfont-delete"
  459. },
  460. }
  461. },
  462. load : function(){
  463. this.node = new Element("div").inject( this.container );
  464. this.availableTool.each( function( group ){
  465. var toolgroupNode = new Element("div.toolgroupNode").inject( this.node );
  466. var length = group.length;
  467. group.each( function( t, i ){
  468. var className;
  469. if( length == 1 ){
  470. className = "toolItemNode_single";
  471. }else{
  472. if( i == 0 ){
  473. className = "toolItemNode_left";
  474. }else if( i + 1 == length ){
  475. className = "toolItemNode_right";
  476. }else{
  477. className = "toolItemNode_center";
  478. }
  479. }
  480. var tool = this.tools[ t ];
  481. var toolNode = new Element( "div", {
  482. class : className,
  483. style : "cursor:pointer;height:30px;line-height:30px;padding-left:12px;padding-right:12px;background: #4A90E2;font-size: 13px;color: #FFFFFF;font-weight: 400;",
  484. events : {
  485. click : function( ev ){ this[tool.action]( ev ) }.bind(this)
  486. }
  487. }).inject( toolgroupNode );
  488. var iconNode = new Element("icon",{"class":"o2Drive " + tool.icon,"style":"margin-right:6px"}).inject(toolNode);
  489. var textNode = new Element("span").inject(toolNode);
  490. textNode.set("text",tool.text);
  491. }.bind(this))
  492. }.bind(this));
  493. this.loadRightNode()
  494. },
  495. rename : function(){
  496. var _self = this;
  497. if (this.explorer.selectedList && this.explorer.selectedList.length){
  498. var data = this.explorer.selectedList[0];
  499. var form = new MWF.xApplication.HotArticle.ReNameForm(this.explorer, data, {
  500. }, {
  501. app: this.app
  502. });
  503. form.edit()
  504. }else {
  505. this.app.notice(this.lp.tip.selectFile,"error");
  506. return;
  507. }
  508. },
  509. delete : function (e){
  510. if (this.explorer.selectedList && this.explorer.selectedList.length){
  511. var _self = this;
  512. var dataList = this.explorer.selectedList;
  513. this.app.confirm("warn", e, this.lp.tip.removeConfirmTitle, this.lp.tip.removeConfirm.replace("{length}",dataList.length), 350, 120, function () {
  514. var count = 0;
  515. dataList.each( function(data){
  516. _self.action.HotPictureInfoAction.delete(data.application, data.infoId , function(){
  517. count++;
  518. if( dataList.length == count ){
  519. _self.app.notice(_self.lp.tip.removeSuccess.replace("{count}",count));
  520. _self.explorer.refresh();
  521. }
  522. });
  523. }.bind(this));
  524. this.close();
  525. }, function () {
  526. this.close();
  527. });
  528. }else {
  529. this.app.notice(this.lp.tip.selectFile,"error");
  530. return;
  531. }
  532. },
  533. loadRightNode : function(){
  534. this.toolabrRightNode = new Element("div.toolabrRightNode",{
  535. "style": "float:right"
  536. }).inject(this.node);
  537. this.loadListType();
  538. },
  539. getListType : function(){
  540. return this.viewType || this.options.viewType
  541. },
  542. loadListType : function(){
  543. this.listViewTypeNode = new Element("div", {
  544. "style" : "font-size:18px;float:left;margin-right:6px",
  545. "class" : this.options.viewType == "list" ? "mainColor_color" : "",
  546. events : {
  547. click : function(){
  548. this.viewType = "list";
  549. this.explorer.options.defaultViewType = this.viewType;
  550. this.explorer.refresh();
  551. }.bind(this)
  552. }
  553. }).inject(this.toolabrRightNode);
  554. new Element("icon",{"class":"iconfont-list"}).inject(this.listViewTypeNode);
  555. this.tileViewTypeNode = new Element("div", {
  556. "style" : "font-size:18px;float:left",
  557. "class" : this.options.viewType !== "list" ? "mainColor_color" : "",
  558. events : {
  559. click : function(){
  560. this.viewType = "tile";
  561. this.explorer.options.defaultViewType = this.viewType;
  562. this.explorer.refresh();
  563. }.bind(this)
  564. }
  565. }).inject(this.toolabrRightNode);
  566. new Element("icon",{"class":"iconfont-grid"}).inject(this.tileViewTypeNode);
  567. }
  568. });
  569. MWF.xApplication.HotArticle.ReNameForm = new Class({
  570. Extends: MPopupForm,
  571. Implements: [Options, Events],
  572. options: {
  573. "style": "attendanceV2",
  574. "width": 700,
  575. //"height": 300,
  576. "height": "200",
  577. "hasTop": true,
  578. "hasIcon": false,
  579. "draggable": true,
  580. "title" : MWF.xApplication.HotArticle.LP.tip.modifyTitle,
  581. "id" : ""
  582. },
  583. _createTableContent: function () {
  584. var html = "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable' style='margin-top: 20px; '>" +
  585. "<tr>" +
  586. " <td styles='formTableValue14' item='title' ></td></tr>" +
  587. "</table>";
  588. this.formTableArea.set("html", html);
  589. this.form = new MForm(this.formTableArea, this.data || {}, {
  590. isEdited: true,
  591. style : "minder",
  592. hasColon : true,
  593. itemTemplate: {
  594. title: { text : MWF.xApplication.HotArticle.LP.list.title, notEmpty : true }
  595. }
  596. }, this.app);
  597. this.form.load();
  598. },
  599. _createBottomContent: function () {
  600. if (this.isNew || this.isEdited) {
  601. this.okActionNode = new Element("button.inputOkButton", {
  602. "styles": this.css.inputOkButton,
  603. "text": MWF.xApplication.HotArticle.LP.button.ok
  604. }).inject(this.formBottomNode);
  605. this.okActionNode.addEvent("click", function (e) {
  606. this.save(e);
  607. }.bind(this));
  608. }
  609. this.cancelActionNode = new Element("button.inputCancelButton", {
  610. "styles": (this.isEdited || this.isNew || this.getEditPermission() ) ? this.css.inputCancelButton : this.css.inputCancelButton_long,
  611. "text": MWF.xApplication.HotArticle.LP.button.close
  612. }).inject(this.formBottomNode);
  613. this.cancelActionNode.addEvent("click", function (e) {
  614. this.close(e);
  615. }.bind(this));
  616. },
  617. save: function(){
  618. var data = this.form.getResult(true,null,true,false,true);
  619. if( data ){
  620. this.app.action.HotPictureInfoAction.changeTitle({
  621. "id" : data.id,
  622. "application" : data.application,
  623. "infoId" : data.infoId,
  624. "title" : data.title,
  625. "summary" : data.summary,
  626. "picId" : data.picId,
  627. "creator" : data.creator,
  628. "createTime" : data.createTime,
  629. "updateTime" : data.updateTime
  630. }).then(function (){
  631. this.app.notice(MWF.xApplication.HotArticle.LP.tip.success);
  632. this.explorer.refresh();
  633. this.close();
  634. }.bind(this));
  635. }
  636. }
  637. });