diff --git a/MIT-LICENSE b/MIT-LICENSE new file mode 100644 index 0000000..ec4ddd4 --- /dev/null +++ b/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2010 [name of plugin creator] + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README b/README deleted file mode 100644 index f5093be..0000000 --- a/README +++ /dev/null @@ -1,8 +0,0 @@ -Google Calendar integration plugin for Fat Free CRM - -Put/Edit/Delete events for tasks with due date - -This plugin needs http://github.com/tractis/crm_google_account_settings plugin to work, google account settings in user profile - -Requeriments: -- gem install gcal4ruby \ No newline at end of file diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..24fd60a --- /dev/null +++ b/README.markdown @@ -0,0 +1,19 @@ +Google Calendar integration plugin for Fat Free CRM +============ + +Put/Edit/Delete events for tasks with due date + +This plugin needs http://github.com/tractis/crm_google_account_settings plugin to work, google account settings in user profile + +Installation +============ + +The plugin can be installed by running: + + script/plugin install git://github.com/tractis/crm_google_account_settings.git + script/plugin install git://github.com/tractis/crm_google_calendar.git + sudo gem install gcal4ruby + +Then restart your web server. + +Copyright (c) 2010 by Tractis (https://www.tractis.com), released under the MIT License \ No newline at end of file diff --git a/lib/crm_google_calendar/crm_google_calendar_model_hooks.rb b/lib/crm_google_calendar/crm_google_calendar_model_hooks.rb index 944e6db..312f148 100644 --- a/lib/crm_google_calendar/crm_google_calendar_model_hooks.rb +++ b/lib/crm_google_calendar/crm_google_calendar_model_hooks.rb @@ -17,8 +17,8 @@ def create_gcalendar event.attendees = [{ :name => attendee.full_name, :email => attendee.email }] end event.title = get_title - event.start = due_at + 28800 - event.end = due_at + 32400 + event.start = get_event_start + event.end = get_event_end # TODO: Put the uri of the task: event.where = request.request_uri event.reminder = { :minutes => "15", :method => 'email' } event.save @@ -40,8 +40,8 @@ def update_gcalendar event.attendees = [{ :name => attendee.full_name, :email => attendee.email }] end event.title = title - event.start = due_at + 28800 - event.end = due_at + 32400 + event.start = get_event_start + event.end = get_event_end # TODO: Put the uri of the task: event.where = request.request_uri event.reminder = { :minutes => "15", :method => 'email' } event.save @@ -96,6 +96,16 @@ def get_category category == "" ? "other" : category end + #---------------------------------------------------------------------------- + def get_event_start + Setting.task_calendar_with_time == true ? due_at : due_at + 28800 + end + + #---------------------------------------------------------------------------- + def get_event_end + Setting.task_calendar_with_time == true ? due_at : due_at + 32400 + end + end end