Skip to content

Instantly share code, notes, and snippets.

@georgehrke
Created July 31, 2013 15:46
Show Gist options
  • Save georgehrke/6123198 to your computer and use it in GitHub Desktop.
Save georgehrke/6123198 to your computer and use it in GitHub Desktop.
Patch, that replaces list view with day view (It also disables scrolling, because scrolling makes day view unusable)
diff --git a/ajax/changeview.php b/ajax/changeview.php
index bcd84a1..e3df411 100644
--- a/ajax/changeview.php
+++ b/ajax/changeview.php
@@ -12,11 +12,11 @@ $view = $_POST['v'];
switch($view) {
case 'agendaWeek':
case 'month';
- case 'list':
+ case 'agendaDay':
break;
default:
OCP\JSON::error(array('message'=>'unexpected parameter: ' . $view));
exit;
}
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'currentview', $view);
-OCP\JSON::success();
\ No newline at end of file
+OCP\JSON::success();
diff --git a/js/calendar.js b/js/calendar.js
index cf1456c..1483cc5 100644
--- a/js/calendar.js
+++ b/js/calendar.js
@@ -857,7 +857,7 @@ function ListView(element, calendar) {
}
}
$(document).ready(function(){
- Calendar.UI.initScroll();
+ //Calendar.UI.initScroll();
$('#fullcalendar').fullCalendar({
header: false,
firstDay: firstDay,
@@ -892,6 +892,11 @@ $(document).ready(function(){
$.post(OC.filePath('calendar', 'ajax', 'changeview.php'), {v:view.name});
defaultView = view.name;
}
+ if(view.name === 'agendaDay') {
+ $('td.fc-state-highlight').css('background-color', '#ffffff');
+ }else{
+ $('td.fc-state-highlight').css('background-color', '#ffc');
+ }
Calendar.UI.setViewActive(view.name);
if (view.name == 'agendaWeek') {
$('#fullcalendar').fullCalendar('option', 'aspectRatio', 0.1);
@@ -952,8 +957,8 @@ $(document).ready(function(){
$('#onemonthview_radio').click(function(){
$('#fullcalendar').fullCalendar('changeView', 'month');
});
- $('#listview_radio').click(function(){
- $('#fullcalendar').fullCalendar('changeView', 'list');
+ $('#onedayview_radio').click(function(){
+ $('#fullcalendar').fullCalendar('changeView', 'agendaDay');
});
$('#today_input').click(function(){
$('#fullcalendar').fullCalendar('today');
diff --git a/templates/calendar.php b/templates/calendar.php
index cde4e4a..3516f9e 100644
--- a/templates/calendar.php
+++ b/templates/calendar.php
@@ -3,9 +3,9 @@
<div id="notification" style="display:none;"></div>
<div id="controls">
<form id="view">
+ <input type="button" value="<?php p($l->t('Day'));?>" id="onedayview_radio"/>
<input type="button" value="<?php p($l->t('Week'));?>" id="oneweekview_radio"/>
- <input type="button" value="<?php p($l->t('Month'));?>" id="onemonthview_radio"/>
- <input type="button" value="<?php p($l->t('List'));?>" id="listview_radio"/>&nbsp;&nbsp;
+ <input type="button" value="<?php p($l->t('Month'));?>" id="onemonthview_radio"/>&nbsp;&nbsp;
<img id="loading" src="<?php print_unescaped(OCP\Util::imagePath('core', 'loading.gif')); ?>" />
</form>
<form id="choosecalendar">
@rabuntu
Copy link

rabuntu commented Aug 11, 2013

Yeah, that works fine. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment