Class: PortfolioSiteObject

Inherits:
Object
  • Object
show all
Includes:
DataFactory, DateFactory, Foundry, StringFactory, Workflows
Defined in:
lib/sambal-cle/data_objects/portfolio.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Workflows

menu_link, #open_my_site_by_name, #reset

Constructor Details

#initialize(browser, opts = {}) ⇒ PortfolioSiteObject

Returns a new instance of PortfolioSiteObject.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 13

def initialize(browser, opts={})
  @browser = browser
  
  defaults = {
    :title=>random_alphanums,
    :site_email=>random_nicelink(32),
    :participants=>{}
  }
  options = defaults.merge(opts)
  
  set_options(options)
  requires @title
end

Instance Attribute Details

#accessObject

Returns the value of attribute access.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def access
  @access
end

#contact_emailObject

Returns the value of attribute contact_email.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def contact_email
  @contact_email
end

#creation_dateObject

Returns the value of attribute creation_date.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def creation_date
  @creation_date
end

#creatorObject

Returns the value of attribute creator.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def creator
  @creator
end

#default_roleObject

Returns the value of attribute default_role.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def default_role
  @default_role
end

#descriptionObject

Returns the value of attribute description.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def description
  @description
end

#idObject

Returns the value of attribute id.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def id
  @id
end

#participantsObject

Returns the value of attribute participants.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def participants
  @participants
end

#short_descriptionObject

Returns the value of attribute short_description.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def short_description
  @short_description
end

#site_contact_nameObject

Returns the value of attribute site_contact_name.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def site_contact_name
  @site_contact_name
end

#site_emailObject

Returns the value of attribute site_email.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def site_email
  @site_email
end

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def status
  @status
end

#titleObject

Returns the value of attribute title.



9
10
11
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 9

def title
  @title
end

Instance Method Details

#add_official_participants(role, *participants) ⇒ Object



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
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 92

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.radio_button(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

#createObject



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
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 27

def create
  my_workspace
  site_setup
  on_page SiteSetup do |page|
    page.new
  end
  on SiteType do |page|
    # Select the Portfolio Site radio button
    page.portfolio_site.set
    page.continue
  end
  on PortfolioSiteInfo do |info|
    info.title.set @title
    info.description=@description unless @description==nil
    info.short_description.fit @short_description
    #TODO Add support for other fields here
    info.continue
  end
  on PortfolioSiteTools do |tools|
    # TODO Add support for individual tool selection and reuse of material from other sites
    tools.all_tools.set
    tools.continue
  end
  on PortfolioConfigureToolOptions do |options|
    options.email.set @site_email
    # TODO Add support for other fields here
    options.continue
  end
  on SiteAccess do |access|
    # TODO Support non-default selections here
    access.continue
  end
  on ConfirmSiteSetup do |confirm|
    if confirm.request_button.present?
      confirm.request_site
    else
      confirm.create_site
    end
  end
  # TODO: Add definition of @participants variable here
  # 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(@title))

    # Get the site id for storage
    @browser.frame(:class=>"portletMainIframe").link(:href=>/xsl-portal.site/, :index=>0).href =~ /(?<=\/site\/).+/
    @id = $~.to_s
  end
end

#deleteObject



88
89
90
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 88

def delete
  
end

#edit(opts = {}) ⇒ Object



79
80
81
82
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 79

def edit opts={}
  
  set_options(opts)
end

#viewObject



84
85
86
# File 'lib/sambal-cle/data_objects/portfolio.rb', line 84

def view
  
end