Commit ac8057bacf910270c67f15e3d1546b539ab300e1
1 parent
7a876551
add revised preferences environment.
- TODO add preferences tabs from plugins. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4229 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
11 changed files
with
213 additions
and
352 deletions
config/siteMap.inc
| ... | ... | @@ -222,11 +222,11 @@ $default->siteMap->addSectionColour("Advanced Search", "th", "A1571B"); |
| 222 | 222 | $default->siteMap->addSectionColour("Standard Search", "th", "A1571B"); |
| 223 | 223 | |
| 224 | 224 | // pages for prefs section |
| 225 | -$default->siteMap->addDefaultPage("preferences", "/presentation/lookAndFeel/knowledgeTree/preferences/editUserPrefsBL.php", "Preferences", User, _("Preferences")); | |
| 226 | -$default->siteMap->addPage("editPrefsSuccess", "/presentation/lookAndFeel/knowledgeTree/preferences/editPrefsSuccess.php", "Preferences", User, "Preferences", false); | |
| 227 | -$default->siteMap->addPage("changeUserPassword", "/presentation/lookAndFeel/knowledgeTree/preferences/passwordManagementBL.php", "Preferences", User, "Preferences", false); | |
| 228 | -$default->siteMap->addSectionColour("Preferences", "th", "F87308"); | |
| 229 | -$default->siteMap->addSectionColour("Preferences", "td", "FEE3CE"); | |
| 225 | +$default->siteMap->addDefaultPage("preferences", "/presentation/lookAndFeel/knowledgeTree/preferences/preferences.php", "Preferences", User, _("Preferences")); | |
| 226 | +//$default->siteMap->addPage("editPrefsSuccess", "/presentation/lookAndFeel/knowledgeTree/preferences/editPrefsSuccess.php", "Preferences", User, "Preferences", false); | |
| 227 | +//$default->siteMap->addPage("changeUserPassword", "/presentation/lookAndFeel/knowledgeTree/preferences/passwordManagementBL.php", "Preferences", User, "Preferences", false); | |
| 228 | +//$default->siteMap->addSectionColour("Preferences", "th", "F87308"); | |
| 229 | +//$default->siteMap->addSectionColour("Preferences", "td", "FEE3CE"); | |
| 230 | 230 | |
| 231 | 231 | // pages for Help section |
| 232 | 232 | $default->siteMap->addDefaultPage("help", "/presentation/lookAndFeel/knowledgeTree/help.php", "Help", Guest, _("Help")); | ... | ... |
lib/templating/kt3template.inc.php
| ... | ... | @@ -177,10 +177,12 @@ class KTPage { |
| 177 | 177 | } else if ($sSection == 'search') { |
| 178 | 178 | $this->componentLabel = 'Search'; |
| 179 | 179 | $this->componentClass = 'search'; |
| 180 | - } else if ($sSection == 'browse') { | |
| 180 | + } else if ($sSection == 'preferences') { | |
| 181 | + $this->componentLabel = 'Preferences'; | |
| 182 | + $this->componentClass = 'preferences'; | |
| 181 | 183 | } else { |
| 182 | - $this->componentLabel = 'DMS Administration'; | |
| 183 | - $this->componentClass = 'administration'; | |
| 184 | + $this->componentLabel = 'Dashboard'; | |
| 185 | + $this->componentClass = 'dashboard'; | |
| 184 | 186 | } |
| 185 | 187 | |
| 186 | 188 | } | ... | ... |
presentation/lookAndFeel/knowledgeTree/preferences/editPrefsSuccess.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit user preferences 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 preferences | |
| 26 | - */ | |
| 27 | - | |
| 28 | -require_once("../../../../config/dmsDefaults.php"); | |
| 29 | -require_once("editUserPrefsUI.inc"); | |
| 30 | - | |
| 31 | -global $default; | |
| 32 | - | |
| 33 | -if(checkSession()) { | |
| 34 | - | |
| 35 | - // include the page template (with navbar) | |
| 36 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 37 | - | |
| 38 | - $oPatternCustom = & new PatternCustom(); | |
| 39 | - $oPatternCustom->setHtml(getEditPageSuccess()); | |
| 40 | - $main->setCentralPayload($oPatternCustom); | |
| 41 | - $main->render(); | |
| 42 | - | |
| 43 | -} | |
| 44 | -?> | |
| 45 | 0 | \ No newline at end of file |
presentation/lookAndFeel/knowledgeTree/preferences/editUserPrefsBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit user preferences. | |
| 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 preferences | |
| 26 | - */ | |
| 27 | -require_once("../../../../config/dmsDefaults.php"); | |
| 28 | - | |
| 29 | -if (checkSession()) { | |
| 30 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 31 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc"); | |
| 32 | - require_once("editUserPrefsUI.inc"); | |
| 33 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 34 | - require_once("$default->fileSystemRoot/lib/users/User.inc"); | |
| 35 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 39 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 40 | - | |
| 41 | - | |
| 42 | - $oPatternCustom = & new PatternCustom(); | |
| 43 | - | |
| 44 | - $oPatternCustom->setHtml(getUserDetailsPage($_SESSION['userID'])); | |
| 45 | - $_SESSION["pageAccess"][$default->rootUrl . '/presentation/lookAndFeel/knowledgeTree/store.php'] = true; | |
| 46 | - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/store.php?fReturnURL=" . urlencode("$default->rootUrl/control.php?action=editPrefsSuccess")); | |
| 47 | - | |
| 48 | - $main->setCentralPayload($oPatternCustom); | |
| 49 | - $main->render(); | |
| 50 | -} | |
| 51 | -?> |
presentation/lookAndFeel/knowledgeTree/preferences/editUserPrefsUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Edit user preferences UI functions. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * Modified 2004 by William Hawkins | |
| 9 | - * | |
| 10 | - * This program is free software; you can redistribute it and/or modify | |
| 11 | - * it under the terms of the GNU General Public License as published by | |
| 12 | - * the Free Software Foundation; either version 2 of the License, or | |
| 13 | - * (at your option) any later version. | |
| 14 | - * | |
| 15 | - * This program is distributed in the hope that it will be useful, | |
| 16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | - * GNU General Public License for more details. | |
| 19 | - * | |
| 20 | - * You should have received a copy of the GNU General Public License | |
| 21 | - * along with this program; if not, write to the Free Software | |
| 22 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 | - * | |
| 24 | - * @version $Revision$ | |
| 25 | - * @author Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | |
| 26 | - * @package preferences | |
| 27 | - */ | |
| 28 | - | |
| 29 | -function getUserDetailsPage($iUserID) { | |
| 30 | - global $default; | |
| 31 | - /*ok*/ $sQuery = array("SELECT * FROM $default->users_table WHERE id = ?", $iUserID); | |
| 32 | - $aDisplayColumns = array("name", "email", "mobile", "email_notification"); | |
| 33 | - $aStoreColumns = array("name", "email", "mobile", "email_notification"); | |
| 34 | - $aColumnNames = array(_("Name") . ": ", _("Email Address") . ": ", _("Mobile Number") . ": ", _("Email Notification") . ": "); | |
| 35 | - $aDisplayColumnTypes = array(1, 1, 1, 2); | |
| 36 | - $aDatabaseColumnTypes = array(1, 1, 1, 2); | |
| 37 | - | |
| 38 | - // get list of User properties...name...text field...is_Sys_admin and is_unit_admin..checkboxes | |
| 39 | - $oPattern = & new PatternEditableListFromQuery($sQuery, $default -> users_table, $aDisplayColumns, $aStoreColumns, $aColumnNames, $aDisplayColumnTypes, $aDatabaseColumnTypes); | |
| 40 | - $oPattern -> setUniqueName("userEdit"); | |
| 41 | - $oPattern -> setColumnsRequired(array(1, 0, 0, 0)); | |
| 42 | - | |
| 43 | - $sToRender.= renderHeading(_("Preferences")); | |
| 44 | - $sToRender.= "<table width=\"600\">\n"; | |
| 45 | - $sToRender.= "<tr></tr>\n"; | |
| 46 | - $sToRender.= "<tr/><tr/><tr><td><b>" . _("Edit User Properties") . ":</b></td></tr>\n"; | |
| 47 | - $sToRender.= "<tr>\n"; | |
| 48 | - $sToRender.= "<td>".$oPattern -> render()."</td>\n"; | |
| 49 | - $sToRender.= "</tr>\n"; | |
| 50 | - $sToRender.= "<tr>\n"; | |
| 51 | - $sToRender.= "</tr>\n"; | |
| 52 | - $sToRender.= "<tr>\n"; | |
| 53 | - $sToRender.= "</tr>\n"; | |
| 54 | - | |
| 55 | - $sToRender.= "<tr><td><input type=\"image\" src =\"" . KTHtml::getUpdateButton() . "\" value=\"Update\" border=\"0\"/>\n"; | |
| 56 | - if (strcmp($default -> authenticationClass, "DBAuthenticator") == 0) { | |
| 57 | - $sToRender.= "<a href=\"$default->rootUrl/control.php?action=changeUserPassword\"><img src =\"" . KTHtml::getUpdatePasswordButton() . "\" border=\"0\" /></td></tr>\n"; | |
| 58 | - } | |
| 59 | - $sToRender.= "</table>\n"; | |
| 60 | - return $sToRender; | |
| 61 | -} | |
| 62 | - | |
| 63 | -function getEditPageSuccess() { | |
| 64 | - global $default; | |
| 65 | - $sToRender.= renderHeading(_("Preferences")); | |
| 66 | - $sToRender.= "<table width=\"600\">\n"; | |
| 67 | - $sToRender.= "<tr/><tr/><tr><td><b>" . _("Success") . "!</b></td></tr>\n"; | |
| 68 | - $sToRender.= "<tr><td>" . _("The User was successfully modified") . "</td></tr>\n"; | |
| 69 | - $sToRender.= "<tr></tr>\n"; | |
| 70 | - $sToRender.= "<tr></tr>\n"; | |
| 71 | - $sToRender.= "<tr>\n"; | |
| 72 | - $sToRender.= "<td><a href=\"$default->rootUrl/control.php?action=preferences\"><img src =\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a></td>\n"; | |
| 73 | - $sToRender.= "</tr>\n"; | |
| 74 | - $sToRender.= "</table>\n"; | |
| 75 | - return $sToRender; | |
| 76 | -} | |
| 77 | - | |
| 78 | -function getEditPageFail() { | |
| 79 | - global $default; | |
| 80 | - $sToRender.= renderHeading(_("Preferences")); | |
| 81 | - $sToRender.= "<table>\n"; | |
| 82 | - $sToRender.= "<tr/><tr/>\n"; | |
| 83 | - $sToRender.= "<tr><td>" . _("User 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=preferences\"><img src =\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a></td>\n"; | |
| 88 | - $sToRender.= "</tr>\n"; | |
| 89 | - $sToRender.= "</table>\n"; | |
| 90 | - return $sToRender; | |
| 91 | -} |
presentation/lookAndFeel/knowledgeTree/preferences/passwordManagementBL.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Change a user's password | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * Modified 2004 by William Hawkins | |
| 9 | - * | |
| 10 | - * This program is free software; you can redistribute it and/or modify | |
| 11 | - * it under the terms of the GNU General Public License as published by | |
| 12 | - * the Free Software Foundation; either version 2 of the License, or | |
| 13 | - * (at your option) any later version. | |
| 14 | - * | |
| 15 | - * This program is distributed in the hope that it will be useful, | |
| 16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | - * GNU General Public License for more details. | |
| 19 | - * | |
| 20 | - * You should have received a copy of the GNU General Public License | |
| 21 | - * along with this program; if not, write to the Free Software | |
| 22 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 | - * | |
| 24 | - * @version $Revision$ | |
| 25 | - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | |
| 26 | - * @package administration.usermanagement | |
| 27 | - */ | |
| 28 | - | |
| 29 | -require_once("../../../../config/dmsDefaults.php"); | |
| 30 | - | |
| 31 | -KTUtil::extractGPC('fForUpdate', 'fNewPassword', 'fNewPasswordConfirm'); | |
| 32 | - | |
| 33 | -if (checkSession()) { | |
| 34 | - require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | |
| 35 | - require_once("$default->fileSystemRoot/lib/users/User.inc"); | |
| 36 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 37 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 38 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 39 | - require_once("passwordManagementUI.inc"); | |
| 40 | - | |
| 41 | - $oPatternCustom = & new PatternCustom(); | |
| 42 | - | |
| 43 | - if (strcmp($default->authenticationClass,"DBAuthenticator") == 0) { | |
| 44 | - //only update passwords if we are in db authentication mode | |
| 45 | - $oUser = User::get($_SESSION["userID"]); | |
| 46 | - if (isset($fForUpdate)) { | |
| 47 | - //execute the update and return to the edit page?? | |
| 48 | - if (strlen($fNewPassword) > 0 && strlen($fNewPasswordConfirm) > 0) { | |
| 49 | - //if passwords have been entered | |
| 50 | - if (strcmp($fNewPassword, $fNewPasswordConfirm) == 0) { | |
| 51 | - //if the password and its confirmation are the same | |
| 52 | - $oUser->setPassword($fNewPassword); | |
| 53 | - if ($oUser->update()) { | |
| 54 | - //successful update | |
| 55 | - $oPatternCustom->setHtml(getPasswordUpdateSuccessPage()); | |
| 56 | - } else { | |
| 57 | - //update failed | |
| 58 | - $oPatternCustom->setHtml(getPage($oUser->getName())); | |
| 59 | - $main->setErrorMessage(_("An error occured while attempting to update the user's password")); | |
| 60 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForUpdate=1"); | |
| 61 | - } | |
| 62 | - } else { | |
| 63 | - $oPatternCustom->setHtml(getPage($oUser->getName())); | |
| 64 | - $main->setErrorMessage(_("The password and its confirmation do not match. Please try again.")); | |
| 65 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForUpdate=1"); | |
| 66 | - } | |
| 67 | - } else { | |
| 68 | - $oPatternCustom->setHtml(getPage($oUser->getName())); | |
| 69 | - $main->setErrorMessage(_("Blank passwords are not valid. Please try again.")); | |
| 70 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForUpdate=1"); | |
| 71 | - } | |
| 72 | - } else { | |
| 73 | - //show the form | |
| 74 | - $oPatternCustom->setHtml(getPage($oUser->getName())); | |
| 75 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForUpdate=1"); | |
| 76 | - } | |
| 77 | - | |
| 78 | - } else { | |
| 79 | - $oPatternCustom->setHtml(getPage($oUser->getName())); | |
| 80 | - $main->setErrorMessage(_("Passwords can only be updated in Knowledge Tree when authentication is against the database, not against an LDAP server")); | |
| 81 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 82 | - } | |
| 83 | - //render the page | |
| 84 | - $main->setCentralPayload($oPatternCustom); | |
| 85 | - $main->render(); | |
| 86 | -} | |
| 87 | -?> |
presentation/lookAndFeel/knowledgeTree/preferences/passwordManagementUI.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Updaate user password | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * Modified 2004 by William Hawkins | |
| 9 | - * | |
| 10 | - * This program is free software; you can redistribute it and/or modify | |
| 11 | - * it under the terms of the GNU General Public License as published by | |
| 12 | - * the Free Software Foundation; either version 2 of the License, or | |
| 13 | - * (at your option) any later version. | |
| 14 | - * | |
| 15 | - * This program is distributed in the hope that it will be useful, | |
| 16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | - * GNU General Public License for more details. | |
| 19 | - * | |
| 20 | - * You should have received a copy of the GNU General Public License | |
| 21 | - * along with this program; if not, write to the Free Software | |
| 22 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 | - * | |
| 24 | - * @version $Revision$ | |
| 25 | - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | |
| 26 | - * @package administration.usermanagement | |
| 27 | - */ | |
| 28 | - | |
| 29 | -function getPage($sUserName) { | |
| 30 | - global $default; | |
| 31 | - $sToRender = renderHeading(_("Update user password")); | |
| 32 | - $sToRender.= "<br>\n"; | |
| 33 | - $sToRender.= "<table cellpadding=\"5\">\n"; | |
| 34 | - $sToRender.= "<tr>\n"; | |
| 35 | - $sToRender.= "<td bgcolor=\"FEE3CE\">" . _("User name") . ": </td>\n"; | |
| 36 | - $sToRender.= "<td bgcolor=\"F5F6EE\">$sUserName</td>\n"; | |
| 37 | - $sToRender.= "</tr>\n"; | |
| 38 | - $sToRender.= "<tr>\n"; | |
| 39 | - $sToRender.= "<td bgcolor=\"FEE3CE\">" . _("New password") . ": </td>\n"; | |
| 40 | - $sToRender.= "<td bgcolor=\"F5F6EE\"><input type=\"password\" name=\"fNewPassword\"></td>\n"; | |
| 41 | - $sToRender.= "</tr>\n"; | |
| 42 | - $sToRender.= "<tr>\n"; | |
| 43 | - $sToRender.= "<td bgcolor=\"FEE3CE\">" . _("Confirm password") . ": </td>\n"; | |
| 44 | - $sToRender.= "<td bgcolor=\"F5F6EE\"><input type=\"password\" name=\"fNewPasswordConfirm\"></td>\n"; | |
| 45 | - $sToRender.= "</tr>\n"; | |
| 46 | - $sToRender.= "<tr>\n"; | |
| 47 | - $sToRender.= "</tr>\n"; | |
| 48 | - $sToRender.= "<tr>\n"; | |
| 49 | - $sToRender.= "<td colspan=\"2\" align=\"right\">"; | |
| 50 | - $sToRender.= "<td align = right><input type=\"image\" src =\"" . KTHtml::getUpdateButton() . "\" value=\"Update\" border=\"0\"/>"; | |
| 51 | - $sToRender.= "<a href=\"$default->rootUrl/control.php?action=preferences\"><img src =\"" . KTHtml::getCancelButton() . "\" value=\"cancel\" border=\"0\"/></a>\n"; | |
| 52 | - $sToRender.= "</tr>\n"; | |
| 53 | - $sToRender.= "</table>\n"; | |
| 54 | - return $sToRender; | |
| 55 | -} | |
| 56 | - | |
| 57 | -function getPasswordUpdateSuccessPage() { | |
| 58 | - global $default; | |
| 59 | - $sToRender.= renderHeading(_("Update user password")); | |
| 60 | - $sToRender.= "<br>\n"; | |
| 61 | - $sToRender.= "<table>\n"; | |
| 62 | - $sToRender.= "<tr><td>" . _("The user's password was successfully updated") . "</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=preferences\"><img src =\"" . KTHtml::getBackButton() . "\" border = \"0\" /></a></td>\n"; | |
| 67 | - $sToRender.= "</tr>\n"; | |
| 68 | - $sToRender.= "</table>\n"; | |
| 69 | - return $sToRender; | |
| 70 | -} | |
| 71 | -?> |
presentation/lookAndFeel/knowledgeTree/preferences/preferences.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +// main library routines and defaults | |
| 4 | +require_once("../../../../config/dmsDefaults.php"); | |
| 5 | +require_once(KT_LIB_DIR . "/unitmanagement/Unit.inc"); | |
| 6 | + | |
| 7 | +require_once(KT_LIB_DIR . "/templating/templating.inc.php"); | |
| 8 | +require_once(KT_LIB_DIR . "/templating/kt3template.inc.php"); | |
| 9 | +require_once(KT_LIB_DIR . "/dispatcher.inc.php"); | |
| 10 | + | |
| 11 | +require_once(KT_LIB_DIR . '/widgets/fieldWidgets.php'); | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | +class DashboardDispatcher extends KTStandardDispatcher { | |
| 16 | + var $sSection = 'preferences'; | |
| 17 | + // Breadcrumbs base - added to in methods | |
| 18 | + var $aBreadcrumbs = array( | |
| 19 | + array('action' => 'preferences', 'name' => 'Preferences'), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + function do_main() { | |
| 23 | + $this->oPage->setBreadcrumbDetails("Your Preferences"); | |
| 24 | + $this->oPage->title = "Dashboard"; // FIXME should this be a mutator? | |
| 25 | + | |
| 26 | + | |
| 27 | + $oUser =& $this->oUser; | |
| 28 | + | |
| 29 | + | |
| 30 | + $edit_fields = array(); | |
| 31 | + $edit_fields[] = new KTStringWidget('Name','Your full name. This is shown in reports and listings. e.g. <strong>John Smith</strong>', 'name', $oUser->getName(), $this->oPage, true); | |
| 32 | + $edit_fields[] = new KTStringWidget('Email Address','Your email address. Notifications and alerts are mailed to this address if <strong>email notifications</strong> is set below. e.g. <strong>jsmith@acme.com</strong>', 'email_address', $oUser->getEmail(), $this->oPage, false); | |
| 33 | + $edit_fields[] = new KTCheckboxWidget('Email Notifications','If this is specified then the you will receive certain notifications. If it isn\'t set, then you will only see notifications on the <strong>Dashboard</strong>', 'email_notifications', $oUser->getEmailNotification(), $this->oPage, false); | |
| 34 | + $edit_fields[] = new KTStringWidget('Mobile Number','Your mobile phone number. If the system is configured to send notifications to cellphones, then this number will be SMS\'d with notifications. e.g. <strong>+27 99 999 9999</strong>', 'mobile_number', $oUser->getMobile(), $this->oPage, false); | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + $oTemplating = new KTTemplating; | |
| 39 | + $oTemplate = $oTemplating->loadTemplate("ktcore/principals/preferences"); | |
| 40 | + $aTemplateData = array( | |
| 41 | + "context" => $this, | |
| 42 | + 'edit_fields' => $edit_fields, | |
| 43 | + ); | |
| 44 | + return $oTemplate->render($aTemplateData); | |
| 45 | + } | |
| 46 | + | |
| 47 | + function do_setPassword() { | |
| 48 | + $this->oPage->setBreadcrumbDetails("Your Password"); | |
| 49 | + $this->oPage->title = "Dashboard"; // FIXME should this be a mutator? | |
| 50 | + | |
| 51 | + | |
| 52 | + $oUser =& $this->oUser; | |
| 53 | + | |
| 54 | + $edit_fields = array(); | |
| 55 | + $edit_fields[] = new KTPasswordWidget('Password','Specify your new password..', 'password', null, $this->oPage, true); | |
| 56 | + $edit_fields[] = new KTPasswordWidget('Confirm Password','Confirm the password specified above.', 'confirm_password', null, $this->oPage, true); | |
| 57 | + | |
| 58 | + | |
| 59 | + $oTemplating = new KTTemplating; | |
| 60 | + $oTemplate = $oTemplating->loadTemplate("ktcore/principals/password"); | |
| 61 | + $aTemplateData = array( | |
| 62 | + "context" => $this, | |
| 63 | + 'edit_fields' => $edit_fields, | |
| 64 | + ); | |
| 65 | + return $oTemplate->render($aTemplateData); | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + function do_updatePassword() { | |
| 71 | + | |
| 72 | + $password = KTUtil::arrayGet($_REQUEST, 'password'); | |
| 73 | + $confirm_password = KTUtil::arrayGet($_REQUEST, 'confirm_password'); | |
| 74 | + | |
| 75 | + if (empty($password)) { | |
| 76 | + $this->errorRedirectToMain("You must specify a password for the user."); | |
| 77 | + } else if ($password !== $confirm_password) { | |
| 78 | + $this->errorRedirectToMain("The passwords you specified do not match."); | |
| 79 | + } | |
| 80 | + // FIXME more validation would be useful. | |
| 81 | + // validated and ready.. | |
| 82 | + $this->startTransaction(); | |
| 83 | + | |
| 84 | + $oUser =& $this->oUser; | |
| 85 | + | |
| 86 | + | |
| 87 | + // FIXME this almost certainly has side-effects. do we _really_ want | |
| 88 | + $oUser->setPassword(md5($password)); // | |
| 89 | + | |
| 90 | + $res = $oUser->update(); | |
| 91 | + //$res = $oUser->doLimitedUpdate(); // ignores a fix blacklist of items. | |
| 92 | + | |
| 93 | + | |
| 94 | + if (PEAR::isError($res) || ($res == false)) { | |
| 95 | + $this->errorRedirectoToMain('Failed to update user.'); | |
| 96 | + } | |
| 97 | + | |
| 98 | + $this->commitTransaction(); | |
| 99 | + $this->successRedirectToMain('Your password has been changed.'); | |
| 100 | + | |
| 101 | + } | |
| 102 | + | |
| 103 | + | |
| 104 | + function do_saveUser() { | |
| 105 | + $oUser =& $this->oUser; | |
| 106 | + | |
| 107 | + $name = KTUtil::arrayGet($_REQUEST, 'name'); | |
| 108 | + if (empty($name)) { | |
| 109 | + $this->errorRedirectToMain('You must specify your name.'); | |
| 110 | + } | |
| 111 | + | |
| 112 | + $email_address = KTUtil::arrayGet($_REQUEST, 'email_address'); | |
| 113 | + $email_notifications = KTUtil::arrayGet($_REQUEST, 'email_notifications', false); | |
| 114 | + if ($email_notifications !== false) $email_notifications = true; | |
| 115 | + $mobile_number = KTUtil::arrayGet($_REQUEST, 'mobile_number'); | |
| 116 | + | |
| 117 | + | |
| 118 | + $this->startTransaction(); | |
| 119 | + | |
| 120 | + $oUser->setName($name); | |
| 121 | + $oUser->setEmail($email_address); | |
| 122 | + $oUser->setEmailNotification($email_notifications); | |
| 123 | + $oUser->setMobile($mobile_number); | |
| 124 | + | |
| 125 | + | |
| 126 | + // old system used the very evil store.php. | |
| 127 | + // here we need to _force_ a limited update of the object, via a db statement. | |
| 128 | + // | |
| 129 | + // $res = $oUser->update(); | |
| 130 | + $res = $oUser->doLimitedUpdate(); // ignores a fix blacklist of items. | |
| 131 | + | |
| 132 | + if (PEAR::isError($res) || ($res == false)) { | |
| 133 | + $this->errorRedirectoToMain('Failed to update your details.'); | |
| 134 | + } | |
| 135 | + | |
| 136 | + $this->commitTransaction(); | |
| 137 | + $this->successRedirectToMain('Your details have been updated.'); | |
| 138 | + | |
| 139 | + } | |
| 140 | + | |
| 141 | + | |
| 142 | +} | |
| 143 | + | |
| 144 | +$oDispatcher = new DashboardDispatcher(); | |
| 145 | +$oDispatcher->dispatch(); | |
| 146 | + | |
| 147 | +?> | |
| 0 | 148 | \ No newline at end of file | ... | ... |
resources/css/kt-headings.css
| ... | ... | @@ -12,6 +12,17 @@ |
| 12 | 12 | #content h1.browse_collections .fahrner { display: none; } |
| 13 | 13 | |
| 14 | 14 | |
| 15 | +#content h1.preferences { | |
| 16 | + border: 1px solid #565963; | |
| 17 | + height: 20px; | |
| 18 | + background: #a0a9b8 url(/resources/graphics/fahrner_preferences.png) center left no-repeat; | |
| 19 | + padding: 5px; | |
| 20 | + color: white; | |
| 21 | +} | |
| 22 | + | |
| 23 | +#content h1.preferences .fahrner { display: none; } | |
| 24 | + | |
| 25 | + | |
| 15 | 26 | #content h1.dashboard { |
| 16 | 27 | border: 1px solid #565963; |
| 17 | 28 | height: 40px; | ... | ... |
templates/ktcore/principals/password.smarty
0 → 100644
| 1 | +<h2>Password</h2> | |
| 2 | + | |
| 3 | +<p class="descriptiveText"><strong>FIXME</strong> better helptext. Change your password.</p> | |
| 4 | + | |
| 5 | +<form action="{$smarty.server.PHP_SELF}" method="POST"> | |
| 6 | +<input type="hidden" name="action" value="updatePassword" /> | |
| 7 | + | |
| 8 | +<fieldset> | |
| 9 | + <legend>Your Details</legend> | |
| 10 | + | |
| 11 | + {foreach item=oWidget from=$edit_fields} | |
| 12 | + {$oWidget->render()} | |
| 13 | + {/foreach} | |
| 14 | + | |
| 15 | + <div class="form_actions"> | |
| 16 | + <input type="submit" value="Change your password" /> | |
| 17 | + <!-- FIXME add CSS for secondary actions. --> | |
| 18 | + <p><a href="?action=setPassword">Change your password.</a></p> | |
| 19 | + </div> | |
| 20 | +</fieldset> | |
| 21 | + | |
| 22 | +</form> | |
| 0 | 23 | \ No newline at end of file | ... | ... |
templates/ktcore/principals/preferences.smarty
0 → 100644
| 1 | +<h2>Preferences</h2> | |
| 2 | + | |
| 3 | +<p class="descriptiveText">From here you can adjust certain basic preferences about | |
| 4 | +how you work with KnowledgeTree.</p> | |
| 5 | + | |
| 6 | +<form action="{$smarty.server.PHP_SELF}" method="POST"> | |
| 7 | +<input type="hidden" name="action" value="updatePreferences" /> | |
| 8 | + | |
| 9 | +<fieldset> | |
| 10 | + <legend>Your Details</legend> | |
| 11 | + | |
| 12 | + {foreach item=oWidget from=$edit_fields} | |
| 13 | + {$oWidget->render()} | |
| 14 | + {/foreach} | |
| 15 | + | |
| 16 | + <div class="form_actions"> | |
| 17 | + <input type="submit" value="Update your details" /> | |
| 18 | + <!-- FIXME add CSS for secondary actions. --> | |
| 19 | + <p><a href="?action=setPassword">Change your password.</a></p> | |
| 20 | + </div> | |
| 21 | +</fieldset> | |
| 22 | + | |
| 23 | +</form> | |
| 0 | 24 | \ No newline at end of file | ... | ... |