删除无用的注释和文件

This commit is contained in:
2021-03-02 01:08:44 +08:00
parent 8f5b66bb92
commit 89bab045dd
147 changed files with 214 additions and 9816 deletions
@@ -15,7 +15,7 @@ class CalendarController extends DefaultController
public $permission = ['calendars', 'help'];
/**
* 显示日历
* 日历首页
*/
public function indexAction()
{
@@ -46,8 +46,8 @@ class CalendarController extends DefaultController
$calendars = CalendarService::getCalendars($user_id);
$calendars[] = [
'id' => 'shared',
'displayname' => '共享事件',
'id' => 'shared',
'displayname' => '共享事件',
'calendarcolor' => '#999',
];
$sources = [];
@@ -82,24 +82,20 @@ class CalendarController extends DefaultController
} catch (\Exception $e) {
return $this->json($e->getMessage());
}
/*} else {
return $this->json('permission denied');
*/
}
$calendar = CalendarService::getCalendar($gets['id'], false);
return $this->json([
'active' => $gets['active'],
'active' => $gets['active'],
'eventSource' => array(
'id' => $calendar['id'],
'url' => url('event/index', ['calendar_id' => $calendar['id']]),
'id' => $calendar['id'],
'url' => url('event/index', ['calendar_id' => $calendar['id']]),
'backgroundColor' => $calendar['calendarcolor'],
"borderColor" => $calendar['calendarcolor'],
"borderColor" => $calendar['calendarcolor'],
)
], true);
}
}
// 添加日历
public function addAction()
{
$gets = Request::all();
@@ -123,7 +119,6 @@ class CalendarController extends DefaultController
return $this->render();
}
// 删除日历
public function deleteAction()
{
$id = Request::get('id');
@@ -19,7 +19,7 @@ class EventController extends DefaultController
{
public $permission = ['share', 'items'];
// 事件对象
// 事件列表
public function indexAction()
{
$gets = Request::all();
@@ -137,14 +137,6 @@ class EventController extends DefaultController
$vcalendar = VObject::parse($event['calendardata']);
$vevent = $vcalendar->VEVENT;
/*
$accessclass = $vevent->getAsString('CLASS');
$permissions = CalendarService::getPermissions($id, Calendar::EVENT, $accessclass);
if(!$permissions & OCP\PERMISSION_UPDATE) {
return $this->json('permission denied');
}
*/
$delta = new \DateInterval('P0D');
$delta->s = $gets['delta'];
@@ -247,13 +239,6 @@ class EventController extends DefaultController
$end = $gets['end'];
$allday = $gets['allDay'];
/*
if (!$end) {
$duration = 60;
$end = $start + ($duration * 60);
}
*/
$start = new \DateTime('@'.strtotime($start));
$end = new \DateTime('@'.strtotime($end));
@@ -267,22 +252,7 @@ class EventController extends DefaultController
$calendar_options = CalendarService::getCalendars(Auth::id(), false);
/*
分享日历暂时未实现
foreach($calendars as $calendar)
{
if($calendar['userid'] != OCP\User::getUser()) {
$sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $calendar['id']);
if ($sharedCalendar && ($sharedCalendar['permissions'] & OCP\PERMISSION_UPDATE)) {
array_push($calendar_options, $calendar);
}
} else {
array_push($calendar_options, $calendar);
}
}*/
$options['calendar_options'] = $calendar_options;
$options['access_class_options'] = CalendarService::getAccessClassOptions();
$options['valarm_options'] = CalendarService::getValarmOptions();
$options['repeat_options'] = CalendarService::getRepeatOptions();
@@ -356,12 +326,12 @@ class EventController extends DefaultController
$end_at = strtotime($gets['to'].' '.$gets['totime']);
$share_data = array(
'source_id' => $gets['id'],
'source_type' => 'event',
'receive_id' => $gets['receive_id'],
'source_id' => $gets['id'],
'source_type' => 'event',
'receive_id' => $gets['receive_id'],
'receive_name' => $gets['receive_name'],
'start_at' => $start_at,
'end_at' => $end_at,
'start_at' => $start_at,
'end_at' => $end_at,
);
$share = ShareService::getItem('event', $gets['id']);
@@ -374,7 +344,7 @@ class EventController extends DefaultController
return $this->json($e->getMessage());
}
if ($data['calendarid'] != $gets['calendarid']) {
if ($event['calendarid'] != $gets['calendarid']) {
try {
CalendarService::moveToCalendar($gets['id'], $gets['calendarid']);
} catch (\Exception $e) {
@@ -394,13 +364,6 @@ class EventController extends DefaultController
$object = VObject::parse($event['calendardata']);
$vevent = $object->VEVENT;
/*
$object = Sabre_Calendar_Object::cleanByAccessClass($id, $object);
$accessclass = $vevent->getAsString('CLASS');
$permissions = CalendarService::getPermissions($id, Calendar::EVENT, $accessclass);
*/
$dtstart = $vevent->DTSTART;
$dtend = CalendarService::getDTEndFromVEvent($vevent);
@@ -573,7 +536,6 @@ class EventController extends DefaultController
$repeat['repeat'] = 'doesnotrepeat';
}
// $options['category_options'] = CalendarService::getCategoryOptions();
$options['calendar_options']= CalendarService::getCalendars(Auth::id(), false);
$options['access_class_options'] = CalendarService::getAccessClassOptions();
$options['valarm_options'] = CalendarService::getValarmOptions();
@@ -588,21 +550,9 @@ class EventController extends DefaultController
$options['repeat_byweekno_options'] = CalendarService::getByWeekNoOptions();
$options['repeat_bymonthday_options'] = CalendarService::getByMonthDayOptions();
/*
if($permissions & OCP\PERMISSION_UPDATE) {
$tmpl = new OCP\Template('calendar', 'part.editevent');
} elseif($permissions & OCP\PERMISSION_READ) {
$tmpl = new OCP\Template('calendar', 'part.showevent');
} elseif($permissions === 0) {
OCP\JSON::error(array('data' => array('message' => CalendarService::$l10n->t('You do not have the permissions to edit this event.'))));
exit;
}*/
$options['id'] = $gets['id'];
$options['permissions'] = $permissions;
$options['lastmodified'] = $event['lastmodified'];
$options['title'] = $summary;
$options['accessclass'] = $accessclass;
$options['location'] = $location;
$options['categories'] = $categories;
$options['calendarid'] = $event['calendarid'];
@@ -707,7 +657,6 @@ class EventController extends DefaultController
$description = strtr($vevent->getAsString('DESCRIPTION'), array('\,' => ',', '\;' => ';'));
$options['id'] = $id;
$options['permissions'] = $permissions;
$options['lastmodified'] = $event['lastmodified'];
$options['title'] = $summary;
$options['location'] = $location;
@@ -491,51 +491,6 @@ class CalendarService
return $dtend;
}
/**
* @brief Remove all properties which should not be exported for the AccessClass Confidential
* @param string $id Event ID
* @param VObject $vobject Sabre VObject
* @return object
*/
public static function cleanByAccessClass($id, $vobject)
{
// Do not clean your own calendar
if (self::getowner($id) === Auth::id()) {
return $vobject;
}
if (isset($vobject->VEVENT)) {
$velement = $vobject->VEVENT;
} elseif (isset($vobject->VJOURNAL)) {
$velement = $vobject->VJOURNAL;
} elseif (isset($vobject->VTODO)) {
$velement = $vobject->VTODO;
}
if (isset($velement->CLASS) && $velement->CLASS->value == 'CONFIDENTIAL') {
foreach ($velement->children as &$property) {
switch ($property->name) {
case 'CREATED':
case 'DTSTART':
case 'RRULE':
case 'DURATION':
case 'DTEND':
case 'CLASS':
case 'UID':
break;
case 'SUMMARY':
$property->value = 'Busy';
break;
default:
$velement->__unset($property->name);
unset($property);
break;
}
}
}
return $vobject;
}
/**
* @brief Get the permissions determined by the access class of an event/todo/journal
* @param VObject $vobject Sabre VObject