diff --git a/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsBL.php b/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsBL.php
index 0eddfd4..687c9fc 100644
--- a/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsBL.php
+++ b/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsBL.php
@@ -8,78 +8,22 @@
*
*/
- require_once("../../../../../config/dmsDefaults.php");
-if (checkSession()) {
- require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc");
- require_once("listGroupsUI.inc");
- require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
- require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
- require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
- require_once("$default->fileSystemRoot/lib/users/User.inc");
- require_once("$default->fileSystemRoot/lib/security/permission.inc");
- require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
- require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
- require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc");
- require_once("$default->fileSystemRoot/lib/visualpatterns/PatternBrowsableSearchResults.inc");
- require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
- require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc");
- require_once("$default->fileSystemRoot/presentation/Html.inc");
-
-
- $oPatternCustom = & new PatternCustom();
-
-if(checkSession()) {
+require_once("../../../../../config/dmsDefaults.php");
+require_once("$default->fileSystemRoot/lib/users/User.inc");
+require_once("$default->fileSystemRoot/lib/security/permission.inc");
+require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
+require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc");
+require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
+require_once("$default->fileSystemRoot/presentation/Html.inc");
+require_once("listGroupsUI.inc");
- $oPatternCustom->addHtml(renderHeading("Current System Groups")); // Create the Heading
- $oPatternCustom->addHtml("
Filter by Unit "); //
-
- if (($fUnitID != "")) { // Check if should use the query string OR ...
- $oUnit = Unit::get($fUnitID);
- $oPatternCustom->addHtml(getFilterOptions($sFilterOptions) . "
\n"); // Get Groups Dropdown for filter option
- } else { //if ($_SESSION['GroupUnitFilter'][0]->iSessionUnitID != ""){ // ... should use session variable
-
- $oPatternCustom->addHtml(getFilterOptions($sFilterOptions) . ""); // Get Groups Dropdown for filter option
- }
- $oPatternCustom->addHtml(getSubmit());
- $oPatternCustom->addHtml(" ");
-
- if ($oUnit) {
- $oPatternCustom->addHtml(" Active Unit filter: " . $oUnit->getName() . " ");
- }
- $main->setFormAction($_SERVER['PHP_SELF']);
-
-
- if($fUnitID != "") { // Filter Option
- $sWhereStatement = "WHERE groups_units_link.unit_id =$fUnitID ";
- }
- $sQuery = "SELECT groups_lookup.id as groupID, units_lookup.name as UnitNameB4, groups_lookup.name as name, 'Edit' , 'Delete', 'Edit Units', " .
- "CASE WHEN units_lookup.name Is Null THEN 'No Unit Assigned ' ELSE units_lookup.name END AS UnitName " .
- "FROM (groups_lookup LEFT join groups_units_link on groups_lookup.id = groups_units_link.group_id) " .
- "LEft join units_lookup on units_lookup.id = groups_units_link.unit_id " .
- $sWhereStatement . " " .
- "ORDER BY groups_lookup.name ";
-
- $aColumns = array("name", "UnitName", "Edit", "Delete", "Edit Units");
- $aColumnNames = array( "Name", "Unit Name", "Edit", "Delete", "Edit Units");
- $aColumnTypes = array(1,1,3,3,3);
- $aDBColumnArray = array("groupID");
- $aQueryStringVariableNames = array("fGroupID");
-
- $aHyperLinkURL = array( 2=> "$default->rootUrl/control.php?action=editGroup",
- 3=> "$default->rootUrl/control.php?action=removeGroup",
- 4=> "$default->rootUrl/control.php?action=editGroupUnit");
-
- $oSearchResults = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnNames, "100%", $aHyperLinkURL,$aDBColumnArray,$aQueryStringVariableNames);
-
- $oSearchResults->setDisplayColumnHeadings(true);
- $htmlTables = $oSearchResults->render() ;
-
- $oPatternCustom->addHtml($htmlTables);
-
- } // end of if checksession
-
+if (checkSession()) {
+ $oPatternCustom = & new PatternCustom();
+ $oPatternCustom->setHtml(getPage($fUnitID));
+ require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
$main->setCentralPayload($oPatternCustom);
- $main->render();
+ $main->setFormAction($_SERVER['PHP_SELF']);
+ $main->render();
}
?>
diff --git a/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsUI.inc b/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsUI.inc
index f181041..465c4c1 100644
--- a/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsUI.inc
+++ b/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsUI.inc
@@ -8,223 +8,59 @@
*
*/
-function getSubmit() {
+function getAddGroupLink() {
global $default;
- $sToRender = " graphicsUrl/widgets/select.gif\" value=\"submit\" border=\"0\"/>\n";
- return $sToRender;
+ $sBGColor = $default->siteMap->getSectionColour("Administration", "td");
+ return "" . generateControllerLink("addGroup", "", "Add A Group ") . "
\n";
}
-// 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($oUnit){
- global $default;
-
- $sToRender .= getUnitDisplay($oUnit);
-
- return $sToRender ;
-}
// display the listbox initially ..then just display the text
-function getUnitDisplay($oUnit) {
+function getUnitDisplay($iUnitID) {
global $default;
if (Permission::userIsUnitAdministrator()) {
- $oUnit = Unit::get(User::getUnitID($_SESSION["userID"]));
- }
- if (!isset($oUnit)) {
- $oPatternListBox = & new PatternListBox($default->owl_units_table, "name", "id", "fUnitID");
- return $oPatternListBox->render();
- } else {
- return " iId . "\">\n" .
- $oUnit->getName();
+ $iUnitID = User::getUnitID($_SESSION["userID"]);
}
-
+ $oPatternListBox = & new PatternListBox($default->owl_units_table, "name", "id", "fUnitID");
+ $oPatternListBox->setPostBackOnChange(true);
+ if ($iUnitID != 0) {
+ $oPatternListBox->setSelectedValue($iUnitID);
+ }
+ return "Filter by Unit " . $oPatternListBox->render() . "
";
}
-
-function getPageButtons($oThread){
+function getGroups($fUnitID) {
global $default;
-
- $sToRender .= "\n";
-
- return $sToRender ;
+ $sQuery = "SELECT groups_lookup.id as groupID, units_lookup.name as UnitNameB4, groups_lookup.name as name, 'Edit' , 'Delete', 'Edit Units', " .
+ "CASE WHEN units_lookup.name Is Null THEN 'No Unit Assigned ' ELSE units_lookup.name END AS UnitName " .
+ "FROM (groups_lookup LEFT join groups_units_link on groups_lookup.id = groups_units_link.group_id) " .
+ "LEft join units_lookup on units_lookup.id = groups_units_link.unit_id " .
+ ($fUnitID ? "WHERE groups_units_link.unit_id =$fUnitID " : "") .
+ "ORDER BY groups_lookup.name ";
+
+ $aColumns = array("name", "UnitName", "Edit", "Delete", "Edit Units");
+ $aColumnNames = array( "Name", "Unit Name", "Edit", "Delete", "Edit Units");
+ $aColumnTypes = array(1,1,3,3,3);
+ $aDBColumnArray = array("groupID");
+ $aQueryStringVariableNames = array("fGroupID");
+
+ $aHyperLinkURL = array( 2=> "$default->rootUrl/control.php?action=editGroup",
+ 3=> "$default->rootUrl/control.php?action=removeGroup",
+ 4=> "$default->rootUrl/control.php?action=editGroupUnit");
+
+ $oSearchResults = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnNames, "100%", $aHyperLinkURL,$aDBColumnArray,$aQueryStringVariableNames);
+ $oSearchResults->setDisplayColumnHeadings(true);
+ return $oSearchResults->render() ;
}
-// If there are no threads to view for a document
-function getViewFailPage($sMessage)
-{
+function getPage($fUnitID) {
global $default;
-
- if (strlen($sMessage)>0){
- $sToRender = $sMessage;
- }
- else $sToRender = "Current document has no discussion. Press the ADD button to start a discussion.";
-
- return $sToRender;
-}
+ $sToRender .= renderHeading("Current System Groups");
-/**
- * Page to create a new thread
- *
- * @param $fDocumentID -> a valid document ID
- */
-function getNewThreadOption($fDocumentID) {
- global $default;
-
- $sToRender .= "Would you like to create a new Discussion thread for this document?";
- $sToRender .= " ";
- $sToRender .= " graphicsUrl/widgets/new.gif\" border=\"0\"> ";
- $sToRender .= " graphicsUrl/widgets/cancel.gif\" border=\"0\"> ";
-
- return $sToRender;
-}
-
-/**
- * Renders the heading for the page
- *
- * @param $sHeading -> text heading for the page
- */
-function renderHeading1($sHeading) {
- global $default;
-
- $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
- $sColor = $default->siteMap->getSectionColour($sSectionName, "th");
- $sToRender = "\n";
- $sToRender .= "$sHeading \n";
- $sToRender .= " \n";
- $sToRender .= " \n";
- $sToRender .= "
\n";
- return $sToRender;
-}
-
-/**
- * Renders the path for the document
- *
- * @param $fDocumentID -> a valid document ID
- */
-function renderDocumentPath($iDocumentID) {
- global $default;
-
- $oDocument = & Document::get($iDocumentID);
- $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
- $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
- $sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($oDocument->getFolderID()), Folder::getFolderPathNamesAsArray($oDocument->getFolderID()), "$default->rootUrl/control.php?action=browse") . " > ";
- $sDocumentPath .= "rootUrl/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php?fDocumentID=" . $oDocument->getID() . "&fForInlineView=1\">" . $oDocument->getName() . " ";
- return "\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 .= " \n";
- $sToRender .= "\n\n";}
- return $sToRender;
-}
-
-/**
- * Views a single thread comment with its text body
- *
- * @param $iDocumentID -> a valid Document ID
- * @param $oComment -> a valid Comment Object
- * @param $oUser -> a valid User Object (Logged in user)
- */
-function getCommentBody($oComment, $iDocumentID, $oUser) {
- global $default;
-
- $sHeading = "Document Comment";
-
- $sToRender .= renderHeading($sHeading);
- $sToRender .= renderDocumentPath($iDocumentID);
-
- $sToRender .= "Author: " . $oUser->getUserName() . " \n";
- $sToRender .= "\n";
- $sToRender .= "getID()) . "\"> graphicsUrl/widgets/reply.gif\" border=\"0\" /> ";
- $sToRender .= " graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" > \n";
- $sToRender .= "Subject: ";
- $sToRender .= "" . $oComment->getSubject() . " ";
- $sToRender .= " Date: " . $oComment->getDate() . " ";
- $sToRender .= " ";
- $sToRender .= urldecode(str_replace("%0D%0A"," ",str_replace("+", " ",$oComment->getBody()))); // Div Views as HTML
- $sToRender .= "
";
-
- $sToRender .= "
";
-
- return $sToRender;
+ $sToRender .= getAddGroupLink();
+ $sToRender .= getUnitDisplay($fUnitID);
+ $sToRender .= getGroups($fUnitID);
+ return $sToRender;
}
-
?>
\ No newline at end of file