MDL-31903 course: Fixed course highlight icon and title toggle
authorJuho Viitasalo <juho.viitasalo@uef.fi>
Tue, 6 Mar 2012 07:42:12 +0000 (09:42 +0200)
committerSam Hemelryk <sam@moodle.com>
Sun, 25 Mar 2012 22:44:16 +0000 (11:44 +1300)
lib/ajax/ajaxcourse.js
lib/ajax/ajaxlib.php
lib/ajax/section_classes.js

index 3d6e208..15f3bdb 100644 (file)
@@ -182,7 +182,6 @@ main_class.prototype.mk_button = function(tag, imgSrc, text, attributes, imgAttr
 
     image.setAttribute('src', imgSrc);
     image.setAttribute('alt', text);
-    //image.setAttribute('title', '');
     container.appendChild(image);
 
     if (attributes != null) {
@@ -199,7 +198,6 @@ main_class.prototype.mk_button = function(tag, imgSrc, text, attributes, imgAttr
             image.setAttribute(imgAttributes[c][0], imgAttributes[c][1]);
         }
     }
-    image.setAttribute('hspace', '3');
     return container;
 };
 
index 0d640e4..9148561 100644 (file)
@@ -158,6 +158,7 @@ class jsportal {
         }
         $output .= "    main.portal.icons['spacerimg']='".$OUTPUT->pix_url('spacer')."';\n";
         $output .= "    main.portal.icons['marker']='".$OUTPUT->pix_url('i/marker')."';\n";
+        $output .= "    main.portal.icons['marked']='".$OUTPUT->pix_url('i/marked')."';\n";
         $output .= "    main.portal.icons['ihide']='".$OUTPUT->pix_url('i/hide')."';\n";
         $output .= "    main.portal.icons['move_2d']='".$OUTPUT->pix_url('i/move_2d')."';\n";
         $output .= "    main.portal.icons['show']='".$OUTPUT->pix_url('t/show')."';\n";
index c787e3f..190c42e 100644 (file)
@@ -92,14 +92,15 @@ 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 = main.mk_button('div', main.portal.icons['marker'], main.getString('marker', this.sectionId),
+                [['class', 'button highlightbutton']], [['class', 'highlightimage']]);
         YAHOO.util.Event.addListener(highlightbutton, 'click', this.mk_marker, this, true);
         commandContainer.appendChild(highlightbutton);
         this.highlightButton = highlightbutton;
     }
     if (this.sectionId > 0) {
         var viewbutton = main.mk_button('div', main.portal.icons['hide'], main.getString('hidesection', this.sectionId),
-                [['title', main.portal.strings['hide'] ]]);
+                [['title', main.portal.strings['hide']],['class', 'button hidebutton']], [['class', 'hideimage']]);
         YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this,true);
         commandContainer.appendChild(viewbutton);
         this.viewButton = viewbutton;
@@ -365,9 +366,13 @@ section_class.prototype.toggle_hide = function(e,target,superficial) {
 section_class.prototype.toggle_highlight = function() {
     if (this.highlighted) {
         YAHOO.util.Dom.removeClass(this.getEl(), 'current');
+        this.highlightButton.childNodes[0].src = main.portal.icons['marker'];
+        this.highlightButton.title = main.getString('marker', this.sectionId);
         this.highlighted = false;
     } else {
         YAHOO.util.Dom.addClass(this.getEl(), 'current');
+        this.highlightButton.childNodes[0].src = main.portal.icons['marked'];
+        this.highlightButton.title = main.getString('marked', this.sectionId);
         this.highlighted = true;
     }
 };