GroupExplorer.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. MWF.xDesktop.requireApp("Org", "PersonExplorer", null, false);
  2. MWF.xApplication.Org.GroupExplorer = new Class({
  3. Extends: MWF.xApplication.Org.PersonExplorer,
  4. Implements: [Options, Events],
  5. options: {
  6. "style": "default",
  7. "lp": {
  8. },
  9. "creator": false
  10. },
  11. _loadLp: function(){
  12. this.options.lp = {
  13. "elementLoaded": this.app.lp.groupLoaded,
  14. "search": this.app.lp.search,
  15. "searchText": this.app.lp.searchText,
  16. "elementSave": this.app.lp.groupSave,
  17. "deleteElements": this.app.lp.deleteGroups,
  18. "deleteElementsCancel": this.app.lp.deleteElementsCancel,
  19. "deleteElementsTitle": this.app.lp.deleteGroupsTitle,
  20. "deleteElementsConfirm": this.app.lp.deleteGroupsConfirm,
  21. "elementBaseText": this.app.lp.groupBaseText,
  22. "elementName": this.app.lp.groupName,
  23. "edit": this.app.lp.edit,
  24. "cancel": this.app.lp.cancel,
  25. "save": this.app.lp.save,
  26. "add": this.app.lp.add,
  27. "inputElementName": this.app.lp.inputGroupName,
  28. "elementMemberPersonText": this.app.lp.groupMemberPersonText,
  29. "personEmployee": this.app.lp.personEmployee,
  30. "personDisplay": this.app.lp.personDisplay,
  31. "personMail": this.app.lp.personMail,
  32. "personPhone": this.app.lp.personPhone,
  33. "deletePersonMemberTitle": this.app.lp.deletePersonMemberTitle,
  34. "deletePersonMember": this.app.lp.deletePersonMember,
  35. "elementMemberGroupText": this.app.lp.groupMemberGroupText,
  36. "groupDescription": this.app.lp.groupDescription,
  37. "groupName": this.app.lp.groupName,
  38. "deleteGroupMemberTitle": this.app.lp.deleteGroupMemberTitle,
  39. "deleteGroupMember": this.app.lp.deleteGroupMember
  40. }
  41. },
  42. _listElementNext: function(lastid, count, callback){
  43. this.actions.listGroupNext(lastid, count, function(json){
  44. if (callback) callback.apply(this, [json]);
  45. }.bind(this));
  46. },
  47. _newElement: function(data, explorer){
  48. return new MWF.xApplication.Org.GroupExplorer.Group(data, explorer, this.isEditor);
  49. },
  50. _listElementByKey: function(callback, failure, key){
  51. this.actions.listGroupByKey(function(json){
  52. if (callback) callback.apply(this, [json]);
  53. }.bind(this), failure, key);
  54. },
  55. _getAddElementData: function(){
  56. return {
  57. "personList": [],
  58. "groupList": [],
  59. "id": "",
  60. "name": ""
  61. };
  62. }
  63. });
  64. MWF.xApplication.Org.GroupExplorer.Group = new Class({
  65. Extends: MWF.xApplication.Org.PersonExplorer.Item,
  66. showItemProperty: function(){
  67. this.content = new MWF.xApplication.Org.GroupExplorer.GroupContent(this);
  68. },
  69. "delete": function(success, failure){
  70. this.explorer.actions.deleteGroup(this.data.id, function(){
  71. this.destroy();
  72. if (success) success();
  73. }.bind(this), function(xhr, text, error){
  74. var errorText = error;
  75. if (xhr) errorText = xhr.responseText;
  76. MWF.xDesktop.notice("error", {x: "right", y:"top"}, "request json error: "+errorText);
  77. if (failure) failure();
  78. });
  79. },
  80. _getIcon: function(){
  81. return "/x_component_Org/$Explorer/default/icon/group.png";
  82. }
  83. });
  84. MWF.xApplication.Org.GroupExplorer.GroupContent = new Class({
  85. Extends: MWF.xApplication.Org.PersonExplorer.ItemContent
  86. });