From a4187dcc4536e18248711f7af3e9aa71f228638d Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 22 Dec 2005 00:11:47 +0000 Subject: [PATCH] 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