sambal-cle 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -1
- data/lib/sambal-cle/base_page.rb +3 -1
- data/lib/sambal-cle/data_objects/announcement.rb +7 -10
- data/lib/sambal-cle/data_objects/assessment.rb +265 -9
- data/lib/sambal-cle/data_objects/assignment.rb +38 -32
- data/lib/sambal-cle/data_objects/assignment_permissions.rb +61 -0
- data/lib/sambal-cle/data_objects/assignment_submission.rb +126 -0
- data/lib/sambal-cle/data_objects/blog.rb +4 -7
- data/lib/sambal-cle/data_objects/blogger.rb +4 -10
- data/lib/sambal-cle/data_objects/chat_room.rb +5 -8
- data/lib/sambal-cle/data_objects/event.rb +6 -17
- data/lib/sambal-cle/data_objects/forum.rb +9 -19
- data/lib/sambal-cle/data_objects/lesson.rb +8 -29
- data/lib/sambal-cle/data_objects/message.rb +7 -10
- data/lib/sambal-cle/data_objects/poll.rb +6 -11
- data/lib/sambal-cle/data_objects/resource.rb +28 -37
- data/lib/sambal-cle/data_objects/site.rb +6 -17
- data/lib/sambal-cle/data_objects/syllabus.rb +6 -8
- data/lib/sambal-cle/data_objects/user.rb +88 -0
- data/lib/sambal-cle/data_objects/web_content_tool.rb +5 -6
- data/lib/sambal-cle/data_objects/wiki.rb +6 -6
- data/lib/sambal-cle/page_objects/account.rb +0 -2
- data/lib/sambal-cle/page_objects/announcements.rb +0 -1
- data/lib/sambal-cle/page_objects/assessments.rb +57 -87
- data/lib/sambal-cle/page_objects/assignments.rb +117 -337
- data/lib/sambal-cle/page_objects/calendar.rb +0 -2
- data/lib/sambal-cle/page_objects/login.rb +3 -9
- data/lib/sambal-cle/page_objects/sections.rb +2 -3
- data/lib/sambal-cle/page_objects/site_setup.rb +9 -19
- data/lib/sambal-cle/rich_text.rb +6 -0
- data/lib/sambal-cle/utilities.rb +4 -10
- data/lib/sambal-cle/workflows.rb +1 -5
- data/lib/sambal-cle.rb +2 -10
- data/sambal-cle.gemspec +7 -8
- data/test/add_assignment_to_calendar_spec.rb +14 -15
- data/test/assessment_create_spec.rb +355 -0
- data/test/assignment_announcements_spec.rb +14 -15
- data/test/assignment_duplicate_spec.rb +56 -0
- data/test/assignment_gradebook_spec.rb +16 -15
- data/test/assignment_permissions_spec.rb +77 -0
- data/test/assignments_grading_spec.rb +123 -0
- data/test/assignments_submission_spec.rb +143 -0
- data/test/config.yml +3 -0
- data/test/directory.yml +120 -0
- data/test/duplicate_site_spec.rb +5 -3
- data/test/import_site_content_spec.rb +248 -0
- metadata +22 -31
- data/lib/sambal-cle/core-ext.rb +0 -90
- data/lib/sambal-cle/date_makers.rb +0 -118
- data/lib/sambal-cle/gem_ext.rb +0 -23
- data/lib/sambal-cle/page_helper.rb +0 -22
- data/lib/sambal-cle/page_maker.rb +0 -48
- data/lib/sambal-cle/randomizers.rb +0 -117
data/README.md
CHANGED
data/lib/sambal-cle/base_page.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class BasePage <
|
1
|
+
class BasePage < PageFactory
|
2
2
|
|
3
3
|
class << self
|
4
4
|
|
@@ -11,6 +11,8 @@ class BasePage < PageMaker
|
|
11
11
|
value(:alert_box) { |b| b.frm.div(:class=>"alertMessage").text }
|
12
12
|
# Returns the text of the header.
|
13
13
|
value(:header) { |b| b.frm.div(:class=>"portletBody").h3.text }
|
14
|
+
element(:cancel_button) { |b| b.frm.button(:value=>"Cancel") }
|
15
|
+
action(:cancel) { |p| p.cancel_button.click }
|
14
16
|
end
|
15
17
|
|
16
18
|
# More element group defs go here...
|
@@ -1,7 +1,9 @@
|
|
1
1
|
class AnnouncementObject
|
2
2
|
|
3
|
-
include
|
4
|
-
include
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include StringFactory
|
6
|
+
include DateFactory
|
5
7
|
include Workflows
|
6
8
|
|
7
9
|
attr_accessor :title, :body, :site, :link, :access, :availability,
|
@@ -16,10 +18,8 @@ class AnnouncementObject
|
|
16
18
|
:body=>random_multiline(500, 10, :alpha)
|
17
19
|
}
|
18
20
|
options = defaults.merge(opts)
|
19
|
-
|
20
|
-
@
|
21
|
-
@site=options[:site]
|
22
|
-
raise "You must specify a Site for the announcement" if @site==nil
|
21
|
+
set_options(options)
|
22
|
+
requires @site
|
23
23
|
end
|
24
24
|
|
25
25
|
alias :name :title
|
@@ -57,10 +57,7 @@ class AnnouncementObject
|
|
57
57
|
end
|
58
58
|
edit.save_changes
|
59
59
|
end
|
60
|
-
|
61
|
-
@body=opts[:body] unless opts[:body]==nil
|
62
|
-
@access=opts[:access]
|
63
|
-
@availability=opts[:availability]
|
60
|
+
update_options(opts)
|
64
61
|
end
|
65
62
|
|
66
63
|
def view
|
@@ -1,32 +1,288 @@
|
|
1
1
|
class AssessmentObject
|
2
2
|
|
3
|
-
include
|
4
|
-
include
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include StringFactory
|
6
|
+
include DateFactory
|
5
7
|
include Workflows
|
6
8
|
|
7
|
-
attr_accessor :title, :site
|
9
|
+
attr_accessor :title, :site, :questions, :parts, :status, :type, :available_date,
|
10
|
+
:due_date, :retract_date, :feedback_authoring, :feedback_delivery, :feedback_date,
|
11
|
+
:release_to, :release, :release_options, :secondary_id, :secondary_password,
|
12
|
+
:navigation, :question_layout, :numbering, :submissions, :num_submissions,
|
13
|
+
:late_handling, :submission_message, :final_page_url, :student_ids,
|
14
|
+
:gradebook_options, :recorded_score, :allowed_ips
|
8
15
|
|
9
16
|
def initialize(browser, opts={})
|
10
17
|
@browser = browser
|
11
18
|
|
12
19
|
defaults = {
|
13
20
|
:title=>random_alphanums,
|
14
|
-
:
|
21
|
+
:authors=>random_alphanums,
|
22
|
+
:description=>random_alphanums,
|
23
|
+
:parts=>[],
|
24
|
+
:questions=>[],
|
25
|
+
:available_date=>right_now,
|
26
|
+
:due_date=>tomorrow,
|
27
|
+
:retract_date=>next_week,
|
28
|
+
:feedback_authoring=>:question_level_feedback,
|
29
|
+
:feedback_delivery=>:no_feedback,
|
30
|
+
:release=>:release_questions_and,
|
31
|
+
:release_options=>[],
|
32
|
+
:released_to=>:released_to_site,
|
33
|
+
:navigation=>:linear_access,
|
34
|
+
:submissions=>:unlimited_submissions,
|
35
|
+
:late_handling=>:late_submissions_not_accepted,
|
36
|
+
:submission_message=>random_alphanums,
|
37
|
+
:final_page_url=>"http://www.rsmart.com",
|
38
|
+
:student_ids=>:student_ids_seen
|
39
|
+
# TODO: More to add
|
15
40
|
}
|
16
41
|
options = defaults.merge(opts)
|
17
|
-
|
18
|
-
@site
|
19
|
-
|
42
|
+
set_options(options)
|
43
|
+
requires @site
|
44
|
+
|
45
|
+
default_part = make PartObject, :title=>"Default", :assessment=>@title, :part_number=>1, :information=>""
|
46
|
+
@parts << default_part
|
20
47
|
end
|
21
48
|
|
22
49
|
def create
|
23
50
|
my_workspace.open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
24
51
|
tests_and_quizzes unless @browser.title=~/Tests & Quizzes$/
|
52
|
+
reset
|
25
53
|
on_page AssessmentsList do |page|
|
26
54
|
page.title.set @title
|
55
|
+
page.type.select @type unless @type==nil
|
27
56
|
page.create
|
28
57
|
end
|
29
|
-
|
58
|
+
on EditAssessment do |assessment|
|
59
|
+
assessment.settings
|
60
|
+
end
|
61
|
+
on AssessmentSettings do |settings|
|
62
|
+
settings.open
|
63
|
+
# Introduction
|
64
|
+
settings.authors.set @authors
|
65
|
+
settings.description.set @description
|
66
|
+
# Delivery Dates
|
67
|
+
settings.available_date.set @available_date[:samigo]
|
68
|
+
settings.due_date.set @due_date[:samigo]
|
69
|
+
settings.retract_date.set @retract_date[:samigo]
|
70
|
+
# Assessment Released To
|
71
|
+
settings.send(@released_to).set
|
72
|
+
# High Security
|
73
|
+
settings.allow_specified_ips.set @allowed_ips
|
74
|
+
settings.secondary_id.set @secondary_id
|
75
|
+
settings.secondary_pw.set @secondary_password
|
76
|
+
# Assessment Organization
|
77
|
+
settings.send(@navigation).set
|
78
|
+
if @navigation==:random_access
|
79
|
+
settings.send(@question_layout).set
|
80
|
+
settings.send(@numbering).set
|
81
|
+
# Mark for Review
|
82
|
+
settings.send(@mark_for_review)
|
83
|
+
end
|
84
|
+
# Submissions
|
85
|
+
settings.send(@submissions).set
|
86
|
+
if @submissions==:only_x_submissions
|
87
|
+
settings.allowed_submissions.set @num_submissions
|
88
|
+
end
|
89
|
+
settings.send(@late_handling).set
|
90
|
+
# Submission Message
|
91
|
+
settings.submission_message.set @submission_message
|
92
|
+
settings.final_page_url.set @final_page_url
|
93
|
+
# Feedback
|
94
|
+
settings.send(@feedback_authoring).set
|
95
|
+
settings.send(@feedback_delivery).set
|
96
|
+
settings.send(@release).set
|
97
|
+
@release_options.each do |option|
|
98
|
+
settings.send(option).set
|
99
|
+
end
|
100
|
+
if @feedback_delivery==:feedback_on_date
|
101
|
+
settings.feedback_date.set @feedback_date
|
102
|
+
end
|
103
|
+
# Grading
|
104
|
+
# TODO: More to add here
|
105
|
+
# Graphics
|
106
|
+
|
107
|
+
# Metadata
|
108
|
+
|
109
|
+
|
110
|
+
settings.save
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def update_settings opts={}
|
115
|
+
|
116
|
+
set_options(opts)
|
117
|
+
end
|
118
|
+
|
119
|
+
def publish
|
120
|
+
my_workspace.open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
121
|
+
tests_and_quizzes unless @browser.title=~/Tests & Quizzes$/
|
122
|
+
reset
|
123
|
+
on AssessmentsList do |list|
|
124
|
+
list.publish @title
|
125
|
+
end
|
126
|
+
on PublishAssessment do |assessment|
|
127
|
+
assessment.publish
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def add_part opts={}
|
132
|
+
position
|
133
|
+
defaults = {
|
134
|
+
:assessment=>@title,
|
135
|
+
:part_number=>@parts.length+1
|
136
|
+
}
|
137
|
+
options = defaults.merge(opts)
|
138
|
+
part = make PartObject, options
|
139
|
+
part.create
|
140
|
+
@parts << part
|
141
|
+
end
|
142
|
+
|
143
|
+
def add_question opts={}
|
144
|
+
position
|
145
|
+
defaults = {
|
146
|
+
:assessment=>@title,
|
147
|
+
:part=>@parts[rand(@parts.length)].title
|
148
|
+
}
|
149
|
+
options = defaults.merge(opts)
|
150
|
+
question = make QuestionObject, options
|
151
|
+
question.create
|
152
|
+
@questions << question
|
153
|
+
end
|
154
|
+
|
155
|
+
private
|
156
|
+
|
157
|
+
def position
|
158
|
+
my_workspace.open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
159
|
+
tests_and_quizzes unless @browser.title=~/Tests & Quizzes$/
|
160
|
+
unless @browser.frame(:class=>"portletMainIframe").h3.text=="Questions: #{@title}"
|
161
|
+
reset
|
162
|
+
on AssessmentsList do |list|
|
163
|
+
list.edit @title
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
class QuestionObject
|
171
|
+
|
172
|
+
include Foundry
|
173
|
+
include Utilities
|
174
|
+
include Workflows
|
175
|
+
include StringFactory
|
176
|
+
|
177
|
+
attr_accessor :type, :assessment, :text, :point_value, :part,
|
178
|
+
# Multiple Choice attributes...
|
179
|
+
:correct_type, :answer_credit, :negative_point_value
|
180
|
+
|
181
|
+
def initialize(browser, opts={})
|
182
|
+
@browser = browser
|
183
|
+
defaults = {
|
184
|
+
:type=>QUESTION_TYPES.keys[rand(QUESTION_TYPES.length)],
|
185
|
+
:text=>random_alphanums,
|
186
|
+
:point_value=>(rand(100)+1).to_s
|
187
|
+
|
188
|
+
}
|
189
|
+
options = defaults.merge(opts)
|
190
|
+
set_options(options)
|
191
|
+
requires @assessment
|
192
|
+
end
|
193
|
+
|
194
|
+
QUESTION_TYPES = {
|
195
|
+
:"Multiple Choice"=>:add_multiple_choice,
|
196
|
+
:Survey=>:add_survey#,
|
197
|
+
#:"Short Answer/Essay"=>:add_short_answer,
|
198
|
+
#:"Fill in the Blank"=>:add_fill_in_the_blank,
|
199
|
+
#:"Numeric Response"=>:add_numeric,
|
200
|
+
#:Matching=>:add_matching,
|
201
|
+
#:"True False"=>:add_true_false,
|
202
|
+
#:"Audio Recording"=>:add_audio,
|
203
|
+
#:"File Upload"=>:add_file_upload,
|
204
|
+
#:"Calculated Question"=>:add_calculated_question
|
205
|
+
}
|
206
|
+
|
207
|
+
def create
|
208
|
+
on EditAssessment do |edit|
|
209
|
+
edit.add_question_to_part(@part).select @type
|
210
|
+
end
|
211
|
+
self.send(QUESTION_TYPES[@type.to_sym])
|
212
|
+
end
|
213
|
+
|
214
|
+
private
|
215
|
+
|
216
|
+
def add_multiple_choice
|
217
|
+
on MultipleChoice do |add|
|
218
|
+
add.answer_point_value.set @point_value
|
219
|
+
add.question_text.set @text
|
220
|
+
add.send(@correct_type).set
|
221
|
+
add.send(@answer_credit).set unless @answer_credit==nil
|
222
|
+
add.negative_point_value.set @negative_point_value unless @negative_point_value==nil
|
223
|
+
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def add_survey
|
228
|
+
on Survey do |add|
|
229
|
+
|
230
|
+
end
|
30
231
|
end
|
31
232
|
|
32
|
-
end
|
233
|
+
end
|
234
|
+
|
235
|
+
class PartObject
|
236
|
+
|
237
|
+
include Foundry
|
238
|
+
include Utilities
|
239
|
+
include Workflows
|
240
|
+
include StringFactory
|
241
|
+
|
242
|
+
attr_accessor :assessment, :title, :information, :type, :number_of_questions, :pool_name, :part_number, :question_ordering
|
243
|
+
|
244
|
+
def initialize(browser, opts={})
|
245
|
+
@browser = browser
|
246
|
+
|
247
|
+
defaults = {
|
248
|
+
:title=>random_alphanums,
|
249
|
+
:information=>random_alphanums,
|
250
|
+
:type=>:one_by_one,
|
251
|
+
:question_ordering=>:order_as_listed
|
252
|
+
}
|
253
|
+
options = defaults.merge(opts)
|
254
|
+
|
255
|
+
set_options(options)
|
256
|
+
requires @assessment
|
257
|
+
end
|
258
|
+
|
259
|
+
def create
|
260
|
+
on EditAssessment do |edit|
|
261
|
+
edit.add_part
|
262
|
+
end
|
263
|
+
on AddEditAssessmentPart do |part|
|
264
|
+
part.title.set @title
|
265
|
+
part.information.set @information
|
266
|
+
part.send(@type).set
|
267
|
+
part.send(@question_ordering).set
|
268
|
+
# TODO: more to add here
|
269
|
+
part.save
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
def edit opts={}
|
274
|
+
|
275
|
+
set_options(opts)
|
276
|
+
end
|
277
|
+
|
278
|
+
def view
|
279
|
+
|
280
|
+
end
|
281
|
+
|
282
|
+
def delete
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
287
|
+
|
288
|
+
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# This data object is strictly the assignment as created by an instructor
|
2
|
+
# for Student submissions of an assignment, use AssignmentSubmissionObject
|
1
3
|
class AssignmentObject
|
2
4
|
|
3
|
-
include
|
4
|
-
include
|
5
|
-
include
|
6
|
-
include
|
5
|
+
include Foundry
|
6
|
+
include DataFactory
|
7
|
+
include StringFactory
|
8
|
+
include DateFactory
|
7
9
|
include Workflows
|
8
10
|
|
9
11
|
attr_accessor :title, :site, :instructions, :id, :link, :status, :grade_scale,
|
@@ -28,23 +30,8 @@ class AssignmentObject
|
|
28
30
|
}
|
29
31
|
options = defaults.merge(opts)
|
30
32
|
|
31
|
-
|
32
|
-
@
|
33
|
-
@site=options[:site]
|
34
|
-
@grade_scale=options[:grade_scale]
|
35
|
-
@max_points=options[:max_points]
|
36
|
-
@allow_resubmission=options[:allow_resubmission]
|
37
|
-
@num_resubmissions=options[:num_resubmissions]
|
38
|
-
@open=options[:open]
|
39
|
-
@due=options[:due]
|
40
|
-
@accept_until=options[:accept_until]
|
41
|
-
@resubmission=options[:resubmission]
|
42
|
-
@student_submissions=options[:student_submissions]
|
43
|
-
@add_due_date=options[:add_due_date]
|
44
|
-
@add_open_announcement=options[:add_open_announcement]
|
45
|
-
@add_to_gradebook=options[:add_to_gradebook]
|
46
|
-
@status=options[:status]
|
47
|
-
raise "You must specify a Site for your Assignment" if @site==nil
|
33
|
+
set_options(options)
|
34
|
+
requires @site
|
48
35
|
raise "You must specify max points if your grade scale is 'points'" if @max_points==nil && @grade_scale=="Points"
|
49
36
|
end
|
50
37
|
|
@@ -121,6 +108,7 @@ class AssignmentObject
|
|
121
108
|
list.edit_assignment @title
|
122
109
|
end
|
123
110
|
end
|
111
|
+
|
124
112
|
on AssignmentAdd do |edit|
|
125
113
|
edit.title.set opts[:title] unless opts[:title]==nil
|
126
114
|
unless opts[:instructions]==nil
|
@@ -128,11 +116,12 @@ class AssignmentObject
|
|
128
116
|
end
|
129
117
|
edit.grade_scale.select opts[:grade_scale] unless opts[:grade_scale]==nil
|
130
118
|
edit.max_points.set opts[:max_points] unless opts[:max_points]==nil
|
131
|
-
# This should be one of the last items edited...
|
132
|
-
edit.add_to_gradebook.send(opts[:add_to_gradebook]) unless opts[:add_to_gradebook]==nil
|
133
119
|
|
134
120
|
#TODO: All the rest goes here
|
135
121
|
|
122
|
+
# This should be one of the last items edited...
|
123
|
+
edit.add_to_gradebook.send(opts[:add_to_gradebook]) unless opts[:add_to_gradebook]==nil
|
124
|
+
|
136
125
|
if (@status=="Draft" && opts[:status]==nil) || opts[:status]=="Draft"
|
137
126
|
edit.save_draft
|
138
127
|
elsif opts[:status]=="Editing"
|
@@ -141,12 +130,7 @@ class AssignmentObject
|
|
141
130
|
edit.post
|
142
131
|
end
|
143
132
|
end
|
144
|
-
|
145
|
-
@instructions=opts[:instructions] unless opts[:instructions] == nil
|
146
|
-
@grade_scale=opts[:grade_scale] unless opts[:grade_scale] == nil
|
147
|
-
@max_points=opts[:max_points] unless opts[:title] == nil
|
148
|
-
@add_to_gradebook==opts[:add_to_gradebook]
|
149
|
-
# TODO: Add all the rest of the elements here
|
133
|
+
set_options(opts)
|
150
134
|
|
151
135
|
unless opts[:status]=="Editing"
|
152
136
|
on AssignmentsList do |list|
|
@@ -194,12 +178,34 @@ class AssignmentObject
|
|
194
178
|
end
|
195
179
|
end
|
196
180
|
|
197
|
-
def
|
198
|
-
|
181
|
+
def duplicate
|
182
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
183
|
+
assignments unless @browser.title=~/Assignments$/
|
184
|
+
reset
|
185
|
+
on AssignmentsList do |list|
|
186
|
+
list.duplicate @title
|
187
|
+
end
|
188
|
+
|
189
|
+
duplicate_assignment = self
|
190
|
+
duplicate_assignment.title="Draft - #{self.title} - Copy"
|
191
|
+
duplicate_assignment.status="Draft"
|
192
|
+
duplicate_assignment
|
199
193
|
end
|
200
194
|
|
201
|
-
def
|
195
|
+
def view_submissions
|
202
196
|
# TODO: Create this method
|
203
197
|
end
|
204
198
|
|
199
|
+
# Use this method to open a submitted assignment for viewing
|
200
|
+
# the page.
|
201
|
+
def view_submission
|
202
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
203
|
+
assignments unless @browser.title=~/Assignments$/
|
204
|
+
reset
|
205
|
+
on AssignmentsList do |list|
|
206
|
+
list.open_assignment @title
|
207
|
+
end
|
208
|
+
end
|
209
|
+
alias open view_submission
|
210
|
+
|
205
211
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class AssignmentPermissionsObject # TODO: Need to add support for Group-specific permissions
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include Workflows
|
6
|
+
|
7
|
+
attr_accessor :site, :group, :guest, :instructor, :student, :teaching_assistant
|
8
|
+
|
9
|
+
def initialize(browser, opts={})
|
10
|
+
@browser = browser
|
11
|
+
checkboxes={:all_groups=>nil, :new=>nil, :submit=>nil, :delete=>nil, :read=>nil, :revise=>nil, :grade=>nil, :receive_notifications=>nil, :share_drafts=>nil}
|
12
|
+
@guest=checkboxes
|
13
|
+
@instructor=checkboxes
|
14
|
+
@student=checkboxes
|
15
|
+
@teaching_assistant=checkboxes
|
16
|
+
set_options(opts)
|
17
|
+
requires @site
|
18
|
+
get
|
19
|
+
end
|
20
|
+
|
21
|
+
def set opts={}
|
22
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
23
|
+
assignments unless @browser.title=~/Assignments$/
|
24
|
+
reset
|
25
|
+
on AssignmentsList do |list|
|
26
|
+
list.permissions
|
27
|
+
end
|
28
|
+
on AssignmentsPermissions do |perm|
|
29
|
+
roles={:guest=>"Guest", :instructor=>"Instructor", :student=>"Student", :teaching_assistant=>"Teaching Assistant"}
|
30
|
+
roles.each_pair do |role, title|
|
31
|
+
if opts[role]!=nil
|
32
|
+
opts[role].each_pair do |checkbox, setting|
|
33
|
+
perm.send(checkbox, title).send(setting)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
perm.save
|
38
|
+
end
|
39
|
+
@guest = @guest.merge(opts[:guest]) unless opts[:guest]==nil
|
40
|
+
@instructor = @instructor.merge(opts[:instructor]) unless opts[:instructor]==nil
|
41
|
+
@student = @student.merge(opts[:student]) unless opts[:student]==nil
|
42
|
+
@teaching_assistant = @teaching_assistant.merge(opts[:teaching_assistant]) unless opts[:teaching_assistant]==nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def get
|
46
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
47
|
+
assignments unless @browser.title=~/Assignments$/
|
48
|
+
reset
|
49
|
+
on AssignmentsList do |list|
|
50
|
+
list.permissions
|
51
|
+
end
|
52
|
+
on AssignmentsPermissions do |perm|
|
53
|
+
roles={@guest=>"Guest", @instructor=>"Instructor", @student=>"Student", @teaching_assistant=>"Teaching Assistant"}
|
54
|
+
roles.each_pair do |role, name|
|
55
|
+
role.each_key { |key| role.store(key, checkbox_setting(perm.send(key, name))) }
|
56
|
+
end
|
57
|
+
perm.cancel
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
class AssignmentSubmissionObject
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include StringFactory
|
6
|
+
include DateFactory
|
7
|
+
include Workflows
|
8
|
+
|
9
|
+
attr_accessor :site, :title, :text, :status, :submission_date,
|
10
|
+
:student, :allow_resubmission, :resubmission, :num_resubmissions,
|
11
|
+
:release_to_student, :grade, :summary_comment, :inline_comment,
|
12
|
+
:grade_status, :accept_until, :returned
|
13
|
+
|
14
|
+
def initialize(browser, opts={})
|
15
|
+
@browser = browser
|
16
|
+
|
17
|
+
defaults = {
|
18
|
+
:text=>random_alphanums,
|
19
|
+
:status=>"Not Started"
|
20
|
+
}
|
21
|
+
options = defaults.merge(opts)
|
22
|
+
|
23
|
+
set_options(options)
|
24
|
+
requires @site, @title, @student
|
25
|
+
end
|
26
|
+
|
27
|
+
def submit
|
28
|
+
open
|
29
|
+
on AssignmentStudentView do |assignment|
|
30
|
+
assignment.assignment_text=@text
|
31
|
+
# TODO: Add stuff for adding file(s) to the assignment
|
32
|
+
assignment.submit
|
33
|
+
@submission_date=right_now[:sakai]
|
34
|
+
@status="Submitted"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def save_draft
|
39
|
+
open
|
40
|
+
on AssignmentStudentView do |assignment|
|
41
|
+
assignment.assignment_text=@text
|
42
|
+
# TODO: Add stuff for adding file(s) to the assignment
|
43
|
+
assignment.save_draft
|
44
|
+
@submission_date=right_now[:sakai]
|
45
|
+
@status="Draft - In progress"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def resubmit opts={}
|
50
|
+
open
|
51
|
+
on AssignmentStudentView do |assignment|
|
52
|
+
assignment.assignment_text=opts[:text] unless opts[:text]==nil
|
53
|
+
# TODO: Add stuff for adding/updating/removing file(s) for the assignment
|
54
|
+
assignment.resubmit
|
55
|
+
@submission_date=right_now[:sakai] # Is this right?
|
56
|
+
@status="Submitted"
|
57
|
+
end
|
58
|
+
@text=opts[:text]
|
59
|
+
end
|
60
|
+
|
61
|
+
def grade_submission opts={}
|
62
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
63
|
+
assignments unless @browser.title=~/Assignments$/
|
64
|
+
reset
|
65
|
+
on AssignmentsList do |list|
|
66
|
+
list.grade @title
|
67
|
+
end
|
68
|
+
on AssignmentSubmissionList do |submissions|
|
69
|
+
submissions.grade @student.ln_fn_id
|
70
|
+
end
|
71
|
+
on AssignmentSubmission do |submission|
|
72
|
+
submission.prepend(submission.assignment_submission, "{{#{opts[@inline_comment]}}}") unless opts[:inline_comment]==nil
|
73
|
+
submission.instructor_comments=opts[:summary_comment] unless opts[:summary_comment]==nil
|
74
|
+
submission.grade.select opts[:grade] unless opts[:grade]==nil
|
75
|
+
submission.allow_resubmission.send(opts[:allow_resubmission]) unless opts[:allow_resubmission]==nil
|
76
|
+
if opts[:allow_resubmission]==:set || submission.allow_resubmission.set?
|
77
|
+
submission.num_resubmissions.wait_until_present
|
78
|
+
if opts[:accept_until]==nil
|
79
|
+
@num_resubmissions=submission.num_resubmissions.selected_options[0].text
|
80
|
+
@accept_until={} # Okay to wipe this (in case it's there) because we're getting
|
81
|
+
# the values from UI--but most likely this var is nil anyway,
|
82
|
+
# in which case we need to turn it into a hash.
|
83
|
+
@accept_until[:MON]=submission.accept_until_month.selected_options[0].text
|
84
|
+
@accept_until[:day_of_month]=submission.accept_until_day.selected_options[0].text
|
85
|
+
@accept_until[:year]=submission.accept_until_year.selected_options[0].text
|
86
|
+
@accept_until[:hour]=submission.accept_until_hour.selected_options[0].text
|
87
|
+
@accept_until[:minute_rounded]=submission.accept_until_min.selected_options[0].text
|
88
|
+
@accept_until[:MERIDIAN]=submission.accept_until_meridian.selected_options[0].text
|
89
|
+
@accept_until[:sakai_rounded]=@accept_until[:MON].capitalize+" "+@accept_until[:day_of_month]+", "+@accept_until[:year]+" "+@accept_until[:hour]+":"+@accept_until[:minute_rounded]+" "+@accept_until[:MERIDIAN].downcase
|
90
|
+
else
|
91
|
+
submission.num_resubmissions.select opts[:num_resubmissions]
|
92
|
+
submission.accept_until_month.select opts[:accept_until][:MON]
|
93
|
+
submission.accept_until_day.select opts[:accept_until][:day_of_month]
|
94
|
+
submission.accept_until_year.select opts[:accept_until][:year]
|
95
|
+
submission.accept_until_hour.select opts[:accept_until][:hour]
|
96
|
+
submission.accept_until_min.select opts[:accept_until][:minute_rounded]
|
97
|
+
submission.accept_until_meridian.select opts[:accept_until][:MERIDIAN]
|
98
|
+
end
|
99
|
+
end
|
100
|
+
if opts[:release_to_student]=~/yes/i
|
101
|
+
submission.save_and_release
|
102
|
+
@status="Returned"
|
103
|
+
@returned=right_now
|
104
|
+
else
|
105
|
+
submission.save_and_dont_release
|
106
|
+
end
|
107
|
+
submission.return_to_list
|
108
|
+
end
|
109
|
+
on AssignmentSubmissionList do |list|
|
110
|
+
@grade_status=list.submission_status_of @student.ln_fn_id
|
111
|
+
end
|
112
|
+
set_options(opts)
|
113
|
+
end
|
114
|
+
|
115
|
+
def open
|
116
|
+
open_my_site_by_name @site unless @browser.title=~/#{@site}/
|
117
|
+
assignments unless @browser.title=~/Assignments$/
|
118
|
+
reset
|
119
|
+
on AssignmentsList do |list|
|
120
|
+
list.open_assignment @title
|
121
|
+
end
|
122
|
+
end
|
123
|
+
alias view open
|
124
|
+
|
125
|
+
|
126
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class BlogEntryObject
|
2
2
|
|
3
|
-
include
|
4
|
-
include
|
3
|
+
include Foundry
|
4
|
+
include StringFactory
|
5
5
|
include Workflows
|
6
6
|
|
7
7
|
attr_accessor :title, :content, :site, :permissions
|
@@ -16,11 +16,8 @@ class BlogEntryObject
|
|
16
16
|
}
|
17
17
|
options = defaults.merge(opts)
|
18
18
|
|
19
|
-
|
20
|
-
@
|
21
|
-
@site=options[:site]
|
22
|
-
@permissions=options[:permissions]
|
23
|
-
raise "You need to specify a site for your blog entry" if @site==nil
|
19
|
+
set_options(options)
|
20
|
+
requirements @site
|
24
21
|
end
|
25
22
|
|
26
23
|
def create
|