diff --git a/.gitattributes b/.gitattributes index a51245def3c618e8ee9e1d3786bd9885affc5b5a..1d7102f03e62a10f6ce4af2fec424e8680d6f753 100644 --- a/.gitattributes +++ b/.gitattributes @@ -47,9 +47,12 @@ IMG/icones/xml-dist.png -text IMG/icones/zip-dist.png -text IMG/icones_barre/barre-a-grave.png -text IMG/icones_barre/barre-bold.png -text +IMG/icones_barre/barre-cadre.png -text +IMG/icones_barre/barre-code.png -text IMG/icones_barre/barre-e-aigu.png -text IMG/icones_barre/barre-euro.png -text IMG/icones_barre/barre-guillemets.png -text +IMG/icones_barre/barre-html.png -text IMG/icones_barre/barre-intertitre.png -text IMG/icones_barre/barre-italic.png -text IMG/icones_barre/barre-lien.png -text @@ -57,6 +60,8 @@ IMG/icones_barre/barre-note.png -text IMG/icones_barre/barre-oe-maj.png -text IMG/icones_barre/barre-oe.png -text IMG/icones_barre/barre-quote.png -text +IMG/icones_barre/barre-tableau.png -text +IMG/icones_barre/barre-wiki.png -text IMG/test.gif -text IMG/test.jpg -text IMG/test.png -text diff --git a/IMG/icones_barre/barre-cadre.png b/IMG/icones_barre/barre-cadre.png new file mode 100644 index 0000000000000000000000000000000000000000..cd6d5c4b0b3e8c294d3e93060c6e1edd52c93920 Binary files /dev/null and b/IMG/icones_barre/barre-cadre.png differ diff --git a/IMG/icones_barre/barre-code.png b/IMG/icones_barre/barre-code.png new file mode 100644 index 0000000000000000000000000000000000000000..4bb5e2d03b8db13b0d145fc5c4c9854726234404 Binary files /dev/null and b/IMG/icones_barre/barre-code.png differ diff --git a/IMG/icones_barre/barre-html.png b/IMG/icones_barre/barre-html.png new file mode 100644 index 0000000000000000000000000000000000000000..381d8423226e33cbcc0b1209569aaebc0aff43c1 Binary files /dev/null and b/IMG/icones_barre/barre-html.png differ diff --git a/IMG/icones_barre/barre-tableau.png b/IMG/icones_barre/barre-tableau.png new file mode 100644 index 0000000000000000000000000000000000000000..97e61f04d5eb492e20d037720c72f804ff847fea Binary files /dev/null and b/IMG/icones_barre/barre-tableau.png differ diff --git a/IMG/icones_barre/barre-wiki.png b/IMG/icones_barre/barre-wiki.png new file mode 100644 index 0000000000000000000000000000000000000000..459b8a815e294233a90dd87c3e465a8148502fdf Binary files /dev/null and b/IMG/icones_barre/barre-wiki.png differ diff --git a/ecrire/inc_barre.php3 b/ecrire/inc_barre.php3 index fa7e1c5e82b410bafb66dfdfbd213f1243aa6f53..31776411ea161515cb7f02d672ad603476dc2cfb 100644 --- a/ecrire/inc_barre.php3 +++ b/ecrire/inc_barre.php3 @@ -45,7 +45,7 @@ function bouton_barre_racc($action, $img, $help, $formulaire, $texte) { } function afficher_barre($formulaire='',$texte='', $forum=false) { - global $spip_lang, $flag_ecrire; + global $spip_lang, $flag_ecrire, $options; if (test_barre()) { $ret = afficher_script_barre(); @@ -54,6 +54,9 @@ function afficher_barre($formulaire='',$texte='', $forum=false) { $ret .= "<tr width='100%'>"; $ret .= "<td align='left'>"; $col++; + + + $ret .= bouton_barre_racc ("javascript:barre_raccourci('{{','}}',$champ)", "barre-bold.png", "Mettre en {{gras}}", $formulaire, $texte); $ret .= bouton_barre_racc ("javascript:barre_raccourci('{','}',$champ)", "barre-italic.png", "Mettre en {italique}", $formulaire, $texte); if (!$forum) { @@ -64,11 +67,25 @@ function afficher_barre($formulaire='',$texte='', $forum=false) { } $ret .= " "; $ret .= bouton_barre_racc ("javascript:barre_demande('[','->',']','Veuillez indiquer l\'adresse de votre lien (vous pouvez indiquer une adresse Web sous la forme http://www.monsite/com ou simplement indiquer le numéro d\'un article de ce site.',$champ)", "barre-lien.png", "Créer un [lien hypertexte->http://...]", $formulaire, $texte); + if ($options == "avancees") { + $ret .= bouton_barre_racc ("javascript:barre_raccourci('[?',']',$champ)", "barre-wiki.png", "Entrée du [?glossaire] (Wikipedia)", $formulaire, $texte); + $ret .= " "; + $ret .= bouton_barre_racc ("javascript:barre_tableau($champ)", "barre-tableau.png", "Insérer un tableau", $formulaire, $texte); + } if ($forum) { $ret .= " "; $ret .= bouton_barre_racc ("javascript:barre_raccourci('\n\n<quote>','</quote>\n\n',$champ)", "barre-quote.png", "<quote>Citer un message</quote>", $formulaire, $texte); } + + if ($options == "avancees") { + $ret .= " "; + $ret .= bouton_barre_racc ("javascript:barre_raccourci('<html>','</html>',$champ)", "barre-html.png", "<html>Ne pas appliquer de correction typographique</html>", $formulaire, $texte); + $ret .= bouton_barre_racc ("javascript:barre_raccourci('<code>','</code>',$champ)", "barre-code.png", "Afficher du <code>code informatique</code>", $formulaire, $texte); + if (!$forum) $ret .= bouton_barre_racc ("javascript:barre_raccourci('\n\n<cadre>','</cadre>\n\n',$champ)", "barre-cadre.png", "<cadre>Afficher un pavé de code informatique</cadre>", $formulaire, $texte); + } + + $ret .= "</td>"; $ret .= "<td align='center'>"; @@ -90,6 +107,9 @@ function afficher_barre($formulaire='',$texte='', $forum=false) { } $ret .= "</td>"; + $ret .= "<td> </td>"; + $col++; + if ($flag_ecrire) { $ret .= "<td align='right' onMouseOver=\"helpline('En savoir plus sur les raccourcis typographiques',helpbox$texte)\">"; $col++; diff --git a/spip_barre.js b/spip_barre.js index f6a21c8fc9a4edfbdc402f9781e8c8fb56cb327b..981f0da922896df312f0b6621c7c768598053a77 100644 --- a/spip_barre.js +++ b/spip_barre.js @@ -69,6 +69,50 @@ function barre_inserer(text,champ) { } } + +// Nicolas Hoizey +function barre_tableau(toolbarfield) +{ + var txtarea = toolbarfield; + txtarea.focus(); + var cols = prompt("Nombre de colonnes du tableau :", ""); + var rows = prompt("Nombre de lignes du tableau :", ""); + if (cols != null && rows != null) { + var tbl = ''; + var ligne = '|'; + var entete = '|'; + for(i = 0; i < cols; i++) { + ligne = ligne + ' valeur |'; + entete = entete + ' {{entete}} |'; + } + for (i = 0; i < rows; i++) { + tbl = tbl + ligne + '\n'; + } + if (confirm('Voulez vous ajouter une ligne d\'en-tĂȘte ?')) { + tbl = entete + '\n' + tbl; + } + if ((clientVer >= 4) && is_ie && is_win) { + var str = document.selection.createRange().text; + var sel = document.selection.createRange(); + sel.text = str + '\n\n' + tbl + '\n\n'; + } else { + var selLength = txtarea.textLength; + var selStart = txtarea.selectionStart; + var selEnd = txtarea.selectionEnd; + if (selEnd == 1 || selEnd == 2) { + selEnd = selLength; + } + var s1 = (txtarea.value).substring(0,selStart); + var s2 = (txtarea.value).substring(selStart, selEnd) + var s3 = (txtarea.value).substring(selEnd, selLength); + txtarea.value = s1 + s2 + "\n\n" + tbl + "\n\n" + s3; + } + } + return; +} + + + // Shows the help messages in the helpline window function helpline(help, champ) { champ.value = help;