Sha256: 2de52036e7fb0f563c8358b5608d8953a08c7d2c08ecae68ef8e8bda7cb94438

Contents?: true

Size: 1.81 KB

Versions: 7

Compression:

Stored size: 1.81 KB

Contents

  # this method adds a new  record
  def savevcardrecord 
  Dir.chdir($progdir) 
 require 'fileutils'
   require 'extras/vpim/maker/vcard'
   if ! @a_filename.empty?
   newname = "%s" %   [@a_filename] # grab the new filename to create
   
	 fullnewname = newname  + ".vcf"
       if ! @a_name.empty?
        contactnameText =  @a_name.to_s
     else
        contactnameText = @a_filename.to_s 
    end
     card = Vpim::Maker::Vcard.make(contactnameText) do |card|
     card.add_name do |name|
      name.family = contactnameText
      
    end
    if ! @a_address.empty?
    addressText = @a_address.to_s
    else
    addressText = " "
    end
      if ! @a_citystatezip.empty?
    localityText = @a_citystatezip.to_s
    else
    localityText = " "
    end
    
     card.add_addr do |addr|
    addr.preferred = true
    addr.location = 'home'
    addr.street = addressText
    addr.locality = localityText
    addr.country = 'rwdaddress'
    end
      if ! @a_phone.empty?
    phoneText = @a_phone.to_s
    else
    phoneText = " "
    end
    
    
     card.add_tel(phoneText) do |tel|
    tel.location = 'home'
    
  end
    if ! @a_email.empty?
    emailText = @a_email.to_s
    else
    emailText = " "
    end
  
  card.add_email(emailText) { |e| e.location = 'home' }
    
    
  

  end # end of vcard creation 
    
  end
  vCardString = card.to_s
    p vCardString
    
        begin # exception trapped block
          fileName = File.join($addressfiles_directory, fullnewname )
       	fd = File.open(fileName,"w")
	     fd.print( vCardString ) # save the record info to the file
	     fd.close
          @createnewnamerecorddisplay= vCardString # show the record info in the browser
        rescue SystemCallError, StandardError
          $stderr.print "system call error: " + $!
        end # exception rescue
    
  end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
bigtinker-0.93 code/superant.com.rwdaddresses/savevcardrecord.rb
bigtinker-0.94 code/superant.com.rwdaddresses/savevcardrecord.rb
bigtinker-0.96 code/superant.com.rwdaddresses/savevcardrecord.rb
rwdaddresses-1.02 code/superant.com.rwdaddresses/savevcardrecord.rb
rwdaddresses-1.04 code/superant.com.rwdaddresses/savevcardrecord.rb
rwdaddresses-1.03 code/superant.com.rwdaddresses/savevcardrecord.rb
rwdaddresses-1.05 code/superant.com.rwdaddresses/savevcardrecord.rb