[ Index ]
 

Code source de SPIP 1.8.3

Accédez au Source d'autres logiciels libres | Soutenez Angelica Josefina !

title

Body

[fermer]

/ecrire/ -> inc_barre.php3 (source)

   1  <?php
   2  
   3  /***************************************************************************\
   4   *  SPIP, Systeme de publication pour l'internet                           *
   5   *                                                                         *
   6   *  Copyright (c) 2001-2005                                                *
   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  //
  14  // Ce fichier ne sera execute qu'une fois
  15  if (defined("_INC_BARRE")) return;
  16  define("_INC_BARRE", "1");
  17  
  18  // construit un bouton (ancre) de raccourci avec icone et aide
  19  
  20  function bouton_barre_racc($action, $img, $help, $champhelp) {
  21  
  22      return "<a\nhref=\"javascript:"
  23          .$action
  24          ."\" class='spip_barre' tabindex='1000'\ntitle=\""
  25          .addslashes(attribut_html($help))
  26          ."\"" 
  27          .(!_DIR_RESTREINT ? '' :  "\nonMouseOver=\"helpline('"
  28            .addslashes(attribut_html($help))
  29            ."',$champhelp)\"\nonMouseOut=\"helpline('"
  30            .addslashes(attribut_html(_T('barre_aide')))
  31            ."', $champhelp)\"")
  32          ."><img\nsrc='"
  33          ._DIR_IMG_ICONES_BARRE
  34          .$img
  35          ."' border='0' height='16' width='16' align='middle' /></a>";
  36  }
  37  
  38  // construit un tableau de raccourcis pour un noeud de DOM 
  39  
  40  function afficher_barre($champ, $forum=false) {
  41      static $num_barre = 0;
  42      include_ecrire  ("inc_layer.php3");
  43      if (!$GLOBALS['browser_barre']) return '';
  44  
  45      global $spip_lang, $spip_lang_right, $spip_lang_left;
  46  
  47      $ret = ($num_barre > 0)  ? '' :
  48        '<script type="text/javascript" src="' . _DIR_PREFIX1. 'spip_barre.js"></script>';
  49      $num_barre++;
  50      $champhelp = "document.getElementById('barre_$num_barre')";
  51  
  52      $ret .= "<table class='spip_barre' width='100%' cellpadding='0' cellspacing='0' border='0'>";
  53      $ret .= "\n<tr width='100%' class='spip_barre'>";
  54      $ret .= "\n<td style='text-align: $spip_lang_left;' valign='middle'>";
  55      $col = 1;
  56  
  57      // Italique, gras, intertitres
  58      $ret .= bouton_barre_racc ("barre_raccourci('{','}',$champ)", "italique.png", _T('barre_italic'), $champhelp);
  59      $ret .= bouton_barre_racc ("barre_raccourci('{{','}}',$champ)", "gras.png", _T('barre_gras'), $champhelp);
  60      if (!$forum) {
  61          $ret .= bouton_barre_racc ("barre_raccourci('\n\n{{{','}}}\n\n',$champ)", "intertitre.png", _T('barre_intertitre'), $champhelp);
  62      }
  63      $ret .= "&nbsp;&nbsp;&nbsp;</td>\n<td>";
  64      $col ++;
  65  
  66      // Lien hypertexte, notes de bas de page, citations
  67      $ret .= bouton_barre_racc ("barre_demande('[','->',']', '".addslashes(_T('barre_lien_input'))."', $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      }
  72      if ($forum) {
  73          $ret .= "&nbsp;&nbsp;&nbsp;&nbsp;</td>\n<td>";
  74          $col ++;
  75          $ret .= bouton_barre_racc ("barre_raccourci('\n\n&lt;quote&gt;','&lt;/quote&gt;\n\n',$champ)", "quote.png", _T('barre_quote'), $champhelp);
  76      }
  77  
  78      $ret .= "&nbsp;&nbsp;&nbsp;&nbsp;</td>";
  79      $col++;
  80  
  81      // Insertion de caracteres difficiles a taper au clavier (guillemets, majuscules accentuees...)
  82      $ret .= "\n<td style='text-align:$spip_lang_left;' valign='middle'>";
  83      $col++;
  84      if ($spip_lang == "fr" OR $spip_lang == "eo" OR $spip_lang == "cpf" OR $spip_lang == "ar" OR $spip_lang == "es") {
  85          $ret .= bouton_barre_racc ("barre_raccourci('&laquo;','&raquo;',$champ)", "guillemets.png", _T('barre_guillemets'), $champhelp);
  86          $ret .= bouton_barre_racc ("barre_raccourci('&ldquo;','&rdquo;',$champ)", "guillemets-simples.png", _T('barre_guillemets_simples'), $champhelp);
  87      }
  88      else if ($spip_lang == "bg" OR $spip_lang == "de" OR $spip_lang == "pl" OR $spip_lang == "hr" OR $spip_lang == "src") {
  89          $ret .= bouton_barre_racc ("barre_raccourci('&bdquo;','&ldquo;',$champ)", "guillemets-de.png", _T('barre_guillemets'), $champhelp);
  90          $ret .= bouton_barre_racc ("barre_raccourci('&sbquo;','&lsquo;',$champ)", "guillemets-uniques-de.png", _T('barre_guillemets_simples'), $champhelp);
  91      }
  92      else {
  93          $ret .= bouton_barre_racc ("barre_raccourci('&ldquo;','&rdquo;',$champ)", "guillemets-simples.png", _T('barre_guillemets'), $champhelp);
  94          $ret .= bouton_barre_racc ("barre_raccourci('&lsquo;','&rsquo;',$champ)", "guillemets-uniques.png", _T('barre_guillemets_simples'), $champhelp);
  95      }
  96      if ($spip_lang == "fr" OR $spip_lang == "eo" OR $spip_lang == "cpf") {
  97          $ret .= bouton_barre_racc ("barre_inserer('&Agrave;',$champ)", "agrave-maj.png", _T('barre_a_accent_grave'), $champhelp);
  98          $ret .= bouton_barre_racc ("barre_inserer('&Eacute;',$champ)", "eacute-maj.png", _T('barre_e_accent_aigu'), $champhelp);
  99          if ($spip_lang == "fr") {
 100              $ret .= bouton_barre_racc ("barre_inserer('&oelig;',$champ)", "oelig.png", _T('barre_eo'), $champhelp);
 101              $ret .= bouton_barre_racc ("barre_inserer('&OElig;',$champ)", "oelig-maj.png", _T('barre_eo_maj'), $champhelp);
 102          }
 103      }
 104      $ret .= bouton_barre_racc ("barre_inserer('&euro;',$champ)", "euro.png", _T('barre_euro'), $champhelp);
 105  
 106      $ret .= "&nbsp;&nbsp;&nbsp;&nbsp;</td>";
 107      $col++;
 108  
 109      if (!_DIR_RESTREINT) {
 110          $ret .= "\n<td style='text-align:$spip_lang_right;' valign='middle'>";
 111          $col++;
 112      //    $ret .= "&nbsp;&nbsp;&nbsp;";
 113          $ret .= aide("raccourcis");
 114          $ret .= "&nbsp;";
 115          $ret .= "</td>";
 116      }
 117      $ret .= "</tr>";
 118  
 119      // Sur les forums publics, petite barre d'aide en survol des icones
 120      if (_DIR_RESTREINT)
 121          $ret .= "\n<tr>\n<td colspan='$col'><input disabled='disabled' type='text' id='barre_$num_barre' size='45' maxlength='100' style='width:100%; font-size:11px; color: black; background-color: #e4e4e4; border: 0px solid #dedede;'\nvalue=\"".attribut_html(_T('barre_aide'))."\" /></td></tr>";
 122  
 123      $ret .= "</table>";
 124      return $ret;
 125  }
 126  
 127  // pour compatibilite arriere. utiliser directement le corps a present.
 128  
 129  function afficher_claret() {
 130      include_ecrire  ("inc_layer.php3");
 131      return $GLOBALS['browser_caret'];
 132  }
 133  
 134  ?>


Généré le : Thu Feb 22 22:27:47 2007 par Balluche grâce à PHPXref 0.7