[rt-devel] RT fixes and changes (still 1.0.1)
Marco Nijdam
marco at West.NL
Mon Mar 6 06:46:51 EST 2000
Sorry, forgot the diffs. They are attached.
Kind regards,
--
-- Marco Nijdam, marco at west.nl
-- West Consulting bv, Bagijnhof 80, 2611 AR Delft, The Netherlands
-- P.O. Box 3318, 2601 DH Delft
-- Tel: +31 15 219 1600, Fax: +31 15 214 7889
-------------- next part --------------
Index: rt/lib/rt/database/manipulate.pm
diff -c rt/lib/rt/database/manipulate.pm:1.1.1.1 rt/lib/rt/database/manipulate.pm:1.2
*** rt/lib/rt/database/manipulate.pm:1.1.1.1 Wed Feb 9 12:19:57 2000
--- rt/lib/rt/database/manipulate.pm Tue Feb 15 15:55:38 2000
***************
*** 1,4 ****
! # $Header: /source/util/REPOS/rt/lib/rt/database/manipulate.pm,v 1.1.1.1 2000/02/09 11:19:57 marco Exp $
package rt;
--- 1,4 ----
! # $Header: /source/util/REPOS/rt/lib/rt/database/manipulate.pm,v 1.2 2000/02/15 14:55:38 marco Exp $
package rt;
***************
*** 228,233 ****
--- 228,256 ----
return ($transaction_num,"Your comments have been recorded.");
}
+ sub change_status {
+ my ($in_serial_num, $in_current_user, $in_new_status) = @_;
+ my ($transaction_num);
+ if (!(&can_manipulate_request($in_serial_num,$in_current_user))) {
+ return (0,"You don't have permission to modify request \#$in_serial_num");
+ }
+ if (!defined($in_new_status) || $in_new_status eq '') {
+ return (0,"Internal error: no status specified when changing status for request \#$in_serial_num");
+ } elsif ($in_new_status eq 'resolved') {
+ return &resolve($in_serial_num, $in_current_user);
+ } elsif ($in_new_status eq 'open') {
+ return &open($in_serial_num, $in_current_user);
+ } elsif ($in_new_status eq 'stalled') {
+ return &stall($in_serial_num, $in_current_user);
+ } elsif ($in_new_status eq 'dead') {
+ return &kill($in_serial_num, $in_current_user);
+ }
+ # else: change to any other status
+
+ $transaction_num=&update_request($in_serial_num,'status', $in_new_status, $in_current_user);
+ return ($transaction_num,"Request #$in_serial_num has status changed to $in_new_status.");
+ }
+
sub resolve {
my ($in_serial_num, $in_current_user) = @_;
my ($transaction_num);
***************
*** 423,428 ****
--- 446,488 ----
return(0, "You can not change the ownership of a request owned by somebody else.");
}
}
+
+ #change the ownership of a request, even if it is owned by somebody else.
+ sub give_with_steal {
+ my ($in_serial_num, $in_owner, $in_current_user) = @_;
+ my ($transaction_num);
+ my $qid;
+ my $requestors;
+
+ if (!(&can_manipulate_request($in_serial_num,$in_current_user))) {
+ return (0,"You do not have access to modify request \#$in_serial_num");
+ }
+
+ if ($in_owner eq $req[$in_serial_num]{owner}) {
+ return(0,"$in_owner already owns request \#$in_serial_num.");
+ }
+
+ # can_manipulate_request sets req, so next this after that.
+ if (($in_owner eq '') || ($req[$in_serial_num]{'owner'} eq '')
+ || ($req[$in_serial_num]{'owner'} eq $in_current_user)) {
+ return(&give ($in_serial_num, $in_owner, $in_current_user));
+ }
+
+ if (!(&can_manipulate_request($in_serial_num,$in_owner))) {
+ return (0,"$in_owner does not have access to modify requests in this queue");
+ }
+
+ $qid = $req[$in_serial_num]{queue_id};
+ $requestors = $req[$in_serial_num]{requestors};
+ $in_subject = $req[$in_serial_num]{subject};
+
+ $transaction_num=&update_request($in_serial_num,'owner',$in_owner, $in_current_user);
+ &rt::template_mail('give',$qid,$rt::users{$in_owner}{email},"","", "$in_serial_num" ,
+ "$transaction_num","$in_subject","$in_current_user",'');
+
+ return ($transaction_num, "Request #$in_serial_num stolen and given to $in_owner.");
+ }
+
sub untake {
my ($in_serial_num, $in_current_user) = @_;
return(&give ($in_serial_num, "", $in_current_user));
Index: rt/lib/rt/ui/cli/manipulate.pm
diff -c rt/lib/rt/ui/cli/manipulate.pm:1.1.1.1 rt/lib/rt/ui/cli/manipulate.pm:1.2
*** rt/lib/rt/ui/cli/manipulate.pm:1.1.1.1 Wed Feb 9 12:19:56 2000
--- rt/lib/rt/ui/cli/manipulate.pm Tue Feb 15 15:57:29 2000
***************
*** 193,198 ****
--- 193,216 ----
print "$message\n";
}
+ elsif ($ARGV[$i] eq "-accept") {
+ $serial_num=int($ARGV[++$i]);
+ ($trans,$message)=&rt::change_status($serial_num, $current_user, 'accepted');
+ print "$message\n";
+ }
+
+ elsif ($ARGV[$i] eq "-assign") {
+ $serial_num=int($ARGV[++$i]);
+ $owner=$ARGV[++$i];
+ ($trans, $message)=&rt::give($serial_num, $owner, $current_user);
+ print "$message\n";
+ # only continue if transaction succeeded
+ if ($trans > 0) {
+ ($trans,$message)=&rt::change_status($serial_num, $current_user, 'assigned');
+ print "$message\n";
+ }
+ }
+
else {
&cli_help_req;
}
***************
*** 300,305 ****
--- 318,325 ----
RT CLI Flags and their arguments
-----------------------------------------------
-create Interactively create a new request
+ -accept <num> Change <num>'s status to accepted
+ -assign <num> <user> Change <num>'s status to assigned, make <user> owner
-resolve <num> Change <num>'s status to resolved
-open <num> Change <num>'s status to open
-stall <num> Change <num>'s status to stalled
Index: rt/lib/rt/ui/cli/query.pm
diff -c rt/lib/rt/ui/cli/query.pm:1.1.1.1 rt/lib/rt/ui/cli/query.pm:1.2
*** rt/lib/rt/ui/cli/query.pm:1.1.1.1 Wed Feb 9 12:19:56 2000
--- rt/lib/rt/ui/cli/query.pm Tue Feb 15 15:57:29 2000
***************
*** 1,4 ****
! # $Header: /source/util/REPOS/rt/lib/rt/ui/cli/query.pm,v 1.1.1.1 2000/02/09 11:19:56 marco Exp $
package rt::ui::cli::query;
--- 1,4 ----
! # $Header: /source/util/REPOS/rt/lib/rt/ui/cli/query.pm,v 1.2 2000/02/15 14:57:29 marco Exp $
package rt::ui::cli::query;
***************
*** 158,163 ****
--- 158,177 ----
}
$status_ops .= " status = \'open\'" ;
}
+ if ($ARGV[$i] eq '-accepted'){
+ if ($status_ops){
+ $status_ops .= " OR ";
+ }
+ $status_ops .= " status = \'accepted\'" ;
+ }
+
+ if ($ARGV[$i] eq '-assigned'){
+ if ($status_ops){
+ $status_ops .= " OR ";
+ }
+ $status_ops .= " status = \'assigned\'" ;
+ }
+
if (($ARGV[$i] eq '-resolved') or ($ARGV[$i] eq '-closed')){
if ($status_ops){
$status_ops .= " OR ";
***************
*** 259,264 ****
--- 273,280 ----
-unowned lists unowned requests
-user <user> lists all requests made by <user>
-open lists only the open requests
+ -accepted lists accepted requests
+ -assigned lists assigned requests
-resolved lists resolved requests
-stalled lists stalled requests
-dead lists killed requests
Index: rt/lib/rt/ui/mail/manipulate.pm
diff -c rt/lib/rt/ui/mail/manipulate.pm:1.1.1.1 rt/lib/rt/ui/mail/manipulate.pm:1.2
*** rt/lib/rt/ui/mail/manipulate.pm:1.1.1.1 Wed Feb 9 12:19:56 2000
--- rt/lib/rt/ui/mail/manipulate.pm Tue Feb 15 15:58:36 2000
***************
*** 324,331 ****
%RT SET final <num> <prio>
will set request <num>'s final priority to <prio>.
! %RT SET status <num> (open|closed|stalled|dead yes)
! will set request <num>'s status to (open|closed|stalled|dead).
%RT SET user <num> <email>
will set request <num>'s requestor(s) to the comma-delineated,
--- 324,331 ----
%RT SET final <num> <prio>
will set request <num>'s final priority to <prio>.
! %RT SET status <num> (open|accepted|assigned|closed|stalled|dead yes)
! will set request <num>'s status to (open|accepted|assigned|closed|stalled|dead).
%RT SET user <num> <email>
will set request <num>'s requestor(s) to the comma-delineated,
***************
*** 517,522 ****
--- 517,530 ----
elsif ($status =~ /open/i) {
($trans, $message)=&rt::open($serial_num, $current_user);
+ }
+
+ elsif ($status =~ /accept/i) {
+ ($trans, $message)=&rt::change_status($serial_num, $current_user, 'accepted');
+ }
+
+ elsif ($status =~ /assign/i) {
+ ($trans, $message)=&rt::change_status($serial_num, $current_user, 'assigned');
}
elsif ($status =~ /resolv/i) {
Index: rt/lib/rt/ui/web/admin.pm
diff -c rt/lib/rt/ui/web/admin.pm:1.1.1.1 rt/lib/rt/ui/web/admin.pm:1.2
*** rt/lib/rt/ui/web/admin.pm:1.1.1.1 Wed Feb 9 12:19:56 2000
--- rt/lib/rt/ui/web/admin.pm Tue Feb 15 16:03:41 2000
***************
*** 1,4 ****
! # $Header: /source/util/REPOS/rt/lib/rt/ui/web/admin.pm,v 1.1.1.1 2000/02/09 11:19:56 marco Exp $
# (c) 1996-1999 Jesse Vincent <jesse at fsck.com>
# This software is redistributable under the terms of the GNU GPL
#
--- 1,4 ----
! # $Header: /source/util/REPOS/rt/lib/rt/ui/web/admin.pm,v 1.2 2000/02/15 15:03:41 marco Exp $
# (c) 1996-1999 Jesse Vincent <jesse at fsck.com>
# This software is redistributable under the terms of the GNU GPL
#
***************
*** 234,248 ****
sub FormModifyUser{
my ($user_id) = @_;
if (!&rt::is_a_user($user_id)) {
&page_head("Create a new user called <b>$user_id</b>");
}
elsif ($user_id eq $current_user){
&page_head("Modify your own attributes");
}
! else {
&page_head("Modify the user <b>$user_id</b>");
}
--- 234,256 ----
sub FormModifyUser{
my ($user_id) = @_;
+ my ($can_modify_user) = 0;
+ if ($rt::users{$current_user}{admin_rt}) {
+ $can_modify_user = 1;
+ }
+
if (!&rt::is_a_user($user_id)) {
&page_head("Create a new user called <b>$user_id</b>");
}
elsif ($user_id eq $current_user){
&page_head("Modify your own attributes");
+ $can_modify_user = 1;
}
! elsif ($can_modify_user) {
&page_head("Modify the user <b>$user_id</b>");
+ } else {
+ &page_head("View the user <b>$user_id</b>");
}
***************
*** 270,276 ****
Real name:
</td>
<td>
! <input name=\"real_name\" size=30 value=\"$rt::users{$user_id}{real_name}\">
</td>
</tr>
<tr>
--- 278,290 ----
Real name:
</td>
<td>
! ";
! if ($can_modify_user) {
! print "<input name=\"real_name\" size=30 value=\"$rt::users{$user_id}{real_name}\">";
! } else {
! print $rt::users{$user_id}{real_name};
! }
! print "
</td>
</tr>
<tr>
***************
*** 278,286 ****
email:
</td>
<td>
! <input name=\"email\" size=30 value=\"$rt::users{$user_id}{email}\">
</td>
</tr>
<tr>
<td>
password:
--- 292,309 ----
email:
</td>
<td>
! ";
! if ($can_modify_user) {
! print "<input name=\"email\" size=30 value=\"$rt::users{$user_id}{email}\">";
! } else {
! print $rt::users{$user_id}{email};
! }
! print "
</td>
</tr>
+ ";
+ if ($can_modify_user) {
+ print "
<tr>
<td>
password:
***************
*** 288,300 ****
<td>
<input type=\"password\" name=\"password\" size=15><font size=\"-2\">(leave blank unless you want to change)</font>
</td>
! </tr>
<tr>
<td>
phone:
</td>
<td>
! <input name=\"phone\" size=30 value=\"$rt::users{$user_id}{phone}\">
</td>
</tr>
<tr>
--- 311,331 ----
<td>
<input type=\"password\" name=\"password\" size=15><font size=\"-2\">(leave blank unless you want to change)</font>
</td>
! </tr>";
! }
! print "
<tr>
<td>
phone:
</td>
<td>
! ";
! if ($can_modify_user) {
! print "<input name=\"phone\" size=30 value=\"$rt::users{$user_id}{phone}\">";
! } else {
! print $rt::users{$user_id}{phone};
! }
! print "
</td>
</tr>
<tr>
***************
*** 302,308 ****
office:
</td>
<td>
! <input name=\"office\" size=30 value=\"$rt::users{$user_id}{office}\">
</td>
</tr>
<tr>
--- 333,345 ----
office:
</td>
<td>
! ";
! if ($can_modify_user) {
! print "<input name=\"office\" size=30 value=\"$rt::users{$user_id}{office}\">";
! } else {
! print $rt::users{$user_id}{office};
! }
! print "
</td>
</tr>
<tr>
***************
*** 310,316 ****
misc:
</td>
<td>
! <input name=\"comments\" size=30 value=\"$rt::users{$user_id}{comments}\">
</td>
</tr>
</table>
--- 347,359 ----
misc:
</td>
<td>
! ";
! if ($can_modify_user) {
! print "<input name=\"comments\" size=30 value=\"$rt::users{$user_id}{comments}\">";
! } else {
! print $rt::users{$user_id}{comments};
! }
! print "
</td>
</tr>
</table>
***************
*** 336,351 ****
}
}
! else {
! if ($rt::users{user_id}{admin_rt}) {
print "<b>This user is an RT administrator</b><br>\n";
}
foreach $queue_id (sort keys %rt::queues) {
! print "<b>$queue_id:</b>\n";
if (!&rt::can_display_queue($queue_id,$user_id)){
! print "No Access\n";
}
! elsif ((&rt::can_admin_queue($queue_id,$user_id))== 1){
print "Admin\n";
}
elsif ((&rt::can_manipulate_queue($queue_id,$user_id))==1){
--- 379,396 ----
}
}
! # Only display queue information of yourself
! elsif ($user_id eq $current_user){
! if ($rt::users{$user_id}{admin_rt}) {
print "<b>This user is an RT administrator</b><br>\n";
}
foreach $queue_id (sort keys %rt::queues) {
! # Don't display queues that you are not allowed to see
if (!&rt::can_display_queue($queue_id,$user_id)){
! next;
}
! print "<b>$queue_id:</b>\n";
! if ((&rt::can_admin_queue($queue_id,$user_id))== 1){
print "Admin\n";
}
elsif ((&rt::can_manipulate_queue($queue_id,$user_id))==1){
***************
*** 361,372 ****
print "<BR>\n";
}
}
print "</TD></TR></TABLE>\n";
print "<TABLE WIDTH=\"100%\" BGCOLOR=\"#DDDDDD\" BORDER=0 CELLSPACING=0 CELLPADDING=3><TR><TD ALIGN=LEFT WIDTH=33%>
! <input type=\"submit\" name=\"action\" value=\"Update User\">
</TD>\n";
if ($rt::users{$current_user}{admin_rt}) {
print "<TD ALIGN=CENTER WIDTH=33%>
--- 406,424 ----
print "<BR>\n";
}
}
+ else {
+ print "Not visible.<BR>\n";
+ }
print "</TD></TR></TABLE>\n";
print "<TABLE WIDTH=\"100%\" BGCOLOR=\"#DDDDDD\" BORDER=0 CELLSPACING=0 CELLPADDING=3><TR><TD ALIGN=LEFT WIDTH=33%>
! ";
! if ($can_modify_user) {
! print "<input type=\"submit\" name=\"action\" value=\"Update User\">";
! }
! print "
</TD>\n";
if ($rt::users{$current_user}{admin_rt}) {
print "<TD ALIGN=CENTER WIDTH=33%>
***************
*** 386,391 ****
--- 438,444 ----
sub FormModifyQueue{
my ($queue_id) = @_;
+
if (!&rt::is_a_queue($queue_id)) {
&page_head("Create a new queue called <b>$queue_id</b>");
***************
*** 410,416 ****
<table>
<tr><td>Queue name:</td><td>$queue_id</td></tr>
! <tr><td>mail alias:</td><td><input name=\"email\" size=30 value=\"$rt::queues{$queue_id}{mail_alias}\"></td></tr>
<tr><td>Initial priority:</td><td> ";
&rt::ui::web::select_an_int($rt::queues{$queue_id}{default_prio},"initial_prio");
print "</td></tr>
--- 463,475 ----
<table>
<tr><td>Queue name:</td><td>$queue_id</td></tr>
! <tr><td>mail alias:</td><td>";
! if (&rt::can_admin_queue($queue_id, $current_user)){
! print "<input name=\"email\" size=30 value=\"$rt::queues{$queue_id}{mail_alias}\">";
! } else {
! print $rt::queues{$queue_id}{mail_alias};
! }
! print "</td></tr>
<tr><td>Initial priority:</td><td> ";
&rt::ui::web::select_an_int($rt::queues{$queue_id}{default_prio},"initial_prio");
print "</td></tr>
***************
*** 454,467 ****
print "<hr><H2>Areas</h2>\n";
! print "Delete the area <select name=\"delete_area\">
<option value=\"\">None ";
foreach $area ( keys % {$rt::queues{$queue_id}{areas}} ) {
print "<option>$area\n";
}
print "</select>\n";
! print "<br>Add an area called <input size=\"15\" name=\"add_area\"><br>
</TD>
--- 513,533 ----
print "<hr><H2>Areas</h2>\n";
! if (&rt::can_admin_queue($queue_id, $current_user)){
! print "Delete the area <select name=\"delete_area\">
<option value=\"\">None ";
+ } else {
+ print "Available areas:<BR><select size=\"4\">";
+ }
foreach $area ( keys % {$rt::queues{$queue_id}{areas}} ) {
print "<option>$area\n";
}
print "</select>\n";
! if (&rt::can_admin_queue($queue_id, $current_user)){
! print "<br>Add an area called <input size=\"15\" name=\"add_area\">";
! }
! print "<br>
</TD>
***************
*** 478,483 ****
--- 544,553 ----
foreach $user_id (sort keys %rt::users) {
+ if (! &rt::can_admin_queue($queue_id, $current_user) &&
+ &rt::can_display_queue($queue_id, $user_id) != 1){
+ next;
+ }
my $escaped_user_id = $user_id;
$escaped_user_id=~s/ /%20/g;
print "<A HREF=\"$ScriptURL?display=Modify+the+User+called&user_id=$escaped_user_id\">$user_id</a>:";
***************
*** 601,606 ****
--- 671,678 ----
my ($user_id, $queue_id) = @_;
my $flag = 0;
+ if (&rt::can_admin_queue($queue_id, $current_user)){
+
print "<select name=\"acl_". $queue_id . "_" .$user_id. "\">\n";
print "<option value=\"admin\"";
***************
*** 622,633 ****
}
print">Display\n";
print "<option value=\"none\"";
! if (! $flag && !&rt::can_display_queue($queue_id,$user_id)){
print "SELECTED";
}
print ">No Access\n";
print "</select><br>\n";
}
1;
--- 694,722 ----
}
print">Display\n";
print "<option value=\"none\"";
! # Changed for West: if user has no display rights, but is admin,
! # set SELECTED anyway, otherwise nothing would be selected,
! # and the display would have "admin" as default selected.
! # Thus when submitting the form, all admins will be member of
! # the queue, and we don't want that.
! if (! $flag && (&rt::can_display_queue($queue_id,$user_id) != 1)){
print "SELECTED";
}
print ">No Access\n";
print "</select><br>\n";
+ } else {
+ if ((&rt::can_admin_queue($queue_id,$user_id))== 1){
+ print "Admin\n";
+ } elsif ((&rt::can_manipulate_queue($queue_id,$user_id))==1){
+ print "Manipulate\n";
+ } elsif ((&rt::can_display_queue($queue_id,$user_id))==1){
+ print "Display\n";
+ } else {
+ print "No Access\n";
+ }
+ print "<br>\n";
+ }
}
1;
Index: rt/lib/rt/ui/web/forms.pm
diff -c rt/lib/rt/ui/web/forms.pm:1.1.1.1 rt/lib/rt/ui/web/forms.pm:1.3
*** rt/lib/rt/ui/web/forms.pm:1.1.1.1 Wed Feb 9 12:19:57 2000
--- rt/lib/rt/ui/web/forms.pm Tue Feb 15 17:13:11 2000
***************
*** 1,6 ****
#jesse at fsck.com
#
! # $Header: /source/util/REPOS/rt/lib/rt/ui/web/forms.pm,v 1.1.1.1 2000/02/09 11:19:57 marco Exp $
package rt::ui::web;
--- 1,6 ----
#jesse at fsck.com
#
! # $Header: /source/util/REPOS/rt/lib/rt/ui/web/forms.pm,v 1.3 2000/02/15 16:13:11 marco Exp $
package rt::ui::web;
***************
*** 16,22 ****
}
print ">
<center>
! <table>
<td valign=\"top\">
<font size=\"-1\">
<b>Status</b>: <SELECT NAME=\"q_status\" Size=1>";
--- 16,22 ----
}
print ">
<center>
! <table border=0 cellspacing=1 cellpadding=1>
<td valign=\"top\">
<font size=\"-1\">
<b>Status</b>: <SELECT NAME=\"q_status\" Size=1>";
***************
*** 24,29 ****
--- 24,33 ----
print "<OPTION> any" if ($rt::ui::web::FORM{'q_status'} ne "any");
print "<OPTION SELECTED> open" if (($rt::ui::web::FORM{'q_status'} eq "open" ) or (!$rt::ui::web::FORM{'q_status'}));
print "<OPTION> open" if (! (($rt::ui::web::FORM{'q_status'} eq "open" ) or (!$rt::ui::web::FORM{'q_status'})) );
+ print "<OPTION SELECTED> accepted" if ($rt::ui::web::FORM{'q_status'} eq "accepted");
+ print "<OPTION> accepted" if ($rt::ui::web::FORM{'q_status'} ne "accepted");
+ print "<OPTION SELECTED> assigned" if ($rt::ui::web::FORM{'q_status'} eq "assigned");
+ print "<OPTION> assigned" if ($rt::ui::web::FORM{'q_status'} ne "assigned");
print "<OPTION SELECTED> stalled" if ($rt::ui::web::FORM{'q_status'} eq "stalled");
print "<OPTION> stalled" if ($rt::ui::web::FORM{'q_status'} ne "stalled");
print "<OPTION SELECTED> resolved" if ($rt::ui::web::FORM{'q_status'} eq "resolved");
***************
*** 65,75 ****
$rt::ui::web::FORM{'q_unowned'} = '' if ! defined $rt::ui::web::FORM{'q_unowned'};
$rt::ui::web::FORM{'q_owned_by'} = '' if ! defined $rt::ui::web::FORM{'q_owned_by'};
! print "CHECKED" if $rt::ui::web::FORM{'q_unowned'};
print "> None ";
print "<INPUT TYPE=\"checkbox\" NAME=\"q_owned_by\" VALUE=\"true\"";
! print "CHECKED" if $rt::ui::web::FORM{'q_owned_by'};
print "> <select name=\"q_owner\">";
--- 69,79 ----
$rt::ui::web::FORM{'q_unowned'} = '' if ! defined $rt::ui::web::FORM{'q_unowned'};
$rt::ui::web::FORM{'q_owned_by'} = '' if ! defined $rt::ui::web::FORM{'q_owned_by'};
! print " CHECKED" if $rt::ui::web::FORM{'q_unowned'};
print "> None ";
print "<INPUT TYPE=\"checkbox\" NAME=\"q_owned_by\" VALUE=\"true\"";
! print " CHECKED" if $rt::ui::web::FORM{'q_owned_by'};
print "> <select name=\"q_owner\">";
***************
*** 106,122 ****
$rt::ui::web::FORM{'q_user'} = '' if ! defined $rt::ui::web::FORM{'q_user'};
! print "CHECKED" if (!$rt::ui::web::FORM{'q_user'}) || (!$rt::ui::web::FORM{'q_user_other'});
print "> Any ";
print "<INPUT TYPE=\"radio\" NAME=\"q_user\" VALUE=\"other\"";
! print "CHECKED" if $rt::ui::web::FORM{'q_user_other'};
print "> <INPUT SIZE=8 NAME=\"q_user_other\"";
print "VALUE=\"$rt::ui::web::FORM{'q_user_other'}\"" if $rt::ui::web::FORM{'q_user_other'};
print ">
<br>
</font>
! </td><td valign=\"top\">
<font size=\"-1\"><b>Refresh:</b><SELECT name=\"refresh\">
<OPTION VALUE=0 ";
if ($rt::ui::web::FORM{'refresh'} == -1 ) { print "SELECTED ";}
--- 110,131 ----
$rt::ui::web::FORM{'q_user'} = '' if ! defined $rt::ui::web::FORM{'q_user'};
! print " CHECKED" if (!$rt::ui::web::FORM{'q_user'}) || (!$rt::ui::web::FORM{'q_user_other'});
print "> Any ";
print "<INPUT TYPE=\"radio\" NAME=\"q_user\" VALUE=\"other\"";
! print " CHECKED" if $rt::ui::web::FORM{'q_user_other'};
print "> <INPUT SIZE=8 NAME=\"q_user_other\"";
print "VALUE=\"$rt::ui::web::FORM{'q_user_other'}\"" if $rt::ui::web::FORM{'q_user_other'};
print ">
<br>
</font>
! </td>
! <td valign=\"top\">
! </td>
! </TR>
! <TR>
! <td valign=\"top\">
<font size=\"-1\"><b>Refresh:</b><SELECT name=\"refresh\">
<OPTION VALUE=0 ";
if ($rt::ui::web::FORM{'refresh'} == -1 ) { print "SELECTED ";}
***************
*** 153,160 ****
print"
</select>
</font>
-
</td></tr></table></center>
<B>
<center><input type=\"submit\" value =\"Update Queue Filters\"></center>
--- 162,183 ----
print"
</select>
</font>
+ </td>
+ <td valign=\"top\">
+ <font size=\"-1\"><b>Show:</b><SELECT name=\"q_showage\">
+ ";
+ print "<option";
+ if ($rt::ui::web::FORM{'q_showage'} eq "date") { print " SELECTED"; }
+ print ">date\n";
+ print "<option";
+ if ($rt::ui::web::FORM{'q_showage'} eq "age") { print " SELECTED"; }
+ print ">age\n";
+ print "<option";
+ if ($rt::ui::web::FORM{'q_showage'} eq "both") { print " SELECTED"; }
+ print ">both
+ </select>
+ </font>
</td></tr></table></center>
<B>
<center><input type=\"submit\" value =\"Update Queue Filters\"></center>
***************
*** 214,219 ****
--- 237,262 ----
<input type=\"hidden\" name=\"do_req_give\" value=\"true\"></FORM>
";
}
+
+ sub FormSetAssign{
+ print "
+ <form action=\"$ScriptURL\" method=\"post\">
+ <input type=\"hidden\" name=\"serial_num\" value=\"$serial_num\" >
+ <input type=\"submit\" value =\"Assign to\"><select name=\"do_req_give_to\">
+ <option value=\"\">Nobody ";
+ foreach $user_id ( sort keys % {$rt::queues{$rt::req[$serial_num]{queue_id}}{acls}} ) {
+ if (&rt::can_manipulate_queue ($rt::req[$serial_num]{queue_id}, $user_id)) {
+ print "<option ";
+ print "SELECTED" if ($user_id eq $rt::req[$serial_num]{owner});
+ print ">$user_id\n";
+ }
+ }
+ print "</select>
+ <input type=\"hidden\" name=\"do_req_give\" value=\"true\">
+ <input type=\"hidden\" name=\"do_req_assign\" value=\"true\"></FORM>
+ ";
+ }
+
sub FormSetArea{
print "
<form action=\"$ScriptURL\" method=\"post\">
***************
*** 342,347 ****
--- 385,396 ----
print "<option value=\"open\" ";
if ($rt::req[$serial_num]{status} eq 'open') { print "SELECTED";}
print ">open\n";
+ print "<option value=\"accept\" ";
+ if ($rt::req[$serial_num]{status} eq 'accepted') { print "SELECTED";}
+ print ">accepted\n";
+ print "<option value=\"assign\" ";
+ if ($rt::req[$serial_num]{status} eq 'assigned') { print "SELECTED";}
+ print ">assigned\n";
print "<option value=\"stall\" ";
if ($rt::req[$serial_num]{status} eq 'stalled') { print "SELECTED";}
print ">stalled\n";
***************
*** 376,381 ****
--- 425,436 ----
print "<option value=\"open\" ";
if ($rt::req[$serial_num]{status} eq 'open') { print "SELECTED";}
print ">open\n";
+ print "<option value=\"accept\" ";
+ if ($rt::req[$serial_num]{status} eq 'accepted') { print "SELECTED";}
+ print ">accepted\n";
+ print "<option value=\"assign\" ";
+ if ($rt::req[$serial_num]{status} eq 'assigned') { print "SELECTED";}
+ print ">assigned\n";
print "<option value=\"stall\" ";
if ($rt::req[$serial_num]{status} eq 'stalled') { print "SELECTED";}
print ">stalled\n";
***************
*** 422,428 ****
<input type=\"submit\" value=\"Create request in queue\"><select name=\"queue_id\">\n";
foreach $queue (sort keys %rt::queues) {
if (&rt::can_create_request($queue, $current_user)) {
! print "<option>$queue\n";
}
# else {
# print "<!-- $current_user can't make a req in $queue\n\n-->";
--- 477,488 ----
<input type=\"submit\" value=\"Create request in queue\"><select name=\"queue_id\">\n";
foreach $queue (sort keys %rt::queues) {
if (&rt::can_create_request($queue, $current_user)) {
! print "<option";
! if (defined ($rt::ui::web::FORM{'q_queue'}) &&
! $rt::ui::web::FORM{'q_queue'} eq $queue) {
! print " SELECTED";
! }
! print ">$queue\n";
}
# else {
# print "<!-- $current_user can't make a req in $queue\n\n-->";
***************
*** 478,483 ****
--- 538,545 ----
<TD align=\"right\">Status:</TD>
<TD><select name=\"status\">
<option value=\"open\">open
+ <option value=\"accepted\">accepted
+ <option value=\"assigned\">assigned
<option value=\"stalled\">stalled
<option value=\"resolved\">resolved
</select></TD>
Index: rt/lib/rt/ui/web/manipulate.pm
diff -c rt/lib/rt/ui/web/manipulate.pm:1.1.1.1 rt/lib/rt/ui/web/manipulate.pm:1.2
*** rt/lib/rt/ui/web/manipulate.pm:1.1.1.1 Wed Feb 9 12:19:57 2000
--- rt/lib/rt/ui/web/manipulate.pm Tue Feb 15 17:11:13 2000
***************
*** 1,4 ****
! # $Header: /source/util/REPOS/rt/lib/rt/ui/web/manipulate.pm,v 1.1.1.1 2000/02/09 11:19:57 marco Exp $
# (c) 1996-1999 Jesse Vincent <jesse at fsck.com>
# This software is redistributable under the terms of the GNU GPL
#
--- 1,4 ----
! # $Header: /source/util/REPOS/rt/lib/rt/ui/web/manipulate.pm,v 1.2 2000/02/15 16:11:13 marco Exp $
# (c) 1996-1999 Jesse Vincent <jesse at fsck.com>
# This software is redistributable under the terms of the GNU GPL
#
***************
*** 34,39 ****
--- 34,46 ----
sub InitDisplay {
+ my($restore_result) = -1;
+ if (! (defined($rt::ui::web::FORM{'display'}) &&
+ defined($rt::ui::web::FORM{'q_status'}))) {
+ # Only restore if not explicitly setting a new query pattern
+ $restore_result = &restore_queue_options;
+ }
+
if (!($frames) && (!$rt::ui::web::FORM{'display'})) {
if ($serial_num > 0 || $rt::ui::web::FORM{'do_req_create'}) {
***************
*** 41,51 ****
}
else{
! #display a default queue
! #$rt::ui::web::FORM{'q_unowned'}='true';
! #$rt::ui::web::FORM{'q_owned_by_me'}='true';
! $rt::ui::web::FORM{'q_status'}='open';
! $rt::ui::web::FORM{'q_by_date_due'}='true';
$rt::ui::web::FORM{'display'} = "Queue";
}
}
--- 48,61 ----
}
else{
! # If there was no cookie from which to restore results.
! if (! $restore_result) {
! #display a default queue
! #$rt::ui::web::FORM{'q_unowned'}='true';
! #$rt::ui::web::FORM{'q_owned_by_me'}='true';
! $rt::ui::web::FORM{'q_status'}='open';
! $rt::ui::web::FORM{'q_by_date_due'}='true';
! }
$rt::ui::web::FORM{'display'} = "Queue";
}
}
***************
*** 58,63 ****
--- 68,78 ----
}
}
+
+ if (defined($rt::ui::web::FORM{'display'}) &&
+ $rt::ui::web::FORM{'display'} eq 'Queue') {
+ &save_queue_options;
+ }
***************
*** 70,77 ****
exit(0);
}
-
-
&rt::ui::web::header();
if (($frames) && (!$rt::ui::web::FORM{'display'})) {
--- 85,90 ----
***************
*** 143,148 ****
--- 156,164 ----
elsif ($rt::ui::web::FORM{'display'} eq 'SetMerge'){
&FormSetMerge();
}
+ elsif ($rt::ui::web::FORM{'display'} eq 'SetAssign'){
+ &FormSetAssign();
+ }
elsif ($rt::ui::web::FORM{'display'} eq 'SetGive'){
&FormSetGive();
}
***************
*** 266,271 ****
--- 282,293 ----
}
if ($rt::ui::web::FORM{'do_req_status'}){
+ if ($rt::ui::web::FORM{'do_req_status'} eq 'accept') {
+ ($trans, $StatusMsg)=&rt::change_status ($serial_num, $current_user, 'accepted');
+ }
+ if ($rt::ui::web::FORM{'do_req_status'} eq 'assign') {
+ ($trans, $StatusMsg)=&rt::change_status ($serial_num, $current_user, 'assigned');
+ }
if ($rt::ui::web::FORM{'do_req_status'} eq 'stall') {
($trans, $StatusMsg)=&rt::stall ($serial_num, $current_user);
}
***************
*** 281,286 ****
--- 303,316 ----
}
+ if ($rt::ui::web::FORM{'do_req_accept'}){
+ ($trans, $StatusMsg)=&rt::change_status ($serial_num, $current_user, 'accepted');
+ }
+
+ if ($rt::ui::web::FORM{'do_req_assign'}){
+ ($trans, $StatusMsg)=&rt::change_status ($serial_num, $current_user, 'assigned');
+ }
+
if ($rt::ui::web::FORM{'do_req_stall'}){
($trans, $StatusMsg)=&rt::stall ($serial_num, $current_user);
***************
*** 310,316 ****
}
if ($rt::ui::web::FORM{'do_req_give'}){
! ($trans, $StatusMsg)=&rt::give($serial_num, $rt::ui::web::FORM{'do_req_give_to'}, $current_user);
if (($trans == 0 ) and
($rt::ui::web::FORM{'do_req_give_to'} eq $current_user) and
--- 340,348 ----
}
if ($rt::ui::web::FORM{'do_req_give'}){
! # Note West: we want everybody to take/give requests to everybody
! # directly. So use give_with_steal() instead of give().
! ($trans, $StatusMsg)=&rt::give_with_steal($serial_num, $rt::ui::web::FORM{'do_req_give_to'}, $current_user);
if (($trans == 0 ) and
($rt::ui::web::FORM{'do_req_give_to'} eq $current_user) and
***************
*** 361,366 ****
--- 393,460 ----
}
}
+ # Save the query options for displaying the queue to a cookie.
+ # Writes out the cookie header, so it must be called before
+ # the HTTP header is ended.
+ # It will only write the cookie if this was a request to
+ # display the queue, and query options were set.
+ sub save_queue_options {
+ my($queue_params, $set_query);
+ if ($rt::ui::web::FORM{'display'} eq 'Queue') {
+ $queue_params = '&' . $ENV{'QUERY_STRING'} . '&';
+ $queue_params =~ s/q_sort=(.*?)\&//;
+ $queue_params =~ s/q_reverse=(.*?)\&//;
+ $queue_params =~ s/display=(.*?)\&//;
+ $queue_params =~ s/\&\&/\&/g;
+ $queue_params =~ s/\&\&/\&/g; # Maybe there are trippled &.
+ $queue_params =~ s/^\&//g;
+ $queue_params =~ s/\&$//g;
+ if ($queue_params eq '') {
+ return;
+ }
+ use CGI::Cookie;
+ $set_query = new CGI::Cookie(-name => 'RT_QUERY',
+ -value => "$queue_params",
+ -expires => '+6M');
+ if (($rt::web_auth_cookies_allow_no_path =~ /yes/i) and
+ ($rt::ui::web::FORM{'insecure_path'})) {
+ $set_query->path('');
+ }
+ print "Set-Cookie: $set_query\n";
+ }
+ }
+
+ # Restore query options for displaying the queue from a cookie.
+ # Will not overwrite options that were set via the query form.
+ #
+ # Note: It should be possible to always call this method, even if
+ # you're not ging to display the queue. The q_* form variables
+ # should not be used in other forms. This can be used to change
+ # the way forms are displayed, based on the last query.
+ #
+ # Return: 0 if no cookie available or value in cookie is empty,
+ # 1 if parameters extracted from cookie.
+ sub restore_queue_options {
+ my($queue_cgi);
+ my(%queue_vars);
+ my($key);
+
+ if (!($rt::ui::web::cookies{'RT_QUERY'}) ||
+ !($rt::ui::web::cookies{'RT_QUERY'}->value)) {
+ return 0;
+ }
+ use CGI qw/:cgi-lib/;
+ $queue_cgi = new CGI($rt::ui::web::cookies{'RT_QUERY'}->value);
+ %queue_vars = $queue_cgi->Vars;
+ foreach $key (keys %queue_vars) {
+ if (!($key =~ /^q_/)) { next; }
+ if (!exists($rt::ui::web::FORM{$key})) {
+ $rt::ui::web::FORM{$key} = $queue_vars{$key};
+ }
+ }
+ return 1;
+ }
+
sub display_queue {
my ($owner_ops, $subject_ops, $queue_ops, $status_ops, $prio_ops, $user_ops, $order_ops, $reverse, $query_string);
local($^W) = 0; # Lots of form fields that may or may not exist give bogus errors
***************
*** 588,594 ****
print &queue_header('status',"Status");
print &queue_header('timestamp',"Told");
print &queue_header('area',"Area");
! print &queue_header('age',"Age");
print &queue_header('last',"Last");
print &queue_header('date_due',"Due");
print &queue_header('user',"Requestor");
--- 682,693 ----
print &queue_header('status',"Status");
print &queue_header('timestamp',"Told");
print &queue_header('area',"Area");
! if (defined($rt::ui::web::FORM{'q_showage'}) &&
! ($rt::ui::web::FORM{'q_showage'} eq 'age')) {
! print &queue_header('age',"Age");
! } else {
! print &queue_header('age',"Created");
! }
print &queue_header('last',"Last");
print &queue_header('date_due',"Due");
print &queue_header('user',"Requestor");
***************
*** 598,603 ****
--- 697,725 ----
for ($temp=0;$temp<$count;$temp++){
+ ($wday, $mon, $mday, $hour, $min, $sec, $TZ, $year)=&rt::parse_time($rt::req[$temp]{'date_created'});
+ my($date_created)=sprintf ("%s %s %4d %02d:%02d", $mday, $mon, $year, $hour, $min);
+ ($wday, $mon, $mday, $hour, $min, $sec, $TZ, $year)=&rt::parse_time($rt::req[$temp]{'date_told'});
+ my($date_told)=sprintf ("%s %s %4d %02d:%02d", $mday, $mon, $year, $hour, $min);
+ $date_told = 'never' if ($rt::req[$temp]{'date_told'} <= 0);
+ ($wday, $mon, $mday, $hour, $min, $sec, $TZ, $year)=&rt::parse_time($rt::req[$temp]{'date_acted'});
+ my($date_acted)=sprintf ("%s %s %4d %02d:%02d", $mday, $mon, $year, $hour, $min);
+ $date_acted = '' if ($rt::req[$temp]{'date_acted'} <= 0);
+
+ if (defined($rt::ui::web::FORM{'q_showage'})) {
+ if ($rt::ui::web::FORM{'q_showage'} eq 'age') {
+ $date_created = $rt::req[$temp]{'age'};
+ $date_told = $rt::req[$temp]{'since_told'};
+ $date_acted = $rt::req[$temp]{'since_acted'};
+ } elsif ($rt::ui::web::FORM{'q_showage'} eq 'both') {
+ $date_created .= " (" . $rt::req[$temp]{'age'} . ")";
+ if ($date_told ne 'never') {
+ $date_told .= " (" . $rt::req[$temp]{'since_told'} . ")";
+ }
+ $date_acted .= " (" . $rt::req[$temp]{'since_acted'} . ")";
+ }
+ }
+
my $wrapped_requestors = $rt::req[$temp]{'requestors'};
$wrapped_requestors =~ s/,/, /g;
if ($temp % 2) {
***************
*** 639,645 ****
</TD>
<TD NOWRAP>
! <font size=-1>$rt::req[$temp]{'since_told'}</font>
</TD>
<TD NOWRAP>
--- 761,767 ----
</TD>
<TD NOWRAP>
! <font size=-1>$date_told</font>
</TD>
<TD NOWRAP>
***************
*** 647,657 ****
</TD>
<TD NOWRAP>
! <font size=-1>$rt::req[$temp]{'age'}</font>
</TD>
<TD NOWRAP>
! <font size=-1>$rt::req[$temp]{'since_acted'}</font>
</TD>
<TD NOWRAP>";
--- 769,779 ----
</TD>
<TD NOWRAP>
! <font size=-1>$date_created</font>
</TD>
<TD NOWRAP>
! <font size=-1>$date_acted</font>
</TD>
<TD NOWRAP>";
***************
*** 703,708 ****
--- 825,831 ----
for ($temp=0; $temp < $total_transactions; $temp++){
+
($wday, $mon, $mday, $hour, $min, $sec, $TZ, $year)=&rt::parse_time($rt::req[$serial_num]{'trans'}[$temp]{'time'});
$date=sprintf ("%s, %s %s %4d", $wday, $mon, $mday, $year);
$time=sprintf ("%.2d:%.2d:%.2d", $hour,$min,$sec);
***************
*** 794,800 ****
my $temp;
print "
! <DIV ALIGN=\"CENTER\"> ".
&fdro_murl("display=SetComment","history","Comment",0). " | " .
&fdro_murl("display=SetReply","history","Reply",0);
--- 917,923 ----
my $temp;
print "
! <DIV ALIGN=\"CENTER\"> " .
&fdro_murl("display=SetComment","history","Comment",0). " | " .
&fdro_murl("display=SetReply","history","Reply",0);
***************
*** 803,814 ****
print " | ".
&fdro_murl("do_req_give=true&do_req_give_to=$current_user","summary","Take",0) ;
}
if ($rt::req[$serial_num]{'status'} ne 'resolved') {
print " | ".
&fdro_murl("do_req_resolve=true","summary","Resolve",0);
}
if ($rt::req[$serial_num]{'status'} ne 'open') {
print " | " .
&fdro_murl("do_req_open=true","summary","Open",0);
--- 926,947 ----
print " | ".
&fdro_murl("do_req_give=true&do_req_give_to=$current_user","summary","Take",0) ;
}
+
+ if ($rt::req[$serial_num]{'status'} ne 'accepted') {
+ print " | ".
+ &fdro_murl("do_req_accept=true","summary","Accept",0);
+ }
+
+ if ($rt::req[$serial_num]{'status'} ne 'assign') {
+ print " | ".
+ &fdro_murl("display=SetAssign","summary","Assign...",0);
+ }
if ($rt::req[$serial_num]{'status'} ne 'resolved') {
print " | ".
&fdro_murl("do_req_resolve=true","summary","Resolve",0);
}
if ($rt::req[$serial_num]{'status'} ne 'open') {
print " | " .
&fdro_murl("do_req_open=true","summary","Open",0);
Index: rt/lib/rt/ui/web/support.pm
diff -c rt/lib/rt/ui/web/support.pm:1.1.1.1 rt/lib/rt/ui/web/support.pm:1.2
*** rt/lib/rt/ui/web/support.pm:1.1.1.1 Wed Feb 9 12:19:57 2000
--- rt/lib/rt/ui/web/support.pm Tue Feb 15 17:12:01 2000
***************
*** 214,225 ****
sub header {
if ($header_printed) {
return();
}
print "Content-type: text/html\n\n";
print '<HTML>
! <head><title>WebRT</title>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</head>
<BODY bgcolor="#ffffff">
--- 214,232 ----
sub header {
+ my($title) = "WebRT";
if ($header_printed) {
return();
}
+ if (defined($rt::ui::web::FORM{'display'})) {
+ $title .= " " . $rt::ui::web::FORM{'display'};
+ }
+ if (defined($rt::ui::web::effective_sn)) {
+ $title .= " for request " . $rt::ui::web::effective_sn;
+ }
print "Content-type: text/html\n\n";
print '<HTML>
! <head><title>' . $title . '</title>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</head>
<BODY bgcolor="#ffffff">
More information about the Rt-devel
mailing list