From 05416823f6f04b3f075415735fb571a315b29d6c Mon Sep 17 00:00:00 2001 From: "alextselegidis@gmail.com" Date: Wed, 25 Dec 2013 01:22:37 +0000 Subject: [PATCH] Added translation change button in frontend. --- doc/translations.xls | Bin 58368 -> 59392 bytes src/application/controllers/backend_api.php | 24 +++++++++++++ src/application/controllers/google.php | 2 ++ .../language/english/translations_lang.php | 2 ++ .../language/german/translations_lang.php | 4 ++- .../language/greek/translations_lang.php | 4 ++- src/application/libraries/google_sync.php | 16 ++++++++- src/application/views/appointments/book.php | 6 ++++ src/application/views/user/login.php | 33 ++++++++++++++---- src/assets/js/backend_calendar.js | 14 +++++--- src/assets/js/frontend_book.js | 4 +-- src/assets/sql/structure.sql | 3 +- 12 files changed, 95 insertions(+), 17 deletions(-) diff --git a/doc/translations.xls b/doc/translations.xls index 552dc5a7d14899a731682be66c236359dc69f0c4..27b5869e716c147662c6cb89d9be0aa08db91161 100644 GIT binary patch delta 1090 zcmb7DTSyd982-+j-P|%$N-HVt=z~(pQc48UO)89n(CQ(I9`RdMM( zF3`cRQ|{(B_#LYCu<4G$goOHebgH_1WPIz)EamFol>bMarLaKu;$-V z1={&teu;PU`}_eJs)fJ_W$!Ohz2y^IZ}6KmcO^sih-_XX)J2B>nD5M(cgeJaZJ8Xz z+N_U}uA5}sj7c{VH$yRL)r!>_?Ib^(u%cV7nAk)vJSi;tES`ujkPdZw(lkA>T{=-| z1qU$$9Z36uv9!By1yDQ%Xqyk5n*>zSkMVvCa7F)53L30I0?nk- zC6_CyZl}76wyhZ6G8}tZ4j!G035wBD^<% zA;buM$RdN#z%UAAIzMKS?);QRy7RLNrZod$*e+kK!N&slmG+Kq*yC zUuVi4f~v-JP%)=k)%MK@++GqnpU)mMwbwUKCHs=8zH}K={pqvE`#rx+eT!5}f2(ox aW$Ii19>%&=%j;c!t;9{P+L=e;6(RO8%P|XupZ&3KP>6hRxU5Dp;5l zCQlCFZekT@W?*=``8s!J15+{2=A@ot9-aRTS`51xZm}{j@BlSlRbXIXmu6r{uw`J# z6K7yh1e*4olY!yHBnE~op2@1STZ2^?6d4%QoYj;G@-G8}9FPVE8-uCg zload->library('google_sync'); + $this->load->model('providers_model'); + + $calendars = $this->google_sync->get_google_calendars($_POST['provider_id']); + echo json_encode($calendars); + + } catch(Exception $exc) { + echo json_encode(array( + 'exceptions' => array(exceptionToJavaScript($exc)) + )); + } + } } /* End of file backend_api.php */ diff --git a/src/application/controllers/google.php b/src/application/controllers/google.php index 8dc0f5a3..1bb5f520 100644 --- a/src/application/controllers/google.php +++ b/src/application/controllers/google.php @@ -58,6 +58,8 @@ class Google extends CI_Controller { $_SESSION['oauth_provider_id']); $this->providers_model->set_setting('google_token', $token, $_SESSION['oauth_provider_id']); + $this->providers_model->set_setting('google_calendar', 'primary', + $_SESSION['oath_provider_id']); } else { echo '

Sync provider id not specified!

'; diff --git a/src/application/language/english/translations_lang.php b/src/application/language/english/translations_lang.php index 45907558..f735c1d9 100644 --- a/src/application/language/english/translations_lang.php +++ b/src/application/language/english/translations_lang.php @@ -262,3 +262,5 @@ $lang['select_time'] = 'Select Time'; $lang['time'] = 'Time'; $lang['hour'] = 'Hour'; $lang['minute'] = 'Minute'; +$lang['google_sync_completed'] = 'Google synchronization completed successfully!'; +$lang['google_sync_failed'] = 'Google synchronization failed: Could not establish server connection.'; diff --git a/src/application/language/german/translations_lang.php b/src/application/language/german/translations_lang.php index 902fe637..a45d5344 100644 --- a/src/application/language/german/translations_lang.php +++ b/src/application/language/german/translations_lang.php @@ -261,4 +261,6 @@ $lang['now'] = 'Jetzt'; $lang['select_time'] = 'Zeit Wählen'; $lang['time'] = 'Zeit'; $lang['hour'] = 'Uhr'; -$lang['minute'] = 'Minute'; \ No newline at end of file +$lang['minute'] = 'Minute'; +$lang['google_sync_completed'] = 'Google Synchronisation erfolgreich beendet!'; +$lang['google_sync_failed'] = 'Google Synchronisation fehlgeschlagen: Serververbindung konnte nicht hergestellt werden.'; \ No newline at end of file diff --git a/src/application/language/greek/translations_lang.php b/src/application/language/greek/translations_lang.php index 159c7e99..1cb838e1 100644 --- a/src/application/language/greek/translations_lang.php +++ b/src/application/language/greek/translations_lang.php @@ -261,4 +261,6 @@ $lang['now'] = 'Τώρα'; $lang['select_time'] = 'Επιλέξτε Ώρα'; $lang['time'] = 'Χρόνος'; $lang['hour'] = 'Ώρα'; -$lang['minute'] = 'Λεπτά'; \ No newline at end of file +$lang['minute'] = 'Λεπτά'; +$lang['google_sync_completed'] = 'Ο συγχρονισμός με την Google ολοκληρώθηκε επιτυχώς!'; +$lang['google_sync_failed'] = 'Ο συγχρονισμός με την Google απέτυχε: Δεν μπόρεσε να πραγματοποιηθεί σύνδεση με τον server.'; \ No newline at end of file diff --git a/src/application/libraries/google_sync.php b/src/application/libraries/google_sync.php index 6e9efe16..fce96097 100644 --- a/src/application/libraries/google_sync.php +++ b/src/application/libraries/google_sync.php @@ -9,7 +9,8 @@ require_once dirname(dirname(dirname(__FILE__))) . '/configuration.php'; * Google Synchronization Class * * This class implements all the core synchronization between the Google Calendar - * and the Easy!Appointments system. + * and the Easy!Appointments system. Do not place any model handling inside this + * library. */ class Google_Sync { private $CI; @@ -293,6 +294,19 @@ class Google_Sync { return $this->service->events->listEvents('primary', $params); } + + /** + * Return available google calendars for specific user. + * + * The given user's token must already exist in db in order to get access to his + * Google Calendar account. + * + * @param numeric $provider_id The provider's record id. + * @return array Returns an array with the available calendars. + */ + public function get_google_calendars($provider_id) { + + } } /* End of file google_sync.php */ diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php index b208ab16..1eb4e5f4 100644 --- a/src/application/views/appointments/book.php +++ b/src/application/views/appointments/book.php @@ -81,10 +81,12 @@ }; var EALang = lang->language); ?>; + var availableLanguages = config->item('available_languages')); ?>; $(document).ready(function() { FrontendBook.initialize(true, GlobalVariables.manageMode); GeneralFunctions.centerElementOnPage($('#book-appointment-wizard')); + GeneralFunctions.enableLanguageSelection($('#select-language')); }); @@ -368,6 +370,10 @@ Easy!Appointments + | + + config->item('language')); ?> + diff --git a/src/application/views/user/login.php b/src/application/views/user/login.php index 8259b77e..0c5fdc6e 100644 --- a/src/application/views/user/login.php +++ b/src/application/views/user/login.php @@ -24,6 +24,10 @@ rel="stylesheet" type="text/css" href="config->base_url(); ?>assets/css/libs/bootstrap/bootstrap-responsive.css"> + @@ -67,8 +71,11 @@ }; var EALang = lang->language); ?>; + var availableLanguages = config->item('available_languages')); ?>; $(document).ready(function() { + GeneralFunctions.enableLanguageSelection($('#select-language')); + /** * Event: Login Button "Click" * @@ -112,16 +119,30 @@
- + - + + +
+ +

- - - lang->line('forgot_your_password'); ?> + + lang->line('forgot_your_password'); ?> + + | + + config->item('language')); ?> +
diff --git a/src/assets/js/backend_calendar.js b/src/assets/js/backend_calendar.js index 778d0252..fd609aad 100644 --- a/src/assets/js/backend_calendar.js +++ b/src/assets/js/backend_calendar.js @@ -287,23 +287,24 @@ var BackendCalendar = { if (response.exceptions) { response.exceptions = GeneralFunctions.parseExceptions(response.exceptions); - GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE, GeneralFunctions.EXCEPTIONS_MESSAGE); + GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE, + GeneralFunctions.EXCEPTIONS_MESSAGE); $('#message_box').append(GeneralFunctions.exceptionsToHtml(response.exceptions)); return; } if (response.warnings) { response.warnings = GeneralFunctions.parseExceptions(response.warnings); - GeneralFunctions.displayMessageBox(GeneralFunctions.WARNINGS_TITLE, GeneralFunctions.WARNINGS_MESSAGE); + GeneralFunctions.displayMessageBox(GeneralFunctions.WARNINGS_TITLE, + GeneralFunctions.WARNINGS_MESSAGE); $('#message_box').append(GeneralFunctions.exceptionsToHtml(response.warnings)); } - Backend.displayNotification('Google synchronization completed successfully!'); + Backend.displayNotification(EALang['google_sync_completed']); $('#reload-appointments').trigger('click'); }, 'error': function(jqXHR, textStatus, errorThrown) { - Backend.displayNotification('Google synchronization failed: Could not establish ' - + 'server connection.'); + Backend.displayNotification(EALang['google_sync_failed']); } }); }); @@ -706,6 +707,9 @@ var BackendCalendar = { $('#enable-sync span').text(EALang['disable_sync']); $('#google-sync').prop('disabled', false); $('#select-filter-item option:selected').attr('google-sync', 'true'); + + // Display the calendar selection dialog. + } } }, 100); diff --git a/src/assets/js/frontend_book.js b/src/assets/js/frontend_book.js index e1e9cbb6..bb48e088 100644 --- a/src/assets/js/frontend_book.js +++ b/src/assets/js/frontend_book.js @@ -324,9 +324,9 @@ var FrontendBook = { var ajaxurl = GlobalVariables.baseUrl + 'appointments/ajax_get_available_hours'; jQuery.post(ajaxurl, postData, function(response) { /////////////////////////////////////////////////////////////// - //console.log('Get Available Hours JSON Response:', response); + console.log('Get Available Hours JSON Response:', response); /////////////////////////////////////////////////////////////// - + if (!GeneralFunctions.handleAjaxExceptions(response)) return; // The response contains the available hours for the selected provider and diff --git a/src/assets/sql/structure.sql b/src/assets/sql/structure.sql index 9bafd599..fd1d7497 100644 --- a/src/assets/sql/structure.sql +++ b/src/assets/sql/structure.sql @@ -173,6 +173,7 @@ CREATE TABLE IF NOT EXISTS `ea_user_settings` ( `notifications` tinyint(4) DEFAULT '0', `google_sync` tinyint(4) DEFAULT '0', `google_token` text, + `google_calendar` varchar(128) DEFAULT NULL, `sync_past_days` int(11) DEFAULT '5', `sync_future_days` int(11) DEFAULT '5', PRIMARY KEY (`id_users`) @@ -234,4 +235,4 @@ INSERT INTO `ea_roles` (`id`, `name`, `slug`, `is_admin`, `appointments`, `custo INSERT INTO `ea_settings` (`name`, `value`) VALUES ('company_working_plan', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"saturday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"sunday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]}}'), -('book_advance_timeout', '30'); \ No newline at end of file +('book_advance_timeout', '30');