* Added update algorithm.

* Fixed firefox issues
This commit is contained in:
alextselegidis@gmail.com 2014-01-04 17:25:21 +00:00
parent b935dd954f
commit 7ac98c1e8d
16 changed files with 95 additions and 33 deletions

Binary file not shown.

View file

@ -29,8 +29,8 @@ $config['base_url'] = SystemConfiguration::$base_url;
| the global "config" variable.
|
*/
$config['ea_version'] = '1.0'; // This must be changed manually.
$config['ea_release_title'] = 'Dev'; // Leave empty for no title or add BETA, TEST etc ...
$config['ea_version'] = '0.7.1'; // This must be changed manually.
$config['ea_release_title'] = 'Beta'; // Leave empty for no title or add BETA, TEST etc ...
$config['ea_google_sync_feature'] = SystemConfiguration::$google_sync_feature;
/*

View file

@ -8,7 +8,7 @@
| whenever you intend to do a schema migration.
|
*/
$config['migration_enabled'] = FALSE;
$config['migration_enabled'] = TRUE;
/*
@ -21,7 +21,7 @@ $config['migration_enabled'] = FALSE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
$config['migration_version'] = 1; // current
/*

View file

@ -252,6 +252,34 @@ class Backend extends CI_Controller {
$view['role_slug'] = $this->session->userdata('role_slug');
$view['privileges'] = $this->roles_model->get_privileges($this->session->userdata('role_slug'));
}
/**
* This method will update the installation to the latest available
* version in the server. IMPORTANT: The code files must exist in the
* server, this method will not fetch any new files but will update
* the database schema.
*
* This method can be used either by loading the page in the browser
* or by an ajax request. But it will answer with json encoded data.
*/
public function update() {
try {
if (!$this->hasPrivileges(PRIV_SYSTEM_SETTINGS, TRUE))
throw new Exception('You do not have the required privileges for this task.');
$this->load->library('migration');
if (!$this->migration->current())
throw new Exception($this->migration->error_string());
echo json_encode(AJAX_SUCCESS);
} catch(Exception $exc) {
echo json_encode(array(
'exceptions' => array(exceptionToJavaScript($exc))
));
}
}
}
/* End of file backend.php */

View file

@ -269,3 +269,4 @@ $lang['select_google_calendar_prompt'] = 'Select the calendar that you want to s
$lang['google_calendar_selected'] = 'Google calendar has been successfully selected!';
$lang['oops_something_went_wrong'] = 'Oops! Something Went Wrong!';
$lang['could_not_add_to_google_calendar'] = 'Your appointment could not be added to your Google Calendar account.';
$lang['ea_update_success'] = 'Easy!Appointments has been successfully updated!';

View file

@ -269,3 +269,4 @@ $lang['select_google_calendar_prompt'] = 'Wählen Sie den Kalender, den Sie Ihre
$lang['google_calendar_selected'] = 'Google-Kalender ausgewählt wurde erfolgreich!';
$lang['oops_something_went_wrong'] = 'Oops! Etwas ist schiefgelaufen!';
$lang['could_not_add_to_google_calendar'] = 'Ihr Termin konnte nicht in den Google-Kalender-Konto hinzugefügt werden.';
$lang['ea_update_success'] = 'Easy!Appointments wurde erfolgreich aktualisiert!';

View file

@ -269,3 +269,4 @@ $lang['select_google_calendar_prompt'] = 'Επιλέξτε το ημερολόγ
$lang['google_calendar_selected'] = 'Το ημερολόγιο της Google επιλέχθηκε επιτυχώς!';
$lang['oops_something_went_wrong'] = 'Ώχ! Κάτι πήγε στραβά!';
$lang['could_not_add_to_google_calendar'] = 'Το ραντεβού σας δεν μπόρεσε να προστεθεί στον λογαριασμό σας στο Google Calendar.';
$lang['ea_update_success'] = 'Το Easy!Appointments ενημερώθηκε με επιτυχία!';

View file

@ -349,7 +349,7 @@
<?php echo $this->lang->line('back'); ?>
</button>
<form id="book-appointment-form" style="display:inline-block" method="post">
<button type="submit" class="btn btn-success">
<button id="book-appointment-submit" type="button" class="btn btn-success">
<i class="icon-ok icon-white"></i>
<?php
echo (!$manage_mode) ? $this->lang->line('confirm')

View file

@ -316,6 +316,9 @@
if ($release_title != '') {
echo ' - ' . $release_title;
}
echo '<button id="update-ea" class="btn btn-success">'
. $this->lang->line('update') . '</button>';
?>
</div>
@ -340,6 +343,10 @@
<a href="https://code.google.com/p/easy-appointments/issues/list">
<?php echo $this->lang->line('project_issues'); ?>
</a>
|
<a href="http://easyappointments.wordpress.com">
E!A Blog
</a>
</p>
<br>

View file

@ -665,9 +665,13 @@ padding: 4px 7px;
}
#settings-page #about .current-version {
padding: 15px 10px;
padding: 9px 10px;
background: #F7F7F7;
font-size: 15px;
color: #7E7E7E;
box-shadow: inset 0px 0px 5px #E0E0E0;
}
#settings-page #update-ea {
margin-left: 12px;
}

View file

@ -103,7 +103,7 @@ var Backend = {
$.each(actions, function(index, action) {
var actionId = action['label'].toLowerCase().replace(' ', '-');
notificationHtml += '<button id="' + actionId + '" class="btn">'
notificationHtml += '<button id="' + actionId + '" class="btn btn-small">'
+ action['label'] + '</button>';
$(document).off('click', '#' + actionId);

View file

@ -1863,7 +1863,8 @@ var BackendCalendar = {
timeOnlyTitle: EALang['select_time'],
timeText: EALang['time'],
hourText: EALang['hour'],
minuteText: EALang['minutes']
minuteText: EALang['minutes'],
firstDay: 1
});
$dialog.find('#start-datetime').val(startDatetime);
@ -1890,7 +1891,8 @@ var BackendCalendar = {
timeOnlyTitle: EALang['select_time'],
timeText: EALang['time'],
hourText: EALang['hour'],
minuteText: EALang['minutes']
minuteText: EALang['minutes'],
firstDay: 1
});
$dialog.find('#end-datetime').val(endDatetime);
},
@ -1950,6 +1952,8 @@ var BackendCalendar = {
resetUnavailableDialog: function() {
var $dialog = $('#manage-unavailable');
$dialog.find('#unavailable-id').val('');
// Set default time values
var start = new Date().toString('dd/MM/yyyy HH:mm');
var end = new Date().addHours(1).toString('dd/MM/yyyy HH:mm');
@ -1977,7 +1981,8 @@ var BackendCalendar = {
timeOnlyTitle: EALang['select_time'],
timeText: EALang['time'],
hourText: EALang['hour'],
minuteText: EALang['minutes']
minuteText: EALang['minutes'],
firstDay: 1
});
$dialog.find('#unavailable-start').val(start);
@ -2004,7 +2009,8 @@ var BackendCalendar = {
timeOnlyTitle: EALang['select_time'],
timeText: EALang['time'],
hourText: EALang['hour'],
minuteText: EALang['minutes']
minuteText: EALang['minutes'],
firstDay: 1
});
$dialog.find('#unavailable-end').val(end);

View file

@ -189,6 +189,23 @@ var BackendSettings = {
}
}, 'json');
});
/**
* Event: Update Easy!Appointments DB Schema To Latest Version
*/
$('#update-ea').click(function() {
var postUrl = GlobalVariables.baseUrl + 'backend/update';
$.post(postUrl, {}, function(response) {
//////////////////////////////////////////////
console.log('Update EA Response', response);
//////////////////////////////////////////////
if (!GeneralFunctions.handleAjaxExceptions(response)) return;
Backend.displayNotification(EALang['ea_update_success']);
}, 'json');
});
}
};

View file

@ -97,18 +97,17 @@ SecretariesHelper.prototype.bindEventHandlers = function() {
$('#delete-secretary').click(function() {
var secretaryId = $('#secretary-id').val();
var messageBtns = {
'Delete': function() {
var messageBtns = {};
messageBtns[EALang['delete']] = function() {
BackendUsers.helper.delete(secretaryId);
$('#message_box').dialog('close');
},
'Cancel': function() {
};
messageBtns[EALang['cancel']] = function() {
$('#message_box').dialog('close');
}
};
GeneralFunctions.displayMessageBox('Delete Secretary', 'Are you sure that you want '
+ 'to delete this record? This action cannot be undone.', messageBtns);
GeneralFunctions.displayMessageBox(EALang['delete_secretary'],
EALang['delete_record_prompt'], messageBtns);
});
/**
@ -188,7 +187,7 @@ SecretariesHelper.prototype.save = function(secretary) {
//console.log('Save Secretary Response:', response);
////////////////////////////////////////////////////
if (!GeneralFunctions.handleAjaxExceptions(response)) return;
Backend.displayNotification('Secretary saved successfully!');
Backend.displayNotification(EALang['secretary_saved']);
BackendUsers.helper.resetForm();
$('#filter-secretaries .key').val('');
BackendUsers.helper.filter('', response.id, true);
@ -209,7 +208,7 @@ SecretariesHelper.prototype.delete = function(id) {
//console.log('Delete secretary response:', response);
//////////////////////////////////////////////////////
if (!GeneralFunctions.handleAjaxExceptions(response)) return;
Backend.displayNotification('Secretary deleted successfully!');
Backend.displayNotification(EALang['secretary_deleted']);
BackendUsers.helper.resetForm();
BackendUsers.helper.filter($('#filter-secretaries .key').val());
}, 'json');

View file

@ -243,7 +243,7 @@ var FrontendBook = {
* in the meantime the selected appointment date/time wasn't reserved by
* another customer or event.
*/
$('#book-appointment-form').submit(function(event) {
$('#book-appointment-submit').click(function(event) {
var formData = jQuery.parseJSON($('input[name="post_data"]').val());
var postData = {
@ -269,7 +269,7 @@ var FrontendBook = {
+ 'the check appointment time availability could not be completed. '
+ 'The following issues occured:');
$('#message_box').append(GeneralFunctions.exceptionsToHtml(response.exceptions));
return;
return false;
}
if (response === true) {
@ -281,8 +281,6 @@ var FrontendBook = {
FrontendBook.getAvailableHours($('#select-date').val());
}
}, 'json');
return false;
});
},

View file

@ -191,7 +191,7 @@ var GeneralFunctions = {
* user opens the "Details" collapse component.
*
* @param {array} exceptions Contains the exceptions to be displayed.
* @returns {String} Returns the html markup for the exceptions.
* @returns {string} Returns the html markup for the exceptions.
*/
exceptionsToHtml: function(exceptions) {
var html =
@ -200,7 +200,7 @@ var GeneralFunctions = {
'<div class="accordion-heading">' +
'<a class="accordion-toggle" data-toggle="collapse" ' +
'data-parent="#error-accordion" href="#error-technical">' +
'Details' +
EALang['details'] +
'</a>' +
'</div>';
@ -222,7 +222,7 @@ var GeneralFunctions = {
* This method parse the json encoded strings that are fetched by ajax calls.
*
* @param {array} exceptions Exception array returned by an ajax call.
* @returns {Array} Returns the parsed js objects.
* @returns {array} Returns the parsed js objects.
*/
parseExceptions: function(exceptions) {
var parsedExceptions = new Array();