
commit
97f2921bbd
7 changed files with 289 additions and 0 deletions
@ -0,0 +1,7 @@
|
||||
* text=auto !eol |
||||
base/breves.php -text |
||||
base/breves_upgrade.php -text |
||||
/breves_autoriser.php -text |
||||
/breves_pipelines.php -text |
||||
/plugin.xml -text |
||||
public/breves.php -text |
@ -0,0 +1,94 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2010 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
|
||||
/** |
||||
* Interfaces des tables breves pour le compilateur |
||||
* |
||||
* @param array $interfaces |
||||
* @return array |
||||
*/ |
||||
function breves_declarer_tables_interfaces($interfaces) { |
||||
$interfaces['table_des_tables']['breves'] = 'breves'; |
||||
|
||||
$interfaces['exceptions_des_tables']['breves']['id_secteur'] = 'id_rubrique'; |
||||
$interfaces['exceptions_des_tables']['breves']['date'] = 'date_heure'; |
||||
$interfaces['exceptions_des_tables']['breves']['nom_site'] = 'lien_titre'; |
||||
$interfaces['exceptions_des_tables']['breves']['url_site'] = 'lien_url'; |
||||
|
||||
$interfaces['table_titre']['breves'] = 'titre, lang'; |
||||
|
||||
$interfaces['table_date']['breves'] = 'date_heure'; |
||||
|
||||
$interfaces['tables_jointures']['spip_breves'][]= 'documents_liens'; |
||||
|
||||
$interfaces['table_des_traitements']['LIEN_TITRE'][]= _TRAITEMENT_TYPO; |
||||
$interfaces['table_des_traitements']['LIEN_URL'][]= 'vider_url(%s)'; |
||||
|
||||
return $interfaces; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Table principale spip_breves |
||||
* |
||||
* @param array $tables_principales |
||||
* @return array |
||||
*/ |
||||
function breves_declarer_tables_principales($tables_principales) { |
||||
|
||||
|
||||
$spip_breves = array( |
||||
"id_breve" => "bigint(21) NOT NULL", |
||||
"date_heure" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL", |
||||
"titre" => "text DEFAULT '' NOT NULL", |
||||
"texte" => "longtext DEFAULT '' NOT NULL", |
||||
"lien_titre" => "text DEFAULT '' NOT NULL", |
||||
"lien_url" => "text DEFAULT '' NOT NULL", |
||||
"statut" => "varchar(6) DEFAULT '0' NOT NULL", |
||||
"id_rubrique" => "bigint(21) DEFAULT '0' NOT NULL", |
||||
"lang" => "VARCHAR(10) DEFAULT '' NOT NULL", |
||||
"langue_choisie" => "VARCHAR(3) DEFAULT 'non'", |
||||
"maj" => "TIMESTAMP"); |
||||
|
||||
$spip_breves_key = array( |
||||
"PRIMARY KEY" => "id_breve", |
||||
"KEY id_rubrique" => "id_rubrique", |
||||
); |
||||
$spip_breves_join = array( |
||||
"id_breve"=>"id_breve", |
||||
"id_rubrique"=>"id_rubrique"); |
||||
|
||||
$tables_principales['spip_breves'] = |
||||
array('field' => &$spip_breves, 'key' => &$spip_breves_key,'join' => &$spip_breves_join); |
||||
|
||||
return $tables_principales; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* Declarer le surnom des breves |
||||
* |
||||
* @param array $surnoms |
||||
* @return array |
||||
*/ |
||||
function breves_declarer_tables_objets_surnoms($surnoms) { |
||||
$surnoms['breve'] = "breves"; |
||||
return $surnoms; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
?> |
@ -0,0 +1,49 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2010 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
/** |
||||
* Installation/maj des tables breves |
||||
* |
||||
* @param string $nom_meta_base_version |
||||
* @param string $version_cible |
||||
*/ |
||||
function breves_upgrade($nom_meta_base_version,$version_cible){ |
||||
$current_version = 0.0; |
||||
if ( (!isset($GLOBALS['meta'][$nom_meta_base_version]) ) |
||||
|| (($current_version = $GLOBALS['meta'][$nom_meta_base_version])!=$version_cible)){ |
||||
|
||||
if ($current_version==0.0){ |
||||
include_spip('base/create'); |
||||
// creer les tables |
||||
creer_base(); |
||||
// mettre les metas par defaut |
||||
$config = charger_fonction('config','inc'); |
||||
$config(); |
||||
ecrire_meta($nom_meta_base_version,$current_version=$version_cible); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Desinstallation/suppression des tables breves |
||||
* |
||||
* @param string $nom_meta_base_version |
||||
*/ |
||||
function breves_vider_tables($nom_meta_base_version) { |
||||
sql_drop_table("spip_breves"); |
||||
|
||||
effacer_meta("activer_breves"); |
||||
|
||||
effacer_meta($nom_meta_base_version); |
||||
} |
||||
|
||||
?> |
@ -0,0 +1,24 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2010 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
// pour le pipeline d'autorisation |
||||
function breves_autoriser(){} |
||||
|
||||
|
||||
// bouton du bandeau |
||||
function autoriser_breves_bouton_dist($faire, $type='', $id=0, $qui = NULL, $opt = NULL){ |
||||
return ($GLOBALS['meta']["activer_breves"] != "non"); |
||||
} |
||||
|
||||
|
||||
|
||||
?> |
@ -0,0 +1,29 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2010 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined("_ECRIRE_INC_VERSION")) return; |
||||
|
||||
|
||||
/** |
||||
* Definir les meta de configuration liee aux breves |
||||
* |
||||
* @param array $metas |
||||
* @return array |
||||
*/ |
||||
function breves_configurer_liste_metas($metas){ |
||||
$metas['activer_breves'] = 'non'; |
||||
return $metas; |
||||
} |
||||
|
||||
|
||||
|
||||
?> |
@ -0,0 +1,49 @@
|
||||
<plugin> |
||||
<nom>Brèves</nom> |
||||
<auteur>Collectif SPIP</auteur> |
||||
<version>1.0</version> |
||||
<version_base>1.0</version_base> |
||||
<install>base/breves_upgrade.php</install> |
||||
<etat>test</etat> |
||||
<description>Les brèves sont des informations courtes, sans auteur.</description> |
||||
<prefix>breves</prefix> |
||||
|
||||
<fonctions>public/breves.php</fonctions> |
||||
|
||||
|
||||
<pipeline> |
||||
<nom>configurer_liste_metas</nom> |
||||
<inclure>breves_pipelines.php</inclure> |
||||
</pipeline> |
||||
|
||||
<pipeline> |
||||
<nom>declarer_tables_interfaces</nom> |
||||
<inclure>base/breves.php</inclure> |
||||
</pipeline> |
||||
<pipeline> |
||||
<nom>declarer_tables_objets_surnoms</nom> |
||||
<inclure>base/breves.php</inclure> |
||||
</pipeline> |
||||
<pipeline> |
||||
<nom>declarer_tables_principales</nom> |
||||
<inclure>base/breves.php</inclure> |
||||
</pipeline> |
||||
|
||||
<pipeline> |
||||
<nom>autoriser</nom> |
||||
<inclure>breves_autoriser.php</inclure> |
||||
</pipeline> |
||||
|
||||
<bouton id='breves' parent="bando_edition"> |
||||
<icone>images/breve-16.png</icone> |
||||
<titre>icone_breves</titre> |
||||
</bouton> |
||||
|
||||
<bouton id='breve_creer' parent="outils_rapides"> |
||||
<icone>images/breve-new-16.png</icone> |
||||
<titre>icone_nouvelle_breve</titre> |
||||
<url>breves_edit</url> |
||||
<args>new=oui&id_rubrique=@id_rubrique@</args> |
||||
</bouton> |
||||
|
||||
</plugin> |
@ -0,0 +1,37 @@
|
||||
<?php |
||||
|
||||
/***************************************************************************\ |
||||
* SPIP, Systeme de publication pour l'internet * |
||||
* * |
||||
* Copyright (c) 2001-2010 * |
||||
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
||||
* * |
||||
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
||||
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
||||
\***************************************************************************/ |
||||
|
||||
if (!defined("_ECRIRE_INC_VERSION")) return; |
||||
|
||||
|
||||
// |
||||
// <BOUCLE(BREVES)> |
||||
// |
||||
// http://doc.spip.org/@boucle_BREVES_dist |
||||
function boucle_BREVES_dist($id_boucle, &$boucles) { |
||||
$boucle = &$boucles[$id_boucle]; |
||||
$id_table = $boucle->id_table; |
||||
$mstatut = $id_table .'.statut'; |
||||
|
||||
// Restreindre aux elements publies |
||||
if (!isset($boucle->modificateur['criteres']['statut'])) { |
||||
if (!$GLOBALS['var_preview']) |
||||
array_unshift($boucle->where,array("'='", "'$mstatut'", "'\\'publie\\''")); |
||||
else |
||||
array_unshift($boucle->where,array("'IN'", "'$mstatut'", "'(\\'publie\\',\\'prop\\')'")); |
||||
} |
||||
|
||||
return calculer_boucle($id_boucle, $boucles); |
||||
} |
||||
|
||||
|
||||
?> |
Loading…
Reference in new issue