Comment.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. MWF.xDesktop.requireApp("cms.Xform", "widget.Comment", null, false);
  3. /** @class Comment 评论组件。
  4. * @o2cn 评论组件
  5. * @example
  6. * //可以在脚本中获取该组件
  7. * //方法1:
  8. * var comment = this.form.get("name"); //获取组件
  9. * //方法2
  10. * var comment = this.target; //在组件事件脚本中获取
  11. * @extends MWF.xApplication.process.Xform.$Module
  12. * @o2category FormComponents
  13. * @o2range {CMS}
  14. * @hideconstructor
  15. */
  16. MWF.xApplication.cms.Xform.Comment = MWF.CMSComment = new Class(
  17. /** @lends MWF.xApplication.process.Xform.Comment# */
  18. {
  19. Extends: MWF.APP$Module,
  20. _loadUserInterface: function(){
  21. this.node.empty();
  22. this.node.setStyle("-webkit-user-select", "text");
  23. debugger;
  24. var config = {};
  25. if(this.json.editorProperties){
  26. config = Object.clone(this.json.editorProperties);
  27. }
  28. if (this.json.config){
  29. if (this.json.config.code){
  30. var obj = this.form.Macro.exec(this.json.config.code, this);
  31. Object.each(obj, function(v, k){
  32. config[k] = v;
  33. });
  34. }
  35. }
  36. /**
  37. * @summary 评论组件使用this.comment实现功能
  38. * @member {MWF.xApplication.cms.Xform.widget.Comment}
  39. * @example
  40. * //可以在脚本中获取该组件
  41. * var field = this.form.get("fieldId"); //获取组件对象
  42. * var items = field.comment.editor; //获取评论的编辑器对象
  43. */
  44. this.comment = new MWF.xApplication.cms.Xform.widget.Comment( this.form.app, this.node, {
  45. "documentId" : this.form.businessData.document.id,
  46. "countPerPage" : this.json.countPerPage || 10,
  47. "isAllowModified" : this.json.isAllowModified,
  48. "isAllowPublish" : this.json.isAllowPublish,
  49. "isAdmin" : this.form.app.isAdmin,
  50. "editorProperties" : config
  51. });
  52. this.comment.load();
  53. }
  54. });