From 213ce29d7ae2080bc38d25ebec12e1a724fb012a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 9 Oct 2005 15:56:13 +0000 Subject: [PATCH] r510: - extracted fieldset and legend definitions to fields.css - added userctrl.php and userctrl.tpl - completed user options page --- docs/todo.txt | 1 - templates/fields.css | 41 ++++++++++ templates/global.css | 1 + templates/newreport.tpl | 1 + templates/report.css | 24 ------ templates/search.tpl | 1 + templates/showreport.tpl | 1 + templates/userctrl.tpl | 98 +++++++++++++++++++++++ userctrl.php | 168 +++++++++++++++++++++++++++++++++++++++ 9 files changed, 311 insertions(+), 25 deletions(-) create mode 100644 templates/fields.css create mode 100644 templates/userctrl.tpl create mode 100644 userctrl.php diff --git a/docs/todo.txt b/docs/todo.txt index e6e0b8f..649dc1d 100755 --- a/docs/todo.txt +++ b/docs/todo.txt @@ -7,7 +7,6 @@ BUGTRACK 1.0 - Add per-product-usergroup permission settings - Ability to disable status colouring on listing pages -- User options/controls page ############################################################################### BUGTRACK 1.1 diff --git a/templates/fields.css b/templates/fields.css new file mode 100644 index 0000000..c6523d7 --- /dev/null +++ b/templates/fields.css @@ -0,0 +1,41 @@ +/*=====================================================================*\ +|| ################################################################### || +|| # BugStrike [#]version[#] +|| # --------------------------------------------------------------- # || +|| # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # || +|| # This file may not be reproduced in any way without permission. # || +|| # --------------------------------------------------------------- # || +|| # User License Agreement at http://www.iris-studios.com/license/ # || +|| ################################################################### || +\*=====================================================================*/ + +legend +{ + background-color: rgb(51, 51, 51); + font-weight: bold; + font-size: 11px; + margin-left: 10px; + color: rgb(255, 255, 255); + padding: 2px; + border: 1px solid rgb(0, 0, 0); +} + + legend a + { + color: rgb(255, 255, 255); + } + +fieldset +{ + border-width: 1px 0px 0px 0px; + border-color: rgb(0, 0, 0); + border-style: solid; + padding: 5px; +} + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ \ No newline at end of file diff --git a/templates/global.css b/templates/global.css index a6847cb..04bfabc 100644 --- a/templates/global.css +++ b/templates/global.css @@ -32,6 +32,7 @@ a .error { color: rgb(255, 0, 0); + text-align: left; } #header diff --git a/templates/newreport.tpl b/templates/newreport.tpl index 9184ff7..d6c33e4 100644 --- a/templates/newreport.tpl +++ b/templates/newreport.tpl @@ -3,6 +3,7 @@ $doctype $headinclude + {@"New Bug Report"} - {$bugsys->options['trackertitle']} diff --git a/templates/report.css b/templates/report.css index 2cb5542..461c82c 100644 --- a/templates/report.css +++ b/templates/report.css @@ -31,30 +31,6 @@ margin-left: 50%; } -legend -{ - background-color: rgb(51, 51, 51); - font-weight: bold; - font-size: 11px; - margin-left: 10px; - color: rgb(255, 255, 255); - padding: 2px; - border: 1px solid rgb(0, 0, 0); -} - - legend a - { - color: rgb(255, 255, 255); - } - -fieldset -{ - border-width: 1px 0px 0px 0px; - border-color: rgb(0, 0, 0); - border-style: solid; - padding: 5px; -} - /* ################################################################### */ #votes, #yourvote, #votesfifty, #voteshundred diff --git a/templates/search.tpl b/templates/search.tpl index 29a10cf..2901004 100644 --- a/templates/search.tpl +++ b/templates/search.tpl @@ -3,6 +3,7 @@ $doctype $headinclude + {$bugsys->options['trackertitle']} - {@"Search"} diff --git a/templates/showreport.tpl b/templates/showreport.tpl index 8549da3..cd55731 100644 --- a/templates/showreport.tpl +++ b/templates/showreport.tpl @@ -3,6 +3,7 @@ $doctype $headinclude + <lang 1="$bug[bugid]">{@"Bug Report %1$s"}</lang> - $bug[summary] diff --git a/templates/userctrl.tpl b/templates/userctrl.tpl new file mode 100644 index 0000000..a56ba94 --- /dev/null +++ b/templates/userctrl.tpl @@ -0,0 +1,98 @@ +$doctype + + +$headinclude + + + {$bugsys->options['trackertitle']} - {@"User Options"} + + +$header + +
+ + +
+
+ +
+ {@"The following errors occurred"}: + {$message->process} +
+
+ +
+
{@"User Options"}
+ +
+
+ {@"Display Name"} + +
+ +
+ {@"Show Email Publicly"} + checked="checked" /> Yes + checked="checked" /> No +
+ +
+ {@"Language"} + +
+ +
+ {@"Timezone"} + +
+
+
+ +
+ +
+
+ {@"Please enter your password to change these fields"}: +
+ + +
+ +
+
+ {@"Password"} + +
+ +
+ {@"Confirm Password"} + +
+
+ +
+
+ {@"Email"} + +
+ +
+ {@"Confirm Email"} + +
+
+
+ +
+ +
+ + +
+ +
+
+ +
+ +$footer \ No newline at end of file diff --git a/userctrl.php b/userctrl.php new file mode 100644 index 0000000..205943b --- /dev/null +++ b/userctrl.php @@ -0,0 +1,168 @@ +userinfo['userid']) +{ + $message->error_permission(); +} + +$userinfo = $bugsys->userinfo; + +// ################################################################### + +if (empty($_REQUEST['do'])) +{ + $_REQUEST['do'] = 'modify'; +} + +// ################################################################### + +if ($_POST['do'] == 'update') +{ + // ------------------------------------------------------------------- + // display name validation + $count = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE displayname = '" . $bugsys->in['displayname'] . "' AND userid <> " . $bugsys->userinfo['userid']); + if ($count) + { + $message->phrase[] = $lang->string('That display name is already in use by another user'); + } + + // ------------------------------------------------------------------- + // authentication + if (!empty($bugsys->in['password']) OR !empty($bugsys->in['email'])) + { + if (empty($bugsys->in['validate'])) + { + $message->phrase[] = $lang->string('You need to enter your current password to change your email or password'); + } + else + { + if (md5(md5($bugsys->in['validate']) . md5($bugsys->userinfo['salt'])) != $bugsys->userinfo['password']) + { + $message->phrase[] = $lang->string('Your authentication password does not match the one in our records'); + } + } + } + + // ------------------------------------------------------------------- + // email validation + if (!empty($bugsys->in['email'])) + { + if (!empty($bugsys->in['email']) AND empty($bugsys->in['email_confirm'])) + { + $message->phrase[] = $lang->string('You need to enter both the email and confirm email fields to change your address'); + } + + if ($bugsys->in['email'] != $bugsys->in['email_confirm']) + { + $message->phrase[] = $lang->string('Your email and confirm email addresses do not match'); + } + + if ($bugsys->in['email']) + { + $count = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $bugsys->in['email'] . "' AND userid <> " . $bugsys->userinfo['userid']); + if ($count) + { + $message->phrase[] = $lang->string('That email address is already in use'); + } + } + + $email = true; + } + + // ------------------------------------------------------------------- + // password validation + if (!empty($bugsys->in['password'])) + { + if (!empty($bugsys->in['password']) AND empty($bugsys->in['password_confirm'])) + { + $message->phrase[] = $lang->string('You need to enter both the password and confirm password fields to change your password'); + } + else + { + if ($bugsys->in['password'] != $bugsys->in['password_confirm']) + { + $message->phrase[] = $lang->string('Your password and confirm password do not match'); + } + } + + $password = true; + } + + // ------------------------------------------------------------------- + // copy fields + $userinfo['displayname'] = $bugsys->in['displayname']; + $userinfo['showemail'] = $bugsys->in['showemail']; + $userinfo['languageid'] = $bugsys->in['languageid']; + $userinfo['timezone'] = $bugsys->in['timezone']; + + $email = $bugsys->in['email']; + $email_confirm = $bugsys->in['email_confirm']; + + // ------------------------------------------------------------------- + // error handling + if ($message->phrase) + { + $message->error_list_process(); + + $show['errors'] = true; + $_REQUEST['do'] = 'modify'; + } + else + { + $db->query(" + UPDATE " . TABLE_PREFIX . "user + SET displayname = '" . $bugsys->in['displayname'] . "', + showemail = " . intval($bugsys->in['showemail']) . ", + languageid = " . intval($bugsys->in['languageid']) . ", + timezone = " . intval($bugsys->in['timezone']) . ($email ? " + email = '" . $bugsys->in['email'] . "'" : '') . ($password ? " + password = '" . md5(md5($bugsys->in['password']) . md5($bugsys->userinfo['salt'])) . "'" : '') . " + WHERE userid = " . $bugsys->userinfo['userid'] + ); + + $message->redirect($lang->string('The changes to your account have been made.'), 'userctrl.php'); + } +} + +// ################################################################### + +if ($_REQUEST['do'] == 'modify') +{ + $langselect = construct_datastore_select('language', 'title', 'languageid', $userinfo['languageid']); + + foreach ($datef->fetch_timezone_list() AS $value => $label) + { + $selected = ($value == $userinfo['timezone']); + eval('$tzselect .= "' . $template->fetch('selectoption') . '";'); + } + + eval('$template->flush("' . $template->fetch('userctrl') . '");'); +} + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file -- 2.43.5