[Bps-public-commit] rt-extension-quickreply branch, master, updated. 8e88086f305b1ee99741219537c35c1d1bf46c2d

? sunnavy sunnavy at bestpractical.com
Wed Sep 18 14:12:31 EDT 2013


The branch, master has been updated
       via  8e88086f305b1ee99741219537c35c1d1bf46c2d (commit)
      from  c805f6216cb0d2485c1d2fe4a6c815d36100c710 (commit)

Summary of changes:
 META.yml                                           |  1 +
 README                                             |  3 ++
 etc/search_results.diff                            | 13 +++++
 .../QuickReply/Elements/RT__Ticket/ColumnMap/Once  | 13 +++++
 .../QuickReply/Search/Results.html/AfterResults    | 17 +++++++
 .../QuickReply/Search/Results.html/BeforeResults   | 10 ++++
 html/Ticket/Elements/QuickReply                    | 10 +++-
 html/Ticket/QuickReply.html                        | 55 ++++++++++++++++++++++
 lib/RT/Extension/QuickReply.pm                     |  4 ++
 9 files changed, 125 insertions(+), 1 deletion(-)
 create mode 100644 etc/search_results.diff
 create mode 100644 html/Callbacks/QuickReply/Elements/RT__Ticket/ColumnMap/Once
 create mode 100644 html/Callbacks/QuickReply/Search/Results.html/AfterResults
 create mode 100644 html/Callbacks/QuickReply/Search/Results.html/BeforeResults
 create mode 100644 html/Ticket/QuickReply.html

- Log -----------------------------------------------------------------
commit 8e88086f305b1ee99741219537c35c1d1bf46c2d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Sep 19 02:11:45 2013 +0800

    quick reply for search results

diff --git a/META.yml b/META.yml
index 13bf04d..3fdf50c 100644
--- a/META.yml
+++ b/META.yml
@@ -16,6 +16,7 @@ meta-spec:
 name: RT-Extension-QuickReply
 no_index:
   directory:
+    - etc
     - html
     - inc
 resources:
diff --git a/README b/README
index 51e4f61..3fb93bd 100644
--- a/README
+++ b/README
@@ -7,6 +7,9 @@ INSTALLATION
     "make install"
         May need root permissions
 
+    apply etc/search_results.diff
+            patch /path/to/rt/share/html/Search/Results.html < etc/search_results.diff
+
     Edit your /opt/rt4/etc/RT_SiteConfig.pm
         Add this line:
 
diff --git a/etc/search_results.diff b/etc/search_results.diff
new file mode 100644
index 0000000..6e12975
--- /dev/null
+++ b/etc/search_results.diff
@@ -0,0 +1,13 @@
+diff --git a/share/html/Search/Results.html b/share/html/Search/Results.html
+index d2856e9..4f6cdac 100644
+--- a/share/html/Search/Results.html
++++ b/share/html/Search/Results.html
+@@ -50,7 +50,7 @@
+     LinkRel => \%link_rel &>
+ <& /Elements/Tabs &>
+ 
+-% $m->callback( ARGSRef => \%ARGS, CallbackName => 'BeforeResults' );
++% $m->callback( ARGSRef => \%ARGS, Format => \$Format, CallbackName => 'BeforeResults' );
+ 
+ % unless ($ok) {
+ %    $msg =~ s{ at .*? line .*}{}s;
diff --git a/html/Callbacks/QuickReply/Elements/RT__Ticket/ColumnMap/Once b/html/Callbacks/QuickReply/Elements/RT__Ticket/ColumnMap/Once
new file mode 100644
index 0000000..454ee8c
--- /dev/null
+++ b/html/Callbacks/QuickReply/Elements/RT__Ticket/ColumnMap/Once
@@ -0,0 +1,13 @@
+<%INIT>
+$COLUMN_MAP->{QuickReply} = {
+    title => ' ',
+    value => sub {
+        my $link = q{<a class="quick-reply" href="#" ticket-id="} . $_[0]->id . q{">} . loc('Quick Reply') . '</a>';
+        return \$link;
+    },
+};
+
+</%INIT>
+<%ARGS>
+$COLUMN_MAP
+</%ARGS>
diff --git a/html/Callbacks/QuickReply/Search/Results.html/AfterResults b/html/Callbacks/QuickReply/Search/Results.html/AfterResults
new file mode 100644
index 0000000..0c62a85
--- /dev/null
+++ b/html/Callbacks/QuickReply/Search/Results.html/AfterResults
@@ -0,0 +1,17 @@
+<div id="quick-reply-container" name="quick-reply-container"></div>
+
+<script type="text/javascript">
+jQuery(function() {
+    jQuery('a.quick-reply').click( function() {
+        var ticket_id = jQuery(this).attr('ticket-id');
+        jQuery('#quick-reply-container').load('/Ticket/QuickReply.html?id=' + ticket_id,
+            function() {
+% if ( RT->Config->Get('MessageBoxRichText',  $session{'CurrentUser'})) {
+                ReplaceAllTextareas(0);
+% }
+            window.scrollTo(0, jQuery( "#quick-reply-container" ).position().top);
+        } );
+        return false;
+    });
+});
+</script>
diff --git a/html/Callbacks/QuickReply/Search/Results.html/BeforeResults b/html/Callbacks/QuickReply/Search/Results.html/BeforeResults
new file mode 100644
index 0000000..ea43bde
--- /dev/null
+++ b/html/Callbacks/QuickReply/Search/Results.html/BeforeResults
@@ -0,0 +1,10 @@
+<%INIT>
+if ( ref $Format ) {
+    $$Format .= q{,'__QuickReply__'} unless $$Format =~ /__QuickReply__/;
+}
+</%INIT>
+
+<%ARGS>
+$ARGSRef
+$Format => undef
+</%ARGS>
diff --git a/html/Ticket/Elements/QuickReply b/html/Ticket/Elements/QuickReply
index 28b394e..5a05352 100755
--- a/html/Ticket/Elements/QuickReply
+++ b/html/Ticket/Elements/QuickReply
@@ -47,9 +47,15 @@
 <&|/Widgets/TitleBox,
     title => loc("Quick Reply"),
 &>
-    <form action="<%$RT::WebPath%>/Ticket/Display.html" method="post" id="quick-reply">
+    <form action="<%$RT::WebPath%>/Ticket/Display.html" method="post" id="quick-reply" <% $PostToNewTab ? ' target="_blank"' : '' |n %>>
         <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
         <table border="0" width="100%">
+% if ( $ShowId ) {
+            <tr>
+                <td class="label">Id:</td>
+                <td><% $Ticket->id %></td>
+            </tr>
+% }
 % if ( $ShowStatus ) {
             <tr>
                 <td class="label">Status:</td>
@@ -126,5 +132,7 @@ return unless $CanRespond || $CanComment;
 </%INIT>
 <%ARGS>
 $ShowStatus => 1
+$ShowId => 0
+$PostToNewTab => 0
 $Ticket
 </%ARGS>
diff --git a/html/Ticket/QuickReply.html b/html/Ticket/QuickReply.html
new file mode 100644
index 0000000..40f07c5
--- /dev/null
+++ b/html/Ticket/QuickReply.html
@@ -0,0 +1,55 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%# 
+%# COPYRIGHT:
+%#  
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC 
+%#                                          <jesse 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., 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 }}}
+
+<& Elements/QuickReply, Ticket => $Ticket, ShowId => 1, PostToNewTab => 1 &>
+
+<%INIT>
+my $Ticket = LoadTicket($id);
+</%INIT>
+
+<%ARGS>
+$id
+</%ARGS>
diff --git a/lib/RT/Extension/QuickReply.pm b/lib/RT/Extension/QuickReply.pm
index 43707cd..7e3e0a0 100644
--- a/lib/RT/Extension/QuickReply.pm
+++ b/lib/RT/Extension/QuickReply.pm
@@ -20,6 +20,10 @@ RT-Extension-QuickReply - QuickReply on ticket display pages, etc.
 
 May need root permissions
 
+=item apply etc/search_results.diff
+
+    patch /path/to/rt/share/html/Search/Results.html < etc/search_results.diff
+
 =item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
 
 Add this line:

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



More information about the Bps-public-commit mailing list