From cdde7a1ee8f382ea16bfff2714b65945bb51682f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 23 Jul 2005 21:57:38 +0000 Subject: [PATCH] r322: You can now edit fields on showreport.php --- docs/todo.txt | 1 - editreport.php | 73 +----------- showreport.php | 234 ++++++++++++++++++++++++++------------- templates/editreport.tpl | 43 ------- templates/showreport.tpl | 68 +++++++++--- 5 files changed, 215 insertions(+), 204 deletions(-) delete mode 100644 templates/editreport.tpl diff --git a/docs/todo.txt b/docs/todo.txt index 1d7a4f5..b87f5be 100755 --- a/docs/todo.txt +++ b/docs/todo.txt @@ -15,7 +15,6 @@ BUGTRACK 1.0 ---------------------------------------- - New style - Make summary field longer -- Make it so that you can modify bug fields on showreport.php ---------------------------------------- BUG REPORTING/EDITING diff --git a/editreport.php b/editreport.php index b9bd379..4492dee 100644 --- a/editreport.php +++ b/editreport.php @@ -212,7 +212,7 @@ if ($_POST['do'] == 'update') // ------------------------------------------------------------------- // process comment stuff - + /* if (!$bugsys->in['firstcomment']) { $message->error('you need to enter some text in the first comment'); @@ -234,7 +234,7 @@ if ($_POST['do'] == 'update') comment_parsed = '" . nl2br($bugsys->in['comment_parsed']) . "' WHERE commentid = $firstcomment[commentid]" ); - + */ // ------------------------------------------------------------------- // auto action comment @@ -269,75 +269,6 @@ if ($_POST['do'] == 'update') $message->redirect('done with update bug', "showreport.php?bugid=$bug[bugid]"); } -// ################################################################### - -if ($_REQUEST['do'] == 'edit') -{ - $select['severity'] = construct_datastore_select('severity', 'severity', 'severityid', $bug['severity']); - - $show['changestatus'] = ((can_perform('canchangestatus')) ? true : false); - if (can_perform('canchangestatus')) - { - $select['priority'] = construct_datastore_select('priority', 'priority', 'priorityid', $bug['priority']); - $select['status'] = construct_datastore_select('status', 'status', 'statusid', $bug['status']); - $select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid', $bug['resolution']); - } - - $show['assign'] = ((can_perform('canassign')) ? true : false); - if (can_perform('canassign')) - { - foreach ($bugsys->datastore['assignto'] AS $dev) - { - $value = $dev['userid']; - $selected = (($dev['userid'] == $bug['assignedto']) ? true : false); - $label = construct_user_display($dev, false); - eval('$select[dev] .= "' . $template->fetch('selectoption') . '";'); - } - } - - $pcv_select = construct_pcv_select("p$bug[productid]c$bug[componentid]v$bug[versionid]"); - - $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1"); - - $customfields = construct_custom_fields($bug); - - if ($bug['duplicateof']) - { - $duplicate = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]"); - } - - if ($bug['dependency']) - { - $dependencies = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($bug[dependency])"); - while ($dependency = $db->fetch_array($dependencies)) - { - $depends[] = "$dependency[bugid]"; - } - $dependencies = implode(' ', $depends); - } - - $actions = $db->query("SELECT * FROM " . TABLE_PREFIX . "autoaction ORDER BY name ASC"); - $select['autoactions'] = ''; - $show['autoactions'] = false; - while ($action = $db->fetch_array($actions)) - { - $label = $action['name']; - $value = $action['actionid']; - $selected = false; - eval('$select[autoaction] .= "' . $bugsys->template->fetch('selectoption') . '";'); - $show['autoactions'] = true; - } - if ($show['autoactions']) - { - $label = ''; - $value = 0; - $selected = true; - eval('$select[autoaction] = "' . $bugsys->template->fetch('selectoption') . '" . $select[autoaction];'); - } - - eval('$template->flush("' . $template->fetch('editreport') . '");'); -} - /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/showreport.php b/showreport.php index 26b0759..33adcb2 100644 --- a/showreport.php +++ b/showreport.php @@ -14,7 +14,8 @@ $fetchtemplates = array( 'SHOWREPORT', 'showreport_attachment', 'showreport_comment', - 'quicksearch' + 'quicksearch', + 'pcv_select_row' ); define('SVN', '$Id$'); @@ -28,6 +29,8 @@ if (!can_perform('canviewbugs')) $message->error_permission(); } +$show['edit'] = (((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $bug['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')) ? true : false; + $bugid = intval($bugsys->in['bugid']); // ################################################################### @@ -56,10 +59,12 @@ if (empty($bugid) OR $_REQUEST['do'] == 'quicksearch') // ------------------------------------------------------------------- // get the report $bug = $db->query_first(" - SELECT bug.*, user.displayname, user.email, user.showemail + SELECT bugvaluefill.*, bug.*, user.email, user.displayname, user.showemail FROM " . TABLE_PREFIX . "bug AS bug LEFT JOIN " . TABLE_PREFIX . "user AS user ON (bug.userid = user.userid) + LEFT JOIN " . TABLE_PREFIX . "bugvaluefill AS bugvaluefill + ON (bug.bugid = bugvaluefill.bugid) WHERE bug.bugid = " . intval($bugsys->in['bugid']) ); @@ -73,102 +78,181 @@ if ($bug['hidden'] AND !can_perform('canviewhidden')) $message->error_permission(); } -// ------------------------------------------------------------------- -// prep display -$bug['userinfo'] = construct_user_display($bug); -$bug['product'] = $bugsys->datastore['product']["$bug[productid]"]['title']; -$bug['component'] = (($bug['componentid']) ? $bugsys->datastore['product']["$bug[componentid]"]['title'] : ''); -$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['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity']; -$bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority']; - -$assigninfo = $bugsys->datastore['assignto']["$bug[assignedto]"]; -$bug['assigninfo'] = ((is_array($assigninfo)) ? construct_user_display($assigninfo) : ''); - -$show['editreport'] = ((((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')) ? true : false); - -$duplicateof = $db->query_first("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]"); - -$duplicates = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE duplicateof = $bug[bugid]"); -while ($duplicate = $db->fetch_array($duplicates)) -{ - $dupelist[] = "$duplicate[summary]"; -} -$dupelist = implode(', ', $dupelist); - -if ($bug['dependency']) -{ - $dependencies = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($bug[dependency])"); - while ($dependency = $db->fetch_array($dependencies)) - { - $depends[] = "$dependency[bugid]"; - } - $dependencies = implode(' ', $depends); -} +// ################################################################### +// global display items $favourite = (bool)$db->query_first("SELECT * FROM " . TABLE_PREFIX . "favourite WHERE bugid = $bug[bugid] AND userid = " . $bugsys->userinfo['userid']); $favouritetext = (($favourite) ? 'Remove from Favourites' : 'Add to Favourites'); -// ------------------------------------------------------------------- -// custom fields -$customfields = ''; -$allfields = $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']}" -); -while ($field = $db->fetch_array($allfields)) +// ################################################################### +// edit display +if ($show['edit']) { - $fieldlist["$field[fieldid]"] = $field; + $select['severity'] = construct_datastore_select('severity', 'severity', 'severityid', $bug['severity']); + + $show['changestatus'] = ((can_perform('canchangestatus')) ? true : false); + if (can_perform('canchangestatus')) + { + $select['priority'] = construct_datastore_select('priority', 'priority', 'priorityid', $bug['priority']); + $select['status'] = construct_datastore_select('status', 'status', 'statusid', $bug['status']); + $select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid', $bug['resolution']); + } + + $show['assign'] = ((can_perform('canassign')) ? true : false); + if (can_perform('canassign')) + { + foreach ($bugsys->datastore['assignto'] AS $dev) + { + $value = $dev['userid']; + $selected = (($dev['userid'] == $bug['assignedto']) ? true : false); + $label = construct_user_display($dev, false); + eval('$select[dev] .= "' . $template->fetch('selectoption') . '";'); + } + } + + $pcv_select = construct_pcv_select("p$bug[productid]c$bug[componentid]v$bug[versionid]"); + + $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1"); + + $customfields = construct_custom_fields($bug); + + if ($bug['duplicateof']) + { + $duplicate = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]"); + } + + if ($bug['dependency']) + { + $dependencies = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($bug[dependency])"); + while ($dependency = $db->fetch_array($dependencies)) + { + $depends[] = "$dependency[bugid]"; + } + $dependencies = implode(' ', $depends); + } + + $actions = $db->query("SELECT * FROM " . TABLE_PREFIX . "autoaction ORDER BY name ASC"); + $select['autoactions'] = ''; + $show['autoactions'] = false; + while ($action = $db->fetch_array($actions)) + { + $label = $action['name']; + $value = $action['actionid']; + $selected = false; + eval('$select[autoaction] .= "' . $bugsys->template->fetch('selectoption') . '";'); + $show['autoactions'] = true; + } + if ($show['autoactions']) + { + $label = ''; + $value = 0; + $selected = true; + eval('$select[autoaction] = "' . $bugsys->template->fetch('selectoption') . '" . $select[autoaction];'); + } } -$fieldvalues = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill WHERE bugid = $bug[bugid]"); - -foreach ($fieldlist AS $fieldid => $field) +// ################################################################### +// non-edit display +else { - if (is_null($fieldvalues["field$fieldid"])) + // ------------------------------------------------------------------- + // prep display + $bug['userinfo'] = construct_user_display($bug); + $bug['product'] = $bugsys->datastore['product']["$bug[productid]"]['title']; + $bug['component'] = (($bug['componentid']) ? $bugsys->datastore['product']["$bug[componentid]"]['title'] : ''); + $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['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity']; + $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority']; + + $assigninfo = $bugsys->datastore['assignto']["$bug[assignedto]"]; + $bug['assigninfo'] = ((is_array($assigninfo)) ? construct_user_display($assigninfo) : ''); + + $show['editreport'] = ((((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')) ? true : false); + + $duplicateof = $db->query_first("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]"); + + $duplicates = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE duplicateof = $bug[bugid]"); + while ($duplicate = $db->fetch_array($duplicates)) { - if ($field['type'] == 'select_single') + $dupelist[] = "$duplicate[summary]"; + } + $dupelist = implode(', ', $dupelist); + + if ($bug['dependency']) + { + $dependencies = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($bug[dependency])"); + while ($dependency = $db->fetch_array($dependencies)) { - if ($field['usedefault']) + $depends[] = "$dependency[bugid]"; + } + $dependencies = implode(' ', $depends); + } + + // ------------------------------------------------------------------- + // custom fields + $customfields = ''; + + $allfields = $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']}" + ); + while ($field = $db->fetch_array($allfields)) + { + $fieldlist["$field[fieldid]"] = $field; + } + + $fieldvalues = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill WHERE bugid = $bug[bugid]"); + + foreach ($fieldlist AS $fieldid => $field) + { + if (is_null($fieldvalues["field$fieldid"])) + { + if ($field['type'] == 'select_single') { - $temp = unserialize($field['selects']); - $value = trim($temp[0]); + if ($field['usedefault']) + { + $temp = unserialize($field['selects']); + $value = trim($temp[0]); + } + else + { + continue; + } } else { - continue; + $value = $field['defaultvalue']; } } else { - $value = $field['defaultvalue']; + $value = $fieldvalues["field$fieldid"]; } + + $customfields .= "
$field[name]: "; + + if ($field['type'] == 'input_text' OR $field['type'] == 'select_single') + { + $customfields .= $value; + } + else if ($field['type'] == 'input_checkbox') + { + $customfields .= (($value) ? 'True' : 'False'); + } + $customfields .= "
\n\n"; } - else - { - $value = $fieldvalues["field$fieldid"]; - } - - $customfields .= "
$field[name]: "; - - if ($field['type'] == 'input_text' OR $field['type'] == 'select_single') - { - $customfields .= $value; - } - else if ($field['type'] == 'input_checkbox') - { - $customfields .= (($value) ? 'True' : 'False'); - } - $customfields .= "
\n\n"; } +// ################################################################### +// other elements + // ------------------------------------------------------------------- // hilight $words = explode(' ', $bugsys->in['hilight']); diff --git a/templates/editreport.tpl b/templates/editreport.tpl deleted file mode 100644 index dacf7cd..0000000 --- a/templates/editreport.tpl +++ /dev/null @@ -1,43 +0,0 @@ -$doctype -$headinclude -$header - -
- - - -
Bug ID: $bug[bugid]
-
style="color: red">Hidden: checked="checked" />
-
Summary/Title:
-
Severity:
- - -
Priority:
-
Status:
-
Resolution:
-
- - -
Assigned to:
-
- -
Duplicate of: $bug[duplicateof]" /> $duplicate[summary]
- -
Dependencies: $dependencies
- -
Product/Component/Version: -
$pcv_select
-
- -
Automatic Response Action: -
-
- -
First Comment:
- -$customfields - -
-
- -$footer \ No newline at end of file diff --git a/templates/showreport.tpl b/templates/showreport.tpl index 05ba521..c269a58 100644 --- a/templates/showreport.tpl +++ b/templates/showreport.tpl @@ -2,23 +2,63 @@ $doctype $headinclude $header -
This bug is hidden!
+
+ + + + +
style="color: red">Hidden: checked="checked" />
+ +
This bug is hidden!
+
Bug ID: $bug[bugid]
Reported by: $bug[userinfo]
-
Product: $bug[product] / Component: $bug[component] / Version: $bug[version]
-
Title / summary: $bug[summary]
-
Status: $bug[status] / Resolution: $bug[resolution]
-
Severity: $bug[severity]
-
Priority: $bug[priority]
-
Assigned to: $bug[assigninfo]
-
Duplicate of: $duplicateof[summary]
-
Bugs marked as duplicates of this: $dupelist
-
Dependencies: $dependencies
- -$customfields - -
[Show Bug History] [Edit Bug Report] [$favouritetext]
+ + +
Summary/Title:
+
Severity:
+ + +
Priority:
+
Status:
+
Resolution:
+
+ + +
Assigned to:
+
+ +
Duplicate of: $bug[duplicateof]" /> $duplicate[summary]
+ +
Dependencies: $dependencies
+ +
Product/Component/Version: +
$pcv_select
+
+ +
Automatic Response Action: +
+
+ + $customfields + +
Product: $bug[product] / Component: $bug[component] / Version: $bug[version]
+
Title / summary: $bug[summary]
+
Status: $bug[status] / Resolution: $bug[resolution]
+
Severity: $bug[severity]
+
Priority: $bug[priority]
+
Assigned to: $bug[assigninfo]
+
Duplicate of: $duplicateof[summary]
+
Bugs marked as duplicates of this: $dupelist
+
Dependencies: $dependencies
+ $customfields +
+ +
+
+ +
[Show Bug History] [$favouritetext]

-- 2.43.5