class AastraXmlApi::PhoneTextMenu
Public Instance Methods
addEntry(name, url, selection=nil, icon=nil, dial=nil)
click to toggle source
Add a menu entry with name displayed and calls url when selected. The selection option is the value appended to a custom softkey URL when this item is highlighted. icon is a reference to an included icon that is shown with the menu entry. dial is what is called when the user hits a softkey with the URI “SoftKey:Dial2”.
# File lib/aastra_xml_api/phone_text_menu.rb, line 84 def addEntry(name, url, selection=nil, icon=nil, dial=nil) @entries += [PhoneTextMenuEntry.new(name, url, selection, icon, dial)] end
natsortByName()
click to toggle source
Use natural order sorting to sort the menu by name.
# File lib/aastra_xml_api/phone_text_menu.rb, line 94 def natsortByName tmparray = [] linklist = {} for i in 0..@entries.size-1 tmparray += [@entries[i].getName] linklist[@entries[i].getName] = i end tmparray.extend(ArrayExtension) tmparray.natsort! newentries = [] tmparray.each do |name| newentries += [@entries[linklist[name]]] end @entries = newentries end
render()
click to toggle source
Create XML text output.
# File lib/aastra_xml_api/phone_text_menu.rb, line 111 def render @maxitems = 30 if @maxitems.nil? xml = "<AastraIPPhoneTextMenu" xml += " destroyOnExit=\"yes\"" if @destroyOnExit == "yes" xml += " cancelAction=\"#{escape(@cancelAction)}\"" if not @cancelAction.nil? xml += " defaultIndex=\"#{@defaultIndex}\"" if not @defaultIndex.nil? xml += " style=\"#{@style}\"" if not @style.nil? xml += " Beep=\"yes\"" if @beep == "yes" xml += " LockIn=\"yes\"" if @lockin == "yes" xml += " wrapList=\"yes\"" if @wraplist == "yes" xml += " allowAnswer=\"yes\"" if @allowAnswer == "yes" xml += " Timeout=\"#{@timeout}\"" if @timeout != 0 xml += ">\n" if not @title.nil? then xml += "<Title" xml += " wrap=\"yes\"" if @title_wrap == "yes" xml += ">#{escape(@title)}</Title>\n" end index = 0 @entries.each do |entry| xml += entry.render if index < @maxitems index += 1 end @softkeys.each { |softkey| xml += softkey.render } iconList = 0 @icons.each do |icon| if iconList == 0 then xml += "<IconList>\n" iconList = 1 end xml += icon.render end xml += "</IconList>\n" if iconList != 0 xml += "</AastraIPPhoneTextMenu>\n" return xml end
setDefaultIndex(defaultIndex)
click to toggle source
Sets the default index to highlight when first shown.
# File lib/aastra_xml_api/phone_text_menu.rb, line 70 def setDefaultIndex(defaultIndex) @defaultIndex = defaultIndex end
setStyle(style)
click to toggle source
Set the style to one of numbered (default), none, or radio.
# File lib/aastra_xml_api/phone_text_menu.rb, line 75 def setStyle(style) @style = style end
setWrapList()
click to toggle source
Allows entries in the list to wrap.
# File lib/aastra_xml_api/phone_text_menu.rb, line 89 def setWrapList @wraplist = "yes" end