plugins/libkolab
Thomas Brüderli
bruederli at kolabsys.com
Wed May 23 16:03:02 CEST 2012
plugins/libkolab/lib/kolab_format_journal.php | 108 ++++++++++++++++++++++++++
plugins/libkolab/lib/kolab_format_note.php | 107 +++++++++++++++++++++++++
plugins/libkolab/lib/kolab_format_task.php | 108 ++++++++++++++++++++++++++
plugins/libkolab/lib/kolab_storage_folder.php | 76 ------------------
4 files changed, 323 insertions(+), 76 deletions(-)
New commits:
commit b93ddae1f52e4fba1245031bcac34c5d21f6ed07
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Wed May 23 16:02:41 2012 +0200
Add stub classes for more Kolab object types; remove legacy methods
diff --git a/plugins/libkolab/lib/kolab_format_journal.php b/plugins/libkolab/lib/kolab_format_journal.php
new file mode 100644
index 0000000..46a59db
--- /dev/null
+++ b/plugins/libkolab/lib/kolab_format_journal.php
@@ -0,0 +1,108 @@
+<?php
+
+/**
+ * Kolab Journal model class
+ *
+ * @version @package_version@
+ * @author Thomas Bruederli <bruederli at kolabsys.com>
+ *
+ * Copyright (C) 2012, Kolab Systems AG <contact at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class kolab_format_journal extends kolab_format
+{
+ public $CTYPE = 'application/calendar+xml';
+
+ protected $read_func = 'kolabformat::readJournal';
+ protected $write_func = 'kolabformat::writeJournal';
+
+
+ function __construct($xmldata = null)
+ {
+ $this->obj = new Journal;
+ $this->xmldata = $xmldata;
+ }
+
+ /**
+ * Set properties to the kolabformat object
+ *
+ * @param array Object data as hash array
+ */
+ public function set(&$object)
+ {
+ $this->init();
+
+ // set some automatic values if missing
+ if (!empty($object['uid']))
+ $this->obj->setUid($object['uid']);
+
+ // TODO: set object propeties
+
+ // cache this data
+ $this->data = $object;
+ unset($this->data['_formatobj']);
+ }
+
+ /**
+ *
+ */
+ public function is_valid()
+ {
+ return $this->data || (is_object($this->obj) && $this->obj->isValid());
+ }
+
+ /**
+ * Load data from old Kolab2 format
+ */
+ public function fromkolab2($record)
+ {
+ $object = array(
+ 'uid' => $record['uid'],
+ 'changed' => $record['last-modification-date'],
+ );
+
+ // TODO: implement this
+
+ $this->data = $object;
+ }
+
+ /**
+ * Convert the Configuration object into a hash array data structure
+ *
+ * @return array Config object data as hash array
+ */
+ public function to_array()
+ {
+ // return cached result
+ if (!empty($this->data))
+ return $this->data;
+
+ $this->init();
+
+ // read object properties
+ $object = array(
+ 'uid' => $this->obj->uid(),
+ 'changed' => $this->obj->lastModified(),
+ );
+
+
+ // TODO: read object properties
+
+ $this->data = $object;
+ return $this->data;
+ }
+
+}
diff --git a/plugins/libkolab/lib/kolab_format_note.php b/plugins/libkolab/lib/kolab_format_note.php
new file mode 100644
index 0000000..1eafa72
--- /dev/null
+++ b/plugins/libkolab/lib/kolab_format_note.php
@@ -0,0 +1,107 @@
+<?php
+
+/**
+ * Kolab Note model class
+ *
+ * @version @package_version@
+ * @author Thomas Bruederli <bruederli at kolabsys.com>
+ *
+ * Copyright (C) 2012, Kolab Systems AG <contact at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class kolab_format_note extends kolab_format
+{
+ public $CTYPE = 'application/x-vnd.kolab.note';
+
+ protected $read_func = 'kolabformat::readNote';
+ protected $write_func = 'kolabformat::writeNote';
+
+
+ function __construct($xmldata = null)
+ {
+ $this->obj = new Note;
+ $this->xmldata = $xmldata;
+ }
+
+ /**
+ * Set properties to the kolabformat object
+ *
+ * @param array Object data as hash array
+ */
+ public function set(&$object)
+ {
+ $this->init();
+
+ // set some automatic values if missing
+ if (!empty($object['uid']))
+ $this->obj->setUid($object['uid']);
+
+ // TODO: set object propeties
+
+ // cache this data
+ $this->data = $object;
+ unset($this->data['_formatobj']);
+ }
+
+ /**
+ *
+ */
+ public function is_valid()
+ {
+ return $this->data || (is_object($this->obj) && $this->obj->isValid());
+ }
+
+ /**
+ * Load data from old Kolab2 format
+ */
+ public function fromkolab2($record)
+ {
+ $object = array(
+ 'uid' => $record['uid'],
+ 'changed' => $record['last-modification-date'],
+ );
+
+
+ $this->data = $object;
+ }
+
+ /**
+ * Convert the Configuration object into a hash array data structure
+ *
+ * @return array Config object data as hash array
+ */
+ public function to_array()
+ {
+ // return cached result
+ if (!empty($this->data))
+ return $this->data;
+
+ $this->init();
+
+ // read object properties
+ $object = array(
+ 'uid' => $this->obj->uid(),
+ 'changed' => $this->obj->lastModified(),
+ );
+
+
+ // TODO: read object properties
+
+ $this->data = $object;
+ return $this->data;
+ }
+
+}
diff --git a/plugins/libkolab/lib/kolab_format_task.php b/plugins/libkolab/lib/kolab_format_task.php
new file mode 100644
index 0000000..a8b497f
--- /dev/null
+++ b/plugins/libkolab/lib/kolab_format_task.php
@@ -0,0 +1,108 @@
+<?php
+
+/**
+ * Kolab Task (ToDo) model class
+ *
+ * @version @package_version@
+ * @author Thomas Bruederli <bruederli at kolabsys.com>
+ *
+ * Copyright (C) 2012, Kolab Systems AG <contact at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class kolab_format_task extends kolab_format
+{
+ public $CTYPE = 'application/calendar+xml';
+
+ protected $read_func = 'kolabformat::readTodo';
+ protected $write_func = 'kolabformat::writeTodo';
+
+
+ function __construct($xmldata = null)
+ {
+ $this->obj = new Todo;
+ $this->xmldata = $xmldata;
+ }
+
+ /**
+ * Set properties to the kolabformat object
+ *
+ * @param array Object data as hash array
+ */
+ public function set(&$object)
+ {
+ $this->init();
+
+ // set some automatic values if missing
+ if (!empty($object['uid']))
+ $this->obj->setUid($object['uid']);
+
+ // TODO: set object propeties
+
+ // cache this data
+ $this->data = $object;
+ unset($this->data['_formatobj']);
+ }
+
+ /**
+ *
+ */
+ public function is_valid()
+ {
+ return $this->data || (is_object($this->obj) && $this->obj->isValid());
+ }
+
+ /**
+ * Load data from old Kolab2 format
+ */
+ public function fromkolab2($record)
+ {
+ $object = array(
+ 'uid' => $record['uid'],
+ 'changed' => $record['last-modification-date'],
+ );
+
+ // TODO: implement this
+
+ $this->data = $object;
+ }
+
+ /**
+ * Convert the Configuration object into a hash array data structure
+ *
+ * @return array Config object data as hash array
+ */
+ public function to_array()
+ {
+ // return cached result
+ if (!empty($this->data))
+ return $this->data;
+
+ $this->init();
+
+ // read object properties
+ $object = array(
+ 'uid' => $this->obj->uid(),
+ 'changed' => $this->obj->lastModified(),
+ );
+
+
+ // TODO: read object properties
+
+ $this->data = $object;
+ return $this->data;
+ }
+
+}
diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
index 3d4c168..6683879 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -764,81 +764,5 @@ class kolab_storage_folder
return true;
}
-
- /* Legacy methods to keep compatibility with the old Horde Kolab_Storage classes */
-
- /**
- * Compatibility method
- */
- public function getOwner()
- {
- PEAR::raiseError("Call to deprecated method kolab_storage_folder::getOwner()");
- return $this->get_owner();
- }
-
- /**
- * Get IMAP ACL information for this folder
- */
- public function getMyRights()
- {
- PEAR::raiseError("Call to deprecated method kolab_storage_folder::getMyRights()");
- return $this->get_myrights();
- }
-
- /**
- * NOP to stay compatible with the formerly used Horde classes
- */
- public function getData()
- {
- PEAR::raiseError("Call to deprecated method kolab_storage_folder::getData()");
- return $this;
- }
-
- /**
- * List all Kolab objects of the given type
- */
- public function getObjects($type = null)
- {
- PEAR::raiseError("Call to deprecated method kolab_storage_folder::getObjects()");
- return $this->get_objects($type);
- }
-
- /**
- * Getter for a single Kolab object, identified by its UID
- */
- public function getObject($uid)
- {
- PEAR::raiseError("Call to deprecated method kolab_storage_folder::getObject()");
- return $this->get_object($uid);
- }
-
- /**
- *
- */
- public function getAttachment($key)
- {
- PEAR::raiseError("Call to deprecated method not returning anything.");
- return null;
- }
-
- /**
- * Alias function of delete()
- */
- public function deleteMessage($id, $trigger = true, $expunge = true)
- {
- PEAR::raiseError("Call to deprecated method kolab_storage_folder::deleteMessage()");
- return $this->delete(array('_msguid' => $id), $trigger, $expunge);
- }
-
- /**
- *
- */
- public function deleteAll()
- {
- PEAR::raiseError("Call to deprecated method kolab_storage_folder::deleteAll()");
- return $this->delete_all();
- }
-
-
}
More information about the commits
mailing list