From 704a1c655e350aa4881069297f99caa0c1d56952 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Sat, 30 Jun 2012 11:07:54 +0000 Subject: [PATCH 1/6] Contacts: fix add contact icon path --- apps/contacts/templates/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index 0d4219c9f2..a8fb6c57c2 100644 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -9,7 +9,7 @@
- +
From 51173163ce71c8b2f7f4876ba3cb9def51f19125 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Sat, 30 Jun 2012 11:22:09 +0000 Subject: [PATCH 2/6] Contacts: align the bottom control buttons --- apps/contacts/css/contacts.css | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css index ce4daa1d3a..588a51a429 100644 --- a/apps/contacts/css/contacts.css +++ b/apps/contacts/css/contacts.css @@ -12,6 +12,7 @@ .ui-draggable-dragging { width: 16em; } .ui-state-hover { border: 1px solid dashed; } #bottomcontrols { padding: 0; bottom:0px; height:2.8em; width: 20em; margin:0; background:#eee; border-top:1px solid #ccc; position:fixed; -moz-box-shadow: 0 -3px 3px -3px #000; -webkit-box-shadow: 0 -3px 3px -3px #000; box-shadow: 0 -3px 3px -3px #000;} +#bottomcontrols img { margin-top: 0.35em; } #contacts_newcontact { float: left; margin: 0.2em 0 0 1em; } #chooseaddressbook { float: right; margin: 0.2em 1em 0 0; } #actionbar { height: 30px; width: 60px; position: fixed; right: 0px; top: 4em; margin: 0 0 0 0; padding: 0 0 0 0; z-index: 1000; } From 34b2486d5342aba7b9459ce1e27f5acf2e7629e4 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 30 Jun 2012 15:23:21 +0200 Subject: [PATCH 3/6] some improvements for calendar export --- apps/calendar/lib/export.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/calendar/lib/export.php b/apps/calendar/lib/export.php index cd248ce92a..b05e758672 100644 --- a/apps/calendar/lib/export.php +++ b/apps/calendar/lib/export.php @@ -37,7 +37,8 @@ class OC_Calendar_Export{ */ private static function calendar($id){ $events = OC_Calendar_Object::all($id); - $return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . OCP\App::getAppVersion('calendar') . "\n"; + $calendar = OC_Calendar_Calendar::find($id); + $return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . OCP\App::getAppVersion('calendar') . "\nX-WR-CALNAME:" . $calendar['displayname'] . "\n"; foreach($events as $event){ $return .= self::generateEvent($event); } @@ -52,7 +53,7 @@ class OC_Calendar_Export{ */ private static function event($id){ $event = OC_Calendar_Object::find($id); - $return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . OCP\App::getAppVersion('calendar') . "\n"; + $return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . OCP\App::getAppVersion('calendar') . "\nX-WR-CALNAME:" . $event['summary'] . "\n"; $return .= self::generateEvent($event); $return .= "END:VCALENDAR"; return $return; From 8e0addebc315d064b543d3b33442b528a0127ee2 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 30 Jun 2012 15:39:20 +0200 Subject: [PATCH 4/6] fix some doc --- apps/calendar/lib/share.php | 84 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php index 01502f1c6b..7e1a43c414 100644 --- a/apps/calendar/lib/share.php +++ b/apps/calendar/lib/share.php @@ -13,9 +13,9 @@ class OC_Calendar_Share{ const EVENT = 'event'; /* * @brief: returns informations about all calendar or events which users are sharing with the user - userid - * @param: (string) $userid - id of the user - * @param: (string) $type - use const self::CALENDAR or self::EVENT - * @return: (array) $return - information about calendars + * @param: string $userid - id of the user + * @param: string $type - use const self::CALENDAR or self::EVENT + * @return: array $return - information about calendars */ public static function allSharedwithuser($userid, $type, $active=null, $permission=null){ $group_where = self::group_sql(OC_Group::getUserGroups($userid)); @@ -35,9 +35,9 @@ class OC_Calendar_Share{ } /* * @brief: returns all users a calendar / event is shared with - * @param: (int) id - id of the calendar / event - * @param: (string) $type - use const self::CALENDAR or self::EVENT - * @return: (array) $users - information about users a calendar / event is shared with + * @param: integer id - id of the calendar / event + * @param: string $type - use const self::CALENDAR or self::EVENT + * @return: array $users - information about users a calendar / event is shared with */ public static function allUsersSharedwith($id, $type){ $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ' . $type . 'id = ? ORDER BY share'); @@ -50,11 +50,11 @@ class OC_Calendar_Share{ } /* * @brief: shares a calendar / event - * @param: (string) $owner - userid of the owner - * @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) - * @param: (string) $sharetype - type of sharing (can be: user/group/public) - * @param: (string) $id - id of the calendar / event - * @param: (string) $type - use const self::CALENDAR or self::EVENT + * @param: string $owner - userid of the owner + * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) + * @param: string $sharetype - type of sharing (can be: user/group/public) + * @param: string $id - id of the calendar / event + * @param: string $type - use const self::CALENDAR or self::EVENT * @return (mixed) - token (if $sharetype == public) / bool (if $sharetype != public) */ public static function share($owner, $share, $sharetype, $id, $type){ @@ -82,12 +82,12 @@ class OC_Calendar_Share{ } /* * @brief: stops sharing a calendar / event - * @param: (string) $owner - userid of the owner - * @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) - * @param: (string) $sharetype - type of sharing (can be: user/group/public) - * @param: (string) $id - id of the calendar / event - * @param: (string) $type - use const self::CALENDAR or self::EVENT - * @return (bool) + * @param: string $owner - userid of the owner + * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) + * @param: string $sharetype - type of sharing (can be: user/group/public) + * @param: string $id - id of the calendar / event + * @param: string $type - use const self::CALENDAR or self::EVENT + * @return boolean */ public static function unshare($owner, $share, $sharetype, $id, $type){ $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_share_' . $type . ' WHERE owner = ? ' . (($sharetype != 'public')?'AND share = ?':'') . ' AND sharetype = ? AND ' . $type . 'id = ?'); @@ -100,12 +100,12 @@ class OC_Calendar_Share{ } /* * @brief: changes the permission for a calendar / event - * @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) - * @param: (string) $sharetype - type of sharing (can be: user/group/public) - * @param: (string) $id - id of the calendar / event - * @param: (int) $permission - permission of user the calendar / event is shared with (if $sharetype == public then $permission = 0) - * @param: (string) $type - use const self::CALENDAR or self::EVENT - * @return (bool) + * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) + * @param: string $sharetype - type of sharing (can be: user/group/public) + * @param: string $id - id of the calendar / event + * @param: integer $permission - permission of user the calendar / event is shared with (if $sharetype == public then $permission = 0) + * @param: string $type - use const self::CALENDAR or self::EVENT + * @return boolean */ public static function changepermission($share, $sharetype, $id, $permission, $type){ if($sharetype == 'public' && $permission == 1){ @@ -117,7 +117,7 @@ class OC_Calendar_Share{ } /* * @brief: generates a token for public calendars / events - * @return: (string) $token + * @return: string $token */ private static function generate_token($id, $type){ $uniqid = uniqid(); @@ -140,12 +140,12 @@ class OC_Calendar_Share{ } /* * @brief: checks if it is already shared - * @param: (string) $owner - userid of the owner - * @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) - * @param: (string) $sharetype - type of sharing (can be: user/group/public) - * @param: (string) $id - id of the calendar / event - * @param: (string) $type - use const self::CALENDAR or self::EVENT - * @return (bool) + * @param: string $owner - userid of the owner + * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) + * @param: string $sharetype - type of sharing (can be: user/group/public) + * @param: string $id - id of the calendar / event + * @param: string $type - use const self::CALENDAR or self::EVENT + * @return boolean */ public static function is_already_shared($owner, $share, $sharetype, $id, $type){ $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE owner = ? AND share = ? AND sharetype = ? AND ' . $type . 'id = ?'); @@ -183,10 +183,10 @@ class OC_Calendar_Share{ } /* * @brief: checks the permission for editing an event - * @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) - * @param: (string) $id - id of the calendar / event - * @param: (string) $type - use const self::CALENDAR or self::EVENT - * @return (bool) + * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) + * @param: string $id - id of the calendar / event + * @param: string $type - use const self::CALENDAR or self::EVENT + * @return boolean */ public static function is_editing_allowed($share, $id, $type){ $group_where = self::group_sql(OC_Group::getUserGroups($share)); @@ -204,10 +204,10 @@ class OC_Calendar_Share{ } /* * @brief: checks the access of - * @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) - * @param: (string) $id - id of the calendar / event - * @param: (string) $type - use const self::CALENDAR or self::EVENT - * @return (bool) + * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) + * @param: string $id - id of the calendar / event + * @param: string $type - use const self::CALENDAR or self::EVENT + * @return boolean */ public static function check_access($share, $id, $type){ $group_where = self::group_sql(OC_Group::getUserGroups($share)); @@ -225,7 +225,7 @@ class OC_Calendar_Share{ } /* * @brief: returns the calendardata of an event or a calendar - * @param: (string) $token - token which should be searched + * @param: string $token - token which should be searched * @return: mixed - bool if false, array with type and id if true */ public static function getElementByToken($token){ @@ -250,7 +250,7 @@ class OC_Calendar_Share{ /* * @brief sets the active status of the calendar - * @param (string) $ + * @param string */ public static function set_active($share, $id, $active){ $stmt = OCP\DB::prepare("UPDATE *PREFIX*calendar_share_calendar SET active = ? WHERE share = ? AND sharetype = 'user' AND calendarid = ?"); @@ -259,8 +259,8 @@ class OC_Calendar_Share{ /* * @brief deletes all shared calendars / events after a user was deleted - * @param (string) $userid - * @return (bool) + * @param string $userid + * @return boolean */ public static function post_userdelete($userid){ $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_share_calendar WHERE owner = ?'); From 4ed55315e7280ab4212c0172503b1a08a0a4240d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=BClsmann?= Date: Sat, 30 Jun 2012 16:53:41 +0200 Subject: [PATCH 5/6] fixed linkTo() --- lib/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helper.php b/lib/helper.php index 64378da356..b1d2da1452 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -45,7 +45,7 @@ class OC_Helper { $urlLinkTo = OC::$WEBROOT . '/?app=' . $app; $urlLinkTo .= ($file!='index.php')?'&getfile=' . urlencode($file):''; }else{ - $urlLinkTo = OC_App::getAppWebPath($app) . $file; + $urlLinkTo = OC_App::getAppWebPath($app) . '/' . $file; } } else{ From fa5b31ac9ce8945140dbd4eae325d8c7aa5560e6 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 30 Jun 2012 17:08:00 +0200 Subject: [PATCH 6/6] fix documentation style --- apps/calendar/lib/app.php | 50 ++++++----- apps/calendar/lib/calendar.php | 8 +- apps/calendar/lib/export.php | 14 +-- apps/calendar/lib/object.php | 157 +++++++++++++++++++++++++-------- apps/calendar/lib/repeat.php | 28 +++--- apps/calendar/lib/share.php | 30 +++---- 6 files changed, 186 insertions(+), 101 deletions(-) diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index ca897a36dc..1a13f2958c 100644 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -13,22 +13,22 @@ OC_Calendar_App::$tz = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', class OC_Calendar_App{ const CALENDAR = 'calendar'; const EVENT = 'event'; - /* + /** * @brief language object for calendar app */ public static $l10n; - /* + /** * @brief categories of the user */ protected static $categories = null; - /* + /** * @brief timezone of the user */ public static $tz; - /* + /** * @brief returns informations about a calendar * @param int $id - id of the calendar * @param bool $security - check access rights or not @@ -53,7 +53,7 @@ class OC_Calendar_App{ return $calendar; } - /* + /** * @brief returns informations about an event * @param int $id - id of the event * @param bool $security - check access rights or not @@ -79,7 +79,7 @@ class OC_Calendar_App{ return $event; } - /* + /** * @brief returns the parsed calendar data * @param int $id - id of the event * @param bool $security - check access rights or not @@ -97,7 +97,7 @@ class OC_Calendar_App{ return $vobject; } - /* + /** * @brief checks if an event was edited and dies if it was * @param (object) $vevent - vevent object of the event * @param (int) $lastmodified - time of last modification as unix timestamp @@ -112,7 +112,7 @@ class OC_Calendar_App{ return true; } - /* + /** * @brief returns the default categories of ownCloud * @return (array) $categories */ @@ -136,7 +136,7 @@ class OC_Calendar_App{ ); } - /* + /** * @brief returns the vcategories object of the user * @return (object) $vcategories */ @@ -147,7 +147,7 @@ class OC_Calendar_App{ return self::$categories; } - /* + /** * @brief returns the categories of the vcategories object * @return (array) $categories */ @@ -202,12 +202,16 @@ class OC_Calendar_App{ self::getVCategories()->loadFromVObject($object, true); } } - + + /** + * @brief returns the options for the repeat rule of an repeating event + * @return array - valid inputs for the repeat rule of an repeating event + */ public static function getRepeatOptions(){ return OC_Calendar_Object::getRepeatOptions(self::$l10n); } - /* + /** * @brief returns the options for the end of an repeating event * @return array - valid inputs for the end of an repeating events */ @@ -215,7 +219,7 @@ class OC_Calendar_App{ return OC_Calendar_Object::getEndOptions(self::$l10n); } - /* + /** * @brief returns the options for an monthly repeating event * @return array - valid inputs for monthly repeating events */ @@ -223,7 +227,7 @@ class OC_Calendar_App{ return OC_Calendar_Object::getMonthOptions(self::$l10n); } - /* + /** * @brief returns the options for an weekly repeating event * @return array - valid inputs for weekly repeating events */ @@ -231,7 +235,7 @@ class OC_Calendar_App{ return OC_Calendar_Object::getWeeklyOptions(self::$l10n); } - /* + /** * @brief returns the options for an yearly repeating event * @return array - valid inputs for yearly repeating events */ @@ -239,7 +243,7 @@ class OC_Calendar_App{ return OC_Calendar_Object::getYearOptions(self::$l10n); } - /* + /** * @brief returns the options for an yearly repeating event which occurs on specific days of the year * @return array - valid inputs for yearly repeating events */ @@ -247,7 +251,7 @@ class OC_Calendar_App{ return OC_Calendar_Object::getByYearDayOptions(); } - /* + /** * @brief returns the options for an yearly repeating event which occurs on specific month of the year * @return array - valid inputs for yearly repeating events */ @@ -255,7 +259,7 @@ class OC_Calendar_App{ return OC_Calendar_Object::getByMonthOptions(self::$l10n); } - /* + /** * @brief returns the options for an yearly repeating event which occurs on specific week numbers of the year * @return array - valid inputs for yearly repeating events */ @@ -263,7 +267,7 @@ class OC_Calendar_App{ return OC_Calendar_Object::getByWeekNoOptions(); } - /* + /** * @brief returns the options for an yearly or monthly repeating event which occurs on specific days of the month * @return array - valid inputs for yearly or monthly repeating events */ @@ -271,7 +275,7 @@ class OC_Calendar_App{ return OC_Calendar_Object::getByMonthDayOptions(); } - /* + /** * @brief returns the options for an monthly repeating event which occurs on specific weeks of the month * @return array - valid inputs for monthly repeating events */ @@ -279,7 +283,7 @@ class OC_Calendar_App{ return OC_Calendar_Object::getWeekofMonth(self::$l10n); } - /* + /** * @brief checks the access for a calendar / an event * @param (int) $id - id of the calendar / event * @param (string) $type - type of the id (calendar/event) @@ -320,7 +324,7 @@ class OC_Calendar_App{ } } - /* + /** * @brief analyses the parameter for calendar parameter and returns the objects * @param (string) $calendarid - calendarid * @param (int) $start - unixtimestamp of start @@ -360,7 +364,7 @@ class OC_Calendar_App{ return $events; } - /* + /** * @brief generates the output for an event which will be readable for our js * @param (mixed) $event - event object / array * @param (int) $start - DateTime object of start diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php index 5274397c76..128b55c48e 100644 --- a/apps/calendar/lib/calendar.php +++ b/apps/calendar/lib/calendar.php @@ -5,7 +5,7 @@ * later. * See the COPYING-README file. */ -/* +/** * * The following SQL statement is just a help for developers and will not be * executed! @@ -201,7 +201,7 @@ class OC_Calendar_Calendar{ return true; } - /* + /** * @brief merges two calendars * @param integer $id1 * @param integer $id2 @@ -240,7 +240,7 @@ class OC_Calendar_Calendar{ return $userid; } - /* + /** * @brief returns the possible color for calendars * @return array */ @@ -257,7 +257,7 @@ class OC_Calendar_Calendar{ ); } - /* + /** * @brief generates the Event Source Info for our JS * @param array $calendar calendar data * @return array diff --git a/apps/calendar/lib/export.php b/apps/calendar/lib/export.php index b05e758672..8f26891f36 100644 --- a/apps/calendar/lib/export.php +++ b/apps/calendar/lib/export.php @@ -5,17 +5,17 @@ * later. * See the COPYING-README file. */ -/* +/** * This class does export and converts all times to UTC */ class OC_Calendar_Export{ - /* + /** * @brief Use one of these constants as second parameter if you call OC_Calendar_Export::export() */ const CALENDAR = 'calendar'; const EVENT = 'event'; - /* + /** * @brief export a calendar or an event * @param integer $id id of calendar / event * @param string $type use OC_Calendar_Export constants @@ -30,7 +30,7 @@ class OC_Calendar_Export{ return self::fixLineBreaks($return); } - /* + /** * @brief exports a calendar and convert all times to UTC * @param integer $id id of the calendar * @return string @@ -46,7 +46,7 @@ class OC_Calendar_Export{ return $return; } - /* + /** * @brief exports an event and convert all times to UTC * @param integer $id id of the event * @return string @@ -59,7 +59,7 @@ class OC_Calendar_Export{ return $return; } - /* + /** * @brief generates the VEVENT with UTC dates * @param array $event * @return string @@ -79,7 +79,7 @@ class OC_Calendar_Export{ return $object->VEVENT->serialize(); } - /* + /** * @brief fixes new line breaks * (fixes problems with Apple iCal) * @param string $string to fix diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 5d475c8943..140542bf4f 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -1,11 +1,13 @@ + * Copyright (c) 2012 Bart Visscher + * Copyright (c) 2012 Georg Ehrke * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ - /* + /** * * The following SQL statement is just a help for developers and will not be * executed! @@ -330,7 +332,12 @@ class OC_Calendar_Object{ public static function getUTCforMDB($datetime){ return date('Y-m-d H:i', $datetime->format('U') - $datetime->getOffset()); } - + + /** + * @brief returns the DTEND of an $vevent object + * @param object $vevent vevent object + * @return object + */ public static function getDTEndFromVEvent($vevent){ if ($vevent->DTEND) { $dtend = $vevent->DTEND; @@ -355,9 +362,12 @@ class OC_Calendar_Object{ } return $dtend; } - - public static function getRepeatOptions($l10n) - { + + /** + * @brief returns the options for the repeat rule of an repeating event + * @return array - valid inputs for the repeat rule of an repeating event + */ + public static function getRepeatOptions($l10n){ return array( 'doesnotrepeat' => $l10n->t('Does not repeat'), 'daily' => $l10n->t('Daily'), @@ -368,26 +378,35 @@ class OC_Calendar_Object{ 'yearly' => $l10n->t('Yearly') ); } - - public static function getEndOptions($l10n) - { + + /** + * @brief returns the options for the end of an repeating event + * @return array - valid inputs for the end of an repeating events + */ + public static function getEndOptions($l10n){ return array( 'never' => $l10n->t('never'), 'count' => $l10n->t('by occurrences'), 'date' => $l10n->t('by date') ); } - - public static function getMonthOptions($l10n) - { + + /** + * @brief returns the options for an monthly repeating event + * @return array - valid inputs for monthly repeating events + */ + public static function getMonthOptions($l10n){ return array( 'monthday' => $l10n->t('by monthday'), 'weekday' => $l10n->t('by weekday') ); } - - public static function getWeeklyOptions($l10n) - { + + /** + * @brief returns the options for an weekly repeating event + * @return array - valid inputs for weekly repeating events + */ + public static function getWeeklyOptions($l10n){ return array( 'MO' => $l10n->t('Monday'), 'TU' => $l10n->t('Tuesday'), @@ -398,9 +417,12 @@ class OC_Calendar_Object{ 'SU' => $l10n->t('Sunday') ); } - - public static function getWeekofMonth($l10n) - { + + /** + * @brief returns the options for an monthly repeating event which occurs on specific weeks of the month + * @return array - valid inputs for monthly repeating events + */ + public static function getWeekofMonth($l10n){ return array( 'auto' => $l10n->t('events week of month'), '1' => $l10n->t('first'), @@ -411,7 +433,11 @@ class OC_Calendar_Object{ '-1' => $l10n->t('last') ); } - + + /** + * @brief returns the options for an yearly repeating event which occurs on specific days of the year + * @return array - valid inputs for yearly repeating events + */ public static function getByYearDayOptions(){ $return = array(); foreach(range(1,366) as $num){ @@ -419,7 +445,11 @@ class OC_Calendar_Object{ } return $return; } - + + /** + * @brief returns the options for an yearly or monthly repeating event which occurs on specific days of the month + * @return array - valid inputs for yearly or monthly repeating events + */ public static function getByMonthDayOptions(){ $return = array(); foreach(range(1,31) as $num){ @@ -427,7 +457,11 @@ class OC_Calendar_Object{ } return $return; } - + + /** + * @brief returns the options for an yearly repeating event which occurs on specific month of the year + * @return array - valid inputs for yearly repeating events + */ public static function getByMonthOptions($l10n){ return array( '1' => $l10n->t('January'), @@ -444,7 +478,11 @@ class OC_Calendar_Object{ '12' => $l10n->t('December') ); } - + + /** + * @brief returns the options for an yearly repeating event + * @return array - valid inputs for yearly repeating events + */ public static function getYearOptions($l10n){ return array( 'bydate' => $l10n->t('by events date'), @@ -453,13 +491,21 @@ class OC_Calendar_Object{ 'bydaymonth' => $l10n->t('by day and month') ); } - + + /** + * @brief returns the options for an yearly repeating event which occurs on specific week numbers of the year + * @return array - valid inputs for yearly repeating events + */ public static function getByWeekNoOptions(){ return range(1, 52); } - - public static function validateRequest($request) - { + + /** + * @brief validates a request + * @param array $request + * @return mixed (array / boolean) + */ + public static function validateRequest($request){ $errnum = 0; $errarr = array('title'=>'false', 'cal'=>'false', 'from'=>'false', 'fromtime'=>'false', 'to'=>'false', 'totime'=>'false', 'endbeforestart'=>'false'); if($request['title'] == ''){ @@ -606,17 +652,24 @@ class OC_Calendar_Object{ } return false; } - - protected static function checkTime($time) - { + + /** + * @brief validates time + * @param string $time + * @return boolean + */ + protected static function checkTime($time){ list($hours, $minutes) = explode(':', $time); return empty($time) || $hours < 0 || $hours > 24 || $minutes < 0 || $minutes > 60; } - - public static function createVCalendarFromRequest($request) - { + + /** + * @brief creates an VCalendar Object from the request data + * @param array $request + * @return object created $vcalendar + */ public static function createVCalendarFromRequest($request){ $vcalendar = new OC_VObject('VCALENDAR'); $vcalendar->add('PRODID', 'ownCloud Calendar'); $vcalendar->add('VERSION', '2.0'); @@ -629,9 +682,14 @@ class OC_Calendar_Object{ $vevent->setUID(); return self::updateVCalendarFromRequest($request, $vcalendar); } - - public static function updateVCalendarFromRequest($request, $vcalendar) - { + + /** + * @brief updates an VCalendar Object from the request data + * @param array $request + * @param object $vcalendar + * @return object updated $vcalendar + */ + public static function updateVCalendarFromRequest($request, $vcalendar){ $title = $request["title"]; $location = $request["location"]; $categories = $request["categories"]; @@ -811,29 +869,52 @@ class OC_Calendar_Object{ $vevent->setString('DESCRIPTION', $description); $vevent->setString('CATEGORIES', $categories); - /*if($repeat == "true"){ + /**if($repeat == "true"){ $vevent->RRULE = $repeat; }*/ return $vcalendar; } - + + /** + * @brief returns the owner of an object + * @param integer $id + * @return string + */ public static function getowner($id){ $event = self::find($id); $cal = OC_Calendar_Calendar::find($event['calendarid']); return $cal['userid']; } + /** + * @brief returns the calendarid of an object + * @param integer $id + * @return integer + */ public static function getCalendarid($id){ $event = self::find($id); return $event['calendarid']; } - + + /** + * @brief checks if an object is repeating + * @param integer $id + * @return boolean + */ public static function isrepeating($id){ $event = self::find($id); return ($event['repeating'] == 1)?true:false; } - + + /** + * @brief converts the start_dt and end_dt to a new timezone + * @param object $dtstart + * @param object $dtend + * @param boolean $allday + * @param string $tz + * @return array + */ public static function generateStartEndDate($dtstart, $dtend, $allday, $tz){ $start_dt = $dtstart->getDateTime(); $end_dt = $dtend->getDateTime(); diff --git a/apps/calendar/lib/repeat.php b/apps/calendar/lib/repeat.php index 204f96a5a2..b9fbee8fe0 100644 --- a/apps/calendar/lib/repeat.php +++ b/apps/calendar/lib/repeat.php @@ -5,12 +5,12 @@ * later. * See the COPYING-README file. */ -/* +/** * This class manages the caching of repeating events * Events will be cached for the current year ± 5 years */ class OC_Calendar_Repeat{ - /* + /** * @brief returns the cache of an event * @param (int) $id - id of the event * @return (array) @@ -24,7 +24,7 @@ class OC_Calendar_Repeat{ } return $return; } - /* + /** * @brief returns the cache of an event in a specific peroid * @param (int) $id - id of the event * @param (DateTime) $from - start for period in UTC @@ -44,7 +44,7 @@ class OC_Calendar_Repeat{ } return $return; } - /* + /** * @brief returns the cache of all repeating events of a calendar * @param (int) $id - id of the calendar * @return (array) @@ -58,7 +58,7 @@ class OC_Calendar_Repeat{ } return $return; } - /* + /** * @brief returns the cache of all repeating events of a calendar in a specific period * @param (int) $id - id of the event * @param (string) $from - start for period in UTC @@ -78,7 +78,7 @@ class OC_Calendar_Repeat{ } return $return; } - /* + /** * @brief generates the cache the first time * @param (int) id - id of the event * @return (bool) @@ -104,7 +104,7 @@ class OC_Calendar_Repeat{ } return true; } - /* + /** * @brief generates the cache the first time for all repeating event of an calendar * @param (int) id - id of the calendar * @return (bool) @@ -116,7 +116,7 @@ class OC_Calendar_Repeat{ } return true; } - /* + /** * @brief updates an event that is already cached * @param (int) id - id of the event * @return (bool) @@ -126,7 +126,7 @@ class OC_Calendar_Repeat{ self::generate($id); return true; } - /* + /** * @brief updates all repating events of a calendar that are already cached * @param (int) id - id of the calendar * @return (bool) @@ -136,7 +136,7 @@ class OC_Calendar_Repeat{ self::generateCalendar($id); return true; } - /* + /** * @brief checks if an event is already cached * @param (int) id - id of the event * @return (bool) @@ -148,7 +148,7 @@ class OC_Calendar_Repeat{ return false; } } - /* + /** * @brief checks if an event is already cached in a specific period * @param (int) id - id of the event * @param (DateTime) $from - start for period in UTC @@ -163,7 +163,7 @@ class OC_Calendar_Repeat{ } } - /* + /** * @brief checks if a whole calendar is already cached * @param (int) id - id of the calendar * @return (bool) @@ -183,7 +183,7 @@ class OC_Calendar_Repeat{ return true; } } - /* + /** * @brief removes the cache of an event * @param (int) id - id of the event * @return (bool) @@ -192,7 +192,7 @@ class OC_Calendar_Repeat{ $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_repeat WHERE eventid = ?'); $stmt->execute(array($id)); } - /* + /** * @brief removes the cache of all events of a calendar * @param (int) id - id of the calendar * @return (bool) diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php index 7e1a43c414..4fe8817140 100644 --- a/apps/calendar/lib/share.php +++ b/apps/calendar/lib/share.php @@ -5,13 +5,13 @@ * later. * See the COPYING-README file. */ -/* +/** * This class manages shared calendars */ class OC_Calendar_Share{ const CALENDAR = 'calendar'; const EVENT = 'event'; - /* + /** * @brief: returns informations about all calendar or events which users are sharing with the user - userid * @param: string $userid - id of the user * @param: string $type - use const self::CALENDAR or self::EVENT @@ -33,7 +33,7 @@ class OC_Calendar_Share{ } return $return; } - /* + /** * @brief: returns all users a calendar / event is shared with * @param: integer id - id of the calendar / event * @param: string $type - use const self::CALENDAR or self::EVENT @@ -48,7 +48,7 @@ class OC_Calendar_Share{ } return $users; } - /* + /** * @brief: shares a calendar / event * @param: string $owner - userid of the owner * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) @@ -80,7 +80,7 @@ class OC_Calendar_Share{ return true; } } - /* + /** * @brief: stops sharing a calendar / event * @param: string $owner - userid of the owner * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) @@ -98,7 +98,7 @@ class OC_Calendar_Share{ } return true; } - /* + /** * @brief: changes the permission for a calendar / event * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) * @param: string $sharetype - type of sharing (can be: user/group/public) @@ -115,7 +115,7 @@ class OC_Calendar_Share{ $stmt->execute(array($permission, $share, $sharetype, $id)); return true; } - /* + /** * @brief: generates a token for public calendars / events * @return: string $token */ @@ -138,7 +138,7 @@ class OC_Calendar_Share{ $token = md5($string); return substr($token, rand(0,16), 15); } - /* + /** * @brief: checks if it is already shared * @param: string $owner - userid of the owner * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) @@ -181,7 +181,7 @@ class OC_Calendar_Share{ } return $active_where; } - /* + /** * @brief: checks the permission for editing an event * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) * @param: string $id - id of the calendar / event @@ -202,7 +202,7 @@ class OC_Calendar_Share{ } return false; } - /* + /** * @brief: checks the access of * @param: string $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public) * @param: string $id - id of the calendar / event @@ -223,7 +223,7 @@ class OC_Calendar_Share{ return false; } } - /* + /** * @brief: returns the calendardata of an event or a calendar * @param: string $token - token which should be searched * @return: mixed - bool if false, array with type and id if true @@ -248,7 +248,7 @@ class OC_Calendar_Share{ return $return; } - /* + /** * @brief sets the active status of the calendar * @param string */ @@ -257,7 +257,7 @@ class OC_Calendar_Share{ $stmt->execute(array($active, $share, $id)); } - /* + /** * @brief deletes all shared calendars / events after a user was deleted * @param string $userid * @return boolean @@ -274,7 +274,7 @@ class OC_Calendar_Share{ return true; } - /* + /** * @brief deletes all shared events of a calendar * @param integer $calid * @return boolean @@ -285,7 +285,7 @@ class OC_Calendar_Share{ return true; } - /* + /** * @brief deletes all shares of an event * @param integer $eventid * @return boolean