This file is indexed.

/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/stests/hiding_worksheets.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
Hiding Worksheets
-----------------

We want to allow the user to hide a worksheet so that it no longer
figures in the gradebook.  The worksheet will not be deleted from the
database, but it will be ignored in all areas of gradebook management.

Helpers:

    >>> # FORMATTERS
    >>> def format_tab(tab):
    ...     text = tab.query.tag('a').text
    ...     active = tab.get_attribute('class') in ('active',)
    ...     return ['%s', '*%s*'][active] % text
    >>> def format_menu(menu):
    ...     result = []
    ...     header = menu.query.css('.header').text
    ...     result.append(header)
    ...     result.append('-'*len(header))
    ...     options = [a.text for a in menu.query_all.tag('a')]
    ...     result.extend(options)
    ...     return '\n'.join(result)

    >>> # GETTERS
    >>> def get_tabs(browser):
    ...     return browser.query_all.css('.third-nav li')

    >>> # PRINTERS
    >>> def print_tabs(browser):
    ...     for tab in get_tabs(browser):
    ...         print format_tab(tab)
    >>> def print_menus(browser, navigators=True):
    ...     menus = browser.query_all.css('.refine .content')
    ...     if navigators:
    ...         menus = menus[3:]
    ...     for menu in menus:
    ...         print format_menu(menu), '\n'

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('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'])

Log in as teacher and go to his gradebook:

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

In a regular worksheet the sidebar has some links that act on the
worksheet being viewed and other that act on the gradebook. Let's
print the worksheet menus in the sidebar:

    >>> print_menus(stephan)
    Add
    ---
    Worksheet
    Activity
    <BLANKLINE>
    Settings
    --------
    Worksheets
    Category Weights
    <BLANKLINE>
    Reports
    -------
    Gradebook Export
    Printable Worksheet

The sidebar shows additional options for users that can modify the
course. Let's allow the manager to edit the gradebook:

    >>> manager.query.link('Server').click()
    >>> manager.query.link('Security').click()
    >>> manager.query.xpath('//a[@title="Edit the access rights"]').click()
    >>> manager.query.id('on.administration_can_grade_students').click()
    >>> manager.query.name('UPDATE_SUBMIT').click()

Add to Administrators group, because Clerks cannot see all of this:

    >>> manager.ui.group.members.add('2005-2006', 'School Administrators', ['manager'])

And see the options displayed to him in the gradebook:

    >>> manager.ui.section.go('2005-2006', 'Year', 'Math I (1)')
    >>> manager.query.link('Gradebook').click()
    >>> print_menus(manager, navigators=False)
    Add
    ---
    Worksheet
    Activity
    <BLANKLINE>
    Settings
    --------
    Worksheets
    Category Weights
    <BLANKLINE>
    Actions
    -------
    Add to Course Worksheets
    <BLANKLINE>
    Reports
    -------
    Gradebook Export
    Printable Worksheet

We'll add two new worksheets, Sheet2 and Sheet3, and will make Sheet2
the current worksheet:

    >>> stephan.query.link('Worksheet').click()
    >>> stephan.query.id('form-widgets-title').ui.set_value('Sheet2')
    >>> stephan.query.id('form-buttons-add').click()
    >>> stephan.query.link('Worksheet').click()
    >>> stephan.query.id('form-widgets-title').ui.set_value('Sheet3')
    >>> stephan.query.id('form-buttons-add').click()
    >>> stephan.query.link('Sheet2').click()

    >>> print_tabs(stephan)
    Sheet1
    *Sheet2*
    Sheet3

Now we'll hide our current worksheet:

    >>> stephan.query.link('Worksheets').click()
    >>> sel = '//input[@type="checkbox" and @value="Sheet2"]'
    >>> stephan.query.xpath(sel).click()

Finally, we'll return to the gradebook, noting that it handles the current
worksheet being hidden, changing the current worksheet to the first one that
is not hidden.

    >>> stephan.query.link('Done').click()
    >>> print_tabs(stephan)
    *Sheet1*
    Sheet3

Unhiding Worksheets
-------------------

Now that we can hide worksheets, we need to allow the user to change
their mind and unhide a worksheet they previously hid.  We need to
navigate to the worksheets from which we can call up the view for
unhiding worksheets. We'll unhide the worksheet we just hid:

    >>> stephan.query.link('Worksheets').click()
    >>> sel = '//input[@type="checkbox" and @value="Sheet2"]'
    >>> stephan.query.xpath(sel).click()

After returning to the gradebook view we see that the worksheet has
reappeared in the worksheets tabs.

    >>> stephan.query.link('Done').click()
    >>> print_tabs(stephan)
    *Sheet1*
    Sheet2
    Sheet3

Hiding all the worksheets
-------------------------

It is possible to hide all the worksheets in the gradebook:

    >>> stephan.query.link('Worksheets').click()
    >>> for sheet in ['Worksheet', 'Sheet2', 'Sheet3']:
    ...     sel = '//input[@type="checkbox" and @value="%s"]' % sheet
    ...     stephan.query.xpath(sel).click()

When we return to the gradebook, we get no tabs and a warning message:

    >>> stephan.query.link('Done').click()

    >>> get_tabs(stephan)
    []
    >>> print stephan.query.css('.page .header h1').text
    No Visible Worksheets
    >>> print stephan.query_all.css('.container p')[0].text
    This section contains only worksheets that are hidden.

When all the worksheets are hidden, the menus only show options that
act on the gradebook:

    >>> print_menus(stephan)
    Add
    ---
    Worksheet
    <BLANKLINE>
    Settings
    --------
    Worksheets

The behavior is the same for the manager:

    >>> manager.ui.section.go('2005-2006', 'Year', 'Math I (1)')
    >>> manager.query.link('Gradebook').click()
    >>> get_tabs(manager)
    []
    >>> print manager.query.css('.page .header h1').text
    No Visible Worksheets
    >>> print manager.query_all.css('.container p')[0].text
    This section contains only worksheets that are hidden.
    >>> print_menus(manager, navigators=False)
    Add
    ---
    Worksheet
    <BLANKLINE>
    Settings
    --------
    Worksheets