From 90f6922a1828bb4d408077378589bb6e1758c3d4 Mon Sep 17 00:00:00 2001 From: naoaki011 Date: Wed, 21 Mar 2012 21:58:20 +0900 Subject: [PATCH] show thumbnail feature added. --- plugins/Assetylene/config.yaml | 3 +++ plugins/Assetylene/lib/Assetylene/CMS.pm | 27 +++++++++++++++++++ plugins/Assetylene/lib/Assetylene/L10N/ja.pm | 3 ++- .../tmpl/blog_config_assetylene.tmpl | 8 ++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/plugins/Assetylene/config.yaml b/plugins/Assetylene/config.yaml index d55b651..c529914 100644 --- a/plugins/Assetylene/config.yaml +++ b/plugins/Assetylene/config.yaml @@ -140,6 +140,9 @@ settings: convert_html: default: 0 scope: blog + show_thumbnail: + default: 0 + scope: blog applications: cms: callbacks: diff --git a/plugins/Assetylene/lib/Assetylene/CMS.pm b/plugins/Assetylene/lib/Assetylene/CMS.pm index 267e132..cb17647 100644 --- a/plugins/Assetylene/lib/Assetylene/CMS.pm +++ b/plugins/Assetylene/lib/Assetylene/CMS.pm @@ -445,6 +445,33 @@ HTML } $tmpl->insertBefore($opt, $el); #< Caption +# Asset Thumbnail > + my $show_thumbnail = $plugin->get_config_value('show_thumbnail',$scope) || 0; + if ($show_thumbnail) { + my %param; + $param{Width} = 150; + my ( $thumbnail, $w, $h ) = $asset->thumbnail_file( %param ); + (my $site_path = $blog->site_path) =~ s!\\!/!g; + (my $site_url = $blog->site_url) =~ s!https?://[^/]+/!/!; + my $regex_path = quotemeta( $site_path ); + $thumbnail =~ s!\\!/!g; + $thumbnail =~ s/^$regex_path/$site_url/; + $thumbnail =~ s!//!/!g; + $opt = $tmpl->createElement('app:setting', { + id => 'asset_thumbnail', + label => MT->translate('Asset Thumbnail'), + label_class => 'no-header', + hint => '', + show_hint => 0, + }); + $opt->innerHTML(< + + +HTML + $tmpl->insertBefore($opt, $el); + } +#< Asset Thumbnail # Remove Popup > my $remove_popup = $plugin->get_config_value('remove_popup',$scope); if ($remove_popup) { diff --git a/plugins/Assetylene/lib/Assetylene/L10N/ja.pm b/plugins/Assetylene/lib/Assetylene/L10N/ja.pm index 8d41bfa..174e546 100644 --- a/plugins/Assetylene/lib/Assetylene/L10N/ja.pm +++ b/plugins/Assetylene/lib/Assetylene/L10N/ja.pm @@ -59,7 +59,8 @@ use vars qw( %Lexicon ); 'Create Insertion Module' => 'モジュールを作成', 'Set alt attribute in image?' => '画像にalt属性を設定する', 'and Save as' => '値を保存する', - + 'Show Thumbnail' => 'サムネイルを表示', + 'Show Asset Thumbnail' => 'アイテムのサムネイルを表示する', ); 1; diff --git a/plugins/Assetylene/tmpl/blog_config_assetylene.tmpl b/plugins/Assetylene/tmpl/blog_config_assetylene.tmpl index 41bb294..d861557 100644 --- a/plugins/Assetylene/tmpl/blog_config_assetylene.tmpl +++ b/plugins/Assetylene/tmpl/blog_config_assetylene.tmpl @@ -199,6 +199,14 @@ checked="checked" value="1" /> +" + hint="<__trans phrase="Hint">"> + + checked="checked" value="1" /> + +