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)) : '').
- '
';
-
- foreach($posts as $annee=>$post) {
- $res .= '- '.$annee.'
';
+ '';
+
+ foreach($posts as $annee => $post) {
+ if (!is_null($active_year) && $active_year == $annee) {
+ $res .= '- ';
+ } else {
+ $res .= '
- ';
+ }
+ $res .= ''.$annee.'
';
for($i=0; $i'.$post[$i]['date'].''.
@@ -73,4 +83,4 @@ class tplShortArchives
return $w->renderDiv($w->content_only,'shortArchives '.$w->class,'',$res);
}
-}
\ No newline at end of file
+}
diff --git a/changelog b/changelog
index 3f4b5ba..0bc4608 100644
--- a/changelog
+++ b/changelog
@@ -1,7 +1,13 @@
+v1.7 - 28-05-2015 - Kozlika & Nikrou
+* suppression d'image et gestion de l'indicateur via css
+* ajout de classes sur chaque liste (année/mois)
+* application de la class .open sur l'item ouvert par défaut
+* application de la class .open sur l'item correspondant au mois actif en cas de consulation des archives
+
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
+* compatibilité dc2.7
diff --git a/css/shortArchives.css b/css/shortArchives.css
index 944b4bc..eff3dac 100644
--- a/css/shortArchives.css
+++ b/css/shortArchives.css
@@ -1,5 +1,41 @@
-.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;}
+@charset "UTF-8";
+
+/* ------------------------ shortArchives styles */
+.shortArchives .arch-years,
+.shortArchives .arch-months {
+ margin-left: 0;
+ list-style-type: none;
+}
+
+/* liste années */
+.shortArchives .arch-years > li {
+ padding-left: 0;
+}
+
+.shortArchives .arch-months {
+ margin: .5em 0 .5em 1.5em;
+}
+
+/* année fermée */
+.shortArchives a.archives-year {
+ text-decoration: none;
+}
+.shortArchives a.archives-year:before {
+ padding-right: .5em;
+ color: #aaa;
+ content: "\25b8";
+ speak: none;
+}
+
+/* année ouverte */
+.shortArchives .open .archives-year {
+ font-weight: bold;
+ text-decoration: none;
+}
+
+.shortArchives .open .archives-year:before {
+ padding-right: .5em;
+ color: #333;
+ content: "\25be";
+ speak: none;
+}
diff --git a/img/bullet_arrow_down.png b/img/bullet_arrow_down.png
deleted file mode 100644
index 9b23c06..0000000
Binary files a/img/bullet_arrow_down.png and /dev/null differ
diff --git a/js/accordion.js b/js/accordion.js
index 9495d9c..7dd16cd 100644
--- a/js/accordion.js
+++ b/js/accordion.js
@@ -1,18 +1,22 @@
$(document).ready(function(){
- $(".shortArchives li ul:not(:first)").hide();
+ if ($(".shortArchives li.open").length == 0) {
+ $(".shortArchives li:first").addClass('open');
+ }
+ $(".shortArchives li:not(.open) ul").hide();
+
+ $(".shortArchives li span").each( function () {
+ var txt = $(this).text();
+ $(this).replaceWith('' + txt + '<\/a>') ;
+ });
- $(".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") });
+ $(".shortArchives li:first").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
+});