diff --git a/addons/ConfigAssistant.pack/config.yaml b/addons/ConfigAssistant.pack/config.yaml index 8685531da..784f7c6a6 100644 --- a/addons/ConfigAssistant.pack/config.yaml +++ b/addons/ConfigAssistant.pack/config.yaml @@ -4,7 +4,7 @@ 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.9 +version: 2.1.10 static_version: 4 schema_version: 2 diff --git a/addons/ConfigAssistant.pack/lib/ConfigAssistant/Plugin.pm b/addons/ConfigAssistant.pack/lib/ConfigAssistant/Plugin.pm index 563d9922e..a4655f874 100644 --- a/addons/ConfigAssistant.pack/lib/ConfigAssistant/Plugin.pm +++ b/addons/ConfigAssistant.pack/lib/ConfigAssistant/Plugin.pm @@ -5,12 +5,12 @@ use warnings; use Carp qw( croak ); use MT::Util qw( relative_date offset_time offset_time_list epoch2ts - ts2epoch format_ts encode_html decode_html dirify ); + ts2epoch format_ts encode_html decode_html dirify ); use ConfigAssistant::Util qw( find_theme_plugin find_template_def find_option_def - find_option_plugin process_file_upload ); + find_option_plugin process_file_upload + plugin_static_web_path plugin_static_file_path ); use JSON; - # use MT::Log::Log4perl qw( l4mtdump ); use Log::Log4perl qw( :resurrect ); our $logger; @@ -21,32 +21,29 @@ sub tag_plugin_static_web_path { if ( !$obj ) { return $ctx->error( - MT->translate( - "The plugin you specified '[_2]' in '[_1]' " - . "could not be found.", - $ctx->stash('tag'), - $sig - ) + MT->translate( + "The plugin you specified '[_2]' in '[_1]' " + . "could not be found.", + $ctx->stash('tag'), + $sig + ) ); } elsif ( $obj->registry('static_version') ) { - my $url = MT->instance->static_path; - $url .= '/' unless $url =~ m!/$!; - $url .= 'support/plugins/' . $obj->id . '/'; - return $url; + return plugin_static_web_path($obj); } else { # TODO - perhaps this should default to: mt-static/plugins/$sig? return $ctx->error( - MT->translate( - "The plugin you specified '[_2]' in '[_1]' has not" - . "registered a static directory. Please use " - . " instead.", - $ctx->stash('tag'), - $sig - ) + MT->translate( + "The plugin you specified '[_2]' in '[_1]' has not" + . "registered a static directory. Please use " + . " instead.", + $ctx->stash('tag'), + $sig + ) ); } } ## end sub tag_plugin_static_web_path @@ -58,28 +55,26 @@ sub tag_plugin_static_file_path { if ( !$obj ) { return $ctx->error( - MT->translate( - "The plugin you specified '[_2]' in '[_1]' " - . "could not be found.", - $ctx->stash('tag'), - $sig - ) + MT->translate( + "The plugin you specified '[_2]' in '[_1]' " + . "could not be found.", + $ctx->stash('tag'), + $sig + ) ); } elsif ( $obj->registry('static_version') ) { - return - File::Spec->catdir( MT->instance->static_file_path, - 'support', 'plugins', $obj->id ); + return plugin_static_file_path($obj); } else { return $ctx->error( - MT->translate( - "The plugin you specified in '[_1]' has not " - . "registered a static directory. Please use " - . " instead.", - $_[0]->stash('tag') - ) + MT->translate( + "The plugin you specified in '[_1]' has not " + . "registered a static directory. Please use " + . " instead.", + $_[0]->stash('tag') + ) ); } } ## end sub tag_plugin_static_file_path @@ -1011,7 +1006,7 @@ sub _hdlr_field_category_list { my ( $ctx, $args, $cond ) = @_; my $field = $ctx->stash('field') or return _no_field($ctx); my $value = _get_field_value($ctx); - my @ids = ref($value) eq 'ARRAY' ? @$value : ($value); + my @ids = ref($value) eq 'ARRAY' ? @$value : ($value); my $class = $ctx->stash('obj_class'); my @categories = MT->model($class)->load( { id => \@ids } ); diff --git a/addons/ConfigAssistant.pack/lib/ConfigAssistant/Util.pm b/addons/ConfigAssistant.pack/lib/ConfigAssistant/Util.pm index 08aecb756..78f03169c 100644 --- a/addons/ConfigAssistant.pack/lib/ConfigAssistant/Util.pm +++ b/addons/ConfigAssistant.pack/lib/ConfigAssistant/Util.pm @@ -3,9 +3,11 @@ package ConfigAssistant::Util; use strict; use warnings; use base 'Exporter'; -our @EXPORT_OK = qw( find_theme_plugin find_template_def find_option_def - find_option_plugin process_file_upload - ERROR SUCCESS OVERWRITE NO_UPLOAD ); +our @EXPORT_OK + = qw( find_theme_plugin find_template_def find_option_def + find_option_plugin process_file_upload + plugin_static_web_path plugin_static_file_path + ERROR SUCCESS OVERWRITE NO_UPLOAD ); use MT::Util qw( encode_url ); @@ -14,6 +16,21 @@ sub SUCCESS () {1} sub OVERWRITE () {2} sub NO_UPLOAD () {3} +sub plugin_static_web_path { + my ($plugin) = @_; + my $url = MT->instance->static_path; + $url .= '/' unless $url =~ m!/$!; + $url .= 'support/plugins/' . $plugin->id . '/'; + return $url; +} + +sub plugin_static_file_path { + my ($plugin) = @_; + return File::Spec->catdir( MT->instance->static_file_path, + 'support', 'plugins', $plugin->id ); + +} + sub process_file_upload { my $app = shift; my ( $param_name, $scope, $extra_path, %upload_param ) = @_; diff --git a/lib/MT/Template/ContextHandlers.pm b/lib/MT/Template/ContextHandlers.pm index 5fedf80fa..73bd95552 100644 --- a/lib/MT/Template/ContextHandlers.pm +++ b/lib/MT/Template/ContextHandlers.pm @@ -14,7 +14,7 @@ use MT::Util qw( start_end_day start_end_week format_ts offset_time_list first_n_words dirify get_entry encode_html encode_js remove_html wday_from_ts days_in spam_protect encode_php encode_url decode_html encode_xml - decode_xml relative_date asset_cleanup ); + decode_xml relative_date asset_cleanup caturl trim ); use MT::Request; use Time::Local qw( timegm timelocal ); use MT::Promise qw( delay ); @@ -258,6 +258,8 @@ sub core_tags { 'App:ListFilters' => \&_hdlr_app_list_filters, 'App:ActionBar' => \&_hdlr_app_action_bar, 'App:Link' => \&_hdlr_app_link, + 'App:HTMLHead' => \&_hdlr_app_html_head, + Var => \&_hdlr_get_var, CGIPath => \&_hdlr_cgi_path, AdminCGIPath => \&_hdlr_admin_cgi_path, @@ -2391,6 +2393,99 @@ EOT ########################################################################### +=head2 App:HTMLHead + +This outputs any elements registered via the html_head registry keys. + +B + +=over 4 + +=item * type (optional) + +Provides a way for the tag to output one or more specific types of elements, +e.g. all of the `'."\n"; + $out .= $link; + } elsif ($f->{content}) { + my $link .= (' ' x $indent).'\n"; + $out .= $link; + } + } + } + } + } + return $out; +} ## end sub _hdlr_app_html_head + +########################################################################### + =head2 App:SettingGroup An application template tag used to wrap a number of L tags. diff --git a/tmpl/cms/include/header.tmpl b/tmpl/cms/include/header.tmpl index 1d42bcada..e046879cb 100644 --- a/tmpl/cms/include/header.tmpl +++ b/tmpl/cms/include/header.tmpl @@ -9,12 +9,14 @@ title="" href="" /> + styles.css?v=" type="text/css" /> css/main.css?v=" type="text/css" /> melody/styles.css?v=" type="text/css" /> + @@ -62,6 +64,7 @@ + <$mt:var name="js_include"$>