[Rt-commit] rt branch, 4.6/configindatabase-themed, updated. rt-4.4.4-410-g00e8652b9

Michel Rodriguez michel at bestpractical.com
Wed Oct 9 10:22:32 EDT 2019


The branch, 4.6/configindatabase-themed has been updated
       via  00e8652b98a9c5d446e11f758be085c7a3d1b4af (commit)
      from  6d2a637167b1f90a27dd68e7a9df10ea8f6e6105 (commit)

Summary of changes:
 lib/RT/Config.pm                                  | 37 ++++++++++---
 share/html/Admin/Tools/Config/Elements/Option     | 51 +++++++++++++++++-
 share/html/Admin/Tools/Config/Elements/Section    | 48 +++++++++++++++++
 share/html/Admin/Tools/Config/Elements/SubSection | 50 +++++++++++++++++
 share/html/Admin/Tools/Config/Elements/Tab        | 48 +++++++++++++++++
 share/html/Admin/Tools/EditConfig.html            |  2 +-
 share/html/Prefs/Other.html                       |  4 +-
 share/html/Widgets/BulkEdit                       |  3 +-
 share/html/Widgets/FinalizeWidgetArguments        | 65 -----------------------
 share/html/Widgets/Form/String                    |  6 +--
 10 files changed, 233 insertions(+), 81 deletions(-)
 delete mode 100644 share/html/Widgets/FinalizeWidgetArguments

- Log -----------------------------------------------------------------
commit 00e8652b98a9c5d446e11f758be085c7a3d1b4af
Author: michel <michel at bestpractical.com>
Date:   Tue Oct 8 22:45:12 2019 +0200

    Fixes failing tests due to undefined variables

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 4c2deb479..d67fcfba8 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -620,19 +620,19 @@ our %META;
     },
     CanonicalizeEmailAddressMatch => {
         Section         => 'Mail',                                     #loc
-        Type    => 'SCALAR',
+        Type            => 'SCALAR',
         Overridable     => 1,
         Widget          => '/Widgets/Form/String',
     },
     CanonicalizeEmailAddressReplace => {
         Section         => 'Mail',                                     #loc
-        Type    => 'SCALAR',
+        Type            => 'SCALAR',
         Overridable     => 1,
         Widget          => '/Widgets/Form/String',
     },
     EmailSubjectTagRegex => {
         Section         => 'Mail',                                     #loc
-        Type    => 'SCALAR',
+        Type            => 'SCALAR',
         Overridable     => 1,
         Widget          => '/Widgets/Form/String',
     },
@@ -2021,7 +2021,7 @@ sub LoadSectionMap {
                 $CurrentSubSectionName='';
             }
             else {
-                warn( "section $CurrentSectionName not found in SectionMap\n");
+                RT->Logger->debug( "section $CurrentSectionName not found in SectionMap\n");
             }
         }
         elsif( $tag eq 'h2') {
@@ -2044,7 +2044,7 @@ sub LoadSectionMap {
                 }
                 else {
                     my $TabName= $SectionIndex{$CurrentSectionName}->{Name};
-                    warn( "missing META info for option [$option]\n");
+                    RT->Logger->debug( "missing META info for option [$option]\n");
                 }
             }
         }
@@ -2056,7 +2056,8 @@ sub LoadSectionMap {
 sub name_to_id {
     my $self = shift;
     my $name = shift;
-    my $id = lc( $name) =~ s{[^a-z0-9]+}{-}gr;
+    my $id = lc( $name);
+    $id =~ s{[^a-z0-9]+}{-}g;
     return $id;
 }
 
@@ -2102,6 +2103,29 @@ sub section_is_active {
     }
     return $active;
 }
+
+# localizes widget arguments for configuration editing
+sub FinalizeWidgetArguments {
+    my $self= shift;
+    my $WidgetArguments = shift;
+
+    return () if ! $WidgetArguments;
+    my %args = %$WidgetArguments;
+
+    %args = (%args, %{ $args{Callback}->() }) if $args{Callback};
+    $args{'Description'} = loc( $args{'Description'} ) if $args{'Description'};
+    $args{'Hints'} = loc( $args{'Hints'} ) if $args{'Hints'};
+    if ( $args{'ValuesLabel'} ) {
+        my %labels;
+        $labels{$_} = loc( $args{'ValuesLabel'}->{$_} )
+            for keys %{$args{'ValuesLabel'}};
+        $args{'ValuesLabel'} = \%labels;
+    }
+    return %args;
+}
+
+sub loc { HTML::Mason::Commands::loc( @_ ); }
+
 =head2 Configs
 
 Returns list of config files found in local etc, plugins' etc
@@ -2550,6 +2574,7 @@ sub RefreshConfigFromDatabase {
         $in_config_change_txn = 0;
     }
 
+    if( RT->InstallMode ) { return; } # RT can't load the config in the DB if the DB is not there!
     my $needs_update = RT->System->ConfigCacheNeedsUpdate;
     if ($needs_update > $database_config_cache_time) {
         $self->LoadConfigFromDatabase();
diff --git a/share/html/Admin/Tools/Config/Elements/Option b/share/html/Admin/Tools/Config/Elements/Option
index 222a06366..ff9289f1f 100644
--- a/share/html/Admin/Tools/Config/Elements/Option
+++ b/share/html/Admin/Tools/Config/Elements/Option
@@ -1,3 +1,51 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2019 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 }}}
+
 <%PERL>
 
 use Data::Dumper;
@@ -88,8 +136,7 @@ my $row_end = qq{</span></div>};
     Default      => 1,
     DefaultValue => '',
     DefaultLabel => '(no value)',
-
-    %{ $m->comp('/Widgets/FinalizeWidgetArguments', WidgetArguments => $args ) },
+    RT->Config->FinalizeWidgetArguments( $args ),
     Name         => $name,
     LabelLink    => $doc_url,
     CurrentValue => $current_value,
diff --git a/share/html/Admin/Tools/Config/Elements/Section b/share/html/Admin/Tools/Config/Elements/Section
index c03626643..cfcbeb3f0 100644
--- a/share/html/Admin/Tools/Config/Elements/Section
+++ b/share/html/Admin/Tools/Config/Elements/Section
@@ -1,3 +1,51 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2019 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 }}}
+
 % my $section_id= RT->Config->name_to_id( $section->{Name} );
 
 % foreach my $subsection ( @{$section->{Content}} ) {
diff --git a/share/html/Admin/Tools/Config/Elements/SubSection b/share/html/Admin/Tools/Config/Elements/SubSection
index 1b3b3c956..d404bb432 100644
--- a/share/html/Admin/Tools/Config/Elements/SubSection
+++ b/share/html/Admin/Tools/Config/Elements/SubSection
@@ -1,3 +1,52 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2019 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 }}}
+
+% if( @{$subsection->{Content}}) {
 % my $id = RT->Config->edit_config_id( type => 'form', level => 'subsection', context => $current_context);
 <form id="<% $id %>" name="EditConfig" method="post" action="EditConfig.html#<% $id %>">
     <input type="hidden" name="Update" value="1" />
@@ -16,6 +65,7 @@
 <& /Elements/Submit, Label => loc('Save Changes') &>
 </&>
 </form>
+% }
 <%ARGS>
 $subsection
 $active_context
diff --git a/share/html/Admin/Tools/Config/Elements/Tab b/share/html/Admin/Tools/Config/Elements/Tab
index 7477fa920..226ca9ef7 100644
--- a/share/html/Admin/Tools/Config/Elements/Tab
+++ b/share/html/Admin/Tools/Config/Elements/Tab
@@ -1,3 +1,51 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2019 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 }}}
+
 % my $nav_type = 'tab'; # 'tab' or 'pill'
 % my $tab_id= RT->Config->name_to_id( $tab->{Name} );
 <div class="row">
diff --git a/share/html/Admin/Tools/EditConfig.html b/share/html/Admin/Tools/EditConfig.html
index 6b40f4898..baa0fa500 100644
--- a/share/html/Admin/Tools/EditConfig.html
+++ b/share/html/Admin/Tools/EditConfig.html
@@ -203,7 +203,7 @@ my $nav_type='tab'; # 'tab' or 'pill'
 % #<&|/Widgets/TitleBox, title => loc("RT Configuration") &>
 <div class="tab-content" id="content-all" >
 % foreach my $tab ( @$options) {
-%     my $tab_id= lc( $tab->{Name}) =~ s{[^a-z]+}{-}gr;
+%     my $tab_id= RT->Config->name_to_id( $tab->{Name} );
 %     $current_context->{tab}= $tab_id;
 %     my $active = $tab_id eq $active_context->{tab} ? ' show active' : '';
 %     my $nav_id = RT->Config->edit_config_id( type => 'nav', level => 'tab', context => $current_context); 
diff --git a/share/html/Prefs/Other.html b/share/html/Prefs/Other.html
index b1fb9a539..a64b0c9ad 100644
--- a/share/html/Prefs/Other.html
+++ b/share/html/Prefs/Other.html
@@ -57,8 +57,8 @@
 % my $meta = RT->Config->Meta( $option );
 <& $meta->{'Widget'},
     Default      => 1,
-    %{ $m->comp('/Widgets/FinalizeWidgetArguments', WidgetArguments =>
-            $meta->{'WidgetArguments'} ) },
+    Description  => $option,
+    RT->Config->FinalizeWidgetArguments( $meta->{'WidgetArguments'} ),
     Name         => $option,
     DefaultValue => scalar RT->Config->Get( $option ),
     CurrentValue => $preferences->{ $option },
diff --git a/share/html/Widgets/BulkEdit b/share/html/Widgets/BulkEdit
index af09f0933..e0b6415bf 100644
--- a/share/html/Widgets/BulkEdit
+++ b/share/html/Widgets/BulkEdit
@@ -48,8 +48,7 @@
 % for my $type ( @$Types ) {
 <& $Meta->{$type}{'Widget'},
     Default      => $Default,
-    %{ $m->comp('/Widgets/FinalizeWidgetArguments', WidgetArguments =>
-            $Meta->{$type}{'WidgetArguments'} ) },
+    RT->Config->FinalizeWidgetArguments( $Meta->{$type}{'WidgetArguments'} ),
     Name         => $type,
     exists $CurrentValue->{$type} ? ( CurrentValue => $CurrentValue->{$type} )
         : (),
diff --git a/share/html/Widgets/FinalizeWidgetArguments b/share/html/Widgets/FinalizeWidgetArguments
deleted file mode 100644
index f742fb454..000000000
--- a/share/html/Widgets/FinalizeWidgetArguments
+++ /dev/null
@@ -1,65 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2019 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 }}}
-<%init>
-    my %args = %$WidgetArguments;
-
-    %args = (%args, %{ $args{Callback}->() }) if $args{Callback};
-    $args{'Description'} = loc( $args{'Description'} ) if $args{'Description'};
-    $args{'Hints'} = loc( $args{'Hints'} ) if $args{'Hints'};
-    if ( $args{'ValuesLabel'} ) {
-        my %labels;
-        $labels{$_} = loc( $args{'ValuesLabel'}->{$_} )
-            for keys %{$args{'ValuesLabel'}};
-        $args{'ValuesLabel'} = \%labels;
-    }
-    return \%args;
-</%init>
-
-<%args>
-$WidgetArguments => {}
-</%args>
diff --git a/share/html/Widgets/Form/String b/share/html/Widgets/Form/String
index cb763f7a4..3755d6a7e 100644
--- a/share/html/Widgets/Form/String
+++ b/share/html/Widgets/Form/String
@@ -53,7 +53,7 @@ see docs/extending/using_forms_widgets.pod
 % if( $LabelLink ) {
     <a href="<% $LabelLink %>"><% $Description %></a>
 % } else {
-    <% $Description %>
+    <% $Description // '' %>
 % }
   </span>
   <span class="col-md-9 value">
@@ -74,12 +74,12 @@ $CurrentValue => '',
 
 $Default        => 0,
 $DefaultValue   => '',
-$DefaultLabel   => loc( 'Default: [_1]', $DefaultValue ),
+$DefaultLabel   => loc( 'Default: [_1]', $DefaultValue // '' ),
 $LabelLink      => '',
 </%ARGS>
 
 <%METHOD InputOnly>
-<input type="<% $Type %>" name="<% $Name %>" size="<% $Size %>" value="<% $CurrentValue || '' %>" class="form-control" />\
+<input type="<% $Type %>" name="<% $Name %>" size="<% $Size %>" value="<% $CurrentValue // '' %>" class="form-control" />\
 <%ARGS>
 $Name
 $CurrentValue => '',

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


More information about the rt-commit mailing list