GroupDetailsWidget.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*##############################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################## */
  16. define([
  17. "dojo/_base/declare",
  18. "dojo/_base/lang",
  19. "dojo/i18n",
  20. "dojo/i18n!./nls/common",
  21. "dojo/i18n!./nls/UserQueryWidget",
  22. "dojo/dom",
  23. "dojo/dom-attr",
  24. "dijit/registry",
  25. "dgrid/OnDemandGrid",
  26. "dgrid/Keyboard",
  27. "dgrid/Selection",
  28. "dgrid/selector",
  29. "dgrid/extensions/ColumnResizer",
  30. "dgrid/extensions/DijitRegistry",
  31. "hpcc/_TabContainerWidget",
  32. "hpcc/ws_access",
  33. "hpcc/MembersWidget",
  34. "hpcc/PermissionsWidget",
  35. "dojo/text!../templates/GroupDetailsWidget.html",
  36. "dijit/form/Textarea",
  37. "dijit/form/TextBox",
  38. "dijit/form/Button",
  39. "dijit/Toolbar",
  40. "dijit/TooltipDialog",
  41. "dijit/TitlePane",
  42. "dijit/Dialog"
  43. ], function (declare, lang, i18n, nlsCommon, nlsSpecific, dom, domAttr,
  44. registry,
  45. OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
  46. _TabContainerWidget, WsAccess, MembersWidget, PermissionsWidget,
  47. template) {
  48. return declare("GroupDetailsWidget", [_TabContainerWidget], {
  49. templateString: template,
  50. baseClass: "GroupDetailsWidget",
  51. i18n: lang.mixin(nlsCommon, nlsSpecific),
  52. postCreate: function (args) {
  53. this.inherited(arguments);
  54. this.summaryWidget = registry.byId(this.id + "_Summary");
  55. this.membersWidget = registry.byId(this.id + "_Members");
  56. this.permissionsWidget = registry.byId(this.id + "_Permissions");
  57. },
  58. getTitle: function () {
  59. return this.i18n.GroupDetails;
  60. },
  61. // Hitched actions ---
  62. _onSave: function (event) {
  63. // Currently disabled. TODO: Add ESP Method to rename group? ---
  64. },
  65. // Implementation ---
  66. init: function (params) {
  67. if (this.inherited(arguments))
  68. return;
  69. this.group = params.Name;
  70. if (this.group) {
  71. this.updateInput("Group", null, this.group);
  72. this.updateInput("Name", null, this.group);
  73. }
  74. },
  75. initTab: function () {
  76. var currSel = this.getSelectedChild();
  77. if (currSel.id == this.membersWidget.id) {
  78. this.membersWidget.init({
  79. groupname: this.group
  80. });
  81. } else if (currSel.id == this.permissionsWidget.id) {
  82. this.permissionsWidget.init({
  83. groupname: this.group
  84. });
  85. }
  86. }
  87. });
  88. });