Commit 44b7097658b143fde6c3a49799ae79f53596b354

Authored by rob
1 parent 6fce99c8

Added edit functionality to document routing


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@699 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
... ... @@ -72,12 +72,12 @@ function renderTypeSpecificMetaData($oDocument) {
72 72 return $oPatternTableSqlQuery->render();
73 73 }
74 74  
75   -function renderDocumentRouting($oDocument) {
  75 +function renderEditableDocumentRouting($oDocument) {
76 76 global $default;
77   - $sQuery = "SELECT GFAL.id as id, R.name AS role_name, COALESCE(U.Name, 'Not assigned') AS name, GFAL.precedence AS precedence, 'Edit' as edit " .
78   - "FROM documents AS D INNER JOIN groups_folders_approval_link AS GFAL ON D.folder_id = GFAL.folder_id " .
  77 + $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, 'Edit' as edit " .
  78 + "FROM documents AS D INNER JOIN $default->owl_groups_folders_approval_table AS GFAL ON D.folder_id = GFAL.folder_id " .
79 79 "INNER JOIN roles AS R ON GFAL.role_id = R.id " .
80   - "LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.folder_id = D.folder_id " .
  80 + "LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.group_folder_approval_id = GFAL.id " .
81 81 "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " .
82 82 "WHERE D.id = " . $oDocument->getID() . " " .
83 83 "ORDER BY GFAL.precedence, role_name ASC";
... ... @@ -85,8 +85,31 @@ function renderDocumentRouting($oDocument) {
85 85 $aColumns = array("role_name", "name", "precedence", "edit");
86 86 $aColumnHeaders = array("Role", "Player", "Seq", "");
87 87 $aColumnTypes = array(1,1,1,3);
88   - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "10%", "$default->owl_root_url/control.php?action=modifyDocumentRouting&fFolderCollaborationID=","id");
  88 + $aDBColumnArray = array("id","document_id");
  89 + $aQueryStringVariableNames = array("fFolderCollaborationID", "fDocumentID");
  90 + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "10%", "$default->owl_root_url/control.php?action=modifyDocumentRouting",$aDBColumnArray,$aQueryStringVariableNames);
89 91 $oPatternTableSqlQuery->setTableHeading("Document Routing");
  92 + $oPatternTableSqlQuery->setDisplayColumnHeadings(true);
  93 + return $oPatternTableSqlQuery->render();
  94 +
  95 +}
  96 +
  97 +function renderNonEditableDocumentRouting($oDocument) {
  98 + global $default;
  99 + $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 " .
  100 + "FROM documents AS D INNER JOIN $default->owl_groups_folders_approval_table AS GFAL ON D.folder_id = GFAL.folder_id " .
  101 + "INNER JOIN roles AS R ON GFAL.role_id = R.id " .
  102 + "LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.group_folder_approval_id = GFAL.id " .
  103 + "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " .
  104 + "WHERE D.id = " . $oDocument->getID() . " " .
  105 + "ORDER BY GFAL.precedence, role_name ASC";
  106 +
  107 + $aColumns = array("role_name", "name", "precedence");
  108 + $aColumnHeaders = array("Role", "Player", "Seq");
  109 + $aColumnTypes = array(1,1,1);
  110 + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "10%", "$default->owl_root_url/control.php?action=modifyDocumentRouting",$aDBColumnArray,$aQueryStringVariableNames);
  111 + $oPatternTableSqlQuery->setTableHeading("Document Routing");
  112 + $oPatternTableSqlQuery->setDisplayColumnHeadings(true);
90 113 return $oPatternTableSqlQuery->render();
91 114  
92 115 }
... ... @@ -113,7 +136,7 @@ function getEditPage($oDocument) {
113 136 $sToRender .= "<td valign=top>\n";
114 137 $sToRender .= "\t<table border = 0, width = 230>\n";
115 138 $sToRender .= "\t<tr>\n";
116   - $sToRender .= "\t\t<td>" . wrapInTable(renderDocumentRouting($oDocument)) . "</td>\n";
  139 + $sToRender .= "\t\t<td>" . wrapInTable(renderEditableDocumentRouting($oDocument)) . "</td>\n";
117 140 //$sToRender .= "\t\t<td>" . renderDocumentRouting($oDocument) . "</td>\n";
118 141 $sToRender .= "\t</tr>";
119 142 $sToRender .= "\t</table>";
... ... @@ -152,7 +175,7 @@ function getViewPage($oDocument) {
152 175 $sToRender .= "<td valign=top>\n";
153 176 $sToRender .= "\t<table border = 0, width = 230>\n";
154 177 $sToRender .= "\t<tr>\n";
155   - $sToRender .= "\t\t<td>" . wrapInTable(renderDocumentRouting($oDocument)) . "</td>\n";
  178 + $sToRender .= "\t\t<td>" . wrapInTable(renderNonEditableDocumentRouting($oDocument)) . "</td>\n";
156 179 //$sToRender .= "\t\t<td>" . renderDocumentRouting($oDocument) . "</td>\n";
157 180 $sToRender .= "\t</tr>";
158 181 $sToRender .= "\t</table>";
... ...