\n";
@@ -49,17 +51,17 @@ function getPage($iUserID, $iGroupID) {
// page that comes up when there is nothing selected
-function getPageNotSelected() {
+function getPageNotSelected($sQueryString) {
global $default;
$sToRender .= "
\n";
+
+
+ return $sToRender;
+}
+// show listbox of Users belonging to Users_Groups_link table
+function getUserDisplay($oUser) {
+ global $default;
+ if (!isset($oUser)) {
+ $oPatternListBox = & new PatternListBox($default->owl_users_table, "username", "id", "fUserID");
+ if (Permission::userIsUnitAdministrator()) {
+ $oPatternListBox->setFromClause("INNER JOIN $default->owl_users_groups_table UGL on ST.id=UGL.user_id " .
+ "INNER JOIN $default->owl_groups_units_table GUL on UGL.group_id=GUL.group_id");
+ $oPatternListBox->setWhereClause("GUL.unit_id=" . User::getUnitID($_SESSION["userID"]));
+ }
+ $oPatternListBox->setPostBackOnChange(true);
+ return $oPatternListBox->render();
+ } else {
+ return "iId . "\">\n" .
+ $oUser->getUserName();
+ }
+}
+
+// display the listbox initially ..then just display the text
+function getOtherGroupDisplay($oGroup) {
+ global $default;
+ if (!isset($oGroup)) {
+ if (Permission::userIsSystemAdministrator()) {
+ // if this is the system administrator, prepend group names with unit name
+ $oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fOtherGroupID");
+ $oPatternListBox->setFromClause("LEFT OUTER JOIN groups_units_link GUL on ST.id=GUL.group_id " .
+ "LEFT OUTER JOIN units_lookup UL on GUL.unit_id=UL.id");
+ $oPatternListBox->setCompositeDisplayName("DISTINCT COALESCE(CONCAT(CONCAT(UL.name, '-'),ST.name),ST.name)");
+ } else if (Permission::userIsUnitAdministrator()) {
+ // else if this is a unit administrator, only display the groups in your unit
+ $oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fOtherGroupID");
+ $oPatternListBox->setFromClause("INNER JOIN $default->owl_groups_units_table GUL on ST.id=GUL.group_id");
+ $oPatternListBox->setWhereClause("GUL.unit_id=" . User::getUnitID($_SESSION["userID"]));
+ }
+ return $oPatternListBox->render();
+ } else {
+ return "iId . "\">\n" .
+ $oGroup->getName();
+ }
+}
+// show Group details on confirm deletion page
+function getGroupDisplay($aGroup) {
+ global $default;
+
+ $sBgColor = "#F5F6EE";
+ $oGroup= null;
+ $sGroup = "
"); // Create the Heading
+ $oPatternCustom->addHtml(renderHeading("Current System Users")); // Create the Heading
+ $oPatternCustom->addHtml("
"); // Create the Heading
+
+ $oPatternCustom->addHtml("
Filter by group
"); //
+ if (isset($fGroupID)) { // Check if should use the query string OR ...
+ $sFilterOptions = getFilterOptions($fGroupID);
+ $oPatternCustom->addHtml($sFilterOptions . "
\n"); // Get Groups Dropdown for filter option
+ } else { // ... should use session variable
+ $sFilterOptions = getFilterOptions($_SESSION['UserGroupFilter'][0]->iSessionGroupID);
+ $oPatternCustom->addHtml(getFilterOptions($sFilterOptions) . ""); // Get Groups Dropdown for filter option
+ }
+ $oPatternCustom->addHtml(getSubmit());
+ $oPatternCustom->addHtml("
");
+ $main->setFormAction($_SERVER['PHP_SELF']);
+
+
+ if($fGroupID == "") { // Used when user wants to filter by group
+ $sQuery = "SELECT users.id as userID, users.name as name, username, " .
+ "'Edit' , 'Delete', 'Edit Groups' " .
+ "FROM users " .
+ "ORDER BY users.name";
+ $_SESSION['UserGroupFilter'][0]->iSessionGroupID = "";
+
+ } else { // List all users on the system
+ if (isset($fGroupID)) {
+ $_SESSION['UserGroupFilter'][0]->iSessionGroupID = $fGroupID ;
+ } else {
+ $fGroupID = $_SESSION['UserGroupFilter'][0]->iSessionGroupID;
+ }
+ $sQuery = "SELECT users.id as userID, users.name as name, username, " .
+ "'Edit' , 'Delete', 'Edit Groups' , users_groups_link.group_id " .
+ "FROM users inner JOIN users_groups_link ON users.id = users_groups_link.user_id " .
+ "WHERE users_groups_link.group_id = $fGroupID " .
+ "ORDER BY users.name";
+ }
+
+ $aColumns = array("name", "username", "Edit", "Delete", "Edit Groups");
+ $aColumnNames = array("Name", "Username", "Edit", "Delete", "Edit Groups");
+ $aColumnTypes = array(1,1,3,3,3);
+ $aDBColumnArray = array("userID");
+ $aQueryStringVariableNames = array("fUserID");
+
+ $aHyperLinkURL = array( 2=> "$default->rootUrl/control.php?action=editUser",
+ 3=> "$default->rootUrl/control.php?action=removeUser",
+ 4=> "$default->rootUrl/control.php?action=editUserGroups"); //"$default->rootUrl/control.php?action=removeUserFromGroup");
+
+ $oSearchResults = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnNames, "100%", $aHyperLinkURL,$aDBColumnArray,$aQueryStringVariableNames);
+
+ $oSearchResults->setDisplayColumnHeadings(true);
+ $htmlTables = $oSearchResults->render() ;
+
+ $oPatternCustom->addHtml($htmlTables);
+
+ } // end of if checksession
+
+ $main->setCentralPayload($oPatternCustom);
+ $main->render();
+}
+?>
diff --git a/presentation/lookAndFeel/knowledgeTree/administration/usermanagement/listUsersUI.inc b/presentation/lookAndFeel/knowledgeTree/administration/usermanagement/listUsersUI.inc
new file mode 100644
index 0000000..8e8563c
--- /dev/null
+++ b/presentation/lookAndFeel/knowledgeTree/administration/usermanagement/listUsersUI.inc
@@ -0,0 +1,218 @@
+graphicsUrl/widgets/select.gif\" value=\"submit\" border=\"0\"/>\n";
+ return $sToRender;
+}
+
+// display the listbox initially ..then just display the text
+function getGroupDisplay($oGroup, $iSelectedValue = 0) {
+ global $default;
+ if (!isset($oGroup)) {
+ if (Permission::userIsSystemAdministrator()) {
+ // if this is the system administrator, prepend group names with unit name
+ $oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");
+ $oPatternListBox->setFromClause("LEFT OUTER JOIN groups_units_link GUL on ST.id=GUL.group_id " .
+ "LEFT OUTER JOIN units_lookup UL on GUL.unit_id=UL.id");
+ $oPatternListBox->setCompositeDisplayName("DISTINCT COALESCE(CONCAT(CONCAT(UL.name, '-'),ST.name),ST.name)");
+ } else if (Permission::userIsUnitAdministrator()) {
+ // else if this is a unit administrator, only display the groups in your unit
+ $oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");
+ $oPatternListBox->setFromClause("INNER JOIN $default->owl_groups_units_table GUL on ST.id=GUL.group_id");
+ $oPatternListBox->setWhereClause("GUL.unit_id=" . User::getUnitID($_SESSION["userID"]));
+ }
+ if ($iSelectedValue != 0) {
+ $oPatternListBox->setSelectedValue($iSelectedValue);
+ }
+
+ return $oPatternListBox->render();
+ } else {
+ return "iId . "\">\n" .
+ $oGroup->getName();
+ }
+
+}
+
+
+function getFilterOptions($fGroupID = 0){
+ global $default;
+ $sToRender .= getGroupDisplay($aGroups, $fGroupID);
+ /*
+ $sToRender .= "
\n";
+}
+
+/**
+ * Views the list of comments for a document
+ * Prints out 1 comment
+ * User needs to call this function many times to list all comments
+ *
+ * @param $iNum -> its the iterative index of the current comment
+ * @param $iThread -> a valid Thread Object
+ * @param $oComment -> a valid Comment Object
+ * @param $oUser -> a valid User Object (Logged in user)
+ */
+function getViewComment($iNum,$oThread,$oComment,$oUser) {
+ global $default;
+
+ $iSubjectChars = 59;
+ // If iNum is odd then highlight it
+ if (($iNum%2) == 1) $BGcolor = "#F5F6EE";
+ if (($iNum%2) == 0) $UserBGcolor = "#F5F6EE";
+
+ // If the Subject string is too long
+ if (strlen($oComment->getSubject())>$iSubjectChars ) $dotdot = " ...";
+ if (strlen($oUser->getUserName())> 13 ) $Userdotdot = " ...";
+
+ // If this is the first Subject line then create a table
+ if ($iNum == 1) {
+ $sHeading = "Document Discussion Comments";
+
+ $sToRender .= renderHeading($sHeading );
+ $sToRender .= renderDocumentPath($oThread->getDocumentID());
+ $sToRender .= "