mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Fixed XHTML and Javascript insertion of tags into the templates
This commit is contained in:
parent
5e87b920e3
commit
704a26cbdd
1 changed files with 18 additions and 11 deletions
|
@ -81,12 +81,28 @@
|
||||||
$bodytag .= 'currTextarea = document.tempform.template;';
|
$bodytag .= 'currTextarea = document.tempform.template;';
|
||||||
$bodytag .= '" ';
|
$bodytag .= '" ';
|
||||||
|
|
||||||
|
// Javascript to insert the field tags into the textarea.
|
||||||
|
$meta = '<script language="JavaScript" type="text/javascript">'."\n";
|
||||||
|
$meta .= '//<![CDATA['."\n";
|
||||||
|
$meta .= 'function insert_field_tags(selectlist) {';
|
||||||
|
$meta .= ' if (typeof(currEditor) != \'undefined\' && currEditor._editMode == \'wysiwyg\') {';
|
||||||
|
// HTMLArea-specific
|
||||||
|
$meta .= ' currEditor.insertHTML(selectlist.options[selectlist.selectedIndex].value); ';
|
||||||
|
$meta .= ' } else {';
|
||||||
|
// For inserting when in HTMLArea code view or for normal textareas
|
||||||
|
$meta .= ' insertAtCursor(currTextarea, selectlist.options[selectlist.selectedIndex].value);';
|
||||||
|
$meta .= ' }'."\n";
|
||||||
|
$meta .= '}'."\n";
|
||||||
|
$meta .= '//]]>'."\n";
|
||||||
|
$meta .= '</script>'."\n";
|
||||||
|
|
||||||
print_header_simple($data->name, '', "<a href='index.php?id=$course->id'>$strdata</a> -> $data->name",
|
print_header_simple($data->name, '', "<a href='index.php?id=$course->id'>$strdata</a> -> $data->name",
|
||||||
'', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
|
'', $meta, true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
|
||||||
navmenu($course, $cm), '', $bodytag);
|
navmenu($course, $cm), '', $bodytag);
|
||||||
|
|
||||||
print_heading(format_string($data->name));
|
print_heading(format_string($data->name));
|
||||||
|
|
||||||
|
|
||||||
/// Groups needed for Add entry tab
|
/// Groups needed for Add entry tab
|
||||||
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
|
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
|
||||||
$currentgroup = get_and_set_current_group($course, $groupmode);
|
$currentgroup = get_and_set_current_group($course, $groupmode);
|
||||||
|
@ -152,7 +168,6 @@
|
||||||
data_generate_default_template($data, 'rsstemplate');
|
data_generate_default_template($data, 'rsstemplate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Print the browsing interface.
|
|
||||||
|
|
||||||
echo '<form name="tempform" action="templates.php?d='.$data->id.'&mode='.$mode.'" method="post">';
|
echo '<form name="tempform" action="templates.php?d='.$data->id.'&mode='.$mode.'" method="post">';
|
||||||
echo '<input name="sesskey" value="'.sesskey().'" type="hidden" />';
|
echo '<input name="sesskey" value="'.sesskey().'" type="hidden" />';
|
||||||
|
@ -187,16 +202,8 @@
|
||||||
helpbutton('tags', get_string('tags','data'), 'data');
|
helpbutton('tags', get_string('tags','data'), 'data');
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
|
|
||||||
echo '<select name="fields1[]" id="availabletags" size="10" ';
|
|
||||||
|
|
||||||
// Javascript to insert the field tags into the textarea.
|
echo '<select name="fields1[]" id="availabletags" size="10" onclick="insert_field_tags(this)">';
|
||||||
echo 'onclick="';
|
|
||||||
echo 'if (typeof(currEditor) != \'undefined\' && currEditor._editMode == \'wysiwyg\') {';
|
|
||||||
echo ' currEditor.insertHTML(this.options[selectedIndex].value); '; // HTMLArea-specific.
|
|
||||||
echo '} else {';
|
|
||||||
echo 'insertAtCursor(currTextarea, this.options[selectedIndex].value);'; // For inserting when in HTMLArea code view or for normal textareas.
|
|
||||||
echo '}';
|
|
||||||
echo '">';
|
|
||||||
|
|
||||||
$fields = get_records('data_fields', 'dataid', $data->id);
|
$fields = get_records('data_fields', 'dataid', $data->id);
|
||||||
echo '<optgroup label="'.get_string('fields', 'data').'">';
|
echo '<optgroup label="'.get_string('fields', 'data').'">';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue