From: mjollnir_ Date: Tue, 2 Sep 2008 10:29:09 +0000 (+0000) Subject: MDL-14591: improvements to configuring already-broken portfolio plugins X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=36facf2e0b547269afdb2b8a83e572f4b107affd;p=moodle.git MDL-14591: improvements to configuring already-broken portfolio plugins --- diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index c7a362a53a..3fb6dc21cd 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -1725,9 +1725,6 @@ final class portfolio_admin_form extends moodleform { $mform->addElement('hidden', 'new', $this->plugin); $mform->addElement('hidden', 'plugin', $this->plugin); - $mform->addElement('text', 'name', get_string('name'), 'maxlength="100" size="30"'); - $mform->addRule('name', $strrequired, 'required', null, 'client'); - // let the plugin add the fields they want (either statically or not) if (portfolio_static_function($this->plugin, 'has_admin_config')) { if (!$this->instance) { @@ -1737,10 +1734,16 @@ final class portfolio_admin_form extends moodleform { } } + if (isset($result) && is_string($result)) { // something went wrong, stop - throw new portfolio_exception($result, 'portfolio_' . $this->plugin, $CFG->wwwroot . '/' . $CFG->admin . '/portfolio.php'); + $mform->addElement('static', 'insane', '', get_string($result, 'portfolio_' . $this->plugin)); //, get_string($result, 'portfolio_' . $this->plugin)); + //throw new portfolio_exception($result, 'portfolio_' . $this->plugin, $CFG->wwwroot . '/' . $CFG->admin . '/portfolio.php'); } + $mform->addElement('text', 'name', get_string('name'), 'maxlength="100" size="30"'); + $mform->addRule('name', $strrequired, 'required', null, 'client'); + + // and set the data if we have some. if ($this->instance) { $data = array('name' => $this->instance->get('name'));