From 2d6bc2626648aba3f0d47e11529d5221d095d398 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 19 Dec 2005 17:15:10 +0000 Subject: [PATCH 01/16] r632: trim() all the data and make sure we have a valid field in diff() --- includes/class_history.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/class_history.php b/includes/class_history.php index a8c8148..571613e 100644 --- a/includes/class_history.php +++ b/includes/class_history.php @@ -81,6 +81,15 @@ class History */ function diff($field, $initial, $final) { + $field = trim($field); + $initial = trim($initial); + $final = trim($final); + + if (empty($field)) + { + return -1; + } + if (empty($initial) AND empty($final)) { if (!$this->allowempty) -- 2.22.5 From 69588e633dccd0466eae6ae9875fe8b03de763ec Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 19 Dec 2005 22:30:35 +0000 Subject: [PATCH 02/16] r633: Subscription is just one permission to check for; we also need to make sure the user can actually view bugs --- favourite.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/favourite.php b/favourite.php index b4e4d8a..28b0f92 100644 --- a/favourite.php +++ b/favourite.php @@ -33,7 +33,7 @@ if ($_REQUEST['do'] == 'handle') $message->error($lang->getlex('error_invalid_id')); } - if (!can_perform('cansubscribe', $bug['productid'])) + if (!can_perform('cansubscribe', $bug['productid']) OR !can_perform('canviewbugs', $bug['productid'])) { $message->error_permission(); } -- 2.22.5 From 768bc0d3a6e1ceb73ffb871dba3dc81b7386b0d7 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 19 Dec 2005 22:34:42 +0000 Subject: [PATCH 03/16] r634: Don't let $uservote == 0 --- vote.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vote.php b/vote.php index a556270..8662c71 100644 --- a/vote.php +++ b/vote.php @@ -68,10 +68,14 @@ if ($_REQUEST['do'] == 'vote') { $votefor++; } - else + else if ($uservote < 0) { $voteagainst++; } + else + { + $message->error($lang->string('You need to specify whether you want to vote for or against this bug.')); + } $db->query("UPDATE " . TABLE_PREFIX . "vote SET userids = '$userids', votefor = $votefor, voteagainst = $voteagainst WHERE bugid = $bug[bugid]"); -- 2.22.5 From 5667f7f0a9fbdefb1d626c935fd2cd5f908cbf3b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 19 Dec 2005 22:57:15 +0000 Subject: [PATCH 04/16] r635: Help link --- admin/permission.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/permission.php b/admin/permission.php index de844d7..d22c6e1 100755 --- a/admin/permission.php +++ b/admin/permission.php @@ -103,7 +103,7 @@ if ($_REQUEST['do'] == 'edit') // Permission $admin->table_start(); - $admin->table_head(sprintf($lang->string('Permissions: %1$s - %2$s'), $usergroup['title'], $product['title'])); + $admin->table_head(sprintf($lang->string('Permissions: %1$s - %2$s'), $usergroup['title'], $product['title']), 2, 'usergroups_permissions_details'); foreach ($permissions AS $group => $settings) { @@ -153,7 +153,7 @@ if ($_REQUEST['do'] == 'modify') $admin->page_start($lang->string('Permission Manager')); $admin->table_start(); - $admin->table_head($lang->string('Permission Manager')); + $admin->table_head($lang->string('Permission Manager'), 2, 'usergroups_permissions'); $groups = $db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup ORDER BY usergroupid ASC"); while ($group = $db->fetch_array($groups)) -- 2.22.5 From 7b37a8a0603ab0224acf6582e18bb4cf55696ae4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 19 Dec 2005 23:02:25 +0000 Subject: [PATCH 05/16] r636: Put the help link on the wrong thing for add/edit --- admin/autoaction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/autoaction.php b/admin/autoaction.php index a28735c..fc7ccb0 100644 --- a/admin/autoaction.php +++ b/admin/autoaction.php @@ -139,7 +139,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') $action['fields'] = unserialize($action['fieldchanges']); } - $admin->page_start(($add ? $lang->string('New Automatic Action') : $lang->string('Edit Automatic Action')), 2, 'automatic_actions'); + $admin->page_start(($add ? $lang->string('New Automatic Action') : $lang->string('Edit Automatic Action'))); $admin->form_start('autoaction.php', ($add ? 'insert' : 'update')); @@ -149,7 +149,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') } $admin->table_start(); - $admin->table_head(($add ? $lang->string('New Automatic Action') : $lang->string('Edit Automatic Action'))); + $admin->table_head(($add ? $lang->string('New Automatic Action') : $lang->string('Edit Automatic Action')), 2, 'automatic_actions'); $admin->row_input($lang->string('Name'), 'name', $action['name']); $admin->row_textarea($lang->string('Description'), 'description', $action['description']); -- 2.22.5 From 50c842fd01e92b9e049998cfadce405a7d6ddaf8 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 19 Dec 2005 23:08:02 +0000 Subject: [PATCH 06/16] r637: Disable the black and white style sheet --- includes/adminfunctions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/adminfunctions.php b/includes/adminfunctions.php index 1e70ebb..2840118 100755 --- a/includes/adminfunctions.php +++ b/includes/adminfunctions.php @@ -77,7 +77,7 @@ EOD; echo "\n"; echo "\n\t$title"; echo "\n\t"; - echo "\n\t" . (($extra) ? "\n$extra" : ''); + echo "\n\t" . (($extra) ? "\n$extra" : ''); echo "\n\n\n"; if (!defined('HIDE_SETUP') AND $bugsys->userinfo['adminsession']) -- 2.22.5 From 68825ce5fa38d166501af2359520cfee6db7d7d6 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 20 Dec 2005 22:12:22 +0000 Subject: [PATCH 07/16] r638: Custom field searching now works right --- docs/beta-3-review.txt | 2 -- search.php | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/beta-3-review.txt b/docs/beta-3-review.txt index b4cf772..ff1b52c 100644 --- a/docs/beta-3-review.txt +++ b/docs/beta-3-review.txt @@ -2,6 +2,4 @@ - getting login page multiple times for admin [can't reproduce] -- search didn't work; I set new in my kewyord field; nothing happens - It would be great to have help customizable for the severity/priority/resolution/prod fields. Many people want 1 line descriptions for these. \ No newline at end of file diff --git a/search.php b/search.php index b07cd5d..a5b5d90 100644 --- a/search.php +++ b/search.php @@ -201,20 +201,20 @@ if ($_REQUEST['do'] == 'process') ); while ($field = $bugsys->db->fetch_array($fields_fetch)) { - if (!empty($bugsys->in['custom']["$field[fieldid]"]) OR ($field['type'] == 'select_single' AND isset($bugsys->in['custom']["$field[fieldid]"]))) + if (!empty($bugsys->in["field$field[fieldid]"]) OR ($field['type'] == 'select_single' AND isset($bugsys->in["field$field[fieldid]"]))) { if ($field['type'] == 'input_checkbox') { - $querybuild[] = "AND bugfieldvalue.field$field[fieldid] = " . (($bugsys->in['custom']["$field[fieldid]"] == 1) ? 0 : 1); + $querybuild[] = "AND bugfieldvalue.field$field[fieldid] = " . (($bugsys->in["field$field[fieldid]"] == 1) ? 0 : 1); } else if ($field['type'] == 'input_text') { - $querybuild[] = "AND bugfieldvalue.field$field[fieldid] LIKE '%" . $bugsys->in['custom']["$field[fieldid]"] . "%'"; + $querybuild[] = "AND bugfieldvalue.field$field[fieldid] LIKE '%" . $bugsys->in["field$field[fieldid]"] . "%'"; } - else if ($field['type'] == 'select_single' AND $bugsys->in['custom']["$field[fieldid]"] != -1) + else if ($field['type'] == 'select_single' AND $bugsys->in["field$field[fieldid]"] != -1) { $temp = unserialize($field['selects']); - $querybuild[] = "AND bugfieldvalue.field$field[fieldid] = '" . trim($temp[ intval($bugsys->in['custom']["$field[fieldid]"]) ]) . "'"; + $querybuild[] = "AND bugfieldvalue.field$field[fieldid] = '" . trim($temp[ intval($bugsys->in["field$field[fieldid]"]) ]) . "'"; } } } -- 2.22.5 From 769efe43e7590e3d84fc30a55cffdfb32c3e3160 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 21 Dec 2005 19:53:41 +0000 Subject: [PATCH 08/16] r639: Adding pre-parse hook so that the userland help system will work --- global.php | 1 + includes/functions.php | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/global.php b/global.php index a282077..9638f79 100755 --- a/global.php +++ b/global.php @@ -16,6 +16,7 @@ require_once('./includes/init.php'); // initialize template system $bugsys->load('template_fs'); $template->extension = 'tpl'; +$template->pre_parse_hook = 'isso_pre_parse_hook'; $template->templatedir = $bugsys->fetch_sourcepath('templates/'); // ################################################################### diff --git a/includes/functions.php b/includes/functions.php index 515289f..2505585 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -406,6 +406,31 @@ function fetch_on_bits($mask) return implode(',', $onbits); } +// #################### Start isso_pre_parse_hook #################### +// the pre-parse hook for ISSO's template engine +function isso_pre_parse_hook($template) +{ + $template = preg_replace('#\$help\[(.*)\]#', '" . fetch_help_link(\'\1\') . "', $template); + return $template; +} + +// ###################### Start fetch_help_link ###################### +// returns a prepared link to insert into templates that opens up a +// help popup in the user-end +function fetch_help_link($topic) +{ + global $bugsys; + + if (isset($bugsys->datastore['help']["$topic"])) + { + + } + else + { + return "[[INVALID TOPIC: $topic]]"; + } +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ -- 2.22.5 From e3e11d24e36e19db1c43db7ab7dd00b68e20ede9 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 21 Dec 2005 22:47:33 +0000 Subject: [PATCH 09/16] r640: Adding the template, image, and code that creates the help link --- global.php | 3 ++- includes/functions.php | 2 +- templates/help_link.tpl | 1 + templates/images/question-mark.gif | Bin 0 -> 70 bytes 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 templates/help_link.tpl create mode 100644 templates/images/question-mark.gif diff --git a/global.php b/global.php index 9638f79..ee41aba 100755 --- a/global.php +++ b/global.php @@ -82,7 +82,8 @@ $globaltemplates = array( 'bugfield_input_checkbox', 'bugfield_select_single_option', 'bugfield_select_single', - 'username_display' + 'username_display', + 'help_link' ); $start = microtime(); diff --git a/includes/functions.php b/includes/functions.php index 2505585..ebc61bb 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -423,7 +423,7 @@ function fetch_help_link($topic) if (isset($bugsys->datastore['help']["$topic"])) { - + return $bugsys->template->fetch('help_link'); } else { diff --git a/templates/help_link.tpl b/templates/help_link.tpl new file mode 100644 index 0000000..63cc722 --- /dev/null +++ b/templates/help_link.tpl @@ -0,0 +1 @@ +Help/Description \ No newline at end of file diff --git a/templates/images/question-mark.gif b/templates/images/question-mark.gif new file mode 100644 index 0000000000000000000000000000000000000000..dc2d75a32c9f63040a1577d1ca6f5c50186209b6 GIT binary patch literal 70 zcmZ?wbhEHbR0A{L~OB literal 0 HcmV?d00001 -- 2.22.5 From 2209ee214afeee0fde5929316b6c7f0c4327cd11 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 21 Dec 2005 22:59:21 +0000 Subject: [PATCH 10/16] r641: Link construction code now works right... --- includes/functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index ebc61bb..e27d571 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -410,7 +410,7 @@ function fetch_on_bits($mask) // the pre-parse hook for ISSO's template engine function isso_pre_parse_hook($template) { - $template = preg_replace('#\$help\[(.*)\]#', '" . fetch_help_link(\'\1\') . "', $template); + $template = preg_replace('#\$help\[(.*)\]#', '" . fetch_help_link("\1") . "', $template); return $template; } @@ -423,7 +423,8 @@ function fetch_help_link($topic) if (isset($bugsys->datastore['help']["$topic"])) { - return $bugsys->template->fetch('help_link'); + eval('$temp = "' . $bugsys->template->fetch('help_link') . '";'); + return $temp; } else { -- 2.22.5 From a4d92360934b859cf8ffd1c58f0946fc60ec017a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 21 Dec 2005 23:02:07 +0000 Subject: [PATCH 11/16] r642: Update the template to actually be lang-compat and show a JS alert --- templates/help_link.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/help_link.tpl b/templates/help_link.tpl index 63cc722..7f323e5 100644 --- a/templates/help_link.tpl +++ b/templates/help_link.tpl @@ -1 +1 @@ -Help/Description \ No newline at end of file +? \ No newline at end of file -- 2.22.5 From bdd8870dce22ae14c2d974259c3b94a966b0af87 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 21 Dec 2005 23:58:43 +0000 Subject: [PATCH 12/16] r643: Updating help link and CSS --- templates/fields.css | 5 +++++ templates/help_link.tpl | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/fields.css b/templates/fields.css index c6523d7..d9e965f 100644 --- a/templates/fields.css +++ b/templates/fields.css @@ -33,6 +33,11 @@ fieldset padding: 5px; } +.helplink +{ + border: none; +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/templates/help_link.tpl b/templates/help_link.tpl index 7f323e5..67ad92e 100644 --- a/templates/help_link.tpl +++ b/templates/help_link.tpl @@ -1 +1 @@ -? \ No newline at end of file +? \ No newline at end of file -- 2.22.5 From 8f195c609002cdcfa0bc430903db33a3c164b4aa Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 22 Dec 2005 00:09:50 +0000 Subject: [PATCH 13/16] r644: Adding help window page --- help.php | 36 ++++++++++++++++++++++++++++++++++++ templates/help_window.tpl | 23 +++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 help.php create mode 100644 templates/help_window.tpl diff --git a/help.php b/help.php new file mode 100644 index 0000000..6b1133d --- /dev/null +++ b/help.php @@ -0,0 +1,36 @@ +in['topic'] OR !isset($bugsys->datastore['help'][ $bugsys->in['topic'] ])) +{ + $message->error($lang->getlex('error_invalid_id')); +} + +$topic = $bugsys->datastore['help'][ $bugsys->in['topic'] ]; + +eval('$template->flush("' . $template->fetch('help_window') . '");'); + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file diff --git a/templates/help_window.tpl b/templates/help_window.tpl new file mode 100644 index 0000000..ec51e05 --- /dev/null +++ b/templates/help_window.tpl @@ -0,0 +1,23 @@ +$doctype + + +$headinclude + + {@"Help"} - $topic[title] + + + + +
+
+
{@"Help"} : $topic[title]
+ +
+ $topic[body] +
+
+
+ + + + \ No newline at end of file -- 2.22.5 From a4187dcc4536e18248711f7af3e9aa71f228638d Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 22 Dec 2005 00:11:47 +0000 Subject: [PATCH 14/16] r645: Custom bug fields now have help text in the cache and have $help added to their templates --- docs/recache.php | 4 ++++ includes/functions_datastore.php | 21 +++++++++++++++++++++ templates/bugfield_input_checkbox.tpl | 2 +- templates/bugfield_input_text.tpl | 2 +- templates/bugfield_select_single.tpl | 2 +- templates/bugfield_static_text.tpl | 2 +- 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/docs/recache.php b/docs/recache.php index 4c2bbbd..eba5dc9 100755 --- a/docs/recache.php +++ b/docs/recache.php @@ -56,6 +56,10 @@ build_auto_actions(); echo '

Auto actions cached

'; +build_user_help(); + +echo '

Userland help cached

'; + // $Id$ ?> \ No newline at end of file diff --git a/includes/functions_datastore.php b/includes/functions_datastore.php index efd865c..79963da 100755 --- a/includes/functions_datastore.php +++ b/includes/functions_datastore.php @@ -256,6 +256,27 @@ function build_auto_actions() $bugsys->datastore['autoaction'] = $actions; } +// ###################### Start build_user_help ###################### +function build_user_help() +{ + global $bugsys; + + // custom field descriptions + $descriptions = $bugsys->db->query("SELECT fieldid, name, description FROM " . TABLE_PREFIX . "bugfield"); + while ($field = $bugsys->db->fetch_array($descriptions)) + { + $help["field$field[fieldid]"] = array('title' => $field['name'], 'body' => $field['description']); + } + + $bugsys->db->query(" + ### replacing user help cache ### + REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) + VALUES ('help', '" . $bugsys->escape(serialize($help)) . "')" + ); + + $bugsys->datastore['help'] = $help; +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/templates/bugfield_input_checkbox.tpl b/templates/bugfield_input_checkbox.tpl index 43df667..9abd4bc 100644 --- a/templates/bugfield_input_checkbox.tpl +++ b/templates/bugfield_input_checkbox.tpl @@ -1,6 +1,6 @@
- $field[name] + $field[name] $help[field$field[fieldid]]
custom[$field[fieldid]]field$field[fieldid]" type="checkbox" value="1"$selected />
\ No newline at end of file diff --git a/templates/bugfield_input_text.tpl b/templates/bugfield_input_text.tpl index c7e6a8b..ba67a76 100644 --- a/templates/bugfield_input_text.tpl +++ b/templates/bugfield_input_text.tpl @@ -1,6 +1,6 @@
- $field[name] + $field[name] $help[field$field[fieldid]]
custom[$field[fieldid]]field$field[fieldid]" type="text" value="$value" size="35"maxlength="$field[maxlength] />
diff --git a/templates/bugfield_select_single.tpl b/templates/bugfield_select_single.tpl index aec2751..ecd66d1 100644 --- a/templates/bugfield_select_single.tpl +++ b/templates/bugfield_select_single.tpl @@ -1,6 +1,6 @@
- $field[name] + $field[name] $help[field$field[fieldid]]
\ No newline at end of file diff --git a/templates/bugfield_static_text.tpl b/templates/bugfield_static_text.tpl index 6f88e54..617bcda 100644 --- a/templates/bugfield_static_text.tpl +++ b/templates/bugfield_static_text.tpl @@ -1,6 +1,6 @@
- $field[name] + $field[name] $help[field$field[fieldid]]
$field[value]
-- 2.22.5 From 071304f85ce6335440e6796e94fe7eac0d8c09d5 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 22 Dec 2005 01:01:51 +0000 Subject: [PATCH 15/16] r646: Make returning [[INVALID TOPIC]] a debug-only thing in fetch_help_link() --- includes/functions.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/functions.php b/includes/functions.php index e27d571..8d17bc1 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -428,7 +428,15 @@ function fetch_help_link($topic) } else { - return "[[INVALID TOPIC: $topic]]"; + if ($bugsys->debug) + { + return "[[INVALID TOPIC: $topic]]"; + } + // do we want this? + else if (null == 1) + { + return eval('$temp = "' . $bugsys->template->fetch('help_link') . '";'); + } } } -- 2.22.5 From 06936436ca869f53a862eaf501a6c9e9b846b1cf Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 22 Dec 2005 01:06:08 +0000 Subject: [PATCH 16/16] r647: Add user help link --- admin/global.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/global.php b/admin/global.php index 4f78096..6f460a7 100755 --- a/admin/global.php +++ b/admin/global.php @@ -26,7 +26,8 @@ $globalnav = array( $lang->string('Options') => array( $lang->string('BugStrike Settings') => 'setting.php', - $lang->string('Manage Languages') => 'language.php' + $lang->string('Manage Languages') => 'language.php', + $lang->string('Edit User Help') => 'userhelp.php' ), $lang->string('Bug Fields') => array( -- 2.22.5