From fda89492b46dac8926981acc11c28fdd7e0732c1 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 9 Oct 2005 16:12:23 +0000 Subject: [PATCH] r511: Added ability to disable status colouring on bug listing pages --- admin/user.php | 5 ++++- docs/schema_changes.sql | 4 +++- docs/todo.txt | 1 - includes/init.php | 1 + index.php | 3 ++- register.php | 3 ++- search.php | 3 ++- templates/stylevars.txt | 3 +++ templates/trackerhome_bits.tpl | 2 +- templates/userctrl.tpl | 6 ++++++ userctrl.php | 2 ++ 11 files changed, 26 insertions(+), 7 deletions(-) diff --git a/admin/user.php b/admin/user.php index d1f28ad..589e273 100644 --- a/admin/user.php +++ b/admin/user.php @@ -70,7 +70,7 @@ if ($_POST['do'] == 'insert') $db->query(" INSERT INTO " . TABLE_PREFIX . "user - (email, displayname, password, salt, authkey, showemail, languageid, usergroupid, timezone) + (email, displayname, password, salt, authkey, showemail, showcolours, languageid, usergroupid, timezone) VALUES ('" . $bugsys->in['email'] . "', '" . $bugsys->in['displayname'] . "', @@ -78,6 +78,7 @@ if ($_POST['do'] == 'insert') '$salt', '" . $funct->rand() . "', " . intval($bugsys->in['showemail']) . ", + " . intval($bugsys->in['showcolours']) . ", " . intval($bugsys->in['languageid']) . ", " . intval($bugsys->in['usergroupid']) . ", " . intval($bugsys->in['timezone']) . " @@ -101,6 +102,7 @@ if ($_POST['do'] == 'update') UPDATE " . TABLE_PREFIX . "user SET displayname = '" . $bugsys->in['displayname'] . "', email = '" . $bugsys->in['email'] . "', + showcolours = " . intval($bugsys->in['showcolours']) . ", usergroupid = " . intval($bugsys->in['usergroupid']) . ", languageid = " . intval($bugsys->in['languageid']) . ", timezone = " . intval($bugsys->in['timezone']) . ($bugsys->in['password'] ? ", @@ -151,6 +153,7 @@ if ($_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == 'add') $admin->row_list($lang->string('Usergroup'), 'usergroupid'); $admin->row_yesno($lang->string('Show Email Publicly'), 'showemail', $user['showemail']); + $admin->row_yesno($lang->string('Show Status Colours on Bug Listings'), 'showcolours', $user['showcolours']); foreach ($bugsys->datastore['language'] AS $language) { diff --git a/docs/schema_changes.sql b/docs/schema_changes.sql index 387f27d..714b06e 100644 --- a/docs/schema_changes.sql +++ b/docs/schema_changes.sql @@ -52,4 +52,6 @@ ALTER TABLE `language` ADD `filename` VARCHAR(255) NOT NULL AFTER `direction`; ALTER TABLE `history` DROP `language`; -ALTER TABLE `history` DROP `arguments`; \ No newline at end of file +ALTER TABLE `history` DROP `arguments`; + +ALTER TABLE `user` ADD `showcolours` INT(2) UNSIGNED NOT NULL AFTER `showemail`; \ No newline at end of file diff --git a/docs/todo.txt b/docs/todo.txt index 649dc1d..c69b0dc 100755 --- a/docs/todo.txt +++ b/docs/todo.txt @@ -6,7 +6,6 @@ SVN: $Id$ BUGTRACK 1.0 - Add per-product-usergroup permission settings -- Ability to disable status colouring on listing pages ############################################################################### BUGTRACK 1.1 diff --git a/includes/init.php b/includes/init.php index 8bd56da..3d834de 100755 --- a/includes/init.php +++ b/includes/init.php @@ -103,6 +103,7 @@ if (!$userinfo) 'userid' => 0, 'email' => '', 'displayname' => '', + 'showcolours' => 1, 'permissions' => $bugsys->datastore['usergroup'][1]['permissions'], 'displaytitle' => $bugsys->datastore['usergroup'][1]['displaytitle'], 'mdisplayname' => $bugsys->datastore['usergroup'][1]['opentag'] . '' . $bugsys->datastore['usergroup'][1]['closetag'] diff --git a/index.php b/index.php index e8daf65..c53e49c 100644 --- a/index.php +++ b/index.php @@ -52,7 +52,8 @@ $bugs_fetch = $db->query(" while ($bug = $db->fetch_array($bugs_fetch)) { - $bug['bgcolour'] = $bugsys->datastore['status']["$bug[status]"]['color']; + $funct->exec_swap_bg($stylevar['alt_colour'], ''); + $bug['bgcolour'] = ($bugsys->userinfo['showcolours'] ? $bugsys->datastore['status']["$bug[status]"]['color'] : $funct->bgcolour); $bug['product'] = $bugsys->datastore['product']["$bug[productid]"]['title']; $bug['version'] = $bugsys->datastore['version']["$bug[versionid]"]['version']; $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status']; diff --git a/register.php b/register.php index 40932fc..ee039be 100755 --- a/register.php +++ b/register.php @@ -113,7 +113,7 @@ if ($_POST['do'] == 'insert') $db->query(" INSERT INTO " . TABLE_PREFIX . "user - (email, displayname, password, salt, authkey, showemail, languageid, usergroupid) + (email, displayname, password, salt, authkey, showemail, showcolours, languageid, usergroupid) VALUES ('" . $bugsys->in['email'] . "', '" . $bugsys->in['displayname'] . "', @@ -121,6 +121,7 @@ if ($_POST['do'] == 'insert') '$salt', '" . $funct->rand() . "', " . intval($bugsys->in['showemail']) . ", + 1, " . intval($bugsys->in['languageid']) . ", $usergroupid )" diff --git a/search.php b/search.php index a2fbacd..bab1bf6 100644 --- a/search.php +++ b/search.php @@ -389,7 +389,8 @@ if ($_REQUEST['do'] == 'results') foreach ($results AS $bug) { - $bug['bgcolour'] = $bugsys->datastore['status']["$bug[status]"]['color']; + $funct->exec_swap_bg($stylevar['alt_colour'], ''); + $bug['bgcolour'] = ($bugsys->userinfo['showcolours'] ? $bugsys->datastore['status']["$bug[status]"]['color'] : $funct->bgcolour); $bug['product'] = $bugsys->datastore['product']["$bug[productid]"]['title']; $bug['version'] = $bugsys->datastore['version']["$bug[versionid]"]['version']; $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status']; diff --git a/templates/stylevars.txt b/templates/stylevars.txt index 9f02000..533d4dd 100644 --- a/templates/stylevars.txt +++ b/templates/stylevars.txt @@ -37,6 +37,9 @@ padding: 2; normal-width: 100%; alternate-width: 45%; +/* alternate background colour used when status colours aren't displayed */ +alt-colour: #BFCCCF; + /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/templates/trackerhome_bits.tpl b/templates/trackerhome_bits.tpl index afdc9d1..b98357f 100644 --- a/templates/trackerhome_bits.tpl +++ b/templates/trackerhome_bits.tpl @@ -1,6 +1,6 @@ -; font-style: italic"> + style="background-color: $bug[bgcolour]; font-style: italic"> $bug[bugid]
$bug[summary]
diff --git a/templates/userctrl.tpl b/templates/userctrl.tpl index a56ba94..1c31781 100644 --- a/templates/userctrl.tpl +++ b/templates/userctrl.tpl @@ -36,6 +36,12 @@ $header checked="checked" /> No +
+ {@"Show Status Colours on Bug Listings"} + checked="checked" /> Yes + checked="checked" /> No +
+
{@"Language"} diff --git a/userctrl.php b/userctrl.php index 205943b..8a5c507 100644 --- a/userctrl.php +++ b/userctrl.php @@ -112,6 +112,7 @@ if ($_POST['do'] == 'update') // copy fields $userinfo['displayname'] = $bugsys->in['displayname']; $userinfo['showemail'] = $bugsys->in['showemail']; + $userinfo['showcolours'] = $bugsys->in['showcolours']; $userinfo['languageid'] = $bugsys->in['languageid']; $userinfo['timezone'] = $bugsys->in['timezone']; @@ -133,6 +134,7 @@ if ($_POST['do'] == 'update') UPDATE " . TABLE_PREFIX . "user SET displayname = '" . $bugsys->in['displayname'] . "', showemail = " . intval($bugsys->in['showemail']) . ", + showcolours = " . intval($bugsys->in['showcolours']) . ", languageid = " . intval($bugsys->in['languageid']) . ", timezone = " . intval($bugsys->in['timezone']) . ($email ? " email = '" . $bugsys->in['email'] . "'" : '') . ($password ? " -- 2.43.5