From d73e265e9a3a49c5ee7004a6c77e638291cfc91b Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 5 Dec 2006 09:44:11 +0000 Subject: [PATCH] added cancel button to glossary comment form and fixed initialization of button arrays MDL-7778 --- login/change_password_form.php | 1 + login/forgot_password_form.php | 1 + login/signup_form.php | 1 + mod/assignment/type/online/assignment.class.php | 1 + mod/assignment/type/upload/assignment.class.php | 1 + mod/glossary/comment.php | 4 ++++ mod/glossary/comment_form.php | 8 +++++--- 7 files changed, 14 insertions(+), 3 deletions(-) diff --git a/login/change_password_form.php b/login/change_password_form.php index 0f9d6b3f07..a6f9b94662 100644 --- a/login/change_password_form.php +++ b/login/change_password_form.php @@ -47,6 +47,7 @@ class change_password_form extends moodleform { // buttons if (empty($USER->preference['auth_forcepasswordchange'])) { + $buttonarray = array(); $buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('savechanges')); $buttonarray[] = &$mform->createElement('cancel'); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); diff --git a/login/forgot_password_form.php b/login/forgot_password_form.php index 31038629cc..bc64b74d57 100644 --- a/login/forgot_password_form.php +++ b/login/forgot_password_form.php @@ -21,6 +21,7 @@ class forgot_password_form extends moodleform { $mform->setType('action', PARAM_ALPHA); // buttons + $buttonarray = array(); $buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('ok')); $buttonarray[] = &$mform->createElement('cancel'); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); diff --git a/login/signup_form.php b/login/signup_form.php index 6e76e1bff8..f1a6737c60 100644 --- a/login/signup_form.php +++ b/login/signup_form.php @@ -50,6 +50,7 @@ class login_signup_form extends moodleform { $mform->setDefault('country', ''); // buttons + $buttonarray = array(); $buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('createaccount')); $buttonarray[] = &$mform->createElement('cancel'); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); diff --git a/mod/assignment/type/online/assignment.class.php b/mod/assignment/type/online/assignment.class.php index 00b4243bdb..1b7f2fda96 100644 --- a/mod/assignment/type/online/assignment.class.php +++ b/mod/assignment/type/online/assignment.class.php @@ -256,6 +256,7 @@ class assignment_online_edit_form extends moodleform { $mform->setType('id', PARAM_INT); // buttons + $buttonarray = array(); $buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('savechanges')); $buttonarray[] =& $mform->createElement('reset', 'reset', get_string('revert')); $buttonarray[] =& $mform->createElement('cancel'); diff --git a/mod/assignment/type/upload/assignment.class.php b/mod/assignment/type/upload/assignment.class.php index 1a3a75e74e..dce890508b 100644 --- a/mod/assignment/type/upload/assignment.class.php +++ b/mod/assignment/type/upload/assignment.class.php @@ -929,6 +929,7 @@ class assignment_upload_notes_form extends moodleform { $mform->setType('id', PARAM_ALPHA); // buttons + $buttonarray = array(); $buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('savechanges')); $buttonarray[] =& $mform->createElement('reset', 'reset', get_string('revert')); $buttonarray[] =& $mform->createElement('cancel'); diff --git a/mod/glossary/comment.php b/mod/glossary/comment.php index e4441de06a..3fd7039b02 100644 --- a/mod/glossary/comment.php +++ b/mod/glossary/comment.php @@ -54,6 +54,10 @@ function glossary_comment_add() { $mform = new glossary_comment_form('comment.php'); $mform->set_defaults(array('eid'=>$eid, 'action'=>'add')); + if ($mform->is_cancelled()) { + redirect("comments.php?id=$cm->id&eid=$entry->id"); + } + if ($data = $mform->data_submitted()) { trusttext_after_edit($data->entrycomment, $context); diff --git a/mod/glossary/comment_form.php b/mod/glossary/comment_form.php index 0d26b7f6cb..dec379e3ef 100644 --- a/mod/glossary/comment_form.php +++ b/mod/glossary/comment_form.php @@ -25,9 +25,11 @@ class glossary_comment_form extends moodleform { $mform->setType('action', PARAM_ACTION); // buttons - $buttonarray=array(); - $buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('savechanges')); - $buttonarray[] = &$mform->createElement('reset', 'resetbutton', get_string('revert')); + $buttonarray = array(); + $buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('savechanges')); + $buttonarray[] =& $mform->createElement('reset', 'reset', get_string('revert')); + $buttonarray[] =& $mform->createElement('cancel'); + $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); } } -- 2.39.5