Commit 082e196760d1ada114d4cf68440ce2b2c6e4fb68
1 parent
c596bfc4
Add link type for document links to describe the relationship
Submitted by: Marcel Berteler (pluk77) SF Tracker: 1013935 SF Tracker: 971712 git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3370 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
18 changed files
with
934 additions
and
11 deletions
config/siteMap.inc
| @@ -132,6 +132,8 @@ $default->siteMap->addPage("systemAdministration", "/presentation/lookAndFeel/kn | @@ -132,6 +132,8 @@ $default->siteMap->addPage("systemAdministration", "/presentation/lookAndFeel/kn | ||
| 132 | 132 | ||
| 133 | $default->siteMap->addPage("browseAdministration", "/presentation/lookAndFeel/knowledgeTree/administration/browsemanagement/editBrowserBL.php", "Administration", SysAdmin, _("Browse Management"), true, 15); | 133 | $default->siteMap->addPage("browseAdministration", "/presentation/lookAndFeel/knowledgeTree/administration/browsemanagement/editBrowserBL.php", "Administration", SysAdmin, _("Browse Management"), true, 15); |
| 134 | 134 | ||
| 135 | +$default->siteMap->addPage("docLinkManagement", "/presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/listLinkTypesBL.php", "Administration", SysAdmin, _("Link Type Management"), true, 16); | ||
| 136 | + | ||
| 135 | $default->siteMap->addSectionColour("Administration", "th", "056DCE"); | 137 | $default->siteMap->addSectionColour("Administration", "th", "056DCE"); |
| 136 | $default->siteMap->addSectionColour("Administration", "td", "6699FF"); | 138 | $default->siteMap->addSectionColour("Administration", "td", "6699FF"); |
| 137 | 139 | ||
| @@ -260,4 +262,12 @@ $default->siteMap->addDefaultPage("addComment", "/presentation/lookAndFeel/knowl | @@ -260,4 +262,12 @@ $default->siteMap->addDefaultPage("addComment", "/presentation/lookAndFeel/knowl | ||
| 260 | 262 | ||
| 261 | $default->siteMap->addSectionColour("Discussion Threads", "td", "BDDFE0"); | 263 | $default->siteMap->addSectionColour("Discussion Threads", "td", "BDDFE0"); |
| 262 | $default->siteMap->addSectionColour("Discussion Threads", "th", "57AFAE"); | 264 | $default->siteMap->addSectionColour("Discussion Threads", "th", "57AFAE"); |
| 265 | + | ||
| 266 | +// Document link management | ||
| 267 | +$default->siteMap->addPage("listLinkTypes", "/presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/listLinkTypesBL.php", "Administration", SysAdmin, "List Link Types", false); | ||
| 268 | +$default->siteMap->addPage("addLinkType", "/presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/addLinkTypeBL.php", "Administration", SysAdmin, "Add A Link Type", false); | ||
| 269 | +$default->siteMap->addPage("addLinkTypeSuccess", "/presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/addLinkTypeSuccess.php", "Administration", SysAdmin, "Add A Link Type Success ", false); | ||
| 270 | +$default->siteMap->addDefaultPage("editLinkType", "/presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/editLinkTypeBL.php", "Administration", SysAdmin, _("Edit Link Type Properties"), false); | ||
| 271 | +$default->siteMap->addDefaultPage("removeLinkType", "/presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/removeLinkTypeBL.php", "Administration", SysAdmin, _("Remove a Link Type"), false); | ||
| 272 | + | ||
| 263 | ?> | 273 | ?> |
config/tableMappings.inc
| @@ -111,4 +111,6 @@ $default->time_unit_lookup_table = "time_unit_lookup"; | @@ -111,4 +111,6 @@ $default->time_unit_lookup_table = "time_unit_lookup"; | ||
| 111 | $default->archive_restoration_table = "archive_restoration_request"; | 111 | $default->archive_restoration_table = "archive_restoration_request"; |
| 112 | $default->status_table = "status_lookup"; | 112 | $default->status_table = "status_lookup"; |
| 113 | $default->search_permissions_table = "search_document_user_link"; | 113 | $default->search_permissions_table = "search_document_user_link"; |
| 114 | -?> | ||
| 115 | \ No newline at end of file | 114 | \ No newline at end of file |
| 115 | +$default->document_link_types_table = "document_link_types"; | ||
| 116 | +$default->upgrades_table = "upgrades"; | ||
| 117 | +?> |
lib/documentmanagement/DocumentLink.inc
| @@ -34,7 +34,8 @@ class DocumentLink extends KTEntity { | @@ -34,7 +34,8 @@ class DocumentLink extends KTEntity { | ||
| 34 | var $iParentDocumentID; | 34 | var $iParentDocumentID; |
| 35 | /** document title name */ | 35 | /** document title name */ |
| 36 | var $iChildDocumentID; | 36 | var $iChildDocumentID; |
| 37 | - | 37 | + /** type of link */ |
| 38 | + var $iLinkTypeID; | ||
| 38 | 39 | ||
| 39 | /** | 40 | /** |
| 40 | * Default constructor | 41 | * Default constructor |
| @@ -43,12 +44,13 @@ class DocumentLink extends KTEntity { | @@ -43,12 +44,13 @@ class DocumentLink extends KTEntity { | ||
| 43 | * @param Child document primary key | 44 | * @param Child document primary key |
| 44 | * | 45 | * |
| 45 | */ | 46 | */ |
| 46 | - function DocumentLink($iNewParentDocumentID, $iNewChildDocumentID) { | 47 | + function DocumentLink($iNewParentDocumentID, $iNewChildDocumentID, $iLinkTypeID) { |
| 47 | //object not created yet | 48 | //object not created yet |
| 48 | global $default; | 49 | global $default; |
| 49 | $this->iId = -1; | 50 | $this->iId = -1; |
| 50 | $this->iParentDocumentID = $iNewParentDocumentID; | 51 | $this->iParentDocumentID = $iNewParentDocumentID; |
| 51 | $this->iChildDocumentID = $iNewChildDocumentID; | 52 | $this->iChildDocumentID = $iNewChildDocumentID; |
| 53 | + $this->iLinkTypeID = $iLinkTypeID; | ||
| 52 | } | 54 | } |
| 53 | 55 | ||
| 54 | /** | 56 | /** |
| @@ -98,10 +100,25 @@ class DocumentLink extends KTEntity { | @@ -98,10 +100,25 @@ class DocumentLink extends KTEntity { | ||
| 98 | $this->iChildDocumentID = $iNewValue; | 100 | $this->iChildDocumentID = $iNewValue; |
| 99 | } | 101 | } |
| 100 | 102 | ||
| 103 | + /** | ||
| 104 | + * Get the primary key of the link type | ||
| 105 | + */ | ||
| 106 | + function getLinkTypeID() { | ||
| 107 | + return $this->iLinkTypeID; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * Set the primary key of the link type | ||
| 112 | + */ | ||
| 113 | + function setLinkTypeID($iNewValue) { | ||
| 114 | + $this->iLinkTypeID = $iNewValue; | ||
| 115 | + } | ||
| 116 | + | ||
| 101 | function _fieldValues () { | 117 | function _fieldValues () { |
| 102 | return array( | 118 | return array( |
| 103 | 'parent_document_id' => $this->iParentDocumentID, | 119 | 'parent_document_id' => $this->iParentDocumentID, |
| 104 | 'child_document_id' => $this->iChildDocumentID, | 120 | 'child_document_id' => $this->iChildDocumentID, |
| 121 | + 'link_type_id' => $this->iLinkTypeID, | ||
| 105 | ); | 122 | ); |
| 106 | } | 123 | } |
| 107 | 124 |
lib/documentmanagement/LinkType.inc
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * Represents the type of link between documents | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +require_once(KT_DIR . '/lib/ktentity.inc'); | ||
| 28 | + | ||
| 29 | +class LinkType extends KTEntity { | ||
| 30 | + var $sName; | ||
| 31 | + var $sDescription; | ||
| 32 | + | ||
| 33 | + function LinkType($sName, $sDescription) { | ||
| 34 | + $this->iId = -1; | ||
| 35 | + $this->sName = $sName; | ||
| 36 | + $this->sDescription = $sDescription; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + function getDescription() { | ||
| 40 | + return $this->sDescription; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + function setDescription($sNewValue) { | ||
| 44 | + $this->sDescription = $sNewValue; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + function getName() { | ||
| 48 | + return $this->sName; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + function setName($sNewValue) { | ||
| 52 | + $this->sName = $sNewValue; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + function _fieldValues () { | ||
| 56 | + return array( | ||
| 57 | + 'name' => $this->sName, | ||
| 58 | + 'description' => $this->sDescription, | ||
| 59 | + ); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + function _table () { | ||
| 63 | + global $default; | ||
| 64 | + return $default->document_link_types_table; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + function getList($sWhereClause = null) { | ||
| 68 | + return KTEntityUtil::getList(Link::_table(), 'LinkType', $sWhereClause); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + function &get($id) { | ||
| 72 | + $sQuery = "SELECT id, name, description FROM " . LinkType::_table() . " WHERE id = ?"; | ||
| 73 | + $aParams = array($id); | ||
| 74 | + $res = DBUtil::getOneResult(array($sQuery, $aParams)); | ||
| 75 | + if (PEAR::isError($res)) { | ||
| 76 | + return $res; | ||
| 77 | + } | ||
| 78 | + if (is_null($res)) { | ||
| 79 | + // XXX: No such key exception type | ||
| 80 | + return $res; | ||
| 81 | + } | ||
| 82 | + $oLinkType =& new LinkType($res['name'], $res['description']); | ||
| 83 | + $oLinkType->iId = $res['id']; | ||
| 84 | + return $oLinkType; | ||
| 85 | + } | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +function &linktypecreateFromArray($aParameters) { | ||
| 89 | + $oLinkType = & new LinkType($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]); | ||
| 90 | + return $oLinkType; | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | + | ||
| 94 | +?> |
presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/addLinkTypeBL.php
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * Add a document link type | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +require_once("../../../../../config/dmsDefaults.php"); | ||
| 28 | + | ||
| 29 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | ||
| 30 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 31 | + | ||
| 32 | +require_once("$default->fileSystemRoot/presentation/Html.inc"); | ||
| 33 | +require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); | ||
| 34 | +require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 35 | + | ||
| 36 | +require_once("$default->fileSystemRoot/lib/documentmanagement/LinkType.inc"); | ||
| 37 | +require_once("addLinkTypeUI.inc"); | ||
| 38 | + | ||
| 39 | +if (!checkSession()) { | ||
| 40 | + die("Session failed"); | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +KTUtil::extractGPC('fLinkID'); | ||
| 44 | + | ||
| 45 | +if ($submitted) { | ||
| 46 | + // include the page template (with navbar) | ||
| 47 | + | ||
| 48 | + $sToRender = renderHeading(_("Add Link Type")); | ||
| 49 | + $sToRender .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | ||
| 50 | + $sToRender .= "<tr>\n"; | ||
| 51 | + if ($fLinkID != -1) { | ||
| 52 | + $sToRender .= "<td><b>" . _("New Link Type Added SuccessFully") . "!<b></td></tr>\n"; | ||
| 53 | + } else { | ||
| 54 | + $sToRender .= "<td><b>" . _("Addition Unsuccessful") . "</b>...</td>\n"; | ||
| 55 | + $sToRender .= "</tr>\n"; | ||
| 56 | + $sToRender .= "<tr></tr>\n"; | ||
| 57 | + $sToRender .= "<tr></tr>\n"; | ||
| 58 | + $sToRender .= "<tr>\n"; | ||
| 59 | + $sToRender .= "<td>Please Check Name and Rank for duplicates!</td>\n"; | ||
| 60 | + $sToRender .= "</tr>\n"; | ||
| 61 | + $sToRender .= "<tr>\n"; | ||
| 62 | + $sToRender .="<td> </td>\n"; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + $sToRender .= "<tr></tr>\n"; | ||
| 66 | + $sToRender .= "<tr></tr>\n"; | ||
| 67 | + $sToRender .= "<tr></tr>\n"; | ||
| 68 | + $sToRender .= "<tr></tr>\n"; | ||
| 69 | + $sToRender .= "<tr>\n"; | ||
| 70 | + $sToRender .= "<td align = right><a href=\"$default->rootUrl/control.php?action=addLinkType\">" . KTHtml::getBackButton() . "</a></td>\n"; | ||
| 71 | + $sToRender .= "</tr>\n"; | ||
| 72 | + $sToRender .= "</table>\n"; | ||
| 73 | + | ||
| 74 | + $oPatternCustom = & new PatternCustom(); | ||
| 75 | + $oPatternCustom->setHtml($sToRender); | ||
| 76 | + $main->setCentralPayload($oPatternCustom); | ||
| 77 | + $main->render(); | ||
| 78 | +} else { | ||
| 79 | + $oPatternCustom = & new PatternCustom(); | ||
| 80 | + $oPatternCustom->setHtml(getPage()); | ||
| 81 | + $main->setCentralPayload($oPatternCustom); | ||
| 82 | + $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/create.php?fRedirectURL=".urlencode("$default->rootUrl/control.php?action=addLinkTypeSuccess&fLinkID=")); | ||
| 83 | + $main->setHasRequiredFields(true); | ||
| 84 | + $main->render(); | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +?> |
presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/addLinkTypeSuccess.php
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * Add a document link type success page. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +require_once("../../../../../config/dmsDefaults.php"); | ||
| 28 | + | ||
| 29 | +require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 30 | + | ||
| 31 | +KTUtil::extractGPC('fLinkID'); | ||
| 32 | + | ||
| 33 | +if(checkSession()) { | ||
| 34 | + | ||
| 35 | + // include the page template (with navbar) | ||
| 36 | + $Center .= renderHeading(_("Add Link Type")); | ||
| 37 | + $Center .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | ||
| 38 | + $Center .= "<tr>\n"; | ||
| 39 | + if ($fLinkID != -1) { | ||
| 40 | + $Center .= "<td><b>" . _("New Link Type Added Successfully") . "!<b></td></tr>\n"; | ||
| 41 | + } else { | ||
| 42 | + $Center .= "<td><b>" . _("Addition Unsuccessful") . "</b>...</td>\n"; | ||
| 43 | + $Center .= "</tr>\n"; | ||
| 44 | + $Center .= "<tr></tr>\n"; | ||
| 45 | + $Center .= "<tr></tr>\n"; | ||
| 46 | + $Center .= "<tr>\n"; | ||
| 47 | + $Center .= "<td>Please Check Name and Rank for duplicates!</td>\n"; | ||
| 48 | + $Center .= "</tr>\n"; | ||
| 49 | + $Center .= "<tr>\n"; | ||
| 50 | + $Center .="<td> </td>\n"; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + $Center .= "<tr></tr>\n"; | ||
| 54 | + $Center .= "<tr></tr>\n"; | ||
| 55 | + $Center .= "<tr></tr>\n"; | ||
| 56 | + $Center .= "<tr></tr>\n"; | ||
| 57 | + $Center .= "<tr>\n"; | ||
| 58 | + $Center .= "<td align = right><a href=\"$default->rootUrl/control.php?action=addLinkType\"><img src=\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | ||
| 59 | + $Center .= "</tr>\n"; | ||
| 60 | + $Center .= "</table>\n"; | ||
| 61 | + | ||
| 62 | + $oPatternCustom = & new PatternCustom(); | ||
| 63 | + $oPatternCustom->setHtml($Center); | ||
| 64 | + $main->setCentralPayload($oPatternCustom); | ||
| 65 | + $main->render(); | ||
| 66 | +} | ||
| 67 | +?> |
presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/addLinkTypeUI.inc
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * Add a document link type UI functions. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | +// get add pages | ||
| 27 | +function getPage() { | ||
| 28 | + | ||
| 29 | + global $default; | ||
| 30 | + | ||
| 31 | + $aDisplayRowNames = array(_("Name") . ":", _("Description") . ":"); | ||
| 32 | + $aParameterNumbers = array(0,1); | ||
| 33 | + $aDisplayColumnTypes = array(1,1); | ||
| 34 | + $aRequired = array(1,1); | ||
| 35 | + | ||
| 36 | + // create a text field that is required | ||
| 37 | + $oPatternCreate = & new PatternCreate("LinkType", "documentmanagement/LinkType.inc",$aDisplayRowNames, $aParameterNumbers, $aDisplayColumnTypes, $aRequired); | ||
| 38 | + $oPatternCreate->setUniqueName("linktype"); | ||
| 39 | + | ||
| 40 | + $sToRender .= renderHeading(_("Add Link Type")); | ||
| 41 | + $sToRender .= "<table>\n"; | ||
| 42 | + $sToRender .= "<tr>\n"; | ||
| 43 | + $sToRender .= "<tr>\n"; | ||
| 44 | + $sToRender .= "<td>" . $oPatternCreate->render() . "</td>\n"; | ||
| 45 | + $sToRender .= "</tr>\n"; | ||
| 46 | + $sToRender .= "<tr>\n"; | ||
| 47 | + $sToRender .= "</tr>\n"; | ||
| 48 | + $sToRender .= "<tr><td align = right><input type=\"image\" src =\"" . KTHtml::getAddButton() . "\" value=\"Submit\" border=\"0\"/>"; | ||
| 49 | + $sToRender .= getCancelButton("listLinkTypes") . "</td>\n"; | ||
| 50 | + $sToRender .= "</table>\n"; | ||
| 51 | + | ||
| 52 | + return $sToRender; | ||
| 53 | +} | ||
| 54 | + | ||
| 55 | + // TODO .. do a check if rank already taken...as well as do a check if name already exists when inserting | ||
| 56 | + // if edition is successful print out success page | ||
| 57 | +function getAddPageFail() { | ||
| 58 | + global $default; | ||
| 59 | + | ||
| 60 | + $sToRender .= renderHeading(_("Add Link Type")); | ||
| 61 | + $sToRender .= "<table>\n"; | ||
| 62 | + $sToRender .= "<tr><td><b>" . _("Addition Unsuccessful") . "</b></td></tr>\n"; | ||
| 63 | + $sToRender .= "<tr></tr>\n"; | ||
| 64 | + $sToRender .= "<tr></tr>\n"; | ||
| 65 | + $sToRender .= "<tr>\n"; | ||
| 66 | + $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addLinkType\">" . KTHtml::getBackButton() . "</a></td>\n"; | ||
| 67 | + $sToRender .= "</tr>\n"; | ||
| 68 | + $sToRender .= "</table>\n"; | ||
| 69 | + | ||
| 70 | + return $sToRender; | ||
| 71 | +} | ||
| 72 | +?> |
presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/editLinkTypeBL.php
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * Edit a document link type. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +require_once("../../../../../config/dmsDefaults.php"); | ||
| 28 | + | ||
| 29 | +KTUtil::extractGPC('fLinkID', 'fLinkName', 'fDescription', 'fForStore'); | ||
| 30 | + | ||
| 31 | +if (checkSession()) { | ||
| 32 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | ||
| 33 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); | ||
| 34 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 35 | + | ||
| 36 | + require_once("$default->fileSystemRoot/presentation/Html.inc"); | ||
| 37 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 38 | + | ||
| 39 | + require_once("$default->fileSystemRoot/lib/documentmanagement/LinkType.inc"); | ||
| 40 | + require_once("editLinkTypeUI.inc"); | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + $oPatternCustom = & new PatternCustom(); | ||
| 44 | + | ||
| 45 | + if (isset($fForStore)){ | ||
| 46 | + $oLink = LinkType::get($fLinkID); | ||
| 47 | + $oLink->setName($fLinkName); | ||
| 48 | + $oLink->setDescription($fDescription); | ||
| 49 | + | ||
| 50 | + if ($oLink->update()) { | ||
| 51 | + // if successfull print out success message | ||
| 52 | + $oPatternCustom->setHtml(getEditPageSuccess()); | ||
| 53 | + | ||
| 54 | + } else { | ||
| 55 | + // if fail print out fail message | ||
| 56 | + $oPatternCustom->setHtml(getEditPageFail()); | ||
| 57 | + } | ||
| 58 | + } else if (isset($fLinkID)){ | ||
| 59 | + // post back on Link select from manual edit page | ||
| 60 | + $oPatternCustom->setHtml(getEditPage($fLinkID)); | ||
| 61 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?fForStore=1"); | ||
| 62 | + | ||
| 63 | + | ||
| 64 | + } else { | ||
| 65 | + // if nothing happens...just reload edit page | ||
| 66 | + $oPatternCustom->setHtml(getEditPage(null)); | ||
| 67 | + $main->setFormAction($_SERVER["PHP_SELF"]); | ||
| 68 | + | ||
| 69 | + } | ||
| 70 | + //render the page | ||
| 71 | + $main->setCentralPayload($oPatternCustom); | ||
| 72 | + $main->setHasRequiredFields(true); | ||
| 73 | + $main->render(); | ||
| 74 | +} | ||
| 75 | +?> |
presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/editLinkTypeUI.inc
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * Edit a document link type UI functions. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +function getEditPage($iLinkID) { | ||
| 28 | + global $default; | ||
| 29 | + $oLink = null; | ||
| 30 | + if (isset($iLinkID)) { | ||
| 31 | + $oLink = LinkType::get($iLinkID); | ||
| 32 | + } else { | ||
| 33 | + $sHeading = _("Please select a Link") . ":"; | ||
| 34 | + } | ||
| 35 | + $sToRender .= renderHeading(_("Edit Link Type")); | ||
| 36 | + $sToRender .= "<table>\n"; | ||
| 37 | + $sToRender .= "<tr><td>$sHeading</td></tr>\n"; | ||
| 38 | + $sToRender .= "<tr>\n"; | ||
| 39 | + $sToRender .= "<td>" . _("Link Name") . ": </td><td>" . getLinkDisplay($oLink) . "</td>\n"; | ||
| 40 | + $sToRender .= "</tr>\n"; | ||
| 41 | + $sToRender .= "<tr>\n"; | ||
| 42 | + $sToRender .= "</tr>\n"; | ||
| 43 | + $sToRender .= "<tr>\n"; | ||
| 44 | + | ||
| 45 | + // if a Link selected...show checkboxes | ||
| 46 | + if (isset($iLinkID)) { | ||
| 47 | + $sToRender .= "</tr>\n"; | ||
| 48 | + $sToRender .= "<tr>\n"; | ||
| 49 | + $sToRender .= "<td>" . _("Description") . ": </td><td>" . getDescr($oLink) . "</td>\n"; | ||
| 50 | + $sToRender .= "</tr>\n"; | ||
| 51 | + $sToRender .= "<tr>\n"; | ||
| 52 | + $sToRender .= "</tr>\n"; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + $sToRender .= "<tr>\n"; | ||
| 57 | + $sToRender .= "</tr>\n"; | ||
| 58 | + $sToRender .= "<td></td>" . getUpdateButton($oLink); | ||
| 59 | + $sToRender .= getCancelButton($oLink); | ||
| 60 | + $sToRender .= "</table>\n"; | ||
| 61 | + | ||
| 62 | + $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n"; | ||
| 63 | + $sToRender .= "function validateForm(theForm) {\n"; | ||
| 64 | + $sToRender .= "\tif (!(validRequired(theForm.fLinkName, 'Link Name'))) {\n"; | ||
| 65 | + $sToRender .= "\t\treturn false;\n"; | ||
| 66 | + $sToRender .= "\t}\n"; | ||
| 67 | + $sToRender .= "\tif (!(validRequired(theForm.fDescription, 'Description'))) {\n"; | ||
| 68 | + $sToRender .= "\t\treturn false;\n"; | ||
| 69 | + $sToRender .= "\t}\n"; | ||
| 70 | + $sToRender .= "return true;\n}\n"; | ||
| 71 | + $sToRender .= "//-->\n</script>\n\n"; | ||
| 72 | + | ||
| 73 | + return $sToRender; | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +// if edition is successful print otu success page | ||
| 77 | +function getEditPageSuccess() { | ||
| 78 | + global $default; | ||
| 79 | + | ||
| 80 | + $sToRender .= renderHeading(_("Edit Link Type")); | ||
| 81 | + $sToRender .= "<b>Success!</b>\n"; | ||
| 82 | + $sToRender .= "<table>\n"; | ||
| 83 | + $sToRender .= "<br></br>\n"; | ||
| 84 | + $sToRender .= "<tr></tr>\n"; | ||
| 85 | + $sToRender .= "<tr><td>" . _("The Link Type was successfully modified") . "</td></tr>\n"; | ||
| 86 | + $sToRender .= "<tr></tr>\n"; | ||
| 87 | + $sToRender .= "<tr></tr>\n"; | ||
| 88 | + $sToRender .= "<tr>\n"; | ||
| 89 | + $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listLinkTypes\">" . generateImage(KTHtml::getBackButton()) . "</a></td>\n"; | ||
| 90 | + $sToRender .= "</tr>\n"; | ||
| 91 | + $sToRender .= "</table>\n"; | ||
| 92 | + | ||
| 93 | + | ||
| 94 | + return $sToRender; | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | + | ||
| 98 | +// gets the page if edition fails | ||
| 99 | +function getEditPageFail() { | ||
| 100 | + global $default; | ||
| 101 | + | ||
| 102 | + $sToRender .= renderHeading(_("Edit Link Type")); | ||
| 103 | + $sToRender .= "<b>" . _("Success") . "!</b>\n"; | ||
| 104 | + $sToRender .= "<table>\n"; | ||
| 105 | + $sToRender .= "<br></br>\n"; | ||
| 106 | + $sToRender .= "<tr></tr>\n"; | ||
| 107 | + $sToRender .= "<tr><td>" . _("The Link Type modification failed") . "!</td></tr>\n"; | ||
| 108 | + $sToRender .= "<tr></tr>\n"; | ||
| 109 | + $sToRender .= "<tr></tr>\n"; | ||
| 110 | + $sToRender .= "<tr>\n"; | ||
| 111 | + $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listLinkTypes\">" . generateImage(KTHtml::getBackButton()) . "</a></td>\n"; | ||
| 112 | + $sToRender .= "</tr>\n"; | ||
| 113 | + $sToRender .= "</table>\n"; | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + return $sToRender; | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +// show the list box when no Link selected | ||
| 120 | +// then shows a text box with the Link's name | ||
| 121 | +function getLinkDisplay($oLink) { | ||
| 122 | + global $default; | ||
| 123 | + if (!isset($oLink)) { | ||
| 124 | + $oPatternListBox = & new PatternListBox($default->document_links_types_table, "name", "id", "fLinkID"); | ||
| 125 | + //$oPatternListBox->setIncludeDefaultValue(true); | ||
| 126 | + $oPatternListBox->setPostBackOnChange(true); | ||
| 127 | + return $oPatternListBox->render(); | ||
| 128 | + } else { | ||
| 129 | + return "<input type=\"hidden\" name=\"fLinkID\" value=\"" . $oLink->iId . "\">\n" . | ||
| 130 | + "<input size = \"40\" type=\"text\" name=\"fLinkName\" value=\"" . $oLink->getName() . "\">"; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | + | ||
| 136 | +// returns the checkbox ticked or unticked | ||
| 137 | +function getDescr($oLink) { | ||
| 138 | + if (!isset($oLink)) { | ||
| 139 | + return ""; | ||
| 140 | + } else { | ||
| 141 | + return "<input size = \"40\" type=\"text\" name=\"fDescription\" value=\"" . $oLink->getDescription() . "\">"; | ||
| 142 | + } | ||
| 143 | +} | ||
| 144 | + | ||
| 145 | + | ||
| 146 | +// gets the updatebutton when a Link is selected | ||
| 147 | +function getUpdateButton($oLink) { | ||
| 148 | + global $default; | ||
| 149 | + if (isset($oLink)) { | ||
| 150 | + return "<td align = right><input type=\"image\" src =\"" . KTHtml::getUpdateButton() . "\" value=\"submit\" border=\"0\"/></td>\n"; | ||
| 151 | + } | ||
| 152 | +} | ||
| 153 | + | ||
| 154 | +// gets the cancel button when a Link is selected | ||
| 155 | +function getCancelButton($oLink) { | ||
| 156 | + global $default; | ||
| 157 | + if (!isset($oLink)) { | ||
| 158 | + //return "<td align = right><a href=\"$default->rootUrl/control.php?action=LinkManagement\"><img src =\"$default->graphicsUrl/widgets/cancel.gif\" value=\"cancel\" /></a></td>\n"; | ||
| 159 | + } else { | ||
| 160 | + return "<td align = right><a href=\"$default->rootUrl/control.php?action=listLinkTypes\">" . generateImage(KTHtml::getCancelButton()) . "</a></td>\n"; | ||
| 161 | + } | ||
| 162 | +} | ||
| 163 | +?> |
presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/listLinkTypesBL.php
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * List document link types. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +require_once("../../../../../config/dmsDefaults.php"); | ||
| 28 | + | ||
| 29 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | ||
| 30 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 31 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | ||
| 32 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternBrowsableSearchResults.inc"); | ||
| 33 | +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | ||
| 34 | + | ||
| 35 | +require_once("$default->fileSystemRoot/presentation/Html.inc"); | ||
| 36 | +require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 37 | +require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); | ||
| 38 | + | ||
| 39 | +require_once("listLinkTypesUI.inc"); | ||
| 40 | + | ||
| 41 | +if (checkSession()) { | ||
| 42 | + $oPatternCustom = & new PatternCustom(); | ||
| 43 | + $oPatternCustom->setHtml(getPage()); | ||
| 44 | + $main->setCentralPayload($oPatternCustom); | ||
| 45 | + $main->setFormAction($_SERVER['PHP_SELF']); | ||
| 46 | + $main->render(); | ||
| 47 | +} | ||
| 48 | +?> |
presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/listLinkTypesUI.inc
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * List document link types UI functions. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +function getLinkTypes() { | ||
| 28 | + global $default; | ||
| 29 | + $sQuery = "SELECT id as LinkID, name as LinkName, description as LinkDescr, " . | ||
| 30 | + "'Edit', 'Delete' " . | ||
| 31 | + "FROM " . $default->document_link_types_table . " " . | ||
| 32 | + "ORDER BY name"; | ||
| 33 | + | ||
| 34 | + $aColumns = array("LinkName", "LinkDescr", "Edit", "Delete"); | ||
| 35 | + $aColumnNames = array("Linktype Name","Description", "Edit", "Delete"); | ||
| 36 | + $aColumnTypes = array(1,1,3,3); | ||
| 37 | + $aDBColumnArray = array("LinkID"); | ||
| 38 | + $aQueryStringVariableNames = array("fLinkID"); | ||
| 39 | + | ||
| 40 | + $aHyperLinkDescr = array( 2=> "$default->rootUrl/control.php?action=editLinkType", | ||
| 41 | + 3=> "$default->rootUrl/control.php?action=removeLinkType"); | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + $oSearchResults = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnNames, "100%", $aHyperLinkDescr,$aDBColumnArray,$aQueryStringVariableNames); | ||
| 45 | + $oSearchResults->setDisplayColumnHeadings(true); | ||
| 46 | + return $oSearchResults->render() ; | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +function getPage() { | ||
| 50 | + global $default; | ||
| 51 | + $sToRender .= renderHeading(_("Link Types Management")); | ||
| 52 | + | ||
| 53 | + // add user link | ||
| 54 | + $sToRender .= getAddLink("addLinkType", "Add A Link Type"); | ||
| 55 | + $sToRender .= getLinkTypes(); | ||
| 56 | + return $sToRender; | ||
| 57 | +} | ||
| 58 | +?> |
presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/removeLinkTypeBL.php
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * Remove a document link type. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | +require_once("../../../../../config/dmsDefaults.php"); | ||
| 27 | + | ||
| 28 | +KTUtil::extractGPC('fLinkID', 'fLinkName', 'fForDelete'); | ||
| 29 | + | ||
| 30 | +if (checkSession()) { | ||
| 31 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | ||
| 32 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); | ||
| 33 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 34 | + | ||
| 35 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 36 | + require_once("$default->fileSystemRoot/presentation/Html.inc"); | ||
| 37 | + | ||
| 38 | + require_once("$default->fileSystemRoot/lib/documentmanagement/LinkType.inc"); | ||
| 39 | + require_once("removeLinkTypeUI.inc"); | ||
| 40 | + | ||
| 41 | + $oPatternCustom = & new PatternCustom(); | ||
| 42 | + | ||
| 43 | + // get main page | ||
| 44 | + if (isset($fLinkID)) { | ||
| 45 | + | ||
| 46 | + $oPatternCustom->setHtml(getDeletePage($fLinkID)); | ||
| 47 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?fForDelete=1"); | ||
| 48 | + | ||
| 49 | + // get delete page | ||
| 50 | + } else { | ||
| 51 | + $oPatternCustom->setHtml(getDeletePage(null)); | ||
| 52 | + $main->setFormAction($_SERVER["PHP_SELF"]); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + // if delete entry | ||
| 56 | + if (isset($fForDelete)) { | ||
| 57 | + $oLink = LinkType::get($fLinkID); | ||
| 58 | + $oLink->setName($fLinkName); | ||
| 59 | + | ||
| 60 | + if ($oLink->delete()) { | ||
| 61 | + $oPatternCustom->setHtml(getDeleteSuccessPage()); | ||
| 62 | + | ||
| 63 | + } else { | ||
| 64 | + $oPatternCustom->setHtml(getDeleteFailPage()); | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + $main->setCentralPayload($oPatternCustom); | ||
| 69 | + $main->render(); | ||
| 70 | +} | ||
| 71 | +?> |
presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/removeLinkTypeUI.inc
0 โ 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * $Id$ | ||
| 4 | + * | ||
| 5 | + * Remove document link type UI functions. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2005 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 Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +// gets the delete stuff | ||
| 28 | +function getDeletePage($iLinkID) { | ||
| 29 | + global $default; | ||
| 30 | + $oLink = null; | ||
| 31 | + if (isset($iLinkID)) { | ||
| 32 | + $oLink = LinkType::get($iLinkID); | ||
| 33 | + $sHeading .= "<b>" . _("Are you sure you wish to memove this Link Type?") . ":</b>\n"; | ||
| 34 | + } else { | ||
| 35 | + $sHeading .= _("Please select a Link Type") . ":"; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + $sToRender .= renderHeading(_("Remove Document Link Type")); | ||
| 39 | + $sToRender .= "<table>\n"; | ||
| 40 | + $sToRender .= "<tr><td colspan=\"2\">$sHeading</td></tr>\n"; | ||
| 41 | + $sToRender .= "<tr>\n"; | ||
| 42 | + $sToRender .= "<td>Link Name: </td><td>" . getLinkDisplay($oLink) . "</td>\n"; | ||
| 43 | + $sToRender .= "</tr>\n"; | ||
| 44 | + $sToRender .= "<tr>\n"; | ||
| 45 | + $sToRender .= "</tr>\n"; | ||
| 46 | + $sToRender .= "<tr>\n"; | ||
| 47 | + $sToRender .= "<td>" . getDescr($oLink) . "</td>\n"; | ||
| 48 | + $sToRender .= "</tr>\n"; | ||
| 49 | + $sToRender .= "<tr>\n"; | ||
| 50 | + $sToRender .= "</tr>\n"; | ||
| 51 | + $sToRender .= "<tr>\n"; | ||
| 52 | + $sToRender .= "</tr>\n"; | ||
| 53 | + $sToRender .= "<tr><td/>" . getDeleteButton($oLink) . "</tr>\n"; | ||
| 54 | + $sToRender .= "</table>\n"; | ||
| 55 | + | ||
| 56 | + return $sToRender; | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +// get successfully deletion page | ||
| 60 | +function getDeleteSuccessPage() { | ||
| 61 | + | ||
| 62 | + global $default; | ||
| 63 | + | ||
| 64 | + $sToRender .= renderHeading(_("Remove Document Link Type")); | ||
| 65 | + $sToRender .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | ||
| 66 | + $sToRender .= "<tr>\n"; | ||
| 67 | + $sToRender .= "<td><b>" . _("Document Link Type successfully removed") . "!</b></td>\n"; | ||
| 68 | + $sToRender .= "</tr>\n"; | ||
| 69 | + $sToRender .= "<tr></tr>\n"; | ||
| 70 | + $sToRender .= "<tr></tr>\n"; | ||
| 71 | + $sToRender .= "<tr></tr>\n"; | ||
| 72 | + $sToRender .= "<tr></tr>\n"; | ||
| 73 | + $sToRender .= "<tr>\n"; | ||
| 74 | + $sToRender .= "<td align = right><a href=\"$default->rootUrl/control.php?action=listLinkTypes\">" . generateImage(KTHtml::getBackButton()) . "</a></td>\n"; | ||
| 75 | + $sToRender .= "</tr>\n"; | ||
| 76 | + $sToRender .= "</table>\n"; | ||
| 77 | + | ||
| 78 | + return $sToRender; | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +// get deletion failed page | ||
| 82 | +function getDeleteFailPage() { | ||
| 83 | + | ||
| 84 | + global $default; | ||
| 85 | + | ||
| 86 | + $sToRender .= renderHeading(_("Remove Document Link Type")); | ||
| 87 | + $sToRender .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | ||
| 88 | + $sToRender .= "<tr>\n"; | ||
| 89 | + $sToRender .= "<td><b>" . _("Deletion failed") . "!</b></td>\n"; | ||
| 90 | + $sToRender .= "</tr>\n"; | ||
| 91 | + $sToRender .= "<tr></tr>\n"; | ||
| 92 | + $sToRender .= "<tr></tr>\n"; | ||
| 93 | + $sToRender .= "<tr><td>" . _("Please ensure that all document links from this type have been removed") . ".</td></tr>\n"; | ||
| 94 | + $sToRender .= "<tr></tr>\n"; | ||
| 95 | + $sToRender .= "<tr></tr>\n"; | ||
| 96 | + $sToRender .= "</tr>\n"; | ||
| 97 | + $sToRender .= "<tr><td align = right><a href=\"$default->rootUrl/control.php?action=listLinkTypes\">" . generateImage(KTHtml::getBackButton()) . "</a></td></tr>\n"; | ||
| 98 | + $sToRender .= "</table>\n"; | ||
| 99 | + | ||
| 100 | + return $sToRender; | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +// show listbox...or the text name | ||
| 104 | +function getLinkDisplay($oLink) { | ||
| 105 | + global $default; | ||
| 106 | + if (!isset($oLink)) { | ||
| 107 | + $oPatternListBox = & new PatternListBox($default->quicklinks_table, "name", "id", "fLinkID"); | ||
| 108 | + $oPatternListBox->setIncludeDefaultValue(true); | ||
| 109 | + $oPatternListBox->setPostBackOnChange(true); | ||
| 110 | + return $oPatternListBox->render(); | ||
| 111 | + } else { | ||
| 112 | + return "<input type=\"hidden\" name=\"fLinkID\" value=\"" . $oLink->iId . "\">\n" . | ||
| 113 | + "<b>" . $oLink->getName() . "</b>"; | ||
| 114 | + } | ||
| 115 | +} | ||
| 116 | + | ||
| 117 | +// show check box | ||
| 118 | +function getDescr($oLink) { | ||
| 119 | + if (!isset($oLink)) { | ||
| 120 | + return ""; | ||
| 121 | + } else { | ||
| 122 | + return _("Description") . ": </td><td>" . $oLink->getDescription(); | ||
| 123 | + } | ||
| 124 | +} | ||
| 125 | + | ||
| 126 | +// show delete button | ||
| 127 | +function getDeleteButton($oLink) { | ||
| 128 | + global $default; | ||
| 129 | + if (isset($oLink)) { | ||
| 130 | + return "<td colspan=\"2\" align=\"right\"><input type=\"image\" src=\"" . KTHtml::getDeleteButton() . "\" value=\"submit\" border=\"0\"/>\n". | ||
| 131 | + "<a href=\"$default->rootUrl/control.php?action=listLinks\">" . generateImage(KTHtml::getCancelButton()) . "</a></td>\n"; | ||
| 132 | + } | ||
| 133 | +} | ||
| 134 | +?> |
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentLinkBL.php
| @@ -31,13 +31,14 @@ | @@ -31,13 +31,14 @@ | ||
| 31 | 31 | ||
| 32 | require_once("../../../../config/dmsDefaults.php"); | 32 | require_once("../../../../config/dmsDefaults.php"); |
| 33 | 33 | ||
| 34 | -KTUtil::extractGPC('fDocumentID', 'fForStore', 'fTargetDocumentID'); | 34 | +KTUtil::extractGPC('fDocumentID', 'fForStore', 'fTargetDocumentID', 'fLinkTypeID'); |
| 35 | 35 | ||
| 36 | if (checkSession()) { | 36 | if (checkSession()) { |
| 37 | require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | 37 | require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); |
| 38 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentLink.inc"); | 38 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentLink.inc"); |
| 39 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | 39 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| 40 | require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | 40 | require_once("$default->fileSystemRoot/lib/security/Permission.inc"); |
| 41 | + require_once("$default->fileSystemRoot/lib/linktypes/LinkType.inc"); | ||
| 41 | require_once("$default->fileSystemRoot/presentation/Html.inc"); | 42 | require_once("$default->fileSystemRoot/presentation/Html.inc"); |
| 42 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | 43 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); |
| 43 | require_once("documentUI.inc"); | 44 | require_once("documentUI.inc"); |
| @@ -48,7 +49,7 @@ if (checkSession()) { | @@ -48,7 +49,7 @@ if (checkSession()) { | ||
| 48 | //user has permission to link this document to another | 49 | //user has permission to link this document to another |
| 49 | if (isset($fForStore)) { | 50 | if (isset($fForStore)) { |
| 50 | //create a new document link | 51 | //create a new document link |
| 51 | - $oDocumentLink = & new DocumentLink($fDocumentID, $fTargetDocumentID); | 52 | + $oDocumentLink = & new DocumentLink($fDocumentID, $fTargetDocumentID, $fLinkTypeID); |
| 52 | if ($oDocumentLink->create()) { | 53 | if ($oDocumentLink->create()) { |
| 53 | controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fShowSection=linkedDocuments"); | 54 | controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fShowSection=linkedDocuments"); |
| 54 | } else { | 55 | } else { |
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentLinkUI.inc
| @@ -41,6 +41,10 @@ function getPage($iDocumentID) { | @@ -41,6 +41,10 @@ function getPage($iDocumentID) { | ||
| 41 | //for netscape 4.7 do this | 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"; | 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 | } | 43 | } |
| 44 | + $sToRender .= "<tr>"; | ||
| 45 | + $sToRender .= "<td>Link Type</td><td>".getLinkTypesList($name="fLinkTypeID")."</td>\n"; | ||
| 46 | + $sToRender .= "</tr>\n"; | ||
| 47 | + | ||
| 44 | $sToRender .= "</tr>\n"; | 48 | $sToRender .= "</tr>\n"; |
| 45 | $sToRender .= "<tr>\n"; | 49 | $sToRender .= "<tr>\n"; |
| 46 | $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"; | 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"; |
| @@ -70,4 +74,20 @@ function getBrowseJavaScript() { | @@ -70,4 +74,20 @@ function getBrowseJavaScript() { | ||
| 70 | $sToRender .= "//--></script>\n"; | 74 | $sToRender .= "//--></script>\n"; |
| 71 | return $sToRender; | 75 | return $sToRender; |
| 72 | } | 76 | } |
| 77 | + | ||
| 78 | +function getLinkTypesList($name="", $selected="") { | ||
| 79 | + $sToRender = "\n<select name=\"$name\">"; | ||
| 80 | + $objects = LinkType::getList(); | ||
| 81 | + for ($x=0; $x<count($objects); $x++){ | ||
| 82 | + $sToRender .="<option value=\""; | ||
| 83 | + $sToRender .= $objects[$x]->iId; | ||
| 84 | + $sToRender .="\">"; | ||
| 85 | + $sToRender .= $objects[$x]->sName; | ||
| 86 | + $sToRender .="</option>"; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + $sToRender .= "</select>"; | ||
| 90 | + return $sToRender; | ||
| 91 | +} | ||
| 92 | + | ||
| 73 | ?> | 93 | ?> |
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
| @@ -297,16 +297,18 @@ function renderNonEditableDocumentRouting($oDocument) { | @@ -297,16 +297,18 @@ function renderNonEditableDocumentRouting($oDocument) { | ||
| 297 | function renderEditableLinkedDocuments($oDocument) { | 297 | function renderEditableLinkedDocuments($oDocument) { |
| 298 | global $default; | 298 | global $default; |
| 299 | 299 | ||
| 300 | - /*ok*/ $sQuery = array("SELECT D.id AS child_document_id, D.name, DL.id as document_link_id, DL.parent_document_id AS parent_document_id, 'Unlink' AS unlink " . | 300 | + /*ok*/ $sQuery = array("SELECT D.id AS child_document_id, D.name, DL.id as document_link_id, " . |
| 301 | + "DL.parent_document_id AS parent_document_id, DLT.name AS link_type, 'Unlink' AS unlink " . | ||
| 301 | "FROM $default->documents_table AS D INNER JOIN $default->document_link_table AS DL ON D.id = DL.child_document_id " . | 302 | "FROM $default->documents_table AS D INNER JOIN $default->document_link_table AS DL ON D.id = DL.child_document_id " . |
| 303 | + "INNER JOIN $default->document_link_types_table AS DLT ON DL.link_type_id = DLT.id " . | ||
| 302 | "WHERE DL.parent_document_id = ?", $oDocument->getID()); | 304 | "WHERE DL.parent_document_id = ?", $oDocument->getID()); |
| 303 | 305 | ||
| 304 | - $aColumns = array("name", "unlink"); | ||
| 305 | - $aColumnHeaders = array(_("Document")); | ||
| 306 | - $aColumnTypes = array(3,3); | 306 | + $aColumns = array("name", "link_type", "unlink"); |
| 307 | + $aColumnHeaders = array(_("Document"), _("Document Link Type")); | ||
| 308 | + $aColumnTypes = array(3,3,3); | ||
| 307 | $aDBColumnArray = array("parent_document_id", "child_document_id","document_link_id", "child_document_id"); | 309 | $aDBColumnArray = array("parent_document_id", "child_document_id","document_link_id", "child_document_id"); |
| 308 | $aQueryStringVariableNames = array("fParentDocumentID","fChildDocumentID", "fDocumentLinkID", "fDocumentID"); | 310 | $aQueryStringVariableNames = array("fParentDocumentID","fChildDocumentID", "fDocumentLinkID", "fDocumentID"); |
| 309 | - $aLinkURLs = array(0=>"$default->rootUrl/control.php?action=viewDocument", 1=>"$default->rootUrl/control.php?action=removeDocumentLink"); | 311 | + $aLinkURLs = array(0=>"$default->rootUrl/control.php?action=viewDocument", 2=>"$default->rootUrl/control.php?action=removeDocumentLink"); |
| 310 | 312 | ||
| 311 | $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500", $aLinkURLs, $aDBColumnArray, $aQueryStringVariableNames); | 313 | $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500", $aLinkURLs, $aDBColumnArray, $aQueryStringVariableNames); |
| 312 | $oPatternTableSqlQuery->setTableHeading(_("Linked documents")); | 314 | $oPatternTableSqlQuery->setTableHeading(_("Linked documents")); |
sql/mysql/install/data.sql
| @@ -97,6 +97,7 @@ INSERT INTO document_fields VALUES (1, 'Category', 'STRING', 1, NULL); | @@ -97,6 +97,7 @@ INSERT INTO document_fields VALUES (1, 'Category', 'STRING', 1, NULL); | ||
| 97 | -- Dumping data for table `document_link_types` | 97 | -- Dumping data for table `document_link_types` |
| 98 | -- | 98 | -- |
| 99 | 99 | ||
| 100 | +INSERT INTO document_link_types VALUES (0, 'Default', 'Default link type'); | ||
| 100 | 101 | ||
| 101 | -- | 102 | -- |
| 102 | -- Dumping data for table `document_subscriptions` | 103 | -- Dumping data for table `document_subscriptions` |
| @@ -644,6 +645,7 @@ INSERT INTO zseq_document_link VALUES (1); | @@ -644,6 +645,7 @@ INSERT INTO zseq_document_link VALUES (1); | ||
| 644 | -- Dumping data for table `zseq_document_link_types` | 645 | -- Dumping data for table `zseq_document_link_types` |
| 645 | -- | 646 | -- |
| 646 | 647 | ||
| 648 | +INSERT INTO zseq_document_link_types VALUES(2); | ||
| 647 | 649 | ||
| 648 | -- | 650 | -- |
| 649 | -- Dumping data for table `zseq_document_subscriptions` | 651 | -- Dumping data for table `zseq_document_subscriptions` |
sql/mysql/install/structure.sql
| @@ -211,7 +211,7 @@ CREATE TABLE document_link ( | @@ -211,7 +211,7 @@ CREATE TABLE document_link ( | ||
| 211 | id int(11) NOT NULL default '0', | 211 | id int(11) NOT NULL default '0', |
| 212 | parent_document_id int(11) NOT NULL default '0', | 212 | parent_document_id int(11) NOT NULL default '0', |
| 213 | child_document_id int(11) NOT NULL default '0', | 213 | child_document_id int(11) NOT NULL default '0', |
| 214 | - link_type_id int(11) default NULL, | 214 | + link_type_id int(11) NOT NULL default '0', |
| 215 | UNIQUE KEY id (id) | 215 | UNIQUE KEY id (id) |
| 216 | ) TYPE=InnoDB; | 216 | ) TYPE=InnoDB; |
| 217 | 217 |