AttachmentSelector.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. MWF.xDesktop.requireApp("File", "Actions.RestActions", null, false);
  2. MWF.xDesktop.requireApp("File", "AttachmentController", null, false);
  3. MWF.xApplication.File.AttachmentSelector = new Class({
  4. Extends: MWF.xApplication.File.AttachmentController,
  5. options: {
  6. "style": "default",
  7. "listStyle": "icon"
  8. },
  9. addAttachment: function(data){
  10. if (this.options.size=="min"){
  11. this.attachments.push(new MWF.widget.AttachmentController.AttachmentMin(data, this));
  12. }else{
  13. this.attachments.push(new MWF.xApplication.File.AttachmentSelector.Attachment(data, this));
  14. }
  15. },
  16. addAttachmentFolder: function(data){
  17. var folder = new MWF.xApplication.File.AttachmentSelector.Folder(data, this);
  18. this.attachments.push(folder);
  19. return folder;
  20. }
  21. });
  22. MWF.xApplication.File.AttachmentSelector.Attachment = new Class({
  23. Extends: MWF.xApplication.File.AttachmentController.Attachment,
  24. load: function(){
  25. this.node = new Element("div").inject(this.content);
  26. switch (this.controller.options.listStyle){
  27. case "list":
  28. this.loadList();
  29. break;
  30. case "icon":
  31. this.loadIcon();
  32. break
  33. case "preview":
  34. this.loadPreview();
  35. break;
  36. }
  37. this.createInforNode(function(){
  38. this.tooltip = new mBox.Tooltip({
  39. content: this.inforNode,
  40. setStyles: {content: {padding: 15, lineHeight: 20}},
  41. attach: this.node,
  42. zIndex: 10013,
  43. transition: 'flyin'
  44. });
  45. }.bind(this));
  46. this.setEvent();
  47. }
  48. });
  49. MWF.xApplication.File.AttachmentSelector.Folder = new Class({
  50. Extends: MWF.xApplication.File.AttachmentController.Folder,
  51. load: function(){
  52. this.node = new Element("div").inject(this.content);
  53. switch (this.controller.options.listStyle){
  54. case "list":
  55. this.loadList();
  56. break;
  57. case "icon":
  58. this.loadIcon();
  59. break
  60. case "preview":
  61. this.loadPreview();
  62. break;
  63. }
  64. this.createInforNode(function(){
  65. this.tooltip = new mBox.Tooltip({
  66. content: this.inforNode,
  67. setStyles: {content: {padding: 15, lineHeight: 20}},
  68. attach: this.node,
  69. zIndex: 10013,
  70. transition: 'flyin'
  71. });
  72. }.bind(this));
  73. this.setEvent();
  74. }
  75. });