This file is indexed.

/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/stests/comment_cell_modal.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
Special modal for gradebook comment cells
-----------------------------------------

If an activity is for the comment score system, there is no way to edit its
contents from within the gradebook spreadsheet.  Until now, we required the
user to grade the student, and then they could get to the ckeditor widget for
the cell in question.  Now, we provide a special modal that pops up when the
user clicks on a cell for a comment activity.

Log in as manager:

    >>> manager = browsers.manager
    >>> manager.ui.login('manager', 'schooltool')

Now, set up a school year (2005-2006) with a single term (Year):

    >>> manager.ui.schoolyear.add('2005-2006', '2005-09-01', '2006-07-15')
    >>> manager.ui.term.add('2005-2006', 'Year', '2005-09-01', '2006-07-15')

Set up one course:

    >>> manager.ui.course.add('2005-2006', 'Math I')

Set up persons:

    >>> manager.ui.person.add('Paul', 'Carduner', 'paul', 'pwd')
    >>> manager.ui.person.add('Tom', 'Hoffman', 'tom', 'pwd')
    >>> manager.ui.person.add('Stephan', 'Richter', 'stephan', 'pwd')

Set up one section with instructor and students:

    >>> manager.ui.section.add('2005-2006', 'Year', 'Math I')
    >>> manager.ui.section.instructors.add('2005-2006', 'Year', 'Math I (1)',
    ...                                    ['stephan'])
    >>> manager.ui.section.students.add('2005-2006', 'Year', 'Math I (1)',
    ...                                 ['paul', 'tom'])

Set up and deploy a report sheet with two comment activities:

    >>> manager.query.link('School').click()
    >>> manager.query.link('Report Sheet Templates').click()
    >>> manager.query.link('Report Sheet Template').click()
    >>> manager.query.id('form-widgets-title').ui.set_value('Comments')
    >>> manager.query.id('form-buttons-add').click()
    >>> manager.query.link('Report Activity').click()
    >>> manager.query.id('form-widgets-title').ui.set_value('CM1')
    >>> manager.query.id('form-widgets-scoresystem').ui.set_value('Comment')
    >>> manager.query.id('form-buttons-add').click()
    >>> manager.query.link('Report Activity').click()
    >>> manager.query.id('form-widgets-title').ui.set_value('CM2')
    >>> manager.query.id('form-widgets-description').ui.set_value('Comment 2')
    >>> manager.query.id('form-widgets-scoresystem').ui.set_value('Comment')
    >>> manager.query.id('form-buttons-add').click()

    >>> manager.query.link('School').click()
    >>> manager.query.link('Deployed Report Sheets').click()
    >>> manager.query.id('template').ui.set_value('Comments')
    >>> manager.query.name('SUBMIT').click()

Log in as teacher and go to his gradebook for the Comments sheet:

    >>> stephan = browsers.stephan
    >>> stephan.ui.login('stephan', 'pwd')
    >>> stephan.query.link('Gradebook').click()
    >>> stephan.query.link('Comments').click()

We see that there are four cells to grade, two activities for the two students,
but in this case, they have the special comment-cell class and hidden_value
attribute.  All hidden values are blank because we haven't entered scores yet.

    >>> cells = stephan.query_all.css('.comment-cell')
    >>> print cells
    <td class="comment-cell" hidden_value="">
    </td>
    <td class="comment-cell" hidden_value="">
    </td>
    <td class="comment-cell" hidden_value="">
    </td>
    <td class="comment-cell" hidden_value="">
    </td>

We'll visit the first comment cell.  We see the student name and the activity
title are there.  We didn't give the first activity a description, so the
hint is blank.

    >>> cells[0].click()
    >>> print stephan.query.css('#comment-cell-dialog-title').text
    Paul Carduner
    >>> print stephan.query.css('#comment-cell-dialog-container .viewspace label span').text
    CM1
    >>> stephan.query.css('#comment-cell-dialog-container .viewspace p.hint').text
    u''

The cancel button gets out of the modal.

    >>> stephan.query.css('.comment-cell-cancel').click()

We'll note the contents of the modal for each of the other three cells.

    >>> cells[1].click()
    >>> print stephan.query.css('#comment-cell-dialog-title').text
    Paul Carduner
    >>> print stephan.query.css('#comment-cell-dialog-container .viewspace label span').text
    CM2
    >>> print stephan.query.css('#comment-cell-dialog-container .viewspace p.hint').text
    Comment 2
    >>> stephan.query.css('.comment-cell-cancel').click()

    >>> cells[2].click()
    >>> print stephan.query.css('#comment-cell-dialog-title').text
    Tom Hoffman
    >>> print stephan.query.css('#comment-cell-dialog-container .viewspace label span').text
    CM1
    >>> stephan.query.css('#comment-cell-dialog-container .viewspace p.hint').text
    u''
    >>> stephan.query.css('.comment-cell-cancel').click()

    >>> cells[3].click()
    >>> print stephan.query.css('#comment-cell-dialog-title').text
    Tom Hoffman
    >>> print stephan.query.css('#comment-cell-dialog-container .viewspace label span').text
    CM2
    >>> print stephan.query.css('#comment-cell-dialog-container .viewspace p.hint').text
    Comment 2

For the fouth cell, we'll go through the trouble of entering data and hitting
the submit button.

XXX these tests should work, and the clicking does give focus to the editor
element, but the set_value doesn't work.  For now, the submit does at least
return to the gradebook.

    >>> editor = stephan.query.id('form-widgets-value___Frame')
    >>> editor.click()
    >>> editor.ui.set_value('123')
    >>> stephan.query.css('.comment-cell-submit').click()
    >>> stephan.url
    u'http://localhost/schoolyears/2005-2006/year/sections/1/activities/2005-2006_year_1/gradebook'