Commit b20a4b8a authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Move indent settings outside fieldset & hide max indent level when not applicable


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent f05f9a6a
......@@ -74,6 +74,8 @@ $elements = array_merge(
)
);
$js = call_static_method(generate_class_name('interaction', $plugin), 'instance_config_js', $group, $instance);
// save, validate and cancelhandlers are in interaction/lib.php
$form = pieform(array(
'name' => 'edit_interaction',
......@@ -85,6 +87,7 @@ $form = pieform(array(
$smarty = smarty(array('tablerenderer'));
$smarty->assign('form', $form);
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('heading', $group->name);
$smarty->assign('subheading', TITLE);
$smarty->display('interaction/edit.tpl');
......
......@@ -72,6 +72,30 @@ class PluginInteractionForum extends PluginInteraction {
}
return array(
'indentmode' => array(
'type' => 'select',
'title' => get_string('indentmode', 'interaction.forum'),
'options' => array('full_indent' => get_string('indentfullindent', 'interaction.forum'),
'max_indent' => get_string('indentmaxindent', 'interaction.forum'),
'no_indent' => get_string('indentflatindent', 'interaction.forum') ),
'description' => get_string('indentmodedescription', 'interaction.forum'),
'defaultvalue' => isset($indentmode) ? $indentmode : 'full_indent',
'rules' => array(
'required' => true,
),
),
'maxindent' => array(
'type' => 'text',
'title' => get_string('maxindent', 'interaction.forum'),
'size' => 2,
'defaultvalue' => isset($maxindent) ? $maxindent : 10,
'class' => (isset($indentmode) & $indentmode == 'max_indent') ? '' : 'hidden',
'rules' => array(
'integer' => true,
'minvalue' => 1,
'maxvalue' => 100,
),
),
'fieldset' => array(
'type' => 'fieldset',
'collapsible' => true,
......@@ -123,35 +147,35 @@ class PluginInteractionForum extends PluginInteraction {
'required' => true,
),
),
'indentmode' => array(
'type' => 'select',
'title' => get_string('indentmode', 'interaction.forum'),
'options' => array('full_indent' => get_string('indentfullindent', 'interaction.forum'),
'max_indent' => get_string('indentmaxindent', 'interaction.forum'),
'no_indent' => get_string('indentflatindent', 'interaction.forum') ),
'description' => get_string('indentmodedescription', 'interaction.forum'),
'defaultvalue' => isset($indentmode) ? $indentmode : 'full_indent',
'rules' => array(
'required' => true,
),
),
'maxindent' => array(
'type' => 'text',
'title' => get_string('maxindent', 'interaction.forum'),
'size' => 2,
'description' => get_string('maxindentdescription', 'interaction.forum'),
'defaultvalue' => isset($maxindent) ? $maxindent : 10,
'rules' => array(
'integer' => true,
'minvalue' => 1,
'maxvalue' => 100,
),
),
)
)
);
}
public static function instance_config_js() {
return <<<EOF
function update_maxindent() {
var s = $('edit_interaction_indentmode');
var m = $('edit_interaction_maxindent_container');
var t = $('edit_interaction_maxindent');
if (!m) {
return;
}
if (s.options[s.selectedIndex].value == 'max_indent') {
removeElementClass(m, 'hidden');
removeElementClass(t, 'hidden');
}
else {
addElementClass(m, 'hidden');
addElementClass(t, 'hidden');
}
}
addLoadEvent(function() {
connect('edit_interaction_indentmode', 'onchange', update_maxindent);
});
EOF;
}
public static function instance_config_save($instance, $values){
db_begin();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment