12 Replies Latest reply on Aug 26, 2014 5:31 AM by Kutir Mobility

    We are developing an app - it is my task to get the app to put events in the calender of the phones using our app. Where do I start? What do I need to do?

    Anny Wink

      What be great to get some help on this.

        • Re: We are developing an app - it is my task to get the app to put events in the calender of the phones using our app. Where do I start? What do I need to do?
          Anny Wink

          Any Chance that this makes sense for you:

           

          I tried the links and therefore made the autorization work & then defined hashes etc in the end the calender should have safed them, like that (the autorization is missing) :-) thx

           

           

          build.yml file   capabilities:
               - calendar

           

           

          System::get_property('has_calendar')

           

          created_event = Rho::RhoEvent.create!(@params['event'])

          #Hashes: Temine definieren

           

          # als Events deklarieren

          events = dict = {}

          dict = {}  # create a new dictionary

          dict['06.11.2014 13:30 - 15:30'] = 'Eröffnungsplenum, im Lichthof'    #associate the key '06.11.2014 13:30 - 15:30 to the value 'Eröffnungsplenum'

          dict['06.11.2014 15:45 - 17:00'] = 'Ersti-/Profiworkshop, im Lichthof/ Raum XYZf'

          dict['06.11.2014 17:00 - 18:15'] = 'Abendessen, in der Mensa'

          dict['06.11.2014 18:30 - 20:00'] = 'Check-In im Host, im Hostell'

          dict['06.11.2014 20:00 - 22:00'] = 'Kennenlernspiele, Treffen beim Niedersachsensaal'

          dict['06.11.2014 22.00 - 05:00'] = 'Party, im Dax'

          p dict['06.11.2014 13:30 - 15:30'] = 'Eröffnungsplenum, im Lichthof'   #prints "Eröffnungsplenum, im Lichthof"

          p dict['06.11.2014 15:45 - 17:00'] = 'Ersti-/Profiworkshop, im Lichthof/ Raum XYZf'

          p dict['06.11.2014 17:00 - 18:15'] = 'Abendessen, in der Mensa'

          p dict['06.11.2014 18:30 - 20:00'] = 'Check-In im Host, im Hostell'

          p dict['06.11.2014 20:00 - 22:00'] = 'Kennenlernspiele, Treffen beim Niedersachsensaal'

          p dict['06.11.2014 22.00 - 05:00'] = 'Party, im Dax'

           

          h.fetch:['06.11.2014 13:30 - 15:30'] = 'Eröffnungsplenum, im Lichthof'

           

          safe dict = {}

           

           

          Rho::RhoEvent.update_attributes(@params['event'])

            • Re: We are developing an app - it is my task to get the app to put events in the calender of the phones using our app. Where do I start? What do I need to do?
              Kutir Mobility

              Hi Anny

              Is it possible for you to share the source code of the app so that we can try it locally and give our tips/feedback.

              Thanks

              Visnupriya

              Kutir Mobility

                • Re: We are developing an app - it is my task to get the app to put events in the calender of the phones using our app. Where do I start? What do I need to do?
                  Anny Wink

                  this is the index file of the calendar:

                   

                  System::get_property('has_calendar')

                   

                  # Termine als Hash definieren

                  temp_event_hash = {

                    :title         => "Eröffnungsplenum",

                    :location      => "Lichthof",

                    :notes         => " "

                    :start_date    => Time.new(2014, 11, 6, 13, 30, 00, "+02:00"),

                    :end_date      => Time.new(2014, 11, 6, 15, 30, 00, "+02:00"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                     # (iPhone and Android only)

                    :organizer     => "FSR Hannover",            # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",          # (iPhone and Android only)

                    :last_modified => Time.now                   # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                  temp_event_hash = {

                    :title         => "Ersti-/Profiworkshop",

                    :location      => "Lichthof/ Raum XYZ",

                    :notes         => ""

                    :start_date    => Time.new(2014, 11, 6, 15, 45, 00, "+01:15"),

                    :end_date      => Time.new(2014, 11, 6, 17, 00, 00, "+01:15"),

                    :recurrence    => { :recurrence => false }, 

                    :canceled      => false,                           

                    :organizer     => "FSR Hannover",            

                    :attendees     => "BuFaK Hannover",       

                    :last_modified => Time.now 

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Abendessen in der Mensa",

                    :location => "Mensa",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 6, 17, 00, 00, "+01:15"),

                    :end_date      => Time.new(2014, 11, 6, 18, 15, 00, "+01:15"),

                    :recurrence    => { :recurrence => false }, 

                    :canceled      => false,                          

                    :organizer     => "FSR Hannover",            

                    :attendees     => "BuFaK Hannover",       

                    :last_modified => Time.now

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Check-In im Hostel",

                    :location => "Hostel",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 6, 18, 30, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 6, 20, 00, 00, "+01:30"),

                    :recurrence    => { :recurrence => false },

                    :canceled      => false,                      

                    :organizer     => "FSR Hannover",            

                    :attendees     => "BuFaK Hannover",

                    :last_modified => Time.now 

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Kennenlernen",

                    :location => "Treffen beim Niedersachsen-Saal",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 6, 20, 00, 00, "+02:00"),

                    :end_date      => Time.new(2014, 11, 6, 22, 00, 00, "+02:00"),

                    :recurrence    => { :recurrence => false }, 

                    :canceled      => false,                           

                    :organizer     => "FSR Hannover",            

                    :attendees     => "BuFaK Hannover",       

                    :last_modified => Time.now

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Party",

                    :location => "DAX",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 6, 22, 00, 00, "+07:00"),

                    :end_date      => Time.new(2014, 11, 7, 05, 00, 00, "+07:00"),

                    :recurrence    => { :recurrence => false },

                    :canceled      => false,                          

                    :organizer     => "FSR Hannover",            

                    :attendees     => "BuFaK Hannover",       

                    :last_modified => Time.now 

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Frühstück",

                    :location => "Hostel",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 7, 07, 00, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 7, 08, 30, 00, "+01:30"),

                    :recurrence    => { :recurrence => false },

                    :canceled      => false,                           

                    :organizer     => "FSR Hannover",            

                    :attendees     => "BuFaK Hannover",      

                    :last_modified => Time.now 

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Workshop I",

                    :location => "siehe Workshopübersicht",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 7, 09, 15, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 7, 10, 45, 00, "+01:30"),

                    :recurrence    => { :recurrence => false }, 

                    :canceled      => false,                        

                    :organizer     => "FSR Hannover",     

                    :attendees     => "BuFaK Hannover",  

                    :last_modified => Time.now

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Zwischenplenum",

                    :location => "1507-201",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 7, 11, 00, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 7, 12, 30, 00, "+01:30"),

                    :recurrence    => { :recurrence => false },

                    :canceled      => false,                

                    :organizer     => "FSR Hannover",   

                    :attendees     => "BuFaK Hannover",

                    :last_modified => Time.now

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Mittagessen",

                    :location => "Mensa",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 7, 12, 30, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 7, 14, 00, 00, "+01:30"),

                    :recurrence    => { :recurrence => false },

                    :canceled      => false,                           

                    :organizer     => "FSR Hannover",     

                    :attendees     => "BuFaK Hannover",

                    :last_modified => Time.now 

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Workshop II",

                    :location => "siehe Workshopübersicht",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 7, 14, 15, 00, "+01:45"),

                    :end_date      => Time.new(2014, 11, 7, 16, 00, 00, "+01:45"),

                    :recurrence    => { :recurrence => false }, 

                    :canceled      => false,                 

                    :organizer     => "FSR Hannover",            

                    :attendees     => "BuFaK Hannover",     

                    :last_modified => Time.now

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "flexible Diskussionsphase",

                    :location => "siehe Aushang Niedersachsen-Saal",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 7, 16, 15, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 7, 17, 45, 00, "+01:30"),

                    :recurrence    => { :recurrence => false }, 

                    :canceled      => false,                 

                    :organizer     => "FSR Hannover",     

                    :attendees     => "BuFaK Hannover",   

                    :last_modified => Time.now

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Abendessen",

                    :location => "Mensa",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 7, 18, 00, 00, "+01:15"),

                    :end_date      => Time.new(2014, 11, 7, 19, 15, 00, "+01:15"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Stadttour, Freizeit, Diskussionszeit",

                    :location => "Treffen am Niedersachsen-Saal",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 7, 20, 00, 00, "+02:00"),

                    :end_date      => Time.new(2014, 11, 7, 22, 00, 00, "+02:00"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Party",

                    :location => "Mambo",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 7, 22, 00, 00, "+07:00"),

                    :end_date      => Time.new(2014, 11, 8, 05, 00, 00, "+07:00"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                   

                  temp_event_hash = {

                    :title => "Frühstück",

                    :location => "Hostel",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 8, 07, 00, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 8, 08, 30, 00, "+01:30"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Workshop II",

                    :location => "siehe Workshopübersicht",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 8, 09, 15, 00, "+03:00"),

                    :end_date      => Time.new(2014, 11, 8, 12, 15, 00, "+03:00"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Zwischenplenum",

                    :location => "1507-201",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 8, 12, 30, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 8, 14, 00, 00, "+01:30"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                  temp_event_hash = {

                    :title => "Mittagessen",

                    :location => "Mensa",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 8, 14, 00, 00, "+01:15"),

                    :end_date      => Time.new(2014, 11, 8, 15, 15, 00, "+01:15"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "flexible Diskussionsphase",

                    :location => "siehe Aushang Niedersachsen-Saal",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 8, 15, 30, 00, "+02:00"),

                    :end_date      => Time.new(2014, 11, 8, 17, 30, 00, "+02:00"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Freizeit/ Diskussionsphase",

                    :location => "flexibel",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 8, 17, 30, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 8, 19, 00, 00, "+01:30"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Kneipentour, inkl. Abendessen",

                    :location => "Treffen im Niedersachsen-Saal",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 8, 19, 00, 00, "+03:00"),

                    :end_date      => Time.new(2014, 11, 8, 22, 00, 00, "+03:00"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                   

                   

                  temp_event_hash = {

                    :title => "Bad Taste Party",

                    :location => "Silo",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 8, 22, 00, 00, "+07:00"),

                    :end_date      => Time.new(2014, 11, 9, 05, 00, 00, "+07:00"),

                    :recurrence    => { :recurrence => false },  # (Blackberry, Windows, iOS, Android)

                    :canceled      => false,                            # (iPhone and Android only)

                    :organizer     => "FSR Hannover",             # (iPhone and Android only)

                    :attendees     => "BuFaK Hannover",        # (iPhone and Android only)

                    :last_modified => Time.now  # (iPhone and Android only)

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                   

                  temp_event_hash = {

                    :title => "Frühstück",

                    :location => "Hostel",

                    :notes => " "

                    :start_date    => Time.new(2014, 11, 9, 07, 00, 00, "+01:30"),

                    :end_date      => Time.new(2014, 11, 9, 08, 30, 00, "+01:30"),

                    :recurrence    => { :recurrence => false }, 

                    :canceled      => false,                           

                    :organizer     => "FSR Hannover",            

                    :attendees     => "BuFaK Hannover",       

                    :last_modified => Time.now

                  }

                  events = [ ]

                  events << Rho: RhoEvent.create! (event_hash)

                   

                  # beim Checkout weiter machen

                   

                  # Termine aktualisieren

                  Rho::RhoEvent.update_attributes(event_hash)

                   

                  # Autorisieren

                  Rho::RhoEvent.get_authorization_status

                   

                  </div>

                   

                   

                  and this is the controller file:

                  require 'rho/rhocontroller'

                  require 'rho/rhoindex.rb'

                  require 'time'

                   

                  class CalendarController < Rho::RhoController

                    include BrowserHelper

                   

                    @layout = 'Calendar/layout'

                   

                    def fetch_events

                         @authorization_status = Rho::RhoEvent.get_authorization_status

                         @@events = Rho::RhoEvent.find(:all,

                          :start_date => (Rho::RhoEvent::MIN_TIME + 1), :end_date => (Rho::RhoEvent::MAX_TIME - 1),

                          :find_type => 'starting', :include_repeating => false)

                      puts "events : #{@@events}"

                     

                      @@events = @@events.sort do |x,y|

                        res = 1 if x['start_date'].nil?

                        res = -1 if y['start_date'].nil?

                        res = x['start_date'] <=> y['start_date'] unless res

                        res

                      end

                   

                      @event = nil

                    end

                    private :fetch_events

                   

                    def get_events

                      @@events   

                    end

                   

                    def index

                      fetch_events

                      render :back => '/app'

                    end

                   

                    def date_popup

                      DateTimePicker.choose url_for(:action => :date_callback), @params['title'], Time.new, 0, Marshal.dump(@params['field_key'])

                    end

                   

                    def date_callback

                      if @params['status'] == 'ok'

                        key = Marshal.load(@params['opaque'])

                        result = Time.at(@params['result'].to_i).strftime('%F %T')

                        WebView.execute_js('setFieldValue("'+key+'","'+result+'");')

                      end

                    end

                   

                    def save

                      event = @params['event']

                      event[Rho::RhoEvent::END_DATE] = nil if event[Rho::RhoEvent::END_DATE] == ''

                      recurrence = !@params['recurrence'].nil?

                      frequency = @params['frequency']

                      interval = @params['interval']

                      recurrence_end = @params['recurrence_end']

                      recurrence_times = @params['recurrence_times']

                     

                      if recurrence

                        event[Rho::RhoEvent::RECURRENCE] = {

                          Rho::RhoEvent::RECURRENCE_FREQUENCY => frequency,

                          Rho::RhoEvent::RECURRENCE_INTERVAL => interval,

                          Rho::RhoEvent::RECURRENCE_END => recurrence_end,

                          Rho::RhoEvent::RECURRENCE_COUNT => recurrence_times }

                      end

                      puts "event: #{event.inspect}"

                      id = event[Rho::RhoEvent::ID]

                      if id.nil? or id.empty?

                        new_event = Rho::RhoEvent.create!(event)

                        if new_event != nil

                            new_id = new_event['id']

                            puts 'created new event with id = ' + new_id

                        end

                      else

                        Rho::RhoEvent.update_attributes event

                      end

                   

                      fetch_events

                      redirect :action => :index

                    end

                   

                    def new

                      puts "create event"

                      @event = nil

                      render :action => :edit

                    end

                   

                    def edit

                      #id = @params[Rho::RhoEvent::ID]

                      #puts "id: #{id}"

                      #@event = Rho::RhoEvent.find(id)

                      @event = @@events[strip_braces(@params['id']).to_i ]

                      render :action => :edit

                    end

                   

                    def delete

                      id = @params[Rho::RhoEvent::ID]

                      Rho::RhoEvent.destroy(id)

                   

                      fetch_events

                      redirect :action => :index

                    end

                   

                  end

                   

                  My group was ok with it, as we are still stuck :-)