Commit ed3c131104d6f20767e3604529a87239f2ccd910

Authored by nbm
1 parent d92af6da

Remove left-over old folder management pages.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4358 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Business logic concerned with the deletion of a folder.
6   - * Will use deleteFolderUI.inc for presentation functionality.
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package foldermanagement
27   - */
28   -
29   -require_once("../../../../config/dmsDefaults.php");
30   -
31   -KTUtil::extractGPC('fDeleteConfirmed', 'fFolderID');
32   -
33   -require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
34   -require_once("$default->fileSystemRoot/lib/foldermanagement/FolderDocTypeLink.inc");
35   -require_once("$default->fileSystemRoot/lib/foldermanagement/PhysicalFolderManagement.inc");
36   -require_once("$default->fileSystemRoot/lib/groups/GroupUnitLink.inc");
37   -require_once("$default->fileSystemRoot/lib/users/User.inc");
38   -require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc");
39   -require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc");
40   -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
41   -require_once("$default->fileSystemRoot/presentation/Html.inc");
42   -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
43   -
44   -require_once("deleteFolderUI.inc");
45   -
46   -if (checkSession()) {
47   - // initialise custom pattern once
48   - $oPatternCustom = & new PatternCustom();
49   -
50   - if (isset($fFolderID)) {
51   - $oFolder = Folder::get($fFolderID);
52   - if (Permission::userHasFolderWritePermission($oFolder)) {
53   - if (isset($fDeleteConfirmed)) {
54   - // deletion of folder is confirmed
55   -
56   - if (isset($oFolder)) {
57   - // check if there are any documents or folders in this folder
58   -
59   - $sFolderPath = Folder::getFolderPath($fFolderID);
60   - if ($oFolder->delete()) {
61   - if (PhysicalFolderManagement::deleteFolder($sFolderPath)) {
62   - // successfully deleted the folder from the file system
63   - $default->log->info("deleteFolderBL.php successfully deleted folder " . $oFolder->getName() . " from parent folder " . Folder::getFolderPath($oFolder->getParentID()) . " id=" . $oFolder->getParentID());
64   -
65   - // delete folder document types link
66   - $aFolderDocTypeLink = FolderDocTypeLink::getList(array("folder_id = ?", $fFolderID));/*ok*/
67   - for ($i=0; $i<count($aFolderDocTypeLink); $i++) {
68   - $aFolderDocTypeLink[$i]->delete();
69   - }
70   -
71   - // fire subscription alerts for parent folder subscriptions to the deleted folder
72   - $count = SubscriptionEngine::fireSubscription($oFolder->getParentID(), SubscriptionConstants::subscriptionAlertType("RemoveChildFolder"),
73   - SubscriptionConstants::subscriptionType("FolderSubscription"),
74   - array( "removedFolderName" => $oFolder->getName(),
75   - "parentFolderName" => Folder::getFolderDisplayPath($oFolder->getParentID())));
76   - $default->log->info("deleteFolderBL.php fired $count parent folder subscription alerts for removed folder " . $oFolder->getName());
77   -
78   - // fire subscription alerts for the deleted folder
79   - $count = SubscriptionEngine::fireSubscription($fFolderID, SubscriptionConstants::subscriptionAlertType("RemoveSubscribedFolder"),
80   - SubscriptionConstants::subscriptionType("FolderSubscription"),
81   - array( "removedFolderName" => $oFolder->getName(),
82   - "parentFolderName" => Folder::getFolderDisplayPath($oFolder->getParentID())));
83   - $default->log->info("deleteFolderBL.php fired $count parent folder subscription alerts for removed folder " . $oFolder->getName());
84   -
85   - // remove folder subscriptions for this folder
86   - if (SubscriptionManager::removeSubscriptions($fFolderID, SubscriptionConstants::subscriptionType("FolderSubscription"))) {
87   - $default->log->info("deleteFolderBL.php removed all subscriptions for this folder");
88   - } else {
89   - $default->log->error("deleteFolderBL.php couldn't remove folder subscriptions");
90   - }
91   -
92   - // redirect to the browse folder page with the parent folder id
93   - redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oFolder->getParentID());
94   - } else {
95   - // could not delete the folder from the file system
96   - $default->log->error("deleteFolderBL.php Filesystem error deleting folder " . $oFolder->getName() . " from parent folder " . Folder::getFolderPath($oFolder->getParentID()) . " id=" . $oFolder->getParentID());
97   - // so reverse the folder deletion
98   - $oFolder->create();
99   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
100   - $oPatternCustom->setHtml("");
101   - $main->setCentralPayload($oPatternCustom);
102   - $main->setErrorMessage(_("The folder could not be deleted from the file system"));
103   - $main->render();
104   - }
105   - } else {
106   - // could not delete the folder in the db
107   - $default->log->error("deleteFolderBL.php DB error deleting folder " . $oFolder->getName() . " from parent folder " . Folder::getFolderPath($oFolder->getParentID()) . " id=" . $oFolder->getParentID());
108   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
109   - $oPatternCustom->setHtml("");
110   - $main->setCentralPayload($oPatternCustom);
111   - $main->setErrorMessage(_("The folder could not be deleted from the database"));
112   - $main->render();
113   - }
114   - } else {
115   - // could not load folder object
116   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
117   - $oPatternCustom->setHtml("");
118   - $main->setCentralPayload($oPatternCustom);
119   - $main->setErrorMessage(_("An error occured whilst retrieving the folder from the database"));
120   - $main->render();
121   - }
122   - } else {
123   - // check if there are any folders or documents in this folder
124   -
125   - // get folders descended from this one
126   - $aFolderArray = Folder::getList(array("parent_id = ?", $fFolderID));/*ok*/
127   - // get live documents in this folder
128   - $aLiveDocuments = Document::getList(array("folder_id = ? AND status_id = " . LIVE, $fFolderID));/*ok*/
129   - // get archived documents in this folder
130   - $aArchivedDocuments = Document::getList(array("folder_id = ? AND status_id = " . ARCHIVED, $fFolderID));/*ok*/
131   -
132   - if (count($aFolderArray) > 0) {
133   - $oPatternCustom->setHtml(getFolderNotEmptyPage($fFolderID, count($aFolderArray), "folder(s)"));
134   - } else if (count($aLiveDocuments) > 0) {
135   - $oPatternCustom->setHtml(getFolderNotEmptyPage($fFolderID, count($aLiveDocuments), "document(s)"));
136   - } else if (count($aArchivedDocuments) > 0) {
137   - $oPatternCustom->setHtml(getFolderNotEmptyPage($fFolderID, "", " archived documents"));
138   - } else {
139   - // check if this is a unit root folder before allowing deletion
140   - $oFolder = Folder::get($fFolderID);
141   -
142   - // check if this unit has any groups
143   - $aGroupUnitLink = GroupUnitLink::getList(array("unit_id = ?", $oFolder->getUnitID()));/*ok*/
144   - $bUnitHasGroups = count($aGroupUnitLink) > 0;
145   -
146   - if (Folder::folderIsUnitRootFolder($fFolderID) && $bUnitHasGroups) {
147   - // you can't delete a unit root folder
148   - $oPatternCustom->setHtml(statusPage("Delete Folder", "", _("You can't delete this folder because it is a Unit Root Folder and in use") . ".", "browse", "fFolderID=" . $iFolderID));
149   -
150   - } else {
151   - // get confirmation first
152   - $oPatternCustom->setHtml(getConfirmPage($fFolderID, $oFolder->getName()));
153   - }
154   - }
155   - // render the page
156   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
157   - $main->setCentralPayload($oPatternCustom);
158   - $main->render();
159   - }
160   - } else {
161   - // user does not have permission to delete the folder
162   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
163   - $oPatternCustom = & new PatternCustom();
164   - $oPatternCustom->setHtml("");
165   - $main->setCentralPayload($oPatternCustom);
166   - $main->setErrorMessage(_("You do not have permission to delete this folder"));
167   - $main->render();
168   - }
169   - } else {
170   - // no folder selected for deletion
171   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
172   - $oPatternCustom = & new PatternCustom();
173   - $oPatternCustom->setHtml("");
174   - $main->setCentralPayload($oPatternCustom);
175   - $main->setErrorMessage(_("No folder currently selected"));
176   - $main->render();
177   - }
178   -}
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Presentation information for deleteFolderBL.php.
6   - *
7   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
8   - *
9   - * This program is free software; you can redistribute it and/or modify
10   - * it under the terms of the GNU General Public License as published by
11   - * the Free Software Foundation; either version 2 of the License, or
12   - * (at your option) any later version.
13   - *
14   - * This program is distributed in the hope that it will be useful,
15   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   - * GNU General Public License for more details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program; if not, write to the Free Software
21   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22   - *
23   - * @version $Revision$
24   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
25   - * @package foldermanagement
26   - */
27   -
28   -function getFolderPath($iFolderID) {
29   - global $default;
30   - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
31   - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
32   - $sFolderPath = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse");
33   - return "<table border=\"0\" width = 100%><tr><td bgcolor=\"$sTDBGColour\">$sFolderPath</td></tr></table>\n";
34   -}
35   -
36   -function getFolderNotEmptyPage($iFolderID, $iObjectCount, $sObjectType) {
37   - global $default;
38   - $sToRender = renderHeading(_("Delete Folder"));
39   - $sToRender .= getFolderPath($iFolderID) . "<br>\n";
40   - $sToRender .= "<table border=\"0\">\n";
41   - $sToRender .= "<tr>\n";
42   - $sToRender .= "<td>" . _("This folder cannot be deleted while it is not empty.") . "</td>\n";
43   - $sToRender .= "<tr>\n";
44   - $sToRender .= "<td>" . _("Select 'Cancel' to return to the browse page.") . "</td>\n";
45   - $sToRender .= "<tr>\n";
46   - $sToRender .= "<tr>\n";
47   - $sToRender .= "<td>&nbsp</td>\n";
48   - $sToRender .= "<tr>\n";
49   - $sToRender .= "<td><table><tr><td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=" . $iFolderID . "\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"></a></td></tr></table></td>";
50   - $sToRender .= "</tr>";
51   - $sToRender .= "</table>\n";
52   - return $sToRender;
53   -}
54   -
55   -function getConfirmPage($iFolderID, $sFolderName) {
56   - global $default;
57   - $sToRender = renderHeading(_("Delete Folder"));
58   - $sToRender .= getFolderPath($iFolderID) . "<br>\n";
59   - $sToRender .= "<table border=\"0\">\n";
60   - $sToRender .= "<tr>\n";
61   - $sToRender .= "<td>" . _("You have chosen to delete the folder entitled") . " '" . $sFolderName . "'.</td>\n";
62   - $sToRender .= "<tr>\n";
63   - $sToRender .= "<tr>\n";
64   - $sToRender .= "<td>" . _("Select 'Delete' to confirm the deletion, or 'Cancel' to cancel it") . "</td>\n";
65   - $sToRender .= "<tr>\n";
66   - $sToRender .= "<tr>\n";
67   - $sToRender .= "<td>&nbsp</td>\n";
68   - $sToRender .= "<tr>\n";
69   - $sToRender .= "<td><table><tr><td><a href=\"" . $_SERVER["PHP_SELF"] . "?fFolderID=$iFolderID&fDeleteConfirmed=1\"><img src=\"" . KTHtml::getDeleteButton() . "\" border=\"0\"></a></td> <td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=" . $iFolderID . "\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"></a></td></tr></table></td>";
70   - $sToRender .= "</tr>";
71   - $sToRender .= "</table>\n";
72   - return $sToRender;
73   -}
74   -
75   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/editBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Business logic used to edit folder properties
6   - *
7   - * Expected form variables:
8   - * o $fFolderID - primary key of folder user is currently browsing
9   - *
10   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
11   - *
12   - * This program is free software; you can redistribute it and/or modify
13   - * it under the terms of the GNU General Public License as published by
14   - * the Free Software Foundation; either version 2 of the License, or
15   - * (at your option) any later version.
16   - *
17   - * This program is distributed in the hope that it will be useful,
18   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
19   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20   - * GNU General Public License for more details.
21   - *
22   - * You should have received a copy of the GNU General Public License
23   - * along with this program; if not, write to the Free Software
24   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25   - *
26   - * @version $Revision$
27   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
28   - * @package foldermanagement
29   - */
30   -
31   -require_once("../../../../config/dmsDefaults.php");
32   -
33   -KTUtil::extractGPC('fFolderID', 'fShowSection');
34   -
35   -if (!checkSession()) {
36   - exit(0);
37   -}
38   -
39   -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
40   -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc");
41   -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListFromQuery.inc");
42   -require_once("editUI.inc");
43   -require_once("$default->fileSystemRoot/lib/security/Permission.inc");
44   -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
45   -require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
46   -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
47   -require_once("$default->fileSystemRoot/presentation/Html.inc");
48   -require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
49   -
50   -$oPatternCustom = & new PatternCustom();
51   -
52   -if (!isset($fFolderID)) {
53   - //else display an error message
54   - $oPatternCustom->setHtml("<a href=\"javascript:history.go(-1)\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a>\n");
55   - $main->setErrorMessage(_("No folder currently selected"));
56   - $_SESSION["pageAccess"][$default->rootUrl . '/presentation/lookAndFeel/knowledgeTree/store.php'] = true;
57   - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/store.php?fReturnURL=" . urlencode("$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID"));
58   - $main->setCentralPayload($oPatternCustom);
59   - $main->render();
60   - exit(0);
61   -}
62   -
63   -$oFolder = Folder::get($fFolderID);
64   -if (!$oFolder) {
65   - // folder doesn't exist
66   - $oPatternCustom->setHtml("<a href=\"javascript:history.go(-1)\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a>\n");
67   - $main->setErrorMessage(_("The folder you're trying to modify does not exist in the DMS"));
68   - $_SESSION["pageAccess"][$default->rootUrl . '/presentation/lookAndFeel/knowledgeTree/store.php'] = true;
69   - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/store.php?fReturnURL=" . urlencode("$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID"));
70   - $main->setCentralPayload($oPatternCustom);
71   - $main->render();
72   - exit(0);
73   -}
74   -
75   -//if the user can edit the folder
76   -if (!Permission::userHasFolderWritePermission($oFolder)) {
77   - //user does not have write permission for this folder,
78   - $oPatternCustom->setHtml("<a href=\"javascript:history.go(-1)\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a>\n");
79   - $main->setErrorMessage(_("You do not have permission to edit this folder"));
80   - $main->setCentralPayload($oPatternCustom);
81   - $main->render();
82   - exit(0);
83   -}
84   -
85   -$main->setCentralPayload($oPatternCustom);
86   -$main->render();
87   -
88   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/editUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Presentation information used for folder editing. Used by editBL.php.
6   - *
7   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
8   - *
9   - * This program is free software; you can redistribute it and/or modify
10   - * it under the terms of the GNU General Public License as published by
11   - * the Free Software Foundation; either version 2 of the License, or
12   - * (at your option) any later version.
13   - *
14   - * This program is distributed in the hope that it will be useful,
15   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   - * GNU General Public License for more details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program; if not, write to the Free Software
21   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22   - *
23   - * @version $Revision$
24   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
25   - * @package foldermanagement
26   - */
27   -
28   -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
29   -require_once(KT_LIB_DIR . '/documentmanagement/DocumentType.inc');
30   -
31   -function getFolderPath($iFolderID) {
32   - global $default;
33   - global $default;
34   - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
35   - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
36   - return "<table border=\"0\" cellpadding=\"5\" width=\"610\"><tr><td bgcolor=\"$sTDBGColour\">" . displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse") . "</td></tr></table>\n";
37   -}
38   -
39   -function getFolderData($iFolderID, $sDivName, $sStatusMessage = "") {
40   - global $default;
41   - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
42   - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
43   - /*ok*/ $sQuery = array("SELECT F.id, F.name, F.description, F.is_public " .
44   - "FROM $default->folders_table AS F " .
45   - "WHERE F.id = ?", $iFolderID);
46   -
47   -
48   - $aColumns = array("name", "description", "is_public");
49   - $aColumnHeaders = array(_("Name"), _("Description"), _("Public"));
50   - $aColumnTypes = array(1,1,2);
51   -
52   - $oPatternListFromQuery = & new PatternListFromQuery($sQuery, $aColumns, $aColumnHeaders, $aColumnTypes);
53   - $oPatternListFromQuery->setTableHeading(_("Folder Data"));
54   - $oPatternListFromQuery->setTableWidth("610");
55   -
56   - $sToRender .= "<table>";
57   - if (strlen($sStatusMessage) > 0) {
58   - $sToRender .= "<tr><td><font color=\"red\">$sStatusMessage</font></td></tr>";
59   - }
60   - $sToRender .= "<tr><td>" . $oPatternListFromQuery->render() . "</td></tr>";
61   - $sToRender .= "<tr><td><a href=\"$default->rootUrl/control.php?action=modifyFolderData&fFolderID=$iFolderID\"><img src=\"" . KTHtml::getEditButton() . "\" border=\"0\" /></a></td></tr>";
62   - $sToRender .= "</table>";;
63   -
64   - if ($sStatusMessage) {
65   - return $sToRender;
66   - } else {
67   - return renderSectionDiv($sDivName, $sToRender);
68   - }
69   -}
70   -
71   -function getFolderDocTypes($iFolderID, $sDivName) {
72   - $sTable = KTUtil::getTableName('folder_doctypes');
73   - $aQuery = array(
74   - "SELECT document_type_id FROM $sTable WHERE folder_id = ?",
75   - array($iFolderID),
76   - );
77   - $aSelectedIds = DBUtil::getResultArrayKey($aQuery, 'document_type_id');
78   -
79   - $sToRender = '<h2>Document Types</h2>';
80   -
81   - $oFolder =& Folder::get($iFolderID);
82   - if ($oFolder->getRestrictDocumentTypes()) {
83   - $sToRender .= '<h3>Document types are restricted to the following:</h3>';
84   - $sToRender .= '<ul>';
85   - foreach ($aSelectedIds as $iId) {
86   - $oDocumentType =& DocumentType::get($iId);
87   - $sToRender .= '<li>' . $oDocumentType->getName() . '</li>';
88   - }
89   - $sToRender .= '</ul>';
90   - } else {
91   - $sToRender .= '<h3>Document types are not restricted on this folder</h3>';
92   - }
93   - $sToRender .= sprintf(
94   - '<a href="%s/control.php?action=editFolderDocType&fFolderId=%d"><img src="%s" border="0" /></a>',
95   - $default->rootUrl, $iFolderID, KTHtml::getEditButton());
96   -
97   - return renderSectionDiv($sDivName, $sToRender);
98   -}
99   -
100   -function renderSectionDiv($sDivName, $sHtml) {
101   - global $default;
102   - if ($default->bNN4) {
103   - return "<div id=\"$sDivName\" style=\"position:absolute;visibility:hidden;top:250px;left:130px;\">" . $sHtml . " </div>";
104   - } else {
105   - return "<div id=\"$sDivName\" style=\"position:absolute;visibility:hidden;left:5px;\">$sHtml</div>";
106   - }
107   -}
108   -
109   -function renderFolderSection($sSectionName, $sHeadingText, $bDisplayLink, $iFolderID) {
110   - if ($bDisplayLink) {
111   - $sLink = generateControllerLink("editFolder", "fFolderID=$iFolderID&fShowSection=$sSectionName", $sHeadingText);
112   - } else {
113   - $sLink = "<a href=\"#\" onClick=\"switchDiv('$sSectionName', 'folder');\">$sHeadingText</a>";
114   - }
115   - return "<tr bgcolor=\"" . getColour($iColour) . "\"><td width=\"100%\">$sLink</td></tr>\n";
116   -}
117   -
118   -function getPage($iFolderID, $sStatusMessage) {
119   - global $default;
120   -
121   - $sToRender = "<div id=\"headings\" style=\"position:relative;visibility:visible;top:2px;left:2px;\">";
122   - $sToRender .= renderHeading(_("Modify Folder Properties"));
123   - $sToRender .= getFolderPath($iFolderID);
124   - $sToRender .= "<table border=0 cellspacing=\"0\" cellpadding=\"0\" width=\"610\">";
125   - $sToRender .= "<tr><td valign=\"top\">";
126   - $sToRender .= "<table border=\"0\" width=\"100%\">";
127   -
128   - // if we have a status message, then make the section links refresh to viewDocument with the fShowSection variable
129   - // ie. effectively removes statusMessage on next click
130   - $bDisplayLink = ($sStatusMessage) ? true : false;
131   -
132   - $sToRender .= renderFolderSection("folderData", _("Folder Data"), $bDisplayLink, $iFolderID);
133   - $sToRender .= renderFolderSection("documentTypes", _("Document Types"), $bDisplayLink, $iFolderID);
134   - $sToRender .= "</table>";
135   - $sToRender .= "</td><td><table border=1>";
136   - $sToRender .= "</table></td></tr></table>";
137   - $sToRender .= "</div>";
138   -
139   - // ugly netscape hacks
140   - if (!$default->bNN4) {
141   - $sToRender .= "<div id=\"contentDiv\" style=\"position:relative;visibility:hidden;width:500px;\">";
142   - }
143   - $sToRender .= getFolderData($iFolderID, "folderData");
144   - $sToRender .= getFolderDocTypes($iFolderID, "documentTypes");
145   - if (!$default->bNN4) {
146   - $sToRender .= "</div>";
147   - }
148   - return $sToRender;
149   -}
150   -
151   -
152   -function getStatusPage($iFolderID, $sStatusMessage) {
153   - global $default;
154   -
155   - $sToRender = "<div id=\"headings\" style=\"position:relative;visibility:visible;top:2px;left:2px;\">";
156   - $sToRender .= renderHeading(_("Modify Folder Properties"));
157   - $sToRender .= getFolderPath($iFolderID);
158   - $sToRender .= "<table border=\"0\" width=\"610\">";
159   -
160   - // if we have a status message, then make the section links refresh to viewDocument with the fShowSection variable
161   - // ie. effectively removes statusMessage on next click
162   - $bDisplayLink = ($sStatusMessage) ? true : false;
163   -
164   - $sToRender .= renderFolderSection("folderData", _("Folder Data"), $bDisplayLink, $iFolderID);
165   - $sToRender .= renderFolderSection("documentTypes", _("Document Types"), $bDisplayLink, $iFolderID);
166   - $sToRender .= renderFolderSection("folderPermissions", _("Folder Permissions"), $bDisplayLink, $iFolderID);
167   -
168   - $sToRender .= "</table>";
169   - $sToRender .= "</div>";
170   - $sToRender .= getFolderData($iFolderID, "folderData", $sStatusMessage);
171   - return $sToRender;
172   -}
173   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Common folder UI functions.
6   - *
7   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
8   - *
9   - * This program is free software; you can redistribute it and/or modify
10   - * it under the terms of the GNU General Public License as published by
11   - * the Free Software Foundation; either version 2 of the License, or
12   - * (at your option) any later version.
13   - *
14   - * This program is distributed in the hope that it will be useful,
15   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   - * GNU General Public License for more details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program; if not, write to the Free Software
21   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22   - *
23   - * @version $Revision$
24   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
25   - * @package foldermanagement
26   - */
27   -
28   -/**
29   - * Displays the passed path array as a link
30   - *
31   - * @param array containing the path to the folder (folder ids)
32   - * @param string the page to link to (defaults to the page this is called from)
33   - */
34   -function displayFolderPathLink($aPathArray, $aPathNameArray, $sLinkPage = "") {
35   - global $default;
36   - if (strlen($sLinkPage) == 0) {
37   - $sLinkPage = $_SERVER["PHP_SELF"];
38   - }
39   - $default->log->debug("displayFolderPathLink: slinkPage=$sLinkPage");
40   - // display a separate link to each folder in the path
41   - for ($i=0; $i<count($aPathArray); $i++) {
42   - $iFolderID = $aPathArray[$i];
43   - // retrieve the folder name for this folder
44   - $sFolderName = $aPathNameArray[$i];
45   - // generate a link back to this page setting fFolderID
46   - $sLink = generateLink($sLinkPage,
47   - "fBrowseType=folder&fFolderID=$iFolderID",
48   - $sFolderName);
49   - $sPathLinks = (strlen($sPathLinks) > 0) ? $sPathLinks . " > " . $sLink : $sLink;
50   - }
51   - return $sPathLinks;
52   -}
53   -
54   -
55   -/**
56   - * Displays the passed folder name as a link
57   - *
58   - * @param object the folder to link to
59   - * @param string the page to link to (defaults to the page this is called from)
60   - */
61   -function displayFolderLink($oFolder, $sLinkPage = "") {
62   - global $default;
63   -
64   - if (strlen($sLinkPage) == 0) {
65   - $sLinkPage = $_SERVER["PHP_SELF"];
66   - }
67   -
68   - if (Folder::folderIsUnitRootFolder($oFolder->getID())) {
69   - $sFolderIconPath = generateImage($default->graphicsUrl . "/widgets/dfolder_unit.gif");
70   - } elseif ($oFolder->getIsPublic()) {
71   - $sFolderIconPath = generateImage($default->graphicsUrl . "/widgets/dfolder_public.gif");
72   - } else {
73   - $sFolderIconPath = generateImage($default->graphicsUrl . "/widgets/dfolder.gif");
74   - }
75   -
76   - return generateLink($sLinkPage,
77   - "fBrowseType=folder&fFolderID=" . $oFolder->getID(),
78   - $sFolderIconPath .
79   - $oFolder->getName());
80   -}
81   -
82   -function renderFolderPath($iFolderID, $sLinkURL, $bDisplayLinks = true) {
83   - global $default;
84   - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
85   - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
86   - if ($bDisplayLinks) {
87   - $sFolderPath = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), $sLinkURL);
88   - } else {
89   - $sFolderPath = implode(" > ", Folder::getFolderPathNamesAsArray($iFolderID));
90   - }
91   - return "<table border=\"0\" cellpadding=\"5\" width=\"100%\"><tr><td bgcolor=\"$sTDBGColour\">$sFolderPath</td></tr></table>\n";
92   -}
93   -
94   -/**
95   -* Renders a the list of folders found in $iFolderID as
96   -* and HTML table. &fFolderID=<folder_id> is automatically
97   -* appended to the query string
98   -*
99   -* @return String HTML table
100   -*/
101   -function renderFolderList($iFolderID, $sLinkURL) {
102   - global $default;
103   - /*ok*/ $sQuery = array("SELECT F.id AS id, F.name AS name " .
104   - "FROM $default->folders_table AS F " .
105   - "WHERE F.parent_id = ? " .
106   - "ORDER BY F.name ASC", $iFolderID);
107   -
108   - $aColumns = array("name");
109   - $aColumnTypes = array(3);
110   - $aColumnHeaderNames = array("Folder");
111   - $aDBColumns = array("id");
112   - $aQueryStringVariableNames = array("fFolderID");
113   - $aLinkURLs = array("$sLinkURL");
114   -
115   - $aLinkURLs = array();
116   - if ((strlen($default->rootUrl) > 0) && (!strstr($sLinkURL, $default->rootUrl))) {
117   - $aLinkURLs = array("$default->rootUrl/$sLinkURL");
118   - } else {
119   - $aLinkURLs = array("$sLinkURL");
120   - }
121   -
122   - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaderNames, "100%", $aLinkURLs, $aDBColumns, $aQueryStringVariableNames);
123   - $oPatternTableSqlQuery->setImageURL("$default->graphicsUrl/widgets/dfolder.gif");
124   - $oPatternTableSqlQuery->setEmptyTableMessage(_("This folder contains no sub folders"));
125   - return $oPatternTableSqlQuery->render();
126   -}
127   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/modifyFolderDataBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Presentation information used for folder data editing.
6   - *
7   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
8   - *
9   - * This program is free software; you can redistribute it and/or modify
10   - * it under the terms of the GNU General Public License as published by
11   - * the Free Software Foundation; either version 2 of the License, or
12   - * (at your option) any later version.
13   - *
14   - * This program is distributed in the hope that it will be useful,
15   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   - * GNU General Public License for more details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program; if not, write to the Free Software
21   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22   - *
23   - * @version $Revision$
24   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
25   - * @package foldermanagement
26   - */
27   -
28   -require_once("../../../../config/dmsDefaults.php");
29   -
30   -KTUtil::extractGPC('fDescription', 'fFolderID', 'fFolderName', 'fForUpdate', 'fIsPublic');
31   -
32   -if (checkSession()) {
33   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
34   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc");
35   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListFromQuery.inc");
36   - require_once("$default->fileSystemRoot/lib/security/Permission.inc");
37   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
38   - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
39   - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
40   - require_once("$default->fileSystemRoot/presentation/Html.inc");
41   - require_once("modifyFolderDataUI.inc");
42   -
43   - if (isset($fFolderID)) {
44   - if (isset($fForUpdate)) {
45   - //user is updating folder data
46   - $oFolder = Folder::get($fFolderID);
47   - $oFolder->setDescription($fDescription);
48   - if (isset($fIsPublic)) {
49   - $oFolder->setIsPublic(true);
50   - } else {
51   - $oFolder->setIsPublic(false);
52   - }
53   - $bSuccessfulUpdate = false;
54   - if (isset($fFolderName) && strcmp($oFolder->getName(), $fFolderName) != 0) {
55   - //folder name has changed, update the full_path
56   - $sOldName = $oFolder->getName();
57   - $sOldPath = $default->documentRoot . "/" . $oFolder->getFullPath() . "/" . $oFolder->getName();
58   - $oFolder->setName($fFolderName);
59   - if ($oFolder->update(true)) {
60   - $bSuccessfulUpdate = true;
61   - if (!PhysicalFolderManagement::renameFolder($sOldPath, $default->documentRoot . "/" . $oFolder->getFullPath() . "/" . $oFolder->getName())) {
62   - //reverse the database changes if the physical rename failed
63   - $oFolder->setName($sOldName);
64   - $oFolder->update(true);
65   - $bSuccessfulUpdate = false;
66   - }
67   - }
68   - } else {
69   - $bSuccessfulUpdate = $oFolder->update();
70   - }
71   - if ($bSuccessfulUpdate) {
72   - // redirect to edit folder page
73   - controllerRedirect("editFolder", "fFolderID=$fFolderID");
74   - exit;
75   - } else {
76   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
77   - $oPatternCustom = & new PatternCustom();
78   - $oPatternCustom->setHtml(getFolderData($fFolderID, _("An error occurred while updating this folder")));
79   - $main->setHasRequiredFields(true);
80   - $_SESSION["pageAccess"][$default->rootUrl . '/presentation/lookAndFeel/knowledgeTree/store.php'] = true;
81   - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/store.php?fReturnURL=" . urlencode("$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID"));
82   - }
83   - } else {
84   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
85   - $oPatternCustom = & new PatternCustom();
86   - // display form
87   - $oPatternCustom->setHtml(getFolderData($fFolderID));
88   - $main->setHasRequiredFields(true);
89   - $main->setFormAction($_SERVER['PHP_SELF']);
90   - }
91   - }
92   - $main->setCentralPayload($oPatternCustom);
93   - $main->render();
94   -}
95   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/modifyFolderDataUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Presentation information used for folder data editing.
6   - *
7   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
8   - *
9   - * This program is free software; you can redistribute it and/or modify
10   - * it under the terms of the GNU General Public License as published by
11   - * the Free Software Foundation; either version 2 of the License, or
12   - * (at your option) any later version.
13   - *
14   - * This program is distributed in the hope that it will be useful,
15   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   - * GNU General Public License for more details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program; if not, write to the Free Software
21   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22   - *
23   - * @version $Revision$
24   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
25   - * @package foldermanagement
26   - */
27   -
28   -function getFolderData($iFolderID, $sStatusMessage = "") {
29   - global $default;
30   - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
31   - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
32   - /*ok*/ $sQuery = array("SELECT F.id, F.name, F.description, F.is_public " .
33   - "FROM $default->folders_table AS F " .
34   - "WHERE F.id = ?", $iFolderID);
35   -
36   - $sql = $default->db;
37   - $sql->query($sQuery);
38   -
39   - $sToRender .= renderHeading(_("Modify Folder Properties"));
40   - $sToRender .= renderFolderPath($iFolderID, generateControllerUrl("browse", "", false));
41   - $sToRender .= "<table>";
42   - $sToRender .= "<tr><td>";
43   - $sToRender .= "<table cellpadding=\"5\" border=\"0\" width=\"610\">\n";
44   - $sToRender .= "<caption><strong>" . _("Folder Data") . "</strong></caption>";
45   - if ($sql->next_record()) {
46   - $sToRender .= "<tr>\n";
47   - $sToRender .= "<td bgcolor=\"" . $sTDBGColour . "\">Name</td>\n";
48   - if (Folder::folderIsUnitRootFolder($iFolderID)) {
49   - $sToRender .= "<td>" . $sql->f("name") . "</td>\n";
50   - } else {
51   - $sToRender .= "<td><input type=\"text\" name=\"fFolderName\" value=\"" . $sql->f("name") . "\" size=\"50\"></td>\n";
52   - }
53   - $sToRender .= "</tr>\n";
54   - $sToRender .= "<tr>\n";
55   - $sToRender .= "<td bgcolor=\"" . $sTDBGColour . "\">Description</td>\n";
56   - $sToRender .= "<td><input type=\"text\" name=\"fDescription\" value=\"" . $sql->f("description") . "\" size=\"50\"></td>\n";
57   - $sToRender .= "</tr>\n";
58   - $sToRender .= "<tr>\n";
59   - $sToRender .= "<td bgcolor=\"" . $sTDBGColour . "\">Public</td>\n";
60   - $sToRender .= "<td><input type=\"checkbox\" name=\"fIsPublic\" " . ($sql->f("is_public") ? "CHECKED" : "") ." ></td>\n";
61   - $sToRender .= "</tr>\n";
62   - $sToRender .= "<tr>\n";
63   - $sToRender .= "<td></td>\n";
64   - $sToRender .= "</tr>\n";
65   - $sToRender .= "<input type=\"hidden\" name=\"fFolderID\" value=\"$iFolderID\">";
66   - $sToRender .= "<input type=\"hidden\" name=\"fForUpdate\" value=\"1\">";
67   -
68   - }
69   - $sToRender .= "</table></td></tr>";
70   - $sToRender .= "<tr><td><input type=\"image\" src=\"" . KTHtml::getUpdateButton() . "\" border=\"0\" />";
71   - $sToRender .= generateControllerLink("editFolder", "fFolderID=$iFolderID", "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/>") . "</td></tr>\n";
72   - $sToRender .= "</table>\n";
73   -
74   - return $sToRender;
75   -}
76   -?>