[Bps-public-commit] rt-extension-mobileui branch, master, updated. b8d222b399ece20a830356e36855ea21ff03d112
Jesse Vincent
jesse at bestpractical.com
Wed Aug 4 15:12:08 EDT 2010
The branch, master has been updated
via b8d222b399ece20a830356e36855ea21ff03d112 (commit)
from da29e20e746e0e9ef2c38ea6ccc676d3f65d3eff (commit)
Summary of changes:
.../RT-Extension-MobileUI/Elements/Login/Header | 2 +-
.../Ticket/Display.html/Initial | 12 +++++
.../RT-Extension-MobileUI/index.html/Initial | 6 ++-
html/m/_elements/full_site_link | 1 +
html/m/_elements/header | 13 ++++--
html/m/_elements/raw_style | 16 +++++--
html/m/_elements/wrapper | 5 ++
html/m/index.html | 1 +
html/m/login | 2 +
html/m/logout | 3 +-
html/m/ticket/create | 43 ++++++++++++-------
html/m/ticket/show | 8 ++--
lib/RT/Extension/MobileUI.pm | 11 +++++
13 files changed, 90 insertions(+), 33 deletions(-)
create mode 100644 html/Callbacks/RT-Extension-MobileUI/Ticket/Display.html/Initial
create mode 100644 html/m/_elements/full_site_link
- Log -----------------------------------------------------------------
commit b8d222b399ece20a830356e36855ea21ff03d112
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Wed Aug 4 12:14:05 2010 -0700
Lots of cleanup
diff --git a/html/Callbacks/RT-Extension-MobileUI/Elements/Login/Header b/html/Callbacks/RT-Extension-MobileUI/Elements/Login/Header
index f3ad8d6..8cecf1a 100644
--- a/html/Callbacks/RT-Extension-MobileUI/Elements/Login/Header
+++ b/html/Callbacks/RT-Extension-MobileUI/Elements/Login/Header
@@ -1,5 +1,5 @@
<%init>
-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(?:\/|$)})) {
+ if ( RT::Extension::MobileUI->MobileClient() || ($m->request_comp->path() =~ m{^/m(?:\/|$)})) {
$m->comp('/m/login',%ARGS);
$m->abort;
diff --git a/html/Callbacks/RT-Extension-MobileUI/Ticket/Display.html/Initial b/html/Callbacks/RT-Extension-MobileUI/Ticket/Display.html/Initial
new file mode 100644
index 0000000..5a2cf20
--- /dev/null
+++ b/html/Callbacks/RT-Extension-MobileUI/Ticket/Display.html/Initial
@@ -0,0 +1,12 @@
+<%INIT>
+return if $ARGSRef->{'NoRedirect'};
+if (RT::Extension::MobileUI::MobileClient()) {
+ RT::Interface::Web::Redirect('/m/ticket/show.html?id='.$TicketObj->id);
+ $m->abort;
+}
+</%INIT>
+
+<%ARGS>
+$TicketObj => undef
+$ARGSRef => {}
+</%ARGS>
diff --git a/html/Callbacks/RT-Extension-MobileUI/index.html/Initial b/html/Callbacks/RT-Extension-MobileUI/index.html/Initial
index 130c2af..41c3370 100644
--- a/html/Callbacks/RT-Extension-MobileUI/index.html/Initial
+++ b/html/Callbacks/RT-Extension-MobileUI/index.html/Initial
@@ -1,5 +1,7 @@
<%init>
-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'}) {
- RT::Interface::Web::Redirect(RT->Config->Get('WebURL') ."/m")
+if ( RT::Extension::MobileUI->MobileClient()) {
+ RT::Interface::Web::Redirect(RT->Config->Get('WebURL') ."m")
+} else {
+return
}
</%init>
diff --git a/html/m/_elements/full_site_link b/html/m/_elements/full_site_link
new file mode 100644
index 0000000..c17dfdb
--- /dev/null
+++ b/html/m/_elements/full_site_link
@@ -0,0 +1 @@
+<a id="fullsite" href="<%RT->Config->Get('WebPath')%>/m?NotMobile=1"><&|/l&>Not using a mobile browser?</&></a>
diff --git a/html/m/_elements/header b/html/m/_elements/header
index 8b9591e..2c20383 100644
--- a/html/m/_elements/header
+++ b/html/m/_elements/header
@@ -2,6 +2,10 @@
$title => undef
$show_home_button => 1
</%args>
+<%init>
+$r->headers_out->{'Pragma'} = 'no-cache';
+$r->headers_out->{'Cache-control'} = 'no-cache';
+</%init>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<%RT->Config->Get('WebPath')|n%>/m/style.css"/>
@@ -9,11 +13,12 @@ $show_home_button => 1
<meta name="viewport" content="width=device-width height=device-height user-scalable=yes"/>
</head>
<body>
-% if ($title) {
-<h1><%$title%></h1>
-% }
% if ($show_home_button) {
-<div id="gohome">
+% # The align is for older browsers, like the blackberry
+<div id="gohome" align="right">
<a href="<%RT->Config->Get('WebPath')%>/m/"><&|/l&>Homepage</&></a>
</div>
% }
+% if ($title) {
+<h1><%$title%></h1>
+% }
diff --git a/html/m/_elements/raw_style b/html/m/_elements/raw_style
index 03dcf70..cabe966 100644
--- a/html/m/_elements/raw_style
+++ b/html/m/_elements/raw_style
@@ -225,12 +225,12 @@ ul.menu form input{
.history ul.history-list li:first-child {
- border-top: 1px solid black;
+ border-top: 1px solid #ccc;
}
.history ul.history-list li {
list-style: none;
- border-bottom: 1px solid black;
+ border-bottom: 1px solid #ccc;
padding: 0.5em;
}
@@ -286,7 +286,6 @@ form {
border-bottom: 1px solid black;
-moz-border-radius-bottomleft: 1em;
-webkit-border-bottom-left-radius: 1em;
-
padding: 0.5em;
background-color: #fff;
}
@@ -324,7 +323,7 @@ div.entry {
min-height: 2em;
}
-input, input[type=text], input[type=password] {
+input, input[type=text], input[type=password], select {
width: 100%;
}
@@ -332,6 +331,15 @@ input, input[type=text], input[type=password] {
width: 5em;
}
+.timefield select {
+ width: auto;
+}
+
+
textarea {
width: 100%;
}
+
+a#fullsite {
+ padding-left: 1em;
+}
diff --git a/html/m/_elements/wrapper b/html/m/_elements/wrapper
index ae2c237..6760aa4 100644
--- a/html/m/_elements/wrapper
+++ b/html/m/_elements/wrapper
@@ -3,6 +3,11 @@ $title => ''
$show_home_button => 1
</%args>
<%init>
+if ($m->request_args->{'NotMobile'}) {
+ $session{'NotMobile'} = 1;
+ RT::Interface::Web::Redirect(RT->Config->Get('WebBaseURL'));
+ $m->abort();
+}
$m->comp('header', title => $title, show_home_button => $show_home_button);
$m->out($m->content);
$m->comp('footer');
diff --git a/html/m/index.html b/html/m/index.html
index d224349..b47b9bc 100644
--- a/html/m/index.html
+++ b/html/m/index.html
@@ -1,4 +1,5 @@
<&| _elements/wrapper &>
<h1><%loc("RT for [_1]",RT->Config->Get('rtname'))%></h1>
<& _elements/menu &>
+<& _elements/full_site_link &>
</&>
diff --git a/html/m/login b/html/m/login
index 46fcf81..0a246bf 100644
--- a/html/m/login
+++ b/html/m/login
@@ -1,4 +1,5 @@
<%INIT>
+
my $req_uri;
if (UNIVERSAL::can($r, 'uri') and $r->uri =~ m{.*/m/(.*)}) {
@@ -73,6 +74,7 @@ unless (!defined($uri->authority) || $uri->authority eq $uri_base_url->authority
</&>
</div><!-- #login-box -->
</div><!-- #login-body -->
+<& _elements/full_site_link &>
</&>
<%ARGS>
$user => ""
diff --git a/html/m/logout b/html/m/logout
index ce2e9cc..02bee7d 100644
--- a/html/m/logout
+++ b/html/m/logout
@@ -3,6 +3,5 @@ if (keys %session) {
tied(%session)->delete;
$session{'CurrentUser'} = RT::CurrentUser->new;
}
-RT::Interface::Web::Redirect('/');
-
+RT::Interface::Web::Redirect(RT->Config->Get('WebBaseURL')."/m");
</%init>
diff --git a/html/m/ticket/create b/html/m/ticket/create
index b7f7210..557887e 100644
--- a/html/m/ticket/create
+++ b/html/m/ticket/create
@@ -211,14 +211,39 @@ 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-simple">
+<&| /Widgets/TitleBox, title => $QueueObj->Name &>
+
+<%perl>
+$showrows->(
+ loc("Subject") => '<input name="Subject" size="30" maxsize="200" value="'.($ARGS{Subject} || '').'" />',
+ loc("Describe the issue below") =>
+ $m->scomp(
+ "/Elements/MessageBox", exists $ARGS{Content} ? (Default => $ARGS{Content}, IncludeSignature => 0 ) :
+( QuoteTransaction => $QuoteTransaction ),
+ Height => 5
+
+
+));
+
+
+$m->comp("/Elements/Submit", Label => loc("Create"));
+
+</%perl>
+
+</&>
+</div>
+
<div id="ticket-create-basics">
<&| /Widgets/TitleBox &>
+ <input type="hidden" class="hidden" name="Queue" value="<%$QueueObj->id %>" />
<%perl>
$showrows->(
- loc('Queue') => $m->scomp( '/Ticket/Elements/ShowQueue', QueueObj => $QueueObj )
- . '<input type="hidden" class="hidden" name="Queue" value="'. $QueueObj->Name .'" />',
+ # loc('Queue') => $m->scomp( '/Ticket/Elements/ShowQueue', QueueObj => $QueueObj ) ,
loc('Status') =>
@@ -265,9 +290,6 @@ $showrows->(
)
. '</font></i></span>',
- loc("Subject") =>
-
- '<input name="Subject" size="60" maxsize="200" value="'.($ARGS{Subject} || '').'" />',
);
@@ -305,17 +327,6 @@ $showrows->(
%$m->scomp("/Elements/GnuPG/SignEncryptWidget", self => $gnupg_widget, QueueObj => $QueueObj )
% }
-<%perl>
-$showrows->(
- loc("Describe the issue below") =>
- $m->scomp(
- "/Elements/MessageBox", exists $ARGS{Content} ? (Default => $ARGS{Content}, IncludeSignature => 0 ) :
-( QuoteTransaction => $QuoteTransaction )));
-
-
-$m->scomp("/Elements/Submit", Label => loc("Create"));
-
-</%perl>
<div class="ticket-info-basics">
<&| /Widgets/TitleBox, title => loc('The Basics'),
diff --git a/html/m/ticket/show b/html/m/ticket/show
index a482bb0..29d20f4 100644
--- a/html/m/ticket/show
+++ b/html/m/ticket/show
@@ -383,7 +383,7 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
<ul>
% for my $Link (@not_tickets, @active, @inactive) {
-<li><& ShowLink, URI => $Link &></li>
+<li><& /Elements/ShowLink, URI => $Link &></li>
% }
</ul>
</div>
@@ -393,7 +393,7 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
<div class="value">
<ul>
% while (my $Link = $Ticket->DependedOnBy->Next) {
-<li><& ShowLink, URI => $Link->BaseURI &></li>
+<li><& /Elements/ShowLink, URI => $Link->BaseURI &></li>
% }
</ul>
</div>
@@ -411,7 +411,7 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
<div class="value">
<ul>
% while (my $Link = $Ticket->RefersTo->Next) {
-<li><& ShowLink, URI => $Link->TargetURI &></li>
+<li><& /Elements/ShowLink, URI => $Link->TargetURI &></li>
% }
</ul>
</div>
@@ -422,7 +422,7 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
<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>
+<li><& /Elements/ShowLink, URI => $Link->BaseURI &></li>
% }
</ul>
</div>
diff --git a/lib/RT/Extension/MobileUI.pm b/lib/RT/Extension/MobileUI.pm
index 332e3d1..c23f484 100644
--- a/lib/RT/Extension/MobileUI.pm
+++ b/lib/RT/Extension/MobileUI.pm
@@ -5,4 +5,15 @@ package RT::Extension::MobileUI;
my $VERSION = 1;
+sub MobileClient {
+ my $self = shift;
+
+
+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 && !$HTML::Mason::Commands::session{'NotMobile'}) {
+ return 1;
+} else {
+ return undef;
+}
+
+}
1;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list