Commit 4866cd8e373db59b945ed3cfe106b8a0a8ca90d2

Authored by Neil Blakey-Milner
1 parent 7b76c6cb

Remove files replaced by actions


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4147 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentLinkBL.php deleted
1 -<?php  
2 -/**  
3 - * $Id$  
4 - *  
5 - * Business Logic to link a two documents together in a parent child  
6 - * relationship  
7 - *  
8 - * Expected form variable:  
9 - * o $fDocumentID - primary key of document user is currently viewing  
10 - *  
11 - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com  
12 - *  
13 - * This program is free software; you can redistribute it and/or modify  
14 - * it under the terms of the GNU General Public License as published by  
15 - * the Free Software Foundation; either version 2 of the License, or  
16 - * (at your option) any later version.  
17 - *  
18 - * This program is distributed in the hope that it will be useful,  
19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
21 - * GNU General Public License for more details.  
22 - *  
23 - * You should have received a copy of the GNU General Public License  
24 - * along with this program; if not, write to the Free Software  
25 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
26 - *  
27 - * @version $Revision$  
28 - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa  
29 - * @package documentmanagement  
30 - */  
31 -  
32 -require_once("../../../../config/dmsDefaults.php");  
33 -  
34 -KTUtil::extractGPC('fDocumentID', 'fForStore', 'fTargetDocumentID', 'fLinkTypeID');  
35 -  
36 -if (checkSession()) {  
37 - require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");  
38 - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentLink.inc");  
39 - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");  
40 - require_once("$default->fileSystemRoot/lib/security/Permission.inc");  
41 - require_once("$default->fileSystemRoot/lib/documentmanagement/LinkType.inc");  
42 - require_once("$default->fileSystemRoot/presentation/Html.inc");  
43 - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");  
44 - require_once("documentUI.inc");  
45 - require_once("addDocumentLinkUI.inc");  
46 -  
47 - $oDocument = Document::get($fDocumentID);  
48 - if (Permission::userHasDocumentWritePermission($oDocument)) {  
49 - //user has permission to link this document to another  
50 - if (isset($fForStore)) {  
51 - //create a new document link  
52 - $oDocumentLink = & new DocumentLink($fDocumentID, $fTargetDocumentID, $fLinkTypeID);  
53 - if ($oDocumentLink->create()) {  
54 - controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fShowSection=linkedDocuments");  
55 - } else {  
56 - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");  
57 - //an error occured while trying to create the document link  
58 - $oPatternCustom = & new PatternCustom();  
59 - $oPatternCustom->setHtml(getPage($fDocumentID));  
60 - if ($default->bNN4) {  
61 - $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");  
62 - }  
63 - $main->setCentralPayload($oPatternCustom);  
64 - $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1");  
65 - $main->setHasRequiredFields(true);  
66 - $main->setErrorMessage(_("An error occured whilst attempting to link the two documents"));  
67 - $main->render();  
68 - }  
69 - } else {  
70 - //display the add page  
71 - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");  
72 -  
73 - $oPatternCustom = & new PatternCustom();  
74 - $oPatternCustom->setHtml(getPage($fDocumentID));  
75 - if ($default->bNN4) {  
76 - $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");  
77 - }  
78 - $main->setCentralPayload($oPatternCustom);  
79 - $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1");  
80 - $main->setHasRequiredFields(true);  
81 - $main->render();  
82 - }  
83 - }  
84 -}  
85 -?>  
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentLinkUI.inc deleted
1 -<?php  
2 -/**  
3 - * $Id$  
4 - *  
5 - * Presentation logic used to link one document to another.  
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 documentmanagement  
26 - */  
27 -  
28 -function getPage($iDocumentID) {  
29 - global $default;  
30 -  
31 - $sToRender = renderHeading(_("Document Linking"));  
32 - $sToRender .= displayDocumentPath($iDocumentID);  
33 - $sToRender .= "<table>";  
34 - $sToRender .= "<tr>";  
35 - //had a slight problem with netscape 4.7x - it doesn't support disabled. So I had to use  
36 - //javascript to set the onFocus attribute to blur  
37 - if (!$default->bNN4) {  
38 - //for any other browser but netscape 4.7 do this  
39 - $sToRender .= "<td>" . _("Document to link") . "</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('" . generateControllerUrl("templateBrowse") . "','window2')\"></td>\n";  
40 - } else {  
41 - //for netscape 4.7 do this  
42 - $sToRender .= "<td>" . _("Document to link") . "</td><td><input type=\"text\" value=\"\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('" . generateControllerUrl("templateBrowse") . "','window2')\"></td>\n";  
43 - }  
44 - $sToRender .= "<tr>";  
45 - $sToRender .= "<td>Link Type</td><td>".getLinkTypesList($name="fLinkTypeID")."</td>\n";  
46 - $sToRender .= "</tr>\n";  
47 -  
48 - $sToRender .= "</tr>\n";  
49 - $sToRender .= "<tr>\n";  
50 - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getUpdateButton() . "\" border=\"0\"/></td><td><a href=\"" . $default->rootUrl . "/control.php?action=viewDocument&fDocumentID=$iDocumentID\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/></a></td></tr></table>\n";  
51 - $sToRender .= "</tr>\n";  
52 - $sToRender .= "</table>\n";  
53 - $sToRender .= "<input type=\"hidden\" name=\"fTargetDocumentID\" value=\"-1\" />\n";  
54 -  
55 - return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript();  
56 -}  
57 -  
58 -function getValidationJavaScript() {  
59 - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n";  
60 - $sToRender .= "function validateForm(theForm) {\n";  
61 - $sToRender .= "\tif (!(validRequired(theForm.fTargetDocument,'Document'))) {\n";  
62 - $sToRender .= "\t\treturn false;\n\t}\n";  
63 - $sToRender .= "return true;\n}\n";  
64 - $sToRender .= "//-->\n</script>\n\n";  
65 - return $sToRender;  
66 -}  
67 -  
68 -function getBrowseJavaScript() {  
69 - $sToRender = "<script language=\"JavaScript\"><!--\n ";  
70 - $sToRender .= "function newWindow(file,window) {\n ";  
71 - $sToRender .= "\tmsgWindow=open(file,window,config='resizable=yes,scrollbars=yes,width=400,height=600');\n ";  
72 - $sToRender .= "\tif (msgWindow.opener == null) msgWindow.opener = self; \n ";  
73 - $sToRender .= "}\n";  
74 - $sToRender .= "//--></script>\n";  
75 - return $sToRender;  
76 -}  
77 -  
78 -function getLinkTypesList($name="", $selected="") {  
79 - $sToRender = "\n<select name=\"$name\">";  
80 - $objects = LinkType::getList("id != -1");  
81 - for ($x=0; $x<count($objects); $x++){  
82 - $sToRender .="<option value=\"";  
83 - $sToRender .= $objects[$x]->iId;  
84 - $sToRender .="\"";  
85 - if ($objects[$x]->iId == 0) {  
86 - $sToRender .= " SELECTED";  
87 - }  
88 - $sToRender .= ">";  
89 - $sToRender .= $objects[$x]->sName;  
90 - $sToRender .="</option>";  
91 - }  
92 -  
93 - $sToRender .= "</select>";  
94 - return $sToRender;  
95 -}  
96 -  
97 -?>  
presentation/lookAndFeel/knowledgeTree/documentmanagement/bulkImport.php deleted
1 -<?php  
2 -  
3 -require_once('../../../../config/dmsDefaults.php');  
4 -  
5 -require_once(KT_LIB_DIR . '/dispatcher.inc.php');  
6 -  
7 -require_once(KT_DIR . "/presentation/webpageTemplate.inc");  
8 -require_once(KT_LIB_DIR . "/documentmanagement/DocumentType.inc");  
9 -require_once(KT_LIB_DIR . "/documentmanagement/DocumentField.inc");  
10 -require_once(KT_LIB_DIR . "/visualpatterns/PatternMetaData.inc");  
11 -  
12 -require_once(KT_LIB_DIR . "/import/fsimportstorage.inc.php");  
13 -require_once(KT_LIB_DIR . "/import/bulkimport.inc.php");  
14 -  
15 -require_once(KT_LIB_DIR . "/validation/dispatchervalidation.inc.php");  
16 -  
17 -class KTBulkImportDispatcher extends KTStandardDispatcher {  
18 - function check() {  
19 - if ($_REQUEST['fFolderID']) {  
20 - $_REQUEST['fFolderId'] = $_REQUEST['fFolderID'];  
21 - unset($_REQUEST['fFolderID']);  
22 - }  
23 -  
24 - $this->oFolder =& $this->oValidator->validateFolder($_REQUEST['fFolderId']);  
25 - $this->oPermission =& $this->oValidator->validatePermissionByName('ktcore.permissions.write');  
26 - $this->oValidator->userHasPermissionOnItem($this->oUser, $this->oPermission, $this->oFolder);  
27 - return true;  
28 - }  
29 -  
30 - function do_main() {  
31 - $oTemplating =& KTTemplating::getSingleton();  
32 - $oTemplate = $oTemplating->loadTemplate('ktcore/import/fs_import');  
33 - $aTypes = $this->getDocumentTypes();  
34 - $iDefaultType = $aTypes[0]->getId();  
35 - $aFields = array(  
36 - 'folder_id' => $this->oFolder->getID(),  
37 - 'folder_path_array' => $this->oFolder->getPathArray(),  
38 - 'document_type_choice' => $this->getDocumentTypeChoice($aTypes, 'getMetadataForType(this.value);'),  
39 - 'generic_metadata_fields' => $this->getGenericMetadataFields(),  
40 - 'type_metadata_fields' => $this->getTypeMetadataFields($iDefaultType),  
41 - );  
42 - return $oTemplate->render($aFields);  
43 - }  
44 -  
45 - function getDocumentTypeChoice($aTypes, $onchange = "") {  
46 - $oTemplating =& KTTemplating::getSingleton();  
47 - $oTemplate = $oTemplating->loadTemplate('ktcore/document/document_type_choice');  
48 - $aFields = array(  
49 - 'document_types' => $aTypes,  
50 - 'onchange' => $onchange,  
51 - );  
52 - return $oTemplate->render($aFields);  
53 - }  
54 -  
55 - function getGenericMetadataFields() {  
56 - $oTemplating = KTTemplating::getSingleton();  
57 - $oTemplate = $oTemplating->loadTemplate("ktcore/metadata/editable_metadata_fields");  
58 - $aTemplateData = array(  
59 - 'caption' => _('Generic meta data'),  
60 - 'empty_message' => _("No Generic Meta Data"),  
61 - 'fields' => DocumentField::getList(array('is_generic = ?', array(true))),  
62 - );  
63 - return $oTemplate->render($aTemplateData);  
64 - }  
65 -  
66 - function getTypeMetadataFields($iDocumentTypeID) {  
67 - global $default;  
68 - /*ok*/ $sQuery = array("SELECT DF.id AS id " .  
69 - "FROM document_fields AS DF LEFT JOIN document_type_fields_link AS DTFL ON DTFL.field_id = DF.id " .  
70 - "WHERE DF.is_generic = ? " .  
71 - "AND DTFL.document_type_id = ?", array(false, $iDocumentTypeID));  
72 -  
73 - $aIDs = DBUtil::getResultArray($sQuery);  
74 -  
75 - $aFields = array();  
76 - foreach ($aIDs as $iID) {  
77 - $aFields[] =& call_user_func(array('DocumentField', 'get'), $iID);  
78 - }  
79 - $aTemplateData = array(  
80 - 'caption' => _('Type specific meta data'),  
81 - 'empty_message' => _("No Type Specific Meta Data"),  
82 - 'fields' => $aFields,  
83 - );  
84 - $oTemplating = KTTemplating::getSingleton();  
85 - $oTemplate = $oTemplating->loadTemplate("ktcore/metadata/editable_metadata_fields");  
86 - return $oTemplate->render($aTemplateData);  
87 - }  
88 -  
89 - function getDocumentTypes() {  
90 - $sTable = KTUtil::getTableName('folder_doctypes');  
91 - $aQuery = array(  
92 - "SELECT document_type_id FROM $sTable WHERE folder_id = ?",  
93 - array($this->oFolder->getId()),  
94 - );  
95 - $aIds = DBUtil::getResultArrayKey($aQuery, 'document_type_id');  
96 - $aRet = array();  
97 - foreach ($aIds as $iId) {  
98 - $aRet[] = DocumentType::get($iId);  
99 - }  
100 - return $aRet;  
101 - }  
102 -  
103 - function do_import() {  
104 - $matches = array();  
105 - $aFields = array();  
106 - foreach ($_REQUEST as $k => $v) {  
107 - if (preg_match('/^emd(\d+)$/', $k, $matches)) {  
108 - $aFields[] = array(DocumentField::get($matches[1]), $v);  
109 - }  
110 - }  
111 -  
112 - $aOptions = array(  
113 - 'documenttype' => DocumentType::get($fDocumentTypeID),  
114 - 'metadata' => $aFields,  
115 - );  
116 -  
117 - $fs =& new KTFSImportStorage($_REQUEST['fPath']);  
118 - $bm =& new KTBulkImportManager($this->oFolder, $fs, $this->oUser, $aOptions);  
119 - DBUtil::startTransaction();  
120 - $res = $bm->import();  
121 - if (PEAR::isError($res)) {  
122 - DBUtil::rollback();  
123 - $_SESSION["KTErrorMessage"][] = _("Bulk import failed") . ": " . $res->getMessage();  
124 - } else {  
125 - DBUtil::commit();  
126 - }  
127 -  
128 - controllerRedirect("browse", 'fFolderID=' . $this->oFolder->getID());  
129 - exit(0);  
130 - }  
131 -}  
132 -  
133 -$d =& new KTBulkImportDispatcher;  
134 -$d->dispatch();  
135 -  
136 -?>  
presentation/lookAndFeel/knowledgeTree/documentmanagement/downloadBL.php deleted
1 -<?php  
2 -/**  
3 - * $Id$  
4 - *  
5 - * Contains the business logic required to download a document.  
6 - *  
7 - * Expected form varaibles:  
8 - * o $fDocumentID - Primary key of document to view  
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 Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa  
28 - * @package documentmanagement  
29 - */  
30 -  
31 -require_once("../../../../config/dmsDefaults.php");  
32 -  
33 -KTUtil::extractGPC('fDocumentID', 'fForInlineView', 'fVersion');  
34 -  
35 -require_once("$default->fileSystemRoot/lib/security/Permission.inc");  
36 -require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc");  
37 -require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc");  
38 -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");  
39 -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");  
40 -  
41 -require_once(KT_LIB_DIR . '/storage/storagemanager.inc.php');  
42 -$oStorage =& KTStorageManagerUtil::getSingleton();  
43 -  
44 -// start the session for a download- workaround for the IE SSL bug  
45 -if (!checkSession(true)) {  
46 - exit(0);  
47 -}  
48 -  
49 -if (!isset($fDocumentID)) {  
50 - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");  
51 - $oPatternCustom = new PatternCustom();  
52 - $oPatternCustom->setHtml("<a href=\"javascript:history.go(-1)\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a>\n");  
53 - $main->setErrorMessage(_("You have not chosen a document to view"));  
54 - $main->setCentralPayload($oPatternCustom);  
55 - $main->render();  
56 - exit(0);  
57 -}  
58 -  
59 -$oDocument = Document::get($fDocumentID);  
60 -if (!Permission::userHasDocumentReadPermission($oDocument)) {  
61 - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");  
62 - $oPatternCustom = new PatternCustom();  
63 - if ($oDocument) {  
64 - $oPatternCustom->setHtml("<a href=\"" . generateControllerLink("browse", "fFolderID=" . $oDocument->getFolderID()) . "\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a>\n");  
65 - } else {  
66 - $oPatternCustom->setHtml("<a href=\"javascript:history.go(-1)\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a>\n");  
67 - }  
68 - $main->setErrorMessage(_("Either you do not have permission to view this document, or the document you have chosen no longer exists on the file system."));  
69 - $main->setCentralPayload($oPatternCustom);  
70 - $main->render();  
71 - exit(0);  
72 -}  
73 -  
74 -if (isset($fForInlineView)) {  
75 - $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Inline view", VIEW);  
76 - $oDocumentTransaction->create();  
77 - PhysicalDocumentManager::inlineViewPhysicalDocument($fDocumentID);  
78 - exit(0);  
79 -}  
80 -  
81 -//if the user has document read permission, perform the download  
82 -if (isset($fVersion)) {  
83 - // we're downloading an old version of the document  
84 - $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document version $fVersion downloaded", DOWNLOAD);  
85 - $oDocumentTransaction->create();  
86 -  
87 - // if the document is currently checked out, and we're the version we're downloading  
88 - // is the same as the current version, then download the current version of the document  
89 - if ($oDocument->getIsCheckedOut() && ($fVersion == $oDocument->getVersion())) {  
90 - $oStorage->download($oDocument);  
91 - } else {  
92 - PhysicalDocumentManager::downloadVersionedPhysicalDocument($fDocumentID, $fVersion);  
93 - }  
94 - exit(0);  
95 -}  
96 -  
97 -// download the current version  
98 -$oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document downloaded", DOWNLOAD);  
99 -$oDocumentTransaction->create();  
100 -$oStorage->download($oDocument);  
101 -exit(0);  
102 -  
103 -?>  
presentation/lookAndFeel/knowledgeTree/documentmanagement/removeDocumentLinkBL.php deleted
1 -<?php  
2 -/**  
3 - * $Id$  
4 - *  
5 - * Business logic for unlinking a parent document from a child documenbt  
6 - *  
7 - * Expected form variables:  
8 - * $fDocumentLinkID - primary key of document link to delete  
9 - * $fChildDocumentID - primary key of child document to which parent document is linked  
10 - * $fParentDocumentID - primary key of parent document  
11 - *  
12 - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com  
13 - *  
14 - * This program is free software; you can redistribute it and/or modify  
15 - * it under the terms of the GNU General Public License as published by  
16 - * the Free Software Foundation; either version 2 of the License, or  
17 - * (at your option) any later version.  
18 - *  
19 - * This program is distributed in the hope that it will be useful,  
20 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
21 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
22 - * GNU General Public License for more details.  
23 - *  
24 - * You should have received a copy of the GNU General Public License  
25 - * along with this program; if not, write to the Free Software  
26 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
27 - *  
28 - * @version $Revision$  
29 - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa  
30 - * @package documentmanagement  
31 - */  
32 -  
33 -require_once("../../../../config/dmsDefaults.php");  
34 -  
35 -KTUtil::extractGPC('fChildDocumentID', 'fDocumentID', 'fDocumentLinkID', 'fForDelete', 'fParentDocumentID');  
36 -  
37 -if (checkSession()) {  
38 - require_once("$default->fileSystemRoot/lib/security/Permission.inc");  
39 - require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");  
40 - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentLink.inc");  
41 - require_once("$default->fileSystemRoot/presentation/Html.inc");  
42 - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");  
43 - require_once("documentUI.inc");  
44 - require_once("removeDocumentLinkUI.inc");  
45 -  
46 - $oDocument = Document::get($fDocumentID);  
47 - if (Permission::userHasDocumentWritePermission($oDocument)) {  
48 - if (isset($fForDelete)) {  
49 - //deleting a document link  
50 - $oDocumentLink = DocumentLink::get($fDocumentLinkID);  
51 - if ($oDocumentLink->delete()) {  
52 - controllerRedirect("viewDocument", "fDocumentID=$fParentDocumentID&fShowSection=linkedDocuments");  
53 - } else {  
54 - //an error occured whilst trying to delete the document link  
55 - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");  
56 -  
57 - $oParentDocument = Document::get($fParentDocumentID);  
58 - $oChildDocument = Document::get($fChildDocumentID);  
59 -  
60 - $oPatternCustom = & new PatternCustom();  
61 - $oPatternCustom->setHtml(getPage($oParentDocument->getName(), $oChildDocument->getName(), $fParentDocumentID));  
62 - $main->setCentralPayload($oPatternCustom);  
63 - $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentLinkID=$fDocumentLinkID&fParentDocumentID=$fParentDocumentID&fChildDocumentID=$fChildDocumentID&fForDelete=1");  
64 - $main->setErrorMessage(_("An error occured whilst attempting to delete the link between the two documents"));  
65 - $main->render();  
66 - }  
67 - } else {  
68 - //user has document write permission and can therefore remove the  
69 - //link between the two documents  
70 - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");  
71 -  
72 - $oParentDocument = Document::get($fParentDocumentID);  
73 - $oChildDocument = Document::get($fChildDocumentID);  
74 -  
75 - $oPatternCustom = & new PatternCustom();  
76 - $oPatternCustom->setHtml(getPage($oParentDocument->getName(), $oChildDocument->getName(), $fParentDocumentID));  
77 - $main->setCentralPayload($oPatternCustom);  
78 - $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentLinkID=$fDocumentLinkID&fParentDocumentID=$fParentDocumentID&fChildDocumentID=$fChildDocumentID&fForDelete=1");  
79 - $main->render();  
80 - }  
81 - } else {  
82 - //user does not have permission to be here  
83 - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");  
84 -  
85 - $oPatternCustom = & new PatternCustom();  
86 - $oPatternCustom->setHtml("");  
87 - $main->setCentralPayload($oPatternCustom);  
88 - $main->setErrorMessage(_("You do not have permission to delete links between documents"));  
89 - $main->render();  
90 - }  
91 -}  
92 -?>  
presentation/lookAndFeel/knowledgeTree/documentmanagement/removeDocumentLinkUI.inc deleted
1 -<?php  
2 -/**  
3 - * $Id$  
4 - *  
5 - * Presentation logic for removing a link between two 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 Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa  
25 - * @package documentmanagement  
26 - */  
27 -  
28 -function getPage($sParentDocumentName, $sChildDocumentName, $iParentDocumentID) {  
29 - global $default;  
30 - $sToRender = renderHeading(_("Unlink document"));  
31 - $sToRender .= displayDocumentPath($iParentDocumentID);  
32 - $sToRender .= "<table>\n";  
33 - $sToRender .= "<tr>\n";  
34 - $sToRender .= "<td>" . _("You have chosen to delete the link between these two documents") . ": '$sParentDocumentName' / '$sChildDocumentName'</td>\n";  
35 - $sToRender .= "</tr>\n";  
36 - $sToRender .= "<tr>\n";  
37 - $sToRender .= "<td>&nbsp</td>\n";  
38 - $sToRender .= "</tr>\n";  
39 - $sToRender .= "<td>" . _("Select 'Delete' to confirm or 'Cancel' to cancel") . "</td>\n";  
40 - $sToRender .= "</tr>\n";  
41 - $sToRender .= "<tr>\n";  
42 - $sToRender .= "<td>&nbsp</td>\n";  
43 - $sToRender .= "</tr>\n"; ;  
44 - $sToRender .= "<tr>\n";  
45 - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getDeleteButton() . "\" border=\"0\"></td> <td><a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $iParentDocumentID . "\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"></a></td></tr></table></td>";  
46 - $sToRender .= "</tr>";  
47 - $sToRender .= "</table>";  
48 - return $sToRender;  
49 -}  
50 -  
51 -?>