Module: MessagesMethods

Defined in:
lib/kuali-sakai-common-lib/messages.rb

Overview

The Messages page for a Site

Instance Method Summary collapse

Instance Method Details

#compose_messageObject

Clicks the Compose Message button, then instantiates the ComposeMessage class.



11
12
13
14
15
# File 'lib/kuali-sakai-common-lib/messages.rb', line 11

def compose_message
  frm.link(:text=>"Compose Message").click
  sleep 1 #FIXME
  ComposeMessage.new(@browser)
end

#deletedObject



27
28
29
30
# File 'lib/kuali-sakai-common-lib/messages.rb', line 27

def deleted
  frm.link(:text=>"Deleted").click
  MessagesDeletedList.new(@browser)
end

#draftObject



32
33
34
35
# File 'lib/kuali-sakai-common-lib/messages.rb', line 32

def draft
  frm.link(:text=>"Draft").click
  MessagesDraftList.new(@browser)
end

#folder_settings(folder_name) ⇒ Object



76
77
78
79
# File 'lib/kuali-sakai-common-lib/messages.rb', line 76

def folder_settings(folder_name)
  frm.table(:class=>"hierItemBlockWrapper").row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>"Folder Settings").click
  MessageFolderSettings.new(@browser)
end

#foldersObject

Gets all the folder names



69
70
71
72
73
74
# File 'lib/kuali-sakai-common-lib/messages.rb', line 69

def folders
  links = frm.table(:class=>"hierItemBlockWrapper").links.find_all { |link| link.title != /Folder Settings/ }
  folders = []
  links.each { |link| folders << link.text }
  return folders
end

#new_folderObject



42
43
44
45
# File 'lib/kuali-sakai-common-lib/messages.rb', line 42

def new_folder
  frm.link(:text=>"New Folder").click
  MessagesNewFolder.new(@browser)
end

#open_folder(foldername) ⇒ Object



37
38
39
40
# File 'lib/kuali-sakai-common-lib/messages.rb', line 37

def open_folder(foldername)
  frm.link(:text=>foldername).click
  FolderList.new(@browser)
end

#receivedObject



17
18
19
20
# File 'lib/kuali-sakai-common-lib/messages.rb', line 17

def received
  frm.link(:text=>"Received").click
  MessagesReceivedList.new(@browser)
end

#sentObject



22
23
24
25
# File 'lib/kuali-sakai-common-lib/messages.rb', line 22

def sent
  frm.link(:text=>"Sent").click
  MessagesSentList.new(@browser)
end

#settingsObject



47
48
49
50
# File 'lib/kuali-sakai-common-lib/messages.rb', line 47

def settings
  frm.link(:text=>"Settings").click
  MessagesSettings.new(@browser)
end

#total_messages_in_folder(folder_name) ⇒ Object

Gets the count of messages in the specified folder and returns it as a string



55
56
57
58
# File 'lib/kuali-sakai-common-lib/messages.rb', line 55

def total_messages_in_folder(folder_name)
  frm.table(:id=>"msgForum:_id23:0:privateForums").row(:text=>/#{Regexp.escape(folder_name)}/).span(:class=>"textPanelFooter", :index=>0).text =~ /\d+/
  return $~.to_s
end

#unread_messages_in_folder(folder_name) ⇒ Object

Gets the count of unread messages in the specified folder and returns it as a string



63
64
65
66
# File 'lib/kuali-sakai-common-lib/messages.rb', line 63

def unread_messages_in_folder(folder_name)
  frm.table(:id=>"msgForum:_id23:0:privateForums").row(:text=>/#{Regexp.escape(folder_name)}/).span(:text=>/unread/).text =~ /\d+/
  return $~.to_s
end