Merge branch 'MDL-26240' of git://github.com/lazydaisy/moodle
authorSam Hemelryk <sam@moodle.com>
Tue, 29 Nov 2011 03:52:50 +0000 (16:52 +1300)
committerSam Hemelryk <sam@moodle.com>
Tue, 29 Nov 2011 03:52:50 +0000 (16:52 +1300)
28 files changed:
filter/mediaplugin/simpletest/testfiltermediaplugin.php
grade/report/grader/styles.css
lib/db/upgradelib.php
lib/navigationlib.php
lib/outputcomponents.php
lib/upgrade.txt
mod/assignment/styles.css
mod/forum/lib.php
mod/glossary/editcategories.php
mod/lti/simpletest/testlocallib.php
mod/survey/report.php
mod/url/locallib.php
mod/wiki/edit_form.php
portfolio/boxnet/lib.php
repository/dropbox/lib.php
repository/dropbox/locallib.php
tag/locallib.php
theme/afterburner/config.php
theme/afterburner/lang/en/theme_afterburner.php
theme/afterburner/layout/default.php
theme/afterburner/lib.php [new file with mode: 0644]
theme/afterburner/pix/images/logo.jpg [new file with mode: 0644]
theme/afterburner/settings.php [new file with mode: 0644]
theme/afterburner/style/afterburner_styles.css
theme/base/style/core.css
theme/standard/style/grade.css
user/profile.php
user/view.php

index 139499d..e74bb2a 100644 (file)
@@ -92,7 +92,6 @@ class filter_mediaplugin_test extends UnitTestCase {
                             '<a >test test</a>',
                             '<ahref="http://moodle.org/testfile/test.mp3">sample</a>',
                             '<a href="" test></a>',
-                            '<a class="_blanktarget" href="http://moodle.org/testfile/test.flv?d=100x">test flv</a>',
                             '<a href="http://www.moodle.com/path/to?#param=29">test</a>',
                             '<a href="http://moodle.org/testfile/test.mp3">test mp3',
                             '<a href="http://moodle.org/testfile/test.mp3"test</a>',
index 7d9c44c..b5a3f95 100644 (file)
@@ -539,6 +539,14 @@ table#user-grades td.ajax {
 text-align:left;
 }
 
+.dir-rtl table#user-grades td.userfield,
+.dir-rtl table#user-grades th,
+.path-grade-report-grader.dir-rtl  div.gradeparent,
+.path-grade-report-grader.dir-rtl  .ie6 form,
+.dir-rtl table#user-grades td.ajax {
+text-align:right;
+}
+
 .path-grade-report-grader .gradeparent {
     overflow:auto;
 }
index 84ce362..6f1455f 100644 (file)
@@ -192,7 +192,10 @@ function upgrade_migrate_user_icons() {
         upgrade_set_timeout(60); /// Give upgrade at least 60 more seconds
         $pbar->update($i, $count, "Migrated user icons $i/$count.");
 
-        $context = get_context_instance(CONTEXT_USER, $user->id);
+        if (!$context = get_context_instance(CONTEXT_USER, $user->id)) {
+            // deleted user
+            continue;
+        }
 
         if ($fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f1.jpg')) {
             // already converted!
index 82a672e..239021b 100644 (file)
@@ -1060,7 +1060,7 @@ class global_navigation extends navigation_node {
         $mycourses = enrol_get_my_courses(NULL, 'visible DESC,sortorder ASC', $limit);
         $showallcourses = (count($mycourses) == 0 || !empty($CFG->navshowallcourses));
         $showcategories = ($showallcourses && $this->show_categories());
-        $issite = ($this->page->course->id != SITEID);
+        $issite = ($this->page->course->id == SITEID);
         $ismycourse = (array_key_exists($this->page->course->id, $mycourses));
 
         // Check if any courses were returned.
@@ -1080,143 +1080,143 @@ class global_navigation extends navigation_node {
         // JavaScript enabled.
         $frontpagecourse = $this->load_course($SITE);
         $this->add_front_page_course_essentials($frontpagecourse, $SITE);
+        $this->load_course_sections($SITE, $frontpagecourse);
 
         $canviewcourseprofile = true;
 
-        // Next load context specific content into the navigation
-        switch ($this->page->context->contextlevel) {
-            case CONTEXT_SYSTEM :
-                // This has already been loaded we just need to map the variable
-                $coursenode = $frontpagecourse;
-                $this->load_all_categories(null, $showcategories);
-                break;
-            case CONTEXT_COURSECAT :
-                // This has already been loaded we just need to map the variable
-                $coursenode = $frontpagecourse;
-                $this->load_all_categories($this->page->context->instanceid, $showcategories);
-                break;
-            case CONTEXT_BLOCK :
-            case CONTEXT_COURSE :
-                // Load the course associated with the page into the navigation
-                $course = $this->page->course;
-                if ($showcategories && !$issite && !$ismycourse) {
-                    $this->load_all_categories($course->category, $showcategories);
-                }
-                $coursenode = $this->load_course($course);
-
-                // If the course wasn't added then don't try going any further.
-                if (!$coursenode) {
-                    $canviewcourseprofile = false;
+        if (!$issite) {
+            // Next load context specific content into the navigation
+            switch ($this->page->context->contextlevel) {
+                case CONTEXT_SYSTEM :
+                    // This has already been loaded we just need to map the variable
+                    $coursenode = $frontpagecourse;
+                    $this->load_all_categories(null, $showcategories);
                     break;
-                }
-
-                // If the user is not enrolled then we only want to show the
-                // course node and not populate it.
-
-                // Not enrolled, can't view, and hasn't switched roles
-                if (!can_access_course($course)) {
-                    // TODO: very ugly hack - do not force "parents" to enrol into course their child is enrolled in,
-                    // this hack has been propagated from user/view.php to display the navigation node. (MDL-25805)
-                    $isparent = false;
-                    if ($this->useridtouseforparentchecks) {
-                        if ($this->useridtouseforparentchecks != $USER->id) {
-                            $usercontext   = get_context_instance(CONTEXT_USER, $this->useridtouseforparentchecks, MUST_EXIST);
-                            if ($DB->record_exists('role_assignments', array('userid' => $USER->id, 'contextid' => $usercontext->id))
-                                    and has_capability('moodle/user:viewdetails', $usercontext)) {
-                                $isparent = true;
-                            }
-                        }
+                case CONTEXT_COURSECAT :
+                    // This has already been loaded we just need to map the variable
+                    $coursenode = $frontpagecourse;
+                    $this->load_all_categories($this->page->context->instanceid, $showcategories);
+                    break;
+                case CONTEXT_BLOCK :
+                case CONTEXT_COURSE :
+                    // Load the course associated with the page into the navigation
+                    $course = $this->page->course;
+                    if ($showcategories && !$ismycourse) {
+                        $this->load_all_categories($course->category, $showcategories);
                     }
+                    $coursenode = $this->load_course($course);
 
-                    if (!$isparent) {
-                        $coursenode->make_active();
+                    // If the course wasn't added then don't try going any further.
+                    if (!$coursenode) {
                         $canviewcourseprofile = false;
                         break;
                     }
-                }
-                // Add the essentials such as reports etc...
-                $this->add_course_essentials($coursenode, $course);
-                if ($this->format_display_course_content($course->format)) {
-                    // Load the course sections
-                    $sections = $this->load_course_sections($course, $coursenode);
-                }
-                if (!$coursenode->contains_active_node() && !$coursenode->search_for_active_node()) {
-                    $coursenode->make_active();
-                }
-                break;
-            case CONTEXT_MODULE :
-                $course = $this->page->course;
-                $cm = $this->page->cm;
 
-                if ($showcategories && !$issite && !$ismycourse) {
-                    $this->load_all_categories($course->category, $showcategories);
-                }
+                    // If the user is not enrolled then we only want to show the
+                    // course node and not populate it.
 
-                // Load the course associated with the page into the navigation
-                $coursenode = $this->load_course($course);
+                    // Not enrolled, can't view, and hasn't switched roles
+                    if (!can_access_course($course)) {
+                        // TODO: very ugly hack - do not force "parents" to enrol into course their child is enrolled in,
+                        // this hack has been propagated from user/view.php to display the navigation node. (MDL-25805)
+                        $isparent = false;
+                        if ($this->useridtouseforparentchecks) {
+                            if ($this->useridtouseforparentchecks != $USER->id) {
+                                $usercontext   = get_context_instance(CONTEXT_USER, $this->useridtouseforparentchecks, MUST_EXIST);
+                                if ($DB->record_exists('role_assignments', array('userid' => $USER->id, 'contextid' => $usercontext->id))
+                                        and has_capability('moodle/user:viewdetails', $usercontext)) {
+                                    $isparent = true;
+                                }
+                            }
+                        }
 
-                // If the course wasn't added then don't try going any further.
-                if (!$coursenode) {
-                    $canviewcourseprofile = false;
+                        if (!$isparent) {
+                            $coursenode->make_active();
+                            $canviewcourseprofile = false;
+                            break;
+                        }
+                    }
+                    // Add the essentials such as reports etc...
+                    $this->add_course_essentials($coursenode, $course);
+                    if ($this->format_display_course_content($course->format)) {
+                        // Load the course sections
+                        $sections = $this->load_course_sections($course, $coursenode);
+                    }
+                    if (!$coursenode->contains_active_node() && !$coursenode->search_for_active_node()) {
+                        $coursenode->make_active();
+                    }
                     break;
-                }
+                case CONTEXT_MODULE :
+                    $course = $this->page->course;
+                    $cm = $this->page->cm;
 
-                // If the user is not enrolled then we only want to show the
-                // course node and not populate it.
-                if (!can_access_course($course)) {
-                    $coursenode->make_active();
-                    $canviewcourseprofile = false;
-                    break;
-                }
+                    if ($showcategories && !$ismycourse) {
+                        $this->load_all_categories($course->category, $showcategories);
+                    }
 
-                $this->add_course_essentials($coursenode, $course);
-                // Load the course sections into the page
-                $sections = $this->load_course_sections($course, $coursenode);
-                if ($course->id != SITEID) {
-                    // Find the section for the $CM associated with the page and collect
-                    // its section number.
-                    if (isset($cm->sectionnum)) {
-                        $cm->sectionnumber = $cm->sectionnum;
-                    } else {
-                        foreach ($sections as $section) {
-                            if ($section->id == $cm->section) {
-                                $cm->sectionnumber = $section->section;
-                                break;
+                    // Load the course associated with the page into the navigation
+                    $coursenode = $this->load_course($course);
+
+                    // If the course wasn't added then don't try going any further.
+                    if (!$coursenode) {
+                        $canviewcourseprofile = false;
+                        break;
+                    }
+
+                    // If the user is not enrolled then we only want to show the
+                    // course node and not populate it.
+                    if (!can_access_course($course)) {
+                        $coursenode->make_active();
+                        $canviewcourseprofile = false;
+                        break;
+                    }
+
+                    $this->add_course_essentials($coursenode, $course);
+                    // Load the course sections into the page
+                    $sections = $this->load_course_sections($course, $coursenode);
+                    if ($course->id != SITEID) {
+                        // Find the section for the $CM associated with the page and collect
+                        // its section number.
+                        if (isset($cm->sectionnum)) {
+                            $cm->sectionnumber = $cm->sectionnum;
+                        } else {
+                            foreach ($sections as $section) {
+                                if ($section->id == $cm->section) {
+                                    $cm->sectionnumber = $section->section;
+                                    break;
+                                }
                             }
                         }
-                    }
 
-                    // Load all of the section activities for the section the cm belongs to.
-                    if (isset($cm->sectionnumber) and !empty($sections[$cm->sectionnumber])) {
-                        list($sectionarray, $activityarray) = $this->generate_sections_and_activities($course);
-                        $activities = $this->load_section_activities($sections[$cm->sectionnumber]->sectionnode, $cm->sectionnumber, $activityarray);
+                        // Load all of the section activities for the section the cm belongs to.
+                        if (isset($cm->sectionnumber) and !empty($sections[$cm->sectionnumber])) {
+                            list($sectionarray, $activityarray) = $this->generate_sections_and_activities($course);
+                            $activities = $this->load_section_activities($sections[$cm->sectionnumber]->sectionnode, $cm->sectionnumber, $activityarray);
+                        } else {
+                            $activities = array();
+                            if ($activity = $this->load_stealth_activity($coursenode, get_fast_modinfo($course))) {
+                                // "stealth" activity from unavailable section
+                                $activities[$cm->id] = $activity;
+                            }
+                        }
                     } else {
                         $activities = array();
-                        if ($activity = $this->load_stealth_activity($coursenode, get_fast_modinfo($course))) {
-                            // "stealth" activity from unavailable section
-                            $activities[$cm->id] = $activity;
-                        }
+                        $activities[$cm->id] = $coursenode->get($cm->id, navigation_node::TYPE_ACTIVITY);
                     }
-                } else {
-                    $activities = array();
-                    $activities[$cm->id] = $coursenode->get($cm->id, navigation_node::TYPE_ACTIVITY);
-                }
-                if (!empty($activities[$cm->id])) {
-                    // Finally load the cm specific navigaton information
-                    $this->load_activity($cm, $course, $activities[$cm->id]);
-                    // Check if we have an active ndoe
-                    if (!$activities[$cm->id]->contains_active_node() && !$activities[$cm->id]->search_for_active_node()) {
-                        // And make the activity node active.
-                        $activities[$cm->id]->make_active();
+                    if (!empty($activities[$cm->id])) {
+                        // Finally load the cm specific navigaton information
+                        $this->load_activity($cm, $course, $activities[$cm->id]);
+                        // Check if we have an active ndoe
+                        if (!$activities[$cm->id]->contains_active_node() && !$activities[$cm->id]->search_for_active_node()) {
+                            // And make the activity node active.
+                            $activities[$cm->id]->make_active();
+                        }
+                    } else {
+                        //TODO: something is wrong, what to do? (Skodak)
                     }
-                } else {
-                    //TODO: something is wrong, what to do? (Skodak)
-                }
-                break;
-            case CONTEXT_USER :
-                $course = $this->page->course;
-                if ($course->id != SITEID) {
-                    if ($showcategories && !$issite && !$ismycourse) {
+                    break;
+                case CONTEXT_USER :
+                    if ($showcategories && !$ismycourse) {
                         $this->load_all_categories($course->category, $showcategories);
                     }
                     // Load the course associated with the user into the navigation
@@ -1237,8 +1237,8 @@ class global_navigation extends navigation_node {
                     }
                     $this->add_course_essentials($coursenode, $course);
                     $sections = $this->load_course_sections($course, $coursenode);
-                }
-                break;
+                    break;
+            }
         }
 
         $limit = 20;
index 3a1dc07..c5c2046 100644 (file)
@@ -104,7 +104,7 @@ class user_picture implements renderable {
     /**
      * @var array List of mandatory fields in user record here. (do not include TEXT columns because it would break SELECT DISTINCT in MSSQL and ORACLE)
      */
-    protected static $fields = array('id', 'picture', 'firstname', 'lastname', 'imagealt', 'email');
+    protected static $fields = array('id', 'picture', 'firstname', 'lastname', 'imagealt', 'email'); //TODO: add deleted
 
     /**
      * @var object $user A user object with at least fields all columns specified in $fields array constant set.
@@ -300,9 +300,12 @@ class user_picture implements renderable {
 
         // First we need to determine whether the user has uploaded a profile
         // picture of not.
-        $fs = get_file_storage();
-        $context = get_context_instance(CONTEXT_USER, $this->user->id);
-        $hasuploadedfile = ($fs->file_exists($context->id, 'user', 'icon', 0, '/', $filename.'/.png') || $fs->file_exists($context->id, 'user', 'icon', 0, '/', $filename.'/.jpg'));
+        if (!empty($this->user->deleted) or !$context = context_user::instance($this->user->id, IGNORE_MISSING)) {
+            $hasuploadedfile = false;
+        } else {
+            $fs = get_file_storage();
+            $hasuploadedfile = ($fs->file_exists($context->id, 'user', 'icon', 0, '/', $filename.'/.png') || $fs->file_exists($context->id, 'user', 'icon', 0, '/', $filename.'/.jpg'));
+        }
 
         $imageurl = $renderer->pix_url('u/'.$filename);
         if ($hasuploadedfile && $this->user->picture == 1) {
index a624a4d..f8f3af8 100644 (file)
@@ -10,6 +10,7 @@ removed unused libraries:
 API changes:
 * new admin/tool plugin type
 * new context API - old API is still available
+* deleted users do not have context any more
 * removed global search
 
 
index 356ac17..7d10cd9 100644 (file)
@@ -34,7 +34,6 @@
 
 #page-mod-assignment-submissions .mform.optionspref .fitem .fitemtitle {width:50%;}
 #page-mod-assignment-submissions .mform.optionspref .fitem .felement {width: 30%; margin-left: 51%;}
-#page-mod-assignment-submissions.dir-rtl .mform .fitem .felement {margin-right: 51%; margin-left: 0;}
 
 #page-mod-assignment-submissions .optionspref {width: 50%;}
 #page-mod-assignment-submissions .fastgbutton {text-align: center;}
index 48344e4..71339e4 100644 (file)
@@ -4012,6 +4012,72 @@ function forum_get_file_areas($course, $cm, $context) {
     return $areas;
 }
 
+/**
+ * File browsing support for forum module.
+ *
+ * @param object $browser
+ * @param object $areas
+ * @param object $course
+ * @param object $cm
+ * @param object $context
+ * @param string $filearea
+ * @param int $itemid
+ * @param string $filepath
+ * @param string $filename
+ * @return object file_info instance or null if not found
+ */
+function forum_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
+    global $CFG, $DB;
+
+    if ($context->contextlevel != CONTEXT_MODULE) {
+        return null;
+    }
+
+    $fileareas = array('attachment', 'post');
+    if (!in_array($filearea, $fileareas)) {
+        return null;
+    }
+
+    if (!$post = $DB->get_record('forum_posts', array('id' => $itemid))) {
+        return null;
+    }
+
+    if (!$discussion = $DB->get_record('forum_discussions', array('id' => $post->discussion))) {
+        return null;
+    }
+
+    if (!$forum = $DB->get_record('forum', array('id' => $cm->instance))) {
+        return null;
+    }
+
+    $fs = get_file_storage();
+    $filepath = is_null($filepath) ? '/' : $filepath;
+    $filename = is_null($filename) ? '.' : $filename;
+    if (!($storedfile = $fs->get_file($context->id, 'mod_forum', $filearea, $itemid, $filepath, $filename))) {
+        return null;
+    }
+
+    // Make sure groups allow this user to see this file
+    if ($discussion->groupid > 0 and $groupmode = groups_get_activity_groupmode($cm, $course)) {   // Groups are being used
+        if (!groups_group_exists($discussion->groupid)) { // Can't find group
+            return null;                           // Be safe and don't send it to anyone
+        }
+
+        if (!groups_is_member($discussion->groupid) and !has_capability('moodle/site:accessallgroups', $context)) {
+            // do not send posts from other groups when in SEPARATEGROUPS or VISIBLEGROUPS
+            return null;
+        }
+    }
+
+    // Make sure we're allowed to see it...
+    if (!forum_user_can_see_post($forum, $discussion, $post, NULL, $cm)) {
+        return null;
+    }
+
+    $urlbase = $CFG->wwwroot.'/pluginfile.php';
+    return new file_info_stored($browser, $context, $storedfile, $urlbase, $filearea, $itemid, true, true, false);
+}
+
 /**
  * Serves the forum attachments. Implements needed access control ;-)
  *
@@ -4834,6 +4900,10 @@ function forum_user_can_post_discussion($forum, $currentgroup=null, $unused=-1,
         return false;
     }
 
+    if ($forum->type == 'single') {
+        return false;
+    }
+
     if ($forum->type == 'eachuser') {
         if (forum_user_has_posted_discussion($forum->id, $USER->id)) {
             return false;
index 43e6340..3dc672f 100644 (file)
@@ -83,6 +83,15 @@ echo $OUTPUT->header();
 $fmtoptions = array(
     'context' => $context);
 
+if (right_to_left()) { // RTL table alignment support
+    $rightalignment = 'left';
+    $leftalignment = 'right';
+} else {
+    $rightalignment = 'right';
+    $leftalignment = 'left';
+
+}
+
 if ( $hook >0 ) {
 
     if ( $action == "edit" ) {
@@ -135,7 +144,7 @@ if ( $hook >0 ) {
 
                 <table border="0" width="100" class="confirmbuttons">
                     <tr>
-                        <td align="right" style="width:50%">
+                        <td align="$rightalignment" style="width:50%">
                         <form id="form" method="post" action="editcategories.php">
                         <div>
                         <input type="hidden" name="id"          value="<?php p($cm->id) ?>" />
@@ -147,7 +156,7 @@ if ( $hook >0 ) {
                         </div>
                         </form>
                         </td>
-                        <td align="left" style="width:50%">
+                        <td align="$leftalignment" style="width:50%">
 
 <?php
             unset($options);
@@ -217,7 +226,7 @@ if ( $action ) {
 ?>
 
              <tr>
-               <td style="width:80%" align="left">
+               <td style="width:80%" align="$leftalignment">
                <?php
                     echo "<span class=\"bold\">".format_string($category->name, true, $fmtoptions)."</span> <span>($num_entries " . get_string("entries","glossary") . ")</span>";
                ?>
@@ -245,9 +254,9 @@ if ( $action ) {
              $options['id'] = $cm->id;
              $options['action'] = "add";
 
-             echo "<table class=\"editbuttons\" border=\"0\"><tr><td align=\"right\">";
+             echo "<table class=\"editbuttons\" border=\"0\"><tr><td align=\"$rightalignment\">";
              echo $OUTPUT->single_button(new moodle_url("editcategories.php", $options), get_string("add") . " " . get_string("category","glossary"));
-             echo "</td><td align=\"left\">";
+             echo "</td><td align=\"$leftalignment\">";
              unset($options['action']);
              $options['mode'] = 'cat';
              $options['hook'] = $hook;
index 34a2674..aaeeb42 100644 (file)
@@ -70,7 +70,13 @@ class lti_locallib_test extends UnitTestCase {
                 array('custom_complex____________key' => 'Complex!@#$^*(){}[]Value'));
     }
 
-    public function test_sign_parameters() {
+    /**
+     * This test has been disabled because the test-tool is
+     * being moved and probably it won't work anymore for this.
+     * We should be testing here local stuff only and leave
+     * outside-checks to the conformance tests. MDL-30347
+     */
+    public function disabled_test_sign_parameters() {
         $correct = array ( 'context_id' => '12345', 'context_label' => 'SI124', 'context_title' => 'Social Computing', 'ext_submit' => 'Click Me', 'lti_message_type' => 'basic-lti-launch-request', 'lti_version' => 'LTI-1p0', 'oauth_consumer_key' => 'lmsng.school.edu', 'oauth_nonce' => '47458148e33a8f9dafb888c3684cf476', 'oauth_signature' => 'qWgaBIezihCbeHgcwUy14tZcyDQ=', 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => '1307141660', 'oauth_version' => '1.0', 'resource_link_id' => '123', 'resource_link_title' => 'Weekly Blog', 'roles' => 'Learner', 'tool_consumer_instance_guid' => 'lmsng.school.edu', 'user_id' => '789');
 
         $requestparams = array('resource_link_id' => '123', 'resource_link_title' => 'Weekly Blog', 'user_id' => '789', 'roles' => 'Learner', 'context_id' => '12345', 'context_label' => 'SI124', 'context_title' => 'Social Computing');
@@ -90,7 +96,13 @@ class lti_locallib_test extends UnitTestCase {
         $this->assertEqual($parms, $correct);
     }
 
-    public function test_parse_grade_replace_message() {
+    /**
+     * This test has been disabled because, since its creation,
+     * the sourceId generation has changed and surely this is outdated.
+     * Some day these should be replaced by proper tests, but until then
+     * conformance tests say this is working. MDL-30347
+     */
+    public function disabled_test_parse_grade_replace_message() {
         $message = '
             <imsx_POXEnvelopeRequest xmlns = "http://www.imsglobal.org/lis/oms1p0/pox">
               <imsx_POXHeader>
index 2adb15e..f40d3d4 100644 (file)
@@ -35,7 +35,7 @@
     $notes   = optional_param('notes', '', PARAM_RAW);    // Save teachers notes
 
     $qids = explode(',', $qid);
-    $qids = clean_param($qids, PARAM_INT);
+    $qids = clean_param_array($qids, PARAM_INT);
     $qid = implode (',', $qids);
 
     if (! $cm = get_coursemodule_from_id('survey', $id)) {
index 448c943..6f02035 100644 (file)
@@ -121,7 +121,7 @@ function url_get_full_url($url, $cm, $course, $config=null) {
             if (stripos($fullurl, 'teamspeak://') === 0) {
                 $fullurl = $fullurl.'?'.implode('?', $parameters);
             } else {
-                $join = (strpos($fullurl->externalurl, '?') === false) ? '?' : '&';
+                $join = (strpos($fullurl, '?') === false) ? '?' : '&';
                 $fullurl = $fullurl.$join.implode('&', $parameters);
             }
         }
index 8a73529..b121f8c 100644 (file)
@@ -70,7 +70,7 @@ class mod_wiki_edit_form extends moodleform {
             foreach ($tree['files'] as $file) {
                 $filename = $file->get_filename();
                 foreach ($extensions as $ext) {
-                    if (preg_match('#'.$ext.'$#', $filename)) {
+                    if (preg_match('#'.$ext.'$#i', $filename)) {
                         $files[] = $filename;
                     }
                 }
index eb6f4d8..d49de62 100644 (file)
@@ -243,7 +243,7 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base {
     }
 
     public function supported_formats() {
-        return array(PORTFOLIO_FORMAT_FILE); // don't support rich html, it breaks links
+        return array(PORTFOLIO_FORMAT_FILE, PORTFOLIO_FORMAT_RICHHTML);
     }
 
     /*
index 2b0a380..e639d59 100644 (file)
@@ -66,7 +66,7 @@ class repository_dropbox extends repository {
             'oauth_consumer_key'=>$this->dropbox_key,
             'oauth_consumer_secret'=>$this->dropbox_secret,
             'oauth_callback' => $this->callback->out(false),
-            'api_root' => 'http://www.dropbox.com/0/oauth',
+            'api_root' => 'https://www.dropbox.com/1/oauth',
         );
 
         $this->dropbox = new dropbox($args);
@@ -96,7 +96,7 @@ class repository_dropbox extends repository {
             $ret['login'] = array($popup_btn);
             return $ret;
         } else {
-            echo '<a target="_blank" href="'.$this->flickr->auth().'">'.get_string('login', 'repository').'</a>';
+            echo '<a target="_blank" href="'.$url.'">'.get_string('login', 'repository').'</a>';
         }
     }
 
index 21adb82..c5edf11 100644 (file)
@@ -35,9 +35,9 @@ class dropbox extends oauth_helper {
     /** dropbox access type, can be dropbox or sandbox */
     private $mode = 'dropbox';
     /** dropbox api url*/
-    private $dropbox_api = 'http://api.dropbox.com/0';
+    private $dropbox_api = 'https://api.dropbox.com/1';
     /** dropbox content api url*/
-    private $dropbox_content_api = 'http://api-content.dropbox.com/0';
+    private $dropbox_content_api = 'https://api-content.dropbox.com/1';
 
     function __construct($args) {
         parent::__construct($args);
@@ -52,15 +52,6 @@ class dropbox extends oauth_helper {
         return $data;
     }
 
-    /**
-     * Get user account info
-     */
-    public function get_account_info($token, $secret) {
-        $url = $this->dropbox_api.'/account/info';
-        $content = $this->get($url, array(), $token, $secret);
-        return $content;
-    }
-
     /**
      * Download a file
      */
index 74c788e..7b7cd46 100644 (file)
@@ -324,7 +324,7 @@ function tag_print_user_box($user, $return=false) {
     $usercontext = get_context_instance(CONTEXT_USER, $user->id);
     $profilelink = '';
 
-    if ( has_capability('moodle/user:viewdetails', $usercontext) || has_coursecontact_role($user->id) ) {
+    if ($usercontext and (has_capability('moodle/user:viewdetails', $usercontext) || has_coursecontact_role($user->id))) {
         $profilelink = $CFG->wwwroot .'/user/view.php?id='. $user->id;
     }
 
index 47ef877..ca351e3 100644 (file)
@@ -130,4 +130,6 @@ $THEME->layouts = array(
 
 $THEME->enable_dock = true;
 
-$THEME->rendererfactory = 'theme_overridden_renderer_factory';
\ No newline at end of file
+$THEME->rendererfactory = 'theme_overridden_renderer_factory';
+
+$THEME->csspostprocess = 'afterburner_process_css';
\ No newline at end of file
index 48d12c4..fb5736e 100644 (file)
  * @copyright 2011
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
+$string['configtitle'] = 'Afterburner Custom Settings';
 $string['pluginname'] = 'Afterburner';
 $string['region-side-post'] = 'Right';
 $string['region-side-pre'] = 'Left';
+$string['logo'] = 'Logo';
+$string['logodesc'] = 'Please add the URL to your new logo only if you want to replace the default logo for this theme.<br />For your information, the default logo is a JPG image 320px (wide) by 75px (high)';
+$string['footnote'] = 'Footnote';
+$string['footnotedesc'] = 'Whatever you add to this textarea will be displayed in the footer of every page.';
+$string['customcss'] = 'Custom CSS';
+$string['customcssdesc'] = 'Whatever CSS rules you add to this textarea will be reflected in every page, making for easier customization of this theme.';
 $string['choosereadme'] = '
 <div class="clearfix">
  <div class="theme_screenshot">
index 8c29b7c..a6b39d0 100644 (file)
@@ -13,6 +13,8 @@ $showsidepost = ($hassidepost && !$PAGE->blocks->region_completely_docked('side-
 $custommenu = $OUTPUT->custom_menu();
 $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
 
+$hasfootnote = (!empty($PAGE->theme->settings->footnote));
+
 $bodyclasses = array();
 if ($showsidepre && !$showsidepost) {
     $bodyclasses[] = 'side-pre-only';
@@ -108,6 +110,11 @@ echo $OUTPUT->doctype() ?>
     <div id="page-footer" class="clearfix">
 
         <div class="footer-left">
+
+            <?php if ($hasfootnote) { ?>
+                    <div id="footnote"><?php echo $PAGE->theme->settings->footnote;?></div>
+            <?php } ?>
+
             <a href="http://moodle.org" title="Moodle">
                 <img src="<?php echo $OUTPUT->pix_url('footer/moodle-logo','theme')?>" alt="Moodle logo" />
             </a>
diff --git a/theme/afterburner/lib.php b/theme/afterburner/lib.php
new file mode 100644 (file)
index 0000000..11a4ec4
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+function afterburner_process_css($css, $theme) {
+
+    // Set the background image for the logo
+    if (!empty($theme->settings->logo)) {
+        $logo = $theme->settings->logo;
+    } else {
+        $logo = null;
+    }
+    $css = afterburner_set_logo($css, $logo);
+
+    // Set custom CSS
+    if (!empty($theme->settings->customcss)) {
+        $customcss = $theme->settings->customcss;
+    } else {
+        $customcss = null;
+    }
+    $css = afterburner_set_customcss($css, $customcss);
+
+    return $css;
+}
+
+function afterburner_set_logo($css, $logo) {
+    global $OUTPUT;
+    $tag = '[[setting:logo]]';
+    $replacement = $logo;
+    if (is_null($replacement)) {
+        $replacement = $OUTPUT->pix_url('images/logo','theme');
+    }
+
+    $css = str_replace($tag, $replacement, $css);
+
+    return $css;
+}
+
+function afterburner_set_customcss($css, $customcss) {
+    $tag = '[[setting:customcss]]';
+    $replacement = $customcss;
+    if (is_null($replacement)) {
+        $replacement = '';
+    }
+
+    $css = str_replace($tag, $replacement, $css);
+
+    return $css;
+}
\ No newline at end of file
diff --git a/theme/afterburner/pix/images/logo.jpg b/theme/afterburner/pix/images/logo.jpg
new file mode 100644 (file)
index 0000000..fcd2fe0
Binary files /dev/null and b/theme/afterburner/pix/images/logo.jpg differ
diff --git a/theme/afterburner/settings.php b/theme/afterburner/settings.php
new file mode 100644 (file)
index 0000000..c68a599
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($ADMIN->fulltree) {
+
+    // Logo file setting
+    $name = 'theme_afterburner/logo';
+    $title = get_string('logo','theme_afterburner');
+    $description = get_string('logodesc', 'theme_afterburner');
+    $default = '';
+    $setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_URL);
+    $settings->add($setting);
+
+    // Foot note setting
+    $name = 'theme_afterburner/footnote';
+    $title = get_string('footnote','theme_afterburner');
+    $description = get_string('footnotedesc', 'theme_afterburner');
+    $default = '';
+    $setting = new admin_setting_confightmleditor($name, $title, $description, $default);
+    $settings->add($setting);
+
+    // Custom CSS file
+    $name = 'theme_afterburner/customcss';
+    $title = get_string('customcss','theme_afterburner');
+    $description = get_string('customcssdesc', 'theme_afterburner');
+    $default = '';
+    $setting = new admin_setting_configtextarea($name, $title, $description, $default);
+    $settings->add($setting);
+
+}
\ No newline at end of file
index 6c1b5bd..d6d4855 100644 (file)
@@ -19,8 +19,8 @@ a:hover, a:active {
     text-decoration: none;
 }
 hr {
-    border-bottom:1px dotted gray;
-    border-top:0px;
+    border-bottom: 1px dotted #808080;
+    border-top: 0px;
 }
 h2.headingblock {
     border-bottom: 1px solid #ddd;
@@ -46,11 +46,11 @@ Header and Logo
     background: #fff;
 }
 #logo {
-    background: url([[pix:theme|images/light3]]) no-repeat 0 -272px;
-    width: 288px;
-    height: 58px;
+    background: url([[setting:logo]]) no-repeat 0 0;
+    width: 320px;
+    height: 75px;
     display: block;
-    margin: 20px 15px;
+    margin: 15px 10px 10px;
     float: left;
 }
 .headermenu,
@@ -72,13 +72,13 @@ Page Footer
 #page-footer {
     background: #fff url([[pix:theme|core/h2grad]]) repeat-x left top;
     height: auto;
-    clear:both;
-    float:left;
-    width:98%;
+    clear: both;
+    float: left;
+    width: 98%;
     margin: 0;
     padding: 1%;
     color: #4b4b4b;
-    border-top:1px solid #fff;
+    border-top: 1px solid #fff;
     line-height: 2em;
     font-size: 1em;
 }
@@ -97,6 +97,12 @@ Page Footer
     text-align: left;
     color: #999;
 }
+#page-footer .footer-left p {
+    margin: 0;
+    padding: 0;
+    font-size: 100%;
+    line-height: 1;
+}
 #page-footer .footer-right {
     float: right;
     text-align: right;
@@ -433,4 +439,8 @@ tab styles for ie6 & ie7
 }
 .yui-skin-sam .yui-panel-container {
     z-index: 999999!important;
-}
\ No newline at end of file
+}
+
+/* Custom CSS Settings
+-------------------------*/
+[[setting:customcss]]
\ No newline at end of file
index 4ff7ea4..d7a5626 100644 (file)
@@ -743,7 +743,8 @@ body.tag .managelink {padding: 5px;}
 .dir-rtl .mod-indent-15,
 .dir-rtl .mod-indent-huge {margin-right:300px;margin-left:0;}
 
-.dir-rtl .felement.feditor select {margin-right:18.75%;}
+.dir-rtl .felement.feditor select {margin-right:18.75%;margin-left:auto;}
+.dir-rtl .mform .fitem .felement {margin-right: 16%;margin-left:auto;}
 
 /* Resourcelib mp3 player size: only width could be changed here, height hardcoded in JS */
 .resourcecontent .resourcemediaplugin_mp3 object {height:25px; width: 600px}
@@ -821,10 +822,10 @@ sup {vertical-align: super;}
 .path-rating .ratingtable td.time {white-space:nowrap; text-align:center;}
 
 /* Fix for ordered and unordered list in course topic summary & course weekly summary */
-ul li,
+
 .course-content ul.weeks .content .summary ul li,
 .course-content ul.topics .content .summary ul li {list-style: disc outside none;}
-ol li,
+
 .course-content ul.weeks .content .summary ol li,
 .course-content ul.topics .content .summary ol li {list-style: decimal outside none;}
 
index c001976..41bcce9 100644 (file)
@@ -22,6 +22,7 @@ td.grade div.overridden {background-color: #DDDDDD;}
 
 .path-grade-edit-scale .scale_options,
 #page-admin-grade-edit-scale-index .scale_options {font-size: 0.8em;}
+.path-grade-edit-scale .generaltable {margin: 10px auto;}
 
 .gradetreebox {margin:10px auto;width:90%;}
 .gradetreebox table {font-size: 0.8em;border: 1px solid #AAA;}
index 4919d23..e290901 100644 (file)
@@ -57,6 +57,15 @@ if (!empty($CFG->forceloginforprofiles)) {
 
 $userid = $userid ? $userid : $USER->id;       // Owner of the page
 $user = $DB->get_record('user', array('id' => $userid));
+
+if ($user->deleted) {
+    $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
+    echo $OUTPUT->header();
+    echo $OUTPUT->heading(get_string('userdeleted'));
+    echo $OUTPUT->footer();
+    die;
+}
+
 $currentuser = ($user->id == $USER->id);
 $context = $usercontext = get_context_instance(CONTEXT_USER, $userid, MUST_EXIST);
 
index ce82f8e..87f3a00 100644 (file)
@@ -48,7 +48,7 @@ $currentuser = ($user->id == $USER->id);
 
 $systemcontext = get_context_instance(CONTEXT_SYSTEM);
 $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
-$usercontext   = get_context_instance(CONTEXT_USER, $user->id, MUST_EXIST);
+$usercontext   = get_context_instance(CONTEXT_USER, $user->id, IGNORE_MISSING);
 
 // Require login first
 if (isguestuser($user)) {
@@ -68,7 +68,7 @@ $PAGE->set_other_editing_capability('moodle/course:manageactivities');
 
 $isparent = false;
 
-if (!$currentuser
+if (!$currentuser and !$user->deleted
   and $DB->record_exists('role_assignments', array('userid'=>$USER->id, 'contextid'=>$usercontext->id))
   and has_capability('moodle/user:viewdetails', $usercontext)) {
     // TODO: very ugly hack - do not force "parents" to enrol into course their child is enrolled in,
@@ -109,7 +109,7 @@ if ($currentuser) {
 
     // check course level capabilities
     if (!has_capability('moodle/user:viewdetails', $coursecontext) && // normal enrolled user or mnager
-        !has_capability('moodle/user:viewdetails', $usercontext)) {   // usually parent
+        ($user->deleted or !has_capability('moodle/user:viewdetails', $usercontext))) {   // usually parent
         print_error('cannotviewprofile');
     }