viewHistoryUI.inc
4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/**
* viewHistoryBL.php
* Contains HTML information required to build the document history view page.
* Will be used by viewHistoryBL.php
*
* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
* @date 12 February 2003
* @package presentation.lookAndFeel.knowledgeTree.documentManager
*/
/*function renderHeading($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 = "<table border=\"0\" width=\"600\">\n";
$sToRender .= "<tr align=\"left\"><th class=\"sectionHeading\" bgcolor=\"$sColor\">$sHeading</th></tr>\n";
$sToRender .= "<tr/>\n";
$sToRender .= "<tr/>\n";
$sToRender .= "</table>\n";
return $sToRender;
}*/
function getDocumentPath($iFolderID, $sDocumentName) {
global $default;
$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($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse") . " > " . $sDocumentName;
return "<table border=\"0\" width=\"600\"><tr><td bgcolor=\"$sTDBGColour\">$sDocumentPath</td></tr></table>\n";
}
function getDocumentHistory($iDocumentID) {
global $default;
$sQuery = "SELECT DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment, DT.datetime AS datetime " .
"FROM $default->owl_document_transactions_table AS DT INNER JOIN $default->owl_users_table AS U ON DT.user_id = U.id " .
"INNER JOIN $default->owl_transaction_types_table AS DTT ON DTT.id = DT.transaction_id " .
"WHERE DT.document_id = $iDocumentID ORDER BY DT.datetime DESC";
$sql = $default->db;
$sToRender = "<table cellpadding=\"5\" border=\"1\" width=\"90%\">\n";
$sToRender .= "<caption align=\"top\" colspan=\"5\" align=\"left\"><b>Transaction History</b></caption>\n";
$sql->query($sQuery);
if ($sql->num_rows() == 0) {
$sToRender .= "<tr>\n";
$sToRender .= "\t<td colspan=\"5\">No Transaction History data</td>\n";
$sToRender .= "</tr>\n";
} else {
$sToRender .= "<tr><th align=\"left\">Type</th>\n";
$sToRender .= "<th align=\"left\">Users</th>\n";
$sToRender .= "<th align=\"left\">Version</th>\n";
$sToRender .= "<th align=\"left\">Comment</th>\n";
$sToRender .= "<th align=\"left\">Datetime</th></tr>\n";
$i = 0;
while ($sql->next_record()) {
if ($sql->f("transaction_name") == "Check Out") {
// IE ssl download hack- don't use ssl to download
if ($default->phpSniff->property("browser") == "ie") {
$sVersion = "<a href=\"http://" . $default->serverName . "$default->rootUrl/control.php?action=viewDocument&fDocumentID=$iDocumentID&fForDownload=1&fVersion=" . $sql->f("version") . "\">" . $sql->f("version") . "</a>";
} else {
$sVersion = generateControllerLink("viewDocument", "fDocumentID=$iDocumentID&fForDownload=1&fVersion=" . $sql->f("version"), "<strong>" . $sql->f("version") . "</strong>");
}
} else {
$sVersion = $sql->f("version");
}
$sToRender .= "<tr bgcolor=\"" . getColour($i++) . "\">\n";
$sToRender .= "<td>" . $sql->f("transaction_name") . "</td><td>" . $sql->f("user_name") . "</td><td>$sVersion</td>\n";
$sToRender .= "<td>" . $sql->f("comment") . "</td><td>" . $sql->f("datetime") . "</td></tr>\n";
}
$sToRender .= "</table>\n";
}
return $sToRender;
}
function getPage($iDocumentID, $iFolderID, $sDocumentName) {
global $default;
$sToRender = renderHeading("Document History");
$sToRender .= "<table>\n";
$sToRender .= "<tr>\n";
$sToRender .= "<td>" . getDocumentPath($iFolderID, $sDocumentName) . "</td>\n";
$sToRender .= "</tr>\n";
$sToRender .= "</table>\n";
$sToRender .= "<table>\n";
$sToRender .= "<tr>\n";
$sToRender .= "<td>" . getDocumentHistory($iDocumentID) . "</td>\n";
$sToRender .= "</tr>\n";
$sToRender .= "<tr><td><a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=$iDocumentID\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\" /></a></td></tr>\n";
$sToRender .= "</table>\n";
return $sToRender;
}
?>