[Rt-commit] rt branch, 4.2/remove-offline-tool, created. rt-4.1.8-212-gb72740f

Alex Vandiver alexmv at bestpractical.com
Thu May 2 19:08:37 EDT 2013


The branch, 4.2/remove-offline-tool has been created
        at  b72740fc023e7b12bf137f7d1e410c486954446f (commit)

- Log -----------------------------------------------------------------
commit b72740fc023e7b12bf137f7d1e410c486954446f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu May 2 19:04:46 2013 -0400

    Remove unmaintained and crippled "offline tool"
    
    198da6f accidentally removed the ability for the "Offline" tool to be
    used off of search results -- thus removing its ability to be used for
    offline ticket editing, and limiting it to only offline ticket creation.
    As it has a number of other notable bugs and limitations, prune it
    entirely.

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index eb84dde..4c21935 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -516,12 +516,6 @@ my $build_main_nav = sub {
         );
     }
 
-    $tools->child( offline =>
-        title       => loc('Offline'),
-        description => loc('Create tickets offline'),
-        path        => '/Tools/Offline.html',
-    );
-
     if ( $session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', Object => RT->System ) ) {
         $tools->child( approval =>
             title       => loc('Approval'),
diff --git a/share/html/Tools/Offline.html b/share/html/Tools/Offline.html
deleted file mode 100644
index 5854264..0000000
--- a/share/html/Tools/Offline.html
+++ /dev/null
@@ -1,165 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
-%#                                          <sales at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<& /Elements/Header, Title => loc("Offline upload") &>
-<& /Elements/Tabs &>
-
-<& /Elements/ListActions, actions => \@results &>
-
-% $m->callback( Requestor => \$requestoraddress, Queue => \$qname, %ARGS );
-
-<form action="Offline.html" name="TicketUpdate" method="post" enctype="multipart/form-data">
-<table>
-<tr>
-<td class="label">
-<&|/l&>Default Queue</&>:
-</td>
-<td>
-<& /Elements/SelectQueue, Name => "qname", NamedValues => 1 &>
-<em><&|/l&>If no queue is specified, create tickets in this queue.</&></em>
-</td>
-</tr>
-<tr>
-<td class="label">
-<&|/l&>Default Requestor</&>:
-</td>
-<td>
-<input name="requestoraddress" value="<%$requestoraddress%>" />
-<em><&|/l&>If no Requestor is specified, create tickets with this requestor.</&></em>
-</td>
-</tr>
-<tr><td class="labeltop">
-<&|/l&>Template</&>:
-</td>
-<td colspan="2">
-<textarea name="string" cols="80" rows="30"><% $string %></textarea>
-</td>
-</tr>
-<tr><td class="label">
-<&|/l&>Get template from file</&>:
-</td>
-<td>
-<input name="Template" type="file" />
-<input type="submit" class="button" name="Parse" value="<&|/l&>Go!</&>" />
-</td>
-</tr>
-</table>
-<& /Elements/Submit, Name => 'UpdateTickets', Label => loc('Upload'), Caption => loc("Upload your changes"), color => "#993333" &>
-
-</form>
-<%args>
-$requestoraddress => ''
-$qname => undef
-$string => undef
-</%args>
-<%INIT>
-
-my @results;
-use RT::Action::CreateTickets;
-my $action = RT::Action::CreateTickets->new(CurrentUser => $session{'CurrentUser'});
-;
-if ($ARGS{'Parse'} && $ARGS{'Template'}) {
-    $string = "";
-    my $cgi_object = $m->cgi_object;
-    my $fh = $cgi_object->upload('Template');
-    my $filename = "$fh";
-
-    my ($buffer, $template);
-    while ( my $bytesread = read( $fh, $buffer, 4096 ) ) {
-        $template .= $buffer;
-    }
-    my $encode = RT::I18N::_GuessCharset( $template );
-    require Encode;
-    $template = Encode::decode( $encode, $template );
-    $template =~ s/\r\n/\n/gs;
-    $action->Parse(Content => $template, Queue => $qname, Requestor => $requestoraddress);
-    foreach ( @{ $action->{'create_tickets'} } ) {
-        my $id = $_;
-        $id =~ s/^create\-//;
-        $string .= "===Create-Ticket: $id\n";
-        $string .= $action->{'templates'}->{$_} . "\n";
-    }
-    foreach ( @{ $action->{'update_tickets'} } ) {
-        my $id = $_;
-        $id =~ s/^update\-//;
-        $string .= "===Update-Ticket: $id\n";
-        $string .= $action->{'templates'}->{$_} . "\n";
-    }
-
-
-} elsif ($ARGS{'UpdateTickets'}) {
-    $action->Parse(Content => $ARGS{string}, Queue => $qname, Requestor=> $requestoraddress);
-    push @results, $action->CreateByTemplate();
-    push @results, $action->UpdateByTemplate();
-} else {
-    if ($ARGS{'Query'}) {
-        my $Tickets = RT::Tickets->new($session{'CurrentUser'});
-        $Tickets->FromSQL($ARGS{'Query'});
-
-        while (my $t = $Tickets->Next) {
-            $string .= "===Update-Ticket: " . $t->Id . "\n";
-            $string .= $action->GetUpdateTemplate($t);
-            $string .= "" . "\n";
-        }
-
-        $string .= "" . "\n";
-        $string .= "===# DO NOT EDIT BELOW THIS LINE#===\n";
-        $string .= "" . "\n";
-
-        while (my $t = $Tickets->Next) {
-            $string .= "===# DO NOT EDIT #===\n";
-                $string .= "===Base-Ticket: " . $t->Id . "\n";
-            $string .= $action->GetBaseTemplate($t);
-            $string .= "===# DO NOT EDIT #===\n";
-                $string .= "" . "\n";
-        }
-    } else {
-        $string .= "===Create-Ticket: ticket1\n";
-        $string .= $action->GetCreateTemplate();
-    }
-}
-</%INIT>
diff --git a/t/web/offline.t b/t/web/offline.t
deleted file mode 100644
index 06d5191..0000000
--- a/t/web/offline.t
+++ /dev/null
@@ -1,77 +0,0 @@
-use strict;
-use warnings;
-
-use RT::Test tests => 20;
-
-my ( $url, $m ) = RT::Test->started_ok;
-ok( $m->login, 'logged in' );
-
-{
-    my $template = <<EOF;
-===Create-Ticket: ticket1
-Queue: General
-Subject: test
-Status: new
-EOF
-    my $ticket = create_ticket_offline( $m, $template );
-    ok $ticket->id, 'created a ticket with offline tool';
-    is $ticket->QueueObj->Name, 'General', 'correct value';
-    is $ticket->Subject, 'test', 'correct value';
-    is $ticket->Status, 'new', 'correct value';
-}
-
-{
-    my $template = <<'EOF';
-===Create-Ticket: ticket1
-Queue: General
-Subject: test
-Status: new
-Requestor: test at example.com
-EOF
-    my $ticket = create_ticket_offline( $m, $template );
-    ok $ticket->id, 'created a ticket with offline tool';
-    is $ticket->RequestorAddresses, 'test at example.com', 'correct value';
-}
-
-{
-    my $group = RT::Group->new(RT->SystemUser);
-    my ($id, $msg) = $group->CreateUserDefinedGroup( Name => 'test' );
-    ok $id, "created a user defined group";
-
-    my $template = <<'EOF';
-===Create-Ticket: ticket1
-Queue: General
-Subject: test
-Status: new
-Requestor: test at example.com
-RequestorGroup: test
-EOF
-    my $ticket = create_ticket_offline( $m, $template );
-    ok $ticket->id, 'created a ticket with offline tool';
-    ok grep(
-        { $_->MemberId eq $group->id }
-        @{ $ticket->Requestors->MembersObj->ItemsArrayRef }
-    ), 'correct value' ;
-    is $ticket->RequestorAddresses, 'test at example.com', 'correct value';
-}
-
-sub create_ticket_offline {
-    my ($m, $template) = @_;
-
-    $m->get_ok( $url . '/Tools/Offline.html' );
-
-    $m->submit_form(
-        form_name => 'TicketUpdate',
-        fields    => { string => $template },
-        button    => 'UpdateTickets',
-    );
-
-    my $ticket = RT::Ticket->new( RT->SystemUser );
-    $m->content_like( qr/Ticket \d+ created/, 'found ticket created message' )
-        or return $ticket;
-
-    $ticket->Load( $m->content =~ /Ticket (\d+) created/ );
-    return $ticket;
-}
-
-
diff --git a/t/web/offline_messages_utf8.t b/t/web/offline_messages_utf8.t
deleted file mode 100644
index 4518c7b..0000000
--- a/t/web/offline_messages_utf8.t
+++ /dev/null
@@ -1,65 +0,0 @@
-use strict;
-use warnings;
-
-use RT::Test tests => 8;
-use Encode;
-use RT::Ticket;
-
-my ( $url, $m ) = RT::Test->started_ok;
-$m->default_header( 'Accept-Language' => "zh-tw" );
-ok( $m->login, 'logged in' );
-
-my $ticket_id;
-my $template;
-
-{
-
-    # test create message
-    $template = <<EOF;
-===Create-Ticket: ticket1
-Queue: General
-Subject: test message
-Status: new
-Content: 
-ENDOFCONTENT
-Due: 
-TimeEstimated: 100
-TimeLeft: 100
-FinalPriority: 90
-EOF
-
-    $m->get_ok( $url . '/Tools/Offline.html' );
-
-    $m->submit_form(
-        form_name => 'TicketUpdate',
-        fields    => { string => $template, },
-        button    => 'UpdateTickets',
-    );
-    my $content = encode 'utf8', $m->content;
-    ok( $content =~ m/申請單 #(\d+) 成功新增於 'General' 表單/, 'message is shown right' );
-    $ticket_id = $1;
-}
-
-{
-
-    # test update message
-    $template = <<EOF;
-===Update-Ticket: 1
-Subject: test message update
-EOF
-
-    $m->get_ok( $url . '/Tools/Offline.html' );
-    $m->submit_form(
-        form_name => 'TicketUpdate',
-        fields    => { string => $template, },
-        button    => 'UpdateTickets',
-    );
-
-    my $content = encode 'utf8', $m->content;
-    ok(
-        $content =~
-qr/主題\s*的值從\s*'test message'\s*改為\s*'test message update'/,
-        'subject is updated'
-    );
-}
-
diff --git a/t/web/offline_utf8.t b/t/web/offline_utf8.t
deleted file mode 100644
index c317a46..0000000
--- a/t/web/offline_utf8.t
+++ /dev/null
@@ -1,56 +0,0 @@
-use strict;
-use warnings;
-
-use RT::Test tests => 9;
-use utf8;
-
-use Encode;
-
-use RT::Ticket;
-my $file = File::Spec->catfile( RT::Test->temp_directory, 'template' );
-open my $fh, '>', $file or die $!;
-my $template = <<EOF;
-===Create-Ticket: ticket1
-Queue: General
-Subject: 标题
-Status: new
-Content: 
-这是正文
-ENDOFCONTENT
-EOF
-
-print $fh $template;
-close $fh;
-
-my ( $url, $m ) = RT::Test->started_ok;
-ok( $m->login, 'logged in' );
-
-$m->get_ok( $url . '/Tools/Offline.html' );
-
-$m->submit_form(
-    form_name => 'TicketUpdate',
-    fields    => { Template => $file, },
-    button    => 'Parse',
-);
-
-$m->content_contains( '这是正文', 'content is parsed right' );
-
-$m->submit_form(
-    form_name => 'TicketUpdate',
-    button    => 'UpdateTickets',
-
-    # mimic what browsers do: they seems decoded $template
-    fields    => { string => $template },
-);
-
-$m->content_like( qr/Ticket \d+ created/, 'found ticket created message' );
-my ( $ticket_id ) = $m->content =~ /Ticket (\d+) created/;
-
-my $ticket = RT::Ticket->new( RT->SystemUser );
-$ticket->Load( $ticket_id );
-is( $ticket->Subject, '标题', 'subject in $ticket is right' );
-
-$m->goto_ticket($ticket_id);
-$m->content_contains( '这是正文',
-    'content is right in ticket display page' );
-

-----------------------------------------------------------------------


More information about the Rt-commit mailing list