[Bps-public-commit] rt-extension-mobileui branch, master, updated. da29e20e746e0e9ef2c38ea6ccc676d3f65d3eff
Jesse Vincent
jesse at bestpractical.com
Mon Aug 2 14:45:32 EDT 2010
The branch, master has been updated
via da29e20e746e0e9ef2c38ea6ccc676d3f65d3eff (commit)
via 27150691ef9e744bb251ff7af51d70bfbdde115d (commit)
from 5ff438277f030b83a4d25cfdd795a80482422aec (commit)
Summary of changes:
.../RT-Extension-MobileUI/Elements/Login/Header | 11 +-
html/m/_elements/header | 6 +-
html/m/_elements/menu | 67 +++-
html/m/_elements/raw_style | 102 ++++--
html/m/_elements/ticket_menu | 8 +-
html/m/_elements/wrapper | 3 +-
html/m/login | 26 +-
html/m/ticket/create | 22 +-
html/m/ticket/history | 2 +-
html/m/ticket/reply | 2 +-
html/m/ticket/select_create_queue | 18 +
html/m/ticket/show | 364 +++++++++++++++++---
html/m/tickets/search | 18 +-
13 files changed, 515 insertions(+), 134 deletions(-)
create mode 100644 html/m/ticket/select_create_queue
- Log -----------------------------------------------------------------
commit 27150691ef9e744bb251ff7af51d70bfbdde115d
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Jul 30 12:01:27 2010 -0700
a bit more utility after testing a mobile ui
diff --git a/html/Callbacks/RT-Extension-MobileUI/Elements/Login/Header b/html/Callbacks/RT-Extension-MobileUI/Elements/Login/Header
index 43f0b23..f3ad8d6 100644
--- a/html/Callbacks/RT-Extension-MobileUI/Elements/Login/Header
+++ b/html/Callbacks/RT-Extension-MobileUI/Elements/Login/Header
@@ -1,5 +1,10 @@
<%init>
-return unless ($m->request_comp->path() =~ m{^/m(?:\/|$)});
-$m->comp('/m/login',%ARGS);
-$m->abort;
+if ((($ENV{'HTTP_USER_AGENT'} || '') =~ /(?:hiptop|Blazer|Novarra|Vagabond|SonyEricsson|Symbian|NetFront|UP.Browser|UP.Link|Windows CE|MIDP|J2ME|DoCoMo|J-PHONE|PalmOS|PalmSource|iPhone|iPod|AvantGo|Nokia|Android)/io && !$session{'NotMobile'}) || ($m->request_comp->path() =~ m{^/m(?:\/|$)})) {
+
+ $m->comp('/m/login',%ARGS);
+ $m->abort;
+} else {
+return;
+}
+
</%init>
diff --git a/html/m/_elements/header b/html/m/_elements/header
index c9988ac..f83fea3 100644
--- a/html/m/_elements/header
+++ b/html/m/_elements/header
@@ -5,11 +5,12 @@ $title => undef
<head>
<link rel="stylesheet" type="text/css" href="<%RT->Config->Get('WebPath')|n%>/m/style.css"/>
<title><%$title%></title>
+<meta name="viewport" content="width=device-width height=device-height user-scalable=yes"/>
</head>
<body>
% if ($title) {
<h1><%$title%></h1>
% }
<div id="gohome">
-<a href="<%RT->Config->Get('WebPath')%>/m/"><&|/l&>Homepage</&>
+<a href="<%RT->Config->Get('WebPath')%>/m/"><&|/l&>Homepage</&></a>
</div>
diff --git a/html/m/_elements/menu b/html/m/_elements/menu
index 7f45850..b4bfa8c 100644
--- a/html/m/_elements/menu
+++ b/html/m/_elements/menu
@@ -6,27 +6,44 @@
</ul>
</&>
<%init>
-my @menu = (
-{ label => loc("My tickets"),
- url => '/m/tickets/owned'
-},
- {
- label => loc("My requests"),
- url => '/m/tickets/requested'
+use RT::SavedSearches;
+my @menu = (
+ { label => loc("New ticket"),
+ url => '/m/ticket/create',
},
- {
- label => loc("All tickets"),
- url => '/m/tickets/all'
+ { label => loc("My tickets"),
+ url => '/m/tickets/owned'
+ },
+ { label => loc("My requests"),
+ url => '/m/tickets/requested'
+ },
+ { label => loc("All tickets"),
+ url => '/m/tickets/all'
},
-{
- label => loc("New ticket"),
- url => '/m/ticket/create',
-},
-{
- label => loc("Logout"),
- url => '/m/logout',
-}
-
);
+
+
+if ( $session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch', Object => $RT::System))
+ {
+
+ my @Objects = RT::SavedSearches->new( $session{CurrentUser} )->_PrivacyObjects;
+ push @Objects, RT::System->new( $session{'CurrentUser'} )
+ if $session{'CurrentUser'}->HasRight(
+ Object => $RT::System,
+ Right => 'SuperUser'
+ );
+
+ foreach my $object (@Objects) {
+ my @searches = $object->Attributes->Named('SavedSearch');
+ foreach my $search (@searches) {
+ warn $search->SubValue("SearchType") ." is the type";
+ next unless $search->SubValue("SearchType") eq 'Ticket';
+ warn YAML::Dump($search->Content); use YAML;
+ push @menu, { label => $search->Description, url => '/m/tickets/search?q=' . $search->SubValue("Query") };
+
+ }
+ }
+}
+push @menu, { label => loc("Logout"), url => '/m/logout', } ;
</%init>
diff --git a/html/m/_elements/raw_style b/html/m/_elements/raw_style
index 6fcc058..d80b525 100644
--- a/html/m/_elements/raw_style
+++ b/html/m/_elements/raw_style
@@ -28,9 +28,10 @@ div.buttons {
margin-top: -1.2em;
top: -0.5em;
padding: 0.5em;
+ padding-right: 0;
position: relative;
display: inline-block;
- text-decoration: underline;
+ text-decoration: none;
background-color: #fff;
-moz-border-radius: 0.25em;
-webkit-border-radius: 0.25em;
@@ -54,6 +55,7 @@ ul.menu li
display: block;
margin: 0;
padding: 0;
+ font-weight: bold;
}
ul.ticketlist li:active, ul.ticketlist li:hover,
@@ -108,13 +110,11 @@ hr.clear {
.label, .labeltop {
- text-align: right;
- display: inline-block;
- width: 8em;
font-weight: normal;
}
.value {
font-weight: bold;
+ width: 100%;
}
ul.ticketlist {
@@ -130,11 +130,11 @@ ul.ticketlist {
ul.ticketlist li.ticket {
padding: 0.5em;
font-weight: bold;
- border-bottom: 1px solid black;
+ border-bottom: 1px solid #999;
}
ul.ticketlist li.ticket:first-child {
- border-top: 1px solid black;
+ border-top: 1px solid #999;
}
ul.ticketlist li.ticket a.ticket{
@@ -145,10 +145,6 @@ ul.ticketlist li.ticket div {
padding: 0.2em;
}
-ul.ticketlist li.ticket .label{
- font-weight: normal;
-}
-
ul.ticketlist li.ticket br {
display: none;
@@ -208,13 +204,8 @@ ul.menu a:after {
padding: 0.5em;
}
-div#login-box div.titlebox .label {
- width: 5em;
-}
-
div#login-box div.titlebox {
- width: 21em;
- text-align: center;
+ width: 100%;
margin-left:auto;
margin-right: auto;
}
@@ -285,9 +276,12 @@ div.txn-content {
}
-form span.label {
+.label {
text-align: left;
font-size: 0.8em;
+ clear:both;
+ display: block;
+
}
div.entry {
@@ -296,10 +290,10 @@ div.entry {
border-bottom: 1px solid black;
}
-div.entry input[type=text] {
+input, input[type=text], input[type=password] {
width: 100%;
}
-div.entry textarea {
+textarea {
width: 100%;
}
diff --git a/html/m/login b/html/m/login
index 59bad8c..8d2634a 100644
--- a/html/m/login
+++ b/html/m/login
@@ -44,14 +44,12 @@ unless (!defined($uri->authority) || $uri->authority eq $uri_base_url->authority
% unless (RT->Config->Get('WebExternalAuth') and !RT->Config->Get('WebFallbackToInternalAuth')) {
<form id="login" name="login" method="post" action="<% $form_action %>">
-<div class="input-row">
- <span class="label"><&|/l&>Username</&>:</span>
- <span class="input"><input name="user" value="<%$user%>" id="user" /></span>
+<div class="entry">
+ <span class="label"><&|/l&>Username</&>:</span><span class="value"><input name="user" value="<%$user%>" id="user" /></span>
</div>
-<div class="input-row">
- <span class="label"><&|/l&>Password</&>:</span>
- <span class="input"><input type="password" name="pass" autocomplete="off" /></span>
+<div class="entry">
+ <span class="label"><&|/l&>Password</&>:</span><span class="value"><input type="password" name="pass"/></span>
</div>
<& /Elements/Submit, Label => loc('Login')&>
commit da29e20e746e0e9ef2c38ea6ccc676d3f65d3eff
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Aug 2 11:47:13 2010 -0700
almost ready. need to add a way to get out of the mobile ui
diff --git a/html/m/_elements/header b/html/m/_elements/header
index f83fea3..8b9591e 100644
--- a/html/m/_elements/header
+++ b/html/m/_elements/header
@@ -1,5 +1,6 @@
<%args>
$title => undef
+$show_home_button => 1
</%args>
<html>
<head>
@@ -11,6 +12,8 @@ $title => undef
% if ($title) {
<h1><%$title%></h1>
% }
+% if ($show_home_button) {
<div id="gohome">
<a href="<%RT->Config->Get('WebPath')%>/m/"><&|/l&>Homepage</&></a>
</div>
+% }
diff --git a/html/m/_elements/menu b/html/m/_elements/menu
index b4bfa8c..f1549da 100644
--- a/html/m/_elements/menu
+++ b/html/m/_elements/menu
@@ -1,15 +1,28 @@
<&| /Widgets/TitleBox, class => 'menu'&>
<ul class="menu">
% for my $item (@menu) {
+% if (exists $item->{html}) {
+<li><%$item->{html} |n%></li>
+% } else {
<li><a href="<%RT->Config->Get('WebPath')%><%$item->{url}%>"><%$item->{label}%></a></li>
% }
+% }
</ul>
</&>
<%init>
use RT::SavedSearches;
my @menu = (
+ { html => '<form method="GET" id="search" action="'
+ . RT->Config->Get('WebPath')
+ . '/m/tickets/search">'
+ . loc("Search")
+ . ': <input type="text" name="q" id="q" value=""/>'
+ . '<input type="submit" value="'
+ . loc("Go")
+ . '"/></form>'
+ },
{ label => loc("New ticket"),
- url => '/m/ticket/create',
+ url => '/m/ticket/select_create_queue',
},
{ label => loc("My tickets"),
url => '/m/tickets/owned'
@@ -20,7 +33,6 @@ my @menu = (
{ label => loc("All tickets"),
url => '/m/tickets/all'
},
-
);
diff --git a/html/m/_elements/raw_style b/html/m/_elements/raw_style
index d80b525..03dcf70 100644
--- a/html/m/_elements/raw_style
+++ b/html/m/_elements/raw_style
@@ -1,17 +1,14 @@
body {
font-family: helvetica, arial, sans-serif;
background-color: #ccf;
- text-rendering: optimizeLegibility;
margin: 0;
}
h1 {
font-size: 1.5em;
padding-top: 0.5em;
- padding-bottom: 0.25em;
- margin-bottom: 1.5em;
padding-left: 0.2em;
-
+ display: block;
background-color: #fff;
}
@@ -28,7 +25,6 @@ div.buttons {
margin-top: -1.2em;
top: -0.5em;
padding: 0.5em;
- padding-right: 0;
position: relative;
display: inline-block;
text-decoration: none;
@@ -38,7 +34,6 @@ div.buttons {
-webkit-box-shadow: #333 0px 0px 5px;
-moz-box-shadow: #333 0px 0px 5px;
box-shadow: #333 0px 0px 5px;
-
}
ul.menu
@@ -64,7 +59,7 @@ ul.menu li:active, ul.menu li:hover {
}
-ul.menu li a
+ul.menu li
{
display: block;
padding: 1em;
@@ -76,7 +71,7 @@ ul.menu li a
text-decoration: none;
}
-ul.menu li:first-child a {
+ul.menu li:first-child{
border: none;
}
@@ -85,7 +80,7 @@ ul.menu li#active a
color: #800000;
}
-div.titlebox, #bpscredits{
+div.titlebox, #bpscredits, .ticket_menu{
-moz-border-radius: 1em;
-webkit-border-radius: 1em;
margin: 0.5em;
@@ -158,7 +153,7 @@ div#paging {
text-align: center;
}
-.titlebox.search .titlebox-title, .titlebox.menu .titlebox-title, .ticket_menu .titlebox-title, .history .titlebox-title{
+.titlebox.search .titlebox-title, .titlebox.menu .titlebox-title, .ticket_menu .titlebox-title, .history .titlebox-title, #ticket-create-basics .titlebox-title{
display: none;
}
@@ -172,21 +167,56 @@ ul.menu a:after {
content: " >";
}
+ul.menu form {
+ display: inline;
+}
+
+ul.menu form * {
+ width: 8em;
+ display: inline;
+}
+
+ul.menu form input {
+ padding: 0;
+ margin: 0;
+}
+
+ul.menu form input{
+
+ width: auto;
+ padding: 0.5em;
+ margin: -0.5em;
+ margin-left: 1em;
+}
+
+.ticket_menu {
+ text-align: center;
+}
+
+.ticket_menu ul {
+ display: block;
+ margin: 0;
+ padding: 0;
+}
+
.ticket_menu ul li {
+
display: inline-block;
- list-style: none;
text-align: center;
padding-bottom: 0.25em;
padding-top: 0.25em;
font-size: 1.5em;
+ width: 28%;
+ padding-right: 0.3em;
+ padding-left: 0.2em;
+ border-right: 1px solid #000;
}
-.ticket_menu ul {
- width: 100%;
- display: block;
- padding: 0;
- margin: 0;
+.ticket_menu ul li:last-child {
+ padding-right: 0;
+ border-right: 0;
}
+
.history ul.history-list {
padding: 0;
margin: 0;
@@ -281,19 +311,27 @@ div.txn-content {
font-size: 0.8em;
clear:both;
display: block;
+ padding-bottom: 0.2em;
}
div.entry {
margin-bottom: 1em;
padding-bottom: 1em;
- border-bottom: 1px solid black;
+ border-bottom: 1px solid #ccc;
+ display: block;
+ width: 100%;
+ min-height: 2em;
}
input, input[type=text], input[type=password] {
width: 100%;
}
+.timefield input {
+ width: 5em;
+}
+
textarea {
width: 100%;
}
diff --git a/html/m/_elements/ticket_menu b/html/m/_elements/ticket_menu
index 6c6d4ba..257b066 100644
--- a/html/m/_elements/ticket_menu
+++ b/html/m/_elements/ticket_menu
@@ -2,17 +2,15 @@
$ticket
</%args>
<div class="ticket_menu">
-<&| /Widgets/TitleBox &>
<ul>
% for my $item (@menu) {
-<li style="width: <%$width%>%;"><a href="<%RT->Config->Get('WebPath')%><%$item->{url}%>"><%$item->{label}%></a></li>
+<li><a href="<%RT->Config->Get('WebPath')%><%$item->{url}%>"><%$item->{label}%></a></li>
% }
</ul>
-</&>
</div>
<%init>
my @menu = (
-{ label => loc("Ticket"),
+{ label => loc("Basics"),
url => '/m/ticket/show?id='.$ticket->id
},
{
@@ -28,6 +26,6 @@ my @menu = (
);
-my $width = int(100/ ($#menu +1))-1;
+my $width = int(100/ ($#menu +1))-5;
</%init>
diff --git a/html/m/_elements/wrapper b/html/m/_elements/wrapper
index d7ea7f5..ae2c237 100644
--- a/html/m/_elements/wrapper
+++ b/html/m/_elements/wrapper
@@ -1,8 +1,9 @@
<%args>
$title => ''
+$show_home_button => 1
</%args>
<%init>
-$m->comp('header', title => $title);
+$m->comp('header', title => $title, show_home_button => $show_home_button);
$m->out($m->content);
$m->comp('footer');
$m->abort();
diff --git a/html/m/login b/html/m/login
index 8d2634a..46fcf81 100644
--- a/html/m/login
+++ b/html/m/login
@@ -1,13 +1,15 @@
<%INIT>
my $req_uri;
-if (UNIVERSAL::can($r, 'uri') and $r->uri =~ m{.*/(.*)}) {
- $req_uri = $1;
+if (UNIVERSAL::can($r, 'uri') and $r->uri =~ m{.*/m/(.*)}) {
+ $req_uri = '/m/'.$1;
}
+my $default_path = RT->Config->Get('WebPath') ."/m/";
+
my $form_action = defined $goto ? $goto
: defined $req_uri ? $req_uri
- : RT->Config->Get('WebPath')
+ : $default_path
;
# sanitize $form_action
@@ -15,17 +17,17 @@ my $uri = URI->new($form_action);
# You get undef scheme with a relative uri like "/Search/Build.html"
unless (!defined($uri->scheme) || $uri->scheme eq 'http' || $uri->scheme eq 'https') {
- $form_action = RT->Config->Get('WebPath');
+ $form_action = $default_path;
}
# Make sure we're logging in to the same domain
# You can get an undef authority with a relative uri like "index.html"
-my $uri_base_url = URI->new(RT->Config->Get('WebBaseURL'));
+my $uri_base_url = URI->new(RT->Config->Get('WebBaseURL')."/m/");
unless (!defined($uri->authority) || $uri->authority eq $uri_base_url->authority) {
- $form_action = RT->Config->Get('WebPath');
+ $form_action = $default_path;
}
</%INIT>
-<&| /m/_elements/wrapper &>
+<&| /m/_elements/wrapper, show_home_button => 0 &>
<style>
<& /m/_elements/raw_style &>
</style>
diff --git a/html/m/ticket/create b/html/m/ticket/create
index d9d820b..b7f7210 100644
--- a/html/m/ticket/create
+++ b/html/m/ticket/create
@@ -14,7 +14,7 @@ my $showrows = sub {
my $key = shift @pairs;
my $val = shift @pairs;
- $m->out("<div><label>$key</label><div class=\"value\">$val</div></div>");
+ $m->out("<div class=\"entry\"><span class=\"label\">$key</span><div class=\"value\">$val</div></div>");
}
@@ -101,7 +101,7 @@ if ($CloneTicket) {
my @results;
-my $title = loc("Create a new ticket");
+my $title = loc("Create a ticket");
my $QueueObj = new RT::Queue($session{'CurrentUser'});
$QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded."));
@@ -203,7 +203,7 @@ if ((!exists $ARGS{'AddMoreAttach'}) and (defined($ARGS{'id'}) and $ARGS{'id'} e
</%init>
-<&| /m/_elements/wrapper &>
+<&| /m/_elements/wrapper, title => $title &>
<& /Elements/ListActions, actions => \@results &>
<form action="<% RT->Config->Get('WebPath') %>/m/ticket/create" method="post" enctype="multipart/form-data" name="TicketCreate">
<input type="hidden" class="hidden" name="id" value="new" />
@@ -211,8 +211,8 @@ if ((!exists $ARGS{'AddMoreAttach'}) and (defined($ARGS{'id'}) and $ARGS{'id'} e
% if ($gnupg_widget) {
<& /Elements/GnuPG/SignEncryptWidget:ShowIssues, self => $gnupg_widget &>
% }
-<div id="Ticket-Create-basics">
-<&| /Widgets/TitleBox, title => $title &>
+<div id="ticket-create-basics">
+<&| /Widgets/TitleBox &>
<%perl>
$showrows->(
@@ -334,26 +334,26 @@ $showrows->(
Default => $ARGS{FinalPriority} ? $ARGS{FinalPriority} : $QueueObj->FinalPriority,
),
- loc("Time Estimated") => $m->scomp(
+ loc("Time Estimated") => '<span class="timefield">'.$m->scomp(
"/Elements/EditTimeValue",
Name => 'TimeEstimated',
Default => $ARGS{TimeEstimated} || '',
InUnits => $ARGS{'TimeEstimated-TimeUnits'}
- ),
+ ).'</span>',
- loc("Time Worked") => $m->scomp(
+ loc("Time Worked") => '<span class="timefield">'.$m->scomp(
"/Elements/EditTimeValue",
Name => 'TimeWorked',
Default => $ARGS{TimeWorked} || '',
InUnits => $ARGS{'TimeWorked-TimeUnits'}
- ),
+ ). '</span>',
- loc("Time Left") => $m->scomp(
+ loc("Time Left") => '<span class="timefield">'.$m->scomp(
"/Elements/EditTimeValue",
Name => 'TimeLeft',
Default => $ARGS{TimeLeft} || '',
InUnits => $ARGS{'TimeLeft-TimeUnits'}
- ),
+ ).'</span>',
);
</%perl>
diff --git a/html/m/ticket/history b/html/m/ticket/history
index c7463c6..69bc7d5 100644
--- a/html/m/ticket/history
+++ b/html/m/ticket/history
@@ -6,7 +6,7 @@ my $t = RT::Ticket->new($session{CurrentUser});
$t->Load($id);
my $history = $t->Transactions()->ItemsArrayRef;
</%init>
-<&| /m/_elements/wrapper &>
+<&| /m/_elements/wrapper, title => $t->Subject &>
<div class="history">
<& /m/_elements/ticket_menu, ticket => $t &>
<&|/Widgets/TitleBox &>
diff --git a/html/m/ticket/reply b/html/m/ticket/reply
index c0a7ff8..55eeb83 100644
--- a/html/m/ticket/reply
+++ b/html/m/ticket/reply
@@ -2,7 +2,7 @@
<& /m/_elements/ticket_menu, ticket => $t &>
<& /Elements/ListActions, actions => \@results &>
-<&|/Widgets/TitleBox, title => loc('Update ticket')&>
+<&|/Widgets/TitleBox, title => loc('Update ticket #[_1]', $t->id)&>
<form action="reply" id="update"
method="post" enctype="multipart/form-data">
<input type="hidden" class="hidden" name="DefaultStatus" value="<% $DefaultStatus ||''%>" />
diff --git a/html/m/ticket/select_create_queue b/html/m/ticket/select_create_queue
new file mode 100644
index 0000000..88cf203
--- /dev/null
+++ b/html/m/ticket/select_create_queue
@@ -0,0 +1,18 @@
+<%init>
+my $queues = RT::Queues->new($session{'CurrentUser'});
+$queues->UnLimit();
+
+</%init>
+<&| /m/_elements/wrapper, title => loc("Create a ticket") &>
+<div class="select_queue">
+<&|/Widgets/TitleBox, title => loc("Select a queue") &>
+<ul class="menu">
+% while (my $q = $queues->Next()) {
+% next if (! $q->CurrentUserHasRight('CreateTicket'));
+<li><a href="<%RT->Config->Get('WebPath')%>/m/ticket/create?Queue=<%$q->id%>"><%$q->Name%></a></li>
+% }
+</ul>
+</&>
+</div>
+</&>
+
diff --git a/html/m/ticket/show b/html/m/ticket/show
index 2449d88..a482bb0 100644
--- a/html/m/ticket/show
+++ b/html/m/ticket/show
@@ -2,7 +2,7 @@
$id => undef
</%args>
<%init>
-my $TicketObj;
+my $Ticket;
my @Actions;
if ($ARGS{'id'} eq 'new') {
@@ -18,30 +18,30 @@ if ($ARGS{'id'} eq 'new') {
Abort('You have no permission to create tickets in that queue.');
}
- ($TicketObj, @Actions) = CreateTicket(
+ ($Ticket, @Actions) = CreateTicket(
Attachments => delete $session{'Attachments'},
%ARGS,
);
- unless ( $TicketObj->CurrentUserHasRight('ShowTicket') ) {
- Abort("No permission to view newly created ticket #".$TicketObj->id.".");
+ unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
+ Abort("No permission to view newly created ticket #".$Ticket->id.".");
}
# }}}
} else {
- $TicketObj ||= LoadTicket($ARGS{'id'});
+ $Ticket ||= LoadTicket($ARGS{'id'});
$m->callback( CallbackName => 'BeforeProcessArguments',
- TicketObj => $TicketObj,
+ TicketObj => $Ticket,
ActionsRef => \@Actions, ARGSRef => \%ARGS );
if ( defined $ARGS{'Action'} ) {
if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
my $action = $1;
- my ($res, $msg) = $TicketObj->$action();
+ my ($res, $msg) = $Ticket->$action();
push(@Actions, $msg);
}
}
$m->callback(CallbackName => 'ProcessArguments',
- Ticket => $TicketObj,
+ Ticket => $Ticket,
ARGSRef => \%ARGS,
Actions => \@Actions);
@@ -50,26 +50,26 @@ if ($ARGS{'id'} eq 'new') {
ProcessUpdateMessage(
ARGSRef => \%ARGS,
Actions => \@Actions,
- TicketObj => $TicketObj,
+ TicketObj => $Ticket,
);
delete $session{'Attachments'};
#Process status updates
- push @Actions, ProcessTicketWatchers(ARGSRef => \%ARGS, TicketObj => $TicketObj );
- push @Actions, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $TicketObj );
- push @Actions, ProcessTicketLinks( ARGSRef => \%ARGS, TicketObj => $TicketObj );
- push @Actions, ProcessTicketDates( ARGSRef => \%ARGS, TicketObj => $TicketObj );
- push @Actions, ProcessObjectCustomFieldUpdates(ARGSRef => \%ARGS, TicketObj => $TicketObj );
+ push @Actions, ProcessTicketWatchers(ARGSRef => \%ARGS, TicketObj => $Ticket );
+ push @Actions, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $Ticket );
+ push @Actions, ProcessTicketLinks( ARGSRef => \%ARGS, TicketObj => $Ticket );
+ push @Actions, ProcessTicketDates( ARGSRef => \%ARGS, TicketObj => $Ticket );
+ push @Actions, ProcessObjectCustomFieldUpdates(ARGSRef => \%ARGS, TicketObj => $Ticket );
# XXX: we shouldn't block actions here if user has no right to see the ticket,
# but we should allow him to see actions he has done
- unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
+ unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
Abort("No permission to view ticket");
}
if ( $ARGS{'MarkAsSeen'} ) {
- $TicketObj->SetAttribute(
- Name => 'User-'. $TicketObj->CurrentUser->id .'-SeenUpTo',
- Content => $TicketObj->LastUpdated,
+ $Ticket->SetAttribute(
+ Name => 'User-'. $Ticket->CurrentUser->id .'-SeenUpTo',
+ Content => $Ticket->LastUpdated,
);
push @Actions, loc('Marked all messages as seen');
}
@@ -77,7 +77,7 @@ if ($ARGS{'id'} eq 'new') {
$m->callback(
CallbackName => 'BeforeDisplay',
- TicketObj => \$TicketObj,
+ TicketObj => \$Ticket,
Actions => \@Actions,
ARGSRef => \%ARGS,
);
@@ -92,63 +92,341 @@ if (@Actions) {
my $key = Digest::MD5::md5_hex( rand(1024) );
push @{ $session{"Actions"}->{$key} ||= [] }, @Actions;
$session{'i'}++;
- my $url = RT->Config->Get('WebURL') . "/m/ticket/show?id=" . $TicketObj->id . "&results=" . $key;
+ my $url = RT->Config->Get('WebURL') . "/m/ticket/show?id=" . $Ticket->id . "&results=" . $key;
$url .= '#' . $ARGS{Anchor} if $ARGS{Anchor};
RT::Interface::Web::Redirect($url);
}
-</%init>
-<&| /m/_elements/wrapper &>
-<& /m/_elements/ticket_menu, ticket => $TicketObj &>
+# If we haven't been passed in an Attachments object (through the precaching mechanism)
+# then we need to find one
+my $Attachments = $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket);
+
+my %documents;
+while ( my $attach = $Attachments->Next() ) {
+ next unless ($attach->Filename());
+ unshift( @{ $documents{ $attach->Filename } }, $attach );
+}
+
+my $CustomFields = $Ticket->CustomFields;
+$m->callback(
+ CallbackName => 'MassageCustomFields',
+ Object => $Ticket,
+ CustomFields => $CustomFields,
+);
+
+my $print_value = sub {
+ my ($cf, $value) = @_;
+ my $linked = $value->LinkValueTo;
+ if ( defined $linked && length $linked ) {
+ my $linked = $m->interp->apply_escapes( $linked, 'h' );
+ $m->out('<a href="'. $linked .'" target="_new">');
+ }
+ my $comp = "ShowCustomField". $cf->Type;
+ $m->callback(
+ CallbackName => 'ShowComponentName',
+ Name => \$comp,
+ CustomField => $cf,
+ Object => $Ticket,
+ );
+ if ( $m->comp_exists( $comp ) ) {
+ $m->comp( $comp, Object => $value );
+ } else {
+ $m->out( $m->interp->apply_escapes( $value->Content, 'h' ) );
+ }
+ $m->out('</a>') if defined $linked && length $linked;
+
+ # This section automatically populates a<div with the "IncludeContentForValue" for this custom
+ # field if it's been defined
+ if ( $cf->IncludeContentForValue ) {
+ my $vid = $value->id;
+ $m->out( '<div class="object_cf_value_include" id="object_cf_value_'. $vid .'">' );
+ $m->print( loc("See also:") );
+ $m->out( '<a href="'. $value->IncludeContentForValue .'">' );
+ $m->print( $value->IncludeContentForValue );
+ $m->out( qq{</a></div>\n} );
+ $m->out( qq{<script><!--\nahah('} );
+ $m->print( $value->IncludeContentForValue );
+ $m->out( qq{', 'object_cf_value_$vid');\n--></script>\n} );
+ }
+};
+
+</%init>
+<&| /m/_elements/wrapper, title => $Ticket->Subject &>
+<div id="ticket-show">
+<& /m/_elements/ticket_menu, ticket => $Ticket &>
<&| /Widgets/TitleBox, title => loc('The Basics'),
class => 'ticket-info-basics',
&>
- <& /Ticket/Elements/ShowBasics, Ticket => $TicketObj &>
+
+
+ <div class="entry">
+ <div class="label id"><&|/l&>Id</&>:</div>
+ <div class="value id"><%$Ticket->Id %></div>
+ </div>
+ <div class="entry">
+ <div class="label status"><&|/l&>Status</&>:</div>
+ <div class="value status"><% loc($Ticket->Status) %></div>
+ </div>
+% if ($Ticket->TimeEstimated) {
+ <div class="entry">
+ <div class="label time estimated"><&|/l&>Estimated</&>:</div>
+ <div class="value time estimated"><& ShowTime, minutes => $Ticket->TimeEstimated &></div>
+ </div>
+% }
+% if ($Ticket->TimeWorked) {
+ <div class="entry">
+ <div class="label time worked"><&|/l&>Worked</&>:</div>
+ <div class="value time worked"><& ShowTime, minutes => $Ticket->TimeWorked &></div>
+ </div>
+% }
+% if ($Ticket->TimeLeft) {
+ <div class="entry">
+ <div class="label time left"><&|/l&>Left</&>:</div>
+ <div class="value time left"><& ShowTime, minutes => $Ticket->TimeLeft &></div>
+ </div>
+% }
+ <div class="entry">
+ <div class="label priority"><&|/l&>Priority</&>:</div>
+ <div class="value priority"><& /Ticket/Elements/ShowPriority, Ticket => $Ticket &></div>
+ </div>
+ <div class="entry">
+ <div class="label queue"><&|/l&>Queue</&>:</div>
+ <div class="value queue"><& /Ticket/Elements/ShowQueue, QueueObj => $Ticket->QueueObj &></div>
+ </div>
</&>
-% if ($TicketObj->CustomFields->First) {
+% if ($Ticket->CustomFields->First) {
<&| /Widgets/TitleBox, title => loc('Custom Fields'),
- title_href => RT->Config->Get('WebPath')."/Ticket/Modify.html?id=".$TicketObj->Id,
class => 'ticket-info-cfs',
&>
- <& /Ticket/Elements/ShowCustomFields, Ticket => $TicketObj &>
- </&>
+
+% while ( my $CustomField = $CustomFields->Next ) {
+% my $Values = $Ticket->CustomFieldValues( $CustomField->Id );
+% my $count = $Values->Count;
+ <div class="entry" id="CF-<%$CustomField->id%>-ShowRow">
+ <div class="label"><% $CustomField->Name %>:</div>
+ <div class="value">
+% unless ( $count ) {
+<i><&|/l&>(no value)</&></i>
+% } elsif ( $count == 1 ) {
+% $print_value->( $CustomField, $Values->First );
+% } else {
+<ul>
+% while ( my $Value = $Values->Next ) {
+<li>
+% $print_value->( $CustomField, $Value );
+</li>
+% }
+</ul>
+% }
+ </div>
+ </div>
% }
- <&| /Widgets/TitleBox, title => loc('People'),
- class => 'ticket-info-people',
- &>
- <& /Ticket/Elements/ShowPeople, Ticket => $TicketObj &>
+% $m->callback( CallbackName => 'AfterCustomFields', Object => $Ticket );
+</&>
+% }
+
+ <&| /Widgets/TitleBox, title => loc('People'), class => 'ticket-info-people' &>
+
+
+ <div class="entry">
+ <div class="label"><&|/l&>Owner</&>:</div>
+ <div class="value"><& /Elements/ShowUser, User => $Ticket->OwnerObj, Ticket => $Ticket &>
+ </div>
+ </div>
+ <div class="entry">
+ <div class="label"><&|/l&>Requestors</&>:</div>
+ <div class="value"><& /Ticket/Elements/ShowGroupMembers, Group => $Ticket->Requestors, Ticket => $Ticket &></div>
+ </div>
+ <div class="entry">
+ <div class="label"><&|/l&>Cc</&>:</div>
+ <div class="value"><& /Ticket/Elements/ShowGroupMembers, Group => $Ticket->Cc, Ticket => $Ticket &></div>
+ </div>
+ <div class="entry">
+ <div class="label"><&|/l&>AdminCc</&>:</div>
+ <div class="value"><& /Ticket/Elements/ShowGroupMembers, Group => $Ticket->AdminCc, Ticket => $Ticket &></div>
+ </div>
+
</&>
- <& /Ticket/Elements/ShowAttachments, Ticket => $TicketObj &>
+% if (keys %documents) {
+<&| /Widgets/TitleBox, title => loc('Attachments'),
+ title_class=> 'inverse',
+ class => 'ticket-info-attachments',
+ color => "#336699" &>
+
+% foreach my $key (keys %documents) {
+
+<%$key%><br />
+<ul>
+% foreach my $rev (@{$documents{$key}}) {
+
+<%PERL>
+my $size = $rev->ContentLength;
- <& /Ticket/Elements/ShowRequestor, Ticket => $TicketObj &>
+if ($size) {
+ my $kb = int($size/102.4) / 10;
+ my $units = RT->Config->Get('AttachmentUnits');
+ if (!defined($units)) {
+ if ($size > 1024) {
+ $size = $kb . "k";
+ }
+ else {
+ $size = $size . "b";
+ }
+ }
+ elsif ($units eq 'k') {
+ $size = $kb . "k";
+ }
+ else {
+ $size = $size . "b";
+ }
+
+</%PERL>
+
+<li><font size="-2">
+<a href="<%RT->Config->Get('WebPath')%>/Ticket/Attachment/<%$rev->TransactionId%>/<%$rev->Id%>/<%$rev->Filename | u%>">
+<&|/l, $rev->CreatedAsString, $size, $rev->CreatorObj->Name &>[_1] ([_2]) by [_3]</&>
+</a>
+</font></li>
+% }
+% }
+</ul>
+
+% }
+</&>
+
+% }
% if ( RT->Config->Get('EnableReminders') ) {
<&|/Widgets/TitleBox, title => loc("Reminders"),
class => 'ticket-info-reminders',
&>
- <table><tr><td>
+ <div class="entry"><div
<form action="<%RT->Config->Get('WebPath')%>/Ticket/Display.html" method="post">
- <& /Ticket/Elements/Reminders, Ticket => $TicketObj, ShowCompleted => 0 &>
+ <& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 0 &>
<div align="right"><input type="submit" class="button" value="<&|/l&>Save</&>" /></div>
</form>
- </td></tr></table>
+ </div></div>
</&>
% }
<&| /Widgets/TitleBox, title => loc("Dates"),
class => 'ticket-info-dates',
&>
- <& /Ticket/Elements/ShowDates, Ticket => $TicketObj &>
- </&>
- <&| /Widgets/TitleBox, title => loc('Links'),
- class => 'ticket-info-links',
- &>
- <& /Elements/ShowLinks, Ticket => $TicketObj &>
+
+ <div class="entry">
+ <div class="label date created"><&|/l&>Created</&>:</div>
+ <div class="value date created"><% $Ticket->CreatedObj->AsString %></div>
+ </div>
+ <div class="entry">
+ <div class="label date starts"><&|/l&>Starts</&>:</div>
+ <div class="value date starts"><% $Ticket->StartsObj->AsString %></div>
+ </div>
+ <div class="entry">
+ <div class="label date started"><&|/l&>Started</&>:</div>
+ <div class="value date started"><% $Ticket->StartedObj->AsString %></div>
+ </div>
+ <div class="entry">
+ <div class="label date told"><a href="<% RT->Config->Get('WebPath') %>/Ticket/Display.html?id=<% $Ticket->id %>&Action=SetTold"><&|/l&>Last Contact</&></a>:</div>
+ <div class="value date told"><% $Ticket->ToldObj->AsString %></div>
+ </div>
+ <div class="entry">
+ <div class="label date due"><&|/l&>Due</&>:</div>
+% my $due = $Ticket->DueObj;
+% if ( $due && $due->Unix > 0 && $due->Diff < 0 ) {
+ <div class="value date due"><span class="overdue"><% $due->AsString %></span></div>
+% } else {
+ <div class="value date due"><% $due->AsString %></div>
+% }
+ </div>
+ <div class="entry">
+ <div class="label date resolved"><&|/l&>Closed</&>:</div>
+ <div class="value date resolved"><% $Ticket->ResolvedObj->AsString %></div>
+ </div>
+ <div class="entry">
+ <div class="label date updated"><&|/l&>Updated</&>:</div>
+% my $UpdatedString = $Ticket->LastUpdated ? loc("[_1] by [_2]", $Ticket->LastUpdatedAsString, $Ticket->LastUpdatedByObj->Name) : loc("Never");
+ <div class="value date updated"><% $UpdatedString | h %></div>
+ </div>
+% $m->callback( %ARGS, CallbackName => 'EndOfList', TicketObj => $Ticket );
+
</&>
+ <&| /Widgets/TitleBox, title => loc('Links'), class => 'ticket-info-links' &>
+
+ <div class="entry">
+ <div class="label"><% loc('Depends on')%></div>
+ <div class="value">
+
+<%PERL>
+my ( @active, @inactive, @not_tickets );
+for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
+ my $target = $link->TargetObj;
+ if ( $target && $target->isa('RT::Ticket') ) {
+ if ( $target->QueueObj->IsInactiveStatus( $target->Status ) ) {
+ push( @inactive, $link->TargetURI );
+ }
+ else {
+ push( @active, $link->TargetURI );
+ }
+ }
+ else {
+ push( @not_tickets, $link->TargetURI );
+ }
+}
+</%PERL>
+
+
+<ul>
+% for my $Link (@not_tickets, @active, @inactive) {
+<li><& ShowLink, URI => $Link &></li>
+% }
+</ul>
+ </div>
+ </div>
+ <div class="entry">
+ <div class="label"><% loc('Depended on by')%></div>
+ <div class="value">
+<ul>
+% while (my $Link = $Ticket->DependedOnBy->Next) {
+<li><& ShowLink, URI => $Link->BaseURI &></li>
+% }
+</ul>
+ </div>
+ </div>
+ <div class="entry">
+ <div class="label"><% loc('Parents') %></div>
+ <div class="value"><& /Ticket/Elements/ShowParents, Ticket => $Ticket &></div>
+ </div>
+ <div class="entry">
+ <div class="label"><% loc('Children')%></div>
+ <div class="value"><& /Ticket/Elements/ShowMembers, Ticket => $Ticket &></div>
+ </div>
+ <div class="entry">
+ <div class="label"><% loc('Refers to')%></div>
+ <div class="value">
+<ul>
+% while (my $Link = $Ticket->RefersTo->Next) {
+<li><& ShowLink, URI => $Link->TargetURI &></li>
+% }
+</ul>
+ </div>
+ </div>
+ <div class="entry">
+ <div class="label"><% loc('Referred to by')%></div>
+ <div class="value">
+ <ul>
+% while (my $Link = $Ticket->ReferredToBy->Next) {
+% next if (UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket') && $Link->BaseObj->Type eq 'reminder');
+<li><& ShowLink, URI => $Link->BaseURI &></li>
+% }
+</ul>
+ </div>
+ </div>
+ </&>
+</div>
</&>
diff --git a/html/m/tickets/search b/html/m/tickets/search
index 0464e78..7ae31ff 100644
--- a/html/m/tickets/search
+++ b/html/m/tickets/search
@@ -1,4 +1,20 @@
+<%args>
+$page => 1
+</%args>
<%init>
- $m->comp('../_elements/ticket_list', query => $ARGS{'query'}, page => $ARGS{'page'});
+use RT::Search::Googleish;
+my $query = $ARGS{'query'};
+if ($ARGS{'q'}) {
+ my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
+ my %args = (
+ Argument => $ARGS{q},
+ TicketsObj => $tickets,
+ );
+ my $search = RT::Search::Googleish->new(%args);
+ $query = $search->QueryToSQL();
+
+}
+
+$m->comp('../_elements/ticket_list', query => $query, page => $page);
$m->abort();
</%init>
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list