From 9ccf6238911e613fc824ef3f051d37f5fdcfd62e Mon Sep 17 00:00:00 2001 From: Michael Joseph Date: Sun, 3 Aug 2003 13:53:24 +0000 Subject: [PATCH] (#2813) refactored and tidied incorporated addDocType link --- presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesBL.php | 67 ++++++++++++++++--------------------------------------------------- presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesUI.inc | 231 ++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 files changed, 44 insertions(+), 254 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesBL.php b/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesBL.php index d80a01d..78d66da 100644 --- a/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesBL.php +++ b/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesBL.php @@ -1,6 +1,6 @@ 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("listDocTypesUI.inc"); +require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); -if (checkSession()) { - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); - require_once("listDocTypesUI.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/presentation/Html.inc"); - - +if (checkSession()) { $oPatternCustom = & new PatternCustom(); - -if(checkSession()) { - global $default; - - $oPatternCustom->addHtml(renderHeading("Document Type Management")); // Create the Heading - - $main->setFormAction($_SERVER['PHP_SELF']); - - $sQuery = "SELECT id as DocTypeID, name as DocTypeName, " . - "'Edit', 'Delete', 'Edit Fields' " . - "FROM " . $default->owl_document_types_table . " " . - "ORDER BY name"; - - $aColumns = array("DocTypeName", "Edit", "Delete", "Edit Fields"); - $aColumnNames = array("Name", "Edit", "Delete", "Edit Fields"); - $aColumnTypes = array(1,3,3,3); - $aDBColumnArray = array("DocTypeID"); - $aQueryStringVariableNames = array("fDocTypeID"); - - $aHyperLinkURL = array( 1=> "$default->rootUrl/control.php?action=editDocType&fDocTypeSelected=1", - 2=> "$default->rootUrl/control.php?action=removeDocType", - 3=> "$default->rootUrl/control.php?action=editDocTypeFields&fDocTypeSelected=1"); - - $oSearchResults = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnNames, "100%", $aHyperLinkURL,$aDBColumnArray,$aQueryStringVariableNames); - $oSearchResults->setDisplayColumnHeadings(true); - $htmlTables = $oSearchResults->render() ; - - $oPatternCustom->addHtml($htmlTables); - - } // end of if checksession - + $oPatternCustom->setHtml(getPage($fGroupID)); + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $main->setCentralPayload($oPatternCustom); - $main->render(); + $main->setFormAction($_SERVER['PHP_SELF']); + $main->render(); } -?> +?> \ No newline at end of file diff --git a/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesUI.inc b/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesUI.inc index 8e8563c..f7d4fc8 100644 --- a/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesUI.inc @@ -1,6 +1,6 @@ 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"; - $sToRender .= "\n"; - $sToRender .= "\n"; - - $sToRender .= "
graphicsUrl/widgets/addcomment.gif\" border=\"0\" />graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" />
\n";*/ - return $sToRender ; -} - -function getPageButtons($oThread){ - global $default; - - $sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "\n"; - - $sToRender .= "
graphicsUrl/widgets/addcomment.gif\" border=\"0\" />graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" />
\n"; - //$sToRender .= "graphicsUrl/widgets/addcomment.gif\" border=\"0\" />\n"; - //$sToRender .= "graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" />\n"; - return $sToRender ; -} - -// If there are no threads to view for a document -function getViewFailPage($sMessage) -{ + $sQuery = "SELECT id as DocTypeID, name as DocTypeName, " . + "'Edit', 'Delete', 'Edit Fields' " . + "FROM " . $default->owl_document_types_table . " " . + "ORDER BY name"; + + $aColumns = array("DocTypeName", "Edit", "Delete", "Edit Fields"); + $aColumnNames = array("Name", "Edit", "Delete", "Edit Fields"); + $aColumnTypes = array(1,3,3,3); + $aDBColumnArray = array("DocTypeID"); + $aQueryStringVariableNames = array("fDocTypeID"); + + $aHyperLinkURL = array( 1=> "$default->rootUrl/control.php?action=editDocType&fDocTypeSelected=1", + 2=> "$default->rootUrl/control.php?action=removeDocType", + 3=> "$default->rootUrl/control.php?action=editDocTypeFields&fDocTypeSelected=1"); + + $oSearchResults = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnNames, "100%", $aHyperLinkURL,$aDBColumnArray,$aQueryStringVariableNames); + $oSearchResults->setDisplayColumnHeadings(true); + return $oSearchResults->render() ; +} + +function getPage() { 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; -} - -/** - * 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; -} + $sToRender .= renderHeading("Current Document Types"); -/** - * 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 .= "\n"; - $sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "
$sHeading
\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 "
$sDocumentPath
\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 .= ""; - $sToRender .= ""; - $sToRender .= ""; - $sToRender .= ""; - $sToRender .= ""; - $sToRender .= "
Views: " . $oThread->getNumberOfViews() . "Replies: " . $oThread->getNumberOfReplies() . "graphicsUrl/widgets/addcomment.gif\" border=\"0\" />"; - $sToRender .= "graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" >

\n"; - $sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "\n"; - } - - $sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "\n"; - - // If this is the last subject line then close the table - if ($iNum == ($oThread->getNumberOfReplies())) { $sToRender .= "\n
SubjectAuthorDate
$iNum getID() . "&iDocumentID=" . $oThread->getDocumentID() . "\" title=\"" . $oComment->getSubject() . "\">" . substr($oComment->getSubject(),0,$iSubjectChars ) . $dotdot . "getUserName()\">" . substr($oUser->getUserName(),0,10) . $Userdotdot . "" . $oComment->getDate() . "
\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 .= "
\n"; - $sToRender .= "\n"; - $sToRender .= ""; - - $sToRender .= "
Author: " . $oUser->getUserName() . "\n"; - $sToRender .= "getID()) . "\">graphicsUrl/widgets/reply.gif\" border=\"0\" />"; - $sToRender .= "graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" >
Subject: "; - $sToRender .= "" . $oComment->getSubject() . ""; - $sToRender .= "Date: " . $oComment->getDate() . "   
"; - $sToRender .= "
"; - $sToRender .= urldecode(str_replace("%0D%0A","
",str_replace("+", " ",$oComment->getBody()))); // Div Views as HTML - $sToRender .= "
"; - - return $sToRender; + // add user link + $sToRender .= getAddLink("addDocType", "Add A Document Type"); + $sToRender .= getDocumentTypes(); + return $sToRender; } - ?> \ No newline at end of file -- libgit2 0.21.4