Commit 89081d8a6a9e809d29f572b7c4da29a6cb5a144d
1 parent
8e7b4bd1
Replaced documentViewUI/BL for consistent file naming
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@494 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
172 additions
and
0 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | +* documentViewUI.php | |
| 4 | +* Contains the business logic required to build the document view page. | |
| 5 | +* Will use documentViewUI.php for HTML | |
| 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 | +*/ | |
| 15 | + | |
| 16 | + | |
| 17 | +require_once("../../../../config/dmsDefaults.php"); | |
| 18 | + | |
| 19 | +if (checkSession()) { | |
| 20 | + | |
| 21 | + //MUST PUT IN DOCUMENT PERMISSION CHECK | |
| 22 | + | |
| 23 | + require_once("$default->owl_fs_root/lib/security/permission.inc"); | |
| 24 | + require_once("$default->owl_fs_root/lib/documentmanagement/Document.inc"); | |
| 25 | + require_once("$default->owl_fs_root/lib/foldermanagement/Folder.inc"); | |
| 26 | + require_once("$default->owl_fs_root/lib/visualpatterns/PatternListFromQuery.inc"); | |
| 27 | + require_once("$default->owl_fs_root/lib/visualpatterns/PatternTableSqlQuery.inc"); | |
| 28 | + require_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | |
| 29 | + require_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/documentmanagement/documentViewUI.php"); | |
| 30 | + require_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | |
| 31 | + | |
| 32 | + $oDocument = & Document::get(12); | |
| 33 | + $oPatternCustom = & new PatternCustom(); | |
| 34 | + $oPatternCustom->setHtml(getPage($oDocument)); | |
| 35 | + $main->setCentralPayload($oPatternCustom); | |
| 36 | + $main->render(); | |
| 37 | +} else { | |
| 38 | + echo "You do not have permission for this page"; | |
| 39 | +} | |
| 40 | + | |
| 41 | +?> | ... | ... |
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
0 → 100644
| 1 | +<?php | |
| 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 | +*/ | |
| 15 | + | |
| 16 | +function renderDocumentPath($oDocument) { | |
| 17 | + $sDocumentPath = Folder::getFolderDisplayPath($oDocument->getFolderID()) . " > " . $oDocument->getName(); | |
| 18 | + return "<table border=1><tr><td>$sDocumentPath</td></tr></table>\n"; | |
| 19 | +} | |
| 20 | + | |
| 21 | +function renderDocumentGenericMetaData($oDocument) { | |
| 22 | + echo "<table border=1>\n"; | |
| 23 | +} | |
| 24 | + | |
| 25 | +function renderGenericDocumentMetaData($oDocument) { | |
| 26 | + $sQuery = "SELECT D.name AS name, DT.datetime AS created_date, D.modified as last_modified, U.name as initiator, DFL.value as authors, CONCAT(CONCAT(D.major_version, \".\"), D.minor_version) AS version, WDSL.name AS status, DFL2.value AS category " . | |
| 27 | + "FROM documents AS D INNER JOIN document_fields_link AS DFL on D.id = DFL.document_id " . | |
| 28 | + "INNER JOIN users AS U on D.creator_id = U.id " . | |
| 29 | + "INNER JOIN document_transactions AS DT on DT.document_id = D.id " . | |
| 30 | + "INNER JOIN document_fields AS DF ON DF.id = DFL.document_field_id " . | |
| 31 | + "INNER JOIN document_transaction_types_lookup AS DTTL ON DTTL.id = DT.transaction_id " . | |
| 32 | + "INNER JOIN document_fields_link AS DFL2 ON DFL2.document_id = D.id " . | |
| 33 | + "INNER JOIN document_fields AS DF2 ON DF2.id = DFL2.document_field_id " . | |
| 34 | + "INNER JOIN web_documents AS WD ON WD.document_id = D.ID " . | |
| 35 | + "INNER JOIN web_documents_status_lookup AS WDSL ON WD.status_id = WDSL.id " . | |
| 36 | + "WHERE D.id = " . $oDocument->getID() . " " . | |
| 37 | + "AND DF.name LIKE 'Author' " . | |
| 38 | + "AND DF2.name LIKE 'Category' " . | |
| 39 | + "AND DTTL.name LIKE 'Create'"; | |
| 40 | + | |
| 41 | + $aColumns = array("name", "created_date", "last_modified", "initiator", "authors", "version", "status", "category"); | |
| 42 | + $aColumnNames = array("Document title", "Date created", "Last updated", "Document initiator", "Author(s)", "Version", "Status", "Category"); | |
| 43 | + $aColumnTypes = array(1,1,1,1,1,1,1,1); | |
| 44 | + | |
| 45 | + $oPatternListFromQuery = & new PatternListFromQuery($sQuery, $aColumns, $aColumnNames, $aColumnTypes); | |
| 46 | + $oPatternListFromQuery->setTableHeading("Generic Meta Data"); | |
| 47 | + //$oPatternListFromQuery->setRenderIndividualTableForEachResult(true); | |
| 48 | + return $oPatternListFromQuery->render(); | |
| 49 | + | |
| 50 | +} | |
| 51 | + | |
| 52 | +function renderTypeSpecificMetaData($oDocument) { | |
| 53 | + $sQuery = "SELECT DF.name AS name, DFL.value AS value " . | |
| 54 | + "FROM documents AS D INNER JOIN document_fields_link AS DFL ON D.id = DFL.document_id " . | |
| 55 | + "INNER JOIN document_fields AS DF ON DF.ID = DFL.document_field_id " . | |
| 56 | + "WHERE D.id = " . $oDocument->getID() . " " . | |
| 57 | + "AND DF.name NOT LIKE 'Author' " . | |
| 58 | + "AND DF.name NOT LIKE 'Category'"; | |
| 59 | + $aColumns = array("name", "value"); | |
| 60 | + $aColumnHeaders = array("Tag", "Value"); | |
| 61 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnHeaders, 150); | |
| 62 | + $oPatternTableSqlQuery->setTableHeading("Type Specific Meta Data"); | |
| 63 | + return $oPatternTableSqlQuery->render(); | |
| 64 | +} | |
| 65 | + | |
| 66 | +function renderDocumentRouting($oDocument) { | |
| 67 | + $sQuery = "SELECT R.name AS role_name, COALESCE(U.Name, 'Not assigned') AS name, GFAL.precedence AS precedence " . | |
| 68 | + "FROM documents AS D INNER JOIN groups_folders_approval_link AS GFAL ON D.folder_id = GFAL.folder_id " . | |
| 69 | + "INNER JOIN roles AS R ON GFAL.role_id = R.id " . | |
| 70 | + "LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.folder_id = D.folder_id " . | |
| 71 | + "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " . | |
| 72 | + "WHERE D.id = " . $oDocument->getID() . " " . | |
| 73 | + "ORDER BY GFAL.precedence, role_name ASC"; | |
| 74 | + | |
| 75 | + $aColumns = array("role_name", "name", "precedence"); | |
| 76 | + $aColumnHeaders = array("Role", "Player", "Sequence"); | |
| 77 | + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnHeaders, 150, true); | |
| 78 | + $oPatternTableSqlQuery->setTableHeading("Document Routing"); | |
| 79 | + return $oPatternTableSqlQuery->render(); | |
| 80 | + | |
| 81 | +} | |
| 82 | + | |
| 83 | +function getPage($oDocument) { | |
| 84 | + $sToRender = renderDocumentPath($oDocument) . "\n<br>\n"; | |
| 85 | + $sToRender .= "<table border = 0>\n"; | |
| 86 | + $sToRender .= "<tr>\n"; | |
| 87 | + $sToRender .= "<td>\n"; | |
| 88 | + $sToRender .= "\t<table border = 0>\n"; | |
| 89 | + $sToRender .= "\t<tr>\n"; | |
| 90 | + $sToRender .= "\t\t<td>" . wrapInTable(renderGenericDocumentMetaData($oDocument)) . "</td>\n"; | |
| 91 | + $sToRender .= "\t</tr>\n"; | |
| 92 | + $sToRender .= "\t<tr>\n"; | |
| 93 | + $sToRender .= "\t\t<td>" . wrapInTable(renderTypeSpecificMetaData($oDocument)) . "</td>\n"; | |
| 94 | + $sToRender .= "\t</tr>\n"; | |
| 95 | + $sToRender .= "\t</table>\n"; | |
| 96 | + $sToRender .= "</td>\n"; | |
| 97 | + $sToRender .= "<td valign=top>\n"; | |
| 98 | + $sToRender .= "\t<table border = 0>\n"; | |
| 99 | + $sToRender .= "\t<tr>\n"; | |
| 100 | + $sToRender .= "\t\t<td>" . wrapInTable(renderDocumentRouting($oDocument)) . "</td>\n"; | |
| 101 | + $sToRender .= "\t</tr>"; | |
| 102 | + $sToRender .= "\t</table>"; | |
| 103 | + $sToRender .= "</td>\n"; | |
| 104 | + $sToRender .= "</tr>\n"; | |
| 105 | + $sToRender .= "</table>"; | |
| 106 | + | |
| 107 | + return $sToRender; | |
| 108 | + /*$sToRender = "<table border = 0 cellpadding = 4 width = 800>\n"; | |
| 109 | + $sToRender .= "<tr>\n"; | |
| 110 | + $sToRender .= "<td align = left colspan=2>" . wrapInTable(renderDocumentPath($oDocument)) . "</td>\n"; | |
| 111 | + $sToRender .= "</tr>\n"; | |
| 112 | + | |
| 113 | + $sToRender .= "<tr>\n"; | |
| 114 | + $sToRender .= "<td>" . wrapInTable(renderGenericDocumentMetaData($oDocument)) . "</td><td>" . wrapInTable(renderDocumentRouting($oDocument)) . "</td>\n"; | |
| 115 | + $sToRender .= "</tr>\n"; | |
| 116 | + | |
| 117 | + $sToRender .= "<tr>\n"; | |
| 118 | + $sToRender .= "<td>" . wrapInTable(renderTypeSpecificMetaData($oDocument)) . "</td><td> </td>\n"; | |
| 119 | + $sToRender .= "</tr>"; | |
| 120 | + | |
| 121 | + $sToRender .= "</table>"; | |
| 122 | + | |
| 123 | + | |
| 124 | + echo $sToRender;*/ | |
| 125 | +} | |
| 126 | + | |
| 127 | +function wrapInTable($sHtml) { | |
| 128 | + return "<table border = 1 width=400><tr><td>$sHtml</td></tr></table>"; | |
| 129 | +} | |
| 130 | + | |
| 131 | +?> | ... | ... |