Added translation change button in frontend.

This commit is contained in:
alextselegidis@gmail.com 2013-12-25 01:22:37 +00:00
parent 6b03dcff90
commit 05416823f6
12 changed files with 95 additions and 17 deletions

Binary file not shown.

View file

@ -1072,6 +1072,30 @@ class Backend_api extends CI_Controller {
));
}
}
/**
* This method will return a list of the available google calendars.
*
* The user will need to select a specific calendar from this list to sync his
* appointments with. Google access must be already granted for the specific
* provider.
*
* @param string $_POST['provider_id'] Provider record id.
*/
public function ajax_get_google_calendars() {
try {
$this->load->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 */

View file

@ -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 '<h1>Sync provider id not specified!</h1>';

View file

@ -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.';

View file

@ -262,3 +262,5 @@ $lang['select_time'] = 'Zeit Wählen';
$lang['time'] = 'Zeit';
$lang['hour'] = 'Uhr';
$lang['minute'] = 'Minute';
$lang['google_sync_completed'] = 'Google Synchronisation erfolgreich beendet!';
$lang['google_sync_failed'] = 'Google Synchronisation fehlgeschlagen: Serververbindung konnte nicht hergestellt werden.';

View file

@ -262,3 +262,5 @@ $lang['select_time'] = 'Επιλέξτε Ώρα';
$lang['time'] = 'Χρόνος';
$lang['hour'] = 'Ώρα';
$lang['minute'] = 'Λεπτά';
$lang['google_sync_completed'] = 'Ο συγχρονισμός με την Google ολοκληρώθηκε επιτυχώς!';
$lang['google_sync_failed'] = 'Ο συγχρονισμός με την Google απέτυχε: Δεν μπόρεσε να πραγματοποιηθεί σύνδεση με τον server.';

View file

@ -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 */

View file

@ -81,10 +81,12 @@
};
var EALang = <?php echo json_encode($this->lang->language); ?>;
var availableLanguages = <?php echo json_encode($this->config->item('available_languages')); ?>;
$(document).ready(function() {
FrontendBook.initialize(true, GlobalVariables.manageMode);
GeneralFunctions.centerElementOnPage($('#book-appointment-wizard'));
GeneralFunctions.enableLanguageSelection($('#select-language'));
});
</script>
</head>
@ -368,6 +370,10 @@
<a href="http://easyappointments.org" target="_blank">
Easy!Appointments
</a>
|
<span id="select-language" class="badge badge-inverse">
<?php echo ucfirst($this->config->item('language')); ?>
</span>
</div>
</div>
</div>

View file

@ -24,6 +24,10 @@
rel="stylesheet"
type="text/css"
href="<?php echo $this->config->base_url(); ?>assets/css/libs/bootstrap/bootstrap-responsive.css">
<link
rel="stylesheet"
type="text/css"
href="<?php echo $this->config->base_url(); ?>assets/css/general.css">
<?php // SET FAVICON FOR PAGE ?>
<link
@ -54,7 +58,7 @@
}
.forgot-password {
margin-left: 20px;
/* margin-left: 20px; */
}
</style>
@ -67,8 +71,11 @@
};
var EALang = <?php echo json_encode($this->lang->language); ?>;
var availableLanguages = <?php echo json_encode($this->config->item('available_languages')); ?>;
$(document).ready(function() {
GeneralFunctions.enableLanguageSelection($('#select-language'));
/**
* Event: Login Button "Click"
*
@ -112,16 +119,30 @@
<div class="alert hidden"></div>
<form id="login-form">
<label for="username"><?php echo $this->lang->line('username'); ?></label>
<input type="text" id="username" placeholder="<?php echo $this->lang->line('enter_username_here'); ?>" class="span3" />
<input type="text" id="username"
placeholder="<?php echo $this->lang->line('enter_username_here'); ?>"
class="span3" />
<label for="password"><?php echo $this->lang->line('password'); ?></label>
<input type="password" id="password" placeholder="<?php echo $this->lang->line('enter_password_here'); ?>" class="span3" />
<input type="password" id="password"
placeholder="<?php echo $this->lang->line('enter_password_here'); ?>"
class="span3" />
<br>
<button type="submit" id="login" class="btn btn-primary">
<?php echo $this->lang->line('login'); ?>
</button>
<br><br>
<button type="submit" id="login" class="btn btn-primary btn-large"><?php echo $this->lang->line('login'); ?></button>
<a href="<?php echo $base_url; ?>user/forgot_password" class="forgot-password"><?php echo $this->lang->line('forgot_your_password'); ?></a>
<a href="<?php echo $base_url; ?>user/forgot_password" class="forgot-password">
<?php echo $this->lang->line('forgot_your_password'); ?>
</a>
|
<span id="select-language" class="badge badge-inverse">
<?php echo ucfirst($this->config->item('language')); ?>
</span>
</form>
</div>

View file

@ -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);

View file

@ -324,7 +324,7 @@ 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;

View file

@ -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`)