From 3ef62a0570055da710328937e7f65dbb2c027c62 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 12 Aug 2002 06:17:09 +0000 Subject: import rt 2.0.14 --- rt/webrt/SelfService/Attachment/dhandler | 27 +++++ rt/webrt/SelfService/Closed.html | 4 + rt/webrt/SelfService/Create.html | 63 ++++++++++ rt/webrt/SelfService/Display.html | 190 +++++++++++++++++++++++++++++++ rt/webrt/SelfService/Elements/GotoTicket | 1 + rt/webrt/SelfService/Elements/Header | 55 +++++++++ rt/webrt/SelfService/Elements/MyRequests | 41 +++++++ rt/webrt/SelfService/Elements/Tabs | 49 ++++++++ rt/webrt/SelfService/Error.html | 22 ++++ rt/webrt/SelfService/Prefs.html | 51 +++++++++ rt/webrt/SelfService/Update.html | 40 +++++++ rt/webrt/SelfService/index.html | 3 + 12 files changed, 546 insertions(+) create mode 100644 rt/webrt/SelfService/Attachment/dhandler create mode 100644 rt/webrt/SelfService/Closed.html create mode 100755 rt/webrt/SelfService/Create.html create mode 100755 rt/webrt/SelfService/Display.html create mode 100755 rt/webrt/SelfService/Elements/GotoTicket create mode 100755 rt/webrt/SelfService/Elements/Header create mode 100644 rt/webrt/SelfService/Elements/MyRequests create mode 100644 rt/webrt/SelfService/Elements/Tabs create mode 100755 rt/webrt/SelfService/Error.html create mode 100755 rt/webrt/SelfService/Prefs.html create mode 100755 rt/webrt/SelfService/Update.html create mode 100644 rt/webrt/SelfService/index.html (limited to 'rt/webrt/SelfService') 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; + + 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 + +<& Elements/Header, Title => "Create a request" &> + + +
+ +<& /Elements/TitleBoxStart, contentbg => "#cccccc", title => "Create a new ticket" &> + + + + + + + + + + + + + + + + + + + + + + + + + +
+Queue: + +<& /Elements/SelectNewTicketQueue, Verbose => 'True' &> +
+Requestors: + + +
+Cc: + + +
+Subject: + + +
+Attach file: + + +
+Describe the issue below:
+<& /Elements/MessageBox &> +
+<& /Elements/TitleBoxEnd &> +<& /Elements/Submit, Label => "Create ticket"&> + + +
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 + +<& /SelfService/Elements/Header, Title => 'Display ticket #'.$Ticket->id &> + + +<& /Elements/ListActions, actions => \@results &> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +% if ($Ticket->TimeWorked) { + + + + +% } + +% my $selects = $Ticket->QueueObj->KeywordSelects; +% while (my $select = $selects->Next) { + + + + + + + + +
+ Ticket Id + + <%$Ticket->Id%> +
+ Requestors + + <%$Ticket->RequestorsAsString%> +
+ Cc + + <%$Ticket->CcAsString%> +
+ Status + + <%$Ticket->Status%> +
+ Queue + + <%$Ticket->QueueObj->Name%> (<%$Ticket->QueueObj->Description%>) +
+ Priority + + <%$Ticket->Priority %> +
+ Worked + + <%$Ticket->TimeWorked %> minutes +
+ <%$select->Name%> + +% my $object_keywords = $Ticket->KeywordsObj($select->id); +% while (my $keyword = $object_keywords->Next) { + <%$keyword->KeywordObj->RelativePath($select->KeywordObj)%> +% } +%} +
+ +% my ($i); +%while (my $Transaction = $Transactions->Next) { +% $i++; +% if ($Transactions->IsLast) { + +% } + <& /Ticket/Elements/ShowTransaction, Transaction => $Transaction, + RowNum => $i, + Ticket => $Ticket &> + +%} +
+ + +<%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; + + + + +<%ARGS> +$id => undef + 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 @@ +
 
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 @@ + + + +<%$Title%> +% if ($Code) { + +% } + + + + + + + + + + +
+ RT + + + +<%$Title%> + + + + +% if ($session{'CurrentUser'} ) { +Signed in as <%$session{'CurrentUser'}->Name%>.
+% if ($session{'CurrentUser'}->HasSystemRight('ModifySelf')) { +[Preferences] +% } +% unless ($RT::WebExternalAuth) { + [Logout] +% } +% } else { +Not logged in. +% } +
+
+ +
+<& /SelfService/Elements/Tabs &> + +<%ARGS> +$Title => '' +$Code => undef +$Why => undef +$BgColor => '#ffffff' + +<%INIT> +$Title = "RT/$RT::rtname: ".$Title; + + 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" &> + + + + + + + + +% while (my $Ticket = $MyTickets->Next) { + + + + +% } +
SubjectStatusOwner 
+<%$Ticket->Id%>: <%$Ticket->Subject%> + +<%$Ticket->Status%> + +<%$Ticket->OwnerObj->Name%> + +[Details] +
+<& /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); +} + +<%ARGS> +$friendly_status => 'open' +@status => ('open', 'new', 'stalled') + 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 @@ + + +% foreach $tab (sort keys %{$tabs}) { + +%} + +% if ($actions) { + + +%} + +
+[{'path'}%>"><% $tabs->{"$tab"}->{'title'}%>] + + +% foreach my $action (sort keys %{$actions}) { + +% } + +
+ +% if ($actions->{"$action"}->{'html'}) { +<%$actions->{"$action"}->{'html'} |n%> +% } else { +<% $actions->{$action}->{'title'}%> +% } + +
+
+
+<%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') + } + }; + + + 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%> +
+ +<%$Details%> + +<& /Elements/TitleBoxEnd &> + + + + +<%args> +$Code => undef +$Details => undef +$Title => "RT Error" +$Why => "the calling component did not specify why" + + +<%INIT> +$RT::Logger->error("WebRT: $Why ($Details)"); + 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 &> +
+ +% unless ($RT::WebExternalAuth) { +<& /Elements/TitleBoxStart, title => 'Change password' &> +New password: +Confirm: +<& /Elements/TitleBoxEnd &> +
+% } +<& /Elements/TitleBoxStart, title => 'Signature' &> + + +
+
+<& /Elements/TitleBoxEnd &> +<& /Elements/Submit &> +
+ + +<%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'}++; + + +<%ARGS> +$Signature => undef +$NewPass1 => undef +$NewPass2 => undef + 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 &> + + +
+ +Status: +<& /Elements/SelectStatus, Name=>"Status", Default => $DefaultStatus &> + + +Subject:
+Attach:
+<& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &> +
+ + +<& /Elements/Submit &> +
+ + + +<%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') ); + + + +<%ARGS> +$id => undef +$Action => undef +$DefaultStatus => undef + 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 &> -- cgit v1.2.1