Commit 5ebf4e59125be860c8adcc5c6b395c9f0021d3da
1 parent
25092535
- add org admin, unit admin.
- hide org admin - improve group-admin to allow editing of unit link - add UnitLink utilities to class Group git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4120 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
36 changed files
with
341 additions
and
2927 deletions
lib/groups/Group.inc
| ... | ... | @@ -24,6 +24,10 @@ |
| 24 | 24 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa |
| 25 | 25 | * @package lib.groups |
| 26 | 26 | */ |
| 27 | + | |
| 28 | +require_once(KT_LIB_DIR . '/groups/GroupUnitLink.inc'); | |
| 29 | +require_once(KT_LIB_DIR . '/unitmanagement/Unit.inc'); | |
| 30 | + | |
| 27 | 31 | class Group extends KTEntity { |
| 28 | 32 | |
| 29 | 33 | /** primary key of current object */ |
| ... | ... | @@ -117,6 +121,43 @@ class Group extends KTEntity { |
| 117 | 121 | } |
| 118 | 122 | } |
| 119 | 123 | |
| 124 | + function _getUnitLink() { | |
| 125 | + $oldUnitLink = GroupUnitLink::getList('group_id = ' . $this->getID()); | |
| 126 | + if (count($oldUnitLink) != 0) { | |
| 127 | + return $oldUnitLink[0]; | |
| 128 | + } else { | |
| 129 | + return null; | |
| 130 | + } | |
| 131 | + } | |
| 132 | + | |
| 133 | + function setUnit($iUnitId) { | |
| 134 | + if ($this->hasUnit()) { | |
| 135 | + $oldUnitLink = $this->_getUnitLink(); | |
| 136 | + $oldUnitLink->setUnitID($iUnitId); | |
| 137 | + $oldUnitLink->update(); | |
| 138 | + } else { | |
| 139 | + $unitLink = new GroupUnitLink($this->iId, $iUnitId); | |
| 140 | + $unitLink->create(); | |
| 141 | + } | |
| 142 | + } | |
| 143 | + | |
| 144 | + function clearUnit() { | |
| 145 | + $oLink = $this->_getUnitLink(); | |
| 146 | + if ($oLink !== null) { | |
| 147 | + $oLink->delete(); | |
| 148 | + } | |
| 149 | + } | |
| 150 | + | |
| 151 | + function getUnit() { | |
| 152 | + $oLink = $this->_getUnitLink(); | |
| 153 | + if ($oLink !== null) { | |
| 154 | + $oUnit = Unit::get($oLink->getUnitID()); | |
| 155 | + return $oUnit; | |
| 156 | + } else { | |
| 157 | + return null; | |
| 158 | + } | |
| 159 | + } | |
| 160 | + | |
| 120 | 161 | /** |
| 121 | 162 | * Static function. |
| 122 | 163 | * Given a groups primary key it will create a | ... | ... |
plugins/ktcore/KTAdminPlugins.php
| ... | ... | @@ -28,6 +28,8 @@ $oAdminRegistry->registerCategory("misc", "Miscellaneous", "Various settings whi |
| 28 | 28 | // users and groups |
| 29 | 29 | $oAdminRegistry->registerLocation("users",'KTUserAdminDispatcher',"principals", "Manage Users","Add or remove users from the system.", KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/usermanagement/userManagement.php', null); |
| 30 | 30 | $oAdminRegistry->registerLocation("groups",'KTGroupAdminDispatcher',"principals", "Manage Groups","Add or remove groups from the system.", KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/groupManagement.php', null); |
| 31 | +$oAdminRegistry->registerLocation("units",'KTUnitAdminDispatcher',"principals", "Control Units","Specify which organisation units are available.", KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/unitManagement.php', null); | |
| 32 | +//$oAdminRegistry->registerLocation("orgs",'KTOrgAdminDispatcher',"principals", "Control Organisations","Specify which organisations are available.", KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/orgManagement.php', null); | |
| 31 | 33 | |
| 32 | 34 | // documents |
| 33 | 35 | $oAdminRegistry->registerLocation("typemanagement",'KTDocumentTypeDispatcher','documents', 'Document Types','Manage the different classes of document which can be added to the system.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/documentTypes.php', null); | ... | ... |
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/editGroupBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit a group. | |
| 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.groupmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fForStore', 'fFromCreate', 'fGroupID', 'fGroupName', 'fGroupSysAdmin', 'fGroupUnitAdmin'); | |
| 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("editGroupUI.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/groups/Group.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 | - | |
| 45 | - $oPatternCustom = & new PatternCustom(); | |
| 46 | - | |
| 47 | - // if a new group has been added | |
| 48 | - if (isset($fFromCreate)) { | |
| 49 | - | |
| 50 | - if($fGroupID == -1) { | |
| 51 | - $oPatternCustom->setHtml(getAddFailPage()); | |
| 52 | - } else { | |
| 53 | - $oPatternCustom->setHtml(getCreatePage($fGroupID)); | |
| 54 | - } | |
| 55 | - | |
| 56 | - $_SESSION["pageAccess"][$default->rootUrl . '/presentation/lookAndFeel/knowledgeTree/store.php'] = true; | |
| 57 | - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/store.php?fReturnURL=" . urlencode("$default->rootUrl/control.php?action=editGroupSuccess")); | |
| 58 | - | |
| 59 | - // coming from manual edit page | |
| 60 | - } else if (isset($fForStore)) { | |
| 61 | - $oGroup = Group::get($fGroupID); | |
| 62 | - $oGroup->setName($fGroupName); | |
| 63 | - | |
| 64 | - //check if checkbox checked | |
| 65 | - $oGroup->setUnitAdmin(isset($fGroupUnitAdmin)); | |
| 66 | - //check if checkbox checked | |
| 67 | - $oGroup->setSysAdmin(isset($fGroupSysAdmin)); | |
| 68 | - | |
| 69 | - if ($oGroup->update()) { | |
| 70 | - // if successfull print out success message | |
| 71 | - $oPatternCustom->setHtml(getEditPageSuccess()); | |
| 72 | - } else { | |
| 73 | - // if fail print out fail message | |
| 74 | - $oPatternCustom->setHtml(getEditPageFail()); | |
| 75 | - } | |
| 76 | - } else if (isset($fGroupID)) { | |
| 77 | - // post back on group select from manual edit page | |
| 78 | - $oPatternCustom->setHtml(getEditPage($fGroupID)); | |
| 79 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForStore=1"); | |
| 80 | - } else { | |
| 81 | - // if nothing happens...just reload edit page | |
| 82 | - $oPatternCustom->setHtml(getEditPage(null)); | |
| 83 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 84 | - } | |
| 85 | - //render the page | |
| 86 | - $main->setCentralPayload($oPatternCustom); | |
| 87 | - $main->render(); | |
| 88 | -} | |
| 89 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/editGroupFail.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit a group failure page. | |
| 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.groupmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -global $default; | |
| 31 | - | |
| 32 | -if(checkSession()) | |
| 33 | -{ | |
| 34 | - | |
| 35 | -// include the page template (with navbar) | |
| 36 | -require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 37 | - | |
| 38 | - | |
| 39 | -$Center = "<br></br>\n" ; | |
| 40 | -$Center .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | |
| 41 | -$Center .= "<tr>\n"; | |
| 42 | -$Center .= "<td>" . _("Deletion Failed!") . "</td>\n"; | |
| 43 | -$Center .= "</tr>\n"; | |
| 44 | -$Center .= "<tr></tr>\n"; | |
| 45 | -$Center .= "<tr><td>" . _("Please Ensure that The Group has been Removed from any Unit it belongs to") . "</td></tr>\n"; | |
| 46 | -$Center .= "<tr></tr>\n"; | |
| 47 | -$Center .= "<tr></tr>\n"; | |
| 48 | -$Center .= "<tr>\n"; | |
| 49 | -$Center .= "<td align = right><a href=\"$default->rootUrl/control.php?action=editGroup\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 50 | -$Center .= "</tr>\n"; | |
| 51 | -$Center .= "</table>\n"; | |
| 52 | - | |
| 53 | - | |
| 54 | -$oPatternCustom = & new PatternCustom(); | |
| 55 | -$oPatternCustom->setHtml($Center); | |
| 56 | -$main->setCentralPayload($oPatternCustom); | |
| 57 | -$main->render(); | |
| 58 | - | |
| 59 | - | |
| 60 | - | |
| 61 | - | |
| 62 | -} | |
| 63 | - | |
| 64 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/editGroupSuccess.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit a group success page. | |
| 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.groupmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | -//require_once("../adminUI.inc"); | |
| 30 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 31 | - | |
| 32 | -global $default; | |
| 33 | - | |
| 34 | -if (checkSession()) { | |
| 35 | - | |
| 36 | - // include the page template (with navbar) | |
| 37 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 38 | - | |
| 39 | - $Center .= renderHeading(_("Edit Group")); | |
| 40 | - $Center .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | |
| 41 | - $Center .= "<tr>\n"; | |
| 42 | - $Center .= "<td>" . _("Update Successful!") . "</td>\n"; | |
| 43 | - $Center .= "</tr>\n"; | |
| 44 | - $Center .= "<tr></tr>\n"; | |
| 45 | - $Center .= "<tr></tr>\n"; | |
| 46 | - $Center .= "<tr></tr>\n"; | |
| 47 | - $Center .= "<tr></tr>\n"; | |
| 48 | - $Center .= "<tr>\n"; | |
| 49 | - $Center .= "<td align = right><a href=\"$default->rootUrl/control.php?action=listGroups\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 50 | - $Center .= "</tr>\n"; | |
| 51 | - $Center .= "</table>\n"; | |
| 52 | - | |
| 53 | - $oPatternCustom = & new PatternCustom(); | |
| 54 | - $oPatternCustom->setHtml($Center); | |
| 55 | - $main->setCentralPayload($oPatternCustom); | |
| 56 | - $main->render(); | |
| 57 | -} | |
| 58 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/editGroupUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit a group 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.groupmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// get hte edit page if it comes from the add page | |
| 29 | -function getCreatePage($iGroupID) { | |
| 30 | - | |
| 31 | - global $default; | |
| 32 | - $oGroup = null; | |
| 33 | - | |
| 34 | - /*ok*/ $sQuery = array("SELECT * FROM $default->groups_table WHERE id = ?", $iGroupID); | |
| 35 | - // #2978 if you're not a system administrator, you can't add a sys admin group | |
| 36 | - // FIXME: there must be a more elegant way to do this? possibly some exclusions to the pattern | |
| 37 | - if (Permission::userIsSystemAdministrator()) { | |
| 38 | - $aDisplayColumns = array("name","is_sys_admin","is_unit_admin"); | |
| 39 | - $aStoreColumns = array("name","is_sys_admin","is_unit_admin"); | |
| 40 | - $aColumnNames = array(_("Name") . ":", _("System Administrator") . ":", _("Unit Administrator") . ":"); | |
| 41 | - $aDisplayColumnTypes = array(1,2,2); | |
| 42 | - $aDatabaseColumnTypes = array(1,2,2); | |
| 43 | - } else { | |
| 44 | - $aDisplayColumns = array("name","is_unit_admin"); | |
| 45 | - $aStoreColumns = array("name","is_unit_admin"); | |
| 46 | - $aColumnNames = array(_("Name") . ":", _("Unit Administrator") . ":"); | |
| 47 | - $aDisplayColumnTypes = array(1,2); | |
| 48 | - $aDatabaseColumnTypes = array(1,2); | |
| 49 | - } | |
| 50 | - | |
| 51 | - // get list of group properties...name...text field...is_Sys_admin and is_unit_admin..checkboxes | |
| 52 | - $oPattern = & new PatternEditableListFromQuery($sQuery, $default->groups_table, $aDisplayColumns, $aStoreColumns, $aColumnNames, $aDisplayColumnTypes, $aDatabaseColumnTypes); | |
| 53 | - $oPattern->setUniqueName("groupEdit"); | |
| 54 | - $oPattern->setColumnsRequired(array(1,0,0)); | |
| 55 | - | |
| 56 | - $sToRender .= renderHeading(_("Add Group Properties")); | |
| 57 | - $sToRender .= "<table>\n"; | |
| 58 | - $sToRender .= "<tr></tr>\n"; | |
| 59 | - $sToRender .= "<tr>\n"; | |
| 60 | - $sToRender .= "<td>" . $oPattern->render() . "</td>\n"; | |
| 61 | - $sToRender .= "</tr>\n"; | |
| 62 | - $sToRender .= "<tr>\n"; | |
| 63 | - $sToRender .= "</tr>\n"; | |
| 64 | - $sToRender .= "<tr>\n"; | |
| 65 | - $sToRender .= "</tr>\n"; | |
| 66 | - | |
| 67 | - $sToRender .= "<td align=\"right\"><input type=\"image\" src=\"" . KTHtml::getUpdateButton() . "\" value=\"Update\" border=\"0\"/></td>\n"; | |
| 68 | - $sToRender .= "</table>\n"; | |
| 69 | - return $sToRender; | |
| 70 | -} | |
| 71 | - | |
| 72 | - | |
| 73 | -// if fails .. | |
| 74 | -function getAddFailPage() { | |
| 75 | - | |
| 76 | - global $default; | |
| 77 | - | |
| 78 | - $sToRender .= renderHeading(_("Edit Group Properties")); | |
| 79 | - $sToRender .= "<table>\n"; | |
| 80 | - $sToRender .= "<tr><td><b>" . _("Add Group Failed") . ":</b></td></tr>\n"; | |
| 81 | - $sToRender .= "<tr>\n"; | |
| 82 | - $sToRender .= "<td>" . _("Sorry, Group Already Exists!") . "</td>\n"; | |
| 83 | - $sToRender .= "</tr>\n"; | |
| 84 | - $sToRender .= "<tr>\n"; | |
| 85 | - $sToRender .= "</tr>\n"; | |
| 86 | - $sToRender .= "<tr>\n"; | |
| 87 | - $sToRender .= "<td align = right><a href=\"$default->rootUrl/control.php?action=listGroups\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 88 | - $sToRender .= "</tr>\n"; | |
| 89 | - $sToRender .= "</table>\n"; | |
| 90 | - | |
| 91 | - return $sToRender; | |
| 92 | - | |
| 93 | -} | |
| 94 | - | |
| 95 | -// if its the manual edit page..then display normally | |
| 96 | -function getEditPage($iGroupID) { | |
| 97 | - global $default; | |
| 98 | - $oGroup = null; | |
| 99 | - if (isset($iGroupID)) { | |
| 100 | - $oGroup = Group::get($iGroupID); | |
| 101 | - | |
| 102 | - } | |
| 103 | - | |
| 104 | - $sToRender .= renderHeading(_("Edit Group Properties")); | |
| 105 | - $sToRender .= "<table>\n"; | |
| 106 | - $sToRender .= "<tr></tr>\n"; | |
| 107 | - $sToRender .= "<tr>\n"; | |
| 108 | - $sToRender .= "<td>" . _("Group Name") . ": </td><td>" . getGroupDisplay($oGroup) . "</td>\n"; | |
| 109 | - $sToRender .= "</tr>\n"; | |
| 110 | - $sToRender .= "<tr>\n"; | |
| 111 | - $sToRender .= "</tr>\n"; | |
| 112 | - $sToRender .= "<tr>\n"; | |
| 113 | - | |
| 114 | - // if a group selected...show checkboxes | |
| 115 | - if (isset($iGroupID)) { | |
| 116 | - $sToRender .= "</tr>\n"; | |
| 117 | - $sToRender .= "<tr>\n"; | |
| 118 | - $sToRender .= "<td>" . _("Unit Administrator") . ": </td><td>" . getUnitAdminCheckBox($oGroup) . "</td>\n"; | |
| 119 | - $sToRender .= "</tr>\n"; | |
| 120 | - if (Permission::userIsSystemAdministrator()) { | |
| 121 | - $sToRender .= "<tr>\n"; | |
| 122 | - $sToRender .= "<td>" . _("System Administrator") . ": </td><td>" . getSysAdminCheckBox($oGroup) . "</td>\n"; | |
| 123 | - $sToRender .= "</tr>\n"; | |
| 124 | - } | |
| 125 | - $sToRender .= "<tr>\n"; | |
| 126 | - $sToRender .= "</tr>\n"; | |
| 127 | - } | |
| 128 | - | |
| 129 | - | |
| 130 | - $sToRender .= "<tr>\n"; | |
| 131 | - $sToRender .= "</tr>\n"; | |
| 132 | - $sToRender .= "<td></td>" . getUpdateButton($oGroup); | |
| 133 | - $sToRender .= getCancelButton($oGroup); | |
| 134 | - $sToRender .= "</table>\n"; | |
| 135 | - | |
| 136 | - | |
| 137 | - return $sToRender; | |
| 138 | -} | |
| 139 | - | |
| 140 | -// if edition is successful print otu success page | |
| 141 | -function getEditPageSuccess() { | |
| 142 | - global $default; | |
| 143 | - | |
| 144 | - $sToRender .= renderHeading(_("Edit Group Properties")); | |
| 145 | - $sToRender .= "<table>\n"; | |
| 146 | - $sToRender .= "<tr><td><b>" . _("Success") . "!</b></td></tr>\n"; | |
| 147 | - $sToRender .= "<tr></tr>\n"; | |
| 148 | - $sToRender .= "<tr><td>" . _("The Group was successfully modified") . "</td></tr>\n"; | |
| 149 | - $sToRender .= "<tr></tr>\n"; | |
| 150 | - $sToRender .= "<tr></tr>\n"; | |
| 151 | - $sToRender .= "<tr>\n"; | |
| 152 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listGroups\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 153 | - $sToRender .= "</tr>\n"; | |
| 154 | - $sToRender .= "</table>\n"; | |
| 155 | - | |
| 156 | - | |
| 157 | - return $sToRender; | |
| 158 | -} | |
| 159 | - | |
| 160 | - | |
| 161 | -// gets the page if edition fails | |
| 162 | -function getEditPageFail() { | |
| 163 | - global $default; | |
| 164 | - | |
| 165 | - $sToRender .= renderHeading(_("Edit Group Properties")); | |
| 166 | - | |
| 167 | - $sToRender .= "<table>\n"; | |
| 168 | - $sToRender .= "<tr><td><b>" . _("Failure") . "!</b></td></tr>\n"; | |
| 169 | - $sToRender .= "<tr></tr>\n"; | |
| 170 | - $sToRender .= "<tr><td>" . _("The Group modification Failed!") . "</td></tr>\n"; | |
| 171 | - $sToRender .= "<tr></tr>\n"; | |
| 172 | - $sToRender .= "<tr></tr>\n"; | |
| 173 | - $sToRender .= "<tr>\n"; | |
| 174 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listGroups\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 175 | - $sToRender .= "</tr>\n"; | |
| 176 | - $sToRender .= "</table>\n"; | |
| 177 | - | |
| 178 | - | |
| 179 | - return $sToRender; | |
| 180 | -} | |
| 181 | - | |
| 182 | -// show the list box when no group selected | |
| 183 | -// then shows a text box with the group's name | |
| 184 | -function getGroupDisplay($oGroup) { | |
| 185 | - global $default; | |
| 186 | - if (!isset($oGroup)) { | |
| 187 | - if (Permission::userIsSystemAdministrator()) { | |
| 188 | - // if this is the system administrator, prepend group names with unit name | |
| 189 | - $oPatternListBox = & new PatternListBox($default->groups_table, "name", "id", "fGroupID"); | |
| 190 | - $oPatternListBox->setFromClause("LEFT OUTER JOIN groups_units_link GUL on ST.id=GUL.group_id " . | |
| 191 | - "LEFT OUTER JOIN units_lookup UL on GUL.unit_id=UL.id"); | |
| 192 | - $oPatternListBox->setCompositeDisplayName("DISTINCT COALESCE(CONCAT(CONCAT(UL.name, '-'),ST.name),ST.name)"); | |
| 193 | - } else if (Permission::userIsUnitAdministrator()) { | |
| 194 | - // else if this is a unit administrator, only display the groups in your unit | |
| 195 | - $oPatternListBox = & new PatternListBox($default->groups_table, "name", "id", "fGroupID"); | |
| 196 | - $oPatternListBox->setFromClause("INNER JOIN $default->groups_units_table GUL on ST.id=GUL.group_id"); | |
| 197 | - $oPatternListBox->setWhereClause("GUL.unit_id=" . User::getUnitID($_SESSION["userID"])); | |
| 198 | - | |
| 199 | - $oUnassignedUsersLB = & new PatternListBox($default->groups_table, "name", "id", "fGroupID"); | |
| 200 | - $oUnassignedUsersLB->setFromClause("LEFT OUTER JOIN $default->groups_units_table GUL ON ST.id=GUL.group_id"); | |
| 201 | - $oUnassignedUsersLB->setWhereClause("ISNULL(GUL.unit_id) AND ST.name <> 'Anonymous' AND ST.name <> 'System Administrators'"); | |
| 202 | - $oPatternListBox->setAdditionalEntries($oUnassignedUsersLB->getEntries()); | |
| 203 | - } | |
| 204 | - | |
| 205 | - $oPatternListBox->setPostBackOnChange(true); | |
| 206 | - return $oPatternListBox->render(); | |
| 207 | - } else { | |
| 208 | - return "<input type=\"hidden\" name=\"fGroupID\" value=\"" . $oGroup->iId . "\">\n" . | |
| 209 | - "<input size = \"40\" type=\"text\" name=\"fGroupName\" value=\"" . $oGroup->getName() . "\">"; | |
| 210 | - } | |
| 211 | - | |
| 212 | -} | |
| 213 | - | |
| 214 | - | |
| 215 | -// returns the checkbox ticked or unticked | |
| 216 | -function getUnitAdminCheckBox($oGroup) { | |
| 217 | - if (!isset($oGroup)) { | |
| 218 | - return ""; | |
| 219 | - } else { | |
| 220 | - return "<input type=\"checkbox\" name=\"fGroupUnitAdmin\" " . ($oGroup->getUnitAdmin() ? "CHECKED " : " ") . " />"; | |
| 221 | - } | |
| 222 | -} | |
| 223 | - | |
| 224 | -// returns the checkbox ticked or unticked | |
| 225 | -function getSysAdminCheckBox($oGroup) { | |
| 226 | - if (!isset($oGroup)) { | |
| 227 | - return ""; | |
| 228 | - } else { | |
| 229 | - return "<input type=\"checkbox\" name=\"fGroupSysAdmin\" " . ($oGroup->getSysAdmin() ? "CHECKED " : " ") . " />"; | |
| 230 | - } | |
| 231 | - | |
| 232 | -} | |
| 233 | - | |
| 234 | -// gets the updatebutton when a group is selected | |
| 235 | -function getUpdateButton($oGroup) { | |
| 236 | - global $default; | |
| 237 | - if (!isset($oGroup)) { | |
| 238 | - return _("Please select a Group") . ": "; | |
| 239 | - } else { | |
| 240 | - return "<td align = right><input type=\"image\" src =\"" . KTHtml::getUpdateButton() . "\" value=\"submit\" border=\"0\"/></td>\n"; | |
| 241 | - } | |
| 242 | -} | |
| 243 | - | |
| 244 | -// gets the cancel button when a group is selected | |
| 245 | -function getCancelButton($oGroup) { | |
| 246 | - global $default; | |
| 247 | - if (!isset($oGroup)) { | |
| 248 | - return "<td align = right><a href=\"$default->rootUrl/control.php?action=groupManagement\"><img src =\"" . KTHtml::getCancelButton() . "\" value=\"cancel\" border=\"0\"/></a></td>\n"; | |
| 249 | - } else { | |
| 250 | - return "<td align = right><a href=\"$default->rootUrl/control.php?action=listGroups\"><img src =\"" . KTHtml::getCancelButton() . "\" border=\"0\"/></a></td>\n"; | |
| 251 | - } | |
| 252 | -} | |
| 253 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/groupManagement.php
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | require_once(KT_LIB_DIR . '/users/User.inc'); |
| 6 | 6 | require_once(KT_LIB_DIR . '/groups/GroupUtil.php'); |
| 7 | 7 | require_once(KT_LIB_DIR . '/groups/Group.inc'); |
| 8 | +require_once(KT_LIB_DIR . '/unitmanagement/Unit.inc'); | |
| 8 | 9 | |
| 9 | 10 | require_once(KT_LIB_DIR . "/templating/templating.inc.php"); |
| 10 | 11 | require_once(KT_LIB_DIR . "/dispatcher.inc.php"); |
| ... | ... | @@ -66,6 +67,20 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher { |
| 66 | 67 | $edit_fields[] = new KTStringWidget('Group Name','A short name for the group. e.g. <strong>administrators</strong>.', 'group_name', $oGroup->getName(), $this->oPage, true); |
| 67 | 68 | $edit_fields[] = new KTCheckboxWidget('Unit Administrators','Should all the members of this group be given <strong>unit</strong> administration privilidges?', 'is_unitadmin', $oGroup->getUnitAdmin(), $this->oPage, false); |
| 68 | 69 | $edit_fields[] = new KTCheckboxWidget('System Administrators','Should all the members of this group be given <strong>system</strong> administration privilidges?', 'is_sysadmin', $oGroup->getSysAdmin(), $this->oPage, false); |
| 70 | + | |
| 71 | + // grab all units. | |
| 72 | + $unit = $oGroup->getUnit(); | |
| 73 | + if ($unit == null) { $unitId = 0; } | |
| 74 | + else { $unitId = $unit->getID(); } | |
| 75 | + | |
| 76 | + | |
| 77 | + $oUnits = Unit::getList(); | |
| 78 | + $vocab = array(); | |
| 79 | + $vocab[0] = 'No Unit'; | |
| 80 | + foreach ($oUnits as $oUnit) { $vocab[$oUnit->getID()] = $oUnit->getName(); } | |
| 81 | + $aOptions = array('vocab' => $vocab); | |
| 82 | + | |
| 83 | + $edit_fields[] = new KTLookupWidget('Unit','Which Unit is this group part of?', 'unit_id', $unitId, $this->oPage, false, null, null, $aOptions); | |
| 69 | 84 | |
| 70 | 85 | $oTemplating = new KTTemplating; |
| 71 | 86 | $oTemplate = $oTemplating->loadTemplate("ktcore/principals/editgroup"); |
| ... | ... | @@ -96,6 +111,12 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher { |
| 96 | 111 | $oGroup->setUnitAdmin($is_unitadmin); |
| 97 | 112 | $oGroup->setSysAdmin($is_sysadmin); |
| 98 | 113 | |
| 114 | + $unit_id = KTUtil::arrayGet($_REQUEST, 'unit_id', 0); | |
| 115 | + if ($unit_id == 0) { // not set, or set to 0. | |
| 116 | + $oGroup->clearUnit(); // safe. | |
| 117 | + } else { | |
| 118 | + $oGroup->setUnit($unit_id); | |
| 119 | + } | |
| 99 | 120 | |
| 100 | 121 | $res = $oGroup->update(); |
| 101 | 122 | if (($res == false) || (PEAR::isError($res))) { return $this->errorRedirectToMain('Failed to set group details.'); } |
| ... | ... | @@ -256,6 +277,12 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher { |
| 256 | 277 | return $oTemplate->render($aTemplateData); |
| 257 | 278 | } |
| 258 | 279 | |
| 280 | + function _getUnitName($oGroup) { | |
| 281 | + $u = $oGroup->getUnit(); | |
| 282 | + | |
| 283 | + return $u->getName(); | |
| 284 | + } | |
| 285 | + | |
| 259 | 286 | // FIXME copy-paste ... |
| 260 | 287 | function do_updateGroupMembers() { |
| 261 | 288 | $group_id = KTUtil::arrayGet($_REQUEST, 'group_id'); | ... | ... |
presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/addOrgBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add an organisation | |
| 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.orgmanagement | |
| 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/unitmanagement/UnitOrganisationLink.inc"); | |
| 31 | -require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 32 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 33 | -require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 34 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 35 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 36 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); | |
| 37 | -require_once("addOrgUI.inc"); | |
| 38 | - | |
| 39 | -if (checkSession()) { | |
| 40 | - $oPatternCustom = & new PatternCustom(); | |
| 41 | - $oPatternCustom->setHtml(getPage()); | |
| 42 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 43 | - $main->setCentralPayload($oPatternCustom); | |
| 44 | - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/create.php?fRedirectURL=".urlencode("$default->rootUrl/control.php?action=addOrgSuccess&fedit=1")); | |
| 45 | - $main->setHasRequiredFields(true); | |
| 46 | - $main->render(); | |
| 47 | -} | |
| 48 | -?> | |
| 49 | 0 | \ No newline at end of file |
presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/addOrgSuccess.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add an organisation success page. | |
| 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.orgmanagement | |
| 26 | - */ | |
| 27 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 28 | - | |
| 29 | -KTUtil::extractGPC('fSuccess'); | |
| 30 | - | |
| 31 | -// XXX: copious default | |
| 32 | -global $default; | |
| 33 | - | |
| 34 | -if(checkSession()) { | |
| 35 | - | |
| 36 | - // include the page template (with navbar) | |
| 37 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 38 | - | |
| 39 | - $sToRender .= renderHeading(_("Add Organisation")); | |
| 40 | - $sToRender .= "<table>\n"; | |
| 41 | - $sToRender .= "<tr>\n"; | |
| 42 | - if($fSuccess) { | |
| 43 | - $sToRender .= "<td>" . _("Organisation added Successfully!") . "</td>\n"; | |
| 44 | - } else { | |
| 45 | - $sToRender .= "<td>" . _("Organisation not added. Organisation may already exist!") . "</td>\n"; | |
| 46 | - } | |
| 47 | - $sToRender .= "</tr>\n"; | |
| 48 | - $sToRender .= "<tr></tr>\n"; | |
| 49 | - $sToRender .= "<tr></tr>\n"; | |
| 50 | - $sToRender .= "<tr></tr>\n"; | |
| 51 | - $sToRender .= "<tr></tr>\n"; | |
| 52 | - $sToRender .= "<tr>\n"; | |
| 53 | - $sToRender .= "<td align = right><a href=\"$default->rootUrl/control.php?action=listOrg\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 54 | - $sToRender .= "</tr>\n"; | |
| 55 | - $sToRender .= "</table>\n"; | |
| 56 | - | |
| 57 | - $oPatternCustom = & new PatternCustom(); | |
| 58 | - $oPatternCustom->setHtml($sToRender); | |
| 59 | - $main->setCentralPayload($oPatternCustom); | |
| 60 | - $main->render(); | |
| 61 | -} | |
| 62 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/addOrgUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add an organisation 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.orgmanagement | |
| 26 | - */ | |
| 27 | -// get add pages | |
| 28 | -function getPage() { | |
| 29 | - | |
| 30 | - global $default; | |
| 31 | - $aDisplayRowNames = array(_("Organisation Name") . ":"); | |
| 32 | - $aParameterNumbers = array(0); | |
| 33 | - $aDisplayColumnTypes = array(1); | |
| 34 | - $aRequired = array(1); | |
| 35 | - | |
| 36 | - // create a text field that is required | |
| 37 | - $oPatternCreate = & new PatternCreate("Organisation", "orgmanagement/Organisation.inc",$aDisplayRowNames, $aParameterNumbers, $aDisplayColumnTypes, $aRequired); | |
| 38 | - $oPatternCreate->setUniqueName("organisation"); | |
| 39 | - | |
| 40 | - $sToRender .= renderHeading(_("Add Organisation")); | |
| 41 | - $sToRender .= "<table>\n"; | |
| 42 | - $sToRender .= "<tr></tr>\n"; | |
| 43 | - $sToRender .= "<tr>\n"; | |
| 44 | - $sToRender .= "<td>" . $oPatternCreate->render() . "</td>\n"; | |
| 45 | - $sToRender .= "</tr>\n"; | |
| 46 | - $sToRender .= "<tr>\n"; | |
| 47 | - $sToRender .= "</tr>\n"; | |
| 48 | - $sToRender .= "<tr>\n"; | |
| 49 | - $sToRender .= "</tr>\n"; | |
| 50 | - $sToRender .= "<td align = right><input type=\"image\" src =\"" . KTHtml::getAddButton() . "\" value=\"Submit\" border=\"0\"/>"; | |
| 51 | - $sToRender .= getCancelButton("listOrg") . "</td>\n"; | |
| 52 | - $sToRender .= "</table>\n"; | |
| 53 | - | |
| 54 | - return $sToRender; | |
| 55 | - | |
| 56 | - | |
| 57 | - | |
| 58 | -} | |
| 59 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/editOrgBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit organisation. | |
| 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.orgmanagement | |
| 26 | - */ | |
| 27 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 28 | - | |
| 29 | -KTUtil::extractGPC('fForStore', 'fOrgID', 'fOrgName'); | |
| 30 | - | |
| 31 | -if (checkSession()) { | |
| 32 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 33 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); | |
| 34 | - require_once("editOrgUI.inc"); | |
| 35 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/orgmanagement/Organisation.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 40 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 41 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 42 | - | |
| 43 | - | |
| 44 | - $oPatternCustom = & new PatternCustom(); | |
| 45 | - | |
| 46 | - // if a new Org has been added | |
| 47 | - // coming from manual edit page | |
| 48 | - if (isset($fForStore)) { | |
| 49 | - $oOrg = Organisation::get($fOrgID); | |
| 50 | - $oOrg->setName($fOrgName); | |
| 51 | - | |
| 52 | - if ($oOrg->update()) { | |
| 53 | - // if successfull print out success message | |
| 54 | - $oPatternCustom->setHtml(getEditPageSuccess()); | |
| 55 | - | |
| 56 | - } else { | |
| 57 | - // if fail print out fail message | |
| 58 | - $oPatternCustom->setHtml(getEditPageFail()); | |
| 59 | - } | |
| 60 | - } else if (isset($fOrgID)){ | |
| 61 | - // post back on Org select from manual edit page | |
| 62 | - $oPatternCustom->setHtml(getEditPage($fOrgID)); | |
| 63 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForStore=1"); | |
| 64 | - | |
| 65 | - | |
| 66 | - } else { | |
| 67 | - // if nothing happens...just reload edit page | |
| 68 | - $oPatternCustom->setHtml(getEditPage(null)); | |
| 69 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 70 | - | |
| 71 | - } | |
| 72 | - //render the page | |
| 73 | - $main->setCentralPayload($oPatternCustom); | |
| 74 | - $main->render(); | |
| 75 | -} | |
| 76 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/editOrgUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit organisation 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.orgmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// if its the manual edit page..then display normally | |
| 29 | -function getEditPage($iOrgID) { | |
| 30 | - global $default; | |
| 31 | - $oOrg = null; | |
| 32 | - if (isset($iOrgID)) { | |
| 33 | - $oOrg = Organisation::get($iOrgID); | |
| 34 | - } | |
| 35 | - | |
| 36 | - $sToRender .= renderHeading(_("Edit Organisation")); | |
| 37 | - $sToRender .= "<table>\n"; | |
| 38 | - $sToRender .= "<tr><td>" . _("Please select an Organisation") . ":</td></tr>\n"; | |
| 39 | - $sToRender .= "<tr>\n"; | |
| 40 | - $sToRender .= "<td>" . _("Organisation Name") . ": </td><td>" . getOrgDisplay($oOrg) . "</td>\n"; | |
| 41 | - $sToRender .= "</tr>\n"; | |
| 42 | - $sToRender .= "<tr>\n"; | |
| 43 | - $sToRender .= "</tr>\n"; | |
| 44 | - $sToRender .= "<tr>\n"; | |
| 45 | - $sToRender .= "<tr>\n"; | |
| 46 | - $sToRender .= "</tr>\n"; | |
| 47 | - $sToRender .= "<td></td>" . getUpdateButton($oOrg); | |
| 48 | - $sToRender .= getCancelButton($oOrg); | |
| 49 | - $sToRender .= "</table>\n"; | |
| 50 | - | |
| 51 | - return $sToRender; | |
| 52 | -} | |
| 53 | - | |
| 54 | -// if edition is successful print otu success page | |
| 55 | -function getEditPageSuccess() { | |
| 56 | - global $default; | |
| 57 | - | |
| 58 | - $sToRender .= renderHeading(_("Edit Organisation")); | |
| 59 | - $sToRender .= "<table>\n"; | |
| 60 | - $sToRender .= "<tr><td><b>" . _("Success") . "!</b></td></tr>\n"; | |
| 61 | - $sToRender .= "<tr></tr>\n"; | |
| 62 | - $sToRender .= "<tr><td>" . _("The Organisation was successfully modified") . "</td></tr>\n"; | |
| 63 | - $sToRender .= "<tr></tr>\n"; | |
| 64 | - $sToRender .= "<tr></tr>\n"; | |
| 65 | - $sToRender .= "<tr>\n"; | |
| 66 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listOrg\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 67 | - $sToRender .= "</tr>\n"; | |
| 68 | - $sToRender .= "</table>\n"; | |
| 69 | - | |
| 70 | - | |
| 71 | - return $sToRender; | |
| 72 | -} | |
| 73 | - | |
| 74 | - | |
| 75 | -// gets the page if edition fails | |
| 76 | -function getEditPageFail() { | |
| 77 | - global $default; | |
| 78 | - | |
| 79 | - $sToRender .= renderHeading(_("Edit Organisation")); | |
| 80 | - $sToRender .= "<table>\n"; | |
| 81 | - $sToRender .= "<tr><td><b>" . strtoupper(_("Failure")) . "!</b></td></tr>\n"; | |
| 82 | - $sToRender .= "<tr></tr>\n"; | |
| 83 | - $sToRender .= "<tr><td>" . _("Organisation modification Failed!") . "</td></tr>\n"; | |
| 84 | - $sToRender .= "<tr></tr>\n"; | |
| 85 | - $sToRender .= "<tr></tr>\n"; | |
| 86 | - $sToRender .= "<tr>\n"; | |
| 87 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listOrg\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 88 | - $sToRender .= "</tr>\n"; | |
| 89 | - $sToRender .= "</table>\n"; | |
| 90 | - | |
| 91 | - | |
| 92 | - return $sToRender; | |
| 93 | -} | |
| 94 | - | |
| 95 | -// show the list box when no Org selected | |
| 96 | -// then shows a text box with the Org's name | |
| 97 | -function getOrgDisplay($oOrg) { | |
| 98 | - global $default; | |
| 99 | - if (!isset($oOrg)) { | |
| 100 | - $oPatternListBox = & new PatternListBox($default->organisations_table, "name", "id", "fOrgID"); | |
| 101 | - //$oPatternListBox->setIncludeDefaultValue(true); | |
| 102 | - $oPatternListBox->setPostBackOnChange(true); | |
| 103 | - return $oPatternListBox->render(); | |
| 104 | - } else { | |
| 105 | - return "<input type=\"hidden\" name=\"fOrgID\" value=\"" . $oOrg->iId . "\">\n" . | |
| 106 | - "<input size = \"40\" type=\"text\" name=\"fOrgName\" value=\"" . $oOrg->getName() . "\">"; | |
| 107 | - } | |
| 108 | - | |
| 109 | -} | |
| 110 | - | |
| 111 | - | |
| 112 | -// gets the updatebutton when a Org is selected | |
| 113 | -function getUpdateButton($oOrg) { | |
| 114 | - global $default; | |
| 115 | - if (isset($oOrg)) { | |
| 116 | - return "<td align = right><input type=\"image\" src =\"" . KTHtml::getUpdateButton() . "\" value=\"submit\" border=\"0\"/></td>\n"; | |
| 117 | - } | |
| 118 | -} | |
| 119 | - | |
| 120 | -// gets the cancel button when a Org is selected | |
| 121 | -function getCancelButton($oOrg) { | |
| 122 | - global $default; | |
| 123 | - if (!isset($oOrg)) { | |
| 124 | - return "<td align = right><a href=\"$default->rootUrl/control.php?action=orgManagement\"><img src =\"" . KTHtml::getCancelButton() . "\" value=\"cancel\" border=\"0\"/></a></td>\n"; | |
| 125 | - } else { | |
| 126 | - return "<td align = right><a href=\"$default->rootUrl/control.php?action=listOrg\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a></td>\n"; | |
| 127 | - } | |
| 128 | -} | |
| 129 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/listOrgBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * List organisations. | |
| 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.orgmanagement | |
| 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("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); | |
| 39 | -require_once("listOrgUI.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/orgmanagement/listOrgUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * List organisations 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.orgmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -function getOrganisations() { | |
| 29 | - global $default; | |
| 30 | - /*ok*/ $sQuery = "SELECT org.id as orgID, org.name as name, " . | |
| 31 | - //"'Edit', 'Delete' " . | |
| 32 | - "'Edit'" . | |
| 33 | - "FROM organisations_lookup as org " . | |
| 34 | - "ORDER BY org.name"; | |
| 35 | - //$aColumns = array("name", "Edit", "Delete"); | |
| 36 | - $aColumns = array("name", "Edit"); | |
| 37 | - //$aColumnNames = array(_("Name"), _("Edit"), _("Delete")); | |
| 38 | - $aColumnNames = array(_("Name"), _("Edit")); | |
| 39 | - //$aColumnTypes = array(1,3,3); | |
| 40 | - $aColumnTypes = array(1,3); | |
| 41 | - $aDBColumnArray = array("orgID"); | |
| 42 | - $aQueryStringVariableNames = array("fOrgID"); | |
| 43 | - $aHyperLinkURL = array( 1=> "$default->rootUrl/control.php?action=editOrg"); | |
| 44 | - //2=> "$default->rootUrl/control.php?action=removeOrg"); | |
| 45 | - $oSearchResults = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnNames, "100%", $aHyperLinkURL,$aDBColumnArray,$aQueryStringVariableNames); | |
| 46 | - $oSearchResults->setDisplayColumnHeadings(true); | |
| 47 | - return $oSearchResults->render() ; | |
| 48 | -} | |
| 49 | - | |
| 50 | -function getPage() { | |
| 51 | - global $default; | |
| 52 | - $sToRender .= renderHeading(_("Organisation Management")); | |
| 53 | - | |
| 54 | - // add user link | |
| 55 | - //$sToRender .= getAddLink("addOrg", "Add An Organisation"); | |
| 56 | - $sToRender .= getOrganisations(); | |
| 57 | - return $sToRender; | |
| 58 | -} | |
| 59 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/orgManagement.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +//require_once('../../../../../config/dmsDefaults.php'); | |
| 4 | + | |
| 5 | +require_once(KT_LIB_DIR . '/orgmanagement/Organisation.inc'); | |
| 6 | + | |
| 7 | +require_once(KT_LIB_DIR . "/templating/templating.inc.php"); | |
| 8 | +require_once(KT_LIB_DIR . "/dispatcher.inc.php"); | |
| 9 | +require_once(KT_LIB_DIR . "/templating/kt3template.inc.php"); | |
| 10 | +require_once(KT_LIB_DIR . "/widgets/fieldWidgets.php"); | |
| 11 | + | |
| 12 | +class KTOrgAdminDispatcher extends KTAdminDispatcher { | |
| 13 | + // Breadcrumbs base - added to in methods | |
| 14 | + var $aBreadcrumbs = array( | |
| 15 | + array('action' => 'administration', 'name' => 'Administration'), | |
| 16 | + ); | |
| 17 | + | |
| 18 | + function do_main() { | |
| 19 | + $this->aBreadcrumbs[] = array('action' => 'orgManagement', 'name' => 'Org Management'); | |
| 20 | + $this->oPage->setBreadcrumbDetails('select a organisation'); | |
| 21 | + $this->oPage->setTitle("Organisation Management"); | |
| 22 | + | |
| 23 | + $org_id= KTUtil::arrayGet($_REQUEST, 'org_id', null); | |
| 24 | + if ($org_id === null) { $for_edit = false; } | |
| 25 | + else { $for_edit = true; } | |
| 26 | + | |
| 27 | + $org_list =& Organisation::getList(); | |
| 28 | + | |
| 29 | + $edit_fields = array(); | |
| 30 | + $edit_org = null; | |
| 31 | + if ($for_edit === true) { | |
| 32 | + $oOrg = Organisation::get($org_id); | |
| 33 | + if (PEAR::isError($oOrg) || ($oOrg == false)) { $this->errorRedirectToMain('Invalid Organisation'); } | |
| 34 | + $edit_fields[] = new KTStringWidget('Organisation Name','The organisation\'s visible name. e.g. <strong>Tech Support</strong>', 'name', $oOrg->getName(), $this->oPage, true); | |
| 35 | + } | |
| 36 | + | |
| 37 | + $oTemplating = new KTTemplating; | |
| 38 | + $oTemplate = $oTemplating->loadTemplate("ktcore/principals/orgadmin"); | |
| 39 | + $aTemplateData = array( | |
| 40 | + "context" => $this, | |
| 41 | + "for_edit" => $for_edit, | |
| 42 | + "edit_fields" => $edit_fields, | |
| 43 | + "edit_org" => $oOrg, | |
| 44 | + "org_list" => $org_list, | |
| 45 | + ); | |
| 46 | + return $oTemplate->render($aTemplateData); | |
| 47 | + } | |
| 48 | + | |
| 49 | + function do_updateOrg() { | |
| 50 | + $org_id = KTUtil::arrayGet($_REQUEST, 'org_id'); | |
| 51 | + $oOrg = Organisation::get($org_id); | |
| 52 | + if (PEAR::isError($oOrg) || ($oOrg == false)) { | |
| 53 | + $this->errorRedirectToMain('Please specify an organisation.'); | |
| 54 | + exit(0); | |
| 55 | + } | |
| 56 | + | |
| 57 | + $org_name = KTUtil::arrayGet($_REQUEST, 'name', null); | |
| 58 | + if (empty($org_name)) { | |
| 59 | + $this->errorRedirectToMain('Please specify an org name.'); | |
| 60 | + exit(0); | |
| 61 | + } | |
| 62 | + | |
| 63 | + $this->startTransaction(); | |
| 64 | + $oOrg->setName($org_name); | |
| 65 | + $res = $oOrg->update(); | |
| 66 | + if (PEAR::isError($res)) { | |
| 67 | + $this->errorRedirectToMain('Failed to update org name.'); | |
| 68 | + exit(0); | |
| 69 | + } | |
| 70 | + | |
| 71 | + $this->commitTransaction(); | |
| 72 | + $this->successRedirectToMain('Org name changed to "' . $org_name . '"'); | |
| 73 | + } | |
| 74 | + | |
| 75 | +} | |
| 76 | + | |
| 77 | + | |
| 78 | +?> | |
| 0 | 79 | \ No newline at end of file | ... | ... |
presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/removeOrgBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove organisation. | |
| 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.orgmanagement | |
| 26 | - */ | |
| 27 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 28 | - | |
| 29 | -KTUtil::extractGPC('fForDelete', 'fOrgID', 'fOrgName'); | |
| 30 | - | |
| 31 | -if (checkSession()) { | |
| 32 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 33 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); | |
| 34 | - require_once("removeOrgUI.inc"); | |
| 35 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/orgmanagement/Organisation.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 40 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 41 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 42 | - | |
| 43 | - $oPatternCustom = & new PatternCustom(); | |
| 44 | - | |
| 45 | - // get main page | |
| 46 | - if (isset($fOrgID)) { | |
| 47 | - $oPatternCustom->setHtml(getDeletePage($fOrgID)); | |
| 48 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForDelete=1"); | |
| 49 | - // get delete page | |
| 50 | - } | |
| 51 | - else { | |
| 52 | - $oPatternCustom->setHtml(getDeletePage(null)); | |
| 53 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 54 | - } | |
| 55 | - | |
| 56 | - // if delete entry | |
| 57 | - if (isset($fForDelete)) { | |
| 58 | - $oOrg = Organisation::get($fOrgID); | |
| 59 | - $oOrg->setName($fOrgName); | |
| 60 | - | |
| 61 | - if ($oOrg->delete()) { | |
| 62 | - $oPatternCustom->setHtml(getDeleteSuccessPage()); | |
| 63 | - } else { | |
| 64 | - $oPatternCustom->setHtml(getDeleteFailPage()); | |
| 65 | - } | |
| 66 | - } | |
| 67 | - | |
| 68 | - $main->setCentralPayload($oPatternCustom); | |
| 69 | - $main->render(); | |
| 70 | -} | |
| 71 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/orgmanagement/removeOrgUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove organisation 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.orgmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// gets the delete stuff | |
| 29 | -function getDeletePage($iOrgID) { | |
| 30 | - global $default; | |
| 31 | - $oOrg = null; | |
| 32 | - if (isset($iOrgID)) { | |
| 33 | - $oOrg = Organisation::get($iOrgID); | |
| 34 | - $sHeading .= "<b>" . _("Are you sure you wish to Remove this Organisation?") . "</b>\n"; | |
| 35 | - } else { | |
| 36 | - $oOrg = null; | |
| 37 | - $sHeading .= _("Please select an Organisation") . ":"; | |
| 38 | - } | |
| 39 | - | |
| 40 | - $sToRender .= renderHeading(_("Remove Organisation")); | |
| 41 | - $sToRender .= "<table>\n"; | |
| 42 | - $sToRender .= "<tr><td>$sHeading</td></tr>\n"; | |
| 43 | - $sToRender .= "<tr>\n"; | |
| 44 | - $sToRender .= "<td>" . _("Organisation Name") . ": " . getOrgDisplay($oOrg) . "</td>\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 .= getDeleteButton($oOrg); | |
| 55 | - $sToRender .= "</table>\n"; | |
| 56 | - | |
| 57 | - return $sToRender; | |
| 58 | -} | |
| 59 | - | |
| 60 | -// get successfully deletion page | |
| 61 | -function getDeleteSuccessPage() { | |
| 62 | - | |
| 63 | - global $default; | |
| 64 | - | |
| 65 | - $sToRender .= renderHeading(_("Remove Organisation")); | |
| 66 | - $sToRender .= "<table>\n"; | |
| 67 | - $sToRender .= "<tr>\n"; | |
| 68 | - $sToRender .= "<td><b>" . _("Organisation Successfully Removed!") . "</b></td>\n"; | |
| 69 | - $sToRender .= "</tr>\n"; | |
| 70 | - $sToRender .= "<tr></tr>\n"; | |
| 71 | - $sToRender .= "<tr></tr>\n"; | |
| 72 | - $sToRender .= "<tr></tr>\n"; | |
| 73 | - $sToRender .= "<tr></tr>\n"; | |
| 74 | - $sToRender .= "<tr>\n"; | |
| 75 | - $sToRender .= "<td align = right><a href=\"$default->rootUrl/control.php?action=listOrg\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 76 | - $sToRender .= "</tr>\n"; | |
| 77 | - $sToRender .= "</table>\n"; | |
| 78 | - | |
| 79 | - return $sToRender; | |
| 80 | -} | |
| 81 | - | |
| 82 | -// get deletion failed page | |
| 83 | -function getDeleteFailPage() { | |
| 84 | - | |
| 85 | - global $default; | |
| 86 | - | |
| 87 | - $sToRender .= renderHeading(_("Remove Organisation")); | |
| 88 | - $sToRender .= "<table>\n"; | |
| 89 | - $sToRender .= "<tr>\n"; | |
| 90 | - $sToRender .= "<td><b>" . _("Deletion Failed!") . "</b></td>\n"; | |
| 91 | - $sToRender .= "</tr>\n"; | |
| 92 | - $sToRender .= "<tr></tr>\n"; | |
| 93 | - $sToRender .= "<tr></tr>\n"; | |
| 94 | - $sToRender .= "<tr><td>" . _("Please Ensure that ALL Units has been Removed the Organisation it belongs to") . "</td></tr>\n"; | |
| 95 | - $sToRender .= "<tr></tr>\n"; | |
| 96 | - $sToRender .= "</tr>\n"; | |
| 97 | - $sToRender .= "<tr><td align = right><a href=\"$default->rootUrl/control.php?action=listOrg\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td></tr>\n"; | |
| 98 | - $sToRender .= "</table>\n"; | |
| 99 | - | |
| 100 | - return $sToRender; | |
| 101 | -} | |
| 102 | - | |
| 103 | -// show listbox...or the text name | |
| 104 | -function getOrgDisplay($oOrg) { | |
| 105 | - global $default; | |
| 106 | - if (!isset($oOrg)) { | |
| 107 | - $oPatternListBox = & new PatternListBox($default->organisations_table, "name", "id", "fOrgID"); | |
| 108 | - $oPatternListBox->setIncludeDefaultValue(true); | |
| 109 | - $oPatternListBox->setPostBackOnChange(true); | |
| 110 | - return $oPatternListBox->render(); | |
| 111 | - } else { | |
| 112 | - return "<input type=\"hidden\" name=\"fOrgID\" value=\"" . $oOrg->iId . "\">\n" . | |
| 113 | - "<b>" . $oOrg->getName() . "</b>"; | |
| 114 | - } | |
| 115 | - | |
| 116 | -} | |
| 117 | - | |
| 118 | - | |
| 119 | -// show delete button | |
| 120 | -function getDeleteButton($oOrg) { | |
| 121 | - global $default; | |
| 122 | - if (isset($oOrg)) { | |
| 123 | - return "<td align = right><input type=\"image\" src =\"" . KTHtml::getDeleteButton() . "\" value=\"submit\" border=\"0\"/></td>\n". | |
| 124 | - "<td align = right><a href=\"$default->rootUrl/control.php?action=listOrg\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a></td>\n"; | |
| 125 | - } | |
| 126 | -} | |
| 127 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/addUnitBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add a unit. | |
| 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.unitmanagement | |
| 26 | - */ | |
| 27 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 28 | - | |
| 29 | -KTUtil::extractGPC('fForStore', 'fOrgID', 'fUnitName'); | |
| 30 | - | |
| 31 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 32 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 33 | -require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | |
| 34 | -require_once("$default->fileSystemRoot/lib/orgmanagement/Organisation.inc"); | |
| 35 | -require_once("$default->fileSystemRoot/lib/unitmanagement/UnitOrganisationLink.inc"); | |
| 36 | -require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 37 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 38 | -require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 39 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 40 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 41 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); | |
| 42 | -require_once("addUnitUI.inc"); | |
| 43 | - | |
| 44 | -if (checkSession()) { | |
| 45 | - | |
| 46 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 47 | - $oPatternCustom = & new PatternCustom(); | |
| 48 | - | |
| 49 | - if (isset($fFolderID)) { | |
| 50 | - | |
| 51 | - if (isset($fForStore)) { | |
| 52 | - if($fUnitName != "" and $fOrgID != "" and $fFolderID != "") { | |
| 53 | - // #2944 a folder will be created for this unit, so check if there is already a folder with the name | |
| 54 | - // of the unit before creating the unit | |
| 55 | - $oFolder = new Folder($fUnitName, $fUnitName . " " . _("Unit Root Folder"), $fFolderID, $_SESSION["userID"], 0); | |
| 56 | - if (!$oFolder->exists()) { | |
| 57 | - | |
| 58 | - $oUnit = new Unit($fUnitName, $fFolderID); | |
| 59 | - | |
| 60 | - // if creation is successfull..get the unit id | |
| 61 | - if ($oUnit->create()) { | |
| 62 | - $unitID = $oUnit->getID(); | |
| 63 | - $oUnitOrg = new UnitOrganisationLink($unitID,$fOrgID); | |
| 64 | - | |
| 65 | - if($oUnitOrg->create()) { | |
| 66 | - // if successfull print out success message | |
| 67 | - $oPatternCustom->setHtml(getAddPageSuccess()); | |
| 68 | - } else { | |
| 69 | - // if fail print out fail message | |
| 70 | - $oPatternCustom->setHtml(getAddToOrgFail()); | |
| 71 | - } | |
| 72 | - } else { | |
| 73 | - // if fail print out fail message | |
| 74 | - $oPatternCustom->setHtml(getAddPageFail(_("The Unit was not added. Unit Name Already exists!"))); | |
| 75 | - } | |
| 76 | - } else { | |
| 77 | - // #2944 failed with duplicate folder error message | |
| 78 | - $oPatternCustom->setHtml(getAddPageFail(_("The folder") . $fUnitName . _("already exists, please rename folder before creating this unit."))); | |
| 79 | - } | |
| 80 | - } else { | |
| 81 | - $oPatternCustom->setHtml(getPageFail()); | |
| 82 | - } | |
| 83 | - | |
| 84 | - } else { | |
| 85 | - // display add unit page | |
| 86 | - $oPatternCustom->setHtml(getAddPage()); | |
| 87 | - $oPatternCustom->addHtml(renderBrowsePage($fFolderID)); | |
| 88 | - $main->setHasRequiredFields(true); | |
| 89 | - $main->setFormAction($_SERVER["PHP_SELF"]. "?fForStore=1&fFolderID=$fFolderID"); | |
| 90 | - | |
| 91 | - } | |
| 92 | - $main->setCentralPayload($oPatternCustom); | |
| 93 | - $main->render(); | |
| 94 | - } | |
| 95 | -} | |
| 96 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/addUnitToOrgBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Map unit to organisation. | |
| 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.unitmanagement | |
| 26 | - */ | |
| 27 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 28 | - | |
| 29 | -KTUtil::extractGPC('fAdd', 'fForStore', 'fOrgID', 'fUnitID', 'fUnitName'); | |
| 30 | - | |
| 31 | -if (checkSession()) { | |
| 32 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 33 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 34 | - require_once("addUnitToOrgUI.inc"); | |
| 35 | - require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/unitmanagement/UnitOrganisationLink.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/orgmanagement/Organisation.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/security/Permission.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 | - $oPatternCustom->addHtml(renderHeading(_("Add Unit to an Organisation"))); | |
| 48 | - | |
| 49 | - if (isset($fUnitID)) { | |
| 50 | - if ($fOrgID == "" && $fAdd == 1){ | |
| 51 | - $main->setErrorMessage(_("Select an Organisation")); | |
| 52 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUnitID=$fUnitID&fAdd=1" ); | |
| 53 | - } | |
| 54 | - if ($fOrgID > 0) { | |
| 55 | - $oUnitOrgLink = & new UnitOrganisationLink($fUnitID,$fOrgID); | |
| 56 | - if ($oUnitOrgLink->create()) { | |
| 57 | - $oPatternCustom->addHtml(getAddSuccessPage()); | |
| 58 | - }else{ | |
| 59 | - $main->setErrorMessage(_("Unit cannot be linked to the Organisation.")); | |
| 60 | - $oPatternCustom->addHtml(getAddFailPage()); | |
| 61 | - } | |
| 62 | - } else{ | |
| 63 | - $oUnit = Unit::get($fUnitID); | |
| 64 | - $oPatternCustom->addHtml(getAddUnitsPage($oUnit)); | |
| 65 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUnitID=$fUnitID&fAdd=1" ); | |
| 66 | - } | |
| 67 | - } | |
| 68 | - else { | |
| 69 | - | |
| 70 | - if (isset($fForStore)) { | |
| 71 | - if($fUnitName != "" and $fOrgID != "") { | |
| 72 | - $oUnit = new Unit($fUnitName); | |
| 73 | - | |
| 74 | - // if creation is successfull..get the unit id | |
| 75 | - if ($oUnit->create()) { | |
| 76 | - $unitID = $oUnit->getID(); | |
| 77 | - $oUnitOrg = new UnitOrganisationLink($unitID,$fOrgID); | |
| 78 | - | |
| 79 | - if($oUnitOrg->create()) { | |
| 80 | - // if successfull print out success message | |
| 81 | - $oPatternCustom->setHtml(getAddPageSuccess()); | |
| 82 | - } else { | |
| 83 | - // if fail print out fail message | |
| 84 | - $oPatternCustom->setHtml(getAddToOrgFail()); | |
| 85 | - } | |
| 86 | - } else { | |
| 87 | - // if fail print out fail message | |
| 88 | - $oPatternCustom->setHtml(getAddPageFail()); | |
| 89 | - } | |
| 90 | - } else { | |
| 91 | - $oPatternCustom->setHtml(getPageFail()); | |
| 92 | - } | |
| 93 | - | |
| 94 | - } else if (isset($fUnitID)) { | |
| 95 | - // post back on Unit select from manual edit page | |
| 96 | - $oPatternCustom->setHtml(getAddPage($fUnitID)); | |
| 97 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForStore=1"); | |
| 98 | - } else { | |
| 99 | - // if nothing happens...just reload edit page | |
| 100 | - $oPatternCustom->setHtml(getAddPage(null)); | |
| 101 | - $main->setFormAction($_SERVER["PHP_SELF"]. "?fForStore=1"); | |
| 102 | - | |
| 103 | - } | |
| 104 | - | |
| 105 | - } | |
| 106 | - | |
| 107 | - $main->setCentralPayload($oPatternCustom); | |
| 108 | - $main->render(); | |
| 109 | -} | |
| 110 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/addUnitToOrgUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Map a unit to an organisation 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.unitmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -function getAddFailPage(){ | |
| 29 | - global $default; | |
| 30 | - | |
| 31 | - $sToRender .= "<table>\n"; | |
| 32 | - $sToRender .= "<tr>\n"; | |
| 33 | - $sToRender .= "<td>\n"; | |
| 34 | - | |
| 35 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a>\n"; | |
| 36 | - | |
| 37 | - $sToRender .= "</td>\n"; | |
| 38 | - $sToRender .= "</tr>\n"; | |
| 39 | - $sToRender .= "</table>\n"; | |
| 40 | - return $sToRender; | |
| 41 | - | |
| 42 | -} | |
| 43 | -function getAddSuccessPage(){ | |
| 44 | - global $default; | |
| 45 | - | |
| 46 | - $sToRender .= "<table>\n"; | |
| 47 | - $sToRender .= "<tr>\n"; | |
| 48 | - $sToRender .= "<td>\n"; | |
| 49 | - | |
| 50 | - $sToRender .= _("Unit has been successfully added to the Organisation."). "\n"; | |
| 51 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a>\n"; | |
| 52 | - | |
| 53 | - $sToRender .= "</td>\n"; | |
| 54 | - $sToRender .= "</tr>\n"; | |
| 55 | - $sToRender .= "</table>\n"; | |
| 56 | - | |
| 57 | - return $sToRender; | |
| 58 | -} | |
| 59 | - | |
| 60 | - | |
| 61 | -function getAddUnitsPage($oUnit) { | |
| 62 | - global $default; | |
| 63 | - | |
| 64 | - $sToRender .= "<table>\n"; | |
| 65 | - $sToRender .= "<th></th>\n"; | |
| 66 | - $sToRender .= "<tr>\n"; | |
| 67 | - $sToRender .= "<td>\n"; | |
| 68 | - $sToRender .= "<b>" . _("Unit Name") . ": </b>"; | |
| 69 | - $sToRender .= "</td>\n"; | |
| 70 | - $sToRender .= "<td>\n"; | |
| 71 | - $sToRender .= $oUnit->getName(); | |
| 72 | - $sToRender .= "</td>\n"; | |
| 73 | - $sToRender .= "</tr>\n"; | |
| 74 | - | |
| 75 | - $sToRender .= "<th></th>\n"; | |
| 76 | - $sToRender .= "<tr>\n"; | |
| 77 | - $sToRender .= "<td>\n"; | |
| 78 | - $sToRender .= "<b>" . _("Organisations") . ": </b>"; | |
| 79 | - $sToRender .= "</td>\n"; | |
| 80 | - $sToRender .= "<td valign=top>\n"; | |
| 81 | - $sToRender .= getOrgDropdown(); | |
| 82 | - $sToRender .= "</td>\n"; | |
| 83 | - $sToRender .= "<td valign=middle>\n"; | |
| 84 | - $sToRender .= "<input type=\"image\" src =\"" . KTHtml::getAddButton() . "\" value=\"Submit\" border=\"0\"/> "; | |
| 85 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=editUnitOrg&fUnitID=" . $oUnit->getID() . "\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a>\n"; | |
| 86 | - $sToRender .= "</td>\n"; | |
| 87 | - $sToRender .= "</tr>\n"; | |
| 88 | - $sToRender .= "</table>\n"; | |
| 89 | - | |
| 90 | - | |
| 91 | - return $sToRender; | |
| 92 | - | |
| 93 | -} | |
| 94 | - | |
| 95 | -function getOrgDropdown(){ | |
| 96 | - global $default; | |
| 97 | - | |
| 98 | - $oPatternListBox = & new PatternListBox($default->organisations_table, "name", "id", "fOrgID"); | |
| 99 | - $sToRender .= $oPatternListBox->render(); | |
| 100 | - | |
| 101 | - return $sToRender; | |
| 102 | -} | |
| 103 | - | |
| 104 | - | |
| 105 | -// get add pages | |
| 106 | -function getAddPage($unitID) { | |
| 107 | - global $default; | |
| 108 | - | |
| 109 | - if (isset($iOrgID)) { | |
| 110 | - $oOrg = Organisation::get($iOrgID); | |
| 111 | - } | |
| 112 | - | |
| 113 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 114 | - $sToRender .= "<table>\n"; | |
| 115 | - $sToRender .= "<tr></tr>\n"; | |
| 116 | - $sToRender .= "<tr>\n"; | |
| 117 | - $sToRender .= "<td>" . _("Unit Name") . ": </td><td><input size = \"40\" type=\"text\" name=\"fUnitName\"> </td>\n"; | |
| 118 | - $sToRender .= "</tr>\n"; | |
| 119 | - $sToRender .= "<tr>\n"; | |
| 120 | - $sToRender .= "<td>" . _("Select an Organisation") . ": </td><td>" . getOrgDisplay($oOrg) ; | |
| 121 | - $sToRender .= "</tr>\n"; | |
| 122 | - $sToRender .= "<tr>\n"; | |
| 123 | - $sToRender .= "</tr>\n"; | |
| 124 | - $sToRender .= "<td></td><td align = right><input type=\"image\" src =\"" . KTHtml::getAddButton() . "\" value=\"Submit\" border=\"0\"/></td>\n"; | |
| 125 | - $sToRender .= "</table>\n"; | |
| 126 | - | |
| 127 | - return $sToRender; | |
| 128 | -} | |
| 129 | - | |
| 130 | -// if edition is successful print out success page | |
| 131 | -function getAddPageSuccess() { | |
| 132 | - global $default; | |
| 133 | - | |
| 134 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 135 | - $sToRender .= "<table>\n"; | |
| 136 | - $sToRender .= "<tr><td><b>" . _("Addition Successful!") . "</b></td></tr>\n"; | |
| 137 | - $sToRender .= "<tr></tr>\n"; | |
| 138 | - $sToRender .= "<tr><td>" . _("New Unit was successfully added") . "</td></tr>\n"; | |
| 139 | - $sToRender .= "<tr></tr>\n"; | |
| 140 | - $sToRender .= "<tr></tr>\n"; | |
| 141 | - $sToRender .= "<tr>\n"; | |
| 142 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 143 | - $sToRender .= "</tr>\n"; | |
| 144 | - $sToRender .= "</table>\n"; | |
| 145 | - | |
| 146 | - return $sToRender; | |
| 147 | -} | |
| 148 | - | |
| 149 | -// if edition is successful print out failure page | |
| 150 | -function getAddPageFail() { | |
| 151 | - global $default; | |
| 152 | - | |
| 153 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 154 | - $sToRender .= "<table>\n"; | |
| 155 | - $sToRender .= "<tr><td><b>" . _("Addition Unsuccessful") . "</b></td></tr>\n"; | |
| 156 | - $sToRender .= "<tr></tr>\n"; | |
| 157 | - $sToRender .= "<tr><td>" . _("The Unit was not added. Unit Name Already exists!") . "</td></tr>\n"; | |
| 158 | - $sToRender .= "<tr></tr>\n"; | |
| 159 | - $sToRender .= "<tr></tr>\n"; | |
| 160 | - $sToRender .= "<tr>\n"; | |
| 161 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 162 | - $sToRender .= "</tr>\n"; | |
| 163 | - $sToRender .= "</table>\n"; | |
| 164 | - | |
| 165 | - | |
| 166 | - return $sToRender; | |
| 167 | -} | |
| 168 | - | |
| 169 | - | |
| 170 | -// if edition is successful print otu success page | |
| 171 | -function getPageFail() { | |
| 172 | - global $default; | |
| 173 | - | |
| 174 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 175 | - $sToRender .= "<table>\n"; | |
| 176 | - $sToRender .= "<tr></tr>\n"; | |
| 177 | - $sToRender .= "<tr><td>" . _("Please enter a name AND Select the Organisation") . "</td></tr>\n"; | |
| 178 | - $sToRender .= "<tr></tr>\n"; | |
| 179 | - $sToRender .= "<tr></tr>\n"; | |
| 180 | - $sToRender .= "<tr>\n"; | |
| 181 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 182 | - $sToRender .= "</tr>\n"; | |
| 183 | - $sToRender .= "</table>\n"; | |
| 184 | - | |
| 185 | - | |
| 186 | - return $sToRender; | |
| 187 | -} | |
| 188 | -// if edition is successful print otu success page | |
| 189 | -function getAddPageToOrgFail() { | |
| 190 | - global $default; | |
| 191 | - | |
| 192 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 193 | - $sToRender .= "<table>\n"; | |
| 194 | - $sToRender .= "<tr><td><b>" . _("Addition to Organisation Unsuccessful") . "</b></td></tr>\n"; | |
| 195 | - $sToRender .= "<tr></tr>\n"; | |
| 196 | - $sToRender .= "<tr><td>" . _("The Unit was not added to the Organisation.") . "</td></tr>\n"; | |
| 197 | - $sToRender .= "<tr></tr>\n"; | |
| 198 | - $sToRender .= "<tr></tr>\n"; | |
| 199 | - $sToRender .= "<tr>\n"; | |
| 200 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 201 | - $sToRender .= "</tr>\n"; | |
| 202 | - $sToRender .= "</table>\n"; | |
| 203 | - | |
| 204 | - | |
| 205 | - return $sToRender; | |
| 206 | -} | |
| 207 | - | |
| 208 | - | |
| 209 | -// show the list box when no unit selected | |
| 210 | -// then shows a text box with the unit's name | |
| 211 | -function getOrgDisplay($oOrg) { | |
| 212 | - global $default; | |
| 213 | - if (!isset($oOrg)) { | |
| 214 | - $oPatternListBox = & new PatternListBox($default->organisations_table, "name", "id", "fOrgID"); | |
| 215 | - return $oPatternListBox->render(); | |
| 216 | - } else { | |
| 217 | - return "<input type=\"hidden\" name=\"fOrgID\" value=\"" . $oOrg->iId . "\">\n" . | |
| 218 | - "" . $oOrg->getName() . "\">"; | |
| 219 | - } | |
| 220 | - | |
| 221 | -} | |
| 222 | - | |
| 223 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/addUnitUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Add a unit 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.unitmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -// get add pages | |
| 29 | -function getAddPage() { | |
| 30 | - global $default; | |
| 31 | - | |
| 32 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 33 | - $sToRender .= "<table>\n"; | |
| 34 | - $sToRender .= "<tr></tr>\n"; | |
| 35 | - $sToRender .= "<tr>\n"; | |
| 36 | - $sToRender .= "<td>" . _("Unit Name") . ": </td><td><input size = \"40\" type=\"text\" name=\"fUnitName\"> </td>\n"; | |
| 37 | - $sToRender .= "</tr>\n"; | |
| 38 | - $sToRender .= "<tr>\n"; | |
| 39 | - $sToRender .= "<td>" . _("Organisation") . ": </td><td>" . getOrgDisplay() ; | |
| 40 | - $sToRender .= "</tr>\n"; | |
| 41 | - $sToRender .= "<tr>\n"; | |
| 42 | - $sToRender .= "</tr>\n"; | |
| 43 | - $sToRender .= "<td></td><td align = right><input type=\"image\" src =\"" . KTHtml::getAddButton() . "\" value=\"Submit\" border=\"0\"/>"; | |
| 44 | - $sToRender .= getCancelButton("listUnits") . "</td>\n"; | |
| 45 | - $sToRender .= "</table>\n"; | |
| 46 | - | |
| 47 | - // javascript validation | |
| 48 | - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n"; | |
| 49 | - $sToRender .= "function validateForm(theForm) {\n"; | |
| 50 | - $sToRender .= "\tif (!validRequired(theForm.fUnitName,'Unit Name') || !validRequired(theForm.fOrgID, 'Organisation')) {\n"; | |
| 51 | - $sToRender .= "\t\treturn false;\n\t}\n"; | |
| 52 | - $sToRender .= "return true;\n}\n"; | |
| 53 | - $sToRender .= "//-->\n</script>\n\n"; | |
| 54 | - | |
| 55 | - return $sToRender; | |
| 56 | -} | |
| 57 | - | |
| 58 | -// if edition is successful print out success page | |
| 59 | -function getAddPageSuccess() { | |
| 60 | - global $default; | |
| 61 | - | |
| 62 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 63 | - $sToRender .= "<table>\n"; | |
| 64 | - $sToRender .= "<tr><td><b>" . _("Addition Successful!") . "</b></td></tr>\n"; | |
| 65 | - $sToRender .= "<tr></tr>\n"; | |
| 66 | - $sToRender .= "<tr><td>" . _("New Unit was successfully added") . "</td></tr>\n"; | |
| 67 | - $sToRender .= "<tr></tr>\n"; | |
| 68 | - $sToRender .= "<tr></tr>\n"; | |
| 69 | - $sToRender .= "<tr>\n"; | |
| 70 | - $sToRender .= "<td></td><td align = right>" . generateControllerLink("listUnits", "", "<img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" />") . "</td>\n"; | |
| 71 | - $sToRender .= "</tr>\n"; | |
| 72 | - $sToRender .= "</table>\n"; | |
| 73 | - | |
| 74 | - return $sToRender; | |
| 75 | -} | |
| 76 | - | |
| 77 | -// if edition is successful print out failure page | |
| 78 | -function getAddPageFail($sMessage) { | |
| 79 | - global $default; | |
| 80 | - | |
| 81 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 82 | - $sToRender .= "<table>\n"; | |
| 83 | - $sToRender .= "<tr><td><b>" . _("Addition Unsuccessful") . "</b></td></tr>\n"; | |
| 84 | - $sToRender .= "<tr></tr>\n"; | |
| 85 | - $sToRender .= "<tr><td>$sMessage</td></tr>\n"; | |
| 86 | - $sToRender .= "<tr></tr>\n"; | |
| 87 | - $sToRender .= "<tr></tr>\n"; | |
| 88 | - $sToRender .= "<tr>\n"; | |
| 89 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit&fFolderID=1\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 90 | - $sToRender .= "</tr>\n"; | |
| 91 | - $sToRender .= "</table>\n"; | |
| 92 | - | |
| 93 | - | |
| 94 | - return $sToRender; | |
| 95 | -} | |
| 96 | - | |
| 97 | -function getPageFail() { | |
| 98 | - global $default; | |
| 99 | - | |
| 100 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 101 | - $sToRender .= "<table>\n"; | |
| 102 | - $sToRender .= "<tr></tr>\n"; | |
| 103 | - $sToRender .= "<tr><td>" . _("Please enter a name AND Select the Organisation") . "</td></tr>\n"; | |
| 104 | - $sToRender .= "<tr></tr>\n"; | |
| 105 | - $sToRender .= "<tr></tr>\n"; | |
| 106 | - $sToRender .= "<tr>\n"; | |
| 107 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 108 | - $sToRender .= "</tr>\n"; | |
| 109 | - $sToRender .= "</table>\n"; | |
| 110 | - | |
| 111 | - return $sToRender; | |
| 112 | -} | |
| 113 | - | |
| 114 | -function getAddPageToOrgFail() { | |
| 115 | - global $default; | |
| 116 | - | |
| 117 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 118 | - $sToRender .= "<table>\n"; | |
| 119 | - $sToRender .= "<tr><td><b>" . _("Addition to Organisation Unsuccessful") . "</b></td></tr>\n"; | |
| 120 | - $sToRender .= "<tr></tr>\n"; | |
| 121 | - $sToRender .= "<tr><td>" . _("The Unit was not added to the Organisation.") . "</td></tr>\n"; | |
| 122 | - $sToRender .= "<tr></tr>\n"; | |
| 123 | - $sToRender .= "<tr></tr>\n"; | |
| 124 | - $sToRender .= "<tr>\n"; | |
| 125 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 126 | - $sToRender .= "</tr>\n"; | |
| 127 | - $sToRender .= "</table>\n"; | |
| 128 | - | |
| 129 | - return $sToRender; | |
| 130 | -} | |
| 131 | - | |
| 132 | -/** | |
| 133 | - * Displays a drop down list of organisations | |
| 134 | - */ | |
| 135 | -function getOrgDisplay() { | |
| 136 | - global $default; | |
| 137 | - $aOrganisations = Organisation::getList();/*ok*/ | |
| 138 | - if ($aOrganisations && (count($aOrganisations) > 0)) { | |
| 139 | - $oOrganisation = $aOrganisations[0]; | |
| 140 | - return $oOrganisation->getName() . "<input type=\"hidden\" name=\"fOrgID\" value=\"" . $oOrganisation->getID() . "\"";; | |
| 141 | - } else { | |
| 142 | - return _("No organisations") . "<input type=\"hidden\" name=\"fOrgID\" value=\"\"/>"; | |
| 143 | - } | |
| 144 | -// $oPatternListBox = & new PatternListBox($default->organisations_table, "name", "id", "fOrgID"); | |
| 145 | -// return $oPatternListBox->render(); | |
| 146 | -} | |
| 147 | - | |
| 148 | - | |
| 149 | -function renderBrowsePage($fFolderID) { | |
| 150 | - global $default; | |
| 151 | - $sToRender = "<table border=\"0\">\n"; | |
| 152 | - $sToRender .= "<tr>\n"; | |
| 153 | - $sToRender .= "\t<td>" . renderFolderPath($fFolderID, generateControllerUrl("addUnit", "", false)) . "</td>\n"; | |
| 154 | - $sToRender .= "</tr>\n"; | |
| 155 | - $sToRender .= "</table>\n"; | |
| 156 | - $sToRender .= "<table border=\"0\">\n"; | |
| 157 | - $sToRender .= "<tr>\n"; | |
| 158 | - $sToRender .= "\t<td>" . renderFolderList($fFolderID, generateControllerUrl("addUnit", "", false)) . "<td>\n"; | |
| 159 | - | |
| 160 | - $sToRender .= "</tr>\n"; | |
| 161 | - $sToRender .= "</table><br>\n"; | |
| 162 | - | |
| 163 | - return $sToRender; | |
| 164 | -} | |
| 165 | - | |
| 166 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/editUnitBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit a unit. | |
| 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.unitmanagement | |
| 26 | - */ | |
| 27 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 28 | - | |
| 29 | -KTUtil::extractGPC('fForStore', 'fUnitID', 'fUnitName'); | |
| 30 | - | |
| 31 | -if (checkSession()) { | |
| 32 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 33 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); | |
| 34 | - require_once("editUnitUI.inc"); | |
| 35 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 40 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 41 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 42 | - | |
| 43 | - | |
| 44 | - $oPatternCustom = & new PatternCustom(); | |
| 45 | - | |
| 46 | - // if a new unit has been added | |
| 47 | - // coming from manual edit page | |
| 48 | - if (isset($fForStore)) { | |
| 49 | - | |
| 50 | - $oUnit = Unit::get($fUnitID); | |
| 51 | - | |
| 52 | - $oUnit->setName($fUnitName); | |
| 53 | - | |
| 54 | - if ($fUnitName== "") { | |
| 55 | - $oPatternCustom->setHtml(getEditPageFail()); | |
| 56 | - }elseif ($oUnit->update()) { | |
| 57 | - // if successfull print out success message | |
| 58 | - $oPatternCustom->setHtml(getEditPageSuccess()); | |
| 59 | - } else { | |
| 60 | - // if fail print out fail message | |
| 61 | - $oPatternCustom->setHtml(getEditPageFail()); | |
| 62 | - } | |
| 63 | - } else if (isset($fUnitID)) { | |
| 64 | - // post back on Unit select from manual edit page | |
| 65 | - $oPatternCustom->setHtml(getEditPage($fUnitID)); | |
| 66 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForStore=1&fUnitID=$fUnitID"); | |
| 67 | - } else { | |
| 68 | - // if nothing happens...just reload edit page | |
| 69 | - $oPatternCustom->setHtml(getEditPage(null)); | |
| 70 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 71 | - } | |
| 72 | - //render the page | |
| 73 | - $main->setCentralPayload($oPatternCustom); | |
| 74 | - $main->render(); | |
| 75 | -} | |
| 76 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/editUnitOrgBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit unit-organisation mapping. | |
| 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.unitmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fDeleteConfirmed', 'fGroupID', 'fGroupSet', 'fOtherGroupID', 'fUnitID', 'fUserID', 'fUserSet'); | |
| 31 | - | |
| 32 | -if (checkSession()) { | |
| 33 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 34 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 35 | - require_once("editUnitOrgUI.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/unitmanagement/UnitOrganisationLink.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/orgmanagement/Organisation.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/security/Permission.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($fUnitID)) { //isset($fUserSet)) { | |
| 48 | - // do a check to see both drop downs selected | |
| 49 | - if($fUnitID == -1) { | |
| 50 | - $oPatternCustom->setHtml(getPageNotSelected()); | |
| 51 | - } else { | |
| 52 | - $oPatternCustom->setHtml(renderHeading(_("Edit Unit Organisation"))); | |
| 53 | - | |
| 54 | - $oPatternCustom->addHtml(getOrgPage($fUnitID)); | |
| 55 | - } | |
| 56 | - } else { | |
| 57 | - // build first page | |
| 58 | - $oPatternCustom->setHtml(getPage(null,null)); | |
| 59 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUserSet=1"); | |
| 60 | - } | |
| 61 | - | |
| 62 | - // render page | |
| 63 | - $main->setCentralPayload($oPatternCustom); | |
| 64 | - $main->render(); | |
| 65 | -} | |
| 66 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/editUnitOrgUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit unit-organisation mapping 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.unitmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -function getOrgPage($iUnitID = null){ | |
| 29 | - global $default; | |
| 30 | - | |
| 31 | - $aUnitOrgLink = UnitOrganisationLink::getList(array("WHERE unit_id = ?", $iUnitID));/*ok*/ | |
| 32 | - | |
| 33 | - if (count($aUnitOrgLink) > 0 ){ | |
| 34 | - $oLink = $aUnitOrgLink[0]; | |
| 35 | - } | |
| 36 | - | |
| 37 | - $sBgColor = "#F5F6EE"; | |
| 38 | - | |
| 39 | - $sToRender .= "<table width=\"600\" border=0>"; | |
| 40 | - $sToRender .= "<tr><td width=100%></td><td>"; | |
| 41 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a>"; | |
| 42 | - $sToRender .= "</td></tr>\n"; | |
| 43 | - $sToRender .= "</table>"; | |
| 44 | - | |
| 45 | - | |
| 46 | - if ($oLink) { | |
| 47 | - $oOrg = Organisation::get($oLink->getOrgID()); | |
| 48 | - $sOrgName = $oOrg->getName(); | |
| 49 | - $bNoOrg = false; | |
| 50 | - } else { | |
| 51 | - $sOrgName = "* " . _("No assigned Organisation"); | |
| 52 | - $bNoOrg = true; | |
| 53 | - } | |
| 54 | - | |
| 55 | - $sToRender .= "<table width=100% border=0>\n"; | |
| 56 | - $sToRender .= "<tr>\n"; | |
| 57 | - $sToRender .= "<td width=300 valign=top>\n"; | |
| 58 | - | |
| 59 | - $sToRender .= "<table width=100% border=0>\n"; | |
| 60 | - $sToRender .= "<tr>\n"; | |
| 61 | - $sToRender .= "<td><b>\n"; | |
| 62 | - $sToRender .= _("Current Organisation") . "\n"; | |
| 63 | - $sToRender .= "</b></td>\n"; | |
| 64 | - $sToRender .= "</tr>\n"; | |
| 65 | - $sToRender .= "<tr>\n"; | |
| 66 | - $sToRender .= "<td bgcolor=$sBgColor>\n"; | |
| 67 | - | |
| 68 | - $sToRender .= $sOrgName; | |
| 69 | - | |
| 70 | - $sToRender .= "</td>\n"; | |
| 71 | - $sToRender .= "</tr>\n"; | |
| 72 | - $sToRender .= "</table>\n"; | |
| 73 | - | |
| 74 | - $sToRender .= "</td>\n"; | |
| 75 | - $sToRender .= "<td>\n"; | |
| 76 | - $sToRender .= getUnitOrgEdit($bNoOrg, $iUnitID); | |
| 77 | - $sToRender .= "</td>\n"; | |
| 78 | - $sToRender .= "</table>\n"; | |
| 79 | - | |
| 80 | - | |
| 81 | - return $sToRender; | |
| 82 | - | |
| 83 | -} | |
| 84 | - | |
| 85 | -function getUnitOrgEdit($bNoOrg, $iUnitID = null){ | |
| 86 | - global $default; | |
| 87 | - | |
| 88 | - $sBgColor = "#F5F6EE"; | |
| 89 | - | |
| 90 | - $sToRender .= "<table border=0 cellspacing=1>\n"; | |
| 91 | - $sToRender .= " <tr><td><b>" . _("Options") . "</b></td></tr>"; | |
| 92 | - if ($bNoOrg) { | |
| 93 | - $sToRender .= " <tr><td bgcolor=$sBgColor>"; | |
| 94 | - $sToRender .= " <br> <a href=\"$default->rootUrl/control.php?action=addUnitToOrg&fUnitID=" . $iUnitID . "\">" . _("Add Unit to an Organisation") . "</a><br><br>"; | |
| 95 | - $sToRender .= " </td><td>"; | |
| 96 | - $sToRender .= " </td></tr>"; | |
| 97 | - } else { | |
| 98 | - $sToRender .= " <tr><td bgcolor=$sBgColor>"; | |
| 99 | - $sToRender .= " <br> <a href=\"$default->rootUrl/control.php?action=removeUnitFromOrg&fUnitID=" . $iUnitID . "\">" . _("Remove Unit from an Organisation") . "</a><br><br>"; | |
| 100 | - $sToRender .= " </td><td>"; | |
| 101 | - $sToRender .= " </td></tr>"; | |
| 102 | - } | |
| 103 | - $sToRender .= "</table>\n"; | |
| 104 | - | |
| 105 | - return $sToRender; | |
| 106 | - | |
| 107 | -} | |
| 108 | - | |
| 109 | -// get page for removal | |
| 110 | -function getPage($iUserID) { | |
| 111 | - global $default; | |
| 112 | - $oUser = null; | |
| 113 | - $oGroup = null; | |
| 114 | - | |
| 115 | - // change headings if User selected | |
| 116 | - if (isset($iUserID)) { | |
| 117 | - $oUser = User::get($iUserID); | |
| 118 | - } else { | |
| 119 | - $heading = "<tr><td>" . _("Please select a User") . ":</td></tr>\n"; | |
| 120 | - } | |
| 121 | - | |
| 122 | - $sToRender .= renderHeading(_("Edit User Groups")); | |
| 123 | - $sToRender .= "<table>\n"; | |
| 124 | - $sToRender .= $heading; | |
| 125 | - $sToRender .= "<tr>\n"; | |
| 126 | - $sToRender .= "</tr>\n"; | |
| 127 | - $sToRender .= "<td>" . _("User Name") . ": " . getUserDisplay($oUser) . "</td>\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></table>\n"; | |
| 135 | - | |
| 136 | - return $sToRender; | |
| 137 | -} | |
| 138 | - | |
| 139 | -// show paig if deletion fails | |
| 140 | -function getPageFail() { | |
| 141 | - global $default; | |
| 142 | - | |
| 143 | - $sToRender .= "<table width=\"600\">" . renderHeading(_("Edit User Groups")) . "</table>"; | |
| 144 | - $sToRender .= "<table>\n"; | |
| 145 | - $sToRender .= "<tr><td><b>" . _("Sorry, Removal Failed") . "</b></td></tr>\n"; | |
| 146 | - $sToRender .= "<tr></tr>\n"; | |
| 147 | - $sToRender .= "</tr>\n"; | |
| 148 | - $sToRender .= "<tr>\n"; | |
| 149 | - $sToRender .= "</tr>\n"; | |
| 150 | - $sToRender .= "<tr>\n"; | |
| 151 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=removeUserFromGroup\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 152 | - $sToRender .= "</tr>\n"; | |
| 153 | - $sToRender .= "</table>\n"; | |
| 154 | - | |
| 155 | - return $sToRender; | |
| 156 | -} | |
| 157 | - | |
| 158 | -// show success page if removed from Group successfully | |
| 159 | -function getPageSuccess() { | |
| 160 | - global $default; | |
| 161 | - | |
| 162 | - $sToRender .= "<table width=\"600\">" . renderHeading(_("Edit User Groups")) . "</table>"; | |
| 163 | - $sToRender .= "<table>\n"; | |
| 164 | - $sToRender .= "<tr><td><b>" . _("Success") . "!</b></td></tr>\n"; | |
| 165 | - $sToRender .= "<tr></tr>\n"; | |
| 166 | - $sToRender .= "<tr><td>" . _("The User was successfully removed from the Group") . "</td></tr>\n"; | |
| 167 | - $sToRender .= "<tr></tr>\n"; | |
| 168 | - $sToRender .= "<tr></tr>\n"; | |
| 169 | - $sToRender .= "<tr>\n"; | |
| 170 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listUsers\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 171 | - $sToRender .= "</tr>\n"; | |
| 172 | - $sToRender .= "</table>\n"; | |
| 173 | - | |
| 174 | - return $sToRender; | |
| 175 | -} | |
| 176 | - | |
| 177 | -// show Group details on confirm deletion page | |
| 178 | -function getGroupDisplay($aGroup) { | |
| 179 | - global $default; | |
| 180 | - | |
| 181 | - $sBgColor = "#F5F6EE"; | |
| 182 | - $oGroup= null; | |
| 183 | - $sGroup = "<table cellspacing=1 border=0>"; | |
| 184 | - for ($i=0;$i < count($aGroup);$i++) { | |
| 185 | - $oGroup= Group::get($aGroup[$i]); | |
| 186 | - $Options .= "<tr><td>" . ($i+1) . "</td><td bgcolor=$sBgColor>". $oGroup->getName() ."</td></tr>\n"; | |
| 187 | - } | |
| 188 | - $sGroup .= $Options . "</table>"; | |
| 189 | - return $sGroup; | |
| 190 | -} | |
| 191 | - | |
| 192 | -// show delete button or select button | |
| 193 | -function getDeleteButton($oUser) { | |
| 194 | - global $default; | |
| 195 | - if (!isset($oUser)) { | |
| 196 | - return "<td align = right><input type=\"image\" src =\"" . KTHtml::getSelectButton() . "\" value=\"submit\" border=\"0\"/></td>\n"; | |
| 197 | - } else { | |
| 198 | - return "<td align = right><input type=\"image\" src =\"" . KTHtml::getDeleteButton() . "\" value=\"submit\" border=\"0\"/></td>\n"; | |
| 199 | - } | |
| 200 | -} | |
| 201 | - | |
| 202 | - | |
| 203 | -// show delete button or select button | |
| 204 | -function getSelectButton($oUser) { | |
| 205 | - global $default; | |
| 206 | - if (!isset($oUser)) { | |
| 207 | - return "<input type=\"image\" src =\"" . KTHtml::getSelectButton() . "\" value=\"submit\" border=\"0\"/>\n"; | |
| 208 | - } else { | |
| 209 | - return "<input type=\"image\" src =\"" . KTHtml::getSelectButton() . "\" value=\"submit\" border=\"0\"/>\n"; | |
| 210 | - } | |
| 211 | -} | |
| 212 | -// show cancel button | |
| 213 | -function getCancelButton($oUser) { | |
| 214 | - global $default; | |
| 215 | - if (!isset($oUser)) { | |
| 216 | - //return "<td align = right><a href=\"$default->rootUrl/control.php?action=UserManagement\"><img src =\"" . KTHtml::getCancelButton() . "\" value=\"cancel\" /></a></td>\n"; | |
| 217 | - } | |
| 218 | - else { | |
| 219 | - return "<a href=\"$default->rootUrl/control.php?action=listUsers\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a>\n"; | |
| 220 | - } | |
| 221 | -} | |
| 222 | - | |
| 223 | - | |
| 224 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/editUnitUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit unit 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.unitmanagement | |
| 26 | - */ | |
| 27 | -// if its the manual edit page..then display normally | |
| 28 | -function getEditPage($iUnitID) { | |
| 29 | - global $default; | |
| 30 | - $oUnit = null; | |
| 31 | - if (isset($iUnitID)) { | |
| 32 | - $oUnit = Unit::get($iUnitID); | |
| 33 | - } | |
| 34 | - | |
| 35 | - $sToRender .= renderHeading(_("Edit Unit")); | |
| 36 | - $sToRender .= "<table>\n"; | |
| 37 | - $sToRender .= "<tr><td><strong>" . _("Please edit the Unit name") . "</strong></td></tr>\n"; | |
| 38 | - $sToRender .= "<tr>\n"; | |
| 39 | - $sToRender .= "<td>" . _("Unit Name") . ": </td><td>" . getUnitDisplay($oUnit) . "</td>\n"; | |
| 40 | - $sToRender .= "</tr>\n"; | |
| 41 | - $sToRender .= "<tr>\n"; | |
| 42 | - $sToRender .= "</tr>\n"; | |
| 43 | - $sToRender .= "<tr>\n"; | |
| 44 | - $sToRender .= "<tr>\n"; | |
| 45 | - $sToRender .= "</tr>\n"; | |
| 46 | - $sToRender .= "<tr><td colspan=\"2\" align = right>" . getUpdateButton($oUnit) . getCancelButton($oUnit) . "</td></tr>"; | |
| 47 | - $sToRender .= "</table>\n"; | |
| 48 | - | |
| 49 | - return $sToRender; | |
| 50 | -} | |
| 51 | - | |
| 52 | -// if edition is successful print otu success page | |
| 53 | -function getEditPageSuccess() { | |
| 54 | - global $default; | |
| 55 | - | |
| 56 | - $sToRender .= renderHeading(_("Edit Unit")); | |
| 57 | - $sToRender .= "<table>\n"; | |
| 58 | - $sToRender .= "<tr><td><b>" . _("Success") . "!</b></td></tr>\n"; | |
| 59 | - $sToRender .= "<tr></tr>\n"; | |
| 60 | - $sToRender .= "<tr><td>" . _("The Unit was successfully modified") . "</td></tr>\n"; | |
| 61 | - $sToRender .= "<tr></tr>\n"; | |
| 62 | - $sToRender .= "<tr></tr>\n"; | |
| 63 | - $sToRender .= "<tr>\n"; | |
| 64 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 65 | - $sToRender .= "</tr>\n"; | |
| 66 | - $sToRender .= "</table>\n"; | |
| 67 | - | |
| 68 | - | |
| 69 | - return $sToRender; | |
| 70 | -} | |
| 71 | - | |
| 72 | - | |
| 73 | -// gets the page if edition fails | |
| 74 | -function getEditPageFail() { | |
| 75 | - global $default; | |
| 76 | - | |
| 77 | - $sToRender .= renderHeading(_("Edit Unit")); | |
| 78 | - $sToRender .= "<table>\n"; | |
| 79 | - $sToRender .= "<tr><td><b>" . strtoupper(_("Failure")) . "!</b></td></tr>\n"; | |
| 80 | - $sToRender .= "<tr></tr>\n"; | |
| 81 | - $sToRender .= "<tr><td>" . _("Unit modification Failed!") . "</td></tr>\n"; | |
| 82 | - $sToRender .= "<tr></tr>\n"; | |
| 83 | - $sToRender .= "<tr></tr>\n"; | |
| 84 | - $sToRender .= "<tr>\n"; | |
| 85 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 86 | - $sToRender .= "</tr>\n"; | |
| 87 | - $sToRender .= "</table>\n"; | |
| 88 | - return $sToRender; | |
| 89 | -} | |
| 90 | - | |
| 91 | -// show the list box when no unit selected | |
| 92 | -// then shows a text box with the unit's name | |
| 93 | -function getUnitDisplay($oUnit) { | |
| 94 | - global $default; | |
| 95 | - if (!isset($oUnit)) { | |
| 96 | - $oPatternListBox = & new PatternListBox($default->units_table, "name", "id", "fUnitID"); | |
| 97 | - $oPatternListBox->setPostBackOnChange(true); | |
| 98 | - return $oPatternListBox->render(); | |
| 99 | - } else { | |
| 100 | - return "<input type=\"hidden\" name=\"fUnitID\" value=\"" . $oUnit->iId . "\">\n" . | |
| 101 | - "<input size = \"40\" type=\"text\" name=\"fUnitName\" value=\"" . $oUnit->getName() . "\">"; | |
| 102 | - } | |
| 103 | -} | |
| 104 | - | |
| 105 | - | |
| 106 | -// gets the updatebutton when a unit is selected | |
| 107 | -function getUpdateButton($oUnit) { | |
| 108 | - global $default; | |
| 109 | - if (isset($oUnit)) { | |
| 110 | - return "<input type=\"image\" src =\"" . KTHtml::getUpdateButton() . "\" value=\"submit\" border=\"0\"/>\n"; | |
| 111 | - } | |
| 112 | -} | |
| 113 | - | |
| 114 | -// gets the cancel button when a unit is selected | |
| 115 | -function getCancelButton($oUnit) { | |
| 116 | - global $default; | |
| 117 | - if (!isset($oUnit)) { | |
| 118 | - return "<a href=\"$default->rootUrl/control.php?action=unitManagement\"><img src =\"" . KTHtml::getCancelButton() . "\" value=\"cancel\" border=\"0\"/></a>\n"; | |
| 119 | - } else { | |
| 120 | - return "<a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getCancelButton() . "\" border=\"0\" /></a>\n"; | |
| 121 | - } | |
| 122 | -} | |
| 123 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/listUnitsBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * List units. | |
| 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.unitmanagement | |
| 26 | - */ | |
| 27 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 28 | - | |
| 29 | -KTUtil::extractGPC('fOrganisationID'); | |
| 30 | - | |
| 31 | -require_once("$default->fileSystemRoot/lib/users/User.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/visualpatterns/PatternTableSqlQuery.inc"); | |
| 35 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 36 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 37 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/administration/adminUI.inc"); | |
| 38 | -require_once("listUnitsUI.inc"); | |
| 39 | - | |
| 40 | -if (checkSession()) { | |
| 41 | - $oPatternCustom = & new PatternCustom(); | |
| 42 | - $oPatternCustom->setHtml(getPage($fOrganisationID)); | |
| 43 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 44 | - $main->setCentralPayload($oPatternCustom); | |
| 45 | - $main->setFormAction($_SERVER['PHP_SELF']); | |
| 46 | - $main->render(); | |
| 47 | -} | |
| 48 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/listUnitsUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * List units 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.unitmanagement | |
| 26 | - */ | |
| 27 | -function getOrganisationDisplay($iOrganisationID) { | |
| 28 | - global $default; | |
| 29 | - $oPatternListBox = & new PatternListBox($default->organisations_table, "name", "id", "iOrganisationID"); | |
| 30 | - $oPatternListBox->setPostBackOnChange(true); | |
| 31 | - if ($iOrganisationID != 0) { | |
| 32 | - $oPatternListBox->setSelectedValue($iOrganisationID); | |
| 33 | - } | |
| 34 | - return "<table><tr><td><b>" . _("Filter By Organisation") . " </b></td><td>" . $oPatternListBox->render() . "</td></tr></table>"; | |
| 35 | -} | |
| 36 | - | |
| 37 | -function getUnits($iOrganisationID) { | |
| 38 | - global $default; | |
| 39 | - | |
| 40 | - $aParams = array(); | |
| 41 | - /*ok*/ $sQuery = "SELECT units_lookup.id as unitID, units_lookup.name as name, " . | |
| 42 | - "'Edit', 'Delete', 'Edit Organisations', " . | |
| 43 | - "CASE WHEN organisations_lookup.name Is Null THEN '<font color=darkgrey>* No Organisation</font>' ELSE organisations_lookup.name END AS OrgName " . | |
| 44 | - "FROM (units_lookup " . | |
| 45 | - "LEFT JOIN units_organisations_link ON units_lookup.id = units_organisations_link.unit_id) " . | |
| 46 | - "LEFT JOIN organisations_lookup ON units_organisations_link.organisation_id = organisations_lookup.id "; | |
| 47 | - if ($iOrganisationID) { | |
| 48 | - $sQuery .= "WHERE units_organisations_link.organisation_id = ? "; | |
| 49 | - $aParams[] = $iOrganisationID; | |
| 50 | - } | |
| 51 | - $sQuery .= "ORDER BY units_lookup.name"; | |
| 52 | - | |
| 53 | - $aColumns = array("name", "OrgName", "Edit", "Delete");//, "Edit Organisations"); | |
| 54 | - $aColumnNames = array(_("Unit Name"), _("Organisation"), _("Edit"), _("Delete"));//, "Edit Organisations"); | |
| 55 | - $aColumnTypes = array(1,1,3,3);//,3); | |
| 56 | - $aDBColumnArray = array("unitID"); | |
| 57 | - $aQueryStringVariableNames = array("fUnitID"); | |
| 58 | - | |
| 59 | - $aHyperLinkURL = array( 2=> "$default->rootUrl/control.php?action=editUnit", | |
| 60 | - 3=> "$default->rootUrl/control.php?action=removeUnit"); | |
| 61 | - //4=> "$default->rootUrl/control.php?action=editUnitOrg"); | |
| 62 | - | |
| 63 | - $oSearchResults = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnNames, "100%", $aHyperLinkURL,$aDBColumnArray,$aQueryStringVariableNames); | |
| 64 | - $oSearchResults->setDisplayColumnHeadings(true); | |
| 65 | - return $oSearchResults->render() ; | |
| 66 | -} | |
| 67 | - | |
| 68 | -function getPage($iOrganisationID) { | |
| 69 | - global $default; | |
| 70 | - $sToRender .= renderHeading(_("Unit Management")); | |
| 71 | - | |
| 72 | - $sToRender .= getAddLink("addUnit&fFolderID=1", _("Add A Unit")); | |
| 73 | - | |
| 74 | - //$sToRender .= getOrganisationDisplay($iOrganisationID); | |
| 75 | - $sToRender .= getUnits($iOrganisationID); | |
| 76 | - return $sToRender; | |
| 77 | -} | |
| 78 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/removeUnitBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove a unit. | |
| 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.unitmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fForDeleteConfirmed', 'fUnitID'); | |
| 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("removeUnitUI.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/orgmanagement/Organisation.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/lib/unitmanagement/UnitOrganisationLink.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 | - | |
| 48 | - if ($fUnitID) { | |
| 49 | - // retrieve unit object | |
| 50 | - $oUnit = Unit::get($fUnitID); | |
| 51 | - if ($oUnit) { | |
| 52 | - | |
| 53 | - // if the unit has groups linked to it, then it can't be deleted | |
| 54 | - if ($oUnit->hasGroups()) { | |
| 55 | - // display error message | |
| 56 | - $oPatternCustom->setHtml(getStatusPage( | |
| 57 | - sprintf(_("Can't delete Unit '%s'"), $oUnit->getName()), _("Please remove all groups belonging to this Unit before attempting to delete it"))); | |
| 58 | - } else { | |
| 59 | - // retrieve organisation link (for later deletion or to get the organisation id) | |
| 60 | - $oUnitOrg = UnitOrganisationLink::getByUnitID($fUnitID); | |
| 61 | - if ($oUnitOrg) { | |
| 62 | - $oOrganisation = Organisation::get($oUnitOrg->getOrgID()); | |
| 63 | - } | |
| 64 | - | |
| 65 | - // we've received confirmation, so delete | |
| 66 | - if (isset($fForDeleteConfirmed)) { | |
| 67 | - //delete unit object | |
| 68 | - if ($oUnit->delete()) { | |
| 69 | - // delete the link between this unit and its organisation if there is one | |
| 70 | - if ($oUnitOrg) { | |
| 71 | - if ($oUnitOrg->delete()) { | |
| 72 | - $oPatternCustom->setHtml(getStatusPage(_("Unit SuccessFully Removed!"))); | |
| 73 | - } else { | |
| 74 | - // couldn't delete the link to the organisation | |
| 75 | - $oPatternCustom->setHtml(getStatusPage(_("Deletion of Unit Organisation Link Failed!"), _("The Unit was deleted, but the link to the Organisation could not be deleted"))); | |
| 76 | - } | |
| 77 | - } else { | |
| 78 | - // no organisation mapped | |
| 79 | - $oPatternCustom->setHtml(getStatusPage(_("Unit SuccessFully Removed!"))); | |
| 80 | - } | |
| 81 | - } else { | |
| 82 | - $oPatternCustom->setHtml(getStatusPage(sprintpf(_("Deletion of Unit '%s' failed!"), $oUnit->getName()))); | |
| 83 | - } | |
| 84 | - // ask for confirmation before deleting | |
| 85 | - } else { | |
| 86 | - $oPatternCustom->setHtml(getConfirmDeletePage($oUnit, $oOrganisation)); | |
| 87 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForDeleteConfirmed=1"); | |
| 88 | - } | |
| 89 | - } | |
| 90 | - } else { | |
| 91 | - // couldn't retrieve unit from db | |
| 92 | - $oPatternCustom->setHtml(getStatusPage(_("No Unit selected for deletion."))); | |
| 93 | - } | |
| 94 | - } else { | |
| 95 | - // no params received, error | |
| 96 | - $oPatternCustom->setHtml(getStatusPage(_("No Unit selected for deletion."))); | |
| 97 | - } | |
| 98 | - | |
| 99 | - $main->setCentralPayload($oPatternCustom); | |
| 100 | - $main->render(); | |
| 101 | -} | |
| 102 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/removeUnitFromOrgBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove unit-organisation mapping. | |
| 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.unitmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../../config/dmsDefaults.php"); | |
| 29 | - | |
| 30 | -KTUtil::extractGPC('fForStore', 'fOrgID', 'fRemove', 'fUnitID', 'fUnitName'); | |
| 31 | - | |
| 32 | -if (checkSession()) { | |
| 33 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 34 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 35 | - require_once("removeUnitFromOrgUI.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/unitmanagement/UnitOrganisationLink.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/lib/orgmanagement/Organisation.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/lib/security/Permission.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 | - | |
| 48 | - $oPatternCustom->addHtml(renderHeading(_("Remove Unit from an Organisation"))); | |
| 49 | - | |
| 50 | - if (isset($fUnitID)) { | |
| 51 | - if ($fOrgID == "" && $fRemove == 1){ | |
| 52 | - $main->setErrorMessage(_("An error occured.")); | |
| 53 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUnitID=$fUnitID&fAdd=1" ); | |
| 54 | - } | |
| 55 | - if ($fOrgID > 0) { | |
| 56 | - //$oUnitOrgLink = & new UnitOrganisationLink($fUnitID,$fOrgID); | |
| 57 | - $aWhereClase = array("WHERE unit_id = ? AND organisation_id = ?", array($fUnitID, $fOrgID)); | |
| 58 | - $aUnitOrgLink = UnitOrganisationLink::getList($aWhereClase);/*ok*/ | |
| 59 | - if (count($aUnitOrgLink) > 1) { | |
| 60 | - $oPatternCustom->addHtml(_("Error") . ":" . _("Multiple links exist even though a Unit can only belong to one Organisation.")); | |
| 61 | - }else { | |
| 62 | - $oLinkObject = $aUnitOrgLink[0]; | |
| 63 | - if ($oLinkObject->delete()) { | |
| 64 | - $oPatternCustom->addHtml(getRemoveSuccessPage()); | |
| 65 | - } else { | |
| 66 | - $oPatternCustom->addHtml(getRemoveFailPage()); | |
| 67 | - } | |
| 68 | - } | |
| 69 | - | |
| 70 | - } else{ | |
| 71 | - $oLink = UnitOrganisationLink::getByUnitID($fUnitID); | |
| 72 | - | |
| 73 | - if($oLink){ | |
| 74 | - $oPatternCustom->addHtml(getRemoveUnitsPage($oLink)); | |
| 75 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fUnitID=$fUnitID&fRemove=1&fOrgID=" . $oLink->getOrgID() ); | |
| 76 | - } | |
| 77 | - } | |
| 78 | - } | |
| 79 | - else { | |
| 80 | - | |
| 81 | - if (isset($fForStore)) { | |
| 82 | - if($fUnitName != "" and $fOrgID != "") { | |
| 83 | - $oUnit = new Unit($fUnitName); | |
| 84 | - | |
| 85 | - // if creation is successfull..get the unit id | |
| 86 | - if ($oUnit->create()) { | |
| 87 | - $unitID = $oUnit->getID(); | |
| 88 | - $oUnitOrg = new UnitOrganisationLink($unitID,$fOrgID); | |
| 89 | - | |
| 90 | - if($oUnitOrg->create()) { | |
| 91 | - // if successfull print out success message | |
| 92 | - $oPatternCustom->setHtml(getAddPageSuccess()); | |
| 93 | - } else { | |
| 94 | - // if fail print out fail message | |
| 95 | - $oPatternCustom->setHtml(getAddToOrgFail()); | |
| 96 | - } | |
| 97 | - } else { | |
| 98 | - // if fail print out fail message | |
| 99 | - $oPatternCustom->setHtml(getAddPageFail()); | |
| 100 | - } | |
| 101 | - } else { | |
| 102 | - $oPatternCustom->setHtml(getPageFail()); | |
| 103 | - } | |
| 104 | - | |
| 105 | - } else if (isset($fUnitID)) { | |
| 106 | - // post back on Unit select from manual edit page | |
| 107 | - $oPatternCustom->setHtml(getAddPage($fUnitID)); | |
| 108 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForStore=1"); | |
| 109 | - } else { | |
| 110 | - // if nothing happens...just reload edit page | |
| 111 | - $oPatternCustom->setHtml(getAddPage(null)); | |
| 112 | - $main->setFormAction($_SERVER["PHP_SELF"]. "?fForStore=1"); | |
| 113 | - | |
| 114 | - } | |
| 115 | - | |
| 116 | - } | |
| 117 | - | |
| 118 | - $main->setCentralPayload($oPatternCustom); | |
| 119 | - $main->render(); | |
| 120 | -} | |
| 121 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/removeUnitFromOrgUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove unit-organisation mapping 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.unitmanagement | |
| 26 | - */ | |
| 27 | -function getRemoveFailPage(){ | |
| 28 | - global $default; | |
| 29 | - | |
| 30 | - $sToRender .= "<table>\n"; | |
| 31 | - $sToRender .= "<tr>\n"; | |
| 32 | - $sToRender .= "<td>\n"; | |
| 33 | - | |
| 34 | - $sToRender .= _("Failure while trying to remove Unit from the Organisation.") . "\n"; | |
| 35 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a>\n"; | |
| 36 | - | |
| 37 | - $sToRender .= "</td>\n"; | |
| 38 | - $sToRender .= "</tr>\n"; | |
| 39 | - $sToRender .= "</table>\n"; | |
| 40 | - return $sToRender; | |
| 41 | - | |
| 42 | -} | |
| 43 | -function getRemoveSuccessPage(){ | |
| 44 | - global $default; | |
| 45 | - | |
| 46 | - $sToRender .= "<table>\n"; | |
| 47 | - $sToRender .= "<tr>\n"; | |
| 48 | - $sToRender .= "<td>\n"; | |
| 49 | - | |
| 50 | - $sToRender .= _("Unit has been successfully removed from the Organisation.") . "\n"; | |
| 51 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a>\n"; | |
| 52 | - | |
| 53 | - $sToRender .= "</td>\n"; | |
| 54 | - $sToRender .= "</tr>\n"; | |
| 55 | - $sToRender .= "</table>\n"; | |
| 56 | - | |
| 57 | - return $sToRender; | |
| 58 | -} | |
| 59 | - | |
| 60 | - | |
| 61 | -function getRemoveUnitsPage($oLink) { | |
| 62 | - global $default; | |
| 63 | - | |
| 64 | - if($oLink){ | |
| 65 | - $oOrg = Organisation::get($oLink->getOrgID()); | |
| 66 | - $oUnit = Unit::get($oLink->getUnitID()); | |
| 67 | - | |
| 68 | - $sToRender .= "<table>\n"; | |
| 69 | - $sToRender .= "<th colspan=2> " . _("Do you wish to remove the Unit from the Organisation?") . "</th>\n"; | |
| 70 | - $sToRender .= "<tr colspan=2> </tr>\n"; | |
| 71 | - $sToRender .= "<th colspan=2> </th>\n"; | |
| 72 | - $sToRender .= "<tr>\n"; | |
| 73 | - $sToRender .= "<td>\n"; | |
| 74 | - $sToRender .= "<b>" . _("Unit Name") . ": </b>"; | |
| 75 | - $sToRender .= "</td>\n"; | |
| 76 | - $sToRender .= "<td>\n"; | |
| 77 | - $sToRender .= $oUnit->getName(); | |
| 78 | - $sToRender .= "</td>\n"; | |
| 79 | - $sToRender .= "</tr>\n"; | |
| 80 | - | |
| 81 | - $sToRender .= "<th></th>\n"; | |
| 82 | - $sToRender .= "<tr>\n"; | |
| 83 | - $sToRender .= "<td>\n"; | |
| 84 | - $sToRender .= "<b>" . _("Organisation") . ": </b>"; | |
| 85 | - $sToRender .= "</td>\n"; | |
| 86 | - $sToRender .= "<td valign=top>\n"; | |
| 87 | - $sToRender .= $oOrg->getName(); | |
| 88 | - $sToRender .= "</td>\n"; | |
| 89 | - $sToRender .= "<td valign=middle>\n"; | |
| 90 | - $sToRender .= "<input type=\"image\" src =\"" . KTHtml::getRemoveButton() . "\" value=\"Submit\" border=\"0\"/> "; | |
| 91 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=editUnitOrg&fUnitID=" . $oUnit->getID() . "\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a>\n"; | |
| 92 | - $sToRender .= "</td>\n"; | |
| 93 | - $sToRender .= "</tr>\n"; | |
| 94 | - $sToRender .= "</table>\n"; | |
| 95 | - } else { | |
| 96 | - $sToRender .= _("Link object is empty.") . "\n"; | |
| 97 | - } | |
| 98 | - | |
| 99 | - return $sToRender; | |
| 100 | - | |
| 101 | -} | |
| 102 | - | |
| 103 | -function getOrgDropdown(){ | |
| 104 | - global $default; | |
| 105 | - | |
| 106 | - $oPatternListBox = & new PatternListBox($default->organisations_table, "name", "id", "fOrgID"); | |
| 107 | - $sToRender .= $oPatternListBox->render(); | |
| 108 | - | |
| 109 | - return $sToRender; | |
| 110 | -} | |
| 111 | - | |
| 112 | - | |
| 113 | -// get add pages | |
| 114 | -function getAddPage($unitID) { | |
| 115 | - global $default; | |
| 116 | - | |
| 117 | - if (isset($iOrgID)) { | |
| 118 | - $oOrg = Organisation::get($iOrgID); | |
| 119 | - } | |
| 120 | - | |
| 121 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 122 | - $sToRender .= "<table>\n"; | |
| 123 | - $sToRender .= "<tr></tr>\n"; | |
| 124 | - $sToRender .= "<tr>\n"; | |
| 125 | - $sToRender .= "<td>" . _("Unit Name") . ": </td><td><input size = \"40\" type=\"text\" name=\"fUnitName\"> </td>\n"; | |
| 126 | - $sToRender .= "</tr>\n"; | |
| 127 | - $sToRender .= "<tr>\n"; | |
| 128 | - $sToRender .= "<td>" . _("Select an Organisation") . ": </td><td>" . getOrgDisplay($oOrg) ; | |
| 129 | - $sToRender .= "</tr>\n"; | |
| 130 | - $sToRender .= "<tr>\n"; | |
| 131 | - $sToRender .= "</tr>\n"; | |
| 132 | - $sToRender .= "<td></td><td align = right><input type=\"image\" src =\"" . KTHtml::getAddButton() . "\" value=\"Submit\" border=\"0\"/></td>\n"; | |
| 133 | - $sToRender .= "</table>\n"; | |
| 134 | - | |
| 135 | - return $sToRender; | |
| 136 | -} | |
| 137 | - | |
| 138 | -// if edition is successful print out success page | |
| 139 | -function getAddPageSuccess() { | |
| 140 | - global $default; | |
| 141 | - | |
| 142 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 143 | - $sToRender .= "<table>\n"; | |
| 144 | - $sToRender .= "<tr><td><b>" . _("Addition Successful!") . "</b></td></tr>\n"; | |
| 145 | - $sToRender .= "<tr></tr>\n"; | |
| 146 | - $sToRender .= "<tr><td>" . _("New Unit was successfully added") . "</td></tr>\n"; | |
| 147 | - $sToRender .= "<tr></tr>\n"; | |
| 148 | - $sToRender .= "<tr></tr>\n"; | |
| 149 | - $sToRender .= "<tr>\n"; | |
| 150 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 151 | - $sToRender .= "</tr>\n"; | |
| 152 | - $sToRender .= "</table>\n"; | |
| 153 | - | |
| 154 | - return $sToRender; | |
| 155 | -} | |
| 156 | - | |
| 157 | -// if edition is successful print out failure page | |
| 158 | -function getAddPageFail() { | |
| 159 | - global $default; | |
| 160 | - | |
| 161 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 162 | - $sToRender .= "<table>\n"; | |
| 163 | - $sToRender .= "<tr><td><b>" . _("Addition Unsuccessful") . "</b></td></tr>\n"; | |
| 164 | - $sToRender .= "<tr></tr>\n"; | |
| 165 | - $sToRender .= "<tr><td>" . _("The Unit was not added. Unit Name Already exists!") . "</td></tr>\n"; | |
| 166 | - $sToRender .= "<tr></tr>\n"; | |
| 167 | - $sToRender .= "<tr></tr>\n"; | |
| 168 | - $sToRender .= "<tr>\n"; | |
| 169 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 170 | - $sToRender .= "</tr>\n"; | |
| 171 | - $sToRender .= "</table>\n"; | |
| 172 | - | |
| 173 | - | |
| 174 | - return $sToRender; | |
| 175 | -} | |
| 176 | - | |
| 177 | - | |
| 178 | -// if edition is successful print otu success page | |
| 179 | -function getPageFail() { | |
| 180 | - global $default; | |
| 181 | - | |
| 182 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 183 | - $sToRender .= "<table>\n"; | |
| 184 | - $sToRender .= "<tr></tr>\n"; | |
| 185 | - $sToRender .= "<tr><td>" . _("Please enter a name AND Select the Organisation") . "</td></tr>\n"; | |
| 186 | - $sToRender .= "<tr></tr>\n"; | |
| 187 | - $sToRender .= "<tr></tr>\n"; | |
| 188 | - $sToRender .= "<tr>\n"; | |
| 189 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 190 | - $sToRender .= "</tr>\n"; | |
| 191 | - $sToRender .= "</table>\n"; | |
| 192 | - | |
| 193 | - | |
| 194 | - return $sToRender; | |
| 195 | -} | |
| 196 | -// if edition is successful print otu success page | |
| 197 | -function getAddPageToOrgFail() { | |
| 198 | - global $default; | |
| 199 | - | |
| 200 | - $sToRender .= renderHeading(_("Add Unit")); | |
| 201 | - $sToRender .= "<table>\n"; | |
| 202 | - $sToRender .= "<tr><td><b>" . _("Addition to Organisation Unsuccessful") . "</b></td></tr>\n"; | |
| 203 | - $sToRender .= "<tr></tr>\n"; | |
| 204 | - $sToRender .= "<tr><td>" . _("The Unit was not added to the Organisation.") . "</td></tr>\n"; | |
| 205 | - $sToRender .= "<tr></tr>\n"; | |
| 206 | - $sToRender .= "<tr></tr>\n"; | |
| 207 | - $sToRender .= "<tr>\n"; | |
| 208 | - $sToRender .= "<td></td><td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 209 | - $sToRender .= "</tr>\n"; | |
| 210 | - $sToRender .= "</table>\n"; | |
| 211 | - | |
| 212 | - | |
| 213 | - return $sToRender; | |
| 214 | -} | |
| 215 | - | |
| 216 | - | |
| 217 | -// show the list box when no unit selected | |
| 218 | -// then shows a text box with the unit's name | |
| 219 | -function getOrgDisplay($oOrg) { | |
| 220 | - global $default; | |
| 221 | - if (!isset($oOrg)) { | |
| 222 | - $oPatternListBox = & new PatternListBox($default->organisations_table, "name", "id", "fOrgID"); | |
| 223 | - return $oPatternListBox->render(); | |
| 224 | - } else { | |
| 225 | - return "<input type=\"hidden\" name=\"fOrgID\" value=\"" . $oOrg->iId . "\">\n" . | |
| 226 | - "" . $oOrg->getName() . "\">"; | |
| 227 | - } | |
| 228 | - | |
| 229 | -} | |
| 230 | - | |
| 231 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/removeUnitUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Remove a unit 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.unitmanagement | |
| 26 | - */ | |
| 27 | - | |
| 28 | -function getConfirmDeletePage($oUnit, $oOrg) { | |
| 29 | - global $default; | |
| 30 | - | |
| 31 | - $sToRender .= renderHeading(_("Remove Unit")); | |
| 32 | - $sToRender .= "<table>\n"; | |
| 33 | - $sToRender .= "<tr><td><b>" . _("Are you sure you wish to Remove this Unit:") . "</b></td></tr>\n"; | |
| 34 | - $sToRender .= "<tr>\n"; | |
| 35 | - $sToRender .= "<td>" . _("Unit Name") . ": " . getUnitDisplay($oUnit) . "</td>\n"; | |
| 36 | - $sToRender .= "</tr>\n"; | |
| 37 | - $sToRender .= "<tr>\n"; | |
| 38 | - $sToRender .= "</tr>\n"; | |
| 39 | - $sToRender .= "<tr>\n"; | |
| 40 | - $sToRender .= "<td>" . _("Organisation Name") . ": " . getOrgDisplay($oOrg) . "</td>\n"; | |
| 41 | - $sToRender .= "</tr>\n"; | |
| 42 | - $sToRender .= "<tr>\n"; | |
| 43 | - $sToRender .= "</tr>\n"; | |
| 44 | - $sToRender .= "<tr>\n"; | |
| 45 | - $sToRender .= getDeleteButton($oUnit); | |
| 46 | - $sToRender .= "</tr>\n"; | |
| 47 | - $sToRender .= "</table>\n"; | |
| 48 | - | |
| 49 | - return $sToRender; | |
| 50 | -} | |
| 51 | - | |
| 52 | -function getStatusPage($sHeading, $sText = "") { | |
| 53 | - | |
| 54 | - global $default; | |
| 55 | - | |
| 56 | - $sToRender .= renderHeading(_("Remove Unit")); | |
| 57 | - $sToRender .= "<table>\n"; | |
| 58 | - $sToRender .= "<tr>\n"; | |
| 59 | - $sToRender .= "<td><b>$sHeading</b></td>\n"; | |
| 60 | - $sToRender .= "</tr>\n"; | |
| 61 | - $sToRender .= "<tr><td>$sText</td></tr>\n"; | |
| 62 | - $sToRender .= "<tr><td align = right><a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td></tr>\n"; | |
| 63 | - $sToRender .= "</table>\n"; | |
| 64 | - | |
| 65 | - return $sToRender; | |
| 66 | -} | |
| 67 | - | |
| 68 | -// show listbox...or the text name | |
| 69 | -function getUnitDisplay($oUnit) { | |
| 70 | - global $default; | |
| 71 | - if (!isset($oUnit)) { | |
| 72 | - $oPatternListBox = & new PatternListBox($default->units_table, "name", "id", "fUnitID"); | |
| 73 | - $oPatternListBox->setIncludeDefaultValue(true); | |
| 74 | - $oPatternListBox->setPostBackOnChange(true); | |
| 75 | - return $oPatternListBox->render(); | |
| 76 | - } else { | |
| 77 | - return "<input type=\"hidden\" name=\"fUnitID\" value=\"" . $oUnit->iId . "\">\n" . | |
| 78 | - "<b>" . $oUnit->getName() . "</b>"; | |
| 79 | - } | |
| 80 | - | |
| 81 | -} | |
| 82 | - | |
| 83 | -// show listbox...or the text name | |
| 84 | -function getOrgDisplay($oOrg) { | |
| 85 | - global $default; | |
| 86 | - if (isset($oOrg)) { | |
| 87 | - return "<input type=\"hidden\" name=\"fOrgID\" value=\"" . $oOrg->iId . "\">\n" . | |
| 88 | - "<b>" . $oOrg->getName() . "</b>"; | |
| 89 | - } else { | |
| 90 | - return "<b>* " . _("Not Assigned to an Organisation") . "<b>"; | |
| 91 | - } | |
| 92 | -} | |
| 93 | - | |
| 94 | - | |
| 95 | -// show delete button | |
| 96 | -function getDeleteButton($oUnit) { | |
| 97 | - global $default; | |
| 98 | - if (isset($oUnit)) { | |
| 99 | - return "<td align = right><input type=\"image\" src =\"" . KTHtml::getDeleteButton() . "\" value=\"submit\" border=\"0\"/></td>\n". | |
| 100 | - "<td align = right><a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a></td>\n"; | |
| 101 | - } | |
| 102 | -} | |
| 103 | - | |
| 104 | - | |
| 105 | -// show cancel button | |
| 106 | -function getCancelButton($oUnit) { | |
| 107 | - global $default; | |
| 108 | - if (!isset($oUnit)) { | |
| 109 | - return "<td align = right><a href=\"$default->rootUrl/control.php?action=unitManagement\"><img src =\"" . KTHtml::getCancelButton() . "\" value=\"cancel\" /></a></td>\n"; | |
| 110 | - } else { | |
| 111 | - return "<td align = right><a href=\"$default->rootUrl/control.php?action=listUnits\"><img src =\"" . KTHtml::getCancelButton() . "\" border = \"0\" /></a></td>\n"; | |
| 112 | - } | |
| 113 | -} | |
| 114 | - | |
| 115 | -?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/unitManagement.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +//require_once('../../../../../config/dmsDefaults.php'); | |
| 4 | + | |
| 5 | +require_once(KT_LIB_DIR . '/unitmanagement/Unit.inc'); | |
| 6 | +require_once(KT_LIB_DIR . '/unitmanagement/UnitOrganisationLink.inc'); | |
| 7 | +require_once(KT_LIB_DIR . '/orgmanagement/Organisation.inc'); | |
| 8 | + | |
| 9 | +require_once(KT_LIB_DIR . "/templating/templating.inc.php"); | |
| 10 | +require_once(KT_LIB_DIR . "/dispatcher.inc.php"); | |
| 11 | +require_once(KT_LIB_DIR . "/templating/kt3template.inc.php"); | |
| 12 | +require_once(KT_LIB_DIR . "/widgets/fieldWidgets.php"); | |
| 13 | + | |
| 14 | +class KTUnitAdminDispatcher extends KTAdminDispatcher { | |
| 15 | + // Breadcrumbs base - added to in methods | |
| 16 | + var $aBreadcrumbs = array( | |
| 17 | + array('action' => 'administration', 'name' => 'Administration'), | |
| 18 | + ); | |
| 19 | + | |
| 20 | + function do_main() { | |
| 21 | + $this->aBreadcrumbs[] = array('action' => 'unitManagement', 'name' => 'Unit Management'); | |
| 22 | + $this->oPage->setBreadcrumbDetails('select a unit'); | |
| 23 | + $this->oPage->setTitle("Unit Management"); | |
| 24 | + | |
| 25 | + $unit_id= KTUtil::arrayGet($_REQUEST, 'unit_id', null); | |
| 26 | + if ($unit_id === null) { $for_edit = false; } | |
| 27 | + else { $for_edit = true; } | |
| 28 | + | |
| 29 | + | |
| 30 | + $add_fields = array(); | |
| 31 | + $add_fields[] = new KTStringWidget('Unit Name','The unit\'s visible name. e.g. <strong>Tech Support</strong>', 'name', null, $this->oPage, true); | |
| 32 | + | |
| 33 | + $unit_list =& Unit::getList(); | |
| 34 | + | |
| 35 | + $edit_fields = array(); | |
| 36 | + $edit_unit = null; | |
| 37 | + if ($for_edit === true) { | |
| 38 | + $oUnit = Unit::get($unit_id); | |
| 39 | + $edit_fields[] = new KTStringWidget('Unit Name','The unit\'s visible name. e.g. <strong>Tech Support</strong>', 'name', $oUnit->getName(), $this->oPage, true); | |
| 40 | + } | |
| 41 | + | |
| 42 | + $oTemplating = new KTTemplating; | |
| 43 | + $oTemplate = $oTemplating->loadTemplate("ktcore/principals/unitadmin"); | |
| 44 | + $aTemplateData = array( | |
| 45 | + "context" => $this, | |
| 46 | + "add_fields" => $add_fields, | |
| 47 | + "for_edit" => $for_edit, | |
| 48 | + "edit_fields" => $edit_fields, | |
| 49 | + "edit_unit" => $oUnit, | |
| 50 | + "unit_list" => $unit_list, | |
| 51 | + ); | |
| 52 | + return $oTemplate->render($aTemplateData); | |
| 53 | + } | |
| 54 | + | |
| 55 | + function do_updateUnit() { | |
| 56 | + $unit_id = KTUtil::arrayGet($_REQUEST, 'unit_id'); | |
| 57 | + $oUnit = Unit::get($unit_id); | |
| 58 | + if (PEAR::isError($oUnit) || ($oUnit == false)) { | |
| 59 | + $this->errorRedirectToMain('Please specify a unit.'); | |
| 60 | + exit(0); | |
| 61 | + } | |
| 62 | + | |
| 63 | + $unit_name = KTUtil::arrayGet($_REQUEST, 'name', null); | |
| 64 | + if (empty($unit_name)) { | |
| 65 | + $this->errorRedirectToMain('Please specify a unit name.'); | |
| 66 | + exit(0); | |
| 67 | + } | |
| 68 | + | |
| 69 | + $this->startTransaction(); | |
| 70 | + $oUnit->setName($unit_name); | |
| 71 | + $res = $oUnit->update(); | |
| 72 | + if (PEAR::isError($res)) { | |
| 73 | + $this->errorRedirectToMain('Failed to update unit name.'); | |
| 74 | + exit(0); | |
| 75 | + } | |
| 76 | + | |
| 77 | + $this->commitTransaction(); | |
| 78 | + $this->successRedirectToMain('Unit name changed to "' . $unit_name . '"'); | |
| 79 | + } | |
| 80 | + | |
| 81 | +} | |
| 82 | + | |
| 83 | + | |
| 84 | +?> | |
| 0 | 85 | \ No newline at end of file | ... | ... |
templates/kt3/fields/lookup.smarty
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | |
| 14 | 14 | <select name="{$name}" {if $has_id}id="{$id}"{/if} {if $options.multi}multiple="true"{/if} {if $options.size}size="{$options.size}"{/if}> |
| 15 | 15 | {foreach item=lookup key=lookup_key from=$options.vocab} |
| 16 | - <option value="{$lookup_key}" {if ($value === $lookup_key)}selected="selected"{/if}>{$lookup}</option> | |
| 16 | + <option value="{$lookup_key}" {if ($value == $lookup_key)}selected="selected"{/if}>{$lookup}</option> | |
| 17 | 17 | {/foreach} |
| 18 | 18 | </select> |
| 19 | 19 | <input type="hidden" name="kt_core_fieldsets_expect[{$name}]" value ="1" /> | ... | ... |
templates/ktcore/principals/groupadmin.smarty
| ... | ... | @@ -30,7 +30,6 @@ very slow if you have many groups.</p> |
| 30 | 30 | <th>Group Name</th> |
| 31 | 31 | <th>Unit Name</th> |
| 32 | 32 | <th>Edit</th> |
| 33 | - <th>Change Unit</th> | |
| 34 | 33 | <th>Manage Users</th> |
| 35 | 34 | <th>Manage sub-groups</th> |
| 36 | 35 | <th>Delete</th> |
| ... | ... | @@ -43,10 +42,10 @@ very slow if you have many groups.</p> |
| 43 | 42 | <tr> |
| 44 | 43 | <td>{$oGroup->getName()}</td> |
| 45 | 44 | <td>{if (!$oGroup->hasUnit())}<span class="descriptiveText">not part of a unit</span>{else} |
| 46 | - <strong>fixme</strong> unit. | |
| 45 | + {$context->_getUnitName($oGroup)} | |
| 46 | + | |
| 47 | 47 | {/if}</td> |
| 48 | 48 | <td><a href="?action=editGroup&group_id={$oGroup->getId()}" class="ktAction ktEdit">Edit</a></td> |
| 49 | - <td><a href="?action=changeUnit&group_id={$oGroup->getId()}">Change Unit</a></td> | |
| 50 | 49 | <td><a href="?action=manageUsers&group_id={$oGroup->getId()}">Manage Users</a></td> |
| 51 | 50 | <td><a href="?action=manageSubgroups&group_id={$oGroup->getId()}">Manage sub-groups</a></td> |
| 52 | 51 | <td><a href="?action=deleteGroup&group_id={$oGroup->getId()}" class="ktAction ktDelete">Delete</a></td> | ... | ... |
templates/ktcore/principals/orgadmin.smarty
0 → 100644
| 1 | +<h2>Orgnisation Administration</h2> | |
| 2 | + | |
| 3 | +<p class="descriptiveText"><strong>FIXME</strong> Overview of Organisations.</p> | |
| 4 | + | |
| 5 | +{if ($for_edit === true)} | |
| 6 | + | |
| 7 | +<form action="{$smarty.server.PHP_SELF}" method="GET"> | |
| 8 | +<fieldset> | |
| 9 | +<legend>Change organisation details</legend> | |
| 10 | + | |
| 11 | +asd | |
| 12 | +<input type="hidden" name="action" value="updateOrg" /> | |
| 13 | +<input type="hidden" name="org_id" value="{$edit_org->getId()}" /> | |
| 14 | + | |
| 15 | + | |
| 16 | +{foreach item=oWidget from=$edit_fields} | |
| 17 | + {$oWidget->render()} | |
| 18 | +{/foreach} | |
| 19 | + | |
| 20 | +<div class="form_actions"> | |
| 21 | + <input type="submit" value="update organisation information" /> | |
| 22 | +</div class="form_actions"> | |
| 23 | +</fieldset> | |
| 24 | +</form> | |
| 25 | + | |
| 26 | +{/if} | |
| 27 | + | |
| 28 | +<table class="listing"> | |
| 29 | +<thead> | |
| 30 | + <tr> | |
| 31 | + <th>Organisation Name</th> | |
| 32 | + <th>Edit</th> | |
| 33 | + </tr> | |
| 34 | +</thead> | |
| 35 | +<tbody> | |
| 36 | + {foreach item=oOrg from=$org_list} | |
| 37 | + <tr> | |
| 38 | + <td>{$oOrg->getName()}</td> | |
| 39 | + <td><a href="?org_id={$oOrg->getId()}" class="ktAction ktEdit">Edit</a></td> | |
| 40 | + | |
| 41 | + </tr> | |
| 42 | + {/foreach} | |
| 43 | +</tbody> | |
| 44 | +</table> | |
| 0 | 45 | \ No newline at end of file | ... | ... |
templates/ktcore/principals/unitadmin.smarty
0 → 100644
| 1 | +<h2>Unit Administration</h2> | |
| 2 | + | |
| 3 | +<p class="descriptiveText"><strong>FIXME</strong> Overview of units.</p> | |
| 4 | + | |
| 5 | +{if ($for_edit === false)} | |
| 6 | + | |
| 7 | +<form action="{$smarty.server.PHP_SELF}" method="GET"> | |
| 8 | +<fieldset> | |
| 9 | +<legend>Add a unit</legend> | |
| 10 | + | |
| 11 | +<input type="hidden" name="action" value="createUnit" /> | |
| 12 | + | |
| 13 | +{foreach item=oWidget from=$add_fields} | |
| 14 | + {$oWidget->render()} | |
| 15 | +{/foreach} | |
| 16 | + | |
| 17 | +<div class="form_actions"> | |
| 18 | + <input type="submit" value="create new unit" /> | |
| 19 | +</div class="form_actions"> | |
| 20 | +</fieldset> | |
| 21 | +</form> | |
| 22 | + | |
| 23 | +{else} | |
| 24 | + | |
| 25 | +<form action="{$smarty.server.PHP_SELF}" method="GET"> | |
| 26 | +<fieldset> | |
| 27 | +<legend>Change a unit's details</legend> | |
| 28 | + | |
| 29 | +<input type="hidden" name="action" value="updateUnit" /> | |
| 30 | +<input type="hidden" name="unit_id" value="{$edit_unit->getId()}" /> | |
| 31 | + | |
| 32 | +{foreach item=oWidget from=$edit_fields} | |
| 33 | + {$oWidget->render()} | |
| 34 | +{/foreach} | |
| 35 | + | |
| 36 | +<div class="form_actions"> | |
| 37 | + <input type="submit" value="update unit information" /> | |
| 38 | +</div class="form_actions"> | |
| 39 | +</fieldset> | |
| 40 | +</form> | |
| 41 | + | |
| 42 | + | |
| 43 | +{/if} | |
| 44 | + | |
| 45 | +<table class="listing"> | |
| 46 | +<thead> | |
| 47 | + <tr> | |
| 48 | + <th>Unit Name</th> | |
| 49 | + <th>Edit</th> | |
| 50 | + <th>Manage Members</th> | |
| 51 | + </tr> | |
| 52 | +</thead> | |
| 53 | +<tbody> | |
| 54 | + {foreach item=oUnit from=$unit_list} | |
| 55 | + <tr> | |
| 56 | + <td>{$oUnit->getName()}</td> | |
| 57 | + <td><a href="?action=editGroup&unit_id={$oUnit->getId()}" class="ktAction ktEdit">Edit</a></td> | |
| 58 | + <!-- <td><a href="?action=manageMembers&unit_id={$oUnit->getId()}">Manage Members</a></td> --> | |
| 59 | + </tr> | |
| 60 | + {/foreach} | |
| 61 | +</tbody> | |
| 62 | +</table> | |
| 0 | 63 | \ No newline at end of file | ... | ... |