From 834758977108318608b3dc733e35615abe9d376e Mon Sep 17 00:00:00 2001 From: brol Date: Sat, 30 May 2015 00:50:40 +0200 Subject: [PATCH] 1.7 par kozlika & nikrou --- README.md | 7 +++++- _define.php | 6 ++--- _public.php | 32 +++++++++++++++++--------- changelog | 8 ++++++- css/shortArchives.css | 46 +++++++++++++++++++++++++++++++++----- img/bullet_arrow_down.png | Bin 201 -> 0 bytes js/accordion.js | 18 +++++++++------ 7 files changed, 89 insertions(+), 28 deletions(-) delete mode 100644 img/bullet_arrow_down.png diff --git a/README.md b/README.md index 0e938df..9ee38ee 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # shortArchives -Afficher les archives du blog dans un menu accordéon, trié par années. + +Widget d'affichage des archives pour le blog des news de Dotclear. Le principe de l'accordéon originel revisité pour un affichage des mois à côté de la date "ouverte". + +Todo: + +* Ajouter les attributs ARIA kivonbien. diff --git a/_define.php b/_define.php index c6457e0..e53ff4f 100644 --- a/_define.php +++ b/_define.php @@ -1,10 +1,10 @@ registerModule( /* Name */ "shortArchives", /* Description*/ "Display blog archives in an accordion menu, sorted by year", /* Author */ "annso, Pierre Van Glabeke", - /* Version */ "1.6", + /* Version */ "1.7", /* Properties */ array( 'permissions' => 'usage,contentadmin', diff --git a/_public.php b/_public.php index 99b8ef9..baa4b7f 100644 --- a/_public.php +++ b/_public.php @@ -1,10 +1,10 @@ homeonly == 2 && $core->url->type == 'default')) { return; } - + $params = array(); $params['type'] = 'month'; - $rs = $core->blog->getDates($params); + $rs = $core->blog->getDates($params); unset($params); if ($rs->isEmpty()) { return; } + $active_year = null; + if (($core->url->type == 'archive') && preg_match('`^/([0-9]{4})/([0-9]{2})$`',$core->url->args,$matches)) { + $active_year = $matches[1]; + } + $posts = array(); while ($rs->fetch()) { - $posts[dt::dt2str(__('%Y'),$rs->dt)][] = array('url' => $rs->url($core), - 'date' => html::escapeHTML(dt::dt2str(__('%B'),$rs->dt)), + $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)) : ''). - '