]> source.dussan.org Git - nextcloud-server.git/commitdiff
Tasks: Update to new public API
authorBart Visscher <bartv@thisnet.nl>
Fri, 4 May 2012 15:19:25 +0000 (17:19 +0200)
committerBart Visscher <bartv@thisnet.nl>
Fri, 4 May 2012 15:19:25 +0000 (17:19 +0200)
apps/tasks/ajax/addtask.php
apps/tasks/ajax/addtaskform.php
apps/tasks/ajax/delete.php
apps/tasks/ajax/edittask.php
apps/tasks/ajax/edittaskform.php
apps/tasks/ajax/getdetails.php
apps/tasks/ajax/gettasks.php
apps/tasks/ajax/update_property.php
apps/tasks/index.php
apps/tasks/lib/app.php

index 9d62a5fe707720cf1a264c5f357b922f6b476bbe..9f5f382cacf81e929ded1080e6a6f0aef0730a2f 100644 (file)
@@ -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));
index 48e1bc8d8974cdc2051fae27733ddf313d6e3c8e..e52c9b59329abbc1d31a2f0bbe2382c25c56d6c2 100644 (file)
@@ -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 )));
index ce80191a5609307073054ee87176d22ca67f2ac5..7b18c70c4fe110a039495e0af7880ed29511bb00 100644 (file)
 
 // 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 )));
index ae937a7dcab3e38c78321c95f89bc0d0afd6d211..4b38bb6c97c3beacd59c89b284dace94e382a3e6 100644 (file)
@@ -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 )));
index 42a4bfead8d598f10a11371550bc13d1d3faddb9..d5d6c23eb4fb6ea94bbb1485297787ac8e14ceac 100644 (file)
@@ -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 )));
index 2e6e8181f1b2ddd555901b2345aa22ad7b405cf9..34cbc16cc9e29c7b9859d16ecf97fa4c3b211288 100644 (file)
@@ -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 )));
index cd8d26f480ee87ac06e1ee7ef8f3eb8fd8f672be..d8a0ae1b74a1767ce77861de2eb9f442f2dbcbee 100644 (file)
@@ -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);
index b075489bd17b687752eaa24b309a99b0b23c1367..68fe32637cfc329655c77e3dfb6a7bdbd830c8dd 100644 (file)
@@ -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));
index 1ec91feb17a018369645a36b845189623f475af7..a9e8c56123a704c46809db7f8ac4a418cd5e328f 100644 (file)
@@ -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');
index 32d924c10df220d80b591c87c34054518fe17c05..b1e92dc6b6e53f537128f3ecf840bf028d72a287 100644 (file)
@@ -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);