cvs: php-bugs-web / bug.php fix.php /include resolve.inc

From: Date: Sun, 10 Feb 2002 00:54:50 +0000
Subject: cvs: php-bugs-web / bug.php fix.php /include resolve.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-8641@lists.php.net to get a copy of this message
jimw Sat Feb 9 19:54:50 2002 EDT Modified files: /php-bugs-web bug.php fix.php /php-bugs-web/include resolve.inc Log: when using a quick-fix link, and someone has already marked the bug with the selected status, toss a bypassable error message. (to keep all the itchy trigger fingers in check.) on the main bug page, integrate the quick fix selection into the bug form proper, and allow for adding additional comments (that are appended to the canned response). Index: php-bugs-web/bug.php diff -u php-bugs-web/bug.php:1.26 php-bugs-web/bug.php:1.27 --- php-bugs-web/bug.php:1.26 Sat Feb 9 15:19:22 2002 +++ php-bugs-web/bug.php Sat Feb 9 19:54:50 2002 @@ -88,7 +88,19 @@ if (!verify_password($user,stripslashes($pw))) { $errors[] = "The username or password you supplied was incorrect."; } - elseif (!($errors = incoming_details_are_valid($in))) { + if ($in['resolve']) { + if (!$trytoforce && $RESOLVE_REASONS[$in['resolve']]['status'] == $bug['status']) { + $errors[] = "The bug is already marked '$bug[status]'. (Submit again to ignore this.)"; + } + else { + if ($in['status'] == $bug['status']) { + $in['status'] = $RESOLVE_REASONS[$in['resolve']]['status']; + } + $ncomment = $RESOLVE_REASONS[$in['resolve']]['message'] + . "\n\n$ncomment"; + } + } + if (!$errors && !($errors = incoming_details_are_valid($in))) { $query = "UPDATE bugdb SET sdesc='$in[sdesc]',status='$in[status]', bug_type='$in[bug_type]', assign='$in[assign]', php_version='$in[php_version]', php_os='$in[php_os]', ts2=NOW() WHERE id=$id"; $success = @mysql_query($query); if ($success && !empty($ncomment)) { @@ -202,16 +214,6 @@ <?php } -if ($edit == 1) {?> -<form id="quickfix" method="post" action="fix.php"> -<b>Quick Fix:</b> -<select name="r"><?php show_reason_types()?></select> -<input type="hidden" name="id" value="<?php echo $id?>" /> -<input type="submit" value="Resolve" /> -</form> -<?php -} - if ($edit == 1 || $edit == 2) {?> <form id="update" action="<?php echo $PHP_SELF?>" method="post"> <?php @@ -286,6 +288,12 @@ } ?> <table> +<?php if ($edit == 1) {?> + <tr> + <th>Quick Fix:</th> + <td colspan="5"><select name="in[resolve]"><?php show_reason_types($in['resolve'],1);?></select><?php if ($in['resolve']) {?><input type="hidden" name="trytoforce" value="1" /><?php }?></td> + </tr> +<?php }?> <tr> <th>Status:</th> <td><select name="in[status]"><?php show_state_options($in['status'],$edit,$bug['status'])?></select></td> @@ -315,7 +323,7 @@ <td colspan="3"><input type="text" size="20" maxlength="32" name="in[php_os]" value="<?php echo field('php_os')?>" /></td> </tr> </table> -<b>New Comment:</b><br /> +<b>New<?php if ($edit==1) echo "/Additional"?> Comment:</b><br /> <textarea cols="60" rows="8" name="ncomment" wrap="physical"><?php echo clean($ncomment)?></textarea> <br /><input type="submit" value="Submit" /> </form> Index: php-bugs-web/fix.php diff -u php-bugs-web/fix.php:1.3 php-bugs-web/fix.php:1.4 --- php-bugs-web/fix.php:1.3 Sat Feb 9 15:19:22 2002 +++ php-bugs-web/fix.php Sat Feb 9 19:54:50 2002 @@ -87,6 +87,13 @@ $status = $RESOLVE_REASONS[$r]['status']; $ncomment = $RESOLVE_REASONS[$r]['message']; +/* if the already has the status of the resolution, bounce over to the + main bug form. it will show the appropriate error message. */ +if ($status == $bug['status']) { + header("Location: bug.php?id=$id&edit=1&in[resolve]=$r"); + exit; +} + $query = "UPDATE bugdb SET status='$status', ts2=NOW() WHERE id=$id"; $success = @mysql_query($query); Index: php-bugs-web/include/resolve.inc diff -u php-bugs-web/include/resolve.inc:1.4 php-bugs-web/include/resolve.inc:1.5 --- php-bugs-web/include/resolve.inc:1.4 Fri Feb 8 09:45:04 2002 +++ php-bugs-web/include/resolve.inc Sat Feb 9 19:54:50 2002 @@ -82,10 +82,11 @@ ), ); -function show_reason_types($current="") +function show_reason_types($current="", $expanded=0) { + if ($expanded) echo "<option value=\"\"></option>\n"; while (list($k,$v) = each($GLOBALS['RESOLVE_REASONS'])) { echo "<option value=\"$k\"", ($current==$k ? " selected" : ""), - ">$v[desc]</option>\n"; + ">$v[desc]",($expanded?" ($v[status])":""),"</option>\n"; } }

« previous php.mirrors (#8641) next »