diff options
Diffstat (limited to 'rt/webrt/SelfService')
-rw-r--r-- | rt/webrt/SelfService/Attachment/dhandler | 27 | ||||
-rw-r--r-- | rt/webrt/SelfService/Closed.html | 4 | ||||
-rwxr-xr-x | rt/webrt/SelfService/Create.html | 63 | ||||
-rwxr-xr-x | rt/webrt/SelfService/Display.html | 190 | ||||
-rwxr-xr-x | rt/webrt/SelfService/Elements/GotoTicket | 1 | ||||
-rwxr-xr-x | rt/webrt/SelfService/Elements/Header | 55 | ||||
-rw-r--r-- | rt/webrt/SelfService/Elements/MyRequests | 41 | ||||
-rw-r--r-- | rt/webrt/SelfService/Elements/Tabs | 49 | ||||
-rwxr-xr-x | rt/webrt/SelfService/Error.html | 22 | ||||
-rwxr-xr-x | rt/webrt/SelfService/Prefs.html | 51 | ||||
-rwxr-xr-x | rt/webrt/SelfService/Update.html | 40 | ||||
-rw-r--r-- | rt/webrt/SelfService/index.html | 3 |
12 files changed, 546 insertions, 0 deletions
diff --git a/rt/webrt/SelfService/Attachment/dhandler b/rt/webrt/SelfService/Attachment/dhandler new file mode 100644 index 000000000..0d646cc0b --- /dev/null +++ b/rt/webrt/SelfService/Attachment/dhandler @@ -0,0 +1,27 @@ +<%perl> + my ($ticket, $trans,$attach, $filename); + my $arg = $m->dhandler_arg; # get rest of path + if ($arg =~ '^(\d+)/(\d+)') { + $trans = $1; + $attach = $2; + } + else { + Abort("Corrupted attachment URL."); + } + my $AttachmentObj = new RT::Attachment($session{'CurrentUser'}); + $AttachmentObj->Load($attach) || Abort("Attachment '$attach' could not be loaded"); + + + unless ($AttachmentObj->id) { + Abort("Bad attachment id. Couldn't find attachment '$attach'\n"); + } + unless ($AttachmentObj->TransactionId() == $trans ) { + Abort("Bad transaction number for attachment. $trans should be".$AttachmentObj->TransactionId() ."\n"); + + } + my $content_type = $AttachmentObj->ContentType || 'text/plain'; + SetContentType($content_type); + $m->out($AttachmentObj->Content); + $m->abort; +</%perl> + diff --git a/rt/webrt/SelfService/Closed.html b/rt/webrt/SelfService/Closed.html new file mode 100644 index 000000000..a35936092 --- /dev/null +++ b/rt/webrt/SelfService/Closed.html @@ -0,0 +1,4 @@ +<& /SelfService/Elements/Header, title => 'RT Self Service / Closed Tickets' &> + +<& /SelfService/Elements/MyRequests, status => ['resolved'], friendly_status => +'closed' &> diff --git a/rt/webrt/SelfService/Create.html b/rt/webrt/SelfService/Create.html new file mode 100755 index 000000000..60110cb5a --- /dev/null +++ b/rt/webrt/SelfService/Create.html @@ -0,0 +1,63 @@ +%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/SelfService/Attic/Create.html,v 1.1 2002-08-12 06:17:09 ivan Exp $ +%# Copyright 1996-2001 Jesse Vincent <jesse@fsck.com> + +<& Elements/Header, Title => "Create a request" &> + + +<FORM ACTION="Display.html" METHOD="POST" ENCTYPE="multipart/form-data"> +<INPUT TYPE=HIDDEN Name="id" VALUE="new"> +<& /Elements/TitleBoxStart, contentbg => "#cccccc", title => "Create a new ticket" &> + +<TABLE> +<TR> +<TD> +Queue: +</TD> +<TD> +<& /Elements/SelectNewTicketQueue, Verbose => 'True' &> +</TD> +</TR> +<TR> +<TD> +Requestors: +</TD> +<TD> +<INPUT Name="Requestors" Value="<%$session{CurrentUser}->EmailAddress%>" SIZE=20> +</TD> +</TR> +<TR> +<TD> +Cc: +</TD> +<TD> + <INPUT NAME="Cc" SIZE=20> +</TD> +</TR> +<TR> +<TD> +Subject: +</TD> +<TD> +<INPUT Name="Subject" SIZE=60 MAXSIZE=100 value=""> +</TD> +</TR> +<TR> +<TD> +Attach file: +</TD> +<TD> +<INPUT Name="Attach" type=file> +</TD> +</TR> +<TR> +<TD COLSPAN=2> +Describe the issue below:<br> +<& /Elements/MessageBox &> +</TD> +</TR> +</TABLE> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, Label => "Create ticket"&> + + +</FORM> diff --git a/rt/webrt/SelfService/Display.html b/rt/webrt/SelfService/Display.html new file mode 100755 index 000000000..2d44f148e --- /dev/null +++ b/rt/webrt/SelfService/Display.html @@ -0,0 +1,190 @@ +%# $Header: /home/cvs/cvsroot/freeside/rt/webrt/SelfService/Attic/Display.html,v 1.1 2002-08-12 06:17:09 ivan Exp $ +%# Copyright 1996-2001 Jesse Vincent <jesse@fsck.com> + +<& /SelfService/Elements/Header, Title => 'Display ticket #'.$Ticket->id &> + + +<& /Elements/ListActions, actions => \@results &> + +<TABLE> + <TR> + <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT> + Ticket Id + </TD> + <TD> + <%$Ticket->Id%> + </TD> + </TR> + <TR> + <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT> + Requestors + </TD> + <TD> + <%$Ticket->RequestorsAsString%> + </TD> + </TR> + <TR> + <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT> + Cc + </TD> + <TD> + <%$Ticket->CcAsString%> + </TD> + </TR> + + <TR> + <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT> + Status + </TD> + <TD> + <%$Ticket->Status%> + </TD> + </TR> + + <TR> + <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT> + Queue + </TD> + <TD> + <%$Ticket->QueueObj->Name%> (<%$Ticket->QueueObj->Description%>) + </TD> + </TR> + <TR> + <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT> + Priority + </TD> + <TD> + <%$Ticket->Priority %> + </TD> + </TR> + +% if ($Ticket->TimeWorked) { + <TR> + <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT> + Worked + </TD> + <TD> + <%$Ticket->TimeWorked %> minutes + </TD> + </TR> +% } + +% my $selects = $Ticket->QueueObj->KeywordSelects; +% while (my $select = $selects->Next) { + <TR> + <TD VALIGN=TOP WIDTH="20%" ALIGN=RIGHT> + <%$select->Name%> + </TD> + <TD> +% my $object_keywords = $Ticket->KeywordsObj($select->id); +% while (my $keyword = $object_keywords->Next) { + <%$keyword->KeywordObj->RelativePath($select->KeywordObj)%> +% } +%} + </TD> + </TR> + + + + + </TABLE> +<TABLE BORDER=0 CELLSPACING=0> +% my ($i); +%while (my $Transaction = $Transactions->Next) { +% $i++; +% if ($Transactions->IsLast) { + <a name="lasttrans"></a> +% } + <& /Ticket/Elements/ShowTransaction, Transaction => $Transaction, + RowNum => $i, + Ticket => $Ticket &> + +%} +</TABLE> + + +<%INIT> + +my ($field, @results); + +# {{{ Load the ticket +#If we get handed two ids, mason will make them an array. bleck. +# We want teh first one. Just because there's no other sensible way +# to deal +my @id = (ref $id eq 'ARRAY') ? @{$id} : ($id); + + +my $Ticket = new RT::Ticket($session{'CurrentUser'}); +if ($id[0] eq 'new') { + # {{{ Create a new ticket + + my $Queue = new RT::Queue($session{'CurrentUser'}); + unless ($Queue->Load($ARGS{'Queue'})) { + $m->comp('Error.html', Why => 'Queue not found'); + $m->abort; + } + + unless ($Queue->CurrentUserHasRight('CreateTicket')) { + $m->comp('Error.html', Why => 'You have no permission to create tickets in that queue.'); + $m->abort; + } + + my @Requestors = split(/,/,$ARGS{'Requestors'}); + my @Cc = split(/,/,$ARGS{'Cc'}); + + + my $MIMEObj = MakeMIMEEntity ( Subject => $ARGS{'Subject'}, + From => $ARGS{'From'}, + Cc => $ARGS{'Cc'}, + Body => $ARGS{'Content'}, + AttachmentFieldName => 'Attach'); + + #TODO in Create_Details.html: priorities and due-date + my ($id, $Trans, $ErrMsg)= $Ticket->Create(Queue=>$ARGS{Queue}, + Requestor=> \@Requestors, + Cc => \@Cc, + Subject=>$ARGS{Subject}, + MIMEObj => $MIMEObj + ); + unless ($id && $Trans) { + $m->comp('Error.html', Why => $ErrMsg); + $m->abort(); + } + + push(@results, $ErrMsg); + + # }}} +} +else { + unless ($Ticket->Load($id[0])) { + $m->comp('Error.html', Why =>"Couldn't load ticket '$id'"); + $m->abort(); + } +} +# }}} + +unless ($session{'CurrentUser'}->HasQueueRight ( TicketObj => $Ticket, + Right => 'ShowTicket')) { + $m->comp('Error.html', Why => "No permission to display that ticket"); + $m->abort(); +} + +my ($code, $msg); + +#Update the status +if ((defined $ARGS{'Status'}) and + ($ARGS{'Status'} ne $Ticket->Status)) { + ($code, $msg) = $Ticket->SetStatus($ARGS{'Status'}); + push @results, "$msg"; +} + +ProcessUpdateMessage(ARGSRef=>\%ARGS, Actions=>\@results, TicketObj=>$Ticket); + +my $Transactions = $Ticket->Transactions; + +</%INIT> + + +<%ARGS> +$id => undef +</%ARGS> diff --git a/rt/webrt/SelfService/Elements/GotoTicket b/rt/webrt/SelfService/Elements/GotoTicket new file mode 100755 index 000000000..0c0c8b67a --- /dev/null +++ b/rt/webrt/SelfService/Elements/GotoTicket @@ -0,0 +1 @@ +<FORM ACTION="<%$RT::WebPath%>/SelfService/Display.html"><input type=submit value="Goto ticket"> <input size=4 name=id></FORM> diff --git a/rt/webrt/SelfService/Elements/Header b/rt/webrt/SelfService/Elements/Header new file mode 100755 index 000000000..ecf58f461 --- /dev/null +++ b/rt/webrt/SelfService/Elements/Header @@ -0,0 +1,55 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" + "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> +<TITLE><%$Title%></TITLE> +% if ($Code) { +<META NAME="HTTP-EQUIV" VALUE="<%$Code%> <%$Why%>"> +% } + +<link rel="stylesheet" href="<%$RT::WebPath%>/NoAuth/webrt.css" type="text/css"> +</HEAD> +<BODY BGCOLOR="<%$BgColor%>"> +<TABLE BORDER=0 WIDTH=100% CELLSPACING=0 BGCOLOR="#993333"> +<TR VALIGN=TOP> +<TD WIDTH=32> + <IMG SRC="<%$RT::LogoURL%>" alt="RT"> +</TD> +<TD VALIGN=CENTER ALIGN=LEFT> +<font size=+2 color=#ffffff> +<B> +<%$Title%> +</B> +</font> +</TD> +<TD ALIGN=RIGHT> +<font color="#ffffff"> +% if ($session{'CurrentUser'} ) { +Signed in as <b><%$session{'CurrentUser'}->Name%></b>.<BR> +% if ($session{'CurrentUser'}->HasSystemRight('ModifySelf')) { +[<A class='inverse' HREF="<%$RT::WebPath%>/SelfService/Prefs.html" >Preferences</A>] +% } +% unless ($RT::WebExternalAuth) { + [<A class='inverse' HREF="<%$RT::WebPath%>/NoAuth/Logout.html">Logout</a>] +% } +% } else { +Not logged in. +% } +</font> +</TD> +</TR> +</TABLE> + +<BR> +<& /SelfService/Elements/Tabs &> + +<%ARGS> +$Title => '' +$Code => undef +$Why => undef +$BgColor => '#ffffff' +</%ARGS> +<%INIT> +$Title = "RT/$RT::rtname: ".$Title; +</%INIT> + diff --git a/rt/webrt/SelfService/Elements/MyRequests b/rt/webrt/SelfService/Elements/MyRequests new file mode 100644 index 000000000..ce268d58d --- /dev/null +++ b/rt/webrt/SelfService/Elements/MyRequests @@ -0,0 +1,41 @@ +<& /Elements/TitleBoxStart, title => "Your $friendly_status requests" &> +<TABLE BORDER=0 cellspacing=1 cellpadding=1 BGCOLOR="#eeeeee" WIDTH=100%> +<TR> +<TH>Subject</TH> +<TH>Status</TH> +<TH>Owner</TH> +<TH> </TH> +</TR> +<TR> +% while (my $Ticket = $MyTickets->Next) { +<TR> +<TD> +<%$Ticket->Id%>: <%$Ticket->Subject%> +</TD> +<TD> +<%$Ticket->Status%> +</TD><TD> +<%$Ticket->OwnerObj->Name%> +</TD><TD ALIGN=RIGHT> +[<A HREF="<% $RT::WebPath %>/SelfService/Display.html?id=<%$Ticket->Id%>">Details</A>] +</TD> +</TR> +% } +</TABLE> +<& /Elements/TitleBoxEnd &> + + +<%INIT> +my $MyTickets; +$MyTickets = new RT::Tickets ($session{'CurrentUser'}); +$MyTickets->LimitRequestor(VALUE => $session{'CurrentUser'}->EmailAddress); + +foreach my $status (@status) { + + $MyTickets->LimitStatus(VALUE => $status); +} +</%INIT> +<%ARGS> +$friendly_status => 'open' +@status => ('open', 'new', 'stalled') +</%ARGS> diff --git a/rt/webrt/SelfService/Elements/Tabs b/rt/webrt/SelfService/Elements/Tabs new file mode 100644 index 000000000..d689d8a72 --- /dev/null +++ b/rt/webrt/SelfService/Elements/Tabs @@ -0,0 +1,49 @@ +<TABLE WIDTH=100%> +<TR> +% foreach $tab (sort keys %{$tabs}) { +<TD ALIGN=CENTER> +[<A HREF="<%$RT::WebPath%>/<% $tabs->{"$tab"}->{'path'}%>"><% $tabs->{"$tab"}->{'title'}%></A>] +</TD> +%} + +% if ($actions) { + +<TD ALIGN=RIGHT> +<TABLE><TR> +% foreach my $action (sort keys %{$actions}) { +<TD> +<FONT SIZE=-1> +% if ($actions->{"$action"}->{'html'}) { +<%$actions->{"$action"}->{'html'} |n%> +% } else { +<A HREF="<%$RT::WebPath%>/<% $actions->{$action}->{'path'}%>"><% $actions->{$action}->{'title'}%></A> +% } +</FONT> +</TD> +% } +</TR> +</TABLE> +</TD> +%} +</TR> +</TABLE> +<hr> +<%INIT> +my ($tab); +my $tabs = { A => { title => 'Open requests', + path => 'SelfService/', + }, + B => { title => 'Closed requests', + path => 'SelfService/Closed.html', + }, + C => { title => 'New request', + path => 'SelfService/Create.html' + } + }; +my $actions = { + B => { html => $m->scomp('GotoTicket') + } + }; +</%INIT> + + diff --git a/rt/webrt/SelfService/Error.html b/rt/webrt/SelfService/Error.html new file mode 100755 index 000000000..19b79e68b --- /dev/null +++ b/rt/webrt/SelfService/Error.html @@ -0,0 +1,22 @@ +<& /SelfService/Elements/Header, Title => 'Error' &> +<& /Elements/TitleBoxStart, title => $Title &> +<%$Why%> +<br> +<font size=-1> +<%$Details%> +</font> +<& /Elements/TitleBoxEnd &> +</body> +</HTML> + + +<%args> +$Code => undef +$Details => undef +$Title => "RT Error" +$Why => "the calling component did not specify why" +</%args> + +<%INIT> +$RT::Logger->error("WebRT: $Why ($Details)"); +</%INIT> diff --git a/rt/webrt/SelfService/Prefs.html b/rt/webrt/SelfService/Prefs.html new file mode 100755 index 000000000..9c614e9fd --- /dev/null +++ b/rt/webrt/SelfService/Prefs.html @@ -0,0 +1,51 @@ +<& /SelfService/Elements/Header, title => 'Preferences' &> + +<& /Elements/ListActions, actions => \@results &> +<form method=post> + +% unless ($RT::WebExternalAuth) { +<& /Elements/TitleBoxStart, title => 'Change password' &> +New password: <input type=password name="NewPass1" size=16> +Confirm: <input type=password name="NewPass2" size=16> +<& /Elements/TitleBoxEnd &> +<BR> +% } +<& /Elements/TitleBoxStart, title => 'Signature' &> + +<TEXTAREA COLS=72 ROWS=4 WRAP=HARD NAME="Signature"><% $session{'CurrentUser'}->UserObj->Signature %></TEXTAREA> +<br> +<BR> +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit &> + </form> + + +<%INIT> +my @results; + +if ($NewPass1) { + if ($NewPass1 ne $NewPass2) { + push (@results, "Passwords did not match."); + } + else { + my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetPassword($NewPass1); + push (@results, "Password: ".$msg); + } +} +if ($Signature) { + $Signature =~ s/(\r\n|\r)/\n/g; + if ($Signature ne $session{'CurrentUser'}->UserObj->Signature) { + my ($val, $msg)=$session{'CurrentUser'}->UserObj->SetSignature($Signature); + push (@results, "Signature: ".$msg); + } +} +#A hack to make sure that session gets rewritten. + +$session{'i'}++; +</%INIT> + +<%ARGS> +$Signature => undef +$NewPass1 => undef +$NewPass2 => undef +</%ARGS> diff --git a/rt/webrt/SelfService/Update.html b/rt/webrt/SelfService/Update.html new file mode 100755 index 000000000..17f1618a3 --- /dev/null +++ b/rt/webrt/SelfService/Update.html @@ -0,0 +1,40 @@ +<& /SelfService/Elements/Header, Title => 'Update ticket #'.$Ticket->id &> + + +<FORM ACTION="Display.html" METHOD=POST ENCTYPE="multipart/form-data"> + +Status: +<& /Elements/SelectStatus, Name=>"Status", Default => $DefaultStatus &> +<input type=hidden name="UpdateType" value="response"> + +Subject: <input name="UpdateSubject" size=60 value="Re: <% $Ticket->Subject %>"> <br> +Attach: <input name="UpdateAttachment" type=file><br> +<& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &> + <INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>"><br> + + +<& /Elements/Submit &> + </FORM> + + + +<%INIT> + +my $Ticket = LoadTicket($id); + +my $title = "Update ticket #" . $Ticket->id; + +$DefaultStatus = $Ticket->Status() unless ($DefaultStatus); + + +Abort("No permission to view update ticket") + unless ( $Ticket->CurrentUserHasRight('ReplyToTicket') or + $Ticket->CurrentUserHasRight('ModifyTicket') ); + +</%INIT> + +<%ARGS> +$id => undef +$Action => undef +$DefaultStatus => undef +</%ARGS> diff --git a/rt/webrt/SelfService/index.html b/rt/webrt/SelfService/index.html new file mode 100644 index 000000000..a377d8cff --- /dev/null +++ b/rt/webrt/SelfService/index.html @@ -0,0 +1,3 @@ +<& /SelfService/Elements/Header, title => 'Self Service' &> + +<& /SelfService/Elements/MyRequests &> |