]> git.mjollnir.org Git - moodle.git/commitdiff
merged, adding vertical and horizontal highlight
authortoyomoyo <toyomoyo>
Tue, 13 Nov 2007 06:55:37 +0000 (06:55 +0000)
committertoyomoyo <toyomoyo>
Tue, 13 Nov 2007 06:55:37 +0000 (06:55 +0000)
grade/report/grader/functions.js
grade/report/grader/lib.php
grade/report/grader/styles.php

index 4c37491f7564bd4257a1668eef1578e2cd4a31de..a879cd91a4c32155d048348c5f2dbe02608c7cb5 100755 (executable)
@@ -1,21 +1,28 @@
-/**
- * enables highlight of rows in user grade tables
- *
- */
-function markRowsInit() {
-    // for every table row ...
-    var rows = document.getElementById('user-grades').getElementsByTagName('tr');
-    for ( var i = 0; i < rows.length; i++ ) {
-        // ... with the class 'odd' or 'even' ...
-        // ... and to mark the row on click ...
-        rows[i].onmousedown = function() {
-            
-            if (this.className.search(/marked/) != -1) {
-                this.className = this.className.replace(' marked', '');   
+/** highlight/unset the row of a table **/
+function set_row(idx) {
+    var table = document.getElementById('user-grades');
+    var rowsize = table.rows[idx].cells.length;
+    for (var i = 1; i < rowsize; i++) {
+        if (table.rows[idx].cells[i]) {
+            if (table.rows[idx].cells[i].className.search(/hmarked/) != -1) {
+                table.rows[idx].cells[i].className = table.rows[idx].cells[i].className.replace(' hmarked', '');
             } else {
-                this.className += ' marked';
+                table.rows[idx].cells[i].className += ' hmarked';
             }
         }
     }
 }
-window.onload=markRowsInit;
\ No newline at end of file
+
+/** highlight/unset the column of a table **/
+function set_col(idx) {
+    var table = document.getElementById('user-grades');
+    for (var i = 1; i < table.rows.length; i++) {
+        if (table.rows[i].cells[idx]) {
+            if (table.rows[i].cells[idx].className.search(/vmarked/) != -1) {
+                table.rows[i].cells[idx].className = table.rows[i].cells[idx].className.replace(' vmarked', '');
+            } else {
+                table.rows[i].cells[idx].className += ' vmarked';
+            }
+        }
+    }
+}
\ No newline at end of file
index a7d91235da7e07b7615febc07a9cf5be9c976c77..76cfa07df1640a011161a491d900bdafdccaf9e0 100644 (file)
@@ -587,7 +587,7 @@ class grade_report_grader extends grade_report {
                     }
 
                     $headerlink = $this->gtree->get_element_header($element, true, $this->get_pref('showactivityicons'), false);
-                    $headerhtml .= '<th class="header '.$columnclass.' '.$type.$catlevel.$hidden.'" scope="col">'. $headerlink . $arrow;
+                    $headerhtml .= '<th class="header '.$columnclass.' '.$type.$catlevel.$hidden.'" scope="col" onclick="set_col(this.cellIndex)">'. $headerlink . $arrow;
                     $headerhtml .= $this->get_icons($element) . '</th>';
                 }
 
@@ -651,7 +651,7 @@ class grade_report_grader extends grade_report {
                 $user_pic = '<div class="userpic">' . print_user_picture($user->id, $this->courseid, true, 0, true) . '</div>';
             }
 
-            $studentshtml .= '<tr class="r'.$this->rowcount++.'"><th class="header c'.$columncount++.' user" scope="row">'.$user_pic
+            $studentshtml .= '<tr class="r'.$this->rowcount++.'"><th class="header c'.$columncount++.' user" scope="row" onclick="set_row(this.parentNode.rowIndex);">'.$user_pic
                           .'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->course->id.'">'
                           .fullname($user).'</a></th>';
 
index 35201d8cb924df30667d7e15af581de885a990ed..24b75b3858574257f1d17593f611a22e85768b5a 100644 (file)
@@ -10,8 +10,16 @@ white-space:normal;
   whitespace: nowrap;
 }
 
-.grade-report-grader table#user-grades tr.marked td.cell {
-    background-color: #FFCC99 ;
+.grade-report-grader table#user-grades td.vmarked {
+    background-color: #ffcc33;
+}
+
+.grade-report-grader table#user-grades td.hmarked {
+    background-color: #ffff99;
+}
+
+.grade-report-grader table#user-grades td.hmarked.vmarked{
+    background-color: #ffcc99;
 }
 
 .grade-report-grader table#user-grades .catlevel1 {