Class: AastraXmlApi::PhoneInputScreenEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/aastra_xml_api/phone_input_screen_entry.rb

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ PhoneInputScreenEntry

Create new input field as a given type. The type can be one of IP, string (default), number, timeUS, timeInt, dateUS, or dateInt.



24
25
26
27
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 24

def initialize(type)
  @type = type
  @softkeys = []
end

Instance Method Details

#addSoftkey(index, label, uri, icon = nil) ⇒ Object

Adds softkey to be displayed when editing this field.



66
67
68
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 66

def addSoftkey(index, label, uri, icon=nil)
  @softkeys += [PhoneSoftkeyEntry.new(index, label, uri, icon)]
end

#renderObject

Create XML text output for this entry.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 71

def render
  xml = "<InputField"
  xml += " type=\"#{@type}\"" if not @type.nil?
  xml += " password=\"yes\"" if @password == "yes"
  xml += " editable=\"yes\"" if @editable == "yes"
  xml += ">\n"
  xml += "<Prompt>#{@prompt}</Prompt>\n" if not @prompt.nil?
  xml += "<Parameter>#{@parameter}</Parameter>\n" if not @parameter.nil?
  xml += "<Selection>#{@selection}</Selection>\n" if not @selection.nil?
  xml += "<Default>#{@default}</Default>\n" if not @default.nil?
  @softkeys.each { |softkey| xml += softkey.render }
  xml += "</InputField>\n"
  return xml
end

#setDefault(default) ⇒ Object

Set default value to load this field with.



55
56
57
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 55

def setDefault(default)
  @default = default
end

#setEditableObject

Make this input field editable, i.e. not read only.



40
41
42
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 40

def setEditable
  @editable = "yes"
end

#setParameter(parameter) ⇒ Object

Set paramter name value to be used to identify this field on submit.



45
46
47
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 45

def setParameter(parameter)
  @parameter = parameter
end

#setPasswordObject

Set this input field as a password field masked by “*” characters.



35
36
37
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 35

def setPassword
  @password = "yes"
end

#setPrompt(prompt) ⇒ Object

Set prompt to be displayed to let user know what this field is for.



50
51
52
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 50

def setPrompt(prompt)
  @prompt = prompt
end

#setSelection(selection) ⇒ Object

The contents of this will be added when the submit key is pressed while editing this field.



61
62
63
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 61

def setSelection(selection)
  @selection = selection
end

#setType(type) ⇒ Object

Set the type (see initialize for values) of this input field.



30
31
32
# File 'lib/aastra_xml_api/phone_input_screen_entry.rb', line 30

def setType(type)
  @type = type
end