Commit 36b90eb218e97d4a3fd1c6666fa9254ccad18de0

Authored by rob
1 parent 02a892d2

Initial revision. Collaboration at the folder level. Basic functionality there


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@687 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/foldermanagement/collaborationBL.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Document collaboration business logic - contains business logic to set up
  4 +* document approval process
  5 +*
  6 +* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  7 +* @date 28 January 2003
  8 +* @package presentation.lookAndFeel.knowledgeTree.documentmanagement
  9 +*
  10 +*/
  11 +
  12 +require_once("../../../../config/dmsDefaults.php");
  13 +
  14 +if (checkSession()) {
  15 + require_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc");
  16 + require_once("collaborationUI.inc");
  17 + require_once("$default->owl_fs_root/lib/security/permission.inc");
  18 + require_once("$default->owl_fs_root/presentation/webpageTemplate.inc");
  19 + require_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc");
  20 +
  21 + $oPatternCustom = & new PatternCustom();
  22 + $oPatternCustom->setHtml(getDocumentRoutingPage(null, 1));
  23 + $main->setCentralPayload($oPatternCustom);
  24 + $main->setFormAction("$default->owl_root_url/control.php?action=viewDocument&fDocumentID=1");
  25 + $main->render();
  26 +}
  27 +
  28 +?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/collaborationUI.inc 0 → 100644
  1 +<?php
  2 +/**
  3 +* Presentation data for collaborationBL.php
  4 +*
  5 +* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  6 +* @date 28 January 2003
  7 +* @package presentation.lookAndFeel.knowledgeTree.documentmanagement
  8 +*
  9 +*/
  10 +
  11 +function getGroupDropDown($iDocumentRoutingID, $fDocumentID) {
  12 + global $_POST, $default;
  13 + $oPatternListBox = & new PatternListBox("$default->owl_groups_table", "name", "id", "fGroupID");
  14 + $oPatternListBox->setPostBackOnChange(true);
  15 + $sOnChangeAction = $_SERVER["PHP_SELF"] . "?fForFilter=1&fDocumentRoutingID=$iDocumentRoutingID&fDocumentID=$fDocumentID";
  16 + $oPatternListBox->setOnChangeAction("setActionAndSubmit('$sOnChangeAction')");
  17 + if (isset($_POST["fGroupID"])) {
  18 + $oPatternListBox->setSelectedValue($_POST["fGroupID"]);
  19 + }
  20 + $oPatternListBox->setEmptyErrorMessage("There are no groups");
  21 + return $oPatternListBox->render();
  22 +}
  23 +
  24 +function getUserDropDown() {
  25 + global $_GET, $_POST, $default;
  26 + $oPatternListBox = & new PatternListBox("$default->owl_users_table", "name", "id", "fUserID");
  27 + if (isset($_GET["fForFilter"])) {
  28 + $sFromClause = "INNER JOIN $default->owl_users_groups_table AS UGL ON ST.id = UGL.user_id ";
  29 + $oPatternListBox->setFromClause($sFromClause);
  30 + $sWhereClause = "UGL.group_id = " . $_POST["fGroupID"];
  31 + $oPatternListBox->setWhereClause($sWhereClause);
  32 + }
  33 +
  34 + $oPatternListBox->setEmptyErrorMessage("There are no users in this group");
  35 + return $oPatternListBox->render();
  36 +}
  37 +
  38 +function getRoleDropDown() {
  39 + global $default;
  40 + $oPatternListBox = & new PatternListBox("$default->owl_roles_table", "name", "id", "fRole");
  41 + $oPatternListBox->setEmptyErrorMessage("There are no users in this group");
  42 + return $oPatternListBox->render();
  43 +}
  44 +
  45 +function getDocumentRoutingPage($oDocumentRouting, $fDocumentID) {
  46 + global $default;
  47 + return "<table border=0>\n" .
  48 + "<caption><b>Edit document routing information</b></caption>\n" .
  49 + "<tr>\n" .
  50 + "<td><b>Group</b></td><td>".getGroupDropDown(1, 1)."</td>\n" .
  51 + "</tr>\n" .
  52 + "<tr>\n" .
  53 + "<td><b>User</b></td><td>".getUserDropDown()."</td>\n" .
  54 + "</tr>\n" .
  55 + "<tr>\n" .
  56 + "<td><b>Role</b></td><td>".getRoleDropDown()."</td>\n" .
  57 + "</tr>\n" .
  58 + "<tr>\n" .
  59 + "<tr>\n" .
  60 + "<td><b>Seq. no.</b></td><td><input type=\"text\" size=\"5\" /></td>\n" .
  61 + "</tr>\n" .
  62 + "<tr>\n" .
  63 + "<td colspan=\"2\">&nbsp</td>\n" .
  64 + "</tr>\n" .
  65 + "<tr>\n" .
  66 + "<td><b><input type=\"submit\" value=\"Submit\" /></b></td><td><a href=\"$default->owl_root_url/control.php?action=viewDocument&fDocumentID=$fDocumentID \">Cancel</a></td>\n" .
  67 + "</tr>\n" .
  68 + "</table>\n";
  69 +}
  70 +
  71 +/*function getRoutingRow($iSequenceValue, $iIndex) {
  72 + $sToRender = "<tr>\n";
  73 + $sToRender .= "\t<td>" . renderGroupDropDown($iIndex) . "</td>\n";
  74 + $sToRender .= "\t<td>" . renderUserDropDown($iIndex) . "</td>\n";
  75 + $sToRender .= "\t<td>" . renderRoleDropDown($iIndex) . "</td>\n";
  76 + $sToRender .= "\t<td><input type=\"text\" value=\"$iSequenceValue\"</td>\n";
  77 + $sToRender .= "</tr>\n";
  78 + return $sToRender;
  79 +}
  80 +
  81 +function something($fDocumentID) {
  82 + $sQuery = "SELECT GFAL.id, R.name AS role_name, COALESCE(U.Name, 'Not assigned') AS name, GFAL.precedence AS precedence " .
  83 + "FROM documents AS D INNER JOIN groups_folders_approval_link AS GFAL ON D.folder_id = GFAL.folder_id " .
  84 + "INNER JOIN roles AS R ON GFAL.role_id = R.id " .
  85 + "LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.folder_id = D.folder_id " .
  86 + "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " .
  87 + "WHERE D.id = $fDocumentID " .
  88 + "ORDER BY GFAL.precedence, role_name ASC";
  89 + $sql = new Owl_DB();
  90 + $sql->query($sQuery);
  91 +
  92 + $sToRender .= "<table border=\"1\">\n";
  93 + $sToRender .= "<th>Group</th>\n";
  94 + $sToRender .= "<th>User</th>\n";
  95 + $sToRender .= "<th>Role</th>\n";
  96 + $sToRender .= "<th>Sequence no.</th>\n";
  97 +
  98 + $iIndex = 0;
  99 + while ($sql->next_record()) {
  100 + $sToRender .= getRoutingRow($sql->f("id"), $sql->f("precedence"));
  101 + $iIndex++;
  102 + }
  103 + $sToRender .= "</table>\n";
  104 +
  105 + return $sToRender;
  106 +}
  107 +
  108 +function getPage($fSelectedGroupID, $iSequenceValue, $iIndex) {
  109 + $sToRender .= "<table>\n";
  110 + $sToRender .= "<th>Group</th>\n";
  111 + $sToRender .= "<th>User</th>\n";
  112 + $sToRender .= "<th>Sequence no.</th>\n";
  113 + for ($i = 0; $i < 5; $i++) {
  114 + $sToRender .= getRoutingRow($fSelectedGroupID, $iSequenceValue, $i);
  115 + }
  116 + $sToRender .= "</table>\n";
  117 +}*/
  118 +
  119 +?>