aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-02-26 21:23:20 +0100
committerGeorg Ehrke <dev@georgswebsite.de>2012-02-26 21:23:20 +0100
commit04c9cc60349fe8d6899a42781ccacaf6d9df5bf5 (patch)
tree6703867e9b45eb36cbcd86e9b7b7d47356f69960
parenta501d4b61e3ba30aa1643b6a92c5177ee69d3b7d (diff)
downloadnextcloud-server-04c9cc60349fe8d6899a42781ccacaf6d9df5bf5.tar.gz
nextcloud-server-04c9cc60349fe8d6899a42781ccacaf6d9df5bf5.zip
give users the possibility to choose between monday and sunday as first day of the week
-rw-r--r--apps/calendar/ajax/settings/getfirstday.php12
-rw-r--r--apps/calendar/ajax/settings/setfirstday.php17
-rw-r--r--apps/calendar/js/calendar.js2
-rw-r--r--apps/calendar/js/settings.js12
-rwxr-xr-xapps/calendar/templates/calendar.php1
-rw-r--r--apps/calendar/templates/settings.php7
6 files changed, 50 insertions, 1 deletions
diff --git a/apps/calendar/ajax/settings/getfirstday.php b/apps/calendar/ajax/settings/getfirstday.php
new file mode 100644
index 00000000000..cab5870509a
--- /dev/null
+++ b/apps/calendar/ajax/settings/getfirstday.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+require_once('../../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+$firstday = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'firstday', 'mo');
+OC_JSON::encodedPrint(array('firstday' => $firstday));
+?>
diff --git a/apps/calendar/ajax/settings/setfirstday.php b/apps/calendar/ajax/settings/setfirstday.php
new file mode 100644
index 00000000000..3b652212205
--- /dev/null
+++ b/apps/calendar/ajax/settings/setfirstday.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+require_once('../../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+if(isset($_POST["firstday"])){
+ OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
+ OC_JSON::success();
+}else{
+ OC_JSON::error();
+}
+?>
+
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index 84b76a3c88f..a1b25780b76 100644
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -661,7 +661,7 @@ $(document).ready(function(){
Calendar.UI.initScroll();
$('#calendar_holder').fullCalendar({
header: false,
- firstDay: 1,
+ firstDay: firstDay,
editable: true,
defaultView: defaultView,
timeFormat: {
diff --git a/apps/calendar/js/settings.js b/apps/calendar/js/settings.js
index fcbfc423db3..c768a47a797 100644
--- a/apps/calendar/js/settings.js
+++ b/apps/calendar/js/settings.js
@@ -17,6 +17,14 @@ $(document).ready(function(){
}
});
});
+ $('#firstday').change( function(){
+ var data = $('#firstday').serialize();
+ $.post( OC.filePath('calendar', 'ajax/settings', 'setfirstday.php'), data, function(data){
+ if(data == 'error'){
+ console.log('saving firstday failed');
+ }
+ });
+ });
$('#timezonedetection').change( function(){
var post = $('#timezonedetection').serialize();
$.post( OC.filePath('calendar', 'ajax/settings', 'timezonedetection.php'), post, function(data){
@@ -32,4 +40,8 @@ $(document).ready(function(){
$('#timezonedetection').attr('checked', 'checked');
}
});
+ $.getJSON(OC.filePath('calendar', 'ajax/settings', 'getfirstday.php'), function(jsondata, status) {
+ $('#' + jsondata.firstday).attr('selected',true);
+ $('#firstday').chosen();
+ });
});
diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php
index eb82d0d02ad..63c3b500296 100755
--- a/apps/calendar/templates/calendar.php
+++ b/apps/calendar/templates/calendar.php
@@ -19,6 +19,7 @@
var missing_field_startsbeforeends = '<?php echo addslashes($l->t('The event ends before it starts')) ?>';
var missing_field_dberror = '<?php echo addslashes($l->t('There was a database fail')) ?>';
var totalurl = '<?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?>/calendars';
+ var firstDay = '<?php echo (OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'); ?>';
$(document).ready(function() {
<?php
if(array_key_exists('showevent', $_)){
diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php
index 979634874e4..f74a45203e1 100644
--- a/apps/calendar/templates/settings.php
+++ b/apps/calendar/templates/settings.php
@@ -37,6 +37,13 @@
</select>
</td></tr>
+ <tr><td><label for="firstday" class="bold"><?php echo $l->t('First day of the week');?></label></td><td>
+ <select style="display: none;" id="firstday" title="<?php echo "First day"; ?>" name="firstday">
+ <option value="mo" id="mo"><?php echo $l->t("Monday"); ?></option>
+ <option value="su" id="su"><?php echo $l->t("Sunday"); ?></option>
+ </select>
+ </td></tr>
+
</table>
<?php echo $l->t('Calendar CalDAV syncing address:');?>