Commit b3374c51c57ee95397a8b14bd412255c749b75cc

Authored by rob
1 parent c690bdce

Initial revision. View a document's transaction history


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@950 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewHistoryBL.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 +* viewHistoryUI.php
  5 +* Contains the business logic required to build the document history view page.
  6 +* Will use viewHistoryUI.php for HTML
  7 +*
  8 +* Expected form varaibles:
  9 +* o $fDocumentID - Primary key of document to view
  10 +*
  11 +*
  12 +* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  13 +* @date 12 February 2003
  14 +* @package presentation.lookAndFeel.knowledgeTree.documentManager
  15 +*/
  16 +
  17 +require_once("../../../../config/dmsDefaults.php");
  18 +
  19 +require_once("$default->owl_fs_root/lib/security/permission.inc");
  20 +
  21 +require_once("$default->owl_fs_root/lib/users/User.inc");
  22 +
  23 +require_once("$default->owl_fs_root/lib/documentmanagement/DocumentTransaction.inc");
  24 +require_once("$default->owl_fs_root/lib/documentmanagement/Document.inc");
  25 +
  26 +require_once("$default->owl_fs_root/lib/visualpatterns/PatternTableSqlQuery.inc");
  27 +require_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc");
  28 +
  29 +require_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewHistoryUI.inc");
  30 +require_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
  31 +//require_once("$default->owl_fs_root/presentation/Html.inc");
  32 +require_once("$default->owl_fs_root/presentation/webpageTemplate.inc");
  33 +
  34 +if (checkSession()) {
  35 + if (isset($fDocumentID)) {
  36 +
  37 + $oDocument = & Document::get($fDocumentID);
  38 + $oPatternCustom = & new PatternCustom();
  39 + $oPatternCustom->setHtml(getPage($oDocument->getID(), $oDocument->getFolderID(), $oDocument->getName()));
  40 + $main->setCentralPayload($oPatternCustom);
  41 + $main->render();
  42 +
  43 + }
  44 +}
  45 +
  46 +?>
... ...
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewHistoryUI.inc 0 → 100644
  1 +<?php
  2 +/**
  3 +* viewHistoryBL.php
  4 +* Contains HTML information required to build the document history view page.
  5 +* Will be used by viewHistoryBL.php
  6 +*
  7 +* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  8 +* @date 12 February 2003
  9 +* @package presentation.lookAndFeel.knowledgeTree.documentManager
  10 +*/
  11 +
  12 +function getDocumentPath($iFolderID, $sDocumentName) {
  13 + global $default;
  14 + $sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), "$default->owl_root_url/control.php?action=browse") . " > " . $sDocumentName;
  15 + return "<table border=1 width = 100%><tr><td>$sDocumentPath</td></tr></table>\n";
  16 +}
  17 +
  18 +function getDocumentHistory($iDocumentID) {
  19 + global $default;
  20 + $sQuery = "DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment, DT.datetime AS datetime " .
  21 + "FROM $default->owl_document_transactions_table AS DT INNER JOIN $default->owl_users_table AS U ON DT.user_id = U.id " .
  22 + "INNER JOIN $default->owl_transaction_types_table AS DTT ON DTT.id = DT.transaction_id " .
  23 + "WHERE DT.documentID = $iDocumentID";
  24 +
  25 + $aColumns = array("transaction_name", "user_name", "version", "comment", "datetime");
  26 + $aColumnHeaders = array("Type","Users","Version","Comment","Datetime");
  27 + $aColumnTypes = array(1,1,1,1,1);
  28 + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%");
  29 + $oPatternTableSqlQuery->setTableHeading("Transaction History");
  30 + return $oPatternTableSqlQuery->render();
  31 +}
  32 +
  33 +function getPage($iDocumentID, $iFolderID, $sDocumentName) {
  34 + $sToRender = "<table>\n";
  35 + $sToRender .= "<tr>\n";
  36 + $sToRender .= "<td>" . getDocumentPath($iFolderID, $sDocumentName) . "</td>\n";
  37 + $sToRender .= "</tr>\n";
  38 + $sToRender .= "</table>\n";
  39 + $sToRender .= "<table>\n";
  40 + $sToRender .= "<tr>\n";
  41 + $sToRender .= "<td>" . getDocumentHistory($iDocumentID) . "</td>\n";
  42 + $sToRender .= "</tr>\n";
  43 + $sToRender .= "</table>\n";
  44 + return $sToRender;
  45 +}
  46 +
  47 +?>
... ...