Skip to content

Commit

Permalink
0.01
Browse files Browse the repository at this point in the history
  • Loading branch information
obra committed Sep 24, 2007
1 parent fd361f3 commit ad84796
Show file tree
Hide file tree
Showing 22 changed files with 1,765 additions and 0 deletions.
22 changes: 22 additions & 0 deletions MANIFEST
@@ -0,0 +1,22 @@
etc/3.6.1/ShowSearch
html/Callbacks/RT-Extension-QuickDelete/Elements/RT__Ticket/ColumnMap/ColumnMap
html/Callbacks/RT-Extension-QuickDelete/Ticket/Elements/Tabs/Default
html/RT-Extension-QuickDelete/Toggle
html/RT-Extension-QuickDelete/ToggleQuickDelete
inc/Module/Install.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/RTx.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
lib/RT/Extension/QuickDelete.pm
Makefile.PL
MANIFEST This list of files
META.yml
README
t/00.load.t
t/pod-coverage.t
t/pod.t
19 changes: 19 additions & 0 deletions META.yml
@@ -0,0 +1,19 @@
---
abstract: Adds q "quick delete" button" to RT's standard ticket search interface
author: Jesse Vincent <jesse@bestpractical.com>
distribution_type: module
generated_by: Module::Install version 0.670
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.3.html
version: 1.3
name: RT-Extension-QuickDelete
no_index:
directory:
- etc
- html
- inc
- t
requires:
Test::More: 0
version: 0.03
10 changes: 10 additions & 0 deletions Makefile.PL
@@ -0,0 +1,10 @@
use inc::Module::Install;

RTx('RT-Extension-QuickDelete');
author ('Jesse Vincent <jesse@bestpractical.com>');
version_from ('lib/RT/Extension/QuickDelete.pm');
abstract_from('lib/RT/Extension/QuickDelete.pm');
license('perl');
requires('Test::More');

&WriteAll;
61 changes: 61 additions & 0 deletions README
@@ -0,0 +1,61 @@
NAME
RT::Extension::QuickDelete - Adds q "quick delete" button" to RT's
standard ticket search interface

SYNOPSIS
perl Makefile.PL
make install
make initdb

# If you're using RT 3.6.0 or RT 3.6.1, copy etc/3.6.1/ShowSearch to /opt/rt3/share/html/Elements/ShowSearch
# (This changed file is already included in RT 3.6.2)

# Update your default RT search results format to include favorites link by adding this to your RT_SiteConfig.pm:

Set ($DefaultSearchResultFormat, qq{
'<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
'<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
Status,
QueueName,
OwnerName,
Priority,
QuickDelete,
'__NEWLINE__',
'',
'<small>__Requestors__</small>',
'<small>__CreatedRelative__</small>',
'<small>__ToldRelative__</small>',
'<small>__LastUpdatedRelative__</small>',
'<small>__TimeLeft__</small>'});

AUTHOR
Jesse Vincent "<jesse@bestpractical.com>"

LICENCE AND COPYRIGHT
Copyright (c) 2007, Best Practical Solutions, LLC. All rights reserved.

This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

104 changes: 104 additions & 0 deletions etc/3.6.1/ShowSearch
@@ -0,0 +1,104 @@
%# BEGIN BPS TAGGED BLOCK {{{
%#
%# COPYRIGHT:
%#
%# This software is Copyright (c) 1996-2006 Best Practical Solutions, LLC
%# <jesse@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., 675 Mass Ave, Cambridge, MA 02139, USA.
%#
%#
%# 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 }}}
<&|/Widgets/TitleBox,
title => loc($search->Description, $SearchArg->{'Rows'}),
title_href => "Search/Results.html".$QueryString,
titleright => loc('Edit'),
titleright_href => $customize &>
<& /Elements/TicketList, %$SearchArg,
ShowNavigation => 0
&>
</&>
<%init>
my $search;
my $user = $session{'CurrentUser'}->UserObj;
my $SearchArg;
my $customize;

if ($SavedSearch) {
my ($container_object, $search_id ) = _parse_saved_search ($SavedSearch);
$search = $container_object->Attributes->WithId($search_id);
unless ($search->Id && ref ($SearchArg = $search->Content) eq 'HASH') {
$m->out ("Saved Search $SavedSearch not found");
return;
}
$customize = $RT::WebPath.'/Search/Build.html?'.
$m->comp('/Elements/QueryString',
LoadSavedSearch => $SavedSearch);
}
else {
($search) = RT::System->new($session{'CurrentUser'})->Attributes->Named('Search - '.$Name);
unless ($search && $search->Id) {
$m->out ("Predefined search $Name not found");
return;
}
$SearchArg = $user->Preferences($search, $search->Content);
$SearchArg->{'Rows'} = $user->Preferences('SummaryRows', $RT::DefaultSummaryRows);
$customize = $RT::WebPath.'/Prefs/Search.html?'.$m->comp('/Elements/QueryString', name => ref($search).'-'.$search->Id)
}

$SearchArg->{'Query'} =~ s/__CurrentUser__/$session{'CurrentUser'}->Id/ge;
$SearchArg->{'Format'} =~ s/__WebPath__/$RT::WebPath/g;
$SearchArg->{'Format'} =~ s/__loc\(["']?(\w+)["']?\)__/loc("$1")/ge;

$m->comp(
'/Elements/Callback',
_CallbackName => 'ModifySearch',
Search => $SearchArg,
%ARGS
);



my $QueryString = '?' . $m->comp('/Elements/QueryString',
%$SearchArg);
#map { $_ => $SearchArg->{$_} } qw(Query Order OrderBy));

</%init>
<%ARGS>
$Name => undef
$SavedSearch => undef
</%ARGS>
@@ -0,0 +1,14 @@
<%ARGS>
$COLUMN_MAP => undef
</%ARGS>
<%init>
$COLUMN_MAP->{'QuickDelete'} = {
title => ' ',
value => sub {
my $ticket = shift;
return $m->comp( '/RT-Extension-QuickDelete/Toggle',
id => $ticket->id );
}
};
</%init>

@@ -0,0 +1,34 @@
%# BEGIN LICENSE BLOCK
%#
%# Copyright (c) 2002-2003 Jesse Vincent <jesse@bestpractical.com>
%#
%# This program is free software; you can redistribute it and/or modify
%# it under the terms of version 2 of the GNU General Public License
%# as published by the Free Software Foundation.
%#
%# A copy of that license should have arrived with this
%# software, but in any event can be snarfed from www.gnu.org.
%#
%# This program 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.
%#
%# END LICENSE BLOCK

<%init>
if ($Ticket) {
$actions->{'_ZZ-QuickDelete'} = {
html => $m->scomp(
'/RT-Extension-QuickDelete/Toggle',
id => $Ticket->id,
toggle => 0
)
};
}

</%init>
<%args>
$Ticket => undef
$actions => undef
</%args>
24 changes: 24 additions & 0 deletions html/RT-Extension-QuickDelete/Toggle
@@ -0,0 +1,24 @@
<%init>
my $ticket =LoadTicket($id);
if ($toggle && $ticket->Status eq 'deleted') {
$ticket->SetStatus('open');
} elsif ($toggle) {

$ticket->SetStatus('deleted');
}

</%init>
<%args>
$id
$toggle => 0
</%args>
<span id="toggle-<%$id%>">
% my $url = $RT::WebPath."/RT-Extension-QuickDelete/ToggleQuickDelete?id=".$id;
<a align="right" href="<%$url|n%>" onClick="ahah('<%$url|n%>', 'toggle-<%$id|n%>'); return false;" >
% if ($ticket->Status ne 'deleted') {
Delete
% } else {
Undelete
% }
</a>
</span>
8 changes: 8 additions & 0 deletions html/RT-Extension-QuickDelete/ToggleQuickDelete
@@ -0,0 +1,8 @@
<%args>
$id
</%args>
<%init>
$m->comp('Toggle', id => $id, toggle => 1);
$m->abort();
</%init>

0 comments on commit ad84796

Please sign in to comment.