Commit 5ee4f70f16a13f0abb6274519c34ea47183c6d54

Authored by Michael Joseph
1 parent 9a8112a2

removed submit button borders and prepend group names with unit names for sysadm…

…ins; only allow editing of groups in your unit and unassigned groups for unitadmin


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1564 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/editGroupUI.inc
@@ -41,7 +41,7 @@ function getCreatePage($iGroupID) { @@ -41,7 +41,7 @@ function getCreatePage($iGroupID) {
41 $sToRender .= "<tr>\n"; 41 $sToRender .= "<tr>\n";
42 $sToRender .= "</tr>\n"; 42 $sToRender .= "</tr>\n";
43 43
44 - $sToRender .= "<td align = right><input type=\"image\" src =\"$default->graphicsUrl/widgets/update.gif\" value=\"Update\" /></td>\n"; 44 + $sToRender .= "<td align = right><input type=\"image\" src =\"$default->graphicsUrl/widgets/update.gif\" value=\"Update\" border=\"0\"/></td>\n";
45 $sToRender .= "</table>\n"; 45 $sToRender .= "</table>\n";
46 46
47 47
@@ -169,8 +169,24 @@ function getEditPageFail() { @@ -169,8 +169,24 @@ function getEditPageFail() {
169 function getGroupDisplay($oGroup) { 169 function getGroupDisplay($oGroup) {
170 global $default; 170 global $default;
171 if (!isset($oGroup)) { 171 if (!isset($oGroup)) {
172 - $oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");  
173 - //$oPatternListBox->setIncludeDefaultValue(true); 172 + if (Permission::userIsSystemAdministrator()) {
  173 + // if this is the system administrator, prepend group names with unit name
  174 + $oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");
  175 + $oPatternListBox->setFromClause("LEFT OUTER JOIN groups_units_link GUL on ST.id=GUL.group_id " .
  176 + "LEFT OUTER JOIN units_lookup UL on GUL.unit_id=UL.id");
  177 + $oPatternListBox->setCompositeDisplayName("DISTINCT COALESCE(CONCAT(CONCAT(UL.name, '-'),ST.name),ST.name)");
  178 + } else if (Permission::userIsUnitAdministrator()) {
  179 + // else if this is a unit administrator, only display the groups in your unit
  180 + $oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");
  181 + $oPatternListBox->setFromClause("INNER JOIN $default->owl_groups_units_table GUL on ST.id=GUL.group_id");
  182 + $oPatternListBox->setWhereClause("GUL.unit_id=" . User::getUnitID($_SESSION["userID"]));
  183 +
  184 + $oUnassignedUsersLB = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");
  185 + $oUnassignedUsersLB->setFromClause("LEFT OUTER JOIN $default->owl_groups_units_table GUL ON ST.id=GUL.group_id");
  186 + $oUnassignedUsersLB->setWhereClause("ISNULL(GUL.unit_id) AND ST.name <> 'Anonymous' AND ST.name <> 'System Administrators'");
  187 + $oPatternListBox->setAdditionalEntries($oUnassignedUsersLB->getEntries());
  188 + }
  189 +
174 $oPatternListBox->setPostBackOnChange(true); 190 $oPatternListBox->setPostBackOnChange(true);
175 return $oPatternListBox->render(); 191 return $oPatternListBox->render();
176 } else { 192 } else {
@@ -206,7 +222,7 @@ function getUpdateButton($oGroup) { @@ -206,7 +222,7 @@ function getUpdateButton($oGroup) {
206 if (!isset($oGroup)) { 222 if (!isset($oGroup)) {
207 return "Please select a group: "; 223 return "Please select a group: ";
208 } else { 224 } else {
209 - return "<td align = right><input type=\"image\" src =\"$default->graphicsUrl/widgets/update.gif\" value=\"submit\" /></td>\n"; 225 + return "<td align = right><input type=\"image\" src =\"$default->graphicsUrl/widgets/update.gif\" value=\"submit\" border=\"0\"/></td>\n";
210 } 226 }
211 } 227 }
212 228