~aelkner/schooltool/schooltool.gradebook_july_fixes

« back to all changes in this revision

Viewing changes to src/schooltool/gradebook/browser/gradebook_overview.js.pt

  • Committer: Alan Elkner
  • Date: 2009-07-10 22:27:33 UTC
  • Revision ID: aelkner@gmail.com-20090710222733-vfjjrrakjj6q230u
returning invalid scores are now higlighted in red, bug #391305

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        return true;
50
50
}
51
51
 
52
 
function setFirstCellFocus()
 
52
function onLoadHandler()
53
53
{
 
54
    // highlight error values
 
55
    for (a = 0; a < numactivities; a++)
 
56
    {
 
57
        activity = activities[a];
 
58
        for (s = 0; s < numstudents; s++)
 
59
        {
 
60
            name = activity + '_' + students[s];
 
61
            value = document.getElementById(name).value;
 
62
            setBackgroundColor(name, activity, value, true);
 
63
        }
 
64
    }
 
65
 
 
66
    // set focus to first cell
54
67
    if (firstCellId != '')
55
68
        document.getElementById(firstCellId).focus();
56
69
}
57
70
 
58
 
window.onload = setFirstCellFocus;
 
71
window.onload = onLoadHandler;
59
72
window.onunload = checkChanges;
60
73
 
61
74
 
169
182
    var elementCell = document.getElementById(name+'_cell');
170
183
    var value = element.value;
171
184
 
172
 
    return setBackgroundColor(name, activity, value);
 
185
    return setBackgroundColor(name, activity, value, false);
173
186
}
174
187
 
175
 
function setBackgroundColor(name, activity, value)
 
188
function setBackgroundColor(name, activity, value, errors_only)
176
189
{
177
190
    changeBackgroundColor(name+'_cell', 'default_bg');
178
191
 
185
198
    {
186
199
        for(var index in actScores)
187
200
        {
188
 
               if (index > 0 && value == actScores[index])
189
 
                   return true;
 
201
            if (index > 0 && value == actScores[index])
 
202
            {
 
203
                if (!errors_only)
 
204
                    changeBackgroundColor(name+'_cell', 'changed_bg');
 
205
                return true;
 
206
            }
190
207
        }  
191
208
        changeBackgroundColor(name+'_cell', 'error_bg');
192
209
        return false;   
204
221
            changeBackgroundColor(name+'_cell', 'error_bg');
205
222
            return false;   
206
223
        }
 
224
        if (errors_only)
 
225
            return true;
207
226
        if (intValue > max)
208
227
        {
209
228
            changeBackgroundColor(name+'_cell', 'warning_bg');
226
245
    for(j=0;j!=numstudents;j++) {
227
246
        name = activity+'_'+students[j];
228
247
        document.getElementById(name).value = fd.value;
229
 
        setBackgroundColor(name, activity, fd.value);
 
248
        setBackgroundColor(name, activity, fd.value, false);
230
249
    }
231
250
    document.getElementById('fd_'+activity).value = '';
232
251
    document.getElementById('fdbtn_'+activity).style.display = 'none';