Commit fa7d2bc2eb55c162f0c04b1e1780a035840a87de

Authored by Michael Joseph
1 parent 25f80642

updated phpdoc

changed to use div switching


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2185 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/foldermanagement/editUI.inc
1 <?php 1 <?php
2 /** 2 /**
3 -* Presentation information used for folder editing. Used by editBL.php  
4 -*  
5 -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa  
6 -* @date 2 February 2003  
7 -* @package presentation.lookAndFeel.knowledgeTree.foldermanagement  
8 -*  
9 -*/  
10 -  
11 -/*function renderHeading() {  
12 - global $default;  
13 - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));  
14 - $sColor = $default->siteMap->getSectionColour($sSectionName, "th");  
15 - $sToRender = "<table border=\"0\" width=\"600\">\n";  
16 - $sToRender .= "<tr align=\"left\"><th class=\"sectionHeading\" bgcolor=\"$sColor\"><font color=\"ffffff\">Modify Folder</font></th></tr>\n";  
17 - $sToRender .= "<tr/>\n";  
18 - $sToRender .= "<tr/>\n";  
19 - $sToRender .= "</table>\n";  
20 - return $sToRender;  
21 -}*/ 3 + * $Id$
  4 + *
  5 + * Presentation information used for folder editing. Used by editBL.php
  6 + *
  7 + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING.
  8 + *
  9 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  10 + * @date 2 February 2003
  11 + * @package presentation.lookAndFeel.knowledgeTree.foldermanagement
  12 + */
22 13
23 function getFolderPath($iFolderID) { 14 function getFolderPath($iFolderID) {
24 global $default; 15 global $default;
25 global $default; 16 global $default;
26 $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); 17 $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
27 $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td"); 18 $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
28 - return "<table border=\"0\" width=\"100%\"><tr><td bgcolor=\"$sTDBGColour\">" . displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse") . "</td></tr></table>\n"; 19 + return "<table border=\"0\" width=\"610\"><tr><td bgcolor=\"$sTDBGColour\">" . displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse") . "</td></tr></table>\n";
29 } 20 }
30 21
31 -  
32 -function getFolderData($iFolderID) { 22 +function getFolderData($iFolderID, $sDivName) {
33 global $default; 23 global $default;
34 $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); 24 $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
35 $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td"); 25 $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
@@ -40,6 +30,7 @@ function getFolderData($iFolderID) { @@ -40,6 +30,7 @@ function getFolderData($iFolderID) {
40 $sql = $default->db; 30 $sql = $default->db;
41 $sql->query($sQuery); 31 $sql->query($sQuery);
42 $sToRender = "<table>\n"; 32 $sToRender = "<table>\n";
  33 + $sToRender .= "<caption><strong>Folder Data</strong></caption>";
43 if ($sql->next_record()) { 34 if ($sql->next_record()) {
44 $sToRender .= "<tr>\n"; 35 $sToRender .= "<tr>\n";
45 $sToRender .= "<td bgcolor=\"" . $sTDBGColour . "\">Name</td>\n"; 36 $sToRender .= "<td bgcolor=\"" . $sTDBGColour . "\">Name</td>\n";
@@ -62,49 +53,13 @@ function getFolderData($iFolderID) { @@ -62,49 +53,13 @@ function getFolderData($iFolderID) {
62 $sToRender .= "</tr>\n"; 53 $sToRender .= "</tr>\n";
63 54
64 } 55 }
  56 + $sToRender .= "<tr><td><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" onClick=\"setActionAndSubmit('" . $_SERVER["PHP_SELF"] . "?fFolderID=$iFolderID&fForUpdate=1')\" border=\"0\" /></td></tr>\n";
65 $sToRender .= "</table>\n"; 57 $sToRender .= "</table>\n";
66 -  
67 -  
68 - /*$aDisplayColumns = array("folder_name", "description", "is_public");  
69 - $aStoreColumns = array("name", "description" , "is_public");  
70 - $aColumnNames = array("Name", "Description", "Public");  
71 - $aDisplayColumnTypes = array(1,1,2);  
72 - $aDatabaseColumnTypes = array(1,1,2);  
73 - $aDropDownListTableNames = array(2 => "$default->owl_document_types_table");  
74 -  
75 - $oPatternEditableListFromQuery = & new PatternEditableListFromQuery($sQuery, $default->owl_folders_table, $aDisplayColumns, $aStoreColumns, $aColumnNames, $aDisplayColumnTypes, $aDatabaseColumnTypes);  
76 - $oPatternEditableListFromQuery->setUniqueName("folderEdit");  
77 - $oPatternEditableListFromQuery->setDropDownListTableNames($aDropDownListTableNames);  
78 - $oPatternEditableListFromQuery->setColumnsRequired(array(1,0,1,0));  
79 -  
80 - return $oPatternEditableListFromQuery->render();*/  
81 -  
82 - return $sToRender;  
83 -  
84 -}  
85 58
86 -function getFolderDocTypes($iFolderID) {  
87 - global $default;  
88 - $sQuery = "SELECT FDL.id, FDL.folder_id, FDL.document_type_id, DTL.name, 'Remove' AS del " .  
89 - "FROM $default->owl_folder_doctypes_table AS FDL INNER JOIN $default->owl_document_types_table AS DTL ON FDL.document_type_id = DTL.id " .  
90 - "WHERE FDL.folder_id = $iFolderID " .  
91 - "ORDER BY DTL.name ASC";  
92 -  
93 - $aColumns = array("name", "del");  
94 - $aColumnHeaders = array("","");  
95 - $aColumnTypes = array(1,3,3);  
96 - $aDBColumnArray = array("id","folder_id");  
97 - $aQueryStringVariableNames = array("fFolderDocTypeID", "fFolderID");  
98 - $aLinkURLs = array(1=>"$default->rootUrl/control.php?action=deleteFolderDocType");  
99 -  
100 - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames);  
101 - $oPatternTableSqlQuery->setTableHeading("Document Types");  
102 - $oPatternTableSqlQuery->setDisplayColumnHeadings(true);  
103 - return $oPatternTableSqlQuery->render();  
104 - 59 + return renderSectionDiv($sDivName, $sToRender);
105 } 60 }
106 61
107 -function getFolderRouting($iFolderID) { 62 +function getFolderRouting($iFolderID, $sDivName, $bCollaboration) {
108 global $default; 63 global $default;
109 //had to use coalesce and left outer join for user_id because this column was a new addition 64 //had to use coalesce and left outer join for user_id because this column was a new addition
110 //and the user_ids for existing documents before this change will be null 65 //and the user_ids for existing documents before this change will be null
@@ -122,14 +77,49 @@ function getFolderRouting($iFolderID) { @@ -122,14 +77,49 @@ function getFolderRouting($iFolderID) {
122 $aQueryStringVariableNames = array("fFolderCollaborationID", "fFolderID", "fGroupID","fUserID","fSequenceNumber","fRoleID"); 77 $aQueryStringVariableNames = array("fFolderCollaborationID", "fFolderID", "fGroupID","fUserID","fSequenceNumber","fRoleID");
123 $aLinkURLs = array(4=>"$default->rootUrl/control.php?action=modifyFolderCollaboration",5=>"$default->rootUrl/control.php?action=deleteFolderCollaboration", 6=>"$default->rootUrl/control.php?action=viewDependantDocument"); 78 $aLinkURLs = array(4=>"$default->rootUrl/control.php?action=modifyFolderCollaboration",5=>"$default->rootUrl/control.php?action=deleteFolderCollaboration", 6=>"$default->rootUrl/control.php?action=viewDependantDocument");
124 79
125 - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames); 80 + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "610", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames);
126 $oPatternTableSqlQuery->setTableHeading("Document Routing"); 81 $oPatternTableSqlQuery->setTableHeading("Document Routing");
127 $oPatternTableSqlQuery->setDisplayColumnHeadings(true); 82 $oPatternTableSqlQuery->setDisplayColumnHeadings(true);
128 - return $oPatternTableSqlQuery->render();  
129 83
  84 + $sToRender .= "<table>";
  85 + $sToRender .= $oPatternTableSqlQuery->render();
  86 + if (!$bCollaboration) {
  87 + $sToRender .= "<tr>\n";
  88 + $sToRender .= "<td>\n";
  89 + $sToRender .= "<a href=\"$default->rootUrl/control.php?action=addFolderCollaboration&fFolderID=$iFolderID\"><img src=\"$default->graphicsUrl/widgets/add.gif\" border=\"0\" /></a>\n";
  90 + $sToRender .= "</td>\n";
  91 + $sToRender .= "</tr>\n";
  92 + }
  93 + $sToRender .= "</table>";
  94 + return renderSectionDiv($sDivName, $sToRender);
130 } 95 }
131 96
132 -function getFolderGroupAccess($iFolderID) { 97 +function getFolderDocTypes($iFolderID, $sDivName) {
  98 + global $default;
  99 + $sQuery = "SELECT FDL.id, FDL.folder_id, FDL.document_type_id, DTL.name, 'Remove' AS del " .
  100 + "FROM $default->owl_folder_doctypes_table AS FDL INNER JOIN $default->owl_document_types_table AS DTL ON FDL.document_type_id = DTL.id " .
  101 + "WHERE FDL.folder_id = $iFolderID " .
  102 + "ORDER BY DTL.name ASC";
  103 +
  104 + $aColumns = array("name", "del");
  105 + $aColumnHeaders = array("","");
  106 + $aColumnTypes = array(1,3,3);
  107 + $aDBColumnArray = array("id","folder_id");
  108 + $aQueryStringVariableNames = array("fFolderDocTypeID", "fFolderID");
  109 + $aLinkURLs = array(1=>"$default->rootUrl/control.php?action=deleteFolderDocType");
  110 +
  111 + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "610", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames);
  112 + $oPatternTableSqlQuery->setTableHeading("Document Types");
  113 + $oPatternTableSqlQuery->setDisplayColumnHeadings(true);
  114 +
  115 + $sToRender .= "<table>";
  116 + $sToRender .= $oPatternTableSqlQuery->render();
  117 + $sToRender .= "<tr><td><a href=\"$default->rootUrl/control.php?action=addFolderDocType&fFolderID=$iFolderID\"><img src=\"$default->graphicsUrl/widgets/add.gif\" border=\"0\" /></a></td></tr>";
  118 + $sToRender .= "</table>";
  119 + return renderSectionDiv($sDivName, $sToRender);
  120 +}
  121 +
  122 +function getFolderGroupAccess($iFolderID, $sDivName) {
133 global $default; 123 global $default;
134 $sQuery = "SELECT GFL.id as id, GFL.group_id AS group_id, GFL.folder_id AS folder_id, GFL.can_read AS can_read, GFL.can_write AS can_write, GL.name AS group_name, 'Edit' as edit, 'Delete' as del " . 124 $sQuery = "SELECT GFL.id as id, GFL.group_id AS group_id, GFL.folder_id AS folder_id, GFL.can_read AS can_read, GFL.can_write AS can_write, GL.name AS group_name, 'Edit' as edit, 'Delete' as del " .
135 "FROM $default->owl_groups_folders_table AS GFL " . 125 "FROM $default->owl_groups_folders_table AS GFL " .
@@ -143,27 +133,54 @@ function getFolderGroupAccess($iFolderID) { @@ -143,27 +133,54 @@ function getFolderGroupAccess($iFolderID) {
143 $aQueryStringVariableNames = array("fGroupFolderLinkID", "fFolderID"); 133 $aQueryStringVariableNames = array("fGroupFolderLinkID", "fFolderID");
144 $aLinkURLs = array(3=>"$default->rootUrl/control.php?action=modifyGroupFolderLink",4=>"$default->rootUrl/control.php?action=deleteGroupFolderLink"); 134 $aLinkURLs = array(3=>"$default->rootUrl/control.php?action=modifyGroupFolderLink",4=>"$default->rootUrl/control.php?action=deleteGroupFolderLink");
145 135
146 - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames); 136 + $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "610", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames);
147 $oPatternTableSqlQuery->setTableHeading("Folder Permissions"); 137 $oPatternTableSqlQuery->setTableHeading("Folder Permissions");
148 $oPatternTableSqlQuery->setDisplayColumnHeadings(true); 138 $oPatternTableSqlQuery->setDisplayColumnHeadings(true);
149 - return $oPatternTableSqlQuery->render(); 139 +
  140 + $sToRender .= "<table>";
  141 + $sToRender .= $oPatternTableSqlQuery->render();
  142 + $sToRender .= "<tr><td><a href=\"$default->rootUrl/control.php?action=addGroupFolderLink&fFolderID=$iFolderID\"><img src=\"$default->graphicsUrl/widgets/add.gif\" border=\"0\" /></a></td></tr>";
  143 + $sToRender .= "</table>";
  144 + return renderSectionDiv($sDivName, $sToRender);
  145 +}
  146 +
  147 +function renderSectionDiv($sDivName, $sHtml) {
  148 + global $default;
  149 +
  150 + if ( $default->browser == "ie" ) {
  151 + return "<div id=\"$sDivName\" style=\"position:absolute;visibility:hidden;top:250px;left:135px;\">$sHtml</div>";
  152 + } else {
  153 + return "<div id=\"$sDivName\" style=\"position:absolute;visibility:hidden;top:230px;left:133px;\">$sHtml</div>";
  154 + }
  155 +}
  156 +
  157 +function renderFolderSection($sHeading) {
  158 + return "<tr bgcolor=\"" . getColour($iColour) . "\"><td width=\"100%\">$sHeading</td></tr>\n";
150 } 159 }
151 160
152 function getPage($iFolderID, $bCollaboration = false) { 161 function getPage($iFolderID, $bCollaboration = false) {
153 global $default; 162 global $default;
154 -  
155 - $sToRender = renderHeading("Modify Folder");  
156 - $sToRender .= getFolderPath($iFolderID);  
157 - $sToRender .= "<table border=\"0\" width=\"100%\">\n";  
158 - $sToRender .= "<tr>\n";  
159 - $sToRender .= "<td valign=\"top\">\n";  
160 - $sToRender .= getLeftSide($iFolderID, $bCollaboration);  
161 - $sToRender .= "</td>\n";  
162 - $sToRender .= "<td valign=\"top\">\n";  
163 - $sToRender .= getRightSide($iFolderID);  
164 - $sToRender .= "</td>\n";  
165 - $sToRender .= "</tr>\n";  
166 - $sToRender .= "</table>\n"; 163 +
  164 + if ( $default->browser == "ie" ) {
  165 + $sToRender = "<div id=\"headings\" style=\"position:absolute;visibility:visible;top:120px;left:134px;\">";
  166 + } else {
  167 + $sToRender = "<div id=\"headings\" style=\"position:absolute;visibility:visible;top:106px;left:134px;\">";
  168 + }
  169 + $sToRender .= renderHeading("Modify Folder Properties");
  170 + $sToRender .= getFolderPath($iFolderID);
  171 +
  172 + $sToRender .= "<table border=\"0\" width=\"610\">";
  173 + $sToRender .= renderFolderSection("<a href=\"javascript:void();\" onClick=\"switchDiv('folderData', 'folder');\">Folder Data</a>");
  174 + $sToRender .= renderFolderSection("<a href=\"javascript:void();\" onClick=\"switchDiv('folderRouting', 'folder');\">Document Routing</a>");
  175 + $sToRender .= renderFolderSection("<a href=\"javascript:void();\" onClick=\"switchDiv('documentTypes', 'folder');\">Document Types</a>");
  176 + $sToRender .= renderFolderSection("<a href=\"javascript:void();\" onClick=\"switchDiv('folderPermissions', 'folder');\">Folder Permissions</a>");
  177 + $sToRender .= "</table>";
  178 + $sToRender .= "</div>";
  179 +
  180 + $sToRender .= getFolderData($iFolderID, "folderData");
  181 + $sToRender .= getFolderRouting($iFolderID, "folderRouting", $bCollaboration);
  182 + $sToRender .= getFolderDocTypes($iFolderID, "documentTypes");
  183 + $sToRender .= getFolderGroupAccess($iFolderID, "folderPermissions");
167 return $sToRender; 184 return $sToRender;
168 } 185 }
169 186