Changeset 54034 in spip-zone
- Timestamp:
- Nov 4, 2011, 2:23:55 PM (9 years ago)
- Location:
- _plugins_/agenda/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/agenda/trunk/action/editer_evenement.php
r54006 r54034 7 7 */ 8 8 9 9 /** 10 * Edition d'un evenement 11 * @param string $arg 12 * @return array 13 */ 10 14 function action_editer_evenement_dist($arg=null){ 11 15 … … 28 32 29 33 /** 30 * creer un nouvel evenement 34 * Creer un nouvel evenement 35 * 31 36 * @param int $id_article 32 37 * @param int $id_evenement_source … … 43 48 "id_evenement_source"=>intval($id_evenement_source), 44 49 'id_article'=>intval($id_article), 45 "maj"=>date("Y-m-d H:i:s"),46 50 'statut' => 'prepa', 47 51 ); … … 77 81 } 78 82 79 83 /** 84 * Modifier un evenement existant 85 * 86 * @param int $id_evenement 87 * @param array $set 88 * @return bool|string 89 */ 80 90 function evenement_modifier($id_evenement, $set=null){ 81 91 … … 111 121 evenement_associer_mots($id_evenement,$mots); 112 122 113 agenda_action_revision_evenement_repetitions($id_evenement,_request('repetitions',$set)); 114 115 // Modification de statut, changement de rubrique ? 123 if (!is_null($repetitions = _request('repetitions',$set))) 124 agenda_action_revision_evenement_repetitions($id_evenement,$repetitions); 125 126 // Modification de statut, changement de parent ? 116 127 $c = collecter_requests(array('statut', 'id_parent'),array(),$set); 117 128 $err = evenement_instituer($id_evenement, $c); … … 234 245 } 235 246 247 /** 248 * Associer une liste de mots a un evenement 249 * Modifie la liste des mots lies pour qu'elle corresponde exactement a $mots 250 * 251 * @param int $id_evenement 252 * @param array $mots 253 * @return void 254 */ 236 255 function evenement_associer_mots($id_evenement,$mots){ 237 256 include_spip('action/editer_liens'); … … 243 262 244 263 245 // $c est un array ('statut', 'id_parent' = changement de rubrique) 264 /** 265 * Instituer un evenement 266 * 267 * @param int $id_evenement 268 * @param array $c 269 * @return bool|string 270 */ 246 271 function evenement_instituer($id_evenement, $c) { 247 272 … … 249 274 include_spip('inc/modifier'); 250 275 251 $row = sql_fetsel("id_article", "spip_evenements", "id_evenement=".intval($id_evenement)); 252 $id_parent = $row['id_article']; 276 $row = sql_fetsel("id_article, statut", "spip_evenements", "id_evenement=".intval($id_evenement)); 277 $id_parent = $id_parent_ancien = $row['id_article']; 278 $statut = $statut_ancien = $row['statut']; 279 253 280 $champs = array(); 254 281 255 282 if (!autoriser('modifier', 'article', $id_parent) 256 OR ( !autoriser('modifier', 'article', $c['id_parent']))){283 OR (isset($c['id_parent']) AND !autoriser('modifier', 'article', $c['id_parent']))){ 257 284 spip_log("editer_evenement $id_evenement refus " . join(' ', $c)); 258 285 return false; 259 286 } 260 287 261 // Verifier que l a rubrique demandee existe et est differente262 // de l a rubrique actuelle288 // Verifier que l'article demande existe et est different 289 // de l'article actuel 263 290 if ($c['id_parent'] 264 AND $c['id_parent'] != $id_parent 265 AND (sql_fetsel('1', "spip_articles", "id_article=".intval($c['id_parent'])))) { 266 $champs['id_article'] = $c['id_parent']; 291 AND $c['id_parent'] != $id_parent 292 AND (sql_countsel("spip_articles", "id_article=".intval($c['id_parent'])))) { 293 $id_parent = $champs['id_article'] = $c['id_parent']; 294 } 295 296 $sa = sql_getfetsel('statut','spip_articles','id_article='.intval($id_parent)); 297 if ($id_parent 298 AND ( 299 $id_parent!==$id_parent_ancien OR $statut=='0' 300 )){ 301 switch($sa){ 302 case 'publie': 303 // statut par defaut si besoin 304 if ($statut=='0') 305 $champs['statut'] = $statut = 'publie'; 306 break; 307 case 'poubelle': 308 // si article a la poubelle, evenement aussi 309 $champs['statut'] = $statut = 'poubelle'; 310 break; 311 default: 312 // pas de publie ni 0 si article pas publie 313 if (in_array($statut,array('publie','0'))) 314 $champs['statut'] = $statut = 'prop'; 315 break; 316 } 317 } 318 319 // si pas d'article lie, et statut par defaut 320 // on met en propose 321 if ($statut=='0') 322 $champs['statut'] = $statut = 'prop'; 323 324 if (isset($c['statut']) 325 AND $s = $c['statut'] 326 AND $s != $statut) { 327 // pour instituer un evenement il faut avoir le droit d'instituer l'article associe avec le meme statut 328 if (autoriser('instituer', 'article', $id_parent, null, array('statut'=>$s)) 329 AND ($sa=='publie' OR $s!=='publie')) 330 $champs['statut'] = $statut = $s; 331 else 332 spip_log("editer_evenement $id_evenement refus " . join(' ', $c)); 267 333 } 268 334 … … 274 340 'action'=>'instituer', 275 341 'id_objet' => $id_evenement, 276 'id_parent_ancien' => $id_parent, 342 'id_parent_ancien' => $id_parent_ancien, 343 'statut_ancien' => $statut_ancien, 277 344 ), 278 345 'data' => $champs … … 289 356 // Invalider les caches 290 357 include_spip('inc/invalideur'); 358 suivre_invalideur("id='id_article/$id_parent_ancien'"); 291 359 suivre_invalideur("id='id_article/$id_parent'"); 292 suivre_invalideur("id='id_article/".$champs['id_article']."'");293 360 294 361 // Pipeline … … 299 366 'action'=>'instituer', 300 367 'id_objet' => $id_evenement, 301 'id_parent_ancien' => $id_parent, 368 'id_parent_ancien' => $id_parent_ancien, 369 'statut_ancien' => $statut_ancien, 302 370 ), 303 371 'data' => $champs … … 308 376 if ($notifications = charger_fonction('notifications', 'inc')) { 309 377 $notifications('instituerevenement', $id_evenement, 310 array('id_parent' => $ champs['id_article'], 'id_parent_ancien' => $id_parent)378 array('id_parent' => $id_parent, 'statut' => $statut, 'id_parent_ancien' => $id_parent, 'statut_ancien' => $statut_ancien) 311 379 ); 312 380 } -
_plugins_/agenda/trunk/agenda_administrations.php
r53973 r54034 27 27 array('sql_alter',"TABLE spip_evenements ADD `id_article` bigint(21) DEFAULT '0' NOT NULL AFTER `id_evenement`"), 28 28 array('sql_alter',"TABLE spip_evenements ADD ADD INDEX ( `id_article` )"), 29 array('upgrade_evenements_articles '),29 array('upgrade_evenements_articles_012'), 30 30 array('sql_drop_table',"spip_evenements_articles"), 31 31 ); … … 62 62 include_spip('maj/svn10000'); 63 63 $maj['0.24.0'] = array( 64 65 64 array('maj_liens','mot','evenement'), 66 65 array('sql_drop_table',"spip_mots_evenements"), 67 66 array('sql_alter',"TABLE spip_evenements ADD statut varchar(10) DEFAULT 0 NOT NULL"), 68 array('sql_update',"spip_evenements", array('statut'=>'publie'), 'id_evenement>0'), 67 ); 68 $maj['0.25.0'] = array( 69 array('upgrade_evenements_statut_025'), 69 70 ); 70 71 … … 72 73 maj_plugin($nom_meta_base_version, $version_cible, $maj); 73 74 } 74 function upgrade_evenements_articles(){75 $res = sql_select("*", "spip_evenements_articles");76 while ($row = sql_fetch($res)){77 $id_article = $row['id_article'];78 $id_evenement = $row['id_evenement'];79 sql_update("spip_evenements", array('statut'=>"publie"));80 }81 75 76 function agenda_vider_tables() { 77 sql_drop_table("spip_evenements"); 78 sql_drop_table("spip_mots_evenements"); 79 sql_alter("TABLE spip_rubriques DROP COLUMN agenda"); 80 effacer_meta('agenda_base_version'); 81 } 82 83 function upgrade_evenements_articles_012(){ 84 $res = sql_select("*", "spip_evenements_articles"); 85 while ($row = sql_fetch($res)){ 86 $id_article = $row['id_article']; 87 $id_evenement = $row['id_evenement']; 88 sql_update("spip_evenements", array('id_article'=>$id_article),'id_evenement='.intval($id_evenement)); 82 89 } 83 84 function agenda_vider_tables() { 85 sql_drop_table("spip_evenements"); 86 sql_drop_table("spip_mots_evenements"); 87 sql_alter("TABLE spip_rubriques DROP COLUMN agenda"); 88 effacer_meta('agenda_base_version'); 90 } 91 92 function upgrade_evenements_statut_025(){ 93 include_spip('action/editer_evenement'); 94 $res = sql_select('id_evenement','spip_evenements',"statut='0'"); 95 while ($row = sql_fetch($res)){ 96 evenement_modifier($row['id_evenement'],array()); 89 97 } 90 98 } 91 99 92 100 ?> -
_plugins_/agenda/trunk/base/agenda_evenements.php
r54000 r54034 7 7 */ 8 8 9 /** 10 * Interfaces du compilateur 11 * 12 * @param array $interface 13 * @return array 14 */ 9 15 function agenda_declarer_tables_interfaces($interface){ 10 16 // 'spip_' dans l'index de $tables_principales 11 17 $interface['table_des_tables']['evenements']='evenements'; 12 18 13 //-- Jointures ---------------------------------------------------- 14 15 $interface['tables_jointures']['spip_articles'][]= 'evenements'; 16 $interface['tables_jointures']['spip_evenements'][] = 'articles'; 17 $interface['tables_jointures']['spip_evenements'][] = 'evenements_participants'; 18 $interface['tables_jointures']['spip_auteurs'][] = 'evenements_participants'; 19 $interface['table_des_traitements']['LIEU'][]= 'typo(%s)'; 19 $interface['table_des_traitements']['LIEU'][]= _TRAITEMENT_TYPO; 20 20 21 21 // permet d'utiliser les criteres racine, meme_parent, id_parent … … 23 23 $interface['exceptions_des_tables']['evenements']['id_rubrique']=array('spip_articles', 'id_rubrique'); 24 24 25 $interface['table_date']['evenements'] = 'date_debut';26 27 // des titres pour certains jeux d'URL (propre, arborescent...)28 $interface['table_titre']['evenements'] = 'titre, "" AS lang';29 30 25 return $interface; 31 26 } 32 27 33 function agenda_declarer_tables_principales($tables_principales){ 34 35 36 $tables_principales['spip_rubriques']['field']['agenda'] = 'tinyint(1) DEFAULT 0 NOT NULL'; 37 38 return $tables_principales; 39 } 40 28 /** 29 * Tables auxiliaires de liens 30 * @param array $tables_auxiliaires 31 * @return array 32 */ 41 33 function agenda_declarer_tables_auxiliaires($tables_auxiliaires){ 42 34 … … 59 51 return $tables_auxiliaires; 60 52 } 53 54 /** 55 * Declarer la table objet evenement 56 * 57 * @param array $tables 58 * @return array 59 */ 61 60 function agenda_declarer_tables_objets_sql($tables){ 62 61 $tables['spip_evenements'] = array( … … 70 69 'info_1_objet' => 'agenda:info_un_evenement', 71 70 'info_nb_objets' => 'agenda:info_nombre_evenements', 72 'titre' => 'titre ',73 'date' => 'date_ heure',71 'titre' => 'titre, "" AS lang', 72 'date' => 'date_debut', 74 73 'principale' => 'oui', 75 74 'champs_editables' => array('date_debut', 'date_fin', 'titre', 'descriptif','lieu', 'adresse', 'inscription', 'places', 'horaire'), … … 100 99 "id_article"=>"id_article" 101 100 ), 101 'tables_jointures' => array( 102 'articles', 103 'evenements_participants', 104 ), 102 105 'rechercher_champs' => array( 103 106 'titre' => 8, 'descriptif' => 5, 'lieu' => 5, 'adresse' => 3 … … 114 117 ), 115 118 ), 119 'statut_titres' => array( 120 'prop'=>'agenda:info_evenement_propose', 121 'publie'=>'agenda:info_evenement_publie', 122 'poubelle'=>'agenda:info_evenement_supprime' 123 ), 124 'statut_textes_instituer' => array( 125 'prop' => 'texte_statut_propose_evaluation', 126 'publie' => 'texte_statut_publie', 127 'poubelle' => 'texte_statut_poubelle', 128 ), 129 'texte_changer_statut' => 'agenda:texte_evenement_statut', 116 130 'champs_versionnes' => array('id_article', 'titre', 'descriptif', 'lieu', 'adresse'), 131 117 132 ); 133 134 //-- Jointures ---------------------------------------------------- 135 $tables['spip_articles']['tables_jointures'][] = 'evenements'; 136 $tables['spip_auteurs']['tables_jointures'][] = 'evenements_participants'; 137 $tables['spip_rubriques']['field']['agenda'] = 'tinyint(1) DEFAULT 0 NOT NULL'; 118 138 119 139 return $tables; -
_plugins_/agenda/trunk/lang/agenda_fr.php
r54000 r54034 68 68 'info_aucun_evenement' => 'Aucun événement', 69 69 'info_evenement' => 'Événement', 70 'info_evenement_propose' => 'Événement proposé', 71 'info_evenement_publie' => 'Événement publié', 72 'info_evenement_poubelle' => 'Événement supprimé', 70 73 'info_evenements' => 'Événements', 71 74 'info_nombre_evenements' => '@nb@ événements', … … 107 110 'telecharger' => 'Télécharger', 108 111 'texte_agenda' => 'AGENDA', 112 'texte_evenement_statut' => 'Cet événement est :', 109 113 'titre_cadre_ajouter_evenement' => 'Ajouter un événement', 110 114 'titre_cadre_modifier_evenement' => 'Modifier un événement', -
_plugins_/agenda/trunk/paquet.xml
r54005 r54034 6 6 compatibilite="[3.0.0-dev;[" 7 7 logo="prive/themes/spip/images/evenement-32.png" 8 schema="0.2 4.0"8 schema="0.25.0" 9 9 documentation="http://www.spip-contrib.net/article2858" 10 10 > … … 18 18 <auteur lien="http://www.cahri.com">Julien Tessier</auteur> 19 19 20 <copyright>2006-201 0</copyright>20 <copyright>2006-2011</copyright> 21 21 22 22 <licence lien="http://www.gnu.org/licenses/gpl-3.0.html">GPL 3</licence> … … 24 24 <pipeline nom="autoriser" inclure="agenda_autoriser.php" /> 25 25 <pipeline nom="declarer_tables_interfaces" inclure="base/agenda_evenements.php" /> 26 <pipeline nom="declarer_tables_principales" inclure="base/agenda_evenements.php" />27 26 <pipeline nom="declarer_tables_auxiliaires" inclure="base/agenda_evenements.php" /> 28 27 <pipeline nom="declarer_tables_objets_sql" inclure="base/agenda_evenements.php" /> -
_plugins_/agenda/trunk/prive/squelettes/navigation/evenement.html
r48217 r54034 1 <BOUCLE_nav(EVENEMENTS){id_evenement}{statut ?}{si #ENV{exec}|=={evenement}}>1 <BOUCLE_nav(EVENEMENTS){id_evenement}{statut==.*}{si #ENV{exec}|=={evenement}}> 2 2 #BOITE_OUVRIR{'','info'} 3 3 #PIPELINE{boite_infos,#ARRAY{data,'',args,#ARRAY{'type','evenement','id',#ENV{id_evenement}}}}
Note: See TracChangeset
for help on using the changeset viewer.