Calendar.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. MWF.xDesktop.requireApp("process.Xform", "$Input", null, false);
  2. MWF.xApplication.process.Xform.Calendar = MWF.APPCalendar = new Class({
  3. Implements: [Events],
  4. Extends: MWF.APP$Input,
  5. iconStyle: "calendarIcon",
  6. options: {
  7. "moduleEvents": ["complete", "clear"]
  8. },
  9. setDescriptionEvent: function(){
  10. if (this.descriptionNode){
  11. this.descriptionNode.addEvents({
  12. "mousedown": function(){
  13. this.descriptionNode.setStyle("display", "none");
  14. this.clickSelect();
  15. }.bind(this)
  16. });
  17. }
  18. },
  19. clickSelect: function(){
  20. if (!this.calendar){
  21. MWF.require("MWF.widget.Calendar", function(){
  22. this.calendar = new MWF.widget.Calendar(this.node.getFirst(), {
  23. "style": "xform",
  24. "isTime": (this.json.selectType=="datetime"),
  25. //"target": this.form.node,
  26. "target": this.form.app.content,
  27. "format": this.json.format,
  28. "onComplate": function(){
  29. this.validationMode();
  30. this.validation();
  31. this.fireEvent("complete");
  32. }.bind(this),
  33. "onClear": function(){
  34. this.validationMode();
  35. this.validation();
  36. this.fireEvent("clear");
  37. if (!this.node.getFirst().get("value")) if (this.descriptionNode) this.descriptionNode.setStyle("display", "block");
  38. }.bind(this),
  39. "onShow": function(){
  40. if (this.descriptionNode) this.descriptionNode.setStyle("display", "none");
  41. }.bind(this),
  42. "onHide": function(){
  43. if (!this.node.getFirst().get("value")) if (this.descriptionNode) this.descriptionNode.setStyle("display", "block");
  44. }.bind(this)
  45. });
  46. this.calendar.show();
  47. }.bind(this));
  48. }else{
  49. this.node.getFirst().focus();
  50. }
  51. }
  52. });