WIP ViDoTeach REST API

This commit is contained in:
ralf 2024-05-14 18:39:56 +02:00
parent 4271b5c72c
commit a69142946c
4 changed files with 32 additions and 29 deletions

View File

@ -119,7 +119,7 @@ class JsBase
*/
protected static function parseAccount(string $value, bool $user=true)
{
if (is_numeric($value) && ($exists = Api\Accounts::getInstance()->exists(value)) &&
if (is_numeric($value) && ($exists = Api\Accounts::getInstance()->exists($value)) &&
(!isset($user) || $exists === ($user ? 1 : 2)))
{
$account_id = (int)$value;
@ -441,7 +441,7 @@ class JsBase
* Parse a DateTime value
*
* @param string $value
* @param string|null $timezone
* @param string|null $timezone default user-timezone
* @param bool $showWithoutTime true: return H:i set to 00:00
* @return Api\DateTime
* @throws Api\Exception
@ -450,4 +450,30 @@ class JsBase
{
return new Api\DateTime($value, !empty($timezone) ? new \DateTimeZone($timezone) : null);
}
const DATETIME_FORMAT = 'Y-m-d\TH:i:s';
/**
* Return a date-time value in the given timezone
*
* @link https://datatracker.ietf.org/doc/html/rfc8984#name-localdatetime
* @param null|string|\DateTime $date
* @param string|null $timezone default user-timezone
* @return string|null
*/
protected static function DateTime($date, $timezone=null)
{
static $timezones = [];
if (!isset($timezone)) $timezone = Api\DateTime::$user_timezone->getName();
if (!isset($timezones[$timezone])) $timezones[$timezone] = new \DateTimeZone($timezone);
if (!isset($date))
{
return null;
}
$date = Api\DateTime::to($date, 'object');
$date->setTimezone($timezones[$timezone]);
return $date->format(self::DATETIME_FORMAT);
}
}

View File

@ -499,31 +499,6 @@ class JsCalendar extends JsBase
return $value;
}
const DATETIME_FORMAT = 'Y-m-d\TH:i:s';
/**
* Return a date-time value in the given timezone
*
* @link https://datatracker.ietf.org/doc/html/rfc8984#name-localdatetime
* @param null|string|\DateTime $date
* @param string $timezone
* @return string|null
*/
protected static function DateTime($date, $timezone)
{
static $timezones = [];
if (!isset($timezones[$timezone])) $timezones[$timezone] = new \DateTimeZone($timezone);
if (!isset($date))
{
return null;
}
$date = Api\DateTime::to($date, 'object');
$date->setTimezone($timezones[$timezone]);
return $date->format(self::DATETIME_FORMAT);
}
/**
* Return a duration calculated from given start- and end-time or a duration in seconds (start=0)
*

View File

@ -230,7 +230,7 @@ class MimeMagic
* @author skwashd
* @author ralfbecker - convert to a static array ;-)
*
* @var array of extenstion to mime mappings
* @var array of extention to mime mappings
*/
static $mime_extension_map = array(
'txt' => 'text/plain', // should be first, so text/plain maps back to .txt

View File

@ -33,6 +33,7 @@ One can use the following URLs relative (!) to https://example.org/egroupware/gr
- ```/<current-username>/(resource|location)-<resource-name>``` shared calendar from a resource/location
- ```/mail/``` REST API only
- ```/timesheet/``` REST API only
- ```/smallpart/``` REST API only
Shared addressbooks or calendars are only shown in the users home-set, if he subscribed to it via his CalDAV preferences!
@ -50,6 +51,7 @@ from the data of an ```allprop``` PROPFIND, allow browsing CalDAV/CardDAV tree w
* view and reply to eml files and
* vacation handling
- [Timesheet](Timesheet.md)
- [ViDoTeach](https://github.com/EGroupware/smallpart/blob/master/doc/RESP-API.md)
- [Links and attachments](Links-and-attachments.md)
* linking application entries to other application entries
* attaching files to application entries