kuali-sakai-common-lib 0.0.1 → 0.0.6
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/kuali-sakai-common-lib.gemspec +4 -5
- data/lib/kuali-sakai-common-lib.rb +3 -2
- data/lib/kuali-sakai-common-lib/add_files.rb +260 -0
- data/lib/kuali-sakai-common-lib/announcements.rb +301 -0
- data/lib/kuali-sakai-common-lib/assessments.rb +1183 -0
- data/lib/kuali-sakai-common-lib/assignments.rb +861 -0
- data/lib/kuali-sakai-common-lib/basic_lti.rb +13 -0
- data/lib/kuali-sakai-common-lib/blogs.rb +23 -0
- data/lib/kuali-sakai-common-lib/calendar.rb +466 -0
- data/lib/kuali-sakai-common-lib/calendar_summary.rb +0 -0
- data/lib/kuali-sakai-common-lib/chat_room.rb +0 -0
- data/lib/{core-ext.rb → kuali-sakai-common-lib/core-ext.rb} +0 -0
- data/lib/kuali-sakai-common-lib/drop_box.rb +0 -0
- data/lib/kuali-sakai-common-lib/email_archive.rb +28 -0
- data/lib/kuali-sakai-common-lib/forums.rb +326 -0
- data/lib/kuali-sakai-common-lib/gem_ext.rb +36 -0
- data/lib/kuali-sakai-common-lib/gradebook.rb +23 -0
- data/lib/kuali-sakai-common-lib/gradebook2.rb +24 -0
- data/lib/kuali-sakai-common-lib/messages.rb +639 -0
- data/lib/kuali-sakai-common-lib/news.rb +8 -0
- data/lib/kuali-sakai-common-lib/polls.rb +77 -0
- data/lib/kuali-sakai-common-lib/post_em.rb +0 -0
- data/lib/kuali-sakai-common-lib/profile.rb +46 -0
- data/lib/kuali-sakai-common-lib/profile2.rb +360 -0
- data/lib/kuali-sakai-common-lib/resources_roster.rb +0 -0
- data/lib/kuali-sakai-common-lib/rwiki.rb +0 -0
- data/lib/kuali-sakai-common-lib/sections.rb +237 -0
- data/lib/kuali-sakai-common-lib/single_user.rb +0 -0
- data/lib/kuali-sakai-common-lib/site_statistics.rb +0 -0
- data/lib/kuali-sakai-common-lib/syllabus.rb +182 -0
- data/lib/{utilities.rb → kuali-sakai-common-lib/utilities.rb} +13 -2
- metadata +51 -8
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#================
|
2
|
+
# Email Archive pages
|
3
|
+
#================
|
4
|
+
|
5
|
+
module EmailArchiveMethods
|
6
|
+
include PageObject
|
7
|
+
def options
|
8
|
+
frm.link(:text=>"Options").click
|
9
|
+
EmailArchiveOptions.new(@browser)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Returns an array containing the
|
13
|
+
def email_list
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.page_elements(identifier)
|
17
|
+
in_frame(identifier) do |frame|
|
18
|
+
text_field(:search_field, :id=>"search", :frame=>frame)
|
19
|
+
button(:search_button, :value=>"Search", :frame=>frame)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module EmailArchiveOptionsMethods
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,326 @@
|
|
1
|
+
|
2
|
+
#================
|
3
|
+
# Forum Pages - NOT "Discussion Forums"
|
4
|
+
#================
|
5
|
+
|
6
|
+
# The forums page in a particular Site
|
7
|
+
module ForumsMethods
|
8
|
+
|
9
|
+
# Pass this method a string that matches
|
10
|
+
# the title of a Forum on the page, it returns
|
11
|
+
# True if the specified forum row has "DRAFT" in it.
|
12
|
+
def draft?(title)
|
13
|
+
frm.table(:id=>"msgForum:forums").row(:text=>/#{Regexp.escape(title)}/).span(:text=>"DRAFT").exist?
|
14
|
+
end
|
15
|
+
|
16
|
+
def new_forum
|
17
|
+
frm.link(:text=>"New Forum").click
|
18
|
+
EditForum.new(@browser)
|
19
|
+
end
|
20
|
+
|
21
|
+
def new_topic_for_forum(name)
|
22
|
+
index = forum_titles.index(name)
|
23
|
+
frm.link(:text=>"New Topic", :index=>index).click
|
24
|
+
AddEditTopic.new(@browser)
|
25
|
+
end
|
26
|
+
|
27
|
+
def organize
|
28
|
+
frm.link(:text=>"Organize").click
|
29
|
+
OrganizeForums.new(@browser)
|
30
|
+
end
|
31
|
+
|
32
|
+
def template_settings
|
33
|
+
frm.link(:text=>"Template Settings").click
|
34
|
+
ForumTemplateSettings.new(@browser)
|
35
|
+
end
|
36
|
+
|
37
|
+
def forums_table
|
38
|
+
frm.div(:class=>"portletBody").table(:id=>"msgForum:forums")
|
39
|
+
end
|
40
|
+
|
41
|
+
def forum_titles
|
42
|
+
titles = []
|
43
|
+
title_links = frm.div(:class=>"portletBody").links.find_all { |link| link.class_name=="title" && link.id=="" }
|
44
|
+
title_links.each { |link| titles << link.text }
|
45
|
+
return titles
|
46
|
+
end
|
47
|
+
|
48
|
+
def topic_titles
|
49
|
+
titles = []
|
50
|
+
title_links = frm.div(:class=>"portletBody").links.find_all { |link| link.class_name == "title" && link.id != "" }
|
51
|
+
title_links.each { |link| titles << link.text }
|
52
|
+
return titles
|
53
|
+
end
|
54
|
+
|
55
|
+
def forum_settings(name)
|
56
|
+
index = forum_titles.index(name)
|
57
|
+
frm.link(:text=>"Forum Settings", :index=>index).click
|
58
|
+
EditForum.new(@browser)
|
59
|
+
end
|
60
|
+
|
61
|
+
def topic_settings(name)
|
62
|
+
index = topic_titles.index(name)
|
63
|
+
frm.link(:text=>"Topic Settings", :index=>index).click
|
64
|
+
AddEditTopic.new(@browser)
|
65
|
+
end
|
66
|
+
|
67
|
+
def delete_forum(name)
|
68
|
+
index = forum_titles.index(name)
|
69
|
+
frm.link(:id=>/msgForum:forums:\d+:delete/,:text=>"Delete", :index=>index).click
|
70
|
+
EditForum.new(@browser)
|
71
|
+
end
|
72
|
+
|
73
|
+
def delete_topic(name)
|
74
|
+
index = topic_titles.index(name)
|
75
|
+
frm.link(:id=>/topics:\d+:delete_confirm/, :text=>"Delete", :index=>index).click
|
76
|
+
AddEditTopic.new(@browser)
|
77
|
+
end
|
78
|
+
|
79
|
+
def open_forum(forum_title)
|
80
|
+
frm.link(:text=>forum_title).click
|
81
|
+
# New Class def goes here.
|
82
|
+
end
|
83
|
+
|
84
|
+
def open_topic(topic_title)
|
85
|
+
frm.link(:text=>topic_title).click
|
86
|
+
TopicPage.new(@browser)
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
module TopicPageMethods
|
92
|
+
|
93
|
+
def post_new_thread
|
94
|
+
frm.link(:text=>"Post New Thread").click
|
95
|
+
ComposeForumMessage.new(@browser)
|
96
|
+
end
|
97
|
+
|
98
|
+
def thread_titles
|
99
|
+
titles = []
|
100
|
+
message_table = frm.table(:id=>"msgForum:messagesInHierDataTable")
|
101
|
+
1.upto(message_table.rows.size-1) do |x|
|
102
|
+
titles << message_table[x][1].span(:class=>"firstChild").link(:index=>0).text
|
103
|
+
end
|
104
|
+
return titles
|
105
|
+
end
|
106
|
+
|
107
|
+
def open_message(message_title)
|
108
|
+
frm.div(:class=>"portletBody").link(:text=>message_title).click
|
109
|
+
ViewForumThread.new(@browser)
|
110
|
+
end
|
111
|
+
|
112
|
+
def display_entire_message
|
113
|
+
frm.link(:text=>"Display Entire Message").click
|
114
|
+
TopicPage.new(@browser)
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
module ViewForumThreadMethods
|
120
|
+
|
121
|
+
def reply_to_thread
|
122
|
+
frm.link(:text=>"Reply to Thread").click
|
123
|
+
ComposeForumMessage.new(@browser)
|
124
|
+
end
|
125
|
+
|
126
|
+
def reply_to_message(index)
|
127
|
+
frm.link(:text=>"Reply", :index=>(index.to_i - 1)).click
|
128
|
+
ComposeForumMessage.new(@browser)
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
module ComposeForumMessageMethods
|
134
|
+
include PageObject
|
135
|
+
def post_message
|
136
|
+
frm.button(:text=>"Post Message").click
|
137
|
+
# Not sure if we need logic here...
|
138
|
+
TopicPage.new(@browser)
|
139
|
+
end
|
140
|
+
|
141
|
+
def editor
|
142
|
+
frm.frame(:id, "dfCompose:df_compose_body_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
|
143
|
+
end
|
144
|
+
|
145
|
+
def message=(text)
|
146
|
+
editor.send_keys(text)
|
147
|
+
end
|
148
|
+
|
149
|
+
def reply_text
|
150
|
+
@browser.frame(:index=>1).div(:class=>"singleMessageReply").text
|
151
|
+
end
|
152
|
+
|
153
|
+
def add_attachments
|
154
|
+
#FIXME
|
155
|
+
end
|
156
|
+
|
157
|
+
def cancel
|
158
|
+
frm.button(:value=>"Cancel").click
|
159
|
+
# Logic for picking the correct page class
|
160
|
+
if frm.link(:text=>"Reply to Thread")
|
161
|
+
ViewForumThread.new(@browser)
|
162
|
+
elsif frm.link(:text=>"Post New Thread").click
|
163
|
+
TopicPage.new(@browser)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def self.page_elements(identifier)
|
168
|
+
in_frame(identifier) do |frame|
|
169
|
+
text_field(:title, :id=>"dfCompose:df_compose_title", :frame=>frame)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
module ForumTemplateSettingsMethods
|
175
|
+
|
176
|
+
def page_title
|
177
|
+
frm.div(:class=>"portletBody").h3(:index=>0).text
|
178
|
+
end
|
179
|
+
|
180
|
+
def save
|
181
|
+
frm.button(:value=>"Save").click
|
182
|
+
Forums.new(@browser)
|
183
|
+
end
|
184
|
+
|
185
|
+
def cancel
|
186
|
+
frm.button(:value=>"Cancel").click
|
187
|
+
Forums.new(@browser)
|
188
|
+
end
|
189
|
+
=begin
|
190
|
+
def site_role=(role)
|
191
|
+
frm.select(:id=>"revise:role").select(role)
|
192
|
+
0.upto(frm.select(:id=>"revise:role").length - 1) do |x|
|
193
|
+
if frm.div(:class=>"portletBody").table(:class=>"permissionPanel jsfFormTable lines nolines", :index=>x).visible?
|
194
|
+
@@table_index = x
|
195
|
+
|
196
|
+
def permission_level=(value)
|
197
|
+
frm.select(:id=>"revise:perm:#{@@table_index}:level").select(value)
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
=end
|
204
|
+
|
205
|
+
end
|
206
|
+
|
207
|
+
module OrganizeForumsMethods
|
208
|
+
|
209
|
+
def save
|
210
|
+
frm.button(:value=>"Save").click
|
211
|
+
Forums.new(@browser)
|
212
|
+
end
|
213
|
+
|
214
|
+
# These are set to so that the user
|
215
|
+
# does not have to start the list at zero...
|
216
|
+
def forum(index)
|
217
|
+
frm.select(:id, "revise:forums:#{index.to_i - 1}:forumIndex")
|
218
|
+
end
|
219
|
+
|
220
|
+
def topic(forumindex, topicindex)
|
221
|
+
frm.select(:id, "revise:forums:#{forumindex.to_i - 1}:topics:#{topicindex.to_i - 1}:topicIndex")
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
225
|
+
|
226
|
+
# The page for creating/editing a forum in a Site
|
227
|
+
module EditForumMethods
|
228
|
+
include PageObject
|
229
|
+
def save
|
230
|
+
frm.button(:value=>"Save").click
|
231
|
+
Forums.new(@browser)
|
232
|
+
end
|
233
|
+
|
234
|
+
def save_and_add
|
235
|
+
frm.button(:value=>"Save Settings & Add Topic").click
|
236
|
+
AddEditTopic.new(@browser)
|
237
|
+
end
|
238
|
+
|
239
|
+
def editor
|
240
|
+
frm.div(:class=>"portletBody").frame(:id, "revise:df_compose_description_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
|
241
|
+
end
|
242
|
+
|
243
|
+
def description=(text)
|
244
|
+
editor.send_keys(text)
|
245
|
+
end
|
246
|
+
|
247
|
+
def add_attachments
|
248
|
+
frm.button(:value=>/attachments/).click
|
249
|
+
ForumsAddAttachments.new(@browser)
|
250
|
+
end
|
251
|
+
|
252
|
+
def self.page_elements(identifier)
|
253
|
+
in_frame(identifier) do |frame|
|
254
|
+
text_field(:title, :id=>"revise:forum_title", :frame=>frame)
|
255
|
+
text_area(:short_description, :id=>"revise:forum_shortDescription", :frame=>frame)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
module AddEditTopicMethods
|
261
|
+
|
262
|
+
include PageObject
|
263
|
+
|
264
|
+
@@table_index=0
|
265
|
+
|
266
|
+
def editor
|
267
|
+
frm.div(:class=>"portletBody").frame(:id, "revise:topic_description_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
|
268
|
+
end
|
269
|
+
|
270
|
+
def description=(text)
|
271
|
+
editor.send_keys(text)
|
272
|
+
end
|
273
|
+
|
274
|
+
def save
|
275
|
+
frm.button(:value=>"Save").click
|
276
|
+
Forums.new(@browser)
|
277
|
+
end
|
278
|
+
|
279
|
+
def add_attachments
|
280
|
+
frm.button(:value=>/Add.+ttachment/).click
|
281
|
+
ForumsAddAttachments.new(@browser)
|
282
|
+
end
|
283
|
+
|
284
|
+
def roles
|
285
|
+
roles=[]
|
286
|
+
options = frm.select(:id=>"revise:role").options.to_a
|
287
|
+
options.each { |option| roles << option.text }
|
288
|
+
return roles
|
289
|
+
end
|
290
|
+
|
291
|
+
def site_role=(role)
|
292
|
+
frm.select(:id=>"revise:role").select(role)
|
293
|
+
0.upto(frm.select(:id=>"revise:role").length - 1) do |x|
|
294
|
+
if frm.div(:class=>"portletBody").table(:class=>"permissionPanel jsfFormTable lines nolines", :index=>x).visible?
|
295
|
+
@@table_index = x
|
296
|
+
|
297
|
+
def permission_level=(value)
|
298
|
+
frm.select(:id=>"revise:perm:#{@@table_index}:level").select(value)
|
299
|
+
end
|
300
|
+
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
def self.page_elements(identifier)
|
306
|
+
in_frame(identifier) do |frame|
|
307
|
+
text_field(:title, :id=>"revise:topic_title", :frame=>frame)
|
308
|
+
text_area(:short_description, :id=>"revise:topic_shortDescription", :frame=>frame)
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
# TODO: Determine where this should go and a better way to organize the code
|
314
|
+
class ForumsAddAttachments < AddFiles
|
315
|
+
|
316
|
+
def initialize(browser)
|
317
|
+
@browser = browser
|
318
|
+
|
319
|
+
@@classes = {
|
320
|
+
:this => "ForumsAddAttachments",
|
321
|
+
:parent => "AddEditTopic",
|
322
|
+
:second => "EditForum"
|
323
|
+
}
|
324
|
+
end
|
325
|
+
|
326
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Methods to extend the page-object gem...
|
2
|
+
module PageObject
|
3
|
+
module Elements
|
4
|
+
class Element
|
5
|
+
|
6
|
+
def disabled?
|
7
|
+
@element.disabled?
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Need this to extend Watir to be able to attach to Sakai's non-standard tags...
|
15
|
+
module Watir
|
16
|
+
class Element
|
17
|
+
# attaches to the "headers" tags inside of the assignments table.
|
18
|
+
def headers
|
19
|
+
@how = :ole_object
|
20
|
+
return @o.headers
|
21
|
+
end
|
22
|
+
|
23
|
+
# attaches to the "for" tags in "label" tags.
|
24
|
+
def for
|
25
|
+
@how = :ole_object
|
26
|
+
return @o.for
|
27
|
+
end
|
28
|
+
|
29
|
+
# attaches to the "summary" tag
|
30
|
+
def summary
|
31
|
+
@how = :ole_object
|
32
|
+
return @o.summary
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module GradebookMethods
|
2
|
+
|
3
|
+
def items_titles
|
4
|
+
titles = []
|
5
|
+
items_table = frm.table(:class=>"listHier lines nolines")
|
6
|
+
1.upto(items_table.rows.size-1) do |x|
|
7
|
+
titles << items_table.row(:index=>x).a(:index=>0).text
|
8
|
+
end
|
9
|
+
return titles
|
10
|
+
end
|
11
|
+
|
12
|
+
# Returns the value of the "Released to Students" column
|
13
|
+
# for the specified assignment title.
|
14
|
+
def released_to_students(assignment)
|
15
|
+
frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(assignment)}/)[4].text
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns the due date value for the specified assignment.
|
19
|
+
def due_date(assignment)
|
20
|
+
frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(assignment)}/)[3].text
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#================
|
2
|
+
# Gradebook2 Pages
|
3
|
+
#================
|
4
|
+
|
5
|
+
#
|
6
|
+
module Gradebook2Methods
|
7
|
+
include PageObject
|
8
|
+
# Returns an array of names of Gradebook items
|
9
|
+
def gradebook_items
|
10
|
+
items = []
|
11
|
+
frm.div(:class=>"x-grid3-scroller").spans.each do |span|
|
12
|
+
if span.class_name =~ /^x-tree3-node-text/
|
13
|
+
items << span.text
|
14
|
+
end
|
15
|
+
end
|
16
|
+
return items
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.page_elements(identifier)
|
20
|
+
in_frame(identifier) do |frame|
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|