diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-09 11:38:22 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-09 11:38:22 -0400 |
commit | 78cd1153f012f871935130325167759898f030ab (patch) | |
tree | 685a5fe56663e6b6087aa4f28c8f09daf1e80546 /apps | |
parent | b830b3e24b281204344e9162352c7034f0a67187 (diff) | |
parent | f9cec1426fe639a5683e36b5fbdeb9149feacb19 (diff) | |
download | nextcloud-server-78cd1153f012f871935130325167759898f030ab.tar.gz nextcloud-server-78cd1153f012f871935130325167759898f030ab.zip |
Merge branch 'master' into share_api
Conflicts:
apps/contacts/lib/vcard.php
apps/files_sharing/sharedstorage.php
Diffstat (limited to 'apps')
43 files changed, 401 insertions, 307 deletions
diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php index 483716405a1..c8a64d531c9 100644 --- a/apps/bookmarks/ajax/addBookmark.php +++ b/apps/bookmarks/ajax/addBookmark.php @@ -21,11 +21,6 @@ * */ -//no apps or filesystem -$RUNTIME_NOSETUPFS=true; - - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); @@ -34,4 +29,4 @@ OCP\JSON::checkAppEnabled('bookmarks'); require_once(OC_App::getAppPath('bookmarks').'/bookmarksHelper.php'); $id = addBookmark($_POST['url'], $_POST['title'], $_POST['tags']); -OCP\JSON::success(array('data' => $id));
\ No newline at end of file +OCP\JSON::success(array('data' => $id)); diff --git a/apps/bookmarks/ajax/delBookmark.php b/apps/bookmarks/ajax/delBookmark.php index f40f02ebab7..ba1dfff3bed 100644 --- a/apps/bookmarks/ajax/delBookmark.php +++ b/apps/bookmarks/ajax/delBookmark.php @@ -21,11 +21,6 @@ * */ -//no apps or filesystem -$RUNTIME_NOSETUPFS=true; - - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); diff --git a/apps/bookmarks/ajax/editBookmark.php b/apps/bookmarks/ajax/editBookmark.php index 0b37d161af1..ad43be064f0 100644 --- a/apps/bookmarks/ajax/editBookmark.php +++ b/apps/bookmarks/ajax/editBookmark.php @@ -21,11 +21,6 @@ * */ -//no apps or filesystem -$RUNTIME_NOSETUPFS=true; - - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); diff --git a/apps/bookmarks/ajax/recordClick.php b/apps/bookmarks/ajax/recordClick.php index 1eee1718d13..0283f09f60d 100644 --- a/apps/bookmarks/ajax/recordClick.php +++ b/apps/bookmarks/ajax/recordClick.php @@ -21,11 +21,6 @@ * */ -//no apps or filesystem -$RUNTIME_NOSETUPFS=true; - - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('bookmarks'); diff --git a/apps/bookmarks/ajax/updateList.php b/apps/bookmarks/ajax/updateList.php index 4de2475d067..cf9a2cf9183 100644 --- a/apps/bookmarks/ajax/updateList.php +++ b/apps/bookmarks/ajax/updateList.php @@ -22,11 +22,6 @@ * */ -//no apps or filesystem -$RUNTIME_NOSETUPFS=true; - - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('bookmarks'); diff --git a/apps/calendar/ajax/calendar/overview.php b/apps/calendar/ajax/calendar/overview.php index 9d43364ffbf..1d8e49ea5f2 100644 --- a/apps/calendar/ajax/calendar/overview.php +++ b/apps/calendar/ajax/calendar/overview.php @@ -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'); diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 72ddde60152..9ae255853d5 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -35,7 +35,6 @@ 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'); OCP\Share::registerBackend('calendar', 'OC_Share_Backend_Calendar'); OCP\Share::registerBackend('event', 'OC_Share_Backend_Event'); diff --git a/apps/calendar/calendar.php b/apps/calendar/calendar.php new file mode 100644 index 00000000000..2c0bee9d233 --- /dev/null +++ b/apps/calendar/calendar.php @@ -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();
\ No newline at end of file diff --git a/apps/calendar/css/style.css b/apps/calendar/css/style.css index 373a4565638..5cda4b1beff 100644 --- a/apps/calendar/css/style.css +++ b/apps/calendar/css/style.css @@ -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; +}
\ No newline at end of file diff --git a/apps/calendar/index.php b/apps/calendar/index.php index cbfe0027b7b..352c295c437 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -5,8 +5,7 @@ * later. * See the COPYING-README file. */ - - +DEFINE('DEBUG', TRUE); OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('calendar'); diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 25311fa0df4..23846c89b84 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -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'}); + }); }); diff --git a/apps/calendar/js/settings.js b/apps/calendar/js/settings.js index 60741f2b6fc..20753a7b8fe 100644 --- a/apps/calendar/js/settings.js +++ b/apps/calendar/js/settings.js @@ -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) { diff --git a/apps/calendar/settings.php b/apps/calendar/settings.php index eaa20c6c9b4..f563518046d 100644 --- a/apps/calendar/settings.php +++ b/apps/calendar/settings.php @@ -14,4 +14,4 @@ $tmpl->assign('calendars', OC_Calendar_Calendar::allCalendars(OCP\USER::getUser( OCP\Util::addscript('calendar','settings'); -return $tmpl->fetchPage(); +$tmpl->printPage();
\ No newline at end of file diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 29b9bf6bc54..c94cc755ab3 100644 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -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=" < " id="datecontrol_left"/> @@ -50,12 +52,6 @@ <input type="button" value=" > " 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>
\ No newline at end of file diff --git a/apps/calendar/templates/part.choosecalendar.php b/apps/calendar/templates/part.choosecalendar.php index 8d621cc3630..ad2f9e753f2 100644 --- a/apps/calendar/templates/part.choosecalendar.php +++ b/apps/calendar/templates/part.choosecalendar.php @@ -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>
\ No newline at end of file + ?> + <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>
\ No newline at end of file diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php index 28c357621a8..56a6a42ee0e 100644 --- a/apps/calendar/templates/settings.php +++ b/apps/calendar/templates/settings.php @@ -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> + + </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> + + </td> + <td> + <input type="checkbox" name="timezonedetection" id="timezonedetection"> + + <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> + + </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> + + </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> + + </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>
\ No newline at end of file diff --git a/apps/contacts/ajax/contact/add.php b/apps/contacts/ajax/contact/add.php index 6aaf5a9df35..043e947dc4b 100644 --- a/apps/contacts/ajax/contact/add.php +++ b/apps/contacts/ajax/contact/add.php @@ -49,4 +49,10 @@ if(!$id) { exit(); } -OCP\JSON::success(array('data' => array( 'id' => $id, 'aid' => $aid ))); +OCP\JSON::success(array( + 'data' => array( + 'id' => $id, + 'aid' => $aid, + 'lastmodified' => OC_Contacts_VCard::lastModified($vcard)->format('U') + ) +)); diff --git a/apps/contacts/ajax/contact/addproperty.php b/apps/contacts/ajax/contact/addproperty.php index 58b857547fb..df064367ef1 100644 --- a/apps/contacts/ajax/contact/addproperty.php +++ b/apps/contacts/ajax/contact/addproperty.php @@ -25,7 +25,7 @@ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); OCP\JSON::callCheck(); -require_once 'loghandler.php'; +require_once __DIR__.'/../loghandler.php'; $id = isset($_POST['id'])?$_POST['id']:null; $name = isset($_POST['name'])?$_POST['name']:null; @@ -48,9 +48,9 @@ if(!$vcard) { if(!is_array($value)) { $value = trim($value); - if(!$value + if(!$value && in_array( - $name, + $name, array('TEL', 'EMAIL', 'ORG', 'BDAY', 'URL', 'NICKNAME', 'NOTE')) ) { bailOut($l10n->t('Cannot add empty property.')); @@ -78,9 +78,9 @@ foreach($current as $item) { } if(is_array($value)) { - // NOTE: Important, otherwise the compound value will + // NOTE: Important, otherwise the compound value will // be set in the order the fields appear in the form! - ksort($value); + ksort($value); $value = array_map('strip_tags', $value); } else { $value = strip_tags($value); @@ -123,10 +123,10 @@ switch($name) { $line = count($vcard->children) - 1; -// Apparently Sabre_VObject_Parameter doesn't do well with +// Apparently Sabre_VObject_Parameter doesn't do well with // multiple values or I don't know how to do it. Tanghus. foreach ($parameters as $key=>$element) { - if(is_array($element) && strtoupper($key) == 'TYPE') { + if(is_array($element) && strtoupper($key) == 'TYPE') { // NOTE: Maybe this doesn't only apply for TYPE? // And it probably shouldn't be done here anyways :-/ foreach($element as $e) { @@ -144,4 +144,9 @@ if(!OC_Contacts_VCard::edit($id, $vcard)) { bailOut($l10n->t('Error adding contact property: '.$name)); } -OCP\JSON::success(array('data' => array( 'checksum' => $checksum ))); +OCP\JSON::success(array( + 'data' => array( + 'checksum' => $checksum, + 'lastmodified' => OC_Contacts_VCard::lastModified($vcard)->format('U')) + ) +); diff --git a/apps/contacts/ajax/contact/delete.php b/apps/contacts/ajax/contact/delete.php index 9777046fc82..def98b36705 100644 --- a/apps/contacts/ajax/contact/delete.php +++ b/apps/contacts/ajax/contact/delete.php @@ -23,7 +23,8 @@ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); OCP\JSON::callCheck(); -require_once 'loghandler.php'; + +require_once __DIR__.'/../loghandler.php'; $id = isset($_POST['id'])?$_POST['id']:null; if(!$id) { diff --git a/apps/contacts/ajax/contact/deleteproperty.php b/apps/contacts/ajax/contact/deleteproperty.php index 205df8bc184..d7545ff1fbf 100644 --- a/apps/contacts/ajax/contact/deleteproperty.php +++ b/apps/contacts/ajax/contact/deleteproperty.php @@ -24,7 +24,8 @@ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); OCP\JSON::callCheck(); -require_once 'loghandler.php'; + +require_once __DIR__.'/../loghandler.php'; $id = $_POST['id']; $checksum = $_POST['checksum']; @@ -43,4 +44,9 @@ if(!OC_Contacts_VCard::edit($id, $vcard)) { bailOut($l10n->t('Error deleting contact property.')); } -OCP\JSON::success(array('data' => array( 'id' => $id ))); +OCP\JSON::success(array( + 'data' => array( + 'id' => $id, + 'lastmodified' => OC_Contacts_VCard::lastModified($vcard)->format('U'), + ) +)); diff --git a/apps/contacts/ajax/contact/details.php b/apps/contacts/ajax/contact/details.php index 0e07f9ec3d8..c22f18937d7 100644 --- a/apps/contacts/ajax/contact/details.php +++ b/apps/contacts/ajax/contact/details.php @@ -53,5 +53,6 @@ if(isset($details['PHOTO'])) { $details['id'] = $id; $details['displayname'] = $card['fullname']; $details['addressbookid'] = $card['addressbookid']; +$details['lastmodified'] = OC_Contacts_App::lastModified($vcard)->format('U'); OC_Contacts_App::setLastModifiedHeader($vcard); OCP\JSON::success(array('data' => $details)); diff --git a/apps/contacts/ajax/contact/saveproperty.php b/apps/contacts/ajax/contact/saveproperty.php index ef4d1b26c5b..799038b6f1d 100644 --- a/apps/contacts/ajax/contact/saveproperty.php +++ b/apps/contacts/ajax/contact/saveproperty.php @@ -19,7 +19,9 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ -require_once 'loghandler.php'; + +require_once __DIR__.'/../loghandler.php'; + // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); @@ -146,5 +148,6 @@ if(!OC_Contacts_VCard::edit($id, $vcard)) { OCP\JSON::success(array('data' => array( 'line' => $line, 'checksum' => $checksum, - 'oldchecksum' => $_POST['checksum'])) -); + 'oldchecksum' => $_POST['checksum'] + 'lastmodified' => OC_Contacts_VCard::lastModified($vcard)->format('U') +)); diff --git a/apps/contacts/ajax/savecrop.php b/apps/contacts/ajax/savecrop.php index 1df5299c7a6..2483d0f7128 100644 --- a/apps/contacts/ajax/savecrop.php +++ b/apps/contacts/ajax/savecrop.php @@ -62,17 +62,17 @@ if($data) { if($image->crop($x1, $y1, $w, $h)) { if(($image->width() <= 200 && $image->height() <= 200) || $image->resize(200)) { - $card = OC_Contacts_App::getContactVCard($id); - if(!$card) { + $vcard = OC_Contacts_App::getContactVCard($id); + if(!$vcard) { OC_Cache::remove($tmpkey); bailOut(OC_Contacts_App::$l10n ->t('Error getting contact object.')); } - if($card->__isset('PHOTO')) { + if($vcard->__isset('PHOTO')) { OCP\Util::writeLog('contacts', 'savecrop.php: PHOTO property exists.', OCP\Util::DEBUG); - $property = $card->__get('PHOTO'); + $property = $vcard->__get('PHOTO'); if(!$property) { OC_Cache::remove($tmpkey); bailOut(OC_Contacts_App::$l10n @@ -83,27 +83,28 @@ if($data) { = new Sabre_VObject_Parameter('ENCODING', 'b'); $property->parameters[] = new Sabre_VObject_Parameter('TYPE', $image->mimeType()); - $card->__set('PHOTO', $property); + $vcard->__set('PHOTO', $property); } else { OCP\Util::writeLog('contacts', 'savecrop.php: files: Adding PHOTO property.', OCP\Util::DEBUG); - $card->addProperty('PHOTO', + $vcard->addProperty('PHOTO', $image->__toString(), array('ENCODING' => 'b', 'TYPE' => $image->mimeType())); } $now = new DateTime; - $card->setString('REV', $now->format(DateTime::W3C)); - if(!OC_Contacts_VCard::edit($id, $card)) { + $vcard->setString('REV', $now->format(DateTime::W3C)); + if(!OC_Contacts_VCard::edit($id, $vcard)) { bailOut(OC_Contacts_App::$l10n->t('Error saving contact.')); } - $tmpl = new OCP\Template("contacts", "part.contactphoto"); - $tmpl->assign('id', $id); - $tmpl->assign('refresh', true); - $tmpl->assign('width', $image->width()); - $tmpl->assign('height', $image->height()); - $page = $tmpl->fetchPage(); - OCP\JSON::success(array('data' => array('page'=>$page))); + OCP\JSON::success(array( + 'data' => array( + 'id' => $id, + 'width' => $image->width(), + 'height' => $image->height(), + 'lastmodified' => OC_Contacts_App::lastModified($vcard)->format('U') + ) + )); } else { bailOut(OC_Contacts_App::$l10n->t('Error resizing image')); } diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css index df9bba2dd3e..ad8762167b5 100644 --- a/apps/contacts/css/contacts.css +++ b/apps/contacts/css/contacts.css @@ -141,4 +141,7 @@ input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; } .addressbooks-settings .actions * { float: left; } .addressbooks-settings .actions input.name { width: 5em; } .addressbooks-settings .actions input.name { width: 7em; } +.addressbooks-settings a.action { opacity: 0.2; } +.addressbooks-settings a.action:hover { opacity: 1; } +.addressbooks-settings td.active, .addressbooks-settings td.action { width: 20px; } diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index 9aec02557fc..67bfa9847ee 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -835,7 +835,7 @@ OC.Contacts={ OC.Contacts.propertyContainerFor(obj).data('checksum', ''); if(proptype == 'PHOTO') { OC.Contacts.Contacts.refreshThumbnail(OC.Contacts.Card.id); - OC.Contacts.Card.loadPhoto(true); + OC.Contacts.Card.loadPhoto(); } else if(proptype == 'NOTE') { $('#note').find('textarea').val(''); OC.Contacts.propertyContainerFor(obj).hide(); @@ -1218,9 +1218,9 @@ OC.Contacts={ } }); }, - loadPhoto:function(refresh){ + loadPhoto:function(){ var self = this; - var refreshstr = (refresh?'&refresh=1'+Math.random():'') + var refreshstr = ''; //'&refresh='+Math.random(); $('#phototools li a').tipsy('hide'); var wrapper = $('#contacts_details_photo_wrapper'); wrapper.addClass('loading').addClass('wait'); @@ -1278,7 +1278,7 @@ OC.Contacts={ var response=jQuery.parseJSON(target.contents().text()); if(response != undefined && response.status == 'success'){ // load cropped photo. - self.loadPhoto(true); + self.loadPhoto(); OC.Contacts.Card.data.PHOTO = true; }else{ OC.dialogs.alert(response.data.message, t('contacts', 'Error')); diff --git a/apps/contacts/js/settings.js b/apps/contacts/js/settings.js index ee8d889d722..69cf473e06a 100644 --- a/apps/contacts/js/settings.js +++ b/apps/contacts/js/settings.js @@ -90,8 +90,7 @@ OC.Contacts.Settings = OC.Contacts.Settings || { + '<td class="action"><a class="svg action globe" title="'+t('contacts', 'Show CardDav link')+'"></a></td>' + '<td class="action"><a class="svg action cloud" title="'+t('contacts', 'Show read-only VCF link')+'"></a></td>' + '<td class="action"><a class="svg action download" title="'+t('contacts', 'Download')+'" ' - + 'href="'+totalurl+'/'+encodeURIComponent(oc_current_user)+'/' - + encodeURIComponent(jsondata.data.addressbook.uri)+'?export"></a></td>' + + 'href="'+OC.linkTo('contacts', 'export.php')+'?bookid='+jsondata.data.addressbook.id+'"></a></td>' + '<td class="action"><a class="svg action edit" title="'+t('contacts', 'Edit')+'"></a></td>' + '<td class="action"><a class="svg action delete" title="'+t('contacts', 'Delete')+'"></a></td>' + '</tr>'); @@ -107,17 +106,27 @@ OC.Contacts.Settings = OC.Contacts.Settings || { } }); }, + showLink:function(id, row, link) { + console.log('row:', row.length); + row.next('tr.link').remove(); + var linkrow = $('<tr class="link"><td colspan="5"><input style="width: 95%;" type="text" value="'+link+'" /></td>' + + '<td colspan="3"><button>'+t('contacts', 'Cancel')+'</button></td></tr>').insertAfter(row); + linkrow.find('input').focus().select(); + linkrow.find('button').click(function() { + $(this).parents('tr').first().remove(); + }); + }, showCardDAV:function(id) { console.log('showCardDAV: ', id); var row = this.adrsettings.find('tr[data-id="'+id+'"]'); - this.adractions.find('.link').val(totalurl+'/'+encodeURIComponent(oc_current_user)+'/'); - this.showActions(['link','cancel']); + this.showLink(id, row, totalurl+'/'+encodeURIComponent(oc_current_user)); }, showVCF:function(id) { console.log('showVCF: ', id); var row = this.adrsettings.find('tr[data-id="'+id+'"]'); - this.adractions.find('.link').val(totalurl+'/'+encodeURIComponent(oc_current_user)+'/'+encodeURIComponent(row.data('uri'))+'?export'); - this.showActions(['link','cancel']); + var link = totalurl+'/'+encodeURIComponent(oc_current_user)+'/'+encodeURIComponent(row.data('uri'))+'?export'; + console.log(link); + this.showLink(id, row, link); } } }; diff --git a/apps/contacts/l10n/de.php b/apps/contacts/l10n/de.php index 08e28f3fd0d..5fa5bb4f9dd 100644 --- a/apps/contacts/l10n/de.php +++ b/apps/contacts/l10n/de.php @@ -108,6 +108,8 @@ "Next contact in list" => "Nächster Kontakt aus der Liste", "Previous contact in list" => "Vorheriger Kontakt aus der Liste", "Expand/collapse current addressbook" => "Ausklappen/Einklappen des Adressbuches", +"Next addressbook" => "Nächstes Adressbuch", +"Previous addressbook" => "Vorheriges Adressbuch", "Actions" => "Aktionen", "Refresh contacts list" => "Kontaktliste neu laden", "Add new contact" => "Neuen Kontakt hinzufügen", diff --git a/apps/contacts/l10n/fr.php b/apps/contacts/l10n/fr.php index 88521f84e88..9b4822bd976 100644 --- a/apps/contacts/l10n/fr.php +++ b/apps/contacts/l10n/fr.php @@ -63,6 +63,8 @@ "Result: " => "Résultat :", " imported, " => "importé,", " failed." => "échoué.", +"Displayname cannot be empty." => "Le nom d'affichage ne peut pas être vide.", +"Addressbook not found: " => "Carnet d'adresse introuvable : ", "This is not your addressbook." => "Ce n'est pas votre carnet d'adresses.", "Contact could not be found." => "Ce contact n'a pu être trouvé.", "Address" => "Adresse", @@ -97,6 +99,7 @@ "Contact" => "Contact", "Add Contact" => "Ajouter un Contact", "Import" => "Importer", +"Settings" => "Paramètres", "Addressbooks" => "Carnets d'adresses", "Close" => "Fermer", "Keyboard shortcuts" => "Raccourcis clavier", @@ -104,6 +107,8 @@ "Next contact in list" => "Contact suivant dans la liste", "Previous contact in list" => "Contact précédent dans la liste", "Expand/collapse current addressbook" => "Dé/Replier le carnet d'adresses courant", +"Next addressbook" => "Carnet d'adresses suivant", +"Previous addressbook" => "Carnet d'adresses précédent", "Actions" => "Actions", "Refresh contacts list" => "Actualiser la liste des contacts", "Add new contact" => "Ajouter un nouveau contact", @@ -190,9 +195,13 @@ "more info" => "Plus d'infos", "Primary address (Kontact et al)" => "Adresse principale", "iOS/OS X" => "iOS/OS X", +"Show CardDav link" => "Afficher le lien CardDav", "Download" => "Télécharger", "Edit" => "Modifier", "New Address Book" => "Nouveau Carnet d'adresses", +"Name" => "Nom", +"Description" => "Description", "Save" => "Sauvegarder", -"Cancel" => "Annuler" +"Cancel" => "Annuler", +"More..." => "Plus…" ); diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php index e8d9abac417..f6ce213c49b 100644 --- a/apps/contacts/lib/app.php +++ b/apps/contacts/lib/app.php @@ -243,6 +243,18 @@ class OC_Contacts_App { self::getVCategories()->loadFromVObject($contact, true); } + /** + * @brief Get the last modification time. + * @param $vcard OC_VObject + * $return DateTime | null + */ + public static function lastModified($vcard) { + $rev = $vcard->getAsString('REV'); + if ($rev) { + return DateTime::createFromFormat(DateTime::W3C, $rev); + } + } + public static function setLastModifiedHeader($contact) { $rev = $contact->getAsString('REV'); if ($rev) { diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index a93ca399d3a..4cc18027acf 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -282,12 +282,13 @@ class OC_Contacts_VCard{ /** * @brief Adds a card - * @param integer $aid Addressbook id - * @param OC_VObject $card vCard file - * @param string $uri the uri of the card, default based on the UID + * @param $aid integer Addressbook id + * @param $card OC_VObject vCard file + * @param $uri string the uri of the card, default based on the UID + * @param $isChecked boolean If the vCard should be checked for validity and version. * @return insertid on success or false. */ - public static function add($aid, OC_VObject $card, $uri=null, $isnew=false){ + public static function add($aid, OC_VObject $card, $uri=null, $isChecked=false){ if(is_null($card)) { OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::add. No vCard supplied', OCP\Util::ERROR); return null; @@ -295,22 +296,13 @@ class OC_Contacts_VCard{ $addressbook = OC_Contacts_Addressbook::find($aid); if ($addressbook['userid'] != OCP\User::getUser()) { $sharedAddressbook = OCP\Share::getItemSharedWithBySource('addressbook', $aid); - if (!$sharedAddressbook) { + if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_CREATE)) { return false; } - } else { - $sharedAddressbook = false; } - if(!$isnew) { - if ($sharedAddressbook && !($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_UPDATE)) { - return false; - } + if(!$isChecked) { OC_Contacts_App::loadCategoriesFromVCard($card); self::updateValuesFromAdd($aid, $card); - } else { - if ($sharedAddressbook && !($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_CREATE)) { - return false; - } } $card->setString('VERSION', '3.0'); // Add product ID is missing. diff --git a/apps/contacts/photo.php b/apps/contacts/photo.php index efdf157cd95..f5c8e6fe4bd 100644 --- a/apps/contacts/photo.php +++ b/apps/contacts/photo.php @@ -20,14 +20,15 @@ function getStandardImage() { } $id = isset($_GET['id']) ? $_GET['id'] : null; -$caching = isset($_GET['refresh']) ? 0 : null; +$etag = null; +$caching = null; if(is_null($id)) { getStandardImage(); } if(!extension_loaded('gd') || !function_exists('gd_info')) { - OCP\Util::writeLog('contacts', + OCP\Util::writeLog('contacts', 'photo.php. GD module not installed', OCP\Util::DEBUG); getStandardImage(); } @@ -39,25 +40,34 @@ if (!$image) { } // invalid vcard if (is_null($contact)) { - OCP\Util::writeLog('contacts', - 'photo.php. The VCard for ID ' . $id . ' is not RFC compatible', + OCP\Util::writeLog('contacts', + 'photo.php. The VCard for ID ' . $id . ' is not RFC compatible', OCP\Util::ERROR); } else { - OCP\Response::enableCaching($caching); - OC_Contacts_App::setLastModifiedHeader($contact); - // Photo :-) if ($image->loadFromBase64($contact->getAsString('PHOTO'))) { // OK - OCP\Response::setETagHeader(md5($contact->getAsString('PHOTO'))); + $etag = md5($contact->getAsString('PHOTO')); } else // Logo :-/ if ($image->loadFromBase64($contact->getAsString('LOGO'))) { // OK - OCP\Response::setETagHeader(md5($contact->getAsString('LOGO'))); + $etag = md5($contact->getAsString('LOGO')); } if ($image->valid()) { + $modified = OC_Contacts_App::lastModified($contact); + // Force refresh if modified within the last minute. + if(!is_null($modified)) { + $caching = (time() - $modified->format('U') > 60) ? null : 0; + } + OCP\Response::enableCaching($caching); + if(!is_null($modified)) { + OCP\Response::setLastModifiedHeader($modified); + } + if($etag) { + OCP\Response::setETagHeader($etag); + } $max_size = 200; if ($image->width() > $max_size || $image->height() > $max_size) { $image->resize($max_size); diff --git a/apps/contacts/templates/settings.php b/apps/contacts/templates/settings.php index c9713451c8a..e3536c7b461 100644 --- a/apps/contacts/templates/settings.php +++ b/apps/contacts/templates/settings.php @@ -27,8 +27,7 @@ </td> <td class="action"> <a class="svg action download" title="<?php echo $l->t('Download'); ?>" - href="<?php echo OCP\Util::linkToRemote('carddav').'addressbooks/'.OCP\USER::getUser().'/' - .rawurlencode($addressbook['uri']) ?>?export"></a> + href="<?php echo OCP\Util::linkToAbsolute('contacts', 'export.php'); ?>?bookid=<?php echo $addressbook['id'] ?>"></a> </td> <td class="action"> <a class="svg action edit" title="<?php echo $l->t("Edit"); ?>"></a> @@ -44,7 +43,6 @@ <button class="new"><?php echo $l->t('New Address Book') ?></button> <input class="name hidden" type="text" autofocus="autofocus" placeholder="<?php echo $l->t('Name'); ?>" /> <input class="description hidden" type="text" placeholder="<?php echo $l->t('Description'); ?>" /> - <input class="link hidden" style="width: 80%" type="text" autofocus="autofocus" /> <button class="save hidden"><?php echo $l->t('Save') ?></button> <button class="cancel hidden"><?php echo $l->t('Cancel') ?></button> </div> diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php index 6deb5ca379e..1e3714ae6c6 100644 --- a/apps/contacts/thumbnail.php +++ b/apps/contacts/thumbnail.php @@ -26,27 +26,26 @@ OCP\App::checkAppEnabled('contacts'); session_write_close(); function getStandardImage() { - //OCP\Response::setExpiresHeader('P10D'); OCP\Response::enableCaching(); OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person.png')); } if(!extension_loaded('gd') || !function_exists('gd_info')) { - OCP\Util::writeLog('contacts', + OCP\Util::writeLog('contacts', 'thumbnail.php. GD module not installed', OCP\Util::DEBUG); getStandardImage(); exit(); } $id = $_GET['id']; -$caching = isset($_GET['refresh']) ? 0 : null; +$caching = null; $contact = OC_Contacts_App::getContactVCard($id); // invalid vcard if(is_null($contact)) { - OCP\Util::writeLog('contacts', - 'thumbnail.php. The VCard for ID ' . $id . ' is not RFC compatible', + OCP\Util::writeLog('contacts', + 'thumbnail.php. The VCard for ID ' . $id . ' is not RFC compatible', OCP\Util::ERROR); getStandardImage(); exit(); @@ -60,30 +59,39 @@ $thumbnail_size = 23; $image = new OC_Image(); $photo = $contact->getAsString('PHOTO'); if($photo) { - OCP\Response::setETagHeader(md5($photo)); if($image->loadFromBase64($photo)) { if($image->centerCrop()) { if($image->resize($thumbnail_size)) { + $modified = OC_Contacts_App::lastModified($contact); + // Force refresh if modified within the last minute. + if(!is_null($modified)) { + $caching = (time() - $modified->format('U') > 60) ? null : 0; + } + OCP\Response::enableCaching($caching); + if(!is_null($modified)) { + OCP\Response::setLastModifiedHeader($modified); + } + OCP\Response::setETagHeader(md5($photo)); if($image->show()) { exit(); } else { - OCP\Util::writeLog('contacts', - 'thumbnail.php. Couldn\'t display thumbnail for ID ' . $id, + OCP\Util::writeLog('contacts', + 'thumbnail.php. Couldn\'t display thumbnail for ID ' . $id, OCP\Util::ERROR); } } else { - OCP\Util::writeLog('contacts', - 'thumbnail.php. Couldn\'t resize thumbnail for ID ' . $id, + OCP\Util::writeLog('contacts', + 'thumbnail.php. Couldn\'t resize thumbnail for ID ' . $id, OCP\Util::ERROR); } }else{ - OCP\Util::writeLog('contacts', - 'thumbnail.php. Couldn\'t crop thumbnail for ID ' . $id, + OCP\Util::writeLog('contacts', + 'thumbnail.php. Couldn\'t crop thumbnail for ID ' . $id, OCP\Util::ERROR); } } else { - OCP\Util::writeLog('contacts', - 'thumbnail.php. Couldn\'t load image string for ID ' . $id, + OCP\Util::writeLog('contacts', + 'thumbnail.php. Couldn\'t load image string for ID ' . $id, OCP\Util::ERROR); } } diff --git a/apps/files/ajax/mimeicon.php b/apps/files/ajax/mimeicon.php index 80d50f84528..dbb8b60112a 100644 --- a/apps/files/ajax/mimeicon.php +++ b/apps/files/ajax/mimeicon.php @@ -1,9 +1,3 @@ <?php -// no need for apps -$RUNTIME_NOAPPS=false; - -// Init owncloud - - print OC_Helper::mimetypeIcon($_GET['mime']); diff --git a/apps/files/l10n/de.php b/apps/files/l10n/de.php index 1f4b076ee47..9569735d54c 100644 --- a/apps/files/l10n/de.php +++ b/apps/files/l10n/de.php @@ -9,12 +9,17 @@ "Files" => "Dateien", "Unshare" => "Nicht mehr teilen", "Delete" => "Löschen", +"already exists" => "ist bereits vorhanden", +"replace" => "Ersetzen", +"cancel" => "Abbrechen", +"replaced" => "Ersetzt", +"with" => "mit", "undo" => "rückgängig machen", "deleted" => "gelöscht", "generating ZIP-file, it may take some time." => "Erstelle ZIP-Datei. Dies kann eine Weile dauern.", -"Unable to upload your file as it is a directory or has 0 bytes" => "Datei kann nicht hochgeladen werden da sie ein Verzeichniss ist oder 0 bytes hat.", +"Unable to upload your file as it is a directory or has 0 bytes" => "Datei kann nicht hochgeladen werden da sie ein Verzeichnis ist oder 0 Bytes hat.", "Upload Error" => "Fehler beim Hochladen", -"Pending" => "Anstehend", +"Pending" => "Ausstehend", "Upload cancelled." => "Hochladen abgebrochen.", "Invalid name, '/' is not allowed." => "Ungültiger Name, \"/\" ist nicht erlaubt.", "Size" => "Größe", @@ -36,7 +41,7 @@ "From url" => "Von der URL", "Upload" => "Hochladen", "Cancel upload" => "Upload abbrechen", -"Nothing in here. Upload something!" => "Alles leer. Lad’ was hoch!", +"Nothing in here. Upload something!" => "Alles leer. Lade etwas hoch!", "Name" => "Name", "Share" => "Teilen", "Download" => "Herunterladen", diff --git a/apps/files/l10n/fa.php b/apps/files/l10n/fa.php index 77173d28364..aa6559022f7 100644 --- a/apps/files/l10n/fa.php +++ b/apps/files/l10n/fa.php @@ -8,6 +8,8 @@ "Failed to write to disk" => "نوشتن بر روی دیسک سخت ناموفق بود", "Files" => "فایل ها", "Delete" => "پاک کردن", +"already exists" => "وجود دارد", +"deleted" => "حذف شده", "generating ZIP-file, it may take some time." => "در حال ساخت فایل فشرده ممکن است زمان زیادی به طول بیانجامد", "Unable to upload your file as it is a directory or has 0 bytes" => "ناتوان در بارگذاری یا فایل یک پوشه است یا 0بایت دارد", "Upload Error" => "خطا در بار گذاری", diff --git a/apps/files/l10n/fr.php b/apps/files/l10n/fr.php index e037c7a2f4b..70af377b170 100644 --- a/apps/files/l10n/fr.php +++ b/apps/files/l10n/fr.php @@ -9,6 +9,11 @@ "Files" => "Fichiers", "Unshare" => "Ne plus partager", "Delete" => "Supprimer", +"already exists" => "existe déjà", +"replace" => "remplacer", +"cancel" => "annuler", +"replaced" => "remplacé", +"with" => "avec", "undo" => "annuler", "deleted" => "supprimé", "generating ZIP-file, it may take some time." => "Générer un fichier ZIP, cela peut prendre du temps", diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php index 70a5162d382..1d219719b2d 100644 --- a/apps/files_sharing/get.php +++ b/apps/files_sharing/get.php @@ -1,6 +1,4 @@ <?php -$RUNTIME_NOSETUPFS=true; //don't setup the fs yet - // only need authentication apps $RUNTIME_APPTYPES=array('authentication'); OC_App::loadApps($RUNTIME_APPTYPES); diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index ca811a16fef..fc2e6e32c7c 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -343,6 +343,25 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { public function fopen($path, $mode) { if ($source = $this->getSourcePath($path)) { + switch ($mode) { + case 'r+': + case 'rb+': + case 'w+': + case 'wb+': + case 'x+': + case 'xb+': + case 'a+': + case 'ab+': + case 'w': + case 'wb': + case 'x': + case 'xb': + case 'a': + case 'ab': + if (!$this->isUpdatable($path)) { + return false; + } + } $info = array( 'target' => $this->sharedFolder.$path, 'source' => $source, diff --git a/apps/media/ajax/autoupdate.php b/apps/media/ajax/autoupdate.php index c2dbf27a004..a5801f1a0e0 100644 --- a/apps/media/ajax/autoupdate.php +++ b/apps/media/ajax/autoupdate.php @@ -23,11 +23,6 @@ header('Content-type: text/html; charset=UTF-8') ; -//no apps or filesystem -$RUNTIME_NOAPPS=true; -$RUNTIME_NOSETUPFS=true; - - OCP\JSON::checkAppEnabled('media'); $autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true'); diff --git a/apps/remoteStorage/ajax/revokeToken.php b/apps/remoteStorage/ajax/revokeToken.php index 322d9ed7279..e6a68189945 100644 --- a/apps/remoteStorage/ajax/revokeToken.php +++ b/apps/remoteStorage/ajax/revokeToken.php @@ -25,10 +25,6 @@ * */ - -// Do not load FS ... -$RUNTIME_NOSETUPFS = true; - OCP\App::checkAppEnabled('remoteStorage'); require_once('remoteStorage/lib_remoteStorage.php'); diff --git a/apps/remoteStorage/auth.php b/apps/remoteStorage/auth.php index 99e2272d3ab..91ca43ea076 100644 --- a/apps/remoteStorage/auth.php +++ b/apps/remoteStorage/auth.php @@ -27,9 +27,6 @@ header("X-Frame-Options: Sameorigin"); -// Do not load FS ... -$RUNTIME_NOSETUPFS = true; - OCP\App::checkAppEnabled('remoteStorage'); require_once('Sabre/autoload.php'); require_once('lib_remoteStorage.php'); @@ -60,64 +57,23 @@ if($userId && $appUrl && $categories) { header('Location: '.$_GET['redirect_uri'].'#access_token='.$existingToken.'&token_type=bearer'); } else { //params ok, logged in ok, but need to click Allow still: -?> -<!DOCTYPE html> -<html> - <head> - <title>ownCloud</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="shortcut icon" href="../../../core/img/favicon.png" /><link rel="apple-touch-icon-precomposed" href="../../../core/img/favicon-touch.png" /> - <link rel="stylesheet" href="../../../core/css/styles.css" type="text/css" media="screen" /> - <link rel="stylesheet" href="../../../core/css/auth.css" type="text/css" media="screen" /> - </head> - <body id="body-login"> - <div id="login"> - <header> - <div id="header"> - <img src="../../../core/img/logo.png" alt="ownCloud" /> - </div> - </header> - <section id="main"> - <div id="oauth"> - <h2><img src="../../../core/img/remoteStorage-big.png" alt="remoteStorage" /></h2> - <p><strong><?php $appUrlParts = explode('/', $_GET['redirect_uri']); echo htmlentities($appUrlParts[2]); ?></strong> - requests read & write access to your - <?php - $categories = explode(',', htmlentities($_GET['scope'])); - if(!count($categories)) { - echo htmlentities($_GET['scope']); - } else { - echo '<em>'.$categories[0].'</em>'; - if(count($categories)==2) { - echo ' and <em>'.$categories[1].'</em>'; - } else if(count($categories)>2) { - for($i=1; $i<count($categories)-1; $i++) { - echo ', <em>'.$categories[$i].'</em>'; - } - echo ', and <em>'.$categories[$i].'</em>'; - } - } - ?>. - </p> - <form accept-charset="UTF-8" method="post"> - <input id="allow-auth" name="allow" type="submit" value="Allow" /> - <input id="deny-auth" name="deny" type="submit" value="Deny" /> - </form> - </div> - </section> - </div> - <footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> – web services under your control</p></footer> - </body> -</html> -<?php - }//end 'need to click Allow still' + $appUrlParts = explode('/', $_GET['redirect_uri']); + $host = $appUrlParts[2]; + $categories = explode(',', $_GET['scope']); + OCP\Util::addStyle('', 'auth'); + OCP\Template::printGuestPage('remoteStorage', 'auth', array( + 'host' => $host, + 'categories' => $categories, + )); + }//end 'need to click Allow still' } else {//login not ok if($currUser) { die('You are logged in as '.$currUser.' instead of '.htmlentities($userId)); } else { - header('Location: /?redirect_url='.urlencode('/apps/remoteStorage/auth.php'.$_SERVER['PATH_INFO'].'?'.$_SERVER['QUERY_STRING'])); + // this will display the login page for us + OCP\Util::checkLoggedIn(); } } } else {//params not ok - die('please use e.g. /?app=remoteStorage&getfile=auth.php&userid=admin&redirect_uri=http://host/path&scope=...'); + die('please use e.g. '.OCP\Util::linkTo('remoteStorage', 'auth.php').'?userid=admin&redirect_uri=http://host/path&scope=...'); } diff --git a/apps/remoteStorage/templates/auth.php b/apps/remoteStorage/templates/auth.php new file mode 100644 index 00000000000..6a7054eabb0 --- /dev/null +++ b/apps/remoteStorage/templates/auth.php @@ -0,0 +1,28 @@ + <section id="main"> + <div id="oauth"> + <h2><img src="<?php echo image_path('', 'remoteStorage-big.png'); ?>" alt="remoteStorage" /></h2> + <p><strong><?php echo $_['host'] ?></strong> + requests read & write access to your + <?php + $categories = $_['categories']; + if(!count($categories)) { + echo $categories[0]; + } else { + echo '<em>'.$categories[0].'</em>'; + if(count($categories)==2) { + echo ' and <em>'.$categories[1].'</em>'; + } else if(count($categories)>2) { + for($i=1; $i<count($categories)-1; $i++) { + echo ', <em>'.$categories[$i].'</em>'; + } + echo ', and <em>'.$categories[$i].'</em>'; + } + } + ?>. + </p> + <form accept-charset="UTF-8" method="post"> + <input id="allow-auth" name="allow" type="submit" value="Allow" /> + <input id="deny-auth" name="deny" type="submit" value="Deny" /> + </form> + </div> + </section> |