From 75f1d5b7396ad1c74b4f40382db83bb2a8291d3f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 1 Aug 2005 20:48:31 +0000 Subject: [PATCH] r333: - Finished styling search templates - construct_custom_fields() can now ignore 2 or 1 masks as well as default values --- includes/functions.php | 14 ++- search.php | 85 +++++------------ templates/search.tpl | 174 ++++++++++++++++++++++++----------- templates/search_results.tpl | 18 ++-- 4 files changed, 167 insertions(+), 124 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 7b05fc5..9d2dc35 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -321,7 +321,7 @@ function construct_datastore_select($datastore, $labelname, $valuename, $selecte } // ################## Start construct_custom_fields ################## -function construct_custom_fields($bug = array()) +function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefault = false) { global $bugsys; static $fields; @@ -343,12 +343,17 @@ function construct_custom_fields($bug = array()) } } - $fieldvalues = $bugsys->db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill WHERE bugid = $bug[bugid]"); + $fieldvalues = $bugsys->db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill WHERE bugid = " . intval($bug['bugid'])); $fieldbits = ''; foreach ($fields AS $field) { + if ($nodefault) + { + $field['defaultvalue'] = ''; + } + if (!is_null($bug["field$field[fieldid]"])) { $bugsys->debug("not null: $field[fieldid]"); @@ -359,6 +364,11 @@ function construct_custom_fields($bug = array()) $value = $field['defaultvalue']; } + if ($ignore21mask) + { + $field['mask'] = 2; + } + if ($field['mask'] == 2) { switch ($field['type']) diff --git a/search.php b/search.php index 76221f6..957b27a 100644 --- a/search.php +++ b/search.php @@ -262,7 +262,9 @@ if ($_REQUEST['do'] == 'results') $bug['version'] = $bugsys->datastore['version']["$bug[versionid]"]['version']; $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status']; $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution']; - $bug['lastpostinfo'] = $datef->format($bugsys->options['dateformat'], $bug['lastposttime']) . ' by ' . $bug['lastpost']; + $bug['lastposttime'] = (($bug['hiddendisplay']) ? $bug['hiddenlastposttime'] : $bug['lastposttime']); + $bug['lastpost'] = (($bug['hiddendisplay']) ? $bug['hiddenlastpost'] : $bug['lastpost']); + $bug['lastposttime'] = $datef->format($bugsys->options['dateformat'], $bug['lastposttime']); $bug['urladd'] = "&hilight=$hilight"; eval('$bugs .= "' . $template->fetch('trackerhome_bits') . '";'); } @@ -278,69 +280,32 @@ if ($_REQUEST['do'] == 'search') // ------------------------------------------------------------------- // custom fields - $fields_fetch = $bugsys->db->query(" - SELECT bugfield.* - FROM " . TABLE_PREFIX . "bugfield AS bugfield - LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission - ON (bugfield.fieldid = permission.fieldid) - WHERE permission.mask <> 0 - AND permission.usergroupid = {$bugsys->userinfo['usergroupid']} - AND bugfield.cansearch = 1" - ); - while ($field = $bugsys->db->fetch_array($fields_fetch)) + $fields = construct_custom_fields($bug, true, true); + + $bugsys->debug(count($fields) % 2); + $i = 1; + foreach ($fields AS $field) { - switch ($field['type']) + $bugsys->debug("i = $i"); + if ($i == 1) { - case 'input_text': - eval('$tempfield = "' . $bugsys->template->fetch('bugfield_input_text') . '";'); - break; - - case 'input_checkbox': - $selected = (($value) ? ' checked="checked"' : ''); - - // ignore - $value = 0; - $label = ''; - $selected = true; - eval('$options = "' . $bugsys->template->fetch('selectoption') . '";'); - - // on - $value = 1; - $label = 'Checked'; - $selected = false; - eval('$options .= "' . $bugsys->template->fetch('selectoption') . '";'); - - // off - $value = 2; - $label = 'Un-Checked'; - $selected = false; - eval('$options .= "' . $bugsys->template->fetch('selectoption') . '";'); - - eval('$tempfield = "' . $bugsys->template->fetch('bugfield_select_single') . '";'); - break; - - case 'select_single': - $selectopts = unserialize($field['selects']); - $value = trim($value); - $options = ''; - - $id = -1; - $select = ''; - $selected = ' selected="selected"'; - eval('$options .= "' . $bugsys->template->fetch('bugfield_select_single_option') . '";'); - $selected = ''; - - foreach ($selectopts AS $id => $select) - { - $select = trim($select); - eval('$options .= "' . $bugsys->template->fetch('bugfield_select_single_option') . '";'); - } - eval('$tempfield = "' . $bugsys->template->fetch('bugfield_select_single') . '";'); - break; + $left = $field; } - $fieldbits .= $tempfield; + else if ($i == 2) + { + $right = $field; + eval('$customfields .= "' . $template->fetch('customfield_bit') . '";'); + $i = 0; + } + $i++; + } + + if ((count($fields) % 2) != 0) + { + $bugsys->debug('no modulo for you'); + $right = ''; + eval('$customfields .= "' . $template->fetch('customfield_bit') . '";'); } - unset($select); // ------------------------------------------------------------------- // built-in fields diff --git a/templates/search.tpl b/templates/search.tpl index 9f650b3..3846713 100644 --- a/templates/search.tpl +++ b/templates/search.tpl @@ -1,68 +1,134 @@ $doctype + + $headinclude + {$bugsys->options['trackertitle']} - Search + + $header
Any fields left blank or unselected will be excluded from the search query
-
+ -
- Key Words: - - Any Words - All Words - Raw Boolean Search -
-
Reporter:
- -
Favourite
- -
Severity:
-
Priority:
-
Status:
-
Resolution:
-
Assigned To:
- -
- Date (submitted since): - -
- -
Products/Components/Versions:
-
-$pcv_select -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -
- Sort By: - - Ascending - Descending -
+ + + + + -
$fieldbits
+$customfields -
- - -
+ + + + + +
KeywordsSearch Mode + +
ReporterSort By + + + +
StatusResolution
SeverityPriority
Assigned ToDate (submitted since) + +
Product / Version +
Favourite:
+
+ + +
diff --git a/templates/search_results.tpl b/templates/search_results.tpl index f2a1a64..f5a0175 100644 --- a/templates/search_results.tpl +++ b/templates/search_results.tpl @@ -1,16 +1,18 @@ $doctype + + $headinclude -$header + {$bugsys->options['trackertitle']} - Search Results + -Here are the search results: +$header - - - - - - +
Bug IDTitleReporterProduct/Version
+ + + + $bugs -- 2.22.5
IDSummary/Reporter Status/ResolutionProduct/Version Last Post