MDL-31903 course: Highlight icon will get iniatlised properly
authorRajesh Taneja <rajesh@moodle.com>
Fri, 16 Mar 2012 06:54:21 +0000 (14:54 +0800)
committerSam Hemelryk <sam@moodle.com>
Sun, 25 Mar 2012 22:44:50 +0000 (11:44 +1300)
lib/ajax/section_classes.js

index 2f64ac3..4140f09 100644 (file)
@@ -92,7 +92,13 @@ section_class.prototype.init_buttons = function() {
     }
 
     if (main.getString('courseformat', this.sectionId) != "weeks" && this.sectionId > 0) {
-        var highlightbutton = main.mk_button('div', main.portal.icons['marker'], main.getString('marker', this.sectionId));
+        var highlightbutton = '';
+        //If current topic, then initalised as marked else marker
+        if (YAHOO.util.Dom.hasClass(this.getEl(),'current')) {
+            highlightbutton = main.mk_button('div', main.portal.icons['marked'], main.getString('marked', this.sectionId));
+        } else {
+            highlightbutton = main.mk_button('div', main.portal.icons['marker'], main.getString('marker', this.sectionId));
+        }
         YAHOO.util.Event.addListener(highlightbutton, 'click', this.mk_marker, this, true);
         commandContainer.appendChild(highlightbutton);
         this.highlightButton = highlightbutton;