Changeset 93608 in spip-zone
- Timestamp:
- Dec 13, 2015, 11:32:10 AM (5 years ago)
- Location:
- _core_/plugins/compagnon
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
_core_/plugins/compagnon/action/compagnon.php
r64983 r93608 4 4 /** 5 5 * Gestion de l'action compagnon 6 * 6 * 7 7 * @package SPIP\Compagnon\Action 8 **/8 **/ 9 9 10 if (!defined('_ECRIRE_INC_VERSION')) return; 10 if (!defined('_ECRIRE_INC_VERSION')) { 11 return; 12 } 11 13 12 14 /** 13 15 * Action compagnon : indique qu'un auteur a validé un message d'aide 14 16 * 15 * @global array $GLOBALS ['visiteur_session']16 **/17 * @global array $GLOBALS ['visiteur_session'] 18 **/ 17 19 function action_compagnon_dist() { 18 $securiser_action = charger_fonction('securiser_action', 'inc');20 $securiser_action = charger_fonction('securiser_action', 'inc'); 19 21 $arg = $securiser_action(); 20 21 if (substr($arg, 0,8) !== 'compris/') {22 23 if (substr($arg, 0, 8) !== 'compris/') { 22 24 include_spip('inc/minipres'); 23 25 echo minipres("Arguments de l'action compagnon non compris"); 24 26 exit; 25 27 } 26 $quoi = substr($arg, 8);28 $quoi = substr($arg, 8); 27 29 $auteur = $GLOBALS['visiteur_session']['id_auteur']; 28 30 29 31 include_spip('inc/config'); 30 32 ecrire_config("compagnon/$auteur/$quoi", 1); 31 33 32 34 } 33 35 -
_core_/plugins/compagnon/compagnon_administrations.php
r64983 r93608 5 5 * 6 6 * @package SPIP\Compagnon\Installation 7 **/7 **/ 8 8 9 if (!defined('_ECRIRE_INC_VERSION')) return; 9 if (!defined('_ECRIRE_INC_VERSION')) { 10 return; 11 } 10 12 11 13 /** … … 13 15 * 14 16 * Active par défaut le compagnon s'il n'y a aucune rubrique dans le site. 15 * 17 * 16 18 * @param string $nom_meta_base_version 17 19 * Nom de la meta informant de la version du schéma de données du plugin installé dans SPIP … … 19 21 * Version du schéma de données dans ce plugin (déclaré dans paquet.xml) 20 22 * @return void 21 **/22 function compagnon_upgrade($nom_meta_base_version, $version_cible) {23 23 **/ 24 function compagnon_upgrade($nom_meta_base_version, $version_cible) { 25 24 26 $maj = array(); 25 27 $maj['create'] = array( … … 31 33 32 34 /** 33 * Déclare la configuration du compagnon 35 * Déclare la configuration du compagnon 34 36 * 35 * Si aucune rubrique n'est présente, active le compagnon, sinon non. 36 **/37 * Si aucune rubrique n'est présente, active le compagnon, sinon non. 38 **/ 37 39 function compagnon_create() { 38 40 include_spip('inc/config'); … … 48 50 * 49 51 * Efface les informations du compagnon 50 * 52 * 51 53 * @param string $nom_meta_base_version 52 54 * Nom de la meta informant de la version du schéma de données du plugin installé dans SPIP 53 55 * @return void 54 **/56 **/ 55 57 function compagnon_vider_tables($nom_meta_base_version) { 56 58 effacer_meta("compagnon"); 57 59 effacer_meta($nom_meta_base_version); 58 60 } 61 59 62 ?> -
_core_/plugins/compagnon/compagnon_fonctions.php
r64983 r93608 3 3 /** 4 4 * Fonctions pour les squelettes 5 * 5 * 6 6 * @package SPIP\Compagnon\Fonctions 7 **/7 **/ 8 8 9 if (!defined('_ECRIRE_INC_VERSION')) return; 9 if (!defined('_ECRIRE_INC_VERSION')) { 10 return; 11 } 10 12 11 13 … … 16 18 * @example 17 19 * [(#VAL|ok_aleatoire)] 18 * 20 * 19 21 * @return string 20 22 * Le texte traduit. 21 **/23 **/ 22 24 function filtre_ok_aleatoire_dist() { 23 25 $alea = array( … … 28 30 'compagnon:ok_parfait', 29 31 ); 30 32 31 33 return _T($alea[array_rand($alea)]); 32 34 } 35 33 36 ?> -
_core_/plugins/compagnon/compagnon_messages.php
r88449 r93608 3 3 /** 4 4 * Gestion de l'action compagnon 5 * 5 * 6 6 * @package SPIP\Compagnon\Pipelines 7 **/7 **/ 8 8 9 if (!defined('_ECRIRE_INC_VERSION')) return; 9 if (!defined('_ECRIRE_INC_VERSION')) { 10 return; 11 } 10 12 11 13 /** … … 16 18 * 17 19 * @pipeline compagnon_messages 18 * 20 * 19 21 * @param array $flux 20 22 * Données du pipeline 21 23 * @return array $flux 22 24 * Données du pipeline 23 **/25 **/ 24 26 function compagnon_compagnon_messages($flux) { 25 27 26 $exec 28 $exec = $flux['args']['exec']; 27 29 $pipeline = $flux['args']['pipeline']; 28 $vus 29 $aides 30 $vus = $flux['args']['deja_vus']; 31 $aides = &$flux['data']; 30 32 31 33 switch ($pipeline) { 32 34 33 35 case 'affiche_milieu': 34 36 switch ($exec) { … … 38 40 'id' => 'accueil', 39 41 'inclure' => 'compagnon/accueil', 40 'statuts' => array('1comite', '0minirezo', 'webmestre')42 'statuts' => array('1comite', '0minirezo', 'webmestre') 41 43 ); 42 44 $aides[] = array( 43 45 'id' => 'accueil_configurer', 44 46 'titre' => _T('compagnon:c_accueil_configurer_site'), 45 'texte' => _T('compagnon:c_accueil_configurer_site_texte', array('nom' =>$GLOBALS['meta']['nom_site'])),46 'statuts' => array('webmestre'),47 'texte' => _T('compagnon:c_accueil_configurer_site_texte', array('nom' => $GLOBALS['meta']['nom_site'])), 48 'statuts' => array('webmestre'), 47 49 'target' => '#bando_identite .nom_site_spip .nom', 48 50 ); … … 51 53 'titre' => _T('compagnon:c_accueil_publication'), 52 54 'texte' => _T('compagnon:c_accueil_publication_texte'), 53 'statuts' => array('webmestre'),54 'target' => '#bando1_menu_edition',55 'statuts' => array('webmestre'), 56 'target' => '#bando1_menu_edition', 55 57 ); 56 58 break; … … 64 66 'titre' => _T('compagnon:c_rubriques_creer'), 65 67 'texte' => _T('compagnon:c_rubriques_creer_texte'), 66 'statuts' => array('webmestre'),67 'target' => '#contenu .icone:first-of-type',68 'statuts' => array('webmestre'), 69 'target' => '#contenu .icone:first-of-type', 68 70 ); 69 71 } … … 74 76 // eviter si possible une requete sql. 75 77 if (!isset($vus['rubrique'])) { 76 $statut = sql_getfetsel('statut', 'spip_rubriques', 'id_rubrique=' .$flux['args']['id_rubrique']);78 $statut = sql_getfetsel('statut', 'spip_rubriques', 'id_rubrique=' . $flux['args']['id_rubrique']); 77 79 if ($statut != 'publie') { 78 80 $aides[] = array( … … 80 82 'titre' => _T('compagnon:c_rubrique_publier'), 81 83 'texte' => _T('compagnon:c_rubrique_publier_texte'), 82 'statuts' => array('webmestre'),83 'target' => '#contenu .icone.article-new-24'84 'statuts' => array('webmestre'), 85 'target' => '#contenu .icone.article-new-24' 84 86 ); 85 87 } … … 94 96 'titre' => _T('compagnon:c_articles_creer'), 95 97 'texte' => _T('compagnon:c_articles_creer_texte'), 96 'statuts' => array('webmestre')98 'statuts' => array('webmestre') 97 99 ); 98 100 } … … 106 108 'titre' => _T('compagnon:c_sites_creer'), 107 109 'texte' => _T('compagnon:c_sites_creer_texte'), 108 'statuts' => array('webmestre')110 'statuts' => array('webmestre') 109 111 ); 110 112 } … … 115 117 'id' => 'article_redaction', 116 118 'inclure' => 'compagnon/article_redaction', 117 'statuts' => array('0minirezo', 'webmestre')118 ); 119 'statuts' => array('0minirezo', 'webmestre') 120 ); 119 121 $aides[] = array( 120 122 'id' => 'article_redaction_redacteur', 121 123 'inclure' => 'compagnon/article_redaction_redacteur', 122 'statuts' => array('1comite')124 'statuts' => array('1comite') 123 125 ); 124 126 break; … … 133 135 'titre' => _T('compagnon:c_job'), 134 136 'texte' => _T('compagnon:c_job_texte'), 135 'statuts' => array('webmestre')137 'statuts' => array('webmestre') 136 138 ); 137 139 break; -
_core_/plugins/compagnon/compagnon_pipelines.php
r85130 r93608 3 3 /** 4 4 * Utilisations de pipelines 5 * 5 * 6 6 * @package SPIP\Compagnon\Pipelines 7 **/7 **/ 8 8 9 if (!defined('_ECRIRE_INC_VERSION')) return; 9 if (!defined('_ECRIRE_INC_VERSION')) { 10 return; 11 } 10 12 11 13 … … 14 16 * 15 17 * @pipeline affiche_milieu 16 * 18 * 17 19 * @param array $flux 18 20 * Données du pipeline 19 21 * @return array 20 22 * Données du pipeline 21 **/23 **/ 22 24 function compagnon_affiche_milieu($flux) { 23 25 return compagnonage($flux, 'affiche_milieu'); … … 28 30 * 29 31 * @pipeline affiche_gauche 30 * 32 * 31 33 * @param array $flux 32 34 * Données du pipeline 33 35 * @return array 34 36 * Données du pipeline 35 **/37 **/ 36 38 function compagnon_affiche_gauche($flux) { 37 39 return compagnonage($flux, 'affiche_gauche'); … … 42 44 * 43 45 * @pipeline affiche_droite 44 * 46 * 45 47 * @param array $flux 46 48 * Données du pipeline 47 49 * @return array 48 50 * Données du pipeline 49 **/51 **/ 50 52 function compagnon_affiche_droite($flux) { 51 53 return compagnonage($flux, 'affiche_droite'); … … 60 62 * 61 63 * @pipeline_appel compagnon_messages 62 * 64 * 63 65 * @param array $flux 64 * 66 * Flux d'informations transmises au pipeline 65 67 * @param string $pipeline 66 * 68 * Nom du pipeline d'origine 67 69 * @return array $flux 68 * 69 **/70 * Le flux éventuellement complété de l'aide du compagnon 71 **/ 70 72 function compagnonage($flux, $pipeline) { 71 73 … … 77 79 78 80 $moi = $GLOBALS['visiteur_session']; 79 $deja_vus = lire_config("compagnon/" .$moi['id_auteur']);81 $deja_vus = lire_config("compagnon/" . $moi['id_auteur']); 80 82 81 83 $flux['args']['pipeline'] = $pipeline; 82 84 $flux['args']['deja_vus'] = $deja_vus; 83 $aides = pipeline('compagnon_messages', array('args' =>$flux['args'], 'data' => array()));85 $aides = pipeline('compagnon_messages', array('args' => $flux['args'], 'data' => array())); 84 86 85 87 if (!$aides) { … … 113 115 if (isset($aide['inclure']) and $inclure = $aide['inclure']) { 114 116 unset($aide['inclure']); 115 $ajout = recuperer_fond($inclure, array_merge($flux['args'], $aide), array('ajax'=>true)); 116 } 117 // sinon les textes sont fournis 117 $ajout = recuperer_fond($inclure, array_merge($flux['args'], $aide), array('ajax' => true)); 118 } // sinon les textes sont fournis 118 119 else { 119 $ajout = recuperer_fond('compagnon/_boite', $aide, array('ajax' =>true));120 $ajout = recuperer_fond('compagnon/_boite', $aide, array('ajax' => true)); 120 121 } 121 122 … … 127 128 if ($ajouts) { 128 129 $twinkle = find_in_path('prive/javascript/jquery.twinkle.js'); 129 $ajouts .=<<<JS130 $ajouts .= <<<JS 130 131 <script type="text/javascript"> 131 132 jQuery.getScript('$twinkle',function(){ … … 155 156 $flux['data'] = $ajouts . $flux['data']; 156 157 } 157 158 158 159 return $flux; 159 160 } 160 161 161 162 162 163 164 163 ?> -
_core_/plugins/compagnon/formulaires/reinitialiser_compagnon.php
r64983 r93608 7 7 * les messages qu'on a déjà vus. Du coup, ils seront de nouveaux 8 8 * affichés sur les différentes pages. 9 * 9 * 10 10 * @package SPIP\Compagnon\Formulaires 11 **/11 **/ 12 12 13 if (!defined('_ECRIRE_INC_VERSION')) return; 13 if (!defined('_ECRIRE_INC_VERSION')) { 14 return; 15 } 14 16 15 17 /** 16 * Chargement du formulaire de réinitialisation des messages du compagnon 18 * Chargement du formulaire de réinitialisation des messages du compagnon 17 19 * 18 20 * @return array 19 21 * Environnement du formulaire 20 **/22 **/ 21 23 function formulaires_reinitialiser_compagnon_charger() { 22 24 return array('qui' => 'moi'); … … 24 26 25 27 /** 26 * Traitement du formulaire de réinitialisation des messages du compagnon 28 * Traitement du formulaire de réinitialisation des messages du compagnon 27 29 * 28 30 * @return array 29 31 * Retours du traitement 30 **/32 **/ 31 33 function formulaires_reinitialiser_compagnon_traiter() { 32 34 $qui = _request('qui'); … … 40 42 ecrire_config('compagnon/config', $config); 41 43 } 42 44 43 45 return array( 44 46 'message_ok' => _T('compagnon:reinitialisation_ok')
Note: See TracChangeset
for help on using the changeset viewer.