Commit b95af0da6ae02c2b02c272ad33b8e7527c67e158
1 parent
8b1991c7
Rework Document Type management to use dispatcher and templating.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3678 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
16 changed files
with
188 additions
and
1501 deletions
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/addDocTypeBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add document type. | |
| 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 30 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 31 | -require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTypeFieldLink.inc"); | |
| 32 | -require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 33 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 34 | -require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 35 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 36 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 37 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); | |
| 38 | -require_once("addDocTypeUI.inc"); | |
| 39 | - | |
| 40 | -if (checkSession()) { | |
| 41 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 42 | - $oPatternCustom = & new PatternCustom(); | |
| 43 | - $oPatternCustom->setHtml(getPage()); | |
| 44 | - $main->setCentralPayload($oPatternCustom); | |
| 45 | - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/create.php?fRedirectURL=".urlencode("$default->rootUrl/control.php?action=addDocTypeSuccess&fDocTypeID=")); | |
| 46 | - $main->setHasRequiredFields(true); | |
| 47 | - $main->render(); | |
| 48 | -} | |
| 49 | -?> | |
| 50 | 0 | \ No newline at end of file |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/addDocTypeFieldsLinkBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add a link between a document type and 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fAdd', 'fDataType', 'fDocTypeID', 'fFieldID', 'fFromList', 'fNewField'); | |
| 31 | - | |
| 32 | -// XXX: huh? | |
| 33 | -global $default; | |
| 34 | - | |
| 35 | -if (checkSession()) { | |
| 36 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 38 | - require_once("addDocTypeFieldsLinkUI.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc"); | |
| 40 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTypeFieldLink.inc"); | |
| 41 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 42 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 43 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 44 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 45 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 46 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 47 | - | |
| 48 | - $oPatternCustom = & new PatternCustom(); | |
| 49 | - | |
| 50 | - if (isset($fAdd)){ | |
| 51 | - if (isset($fDocTypeID)){ | |
| 52 | - | |
| 53 | - if ($bMandatory){ $bMandatory = true; } | |
| 54 | - else { $bMandatory = false; } | |
| 55 | - | |
| 56 | - if ($fFieldID > 0){ // Use Existing Non-generic field | |
| 57 | - | |
| 58 | - $oDocTypeFieldLink = new DocumentTypeFieldLink($fDocTypeID,$fFieldID,$bMandatory); | |
| 59 | - | |
| 60 | - if ($oDocTypeFieldLink->create()){ | |
| 61 | - $oPatternCustom->setHtml(addSuccessPage($fDocTypeID)); | |
| 62 | - }else { | |
| 63 | - $oPatternCustom->setHtml(addFailPage($fDocTypeID));; | |
| 64 | - } | |
| 65 | - | |
| 66 | - } else if (strlen($fNewField) > 0){ // Create a New Field | |
| 67 | - | |
| 68 | - if ($bHasLookup){ $bHasLookup = true; } | |
| 69 | - else { $bHasLookup = false; } | |
| 70 | - | |
| 71 | - $oDocField = new DocumentField($fNewField, $fDataType, false, $bHasLookup); | |
| 72 | - if ($oDocField->create()) { | |
| 73 | - $fFieldID = $oDocField->getID(); | |
| 74 | - $oDocTypeFieldLink = new DocumentTypeFieldLink($fDocTypeID,$fFieldID,$bMandatory); | |
| 75 | - | |
| 76 | - if ($oDocTypeFieldLink->create()){ | |
| 77 | - $oPatternCustom->setHtml(getCreateNewSuccess($fDocTypeID)); | |
| 78 | - }else { | |
| 79 | - $oPatternCustom->setHtml(getCreateNewFail($fDocTypeID)); | |
| 80 | - } | |
| 81 | - } else { | |
| 82 | - $oPatternCustom->setHtml(getCreateNewFail($fDocTypeID)); | |
| 83 | - } | |
| 84 | - } else { | |
| 85 | - $oPatternCustom->setHtml(getFail_NoFieldID($fDocTypeID)); | |
| 86 | - } | |
| 87 | - }else{ //error | |
| 88 | - $oPatternCustom->setHtml(getMissingDocTypeIDPage($fDocTypeID)); | |
| 89 | - } | |
| 90 | - | |
| 91 | - } else if (isset($fDocTypeID)){ | |
| 92 | - if (isset($fFromList)){ | |
| 93 | - $sNewTableName = $default->document_fields_table; | |
| 94 | - $sNewDisplayColumn = "name"; | |
| 95 | - $sNewValueColumn = "id"; | |
| 96 | - $sNewSelectName = "fFieldID"; | |
| 97 | - $sNewWhereClause = "is_generic != 1"; | |
| 98 | - $bNewOrderAsc = true; | |
| 99 | - | |
| 100 | - $oSelectBox = & new PatternListBox($sNewTableName, $sNewDisplayColumn, $sNewValueColumn, $sNewSelectName, $sNewWhereClause , $bNewOrderAsc ); | |
| 101 | - if (count($oSelectBox->getEntries()) > 0) { | |
| 102 | - | |
| 103 | - $main->setFormAction($_SERVER['PHP_SELF'] . "?fAdd=1&fDocTypeID=$fDocTypeID"); | |
| 104 | - | |
| 105 | - $htmlListBox = $oSelectBox->render(); | |
| 106 | - $oPatternCustom->addHtml(getFirstPage($htmlListBox, $fDocTypeID)); | |
| 107 | - | |
| 108 | - } else { //Go to -> no Non-generic fields exist | |
| 109 | - $oPatternCustom->addHtml(getListFailPage($fDocTypeID)); | |
| 110 | - } | |
| 111 | - } else if(isset($fNewField)){//A new Field Entry | |
| 112 | - $main->setFormAction($_SERVER['PHP_SELF'] . "?fAdd=1&fDocTypeID=$fDocTypeID"); | |
| 113 | - $oPatternCustom->addHtml(getFirstPage($Nothing, $fDocTypeID, true)); | |
| 114 | - } else { // get OptionPage | |
| 115 | - $oPatternCustom->addHtml(getOptionPage($fDocTypeID)); | |
| 116 | - } | |
| 117 | - } else { | |
| 118 | - $oPatternCustom->setHtml(getMissingDocTypeIDPage()); | |
| 119 | - } | |
| 120 | - | |
| 121 | - $main->setCentralPayload($oPatternCustom); | |
| 122 | - $main->setHasRequiredFields(true); | |
| 123 | - $main->render(); | |
| 124 | -} | |
| 125 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/addDocTypeFieldsLinkUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add a link between a document type and 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -function getOptionPage($iDocTypeID = null){ | |
| 29 | - global $default; | |
| 30 | - | |
| 31 | - $sToRender .= renderHeading(_("Add Type Specific Field to Document Type")); | |
| 32 | - $sToRender .= "<br>"; | |
| 33 | - $sToRender .= "<table>\n"; | |
| 34 | - $sToRender .= "<tr><td>" . _("New type specific field?") . "</td><td><a href=\"$default->rootUrl/control.php?action=addDocTypeFieldsLink&fNewField=1&fDocTypeID=$iDocTypeID\"><img src =\"" . KTHtml::getSelectButton() . "\" border = \"0\" /></a></td></tr>\n"; | |
| 35 | - $sToRender .= "<tr><td>" . _("Choose from existing type specific fields") . "</td><td><a href=\"$default->rootUrl/control.php?action=addDocTypeFieldsLink&fFromList=1&fDocTypeID=$iDocTypeID\"><img src =\"" . KTHtml::getSelectButton() . "\" border = \"0\" /></a></td></tr>\n"; | |
| 36 | - $sToRender .= "<tr><td></td><td>" . getCancelButton($iDocTypeID) . "</td></tr>\n"; | |
| 37 | - $sToRender .= "</table>\n"; | |
| 38 | - | |
| 39 | - return $sToRender; | |
| 40 | -} | |
| 41 | - | |
| 42 | - | |
| 43 | -function genericMessage($sMsg, $iDocTypeID = null){ | |
| 44 | - global $default; | |
| 45 | - | |
| 46 | - $sToRender .= "<table>\n"; | |
| 47 | - $sToRender .= "<tr><td>$sMsg</td></tr>\n"; | |
| 48 | - $sToRender .= "<tr><td></td><td>" . getBackButton($iDocTypeID) . "</td></tr>\n"; | |
| 49 | - $sToRender .= "</table>\n"; | |
| 50 | - | |
| 51 | - return $sToRender; | |
| 52 | -} | |
| 53 | - | |
| 54 | -function getCreateNewFail($iDocTypeID){ | |
| 55 | - $sToRender = genericMessage(_("Error creating new Type Specific Field and Linking it"), $iDocTypeID); | |
| 56 | - return $sToRender; | |
| 57 | -} | |
| 58 | - | |
| 59 | - | |
| 60 | -function getCreateNewSuccess($iDocTypeID){ | |
| 61 | - $sToRender = genericMessage(_("New Type specific Field Created and Linked."), $iDocTypeID); | |
| 62 | - return $sToRender; | |
| 63 | -} | |
| 64 | - | |
| 65 | -function getFail_NoFieldID($iDocTypeID = null){ | |
| 66 | - $sToRender = genericMessage(_("Linking cannot be done. Please select a field to link to."), $iDocTypeID); | |
| 67 | - return $sToRender; | |
| 68 | -} | |
| 69 | - | |
| 70 | -function addSuccessPage($iDocTypeID = null){ | |
| 71 | - $sToRender = genericMessage(_("Field is successfully linked to the Document Type."), $iDocTypeID); | |
| 72 | - return $sToRender; | |
| 73 | -} | |
| 74 | - | |
| 75 | -function addFailPage($iDocTypeID = null ){ | |
| 76 | - $sToRender = genericMessage(_("Error") . ": " . _("Field Could not be linked to the Document Type."), $iDocTypeID); | |
| 77 | - return $sToRender; | |
| 78 | -} | |
| 79 | - | |
| 80 | -function getMissingDocTypeIDPage($iDocTypeID = null ){ | |
| 81 | - $sToRender = genericMessage(_("Error") . ": " . _("Page expects a Document Type ID."), $iDocTypeID); | |
| 82 | - return $sToRender; | |
| 83 | -} | |
| 84 | - | |
| 85 | - | |
| 86 | -function getListFailPage($iDocTypeID = null){ | |
| 87 | - $sToRender = genericMessage(_("There are no non-generic fields in the database."), $iDocTypeID); | |
| 88 | - return $sToRender; | |
| 89 | -} | |
| 90 | - | |
| 91 | -// get add pages | |
| 92 | -function getFirstPage($sHtmlListBox = null, $iDocTypeID, $bIsNew = null) { | |
| 93 | - global $default; | |
| 94 | - | |
| 95 | - $sToRender .= renderHeading(_("Add Type Specific Field to Document Type")); | |
| 96 | - $sToRender .= "<br>\n"; | |
| 97 | - $sToRender .= "<table>\n"; | |
| 98 | - | |
| 99 | - if ($bIsNew) { | |
| 100 | - $sNewTableName = $default->data_types_table; | |
| 101 | - $sNewDisplayColumn = "name"; | |
| 102 | - $sNewValueColumn = "name"; | |
| 103 | - $sNewSelectName = "fDataType"; | |
| 104 | - $bNewOrderAsc = true; | |
| 105 | - | |
| 106 | - $oSelectBox = & new PatternListBox($sNewTableName, $sNewDisplayColumn, $sNewValueColumn, $sNewSelectName, $sNewWhereClause , $bNewOrderAsc ); | |
| 107 | - $oSelectBox->setIncludeDefaultValue(false); | |
| 108 | - $sToRender .= "<tr>"; | |
| 109 | - $sToRender .= "<td>" . _("New non-generic field:") . " </td><td><input type=text name=fNewField></td>"; | |
| 110 | - $sToRender .= "</tr>"; | |
| 111 | - $sToRender .= "<tr>"; | |
| 112 | - $sToRender .= "<td>" . _("Field data type:") . " </td><td>" . $oSelectBox->render() . "</td>"; | |
| 113 | - $sToRender .= "</tr>"; | |
| 114 | - $sToRender .= "<tr>"; | |
| 115 | - $sToRender .= "<td align=right>" . _("Has Lookup? ") . " </td><td><input type=checkbox name=bHasLookup></td>"; | |
| 116 | - $sToRender .= "</tr>"; | |
| 117 | - | |
| 118 | - } else { | |
| 119 | - $sToRender .= "<tr>"; | |
| 120 | - $sToRender .= "<td>" . _("Non-generic fields:") . " </td><td>" . $sHtmlListBox . "</td>"; | |
| 121 | - $sToRender .= "</tr>"; | |
| 122 | - } | |
| 123 | - | |
| 124 | - $sToRender .= "<tr><td align=right>" . _("Mandatory") . "? </td><td><input type=checkbox name=bMandatory> </td></tr>\n"; | |
| 125 | - $sToRender .= "<tr><td></td><td align=right><input type=\"image\" src =\"" . KTHtml::getAddButton() . "\" border=0 value=\"submit\"/></td>"; | |
| 126 | - | |
| 127 | - //$sToRender .= "<td><a href=\"$default->rootUrl/control.php?action=listDocTypes\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a></td></tr>\n"; | |
| 128 | - $sToRender .= "<td>" . getCancelButton($iDocTypeID) . "</td></tr>\n"; | |
| 129 | - | |
| 130 | - $sToRender .= "</table>\n"; | |
| 131 | - | |
| 132 | - return $sToRender; | |
| 133 | -} | |
| 134 | - | |
| 135 | -// gets the cancel button | |
| 136 | -function getCancelButton($iDocTypeID = null) { | |
| 137 | - global $default; | |
| 138 | - //return "<a href=\"$default->rootUrl/control.php?action=listDocTypes\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a>\n"; | |
| 139 | - return "<a href=\"$default->rootUrl/control.php?action=editDocTypeFields&fDocTypeSelected=1&fDocTypeID=" . $iDocTypeID . "\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a>\n"; | |
| 140 | -} | |
| 141 | - | |
| 142 | -// gets the cancel button | |
| 143 | -function getBackButton($iDocTypeID = null) { | |
| 144 | - global $default; | |
| 145 | - return "<a href=\"$default->rootUrl/control.php?action=editDocTypeFields&fDocTypeSelected=1&fDocTypeID=" . $iDocTypeID . "\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a>\n"; | |
| 146 | -} | |
| 147 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/addDocTypeSuccess.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Successfully added a document type. | |
| 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fDocTypeID'); | |
| 31 | - | |
| 32 | -// XXX: huh? | |
| 33 | -global $default; | |
| 34 | - | |
| 35 | -if(checkSession()) { | |
| 36 | - | |
| 37 | - // include the page template (with navbar) | |
| 38 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 39 | - | |
| 40 | - $Center .= renderHeading (_("Add Document Type")); | |
| 41 | - $Center .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | |
| 42 | - $Center .= "<tr>\n"; | |
| 43 | - if($fDocTypeID == -1) { | |
| 44 | - $Center .= "<td><b>" . _("Document Type addition Unsuccessful!") . "</b></td>\n"; | |
| 45 | - $Center .= "</tr>\n"; | |
| 46 | - $Center .= "<tr></tr>\n"; | |
| 47 | - $Center .= "<tr>\n"; | |
| 48 | - $Center .= "<td>" . _("Document Type already exists") . "</td>\n"; | |
| 49 | - $Center .= "</tr>\n"; | |
| 50 | - } else { | |
| 51 | - $Center .= "<td><b>" . _("Document Type added Successfully!") . "</b></td>\n"; | |
| 52 | - $Center .= "</tr>\n"; | |
| 53 | - } | |
| 54 | - | |
| 55 | - $Center .= "<tr></tr>\n"; | |
| 56 | - $Center .= "<tr></tr>\n"; | |
| 57 | - $Center .= "<tr></tr>\n"; | |
| 58 | - $Center .= "<tr></tr>\n"; | |
| 59 | - $Center .= "<tr>\n"; | |
| 60 | - $Center .= "<td align = right><a href=\"$default->rootUrl/control.php?action=addDocType\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 61 | - $Center .= "</tr>\n"; | |
| 62 | - $Center .= "</table>\n"; | |
| 63 | - | |
| 64 | - $oPatternCustom = & new PatternCustom(); | |
| 65 | - $oPatternCustom->setHtml($Center); | |
| 66 | - $main->setCentralPayload($oPatternCustom); | |
| 67 | - $main->render(); | |
| 68 | -} | |
| 69 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/addDocTypeUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add document type 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// get add pages | |
| 29 | -function getPage() { | |
| 30 | - | |
| 31 | - global $default; | |
| 32 | - $aDisplayRowNames = array(_("Document Type Name") . ":"); | |
| 33 | - $aParameterNumbers = array(0); | |
| 34 | - $aDisplayColumnTypes = array(1); | |
| 35 | - $aRequired = array(1); | |
| 36 | - //$aDropDownListTableNames = array(10=>"document_types_lookup"); | |
| 37 | - | |
| 38 | - // create a text field that is required | |
| 39 | - $oPatternCreate = & new PatternCreate("DocumentType", "documentmanagement/DocumentType.inc",$aDisplayRowNames, $aParameterNumbers, $aDisplayColumnTypes, $aRequired); | |
| 40 | - $oPatternCreate->setUniqueName("documentType"); | |
| 41 | - | |
| 42 | - $sToRender .= renderHeading(_("Add Document Type")); | |
| 43 | - $sToRender .= "<table>\n"; | |
| 44 | - $sToRender .= "<tr></tr>\n"; | |
| 45 | - $sToRender .= "<tr>\n"; | |
| 46 | - $sToRender .= "<td>" . $oPatternCreate->render() . "</td>\n"; | |
| 47 | - $sToRender .= "</tr>\n"; | |
| 48 | - $sToRender .= "<tr>\n"; | |
| 49 | - $sToRender .= "</tr>\n"; | |
| 50 | - $sToRender .= "<tr>\n"; | |
| 51 | - $sToRender .= "</tr>\n"; | |
| 52 | - $sToRender .= "<td align = right><input type=\"image\" src =\"" . KTHtml::getAddButton() . "\" value=\"submit\" border=\"0\"/>"; | |
| 53 | - $sToRender .= getCancelButton("listDocTypes") . "</td>\n"; | |
| 54 | - $sToRender .= "</table>\n"; | |
| 55 | - | |
| 56 | - return $sToRender; | |
| 57 | - | |
| 58 | - | |
| 59 | - | |
| 60 | -} | |
| 61 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/documentTypes.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +require_once('../../../../../config/dmsDefaults.php'); | |
| 4 | +require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | |
| 5 | +require_once(KT_LIB_DIR . '/templating/templating.inc.php'); | |
| 6 | + | |
| 7 | +require_once(KT_LIB_DIR . '/documentmanagement/DocumentType.inc'); | |
| 8 | +require_once(KT_LIB_DIR . '/metadata/fieldset.inc.php'); | |
| 9 | +require_once(KT_LIB_DIR . '/metadata/metadatautil.inc.php'); | |
| 10 | + | |
| 11 | +$sectionName = "Administration"; | |
| 12 | +require_once(KT_DIR . "/presentation/webpageTemplate.inc"); | |
| 13 | + | |
| 14 | +class KTDocumentTypeDispatcher extends KTAdminDispatcher { | |
| 15 | + function do_main () { | |
| 16 | + $oTemplating =& KTTemplating::getSingleton(); | |
| 17 | + $oTemplate = $oTemplating->loadTemplate('ktcore/documenttypes/list'); | |
| 18 | + $oTemplate->setData(array( | |
| 19 | + 'document_types' => DocumentType::getList(), | |
| 20 | + )); | |
| 21 | + return $oTemplate; | |
| 22 | + } | |
| 23 | + | |
| 24 | + function do_new() { | |
| 25 | + $sName = $_REQUEST['name']; | |
| 26 | + $oDocumentType =& DocumentType::createFromArray(array( | |
| 27 | + 'name' => $sName, | |
| 28 | + )); | |
| 29 | + if (PEAR::isError($oDocumentType)) { | |
| 30 | + $this->errorRedirectToMain('Could not create document type'); | |
| 31 | + exit(0); | |
| 32 | + } | |
| 33 | + $this->errorRedirectTo('edit', 'Document type created', 'fDocumentTypeId=' . $oDocumentType->getId()); | |
| 34 | + exit(0); | |
| 35 | + } | |
| 36 | + | |
| 37 | + function do_delete() { | |
| 38 | + $oDocumentType =& DocumentType::get($_REQUEST['fDocumentTypeId']); | |
| 39 | + if ($oDocumentType->isUsed()) { | |
| 40 | + $this->errorRedirectToMain('Document type still in use, could not be deleted'); | |
| 41 | + exit(0); | |
| 42 | + } | |
| 43 | + $res = $oDocumentType->delete(); | |
| 44 | + if (PEAR::isError($res) || ($res === false)) { | |
| 45 | + $this->errorRedirectToMain('Document type could not be deleted'); | |
| 46 | + exit(0); | |
| 47 | + } | |
| 48 | + | |
| 49 | + $this->errorRedirectToMain('Document type deleted'); | |
| 50 | + exit(0); | |
| 51 | + } | |
| 52 | + | |
| 53 | + function do_edit() { | |
| 54 | + $oTemplating =& KTTemplating::getSingleton(); | |
| 55 | + $oTemplate = $oTemplating->loadTemplate('ktcore/documenttypes/edit'); | |
| 56 | + $oDocumentType =& DocumentType::get($_REQUEST['fDocumentTypeId']); | |
| 57 | + $aCurrentFieldsets =& KTFieldset::getForDocumentType($oDocumentType); | |
| 58 | + $aAvailableFieldsets =& KTFieldset::getNonGenericFieldsets(); | |
| 59 | + $aAvailableFieldsets = array_diff($aAvailableFieldsets, $aCurrentFieldsets); | |
| 60 | + $oTemplate->setData(array( | |
| 61 | + 'oDocumentType' => $oDocumentType, | |
| 62 | + 'aCurrentFieldsets' => $aCurrentFieldsets, | |
| 63 | + 'aAvailableFieldsets' => $aAvailableFieldsets, | |
| 64 | + )); | |
| 65 | + return $oTemplate; | |
| 66 | + } | |
| 67 | + | |
| 68 | + function do_editobject() { | |
| 69 | + $oDocumentType =& DocumentType::get($_REQUEST['fDocumentTypeId']); | |
| 70 | + $oDocumentType->setName($_REQUEST['name']); | |
| 71 | + $res = $oDocumentType->update(); | |
| 72 | + if (PEAR::isError($res) || ($res === false)) { | |
| 73 | + $this->errorRedirectTo('edit', 'Could not save document type changes', 'fDocumentTypeId=' . $oDocumentType->getId()); | |
| 74 | + exit(0); | |
| 75 | + } | |
| 76 | + $this->errorRedirectTo('edit', 'Changes saved', 'fDocumentTypeId=' . $oDocumentType->getId()); | |
| 77 | + exit(0); | |
| 78 | + } | |
| 79 | + | |
| 80 | + function do_removefieldsets() { | |
| 81 | + $oDocumentType =& DocumentType::get($_REQUEST['fDocumentTypeId']); | |
| 82 | + $res = KTMetadataUtil::removeSetsFromDocumentType($oDocumentType, $_REQUEST['fieldsetid']); | |
| 83 | + if (PEAR::isError($res)) { | |
| 84 | + var_dump($res); | |
| 85 | + $this->errorRedirectTo('edit', 'Changes not saved', 'fDocumentTypeId=' . $oDocumentType->getId()); | |
| 86 | + exit(0); | |
| 87 | + } | |
| 88 | + $this->errorRedirectTo('edit', 'Changes saved', 'fDocumentTypeId=' . $oDocumentType->getId()); | |
| 89 | + exit(0); | |
| 90 | + } | |
| 91 | + | |
| 92 | + function do_addfieldsets() { | |
| 93 | + $oDocumentType =& DocumentType::get($_REQUEST['fDocumentTypeId']); | |
| 94 | + $res = KTMetadataUtil::addSetsToDocumentType($oDocumentType, $_REQUEST['fieldsetid']); | |
| 95 | + if (PEAR::isError($res)) { | |
| 96 | + var_dump($res); | |
| 97 | + $this->errorRedirectTo('edit', 'Changes not saved', 'fDocumentTypeId=' . $oDocumentType->getId()); | |
| 98 | + exit(0); | |
| 99 | + } | |
| 100 | + $this->errorRedirectTo('edit', 'Changes saved', 'fDocumentTypeId=' . $oDocumentType->getId()); | |
| 101 | + exit(0); | |
| 102 | + } | |
| 103 | + | |
| 104 | + function handleOutput($data) { | |
| 105 | + global $main; | |
| 106 | + $main->bFormDisabled = true; | |
| 107 | + $main->setCentralPayload($data); | |
| 108 | + $main->render(); | |
| 109 | + } | |
| 110 | +} | |
| 111 | + | |
| 112 | +$d =& new KTDocumentTypeDispatcher; | |
| 113 | +$d->dispatch(); | |
| 114 | + | |
| 115 | +?> | ... | ... |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/editDocTypeBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit document type. | |
| 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fAdd', 'fDocFieldTypeID', 'fDocTypeID', 'fDocTypeName'); | |
| 31 | -KTUtil::extractGPC('fDocTypeSelected', 'fEdit', 'fFieldID', 'fIsMandatory'); | |
| 32 | -KTUtil::extractGPC('fMandatory', 'fRemove', 'fUpdate', 'fUpdateMandatory'); | |
| 33 | - | |
| 34 | -if (checkSession()) { | |
| 35 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); | |
| 37 | - require_once("editDocTypeUI.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc"); | |
| 40 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc"); | |
| 41 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTypeFieldLink.inc"); | |
| 42 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 43 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 44 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 45 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 46 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 47 | - | |
| 48 | - | |
| 49 | - $oPatternCustom = & new PatternCustom(); | |
| 50 | - | |
| 51 | - // if a new DocType has been added | |
| 52 | - // coming from manual edit page | |
| 53 | - if (isset($fUpdate)) { | |
| 54 | - | |
| 55 | - $oDocType = DocumentType::get($fDocTypeID); | |
| 56 | - $oDocType->setName($fDocTypeName); | |
| 57 | - | |
| 58 | - if ($oDocType->update()) { | |
| 59 | - // if successfull print out success message | |
| 60 | - $oPatternCustom->setHtml(getEditPageSuccess()); | |
| 61 | - | |
| 62 | - } else { | |
| 63 | - // if fail print out fail message | |
| 64 | - $oPatternCustom->setHtml(getEditPageFail()); | |
| 65 | - } | |
| 66 | - } else if (isset($fDocTypeSelected)){ | |
| 67 | - | |
| 68 | - $oPatternCustom->setHtml(getDetailsPage($fDocTypeID)); | |
| 69 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUpdate=1"); | |
| 70 | - }else if(isset($fAdd)) | |
| 71 | - { | |
| 72 | - if($fIsMandatory == 1){ | |
| 73 | - $iMandatory = 1; | |
| 74 | - }else{ | |
| 75 | - $iMandatory = 0; | |
| 76 | - } | |
| 77 | - | |
| 78 | - $oDocTypeField = new DocumentTypeFieldLink($fDocTypeID, $fDocFieldTypeID, $iMandatory); | |
| 79 | - | |
| 80 | - $oDocTypeField->create(); | |
| 81 | - | |
| 82 | - | |
| 83 | - // post back on DocType select from manual edit page | |
| 84 | - // store type generic field id's in an array | |
| 85 | - //$oDocFieldType = new DocumentTypeFieldLink( | |
| 86 | - $aGenericFields = DocumentField::getGenericFields(); | |
| 87 | - | |
| 88 | - // get all specific fields | |
| 89 | - $aAllSpecificFields = DocumentField::getAllSpecificFields(); | |
| 90 | - | |
| 91 | - | |
| 92 | - // store type specific field id's and names in an array for specifc doctype | |
| 93 | - $aSpecificFields = DocumentTypeFieldLink::getSpecificFields($fDocTypeID); | |
| 94 | - | |
| 95 | - $oPatternCustom->setHtml(getDetailsPage($fDocTypeID, $aGenericFields, $aSpecificFields, $aAllSpecificFields)); | |
| 96 | - | |
| 97 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocTypeSelected=1"); | |
| 98 | - //$oPatternCustom->setHtml(getEditPageSuccess()); | |
| 99 | - | |
| 100 | - | |
| 101 | - }else if(isset($fRemove)){ | |
| 102 | - | |
| 103 | - $fFieldID = $fRemove; | |
| 104 | - | |
| 105 | - // does'nt matter wot ismandatory is..not checking for it when deleting | |
| 106 | - $iMandatory = 0; | |
| 107 | - //create new object | |
| 108 | - $oDocTypeField = new DocumentTypeFieldLink($fDocTypeID, $fFieldID, $iMandatory); | |
| 109 | - | |
| 110 | - //delete it by first getting hte corresponding id | |
| 111 | - $oDocTypeField ->setDocTypeFieldID($fDocTypeID, $fFieldID); | |
| 112 | - $oDocTypeField->delete(); | |
| 113 | - | |
| 114 | - // post back on DocType select from manual edit page | |
| 115 | - // store type generic field id's in an array | |
| 116 | - //$oDocFieldType = new DocumentTypeFieldLink( | |
| 117 | - $aGenericFields = DocumentField::getGenericFields(); | |
| 118 | - | |
| 119 | - // get all specific fields | |
| 120 | - $aAllSpecificFields = DocumentField::getAllSpecificFields(); | |
| 121 | - | |
| 122 | - | |
| 123 | - // store type specific field id's and names in an array for specifc doctype | |
| 124 | - $aSpecificFields = DocumentTypeFieldLink::getSpecificFields($fDocTypeID); | |
| 125 | - | |
| 126 | - $oPatternCustom->setHtml(getDetailsPage($fDocTypeID, $aGenericFields, $aSpecificFields, $aAllSpecificFields)); | |
| 127 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocTypeSelected=1"); | |
| 128 | - | |
| 129 | - }else if(isset($fEdit)){ | |
| 130 | - $fFieldID = $fEdit; | |
| 131 | - | |
| 132 | - $iMandatory = 0; | |
| 133 | - | |
| 134 | - $oDocTypeField = new DocumentTypeFieldLink($fDocTypeID, $fFieldID, $iMandatory); | |
| 135 | - | |
| 136 | - //delete it by first getting hte corresponding id | |
| 137 | - $oDocTypeField ->setDocTypeFieldID($fDocTypeID, $fFieldID); | |
| 138 | - | |
| 139 | - $iDocTypeFieldID = $oDocTypeField->getID(); | |
| 140 | - | |
| 141 | - $oPatternCustom->setHtml(getMandatoryPage($fFieldID,$iDocTypeFieldID)); | |
| 142 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUpdateMandatory=1"); | |
| 143 | - | |
| 144 | - | |
| 145 | - | |
| 146 | - | |
| 147 | - }else if(isset($fUpdateMandatory)){ | |
| 148 | - | |
| 149 | - | |
| 150 | - | |
| 151 | - | |
| 152 | - $oDocTypeField = new DocumentTypeFieldLink($fDocTypeID, $fFieldID, $fMandatory); | |
| 153 | - | |
| 154 | - //delete it by first getting hte corresponding id | |
| 155 | - $oDocTypeField->setDocTypeFieldID($fDocTypeID, $fFieldID); | |
| 156 | - | |
| 157 | - if(isset($fIsMandatory)){ | |
| 158 | - $oDocTypeField->setIsMandatory(true); | |
| 159 | - }else{ | |
| 160 | - $oDocTypeField->setIsMandatory(false); | |
| 161 | - } | |
| 162 | - | |
| 163 | - $oDocTypeField->update(); | |
| 164 | - | |
| 165 | - | |
| 166 | - | |
| 167 | - // post back on DocType select from manual edit page | |
| 168 | - // store type generic field id's in an array | |
| 169 | - //$oDocFieldType = new DocumentTypeFieldLink( | |
| 170 | - $aGenericFields = DocumentField::getGenericFields(); | |
| 171 | - | |
| 172 | - // get all specific fields | |
| 173 | - $aAllSpecificFields = DocumentField::getAllSpecificFields(); | |
| 174 | - | |
| 175 | - | |
| 176 | - // store type specific field id's and names in an array for specifc doctype | |
| 177 | - $aSpecificFields = DocumentTypeFieldLink::getSpecificFields($fDocTypeID); | |
| 178 | - | |
| 179 | - $oPatternCustom->setHtml(getDetailsPage($fDocTypeID, $aGenericFields, $aSpecificFields, $aAllSpecificFields)); | |
| 180 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocTypeSelected=1"); | |
| 181 | - | |
| 182 | - | |
| 183 | - | |
| 184 | - | |
| 185 | - }else { | |
| 186 | - // if nothing happens...just reload edit page | |
| 187 | - $oPatternCustom->setHtml(getEditPage(null)); | |
| 188 | - $main->setFormAction($_SERVER["PHP_SELF"] ."?fDocTypeSelected=1"); | |
| 189 | - | |
| 190 | - | |
| 191 | - } | |
| 192 | - | |
| 193 | - | |
| 194 | - | |
| 195 | - | |
| 196 | - | |
| 197 | - | |
| 198 | - //render the page | |
| 199 | - $main->setCentralPayload($oPatternCustom); | |
| 200 | - $main->render(); | |
| 201 | -} | |
| 202 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/editDocTypeFieldsBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit document type 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 Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package administration.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fConfirm', 'fDocFieldID', 'fDocTypeID', 'fIsMandatory', 'fRemove', 'fUpdateMandatory'); | |
| 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("editDocTypeFieldsUI.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTypeFieldLink.inc"); | |
| 40 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 41 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 42 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 43 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 44 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 45 | - | |
| 46 | - $oPatternCustom = & new PatternCustom(); | |
| 47 | - if ($fDocTypeID) { | |
| 48 | - if ($fDocFieldID) { | |
| 49 | - $oDocTypeFieldLink = DocumentTypeFieldLink::getByFieldAndTypeIDs($fDocTypeID, $fDocFieldID); | |
| 50 | - if (isset($fRemove)) { | |
| 51 | - if ($fConfirm) { | |
| 52 | - $oDocTypeFieldLink = DocumentTypeFieldLink::getByFieldAndTypeIDs($fDocTypeID, $fDocFieldID); | |
| 53 | - if ($oDocTypeFieldLink->delete()) { | |
| 54 | - // success | |
| 55 | - $oPatternCustom->setHtml(getSuccessPage(_("Document field successfully deleted."), $fDocTypeID)); | |
| 56 | - } else { | |
| 57 | - // failure | |
| 58 | - $oPatternCustom->setHtml(getSuccessPage(_("Error deleting document field."), $fDocTypeID)); | |
| 59 | - } | |
| 60 | - } else { | |
| 61 | - // ask for confirmation | |
| 62 | - $oPatternCustom->setHtml(getDeleteConfirmationPage($fDocTypeID, $fDocFieldID)); | |
| 63 | - } | |
| 64 | - } else if(isset($fUpdateMandatory)) { | |
| 65 | - if ($fConfirm) { | |
| 66 | - if (isset($fIsMandatory)) { | |
| 67 | - $oDocTypeFieldLink->setIsMandatory(true); | |
| 68 | - } else { | |
| 69 | - $oDocTypeFieldLink->setIsMandatory(false); | |
| 70 | - } | |
| 71 | - $default->log->info("dfl=" . arrayToString($oDocTypeFieldLink)); | |
| 72 | - $oDocTypeFieldLink->update(); | |
| 73 | - $oPatternCustom->setHtml(getDetailsPage($fDocTypeID)); | |
| 74 | - } else { | |
| 75 | - // display edit form | |
| 76 | - $oPatternCustom->setHtml(getEditDocumentFieldLinkPage($oDocTypeFieldLink)); | |
| 77 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUpdateMandatory=1"); | |
| 78 | - } | |
| 79 | - } | |
| 80 | - } else { | |
| 81 | - $oPatternCustom->setHtml(getDetailsPage($fDocTypeID)); | |
| 82 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUpdateMandatory=1"); | |
| 83 | - } | |
| 84 | - } else { | |
| 85 | - // no document type selected to edit | |
| 86 | - // FIXME | |
| 87 | - } | |
| 88 | - | |
| 89 | - //render the page | |
| 90 | - $main->setCentralPayload($oPatternCustom); | |
| 91 | - $main->render(); | |
| 92 | -} | |
| 93 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/editDocTypeFieldsUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit document type 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 Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package administration.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// if its the manual edit page..then display normally | |
| 29 | -function getDetailsPage($iDocTypeID) { | |
| 30 | - global $default; | |
| 31 | - $oDocType = null; | |
| 32 | - if (isset($iDocTypeID)) { | |
| 33 | - $oDocType = DocumentType::get($iDocTypeID); | |
| 34 | - } | |
| 35 | - | |
| 36 | - $sToRender .= renderHeading(_("Edit Document Type")); | |
| 37 | - | |
| 38 | - $sToRender .= "<table border=0 width=100%>\n"; | |
| 39 | - | |
| 40 | - $sToRender .= "<tr>\n"; | |
| 41 | - $sToRender .= "<td width=\"45%\">" . _("Document Type Name:") . " </td><td>" . $oDocType->getName() . "</td>\n"; | |
| 42 | - $sToRender .= "</tr>\n"; | |
| 43 | - $sToRender .= "<tr><input type=hidden name=\"fDocTypeID\" value=\"" . $iDocTypeID . "\"></tr>\n"; | |
| 44 | - $sToRender .= "<tr></tr>\n"; | |
| 45 | - $sToRender .= "<tr><td valign=\"top\">" . _("Generic Document Fields:") . " </td><td>" . getGenericFieldsList() . "</td></tr>\n"; | |
| 46 | - $sToRender .= "<tr></tr>\n"; | |
| 47 | - $sToRender .= "<tr><td valign=\"top\">" . _("Document Type Specific Fields:") . " </td>"; | |
| 48 | - $sToRender .= "<td>" . getDocumentTypeFieldsList($iDocTypeID) . "</td></tr>\n"; | |
| 49 | - $sToRender .= "<tr><td >" . generateControllerLink("addDocTypeFieldsLink", "fDocTypeID=$iDocTypeID", _("Add new Type Specific Field") . " <img border=0 src=\"" . KTHtml::getAddButton() . "\"/>"); | |
| 50 | - $sToRender .= generateControllerLink("listDocTypes", "", "<img border=0 src=\"" . KTHtml::getBackButton() . "\"/>"). "</td></tr>\n"; | |
| 51 | - $sToRender .= "</table>\n"; | |
| 52 | - | |
| 53 | - return $sToRender; | |
| 54 | -} | |
| 55 | - | |
| 56 | -function getDeleteConfirmationPage($iDocTypeID, $iDocFieldID) { | |
| 57 | - global $default; | |
| 58 | - | |
| 59 | - $oDocType = DocumentType::get($iDocTypeID); | |
| 60 | - $oDocField = DocumentField::get($iDocFieldID); | |
| 61 | - | |
| 62 | - $sToRender .= renderHeading(_("Edit Document Type") . " - " . _("Delete Document Field Link")); | |
| 63 | - $sToRender .= "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n"; | |
| 64 | - $sToRender .= "<tr><td>" . | |
| 65 | - sprintf(_("Are you sure you want to remove field '%s' from document type '%s'?"), $oDocField->getName(), $oDocType->getName()) . | |
| 66 | - "</td></tr>\n"; | |
| 67 | - $sToRender .= "<tr/><tr/>\n"; | |
| 68 | - $sToRender .= "<tr><td>" . _("Click 'Remove' to remove the link, or 'Cancel' to abort.") . "</td></tr>\n"; | |
| 69 | - $sToRender .= "<tr/><tr/>\n"; | |
| 70 | - $sToRender .= "<td align=\"right\">" . generateControllerLink("editDocTypeFields", "fConfirm=1&fRemove=1&fDocFieldID=$iDocFieldID&fDocTypeID=$iDocTypeID", "<img src =\"" . KTHtml::getRemoveButton() . "\" border = \"0\" />"); | |
| 71 | - $sToRender .= generateControllerLink("editDocTypeFields", "fDocTypeID=$iDocTypeID", "<img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" />") . "</td>\n"; | |
| 72 | - $sToRender .= "</table>\n"; | |
| 73 | - return $sToRender; | |
| 74 | -} | |
| 75 | - | |
| 76 | -function getEditDocumentFieldLinkPage($oDocTypeFieldLink) { | |
| 77 | - global $default; | |
| 78 | - | |
| 79 | - $oDocField = DocumentField::get($oDocTypeFieldLink->getFieldID()); | |
| 80 | - | |
| 81 | - $sToRender .= renderHeading(_("Edit Document Type") . " - " . _("Update Document Field Link Mandatory Setting")); | |
| 82 | - $sToRender .= "<table>\n"; | |
| 83 | - $sToRender .= "<input type=\"hidden\" name=\"fConfirm\" value=\"1\">\n"; | |
| 84 | - $sToRender .= "<input type=\"hidden\" name=\"fDocTypeID\" value=\"" . $oDocTypeFieldLink->getDocumentTypeID() . "\">\n"; | |
| 85 | - $sToRender .= "<input type=\"hidden\" name=\"fDocFieldID\" value=\"" . $oDocTypeFieldLink->getFieldID() . "\">\n"; | |
| 86 | - $sToRender .= "<tr>\n"; | |
| 87 | - $sToRender .= "<td>" . _("Document Field Name:") . " </td><td>" . $oDocField->getName() . "</td>\n"; | |
| 88 | - $sToRender .= "</tr>\n"; | |
| 89 | - $sToRender .= "<tr/>\n"; | |
| 90 | - $sToRender .= "<tr>\n"; | |
| 91 | - $sToRender .= "<td>" . _("Mandatory") . ": </td><td><input type=\"checkbox\" name=\"fIsMandatory\" value=\"1\" " . ($oDocTypeFieldLink->getIsMandatory() ? "CHECKED" : "") . "></td>\n"; | |
| 92 | - $sToRender .= "</tr>\n"; | |
| 93 | - $sToRender .= "<tr><td><input type=\"image\" src=\"" . KTHtml::getUpdateButton() . "\"/>"; | |
| 94 | - $sToRender .= generateControllerLink("editDocTypeFields", "fDocTypeID=" . $oDocTypeFieldLink->getDocumentTypeID(), "<img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" />") . "</td></tr>\n"; | |
| 95 | - $sToRender .= "</table>\n"; | |
| 96 | - return $sToRender; | |
| 97 | -} | |
| 98 | - | |
| 99 | - | |
| 100 | -function getStatusPage($sHeading, $sText = "", $iDocTypeID) { | |
| 101 | - global $default; | |
| 102 | - | |
| 103 | - $sToRender .= renderHeading(_("Edit Document Type")); | |
| 104 | - $sToRender .= "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n"; | |
| 105 | - $sToRender .= "<tr>\n"; | |
| 106 | - $sToRender .= "<td><b>$sHeading</b></td>\n"; | |
| 107 | - $sToRender .= "</tr>\n"; | |
| 108 | - $sToRender .= "<tr/><tr/>\n"; | |
| 109 | - $sToRender .= "<tr><td>$sText</td></tr>\n"; | |
| 110 | - $sToRender .= "<tr/><tr/>\n"; | |
| 111 | - $sToRender .= "<td align=\"right\">" . generateControllerLink("editDocTypeFields", "fDocTypeID=$iDocTypeID", "<img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" />") . "</td>\n"; | |
| 112 | - $sToRender .= "</table>\n"; | |
| 113 | - return $sToRender; | |
| 114 | -} | |
| 115 | - | |
| 116 | -// if addition is successful print otu success page | |
| 117 | -function getSuccessPage($sMessage, $iDocTypeID) { | |
| 118 | - return getStatusPage(_("Success") . "!", $sMessage, $iDocTypeID); | |
| 119 | -} | |
| 120 | - | |
| 121 | -// gets the page if editing fails | |
| 122 | -function getFailurePage($sMessage, $iDocTypeID) { | |
| 123 | - return getStatusPage(_("Failure") . "!", $sMessage, $iDocTypeID); | |
| 124 | -} | |
| 125 | - | |
| 126 | -function getGenericFieldsList() { | |
| 127 | - global $default; | |
| 128 | - $aGenericDocumentFields = DocumentField::getList(array("is_generic=?", array(true)));/*ok*/ | |
| 129 | - for($i = 0; $i < count($aGenericDocumentFields); $i++) { | |
| 130 | - $sToRender .= "<li>" . $aGenericDocumentFields[$i]->getName() . "</li>\n"; | |
| 131 | - } | |
| 132 | - return $sToRender; | |
| 133 | -} | |
| 134 | - | |
| 135 | -function getDocumentTypeFieldsList($iDocTypeID) { | |
| 136 | - global $default; | |
| 137 | - $aDocumentTypeFields = DocumentTypeFieldLink::getDocumentTypeFields($iDocTypeID); | |
| 138 | - $sToRender .= "<table border=0>"; | |
| 139 | - for($i = 0; $i < count($aDocumentTypeFields); $i++) { | |
| 140 | - $oDocField = $aDocumentTypeFields[$i]; | |
| 141 | - if ($oDocField) { | |
| 142 | - $oDocumentTypeFieldLink = DocumentTypeFieldLink::getByFieldAndTypeIDs($iDocTypeID, $oDocField->getID()); | |
| 143 | - $sToRender .= "<tr>"; | |
| 144 | - $sToRender .= "<td>" . $oDocField->getName() . "</td>"; | |
| 145 | - $sToRender .= "<td><img src=\"$default->graphicsUrl/widgets/" . ($oDocumentTypeFieldLink->getIsMandatory() ? "checked" : "unchecked") . ".gif\"/></td>"; | |
| 146 | - $sToRender .= "<td>" . getEditSpecificFieldButton($oDocField->getID(), $iDocTypeID) . "</td>"; | |
| 147 | - $sToRender .= "<td>" . getRemoveSpecificFieldButton($oDocField->getID(), $iDocTypeID) . "</td>"; | |
| 148 | - $sToRender .= "</tr>"; | |
| 149 | - } else { | |
| 150 | - // FIXME: what about broken links? | |
| 151 | - } | |
| 152 | - } | |
| 153 | - $sToRender .= "</table>\n"; | |
| 154 | - return $sToRender; | |
| 155 | -} | |
| 156 | - | |
| 157 | -function getEditSpecificFieldButton($iDocFieldID, $iDocTypeID) { | |
| 158 | - global $default; | |
| 159 | - return generateControllerLink("editDocTypeFields", "fUpdateMandatory=1&fDocFieldID=$iDocFieldID&fDocTypeID=$iDocTypeID", "<img border=0 src =\"" . KTHtml::getEditButton() . "\" value=\"edit\" />"); | |
| 160 | -} | |
| 161 | - | |
| 162 | -function getRemoveSpecificFieldButton($iDocFieldID, $iDocTypeID) { | |
| 163 | - global $default; | |
| 164 | - return generateControllerLink("editDocTypeFields", "fRemove=1&fDocFieldID=$iDocFieldID&fDocTypeID=$iDocTypeID", "<img border=0 src =\"" . KTHtml::getRemoveButton() . "\" value=\"remove\" />"); | |
| 165 | -} | |
| 166 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/editDocTypeUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit document type 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// if its the manual edit page..then display normally | |
| 29 | -function getEditPage($iDocTypeID) { | |
| 30 | - global $default; | |
| 31 | - $oDocType = null; | |
| 32 | - if (isset($iDocTypeID)) { | |
| 33 | - $oDocType = DocumentType::get($iDocTypeID); | |
| 34 | - | |
| 35 | - } | |
| 36 | - | |
| 37 | - $sToRender .= renderHeading(_("Edit Document Type")); | |
| 38 | - $sToRender .= "<table>\n"; | |
| 39 | - $sToRender .= "<tr></tr>\n"; | |
| 40 | - $sToRender .= "<tr>\n"; | |
| 41 | - $sToRender .= "<td>" . _("Document Type Name:") . " </td><td>" . getDocTypeDisplay($oDocType) . "</td>\n"; | |
| 42 | - $sToRender .= "</tr>\n"; | |
| 43 | - $sToRender .= "<tr>\n"; | |
| 44 | - $sToRender .= "</tr>\n"; | |
| 45 | - $sToRender .= "<tr>\n"; | |
| 46 | - $sToRender .= "</tr>\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 .= "<tr>\n"; | |
| 56 | - $sToRender .= "<td></td>" . getUpdateButton($oDocType); | |
| 57 | - $sToRender .= getCancelButton($oDocType); | |
| 58 | - $sToRender .= "</tr>\n"; | |
| 59 | - $sToRender .= "</table>\n"; | |
| 60 | - | |
| 61 | - | |
| 62 | - return $sToRender; | |
| 63 | -} | |
| 64 | - | |
| 65 | -// if its the manual edit page..then display normally | |
| 66 | -function getDetailsPage($iDocTypeID) { | |
| 67 | - global $default; | |
| 68 | - $oDocType = null; | |
| 69 | - | |
| 70 | - if (isset($iDocTypeID)) { | |
| 71 | - $oDocType = DocumentType::get($iDocTypeID); | |
| 72 | - | |
| 73 | - } | |
| 74 | - | |
| 75 | - $sToRender .= renderHeading(_("Edit Document Type")); | |
| 76 | - $sToRender .= "<table>\n"; | |
| 77 | - $sToRender .= "<tr><td><br></br></td></tr>\n"; | |
| 78 | - $sToRender .= "<tr>\n"; | |
| 79 | - $sToRender .= "<td>" . _("Document Type Name:") . " </td><td>" . getDocTypeDisplay($oDocType) . "</td>\n"; | |
| 80 | - $sToRender .= "</tr>\n"; | |
| 81 | - $sToRender .= "<tr>\n"; | |
| 82 | - $sToRender .= "<td></td>" . getUpdateButton($oDocType); | |
| 83 | - $sToRender .= getCancelButton($oDocType); | |
| 84 | - $sToRender .= "</tr>\n"; | |
| 85 | - $sToRender .= "</table>\n"; | |
| 86 | - | |
| 87 | - | |
| 88 | - return $sToRender; | |
| 89 | -} | |
| 90 | - | |
| 91 | -// if its the manual edit page..then display normally | |
| 92 | -function getMandatoryPage($iDocFieldID,$iDocTypeFieldID) { | |
| 93 | - global $default; | |
| 94 | - $oDocField = null; | |
| 95 | - | |
| 96 | - if (isset($iDocFieldID)) { | |
| 97 | - $oDocField = DocumentField::get($iDocFieldID); | |
| 98 | - | |
| 99 | - } | |
| 100 | - | |
| 101 | - if (isset($iDocTypeFieldID)) { | |
| 102 | - $oDocTypeField = DocumentTypeFieldLink::get($iDocTypeFieldID); | |
| 103 | - | |
| 104 | - } | |
| 105 | - $sToRender .= "<input type=\"hidden\" name=\"fDocTypeID\" value=\"" . $oDocTypeField->iDocumentTypeID . "\">\n" ; | |
| 106 | - $sToRender .= "<input type=\"hidden\" name=\"fFieldID\" value=\"" . $oDocTypeField->iFieldID . "\">\n" . | |
| 107 | - $sToRender .= "<br></br>\n"; | |
| 108 | - $sToRender .= "<b>" . _("Change Mandatory Setting:") . "</b>\n"; | |
| 109 | - $sToRender .= "<table>\n"; | |
| 110 | - $sToRender .= "<br></br>\n"; | |
| 111 | - $sToRender .= "<tr></tr>\n"; | |
| 112 | - $sToRender .= "<tr>\n"; | |
| 113 | - $sToRender .= "<td>" . _("Document Field Name:") . " </td><td>" . $oDocField->getName() . "</td>\n"; | |
| 114 | - $sToRender .= "</tr>\n"; | |
| 115 | - $sToRender .= "<tr>\n"; | |
| 116 | - $sToRender .= "</tr>\n"; | |
| 117 | - $sToRender .= "<tr>\n"; | |
| 118 | - if($oDocTypeField->getIsMandatory() == 1) { | |
| 119 | - $sToRender .= "<td>" . _("Is Mandatory:") . " </td><td><input type=\"checkbox\" name=\"fIsMandatory\" value=\"1\" CHECKED></td><td>\n"; | |
| 120 | - } else { | |
| 121 | - $sToRender .= "<td>" . _("Is Mandatory:") . " </td><td><input type=\"checkbox\" name=\"fIsMandatory\" value=\"0\" ></td><td>\n"; | |
| 122 | - } | |
| 123 | - | |
| 124 | - $sToRender .= "</tr>\n"; | |
| 125 | - $sToRender .= "<tr>\n"; | |
| 126 | - $sToRender .= "</tr>\n"; | |
| 127 | - $sToRender .= "<tr>\n"; | |
| 128 | - $sToRender .= "</tr>\n"; | |
| 129 | - $sToRender .= "<tr>\n"; | |
| 130 | - $sToRender .= "</tr>\n"; | |
| 131 | - $sToRender .= "<tr>\n"; | |
| 132 | - $sToRender .= "</tr>\n"; | |
| 133 | - $sToRender .= "<tr>\n"; | |
| 134 | - $sToRender .= "<td></td>" . getDocTypeFieldUpdateButton(); | |
| 135 | - $sToRender .= "</tr>\n"; | |
| 136 | - $ | |
| 137 | - $sToRender .= "</table>\n"; | |
| 138 | - | |
| 139 | - | |
| 140 | - return $sToRender; | |
| 141 | -} | |
| 142 | - | |
| 143 | -// if edition is successful print otu success page | |
| 144 | -function getEditPageSuccess() { | |
| 145 | - global $default; | |
| 146 | - | |
| 147 | - $sToRender .= renderHeading(_("Edit Document Type")); | |
| 148 | - $sToRender .= "<table>\n"; | |
| 149 | - $sToRender .= "<tr><td><b>" . _("Success") . "!</b></td></tr>\n"; | |
| 150 | - $sToRender .= "<tr><td>" . _("The Document Type was successfully modified") . "</td></tr>\n"; | |
| 151 | - $sToRender .= "<tr></tr>\n"; | |
| 152 | - $sToRender .= "<tr></tr>\n"; | |
| 153 | - $sToRender .= "<tr>\n"; | |
| 154 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listDocTypes\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 155 | - $sToRender .= "</tr>\n"; | |
| 156 | - $sToRender .= "</table>\n"; | |
| 157 | - | |
| 158 | - return $sToRender; | |
| 159 | -} | |
| 160 | - | |
| 161 | -// gets the page if editing fails | |
| 162 | -function getEditPageFail() { | |
| 163 | - global $default; | |
| 164 | - | |
| 165 | - $sToRender .= renderHeading(_("Edit Document Type")); | |
| 166 | - $sToRender .= "<table>\n"; | |
| 167 | - $sToRender .= "<tr><td><b>" . strtoupper(_("Failure")) . "!</b></td></tr>\n"; | |
| 168 | - $sToRender .= "<tr><td>" . _("Document Type modification Failed!") . "</td></tr>\n"; | |
| 169 | - $sToRender .= "<tr></tr>\n"; | |
| 170 | - $sToRender .= "<tr></tr>\n"; | |
| 171 | - $sToRender .= "<tr>\n"; | |
| 172 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listDocTypes\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 173 | - $sToRender .= "</tr>\n"; | |
| 174 | - $sToRender .= "</table>\n"; | |
| 175 | - | |
| 176 | - return $sToRender; | |
| 177 | -} | |
| 178 | - | |
| 179 | -// show the list box when no DocType selected | |
| 180 | -// then shows a text box with the DocType's name | |
| 181 | -function getDocTypeDisplay($oDocType) { | |
| 182 | - global $default; | |
| 183 | - if (!isset($oDocType)) { | |
| 184 | - $oPatternListBox = & new PatternListBox($default->document_types_table, "name", "id", "fDocTypeID"); | |
| 185 | - // only restrict doc type editing for non sys admins | |
| 186 | - if (!Permission::userIsSystemAdministrator()) { | |
| 187 | - $oPatternListBox->setFromClause("LEFT OUTER JOIN $default->documents_table D on ST.id=D.document_type_id"); | |
| 188 | - $oPatternListBox->setWhereClause("ISNULL(D.id)"); | |
| 189 | - } | |
| 190 | - $oPatternListBox->setPostBackOnChange(true); | |
| 191 | - return $oPatternListBox->render(); | |
| 192 | - } else { | |
| 193 | - return "<input type=\"hidden\" name=\"fDocTypeID\" value=\"" . $oDocType->iId . "\">\n" . | |
| 194 | - "<input size = \"30\" type=\"text\" name=\"fDocTypeName\" value=\"" . $oDocType->getName() . "\">"; | |
| 195 | - } | |
| 196 | - | |
| 197 | -} | |
| 198 | - | |
| 199 | -function getGenericFieldsList($aGeneric) { | |
| 200 | - global $default; | |
| 201 | - | |
| 202 | - $sList = "</tr><tr><td></td><td>"; | |
| 203 | - for($i = 0; $i < count($aGeneric);$i++) { | |
| 204 | - $sList .= "<li>" . $aGeneric[$i]["name"]. "</li>\n"; | |
| 205 | - } | |
| 206 | - $sList .= "</td></tr>"; | |
| 207 | - return $sList; | |
| 208 | -} | |
| 209 | - | |
| 210 | -function getSpecificFieldsList($aSpecific) { | |
| 211 | - global $default; | |
| 212 | - for($i = 0; $i < count($aSpecific);$i++) { | |
| 213 | - $oDocField = DocumentField::get($aSpecific[$i]); | |
| 214 | - $sList .= "<tr><td></td><td><li>" . $oDocField->getName() . "</li></td><td>" . getEditSpecificFieldButton($aSpecific[$i]) ." ". getRemoveSpecificFieldButton($aSpecific[$i]) . "</td></tr>\n"; | |
| 215 | - } | |
| 216 | - return $sList; | |
| 217 | -} | |
| 218 | - | |
| 219 | -// show Group details on confirm deletion page | |
| 220 | -function addSpecificFieldsList($aAllSpecific) { | |
| 221 | - global $default; | |
| 222 | - | |
| 223 | - $sDocFieldType = "<Select Name=\"fDocFieldTypeID\">"; | |
| 224 | - for ($i=0;$i < count($aAllSpecific);$i++) { | |
| 225 | - $Options .= "<OPTION value= \"". $aAllSpecific[$i]["id"] . "\">". $aAllSpecific[$i]["name"] ."</OPTION>\n"; | |
| 226 | - } | |
| 227 | - $sDocFieldType .= $Options . "</SELECT>"; | |
| 228 | - | |
| 229 | - return $sDocFieldType; | |
| 230 | -} | |
| 231 | - | |
| 232 | -// gets the updatebutton when a DocType is selected | |
| 233 | -function getUpdateButton($oDocType) { | |
| 234 | - global $default; | |
| 235 | - if (!isset($oDocType)) { | |
| 236 | - return _("Please select a Document Type") . ": "; | |
| 237 | - } else { | |
| 238 | - return "<td align = right><input ONCLICK=\"// setActionAndSubmit('" . $_SERVER["PHP_SELF"] ."?fUpdate=1');\" type=\"image\" src =\"" . KTHtml::getUpdateButton() . "\" border=0 value=\"submit\" /></td>\n"; | |
| 239 | - } | |
| 240 | -} | |
| 241 | - | |
| 242 | -// gets the updatebutton when a DocType is selected | |
| 243 | -function getDocTypeFieldUpdateButton() { | |
| 244 | - global $default; | |
| 245 | - return "<td align = right><input ONCLICK=\" setActionAndSubmit('" . $_SERVER["PHP_SELF"] ."?fUpdateMandatory=1')\" type=\"image\" src =\"" . KTHtml::getUpdateButton() . "\" border=0 value=\"submit\" /></td>\n"; | |
| 246 | -} | |
| 247 | - | |
| 248 | -function getRemoveSpecificFieldButton($iNumber) { | |
| 249 | - global $default; | |
| 250 | - return "<input ONCLICK=\" setActionAndSubmit('" . $_SERVER["PHP_SELF"] ."?fRemove=$iNumber')\" align = \"absmiddle\" type=\"image\" src =\"" . KTHtml::getRemoveButton() . "\" value=\"remove\" />\n"; | |
| 251 | -} | |
| 252 | - | |
| 253 | -function getEditSpecificFieldButton($iNumber) { | |
| 254 | - global $default; | |
| 255 | - return "<input ONCLICK=\" setActionAndSubmit('" . $_SERVER["PHP_SELF"] ."?fEdit=$iNumber')\" align = \"absmiddle\" type=\"image\" src =\"" . KTHtml::getEditButton() . "\" value=\"edit\" />\n"; | |
| 256 | -} | |
| 257 | - | |
| 258 | -function getAddSpecificFieldButton() { | |
| 259 | - global $default; | |
| 260 | - return "<input ONCLICK=\" setActionAndSubmit('" . $_SERVER["PHP_SELF"] ."?fAdd=1')\" align = \"absmiddle\" type=\"image\" src =\"" . KTHtml::getAddButton() . "\" value=\"add\" />\n"; | |
| 261 | -} | |
| 262 | - | |
| 263 | -// gets the cancel button when a DocType is selected | |
| 264 | -function getCancelButton($oDocType) { | |
| 265 | - global $default; | |
| 266 | - if (!isset($oDocType)) { | |
| 267 | - return "<td align = right><a href=\"$default->rootUrl/control.php?action=doctypeManagement\"><img src =\"" . KTHtml::getCancelButton() . "\" value=\"cancel\" border = \"0\"/></a></td>\n"; | |
| 268 | - } | |
| 269 | - else { | |
| 270 | - return "<td align = right><a href=\"$default->rootUrl/control.php?action=listDocTypes\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a></td>\n"; | |
| 271 | - } | |
| 272 | -} | |
| 273 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/listDocTypesBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * List document types. | |
| 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.doctypemanagement | |
| 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("listDocTypesUI.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/doctypemanagement/listDocTypesUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * List document types 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -function getDocumentTypes() { | |
| 29 | - global $default; | |
| 30 | - | |
| 31 | - /*ok*/ $sQuery = "SELECT id as DocTypeID, name as DocTypeName, " . | |
| 32 | - "'Edit', 'Delete', 'Edit Fields' " . | |
| 33 | - "FROM " . $default->document_types_table . " " . | |
| 34 | - "ORDER BY name"; | |
| 35 | - | |
| 36 | - $aColumns = array("DocTypeName", "Edit", "Delete", "Edit Fields"); | |
| 37 | - $aColumnNames = array(_("Name"), _("Edit"), _("Delete"), _("Edit Fields")); | |
| 38 | - $aColumnTypes = array(1,3,3,3); | |
| 39 | - $aDBColumnArray = array("DocTypeID"); | |
| 40 | - $aQueryStringVariableNames = array("fDocTypeID"); | |
| 41 | - | |
| 42 | - $aHyperLinkURL = array( 1=> "$default->rootUrl/control.php?action=editDocType&fDocTypeSelected=1", | |
| 43 | - 2=> "$default->rootUrl/control.php?action=removeDocType", | |
| 44 | - 3=> "$default->rootUrl/control.php?action=editDocTypeFields&fDocTypeSelected=1"); | |
| 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 Type Management")); | |
| 54 | - | |
| 55 | - // add user link | |
| 56 | - $sToRender .= getAddLink("addDocType", _("Add A Document Type")); | |
| 57 | - $sToRender .= getDocumentTypes(); | |
| 58 | - return $sToRender; | |
| 59 | -} | |
| 60 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/removeDocTypeBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove a document type. | |
| 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fDocTypeID', 'fDocTypeName', '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("removeDocTypeUI.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 40 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 41 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 42 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 43 | - | |
| 44 | - $oPatternCustom = & new PatternCustom(); | |
| 45 | - | |
| 46 | - // get main page | |
| 47 | - if (isset($fDocTypeID)) { | |
| 48 | - | |
| 49 | - $oPatternCustom->setHtml(getDeletePage($fDocTypeID)); | |
| 50 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForDelete=1"); | |
| 51 | - | |
| 52 | - // get delete page | |
| 53 | - } else { | |
| 54 | - $oPatternCustom->setHtml(getDeletePage(null)); | |
| 55 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 56 | - } | |
| 57 | - | |
| 58 | - // if delete entry | |
| 59 | - if (isset($fForDelete)) { | |
| 60 | - $oDocType = DocumentType::get($fDocTypeID); | |
| 61 | - $oDocType->setName($fDocTypeName); | |
| 62 | - | |
| 63 | - | |
| 64 | - if ($oDocType->delete()) { | |
| 65 | - | |
| 66 | - //delete all fields as well | |
| 67 | - $oDocType->deleteAllFieldLinks(); | |
| 68 | - | |
| 69 | - $oPatternCustom->setHtml(getDeleteSuccessPage()); | |
| 70 | - | |
| 71 | - } else { | |
| 72 | - $oPatternCustom->setHtml(getDeleteFailPage()); | |
| 73 | - } | |
| 74 | - } | |
| 75 | - | |
| 76 | - $main->setCentralPayload($oPatternCustom); | |
| 77 | - $main->render(); | |
| 78 | -} | |
| 79 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/removeDocTypeUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove a document type 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.doctypemanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// gets the delete stuff | |
| 29 | -function getDeletePage($iDocTypeID) { | |
| 30 | - global $default; | |
| 31 | - $oDocType = null; | |
| 32 | - if (isset($iDocTypeID)) { | |
| 33 | - $oDocType = DocumentType::get($iDocTypeID); | |
| 34 | - $sHeading .= "<b>" . _("Are you sure you wish to Remove this Document Type?") . ":</b>\n"; | |
| 35 | - } else { | |
| 36 | - $sHeading .= _("Please select a Document Type") . ":"; | |
| 37 | - } | |
| 38 | - | |
| 39 | - $sToRender .= renderHeading(_("Remove Document Type")); | |
| 40 | - $sToRender .= "<table>\n"; | |
| 41 | - $sToRender .= "<tr><td>$sHeading</td></tr>\n"; | |
| 42 | - $sToRender .= "<tr>\n"; | |
| 43 | - $sToRender .= "<td>" . _("Document Type Name:") . " " . getDocTypeDisplay($oDocType) . "</td>\n"; | |
| 44 | - $sToRender .= "</tr>\n"; | |
| 45 | - $sToRender .= "<tr>\n"; | |
| 46 | - $sToRender .= "</tr>\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 .= getDeleteButton($oDocType); | |
| 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 Type")); | |
| 65 | - $sToRender .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | |
| 66 | - $sToRender .= "<tr>\n"; | |
| 67 | - $sToRender .= "<td><b>" . _("DocumentType 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=listDocTypes\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></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 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 the Document Type has been Removed from ALL Folders") . "</td></tr>\n"; | |
| 94 | - $sToRender .= "<tr></tr>\n"; | |
| 95 | - $sToRender .= "</tr>\n"; | |
| 96 | - $sToRender .= "<tr><td align = right><a href=\"$default->rootUrl/control.php?action=listDocTypes\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td></tr>\n"; | |
| 97 | - $sToRender .= "</table>\n"; | |
| 98 | - | |
| 99 | - return $sToRender; | |
| 100 | -} | |
| 101 | - | |
| 102 | -// show listbox...or the text name | |
| 103 | -function getDocTypeDisplay($oDocType) { | |
| 104 | - global $default; | |
| 105 | - if (!isset($oDocType)) { | |
| 106 | - $oPatternListBox = & new PatternListBox($default->document_types_table, "name", "id", "fDocTypeID"); | |
| 107 | - $oPatternListBox->setFromClause("LEFT OUTER JOIN $default->documents_table D on ST.id=D.document_type_id"); | |
| 108 | - $oPatternListBox->setWhereClause("ISNULL(D.id)"); | |
| 109 | - $oPatternListBox->setIncludeDefaultValue(true); | |
| 110 | - $oPatternListBox->setPostBackOnChange(true); | |
| 111 | - return $oPatternListBox->render(); | |
| 112 | - } else { | |
| 113 | - return "<input type=\"hidden\" name=\"fDocTypeID\" value=\"" . $oDocType->iId . "\">\n" . | |
| 114 | - "<b>" . $oDocType->getName() . "</b>"; | |
| 115 | - } | |
| 116 | - | |
| 117 | -} | |
| 118 | - | |
| 119 | - | |
| 120 | -// show delete button | |
| 121 | -function getDeleteButton($oDocType) { | |
| 122 | - global $default; | |
| 123 | - if (isset($oDocType)) { | |
| 124 | - return "<td align = right><input type=\"image\" src =\"" . KTHtml::getDeleteButton() . "\" value=\"submit\" border=\"0\"/></td>\n". | |
| 125 | - "<td align = right><a href=\"$default->rootUrl/control.php?action=listDocTypes\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a></td>\n"; | |
| 126 | - } | |
| 127 | -} | |
| 128 | -?> |
templates/ktcore/documenttypes/edit.smarty
0 → 100644
| 1 | +<h1>Document Type: { $oDocumentType->getName() }</h1> | |
| 2 | + | |
| 3 | +<form method="POST" action="{$smarty.server.PHP_SELF}"> | |
| 4 | +<input type="hidden" name="action" value="editobject"> | |
| 5 | +<input type="hidden" name="fDocumentTypeId" value="{$oDocumentType->getId()}"> | |
| 6 | +<input type="textbox" name="name" value="{$oDocumentType->getName()|escape}"> | |
| 7 | +<input type="submit" name="submit" value="Change"> | |
| 8 | +</form> | |
| 9 | + | |
| 10 | +<h2>Type-specific field sets</h2> | |
| 11 | + | |
| 12 | +<h3>Existing field sets</h3> | |
| 13 | + | |
| 14 | +{ if $aCurrentFieldsets } | |
| 15 | +<form method="POST" action="{$smarty.server.PHP_SELF}"> | |
| 16 | + <input type="hidden" name="action" value="removefieldsets"> | |
| 17 | + <input type="hidden" name="fDocumentTypeId" value="{$oDocumentType->getId()}"> | |
| 18 | + | |
| 19 | + <ul> | |
| 20 | + {foreach from="$aCurrentFieldsets item=oFieldset} | |
| 21 | + <li><label><input type="checkbox" name="fieldsetid[]" value="{$oFieldset->getId() }" />{$oFieldset->getName() }</label></li> | |
| 22 | + {/foreach} | |
| 23 | + </ul> | |
| 24 | + <input type="submit" name="submit" value="Remove field sets"> | |
| 25 | +</form> | |
| 26 | +{ /if } | |
| 27 | + | |
| 28 | +{ if $aAvailableFieldsets } | |
| 29 | +<h3>Add field sets</h3> | |
| 30 | + | |
| 31 | +<form method="POST" action="{$smarty.server.PHP_SELF}"> | |
| 32 | + <input type="hidden" name="action" value="addfieldsets"> | |
| 33 | + <input type="hidden" name="fDocumentTypeId" value="{$oDocumentType->getId()}"> | |
| 34 | + <select name="fieldsetid" multiple="true" size="5"> | |
| 35 | + {foreach from=$aAvailableFieldsets item=oFieldset} | |
| 36 | + <option value="{$oFieldset->getId()}">{$oFieldset->getName()}</option> | |
| 37 | + {/foreach} | |
| 38 | + </select> | |
| 39 | + <input type="submit" name="submit" value="Add field sets"> | |
| 40 | +</form> | |
| 41 | +{ /if } | |
| 42 | + | |
| 43 | +<a href="{$smarty.server.PHP_SELF}">Back to document type list</a> | ... | ... |
templates/ktcore/documenttypes/list.smarty
0 → 100644
| 1 | +<h1>Document Types</h1> | |
| 2 | + | |
| 3 | +<h2>Existing document types</h2> | |
| 4 | + | |
| 5 | +<table class="pretty" cellspacing="0" cellpadding="0"> | |
| 6 | + <thead> | |
| 7 | + <tr><th>Name</th></tr> | |
| 8 | + </thead> | |
| 9 | + <tbody> | |
| 10 | +{foreach from=$document_types item=oDocumentType} | |
| 11 | +<tr><td> | |
| 12 | +{ if $oDocumentType->isUsed() } | |
| 13 | +<img border="0" src="{"icons/delete_disabled.png"|imgSrc}" title="This document type is assigned to documents, and thus can not be deleted." /> | |
| 14 | +{ else } | |
| 15 | +<a href="?action=delete&fDocumentTypeId={$oDocumentType->getId()}"><img border="0" src="{"icons/delete.png"|imgSrc}" /></a> | |
| 16 | +{/if} | |
| 17 | +<a href="?action=edit&fDocumentTypeId={$oDocumentType->getId()}"> { $oDocumentType->getName() } | |
| 18 | +</a> | |
| 19 | +</td></tr> | |
| 20 | + </tbody> | |
| 21 | +{/foreach} | |
| 22 | +</table> | |
| 23 | + | |
| 24 | +<h2>Create a new document type</h2> | |
| 25 | + | |
| 26 | +<form method="POST"> | |
| 27 | +<input type="hidden" name="action" value="new"> | |
| 28 | +<input type="textbox" name="name"> | |
| 29 | +<input type="submit" name="submit" value="Create"> | |
| 30 | +</form> | ... | ... |