Comment.js 2.0 KB

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