-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.html
57 lines (52 loc) · 3.48 KB
/
mod.html
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
<?php
require_once($CFG->dirroot . '/local/harpiaajax/send_message.php');
$providers = send_message::fetch_providers()->providers;
/* The contents of this file are shown when the teacher is
creating or editing a field of the type implemented by this plug-in */
?>
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><label for="name"><?php p(get_string('fieldname', 'data')); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><label for="description"><?php p(get_string('fielddescription', 'data')); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
<tr>
<td class="c0"><label for="provider-name-input"><?php p(get_string('providername', 'datafield_harpiainteraction')); ?></label></td>
<td class="c1">
<select id="answerproviders" name="param1" id="provider-name-input" onchange="document.getElementById('system-prompt-input').setAttribute('placeholder', this.children[this.selectedIndex].getAttribute('data-default-system-prompt')); document.getElementById('system-prompt-row').classList[parseInt(this.children[this.selectedIndex].getAttribute('data-supports-system-prompt')) ? 'remove' : 'add']('hidden')">
<?php
$prompt_placeholder = '';
$hide_prompt = false;
foreach ($providers as $provider) {
$checked = '';
if ($this->field->param1 === $provider->name) {
$checked = ' selected="selected"';
$prompt_placeholder = $provider->default_system_prompt;
$hide_prompt = !$provider->supports_system_prompt;
}
echo '<option value="' . s($provider->name) . '" ' . $checked .
' data-default-system-prompt="' . s($provider->default_system_prompt) . '"' .
' data-supports-system-prompt="' . +$provider->supports_system_prompt . '"' .
'>' . s($provider->name) . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td class="c0"><label for="experimenttype"><?php p(get_string('experimenttype', 'datafield_harpiainteraction')); ?></label></td>
<td class="c1">
<select class="fieldname" name="param2" id="experimenttype">
<option value="single" <?php if ($this->field->param2 == 'single') echo 'selected="selected"'; ?>> <?php p(get_string('experimenttype_single', 'datafield_harpiainteraction')); ?> </option>
<option value="chat" <?php if ($this->field->param2 == 'chat') echo 'selected="selected"'; ?>> <?php p(get_string('experimenttype_chat', 'datafield_harpiainteraction')); ?> </option>
</select>
</td>
</tr>
<tr id="system-prompt-row" <?php if ($hide_prompt) echo ' class="hidden"'; ?>>
<td class="c0"><label for="system-prompt-input"><?php echo get_string('systemprompt', 'datafield_harpiainteraction'); ?></label></td>
<td class="c1"><textarea class="fieldname" name="param3" id="system-prompt-input" placeholder="<?php p($prompt_placeholder); ?>" ><?php p($this->field->param3 ?: ''); ?></textarea></td>
</tr>
</table>