1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| <script type="text/JavaScript">
<!--
function addLine(line_id) {
try {
var conteneur = document.getElementById(line_id);
var paragraphe = document.createElement('p');
var ligne = document.createElement('textarea');
ligne.setAttribute('name','line_content[]');
ligne.setAttribute('id','line_content[]');
paragraphe.appendChild(ligne);
conteneur.appendChild(paragraphe);
}
catch(e) {
alert(e);
}
}
-->
</script>
<?php
if (isset($_REQUEST['save'])) {
$inputs = filter_input_array(INPUT_POST, array(
'page_name' => FILTER_SANITIZE_ENCODED,
'leftcol' => FILTER_SANITIZE_ENCODED,
'rightcol' => FILTER_SANITIZE_ENCODED,
'image_format' => FILTER_SANITIZE_ENCODED,
'line_content' => FILTER_UNSAFE_RAW,
));
$page_name = $inputs['page_name'];
$leftcol = $inputs['leftcol'];
$rightcol = $inputs['rightcol'];
$image_format = $inputs['image_format'];
$line_content = $inputs['line_content'];
$output = '
{| align="center" width="90%" border="1" cellspacing="0" cellpadding="5"
!<center>' . $leftcol . '</center>
!width="95%"|<center>' . $rightcol . '</center>
|------------------------------------------------------------
';
$image_number=1;
$output .= ' |[[image:' . $page_name . '_' . $image_number++ .'.' . $image_format . ']]
|' . $line_content . '
|------------------------------------------------------------
';
echo '<pre>'.$output.' |}</pre>';
}
?>
<form method="post">
<fieldset>
<p><label for="page_name">Nom de la page : </label><input type="text" name="page_name" id="page_name" /></p>
<p><label for="leftcol">Colonne de gauche : </label><input type="text" name="leftcol" id="leftcol" /></p>
<p><label for="rightcol">Colonne de droite : </label><input type="text" name="rightcol" id="rightcol" /></p>
<p>
Indiquer le format des images :<br />
<input type="radio" name="image_format" value="jpg" id="jpg" /> <label for="jpg">.jpg</label><br />
<input type="radio" name="image_format" value="png" id="png" /> <label for="png">.png</label><br />
</p>
<div><p><label for="line_content[]">Contenu de la ligne : </label><textarea name="line_content[]" id="line_content[]"></textarea></div>
<div id = "ligne_sup"></div>
<p onclick="addLine('ligne_sup')" style="text-decoration:underline; cursor:pointer">Ajouter une ligne</p>
</fieldset>
<fieldset>
<input type="submit" name="save" value="Générer" />
<input type="reset" value="Reinitialiser" />
</fieldset>
</form> |
Partager