diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php index d631cbad..eb75bac7 100644 --- a/plugins/calendar/drivers/kolab/kolab_calendar.php +++ b/plugins/calendar/drivers/kolab/kolab_calendar.php @@ -90,10 +90,13 @@ class kolab_calendar /** * Return color to display this calendar */ - public function get_color() + public function get_color($owner) { // TODO: read color from backend (not yet supported) - return '0000dd'; + //temporary color deffirence between own calendars and the rest + if ($owner == $_SESSION['username']) + return 'd63355'; + return '1f9ebe'; } @@ -135,6 +138,7 @@ class kolab_calendar // resolve recurring events (maybe move to _fetch_events() for general use?) if ($event['recurrence']) { + $recurrence = new Horde_Date_Recurrence($event['start']); $recurrence->fromRRule20(calendar::to_rrule($event['recurrence'])); @@ -169,6 +173,7 @@ class kolab_calendar * Create a new event record * * @see Driver:new_event() + * * @return mixed The created record ID on success, False on error */ public function insert_event($event) diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php index 5898c9ad..74d34d89 100644 --- a/plugins/calendar/drivers/kolab/kolab_driver.php +++ b/plugins/calendar/drivers/kolab/kolab_driver.php @@ -71,7 +71,7 @@ class kolab_driver extends calendar_driver 'id' => $calendar->id, 'name' => $calendar->get_name(), 'editname' => $calendar->get_foldername(), - 'color' => $calendar->get_color(), + 'color' => $calendar->get_color($c_folder->_owner), 'readonly' => $c_folder->_owner != $_SESSION['username'], ); } diff --git a/plugins/calendar/skins/default/calendar.css b/plugins/calendar/skins/default/calendar.css index 51d8c603..1a1dbfcd 100644 --- a/plugins/calendar/skins/default/calendar.css +++ b/plugins/calendar/skins/default/calendar.css @@ -22,7 +22,7 @@ body.calendarmain { top: 37px; left: 10px; bottom: 0; - width: 230px; + width: 265px; } #datepicker { @@ -41,9 +41,9 @@ body.calendarmain { #sidebartoggle { position: absolute; - left: 244px; + left: 276px; width: 8px; - top: 37px; + top: 27px; bottom: 0; background: url('images/toggle.gif') 0 48% no-repeat transparent; cursor: pointer; @@ -60,7 +60,7 @@ div.sidebarclosed { #calendar { position: absolute; top: 0; - left: 256px; + left: 290px; right: 10px; bottom: 0; } @@ -539,4 +539,3 @@ div.fc-event-location { fieldset #calendarcategories div { margin-bottom: 0.3em; } - diff --git a/plugins/kolab_core/rcube_kolab.php b/plugins/kolab_core/rcube_kolab.php index 8378a2bf..d2c98add 100644 --- a/plugins/kolab_core/rcube_kolab.php +++ b/plugins/kolab_core/rcube_kolab.php @@ -86,6 +86,7 @@ class rcube_kolab * Get instance of a Kolab (XML) format object * * @param string Data type (contact,event,task,note) + * * @return object Horde_Kolab_Format_XML The format object */ public static function get_format($type) @@ -98,6 +99,7 @@ class rcube_kolab * Get a list of storage folders for the given data type * * @param string Data type to list folders for (contact,event,task,note) + * * @return array List of Kolab_Folder objects (folder names in UTF7-IMAP) */ public static function get_folders($type) @@ -112,6 +114,7 @@ class rcube_kolab * * @param string IMAP folder to access (UTF7-IMAP) * @param string Object type to deal with (leave empty for auto-detection using annotations) + * * @return object Kolab_Data The data storage object */ public static function get_storage($folder, $data_type = null) @@ -143,4 +146,80 @@ class rcube_kolab return asciiwords(strtr($folder, '/.', '--')); } + /** + * Deletes IMAP folder + * + * @param string $name Folder name (UTF7-IMAP) + * + * @return bool True on success, false on failure + */ + public static function folder_delete($name) + { + self::setup(); + $kolab = Kolab_List::singleton(); + + $folder = $kolab->getFolder($name); + $result = $folder->delete(); + + if (is_a($result, 'PEAR_Error')) { + return false; + } + + return true; + } + + /** + * Creates IMAP folder + * + * @param string $name Folder name (UTF7-IMAP) + * @param string $type Folder type + * @param bool $default True if older is default (for specified type) + * + * @return bool True on success, false on failure + */ + public static function folder_create($name, $type=null, $default=false) + { + self::setup(); + $kolab = Kolab_List::singleton(); + + $folder = new Kolab_Folder(); + $folder->setList($kolab); + $folder->setFolder($name); + + $result = $folder->save(array( + 'type' => $type, + 'default' => $default, + )); + + if (is_a($result, 'PEAR_Error')) { + return false; + } + + return true; + } + + /** + * Renames IMAP folder + * + * @param string $oldname Old folder name (UTF7-IMAP) + * @param string $newname New folder name (UTF7-IMAP) + * + * @return bool True on success, false on failure + */ + public static function folder_rename($oldname, $newname) + { + self::setup(); + $kolab = Kolab_List::singleton(); + + $folder = $kolab->getFolder($oldname); + $folder->setFolder($newname); + $result = $kolab->rename($folder); + + if (is_a($result, 'PEAR_Error')) { + return false; + } + + return true; + } + }