Tasks: Remove unused code
This commit is contained in:
parent
060b8865a4
commit
ad12e13f14
|
@ -1,20 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Init owncloud
|
|
||||||
OCP\JSON::checkLoggedIn();
|
|
||||||
OCP\JSON::checkAppEnabled('tasks');
|
|
||||||
|
|
||||||
$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();
|
|
||||||
$tmpl = new OCP\Template('tasks','part.addtaskform');
|
|
||||||
$tmpl->assign('calendars',$calendars);
|
|
||||||
$tmpl->assign('category_options', $category_options);
|
|
||||||
$tmpl->assign('percent_options', $percent_options);
|
|
||||||
$tmpl->assign('priority_options', $priority_options);
|
|
||||||
$tmpl->assign('details', new OC_VObject('VTODO'));
|
|
||||||
$tmpl->assign('categories', '');
|
|
||||||
$page = $tmpl->fetchPage();
|
|
||||||
|
|
||||||
OCP\JSON::success(array('data' => array( 'page' => $page )));
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Init owncloud
|
|
||||||
OCP\JSON::checkLoggedIn();
|
|
||||||
OCP\JSON::checkAppEnabled('tasks');
|
|
||||||
OCP\JSON::callCheck();
|
|
||||||
|
|
||||||
$l10n = new OC_L10N('tasks');
|
|
||||||
|
|
||||||
$id = $_POST['id'];
|
|
||||||
$vcalendar = OC_Calendar_App::getVCalendar($id);
|
|
||||||
|
|
||||||
$errors = OC_Task_App::validateRequest($_POST);
|
|
||||||
if (!empty($errors)) {
|
|
||||||
OCP\JSON::error(array('data' => array( 'errors' => $errors )));
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
OC_Task_App::updateVCalendarFromRequest($_POST, $vcalendar);
|
|
||||||
OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
|
||||||
|
|
||||||
$priority_options = OC_Task_App::getPriorityOptions();
|
|
||||||
$tmpl = new OCP\Template('tasks','part.details');
|
|
||||||
$tmpl->assign('priority_options', $priority_options);
|
|
||||||
$tmpl->assign('details', $vcalendar->VTODO);
|
|
||||||
$tmpl->assign('id', $id);
|
|
||||||
$page = $tmpl->fetchPage();
|
|
||||||
|
|
||||||
$user_timezone = OC_Calendar_App::getTimezone();
|
|
||||||
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
|
|
||||||
|
|
||||||
OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));
|
|
|
@ -1,24 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Init owncloud
|
|
||||||
OCP\JSON::checkLoggedIn();
|
|
||||||
OCP\JSON::checkAppEnabled('tasks');
|
|
||||||
|
|
||||||
$id = $_GET['id'];
|
|
||||||
$details = OC_Calendar_App::getVCalendar($id)->VTODO;
|
|
||||||
$categories = $details->getAsString('CATEGORIES');
|
|
||||||
|
|
||||||
$category_options = OC_Calendar_App::getCategoryOptions();
|
|
||||||
$percent_options = range(0, 100, 10);
|
|
||||||
$priority_options = OC_Task_App::getPriorityOptions();
|
|
||||||
|
|
||||||
$tmpl = new OCP\Template('tasks','part.edittaskform');
|
|
||||||
$tmpl->assign('category_options', $category_options);
|
|
||||||
$tmpl->assign('percent_options', $percent_options);
|
|
||||||
$tmpl->assign('priority_options', $priority_options);
|
|
||||||
$tmpl->assign('id',$id);
|
|
||||||
$tmpl->assign('details',$details);
|
|
||||||
$tmpl->assign('categories', $categories);
|
|
||||||
$page = $tmpl->fetchPage();
|
|
||||||
|
|
||||||
OCP\JSON::success(array('data' => array( 'page' => $page )));
|
|
|
@ -1,24 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Init owncloud
|
|
||||||
OCP\JSON::checkLoggedIn();
|
|
||||||
OCP\JSON::checkAppEnabled('tasks');
|
|
||||||
|
|
||||||
$l10n = new OC_L10N('tasks');
|
|
||||||
|
|
||||||
$id = $_GET['id'];
|
|
||||||
$task = OC_Calendar_Object::find($id);
|
|
||||||
$details = OC_VObject::parse($task['calendardata']);
|
|
||||||
if (!$details){
|
|
||||||
OCP\JSON::error();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$priority_options = OC_Task_App::getPriorityOptions();
|
|
||||||
$tmpl = new OCP\Template('tasks','part.details');
|
|
||||||
$tmpl->assign('priority_options', $priority_options);
|
|
||||||
$tmpl->assign('details',$details->VTODO);
|
|
||||||
$tmpl->assign('id',$id);
|
|
||||||
$page = $tmpl->fetchPage();
|
|
||||||
|
|
||||||
OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
|
|
|
@ -469,67 +469,5 @@ $(document).ready(function(){
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#tasks_addtaskform input[type="submit"]').live('click',function(){
|
|
||||||
$.post('ajax/addtask.php',$('#tasks_addtaskform').serialize(),function(jsondata){
|
|
||||||
if(jsondata.status == 'success'){
|
|
||||||
$('#task_details').data('id',jsondata.data.id);
|
|
||||||
$('#task_details').html(jsondata.data.page);
|
|
||||||
$('#tasks_list').append(OC.Tasks.create_task_div(jsondata.data.task));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
alert(jsondata.data.message);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#tasks_edit').live('click',function(){
|
|
||||||
var id = $('#task_details').data('id');
|
|
||||||
$.getJSON('ajax/edittaskform.php',{'id':id},function(jsondata){
|
|
||||||
if(jsondata.status == 'success'){
|
|
||||||
$('#task_details').html(jsondata.data.page);
|
|
||||||
$('#task_details #categories').multiple_autocomplete({source: categories});
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
alert(jsondata.data.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#tasks_edittaskform #percent_complete').live('change',function(event){
|
|
||||||
if ($(event.target).val() == 100){
|
|
||||||
$('#tasks_edittaskform #complete').show();
|
|
||||||
}else{
|
|
||||||
$('#tasks_edittaskform #complete').hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#tasks_edittaskform input[type="submit"]').live('click',function(){
|
|
||||||
$.post('ajax/edittask.php',$('#tasks_edittaskform').serialize(),function(jsondata){
|
|
||||||
$('.error_msg').remove();
|
|
||||||
$('.error').removeClass('error');
|
|
||||||
if(jsondata.status == 'success'){
|
|
||||||
var id = jsondata.data.id;
|
|
||||||
$('#task_details').data('id',id);
|
|
||||||
$('#task_details').html(jsondata.data.page);
|
|
||||||
var task = jsondata.data.task;
|
|
||||||
$('#tasks .task[data-id='+id+']')
|
|
||||||
.data('task', task)
|
|
||||||
.html(OC.Tasks.create_task_div(task).html());
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
var errors = jsondata.data.errors;
|
|
||||||
for (k in errors){
|
|
||||||
$('#'+k).addClass('error')
|
|
||||||
.after('<span class="error_msg">'+errors[k]+'</span>');
|
|
||||||
}
|
|
||||||
$('.error_msg').effect('highlight', {}, 3000);
|
|
||||||
$('.error').effect('highlight', {}, 3000);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
OCCategories.app = 'calendar';
|
OCCategories.app = 'calendar';
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<form id="tasks_addtaskform">
|
|
||||||
<?php if(count($_['calendars'])==1): ?>
|
|
||||||
<input type="hidden" name="id" value="<?php echo $_['calendars'][0]['id']; ?>">
|
|
||||||
<?php else: ?>
|
|
||||||
<label for="id"><?php echo $l->t('Calendar'); ?></label>
|
|
||||||
<select name="id" size="1">
|
|
||||||
<?php foreach($_['calendars'] as $calendar): ?>
|
|
||||||
<option value="<?php echo $calendar['id']; ?>"><?php echo $calendar['displayname']; ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
<br>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php echo $this->inc('part.taskform'); ?>
|
|
||||||
<input type="submit" name="submit" value="<?php echo $l->t('Create Task'); ?>">
|
|
||||||
</form>
|
|
|
@ -1,42 +0,0 @@
|
||||||
<?php if(isset($_['details']->SUMMARY)): ?>
|
|
||||||
<table>
|
|
||||||
<?php
|
|
||||||
echo $this->inc('part.property', array('label' => $l->t('Summary'), 'property' => $_['details']->SUMMARY));
|
|
||||||
if(isset($_['details']->LOCATION)):
|
|
||||||
echo $this->inc('part.property', array('label' => $l->t('Location'), 'property' => $_['details']->LOCATION));
|
|
||||||
endif;
|
|
||||||
if(isset($_['details']->CATEGORIES)):
|
|
||||||
echo $this->inc('part.property', array('label' => $l->t('Categories'), 'property' => $_['details']->CATEGORIES));
|
|
||||||
endif;
|
|
||||||
if(isset($_['details']->DUE)):
|
|
||||||
echo $this->inc('part.property', array('label' => $l->t('Due'), 'property' => $_['details']->DUE[0]));
|
|
||||||
endif;
|
|
||||||
if(isset($_['details']->PRIORITY)):
|
|
||||||
echo $this->inc('part.property', array('label' => $l->t('Priority'), 'property' => $_['details']->PRIORITY[0], 'options' => $_['priority_options']));
|
|
||||||
endif;
|
|
||||||
if($_['details']->__isset('PERCENT-COMPLETE') || isset($_['details']->COMPLETED)):
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<?php echo $l->t('Complete') ?>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<?php if($_['details']->__isset('PERCENT-COMPLETE')):
|
|
||||||
echo $_['details']->__get('PERCENT-COMPLETE')->value.' % ';
|
|
||||||
endif;
|
|
||||||
if(isset($_['details']->COMPLETED)):
|
|
||||||
echo $l->t('on '). $l->l('datetime', $_['details']->COMPLETED[0]->getDateTime());
|
|
||||||
endif;
|
|
||||||
echo '</tr>';
|
|
||||||
endif;
|
|
||||||
if(isset($_['details']->DESCRIPTION)):
|
|
||||||
echo $this->inc('part.property', array('label' => $l->t('Description'), 'property' => $_['details']->DESCRIPTION));
|
|
||||||
endif; ?>
|
|
||||||
</table>
|
|
||||||
<form>
|
|
||||||
<input type="button" id="tasks_delete" value="<?php echo $l->t('Delete');?>">
|
|
||||||
<input type="button" id="tasks_edit" value="<?php echo $l->t('Edit');?>">
|
|
||||||
</form>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php //var_dump($_['details']); ?>
|
|
||||||
<?php endif ?>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<form id="tasks_edittaskform">
|
|
||||||
<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
|
|
||||||
<?php echo $this->inc('part.taskform'); ?>
|
|
||||||
<input type="submit" name="submit" value="<?php echo $l->t('Update Task'); ?>">
|
|
||||||
</form>
|
|
|
@ -1,22 +0,0 @@
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<?php echo $_['label'] ?>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
switch (get_class($_['property']))
|
|
||||||
{
|
|
||||||
case 'Sabre_VObject_Element_DateTime':
|
|
||||||
echo $l->l('datetime', $_['property']->getDateTime());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$value = $_['property']->value;
|
|
||||||
if (isset($_['options']))
|
|
||||||
{
|
|
||||||
$value = $_['options'][$value];
|
|
||||||
}
|
|
||||||
echo nl2br($value);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<label for="summary"><?php echo $l->t('Summary'); ?></label>
|
|
||||||
<input type="text" id="summary" name="summary" placeholder="<?php echo $l->t('Summary of the task');?>" value="<?php echo isset($_['details']->SUMMARY) ? $_['details']->SUMMARY[0]->value : '' ?>">
|
|
||||||
<br>
|
|
||||||
<label for="location"><?php echo $l->t('Location'); ?></label>
|
|
||||||
<input type="text" id="location" name="location" placeholder="<?php echo $l->t('Location of the task');?>" value="<?php echo isset($_['details']->LOCATION) ? $_['details']->LOCATION[0]->value : '' ?>">
|
|
||||||
<br>
|
|
||||||
<label for="categories"><?php echo $l->t('Categories'); ?></label>
|
|
||||||
<input id="categories" name="categories" type="text" placeholder="<?php echo $l->t('Separate categories with commas'); ?>" value="<?php echo isset($_['categories']) ? $_['categories'] : '' ?>">
|
|
||||||
<a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"><img alt="<?php echo $l->t('Edit categories'); ?>" src="<?php echo OCP\image_path('core','actions/rename.svg')?>" class="svg action" style="width: 16px; height: 16px;"></a>
|
|
||||||
<br>
|
|
||||||
<label for="due"><?php echo $l->t('Due'); ?></label>
|
|
||||||
<input type="text" id="due" name="due" placeholder="<?php echo $l->t('Due date') ?>" value="<?php echo isset($_['details']->DUE) ? $l->l('datetime', $_['details']->DUE[0]->getDateTime()) : '' ?>">
|
|
||||||
<br>
|
|
||||||
<select name="percent_complete" id="percent_complete">
|
|
||||||
<?php
|
|
||||||
foreach($_['percent_options'] as $percent){
|
|
||||||
echo '<option value="' . $percent . '"' . (($_['details']->__get('PERCENT-COMPLETE') && $percent == $_['details']->__get('PERCENT-COMPLETE')->value) ? ' selected="selected"' : '') . '>' . $percent . ' %</option>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<label for="percent_complete"><?php echo $l->t('Complete'); ?></label>
|
|
||||||
<span id="complete"<?php echo ($_['details']->__get('PERCENT-COMPLETE') && $_['details']->__get('PERCENT-COMPLETE')->value == 100) ? '' : ' style="display:none;"' ?>><label for="completed"><?php echo $l->t('completed on'); ?></label>
|
|
||||||
<input type="text" id="completed" name="completed" value="<?php echo isset($_['details']->COMPLETED) ? $l->l('datetime', $_['details']->COMPLETED[0]->getDateTime()) : '' ?>"></span>
|
|
||||||
<br>
|
|
||||||
<label for="priority"><?php echo $l->t('Priority'); ?></label>
|
|
||||||
<select name="priority">
|
|
||||||
<?php
|
|
||||||
foreach($_['priority_options'] as $priority => $label){
|
|
||||||
echo '<option value="' . $priority . '"' . ((isset($_['details']->PRIORITY) && $priority == $_['details']->PRIORITY->value) ? ' selected="selected"' : '') . '>' . $label . '</option>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<br>
|
|
||||||
<label for="description"><?php echo $l->t('Description'); ?></label><br>
|
|
||||||
<textarea placeholder="<?php echo $l->t('Description of the task');?>" name="description"><?php echo isset($_['details']->DESCRIPTION) ? $_['details']->DESCRIPTION[0]->value : '' ?></textarea>
|
|
||||||
<br>
|
|
|
@ -1,3 +0,0 @@
|
||||||
<?php foreach( $_['tasks'] as $task ): ?>
|
|
||||||
<li data-id="<?php echo $task['id']; ?>"><a href="index.php?id=<?php echo $task['id']; ?>"><?php echo $task['name']; ?></a> </li>
|
|
||||||
<?php endforeach; ?>
|
|
Loading…
Reference in New Issue