Commit 02db75330a01c05fc7f0c719c72a2b842044b299
1 parent
3b006136
changed to use switched divs
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2168 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
329 additions
and
376 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | -* documentViewUI.php | |
| 4 | -* Contains HTML information required to build the document view page. | |
| 5 | -* Will be used by documentViewBL.php | |
| 6 | -* | |
| 7 | -* Variables expected: | |
| 8 | -* o $fDocumentID Primary key of document to view | |
| 9 | -* | |
| 10 | -* | |
| 11 | -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | |
| 12 | -* @date 21 January 2003 | |
| 13 | -* @package presentation.lookAndFeel.knowledgeTree.documentManager | |
| 14 | -*/ | |
| 3 | + * $Id$ | |
| 4 | + * | |
| 5 | + * Contains HTML information required to build the document view page. | |
| 6 | + * Will be used by documentViewBL.php | |
| 7 | + * | |
| 8 | + * Variables expected: | |
| 9 | + * o $fDocumentID Primary key of document to view | |
| 10 | + * | |
| 11 | + * | |
| 12 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | |
| 13 | + * @date 21 January 2003 | |
| 14 | + * @package presentation.lookAndFeel.knowledgeTree.documentmanagement | |
| 15 | + */ | |
| 15 | 16 | |
| 16 | -function renderDocumentPath($oDocument) { | |
| 17 | +function renderDocumentPath($oDocument, $bDisplayActions) { | |
| 17 | 18 | global $default; |
| 18 | 19 | $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); |
| 19 | - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td"); | |
| 20 | - $sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($oDocument->getFolderID()), Folder::getFolderPathNamesAsArray($oDocument->getFolderID()), "$default->rootUrl/control.php?action=browse") . " > "; | |
| 21 | - $sDocumentPath .= "<a href=\"$default->rootUrl/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php?fDocumentID=" . $oDocument->getID() . "&fForInlineView=1\">" . $oDocument->getName() . "</a>"; | |
| 22 | - return "<table border=0 cellpadding=\"5\" width = 100%><tr><td bgcolor=\"$sTDBGColour\">$sDocumentPath</td></tr></table>\n"; | |
| 20 | + $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td"); | |
| 21 | + if ($bDisplayActions) { | |
| 22 | + $sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($oDocument->getFolderID()), Folder::getFolderPathNamesAsArray($oDocument->getFolderID()), "$default->rootUrl/control.php?action=browse") . " > "; | |
| 23 | + $sDocumentPath .= "<a onClick=\"alert('This will view a copy of the document current in the DMS. Any changes to this file will not be managed in the DMS.'); return true;\" href=\"" . generateControllerUrl("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForInlineView=1") . "\">" . $oDocument->getName() . "</a>"; | |
| 24 | + //$sDocumentPath .= generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForInlineView=1", $oDocument->getName()); | |
| 25 | + } else { | |
| 26 | + $sDocumentPath = $oDocument->getDisplayPath(); | |
| 27 | + } | |
| 28 | + return "<table border=0 cellpadding=\"5\" width=\"610\"><tr bgcolor=\"$sTDBGColour\"><td width=\"87%\">$sDocumentPath</td>" . ($bDisplayActions ? "<td width=\"15%\">Actions</td>" : "") . "</tr></table>\n"; | |
| 23 | 29 | } |
| 24 | 30 | |
| 25 | -function renderDocumentData($oDocument) { | |
| 31 | +function renderDocumentData($oDocument, $bEditable) { | |
| 26 | 32 | global $default; |
| 27 | 33 | $sQuery = "SELECT D.name, D.modified, DTT.datetime AS created, U.name AS initiator, CONCAT(CONCAT(D.major_version, '.'), D.minor_version) AS version, WDSL.name AS status, DTL.name AS document_type, D.is_checked_out, COALESCE(U2.name, '') AS c_user " . |
| 28 | 34 | "FROM $default->owl_documents_table AS D INNER JOIN $default->owl_web_documents_table AS WD ON WD.document_id = D.ID " . |
| ... | ... | @@ -40,50 +46,24 @@ function renderDocumentData($oDocument) { |
| 40 | 46 | $aColumnTypes = array(1,1,1,1,1,1,1,1); |
| 41 | 47 | $oPatternListFromQuery = & new PatternListFromQuery($sQuery, $aColumns, $aColumnNames, $aColumnTypes); |
| 42 | 48 | $oPatternListFromQuery->setTableHeading("Document Data"); |
| 43 | - $oPatternListFromQuery->setTableWidth("90%"); | |
| 44 | - return $oPatternListFromQuery->render(); | |
| 45 | -} | |
| 46 | - | |
| 47 | -function renderEditableLinkedDocuments($oDocument) { | |
| 48 | - global $default; | |
| 49 | - | |
| 50 | - $sQuery = "SELECT D.id AS child_document_id, D.name, DL.id as document_link_id, DL.parent_document_id AS parent_document_id, 'Unlink' AS unlink " . | |
| 51 | - "FROM documents AS D INNER JOIN document_link AS DL ON D.id = DL.child_document_id " . | |
| 52 | - "WHERE DL.parent_document_id = " . $oDocument->getID(); | |
| 53 | - | |
| 54 | - $aColumns = array("name", "unlink"); | |
| 55 | - $aColumnHeaders = array("Document"); | |
| 56 | - $aColumnTypes = array(3,3); | |
| 57 | - $aDBColumnArray = array("parent_document_id", "child_document_id","document_link_id"); | |
| 58 | - $aQueryStringVariableNames = array("fParentDocumentID","fChildDocumentID", "fDocumentLinkID"); | |
| 59 | - $aLinkURLs = array(0=>"$default->rootUrl/control.php?action=viewDocument", 1=>"$default->rootUrl/control.php?action=removeDocumentLink"); | |
| 60 | - | |
| 61 | - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "100%", $aLinkURLs,$aDBColumnArray,$aQueryStringVariableNames); | |
| 62 | - $oPatternTableSqlQuery->setTableHeading("Linked documents"); | |
| 63 | - $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | |
| 64 | - return $oPatternTableSqlQuery->render(); | |
| 65 | - | |
| 66 | -} | |
| 49 | + $oPatternListFromQuery->setTableWidth("400"); | |
| 50 | + | |
| 51 | + $sToRender .= "\t<table border=\"0\" width=\"100%\">\n"; | |
| 52 | + $sToRender .= "\t<tr>\n"; | |
| 53 | + $sToRender .= "\t\t<td>" . $oPatternListFromQuery->render() . "</td>\n"; | |
| 54 | + $sToRender .= "\t</tr>\n"; | |
| 55 | + if ($bEditable) { | |
| 56 | + $sToRender .= "\t<tr>\n"; | |
| 57 | + $sToRender .= "<td colspan=\"2\"><a href=\"$default->rootUrl/control.php?action=modifyDocument&fDocumentID=" . $oDocument->getID() . "\"><image src=\"$default->graphicsUrl/widgets/edit.gif\" border=\"0\"></a></td>\n"; | |
| 58 | + $sToRender .= "\t</tr>\n"; | |
| 59 | + } | |
| 60 | + $sToRender .= "\t</table>\n"; | |
| 67 | 61 | |
| 68 | -function renderNonEditableLinkedDocuments($oDocument) { | |
| 69 | - global $default; | |
| 70 | - | |
| 71 | - $sQuery = "SELECT D.id, D.name, 'Delete' AS del " . | |
| 72 | - "FROM documents AS D INNER JOIN document_link AS DL ON D.id = DL.child_document_id " . | |
| 73 | - "WHERE DL.parent_document_id = " . $oDocument->getID(); | |
| 74 | - | |
| 75 | - $aColumns = array("name","del"); | |
| 76 | - $aColumnNames = array("Document"); | |
| 77 | - $aColumnTypes = array(1,3); | |
| 78 | - | |
| 79 | - $oPatternListFromQuery = & new PatternListFromQuery($sQuery, $aColumns, $aColumnNames, $aColumnTypes); | |
| 80 | - $oPatternListFromQuery->setTableHeading("Linked documents"); | |
| 81 | - $oPatternListFromQuery->setTableWidth("90%"); | |
| 82 | - return $oPatternListFromQuery->render(); | |
| 62 | + return $sToRender; | |
| 83 | 63 | } |
| 84 | 64 | |
| 85 | 65 | |
| 86 | -function renderGenericMetaData($oDocument) { | |
| 66 | +function renderGenericMetaData($oDocument, $sDivName, $bEditable) { | |
| 87 | 67 | global $default; |
| 88 | 68 | $sQuery = "SELECT DF.name AS name, DFL.value as value " . |
| 89 | 69 | "FROM $default->owl_documents_table AS D INNER JOIN $default->owl_document_fields_table AS DFL ON D.id = DFL.document_id " . |
| ... | ... | @@ -93,13 +73,26 @@ function renderGenericMetaData($oDocument) { |
| 93 | 73 | $aColumns = array("name", "value"); |
| 94 | 74 | $aColumnHeaders = array("Tag", "Value"); |
| 95 | 75 | $aColumnTypes = array(1,1); |
| 96 | - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%"); | |
| 76 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "540"); | |
| 97 | 77 | $oPatternTableSqlQuery->setTableHeading("Generic Meta Data"); |
| 98 | - return $oPatternTableSqlQuery->render(); | |
| 99 | - | |
| 78 | + | |
| 79 | + $sToRender .= "\t<table border=\"0\" width=\"100%\">\n"; | |
| 80 | + $sToRender .= "\t<tr>\n"; | |
| 81 | + $sToRender .= "\t<td>" . $oPatternTableSqlQuery->render() . "</td>\n"; | |
| 82 | + $sToRender .= "\t</tr>\n"; | |
| 83 | + if ($bEditable) { | |
| 84 | + $sToRender .= "\t<tr>\n"; | |
| 85 | + $sToRender .= "<td><a href=\"$default->rootUrl/control.php?action=modifyDocumentGenericMetaData&fDocumentID=" . $oDocument->getID() . "\"><image src=\"$default->graphicsUrl/widgets/edit.gif\" border=\"0\"></a></td>\n"; | |
| 86 | + $sToRender .= "\t</tr>\n"; | |
| 87 | + } | |
| 88 | + $sToRender .= "\t</table>\n"; | |
| 89 | + | |
| 90 | + return renderSectionDiv($sDivName, $sToRender); | |
| 100 | 91 | } |
| 101 | 92 | |
| 102 | -function renderTypeSpecificMetaData($oDocument) { | |
| 93 | +function renderTypeSpecificMetaData($oDocument, $sDivName, $bEditable) { | |
| 94 | + global $default; | |
| 95 | + | |
| 103 | 96 | $sQuery = "SELECT DF.name AS name, DFL.value AS value " . |
| 104 | 97 | "FROM documents AS D INNER JOIN document_fields_link AS DFL ON D.id = DFL.document_id " . |
| 105 | 98 | "INNER JOIN document_fields AS DF ON DF.ID = DFL.document_field_id " . |
| ... | ... | @@ -110,58 +103,25 @@ function renderTypeSpecificMetaData($oDocument) { |
| 110 | 103 | $aColumns = array("name", "value"); |
| 111 | 104 | $aColumnHeaders = array("Tag", "Value"); |
| 112 | 105 | $aColumnTypes = array(1,1); |
| 113 | - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%"); | |
| 106 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "540"); | |
| 114 | 107 | $oPatternTableSqlQuery->setTableHeading("Type Specific Meta Data"); |
| 115 | 108 | $oPatternTableSqlQuery->setEmptyTableMessage("No Type Specific Meta Data"); |
| 116 | - return $oPatternTableSqlQuery->render(); | |
| 117 | -} | |
| 118 | - | |
| 119 | -function renderEditableDocumentRouting($oDocument) { | |
| 120 | - global $default; | |
| 121 | - $sQuery = "SELECT D.id as document_id, GFAL.id as id, R.name AS role_name, COALESCE(U.Name, U2.Name, 'Not assigned') AS name, GFAL.precedence AS precedence, COALESCE(FURL.active,0) AS active, COALESCE(FURL.done, 0) AS done, 'Edit' as edit " . | |
| 122 | - "FROM documents AS D INNER JOIN $default->owl_groups_folders_approval_table AS GFAL ON D.folder_id = GFAL.folder_id " . | |
| 123 | - "INNER JOIN roles AS R ON GFAL.role_id = R.id " . | |
| 124 | - "LEFT OUTER JOIN users AS U2 ON U2.id = GFAL.user_id " . | |
| 125 | - "LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.group_folder_approval_id = GFAL.id AND FURL.document_id = D.id " . | |
| 126 | - "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " . | |
| 127 | - "WHERE D.id = " . $oDocument->getID() . " " . | |
| 128 | - "ORDER BY GFAL.precedence, role_name ASC"; | |
| 129 | - $aColumns = array("role_name", "name", "precedence", "active", "done", "edit"); | |
| 130 | - $aColumnHeaders = array("Role", "User", "Seq", "Active", "Done", ""); | |
| 131 | - $aColumnTypes = array(1,1,1,1,1,3); | |
| 132 | - $aDBColumnArray = array("id","document_id","active","done"); | |
| 133 | - $aQueryStringVariableNames = array("fFolderCollaborationID", "fDocumentID","fIsActive","fIsDone"); | |
| 134 | - $aLinkURLs = array(5=>"$default->rootUrl/control.php?action=modifyDocumentRouting"); | |
| 135 | - | |
| 136 | - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "10%", $aLinkURLs,$aDBColumnArray,$aQueryStringVariableNames); | |
| 137 | - $oPatternTableSqlQuery->setTableHeading("Document Routing"); | |
| 138 | - $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | |
| 139 | - return $oPatternTableSqlQuery->render(); | |
| 140 | - | |
| 141 | -} | |
| 142 | - | |
| 143 | -function renderNonEditableDocumentRouting($oDocument) { | |
| 144 | - global $default; | |
| 145 | - $sQuery = "SELECT D.id as document_id, GFAL.id as id, R.name AS role_name, COALESCE(U.Name, 'Not assigned') AS name, GFAL.precedence AS precedence, COALESCE(FURL.active,0) AS active, COALESCE(FURL.done, 0) AS done " . | |
| 146 | - "FROM documents AS D INNER JOIN $default->owl_groups_folders_approval_table AS GFAL ON D.folder_id = GFAL.folder_id " . | |
| 147 | - "INNER JOIN roles AS R ON GFAL.role_id = R.id " . | |
| 148 | - "LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.group_folder_approval_id = GFAL.id AND FURL.document_id = D.id " . | |
| 149 | - "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " . | |
| 150 | - "WHERE D.id = " . $oDocument->getID() . " " . | |
| 151 | - "ORDER BY GFAL.precedence, role_name ASC"; | |
| 152 | - | |
| 153 | - $aColumns = array("role_name", "name", "precedence", "active", "done"); | |
| 154 | - $aColumnHeaders = array("Role", "User", "Seq", "Active", "Done"); | |
| 155 | - $aColumnTypes = array(1,1,1,1,1); | |
| 156 | - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "10%", "$default->rootUrl/control.php?action=modifyDocumentRouting",$aDBColumnArray,$aQueryStringVariableNames); | |
| 157 | - $oPatternTableSqlQuery->setTableHeading("Document Routing"); | |
| 158 | - $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | |
| 159 | - return $oPatternTableSqlQuery->render(); | |
| 160 | - | |
| 109 | + | |
| 110 | + $sToRender .= "\t<table border=\"0\" width=\"100%\">\n"; | |
| 111 | + $sToRender .= "\t<tr>\n"; | |
| 112 | + $sToRender .= "\t\t<td>" . $oPatternTableSqlQuery->render() . "</td>\n"; | |
| 113 | + $sToRender .= "\t</tr>\n"; | |
| 114 | + if ($bEditable) { | |
| 115 | + $sToRender .= "\t<tr>\n"; | |
| 116 | + $sToRender .= "<td><a href=\"$default->rootUrl/control.php?action=modifyDocumentTypeMetaData&fDocumentID=" . $oDocument->getID() . "\"><image src=\"$default->graphicsUrl/widgets/edit.gif\" border=\"0\"></a></td>\n"; | |
| 117 | + $sToRender .= "\t</tr>\n"; | |
| 118 | + } | |
| 119 | + $sToRender .= "\t</table>\n"; | |
| 120 | + return renderSectionDiv($sDivName, $sToRender); | |
| 161 | 121 | } |
| 162 | 122 | |
| 163 | -function renderDocumentArchiveSettings($oDocument) { | |
| 164 | - global $default; | |
| 123 | +function renderEditableDocumentArchiveSettings($oDocument) { | |
| 124 | + global $default; | |
| 165 | 125 | $sQuery = "SELECT d.id, atl.name, 'Edit' AS edit FROM $default->owl_document_archiving_table AS da " . |
| 166 | 126 | "INNER JOIN $default->owl_archiving_type_lookup_table AS atl ON da.archiving_type_id=atl.id " . |
| 167 | 127 | "INNER JOIN $default->owl_documents_table AS d ON da.document_id=d.id " . |
| ... | ... | @@ -173,111 +133,74 @@ function renderDocumentArchiveSettings($oDocument) { |
| 173 | 133 | $aDBColumnArray = array("id"); |
| 174 | 134 | $aQueryStringVariableNames = array("fDocumentID"); |
| 175 | 135 | $aLinkURLs = array(1=>"$default->rootUrl/control.php?action=modifyDocumentArchiveSettings"); |
| 176 | - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%", $aLinkURLs ,$aDBColumnArray,$aQueryStringVariableNames); | |
| 136 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "540", $aLinkURLs ,$aDBColumnArray,$aQueryStringVariableNames); | |
| 177 | 137 | $oPatternTableSqlQuery->setTableHeading("Archiving Settings"); |
| 178 | 138 | $oPatternTableSqlQuery->setEmptyTableMessage("No archiving settings"); |
| 179 | 139 | $oPatternTableSqlQuery->setDisplayColumnHeadings(true); |
| 180 | 140 | return $oPatternTableSqlQuery->render(); |
| 181 | 141 | } |
| 182 | 142 | |
| 183 | -function displayActionButtons($oDocument, $bEdit) { | |
| 184 | - global $default; | |
| 185 | - if ($bEdit) { | |
| 186 | - // display the check in button if the document is checked out and you checked the document out | |
| 187 | - if ($oDocument->getIsCheckedOut() && ($oDocument->getCheckedOutUserID() == $_SESSION["userID"])) { | |
| 188 | - $sToRender = "<td><a href=\"" . generateControllerLink("checkInDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/checkin.gif\" border=\"0\" /></a></td>\n"; | |
| 189 | - // otherwise display the check out button | |
| 190 | - } else { | |
| 191 | - $sToRender = "<td><a href=\"" . generateControllerLink("checkOutDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/checkout.gif\" border=\"0\" /></a></td>\n"; | |
| 192 | - } | |
| 193 | - } | |
| 194 | - | |
| 195 | - $sToRender .= "<td><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/email.gif\" border=\"0\" /></a></td>\n"; | |
| 196 | - if ($bEdit) { | |
| 197 | - $sToRender .= "<td><a href=\"" . generateControllerLink("deleteDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/delete.gif\" border=\"0\" /></a></td>\n"; | |
| 198 | - } | |
| 199 | - $sToRender .= "<td><a href=\"" . generateControllerLink("viewHistory", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/history.gif\" border=\"0\" /></a></td>\n"; | |
| 200 | - if ($bEdit) { | |
| 201 | - $sToRender .= "<td><a href=\"" . generateControllerLink("moveDocument", "fFolderID=" . $oDocument->getFolderID() . "&fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/move.gif\" border=\"0\" /></a></td>\n"; | |
| 202 | - } | |
| 203 | - | |
| 204 | - // display the unsubscribe button if the user is subscribed to the document | |
| 205 | - if (Subscription::exists($_SESSION["userID"], $oDocument->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"))) { | |
| 206 | - $sToRender .= "<td><a href=\"" . generateControllerLink("removeSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/unsubscribe.gif\" border=\"0\" /></a></td>\n"; | |
| 207 | - // otherwise display the subscribe button | |
| 208 | - } else { | |
| 209 | - $sToRender .= "<td><a href=\"" . generateControllerLink("addSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/subscribe.gif\" border=\"0\" /></a></td>\n"; | |
| 210 | - } | |
| 211 | - $sToRender .= "<td><a onClick=\"alert('This will download a copy of the document and is not the same as Checking Out a document- changes to this downloaded file will not be managed in the DMS.'); return true;\" href=\"" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForDownload=1") . "\"><img src=\"$default->graphicsUrl/widgets/download.gif\" border=\"0\" /></a></td>\n"; | |
| 212 | - $sToRender .= "<td><a href=\"" . generateControllerLink("viewDiscussion", "fDocumentID=" . $oDocument->getID() . "&fForDiscussion=1") . "\"><img src=\"$default->graphicsUrl/widgets/discussion.gif\" border=\"0\" /></a></td>\n"; | |
| 213 | - // only display the archive button for available documents | |
| 214 | - if (!$oDocument->getIsCheckedOut() || !$oDocument->hasCollaboration() || (!DocumentCollaboration::documentCollaborationStarted($oDocument->getID()))) { | |
| 215 | - $sToRender .= "<td><a href=\"" . generateControllerLink("archiveDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/archive.gif\" border=\"0\" /></a></td>\n"; | |
| 216 | - } | |
| 143 | +function renderNonEditableDocumentArchiveSettings($oDocument) { | |
| 144 | + global $default; | |
| 145 | + $sQuery = "SELECT d.id, atl.name FROM $default->owl_document_archiving_table AS da " . | |
| 146 | + "INNER JOIN $default->owl_archiving_type_lookup_table AS atl ON da.archiving_type_id=atl.id " . | |
| 147 | + "INNER JOIN $default->owl_documents_table AS d ON da.document_id=d.id " . | |
| 148 | + "WHERE d.id = " . $oDocument->getID(); | |
| 217 | 149 | |
| 218 | - $sToRender .= "<td><a href=\"" . generateControllerLink("createDependantDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/archive.gif\" border=\"0\" /></a></td>\n"; | |
| 219 | - | |
| 220 | - return $sToRender; | |
| 150 | + $aColumns = array("name"); | |
| 151 | + $aColumnHeaders = array("Archiving Type"); | |
| 152 | + $aColumnTypes = array(1); | |
| 153 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "540", $aLinkURLs ,$aDBColumnArray,$aQueryStringVariableNames); | |
| 154 | + $oPatternTableSqlQuery->setTableHeading("Archiving Settings"); | |
| 155 | + $oPatternTableSqlQuery->setEmptyTableMessage("No archiving settings"); | |
| 156 | + $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | |
| 157 | + return $oPatternTableSqlQuery->render(); | |
| 221 | 158 | } |
| 222 | 159 | |
| 223 | -function getEditPage($oDocument) { | |
| 224 | - global $default; | |
| 225 | - $iDocumentID = $oDocument->getID(); | |
| 226 | - $sToRender = renderHeading("Document Detail") . renderDocumentPath($oDocument) . "\n<br>\n"; | |
| 227 | - | |
| 228 | - $sToRender .= "<table>\n"; | |
| 229 | - $sToRender .= "<tr>\n"; | |
| 230 | - $sToRender .= displayActionButtons($oDocument, true); | |
| 231 | - $sToRender .= "</tr>\n"; | |
| 232 | - $sToRender .= "</table>\n"; | |
| 233 | - | |
| 234 | - $sToRender .= "<table border = 0>\n"; | |
| 235 | - $sToRender .= "<tr>\n"; | |
| 236 | - $sToRender .= "<td>\n"; | |
| 237 | - | |
| 238 | - $sToRender .= "\t<table border = 0>\n"; | |
| 239 | - $sToRender .= "\t<tr>\n"; | |
| 240 | - $sToRender .= "\t\t<td>" . renderDocumentData($oDocument) . "</td>\n"; | |
| 241 | - $sToRender .= "\t</tr>\n"; | |
| 242 | - $sToRender .= "\t<tr>\n"; | |
| 243 | - $sToRender .= "<td><a href=\"$default->rootUrl/control.php?action=modifyDocument&fDocumentID=$iDocumentID\"><image src=\"$default->graphicsUrl/widgets/edit.gif\" border=\"0\"></a></td>\n"; | |
| 244 | - $sToRender .= "\t</tr>\n"; | |
| 245 | - $sToRender .= "\t<tr>\n"; | |
| 246 | - $sToRender .= "\t<td>" . renderGenericMetaData($oDocument) . "</td>\n"; | |
| 247 | - $sToRender .= "\t</tr>\n"; | |
| 248 | - $sToRender .= "\t<tr>\n"; | |
| 249 | - $sToRender .= "<td><a href=\"$default->rootUrl/control.php?action=modifyDocumentGenericMetaData&fDocumentID=$iDocumentID\"><image src=\"$default->graphicsUrl/widgets/edit.gif\" border=\"0\"></a></td>\n"; | |
| 250 | - $sToRender .= "\t</tr>\n"; | |
| 251 | - $sToRender .= "\t<tr>\n"; | |
| 252 | - $sToRender .= "\t\t<td>" . renderTypeSpecificMetaData($oDocument) . "</td>\n"; | |
| 253 | - | |
| 254 | - $sToRender .= "\t</tr>\n"; | |
| 255 | - $sToRender .= "\t<tr>\n"; | |
| 256 | - $sToRender .= "<td><a href=\"$default->rootUrl/control.php?action=modifyDocumentTypeMetaData&fDocumentID=$iDocumentID\"><image src=\"$default->graphicsUrl/widgets/edit.gif\" border=\"0\"></a></td>\n"; | |
| 257 | - $sToRender .= "\t</tr>\n"; | |
| 258 | - $sToRender .= "\t</table>\n"; | |
| 259 | - $sToRender .= "</td>\n"; | |
| 260 | - $sToRender .= "<td valign=top>\n"; | |
| 261 | - | |
| 262 | - $sToRender .= "\t<table border=\"0\">\n"; | |
| 263 | - | |
| 160 | +function renderDocumentArchiveSettings($oDocument, $sDivName, $bEditable) { | |
| 161 | + global $default; | |
| 162 | + | |
| 163 | + $sToRender .= "\t<table border=\"0\" width=\"100%\">\n"; | |
| 264 | 164 | $sToRender .= "\t<tr>\n"; |
| 265 | - $sToRender .= "\t\t<td>" . renderDocumentArchiveSettings($oDocument) . "</td>\n"; | |
| 165 | + $sToRender .= "\t\t<td>" . ($bEditable ? renderEditableDocumentArchiveSettings($oDocument) : renderNonEditableDocumentArchiveSettings($oDocument)) . "</td>\n"; | |
| 266 | 166 | $sToRender .= "\t</tr>"; |
| 267 | - // if there are no archiving settings then allow their addition | |
| 268 | - $oDocumentArchiving = DocumentArchiving::getFromDocumentID($iDocumentID); | |
| 269 | - if (!$oDocumentArchiving) { | |
| 270 | - $sToRender .= "\t<tr>\n"; | |
| 271 | - $sToRender .= "\t\t<td><a href=\"$default->rootUrl/control.php?action=addDocumentArchiveSettings&fDocumentID=$iDocumentID\"><img src=\"$default->graphicsUrl/widgets/add.gif\" border=\"0\"/></a></td>\n"; | |
| 167 | + if ($bEditable) { | |
| 168 | + $sToRender .= "\t<tr>\n"; | |
| 169 | + // if there are no archiving settings then allow their addition | |
| 170 | + $oDocumentArchiving = DocumentArchiving::getFromDocumentID($oDocument->getID()); | |
| 171 | + $sToRender .= "\t\t<td>" . ($oDocumentArchiving ? "" : generateControllerLink("addDocumentArchiveSettings", "fDocumentID=" . $oDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/add.gif\" border=\"0\"/>")) . "</td>\n"; | |
| 272 | 172 | $sToRender .= "\t</tr>"; |
| 273 | - } | |
| 173 | + } | |
| 174 | + $sToRender .= "\t</table>\n"; | |
| 274 | 175 | |
| 275 | - $sToRender .= "\t<tr>\n"; | |
| 276 | - $sToRender .= "\t\t<td>" . renderEditableDocumentRouting($oDocument) . "</td>\n"; | |
| 277 | - $sToRender .= "\t</tr>"; | |
| 278 | - | |
| 279 | - $sToRender .= "\t<tr>\n"; | |
| 176 | + return renderSectionDiv($sDivName, $sToRender); | |
| 177 | +} | |
| 178 | + | |
| 179 | +function renderEditableDocumentRouting($oDocument, $sDivName) { | |
| 180 | + global $default; | |
| 181 | + $sQuery = "SELECT D.id as document_id, GFAL.id as id, R.name AS role_name, COALESCE(U.Name, 'Not assigned') AS name, GFAL.precedence AS precedence, COALESCE(FURL.active,0) AS active, COALESCE(FURL.done, 0) AS done, 'Edit' as edit " . | |
| 182 | + "FROM documents AS D INNER JOIN $default->owl_groups_folders_approval_table AS GFAL ON D.folder_id = GFAL.folder_id " . | |
| 183 | + "INNER JOIN roles AS R ON GFAL.role_id = R.id " . | |
| 184 | + "LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.group_folder_approval_id = GFAL.id AND FURL.document_id = D.id " . | |
| 185 | + "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " . | |
| 186 | + "WHERE D.id = " . $oDocument->getID() . " " . | |
| 187 | + "ORDER BY GFAL.precedence, role_name ASC"; | |
| 188 | + $aColumns = array("role_name", "name", "precedence", "active", "done", "edit"); | |
| 189 | + $aColumnHeaders = array("Role", "User", "Seq", "Active", "Done", ""); | |
| 190 | + $aColumnTypes = array(1,1,1,1,1,3); | |
| 191 | + $aDBColumnArray = array("id","document_id","active","done"); | |
| 192 | + $aQueryStringVariableNames = array("fFolderCollaborationID", "fDocumentID","fIsActive","fIsDone"); | |
| 193 | + $aLinkURLs = array(5=>"$default->rootUrl/control.php?action=modifyDocumentRouting"); | |
| 194 | + | |
| 195 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "540", $aLinkURLs,$aDBColumnArray,$aQueryStringVariableNames); | |
| 196 | + $oPatternTableSqlQuery->setTableHeading("Document Routing"); | |
| 197 | + $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | |
| 280 | 198 | |
| 199 | + $sToRender .= "\t<table border=\"0\" width=\"100%\">\n"; | |
| 200 | + $sToRender .= "\t<tr>\n"; | |
| 201 | + $sToRender .= "\t\t<td>" . $oPatternTableSqlQuery->render() . "</td>\n"; | |
| 202 | + $sToRender .= "\t</tr>"; | |
| 203 | + $sToRender .= "\t<tr>\n"; | |
| 281 | 204 | // collaboration cannot be started or approved/rejected unless the document is not checked out |
| 282 | 205 | if (!$oDocument->getIsCheckedOut() && $oDocument->hasCollaboration() && (!DocumentCollaboration::documentCollaborationStarted($oDocument->getID())) && ($_SESSION["userID"] == $oDocument->getCreatorID())) { |
| 283 | 206 | //if not all collaboration steps have been set, then you cannot start the collaboration process |
| ... | ... | @@ -291,17 +214,16 @@ function getEditPage($oDocument) { |
| 291 | 214 | // collaboration cannot be started or approved/rejected if the document is checked out |
| 292 | 215 | if (!$oDocument->getIsCheckedOut()) { |
| 293 | 216 | $sToRender .= "\t\t<td align=\"center\"><a onClick=\"return confirm('Are you sure you want to approve? You will not have access to this document until the collaboration process is complete (unless the document is rejected in a subsequent step)');\" href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fCollaborationStepComplete=1><img src=\"$default->graphicsUrl/widgets/approve.gif\" border=\"0\"/></a></td>\n"; |
| 294 | - $sToRender .= "\t\t<td align=\"center\"><a href=\"$default->rootUrl/control.php?action=collaborationStepReject&fDocumentID=$iDocumentID\"><img src=\"$default->graphicsUrl/widgets/reject.gif\" border=\"0\"/></a></td>\n"; | |
| 217 | + $sToRender .= "\t\t<td align=\"center\"><a href=\"$default->rootUrl/control.php?action=collaborationStepReject&fDocumentID=" . $oDocument->getID() . "\"><img src=\"$default->graphicsUrl/widgets/reject.gif\" border=\"0\"/></a></td>\n"; | |
| 295 | 218 | } |
| 296 | 219 | $sToRender .= "\t\t</tr></table></td>\n"; |
| 297 | - } | |
| 298 | - | |
| 299 | - if (!DocumentCollaboration::documentIsPendingWebPublishing($iDocumentID) && !DocumentCollaboration::documentIsPublished($iDocumentID)) { | |
| 220 | + } | |
| 221 | + if (!DocumentCollaboration::documentIsPendingWebPublishing($oDocument->getID())) { | |
| 300 | 222 | // only display for unpublished documents |
| 301 | 223 | // if there is collaboration |
| 302 | 224 | if ($oDocument->hasCollaboration()) { |
| 303 | 225 | // only display publish button if collaboration is complete and you're the last user in the collaboration process |
| 304 | - if (DocumentCollaboration::documentCollaborationDone($oDocument->getID()) && ($_SESSION["userID"] == DocumentCollaboration::getLastCollaboratorID($iDocumentID))) { | |
| 226 | + if (DocumentCollaboration::documentCollaborationDone($oDocument->getID()) && ($_SESSION["userID"] == DocumentCollaboration::getLastCollaboratorID($oDocument->getID()))) { | |
| 305 | 227 | $sToRender .= "<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fForPublish=1><img src=\"$default->graphicsUrl/widgets/publish.gif\" border=\"0\"/></a></td>\n"; |
| 306 | 228 | } |
| 307 | 229 | } else if ($_SESSION["userID"] == $oDocument->getCreatorID()) { |
| ... | ... | @@ -311,165 +233,212 @@ function getEditPage($oDocument) { |
| 311 | 233 | } |
| 312 | 234 | } |
| 313 | 235 | $sToRender .= "\t</tr>"; |
| 314 | - $sToRender .= "\t<tr>\n"; | |
| 315 | - $sToRender .= "\t\t<td>" . renderEditableLinkedDocuments($oDocument) . "</td>\n"; | |
| 316 | - $sToRender .= "\t</tr>"; | |
| 317 | - $sToRender .= "\t<tr>\n"; | |
| 318 | - $sToRender .= "<td><a href=\"$default->rootUrl/control.php?action=addDocumentLink&fDocumentID=" . $oDocument->getID() ."\"><img src=\"$default->graphicsUrl/widgets/add.gif\" border=\"0\"/></a></td>\n"; | |
| 319 | - $sToRender .= "\t</tr>"; | |
| 320 | - $sToRender .= "\t</table>"; | |
| 321 | - $sToRender .= "</td>\n"; | |
| 322 | - $sToRender .= "</tr>\n"; | |
| 323 | - $sToRender .= "</table>\n"; | |
| 324 | - | |
| 325 | - $sToRender .= "<table>\n"; | |
| 326 | - $sToRender .= "<tr>\n"; | |
| 327 | - $sToRender .= displayActionButtons($oDocument, true); | |
| 328 | - $sToRender .= "</tr>\n"; | |
| 329 | - $sToRender .= "</table>\n"; | |
| 330 | - | |
| 331 | - return $sToRender; | |
| 236 | + $sToRender .= "\t</table>\n"; | |
| 237 | + | |
| 238 | + return renderSectionDiv($sDivName, $sToRender); | |
| 332 | 239 | } |
| 333 | 240 | |
| 334 | -function getViewPage($oDocument) { | |
| 241 | +function renderNonEditableDocumentRouting($oDocument, $sDivName) { | |
| 335 | 242 | global $default; |
| 336 | - $iDocumentID = $oDocument->getID(); | |
| 337 | - $sToRender = renderHeading("Document Detail") . renderDocumentPath($oDocument) . "\n<br>\n"; | |
| 338 | - | |
| 339 | - $sToRender .= "<table>\n"; | |
| 340 | - $sToRender .= "<tr>\n"; | |
| 341 | - $sToRender .= displayActionButtons($oDocument, false); | |
| 342 | - $sToRender .= "</tr>\n"; | |
| 343 | - $sToRender .= "</table>\n"; | |
| 344 | - | |
| 345 | - $sToRender .= "<table border = 0>\n"; | |
| 346 | - $sToRender .= "<tr>\n"; | |
| 347 | - $sToRender .= "<td>\n"; | |
| 348 | - $sToRender .= "\t<table border = 0 width = 280>\n"; | |
| 349 | - $sToRender .= "\t<tr>\n"; | |
| 350 | - $sToRender .= "\t\t<td>" . renderDocumentData($oDocument) . "</td>\n"; | |
| 351 | - $sToRender .= "\t</tr>\n"; | |
| 352 | - $sToRender .= "\t<tr>\n"; | |
| 353 | - $sToRender .= "\t<td>" . renderGenericMetaData($oDocument) . "</td>\n"; | |
| 354 | - $sToRender .= "\t<tr>\n"; | |
| 355 | - $sToRender .= "\t<tr>\n"; | |
| 356 | - $sToRender .= "\t\t<td>" . renderTypeSpecificMetaData($oDocument) . "</td>\n"; | |
| 357 | - $sToRender .= "\t</tr>\n"; | |
| 358 | - $sToRender .= "\t</table>\n"; | |
| 359 | - $sToRender .= "</td>\n"; | |
| 360 | - $sToRender .= "<td valign=top>\n"; | |
| 361 | - $sToRender .= "\t<table border = 0, width = 230>\n"; | |
| 243 | + $sQuery = "SELECT D.id as document_id, GFAL.id as id, R.name AS role_name, COALESCE(U.Name, 'Not assigned') AS name, GFAL.precedence AS precedence, COALESCE(FURL.active,0) AS active, COALESCE(FURL.done, 0) AS done " . | |
| 244 | + "FROM documents AS D INNER JOIN $default->owl_groups_folders_approval_table AS GFAL ON D.folder_id = GFAL.folder_id " . | |
| 245 | + "INNER JOIN roles AS R ON GFAL.role_id = R.id " . | |
| 246 | + "LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.group_folder_approval_id = GFAL.id AND FURL.document_id = D.id " . | |
| 247 | + "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " . | |
| 248 | + "WHERE D.id = " . $oDocument->getID() . " " . | |
| 249 | + "ORDER BY GFAL.precedence, role_name ASC"; | |
| 250 | + | |
| 251 | + $aColumns = array("role_name", "name", "precedence", "active", "done"); | |
| 252 | + $aColumnHeaders = array("Role", "User", "Seq", "Active", "Done"); | |
| 253 | + $aColumnTypes = array(1,1,1,1,1); | |
| 254 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "540", "$default->rootUrl/control.php?action=modifyDocumentRouting",$aDBColumnArray,$aQueryStringVariableNames); | |
| 255 | + $oPatternTableSqlQuery->setTableHeading("Document Routing"); | |
| 256 | + $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | |
| 257 | + | |
| 258 | + $sToRender .= "\t<table border=\"0\" width=\"100%\">\n"; | |
| 362 | 259 | $sToRender .= "\t<tr>\n"; |
| 363 | - $sToRender .= "\t\t<td>" . renderNonEditableDocumentRouting($oDocument) . "</td>\n"; | |
| 260 | + $sToRender .= "\t\t<td>" . $oPatternTableSqlQuery->render() . "</td>\n"; | |
| 364 | 261 | $sToRender .= "\t</tr>"; |
| 262 | + | |
| 365 | 263 | if (DocumentCollaboration::userIsPerformingCurrentCollaborationStep($oDocument->getID())) { |
| 366 | 264 | //if the current user is responsible for an active step in the collaboration process |
| 367 | 265 | $sToRender .= "\t\t<tr><td><table border=\"0\"><tr>\n"; |
| 368 | 266 | $sToRender .= "\t\t<td><b>You currently have an active role<br> in the collaboration process</b></td>\n"; |
| 369 | 267 | $sToRender .= "\t\t<td align=\"center\"><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fCollaborationStepComplete=1><img src=\"$default->graphicsUrl/widgets/approve.gif\" border=\"0\"/></a></td>\n"; |
| 370 | 268 | $sToRender .= "\t\t<td align=\"center\"><a href=\"$default->rootUrl/control.php?action=collaborationStepReject&fDocumentID=$iDocumentID\"><img src=\"$default->graphicsUrl/widgets/reject.gif\" border=\"0\"/></a></td>\n"; |
| 371 | - $sToRender .= "\t\t</tr></table></td>\n"; | |
| 269 | + $sToRender .= "\t\t</tr></table></td></tr>\n"; | |
| 372 | 270 | } |
| 373 | - $sToRender .= "\t</table>"; | |
| 374 | - $sToRender .= "</td>\n"; | |
| 375 | - $sToRender .= "</tr>\n"; | |
| 376 | - $sToRender .= "</table>"; | |
| 377 | - | |
| 378 | - $sToRender .= "<table>\n"; | |
| 379 | - $sToRender .= "<tr>\n"; | |
| 380 | - $sToRender .= displayActionButtons($oDocument, false); | |
| 381 | - $sToRender .= "</tr>\n"; | |
| 382 | - $sToRender .= "</table>\n"; | |
| 383 | - | |
| 384 | - return $sToRender; | |
| 271 | + | |
| 272 | + $sToRender .= "\t</table>\n"; | |
| 273 | + | |
| 274 | + return renderSectionDiv($sDivName, $sToRender); | |
| 385 | 275 | } |
| 386 | 276 | |
| 387 | -/** | |
| 388 | - * Displays the document view page with additional input controls | |
| 389 | - * for checking out the document | |
| 390 | - * | |
| 391 | - * @param object the document to view and check out | |
| 392 | - */ | |
| 393 | -function getCheckOutEditPage($oDocument, $bCheckedOut = false) { | |
| 394 | - global $default; | |
| 395 | - $sToRender = renderHeading("Document Detail") . renderDocumentPath($oDocument) . "\n<br>\n"; | |
| 396 | - $sToRender .= "<table border = 0>\n"; | |
| 397 | - $sToRender .= "<tr>\n"; | |
| 398 | - $sToRender .= "<td>\n"; | |
| 399 | - $sToRender .= "\t<table border = 0 width = 280>\n"; | |
| 400 | - $sToRender .= "\t<tr>\n"; | |
| 401 | - $sToRender .= "\t\t<td>" . renderDocumentData($oDocument) . "</td>\n"; | |
| 402 | - $sToRender .= "\t</tr>\n"; | |
| 403 | - $sToRender .= "\t<tr>\n"; | |
| 404 | - $sToRender .= "\t<td>" . renderGenericMetaData($oDocument) . "</td>\n"; | |
| 405 | - $sToRender .= "\t<tr>\n"; | |
| 406 | - $sToRender .= "\t<tr>\n"; | |
| 407 | - $sToRender .= "\t\t<td>" . renderTypeSpecificMetaData($oDocument) . "</td>\n"; | |
| 408 | - $sToRender .= "\t</tr>\n"; | |
| 409 | - $sToRender .= "\t</table>\n"; | |
| 410 | - $sToRender .= "</td>\n"; | |
| 411 | - $sToRender .= "<td valign=top>\n"; | |
| 412 | - $sToRender .= "\t<table border = 0, width = 230>\n"; | |
| 277 | +function renderEditableLinkedDocuments($oDocument, $sDivName) { | |
| 278 | + global $default; | |
| 279 | + | |
| 280 | + $sQuery = "SELECT D.id AS child_document_id, D.name, DL.id as document_link_id, DL.parent_document_id AS parent_document_id, 'Unlink' AS unlink " . | |
| 281 | + "FROM documents AS D INNER JOIN document_link AS DL ON D.id = DL.child_document_id " . | |
| 282 | + "WHERE DL.parent_document_id = " . $oDocument->getID(); | |
| 283 | + | |
| 284 | + $aColumns = array("name", "unlink"); | |
| 285 | + $aColumnHeaders = array("Document"); | |
| 286 | + $aColumnTypes = array(3,3); | |
| 287 | + $aDBColumnArray = array("parent_document_id", "child_document_id","document_link_id", "child_document_id"); | |
| 288 | + $aQueryStringVariableNames = array("fParentDocumentID","fChildDocumentID", "fDocumentLinkID", "fDocumentID"); | |
| 289 | + $aLinkURLs = array(0=>"$default->rootUrl/control.php?action=viewDocument", 1=>"$default->rootUrl/control.php?action=removeDocumentLink"); | |
| 290 | + | |
| 291 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "540", $aLinkURLs, $aDBColumnArray, $aQueryStringVariableNames); | |
| 292 | + $oPatternTableSqlQuery->setTableHeading("Linked documents"); | |
| 293 | + $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | |
| 294 | + | |
| 295 | + $sToRender .= "\t<table border=\"0\" width=\"100%\">\n"; | |
| 413 | 296 | $sToRender .= "\t<tr>\n"; |
| 414 | - $sToRender .= "\t\t<td>" . renderNonEditableDocumentRouting($oDocument) . "</td>\n"; | |
| 297 | + $sToRender .= "\t\t<td>" . $oPatternTableSqlQuery->render() . "</td>\n"; | |
| 298 | + $sToRender .= "\t</tr>"; | |
| 415 | 299 | $sToRender .= "\t<tr>\n"; |
| 300 | + $sToRender .= "<td><a href=\"$default->rootUrl/control.php?action=addDocumentLink&fDocumentID=" . $oDocument->getID() ."\"><img src=\"$default->graphicsUrl/widgets/add.gif\" border=\"0\"/></a></td>\n"; | |
| 301 | + $sToRender .= "\t</tr>"; | |
| 302 | + $sToRender .= "\t</table>\n"; | |
| 303 | + return renderSectionDiv($sDivName, $sToRender); | |
| 304 | +} | |
| 305 | + | |
| 306 | +function renderNonEditableLinkedDocuments($oDocument, $sDivName) { | |
| 307 | + global $default; | |
| 308 | + | |
| 309 | + $sQuery = "SELECT D.id, D.name " . | |
| 310 | + "FROM documents AS D INNER JOIN document_link AS DL ON D.id = DL.child_document_id " . | |
| 311 | + "WHERE DL.parent_document_id = " . $oDocument->getID(); | |
| 312 | + | |
| 313 | + $aColumns = array("name"); | |
| 314 | + $aColumnHeaders = array("Document"); | |
| 315 | + $aColumnTypes = array(3); | |
| 316 | + $aDBColumnArray = array("id"); | |
| 317 | + $aQueryStringVariableNames = array("fDocumentID"); | |
| 318 | + $aLinkURLs = array(0=>"$default->rootUrl/control.php?action=viewDocument"); | |
| 319 | + | |
| 320 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "540", $aLinkURLs, $aDBColumnArray, $aQueryStringVariableNames); | |
| 321 | + $oPatternTableSqlQuery->setTableHeading("Linked documents"); | |
| 322 | + $oPatternTableSqlQuery->setDisplayColumnHeadings(true); | |
| 323 | + | |
| 324 | + $sToRender .= "\t<table border=\"0\" width=\"100%\">\n"; | |
| 416 | 325 | $sToRender .= "\t<tr>\n"; |
| 417 | - if ($bCheckedOut) { | |
| 418 | - $sToRender .= "\t\t<td>You have now checked out this document. No one else can make updates to the document while you have it checked out. Click the Download button to get the latest version of the file. Please check it back in, as soon as you finish working on it.</td>\n"; | |
| 419 | - $sToRender .= "\t</tr>"; | |
| 420 | - $sToRender .= "\t<tr>\n"; | |
| 421 | - $sToRender .= "<td><a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID() . "&fForDownload=1\"><img src=\"$default->graphicsUrl/widgets/download.gif\" border=\"0\" /></a>\n"; | |
| 422 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID() . "\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\" /></a></td>\n"; | |
| 423 | - } else { | |
| 424 | - $sToRender .= "\t\t<td>" . renderCheckOutPage($oDocument) . "</td>\n"; | |
| 425 | - } | |
| 326 | + $sToRender .= "\t\t<td>" . $oPatternTableSqlQuery->render() . "</td>\n"; | |
| 426 | 327 | $sToRender .= "\t</tr>"; |
| 427 | - $sToRender .= "\t</table>"; | |
| 428 | - $sToRender .= "</td>\n"; | |
| 429 | - $sToRender .= "</tr>\n"; | |
| 430 | - $sToRender .= "</table>"; | |
| 328 | + $sToRender .= "\t</table>\n"; | |
| 329 | + return renderSectionDiv($sDivName, $sToRender); | |
| 330 | +} | |
| 331 | + | |
| 431 | 332 | |
| 333 | +function displayActionButtons($oDocument, $bEdit) { | |
| 334 | + global $default; | |
| 335 | + if ($bEdit) { | |
| 336 | + // display the check in button if the document is checked out and you checked the document out | |
| 337 | + if ($oDocument->getIsCheckedOut() && ($oDocument->getCheckedOutUserID() == $_SESSION["userID"])) { | |
| 338 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("checkInDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/checkin.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 339 | + // otherwise display the check out button | |
| 340 | + } else { | |
| 341 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("checkOutDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/checkout.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 342 | + } | |
| 343 | + } | |
| 344 | + | |
| 345 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/email.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 346 | + if ($bEdit) { | |
| 347 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("deleteDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/delete.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 348 | + } | |
| 349 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("viewHistory", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/history.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 350 | + if ($bEdit) { | |
| 351 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("moveDocument", "fFolderID=" . $oDocument->getFolderID() . "&fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/move.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 352 | + } | |
| 353 | + | |
| 354 | + // display the unsubscribe button if the user is subscribed to the document | |
| 355 | + if (Subscription::exists($_SESSION["userID"], $oDocument->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"))) { | |
| 356 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("removeSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/unsubscribe.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 357 | + // otherwise display the subscribe button | |
| 358 | + } else { | |
| 359 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("addSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/subscribe.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 360 | + } | |
| 361 | + $sToRender .= "<tr><td align=\"left\"><a onClick=\"alert('This will download a copy of the document and is not the same as Checking Out a document. Changes to this downloaded file will not be managed in the DMS.'); return true;\" href=\"" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForDownload=1") . "\"><img src=\"$default->graphicsUrl/widgets/docactions/download.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 362 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("viewDiscussion", "fDocumentID=" . $oDocument->getID() . "&fForDiscussion=1") . "\"><img src=\"$default->graphicsUrl/widgets/docactions/discussion.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 363 | + // only display the archive button for available documents | |
| 364 | + if (!$oDocument->getIsCheckedOut() || !$oDocument->hasCollaboration() || (!DocumentCollaboration::documentCollaborationStarted($oDocument->getID()))) { | |
| 365 | + $sToRender .= "<tr><td align=\"left\"><a href=\"" . generateControllerLink("archiveDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/archive.gif\" border=\"0\" /></a></td></tr>\n"; | |
| 366 | + } | |
| 367 | + $sToRender .= "<td align=\"left\"><a href=\"" . generateControllerLink("createDependantDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/dependentdoc.gif\" border=\"0\" /></a></td>\n"; | |
| 368 | + | |
| 432 | 369 | return $sToRender; |
| 433 | 370 | } |
| 434 | 371 | |
| 435 | -/** | |
| 436 | - * Displays the document view page with additional input controls | |
| 437 | - * for checking in the document | |
| 438 | - * | |
| 439 | - * @param object the document to view and check out | |
| 440 | - */ | |
| 441 | -function getCheckInEditPage($oDocument) { | |
| 372 | +function renderSectionDiv($sDivName, $sHtml) { | |
| 373 | + global $default; | |
| 374 | + | |
| 375 | + if ( $default->browser == "ie" ) { | |
| 376 | + return "<div id=\"$sDivName\" style=\"position:absolute;visibility:hidden;top:280px;left:135px;\">$sHtml</div>"; | |
| 377 | + } else { | |
| 378 | + return "<div id=\"$sDivName\" style=\"position:absolute;visibility:hidden;top:260px;left:133px;\">$sHtml</div>"; | |
| 379 | + } | |
| 380 | +} | |
| 381 | + | |
| 382 | +function renderDocumentSection($sHeading) { | |
| 383 | + return "<tr bgcolor=\"" . getColour($iColour) . "\"><td width=\"100%\">$sHeading</td></tr>\n"; | |
| 384 | +} | |
| 385 | + | |
| 386 | +function getPage($oDocument, $bEdit, $sHtml = "") { | |
| 442 | 387 | global $default; |
| 443 | - $sToRender = renderHeading("Document Detail") . renderDocumentPath($oDocument) . "\n<br>\n"; | |
| 444 | - $sToRender .= "<table border = 0>\n"; | |
| 445 | - $sToRender .= "<tr>\n"; | |
| 446 | - $sToRender .= "<td>\n"; | |
| 447 | - $sToRender .= "\t<table border = 0 width = 280>\n"; | |
| 448 | - $sToRender .= "\t<tr>\n"; | |
| 449 | - $sToRender .= "\t\t<td>" . renderDocumentData($oDocument) . "</td>\n"; | |
| 450 | - $sToRender .= "\t</tr>\n"; | |
| 451 | - $sToRender .= "\t<tr>\n"; | |
| 452 | - $sToRender .= "\t<td>" . renderGenericMetaData($oDocument) . "</td>\n"; | |
| 453 | - $sToRender .= "\t<tr>\n"; | |
| 454 | - $sToRender .= "\t<tr>\n"; | |
| 455 | - $sToRender .= "\t\t<td>" . renderTypeSpecificMetaData($oDocument) . "</td>\n"; | |
| 456 | - $sToRender .= "\t</tr>\n"; | |
| 457 | - $sToRender .= "\t</table>\n"; | |
| 458 | - $sToRender .= "</td>\n"; | |
| 459 | - $sToRender .= "<td valign=top>\n"; | |
| 460 | - $sToRender .= "\t<table border = 0, width = 230>\n"; | |
| 461 | - $sToRender .= "\t<tr>\n"; | |
| 462 | - $sToRender .= "\t\t<td>" . renderNonEditableDocumentRouting($oDocument) . "</td>\n"; | |
| 463 | - $sToRender .= "\t<tr>\n"; | |
| 464 | - $sToRender .= "\t<tr>\n"; | |
| 465 | - $sToRender .= "\t\t<td>" . renderCheckInPage($oDocument) . "</td>\n"; | |
| 466 | - $sToRender .= "\t</tr>"; | |
| 467 | - $sToRender .= "\t</table>"; | |
| 468 | - $sToRender .= "</td>\n"; | |
| 469 | - $sToRender .= "</tr>\n"; | |
| 470 | - $sToRender .= "</table>"; | |
| 388 | + | |
| 389 | + if ($sHtml <> "") { | |
| 390 | + $sToRender .= renderHeading("Document Detail"); | |
| 391 | + $sToRender .= renderDocumentPath($oDocument, ($sHtml == "")) . "\n\n"; | |
| 392 | + $sToRender .= $sHtml; | |
| 393 | + $sToRender .= renderDocumentData($oDocument, $bEdit); | |
| 394 | + } else { | |
| 395 | + | |
| 396 | + if ( $default->browser == "ie" ) { | |
| 397 | + $sToRender = "<div id=\"headings\" style=\"position:absolute;visibility:visible;top:120px;left:134px;\">"; | |
| 398 | + } else { | |
| 399 | + $sToRender = "<div id=\"headings\" style=\"position:absolute;visibility:visible;top:106px;left:134px;\">"; | |
| 400 | + } | |
| 401 | + $sToRender .= renderHeading("Document Detail"); | |
| 402 | + $sToRender .= renderDocumentPath($oDocument, ($sHtml == "")) . "\n\n"; | |
| 403 | + | |
| 404 | + $sToRender .= "<table border=\"0\" width=\"530\">"; | |
| 405 | + $sToRender .= renderDocumentSection("<a href=\"javascript:void();\" onClick=\"switchDiv('documentData');\">Document Data</a>"); | |
| 406 | + $sToRender .= renderDocumentSection("<a href=\"javascript:void();\" onClick=\"switchDiv('genericMetaData');\">Generic Meta Data</a>"); | |
| 407 | + $sToRender .= renderDocumentSection("<a href=\"javascript:void();\" onClick=\"switchDiv('typeSpecificMetaData');\">Type Specific Meta Data</a>"); | |
| 408 | + $sToRender .= renderDocumentSection("<a href=\"javascript:void();\" onClick=\"switchDiv('archiveSettings');\">Archive Settings</a>"); | |
| 409 | + $sToRender .= renderDocumentSection("<a href=\"javascript:void();\" onClick=\"switchDiv('documentRouting');\">Document Routing</a>"); | |
| 410 | + $sToRender .= renderDocumentSection("<a href=\"javascript:void();\" onClick=\"switchDiv('linkedDocuments');\">Linked Documents</a>"); | |
| 411 | + $sToRender .= "</table>"; | |
| 412 | + $sToRender .= "</div>"; | |
| 413 | + | |
| 414 | + $sToRender .= renderSectionDiv("documentData", renderDocumentData($oDocument, $bEdit)); | |
| 415 | + $sToRender .= renderDocumentArchiveSettings($oDocument, "archiveSettings", $bEdit); | |
| 416 | + if ($bEdit) { | |
| 417 | + $sToRender .= renderEditableDocumentRouting($oDocument, "documentRouting"); | |
| 418 | + } else { | |
| 419 | + $sToRender .= renderNonEditableDocumentRouting($oDocument, "documentRouting"); | |
| 420 | + } | |
| 421 | + | |
| 422 | + $sToRender .= renderGenericMetaData($oDocument, "genericMetaData", $bEdit); | |
| 423 | + if ($bEdit) { | |
| 424 | + $sToRender .= renderEditableLinkedDocuments($oDocument, "linkedDocuments"); | |
| 425 | + } else { | |
| 426 | + $sToRender .= renderNonEditableLinkedDocuments($oDocument, "linkedDocuments", $bEdit); | |
| 427 | + } | |
| 428 | + $sToRender .= renderTypeSpecificMetaData($oDocument, "typeSpecificMetaData", $bEdit); | |
| 429 | + | |
| 430 | + if ( $default->browser == "ie" ) { | |
| 431 | + $sToRender .= "<div id=\"actionButtons\" style=\"position:absolute;visibility:visible;top:170px;left:665px;\">"; | |
| 432 | + } else { | |
| 433 | + $sToRender .= "<div id=\"actionButtons\" style=\"position:absolute;visibility:visible;top:155px;left:665px;\">"; | |
| 434 | + } | |
| 435 | + $sToRender .= "<table cellspacing=\"0\" cellpadding=\"0\">\n"; | |
| 436 | + $sToRender .= displayActionButtons($oDocument, $bEdit); | |
| 437 | + $sToRender .= "</table>\n"; | |
| 438 | + $sToRender .= "</div>"; | |
| 439 | + } | |
| 471 | 440 | |
| 472 | - return $sToRender; | |
| 441 | + return $sToRender; | |
| 473 | 442 | } |
| 474 | 443 | |
| 475 | 444 | function getWebPublishPage($oDocument) { |
| ... | ... | @@ -477,57 +446,41 @@ function getWebPublishPage($oDocument) { |
| 477 | 446 | |
| 478 | 447 | $oPatternListBox = & new PatternListBox($default->owl_web_sites_table, "web_site_name", "id", "fWebSiteID"); |
| 479 | 448 | |
| 480 | - $sToRender = renderHeading("Document Detail") . renderDocumentPath($oDocument) . "\n<br>\n"; | |
| 481 | - $sToRender .= "<table border = 0>\n"; | |
| 482 | - $sToRender .= "<tr>\n"; | |
| 483 | - $sToRender .= "<td>\n"; | |
| 484 | - $sToRender .= "\t<table border = 0 width = 280>\n"; | |
| 485 | - $sToRender .= "\t<tr>\n"; | |
| 486 | - $sToRender .= "\t\t<td>" . renderDocumentData($oDocument) . "</td>\n"; | |
| 487 | - $sToRender .= "\t</tr>\n"; | |
| 488 | - $sToRender .= "\t<tr>\n"; | |
| 489 | - $sToRender .= "\t<td>" . renderGenericMetaData($oDocument) . "</td>\n"; | |
| 490 | - $sToRender .= "\t<tr>\n"; | |
| 491 | - $sToRender .= "\t<tr>\n"; | |
| 492 | - $sToRender .= "\t\t<td>" . renderTypeSpecificMetaData($oDocument) . "</td>\n"; | |
| 493 | - $sToRender .= "\t</tr>\n"; | |
| 494 | - $sToRender .= "\t</table>\n"; | |
| 495 | - $sToRender .= "</td>\n"; | |
| 496 | - $sToRender .= "<td valign=top>\n"; | |
| 497 | - $sToRender .= "\t<table border=\"0\" width=\"230\">\n"; | |
| 498 | - $sToRender .= "\t<tr>\n"; | |
| 499 | - $sToRender .= "\t\t<td>" . renderNonEditableDocumentRouting($oDocument) . "</td>\n"; | |
| 500 | - $sToRender .= "\t<tr>\n"; | |
| 501 | - $sToRender .= "\t<tr>\n"; | |
| 449 | + $sToRender .= "<table>\n"; | |
| 450 | + $sToRender .= "\t<tr>"; | |
| 502 | 451 | $sToRender .= "\t\t<th align=\"left\">Choose the website to publish to:</th>\n"; |
| 503 | 452 | $sToRender .= "\t</tr>"; |
| 504 | 453 | $sToRender .= "\t<tr>\n"; |
| 505 | 454 | $sToRender .= "\t\t<td>" . $oPatternListBox->render() . "</td>\n"; |
| 506 | - $sToRender .= "\t\t<input type=\"hidden\" name=\"fForPublish\" value=\"1\" />\n"; | |
| 507 | - $sToRender .= "\t\t<input type=\"hidden\" name=\"fSubmit\" value=\"1\" />\n"; | |
| 508 | - $sToRender .= "\t</tr>"; | |
| 455 | + $sToRender .= "\t</tr>"; | |
| 509 | 456 | $sToRender .= "\t<tr>\n"; |
| 510 | 457 | $sToRender .= "\t\t<th nowrap align=\"left\">Enter a comment for the web master:</th>\n"; |
| 511 | 458 | $sToRender .= "\t</tr>"; |
| 512 | 459 | $sToRender .= "\t<tr>\n"; |
| 513 | - $sToRender .= "\t\t<td><input type=\"text\" name=\"fComment\" size=\"30\" /></td>\n"; | |
| 460 | + $sToRender .= "\t\t<td><input type=\"text\" name=\"fComment\" size=\"30\"/></td>\n"; | |
| 514 | 461 | $sToRender .= "\t</tr>"; |
| 462 | + $sToRender .= "\t\t<input type=\"hidden\" name=\"fForPublish\" value=\"1\"/>\n"; | |
| 463 | + $sToRender .= "\t\t<input type=\"hidden\" name=\"fSubmit\" value=\"1\"/>\n"; | |
| 515 | 464 | $sToRender .= "\t<tr>\n"; |
| 516 | 465 | $sToRender .= "\t\t<td><input type=\"image\" src=\"$default->graphicsUrl/widgets/publish.gif\" border=\"0\"/></a>"; |
| 517 | 466 | $sToRender .= "\t\t<a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID() . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\" /></a></td>\n"; |
| 518 | - $sToRender .= "\t</tr>"; | |
| 519 | - $sToRender .= "\t</table>"; | |
| 520 | - $sToRender .= "</td>\n"; | |
| 521 | - $sToRender .= "</tr>\n"; | |
| 522 | - $sToRender .= "</table>"; | |
| 467 | + $sToRender .= "\t</tr>"; | |
| 468 | + $sToRender .= "</table>\n"; | |
| 523 | 469 | |
| 524 | - return $sToRender; | |
| 470 | + $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n"; | |
| 471 | + $sToRender .= "function validateForm(theForm) {\n"; | |
| 472 | + $sToRender .= "\tif (!(validRequired(document.MainForm.fWebSiteID,'Website'))) {\n"; | |
| 473 | + $sToRender .= "\t\treturn false;\n\t}\n"; | |
| 474 | + $sToRender .= "\tif (!(validRequired(document.MainForm.fComment,'Publish comment'))) {\n"; | |
| 475 | + $sToRender .= "\t\treturn false;\n\t}\n"; | |
| 476 | + $sToRender .= "return true;\n}\n"; | |
| 477 | + $sToRender .= "//-->\n</script>\n\n"; | |
| 478 | + | |
| 479 | + return getPage($oDocument, false, $sToRender); | |
| 525 | 480 | } |
| 526 | 481 | |
| 527 | -/** | |
| 528 | - * Wraps html in a bordered table | |
| 529 | - */ | |
| 530 | 482 | function wrapInTable($sHtml) { |
| 531 | 483 | return "\n\t\t\t<table border = 1, width = 100%><tr><td>$sHtml</td></tr></table>\n"; |
| 532 | 484 | } |
| 485 | + | |
| 533 | 486 | ?> |
| 534 | 487 | \ No newline at end of file | ... | ... |