[Rt-commit] rt branch, 4.6/configindatabase-themed, repushed

Michel Rodriguez michel at bestpractical.com
Fri Oct 25 11:17:15 EDT 2019


The branch 4.6/configindatabase-themed was deleted and repushed:
       was 5480310b20bb2fc01b7eef8bf921c166624714a4
       now 2ed7c8633e12f2200ba40de9e7b081778bcc0175

 1: d4f253784 < --:  ------- finished rebase
 2: 2d3d7fc01 !  1: 8e91b3d5e Add RadioStyle option to Boolean widget
    @@ -22,12 +22,4 @@
      <input type="hidden" name="<% $Name %>" value="0" />\
      <div class="custom-control custom-checkbox">
        <input type="checkbox" id="<% $Name %>" name="<% $Name %>" class="custom-control-input" value="1" <% $CurrentValue? ' checked="checked"': '' |n %>>
    -@@
    -   </div>
    - </div>
    - % }
    -+% }
    - </%METHOD>
    - 
    - <%METHOD Process>
     
 3: db257822a < --:  ------- Make booleans with RadioStyle use true/false logic
 4: 0db9e30d5 =  2: 53c43bf1e DatabaseSetting schema updates
 5: bc46020c5 =  3: b6ff51392 Add ORM classes for DatabaseSettings
 6: 8ef035749 =  4: ff47365a0 Port database config loading and refreshing from extension
 7: 2dea073d0 =  5: a740b7b26 Add Code and MultilineString widgets
 8: 82d083851 =  6: 42667e9e1 Port EditConfig page from extension
 9: 34cdedd13 =  7: d54a91b4d Annotate Immutable options
10: f97f98a77 =  8: 904c41ee3 Add widget metadata for config options
11: 0637f0ce4 =  9: 8f5a024fd Hide deprecated options
12: 75d5e1352 = 10: eee0dfdcc List Database as source of configuration on Sys Config page
13: b08595411 = 11: cedebbe0e Render config with EditLink as readonly
14: 3e0bdb641 ! 12: 303ce8892 Adds tabs to the Configuration in DB feature
    @@ -1,6 +1,11 @@
     Author: michel <michel at bestpractical.com>
     
         Adds tabs to the Configuration in DB feature
    +    
    +    The tab/section structure is set in Config.pm, subsections
    +    are defined by parsing RT_Config.pm.
    +    
    +    The whole page now uses bootstrap with 4.6 styles.
     
     diff --git a/etc/RT_SiteConfig.pm b/etc/RT_SiteConfig.pm
     deleted file mode 100644
    @@ -62,19 +67,19 @@
          },
     +    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',
     +    },
    @@ -242,7 +247,7 @@
     +                $CurrentSubSectionName='';
     +            }
     +            else {
    -+                warn( "section $CurrentSectionName not found in SectionMap\n");
    ++                RT->Logger->debug( "section $CurrentSectionName not found in SectionMap\n");
     +            }
     +        }
     +        elsif( $tag eq 'h2') {
    @@ -265,7 +270,7 @@
     +                }
     +                else {
     +                    my $TabName= $SectionIndex{$CurrentSectionName}->{Name};
    -+                    warn( "missing META info for option [$option]\n");
    ++                    RT->Logger->debug( "missing META info for option [$option]\n");
     +                }
     +            }
     +        }
    @@ -277,7 +282,8 @@
     +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;
     +}
     +
    @@ -323,15 +329,94 @@
     +    }
     +    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
    +@@
    +         $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
     new file mode 100644
     --- /dev/null
     +++ b/share/html/Admin/Tools/Config/Elements/Option
     @@
    ++%# 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;
    @@ -422,8 +507,7 @@
     +    Default      => 1,
     +    DefaultValue => '',
     +    DefaultLabel => '(no value)',
    -+
    -+    %{ $m->comp('/Widgets/FinalizeWidgetArguments', WidgetArguments => $args ) },
    ++    RT->Config->FinalizeWidgetArguments( $args ),
     +    Name         => $name,
     +    LabelLink    => $doc_url,
     +    CurrentValue => $current_value,
    @@ -435,15 +519,37 @@
     +<!-- end option <% $name %> -->
     +<%ARGS>
     +$option
    -+</%ARGS> 
    -
    -diff --git a/share/html/Admin/Tools/Config/Elements/Section b/share/html/Admin/Tools/Config/Elements/Section
    -new file mode 100644
    ---- /dev/null
    ++</%ARGS>
    +
    +diff --git a/share/html/Widgets/FinalizeWidgetArguments b/share/html/Admin/Tools/Config/Elements/Section
    +similarity index 79%
    +rename from share/html/Widgets/FinalizeWidgetArguments
    +rename to share/html/Admin/Tools/Config/Elements/Section
    +--- a/share/html/Widgets/FinalizeWidgetArguments
     +++ b/share/html/Admin/Tools/Config/Elements/Section
     @@
    + %# 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>
     +% my $section_id= RT->Config->name_to_id( $section->{Name} );
    -+
    + 
    +-<%args>
    +-$WidgetArguments => {}
    +-</%args>
     +% foreach my $subsection ( @{$section->{Content}} ) {
     +%     $current_context->{subsection}= RT->Config->name_to_id( $subsection->{Name});
     +  <& /Admin/Tools/Config/Elements/SubSection, subsection => $subsection, active_context => $active_context, current_context => $current_context &>
    @@ -453,13 +559,62 @@
     +$section
     +$active_context
     +$current_context
    -+</%ARGS> 
    ++</%ARGS>
     
     diff --git a/share/html/Admin/Tools/Config/Elements/SubSection b/share/html/Admin/Tools/Config/Elements/SubSection
     new file mode 100644
     --- /dev/null
     +++ b/share/html/Admin/Tools/Config/Elements/SubSection
     @@
    ++%# 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" />
    @@ -478,17 +633,66 @@
     +<& /Elements/Submit, Label => loc('Save Changes') &>
     +</&>
     +</form>
    ++% }
     +<%ARGS>
     +$subsection
     +$active_context
     +$current_context
    -+</%ARGS> 
    ++</%ARGS>
     
     diff --git a/share/html/Admin/Tools/Config/Elements/Tab b/share/html/Admin/Tools/Config/Elements/Tab
     new file mode 100644
     --- /dev/null
     +++ b/share/html/Admin/Tools/Config/Elements/Tab
     @@
    ++%# 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">
    @@ -541,7 +745,7 @@
     +$tab
     +$active_context
     +$current_context
    -+</%ARGS> 
    ++</%ARGS>
     
     diff --git a/share/html/Admin/Tools/EditConfig.html b/share/html/Admin/Tools/EditConfig.html
     --- a/share/html/Admin/Tools/EditConfig.html
    @@ -681,13 +885,10 @@
     -    Hints        => '',
     -  &>
     -<textarea class="hidden" name="<% $key %>-Current"><% $current_value %></textarea>
    --% }
    --</td>
    --</tr>
     +% #<&|/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); 
    @@ -696,13 +897,45 @@
     +  <& /Admin/Tools/Config/Elements/Tab, tab => $tab, active_context => $active_context, current_context => $current_context &>
     +</div><!-- <% $content_id %> -->
      % }
    +-</td>
    +-</tr>
    +-% }
     -</table>
     -</&>
     -<& /Elements/Submit, Label => loc('Save Changes') &>
     -</form>
    +-
     +%#</&>
     +</div><!-- content-all -->
    - 
    +
    +diff --git a/share/html/Prefs/Other.html b/share/html/Prefs/Other.html
    +--- a/share/html/Prefs/Other.html
    ++++ b/share/html/Prefs/Other.html
    +@@
    + % 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
    +--- a/share/html/Widgets/BulkEdit
    ++++ b/share/html/Widgets/BulkEdit
    +@@
    + % 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/Form/Boolean b/share/html/Widgets/Form/Boolean
     --- a/share/html/Widgets/Form/Boolean
    @@ -782,6 +1015,15 @@
      </%ARGS>
      
      <%METHOD InputOnly>
    +-<input type="text" name="<% $Name %>" value="<% $CurrentValue %>" class="form-control" />\
    ++<input type="text" name="<% $Name %>" size="<% $Size %>" value="<% $CurrentValue %>" class="form-control" />\
    + <%ARGS>
    + $Name
    + $CurrentValue => '',
    ++$Size => 20
    + </%ARGS>
    + <%INIT>
    + $CurrentValue = '' unless defined $CurrentValue;
     
     diff --git a/share/html/Widgets/Form/MultilineString b/share/html/Widgets/Form/MultilineString
     --- a/share/html/Widgets/Form/MultilineString
    @@ -857,14 +1099,13 @@
      </%DOC>
      <div id="form-box-<% lc $Name %>" class="widget form-row">
     -  <div class="col-md-3 label">
    --    <% $Description // '' %>
    --  </div>
    --  <div class="col-md-9 value">
     +  <span class="col-md-3 label">
     +% if( $LabelLink ) {
     +    <a href="<% $LabelLink %>"><% $Description %></a>
     +% } else {
    -+    <% $Description %>
    +     <% $Description // '' %>
    +-  </div>
    +-  <div class="col-md-9 value">
     +% }
     +  </span>
     +  <span class="col-md-9 value">
    @@ -879,11 +1120,23 @@
      <%ARGS>
      $Name
     @@
    + 
      $Default        => 0,
      $DefaultValue   => '',
    - $DefaultLabel   => loc( 'Default: [_1]', $DefaultValue ),
    +-$DefaultLabel   => loc( 'Default: [_1]', $DefaultValue ),
    ++$DefaultLabel   => loc( 'Default: [_1]', $DefaultValue // '' ),
     +$LabelLink      => '',
      </%ARGS>
      
      <%METHOD InputOnly>
    -
    +-<input type="<% $Type %>" name="<% $Name %>" value="<% $CurrentValue || '' %>" class="form-control" />\
    ++<input type="<% $Type %>" name="<% $Name %>" size="<% $Size %>" value="<% $CurrentValue // '' %>" class="form-control" />\
    + <%ARGS>
    + $Name
    + $CurrentValue => '',
    + $Type => 'text'
    ++$Size => 20
    + </%ARGS>
    + </%METHOD>
    + 
    +
15: 2472c0dda < --:  ------- Fixes failing tests due to undefined variables
16: bf36648f2 = 13: 9cdc2ce75 Uses bootstrap pill for section left column menu
17: 48543bb56 = 14: 9e5ea242f Switch from Storable::dclone to Clone::clone to handle code/regex
18: 5480310b2 ! 15: 471d21055 Fix index of "Disabled" for mysql
    @@ -12,3 +12,4 @@
     -CREATE UNIQUE INDEX DatabaseSettings2 ON DatabaseSettings (Disabled);
     +CREATE INDEX DatabaseSettings2 ON DatabaseSettings (Disabled);
      
    +
--:  ------- > 16: 5df044e26 Moved widget arguments to the right spot
--:  ------- > 17: 2ed7c8633 Call FinalizeWidgetArguments after all other argument processing



More information about the rt-commit mailing list