diff --git a/admin/repository.php b/admin/repository.php index 9dad5e6bd03..33e81148e63 100644 --- a/admin/repository.php +++ b/admin/repository.php @@ -4,26 +4,34 @@ require_once(dirname(dirname(__FILE__)) . '/config.php'); require_once($CFG->dirroot . '/repository/lib.php'); require_once($CFG->libdir . '/adminlib.php'); -$edit = optional_param('edit', 0, PARAM_FORMAT); -$new = optional_param('new', '', PARAM_FORMAT); -$hide = optional_param('hide', '', PARAM_FORMAT); -$delete = optional_param('delete', 0, PARAM_FORMAT); -$sure = optional_param('sure', '', PARAM_ALPHA); -$move = optional_param('move', '', PARAM_ALPHANUM); -$type = optional_param('type', '', PARAM_ALPHANUM); +$repository = optional_param('repos', '', PARAM_FORMAT); +$action = optional_param('action', '', PARAM_ALPHA); +$sure = optional_param('sure', '', PARAM_ALPHA); $display = true; // fall through to normal display $pagename = 'repositorycontroller'; -if ($edit) { - $pagename = 'repositorysettings' . $edit; -} else if ($delete) { +if ($action == 'edit') { + $pagename = 'repositorysettings' . $repository; +} else if ($action == 'delete') { $pagename = 'repositorydelete'; -} else if ($new) { +} else if (($action == 'newon') || ($action == 'newoff')) { $pagename = 'repositorynew'; } +// Need to remember this for form +$formaction = $action; + +// Check what visibility to show the new repository +if ($action == 'newon') { + $action = 'new'; + $visible = true; +} else if ($action == 'newoff') { + $action = 'new'; + $visible = false; +} + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); admin_externalpage_setup($pagename); @@ -34,26 +42,26 @@ $configstr = get_string('manage', 'repository'); $return = true; -if (!empty($edit) || !empty($new)) { - if (!empty($edit)) { - $repositorytype = repository::get_type_by_typename($edit); +if (($action == 'edit') || ($action == 'new')) { + if ($action == 'edit') { + $repositorytype = repository::get_type_by_typename($repository); $classname = 'repository_' . $repositorytype->get_typename(); $configs = call_user_func(array($classname,'get_type_option_names')); $plugin = $repositorytype->get_typename(); } else { $repositorytype = null; - $plugin = $new; - $typeid = $new; + $plugin = $repository; + $typeid = $repository; } $PAGE->set_pagetype('admin-repository-' . $plugin); // display the edit form for this instance - $mform = new repository_type_form('', array('plugin' => $plugin, 'instance' => $repositorytype)); + $mform = new repository_type_form('', array('plugin' => $plugin, 'instance' => $repositorytype, 'action' => $formaction)); $fromform = $mform->get_data(); //detect if we create a new type without config (in this case if don't want to display a setting page during creation) $nosettings = false; - if (!empty($new)) { - $adminconfignames = repository::static_function($new, 'get_type_option_names'); + if ($action == 'new') { + $adminconfignames = repository::static_function($repository, 'get_type_option_names'); $nosettings = empty($adminconfignames); } // end setup, begin output @@ -61,10 +69,8 @@ if (!empty($edit) || !empty($new)) { if ($mform->is_cancelled()){ redirect($baseurl); } else if (!empty($fromform) || $nosettings) { - if (!confirm_sesskey()) { - print_error('confirmsesskeybad', '', $baseurl); - } - if ($edit) { + require_sesskey(); + if ($action == 'edit') { $settings = array(); foreach($configs as $config) { if (!empty($fromform->$config)) { @@ -75,7 +81,7 @@ if (!empty($edit) || !empty($new)) { $settings[$config] = ''; } } - $instanceoptionnames = repository::static_function($edit, 'get_instance_option_names'); + $instanceoptionnames = repository::static_function($repository, 'get_instance_option_names'); if (!empty($instanceoptionnames)) { if (array_key_exists('enablecourseinstances', $fromform)) { $settings['enablecourseinstances'] = $fromform->enablecourseinstances; @@ -92,21 +98,14 @@ if (!empty($edit) || !empty($new)) { } $success = $repositorytype->update_options($settings); } else { - $type = new repository_type($plugin, (array)$fromform); + $type = new repository_type($plugin, (array)$fromform, $visible); $type->create(); $success = true; $data = data_submitted(); } if ($success) { - $has_instance = repository::static_function($plugin, 'get_instance_option_names'); - - if (!empty($has_instance)) { - // no common setting for this type, so go to setup instances - redirect($sesskeyurl.'&edit='.$plugin); - } else { - // configs saved - redirect($baseurl); - } + // configs saved + redirect($baseurl); } else { print_error('instancenotsaved', 'repository', $baseurl); } @@ -115,9 +114,9 @@ if (!empty($edit) || !empty($new)) { echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('configplugin', 'repository_'.$plugin)); $displaysettingform = true; - if ($edit) { - $typeoptionnames = repository::static_function($edit, 'get_type_option_names'); - $instanceoptionnames = repository::static_function($edit, 'get_instance_option_names'); + if ($action == 'edit') { + $typeoptionnames = repository::static_function($repository, 'get_type_option_names'); + $instanceoptionnames = repository::static_function($repository, 'get_instance_option_names'); if (empty($typeoptionnames) && empty($instanceoptionnames)) { $displaysettingform = false; } @@ -129,29 +128,38 @@ if (!empty($edit) || !empty($new)) { } $return = false; - //display instances list and creation form - if ($edit){ - $instanceoptionnames = repository::static_function($edit, 'get_instance_option_names'); - if (!empty($instanceoptionnames)){ - repository::display_instances_list(get_context_instance(CONTEXT_SYSTEM), $edit); + // Display instances list and creation form + if ($action == 'edit'){ + $instanceoptionnames = repository::static_function($repository, 'get_instance_option_names'); + if (!empty($instanceoptionnames)) { + repository::display_instances_list(get_context_instance(CONTEXT_SYSTEM), $repository); } } - } -} else if (!empty($hide)) { +} else if ($action == 'show') { if (!confirm_sesskey()) { print_error('confirmsesskeybad', '', $baseurl); } - $repositorytype = repository::get_type_by_typename($hide); + $repositorytype = repository::get_type_by_typename($repository); if (empty($repositorytype)) { - print_error('invalidplugin', 'repository', '', $hide); + print_error('invalidplugin', 'repository', '', $repository); } - $repositorytype->switch_and_update_visibility(); + $repositorytype->update_visibility(true); $return = true; -} else if (!empty($delete)) { - $repositorytype = repository::get_type_by_typename($delete); +} else if ($action == 'hide') { + if (!confirm_sesskey()) { + print_error('confirmsesskeybad', '', $baseurl); + } + $repositorytype = repository::get_type_by_typename($repository); + if (empty($repositorytype)) { + print_error('invalidplugin', 'repository', '', $repository); + } + $repositorytype->update_visibility(false); + $return = true; +} else if ($action == 'delete') { + $repositorytype = repository::get_type_by_typename($repository); if ($sure) { - $PAGE->set_pagetype('admin-repository-' . $delete); + $PAGE->set_pagetype('admin-repository-' . $repository); if (!confirm_sesskey()) { print_error('confirmsesskeybad', '', $baseurl); } @@ -163,13 +171,15 @@ if (!empty($edit) || !empty($new)) { exit; } else { echo $OUTPUT->header(); - echo $OUTPUT->confirm(get_string('confirmremove', 'repository', $repositorytype->get_readablename()), $sesskeyurl . '&delete=' . $delete . '&sure=yes', $baseurl); + echo $OUTPUT->confirm(get_string('confirmremove', 'repository', $repositorytype->get_readablename()), $sesskeyurl . '&action=delete&repos=' . $repository . '&sure=yes', $baseurl); $return = false; } -} -else if (!empty($move) && !empty($type)) { - $repositorytype = repository::get_type_by_typename($type); - $repositorytype->move_order($move); +} else if ($action == 'moveup') { + $repositorytype = repository::get_type_by_typename($repository); + $repositorytype->move_order('up'); +} else if ($action == 'movedown') { + $repositorytype = repository::get_type_by_typename($repository); + $repositorytype->move_order('down'); } if (!empty($return)) { diff --git a/admin/repositoryinstance.php b/admin/repositoryinstance.php index d08932f958e..640ebc98cc4 100644 --- a/admin/repositoryinstance.php +++ b/admin/repositoryinstance.php @@ -28,7 +28,7 @@ admin_externalpage_setup($pagename); require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); $sesskeyurl = "$CFG->wwwroot/$CFG->admin/repositoryinstance.php?sesskey=" . sesskey(); -$baseurl = "$CFG->wwwroot/$CFG->admin/repository.php?session=". sesskey() .'&edit='; +$baseurl = "$CFG->wwwroot/$CFG->admin/repository.php?session=". sesskey() .'&action=edit&repos='; if ($new) { $baseurl .= $new; } @@ -53,7 +53,7 @@ if (!empty($edit) || !empty($new)) { } // display the edit form for this instance - $mform = new repository_instance_form('', array('plugin' => $plugin, 'typeid' => $typeid,'instance' => $instance, 'contextid' => $context->id)); + $mform = new repository_instance_form('', array('plugin' => $plugin, 'typeid' => $typeid, 'instance' => $instance, 'contextid' => $context->id)); // end setup, begin output if ($mform->is_cancelled()){ @@ -98,7 +98,6 @@ if (!empty($edit) || !empty($new)) { $instance->hide(); $return = true; } else if (!empty($delete)) { - echo $OUTPUT->header(); $instance = repository::get_instance($delete); //if you try to delete an instance set as readonly, display an error message if ($instance->readonly) { @@ -110,7 +109,6 @@ if (!empty($edit) || !empty($new)) { } if ($instance->delete()) { $deletedstr = get_string('instancedeleted', 'repository'); - echo $OUTPUT->heading($deletedstr); redirect($baseurl, $deletedstr, 3); } else { print_error('instancenotdeleted', 'repository', $baseurl); @@ -118,6 +116,7 @@ if (!empty($edit) || !empty($new)) { exit; } + echo $OUTPUT->header(); echo $OUTPUT->confirm(get_string('confirmdelete', 'repository', $instance->name), "$sesskeyurl&type=$type'&delete=$delete'&sure=yes", "$CFG->wwwroot/$CFG->admin/repositoryinstance.php?session=". sesskey()); $return = false; } diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index 7451565b4b2..cf77a1cf0f0 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -233,7 +233,7 @@ if ($hassiteconfig) { $ADMIN->add('repositorysettings', new admin_externalpage('repositorysettings'.$repositorytype->get_typename(), $repositorytype->get_readablename(), - $url . '?edit=' . $repositorytype->get_typename()), + $url . '?action=edit&repos=' . $repositorytype->get_typename()), 'moodle/site:config'); } } diff --git a/lang/en/repository.php b/lang/en/repository.php index 105973c1f28..2e33338e78f 100644 --- a/lang/en/repository.php +++ b/lang/en/repository.php @@ -49,8 +49,6 @@ $string['cannotdownload'] = 'Cannot download this file'; $string['cannotdownloaddir'] = 'Cannot download this folder'; $string['cannotinitplugin'] = 'Call plugin_init failed'; $string['cleancache'] = 'Clean my cache files'; -$string['clicktohide'] = 'Click here to hide'; -$string['clicktoshow'] = 'Click here to show'; $string['close'] = 'Close'; $string['configallowexternallinks'] = 'This option enables all users to choose whether or not external media is copied into Moodle or not. If this is off then media is always copied into Moodle (this is usually best for overall data integrity and security). If this is on then users can choose each time they add media to a text.'; $string['configcacheexpire'] = 'The amount of time that file listings are cached locally (in seconds) when browsing external repositories.'; @@ -68,6 +66,7 @@ $string['createxxinstance'] = 'Create "{$a}" instance'; $string['date'] = 'Date'; $string['deleted'] = 'Repository deleted'; $string['deleterepository'] = 'Delete this repository'; +$string['disabled'] = 'Disabled'; $string['download'] = 'Download'; $string['downloadfolder'] = 'Download this folder'; $string['downloadsucc'] = 'The file has been downloaded successfully'; @@ -86,7 +85,7 @@ $string['filename'] = 'Filename'; $string['filenotnull'] = 'You must select a file to upload.'; $string['filesaved'] = 'The file has been saved'; $string['getfile'] = 'Select this file'; -$string['hiddenshow'] = 'Hide/Show'; +$string['hidden'] = 'Hidden'; $string['choosealink'] = 'Choose a link...'; $string['chooselicense'] = 'Choose license'; $string['iconview'] = 'View as icons'; @@ -98,6 +97,7 @@ $string['instancesforothers'] = 'private instance(s)'; $string['invalidjson'] = 'Invalid JSON string'; $string['invalidplugin'] = 'Invalid repository {$a} plug-in'; $string['invalidrepositoryid'] = 'Invalid repository ID'; +$string['isactive'] = 'Active?'; $string['keyword'] = 'Keyword'; $string['linkexternal'] = 'Link external'; $string['listview'] = 'View as list'; @@ -114,8 +114,10 @@ $string['nopathselected'] = 'No destination path select yet (double click tree n $string['nopermissiontoaccess'] = 'No permission to access this repository'; $string['noresult'] = 'No search result'; $string['notyourinstances'] = 'You can not view/edit repository instances of another user'; +$string['off'] = 'Enabled but hidden'; $string['openpicker'] = 'Choose a file...'; $string['operation'] = 'Operation'; +$string['on'] = 'Enabled and visible'; $string['personalrepositories'] = 'Avaiable repository instances'; $string['plugin'] = 'Repository plug-ins'; $string['pluginerror'] = 'Errors in repository plugin.'; @@ -145,7 +147,6 @@ $string['sync'] = 'Sync'; $string['thumbview'] = 'View as icons'; $string['title'] = 'Choose a file...'; $string['typenotvisible'] = 'Type not visible'; -$string['updown'] = 'Display order'; $string['upload'] = 'Upload this file'; $string['uploading'] = 'Uploading...'; $string['uploadsucc'] = 'The file has been uploaded successfully'; diff --git a/lib/adminlib.php b/lib/adminlib.php index 71ba705a689..1b496fc5b42 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -1167,7 +1167,7 @@ class admin_settingpage implements part_of_admin_tree { $data = $adminroot->errors[$fullname]->data; } else { $data = $setting->get_setting(); - // do not use defaults if settings not available - upgrdesettings handles the defaults! + // do not use defaults if settings not available - upgrade settings handles the defaults! } $return .= $setting->output_html($data); } @@ -1478,7 +1478,7 @@ class admin_setting_heading extends admin_setting { global $OUTPUT; $return = ''; if ($this->visiblename != '') { - $return .= $OUTPUT->heading(''.highlightfast($query, $this->visiblename).'', 3, 'main', true); + $return .= $OUTPUT->heading($this->visiblename, 3, 'main', true); } if ($this->description != '') { $return .= $OUTPUT->box(highlight($query, $this->description), 'generalbox formsettingheading'); @@ -6080,6 +6080,15 @@ class admin_setting_managerepository extends admin_setting { return false; } + /** + * Helper function that generates a moodle_url object + * relevant to the repository + */ + + function repository_action_url($repository) { + return new moodle_url('/admin/repository.php', array('sesskey'=>sesskey(), 'repos'=>$repository)); + } + /** * Builds XHTML to display the control * @@ -6089,117 +6098,118 @@ class admin_setting_managerepository extends admin_setting { */ public function output_html($data, $query='') { global $CFG, $USER, $OUTPUT; - $output = $OUTPUT->box_start('generalbox'); - $namestr = get_string('name'); + + $actionchoicesforexisting = array( + 'show' => get_string('on', 'repository'), + 'hide' => get_string('off', 'repository'), + 'delete' => get_string('disabled', 'repository') + ); + + $actionchoicesfornew = array( + 'newon' => get_string('on', 'repository'), + 'newoff' => get_string('off', 'repository'), + 'delete' => get_string('disabled', 'repository') + ); + + $return = ''; + $return .= $OUTPUT->box_start('generalbox'); + + // Set strings that are used multiple times $settingsstr = get_string('settings'); - $updownstr = get_string('updown', 'repository'); - $hiddenstr = get_string('hiddenshow', 'repository'); - $deletestr = get_string('delete'); - $plugins = get_plugin_list('repository'); - $instances = repository::get_types(); - $instancesnumber = count($instances); - $alreadyplugins = array(); + $disablestr = get_string('disable'); + + // Table to list plug-ins $table = new html_table(); - $table->head = array($namestr, $updownstr, $hiddenstr, $deletestr, $settingsstr); - $table->align = array('left', 'center', 'center','center','center'); + $table->head = array(get_string('name'), get_string('isactive', 'repository'), get_string('order'), $settingsstr); + $table->align = array('left', 'center', 'center', 'center', 'center'); $table->data = array(); - $updowncount=1; - foreach ($instances as $i) { - $settings = ''; - //display edit link only if you can config the type or if it has multiple instances (e.g. has instance config) - $typeoptionnames = repository::static_function($i->get_typename(), 'get_type_option_names'); - $instanceoptionnames = repository::static_function($i->get_typename(), 'get_instance_option_names'); - if ( !empty($typeoptionnames) || !empty($instanceoptionnames)) { + // Get list of used plug-ins + $instances = repository::get_types(); + if (!empty($instances)) { + // Array to store plugins being used + $alreadyplugins = array(); + $totalinstances = count($instances); + $updowncount = 1; + foreach ($instances as $i) { + $settings = ''; + $typename = $i->get_typename(); + // Display edit link only if you can config the type or if it has multiple instances (e.g. has instance config) + $typeoptionnames = repository::static_function($typename, 'get_type_option_names'); + $instanceoptionnames = repository::static_function($typename, 'get_instance_option_names'); - //calculate number of instances in order to display them for the Moodle administrator - if (!empty($instanceoptionnames)) { - $params = array(); - $params['context'] = array(get_system_context()); - $params['onlyvisible'] = false; - $params['type'] = $i->get_typename(); - $admininstancenumber = count(repository::static_function($i->get_typename(), - 'get_instances', $params)); - $admininstancenumbertext = "
". $admininstancenumber . - " " . get_string('instancesforadmin', 'repository'); - $params['context'] = array(); - $instancenumber = count(repository::static_function($i->get_typename(), 'get_instances', $params)) - $admininstancenumber; - $instancenumbertext = "
" . $instancenumber . - " " . get_string('instancesforothers', 'repository'); + if (!empty($typeoptionnames) || !empty($instanceoptionnames)) { + // Calculate number of instances in order to display them for the Moodle administrator + if (!empty($instanceoptionnames)) { + $params = array(); + $params['context'] = array(get_system_context()); + $params['onlyvisible'] = false; + $params['type'] = $typename; + $admininstancenumber = count(repository::static_function($typename, 'get_instances', $params)); + $admininstancenumbertext = "
". $admininstancenumber . " " . get_string('instancesforadmin', 'repository'); + $params['context'] = array(); + $instancenumber = count(repository::static_function($typename, 'get_instances', $params)) - $admininstancenumber; + $instancenumbertext = "
" . $instancenumber . " " . get_string('instancesforothers', 'repository'); + } else { + $admininstancenumbertext = ""; + $instancenumbertext = ""; + } + + $settings .= '' . $settingsstr .'' . $admininstancenumbertext . $instancenumbertext . "\n"; + } + // Get the current visibility + if ($i->get_visible()) { + $currentaction = 'show'; } else { - $admininstancenumbertext = ""; - $instancenumbertext = ""; + $currentaction = 'hide'; + } + + $select = new single_select($this->repository_action_url($typename, 'repos'), 'action', $actionchoicesforexisting, $currentaction, null, 'applyto' . basename($typename)); + + // Display up/down link + $updown = ''; + $spacer = $OUTPUT->spacer(array('height'=>15, 'width'=>15)); // should be done with CSS instead + + if ($updowncount > 1) { + $updown .= "baseurl&action=moveup&repos=".$typename."\">"; + $updown .= "pix_url('t/up') . "\" alt=\"up\" /> "; + } + else { + $updown .= $spacer; + } + if ($updowncount < $totalinstances) { + $updown .= "baseurl&action=movedown&repos=".$typename."\">"; + $updown .= "pix_url('t/down') . "\" alt=\"down\" />"; + } + else { + $updown .= $spacer; } - $settings .= '' - . $settingsstr .'' . $admininstancenumbertext . $instancenumbertext . "\n"; - } - $delete = '' - . $deletestr . '' . "\n"; + $updowncount++; - $hidetitle = $i->get_visible() ? get_string('clicktohide', 'repository') : get_string('clicktoshow', 'repository'); - $hiddenshow = ' ' - .'' . $hidetitle . '' - .'' . "\n"; + $table->data[] = array($i->get_readablename(), $OUTPUT->render($select), $updown, $settings); - // display up/down link - $updown = ''; - $spacer = $OUTPUT->spacer(array('height'=>15, 'width'=>15)); // should be done with CSS instead - - if ($updowncount > 1) { - $updown .= "baseurl&move=up&type=".$i->get_typename()."\">"; - $updown .= "pix_url('t/up') . "\" alt=\"up\" /> "; - } - else { - $updown .= $spacer; - } - if ($updowncount < count($instances)) { - $updown .= "baseurl&move=down&type=".$i->get_typename()."\">"; - $updown .= "pix_url('t/down') . "\" alt=\"down\" />"; - } - else { - $updown .= $spacer; - } - - $updowncount++; - - $table->data[] = array($i->get_readablename(), $updown, $hiddenshow, $delete, $settings); - - //display a grey row if the type is defined as not visible - if (!$i->get_visible()) { - $table->rowclasses[] = 'dimmed_text'; - } else { - $table->rowclasses[] = ''; - } - - if (!in_array($i->get_typename(), $alreadyplugins)) { - $alreadyplugins[] = $i->get_typename(); + if (!in_array($typename, $alreadyplugins)) { + $alreadyplugins[] = $typename; + } } } - $output .= html_writer::table($table); - $instancehtml = '

'; - $instancehtml .= get_string('addplugin', 'repository'); - $instancehtml .= '

'; - $instancehtml .= '
'; - if ($addable) { - $output .= $instancehtml; - } - $output .= $OUTPUT->box_end(); - return highlight($query, $output); + $return .= html_writer::table($table); + $return .= $OUTPUT->box_end(); + return highlight($query, $return); } } diff --git a/repository/lib.php b/repository/lib.php index daffe396a89..d60a94e4e33 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -377,12 +377,17 @@ class repository_type { } /** - * 1. Switch the visibility OFF if it's ON, and ON if it's OFF. + * 1. Change visibility to the value chosen + * * 2. Update the type * @return boolean */ - public function switch_and_update_visibility() { - $this->_visible = !$this->_visible; + public function update_visibility($visible = null) { + if (is_bool($visible)) { + $this->_visible = $visible; + } else { + $this->_visible = !$this->_visible; + } return $this->update_visible(); } @@ -1022,7 +1027,6 @@ abstract class repository { $pluginstr = get_string('plugin', 'repository'); $settingsstr = get_string('settings'); $deletestr = get_string('delete'); - $updown = get_string('updown', 'repository'); //retrieve list of instances. In administration context we want to display all //instances of a type, even if this type is not visible. In course/user context we //want to display only visible instances, but for every type types. The repository::get_instances() @@ -1037,7 +1041,7 @@ abstract class repository { $alreadyplugins = array(); $table = new html_table(); - $table->head = array($namestr, $pluginstr, $deletestr, $settingsstr); + $table->head = array($namestr, $pluginstr, $settingsstr, $deletestr); $table->align = array('left', 'left', 'center','center'); $table->data = array(); @@ -1065,7 +1069,7 @@ abstract class repository { } $type = repository::get_type_by_id($i->options['typeid']); - $table->data[] = array($i->name, $type->get_readablename(), $delete, $settings); + $table->data[] = array($i->name, $type->get_readablename(), $settings, $delete); //display a grey row if the type is defined as not visible if (isset($type) && !$type->get_visible()) { @@ -1689,6 +1693,7 @@ final class repository_instance_form extends moodleform { final class repository_type_form extends moodleform { protected $instance; protected $plugin; + protected $action; /** * Definition of the moodleform @@ -1702,15 +1707,18 @@ final class repository_type_form extends moodleform { && is_a($this->_customdata['instance'], 'repository_type')) ? $this->_customdata['instance'] : null; + $this->action = $this->_customdata['action']; $mform =& $this->_form; $strrequired = get_string('required'); - $mform->addElement('hidden', 'edit', ($this->instance) ? $this->instance->get_typename() : 0); - $mform->setType('edit', PARAM_INT); - $mform->addElement('hidden', 'new', $this->plugin); - $mform->setType('new', PARAM_FORMAT); - $mform->addElement('hidden', 'plugin', $this->plugin); - $mform->setType('plugin', PARAM_SAFEDIR); + $mform->addElement('hidden', 'repos', ($this->instance) ? $this->instance->get_typename() : 0); + $mform->setType('repos', PARAM_INT); + $mform->addElement('hidden', 'repos', $this->plugin); + $mform->setType('repos', PARAM_FORMAT); + $mform->addElement('hidden', 'action', $this->action); + $mform->setType('action', PARAM_TEXT); + $mform->addElement('hidden', 'repos', $this->plugin); + $mform->setType('repos', PARAM_SAFEDIR); // let the plugin add its specific fields if (!$this->instance) {