Commit 79fdbbbbce4a5f3c157e99a104bcce6a5946f2fb

Authored by Neil Blakey-Milner
1 parent 81db6282

No longer used.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4495 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/archiveSettingsUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * This page holds all presentation code for display document archiving settings.
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 documentmanagement.archiving
26   - */
27   -
28   -KTUtil::extractGPC('fArchivingTypeID', 'fDocumentID');
29   -
30   -/**
31   - * Displays an error message
32   - */
33   -function renderErrorMessage($sErrorMessage) {
34   - $sToRender = "<table>";
35   - $sToRender .= "<tr><td><p><font color=\"red\">$sErrorMessage</font></p></td></tr>";
36   - $sToRender .= "</table>";
37   - return $sToRender;
38   -}
39   -
40   -function renderDocumentTransactionListBox($iDocumentTransactionID) {
41   - global $default;
42   - $oPatternListBox = & new PatternListBox($default->transaction_types_table, "name", "id", "fDocumentTransactionID");
43   - $oPatternListBox->setWhereClause("ST.name in ('View','Download')");
44   - if (isset($iDocumentTransactionID)) {
45   - $oPatternListBox->setSelectedValue($iDocumentTransactionID);
46   - }
47   - return $oPatternListBox->render();
48   -}
49   -
50   -function renderArchivingTypeListBox() {
51   - global $default, $fArchivingTypeID;
52   - $oPatternListBox = & new PatternListBox($default->archiving_type_lookup_table, "name", "id", "fArchivingTypeID");
53   - $oPatternListBox->setPostBackOnChange(true);
54   - $oPatternListBox->setSelectedValue($fArchivingTypeID);
55   - return $oPatternListBox->render();
56   -}
57   -
58   -function renderTimeUnitsListBox($iTimeUnitID) {
59   - global $default;
60   - $oPatternListBox = & new PatternListBox($default->time_unit_lookup_table, "name", "id", "fTimeUnitID");
61   - if (isset($iTimeUnitID)) {
62   - $oPatternListBox->setSelectedValue($iTimeUnitID);
63   - }
64   - return $oPatternListBox->render();
65   -}
66   -
67   -function renderChooseArchivingTypeForm() {
68   - global $default, $fDocumentID;
69   -
70   - $sToRender = "<table border=\"0\">";
71   - $sToRender .= "<tr><td colspan=\"2\">" . _("Choose the archiving type for this document") . "</td></tr>";
72   - $sToRender .= "<tr><td>" . _("Archiving Type") . ":</td><td>" . renderArchivingTypeListBox() . "</td></tr>";
73   - // hidden archive settings references
74   - $sToRender .= "<input type=\"hidden\" name=\"fDocumentID\" value=\"$fDocumentID\">\n";
75   - $sToRender .= "<tr><td>" . generateControllerLink("viewDocument", "fDocumentID=$fDocumentID&fShowSection=archiveSettings", "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\" />") . "</td></tr>\n";
76   - $sToRender .= "</table>";
77   - return $sToRender;
78   -}
79   -
80   -function getDateArchivingJavascript() {
81   - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n";
82   - $sToRender .= "function validateForm(theForm) {\n";
83   - $sToRender .= "\tif (isBlank(theForm.fExpirationDate) && isBlank(theForm.fUnits) && isBlank(theForm.fTimeUnitID)) {\n";
84   - $sToRender .= "\t\talert('You must specify an expiration date OR an expiration period');\n";
85   - $sToRender .= "\t\treturn false;\n";
86   - $sToRender .= "\t}\n";
87   - // if expirationDate is not blank
88   - // and either units or unit id are not blank
89   - $sToRender .= "\tif (!isBlank(theForm.fExpirationDate) && (!isBlank(theForm.fUnits) || !isBlank(theForm.fTimeUnitID))) {\n";
90   - $sToRender .= "\t\talert('You must specify EITHER an expiration date OR an expiration period');\n";
91   - $sToRender .= "\t\treturn false;\n";
92   - $sToRender .= "\t}\n";
93   -
94   - $sToRender .= "\tif (!isBlank(theForm.fUnits) || !isBlank(theForm.fTimeUnitID)) {\n";
95   - $sToRender .= "\t\tif (!validNum(theForm.fUnits, 'Units', true) ) {\n";
96   - $sToRender .= "\t\t\treturn false;\n";
97   - $sToRender .= "\t\t}\n";
98   - $sToRender .= "\t\tif (!validRequired(theForm.fTimeUnitID, 'Date Unit')) {\n";
99   - $sToRender .= "\t\t\treturn false;\n";
100   - $sToRender .= "\t\t}\n";
101   - $sToRender .= "\t} else {\n";
102   - $sToRender .= "\t\tif (isBlank(theForm.fExpirationDate)) {\n";
103   - $sToRender .= "\t\t\tif (!validDate(theForm.fExpirationDate, 'Expiration Date', true)) {\n";
104   - $sToRender .= "\t\t\t\treturn false;\n";
105   - $sToRender .= "\t\t\t}\n";
106   - $sToRender .= "\t\t}\n";
107   - $sToRender .= "\t}\n";
108   - $sToRender .= "\treturn true;\n";
109   - $sToRender .= "}\n";
110   - $sToRender .= "//-->\n</script>\n\n";
111   - return $sToRender;
112   -}
113   -
114   -function getUtilisationArchivingJavascript() {
115   - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n";
116   - $sToRender .= "function validateForm(theForm) {\n";
117   - $sToRender .= "\tif (!validRequired(theForm.fDocumentTransactionID,'Document Transaction')) {\n";
118   - $sToRender .= "\t\treturn false;\n\t}\n";
119   - $sToRender .= "\tif (!validNum(theForm.fUnits,'Units', true)) {\n";
120   - $sToRender .= "\t\treturn false;\n\t}\n";
121   - $sToRender .= "\tif (!validRequired(theForm.fTimeUnitID,'Date Unit')) {\n";
122   - $sToRender .= "\t\treturn false;\n\t}\n";
123   - $sToRender .= "return true;\n}\n";
124   - $sToRender .= "//-->\n</script>\n\n";
125   - return $sToRender;
126   -}
127   -
128   -function renderTimePeriod($sHeading, $sFooter = "", $oTimePeriod = null) {
129   - global $default;
130   - $sToRender .= "<tr valign=\"middle\">";
131   - if (strlen($sHeading) > 0) {
132   - $sToRender .= "<td>$sHeading:</td>";
133   - }
134   - $sToRender .= "<td><input type=\"text\" size=\"11\" name=\"fUnits\" value=\"" . ($oTimePeriod ? $oTimePeriod->getUnits() : "") . "\">";
135   - $sToRender .= "&nbsp;&nbsp;" . renderTimeUnitsListBox( ($oTimePeriod ? $oTimePeriod->getTimeUnitID() : null) ) . $sFooter;
136   - $sToRender .= "&nbsp;&nbsp;<a href=\"javascript:void();\" onclick=\"document.MainForm.fUnits.value='';document.MainForm.fTimeUnitID.value='';\"><img src=\"" . KTHtml::getResetButton() . "\" border=\"0\"></a></td>";
137   - $sToRender .= "</tr>";
138   - return $sToRender;
139   -}
140   -
141   -/**
142   - * Displays the edit archive settings form
143   - *
144   - * @param integer the archive settings to modify, null display an add form
145   - */
146   -function renderArchiveSettingsForm($iDocumentID, $oArchiveSettings, $iArchivingTypeID = -1) {
147   - global $default, $fDocumentID;
148   -
149   - if ($oArchiveSettings) {
150   - $sToRender .= "(" . _("in order to change the archiving type for this document, click the 'Remove' button and add new archiving settings") . ")";
151   - $iArchivingTypeID = $oArchiveSettings->getArchivingTypeID();
152   - }
153   -
154   - $sArchivingType = lookupName($default->archiving_type_lookup_table, $iArchivingTypeID);
155   -
156   - $sToRender .= "<table border=\"0\">";
157   - // TODO: calendar control integration
158   - switch ($sArchivingType) {
159   - case "Date" :
160   -
161   - $sToRender .= "<tr><th align=\"left\" colspan=\"2\">Archive By Date</th></tr>";
162   - $sToRender .= "<tr><td>" . _("Expiration Date") . ":</td>";
163   - $sToRender .= "<td valign=bottom><input type=\"text\" name=\"fExpirationDate\" size=\"10\" maxlength=\"10\" " . ($oArchiveSettings ? "value=\"" . ($oArchiveSettings->getExpirationDate() == "0000-00-00" ? "" : $oArchiveSettings->getExpirationDate()) . "\"" : "") . ">";
164   - $sToRender .= "&nbsp;&nbsp;<a href=\"javascript:show_calendar('MainForm.fExpirationDate',null,null,'YYYY-MM-DD');\" onmouseover=\"window.status='Date Picker';return true;\" onmouseout=\"window.status='';return true;\"><img src=\"$default->graphicsUrl/calendar/calendar.gif\" name=\"imgCalendar\" width=\"34\" height=\"21\" border=\"0\" alt=\"\"></a>";
165   - $sToRender .= "&nbsp;&nbsp;<a href=\"javascript:void();\" onclick=\"document.MainForm.fExpirationDate.value=''\"><img src=\"" . KTHtml::getResetButton() . "\" border=\"0\"></a></td></tr>";
166   -
167   - if ($oArchiveSettings) {
168   - $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID());
169   - $sToRender .= renderTimePeriod(_("Expires after"), _("from document creation date"), $oTimePeriod);
170   - } else {
171   - $sToRender .= renderTimePeriod(_("Expires after"), _("from document creation date"));
172   - }
173   - $sToRender .= getDateArchivingJavascript();
174   - break;
175   - case "Utilisation" :
176   -
177   - $sToRender .= "<tr><th align=\"left\" colspan=\"2\">Archive By Utilisation</th></tr>";
178   - $sToRender .= "<tr><td colspan=\"2\">Archive document </td></tr>";
179   - if ($oArchiveSettings) {
180   - $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID());
181   - $sToRender .= renderTimePeriod("", "", $oTimePeriod);
182   - } else {
183   - $sToRender .= renderTimePeriod("");
184   - }
185   - if ($oArchiveSettings) {
186   - $iDocumentTransactionID = $oArchiveSettings->getDocumentTransactionID();
187   - }
188   - $sToRender .= "<tr><td colspan=\"2\">" . sprintf(_("after the last %s transactions"), renderDocumentTransactionListBox($iDocumentTransactionID)) . " </td></tr>";
189   - $sToRender .= getUtilisationArchivingJavascript();
190   - break;
191   - }
192   -
193   - // hidden archive settings references
194   - $sToRender .= "<input type=\"hidden\" name=\"fDocumentID\" value=\"$fDocumentID\">\n";
195   - $sToRender .= "<input type=\"hidden\" name=\"fArchivingTypeID\" value=\"$iArchivingTypeID\">\n";
196   - $sToRender .= "<input type=\"hidden\" name=\"fStore\" value=\"1\">\n";
197   - if ($oArchiveSettings) {
198   - $sToRender .= "<tr><td colspan=\"2\"><input type=\"image\" src=\"" . KTHtml::getUpdateButton() . "\" border=\"0\">\n";
199   - $sToRender .= generateControllerLink("modifyDocumentArchiveSettings", "fDocumentID=$fDocumentID&fDelete=1", "<img src=\"" . KTHtml::getRemoveButton() . "\" border=\"0\"/>");
200   - } else {
201   - $sToRender .= "<tr><td colspan=\"2\"><input type=\"image\" src=\"" . KTHtml::getSubmitButton() . "\" border=\"0\">\n";
202   - $sToRender .= generateControllerLink("addDocumentArchiveSettings", "fDocumentID=$fDocumentID", "<img src=\"" . KTHtml::getBackButton() . "\" border=\"0\">");
203   - }
204   - $sToRender .= generateControllerLink("viewDocument", "fDocumentID=$fDocumentID&fShowSection=archiveSettings", "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\" />") . "</td></tr>\n";
205   - $sToRender .= "</table>";
206   -
207   - return $sToRender;
208   -}
209   -
210   -/**
211   - * Displays the edit document archive settings page
212   - */
213   -function renderEditArchiveSettingsPage($iDocumentID, $oArchiveSettings, $sErrorMessage = "") {
214   - global $default;
215   -
216   - $sToRender .= renderHeading(_("Edit Document Archive Settings"));
217   - $sToRender .= displayDocumentPath($iDocumentID);
218   - if (strlen($sErrorMessage) > 0) {
219   - $sToRender .= renderErrorMessage($sErrorMessage);
220   - }
221   - $sToRender .= "<table>\n";
222   - $sToRender .= renderArchiveSettingsForm($iDocumentID, $oArchiveSettings);
223   - $sToRender .= "</table>\n";
224   - return $sToRender;
225   -}
226   -
227   -/**
228   - * Displays the add document archive settings page
229   - */
230   -function renderAddArchiveSettingsPage($iDocumentID, $iArchivingTypeID = false, $sErrorMessage = "") {
231   - global $default;
232   -
233   - $sToRender .= renderHeading(_("Add Document Archive Settings"));
234   - $sToRender .= displayDocumentPath($iDocumentID);
235   - if (strlen($sErrorMessage) > 0) {
236   - $sToRender .= renderErrorMessage($sErrorMessage);
237   - }
238   - $sToRender .= "<table>\n";
239   - if ($iArchivingTypeID) {
240   - $sToRender .= renderArchiveSettingsForm($iDocumentID, null, $iArchivingTypeID);
241   - } else {
242   - $sToRender .= renderChooseArchivingTypeForm();
243   - }
244   - $sToRender .= "</table>\n";
245   - return $sToRender;
246   -}
247   -
248   -
249   -/**
250   - * Display the confirmation page for manual archiving of a document
251   - */
252   -function renderArchiveConfirmationPage($iDocumentID, $sErrorMessage = "") {
253   - global $default;
254   -
255   - $sToRender = renderHeading(_("Archive Document"));
256   - if (strlen($sErrorMessage) > 0) {
257   - $sToRender .= renderErrorMessage($sErrorMessage);
258   - }
259   - $sToRender .= "<table>\n";
260   - $sToRender .= "<tr>\n";
261   - $sToRender .= "<td>" . _("You have chosen to archive the document entitled") . " '" . Document::getDocumentName($iDocumentID) . "'.</td>\n";
262   - $sToRender .= "<tr>\n<tr>\n";
263   - $sToRender .= "<td>" . _("Select 'Archive' to confirm, or 'Cancel' to cancel.") . "</td>\n";
264   - $sToRender .= "<tr>\n";
265   - $sToRender .= "<tr>\n";
266   - $sToRender .= "<td>&nbsp</td>\n";
267   - $sToRender .= "<tr>\n";
268   - $sToRender .= "<td><table><tr><td><a href=\"" . $_SERVER["PHP_SELF"] . "?fDocumentID=$iDocumentID&fConfirmed=1\"><img src=\"" . KTHtml::getArchiveButton() . "\" border=\"0\"></a></td><td>" . generateControllerLink("viewDocument", "fDocumentID=$iDocumentID&fShowSection=archiveSettings", "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\">") . "</td></tr></table></td>";
269   - $sToRender .= "</tr>";
270   - $sToRender .= "</table>\n";
271   -
272   - return $sToRender;
273   -}
274   -?>
presentation/lookAndFeel/knowledgeTree/documentmanagement/archiving/restoreArchivedDocumentUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * This page holds all presentation code for requesting the restoration of archived documents.
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 documentmanagement.archiving
26   - */
27   -
28   -/**
29   - * Displays the page that allows an administrator to restore an archived document
30   - */
31   -function getRestoreArchivedDocumentPage($oDocument) {
32   - global $default;
33   -
34   - $sToRender = renderHeading(_("Restore Archived Document")) . renderDocumentPath($oDocument) . "\n<br>\n";
35   -
36   - $sToRender .= "<table>\n";
37   - $sToRender .= "\t<tr>\n\t\t<td><strong>" . _("This document has been archived!") . "</strong></td>\n\t</tr>\n";
38   - $sToRender .= "\t<tr>\n\t\t<td>" . _("Please click 'Restore' to restore this archived document.") . "</td>\n\t</tr>\n";
39   - $sToRender .= "\t<tr><td><input type=\"hidden\" name=\"fDocumentIDs[]\" value=\"" . $oDocument->getID() . "\"/></td></tr>\n";
40   - $sToRender .= "\t<tr>\n";
41   - $sToRender .= "\t\t<td><a href=\"" . generateControllerUrl("archivedDocuments", "fConfirm=1&fDocumentIDs[]=" . $oDocument->getID()) . "\"><img src=\"" . KTHtml::getRestoreButton() . "\" border=\"0\" /></a>";
42   - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID() . "\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\" /></a></td>\n";
43   - $sToRender .= "\t</tr>";
44   - $sToRender .= "</table>\n";
45   -
46   - return $sToRender;
47   -}
48   -
49   -/**
50   - * Displays the page that allows a user to request the restoration of an archived document
51   - */
52   -function getRequestRestoreDocumentPage($oDocument) {
53   - global $default;
54   -
55   - $sToRender = renderHeading(_("Request Archived Document Restoration")) . renderDocumentPath($oDocument) . "\n<br>\n";
56   -
57   - $sToRender .= "<table>\n";
58   -$sToRender .= "\t<tr>\n\t\t<td><strong>" . _("This document has been archived!") . "</strong></td>\n\t</tr>\n";
59   - $sToRender .= "\t<tr>\n\t\t<td>" . _("To request that the document be unarchived, please click the 'Restore' button.") . "</td>\n\t</tr>\n";
60   - $sToRender .= "\t<tr><td><input type=\"hidden\" name=\"fDocumentIDs[]\" value=\"" . $oDocument->getID() . "\"/></td></tr>\n";
61   - $sToRender .= "\t<tr>\n";
62   - $sToRender .= "\t\t<td><a href=\"" . generateControllerUrl("requestDocumentRestore", "&fDocumentID=" . $oDocument->getID()) . "\"><img src=\"" . KTHtml::getRestoreButton() . "\" border=\"0\" /></a>";
63   - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID() . "\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\" /></a></td>\n";
64   - $sToRender .= "\t</tr>";
65   - $sToRender .= "</table>\n";
66   -
67   - return $sToRender;
68   -}
69   -
70   -/**
71   - * Displays the page that allows an administrator to restore an archived document
72   - */
73   -function renderRequestSuccessPage($oDocument) {
74   - global $default;
75   -
76   - $sToRender = renderHeading(_("Restore Archived Document"));
77   - $sToRender .= "<table>\n";
78   - $sToRender .= "\t<tr><td>" . _("Your request has been processed, you will be notified when the document is restored.") . "</td></tr>\n";
79   - $sToRender .= "\t<tr><td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID() . "\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a></td></tr>\n";
80   - $sToRender .= "</table>\n";
81   - return $sToRender;
82   -}
83   -
84   -/**
85   - * Display the error page for archiving request failure
86   - */
87   -function renderRequestFailurePage($oDocument, $oUnitAdminUser) {
88   - global $default;
89   - $sToRender = renderHeading(_("Restore Archived Document"));
90   - $sToRender .= "<table>\n";
91   - $sToRender .= "\t<tr><td>" . _("There was an error requesting the restoration of this document from the archive. Please try again later.") . "</td></tr>\n";
92   - $sToRender .= "\t<tr><td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID() . "\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a></td></tr>\n";
93   - $sToRender .= "</table>\n";
94   - return $sToRender;
95   -}
96   -?>
presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Common document 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 Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
25   - * @package documentmanagement
26   - */
27   -
28   -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
29   -
30   -/**
31   - *
32   - */
33   -function displayDocumentPath($iDocumentID) {
34   - global $default;
35   - $oDocument = Document::get($iDocumentID);
36   - if ($oDocument) {
37   - $iFolderID = $oDocument->getFolderID();
38   - // #3425 for consistency
39   - $sDocumentName = $oDocument->getFileName();
40   - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
41   - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
42   - $sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse") . " > " . $sDocumentName;
43   - return "<table border=\"0\" width=\"600\"><tr><td bgcolor=\"$sTDBGColour\">$sDocumentPath</td></tr></table>\n";
44   - } else {
45   - return "";
46   - }
47   -}
48   -
49   -/* only used when users choose a template document when setting up document linking
50   - * on the folder collaboration page. Formats the link so that the child window
51   - * lanuched by the javascript feeds back to the parent window
52   -*/
53   -function displayDocumentLinkForTemplateBrowsing($oDocument, $bDisplayFullPath = false) {
54   - global $default;
55   -
56   - $sIconUrl = $oDocument->getMimeTypeIconUrl();
57   - $sIconPath = ($sIconUrl ? generateImage($sIconUrl) : generateImage("$default->graphicsUrl/unknown.gif"));
58   -
59   - // #3425 the title is now the filename, and the description is the title
60   - $sLinkText = $oDocument->getFileName();
61   - if ($bDisplayFullPath) {
62   - // prepend folder path
63   - $sLinkText = Folder::getFolderDisplayPath($oDocument->getFolderID()) . " > " . $sLinkText;
64   - }
65   -
66   -
67   - return generateLinkForTemplateDocumentBrowse("$default->rootUrl/control.php",
68   - "action=viewDocument&fDocumentID=" . $oDocument->getID(),
69   - $sIconPath . "&nbsp;" . $sLinkText, $oDocument->getName(), $oDocument->getID());
70   -
71   -
72   -}
73   -
74   -/**
75   - * Displays a link to view document details
76   - *
77   - * @param object the document to display
78   - * @param boolean whether to display the entire path to the document or not
79   - */
80   -
81   -function displayDocumentLink($oDocument, $bDisplayFullPath = false) {
82   - global $default;
83   -
84   - $sIconUrl = $oDocument->getMimeTypeIconUrl();
85   - $sIconPath = ($sIconUrl ? generateImage($sIconUrl) : generateImage("$default->graphicsUrl/unknown.gif"));
86   -
87   - // #3425 the title is now the filename, and the description is the title
88   - $sLinkText = $oDocument->getFileName();
89   - if ($bDisplayFullPath) {
90   - // prepend folder path
91   - $sLinkText = Folder::getFolderDisplayPath($oDocument->getFolderID()) . " > " . $sLinkText;
92   - }
93   -
94   - return generateLink("$default->rootUrl/control.php",
95   - "action=viewDocument&fDocumentID=" . $oDocument->getID(),
96   - $sIconPath . "&nbsp;" . $sLinkText);
97   -}
98   -
99   -function renderErrorPage($sErrorMessage, $iDocumentID = -1) {
100   - global $default;
101   - return "<p class=\"errorText\">$sErrorMessage</p>\n" .
102   - (($iDocumentID == -1) ?
103   - "<a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=$iDocumentID\">" :
104   - "<a href=\"javascript:history.go(-1)\">") .
105   - "<img src=\"" . KTHtml::getBackButton() . "\" border=\"0\"/></a>\n";
106   -}
107   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/folderDocumentTypes.php deleted
1   -<?php
2   -
3   -require_once('../../../../config/dmsDefaults.php');
4   -require_once(KT_LIB_DIR . '/dispatcher.inc.php');
5   -require_once(KT_LIB_DIR . '/documentmanagement/DocumentType.inc');
6   -require_once(KT_LIB_DIR . '/foldermanagement/FolderDocTypeLink.inc');
7   -
8   -class KTFolderDocumentTypeDispatcher extends KTStandardDispatcher {
9   - function check () {
10   - if (empty($_REQUEST['fFolderId'])) {
11   - $this->permissionDenied();
12   - exit(0);
13   - }
14   - $oPermission = KTPermission::getByName('ktcore.permissions.write');
15   - $this->oFolder =& Folder::get($_REQUEST['fFolderId']);
16   - $oUser =& User::get($_SESSION['userID']);
17   - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPermission, $this->oFolder)) {
18   - $this->permissionDenied();
19   - exit(0);
20   - }
21   - return true;
22   - }
23   -
24   - function do_main() {
25   - $oTemplating =& KTTemplating::getSingleton();
26   - $oTemplate = $oTemplating->loadTemplate('ktcore/documenttypes/folderassign');
27   -
28   - $sTable = KTUtil::getTableName('folder_doctypes');
29   - $aQuery = array(
30   - "SELECT document_type_id FROM $sTable WHERE folder_id = ?",
31   - array($this->oFolder->getId()),
32   - );
33   - $aSelectedIds = DBUtil::getResultArrayKey($aQuery, 'document_type_id');
34   -
35   - $oTemplate->setData(array(
36   - 'oFolder' => $this->oFolder,
37   - 'document_types' => DocumentType::getList(),
38   - 'selected_types' => $aSelectedIds,
39   - ));
40   - return $oTemplate;
41   - }
42   -
43   - function do_assign() {
44   - if (empty($_REQUEST['restricted'])) {
45   - $this->oFolder->setRestrictDocumentTypes(false);
46   - } else {
47   - $this->oFolder->setRestrictDocumentTypes(true);
48   - }
49   -
50   - $sTable = KTUtil::getTableName('folder_doctypes');
51   - $res = DBUtil::runQuery(array(
52   - "DELETE FROM $sTable WHERE folder_id = ?",
53   - array($this->oFolder->getId()),
54   - ));
55   - foreach ($_REQUEST['document_types'] as $iDocumentTypeId) {
56   - $oLink = new FolderDocTypeLink($this->oFolder->getId(), $iDocumentTypeId);
57   - $oLink->create();
58   - }
59   - $this->oFolder->update();
60   - $this->errorRedirectToMain(_('Changes made'), 'fFolderId=' .
61   - $this->oFolder->getId());
62   - exit(0);
63   - }
64   -}
65   -
66   -$d =& new KTFolderDocumentTypeDispatcher;
67   -$d->dispatch();
68   -
69   -?>