diff --git a/README.md b/README.md index d930a8b..0e938df 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # shortArchives -Permet d'afficher les archives du blog dans un menu accordéon, trié par années. +Afficher les archives du blog dans un menu accordéon, trié par années. diff --git a/_admin.php b/_admin.php new file mode 100644 index 0000000..5d76ab5 --- /dev/null +++ b/_admin.php @@ -0,0 +1,15 @@ +registerModule( + /* Name */ "shortArchives", + /* Description*/ "Display blog archives in an accordion menu, sorted by year", + /* Author */ "annso, Pierre Van Glabeke", + /* Version */ "1.6", + /* Properties */ + array( + 'permissions' => 'usage,contentadmin', + 'type' => 'plugin', + 'dc_min' => '2.7', + 'support' => 'http://forum.dotclear.org/viewtopic.php?pid=321044#p321044', + 'details' => 'http://plugins.dotaddict.org/dc2/details/shortArchives' + ) +); \ No newline at end of file diff --git a/_public.php b/_public.php new file mode 100644 index 0000000..99b8ef9 --- /dev/null +++ b/_public.php @@ -0,0 +1,76 @@ +addBehavior('publicHeadContent',array('publicShortArchives','publicHeadContent')); + +class publicShortArchives +{ + public static function publicHeadContent($core) + { + $url = $core->blog->getQmarkURL().'pf='.basename(dirname(__FILE__)); + echo ''."\n"; + echo '\n"; + } +} + +class tplShortArchives +{ + public static function shortArchivesWidgets($w) + { + global $core; + + if ($w->offline) + return; + + if (($w->homeonly == 1 && $core->url->type != 'default') || + ($w->homeonly == 2 && $core->url->type == 'default')) { + return; + } + + $params = array(); + $params['type'] = 'month'; + $rs = $core->blog->getDates($params); + unset($params); + if ($rs->isEmpty()) { + return; + } + + $posts = array(); + while ($rs->fetch()) { + $posts[dt::dt2str(__('%Y'),$rs->dt)][] = array('url' => $rs->url($core), + 'date' => html::escapeHTML(dt::dt2str(__('%B'),$rs->dt)), + 'nbpost' => $rs->nb_post); + } + + $res = + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). + ''; + + return $w->renderDiv($w->content_only,'shortArchives '.$w->class,'',$res); + } +} \ No newline at end of file diff --git a/_widgets.php b/_widgets.php new file mode 100644 index 0000000..d2c5c9b --- /dev/null +++ b/_widgets.php @@ -0,0 +1,36 @@ +addBehavior('initWidgets',array('shortArchivesWidgets','initWidgets')); + +class shortArchivesWidgets +{ + public static function initWidgets($w) + { + $w->create('shortArchives',__('Short Archives'), array('tplShortArchives','shortArchivesWidgets'), + null, + __('Blog Archive List an accordion menu, sorted by year')); + $w->shortArchives->setting('title',__('Title:'),__('Archives')); + $w->shortArchives->setting('postcount',__('With entries counts'),1,'check'); + $w->shortArchives->setting('homeonly',__('Display on:'),0,'combo', + array( + __('All pages') => 0, + __('Home page only') => 1, + __('Except on home page') => 2 + ) + ); + $w->shortArchives->setting('content_only',__('Content only'),0,'check'); + $w->shortArchives->setting('class',__('CSS class:'),''); + $w->shortArchives->setting('offline',__('Offline'),0,'check'); + } +} \ No newline at end of file diff --git a/changelog b/changelog new file mode 100644 index 0000000..3f4b5ba --- /dev/null +++ b/changelog @@ -0,0 +1,7 @@ +v1.6 - 25-04-2015 - Pierre Van Glabeke +* modif appel css +* ajout localisation +* ajout identification widget + +v1.5 - 14-12-2014 - Pierre Van Glabeke +* compatibilité dc2.7 \ No newline at end of file diff --git a/css/shortArchives.css b/css/shortArchives.css new file mode 100644 index 0000000..944b4bc --- /dev/null +++ b/css/shortArchives.css @@ -0,0 +1,5 @@ +.shortArchives li a.archives-year { + background: url(index.php?pf=shortArchives/img/bullet_arrow_down.png) left center no-repeat; + padding-left: 20px; +} +.shortArchives li ul li { list-style-type: none;} diff --git a/img/bullet_arrow_down.png b/img/bullet_arrow_down.png new file mode 100644 index 0000000..9b23c06 Binary files /dev/null and b/img/bullet_arrow_down.png differ diff --git a/js/accordion.js b/js/accordion.js new file mode 100644 index 0000000..9495d9c --- /dev/null +++ b/js/accordion.js @@ -0,0 +1,18 @@ +$(document).ready(function(){ + $(".shortArchives li ul:not(:first)").hide(); + + $(".shortArchives li span").each( function () { + var txt = $(this).text(); + $(this).replaceWith('' + txt + '<\/a>') ; + } ) ; + + $(".shortArchives li a.archives-year").click(function(){ + if ($(this).next(".shortArchives li ul:visible").length != 0) { + $(".shortArchives li ul:visible").slideUp("normal", function () { $(this).parent().removeClass("open") }); + } else { + $(".shortArchives li ul").slideUp("normal", function () { $(this).parent().removeClass("open") }); + $(this).next("ul").slideDown("normal", function () { $(this).parent().addClass("open") }); + } + return false; + }); +}); \ No newline at end of file diff --git a/locales/fr/main.po b/locales/fr/main.po new file mode 100644 index 0000000..c36eda9 --- /dev/null +++ b/locales/fr/main.po @@ -0,0 +1,16 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: brol \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Display blog archives in an accordion menu, sorted by year" +msgstr "Afficher les archives du blog dans un menu accordéon, trié par années" + +msgid "Blog Archive List an accordion menu, sorted by year" +msgstr "Liste des archives du blog dans un menu accordéon, trié par années" \ No newline at end of file