Skip to content

Commit

Permalink
Syncing Config Assistant v2.1.18
Browse files Browse the repository at this point in the history
Config Assistant cases and issues resolved:

* #3 - Fixed perl warning: "my" variable `$dir` masks earlier declaration in same scope at addons/ConfigAssistant.pack/lib/ConfigAssistant/Static.pm line 172.
* #2 - Fixed incredibly annoying warnings on upgrade: Use of uninitialized value `$saved_version` in numeric `gt (>)` at addons/ConfigAssistant.pack/lib/ConfigAssistant/Static.pm line 48
* Lots of documentation updates
    * Added a table of contents for navigating this unwieldy beast
    * Adding initial header, adjusting subheaders and adding a *prominent* note for Melody users
    * Provided link to plugin repo on GitHub
    * Fixed inconsistent specification of plugin ID in examples
    * Edited and clarified the radio-image config type docs
    * Cleaned up the `custom_type_hdlr` routine to make it less visually noisy, hence hopefully clearer.
    * Separated syntax declaration from example pseudo-code so as not to confuse people
    * Fixed option callback docs which were missing the MT::Callback object argument, called the option label incorrectly and changed the argument names needlessly causing confusion.
    * Removed extraneous, old, incomplete sample config.yaml
    * Added a few FIXME's for later consideration
* Bumped version to Config Assistant v2.1.17
* Bumping to v2.1.18 to get back in sync with Melody
  • Loading branch information
jayallen committed Feb 3, 2011
1 parent 4e263b2 commit c8513aa
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 25 deletions.
4 changes: 2 additions & 2 deletions addons/ConfigAssistant.pack/config.yaml
Expand Up @@ -4,8 +4,8 @@ key: ConfigAssistant
author_link: http://openmelody.org/
author_name: "Byrne Reese, Open Melody Software Group"
description: This plugin provides a simple YAML based framework for creating plugin and theme configuration options.
version: 2.1.17
static_version: 7
version: 2.1.18
static_version: 8
schema_version: 3

applications:
Expand Down
45 changes: 29 additions & 16 deletions addons/ConfigAssistant.pack/lib/ConfigAssistant/Init.pm
Expand Up @@ -359,37 +359,48 @@ sub load_tags {
};
if ( $option->{'type'} eq 'checkbox' ) {
$tags->{block}->{ $tag . 'Loop' } = sub {
$_[0]->stash( 'field', $opt );
$_[0]->stash( 'plugin_ns', find_option_plugin($opt)->id );
$_[0]->stash( 'scope', lc( $option->{scope} ) );
runner( '_hdlr_field_array_loop', 'ConfigAssistant::Plugin', @_ );
my $blog = $_[0]->stash('blog');
my $bset = $blog->template_set;
$_[0]->stash( 'field', $bset . '_' . $opt );
$_[0]->stash( 'plugin_ns',
find_theme_plugin($bset)->id );
$_[0]->stash( 'scope', 'blog' );
runner( '_hdlr_field_array_loop',
'ConfigAssistant::Plugin', @_ );
};
$tags->{block}->{ $tag . 'Contains' } = sub {
$_[0]->stash( 'field', $opt );
$_[0]->stash( 'plugin_ns', find_option_plugin($opt)->id );
$_[0]->stash( 'scope', lc( $option->{scope} ) );
my $blog = $_[0]->stash('blog');
my $bset = $blog->template_set;
$_[0]->stash( 'field', $bset . '_' . $opt );
$_[0]->stash( 'plugin_ns',
find_theme_plugin($bset)->id );
$_[0]->stash( 'scope', 'blog' );
runner( '_hdlr_field_array_contains',
'ConfigAssistant::Plugin', @_ );
};

} ## end if ( $option->{'type'}...)
elsif ( $option->{'type'} eq 'file' ) {
$tags->{block}->{ $tag . 'Asset' } = sub {
$_[0]->stash( 'field', $opt );
my $blog = $_[0]->stash('blog');
my $bset = $blog->template_set;
$_[0]->stash( 'field', $bset . '_' . $opt );
$_[0]->stash( 'plugin_ns',
find_option_plugin($opt)->id );
$_[0]->stash( 'scope', lc( $option->{scope} ) );
find_theme_plugin($bset)->id );
$_[0]->stash( 'scope', 'blog' );
runner( '_hdlr_field_asset',
'ConfigAssistant::Plugin', @_ );
};

}
elsif ( $option->{'type'} eq 'link-group' ) {
$tags->{block}->{ $tag . 'Links' } = sub {
$_[0]->stash( 'field', $opt );
my $blog = $_[0]->stash('blog');
my $bset = $blog->template_set;
$_[0]->stash( 'field', $bset . '_' . $opt );
$_[0]->stash( 'plugin_ns',
find_theme_plugin($opt)->id );
$_[0]->stash( 'scope', lc( $option->{scope} ) );
find_theme_plugin($bset)->id );
$_[0]->stash( 'scope', 'blog' );
runner( '_hdlr_field_link_group',
'ConfigAssistant::Plugin', @_ );
};
Expand All @@ -404,10 +415,12 @@ sub load_tags {
my $obj_class = substr( $t, 0, index( $t, '_list' ) );
$tags->{block}->{ $tag . $tag_type } = sub {
$_[0]->stash( 'obj_class', $obj_class );
$_[0]->stash( 'field', $opt );
my $blog = $_[0]->stash('blog');
my $bset = $blog->template_set;
$_[0]->stash( 'field', $bset . '_' . $opt );
$_[0]->stash( 'plugin_ns',
find_option_plugin($opt)->id );
$_[0]->stash( 'scope', lc( $option->{scope} ) );
find_theme_plugin($bset)->id );
$_[0]->stash( 'scope', 'blog' );
runner( '_hdlr_field_category_list',
'ConfigAssistant::Plugin', @_ );
};
Expand Down
14 changes: 8 additions & 6 deletions addons/ConfigAssistant.pack/lib/ConfigAssistant/Static.pm
Expand Up @@ -34,9 +34,13 @@ sub upgrade {
# undef $ver so that we don't try to grab the static_version
# variable. $plugin->id seems to throw an error for some Six
# Apart-originated plugins. I don't know why.
my $plugin_id = eval { $plugin->id } ? $plugin->id : undef $ver;
my $saved_version;
$saved_version = $ver->{$plugin_id} if $ver;
my $saved_version = 0.1; # Default
my $plugin_id = eval { $plugin->id }
or undef $ver;
if ( $ver && $plugin_id ) {
$saved_version = $ver->{$plugin_id}
if defined $ver->{$plugin_id};
}

if ( $static_version > $saved_version ) {
$self->progress( 'Copying static files for <strong>'
Expand Down Expand Up @@ -168,9 +172,7 @@ sub _make_dir {
my $fmgr = MT::FileMgr->new('Local') or return MT::FileMgr->errstr;

my $app = MT->instance;
my $dir
= File::Spec->catfile( $app->static_file_path, 'support', 'plugins',
$dir );
$dir = File::Spec->catfile( $app->static_file_path, 'support', 'plugins', $dir );
if ( $fmgr->mkpath($dir) ) {

# Success!
Expand Down
1 change: 0 additions & 1 deletion addons/ConfigAssistant.pack/lib/ConfigAssistant/Util.pm
Expand Up @@ -28,7 +28,6 @@ sub plugin_static_file_path {
my ($plugin) = @_;
return File::Spec->catdir( MT->instance->static_file_path,
'support', 'plugins', $plugin->id );

}

sub process_file_upload {
Expand Down

0 comments on commit c8513aa

Please sign in to comment.