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.
Files changed (32) hide show
  1. data/kuali-sakai-common-lib.gemspec +4 -5
  2. data/lib/kuali-sakai-common-lib.rb +3 -2
  3. data/lib/kuali-sakai-common-lib/add_files.rb +260 -0
  4. data/lib/kuali-sakai-common-lib/announcements.rb +301 -0
  5. data/lib/kuali-sakai-common-lib/assessments.rb +1183 -0
  6. data/lib/kuali-sakai-common-lib/assignments.rb +861 -0
  7. data/lib/kuali-sakai-common-lib/basic_lti.rb +13 -0
  8. data/lib/kuali-sakai-common-lib/blogs.rb +23 -0
  9. data/lib/kuali-sakai-common-lib/calendar.rb +466 -0
  10. data/lib/kuali-sakai-common-lib/calendar_summary.rb +0 -0
  11. data/lib/kuali-sakai-common-lib/chat_room.rb +0 -0
  12. data/lib/{core-ext.rb → kuali-sakai-common-lib/core-ext.rb} +0 -0
  13. data/lib/kuali-sakai-common-lib/drop_box.rb +0 -0
  14. data/lib/kuali-sakai-common-lib/email_archive.rb +28 -0
  15. data/lib/kuali-sakai-common-lib/forums.rb +326 -0
  16. data/lib/kuali-sakai-common-lib/gem_ext.rb +36 -0
  17. data/lib/kuali-sakai-common-lib/gradebook.rb +23 -0
  18. data/lib/kuali-sakai-common-lib/gradebook2.rb +24 -0
  19. data/lib/kuali-sakai-common-lib/messages.rb +639 -0
  20. data/lib/kuali-sakai-common-lib/news.rb +8 -0
  21. data/lib/kuali-sakai-common-lib/polls.rb +77 -0
  22. data/lib/kuali-sakai-common-lib/post_em.rb +0 -0
  23. data/lib/kuali-sakai-common-lib/profile.rb +46 -0
  24. data/lib/kuali-sakai-common-lib/profile2.rb +360 -0
  25. data/lib/kuali-sakai-common-lib/resources_roster.rb +0 -0
  26. data/lib/kuali-sakai-common-lib/rwiki.rb +0 -0
  27. data/lib/kuali-sakai-common-lib/sections.rb +237 -0
  28. data/lib/kuali-sakai-common-lib/single_user.rb +0 -0
  29. data/lib/kuali-sakai-common-lib/site_statistics.rb +0 -0
  30. data/lib/kuali-sakai-common-lib/syllabus.rb +182 -0
  31. data/lib/{utilities.rb → kuali-sakai-common-lib/utilities.rb} +13 -2
  32. metadata +51 -8
@@ -0,0 +1,8 @@
1
+ module NewsMethods
2
+ include PageObject
3
+ def self.page_elements(identifier)
4
+ in_frame(identifier) do |frame|
5
+
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,77 @@
1
+ module PollsMethods
2
+ include PageObject
3
+ def add
4
+ frm.link(:text=>"Add").click
5
+ frm.frame(:id, "newpolldescr::input___Frame").td(:id, "xEditingArea").wait_until_present
6
+ AddEditPoll.new(@browser)
7
+ end
8
+
9
+ #
10
+ def edit(poll)
11
+
12
+ end
13
+
14
+ def questions
15
+ questions = []
16
+ frm.table(:id=>"sortableTable").rows.each do |row|
17
+ questions << row[0].link.text
18
+ end
19
+ return questions
20
+ end
21
+
22
+ # Returns an array containing the list of poll questions displayed.
23
+ def list
24
+ list = []
25
+ frm.table(:id=>"sortableTable").rows.each_with_index do |row, index|
26
+ next if index==0
27
+ list << row[0].link(:href=>/voteQuestion/).text
28
+ end
29
+ return list
30
+ end
31
+
32
+ def self.page_elements(identifier)
33
+ in_frame(identifier) do |frame|
34
+ end
35
+ end
36
+ end
37
+
38
+ module AddEditPollMethods
39
+ include PageObject
40
+ def additional_instructions=(text)
41
+ frm.frame(:id, "newpolldescr::input___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
42
+ end
43
+
44
+ def save_and_add_options
45
+ frm.button(:value=>"Save and add options").click
46
+ AddAnOption.new(@browser)
47
+ end
48
+
49
+ def save
50
+ frm.button(:value=>"Save").click
51
+ Polls.new(@browser)
52
+ end
53
+
54
+ def self.page_elements(identifier)
55
+ in_frame(identifier) do |frame|
56
+ text_field(:question, :id=>"new-poll-text", :frame=>frame)
57
+ end
58
+ end
59
+ end
60
+
61
+ module AddAnOptionMethods
62
+
63
+ def answer_option=(text)
64
+ frm.frame(:id, "optText::input___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
65
+ end
66
+
67
+ def save
68
+ frm.button(:value=>"Save").click
69
+ AddEditPoll.new(@browser)
70
+ end
71
+
72
+ def save_and_add_options
73
+ frm.button(:value=>"Save and add options").click
74
+ AddAnOption.new(@browser)
75
+ end
76
+
77
+ end
File without changes
@@ -0,0 +1,46 @@
1
+ module ProfileMethods
2
+
3
+ def edit_my_profile
4
+ frm.link(:text=>"Edit my Profile").click
5
+ EditProfile.new(@browser)
6
+ end
7
+
8
+ def show_my_profile
9
+ frm.link(:text=>"Show my Profile").click
10
+ Profile.new @browser
11
+ end
12
+
13
+ def photo
14
+ source = frm.image(:id=>"profileForm:image1").src
15
+ return source.split("/")[-1]
16
+ end
17
+
18
+ def email
19
+ frm.link(:id=>"profileForm:email").text
20
+ end
21
+
22
+ end
23
+
24
+ #
25
+ module EditProfileMethods
26
+ include PageObject
27
+ def save
28
+ frm.button(:value=>"Save").click
29
+ Profile.new(@browser)
30
+ end
31
+
32
+ def picture_file(filename, filepath="")
33
+ frm.file_field(:name=>"editProfileForm:uploadFile.uploadId").set(filepath + filename)
34
+ end
35
+
36
+ def self.page_elements(identifier)
37
+ in_frame(identifier) do |frame|
38
+ text_field(:first_name, :id=>"editProfileForm:first_name", :frame=>frame)
39
+ text_field(:last_name, :id=>"editProfileForm:lname", :frame=>frame)
40
+ text_field(:nickname, :id=>"editProfileForm:nickname", :frame=>frame)
41
+ text_field(:position, :id=>"editProfileForm:position", :frame=>frame)
42
+ text_field(:email, :id=>"editProfileForm:email", :frame=>frame)
43
+ radio_button(:upload_new_picture, :value=>"pictureUpload", :frame=>frame)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,360 @@
1
+ #================
2
+ # Profile2 Pages
3
+ #================
4
+
5
+ module Profile2Nav
6
+
7
+ def preferences
8
+ frm.link(:class=>"icon preferences").click
9
+ Profile2Preferences.new @browser
10
+ end
11
+
12
+ def privacy
13
+ frm.link(:text=>"Privacy").click
14
+ Profile2Privacy.new @browser
15
+ end
16
+
17
+ def my_profile
18
+ frm.link(:text=>"My profile").click
19
+ Profile2.new(@browser)
20
+ end
21
+
22
+ def connections
23
+ frm.link(:class=>"icon connections").click
24
+ Profile2Connections.new @browser
25
+ end
26
+
27
+ def pictures
28
+ frm.link(:text=>"Pictures").click
29
+ Profile2Pictures.new @browser
30
+ end
31
+
32
+ def messages
33
+ frm.link(:text=>"Messages").click
34
+ Profile2Messages.new @browser
35
+ end
36
+
37
+ def search_for_connections
38
+ frm.link(:class=>"icon search").click
39
+ Profile2Search.new @browser
40
+ end
41
+
42
+ end
43
+
44
+ module Profile2Methods
45
+ include PageObject
46
+ def edit_basic_info
47
+ frm.div(:id=>"mainPanel").span(:text=>"Basic Information").fire_event("onmouseover")
48
+ frm.div(:id=>"mainPanel").link(:href=>/myInfo:editButton/).click
49
+ sleep 0.5
50
+ Profile2.new @browser
51
+ end
52
+
53
+ def edit_contact_info
54
+ frm.div(:id=>"mainPanel").span(:text=>"Contact Information").fire_event("onmouseover")
55
+ frm.div(:id=>"mainPanel").link(:href=>/myContact:editButton/).click
56
+ sleep 0.5
57
+ Profile2.new @browser
58
+ end
59
+
60
+ def edit_staff_info
61
+ frm.div(:id=>"mainPanel").span(:text=>"Staff Information").fire_event("onmouseover")
62
+ frm.div(:id=>"mainPanel").link(:href=>/myStaff:editButton/).click
63
+ sleep 0.5
64
+ Profile2.new @browser
65
+ end
66
+
67
+ def edit_student_info
68
+ frm.div(:id=>"mainPanel").span(:text=>"Student Information").fire_event("onmouseover")
69
+ frm.div(:id=>"mainPanel").link(:href=>/myStudent:editButton/).click
70
+ sleep 0.5
71
+ Profile2.new @browser
72
+ end
73
+
74
+ def edit_social_networking
75
+ frm.div(:id=>"mainPanel").span(:text=>"Social Networking").fire_event("onmouseover")
76
+ frm.div(:id=>"mainPanel").link(:href=>/mySocialNetworking:editButton/).click
77
+ sleep 0.5
78
+ Profile2.new @browser
79
+ end
80
+
81
+ def edit_personal_info
82
+ frm.div(:id=>"mainPanel").span(:text=>"Personal Information").fire_event("onmouseover")
83
+ frm.div(:id=>"mainPanel").link(:href=>/myInterests:editButton/).click
84
+ sleep 0.5
85
+ Profile2.new @browser
86
+ end
87
+
88
+ def change_picture
89
+ frm.div(:id=>"myPhoto").fire_event("onmouseover")
90
+ frm.div(:id=>"myPhoto").link(:class=>"edit-image-button").click
91
+ sleep 0.5
92
+ Profile2.new @browser
93
+ end
94
+
95
+ # Enters the specified filename in the file field.
96
+ #
97
+ # Note that the file should be inside the data/sakai-cle-test-api folder.
98
+ # The file or folder name used for the filename variable
99
+ # should not include a preceding slash ("/") character.
100
+ def image_file=(filename)
101
+ frm.file_field(:name=>"picture").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
102
+ end
103
+
104
+ def upload
105
+ frm.button(:value=>"Upload").click
106
+ sleep 0.5
107
+ Profile2.new @browser
108
+ end
109
+
110
+ def personal_summary=(text)
111
+ frm.frame(:id=>"id1a_ifr").send_keys([:command, 'a'], :backspace)
112
+ frm.frame(:id=>"id1a_ifr").send_keys(text)
113
+ end
114
+
115
+ def birthday(day, month, year)
116
+ frm.text_field(:name=>"birthdayContainer:birthday").click
117
+ frm.select(:class=>"ui-datepicker-new-year").wait_until_present
118
+ frm.select(:class=>"ui-datepicker-new-year").select(year.to_i)
119
+ frm.select(:class=>"ui-datepicker-new-month").select(month)
120
+ frm.link(:text=>day.to_s).click
121
+ end
122
+
123
+ def save_changes
124
+ frm.button(:value=>"Save changes").click
125
+ Profile2.new @browser
126
+ end
127
+
128
+ # Returns the number (as a string) displayed next to
129
+ # the "Connections" link in the menu. If there are no
130
+ # connections then returns zero as a string object.
131
+ def connection_requests
132
+ begin
133
+ frm.link(:class=>/icon connections/).span(:class=>"new-items-count").text
134
+ rescue
135
+ return "0"
136
+ end
137
+ end
138
+
139
+ def self.page_elements(identifier)
140
+ in_frame(identifier) do |frame|
141
+ text_field(:say_something, :id=>"id1", :frame=>frame)
142
+ button(:say_it, :value=>"Say it", :frame=>frame)
143
+ # Basic Information
144
+ text_field(:nickname, :name=>"nicknameContainer:nickname", :frame=>frame)
145
+ # Contact Information
146
+ text_field(:email, :name=>"emailContainer:email", :frame=>frame)
147
+ text_field(:home_page, :name=>"homepageContainer:homepage", :frame=>frame)
148
+ text_field(:work_phone, :name=>"workphoneContainer:workphone", :frame=>frame)
149
+ text_field(:home_phone, :name=>"homephoneContainer:homephone", :frame=>frame)
150
+ text_field(:mobile_phone, :name=>"mobilephoneContainer:mobilephone", :frame=>frame)
151
+ text_field(:facsimile, :name=>"facsimileContainer:facsimile", :frame=>frame)
152
+ # Someday Staff Info fields should go here...
153
+
154
+ # Student Information
155
+ text_field(:degree_course, :name=>"courseContainer:course", :frame=>frame)
156
+ text_field(:subjects, :name=>"subjectsContainer:subjects", :frame=>frame)
157
+ # Social Networking
158
+
159
+ # Personal Information
160
+ text_area(:favorite_books, :name=>"booksContainer:favouriteBooks", :frame=>frame)
161
+ text_area(:favorite_tv_shows, :name=>"tvContainer:favouriteTvShows", :frame=>frame)
162
+ text_area(:favorite_movies, :name=>"moviesContainer:favouriteMovies", :frame=>frame)
163
+ text_area(:favorite_quotes, :name=>"quotesContainer:favouriteQuotes", :frame=>frame)
164
+ end
165
+ end
166
+ end
167
+
168
+ module Profile2PreferencesMethods
169
+ include PageObject
170
+ def save_settings
171
+ frm.button(:value=>"Save settings").click
172
+ Profile2Preferences.new(@browser)
173
+ end
174
+
175
+ def self.page_elements(identifier)
176
+ in_frame(identifier) do |frame|
177
+ end
178
+ end
179
+ end
180
+
181
+ #
182
+ module Profile2PrivacyMethods
183
+ include PageObject
184
+ def self.page_elements(identifier)
185
+ in_frame(identifier) do |frame|
186
+ select_list(:profile_image, :name=>"profileImageContainer:profileImage", :frame=>frame)
187
+ select_list(:basic_info, :name=>"basicInfoContainer:basicInfo", :frame=>frame)
188
+ select_list(:contact_info, :name=>"contactInfoContainer:contactInfo", :frame=>frame)
189
+ select_list(:staff_info, :name=>"staffInfoContainer:staffInfo", :frame=>frame)
190
+ select_list(:student_info, :name=>"studentInfoContainer:studentInfo", :frame=>frame)
191
+ select_list(:social_info, :name=>"socialNetworkingInfoContainer:socialNetworkingInfo", :frame=>frame)
192
+ select_list(:personal_info, :name=>"personalInfoContainer:personalInfo", :frame=>frame)
193
+ select_list(:view_connections, :name=>"myFriendsContainer:myFriends", :frame=>frame)
194
+ select_list(:see_status, :name=>"myStatusContainer:myStatus", :frame=>frame)
195
+ select_list(:view_pictures, :name=>"myPicturesContainer:myPictures", :frame=>frame)
196
+ select_list(:send_messages, :name=>"messagesContainer:messages", :frame=>frame)
197
+ select_list(:see_kudos_rating, :name=>"myKudosContainer:myKudos", :frame=>frame)
198
+ checkbox(:show_birth_year, :name=>"birthYearContainer:birthYear", :frame=>frame)
199
+ button(:save_settings, :value=>"Save settings", :frame=>frame)
200
+ end
201
+ end
202
+ end
203
+
204
+ #
205
+ module Profile2SearchMethods
206
+ include PageObject
207
+ def search_by_name_or_email
208
+ frm.button(:value=>"Search by name or email").click
209
+ sleep 0.5
210
+ Profile2Search.new(@browser)
211
+ end
212
+
213
+ def search_by_common_interest
214
+ frm.button(:value=>"Search by common interest").click
215
+ sleep 0.5
216
+ Profile2Search.new(@browser)
217
+ end
218
+
219
+ def add_as_connection(name)
220
+ frm.div(:class=>"search-result", :text=>/#{Regexp.escape(name)}/).link(:class=>"icon connection-add").click
221
+ frm.div(:class=>"modalWindowButtons").wait_until_present
222
+ frm.div(:class=>"modalWindowButtons").button(:value=>"Add connection").click
223
+ frm.div(:class=>"modalWindowButtons").wait_while_present
224
+ sleep 0.5
225
+ Profile2Search.new @browser
226
+ end
227
+
228
+ def view(name)
229
+ frm.link(:text=>name).click
230
+ Profile2View.new(@browser)
231
+ end
232
+
233
+ # Returns an array containing strings of the names of the users returned
234
+ # in the search.
235
+ def results
236
+ results = []
237
+ frm.div(:class=>"portletBody").spans.each do |span|
238
+ if span.class_name == "search-result-info-name"
239
+ results << span.text
240
+ end
241
+ end
242
+ return results
243
+ end
244
+
245
+ def clear_results
246
+ frm.button(:value=>"Clear results").click
247
+ Profile2Search.new(@browser)
248
+ end
249
+
250
+ def self.page_elements(identifier)
251
+ in_frame(identifier) do |frame|
252
+ text_field(:persons_name_or_email, :name=>"searchName", :frame=>frame)
253
+ text_field(:common_interest, :name=>"searchInterest", :frame=>frame)
254
+ end
255
+ end
256
+ end
257
+
258
+ #
259
+ module Profile2ConnectionsMethods
260
+ include PageObject
261
+ def confirm_request(name)
262
+ frm.div(:class=>"connection", :text=>name).link(:title=>"Confirm connection request").click
263
+ frm.div(:class=>"modalWindowButtons").wait_until_present
264
+ frm.div(:class=>"modalWindowButtons").button(:value=>"Confirm connection request").click
265
+ frm.div(:class=>"modalWindowButtons").wait_while_present
266
+ sleep 0.5
267
+ Profile2Connections.new @browser
268
+ end
269
+
270
+ # Returns an array containing the names of the connected users.
271
+ def connections
272
+ results = []
273
+ frm.div(:class=>"portletBody").spans.each do |span|
274
+ if span.class_name == "connection-info-name"
275
+ results << span.text
276
+ end
277
+ end
278
+ return results
279
+ end
280
+
281
+ def self.page_elements(identifier)
282
+ in_frame(identifier) do |frame|
283
+ end
284
+ end
285
+ end
286
+
287
+ #
288
+ module Profile2ViewMethods
289
+
290
+ #
291
+ def connection
292
+ frm.div(:class=>"leftPanel").span(:class=>/instruction icon/).text
293
+ end
294
+
295
+ #
296
+ def basic_information
297
+ hash = {}
298
+ begin
299
+ frm.div(:class=>"mainSection", :text=>/Basic Information/).table(:class=>"profileContent").rows.each do |row|
300
+ hash.store(row[0].text, row[1].text)
301
+ end
302
+ rescue Watir::Exception::UnknownObjectException
303
+
304
+ end
305
+ return hash
306
+ end
307
+
308
+ #
309
+ def contact_information
310
+ hash = {}
311
+ begin
312
+ frm.div(:class=>"mainSection", :text=>/Contact Information/).table(:class=>"profileContent").rows.each do |row|
313
+ hash.store(row[0].text, row[1].text)
314
+ end
315
+ rescue Watir::Exception::UnknownObjectException
316
+
317
+ end
318
+ return hash
319
+ end
320
+
321
+ #
322
+ def staff_information
323
+ hash = {}
324
+ begin
325
+ frm.div(:class=>"mainSection", :text=>/Staff Information/).table(:class=>"profileContent").rows.each do |row|
326
+ hash.store(row[0].text, row[1].text)
327
+ end
328
+ rescue Watir::Exception::UnknownObjectException
329
+
330
+ end
331
+ return hash
332
+ end
333
+
334
+ #
335
+ def student_information
336
+ hash = {}
337
+ begin
338
+ frm.div(:class=>"mainSection", :text=>/Student Information/).table(:class=>"profileContent").rows.each do |row|
339
+ hash.store(row[0].text, row[1].text)
340
+ end
341
+ rescue Watir::Exception::UnknownObjectException
342
+
343
+ end
344
+ return hash
345
+ end
346
+
347
+ #
348
+ def personal_information
349
+ hash = {}
350
+ begin
351
+ frm.div(:class=>"mainSection", :text=>/Personal Information/).table(:class=>"profileContent").rows.each do |row|
352
+ hash.store(row[0].text, row[1].text)
353
+ end
354
+ rescue Watir::Exception::UnknownObjectException
355
+
356
+ end
357
+ return hash
358
+ end
359
+
360
+ end