Tasks: Update to new public API
This commit is contained in:
parent
1e47156226
commit
439467746a
10 changed files with 50 additions and 50 deletions
|
@ -2,10 +2,10 @@
|
|||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
|
||||
$cid = reset($calendars)['id'];
|
||||
|
||||
$input = $_GET['text'];
|
||||
|
@ -21,7 +21,7 @@ $request['description'] = null;
|
|||
$vcalendar = OC_Task_App::createVCalendarFromRequest($request);
|
||||
$id = OC_Calendar_Object::add($cid, $vcalendar->serialize());
|
||||
|
||||
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
|
||||
|
||||
OC_JSON::success(array('task' => $task));
|
||||
OCP\JSON::success(array('task' => $task));
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
|
||||
$category_options = OC_Calendar_App::getCategoryOptions();
|
||||
$percent_options = range(0, 100, 10);
|
||||
$priority_options = OC_Task_App::getPriorityOptions();
|
||||
|
@ -18,4 +18,4 @@ $tmpl->assign('details', new OC_VObject('VTODO'));
|
|||
$tmpl->assign('categories', '');
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
OC_JSON::success(array('data' => array( 'page' => $page )));
|
||||
OCP\JSON::success(array('data' => array( 'page' => $page )));
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
|
||||
$id = $_GET['id'];
|
||||
$task = OC_Calendar_App::getEventObject( $id );
|
||||
|
||||
OC_Calendar_Object::delete($id);
|
||||
OC_JSON::success(array('data' => array( 'id' => $id )));
|
||||
OCP\JSON::success(array('data' => array( 'id' => $id )));
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
||||
|
@ -12,7 +12,7 @@ $vcalendar = OC_Calendar_App::getVCalendar($id);
|
|||
|
||||
$errors = OC_Task_App::validateRequest($_POST);
|
||||
if (!empty($errors)) {
|
||||
OC_JSON::error(array('data' => array( 'errors' => $errors )));
|
||||
OCP\JSON::error(array('data' => array( 'errors' => $errors )));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ $tmpl->assign('details', $vcalendar->VTODO);
|
|||
$tmpl->assign('id', $id);
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
|
||||
|
||||
OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));
|
||||
OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
|
||||
$id = $_GET['id'];
|
||||
$details = OC_Calendar_App::getVCalendar($id)->VTODO;
|
||||
|
@ -22,4 +22,4 @@ $tmpl->assign('details',$details);
|
|||
$tmpl->assign('categories', $categories);
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
OC_JSON::success(array('data' => array( 'page' => $page )));
|
||||
OCP\JSON::success(array('data' => array( 'page' => $page )));
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
||||
|
@ -11,7 +11,7 @@ $id = $_GET['id'];
|
|||
$task = OC_Calendar_Object::find($id);
|
||||
$details = OC_VObject::parse($task['calendardata']);
|
||||
if (!$details){
|
||||
OC_JSON::error();
|
||||
OCP\JSON::error();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -22,4 +22,4 @@ $tmpl->assign('details',$details->VTODO);
|
|||
$tmpl->assign('id',$id);
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
|
||||
OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
|
||||
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
|
||||
$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
|
||||
$tasks = array();
|
||||
foreach( $calendars as $calendar ){
|
||||
|
@ -34,4 +34,4 @@ foreach( $calendars as $calendar ){
|
|||
}
|
||||
}
|
||||
|
||||
OC_JSON::encodedPrint($tasks);
|
||||
OCP\JSON::encodedPrint($tasks);
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
|
||||
$id = $_POST['id'];
|
||||
$property = $_POST['type'];
|
||||
|
@ -39,7 +39,7 @@ switch($property) {
|
|||
$type = null;
|
||||
if ($due != 'false') {
|
||||
try {
|
||||
$timezone = OC_Preferences::getValue(OC_User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$due = new DateTime('@'.$due);
|
||||
$due->setTimezone($timezone);
|
||||
|
@ -48,7 +48,7 @@ switch($property) {
|
|||
$type = Sabre_VObject_Element_DateTime::DATE;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
OC_JSON::error(array('data'=>array('message'=>OC_Task_App::$l10n->t('Invalid date/time'))));
|
||||
OCP\JSON::error(array('data'=>array('message'=>OC_Task_App::$l10n->t('Invalid date/time'))));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -59,11 +59,11 @@ switch($property) {
|
|||
OC_Task_App::setComplete($vtodo, $checked ? '100' : '0', null);
|
||||
break;
|
||||
default:
|
||||
OC_JSON::error(array('data'=>array('message'=>'Unknown type')));
|
||||
OCP\JSON::error(array('data'=>array('message'=>'Unknown type')));
|
||||
exit();
|
||||
}
|
||||
OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
||||
|
||||
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$task_info = OC_Task_App::arrayForJSON($id, $vtodo, $user_timezone);
|
||||
OC_JSON::success(array('data' => $task_info));
|
||||
OCP\JSON::success(array('data' => $task_info));
|
||||
|
|
|
@ -9,22 +9,22 @@
|
|||
*************************************************/
|
||||
|
||||
require_once ('../../lib/base.php');
|
||||
OC_Util::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('tasks');
|
||||
OCP\User::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('tasks');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
|
||||
if( count($calendars) == 0 ) {
|
||||
header('Location: ' . OC_Helper::linkTo('calendar', 'index.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
OC_Util::addScript('3rdparty/timepicker', 'jquery.ui.timepicker');
|
||||
OC_Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
|
||||
OC_UTIL::addScript('tasks', 'tasks');
|
||||
OC_UTIL::addStyle('tasks', 'style');
|
||||
OC_Util::addScript('contacts','jquery.multi-autocomplete');
|
||||
OC_Util::addScript('','oc-vcategories');
|
||||
OC_APP::setActiveNavigationEntry('tasks_index');
|
||||
OCP\Util::addScript('3rdparty/timepicker', 'jquery.ui.timepicker');
|
||||
OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
|
||||
OCP\Util::addScript('tasks', 'tasks');
|
||||
OCP\Util::addStyle('tasks', 'style');
|
||||
OCP\Util::addScript('contacts','jquery.multi-autocomplete');
|
||||
OCP\Util::addScript('','oc-vcategories');
|
||||
OCP\App::setActiveNavigationEntry('tasks_index');
|
||||
|
||||
$categories = OC_Calendar_App::getCategoryOptions();
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
|
|
@ -82,7 +82,7 @@ class OC_Task_App {
|
|||
}
|
||||
|
||||
try {
|
||||
$timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
new DateTime($request['due'], $timezone);
|
||||
} catch (Exception $e) {
|
||||
|
@ -94,7 +94,7 @@ class OC_Task_App {
|
|||
}
|
||||
if ($request['percent_complete'] == 100 && !empty($request['completed'])){
|
||||
try {
|
||||
$timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
new DateTime($request['completed'], $timezone);
|
||||
} catch (Exception $e) {
|
||||
|
@ -147,7 +147,7 @@ class OC_Task_App {
|
|||
$vtodo->setString('PRIORITY', $priority);
|
||||
|
||||
if ($due) {
|
||||
$timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$due = new DateTime($due, $timezone);
|
||||
$vtodo->setDateTime('DUE', $due);
|
||||
|
@ -176,7 +176,7 @@ class OC_Task_App {
|
|||
$completed = null;
|
||||
}
|
||||
if ($completed) {
|
||||
$timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$completed = new DateTime($completed, $timezone);
|
||||
$vtodo->setDateTime('COMPLETED', $completed);
|
||||
|
|
Loading…
Reference in a new issue