port oc_preferences
parent
e3587924a1
commit
7ff262880f
|
@ -17,6 +17,6 @@ switch($view){
|
|||
OC_JSON::error(array('message'=>'unexspected parameter: ' . $view));
|
||||
exit;
|
||||
}
|
||||
OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'currentview', $view);
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'currentview', $view);
|
||||
OC_JSON::success();
|
||||
?>
|
||||
|
|
|
@ -22,12 +22,12 @@ $end = $_POST['end'];
|
|||
$allday = $_POST['allday'];
|
||||
|
||||
if (!$end){
|
||||
$duration = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'duration', '60');
|
||||
$duration = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'duration', '60');
|
||||
$end = $start + ($duration * 60);
|
||||
}
|
||||
$start = new DateTime('@'.$start);
|
||||
$end = new DateTime('@'.$end);
|
||||
$timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$start->setTimezone(new DateTimeZone($timezone));
|
||||
$end->setTimezone(new DateTimeZone($timezone));
|
||||
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
*/
|
||||
|
||||
OC_JSON::checkLoggedIn();
|
||||
$firstday = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'firstday', 'mo');
|
||||
$firstday = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'firstday', 'mo');
|
||||
OC_JSON::encodedPrint(array('firstday' => $firstday));
|
||||
?>
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
OC_JSON::success(array('detection' => OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection')));
|
||||
OC_JSON::success(array('detection' => OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection')));
|
|
@ -17,11 +17,11 @@ $lng = $_GET['long'];
|
|||
|
||||
$timezone = OC_Geo::timezone($lat, $lng);
|
||||
|
||||
if($timezone == OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone')){
|
||||
if($timezone == OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone')){
|
||||
OC_JSON::success();
|
||||
exit;
|
||||
}
|
||||
OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezone', $timezone);
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezone', $timezone);
|
||||
$message = array('message'=> $l->t('New Timezone:') . $timezone);
|
||||
OC_JSON::success($message);
|
||||
?>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
OC_JSON::checkLoggedIn();
|
||||
if(isset($_POST["firstday"])){
|
||||
OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
|
||||
OC_JSON::success();
|
||||
}else{
|
||||
OC_JSON::error();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
OC_JSON::checkLoggedIn();
|
||||
if(isset($_POST["timeformat"])){
|
||||
OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
|
||||
OC_JSON::success();
|
||||
}else{
|
||||
OC_JSON::error();
|
||||
|
|
|
@ -18,7 +18,7 @@ OC_JSON::checkAppEnabled('calendar');
|
|||
// Get data
|
||||
if( isset( $_POST['timezone'] ) ){
|
||||
$timezone=$_POST['timezone'];
|
||||
OC_Preferences::setValue( OCP\USER::getUser(), 'calendar', 'timezone', $timezone );
|
||||
OCP\Config::setUserValue( OCP\USER::getUser(), 'calendar', 'timezone', $timezone );
|
||||
OC_JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') )));
|
||||
}else{
|
||||
OC_JSON::error(array('data' => array( 'message' => $l->t('Invalid request') )));
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
*/
|
||||
|
||||
OC_JSON::checkLoggedIn();
|
||||
$timeformat = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'timeformat', "24");
|
||||
$timeformat = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'timeformat', "24");
|
||||
OC_JSON::encodedPrint(array("timeformat" => $timeformat));
|
||||
?>
|
||||
|
|
|
@ -10,9 +10,9 @@ OC_JSON::checkLoggedIn();
|
|||
OC_JSON::checkAppEnabled('calendar');
|
||||
if(array_key_exists('timezonedetection', $_POST)){
|
||||
if($_POST['timezonedetection'] == 'on'){
|
||||
OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true');
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true');
|
||||
}else{
|
||||
OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false');
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false');
|
||||
}
|
||||
OC_JSON::success();
|
||||
}else{
|
||||
|
|
14
index.php
14
index.php
|
@ -29,21 +29,21 @@ OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources));
|
|||
$categories = OC_Calendar_App::getCategoryOptions();
|
||||
|
||||
//Fix currentview for fullcalendar
|
||||
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){
|
||||
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
|
||||
if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
|
||||
}
|
||||
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){
|
||||
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "month");
|
||||
if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "month");
|
||||
}
|
||||
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){
|
||||
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "list");
|
||||
if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "list");
|
||||
}
|
||||
|
||||
OCP\Util::addscript('3rdparty/fullcalendar', 'fullcalendar');
|
||||
OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar');
|
||||
OCP\Util::addscript('3rdparty/timepicker', 'jquery.ui.timepicker');
|
||||
OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
|
||||
if(OC_Preferences::getValue(OCP\USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true'){
|
||||
if(OCP\Config::getUserValue(OCP\USER::getUser(), "calendar", "timezone") == null || OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true'){
|
||||
OCP\Util::addscript('calendar', 'geo');
|
||||
}
|
||||
OCP\Util::addscript('calendar', 'calendar');
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* This class manages our app actions
|
||||
*/
|
||||
OC_Calendar_App::$l10n = new OC_L10N('calendar');
|
||||
OC_Calendar_App::$tz = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
OC_Calendar_App::$tz = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
class OC_Calendar_App{
|
||||
const CALENDAR = 'calendar';
|
||||
const EVENT = 'event';
|
||||
|
|
|
@ -761,7 +761,7 @@ class OC_Calendar_Object{
|
|||
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::DATE);
|
||||
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::DATE);
|
||||
}else{
|
||||
$timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$start = new DateTime($from.' '.$fromtime, $timezone);
|
||||
$end = new DateTime($to.' '.$totime, $timezone);
|
||||
|
|
|
@ -12,7 +12,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
|
|||
}else{
|
||||
$searchquery[] = $query;
|
||||
}
|
||||
$user_timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$user_timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$l = new OC_l10n('calendar');
|
||||
foreach($calendars as $calendar){
|
||||
$objects = OC_Calendar_Object::all($calendar['id']);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
$tmpl = new OC_Template( 'calendar', 'settings');
|
||||
$timezone=OC_Preferences::getValue(OCP\USER::getUser(),'calendar','timezone','');
|
||||
$timezone=OCP\Config::getUserValue(OCP\USER::getUser(),'calendar','timezone','');
|
||||
$tmpl->assign('timezone',$timezone);
|
||||
$tmpl->assign('timezones',DateTimeZone::listIdentifiers());
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<script type='text/javascript'>
|
||||
var defaultView = '<?php echo OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') ?>';
|
||||
var defaultView = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') ?>';
|
||||
var eventSources = <?php echo json_encode($_['eventSources']) ?>;
|
||||
var categories = <?php echo json_encode($_['categories']); ?>;
|
||||
var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>;
|
||||
var dayNamesShort = <?php echo json_encode($l->tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>;
|
||||
var monthNames = <?php echo json_encode($l->tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>;
|
||||
var monthNamesShort = <?php echo json_encode($l->tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>;
|
||||
var agendatime = '<?php echo ((int) OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}';
|
||||
var defaulttime = '<?php echo ((int) OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>';
|
||||
var agendatime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}';
|
||||
var defaulttime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>';
|
||||
var allDayText = '<?php echo addslashes($l->t('All day')) ?>';
|
||||
var newcalendar = '<?php echo addslashes($l->t('New Calendar')) ?>';
|
||||
var missing_field = '<?php echo addslashes($l->t('Missing fields')) ?>';
|
||||
|
@ -20,7 +20,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 OCP\Util::linkToAbsolute('calendar', 'caldav.php'); ?>/calendars';
|
||||
var firstDay = '<?php echo (OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'); ?>';
|
||||
var firstDay = '<?php echo (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'); ?>';
|
||||
$(document).ready(function() {
|
||||
<?php
|
||||
if(array_key_exists('showevent', $_)){
|
||||
|
|
Loading…
Reference in New Issue