8 changed files with 278 additions and 0 deletions
@ -0,0 +1,91 @@
|
||||
<?php |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Insertion dans le pipeline declarer_tables_objets_sql (SPIP) |
||||
* |
||||
* Declarer les champs categorie et préfixe pour les rubriques. |
||||
* |
||||
* @param array $tables |
||||
* La définition des objets SPIP |
||||
* @return array |
||||
* La définition des objets SPIP modifiés |
||||
*/ |
||||
function contrib_declarer_champs_extras($champs = array()) { |
||||
|
||||
// Table : spip_rubriques, on initialise les champs extras de la table. |
||||
if (!is_array($champs['spip_rubriques'])) { |
||||
$champs['spip_rubriques'] = array(); |
||||
} |
||||
|
||||
// Ajout de la catégorie de plugin. La saisie est une sélection particulière. |
||||
$champs['spip_rubriques']['categorie'] = array( |
||||
'saisie' => 'rubrique_categorie', |
||||
'options' => array( |
||||
'nom' => 'categorie', |
||||
'label' => '<:svp:label_categorie:>', |
||||
'option_intro' => '<:contrib:categorie_vide:>', |
||||
'env' => true, |
||||
'restrictions' => array( |
||||
'modifier' => array( |
||||
'auteur' => 'webmestre', |
||||
), |
||||
'voir' => false, |
||||
), |
||||
'sql' => "varchar(100) DEFAULT '' NOT NULL", |
||||
'rechercher_ponderation' => '2', |
||||
), |
||||
'versionner' => false, |
||||
'verifier' => array( |
||||
), |
||||
); |
||||
|
||||
$champs['spip_rubriques']['prefixe'] = array( |
||||
'saisie' => 'input', |
||||
'options' => array( |
||||
'nom' => 'prefixe', |
||||
'label' => '<:svp:label_prefixe:>', |
||||
'env' => true, |
||||
'restrictions' => array( |
||||
'modifier' => array( |
||||
'auteur' => 'webmestre', |
||||
), |
||||
'voir' => false, |
||||
), |
||||
'sql' => "varchar(30) DEFAULT '' NOT NULL", |
||||
'rechercher_ponderation' => '10', |
||||
), |
||||
'versionner' => false, |
||||
'verifier' => array( |
||||
), |
||||
); |
||||
|
||||
// Table : spip_rubriques, on initialise les champs extras de la table. |
||||
if (!is_array($champs['spip_articles'])) { |
||||
$champs['spip_articles'] = array(); |
||||
} |
||||
|
||||
// Ajout de la catégorie de plugin. La saisie est une sélection particulière. |
||||
$champs['spip_articles']['type_article'] = array( |
||||
'saisie' => 'input', |
||||
'options' => array( |
||||
'nom' => 'type_article', |
||||
'label' => '<:contrib:label_type_article:>', |
||||
'restrictions' => array( |
||||
'modifier' => array( |
||||
'auteur' => 'webmestre', |
||||
), |
||||
), |
||||
'sql' => "varchar(16) DEFAULT '' NOT NULL", |
||||
), |
||||
'versionner' => false, |
||||
'verifier' => array( |
||||
), |
||||
); |
||||
|
||||
return $champs; |
||||
} |
@ -0,0 +1,38 @@
|
||||
<?php |
||||
|
||||
/** |
||||
* Installation/maj du plugin |
||||
* |
||||
* Crée les champs categorie et préfixe pour les rubriques |
||||
* |
||||
* @param string $nom_meta_base_version |
||||
* @param string $version_cible |
||||
*/ |
||||
function contrib_upgrade($nom_meta_base_version, $version_cible) { |
||||
|
||||
$maj = array(); |
||||
|
||||
include_spip('inc/cextras'); |
||||
include_spip('base/contrib_declarations'); |
||||
cextras_api_upgrade(contrib_declarer_champs_extras(), $maj['create']); |
||||
|
||||
include_spip('base/upgrade'); |
||||
maj_plugin($nom_meta_base_version, $version_cible, $maj); |
||||
} |
||||
|
||||
/** |
||||
* Désinstalle les données du plugin |
||||
* |
||||
* Supprime les champs categorie et préfixe pour les rubriques |
||||
* |
||||
* @param string $nom_meta_base_version |
||||
*/ |
||||
function contrib_vider_tables($nom_meta_base_version) { |
||||
|
||||
include_spip('inc/cextras'); |
||||
include_spip('base/contrib_declarations'); |
||||
cextras_api_vider_tables(contrib_declarer_champs_extras()); |
||||
|
||||
// on efface la meta du schéma du plugin |
||||
effacer_meta($nom_meta_base_version); |
||||
} |
After Width: | Height: | Size: 2.4 KiB |
@ -0,0 +1,54 @@
|
||||
<?php |
||||
|
||||
// On force le mode d'utilisation de SVP a non runtime car on veut presenter tous les |
||||
// plugins contenus dans les depots quelque soit leur compatibilite spip |
||||
if (!defined('_SVP_MODE_RUNTIME')) |
||||
define('_SVP_MODE_RUNTIME', false); |
||||
|
||||
// Liste des pages publiques d'objet supportees par le squelette (depot, plugin). |
||||
// Permet d'afficher le bouton voir en ligne dans la page d'edition de l'objet |
||||
if (!defined('_SVP_PAGES_OBJET_PUBLIQUES')) |
||||
define('_SVP_PAGES_OBJET_PUBLIQUES', 'depot:plugin'); |
||||
|
||||
// Taille des listes et pas de pagination de la page sommaire |
||||
if (!defined('_PLUGINSPIP_TAILLE_SELECTION_PLUGINS')) |
||||
define('_PLUGINSPIP_TAILLE_SELECTION_PLUGINS', 10); |
||||
if (!defined('_PLUGINSPIP_TAILLE_TOP_PLUGINS')) |
||||
define('_PLUGINSPIP_TAILLE_TOP_PLUGINS', 30); |
||||
if (!defined('_PLUGINSPIP_TAILLE_MAJ_PLUGINS')) |
||||
define('_PLUGINSPIP_TAILLE_MAJ_PLUGINS', 30); |
||||
if (!defined('_PLUGINSPIP_PAS_TOP_PLUGINS')) |
||||
define('_PLUGINSPIP_PAS_TOP_PLUGINS', 5); |
||||
if (!defined('_PLUGINSPIP_PAS_MAJ_PLUGINS')) |
||||
define('_PLUGINSPIP_PAS_MAJ_PLUGINS', 5); |
||||
if (!defined('_SVP_PERIODE_ACTUALISATION_DEPOTS')) |
||||
define('_SVP_PERIODE_ACTUALISATION_DEPOTS', 1); |
||||
|
||||
// Branche SPIP stable |
||||
if (!defined('_PLUGINSPIP_BRANCHE_STABLE')) |
||||
define('_PLUGINSPIP_BRANCHE_STABLE', '3.2'); |
||||
|
||||
// Branches SPIP maintenues |
||||
if (!defined('_PLUGINSPIP_BRANCHES_MAINTENUES')) |
||||
define('_PLUGINSPIP_BRANCHES_MAINTENUES', '3.2,3.1,3.0'); |
||||
|
||||
// Période de rafaichissement du cache autodoc |
||||
if (!defined('_PLUGINSPIP_TIMEOUT_AUTODOC')) |
||||
define('_PLUGINSPIP_TIMEOUT_AUTODOC', 3600*24); |
||||
|
||||
// Forcer l'utilisation de la langue du visiteur |
||||
$GLOBALS['forcer_lang'] = true; |
||||
|
||||
|
||||
function generer_titre_rubrique($id_rubrique, $contenu_objet) { |
||||
|
||||
include_spip('inc/utils'); |
||||
$titre = $contenu_objet['titre']; |
||||
if (test_espace_prive()) { |
||||
// On affiche le titre suivi de sa catégorie ou de son préfixe (exclusif) |
||||
$titre .= $contenu_objet['categorie'] ? " ({$contenu_objet['categorie']})" : ''; |
||||
$titre .= $contenu_objet['prefixe'] ? " ({$contenu_objet['prefixe']})" : ''; |
||||
} |
||||
|
||||
return $titre; |
||||
} |
@ -0,0 +1,12 @@
|
||||
<?php |
||||
// This is a SPIP language file -- Ceci est un fichier langue de SPIP |
||||
// Fichier source, a modifier dans svn://zone.spip.org/spip-zone/_plugins_/article_accueil/trunk/lang/ |
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
$GLOBALS[$GLOBALS['idx_lang']] = array( |
||||
|
||||
// I |
||||
'categorie_vide' => 'Aucune catégorie', |
||||
); |
@ -0,0 +1,23 @@
|
||||
<paquet |
||||
prefix="contrib" |
||||
categorie="outil" |
||||
version="0.1.0" |
||||
etat="dev" |
||||
compatibilite="[3.2.0;3.2.*]" |
||||
logo="contrib_logo-64.png" |
||||
schema="1" |
||||
> |
||||
<nom>Contrib - Mécanismes et espace privé</nom> |
||||
|
||||
<auteur>Collectif SPIP</auteur> |
||||
|
||||
<licence lien="http://www.gnu.org/licenses/gpl-3.0.html">GPL 3</licence> |
||||
|
||||
<necessite nom="exclure_sect" compatibilite="[2.0.18;]" /> |
||||
<necessite nom="selections_editoriales" compatibilite="[1.8.10;]" /> |
||||
<necessite nom="article_accueil" compatibilite="[1.1.6;]" /> |
||||
<necessite nom="cextras" compatibilite="[3.11.8;]" /> |
||||
<necessite nom="autorite" compatibilite="[0.10.23;]" /> |
||||
|
||||
<pipeline nom="declarer_champs_extras" inclure="base/contrib_declarations.php" /> |
||||
</paquet> |
@ -0,0 +1,30 @@
|
||||
[(#REM) |
||||
|
||||
### /!\ Saisie des catégories d'un plugin ### |
||||
|
||||
Paramètres : |
||||
- nom : name du select |
||||
- data : tableau de donnees avec ou sans traduction |
||||
sans => [] = alias catégorie |
||||
avec => [alias catégorie] = traduction catégorie |
||||
- class : classe(s) css ajoutes au select |
||||
- option_intro : chaine de langue de la premiere ligne vide ? (defaut:"") |
||||
- cacher_option_intro : pas de premier option vide (defaut:"") |
||||
] |
||||
|
||||
<B_categories> |
||||
<select name="#ENV{nom}" id="champ_#ENV{nom}"[ class="(#ENV{class})"][ disabled="(#ENV{disable})"][ readonly="(#ENV{readonly})"] > |
||||
[(#ENV{cacher_option_intro}|non) |
||||
<option value=""[ (#ENV{categorie}|non)selected="selected"]> |
||||
[(#ENV{option_intro, <:svp:option_categorie_toute:>})] |
||||
</option> |
||||
] |
||||
<BOUCLE_categories(DATA) {source table, #GET{data}}> |
||||
[(#SET{value, [(#CLE|is_string|?{#CLE, #VALEUR})]})] |
||||
<option value="#GET{value}"[ (#ENV{categorie}|=={#GET{value}}|oui)selected="selected"]> |
||||
#VALEUR |
||||
</option> |
||||
</BOUCLE_categories> |
||||
</select> |
||||
</B_categories> |
||||
[(#ENV**|unserialize|bel_env)] |
@ -0,0 +1,30 @@
|
||||
[(#REM) |
||||
|
||||
### /!\ Saisie des catégories d'un plugin ### |
||||
|
||||
Paramètres : |
||||
- nom : name du select |
||||
- class : classe(s) css ajoutes au select |
||||
] |
||||
|
||||
[(#REM) Déterminer les data en fonction du contexte ] |
||||
#SET{data, #ARRAY} |
||||
<BOUCLE_secteur(RUBRIQUES) {id_rubrique}> |
||||
[(#PROFONDEUR|=={0}|oui) #SET{data, #VAL{1}|svp_lister_categorie}] |
||||
[(#PROFONDEUR|=={1}|oui) #SET{data, #VAL{2}|svp_lister_categorie{#INFO_CATEGORIE{rubrique, #ID_PARENT}}}] |
||||
</BOUCLE_secteur> |
||||
|
||||
|
||||
<B_categories> |
||||
<select name="#ENV{nom}" id="champ_#ENV{nom}"[ class="(#ENV{class})"][ disabled="(#ENV{disable})"][ readonly="(#ENV{readonly})"] > |
||||
[<option value=""[ (#ENV{categorie}|non)selected="selected"]> |
||||
(#ENV{option_intro}) |
||||
</option>] |
||||
<BOUCLE_categories(DATA) {source table, #GET{data}}> |
||||
[(#SET{value, [(#CLE|is_string|?{#CLE, #VALEUR})]})] |
||||
<option value="#GET{value}"[ (#ENV{categorie}|=={#GET{value}}|oui)selected="selected"]> |
||||
#VALEUR |
||||
</option> |
||||
</BOUCLE_categories> |
||||
</select> |
||||
</B_categories> |
Loading…
Reference in new issue