[ Index ]
 

Code source de SPIP 1.9.2c

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/ecrire/inc/ -> barre.php (source)

   1  <?php
   2  
   3  /***************************************************************************\
   4   *  SPIP, Systeme de publication pour l'internet                           *
   5   *                                                                         *
   6   *  Copyright (c) 2001-2007                                                *
   7   *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
   8   *                                                                         *
   9   *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
  10   *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
  11  \***************************************************************************/
  12  
  13  if (!defined("_ECRIRE_INC_VERSION")) return;
  14  
  15  // construit un bouton (ancre) de raccourci avec icone et aide
  16  
  17  // http://doc.spip.org/@bouton_barre_racc
  18  function bouton_barre_racc($action, $img, $help, $champhelp) {
  19  
  20      $a = attribut_html($help);
  21      return "<a\nhref=\"javascript:"
  22          .$action
  23          ."\" tabindex='1000'\ntitle=\""
  24          . $a
  25          ."\"" 
  26          .(!_DIR_RESTREINT ? '' :  "\nonmouseover=\"helpline('"
  27            .addslashes(str_replace('&#39;',"'",$a))
  28            ."',$champhelp)\"\nonmouseout=\"helpline('"
  29            .attribut_html(_T('barre_aide'))
  30            ."', $champhelp)\"")
  31          ."><img\nsrc='"
  32          ._DIR_IMG_ICONES_BARRE
  33          .$img
  34          ."' style=\"height: 16px; width: 16px; background-position: center center;\" alt=\"$a\"/></a>";
  35  }
  36  
  37  // construit un tableau de raccourcis pour un noeud de DOM 
  38  
  39  // http://doc.spip.org/@afficher_barre
  40  function afficher_barre($champ, $forum=false, $lang='') {
  41      global $spip_lang, $spip_lang_right, $spip_lang_left, $spip_lang;
  42      static $num_barre = 0;
  43      include_spip('inc/layer');
  44      if (!$GLOBALS['browser_barre']) return '';
  45      if (!$lang) $lang = $spip_lang;
  46      $num_barre++;
  47      $champhelp = "document.getElementById('barre_$num_barre')";
  48  
  49      $ret = ($num_barre > 1)  ? '' :
  50        '<script type="text/javascript" src="' . _DIR_JAVASCRIPT . 'spip_barre.js"></script>';
  51      $ret .= "<table class='spip_barre' cellpadding='0' cellspacing='0' border='0'>";
  52      $ret .= "\n<tr>";
  53      $ret .= "\n<td style='text-align: $spip_lang_left;' valign='middle'>";
  54      $col = 1;
  55  
  56      // Italique, gras, intertitres
  57      $ret .= bouton_barre_racc ("barre_raccourci('{','}',$champ)", "italique.png", _T('barre_italic'), $champhelp);
  58      $ret .= bouton_barre_racc ("barre_raccourci('{{','}}',$champ)", "gras.png", _T('barre_gras'), $champhelp);
  59      if (!$forum) {
  60          $ret .= bouton_barre_racc ("barre_raccourci('\n\n{{{','}}}\n\n',$champ)", "intertitre.png", _T('barre_intertitre'), $champhelp);
  61      }
  62      $ret .= "</td>\n<td>";
  63      $col ++;
  64  
  65      // Lien hypertexte, notes de bas de page, citations
  66      $js = addslashes(_T('barre_lien_input'));
  67      $ret .= bouton_barre_racc ("barre_demande('[','->',']', '$js', $champ)",
  68          "lien.png", _T('barre_lien'), $champhelp);
  69      if (!$forum) {
  70          $ret .= bouton_barre_racc ("barre_raccourci('[[',']]',$champ)", "notes.png", _T('barre_note'), $champhelp);
  71      } else {
  72          $col ++;
  73          $ret .= "</td>\n<td>"
  74            . bouton_barre_racc ("barre_raccourci('\n\n&lt;quote&gt;','&lt;/quote&gt;\n\n',$champ)", "quote.png", _T('barre_quote'), $champhelp);
  75      }
  76  
  77      $ret .= "</td>";
  78  
  79      // Insertion de caracteres difficiles a taper au clavier (guillemets, majuscules accentuees...)
  80      $ret .= "\n<td style='text-align:$spip_lang_left;' valign='middle'>";
  81      $col++;
  82      if ($lang == "fr" OR $lang == "eo" OR $lang == "cpf" OR $lang == "ar" OR $lang == "es") {
  83          $ret .= bouton_barre_racc ("barre_raccourci('&laquo;','&raquo;',$champ)", "guillemets.png", _T('barre_guillemets'), $champhelp);
  84          $ret .= bouton_barre_racc ("barre_raccourci('&ldquo;','&rdquo;',$champ)", "guillemets-simples.png", _T('barre_guillemets_simples'), $champhelp);
  85      }
  86      else if ($lang == "bg" OR $lang == "de" OR $lang == "pl" OR $lang == "hr" OR $lang == "src") {
  87          $ret .= bouton_barre_racc ("barre_raccourci('&bdquo;','&ldquo;',$champ)", "guillemets-de.png", _T('barre_guillemets'), $champhelp);
  88          $ret .= bouton_barre_racc ("barre_raccourci('&sbquo;','&lsquo;',$champ)", "guillemets-uniques-de.png", _T('barre_guillemets_simples'), $champhelp);
  89      }
  90      else {
  91          $ret .= bouton_barre_racc ("barre_raccourci('&ldquo;','&rdquo;',$champ)", "guillemets-simples.png", _T('barre_guillemets'), $champhelp);
  92          $ret .= bouton_barre_racc ("barre_raccourci('&lsquo;','&rsquo;',$champ)", "guillemets-uniques.png", _T('barre_guillemets_simples'), $champhelp);
  93      }
  94      if ($lang == "fr" OR $lang == "eo" OR $lang == "cpf") {
  95          $ret .= bouton_barre_racc ("barre_inserer('&Agrave;',$champ)", "agrave-maj.png", _T('barre_a_accent_grave'), $champhelp);
  96          $ret .= bouton_barre_racc ("barre_inserer('&Eacute;',$champ)", "eacute-maj.png", _T('barre_e_accent_aigu'), $champhelp);
  97          if ($lang == "fr") {
  98              $ret .= bouton_barre_racc ("barre_inserer('&oelig;',$champ)", "oelig.png", _T('barre_eo'), $champhelp);
  99              $ret .= bouton_barre_racc ("barre_inserer('&OElig;',$champ)", "oelig-maj.png", _T('barre_eo_maj'), $champhelp);
 100          }
 101      }
 102      $ret .= bouton_barre_racc ("barre_inserer('&euro;',$champ)", "euro.png", _T('barre_euro'), $champhelp);
 103  
 104      $ret .= "</td>";
 105  
 106      if (!_DIR_RESTREINT) {
 107          $ret .= "\n<td style='text-align:$spip_lang_right;' valign='middle'>";
 108          $col++;
 109      //    $ret .= "&nbsp;&nbsp;&nbsp;";
 110          $ret .= aide("raccourcis");
 111          $ret .= "&nbsp;";
 112          $ret .= "</td>";
 113      }
 114      $ret .= "</tr>";
 115  
 116      // Sur les forums publics, petite barre d'aide en survol des icones
 117      if (_DIR_RESTREINT)
 118          $ret .= "\n<tr>\n<td colspan='$col'><input disabled='disabled' type='text' class='barre' id='barre_$num_barre' size='45' maxlength='100'\nvalue=\"".attribut_html(_T('barre_aide'))."\" /></td></tr>";
 119  
 120      $ret .= "</table>";
 121  
 122      return $ret;
 123  }
 124  
 125  // http://doc.spip.org/@afficher_textarea_barre
 126  function afficher_textarea_barre($texte, $forum=false)
 127  {
 128      global $spip_display, $spip_ecran;
 129  
 130      $rows = ($spip_ecran == "large") ? 28 : 15;
 131  
 132      return (($spip_display == 4) ? '' :
 133          afficher_barre('document.formulaire.texte', $forum))
 134      . "<textarea name='texte' id='texte' "
 135      . $GLOBALS['browser_caret']
 136      . " rows='$rows' class='formo' cols='40'>"
 137      . entites_html($texte)
 138      . "</textarea>\n";
 139  }
 140  
 141  ?>


Généré le : Wed Nov 21 10:20:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics