[Bps-public-commit] rt-extension-mobileui branch, master, updated. 4a07d2e979bb53976c036e4c1f10ed8e443a34d2
Jesse Vincent
jesse at bestpractical.com
Tue Jul 27 17:12:31 EDT 2010
The branch, master has been updated
via 4a07d2e979bb53976c036e4c1f10ed8e443a34d2 (commit)
from fdd9d812ece3bd4908ff65329e9711cba2804833 (commit)
Summary of changes:
html/m/_elements/raw_style | 29 +++++++
html/m/_elements/ticket_menu | 5 +-
html/m/ticket/history | 2 +
html/m/ticket/reply | 170 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 202 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 4a07d2e979bb53976c036e4c1f10ed8e443a34d2
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Tue Jul 27 14:14:22 2010 -0700
all the basic functionality we need for 0.1
diff --git a/html/m/_elements/raw_style b/html/m/_elements/raw_style
index faa5cfa..6fcc058 100644
--- a/html/m/_elements/raw_style
+++ b/html/m/_elements/raw_style
@@ -274,3 +274,32 @@ form {
font-size: 1.2em;
color: #000;
}
+
+div.txn-content {
+
+ font-size:0.8em;
+ padding-left:1em;
+ padding-top:0.5em;
+ padding-bottom: 0.5em;
+ border-left: 5px solid #00c;
+
+}
+
+form span.label {
+ text-align: left;
+ font-size: 0.8em;
+}
+
+div.entry {
+ margin-bottom: 1em;
+ padding-bottom: 1em;
+ border-bottom: 1px solid black;
+}
+
+div.entry input[type=text] {
+ width: 100%;
+}
+
+div.entry textarea {
+ width: 100%;
+}
diff --git a/html/m/_elements/ticket_menu b/html/m/_elements/ticket_menu
index 48fd46e..6c6d4ba 100644
--- a/html/m/_elements/ticket_menu
+++ b/html/m/_elements/ticket_menu
@@ -19,10 +19,7 @@ my @menu = (
label => loc("History"),
url => '/m/ticket/history?id='.$ticket->id
},
- {
- label => loc("Modify"),
- url => '/m/ticket/modify?id='.$ticket->id
- },
+ #{ label => loc("Modify"), url => '/m/ticket/modify?id='.$ticket->id },
{
label => loc("Reply"),
url => '/m/ticket/reply?id='.$ticket->id
diff --git a/html/m/ticket/history b/html/m/ticket/history
index 61806d5..c7463c6 100644
--- a/html/m/ticket/history
+++ b/html/m/ticket/history
@@ -17,9 +17,11 @@ my $history = $t->Transactions()->ItemsArrayRef;
<& /Elements/ShowUser, User => $entry->CreatorObj &> -
<%$entry->BriefDescription%>
% if ($entry->Type !~ /EmailRecord/) {
+% if ($entry->ContentObj) {
<div class="txn-content">
<%$entry->Content%>
</div>
+%}
% }
</li>
% }
diff --git a/html/m/ticket/reply b/html/m/ticket/reply
index e69de29..c0a7ff8 100644
--- a/html/m/ticket/reply
+++ b/html/m/ticket/reply
@@ -0,0 +1,170 @@
+<&|/m/_elements/wrapper &>
+<& /m/_elements/ticket_menu, ticket => $t &>
+<& /Elements/ListActions, actions => \@results &>
+
+<&|/Widgets/TitleBox, title => loc('Update ticket')&>
+<form action="reply" id="update"
+ method="post" enctype="multipart/form-data">
+<input type="hidden" class="hidden" name="DefaultStatus" value="<% $DefaultStatus ||''%>" />
+<input type="hidden" class="hidden" name="Action" value="<% $ARGS{Action}||'' %>" />
+
+<div class="entry"><span class="label"><&|/l&>Status</&>:</span>
+<div class="value">
+<& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)", loc($t->Status)), Default => $ARGS{'Status'} || ($t->Status eq $DefaultStatus ? undef : $DefaultStatus)&>
+</div></div>
+
+<div class="entry"><span class="label"><&|/l&>Owner</&>:</span>
+<div class="value">
+<& /Elements/SelectOwner,
+ Name => "Owner",
+ TicketObj => $t,
+ QueueObj => $t->QueueObj,
+ DefaultLabel => loc("[_1] (Unchanged)", $t->OwnerObj->Name),
+ Default => $ARGS{'Owner'}
+&>
+</div></div>
+<div class="entry"><span class="label"><&|/l&>Worked</&>:</span><div class="value">
+<& /Elements/EditTimeValue,
+ Name => 'UpdateTimeWorked',
+ Default => $ARGS{UpdateTimeWorked}||'',
+ InUnits => $ARGS{'UpdateTimeWorked-TimeUnits'}||'minutes',
+&>
+</div></div>
+<input type="hidden" class="hidden" name="id" value="<%$t->Id%>" /><br />
+<div class="entry"><span class="label"><&|/l&>Update Type</&>:</span>
+<div class="value"><select name="UpdateType">
+% if ($CanComment) {
+<option value="private" <% ($ARGS{'UpdateType'} && $ARGS{'UpdateType'} eq "private") ? qq[ selected="selected"] : !$ARGS{'UpdateType'}&&$CommentDefault |n %>><&|/l&>Comments (Not sent to requestors)</&></option>
+% }
+% if ($CanRespond) {
+<option value="response" <% ($ARGS{'UpdateType'} && $ARGS{'UpdateType'} eq "response") ? qq[ selected="selected"] : !$ARGS{'UpdateType'}&&$ResponseDefault |n %>><&|/l&>Reply to requestors</&></option>
+% }
+</select>
+</div></div>
+<div class="entry"><span class="label"><&|/l&>Subject</&>:</span><div class="value"> <input name="UpdateSubject" size="60" value="<% $ARGS{UpdateSubject} || $t->Subject()%>" />
+% $m->callback( %ARGS, CallbackName => 'AfterSubject' );
+</div></div>
+
+<div class="entry"><span class="label"><&|/l&>One-time Cc</&>:</span><div><& /Elements/EmailInput, Name => 'UpdateCc', Size => '60', Default => $ARGS{UpdateCc} &></div></div>
+
+<div class="entry"><span class="label"><&|/l&>One-time Bcc</&>:</span><div><& /Elements/EmailInput, Name => 'UpdateBcc', Size => '60', Default => $ARGS{UpdateBcc} &></div></div>
+
+<div class="entry"><span class="label" ><&|/l&>Message</&>:</span><div class="value">
+% if (exists $ARGS{UpdateContent}) {
+% # preserve QuoteTransaction so we can use it to set up sane references/in/reply to
+% my $temp = $ARGS{'QuoteTransaction'};
+% delete $ARGS{'QuoteTransaction'};
+<& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&>
+% $ARGS{'QuoteTransaction'} = $temp;
+% } else {
+% my $IncludeSignature = 1;
+% $IncludeSignature = 0 if $Action ne 'Respond' && !RT->Config->Get('MessageBoxIncludeSignatureOnComment');
+<& /Elements/MessageBox, Name=>"UpdateContent", IncludeSignature => $IncludeSignature, %ARGS &>
+% }
+</div></div>
+<& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
+</form>
+</&>
+</&>
+<%INIT>
+my $CanRespond = 0;
+my $CanComment = 0;
+my $checks_failure = 0;
+my $title;
+
+my $t = LoadTicket($id);
+
+my @results;
+
+$m->callback( Ticket => $t, ARGSRef => \%ARGS, results => \@results, CallbackName => 'Initial' );
+
+unless($DefaultStatus){
+ $DefaultStatus=($ARGS{'Status'} ||$t->Status());
+}
+
+if ($DefaultStatus eq 'new'){
+ $DefaultStatus='open';
+}
+
+if ($DefaultStatus eq 'resolved') {
+ $title = loc("Resolve ticket #[_1] ([_2])", $t->id, $t->Subject);
+} else {
+ $title = loc("Update ticket #[_1] ([_2])", $t->id, $t->Subject);
+}
+
+# Things needed in the template - we'll do the processing here, just
+# for the convenience:
+
+my ($CommentDefault, $ResponseDefault);
+if ($Action ne 'Respond') {
+ $CommentDefault = qq[ selected="selected"];
+ $ResponseDefault = "";
+} else {
+ $CommentDefault = "";
+ $ResponseDefault = qq[ selected="selected"];
+}
+
+
+
+$CanRespond = 1 if ( $t->CurrentUserHasRight('ReplyToTicket') or
+ $t->CurrentUserHasRight('ModifyTicket') );
+
+$CanComment = 1 if ( $t->CurrentUserHasRight('CommentOnTicket') or
+ $t->CurrentUserHasRight('ModifyTicket') );
+
+
+# {{{ deal with deleting uploaded attachments
+foreach my $key (keys %ARGS) {
+ if ($key =~ m/^DeleteAttach-(.+)$/) {
+ delete $session{'Attachments'}{$1};
+ }
+ $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
+}
+# }}}
+
+# {{{ store the uploaded attachment in session
+if ($ARGS{'Attach'}) { # attachment?
+ my $attachment = MakeMIMEEntity(
+ AttachmentFieldName => 'Attach'
+ );
+
+ my $file_path = Encode::decode_utf8("$ARGS{'Attach'}");
+ $session{'Attachments'} = {
+ %{$session{'Attachments'} || {}},
+ $file_path => $attachment,
+ };
+}
+# }}}
+
+# delete temporary storage entry to make WebUI clean
+unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
+ delete $session{'Attachments'};
+}
+# }}}
+
+# check email addresses for RT's
+{
+ foreach my $field ( qw(UpdateCc UpdateBcc) ) {
+ my $value = $ARGS{ $field };
+ next unless defined $value && length $value;
+
+ my @emails = Email::Address->parse( $value );
+ foreach my $email ( grep RT::EmailParser->IsRTAddress($_->address), @emails ) {
+ push @results, loc("[_1] is an address RT receives mail at. Adding it as a '[_2]' would create a mail loop", $email->format, loc(substr($field, 6)) );
+ $checks_failure = 1;
+ $email = undef;
+ }
+ $ARGS{ $field } = join ', ', map $_->format, grep defined, @emails;
+ }
+}
+
+if ( !$checks_failure && exists $ARGS{SubmitTicket} ) {
+ return $m->comp('/m/ticket/show', TicketObj => $t, %ARGS);
+}
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Action => undef
+$DefaultStatus => undef
+</%ARGS>
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list