moodle/mod/glossary/edit.html

193 lines
6.7 KiB
HTML

<form name="form" method="post" action="edit.php" enctype="multipart/form-data">
<table border="0" cellpadding="5">
<?php
if (isset($errors)) {
?>
<tr valign="top">
<td colspan="2" align="center"><strong><font color="red"><?php p($errors) ?></font></strong>
</td>
</tr>
<?php
}
?>
<tr valign="top">
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="5">
<tr>
<td width="150" align="right"><p><b><?php echo get_string("concept","glossary") ?>:</b></p></td>
<td><input type="text" name="concept" size="30" value="<?php p($newentry->concept) ?>" /></td>
</tr>
<tr>
<td align="right"><p><b><?php echo get_string("categories","glossary") ?>:</b></p></td>
<td valign="top">
<?php
$categories = get_records("glossary_categories","glossaryid",$glossary->id,'name ASC');
echo "<select size=\"5\" name=\"categories[]\" multiple=\"yes\" />";
echo "<option value=\"0\">" . get_string("notcategorised","glossary") . "</option>";
if ( $categories ) {
foreach ( $categories as $category ) {
echo " <option ";
if (isset($newentry->id)) {
if ( record_exists("glossary_entries_categories","entryid",$newentry->id,"categoryid",$category->id) ) {
echo "selected " ;
}
}
echo "value=\"$category->id\">$category->name</option>\n";
}
}
echo "</select>\n";
?>
</td>
</tr>
</table></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td valign="top" align="right"><p><b>
<?php
echo get_string("aliases","glossary");
echo ':<br />';
helpbutton("aliases", strip_tags(get_string("aliases", "glossary")), "glossary");
?></b></p>
</td>
<td valign="top">
<textarea rows="2" name="aliases" cols="20"><?php p($newentry->aliases) ?></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<?php
if ( !$glossary->usedynalink ) {
echo '<input type="hidden" name="usedynalink" value="0" />';
echo '<input type="hidden" name="casesensitive" value="0" />';
echo '<input type="hidden" name="fullmatch" value="0" />';
} else {
echo '<script>var items = [\'casesensitive\',\'fullmatch\'];</script>';
if (!empty($newentry->usedynalink)) {
$selected = "checked";
} else {
$selected = "";
}
echo '<input type="checkbox" name="usedynalink" value="1" ' . $selected . ' onclick="return lockoptions(\'form\',\'usedynalink\', items)" /> ';
echo '<font size="-1">';
print_string("entryusedynalink","glossary");
echo '</font>';
echo helpbutton("usedynalinkentry", strip_tags(get_string("usedynalink", "glossary")), "glossary");
echo '<br />';
if (!empty($newentry->casesensitive)) {
$selected = "checked";
} else {
$selected = "";
}
echo '<input type="checkbox" name="casesensitive" value="1" ' . $selected . ' /> ';
echo '<font size="-1">';
print_string("casesensitive","glossary");
echo '</font>';
echo helpbutton("casesensitive", strip_tags(get_string("casesensitive", "glossary")), "glossary");
echo '<br />';
if (!empty($newentry->fullmatch)) {
$selected = "checked";
} else {
$selected = "";
}
echo '<input type="checkbox" name="fullmatch" value="1" ' . $selected . ' /> ';
echo '<font size="-1">';
print_string("fullmatch","glossary");
echo '</font>';
echo helpbutton("fullmatch", strip_tags(get_string("fullmatch", "glossary")), "glossary");
echo '<br />';
}
?>
</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b>
<?php print_string("definition", "glossary"); ?>:
</b></p></td>
<td align="left" rowspan="2">
<?php print_textarea($usehtmleditor, 25, 65, 630, 400, "text", $newentry->definition); ?>
</td>
</tr>
<tr valign="top">
<td align="right" valign="center" nowrap="nowrap">
<font size="1">
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
emoticonhelpbutton("form", "text");
}
?>
<br />
</font>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("formattexttype"); ?>:</b></p></td>
<td>
<?php
if ($usehtmleditor) { /// Trying this out for a while
print_string('formathtml');
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
} else {
if (!isset($newentry->format)) {
$newentry->format = $defaultformat;
}
choose_from_menu(format_text_menu(), "format", $newentry->format, "");
}
helpbutton("textformat", get_string("helpformatting"));
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("attachment", "glossary") ?>:<br />(<?php print_string("optional") ?>)&nbsp;</b></p></td>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo get_max_upload_file_size($CFG->maxbytes, $course->maxbytes) ?>" />
<input type="file" name="attachment" size="40" />
<?php
helpbutton("attachment", get_string("attachment", "glossary"), "glossary");
print_string("maxsize", "", display_size(get_max_upload_file_size($CFG->maxbytes, $course->maxbytes)));
?>
</td>
</tr>
<tr>
<td colspan="2">
<p align="center">
<?php if (isset($newentry->id)) {
echo "<input type=\"hidden\" name="e" value=\"$newentry->id\" />";
}
?>
<input type="hidden" name="husedynalink" value="1" />
<input type="hidden" name="hcasesensitive" value="0" />
<input type="hidden" name="hfullmatch" value="1" />
<input type="hidden" name="id" value="<?php p($cm->id) ?>" />
<input type="hidden" name="mode" value="<?php p($mode) ?>" />
<input type="hidden" name="hook" value="<?php p($hook) ?>" />
<input type="hidden" name="confirm" value="1">
<input type="submit" value="<?php print_string("savechanges") ?>" />
<input type="reset" value="<?php print_string("revert") ?>" />
</p>
</td>
</tr>
</table>
</form>