mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Einfüge-Buttons für MathML und Textformatierung hinzugefügt
This commit is contained in:
@@ -103,6 +103,48 @@ function preview()
|
||||
{
|
||||
document.getElementById('vorschau').innerHTML = document.getElementById('text').value;
|
||||
}
|
||||
function previewvorschlag()
|
||||
{
|
||||
document.getElementById('vorschauvorschlag').innerHTML = document.getElementById('text_vorschlag').value;
|
||||
}
|
||||
function insertfrage(aTag, eTag)
|
||||
{
|
||||
var input = document.forms['formular_frage'].elements['text'];
|
||||
input.focus();
|
||||
/* Einfügen des Formatierungscodes */
|
||||
var start = input.selectionStart;
|
||||
var end = input.selectionEnd;
|
||||
var insText = input.value.substring(start, end);
|
||||
input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
|
||||
/* Anpassen der Cursorposition */
|
||||
var pos;
|
||||
if (insText.length == 0) {
|
||||
pos = start + aTag.length;
|
||||
} else {
|
||||
pos = start + aTag.length + insText.length + eTag.length;
|
||||
}
|
||||
input.selectionStart = pos;
|
||||
input.selectionEnd = pos;
|
||||
}
|
||||
function insertvorschlag(aTag, eTag)
|
||||
{
|
||||
var input = document.forms['formular_vorschlag'].elements['text_vorschlag'];
|
||||
input.focus();
|
||||
/* Einfügen des Formatierungscodes */
|
||||
var start = input.selectionStart;
|
||||
var end = input.selectionEnd;
|
||||
var insText = input.value.substring(start, end);
|
||||
input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
|
||||
/* Anpassen der Cursorposition */
|
||||
var pos;
|
||||
if (insText.length == 0) {
|
||||
pos = start + aTag.length;
|
||||
} else {
|
||||
pos = start + aTag.length + insText.length + eTag.length;
|
||||
}
|
||||
input.selectionStart = pos;
|
||||
input.selectionEnd = pos;
|
||||
}
|
||||
</script>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -613,14 +655,32 @@ if($frage_id!='')
|
||||
echo '</td>';
|
||||
//Zusaetzliche EingabeFelder anzeigen
|
||||
echo "<td>";
|
||||
echo "<form method='POST' action='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&frage_id=$frage_id'>";
|
||||
echo "<form name='formular_frage' method='POST' action='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&frage_id=$frage_id'>";
|
||||
echo "<table>";
|
||||
//Bei Aenderungen im Textfeld werden diese sofort in der Vorschau angezeigt
|
||||
//Wenn beim Speichern der Text kein Gueltiges XML ist, wird der vorige Text erneut angezeigt
|
||||
|
||||
echo "<tr valign='top'><td colspan='2'>\n<textarea name='text' id='text' cols='50' rows='27' oninput='preview()'><![CDATA[".(isset($frage_error_text)?$frage_error_text:$frage->text)."]]></textarea>\n</td>";
|
||||
echo "<table><tr><input type='button' value='MathML' onclick='document.getElementById(\"text\").value=\"<math xmlns=\"http://www.w3.org/1998/Math/MathML\"></math>\";' />";
|
||||
echo "<tr><br/></tr>";
|
||||
echo "<table><tr><td><input type='button' value='br' onclick='insertfrage(\"<br/>\", \"\")' />";
|
||||
echo "<input type='button' value='F' style='font-weight:bold' onclick='insertfrage(\"<strong>\", \"</strong>\")' />";
|
||||
echo "<input type='button' value='K' style='font-style:italic' onclick='insertfrage(\"<i>\", \"</i>\")' /><br/><br/>";
|
||||
echo "<input type='button' value='MathML' onclick='insertfrage(\"<math xmlns=\"http://www.w3.org/1998/Math/MathML\">\", \"</math>\")' title='Deklaration' /><br/>";
|
||||
echo "<input type='button' value='mrow' onclick='insertfrage(\"<mrow>\", \"</mrow>\")' title='Zusammenhängende Zeile' /><br/>";
|
||||
echo "<input type='button' value='mo' onclick='insertfrage(\"<mo>\", \"</mo>\")' title='Operator (+,-,=,...)' /><br/>";
|
||||
echo "<input type='button' value='mn' onclick='insertfrage(\"<mn>\", \"</mn>\")' title='Number (1,2,3,...)' /><br/>";
|
||||
echo "<input type='button' value='mi' onclick='insertfrage(\"<mi>\", \"</mi>\")' title='Identifier (Variablen x,y,...)' /><br/>";
|
||||
echo "<input type='button' value='mfrac' onclick='insertfrage(\"<mfrac>\", \"</mfrac>\")' title='Bruch' /><br/>";
|
||||
echo "<input type='button' value='msup' onclick='insertfrage(\"<msup>\", \"</msup>\")' title='Hochgestellt' /><br/>";
|
||||
echo "<input type='button' value='msub' onclick='insertfrage(\"<msub>\", \"</msub>\")' title='Tiefgestellt' /><br/>";
|
||||
echo "<input type='button' value='mspace' onclick='insertfrage(\"<mspace width=\"2px\"/>\", \"\")' title='Leerraum (einstellbar)' /><br/>";
|
||||
echo "<input type='button' value='mfenced' onclick='insertfrage(\"<mfenced>\", \"</mfenced>\")' title='Große Klammern' /><br/>";
|
||||
echo "<input type='button' value='msqrt' onclick='insertfrage(\"<msqrt>\", \"</msqrt>\")' title='Wurzel' /><br/>";
|
||||
echo "<input type='button' value='munderover' onclick='insertfrage(\"<munderover><mo movablelimits=\"false\">Das steht mittig</mo><mo>Das steht unten</mo><mo>Das steht oben</mo></munderover>\", \"\")' title='Oben und unten' /><br/>";
|
||||
echo "<input type='button' value='mtext' onclick='insertfrage(\"<mtext>\", \"</mtext>\")' title='Text' /><br/>";
|
||||
echo "Operatoren:<br/>π<br/>·<br/>∑<br/>∫<br/><a href='http://de.selfhtml.org/html/referenz/zeichen.htm#benannte_iso8859_1' target='blank'>Weitere</a>";
|
||||
echo "</td>";
|
||||
//echo "<table><tr><input type='button' value='MathML' onclick='document.getElementById(\"text\").value=\"<math xmlns=\"http://www.w3.org/1998/Math/MathML\"></math>\";' />";
|
||||
//echo "<tr><br/></tr>";
|
||||
echo "</tr></table></tr>";
|
||||
echo "<tr><td>Demo <input type='checkbox' name='demo' ".($frage->demo?'checked="true"':'')." />
|
||||
Level <input type='text' name='level' value='$frage->level' size='1' />
|
||||
@@ -650,7 +710,7 @@ if($frage_id!='')
|
||||
}
|
||||
//Vorschlag
|
||||
echo '<b>Vorschlag'.($vorschlag_id!=''?' Edit':'').'</b><br /><br />';
|
||||
echo "<form method='POST' enctype='multipart/form-data' action='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&frage_id=$frage_id'>";
|
||||
echo "<form name='formular_vorschlag' method='POST' enctype='multipart/form-data' action='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&frage_id=$frage_id'>";
|
||||
echo "<input type='hidden' name='vorschlag_id' value='$vorschlag->vorschlag_id' />";
|
||||
echo '<table>';
|
||||
echo "<tr><td>Nummer:</td><td><input type='text' name='nummer' size='3' id='nummer' value='$vorschlag->nummer' /><input type='button' value='1' onclick='document.getElementById(\"nummer\").value=\"1\";' /><input type='button' value='2' onclick='document.getElementById(\"nummer\").value=\"2\";' /><input type='button' value='3' onclick='document.getElementById(\"nummer\").value=\"3\";' /><input type='button' value='4' onclick='document.getElementById(\"nummer\").value=\"4\";' /></td></tr>";
|
||||
@@ -658,8 +718,25 @@ if($frage_id!='')
|
||||
echo "<td>Punkte:</td><td><input type='text' size='8' id='punkte' name='punkte' value='$vorschlag->punkte' /><input type='button' style='background-color:#FFBFBF' value='-1/2' onclick='document.getElementById(\"punkte\").value=\"-0.5\";' /><input type='button' style='background-color:#FFBFBF' value='-1/3' onclick='document.getElementById(\"punkte\").value=\"-0.3333\";' /><input type='button' value='+1' style='background-color:#C5FFBF' onclick='document.getElementById(\"punkte\").value=\"1\";' /><input type='button' value='+1/3' style='background-color:#C5FFBF' onclick='document.getElementById(\"punkte\").value=\"0.3333\";' /><input type='button' value='+1/2' style='background-color:#C5FFBF' onclick='document.getElementById(\"punkte\").value=\"0.5\";' /></td>";
|
||||
echo '</tr>';
|
||||
echo '<tr valign="top">';
|
||||
echo '<td>Text:</td><td><textarea name="text" id="text_vorschlag" rows="25" cols="45" oninput="preview()"><![CDATA['.$vorschlag->text."]]></textarea>\n</td>";
|
||||
echo "<td><input type='button' value='MathML' onclick='document.getElementById(\"text_vorschlag\").value=\"<math xmlns=\"http://www.w3.org/1998/Math/MathML\"></math>\";' /></td>";
|
||||
echo '<td>Text:</td><td><textarea name="text_vorschlag" id="text_vorschlag" rows="25" cols="45" oninput="previewvorschlag()"><![CDATA['.$vorschlag->text."]]></textarea>\n</td>";
|
||||
echo "<td><input type='button' value='br' onclick='insertvorschlag(\"<br/>\", \"\")' />";
|
||||
echo "<input type='button' value='F' style='font-weight:bold' onclick='insertvorschlag(\"<strong>\", \"</strong>\")' />";
|
||||
echo "<input type='button' value='K' style='font-style:italic' onclick='insertvorschlag(\"<i>\", \"</i>\")' /><br/><br/>";
|
||||
echo "<input type='button' value='MathML' onclick='insertvorschlag(\"<math xmlns=\"http://www.w3.org/1998/Math/MathML\">\", \"</math>\")' title='Deklaration' /><br/>";
|
||||
echo "<input type='button' value='mrow' onclick='insertvorschlag(\"<mrow>\", \"</mrow>\")' title='Zusammenhängende Zeile' /><br/>";
|
||||
echo "<input type='button' value='mo' onclick='insertvorschlag(\"<mo>\", \"</mo>\")' title='Operator (+,-,=,...)' /><br/>";
|
||||
echo "<input type='button' value='mn' onclick='insertvorschlag(\"<mn>\", \"</mn>\")' title='Number (1,2,3,...)' /><br/>";
|
||||
echo "<input type='button' value='mi' onclick='insertvorschlag(\"<mi>\", \"</mi>\")' title='Identifier (Variablen x,y,...)' /><br/>";
|
||||
echo "<input type='button' value='mfrac' onclick='insertvorschlag(\"<mfrac>\", \"</mfrac>\")' title='Bruch' /><br/>";
|
||||
echo "<input type='button' value='msup' onclick='insertvorschlag(\"<msup>\", \"</msup>\")' title='Hochgestellt' /><br/>";
|
||||
echo "<input type='button' value='msub' onclick='insertvorschlag(\"<msub>\", \"</msub>\")' title='Tiefgestellt' /><br/>";
|
||||
echo "<input type='button' value='mspace' onclick='insertvorschlag(\"<mspace width=\"2px\"/>\", \"\")' title='Leerraum (einstellbar)' /><br/>";
|
||||
echo "<input type='button' value='mfenced' onclick='insertvorschlag(\"<mfenced>\", \"</mfenced>\")' title='Große Klammern' /><br/>";
|
||||
echo "<input type='button' value='msqrt' onclick='insertvorschlag(\"<msqrt>\", \"</msqrt>\")' title='Wurzel' /><br/>";
|
||||
echo "<input type='button' value='munderover' onclick='insertvorschlag(\"<munderover><mo movablelimits=\"false\">Das steht mittig</mo><mo>Das steht unten</mo><mo>Das steht oben</mo></munderover>\", \"\")' title='Oben und unten' /><br/>";
|
||||
echo "<input type='button' value='mtext' onclick='insertvorschlag(\"<mtext>\", \"</mtext>\")' title='Text' /><br/>";
|
||||
echo "Operatoren:<br/>π<br/>·<br/>∑<br/>∫<br/><a href='http://de.selfhtml.org/html/referenz/zeichen.htm#benannte_iso8859_1' target='blank'>Weitere</a>";
|
||||
echo "</td>";
|
||||
echo '</tr><tr valign="top">';
|
||||
//Upload Feld fuer Bild
|
||||
echo "<td>Bild:</td><td><input type='file' name='bild' /></td>";
|
||||
@@ -669,6 +746,8 @@ if($frage_id!='')
|
||||
echo "<td>Audio:</td><td><input type='file' name='audio' /></td></tr>";
|
||||
|
||||
echo "<tr><td colspan='2' align='right'><input type='submit' name='submitvorschlag' value='Speichern' />".($vorschlag_id!=''?"<input type='button' value='Abbrechen' onclick=\"document.location.href='$PHP_SELF?gebiet_id=$gebiet_id&nummer=$nummer&frage_id=$frage->frage_id'\" />":'')."</td></tr>";
|
||||
//Vorschau fuer das Text-Feld
|
||||
echo "<tr><td colspan='2'>Vorschau:<br /><div id='vorschauvorschlag' style='border: 1px solid black' align='center'>$vorschlag->text</div></td></tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user