Password.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. MWF.xDesktop.requireApp("Setting", "servers.DataServers", null, false);
  2. MWF.xApplication.Setting.resource = MWF.xApplication.Setting.resource || {};
  3. MWF.xApplication.Setting.resource.Password = new Class({
  4. Extends: MWF.xApplication.Setting.servers.DataServer.Document,
  5. Implements: [Events],
  6. initialize: function(explorer){
  7. this.explorer = explorer;
  8. this.app = this.explorer.app;
  9. this.container = this.explorer.passwordContent;
  10. this.css = this.explorer.app.css;
  11. this.load();
  12. },
  13. load: function(){
  14. this.app.actions.getResPassword(function(json){
  15. this.json = json.data;
  16. this.node = new Element("div", {"styles": this.css.centerServerDocumentNode}).inject(this.container);
  17. this.createForm();
  18. }.bind(this));
  19. },
  20. createActions: function(){
  21. this.actionNode = new Element("div", {"styles": this.css.applicationServerDocumentActionNode}).inject(this.node);
  22. this.saveAction = new Element("div", {"styles": this.css.applicationServerDocumentSaveNode}).inject(this.actionNode);
  23. //this.closeAction = new Element("div", {"styles": this.css.applicationServerDocumentCloseNode}).inject(this.actionNode);
  24. this.saveAction.addEvents({
  25. "mouseover": function(){this.saveAction.setStyles(this.css.applicationServerDocumentSaveNode_over);}.bind(this),
  26. "mouseout": function(){this.saveAction.setStyles(this.css.applicationServerDocumentSaveNode);}.bind(this),
  27. "mousedown": function(){this.saveAction.setStyles(this.css.applicationServerDocumentSaveNode_down);}.bind(this),
  28. "mouseup": function(){this.saveAction.setStyles(this.css.applicationServerDocumentSaveNode_over);}.bind(this),
  29. "click": function(e){this.saveDocument();}.bind(this)
  30. });
  31. },
  32. createBaseInfo: function(){
  33. this.inforAreaNode = new Element("div", {"styles": this.css.applicationServerDocumentInforAreaNode}).inject(this.node);
  34. this.inforNode = new Element("div", {"styles": this.css.dataServerDocumentInforNode}).inject(this.inforAreaNode);
  35. var html = "<table cellSpacing='8px' width='90%' align='center'>" +
  36. "<tr><td width='120px'>key</td><td><input value='"+(this.json.key || "")+"'/></td></tr>" +
  37. "</table>";
  38. this.inforNode.set("html", html);
  39. var tds = this.inforNode.getElements("td");
  40. var inputs = this.inforNode.getElements("input");
  41. tds.setStyles(this.css.applicationServerDocumentTdNode);
  42. inputs.setStyles(this.css.applicationServerDocumentInputNode);
  43. },
  44. saveDocument: function(){
  45. var inputs = this.inforNode.getElements("input");
  46. this.json.key = inputs[0].get("value");
  47. this.app.actions.updateResPassword(this.json, function(){
  48. this.app.notice(this.app.lp.centerSaveInfor, "success");
  49. }.bind(this));
  50. },
  51. destroy: function(){
  52. if (this.node) this.node.destroy();
  53. MWF.release(this);
  54. },
  55. });