DelayPublishForm.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. MWF.xApplication.cms.Document = MWF.xApplication.cms.Document || {};
  2. MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
  3. MWF.xApplication.cms.Document.DelayPublishForm = new Class({
  4. Extends: MPopupForm,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "width": "580",
  9. "height": "220",
  10. "hasTop": true,
  11. "hasIcon": false,
  12. "hasTopIcon" : false,
  13. "hasTopContent" : true,
  14. "hasBottom": true,
  15. "title": MWF.xApplication.cms.Document.LP.regularPublish, //"设置热点"
  16. "draggable": true,
  17. "closeAction": true,
  18. "publishTime": ""
  19. },
  20. _createTableContent: function () {
  21. this.formAreaNode.setStyle("z-index", 1002);
  22. this.formMaskNode.setStyle("z-index", 1002);
  23. this.formTableContainer.setStyles({
  24. "margin":"40px 40px 0px 40px"
  25. });
  26. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
  27. "<tr>" +
  28. " <td styles='formTableTitle' style='font-size: 14px;width: 80px;'>"+this.lp.publishTime+":</td>" +
  29. " <td styles='formTableValue' item='publishTime'></td>" +
  30. "</tr>"+
  31. "</table>";
  32. this.formTableArea.set("html", html);
  33. MWF.xDesktop.requireApp("Template", "MForm", function () {
  34. this.form = new MForm(this.formTableArea, this.data, {
  35. style: "meeting",
  36. isEdited: true,
  37. itemTemplate: {
  38. publishTime: {
  39. text: this.lp.publishTime,
  40. tType: "datetime",
  41. notEmpty: true,
  42. value: this.options.publishTime || "",
  43. attr: {
  44. "readonly":true
  45. },
  46. calendarOptions : {
  47. "secondEnable": true,
  48. "format": "db",
  49. "onShow": function () {
  50. this.container.setStyle("z-index", 1003 );
  51. }
  52. }
  53. }
  54. }
  55. }, this.app, this.css);
  56. this.form.load();
  57. }.bind(this), true);
  58. },
  59. _createBottomContent: function () {
  60. this.closeActionNode = new Element("div.formCancelActionNode", {
  61. "styles": this.css.formCancelActionNode,
  62. "text": this.lp.close
  63. }).inject(this.formBottomNode);
  64. this.closeActionNode.addEvent("click", function (e) {
  65. this.cancel(e);
  66. }.bind(this));
  67. this.okActionNode = new Element("div.formOkActionNode", {
  68. "styles": this.css.formOkActionNode,
  69. "text": this.lp.publish
  70. }).inject(this.formBottomNode);
  71. this.okActionNode.addEvent("click", function (e) {
  72. this.ok(e);
  73. }.bind(this));
  74. },
  75. ok: function (e) {
  76. this.fireEvent("queryOk");
  77. var result = this.form.getResult(true, null);
  78. if( !result ){
  79. this.app.notice(this.lp.inputPublishTime, "error");
  80. return;
  81. }else if( new Date( result.publishTime ) <= new Date() ){
  82. this.app.notice(this.lp.inputPublishTime2, "error");
  83. return;
  84. }
  85. (this.formMaskNode || this.formMarkNode).destroy();
  86. this.formAreaNode.destroy();
  87. // this.app.notice(this.lp.setHotLinkSuccess, "success");
  88. this.fireEvent("postOk", result.publishTime);
  89. }
  90. });