class ADIWG::Mdtranslator::Writers::Html::Html_Contact

Public Class Methods

new(html) click to toggle source
# File lib/adiwg/mdtranslator/writers/html/sections/html_contact.rb, line 20
def initialize(html)
   @html = html
end

Public Instance Methods

writeHtml(hContact) click to toggle source
# File lib/adiwg/mdtranslator/writers/html/sections/html_contact.rb, line 24
def writeHtml(hContact)

   # classes used
   onlineClass = Html_OnlineResource.new(@html)
   graphicClass = Html_Graphic.new(@html)

   @html.details do
      @html.summary(hContact[:name], {'id' => 'CID_' + hContact[:contactId], 'class' => 'h3'})
      @html.section(:class => 'block') do

         # contact - contact ID
         unless hContact[:contactId].nil?
            @html.em('Contact ID: ')
            @html.text!(hContact[:contactId])
            @html.br
         end

         # contact - isOrganization
         @html.em('is Organization: ')
         @html.text!(hContact[:isOrganization].to_s)
         @html.br

         # contact - type
         unless hContact[:contactType].nil?
            @html.em('Contact Type: ')
            @html.text!(hContact[:contactType])
            @html.br
         end

         # contact - position
         unless hContact[:positionName].nil?
            @html.em('Position Name: ')
            @html.text!(hContact[:positionName])
            @html.br
         end

         # contact - member of organizations []
         hContact[:memberOfOrgs].each do |org|
            hMember = Html_Document.getContact(org)
            unless hMember.empty?
               @html.em('is Member of: ')
               @html.a(hMember[:name], 'href' => '#CID_'+hMember[:contactId])
               @html.br
            end
         end

         # contact - address
         hContact[:addresses].each do |hAddress|
            @html.details do
               @html.summary('Address', {'class' => 'h5'})
               @html.section(:class => 'block') do

                  # address - delivery points
                  hAddress[:deliveryPoints].each do |addLine|
                     @html.text!(addLine)
                     @html.br
                  end

                  # address - city, adminArea postalCode
                  unless hAddress[:city].nil?
                     @html.text!(hAddress[:city])
                  end
                  unless hAddress[:adminArea].nil?
                     @html.text!(', ' + hAddress[:adminArea])
                  end
                  unless hAddress[:postalCode].nil?
                     @html.text!(' ' + hAddress[:postalCode])
                  end
                  @html.br

                  # address - country
                  unless hAddress[:country].nil?
                     @html.text!(hAddress[:country])
                     @html.br
                  end

                  # address - type
                  hAddress[:addressTypes].each do |addType|
                     @html.em('Address Type: ')
                     @html.text!(addType)
                     @html.br
                  end

                  # address - description
                  if hAddress[:description]
                     @html.em('Description: ')
                     @html.text!(hAddress[:description])
                     @html.br
                  end

               end
            end
         end


         # contact - phones
         hContact[:phones].each do |hPhone|
            @html.details do
               @html.summary('Phone', {'class' => 'h5'})
               @html.section(:class => 'block') do

                  # phone - name
                  unless hPhone[:phoneName].nil?
                     @html.em('Phone Name: ')
                     @html.text!(hPhone[:phoneName])
                     @html.br
                  end

                  # phone - number
                  unless hPhone[:phoneNumber].nil?
                     @html.em('Phone Number: ')
                     @html.text!(hPhone[:phoneNumber])
                     @html.br
                  end

                  # phone - service types
                  unless hPhone[:phoneServiceTypes].empty?
                     @html.em('Service Types: ')
                     hPhone[:phoneServiceTypes].each do |phoneType|
                        @html.text!(phoneType + ' ')
                     end
                     @html.br
                  end

               end
            end
         end

         # contact - email []
         hContact[:eMailList].each do |email|
            @html.em('Electronic Mail: ')
            @html.text!(email)
            @html.br
         end

         # contact - online resource []
         hContact[:onlineResources].each do |hOnline|
            @html.details do
               @html.summary('Online Resource', {'class' => 'h5'})
               @html.section(:class => 'block') do
                  onlineClass.writeHtml(hOnline)
               end
            end
         end

         # contact - logos []
         hContact[:logos].each do |hLogo|
            @html.details do
               @html.summary('Logo Graphic', {'class' => 'h5'})
               @html.section(:class => 'block') do
                  graphicClass.writeHtml(hLogo)
               end
            end
         end

         # contact - hours of service []
         hContact[:hoursOfService].each do |hours|
            @html.em('Hours of Service: ')
            @html.text!(hours)
            @html.br
         end

         # contact - instructions
         unless hContact[:contactInstructions].nil?
            @html.em('Contact Instructions: ')
            @html.text!(hContact[:contactInstructions])
            @html.br
         end

      end
   end

end