This file is indexed.

/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/ftests/report_sheets.txt is in python-schooltool.gradebook 2.6.3-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
Report sheets
-------------

Import helper to print the gradebook:

    >>> from schooltool.gradebook.browser.ftests import printGradebook

Log in as manager:

    >>> manager = Browser('manager', 'schooltool')

Add two schoolyear:

    >>> from schooltool.app.browser.ftests import setup
    >>> setup.addSchoolYear('2011', '2011-01-01', '2011-12-31')
    >>> setup.addSchoolYear('2012', '2012-01-01', '2012-12-31')

Add two terms to the 2011 schoolyear:

    >>> setup.addTerm('Term1', '2011-01-01', '2011-06-30', '2011')
    >>> setup.addTerm('Term2', '2011-07-01', '2011-12-31', '2011')

and one term to the 2012 schoolyear:

    >>> setup.addTerm('Single Term', '2012-01-01', '2012-12-31', '2012')

Set up three courses for both years:

    >>> setup.addCourse('Soccer', '2011')
    >>> setup.addCourse('Baseball', '2011')
    >>> setup.addCourse('Swimming', '2011')

    >>> setup.addCourse('Soccer', '2012')
    >>> setup.addCourse('Baseball', '2012')
    >>> setup.addCourse('Swimming', '2012')

Set up persons:

    >>> from schooltool.basicperson.browser.ftests.setup import addPerson
    >>> addPerson('Mario', 'Tejada', 'mario', 'pwd', browser=manager)
    >>> addPerson('Camila', 'Cerna', 'camila', 'pwd', browser=manager)
    >>> addPerson('Nestor', 'Guzman', 'nestor', 'pwd', browser=manager)
    >>> addPerson('William', 'Mejia', 'william', 'pwd', browser=manager)

Set up two sections for the first term of 2011 and one for the second
term:

    >>> setup.addSection('Soccer', '2011', 'Term1',
    ...                  instructors=['William'],
    ...                  members=['Mario', 'Camila', 'Nestor'])
    >>> setup.addSection('Baseball', '2011', 'Term1',
    ...                  instructors=['William'],
    ...                  members=['Mario', 'Camila', 'Nestor'])
    >>> setup.addSection('Swimming', '2011', 'Term2',
    ...                  instructors=['William'],
    ...                  members=['Mario', 'Camila', 'Nestor'])

And one section for 2012:

    >>> setup.addSection('Soccer', '2012', 'Single Term',
    ...                  instructors=['William'],
    ...                  members=['Mario', 'Camila', 'Nestor'])

Go to the management view for report sheet templates:

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('Report Sheet Templates').click()
    >>> manager.printQuery('//h1/text()')
    Report Sheet Templates

Test the Cancel button of the New Report Sheet view:

    >>> manager.getLink('New Report Sheet').click()
    >>> manager.getControl('Cancel').click()
    >>> manager.printQuery('//h1/text()')
    Report Sheet Templates

Add four report sheet templates:

    >>> manager.getLink('New Report Sheet').click()
    >>> manager.getControl('Title').value = 'Report Sheet 1'
    >>> manager.getControl('Add').click()

    >>> manager.getLink('New Report Sheet').click()
    >>> manager.getControl('Title').value = 'Report Sheet 2'
    >>> manager.getControl('Add').click()

    >>> manager.getLink('New Report Sheet').click()
    >>> manager.getControl('Title').value = 'Report Sheet 3'
    >>> manager.getControl('Add').click()

    >>> manager.getLink('New Report Sheet').click()
    >>> manager.getControl('Title').value = 'Report Sheet 4'
    >>> manager.getControl('Add').click()

After adding a report sheet template, we get back to the management
view for report sheet templates:

    >>> manager.printQuery('//h1/text()')
    Report Sheet Templates
    >>> manager.printQuery('//form//div/a/text()')
    Report Sheet 1
    Report Sheet 2
    Report Sheet 3
    Report Sheet 4

We can change the order of the report sheets. Let's put the 'Report
Sheet 3' at the beginning of the list:

    >>> manager.getControl(name='pos.ReportWorksheet-3').displayValue = ['1']
    >>> manager.getForm().submit()

    >>> manager.printQuery('//h1/text()')
    Report Sheet Templates
    >>> manager.printQuery('//form//div/a/text()')
    Report Sheet 3
    Report Sheet 1
    Report Sheet 2
    Report Sheet 4

and we can delete them:

    >>> manager.getControl(name='delete:list').value = ['ReportWorksheet-4']
    >>> manager.getControl('Delete').click()

    >>> manager.printQuery('//h1/text()')
    Report Sheet Templates
    >>> manager.printQuery('//form//div/a/text()')
    Report Sheet 3
    Report Sheet 1
    Report Sheet 2

Now, let's add four report activities to the Report Sheet 1
template. We'll also test the Cancel button of the New Report Activity
form:

    >>> manager.getLink('Report Sheet 1').click()

    >>> manager.printQuery('//h1/text()')
    Activities of Report Sheet 1

    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Cancel').click()
    >>> manager.printQuery('//h1/text()')
    Activities of Report Sheet 1

    >>> manager.getLink('New Report Activity').click()
    >>> manager.printQuery('//h3/text()')
    Add new report activity
    >>> manager.getControl('Title').value = 'Report Activity 1.1.3'
    >>> manager.getControl('Label').value = 'RA1.1'
    >>> manager.getControl('Score System').displayValue = ['Comment']
    >>> manager.getControl('Add').click()

    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Title').value = 'Report Activity 1.2'
    >>> manager.getControl('Score System').displayValue = ['Extended Letter Grade']
    >>> manager.getControl('Add').click()

    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Title').value = 'Report Activity 1.3'
    >>> manager.getControl('Add').click()

    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Title').value = 'Report Activity 1.4'
    >>> manager.getControl('Score System').displayValue = ['100 Points']
    >>> manager.getControl('Label').value = 'RA1.4'
    >>> manager.getControl('Add').click()

    >>> manager.printQuery('//h1/text()')
    Activities of Report Sheet 1
    >>> manager.printQuery('//form/div/a/text()')
    Report Activity 1.1.3
    Report Activity 1.2
    Report Activity 1.3
    Report Activity 1.4

Report activities can be reordered in a report sheet template:

    >>> manager.getControl(name='pos.ReportActivity').displayValue = ['3']
    >>> manager.getForm().submit()
    >>> manager.printQuery('//h1/text()')
    Activities of Report Sheet 1
    >>> manager.printQuery('//form/div/a/text()')
    Report Activity 1.2
    Report Activity 1.3
    Report Activity 1.1.3
    Report Activity 1.4

They can also be edited. We'll test the Cancel button in that form
too:

    >>> manager.getLink('Report Activity 1.1.3').click()
    >>> manager.getControl('Cancel').click()
    >>> manager.getLink('Report Activity 1.1.3').click()
    >>> manager.getControl('Title').value = 'Report Activity 1.1'
    >>> manager.getControl('Apply').click()

And deleted:

    >>> manager.getControl(name='delete:list').value = ['ReportActivity-3']
    >>> manager.getControl('Delete').click()

    >>> manager.printQuery('//h1/text()')
    Activities of Report Sheet 1
    >>> manager.printQuery('//form/div/a/text()')
    Report Activity 1.2
    Report Activity 1.1
    Report Activity 1.4

Let's edit one:

    >>> manager.getLink('Report Activity 1.4').click()
    >>> manager.getControl('Title').value = 'REPORT ACTIVITY 1.3'
    >>> manager.getControl('Apply').click()

    >>> manager.printQuery('//h1/text()')
    Activities of Report Sheet 1
    >>> manager.printQuery('//form/div/a/text()')
    Report Activity 1.2
    Report Activity 1.1
    REPORT ACTIVITY 1.3

Now, let's add two activities to the Report Sheet 2 template:

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('Report Sheet Templates').click()
    >>> manager.getLink('Report Sheet 2').click()
    >>> manager.printQuery('//h1/text()')
    Activities of Report Sheet 2

    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Title').value = 'Report Activity 2-1'
    >>> manager.getControl('Add').click()

    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Title').value = 'Report Activity 2-2'
    >>> manager.getControl('Add').click()

And one activity to the Report Sheet 3 template:

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('Report Sheet Templates').click()
    >>> manager.getLink('Report Sheet 3').click()
    >>> manager.printQuery('//h1/text()')
    Activities of Report Sheet 3

    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Title').value = 'Report Activity 3_1'
    >>> manager.getControl('Label').value = 'REPACT31'
    >>> manager.getControl('Add').click()

Before deploying our report sheet templates, let's login as teacher
and visit the Soccer Term1 section. The teacher should have a default
worksheet:

    >>> teacher = Browser('william', 'pwd')
    >>> teacher.getLink('Gradebook').click()
    >>> teacher.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
    2011 / Term1
    >>> teacher.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
    Soccer - Soccer (1)
    >>> printGradebook(teacher.contents)
    +----------+
    | *Sheet1* |
    +----------+
    +---------------+-------+------+
    | Name          | Total | Ave. |
    +---------------+-------+------+
    | Camila Cerna  | 0.0   | N/A  |
    | Nestor Guzman | 0.0   | N/A  |
    | Mario Tejada  | 0.0   | N/A  |
    +---------------+-------+------+

Now, let's deploy our report sheet templates so sections can use
them. Let's deploy the first template in the 2011 schoolyear, the
second one in the first term only and the third template in the second
term of 2011:

    >>> manager.getLink('2011').click()
    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.printQuery('//h1/text()')
    Deploy Report Worksheet Template
    >>> manager.getControl('Template').displayValue = ['Report Sheet 1']
    >>> manager.getControl('Deploy').click()

    >>> manager.getLink('Term1').click()
    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.printQuery('//h1/text()')
    Deploy Report Worksheet Template
    >>> manager.getControl('Cancel').click()
    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.getControl('Template').displayValue = ['Report Sheet 2']
    >>> manager.getControl('Deploy').click()

    >>> manager.getLink('2011').click()
    >>> manager.getLink('Term2').click()
    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.printQuery('//h1/text()')
    Deploy Report Worksheet Template
    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.getControl('Template').displayValue = ['Report Sheet 3']
    >>> manager.getControl('Deploy').click()

Now that the report sheet templates have been deployed, they should be
available for sections.

Let's visit again our Soccer section for Term1 of 2011:

    >>> teacher.reload()
    >>> teacher.getLink('Gradebook').click()
    >>> teacher.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
    2011 / Term1
    >>> teacher.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
    Soccer - Soccer (1)

and we see our default Sheet1 worksheet we used before, the report
sheet deployed in the 2011 schoolyear and the report sheet deployed
for Term1:

    >>> printGradebook(teacher.contents)
    +----------+----------------+----------------+
    | *Sheet1* | Report Sheet 1 | Report Sheet 2 |
    +----------+----------------+----------------+
    +---------------+-------+------+
    | Name          | Total | Ave. |
    +---------------+-------+------+
    | Camila Cerna  | 0.0   | N/A  |
    | Nestor Guzman | 0.0   | N/A  |
    | Mario Tejada  | 0.0   | N/A  |
    +---------------+-------+------+

The 2011 report sheet, Report Sheet 1, should have three activities,
and like all deployed sheets it has no totals or average columns:

    >>> teacher.getLink('Report Sheet 1').click()
    >>> printGradebook(teacher.contents)
    +--------+------------------+----------------+
    | Sheet1 | *Report Sheet 1* | Report Sheet 2 |
    +--------+------------------+----------------+
    +---------------+-------+------+---------+-------+---------+
    | Name          | Total | Ave. | Repor   | RA1.1 | RA1.4   |
    +---------------+-------+------+---------+-------+---------+
    | Camila Cerna  | 0.0   | N/A  | [_____] |       | [_____] |
    | Nestor Guzman | 0.0   | N/A  | [_____] |       | [_____] |
    | Mario Tejada  | 0.0   | N/A  | [_____] |       | [_____] |
    +---------------+-------+------+---------+-------+---------+

Note that the 'Report Activity 1 (RA1.1)' cannot be graded directly in
the worksheet nor on it's own. That's because it uses a Comment score
system. To grade such activities, we have to use the student
gradebook. Let's grade Nestor's activities:

    >>> teacher.getLink('>', index=1).click()
    >>> teacher.printQuery("id('form')/div[1]/h3")
    <h3>Enter grades for Nestor Guzman</h3>
    >>> teacher.printQuery('id("form")//fieldset//label/span/text()')
    Report Activity 1.2 (A+)
    Report Activity 1.1
    REPORT ACTIVITY 1.3 (100)
    >>> teacher.getControl('Report Activity 1.1').value = '<p>This is the report for Nestor for:</p><p>&nbsp;</p><p><strong>Report Activity 1.1</strong></p><p>&nbsp;</p><p>His teacher.</p>'
    >>> teacher.getControl('REPORT ACTIVITY 1.3').value = '87'

and now for Camila:

    >>> teacher.getControl('Previous').click()
    >>> url = teacher.url
    >>> teacher.printQuery("id('form')/div[1]/h3")
    <h3>Enter grades for Camila Cerna</h3>
    >>> teacher.printQuery('id("form")//fieldset//label/span/text()')
    Report Activity 1.2 (A+)
    Report Activity 1.1
    REPORT ACTIVITY 1.3 (100)
    >>> teacher.getControl('Report Activity 1.2').value = 'A-'
    >>> teacher.getControl('Report Activity 1.1').value = '<p>This is the report for Camila for:</p><p>&nbsp;</p><p><strong>Report Activity 1.1</strong></p><p>&nbsp;</p><p>Her teacher.</p>'
    >>> teacher.getControl('REPORT ACTIVITY 1.3').value = '78'
    >>> teacher.getControl('Apply').click()

We get back to the 'Report Sheet 1' sheet:

    >>> printGradebook(teacher.contents)
    +--------+------------------+----------------+
    | Sheet1 | *Report Sheet 1* | Report Sheet 2 |
    +--------+------------------+----------------+
    +---------------+-------+-------+---------+-------+---------+
    | Name          | Total | Ave.  | Repor   | RA1.1 | RA1.4   |
    +---------------+-------+-------+---------+-------+---------+
    | Camila Cerna  | 81.7  | 78.6% | [A-___] | ...   | [78___] |
    | Nestor Guzman | 87.0  | 87.0% | [_____] | ...   | [87___] |
    | Mario Tejada  | 0.0   | N/A   | [_____] |       | [_____] |
    +---------------+-------+-------+---------+-------+---------+

Let's check the Report Sheet 2 sheet:

    >>> teacher.getLink('Report Sheet 2').click()
    >>> printGradebook(teacher.contents)
    +--------+----------------+------------------+
    | Sheet1 | Report Sheet 1 | *Report Sheet 2* |
    +--------+----------------+------------------+
    +---------------+-------+------+---------+---------+
    | Name          | Total | Ave. | Repor   | Repor   |
    +---------------+-------+------+---------+---------+
    | Camila Cerna  | 0.0   | N/A  | [_____] | [_____] |
    | Nestor Guzman | 0.0   | N/A  | [_____] | [_____] |
    | Mario Tejada  | 0.0   | N/A  | [_____] | [_____] |
    +---------------+-------+------+---------+---------+

Now, if we go to the other section in this term, we should see these
same report sheets and activities deployed:

    >>> teacher.getControl(name='currentSection').displayValue = ['Baseball - Baseball (2)']
    >>> teacher.getForm().submit()

    >>> teacher.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
    2011 / Term1
    >>> teacher.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
    Baseball - Baseball (2)

    >>> teacher.getLink('Report Sheet 1').click()
    >>> printGradebook(teacher.contents)
    +------------------+----------------+--------+
    | *Report Sheet 1* | Report Sheet 2 | Sheet1 |
    +------------------+----------------+--------+
    +---------------+-------+------+---------+-------+---------+
    | Name          | Total | Ave. | Repor   | RA1.1 | RA1.4   |
    +---------------+-------+------+---------+-------+---------+
    | Camila Cerna  | 0.0   | N/A  | [_____] |       | [_____] |
    | Nestor Guzman | 0.0   | N/A  | [_____] |       | [_____] |
    | Mario Tejada  | 0.0   | N/A  | [_____] |       | [_____] |
    +---------------+-------+------+---------+-------+---------+

    >>> teacher.getLink('Report Sheet 2').click()
    >>> printGradebook(teacher.contents)
    +----------------+------------------+--------+
    | Report Sheet 1 | *Report Sheet 2* | Sheet1 |
    +----------------+------------------+--------+
    +---------------+-------+------+---------+---------+
    | Name          | Total | Ave. | Repor   | Repor   |
    +---------------+-------+------+---------+---------+
    | Camila Cerna  | 0.0   | N/A  | [_____] | [_____] |
    | Nestor Guzman | 0.0   | N/A  | [_____] | [_____] |
    | Mario Tejada  | 0.0   | N/A  | [_____] | [_____] |
    +---------------+-------+------+---------+---------+

And if we go to the other term, Term2, in this schoolyear, we'll see
that the 'Report Sheet 1' sheet is common for both terms and we'll see
the other 'Report Sheet 3' deployed only for that term:

    >>> teacher.getControl(name='currentTerm').displayValue = ['2011 / Term2']
    >>> teacher.getForm().submit()

    >>> teacher.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
    2011 / Term2
    >>> teacher.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
    Swimming - Swimming (1)

    >>> teacher.getLink('Report Sheet 1').click()
    >>> printGradebook(teacher.contents)
    +------------------+----------------+--------+
    | *Report Sheet 1* | Report Sheet 3 | Sheet1 |
    +------------------+----------------+--------+
    +---------------+-------+------+---------+-------+---------+
    | Name          | Total | Ave. | Repor   | RA1.1 | RA1.4   |
    +---------------+-------+------+---------+-------+---------+
    | Camila Cerna  | 0.0   | N/A  | [_____] |       | [_____] |
    | Nestor Guzman | 0.0   | N/A  | [_____] |       | [_____] |
    | Mario Tejada  | 0.0   | N/A  | [_____] |       | [_____] |
    +---------------+-------+------+---------+-------+---------+

    >>> teacher.getLink('Report Sheet 3').click()
    >>> printGradebook(teacher.contents)
    +----------------+------------------+--------+
    | Report Sheet 1 | *Report Sheet 3* | Sheet1 |
    +----------------+------------------+--------+
    +---------------+-------+------+---------+
    | Name          | Total | Ave. | REPAC   |
    +---------------+-------+------+---------+
    | Camila Cerna  | 0.0   | N/A  | [_____] |
    | Nestor Guzman | 0.0   | N/A  | [_____] |
    | Mario Tejada  | 0.0   | N/A  | [_____] |
    +---------------+-------+------+---------+

And now, if we go to the section in the 2012 schoolyear, we won't see
any common report sheet deployed, just the default worksheet:

    >>> teacher.getControl(name='currentTerm').displayValue = ['2012 / Single Term']
    >>> teacher.getForm().submit()

    >>> teacher.getLink('Gradebook').click()
    >>> teacher.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
    2012 / Single Term
    >>> teacher.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
    Soccer - Soccer (1)

    >>> printGradebook(teacher.contents)
    +----------+
    | *Sheet1* |
    +----------+
    +---------------+-------+------+
    | Name          | Total | Ave. |
    +---------------+-------+------+
    | Camila Cerna  | 0.0   | N/A  |
    | Nestor Guzman | 0.0   | N/A  |
    | Mario Tejada  | 0.0   | N/A  |
    +---------------+-------+------+

Now, let's visit the unreachable 'view.html' view for Camila's Report Sheet 1 grades:

    >>> teacher.open(url + '/view.html')
    >>> teacher.printQuery('//h1/text()')
    Report Sheet 1 for Camila Cerna in Soccer - Soccer (1)
    >>> teacher.printQuery('//div[@class="info-block"]')
    <div class="info-block">
      <h3>Report Activity 1.2</h3>
      <p>A-</p>
    </div>
    <div class="info-block">
      <h3>Report Activity 1.1</h3>
      <p>This is the report for Camila for:</p>
      <p> </p>
      <p><strong>Report Activity 1.1</strong></p>
      <p> </p>
      <p>Her teacher.</p>
    </div>
    <div class="info-block">
      <h3>REPORT ACTIVITY 1.3</h3>
      <p>78</p>
    </div>

Now, let's log in as a student and check the mygrades view:

    >>> student = Browser('camila', 'pwd')
    >>> student.getLink('Gradebook').click()

We get to the first section of the 2011 / Term1 term:

    >>> student.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
    2011 / Term1
    >>> student.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
    Soccer - Soccer (1)

and we see the three worksheets, the first one with no grades:

    >>> student.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
    <td class="active_tab">
      <span style="font-weight: bold;">Sheet1</span>
    </td>
    <td class="active_tab">
      <a href="http://localhost/schoolyears/2011/term1/sections/1/activities/2011_term1/mygrades">Report Sheet 1</a>
    </td>
    <td class="active_tab">
      <a href="http://localhost/schoolyears/2011/term1/sections/1/activities/2011_term1-2/mygrades">Report Sheet 2</a>
    </td>

    >>> student.printQuery('//table[@class="student_gradebook"]/tr[1]/td')
    <td colspan="2" class="odd student_cell">
      <div>Nothing Graded</div>
    </td>
    >>> student.printQuery('//table[@class="student_gradebook"]/tr[position()>1]/*[1]/div/text()')
    Activity
    >>> student.printQuery('//table[@class="student_gradebook"]/tr[position()>1]/*[2]/div/text()')
    Grade

the second with three graded report activities:

    >>> student.getLink('Report Sheet 1').click()

    >>> student.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
    <td class="active_tab">
      <a href="http://localhost/schoolyears/2011/term1/sections/1/activities/Worksheet/mygrades">Sheet1</a>
    </td>
    <td class="active_tab">
      <span style="font-weight: bold;">Report Sheet 1</span>
    </td>
    <td class="active_tab">
      <a href="http://localhost/schoolyears/2011/term1/sections/1/activities/2011_term1-2/mygrades">Report Sheet 2</a>
    </td>
    
    >>> student.printQuery('//table[@class="student_gradebook"]/tr/*[1]/div/text()')
    Ave.: 78.6%
    Activity
    Report Activity 1.2
    Report Activity 1.1
    REPORT ACTIVITY 1.3
    >>> student.printQuery('//table[@class="student_gradebook"]/tr/*[2]')
    <th class="cell student_header">
      <div>Grade</div>
    </th>
    <td class="odd student_cell">
      <div>3.7 / A+</div>
    </td>
    <td class="even student_cell">
      <p>This is the report for Camila for:</p>
      <p> </p>
      <p><strong>Report Activity 1.1</strong></p>
      <p> </p>
      <p>Her teacher.</p>
    </td>
    <td class="odd student_cell">
      <div>78 / 100</div>
    </td>

and the third with two report activities with no grades:

    >>> student.getLink('Report Sheet 2').click()

    >>> student.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
    <td class="active_tab">
      <a href="http://localhost/schoolyears/2011/term1/sections/1/activities/Worksheet/mygrades">Sheet1</a>
    </td>
    <td class="active_tab">
      <a href="http://localhost/schoolyears/2011/term1/sections/1/activities/2011_term1/mygrades">Report Sheet 1</a>
    </td>
    <td class="active_tab">
      <span style="font-weight: bold;">Report Sheet 2</span>
    </td>

    >>> student.printQuery('//table[@class="student_gradebook"]/tr/*[1]/div/text()')
    Nothing Graded
    Activity
    Report Activity 2-1
    Report Activity 2-2
    >>> student.printQuery('//table[@class="student_gradebook"]/tr/*[2]/div/text()')
    Grade

Note that the last two worksheets have no average.

Let's check the report sheets for the other graded student:

    >>> other_student = Browser('nestor', 'pwd')
    >>> other_student.getLink('Gradebook').click()
    >>> other_student.getLink('Report Sheet 1').click()

    >>> other_student.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
    <td class="active_tab">
      <a href="http://localhost/schoolyears/2011/term1/sections/1/activities/Worksheet/mygrades">Sheet1</a>
    </td>
    <td class="active_tab">
      <span style="font-weight: bold;">Report Sheet 1</span>
    </td>
    <td class="active_tab">
      <a href="http://localhost/schoolyears/2011/term1/sections/1/activities/2011_term1-2/mygrades">Report Sheet 2</a>
    </td>
    
    >>> other_student.printQuery('//table[@class="student_gradebook"]/tr/*[1]/div/text()')
    Ave.: 87.0%
    Activity
    Report Activity 1.2
    Report Activity 1.1
    REPORT ACTIVITY 1.3
    >>> other_student.printQuery('//table[@class="student_gradebook"]/tr/*[2]')
    <th class="cell student_header">
      <div>Grade</div>
    </th>
    <td class="odd student_cell">
      <div></div>
    </td>
    <td class="even student_cell">
      <p>This is the report for Nestor for:</p>
      <p> </p>
      <p><strong>Report Activity 1.1</strong></p>
      <p> </p>
      <p>His teacher.</p>
    </td>
    <td class="odd student_cell">
      <div>87 / 100</div>
    </td>


Hiding deployed report sheets
-----------------------------

We allow the manager to hide deployed report sheets.  We only support this
for a term because some combinations of term and full year deployments would
leave it confusing have the user hide deployed report sheets by year

    >>> manager.getLink('2011').click()
    >>> manager.getLink('Term1').click()
    >>> manager.getLink('Hide Report Sheet').click()

We see the title and select field with the two report sheets deployed in
Term1.

    >>> manager.printQuery('//h1/text()')
    Hide Deployed Report Sheet
    >>> manager.printQuery('//select[@name="reportWorksheet"]/option')
    <option value="2011_term1">Report Sheet 1</option>
    <option value="2011_term1-2">Report Sheet 2</option>

If the user hits cancel, they are returned to the term view.

    >>> manager.getControl('Cancel').click()
    >>> manager.url
    'http://localhost/schoolyears/2011/term1'

If they go again and hit Hide, a confirmation view comes up.

    >>> manager.getLink('Hide Report Sheet').click()
    >>> manager.getControl(name='reportWorksheet').displayValue = ['Report Sheet 2']
    >>> manager.getControl('Hide').click()
    >>> manager.printQuery('//form/p/text()')
    Are you sure you want to hide the report sheet, 'Report Sheet 2' in every
    section of term, 'Term1'?  If so, hit the 'Hide' button again to confirm.

If the user hits cancel, they are returned to the term view.

    >>> manager.getControl('Cancel').click()
    >>> manager.url
    'http://localhost/schoolyears/2011/term1'

This time, the user will conform the action by hitting Hide a second time.

    >>> manager.getLink('Hide Report Sheet').click()
    >>> manager.getControl(name='reportWorksheet').displayValue = ['Report Sheet 2']
    >>> manager.getControl('Hide').click()
    >>> manager.getControl('Hide').click()

Now, returning the hide view, we see that only Report Sheet 1 is available
for hiding.

    >>> manager.getLink('Hide Report Sheet').click()
    >>> manager.printQuery('//select[@name="reportWorksheet"]/option')
    <option value="2011_term1">Report Sheet 1</option>

To confirm that the report sheet was hidden, we'll have the teacher view
their gradebook for one of the sections in Term1.

    >>> teacher.getLink('Gradebook').click()
    >>> teacher.getControl(name='currentTerm').displayValue = ['2011 / Term1']
    >>> teacher.getForm().submit()
    >>> printGradebook(teacher.contents)
    +----------+----------------+
    | *Sheet1* | Report Sheet 1 |
    +----------+----------------+
    +---------------+-------+------+
    | Name          | Total | Ave. |
    +---------------+-------+------+
    | Camila Cerna  | 0.0   | N/A  |
    | Nestor Guzman | 0.0   | N/A  |
    | Mario Tejada  | 0.0   | N/A  |
    +---------------+-------+------+

We can also unhide report sheets that we have hidden.  We see that the one
we just hid is available for unhiding.

    >>> manager.getLink('Unhide Report Sheet').click()
    >>> manager.printQuery('//h1/text()')
    Unhide Deployed Report Sheet
    >>> manager.printQuery('//select[@name="reportWorksheet"]/option')
    <option value="2011_term1-2">Report Sheet 2</option>

If the user hits cancel, they are returned to the term view.

    >>> manager.getControl('Cancel').click()
    >>> manager.url
    'http://localhost/schoolyears/2011/term1'

If they go again and hit Unhide, a confirmation view comes up.

    >>> manager.getLink('Unhide Report Sheet').click()
    >>> manager.getControl(name='reportWorksheet').displayValue = ['Report Sheet 2']
    >>> manager.getControl('Unhide').click()
    >>> manager.printQuery('//form/p/text()')
    Are you sure you want to unhide the report sheet, 'Report Sheet 2' in every
    section of term, 'Term1'?  If so, hit the 'Unhide' button again to confirm.

If the user hits cancel, they are returned to the term view.

    >>> manager.getControl('Cancel').click()
    >>> manager.url
    'http://localhost/schoolyears/2011/term1'

This time, the user will conform the action by hitting Unhide a second time.

    >>> manager.getLink('Unhide Report Sheet').click()
    >>> manager.getControl(name='reportWorksheet').displayValue = ['Report Sheet 2']
    >>> manager.getControl('Unhide').click()
    >>> manager.getControl('Unhide').click()

Now we see that both report sheets are available again for hiding.

    >>> manager.getLink('Hide Report Sheet').click()
    >>> manager.printQuery('//select[@name="reportWorksheet"]/option')
    <option value="2011_term1">Report Sheet 1</option>
    <option value="2011_term1-2">Report Sheet 2</option>

The teacher can see Report Sheet 2 again.  We'll click on the tab to make
sure it's still ok.

    >>> teacher.reload()
    >>> teacher.getLink('Report Sheet 2').click()
    >>> printGradebook(teacher.contents)
    +--------+----------------+------------------+
    | Sheet1 | Report Sheet 1 | *Report Sheet 2* |
    +--------+----------------+------------------+
    +---------------+-------+------+---------+---------+
    | Name          | Total | Ave. | Repor   | Repor   |
    +---------------+-------+------+---------+---------+
    | Camila Cerna  | 0.0   | N/A  | [_____] | [_____] |
    | Nestor Guzman | 0.0   | N/A  | [_____] | [_____] |
    | Mario Tejada  | 0.0   | N/A  | [_____] | [_____] |
    +---------------+-------+------+---------+---------+

Finally, we need the hide and unhide views to handle the case where there
are no report sheets to hide or unhide.  Presently there are no report sheets
in Term1 to unhide.

    >>> manager.getLink('Unhide Report Sheet').click()
    >>> manager.printQuery('//form/p/text()')
    There are no hidden deployed report sheets to unhide.

We also see that there is only the Cancel button to click which still takes
the user back to the term view.

    >>> manager.printQuery('//input[@type="submit"]')
    <input type="submit" class="button-cancel" name="CANCEL" value="Cancel" />
    >>> manager.getControl('Cancel').click()
    >>> manager.url
    'http://localhost/schoolyears/2011/term1'

If we go ahead and hide both report sheets again, we'll see the same is
true for the hide view.

    >>> manager.getLink('Hide Report Sheet').click()
    >>> manager.getControl('Hide').click()
    >>> manager.getControl('Hide').click()
    >>> manager.getLink('Hide Report Sheet').click()
    >>> manager.getControl('Hide').click()
    >>> manager.getControl('Hide').click()

    >>> manager.getLink('Hide Report Sheet').click()
    >>> manager.printQuery('//form/p/text()')
    There are no deployed report sheets to hide.
    >>> manager.printQuery('//input[@type="submit"]')
    <input type="submit" class="button-cancel" name="CANCEL" value="Cancel" />
    >>> manager.getControl('Cancel').click()
    >>> manager.url
    'http://localhost/schoolyears/2011/term1'