Commit c7370b981bc2dda0ebbc626fdbd68c5b395d253f

Authored by rob
1 parent 77dbc87c

Added linked document table


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1887 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
... ... @@ -56,6 +56,45 @@ function renderDocumentData($oDocument) {
56 56 return $oPatternListFromQuery->render();
57 57 }
58 58  
  59 +function renderEditableLinkedDocuments($oDocument) {
  60 + global $default;
  61 +
  62 + $sQuery = "SELECT D.id AS document_id, D.name, DL.id as document_link_id, 'Unlink' AS unlink " .
  63 + "FROM documents AS D INNER JOIN document_link AS DL ON D.id = DL.child_document_id " .
  64 + "WHERE DL.parent_document_id = " . $oDocument->getID();
  65 +
  66 + $aColumns = array("name", "unlink");
  67 + $aColumnHeaders = array("Document");
  68 + $aColumnTypes = array(3,3);
  69 + $aDBColumnArray = array("document_id","document_link_id");
  70 + $aQueryStringVariableNames = array("fDocumentID", "fDocumentLinkID");
  71 + $aLinkURLs = array(0=>"$default->rootUrl/control.php?action=viewDocument", 1=>"$default->rootUrl/control.php?action=removeDocumentLink");
  72 +
  73 + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "100%", $aLinkURLs,$aDBColumnArray,$aQueryStringVariableNames);
  74 + $oPatternTableSqlQuery->setTableHeading("Linked documents");
  75 + $oPatternTableSqlQuery->setDisplayColumnHeadings(true);
  76 + return $oPatternTableSqlQuery->render();
  77 +
  78 +}
  79 +
  80 +function renderNonEditableLinkedDocuments($oDocument) {
  81 + global $default;
  82 +
  83 + $sQuery = "SELECT D.id, D.name, 'Delete' AS del " .
  84 + "FROM documents AS D INNER JOIN document_link AS DL ON D.id = DL.child_document_id " .
  85 + "WHERE DL.parent_document_id = " . $oDocument->getID();
  86 +
  87 + $aColumns = array("name","del");
  88 + $aColumnNames = array("Document");
  89 + $aColumnTypes = array(1,3);
  90 +
  91 + $oPatternListFromQuery = & new PatternListFromQuery($sQuery, $aColumns, $aColumnNames, $aColumnTypes);
  92 + $oPatternListFromQuery->setTableHeading("Linked documents");
  93 + $oPatternListFromQuery->setTableWidth("90%");
  94 + return $oPatternListFromQuery->render();
  95 +}
  96 +
  97 +
59 98 function renderGenericMetaData($oDocument) {
60 99 global $default;
61 100 $sQuery = "SELECT DF.name AS name, DFL.value as value " .
... ... @@ -237,9 +276,10 @@ function getEditPage($oDocument) {
237 276 $sToRender .= "\t</tr>";
238 277 }
239 278 */
  279 +
240 280 $sToRender .= "\t<tr>\n";
241 281 $sToRender .= "\t\t<td>" . renderEditableDocumentRouting($oDocument) . "</td>\n";
242   - $sToRender .= "\t</tr>";
  282 + $sToRender .= "\t</tr>";
243 283  
244 284 $sToRender .= "\t<tr>\n";
245 285  
... ... @@ -257,7 +297,7 @@ function getEditPage($oDocument) {
257 297 if (!$oDocument->getIsCheckedOut()) {
258 298 $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";
259 299 $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";
260   - }
  300 + }
261 301 $sToRender .= "\t\t</tr></table></td>\n";
262 302 }
263 303  
... ... @@ -275,7 +315,13 @@ function getEditPage($oDocument) {
275 315 $sToRender .= "<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fForPublish=1><img src=\"$default->graphicsUrl/widgets/publish.gif\" border=\"0\"/></a></td>\n";
276 316 }
277 317 }
278   - $sToRender .= "\t</tr>";
  318 + $sToRender .= "\t</tr>";
  319 + $sToRender .= "\t<tr>\n";
  320 + $sToRender .= "\t\t<td>" . renderEditableLinkedDocuments($oDocument) . "</td>\n";
  321 + $sToRender .= "\t</tr>";
  322 + $sToRender .= "\t<tr>\n";
  323 + $sToRender .= "<td><a href=" . $_SERVER['PHP_SELF'] . "?fDocumentID=" . $oDocument->getID() . "&fForPublish=1><img src=\"$default->graphicsUrl/widgets/add.gif\" border=\"0\"/></a></td>\n";
  324 + $sToRender .= "\t</tr>";
279 325 $sToRender .= "\t</table>";
280 326 $sToRender .= "</td>\n";
281 327 $sToRender .= "</tr>\n";
... ...