Merge branch 'w29_MDL-28384_m22_nullurl' of git://github.com/skodak/moodle
authorSam Hemelryk <sam@moodle.com>
Mon, 25 Jul 2011 02:14:29 +0000 (10:14 +0800)
committerSam Hemelryk <sam@moodle.com>
Mon, 25 Jul 2011 02:14:29 +0000 (10:14 +0800)
enrol/cohort/addinstance.php
enrol/cohort/ajax.php
enrol/cohort/lib.php
lib/accesslib.php
lib/outputrequirementslib.php
theme/canvas/style/core.css

index d35e098..bafb716 100644 (file)
@@ -35,6 +35,7 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
 
 require_login($course);
 require_capability('moodle/course:enrolconfig', $context);
+require_capability('enrol/cohort:config', $context);
 
 $PAGE->set_url('/enrol/cohort/addinstance.php', array('id'=>$course->id));
 $PAGE->set_pagelayout('admin');
index 83888a8..ccb8412 100644 (file)
@@ -74,6 +74,7 @@ switch ($action) {
         break;
     case 'enrolcohort':
         require_capability('moodle/course:enrolconfig', $context);
+        require_capability('enrol/cohort:config', $context);
         $roleid = required_param('roleid', PARAM_INT);
         $cohortid = required_param('cohortid', PARAM_INT);
         
@@ -87,10 +88,16 @@ switch ($action) {
         enrol_cohort_sync($manager->get_course()->id);
         break;
     case 'enrolcohortusers':
-        require_capability('moodle/course:enrolconfig', $context);
+        require_capability('enrol/manual:enrol', $context);
         $roleid = required_param('roleid', PARAM_INT);
         $cohortid = required_param('cohortid', PARAM_INT);
         $result = enrol_cohort_enrol_all_users($manager, $cohortid, $roleid);
+
+        $roles = $manager->get_assignable_roles();
+        $cohorts = enrol_cohort_get_cohorts($manager);
+        if (!array_key_exists($cohortid, $cohorts) || !array_key_exists($roleid, $roles)) {
+            throw new enrol_ajax_exception('errorenrolcohort');
+        }
         if ($result === false) {
             throw new enrol_ajax_exception('errorenrolcohortusers');
         }
index aa0c320..d8cd4e1 100644 (file)
@@ -163,7 +163,7 @@ class enrol_cohort_plugin extends enrol_plugin {
         $button->strings_for_js('users', 'moodle');
 
         // No point showing this at all if the user cant manually enrol users
-        $hasmanualinstance = has_capability('enrol/manual:manage', $manager->get_context()) && $manager->has_instance('manual');
+        $hasmanualinstance = has_capability('enrol/manual:enrol', $manager->get_context()) && $manager->has_instance('manual');
 
         $modules = array('moodle-enrol_cohort-quickenrolment', 'moodle-enrol_cohort-quickenrolment-skin');
         $function = 'M.enrol_cohort.quickenrolment.init';
index f56aecb..44b87ee 100644 (file)
@@ -3395,6 +3395,12 @@ function update_capabilities($component = 'moodle') {
     $storedcaps = array();
 
     $filecaps = load_capability_def($component);
+    foreach($filecaps as $capname=>$unused) {
+        if (!preg_match('|^[a-z]+/[a-z_0-9]+:[a-z_0-9]+$|', $capname)) {
+            debugging("Coding problem: Invalid capability name '$capname', use 'clonepermissionsfrom' field for migration.");
+        }
+    }
+
     $cachedcaps = get_cached_capabilities($component);
     if ($cachedcaps) {
         foreach ($cachedcaps as $cachedcap) {
index bdd635f..6c7d0e4 100644 (file)
@@ -719,7 +719,7 @@ class page_requirements_manager {
             // Set Y's config.gallery to the version
             $jscode = 'Y.config.gallery='.json_encode($galleryversion).';';
         }
-        $jscode .= 'Y.use('.join(',', array_map('json_encode', $modules)).',function() {'.js_writer::function_call($function, $arguments).'})';
+        $jscode .= 'Y.use('.join(',', array_map('json_encode', $modules)).',function() {'.js_writer::function_call($function, $arguments).'});';
         if ($ondomready) {
             $jscode = "Y.on('domready', function() { $jscode });";
         }
index 1efd840..0431db1 100644 (file)
@@ -200,7 +200,7 @@ input[type="radio"] {
 
 .maincalendar .calendarmonth th,
 .minicalendar th {
-    background: url([[pix:theme|gradient-sb]]) repeat-x 0 0;
+    background: none;
 }
 
 .maincalendar .calendar-controls {