Main.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. MWF.xDesktop.requireApp("ContentManage", "Actions.RestActions", null, false);
  2. MWF.xApplication.ContentManage.options.multitask = true;
  3. MWF.xApplication.ContentManage.Main = new Class({
  4. Extends: MWF.xApplication.Common.Main,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "name": "ContentManage",
  9. "icon": "icon.png",
  10. "width": "600",
  11. "height": "500",
  12. "isResize": true,
  13. "isMax": true,
  14. "title": MWF.xApplication.ContentManage.LP.title
  15. },
  16. onQueryLoad: function(){
  17. this.lp = MWF.xApplication.ContentManage.LP;
  18. this.actions = new MWF.xApplication.ContentManage.Actions.RestActions();
  19. },
  20. loadApplication: function(callback){
  21. this.node = new Element("div", {"styles": this.css.contentNode}).inject(this.content);
  22. this.titleNode = new Element("input", {"styles": this.css.titleNode}).inject(this.node);
  23. this.departmentNode = new Element("input", {"styles": this.css.departmentNode}).inject(this.node);
  24. this.dataNode = new Element("textarea", {"styles": this.css.dataNode}).inject(this.node);
  25. this.submitButton = new Element("input", {
  26. "type": "button",
  27. "value": this.lp.ok,
  28. "styles": this.css.submitButton
  29. }).inject(this.node);
  30. this.setEvent();
  31. },
  32. setEvent: function(){
  33. this.submitButton.addEvent("click", function(){
  34. this.submit();
  35. }.bind(this));
  36. },
  37. submit: function(){
  38. var data = {
  39. "title": this.titleNode.get("value"),
  40. "department": this.departmentNode.get("value"),
  41. "data": this.dataNode.get("value")
  42. };
  43. this.actions.addNote(data, function(json){
  44. this.notice(this.lp.saveOk, "success");
  45. }.bind(this));
  46. }
  47. });