3 if (!defined('_ECRIRE_INC_VERSION')) return;
7 function compagnon_affiche_milieu($flux) {
8 return compagnonage($flux, 'affiche_milieu');
10 function compagnon_affiche_gauche($flux) {
11 return compagnonage($flux, 'affiche_gauche');
13 function compagnon_affiche_droite($flux) {
14 return compagnonage($flux, 'affiche_droite');
21 * Flux d'informations transmises au pipeline
22 * @param string $pipeline
23 * Nom du pipeline d'origine
25 * Le flux éventuellement complété de l'aide du compagnon
27 function compagnonage($flux, $pipeline) {
29 // pas de compagnon souhaite ?
30 include_spip('inc/config');
31 if (lire_config("compagnon/config/activer") == 'non') {
35 $moi = $GLOBALS['visiteur_session'];
36 $deja_vus = lire_config("compagnon/".$moi['id_auteur']);
38 $flux['args']['pipeline'] = $pipeline;
39 $flux['args']['deja_vus'] = $deja_vus;
40 $aides = pipeline('compagnon_messages', array('args'=>$flux['args'], 'data' => array()));
48 foreach ($aides as $aide) {
49 // restreindre l'affichage par statut d'auteur
51 if (isset($aide['statuts']) and $statuts = $aide['statuts']) {
53 if (!is_array($statuts)) {
54 $statuts = array($statuts);
56 if (in_array('webmestre', $statuts) and ($moi['webmestre'] == 'oui')) {
58 } elseif (in_array($moi['statut'], $statuts)) {
63 // si c'est ok, mais que l'auteur a deja lu ca. On s'arrete.
64 if ($ok and is_array($deja_vus) and isset($deja_vus[$aide['id']]) and $deja_vus[$aide['id']]) {
69 // demande d'un squelette
70 if (isset($aide['inclure']) and $inclure = $aide['inclure']) {
71 unset($aide['inclure']);
72 $ajout = recuperer_fond($inclure, array_merge($flux['args'], $aide), array('ajax'=>true));
74 // sinon les textes sont fournis
76 $ajout = recuperer_fond('compagnon/_boite', $aide, array('ajax'=>true));
83 // ajout de nos trouvailles
85 $twinkle = find_in_path('prive/javascript/jquery.twinkle.js');
87 <script type="text/javascript">
88 jQuery.getScript('$twinkle',function(){
93 "color": "rgba(255,96,96,1)",
97 jQuery('.compagnon .target').each(function(){
98 var target = jQuery(this).attr('data-target');
100 jQuery(this).mousemove(function(){
102 delay=1; setTimeout(function(){delay=0;}, 800);
103 jQuery(target).twinkle(options);
112 $flux['data'] = $ajouts . $flux['data'];