[Rt-commit] rt branch, 4.4/include-article-queue, repushed

Craig Kaiser craig at bestpractical.com
Tue Feb 20 20:14:01 EST 2018


The branch 4.4/include-article-queue was deleted and repushed:
       was 54242d489829d4248fb26970c8e5b8ef634151ab
       now 7458fbe667da002c2135f9a87e001078c449bfb4

1: 2d2495159 < -:  ------- Add callback to Bulk.html at start of Init block
2: 39e6fc1a2 < -:  ------- Don't fail externalauth/auth_config.t tests if Net::LDAP is missing
3: eac112a02 < -:  ------- Set proper HTTP Status codes on Abort
4: db9b71e9c < -:  ------- Fix tests failing because they assume a 200 status response
5: 7ad0ed9e1 < -:  ------- Avoid spuriously unchecking all recipient checkboxes
6: 2d9444120 < -:  ------- Make RT owner dropdown limit a config option
-:  ------- > 1: 7177ac5c8 Add test for 'Order by' dropdown content
-:  ------- > 2: 06d49b393 Re-add Queue to 'Order by' dropdown in Search Builder
-:  ------- > 3: 9fa17efe4 find idle port for ldap test server
7: 73ea73c1e ! 4: 64676e64a Add support for Queue Default Article for web UI
    @@ -1,4 +1,4 @@
    -Author: Craig Kaiser <craig at bestpractical.com>
    +Author: craig Kaiser <craig at bestpractical.com>
     
         Add support for Queue Default Article for web UI
         
    @@ -15,7 +15,7 @@
          &>
     +
     +    <tr><td class="label"><&|/l&>Article</&>:</td>
    -+        <td><& /Elements/ArticleSelect, QueueObj => $queue, Default => $queue->DefaultValue('QueueDefaultArticle') &>
    ++        <td><& /Elements/SelectArticle, QueueObj => $queue &>
     +    </td></tr>
     +
          </table>
    @@ -26,7 +26,7 @@
      }
      elsif ( $ARGS{Update} ) {
     -    for my $field ( qw/InitialPriority FinalPriority Starts Due/ ) {
    -+    for my $field ( qw/InitialPriority FinalPriority Starts Due QueueDefaultArticle/ ) {
    ++    for my $field ( qw/InitialPriority FinalPriority Starts Due Article/ ) {
              my ($ret, $msg) = $queue->SetDefaultValue(
                  Name => $field,
                  Value => $ARGS{$field},
    @@ -35,30 +35,40 @@
     --- a/share/html/Articles/Elements/IncludeArticle
     +++ b/share/html/Articles/Elements/IncludeArticle
     @@
    +     && grep rindex($_, "$ARGS{'Name'}-Articles-", 0) == 0,
    +         keys %$parent_args;
    + 
    ++my $article_included = 0;
    + foreach my $arg ( keys %$parent_args ) {
    +     next if $name_prefix && substr($arg, 0, length($name_prefix)) ne $name_prefix;
    + 
    +@@
              Value => $parent_args->{$arg},
              Queue => $Queue->Id,
          );
     +
     +    # Check if Ticket id is present, if it is not we know we are creating a Ticket
    -+    if ( !$parent_args->{'id'} ){
    ++    if ( !$article_included && !$parent_args->{id} or $parent_args->{id} eq 'new' && $article && $article->id ){
     +        my $queue_id = $parent_args->{'Queue'};
     +
     +        my $QueueObj = RT::Queue->new($session{'CurrentUser'});
     +        $QueueObj->Load( $queue_id );
     +
    -+        if ($QueueObj->DefaultValue('QueueDefaultArticle') ){
    -+            $article->LoadByCols( Name => $QueueObj->DefaultValue('QueueDefaultArticle') );
    ++        if ($QueueObj->DefaultValue('Article') ){
    ++            $article->Load( $QueueObj->DefaultValue('Article') );
     +        }
    ++
    ++        $article_included = 1;
     +    }
     +
          next unless $article && $article->id;
      
          my $formatted_article = $m->scomp('/Articles/Article/Elements/Preformatted',
     
    -diff --git a/share/html/Elements/ArticleSelect b/share/html/Elements/ArticleSelect
    +diff --git a/share/html/Elements/SelectArticle b/share/html/Elements/SelectArticle
     new file mode 100644
     --- /dev/null
    -+++ b/share/html/Elements/ArticleSelect
    ++++ b/share/html/Elements/SelectArticle
     @@
     +%# BEGIN BPS TAGGED BLOCK {{{
     +%#
    @@ -106,11 +116,21 @@
     +%# works based on those contributions, and sublicense and distribute
     +%# those contributions and any derivatives thereof.
     +%#
    -+
    -+<& "SelectArticle$Widget", articles => $articles, QueueObj => $QueueObj, Default => $Default &>
    ++%# END BPS TAGGED BLOCK }}}
    ++% if ( $autocomplete ) {
    ++<& "SelectArticleAutocomplete", articles => $articles, QueueObj => $QueueObj, Default => $Default &>
    ++% } else {
    ++<select name='Article'>
    ++<option value="">-</option>
    ++% while (my $article = $articles->Next) {
    ++<option <% ( $article->Name eq $Default) ? qq[ selected="selected"] : '' |n %>
    ++    value="<%$article->Id%>"
    ++><% $article->Name %></option>
    ++% }
    ++</select>
    ++% }
     +
     +<%INIT>
    -+
     +my $articles = RT::Articles->new( $session{'CurrentUser'} );
     +$articles->LimitHotlistClasses;
     +$articles->LimitAppliedClasses( Queue => $QueueObj );
    @@ -118,21 +138,25 @@
     +my $dropdown_limit = 50;
     +$m->callback( CallbackName => 'ModifyDropdownLimit', DropdownLimit => \$dropdown_limit );
     +
    -+my $Widget =  $articles->Count > $dropdown_limit ? 'Autocomplete' : 'Dropdown';
    ++my $Default = '';
    ++
    ++my $autocomplete =  $articles->Count > $dropdown_limit ? 1 : 0;
     +
     +my $default_article = RT::Article->new($session{'CurrentUser'});
     +# Default Article is "" if no value selected
    -+if ( defined $QueueObj->DefaultValue('QueueDefaultArticle') && $QueueObj->DefaultValue('QueueDefaultArticle') ne "") {
    -+    my ($ret, $msg) = $default_article->LoadByCol( Name => $QueueObj->DefaultValue('QueueDefaultArticle') );
    -+    RT::Logger->error($msg) unless $ret;
    -+    $Default = $default_article->Name;
    ++if ( defined $QueueObj->DefaultValue('Article') && $QueueObj->DefaultValue($Name) ne "") {
    ++    my ($ret, $msg) = $default_article->Load( $QueueObj->DefaultValue('Article') );
    ++    if ($ret) {
    ++         $Default = $default_article->Name;
    ++        } else{
    ++        RT::Logger->error($msg);
    ++    }
     +}
    -+
     +</%INIT>
     +
     +<%ARGS>
     +$QueueObj
    -+$Default => ""
    ++$Name => 'Article'
     +</%ARGS>
     
     diff --git a/share/html/Elements/SelectArticleAutocomplete b/share/html/Elements/SelectArticleAutocomplete
    @@ -187,78 +211,11 @@
     +%# those contributions and any derivatives thereof.
     +%#
     +%# END BPS TAGGED BLOCK }}}
    -+<input data-autocomplete="Articles" data-autocomplete-return="Name" name='QueueDefaultArticle' value="<% $Default %>" selected>
    ++<input data-autocomplete="Articles" data-autocomplete-limit_queue=<% $QueueObj %> data-autocomplete-return="Name" name='Article' value="<% $Default %>" selected>
     +
     +<%ARGS>
    ++$QueueObj => ""
     +$Default => ""
     +</%ARGS>
     \ No newline at end of file
     
    -diff --git a/share/html/Elements/SelectArticleDropdown b/share/html/Elements/SelectArticleDropdown
    -new file mode 100644
    ---- /dev/null
    -+++ b/share/html/Elements/SelectArticleDropdown
    -@@
    -+%# BEGIN BPS TAGGED BLOCK {{{
    -+%#
    -+%# COPYRIGHT:
    -+%#
    -+%# This software is Copyright (c) 1996-2017 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 }}}
    -+
    -+<select name='QueueDefaultArticle'>
    -+<option value="">-</option>
    -+% while (my $article = $articles->Next) {
    -+<option <% ( $article->Name eq $Default) ? qq[ selected="selected"] : '' |n %>
    -+    value="<%$article->Name%>"
    -+><% $article->Name %></option>
    -+% }
    -+</select>
    -+
    -+<%ARGS>
    -+$articles
    -+$Default => undef
    -+</%ARGS>
    -+
    -
8: b4a79f43d ! 5: 6704b2405 Add autocomplete for Articles
    @@ -1,4 +1,4 @@
    -Author: Craig Kaiser <craig at bestpractical.com>
    +Author: craig Kaiser <craig at bestpractical.com>
     
         Add autocomplete for Articles
     
    @@ -63,6 +63,7 @@
     +$op         => 'STARTSWITH'
     +$right      => undef
     +$return     => 'Name'
    ++$limit_queue => undef
     +</%ARGS>
     +<%INIT>
     +# Only allow certain return fields
    @@ -79,6 +80,11 @@
     +$m->callback( CallbackName => 'ModifyMaxResults', max => \$max );
     +
     +my $articles = RT::Articles->new( $session{CurrentUser} );
    ++$articles->LimitHotlistClasses;
    ++if( $limit_queue ) {
    ++    $articles->LimitAppliedClasses( Queue => $limit_queue );
    ++}
    ++
     +$articles->RowsPerPage( $max );
     +$articles->Limit(
     +    FIELD           => 'Name',
    @@ -96,6 +102,7 @@
     +    $m->callback( CallbackName => "ModifySuggestion", suggestions => @suggestions, label => $a );
     +}
     +</%INIT>
    +\ No newline at end of file
     
     diff --git a/share/static/js/autocomplete.js b/share/static/js/autocomplete.js
     --- a/share/static/js/autocomplete.js
9: 54242d489 ! 6: 7458fbe66 Test Ticket create web UI when Default Article
    @@ -1,4 +1,4 @@
    -Author: Craig Kaiser <craig at bestpractical.com>
    +Author: craig Kaiser <craig at bestpractical.com>
     
         Test Ticket create web UI when Default Article
         
    @@ -34,7 +34,7 @@
     +my $queue = RT::Queue->new(RT->SystemUser);
     +$queue->Load('General');
     +ok( $queue, 'Loaded General Queue' );
    -+($ret, $msg) = $queue->SetDefaultValue( Name => 'QueueDefaultArticle', Value => $article->Name);
    ++($ret, $msg) = $queue->SetDefaultValue( Name => 'Article', Value => $article->Id);
     +ok( $ret, $msg );
     +
     +ok $m->login(root => 'password'), "logged in";



More information about the rt-commit mailing list