Tasks: Code cleanup

This commit is contained in:
Bart Visscher 2012-04-15 15:38:44 +02:00
parent 029e1aced7
commit 19d81068f6
4 changed files with 3 additions and 21 deletions

View File

@ -5,8 +5,6 @@ require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('tasks'); OC_JSON::checkAppEnabled('tasks');
$l10n = new OC_L10N('tasks');
$cid = $_POST['id']; $cid = $_POST['id'];
$calendar = OC_Calendar_App::getCalendar( $cid ); $calendar = OC_Calendar_App::getCalendar( $cid );

View File

@ -5,10 +5,8 @@ require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('tasks'); OC_JSON::checkAppEnabled('tasks');
$l10n = new OC_L10N('tasks');
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true); $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
$category_options = OC_Calendar_App::getCategoryOptions($l10n); $category_options = OC_Calendar_App::getCategoryOptions();
$percent_options = range(0, 100, 10); $percent_options = range(0, 100, 10);
$priority_options = OC_Task_App::getPriorityOptions(); $priority_options = OC_Task_App::getPriorityOptions();
$tmpl = new OC_Template('tasks','part.addtaskform'); $tmpl = new OC_Template('tasks','part.addtaskform');

View File

@ -25,20 +25,8 @@ require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('tasks'); OC_JSON::checkAppEnabled('tasks');
$l10n = new OC_L10N('tasks');
$id = $_GET['id']; $id = $_GET['id'];
$task = OC_Calendar_Object::find( $id ); $task = OC_Calendar_App::getEventObject( $id );
if( $task === false ){
OC_JSON::error(array('data' => array( 'message' => $l10n->t('Can not find Task!'))));
exit();
}
$calendar = OC_Calendar_Calendar::findCalendar( $task['calendarid'] );
if( $calendar === false || $calendar['userid'] != OC_USER::getUser()){
OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your task!'))));
exit();
}
OC_Calendar_Object::delete($id); OC_Calendar_Object::delete($id);
OC_JSON::success(array('data' => array( 'id' => $id ))); OC_JSON::success(array('data' => array( 'id' => $id )));

View File

@ -5,13 +5,11 @@ require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('tasks'); OC_JSON::checkAppEnabled('tasks');
$l10n = new OC_L10N('tasks');
$id = $_GET['id']; $id = $_GET['id'];
$details = OC_Calendar_App::getVCalendar($id)->VTODO; $details = OC_Calendar_App::getVCalendar($id)->VTODO;
$categories = $details->getAsString('CATEGORIES'); $categories = $details->getAsString('CATEGORIES');
$category_options = OC_Calendar_App::getCategoryOptions($l10n); $category_options = OC_Calendar_App::getCategoryOptions();
$percent_options = range(0, 100, 10); $percent_options = range(0, 100, 10);
$priority_options = OC_Task_App::getPriorityOptions(); $priority_options = OC_Task_App::getPriorityOptions();