Commit 30c7c51152ff02c622614e5bc30026b0ea965c6a
1 parent
7c4ce4eb
Remove old document field management
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3691 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
7 changed files
with
0 additions
and
527 deletions
presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/addDocFieldBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add a document field. | |
| 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 Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package administration.docfieldmanagement | |
| 26 | - */ | |
| 27 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 28 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 29 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 30 | -require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 31 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 32 | -require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 33 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 34 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 35 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); | |
| 36 | -require_once("addDocFieldUI.inc"); | |
| 37 | - | |
| 38 | -if (checkSession()) { | |
| 39 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 40 | - $oPatternCustom = & new PatternCustom(); | |
| 41 | - $oPatternCustom->setHtml(getPage()); | |
| 42 | - $main->setCentralPayload($oPatternCustom); | |
| 43 | - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/create.php?fRedirectURL=".urlencode("$default->rootUrl/control.php?action=addDocFieldSuccess&fFromCreate=1&fDocFieldID=")); | |
| 44 | - $main->setHasRequiredFields(true); | |
| 45 | - $main->render(); | |
| 46 | -} | |
| 47 | -?> | |
| 48 | 0 | \ No newline at end of file |
presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/addDocFieldSuccess.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Succesfull document field addition. | |
| 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 Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package administration.docfieldmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fDocFieldID'); | |
| 31 | - | |
| 32 | -if(checkSession()) { | |
| 33 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc"); | |
| 34 | - | |
| 35 | - $oDocField = DocumentField::get($fDocFieldID); | |
| 36 | - if ($oDocField) { | |
| 37 | - // if we're setting lookup to be true, then prompt for an initial lookup value?? | |
| 38 | - if ($oDocField->getHasLookup()) { | |
| 39 | - // and there are no metadata values for this lookup | |
| 40 | - // there shouldn't be since this has just been added- but lets be paranoid shall we? | |
| 41 | - if (DocumentField::getLookupCount($fDocFieldID) == 0) { | |
| 42 | - // then redirect to the edit metadata page | |
| 43 | - controllerRedirect("addMetaDataForField", "fDocFieldID=$fDocFieldID"); | |
| 44 | - } | |
| 45 | - } | |
| 46 | - } | |
| 47 | - | |
| 48 | - // include the page template (with navbar) | |
| 49 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 50 | - global $default; | |
| 51 | - $Center .= renderHeading(_("Add Document Field")); | |
| 52 | - $Center .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | |
| 53 | - $Center .= "<tr>\n"; | |
| 54 | - if ($fDocFieldID == -1) { | |
| 55 | - $Center .= "<td><b>" . _("Document Field addition Unsuccessful!") . "</b></td>\n"; | |
| 56 | - $Center .= "</tr>\n"; | |
| 57 | - $Center .= "<tr></tr>\n"; | |
| 58 | - } else { | |
| 59 | - $Center .= "<td><b>" . _("Document Field added Successfully!") . "</b></td>\n"; | |
| 60 | - $Center .= "</tr>\n"; | |
| 61 | - } | |
| 62 | - $Center .= "<tr></tr>\n"; | |
| 63 | - $Center .= "<tr></tr>\n"; | |
| 64 | - $Center .= "<tr></tr>\n"; | |
| 65 | - $Center .= "<tr></tr>\n"; | |
| 66 | - $Center .= "<tr>\n"; | |
| 67 | - $Center .= "<td align = right><a href=\"$default->rootUrl/control.php?action=addDocField\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 68 | - $Center .= "</tr>\n"; | |
| 69 | - $Center .= "</table>\n"; | |
| 70 | - | |
| 71 | - $oPatternCustom = & new PatternCustom(); | |
| 72 | - $oPatternCustom->setHtml($Center); | |
| 73 | - $main->setCentralPayload($oPatternCustom); | |
| 74 | - $main->render(); | |
| 75 | -} | |
| 76 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/addDocFieldUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add document field 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 Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package administration.docfieldmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// get add pages | |
| 29 | -function getPage() { | |
| 30 | - | |
| 31 | - global $default; | |
| 32 | - $aDisplayRowNames = array(_("Document Field Name:"), _("Data Types") . ": ", _("Generic") . ": ", _("Has a Lookup") . ": "); | |
| 33 | - $aParameterNumbers = array(0,1,2,3); | |
| 34 | - $aDisplayColumnTypes = array(1,3,2,2); | |
| 35 | - $aRequired = array(1,1); | |
| 36 | - $aDropDownListTableNames = array(1 => "$default->data_types_table"); | |
| 37 | - $aDropDownListValueColumns = array(1=>'name'); | |
| 38 | - $aDropDownListDisplayColumns = array(1=>'name'); | |
| 39 | - | |
| 40 | - // create a text field that is required | |
| 41 | - $oPatternCreate = & new PatternCreate("DocumentField", "documentmanagement/DocumentField.inc",$aDisplayRowNames, $aParameterNumbers, $aDisplayColumnTypes, $aRequired,$aDropDownListTableNames,$aDropDownListValueColumns,$aDropDownListDisplayColumns); | |
| 42 | - $oPatternCreate->setUniqueName("DocField"); | |
| 43 | - | |
| 44 | - $sToRender .= renderHeading(_("Add Document Field")); | |
| 45 | - $sToRender .= "<table>\n"; | |
| 46 | - $sToRender .= "<tr></tr>\n"; | |
| 47 | - $sToRender .= "<tr>\n"; | |
| 48 | - $sToRender .= "<td>" . $oPatternCreate->render() . "</td>\n"; | |
| 49 | - $sToRender .= "</tr>\n"; | |
| 50 | - $sToRender .= "<tr>\n"; | |
| 51 | - $sToRender .= "</tr>\n"; | |
| 52 | - $sToRender .= "<tr>\n"; | |
| 53 | - $sToRender .= "<td align = right><input type=\"image\" src =\"" . KTHtml::getAddButton() . "\" value=\"Submit\" border=\"0\"/></td>\n"; | |
| 54 | - $sToRender .= "<td align = right>" . getCancelButton("listDocFields") . "</td>\n"; | |
| 55 | - $sToRender .= "</tr>\n"; | |
| 56 | - $sToRender .= "</table>\n"; | |
| 57 | - | |
| 58 | - return $sToRender; | |
| 59 | -} | |
| 60 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/listDocFieldsBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * List document fields. | |
| 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 Omar Rahbeeni, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package administration.docfieldmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fGroupID'); | |
| 31 | - | |
| 32 | -require_once("$default->fileSystemRoot/lib/users/User.inc"); | |
| 33 | -require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 34 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 35 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | |
| 36 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 37 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 38 | -require_once("listDocFieldsUI.inc"); | |
| 39 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); | |
| 40 | - | |
| 41 | -if (checkSession()) { | |
| 42 | - $oPatternCustom = & new PatternCustom(); | |
| 43 | - $oPatternCustom->setHtml(getPage($fGroupID)); | |
| 44 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 45 | - $main->setCentralPayload($oPatternCustom); | |
| 46 | - $main->setFormAction($_SERVER['PHP_SELF']); | |
| 47 | - $main->render(); | |
| 48 | -} | |
| 49 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/listDocFieldsUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * List document fields 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 Omar Rahbeeni, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package administration.docfieldmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -function getDocumentFields() { | |
| 29 | - global $default; | |
| 30 | - | |
| 31 | - /*ok*/ $sQuery = "SELECT id as DocFieldID, name as DocFieldName, data_type, is_generic, has_lookup, " . | |
| 32 | - "'Edit', 'Delete', 'Edit Lookups' " . | |
| 33 | - "FROM " . $default->document_fields_table . " " . | |
| 34 | - "ORDER BY name"; | |
| 35 | - | |
| 36 | - $aColumns = array("DocFieldName", "data_type", "is_generic", "has_lookup","Edit", "Delete", "Edit Lookups" ); | |
| 37 | - $aColumnNames = array(_("Name"), _("Data Type"), _("Generic?"), _("Lookup") . "?", _("Edit"), _("Delete"), _("Edit Lookups")); | |
| 38 | - $aColumnTypes = array(1,1,2,2,3,3,3); | |
| 39 | - $aDBColumnArray = array("DocFieldID"); | |
| 40 | - $aQueryStringVariableNames = array("fDocFieldID"); | |
| 41 | - | |
| 42 | - $aHyperLinkURL = array( 4=> "$default->rootUrl/control.php?action=editDocField", | |
| 43 | - 5=> "$default->rootUrl/control.php?action=removeDocField", | |
| 44 | - 6=> "$default->rootUrl/control.php?action=editDocFieldLookups"); | |
| 45 | - | |
| 46 | - $oSearchResults = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnNames, "100%", $aHyperLinkURL,$aDBColumnArray,$aQueryStringVariableNames); | |
| 47 | - $oSearchResults->setDisplayColumnHeadings(true); | |
| 48 | - return $oSearchResults->render() ; | |
| 49 | -} | |
| 50 | - | |
| 51 | -function getPage() { | |
| 52 | - global $default; | |
| 53 | - $sToRender .= renderHeading(_("Document Field Management")); | |
| 54 | - | |
| 55 | - // add user link | |
| 56 | - $sToRender .= getAddLink("addDocField", _("Add A Document Field")); | |
| 57 | - $sToRender .= getDocumentFields(); | |
| 58 | - return $sToRender; | |
| 59 | -} | |
| 60 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/removeDocFieldBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove document field. | |
| 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 Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package administration.docfieldmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fDocFieldID', 'fForDelete'); | |
| 31 | - | |
| 32 | -if (checkSession()) { | |
| 33 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 34 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); | |
| 35 | - require_once("removeDocFieldUI.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 40 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 41 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 42 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 43 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 44 | - | |
| 45 | - $oPatternCustom = & new PatternCustom(); | |
| 46 | - | |
| 47 | - if (isset($fDocFieldID)) { | |
| 48 | - $oDocField = DocumentField::get($fDocFieldID); | |
| 49 | - if ($oDocField) { | |
| 50 | - // check if we're trying to delete the category field | |
| 51 | - if ($oDocField->getName() != "Category") { | |
| 52 | - // check if the document field is mapped to a document type first | |
| 53 | - $aDocumentTypes = $oDocField->getDocumentTypes(); | |
| 54 | - if (count($aDocumentTypes) > 0) { | |
| 55 | - // display status message- can't delete | |
| 56 | - $oPatternCustom->setHtml(getFieldMappedPage($oDocField->getName(), $aDocumentTypes)); | |
| 57 | - } else { | |
| 58 | - // perform the deletion | |
| 59 | - if (isset($fForDelete)) { | |
| 60 | - if ($oDocField->delete()) { | |
| 61 | - $oPatternCustom->setHtml(getDeleteSuccessPage()); | |
| 62 | - } else { | |
| 63 | - $oPatternCustom->setHtml(getDeleteFailPage()); | |
| 64 | - } | |
| 65 | - } else { | |
| 66 | - // delete confirmation page | |
| 67 | - $oPatternCustom->setHtml(getDeletePage($fDocFieldID)); | |
| 68 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForDelete=1"); | |
| 69 | - } | |
| 70 | - } | |
| 71 | - } else { | |
| 72 | - // couldn't retrieve document field from db | |
| 73 | - $oPatternCustom->setHtml(getStatusPage(_("Read-only document field"), _("The 'Category' document field cannot be deleted."))); | |
| 74 | - } | |
| 75 | - } else { | |
| 76 | - // couldn't retrieve document field from db | |
| 77 | - $oPatternCustom->setHtml(getStatusPage(_("Non-existent document field"), _("This document field does not exist in the database"))); | |
| 78 | - } | |
| 79 | - } else { | |
| 80 | - // prompt for a field to delete | |
| 81 | - $oPatternCustom->setHtml(getDeletePage(null)); | |
| 82 | - $main->setFormAction($_SERVER["PHP_SELF"] ); | |
| 83 | - } | |
| 84 | - | |
| 85 | - $main->setCentralPayload($oPatternCustom); | |
| 86 | - $main->render(); | |
| 87 | -} | |
| 88 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/removeDocFieldUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove document field 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 Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package administration.docfieldmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// gets the delete stuff | |
| 29 | -function getDeletePage($iDocFieldID) { | |
| 30 | - global $default; | |
| 31 | - $oDocField = null; | |
| 32 | - if (isset($iDocFieldID)) { | |
| 33 | - $oDocField = DocumentField::get($iDocFieldID); | |
| 34 | - $sHeading = "<b>" . _("Are you sure you wish to Remove this Document Field?") . ":</b>\n"; | |
| 35 | - } else { | |
| 36 | - $sHeading = _("Please select a Document Field:"); | |
| 37 | - } | |
| 38 | - | |
| 39 | - $sToRender .= renderHeading(_("Remove Document Field")); | |
| 40 | - $sToRender .= "<table>\n"; | |
| 41 | - $sToRender .= "<tr><td colspan=\"2\">$sHeading</td></tr>\n"; | |
| 42 | - $sToRender .= "<tr>\n"; | |
| 43 | - $sToRender .= "<td>" . _("Document Field Name:") . " </td><td>" . getDocFieldDisplay($oDocField) . "</td>\n"; | |
| 44 | - $sToRender .= "</tr>\n"; | |
| 45 | - $sToRender .= "<tr>\n"; | |
| 46 | - $sToRender .= "<td>" . getDocFieldDataType($oDocField) . "</td>\n"; | |
| 47 | - $sToRender .= "</tr>\n"; | |
| 48 | - $sToRender .= "<tr>\n"; | |
| 49 | - $sToRender .= "</tr>\n"; | |
| 50 | - $sToRender .= "<tr>\n"; | |
| 51 | - $sToRender .= "</tr>\n"; | |
| 52 | - $sToRender .= "<tr>\n"; | |
| 53 | - $sToRender .= "</tr>\n"; | |
| 54 | - $sToRender .= "<tr>\n"; | |
| 55 | - $sToRender .= "<td></td>" . getDeleteButton($oDocField);// . getCancelButton($oDocField); | |
| 56 | - $sToRender .= "</tr>\n"; | |
| 57 | - $sToRender .= "</table>\n"; | |
| 58 | - | |
| 59 | - | |
| 60 | - return $sToRender; | |
| 61 | -} | |
| 62 | - | |
| 63 | -function getStatusPage($sHeading, $sText = "") { | |
| 64 | - global $default; | |
| 65 | - | |
| 66 | - $sToRender .= renderHeading(_("Remove Document Field")); | |
| 67 | - $sToRender .= "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n"; | |
| 68 | - $sToRender .= "<tr>\n"; | |
| 69 | - $sToRender .= "<td><b>$sHeading</b></td>\n"; | |
| 70 | - $sToRender .= "</tr>\n"; | |
| 71 | - $sToRender .= "<tr/><tr/>\n"; | |
| 72 | - $sToRender .= "<tr><td>$sText</td></tr>\n"; | |
| 73 | - $sToRender .= "<tr/><tr/>\n"; | |
| 74 | - $sToRender .= "<td align=\"right\">" . generateControllerLink("listDocFields", "", "<img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" />") . "</td>\n"; | |
| 75 | - $sToRender .= "</table>\n"; | |
| 76 | - return $sToRender; | |
| 77 | -} | |
| 78 | - | |
| 79 | -// get successfully deletion page | |
| 80 | -function getDeleteSuccessPage() { | |
| 81 | - return getStatusPage(_("Document Field SuccessFully Removed!")); | |
| 82 | -} | |
| 83 | - | |
| 84 | -// get deletion failed page | |
| 85 | -function getDeleteFailPage() { | |
| 86 | - return getStatusPage(_("Deletion Failed!"), _("Please Ensure that The Document Field has not been assigned")); | |
| 87 | -} | |
| 88 | - | |
| 89 | -function getFieldMappedPage($sDocumentFieldName, $aDocumentTypes) { | |
| 90 | - global $default; | |
| 91 | - | |
| 92 | - $sToRender .= "<table>\n"; | |
| 93 | - $sToRender .= "<tr><td>" . | |
| 94 | - sprintf(_("Document field '%s' is mapped to the following document type(s), and can therefore not be deleted."), $sDocumentFieldName) . "</td></tr>\n"; | |
| 95 | - $sToRender .= "<tr><td>" . _("Click on the Document Type name to edit its fields, or click 'Back' to return to List Document Fields.") . "</td></tr>\n"; | |
| 96 | - for ($i=0; $i<count($aDocumentTypes); $i++) { | |
| 97 | - $sToRender .= "<tr><td><strong>" . generateControllerLink("editDocTypeFields", "fDocTypeSelected=1&fDocTypeID=" . $aDocumentTypes[$i]->getID(), $aDocumentTypes[$i]->getName()) . "</strong></td></tr>"; | |
| 98 | - } | |
| 99 | - $sToRender .= "</table>\n"; | |
| 100 | - | |
| 101 | - return getStatusPage(_("Can't delete document field") . " '$sDocumentFieldName'", $sToRender); | |
| 102 | -} | |
| 103 | - | |
| 104 | -// show listbox...or the text name | |
| 105 | -function getDocFieldDisplay($oDocField) { | |
| 106 | - global $default; | |
| 107 | - if (!isset($oDocField)) { | |
| 108 | - $oPatternListBox = & new PatternListBox($default->document_fields_table, "name", "id", "fDocFieldID"); | |
| 109 | - $oPatternListBox->setFromClause("LEFT OUTER JOIN $default->document_fields_link_table DFL ON ST.id=DFL.document_field_id"); | |
| 110 | - $oPatternListBox->setWhereClause("ISNULL(DFL.value)"); | |
| 111 | - $oPatternListBox->setPostBackOnChange(true); | |
| 112 | - return $oPatternListBox->render(); | |
| 113 | - } else { | |
| 114 | - return "<input type=\"hidden\" name=\"fDocFieldID\" value=\"" . $oDocField->iId . "\">\n" . | |
| 115 | - "<b>" . $oDocField->getName() . "</b>"; | |
| 116 | - } | |
| 117 | -} | |
| 118 | - | |
| 119 | -// show listbox...or the text name | |
| 120 | -function getDocFieldDataType($oDocField) { | |
| 121 | - global $default; | |
| 122 | - if (!isset($oDocField)) { | |
| 123 | - return ""; | |
| 124 | - } else { | |
| 125 | - return "Data Type: </td><td>" . $oDocField->getDataType(); | |
| 126 | - } | |
| 127 | -} | |
| 128 | - | |
| 129 | -// show delete button | |
| 130 | -function getDeleteButton($oDocField) { | |
| 131 | - global $default; | |
| 132 | - if (isset($oDocField)) { | |
| 133 | - return "<td align=\"right\"><input type=\"image\" src =\"" . KTHtml::getDeleteButton() . "\" value=\"submit\"border=\"0\" /></td>\n". | |
| 134 | - "<td align=\"right\">" . generateControllerLink("listDocFields", "", "<img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" />") . "</td>\n"; | |
| 135 | - } | |
| 136 | -} | |
| 137 | - | |
| 138 | -// gets the cancel button when a DocField is selected | |
| 139 | -function getCancelButton($oDocField) { | |
| 140 | - global $default; | |
| 141 | - if (!isset($oDocField)) { | |
| 142 | - return "<td align=\"right\">" . generateControllerLink("docfield", "", "<img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" />") . "</td>\n"; | |
| 143 | - } else { | |
| 144 | - return "<td align=\"right\">" . generateControllerLink("listDocFields", "", "<img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" />") . "</td>\n"; | |
| 145 | - } | |
| 146 | -} | |
| 147 | -?> |