Class: CourseSiteObject
- Inherits:
-
Object
- Object
- CourseSiteObject
- Includes:
- DataFactory, DateFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/course.rb
Instance Attribute Summary collapse
-
#authorizer ⇒ Object
Returns the value of attribute authorizer.
-
#course ⇒ Object
Returns the value of attribute course.
-
#creation_date ⇒ Object
Returns the value of attribute creation_date.
-
#description ⇒ Object
Returns the value of attribute description.
-
#email ⇒ Object
Returns the value of attribute email.
-
#id ⇒ Object
Returns the value of attribute id.
-
#joiner_role ⇒ Object
Returns the value of attribute joiner_role.
-
#name ⇒ Object
Returns the value of attribute name.
-
#participants ⇒ Object
Returns the value of attribute participants.
-
#section ⇒ Object
Returns the value of attribute section.
-
#short_description ⇒ Object
Returns the value of attribute short_description.
-
#site_contact_email ⇒ Object
Returns the value of attribute site_contact_email.
-
#site_contact_name ⇒ Object
Returns the value of attribute site_contact_name.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#term ⇒ Object
Returns the value of attribute term.
-
#term_value ⇒ Object
Returns the value of attribute term_value.
-
#web_content_source ⇒ Object
Returns the value of attribute web_content_source.
-
#web_content_title ⇒ Object
Returns the value of attribute web_content_title.
Instance Method Summary collapse
- #add_official_participants(role, *participants) ⇒ Object
- #create ⇒ Object
- #create_and_reuse_site(site_name) ⇒ Object
- #duplicate(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ CourseSiteObject
constructor
A new instance of CourseSiteObject.
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ CourseSiteObject
Returns a new instance of CourseSiteObject.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sambal-cle/data_objects/course.rb', line 13 def initialize(browser, opts={}) @browser = browser defaults = { :subject => random_alphanums(8), :course => random_alphanums(8), :section => random_alphanums(8), :authorizer => "admin", :web_content_title => random_alphanums(15), :web_content_source => "http://www.rsmart.com", :email=>random_nicelink(32), :joiner_role => "Student", :description => random_alphanums(30), :short_description => random_alphanums, :site_contact_name => random_alphanums(5)+" "+random_alphanums(8), :participants=>{} } = defaults.merge(opts) () end |
Instance Attribute Details
#authorizer ⇒ Object
Returns the value of attribute authorizer.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def @authorizer end |
#course ⇒ Object
Returns the value of attribute course.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def course @course end |
#creation_date ⇒ Object
Returns the value of attribute creation_date.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def creation_date @creation_date end |
#description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def description @description end |
#email ⇒ Object
Returns the value of attribute email.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def email @email end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def id @id end |
#joiner_role ⇒ Object
Returns the value of attribute joiner_role.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def joiner_role @joiner_role end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def name @name end |
#participants ⇒ Object
Returns the value of attribute participants.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def participants @participants end |
#section ⇒ Object
Returns the value of attribute section.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def section @section end |
#short_description ⇒ Object
Returns the value of attribute short_description.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def short_description @short_description end |
#site_contact_email ⇒ Object
Returns the value of attribute site_contact_email.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def site_contact_email @site_contact_email end |
#site_contact_name ⇒ Object
Returns the value of attribute site_contact_name.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def site_contact_name @site_contact_name end |
#subject ⇒ Object
Returns the value of attribute subject.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def subject @subject end |
#term ⇒ Object
Returns the value of attribute term.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def term @term end |
#term_value ⇒ Object
Returns the value of attribute term_value.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def term_value @term_value end |
#web_content_source ⇒ Object
Returns the value of attribute web_content_source.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def web_content_source @web_content_source end |
#web_content_title ⇒ Object
Returns the value of attribute web_content_title.
9 10 11 |
# File 'lib/sambal-cle/data_objects/course.rb', line 9 def web_content_title @web_content_title end |
Instance Method Details
#add_official_participants(role, *participants) ⇒ Object
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/sambal-cle/data_objects/course.rb', line 261 def add_official_participants(role, *participants) list_of_ids=participants.join("\n") open_my_site_by_name @title site_editor on SiteEditor do |site| site.add_participants end on SiteSetupAddParticipants do |add| add.official_participants.set list_of_ids add.continue end on SiteSetupChooseRole do |choose| choose.(role).set choose.continue end on SiteSetupParticipantEmail do |send| send.continue end on SiteSetupParticipantConfirm do |confirm| confirm.finish end if @participants.has_key?(role) @participants[role].insert(-1, participants).flatten! else @participants.store(role, participants) end end |
#create ⇒ Object
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 |
# File 'lib/sambal-cle/data_objects/course.rb', line 34 def create my_workspace site_setup on_page SiteSetup do |page| page.new end on SiteType do |page| # Select the Course Site radio button page.course_site.set # Store the selected term value for use later # TODO: Add logic here in case we want to actually SET the term value instead. @term_value = page.academic_term.value @term = page.academic_term.[0].text page.continue end on CourseSectionInfo do |page| # Fill in those fields, storing the entered values for later verification steps page.subject.set @subject page.course.set @course page.section.set @section # Store site name for ease of coding and readability later @name = "#{@subject} #{@course} #{@section} #{@term_value}" # Add a valid instructor id page..set @authorizer # Click continue button page.continue end on CourseSiteInfo do |page| page.short_description.set @short_description page.site_contact_name.set @site_contact_name page.site_contact_email.set @site_contact_email page.enter_source_text page.editor, @description # Click Continue page.continue end on EditSiteTools do |page| #Check All Tools page.all_tools.set page.continue end on AddMultipleTools do |add_tools| add_tools.site_email_address.set @email add_tools.web_content_title.set @web_content_title add_tools.web_content_source.set @web_content_source add_tools.continue end on SiteAccess do |access| access.allow.set access.joiner_role.select @joiner_role access.continue end on ConfirmSiteSetup do |review| review.request_site end # Create a string that will match the new Site's "creation date" string @creation_date = right_now[:sakai] on SiteSetup do |site_setup| site_setup.search(Regexp.escape(@subject)) # Get the site id for storage @browser.frame(:class=>"portletMainIframe").link(:href=>/xsl-portal.site/, :index=>0).href =~ /(?<=\/site\/).+/ @id = $~.to_s end end |
#create_and_reuse_site(site_name) ⇒ Object
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 |
# File 'lib/sambal-cle/data_objects/course.rb', line 108 def create_and_reuse_site(site_name) my_workspace site_setup on_page SiteSetup do |page| page.new end on SiteType do |site_type| # Select the Course Site radio button site_type.course_site.set # Store the selected term value for use later @term = site_type.academic_term.value # Click continue site_type.continue end on CourseSectionInfo do |course_section| # Fill in those fields, storing the entered values for later verification steps course_section.subject.set @subject course_section.course.set @course course_section.section.set @section # Store site name for ease of coding and readability later @name = "#{@subject} #{@course} #{@section} #{@term_value}" # Add a valid instructor id course_section..set @authorizer # Click continue button course_section.continue end on CourseSiteInfo do |course_site| course_site.enter_source_text course_site.editor, @description course_site.short_description.set @short_description # Click Continue course_site.continue end on EditSiteTools do |course_tools| #Check All Tools course_tools.all_tools.set course_tools.yes.set course_tools.import_sites.select site_name course_tools.continue end on_page ReUseMaterial do |page| page.announcements_checkbox.set page.calendar_checkbox.set page.discussion_forums_checkbox.set page.forums_checkbox.set page.chat_room_checkbox.set page.polls_checkbox.set page.syllabus_checkbox.set page.lessons_checkbox.set page.resources_checkbox.set page.assignments_checkbox.set page.tests_and_quizzes_checkbox.set page.gradebook_checkbox.set page.gradebook2_checkbox.set page.wiki_checkbox.set page.news_checkbox.set page.web_content_checkbox.set page.site_statistics_checkbox.set page.continue end on_page AddMultipleTools do |page| page.site_email_address.set @email page.web_content_title.set @web_content_title page.web_content_source.set @web_content_source page.continue end on_page SiteAccess do |page| page.allow.set page.joiner_role.select @joiner_role page.continue end on_page ConfirmSiteSetup do |page| page.request_site end # Create a string that will match the new Site's "creation date" string @creation_date = make_date(Time.now) on_page SiteSetup do |page| page.search(Regexp.escape(@subject)) end # Get the site id for storage @browser.frame(:class=>"portletMainIframe").link(:href=>/xsl-portal.site/, :index=>0).href =~ /(?<=\/site\/).+/ @id = $~.to_s end |
#duplicate(opts = {}) ⇒ Object
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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/sambal-cle/data_objects/course.rb', line 201 def duplicate opts={} defaults = { :name => random_alphanums, :term => @term, :subject => @subject, :course => @course, :section => @section, :authorizer => @authorizer, :web_content_title => @web_content_title, :web_content_source => @web_content_source, :email=>@email, :joiner_role => @joiner_role, :description => @description, :short_description => @short_description, :site_contact_name => @site_contact_name, :site_contact_email => @site_contact_email } = defaults.merge(opts) new_site = make CourseSiteObject, new_site.name=[:name] new_site.subject=[:subject] new_site.course=[:course] new_site.section=[:section] new_site.=[:authorizer] new_site.web_content_source=[:web_content_source] new_site.email=[:email] new_site.joiner_role=[:joiner_role] new_site.web_content_title=[:web_content_title] new_site.description=[:description] new_site.short_description=[:short_description] new_site.site_contact_name=[:site_contact_name] new_site.site_contact_email=[:site_contact_email] new_site.term=[:term] open_my_site_by_name @site site_editor on SiteEditor do |edit| edit.duplicate_site end on DuplicateSite do |dupe| dupe.site_title.set new_site.name dupe.academic_term.select new_site.term dupe.duplicate end my_workspace site_setup on SiteSetup do |sites| sites.search(Regexp.escape(new_site.name)) end # Get the site id for storage @browser.frame(:class=>"portletMainIframe").link(:href=>/xsl-portal.site/, :index=>0).href =~ /(?<=\/site\/).+/ new_site.id = $~.to_s new_site end |