move calendar settings from personal settings to in app settings

master
Georg Ehrke 2012-08-09 12:36:00 +02:00
parent ca912ddff6
commit d7e742c32d
11 changed files with 178 additions and 123 deletions

View File

@ -4,9 +4,7 @@
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
*/
$l10n = OC_L10N::get('calendar');
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');

View File

@ -33,5 +33,4 @@ OCP\App::addNavigationEntry( array(
'href' => OCP\Util::linkTo( 'calendar', 'index.php' ),
'icon' => OCP\Util::imagePath( 'calendar', 'icon.svg' ),
'name' => $l->t('Calendar')));
OCP\App::registerPersonal('calendar', 'settings');
OC_Search::registerProvider('OC_Search_Provider_Calendar');

12
calendar.php Normal file
View File

@ -0,0 +1,12 @@
<?php
/**
* Copyright (c) 2012 Georg Ehrke <ownClouddev at georgswebsite.de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
$l10n = OC_L10N::get('calendar');
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
$tmpl = new OCP\Template('calendar', 'part.choosecalendar');
$tmpl->printpage();

View File

@ -19,7 +19,7 @@
#loading { display: none;margin: 0;padding:0;margin-top:5px;}
#calendar_holder {position: relative;bottom: 0; right: 0; left: 0; top: 3em;}
#fullcalendar {position: relative;bottom: 0; right: 0; left: 0; top: 3em;}
.fc-content{padding:2px 4px;}
#listview {margin: 0; padding: 10px; background: #EEEEEE;}
#listview #more_before, #listview #more_after {border: 1px solid #1a1a1a; width:25em;padding: 3px;text-align: center;}
@ -133,3 +133,12 @@ padding:0 8px 2px;
line-height:1.2;
margin-bottom:4px;
}
#choosecalendar a.settings{
margin-top: 25px;
margin-right: 10px;
}
#fullcalendar{
overflow: scroll;
}

View File

@ -5,8 +5,7 @@
* later.
* See the COPYING-README file.
*/
DEFINE('DEBUG', TRUE);
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');

View File

@ -18,7 +18,7 @@ Calendar={
startEventDialog:function(){
Calendar.UI.loading(false);
$('.tipsy').remove();
$('#calendar_holder').fullCalendar('unselect');
$('#fullcalendar').fullCalendar('unselect');
Calendar.UI.lockTime();
$( "#from" ).datepicker({
dateFormat : 'dd-mm-yy'
@ -88,7 +88,7 @@ Calendar={
$.post(url, post, function(data){
Calendar.UI.loading(false);
if(data.status == 'success'){
$('#calendar_holder').fullCalendar('removeEvents', $('#event_form input[name=id]').val());
$('#fullcalendar').fullCalendar('removeEvents', $('#event_form input[name=id]').val());
$('#event').dialog('destroy').remove();
} else {
$('#errorbox').html(t('calendar', 'Deletion failed'));
@ -133,7 +133,7 @@ Calendar={
} else
if(data.status == 'success'){
$('#event').dialog('destroy').remove();
$('#calendar_holder').fullCalendar('refetchEvents');
$('#fullcalendar').fullCalendar('refetchEvents');
}
},"json");
},
@ -148,7 +148,7 @@ Calendar={
console.log("Event moved successfully");
}else{
revertFunc();
$('#calendar_holder').fullCalendar('refetchEvents');
$('#fullcalendar').fullCalendar('refetchEvents');
}
});
},
@ -163,7 +163,7 @@ Calendar={
console.log("Event resized successfully");
}else{
revertFunc();
$('#calendar_holder').fullCalendar('refetchEvents');
$('#fullcalendar').fullCalendar('refetchEvents');
}
});
},
@ -239,11 +239,11 @@ Calendar={
doc_height = $(document).height(),
win_height = $(window).height();
if(direction == 'down' && win_height == (doc_height - scroll)){
$('#calendar_holder').fullCalendar('next');
$('#fullcalendar').fullCalendar('next');
$(document).scrollTop(0);
event.preventDefault();
}else if (direction == 'top' && scroll == 0) {
$('#calendar_holder').fullCalendar('prev');
$('#fullcalendar').fullCalendar('prev');
$(document).scrollTop(win_height);
event.preventDefault();
}
@ -398,9 +398,9 @@ Calendar={
if (data.status == 'success'){
checkbox.checked = data.active == 1;
if (data.active == 1){
$('#calendar_holder').fullCalendar('addEventSource', data.eventSource);
$('#fullcalendar').fullCalendar('addEventSource', data.eventSource);
}else{
$('#calendar_holder').fullCalendar('removeEventSource', data.eventSource.url);
$('#fullcalendar').fullCalendar('removeEventSource', data.eventSource.url);
}
}
});
@ -426,10 +426,10 @@ Calendar={
function(data) {
if (data.status == 'success'){
var url = 'ajax/events.php?calendar_id='+calid;
$('#calendar_holder').fullCalendar('removeEventSource', url);
$('#fullcalendar').fullCalendar('removeEventSource', url);
$('#choosecalendar_dialog').dialog('destroy').remove();
Calendar.UI.Calendar.overview();
$('#calendar_holder').fullCalendar('refetchEvents');
$('#fullcalendar').fullCalendar('refetchEvents');
}
});
}
@ -456,8 +456,8 @@ Calendar={
function(data){
if(data.status == 'success'){
$(button).closest('tr').prev().html(data.page).show().next().remove();
$('#calendar_holder').fullCalendar('removeEventSource', data.eventSource.url);
$('#calendar_holder').fullCalendar('addEventSource', data.eventSource);
$('#fullcalendar').fullCalendar('removeEventSource', data.eventSource.url);
$('#fullcalendar').fullCalendar('addEventSource', data.eventSource);
if (calendarid == 'new'){
$('#choosecalendar_dialog > table:first').append('<tr><td colspan="6"><a href="#" onclick="Calendar.UI.Calendar.newCalendar(this);"><input type="button" value="' + newcalendar + '"></a></td></tr>');
}
@ -504,7 +504,7 @@ Calendar={
idtype: '',
activation:function(object,owner,id){
$.post(OC.filePath('calendar', 'ajax/share', 'activation.php'),{id:id, idtype:'calendar', activation:object.checked?1:0});
$('#calendar_holder').fullCalendar('refetchEvents');
$('#fullcalendar').fullCalendar('refetchEvents');
},
dropdown:function(userid, calid){
$('.calendar_share_dropdown').remove();
@ -612,7 +612,7 @@ Calendar={
console.log('The drop-import feature is not supported in your browser :(');
return false;
}
droparea = document.getElementById('calendar_holder');
droparea = document.getElementById('fullcalendar');
droparea.ondrop = function(e){
e.preventDefault();
Calendar.UI.Drop.drop(e);
@ -626,7 +626,7 @@ Calendar={
reader = new FileReader();
reader.onload = function(event){
Calendar.UI.Drop.import(event.target.result);
$('#calendar_holder').fullCalendar('refetchEvents');
$('#fullcalendar').fullCalendar('refetchEvents');
}
reader.readAsDataURL(file);
}
@ -634,7 +634,7 @@ Calendar={
import:function(data){
$.post(OC.filePath('calendar', 'ajax/import', 'dropimport.php'), {'data':data},function(result) {
if(result.status == 'success'){
$('#calendar_holder').fullCalendar('addEventSource', result.eventSource);
$('#fullcalendar').fullCalendar('addEventSource', result.eventSource);
$('#notification').html(result.message);
$('#notification').slideDown();
window.setTimeout(function(){$('#notification').slideUp();}, 5000);
@ -647,7 +647,11 @@ Calendar={
});
}
}
}
},
Settings:{
//
},
}
$.fullCalendar.views.list = ListView;
function ListView(element, calendar) {
@ -815,7 +819,7 @@ function ListView(element, calendar) {
}
$(document).ready(function(){
Calendar.UI.initScroll();
$('#calendar_holder').fullCalendar({
$('#fullcalendar').fullCalendar({
header: false,
firstDay: firstDay,
editable: true,
@ -851,10 +855,10 @@ $(document).ready(function(){
}
Calendar.UI.setViewActive(view.name);
if (view.name == 'agendaWeek') {
$('#calendar_holder').fullCalendar('option', 'aspectRatio', 0.1);
$('#fullcalendar').fullCalendar('option', 'aspectRatio', 0.1);
}
else {
$('#calendar_holder').fullCalendar('option', 'aspectRatio', 1.35);
$('#fullcalendar').fullCalendar('option', 'aspectRatio', 1.35);
}
},
columnFormat: {
@ -888,7 +892,7 @@ $(document).ready(function(){
changeYear: true,
showButtonPanel: true,
beforeShow: function(input, inst) {
var calendar_holder = $('#calendar_holder');
var calendar_holder = $('#fullcalendar');
var date = calendar_holder.fullCalendar('getDate');
inst.input.datepicker('setDate', date);
inst.input.val(calendar_holder.fullCalendar('getView').title);
@ -896,30 +900,36 @@ $(document).ready(function(){
},
onSelect: function(value, inst) {
var date = inst.input.datepicker('getDate');
$('#calendar_holder').fullCalendar('gotoDate', date);
$('#fullcalendar').fullCalendar('gotoDate', date);
}
});
fillWindow($('#content'));
OCCategories.changed = Calendar.UI.categoriesChanged;
OCCategories.app = 'calendar';
$('#oneweekview_radio').click(function(){
$('#calendar_holder').fullCalendar('changeView', 'agendaWeek');
$('#fullcalendar').fullCalendar('changeView', 'agendaWeek');
});
$('#onemonthview_radio').click(function(){
$('#calendar_holder').fullCalendar('changeView', 'month');
$('#fullcalendar').fullCalendar('changeView', 'month');
});
$('#listview_radio').click(function(){
$('#calendar_holder').fullCalendar('changeView', 'list');
$('#fullcalendar').fullCalendar('changeView', 'list');
});
$('#today_input').click(function(){
$('#calendar_holder').fullCalendar('today');
$('#fullcalendar').fullCalendar('today');
});
$('#datecontrol_left').click(function(){
$('#calendar_holder').fullCalendar('prev');
$('#fullcalendar').fullCalendar('prev');
});
$('#datecontrol_right').click(function(){
$('#calendar_holder').fullCalendar('next');
$('#fullcalendar').fullCalendar('next');
});
Calendar.UI.Share.init();
Calendar.UI.Drop.init();
$('#choosecalendar .generalsettings').on('click keydown', function() {
OC.appSettings({appid:'calendar', loadJS:true, cache:false});
});
$('#choosecalendar .calendarsettings').on('click keydown', function() {
OC.appSettings({appid:'calendar', loadJS:true, cache:false, scriptName:'calendar.php'});
});
});

View File

@ -1,11 +1,7 @@
$(document).ready(function(){
$('#timezone').change( function(){
OC.msg.startSaving('#calendar .msg')
// Serialize the data
var post = $( '#timezone' ).serialize();
$.post( OC.filePath('calendar', 'ajax/settings', 'settimezone.php'), post, function(data){
//OC.msg.finishedSaving('#calendar .msg', data);
});
$.post( OC.filePath('calendar', 'ajax/settings', 'settimezone.php'), post, function(data){return;});
return false;
});
$('#timezone').chosen();
@ -52,6 +48,7 @@ $(document).ready(function(){
});
});
calendarcachecheck();
});
function calendarcachecheck(){
$.getJSON(OC.filePath('calendar', 'ajax/cache', 'status.php'), function(jsondata, status) {

View File

@ -14,4 +14,4 @@ $tmpl->assign('calendars', OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(
OCP\Util::addscript('calendar','settings');
return $tmpl->fetchPage();
$tmpl->printPage();

View File

@ -33,6 +33,7 @@
?>
});
</script>
<div id="notification" style="display:none;"></div>
<div id="controls">
<form id="view">
<input type="button" value="<?php echo $l->t('Week');?>" id="oneweekview_radio"/>
@ -41,8 +42,9 @@
<img id="loading" src="<?php echo OCP\Util::imagePath('core', 'loading.gif'); ?>" />
</form>
<form id="choosecalendar">
<input type="button" id="today_input" value="<?php echo $l->t("Today");?>"/>
<input type="button" id="choosecalendar_input" value="<?php echo $l->t("Calendars");?>" onclick="Calendar.UI.Calendar.overview();" />
<!--<input type="button" id="today_input" value="<?php echo $l->t("Today");?>"/>-->
<a class="settings calendarsettings" title="<?php echo $l->t('Settings'); ?>"><img class="svg" src="<?php echo OCP\Util::imagePath('calendar', 'icon.svg'); ?>" alt="<?php echo $l->t('Settings'); ?>" /></a>
<a class="settings generalsettings" title="<?php echo $l->t('Settings'); ?>"><img class="svg" src="core/img/actions/settings.svg" alt="<?php echo $l->t('Settings'); ?>" /></a>
</form>
<form id="datecontrol">
<input type="button" value="&nbsp;&lt;&nbsp;" id="datecontrol_left"/>
@ -50,12 +52,6 @@
<input type="button" value="&nbsp;&gt;&nbsp;" id="datecontrol_right"/>
</form>
</div>
<div id="notification" style="display:none;"></div>
<div id="calendar_holder">
</div>
<!-- Dialogs -->
<div id="fullcalendar"></div>
<div id="dialog_holder"></div>
<div id="parsingfail_dialog" title="Parsing Fail">
<?php echo $l->t("There was a fail, while parsing the file."); ?>
</div>
<!-- End of Dialogs -->
<div id="appsettings" class="popup topright hidden"></div>

View File

@ -1,51 +1,52 @@
<div id="choosecalendar_dialog" title="<?php echo $l->t("Choose active calendars"); ?>">
<p><b><?php echo $l->t('Your calendars'); ?>:</b></p>
<table width="100%" style="border: 0;">
<?php
$option_calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
for($i = 0; $i < count($option_calendars); $i++){
echo "<tr>";
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $option_calendars[$i]);
if(OC_Calendar_Share::allUsersSharedwith($option_calendars[$i]['id'], OC_Calendar_Share::CALENDAR) == array()){
$shared = false;
}else{
$shared = true;
<form id="calendar">
<p><b><?php echo $l->t('Your calendars'); ?>:</b></p>
<table width="100%" style="border: 0;">
<?php
$option_calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
for($i = 0; $i < count($option_calendars); $i++){
echo "<tr>";
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $option_calendars[$i]);
if(OC_Calendar_Share::allUsersSharedwith($option_calendars[$i]['id'], OC_Calendar_Share::CALENDAR) == array()){
$shared = false;
}else{
$shared = true;
}
$tmpl->assign('shared', $shared);
$tmpl->printpage();
echo "</tr>";
}
$tmpl->assign('shared', $shared);
$tmpl->printpage();
echo "</tr>";
}
?>
<tr>
<td colspan="6">
<a href="#" onclick="Calendar.UI.Calendar.newCalendar(this);"><input type="button" value="<?php echo $l->t('New Calendar') ?>"></a>
</td>
</tr>
<tr>
<td colspan="6">
<p style="margin: 0 auto;width: 90%;"><input style="display:none;width: 90%;float: left;" type="text" id="caldav_url" onmouseover="$('#caldav_url').select();" title="<?php echo $l->t("CalDav Link"); ?>"><img id="caldav_url_close" style="height: 20px;vertical-align: middle;display: none;" src="<?php echo OCP\Util::imagePath('core', 'actions/delete.svg') ?>" alt="close" onclick="$('#caldav_url').hide();$('#caldav_url_close').hide();"/></p>
</td>
</tr>
</table><br>
<p><b><?php echo $l->t('Shared calendars'); ?>: </b></p>
<table width="100%" style="border: 0;">
<?php
$share = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR);
$count = count($share);
for($i = 0; $i < $count; $i++){
$share[$i]['calendar'] = OC_Calendar_App::getCalendar($share[$i]['calendarid'], false, false);
echo '<tr>';
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields.shared');
$tmpl->assign('share', $share[$i]);
$tmpl->printpage();
echo '</tr>';
}
?>
</table>
<?php
if($count == 0){
echo '<p style="text-align:center;"><b>' . $l->t('No shared calendars') . '</b></p>';
}
?>
</div>
?>
<tr>
<td colspan="6">
<a href="#" onclick="Calendar.UI.Calendar.newCalendar(this);"><input type="button" value="<?php echo $l->t('New Calendar') ?>"></a>
</td>
</tr>
<tr>
<td colspan="6">
<p style="margin: 0 auto;width: 90%;"><input style="display:none;width: 90%;float: left;" type="text" id="caldav_url" onmouseover="$('#caldav_url').select();" title="<?php echo $l->t("CalDav Link"); ?>"><img id="caldav_url_close" style="height: 20px;vertical-align: middle;display: none;" src="<?php echo OCP\Util::imagePath('core', 'actions/delete.svg') ?>" alt="close" onclick="$('#caldav_url').hide();$('#caldav_url_close').hide();"/></p>
</td>
</tr>
</table><br>
<p><b><?php echo $l->t('Shared calendars'); ?>: </b></p>
<table width="100%" style="border: 0;">
<?php
$share = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR);
$count = count($share);
for($i = 0; $i < $count; $i++){
$share[$i]['calendar'] = OC_Calendar_App::getCalendar($share[$i]['calendarid'], false, false);
echo '<tr>';
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields.shared');
$tmpl->assign('share', $share[$i]);
$tmpl->printpage();
echo '</tr>';
}
?>
</table>
<?php
if($count == 0){
echo '<p style="text-align:center;"><b>' . $l->t('No shared calendars') . '</b></p>';
}
?>
</fieldset>
</form>

View File

@ -7,11 +7,16 @@
* See the COPYING-README file.
*/
?>
<form id="calendar">
<fieldset class="personalblock">
<legend><?php echo $l->t('Calendar'); ?></legend>
<table class="nostyle">
<tr><td><label for="timezone" class="bold"><?php echo $l->t('Timezone');?></label></td><td><select style="display: none;" id="timezone" name="timezone">
<h2 id="title_general"><?php echo $l->t('General'); ?></h2>
<div id="general">
<table class="nostyle">
<tr>
<td>
<label for="timezone" class="bold"><?php echo $l->t('Timezone');?></label>
&nbsp;&nbsp;
</td>
<td>
<select style="display: none;" id="timezone" name="timezone">
<?php
$continent = '';
foreach($_['timezones'] as $timezone):
@ -27,29 +32,58 @@
$city=strtr($ex[1], '_', ' ');
$continent=$ex[0];
echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>';
var_dump($_['timezone']);
endforeach;?>
</select><input type="checkbox" name="timezonedetection" id="timezonedetection"><label for="timezonedetection"><?php echo $l->t('Check always for changes of the timezone'); ?></label></td></tr>
<tr><td><label for="timeformat" class="bold"><?php echo $l->t('Timeformat');?></label></td><td>
</select>
</td>
</tr>
<tr>
<td>
&nbsp;&nbsp;
</td>
<td>
<input type="checkbox" name="timezonedetection" id="timezonedetection">
&nbsp;
<label for="timezonedetection"><?php echo $l->t('Update timezone automatically'); ?></label>
</td>
</tr>
<tr>
<td>
<label for="timeformat" class="bold"><?php echo $l->t('Time format');?></label>
&nbsp;&nbsp;
</td>
<td>
<select style="display: none; width: 60px;" id="timeformat" title="<?php echo "timeformat"; ?>" name="timeformat">
<option value="24" id="24h"><?php echo $l->t("24h"); ?></option>
<option value="ampm" id="ampm"><?php echo $l->t("12h"); ?></option>
</select>
</td></tr>
<tr><td><label for="firstday" class="bold"><?php echo $l->t('First day of the week');?></label></td><td>
</td>
</tr>
<tr>
<td>
<label for="firstday" class="bold"><?php echo $l->t('Start week on');?></label>
&nbsp;&nbsp;
</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>
<tr><td><label for="" class="bold"><?php echo $l->t('Cache');?></label></td><td>
<input id="cleancalendarcache" type="button" class="button" value="<?php echo $l->t('Clear cache for repeating events');?>">
</td></tr>
</table>
</td>
</tr>
<tr class="advancedsettings">
<td>
<label for="" class="bold"><?php echo $l->t('Cache');?></label>
&nbsp;&nbsp;
</td>
<td>
<input id="cleancalendarcache" type="button" class="button" value="<?php echo $l->t('Clear cache for repeating events');?>">
</td>
</tr>
</table>
</div>
<h2 id="title_urls"><?php echo $l->t('URLs'); ?></h2>
<div id="urls">
<?php echo $l->t('Calendar CalDAV syncing addresses'); ?> (<a href="http://owncloud.org/synchronisation/" target="_blank"><?php echo $l->t('more info'); ?></a>)
<dl>
<dt><?php echo $l->t('Primary address (Kontact et al)'); ?></dt>
@ -63,5 +97,5 @@
<?php } ?>
</dd>
</dl>
</fieldset>
</form>
</div>
</div>