From 2b643f048ffcd97c93e810d8d675bad591dec785 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 16 Jan 2006 08:10:05 +0000 Subject: [PATCH] r743: Adding explain for autoactions --- explain.php | 62 ++++++++++++++++++++++++++++++++ templates/explain_autoaction.tpl | 18 ++++++++++ 2 files changed, 80 insertions(+) create mode 100644 templates/explain_autoaction.tpl diff --git a/explain.php b/explain.php index 4572e52..b2a95c7 100644 --- a/explain.php +++ b/explain.php @@ -12,6 +12,7 @@ $fetchtemplates = array( 'explain_product', + 'explain_autoaction', 'explain_row' ); @@ -76,6 +77,67 @@ if ($_REQUEST['do'] == 'products') eval('$template->flush("' . $template->fetch('explain_product') . '");'); } +// ################################################################### + +if ($_REQUEST['do'] == 'autoactions') +{ + $fields_fetch = $bugsys->db->query(" + SELECT bugfield.*, permission.mask + FROM " . TABLE_PREFIX . "bugfield AS bugfield + LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission + ON (bugfield.fieldid = permission.fieldid) + WHERE (permission.mask = 2 OR permission.mask = 1) + AND permission.usergroupid = {$bugsys->userinfo['usergroupid']}" + ); + while ($field = $bugsys->db->fetch_array($fields_fetch)) + { + $fields["$field[fieldid]"] = $field; + } + + foreach ($bugsys->datastore['autoaction'] AS $autoaction) + { + $autoaction['fieldchanges'] = unserialize($autoaction['fieldchanges']); + + $left = $autoaction['name']; + $right = $autoaction['description']; + $trextra = ' class="listinghead"'; + + eval('$autoactions .= "' . $template->fetch('explain_row') . '";'); + + if ($autoaction['comment']) + { + $left = $lang->string('Add Comment'); + $right = $autoaction['comment']; + $trextra = ' style="background-color: ' . $stylevar['alt_colour'] . '"'; + + eval('$autoactions .= "' . $template->fetch('explain_row') . '";'); + } + + $trextra = ''; + + foreach ($autoaction['fieldchanges']['builtin'] AS $name => $value) + { + $left = $name; + $right = $bugsys->datastore["$left"]["$value"]["$left"]; + eval('$autoactions .= "' . $template->fetch('explain_row') . '";'); + } + + foreach ($autoaction['fieldchanges']['custom'] AS $id => $value) + { + if (!$fields["$id"]) + { + continue; + } + + $left = $fields["$id"]['name'] . ' ' . sprintf($lang->string('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']); + $right = $value; + eval('$autoactions .= "' . $template->fetch('explain_row') . '";'); + } + } + + eval('$template->flush("' . $template->fetch('explain_autoaction') . '");'); +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/templates/explain_autoaction.tpl b/templates/explain_autoaction.tpl new file mode 100644 index 0000000..6012e53 --- /dev/null +++ b/templates/explain_autoaction.tpl @@ -0,0 +1,18 @@ +$doctype + + +$headinclude + {$bugsys->options['trackertitle']} - {@"Automatic Actions"} + + + + +$header + +

{@"Explication of Automatic Actions"}

+ + +$autoactions +
+ +$footer \ No newline at end of file -- 2.22.5