From 3e2efe3b05d6d0806424bdb55ab9c006d746a40e Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Fri, 16 Nov 2012 15:55:45 +0800 Subject: [PATCH] MDl-36352 Calendar: Poll interval will be disabled for calendar file import --- calendar/managesubscriptions_form.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/calendar/managesubscriptions_form.php b/calendar/managesubscriptions_form.php index 12c3135c1a3..26598c9cfb2 100644 --- a/calendar/managesubscriptions_form.php +++ b/calendar/managesubscriptions_form.php @@ -63,9 +63,6 @@ class calendar_addsubscription_form extends moodleform { // Import file $mform->addElement('filepicker', 'importfile', get_string('importfromfile', 'calendar')); - $mform->disabledIf('url', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_FILE); - $mform->disabledIf('importfile', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_URL); - // Poll interval $choices = calendar_get_pollinterval_choices(); $mform->addElement('select', 'pollinterval', get_string('pollinterval', 'calendar'), $choices); @@ -73,6 +70,11 @@ class calendar_addsubscription_form extends moodleform { $mform->addHelpButton('pollinterval', 'pollinterval', 'calendar'); $mform->setType('pollinterval', PARAM_INT); + // Disable appropriate elements depending on import from value. + $mform->disabledIf('pollinterval', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_FILE); + $mform->disabledIf('url', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_FILE); + $mform->disabledIf('importfile', 'importfrom', 'eq', CALENDAR_IMPORT_FROM_URL); + // Eventtype: 0 = user, 1 = global, anything else = course ID. list($choices, $groups) = calendar_get_eventtype_choices($courseid); $mform->addElement('select', 'eventtype', get_string('eventkind', 'calendar'), $choices);