v0.2
cf changelog
This commit is contained in:
parent
a5a9c6e047
commit
d06c4f5e6c
8 changed files with 83 additions and 37 deletions
|
@ -13,7 +13,7 @@ if (!defined('DC_RC_PATH')) {
|
|||
return;
|
||||
}
|
||||
class ConstCategoriesPage {
|
||||
const VERSION = '0.1';
|
||||
const VERSION = '0.2';
|
||||
const NS = 'CategoriesPage';
|
||||
const PARAM = 'CategoriesPage';
|
||||
}
|
||||
|
|
|
@ -7,10 +7,6 @@ Ce plugin ajoute un widget permettant d'accèder à une page listant les catégo
|
|||
|
||||
Ce plugin est basé sur le plugin [CategoriesMode] (http://plugins.dotaddict.org/dc2/details/categoriesMode) de Adjaya, Pierre Van Glabeke.
|
||||
|
||||
Compatibilité
|
||||
============
|
||||
|
||||
Ce plugin a été testé avec les versions 2.5 et 2.6 de [Dotclear] (http://fr.dotclear.org/).
|
||||
|
||||
Auteurs
|
||||
=======
|
||||
|
|
|
@ -16,13 +16,13 @@ $this->registerModule(
|
|||
/* Name */ 'Categories Page',
|
||||
/* Description*/ 'Add a category list page / Ajoute une page listant les catégories',
|
||||
/* Author */ 'Pierre Van Glabeke, Bernard Le Roux',
|
||||
/* Version */ '0.1',
|
||||
/* Version */ '0.2',
|
||||
/* Properties */
|
||||
array(
|
||||
'permissions' => 'admin',
|
||||
'type' => 'plugin',
|
||||
'dc_min' => '2.5',
|
||||
'support' => 'http://forum.dotclear.org/viewforum.php?id=16',
|
||||
'dc_min' => '2.7',
|
||||
'support' => 'http://forum.dotclear.org/viewtopic.php?pid=326224#p326224',
|
||||
'details' => 'http://plugins.dotaddict.org/dc2/details/categoriesPage'
|
||||
)
|
||||
);
|
||||
|
|
|
@ -58,8 +58,12 @@ class tplCategories {
|
|||
class behaviorCategoriesPage {
|
||||
|
||||
public static function addTplPath($core) {
|
||||
$tpl = $core->tpl;
|
||||
$tpl->setPath($tpl->getPath(), dirname(__FILE__) . '/default-templates');
|
||||
$tplset = $core->themes->moduleInfo($core->blog->settings->system->theme,'tplset');
|
||||
if (!empty($tplset) && is_dir(dirname(__FILE__).'/default-templates/'.$tplset)) {
|
||||
$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates/'.$tplset);
|
||||
} else {
|
||||
$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates/'.DC_DEFAULT_TPLSET);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
29
_widgets.php
29
_widgets.php
|
@ -33,30 +33,22 @@ class widgetsCategoriesPage {
|
|||
$core = $GLOBALS['core'];
|
||||
|
||||
$url = $core->url;
|
||||
|
||||
if ($widget->offline)
|
||||
return;
|
||||
|
||||
if (($widget->homeonly == 1 && $url->type !== 'default') ||
|
||||
($widget->homeonly == 2 && $url->type === 'default')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$class = $divB = $divE = $title = '';
|
||||
if ($widget->class) {
|
||||
$class = html::escapeHTML($widget->class);
|
||||
}
|
||||
if ( !$widget->content_only) {
|
||||
$divB = '<div class="categories '. $class . '">';
|
||||
$divE = '</div>';
|
||||
}
|
||||
if ( $widget->title ) {
|
||||
$title = '<h2>' . html::escapeHTML($widget->title) . '</h2>';
|
||||
}
|
||||
|
||||
return $divB . $title .
|
||||
'<ul><li><strong><a href="' .
|
||||
$core->blog->url . $core->url->getBase("categories") . '">' .
|
||||
__('All categories') .
|
||||
'</a></strong></li></ul>' .
|
||||
$divE;
|
||||
$res =
|
||||
($widget->title ? $widget->renderTitle(html::escapeHTML($widget->title)) : '').
|
||||
'<p><a href="'.$core->blog->url.$core->url->getBase('categories').'">'.
|
||||
($widget->link_title ? html::escapeHTML($widget->link_title) : __('All categories')).
|
||||
'</a></p>';
|
||||
|
||||
return $widget->renderDiv($widget->content_only,'categories '.$widget->class,'',$res);
|
||||
}
|
||||
|
||||
public static function initWidgets($widget) {
|
||||
|
@ -72,6 +64,7 @@ class widgetsCategoriesPage {
|
|||
);
|
||||
$categoriesPage->setting('content_only', __('Content only'), 0, 'check');
|
||||
$categoriesPage->setting('class', __('CSS class:'), '');
|
||||
$categoriesPage->setting('offline',__('Offline'),0,'check');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
8
changelog
Normal file
8
changelog
Normal file
|
@ -0,0 +1,8 @@
|
|||
v0.2 - 14-12-2014 : Pierre Van Glabeke
|
||||
Ajout case hors ligne
|
||||
Ajout tpl pour currywurst
|
||||
Compatibilité dc2.7
|
||||
|
||||
v0.1 - 28-12-2013 : Pierre Van Glabeke, Bernard Le Roux
|
||||
Refonte du code depuis CategoriesMode
|
||||
Compatibilité dc2.5 et 2.6
|
47
default-templates/currywurst/categories.html
Normal file
47
default-templates/currywurst/categories.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
{{tpl:extends parent="__layout.html"}}
|
||||
|
||||
<tpl:Block name="head-title">
|
||||
<title>{{tpl:lang Categories Page}} - {{tpl:BlogName encode_html="1"}}</title>
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="meta-robots">
|
||||
<meta name="ROBOTS" content="{{tpl:BlogMetaRobots robots="NOINDEX"}}" />
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="dc-entry">
|
||||
<meta name="dc.title" lang="{{tpl:BlogLanguage}}" content="{{tpl:lang Categories page}} - {{tpl:BlogName encode_html="1"}}" />
|
||||
<meta property="dc.language" content="{{tpl:BlogLanguage}}" />
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="head-linkrel">
|
||||
<link rel="top" href="{{tpl:BlogURL}}" title="{{tpl:lang Home}}" />
|
||||
<link rel="contents" title="{{tpl:lang Archives}}" href="{{tpl:BlogArchiveURL}}" />
|
||||
<tpl:Categories>
|
||||
<link rel="section" href="{{tpl:CategoryURL}}" title="{{tpl:CategoryTitle encode_html="1"}}" />
|
||||
</tpl:Categories>
|
||||
<link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="{{tpl:BlogFeedURL type="atom"}}" />
|
||||
</tpl:Block>
|
||||
|
||||
<tpl:Block name="body-tag"><body class="dc-categories"></tpl:Block>
|
||||
|
||||
<tpl:Block name="main-content">
|
||||
<div id="content-info">
|
||||
<h2>{{tpl:lang Categories}}</h2>
|
||||
|
||||
<tpl:Categories>
|
||||
<h3><a href="{{tpl:CategoryURL}}">{{tpl:CategoryTitle encode_html="1"}}</a> ({{tpl:CategoryCount}})</h3>
|
||||
<div>{{tpl:CategoryDescription}}</div>
|
||||
|
||||
<p><a type="application/atom+xml" href="{{tpl:CategoryFeedURL type="atom"}}"
|
||||
title="{{tpl:lang This category's entries Atom feed}}" class="feed">{{tpl:lang Entries feed}}</a>
|
||||
|
||||
<tpl:SysIf operator="or" comments_active="1" pings_active="1">
|
||||
- <a type="application/atom+xml" href="{{tpl:CategoryFeedURL type="atom"}}/comments"
|
||||
title="{{tpl:lang This category's comments Atom feed}}" class="feed">{{tpl:lang Comments feed}}</a>
|
||||
</tpl:SysIf>
|
||||
</p>
|
||||
</tpl:Categories>
|
||||
</div>
|
||||
|
||||
|
||||
</tpl:Block>
|
|
@ -1,32 +1,30 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{tpl:BlogLanguage}}" lang="{{tpl:BlogLanguage}}">
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{tpl:BlogLanguage}}">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="ROBOTS" content="{{tpl:BlogMetaRobots robots="NOINDEX"}}" />
|
||||
|
||||
<title>{{tpl:lang Categories Page}} - {{tpl:BlogName encode_html="1"}}</title>
|
||||
<meta name="copyright" content="{{tpl:BlogCopyrightNotice encode_html="1"}}" />
|
||||
<meta name="author" content="{{tpl:BlogEditor encode_html="1"}}" />
|
||||
<meta name="date" scheme="W3CDTF" content="{{tpl:BlogUpdateDate iso8601="1"}}" />
|
||||
|
||||
<link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
|
||||
<meta name="dc.title" lang="{{tpl:BlogLanguage}}" content="{{tpl:lang Categories page}} - {{tpl:BlogName encode_html="1"}}" />
|
||||
<meta name="dc.language" content="{{tpl:BlogLanguage}}" />
|
||||
<meta name="dc.publisher" content="{{tpl:BlogEditor encode_html="1"}}" />
|
||||
<meta name="dc.rights" content="{{tpl:BlogCopyrightNotice encode_html="1"}}" />
|
||||
<meta name="dc.date" scheme="W3CDTF" content="{{tpl:BlogUpdateDate iso8601="1"}}" />
|
||||
<meta name="dc.type" content="text" />
|
||||
<meta name="dc.format" content="text/html" />
|
||||
|
||||
<link rel="top" href="{{tpl:BlogURL}}" title="{{tpl:lang Home}}" />
|
||||
<link rel="contents" href="{{tpl:BlogArchiveURL}}" title="{{tpl:lang Archives}}" />
|
||||
<link rel="contents" title="{{tpl:lang Archives}}" href="{{tpl:BlogArchiveURL}}" />
|
||||
<tpl:Categories>
|
||||
<link rel="section" href="{{tpl:CategoryURL}}" title="{{tpl:CategoryTitle encode_html="1"}}" />
|
||||
</tpl:Categories>
|
||||
|
||||
|
||||
<link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="{{tpl:BlogFeedURL type="atom"}}" />
|
||||
<link rel="meta" type="application/xbel+xml" title="Blogroll" href="{{tpl:BlogrollXbelLink}}" />
|
||||
|
||||
|
||||
{{tpl:include src="_head.html"}}
|
||||
</head>
|
||||
|
Loading…
Reference in a new issue