Skip to content

Commit

Permalink
Item2043: attributes are not restated but overridden
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@4862 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
ArthurClemens authored and ArthurClemens committed Sep 12, 2009
1 parent ba9ad2b commit fbbd68f
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions TablePlugin/lib/Foswiki/Plugins/TablePlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,30 @@ Read in plugin settings from TABLEPLUGIN_TABLEATTRIBUTES
TABLEATTRIBUTES are no longer supported (NO_PREFS_IN_TOPIC).
If no settings are found, use the default settings from configure.
And if these cannot be read, use the default values defined here in this plugin.
Settings are applied by the principle of 'filling in the gaps'
=cut

sub _readPluginSettings {
debug("TablePlugin _readPluginSettings");

my $settings =
Foswiki::Func::getPreferencesValue('TABLEPLUGIN_TABLEATTRIBUTES')
|| $Foswiki::cfg{Plugins}{TablePlugin}{DefaultAttributes}
|| $DEFAULT_TABLE_SETTINGS;

debug("\t settings=$settings");

$settings =
Foswiki::Func::expandCommonVariables( $settings, $topic, $web, undef );
%pluginAttributes = Foswiki::Func::extractParameters($settings);
my $configureAttrStr =
$Foswiki::cfg{Plugins}{TablePlugin}{DefaultAttributes};
my $pluginAttrStr =
Foswiki::Func::getPreferencesValue('TABLEPLUGIN_TABLEATTRIBUTES');

debug("\t configureAttrStr=$configureAttrStr") if $configureAttrStr;
debug("\t pluginAttrStr=$pluginAttrStr") if $pluginAttrStr;

debug("no settings from configure could be read; using default values") if !$configureAttrStr;
$configureAttrStr ||= $DEFAULT_TABLE_SETTINGS;

$configureAttrStr = Foswiki::Func::expandCommonVariables($configureAttrStr, $topic, $web, undef) if $configureAttrStr;
$pluginAttrStr = Foswiki::Func::expandCommonVariables($pluginAttrStr, $topic, $web, undef) if $pluginAttrStr;

my %configureParams = Foswiki::Func::extractParameters($configureAttrStr);
my %pluginParams = Foswiki::Func::extractParameters($pluginAttrStr);

%pluginAttributes = ( %configureParams, %pluginParams );
}

=pod
Expand Down

0 comments on commit fbbd68f

Please sign in to comment.