MDL-35073 Badges - Set of minor fixes for issues found during integration
authorDamyon Wiese <damyon@moodle.com>
Tue, 2 Apr 2013 07:40:15 +0000 (15:40 +0800)
committerDamyon Wiese <damyon@moodle.com>
Tue, 2 Apr 2013 07:55:21 +0000 (15:55 +0800)
admin/settings/badges.php
badges/action.php
badges/index.php
lang/en/badges.php
lib/navigationlib.php
lib/pluginlib.php
pix/i/expired.svg
pix/t/backpack.svg

index cda847d..7e6f41e 100644 (file)
@@ -26,7 +26,6 @@
 */
 
 global $SITE;
-require_once($CFG->libdir . '/badgeslib.php');
 
 if (!empty($CFG->enablebadges) && ($hassiteconfig || has_any_capability(array(
             'moodle/badges:viewawarded',
@@ -37,6 +36,8 @@ if (!empty($CFG->enablebadges) && ($hassiteconfig || has_any_capability(array(
             'moodle/badges:configuredetails',
             'moodle/badges:deletebadge'), $systemcontext))) {
 
+    require_once($CFG->libdir . '/badgeslib.php');
+
     $globalsettings = new admin_settingpage('badgesettings', new lang_string('badgesettings', 'badges'),
             array('moodle/badges:manageglobalsettings'));
 
index f32e05b..33181a5 100644 (file)
@@ -91,6 +91,7 @@ if ($delete) {
 }
 
 if ($copy) {
+    require_sesskey();
     require_capability('moodle/badges:createbadge', $context);
 
     $cloneid = $badge->make_clone();
index d7f40b4..64d6fe8 100644 (file)
@@ -124,6 +124,7 @@ if ($activate && has_capability('moodle/badges:configuredetails', $PAGE->context
             $badge->set_status(BADGE_STATUS_ACTIVE_LOCKED);
             $msg = get_string('activatesuccess', 'badges');
         } else {
+            require_sesskey();
             $badge->set_status(BADGE_STATUS_ACTIVE);
             $msg = get_string('activatesuccess', 'badges');
         }
@@ -136,6 +137,7 @@ if ($activate && has_capability('moodle/badges:configuredetails', $PAGE->context
         $badge->set_status(BADGE_STATUS_INACTIVE_LOCKED);
         $msg = get_string('deactivatesuccess', 'badges');
     } else {
+        require_sesskey();
         $badge->set_status(BADGE_STATUS_INACTIVE);
         $msg = get_string('deactivatesuccess', 'badges');
     }
index 82be867..d8ea421 100644 (file)
@@ -49,7 +49,7 @@ $string['allowcoursebadges_desc'] = 'Allow badges to be created and awarded in c
 $string['allowexternalbackpack'] = 'Enable connection to external backpacks';
 $string['allowexternalbackpack_desc'] = 'Allow users to set up connections and display badges from their external backpack providers.
 
-Note: It is recommended to leave this option disabled if the web site cannot be accesed from the internet (e.g. because of the firewall).';
+Note: It is recommended to leave this option disabled if the web site cannot be accessed from the internet (e.g. because of the firewall).';
 $string['any'] = 'Any';
 $string['anymethod'] = 'Any of the selected conditions is met';
 $string['anymethodactivity'] = 'Any of the selected activities is complete';
index ad9943f..61331f0 100644 (file)
@@ -2182,7 +2182,7 @@ class global_navigation extends navigation_node {
             $usernode->add(get_string('myfiles'), $url, self::TYPE_SETTING);
         }
 
-        if ($CFG->enablebadges && $iscurrentuser &&
+        if (!empty($CFG->enablebadges) && $iscurrentuser &&
                 has_capability('moodle/badges:manageownbadges', context_user::instance($USER->id))) {
             $url = new moodle_url('/badges/mybadges.php');
             $usernode->add(get_string('mybadges', 'badges'), $url, self::TYPE_SETTING);
@@ -2511,7 +2511,7 @@ class global_navigation extends navigation_node {
         }
 
         //Badges
-        if ($CFG->enablebadges && has_capability('moodle/badges:viewbadges', $this->page->context)) {
+        if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {
             $url = new moodle_url($CFG->wwwroot . '/badges/view.php', array('type' => 1));
             $coursenode->add(get_string('sitebadges', 'badges'), $url, navigation_node::TYPE_CUSTOM);
         }
index f5fba43..f3d4087 100644 (file)
@@ -408,7 +408,7 @@ class plugin_manager {
             ),
 
             'block' => array(
-                'activity_modules', 'admin_bookmarks', 'blog_menu',
+                'activity_modules', 'admin_bookmarks', 'badges', 'blog_menu',
                 'blog_recent', 'blog_tags', 'calendar_month',
                 'calendar_upcoming', 'comments', 'community',
                 'completionstatus', 'course_list', 'course_overview',
index 81de106..b4e103b 100644 (file)
@@ -1,4 +1,4 @@
-<svg width="150" height="150" xmlns="http://www.w3.org/2000/svg">
+<svg width="150" height="150" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMid meet">
  <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
  <g>
   <title>Layer 1</title>
index e5b37e6..8ef038b 100644 (file)
@@ -14,7 +14,7 @@
    id="svg3063"
    version="1.1"
    inkscape:version="0.48.3.1 r9886"
-   sodipodi:docname="backpack.svg">
+   sodipodi:docname="backpack.svg" preserveAspectRatio="xMinYMid meet">
   <defs
      id="defs3065" />
   <sodipodi:namedview