Merge branch 'dev/kolab3'
This commit is contained in:
commit
de40ba8950
6 changed files with 51 additions and 93 deletions
|
@ -1149,6 +1149,7 @@ class calendar extends rcube_plugin
|
||||||
return array(
|
return array(
|
||||||
'start' => gmdate('c', $this->fromGMT($event['start'])), // client treats date strings as they were in users's timezone
|
'start' => gmdate('c', $this->fromGMT($event['start'])), // client treats date strings as they were in users's timezone
|
||||||
'end' => gmdate('c', $this->fromGMT($event['end'])), // so shift timestamps to users's timezone and render a date string
|
'end' => gmdate('c', $this->fromGMT($event['end'])), // so shift timestamps to users's timezone and render a date string
|
||||||
|
'title' => strval($event['title']),
|
||||||
'description' => strval($event['description']),
|
'description' => strval($event['description']),
|
||||||
'location' => strval($event['location']),
|
'location' => strval($event['location']),
|
||||||
'className' => ($addcss ? 'fc-event-cal-'.asciiwords($event['calendar'], true).' ' : '') . 'fc-event-cat-' . asciiwords(strtolower($event['categories']), true),
|
'className' => ($addcss ? 'fc-event-cal-'.asciiwords($event['calendar'], true).' ' : '') . 'fc-event-cat-' . asciiwords(strtolower($event['categories']), true),
|
||||||
|
|
|
@ -29,6 +29,11 @@ abstract class kolab_format
|
||||||
{
|
{
|
||||||
public static $timezone;
|
public static $timezone;
|
||||||
|
|
||||||
|
public /*abstract*/ $CTYPE;
|
||||||
|
|
||||||
|
protected /*abstract*/ $read_func;
|
||||||
|
protected /*abstract*/ $write_func;
|
||||||
|
|
||||||
protected $obj;
|
protected $obj;
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $xmldata;
|
protected $xmldata;
|
||||||
|
@ -232,7 +237,29 @@ abstract class kolab_format
|
||||||
*
|
*
|
||||||
* @param string XML data
|
* @param string XML data
|
||||||
*/
|
*/
|
||||||
abstract public function load($xml);
|
public function load($xml)
|
||||||
|
{
|
||||||
|
$this->obj = call_user_func($this->read_func, $xml, false);
|
||||||
|
$this->loaded = !$this->format_errors();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write object data to XML format
|
||||||
|
*
|
||||||
|
* @return string XML data
|
||||||
|
*/
|
||||||
|
public function write()
|
||||||
|
{
|
||||||
|
$this->init();
|
||||||
|
$this->xmldata = call_user_func($this->write_func, $this->obj);
|
||||||
|
|
||||||
|
if (!$this->format_errors())
|
||||||
|
$this->update_uid();
|
||||||
|
else
|
||||||
|
$this->xmldata = null;
|
||||||
|
|
||||||
|
return $this->xmldata;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set properties to the kolabformat object
|
* Set properties to the kolabformat object
|
||||||
|
@ -246,13 +273,6 @@ abstract class kolab_format
|
||||||
*/
|
*/
|
||||||
abstract public function is_valid();
|
abstract public function is_valid();
|
||||||
|
|
||||||
/**
|
|
||||||
* Write object data to XML format
|
|
||||||
*
|
|
||||||
* @return string XML data
|
|
||||||
*/
|
|
||||||
abstract public function write();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the Kolab object into a hash array data structure
|
* Convert the Kolab object into a hash array data structure
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,6 +26,9 @@ class kolab_format_contact extends kolab_format
|
||||||
{
|
{
|
||||||
public $CTYPE = 'application/vcard+xml';
|
public $CTYPE = 'application/vcard+xml';
|
||||||
|
|
||||||
|
protected $read_func = 'kolabformat::readContact';
|
||||||
|
protected $write_func = 'kolabformat::writeContact';
|
||||||
|
|
||||||
public static $fulltext_cols = array('name', 'firstname', 'surname', 'middlename', 'email');
|
public static $fulltext_cols = array('name', 'firstname', 'surname', 'middlename', 'email');
|
||||||
|
|
||||||
public $phonetypes = array(
|
public $phonetypes = array(
|
||||||
|
@ -113,35 +116,6 @@ class kolab_format_contact extends kolab_format
|
||||||
$this->phonetypes['workfax'] |= Telephone::Work;
|
$this->phonetypes['workfax'] |= Telephone::Work;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load Contact object data from the given XML block
|
|
||||||
*
|
|
||||||
* @param string XML data
|
|
||||||
*/
|
|
||||||
public function load($xml)
|
|
||||||
{
|
|
||||||
$this->obj = kolabformat::readContact($xml, false);
|
|
||||||
$this->loaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write Contact object data to XML format
|
|
||||||
*
|
|
||||||
* @return string XML data
|
|
||||||
*/
|
|
||||||
public function write()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->xmldata = kolabformat::writeContact($this->obj);
|
|
||||||
|
|
||||||
if (!parent::format_errors())
|
|
||||||
parent::update_uid();
|
|
||||||
else
|
|
||||||
$this->xmldata = null;
|
|
||||||
|
|
||||||
return $this->xmldata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set contact properties to the kolabformat object
|
* Set contact properties to the kolabformat object
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,6 +26,10 @@ class kolab_format_distributionlist extends kolab_format
|
||||||
{
|
{
|
||||||
public $CTYPE = 'application/vcard+xml';
|
public $CTYPE = 'application/vcard+xml';
|
||||||
|
|
||||||
|
protected $read_func = 'kolabformat::readDistlist';
|
||||||
|
protected $write_func = 'kolabformat::writeDistlist';
|
||||||
|
|
||||||
|
|
||||||
function __construct($xmldata = null)
|
function __construct($xmldata = null)
|
||||||
{
|
{
|
||||||
$this->obj = new DistList;
|
$this->obj = new DistList;
|
||||||
|
@ -33,34 +37,10 @@ class kolab_format_distributionlist extends kolab_format
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Kolab object data from the given XML block
|
* Set properties to the kolabformat object
|
||||||
*
|
*
|
||||||
* @param string XML data
|
* @param array Object data as hash array
|
||||||
*/
|
*/
|
||||||
public function load($xml)
|
|
||||||
{
|
|
||||||
$this->obj = kolabformat::readDistlist($xml, false);
|
|
||||||
$this->loaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write object data to XML format
|
|
||||||
*
|
|
||||||
* @return string XML data
|
|
||||||
*/
|
|
||||||
public function write()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->xmldata = kolabformat::writeDistlist($this->obj);
|
|
||||||
|
|
||||||
if (!parent::format_errors())
|
|
||||||
parent::update_uid();
|
|
||||||
else
|
|
||||||
$this->xmldata = null;
|
|
||||||
|
|
||||||
return $this->xmldata;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function set(&$object)
|
public function set(&$object)
|
||||||
{
|
{
|
||||||
$this->init();
|
$this->init();
|
||||||
|
@ -137,7 +117,7 @@ class kolab_format_distributionlist extends kolab_format
|
||||||
// read object properties
|
// read object properties
|
||||||
$object = array(
|
$object = array(
|
||||||
'uid' => $this->obj->uid(),
|
'uid' => $this->obj->uid(),
|
||||||
# 'changed' => $this->obj->lastModified(),
|
'changed' => $this->obj->lastModified(),
|
||||||
'name' => $this->obj->name(),
|
'name' => $this->obj->name(),
|
||||||
'member' => array(),
|
'member' => array(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -26,6 +26,9 @@ class kolab_format_event extends kolab_format
|
||||||
{
|
{
|
||||||
public $CTYPE = 'application/calendar+xml';
|
public $CTYPE = 'application/calendar+xml';
|
||||||
|
|
||||||
|
protected $read_func = 'kolabformat::readEvent';
|
||||||
|
protected $write_func = 'kolabformat::writeEvent';
|
||||||
|
|
||||||
public static $fulltext_cols = array('title', 'description', 'location', 'attendees:name', 'attendees:email');
|
public static $fulltext_cols = array('title', 'description', 'location', 'attendees:name', 'attendees:email');
|
||||||
|
|
||||||
private $sensitivity_map = array(
|
private $sensitivity_map = array(
|
||||||
|
@ -99,35 +102,6 @@ class kolab_format_event extends kolab_format
|
||||||
$this->xmldata = $xmldata;
|
$this->xmldata = $xmldata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load Contact object data from the given XML block
|
|
||||||
*
|
|
||||||
* @param string XML data
|
|
||||||
*/
|
|
||||||
public function load($xml)
|
|
||||||
{
|
|
||||||
$this->obj = kolabformat::readEvent($xml, false);
|
|
||||||
$this->loaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write Contact object data to XML format
|
|
||||||
*
|
|
||||||
* @return string XML data
|
|
||||||
*/
|
|
||||||
public function write()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->xmldata = kolabformat::writeEvent($this->obj);
|
|
||||||
|
|
||||||
if (!parent::format_errors())
|
|
||||||
parent::update_uid();
|
|
||||||
else
|
|
||||||
$this->xmldata = null;
|
|
||||||
|
|
||||||
return $this->xmldata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set contact properties to the kolabformat object
|
* Set contact properties to the kolabformat object
|
||||||
*
|
*
|
||||||
|
|
|
@ -506,6 +506,12 @@ class kolab_storage_cache
|
||||||
'lock'
|
'lock'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// abort if database is not set-up
|
||||||
|
if ($this->db->is_error()) {
|
||||||
|
$this->ready = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// create lock record if not exists
|
// create lock record if not exists
|
||||||
if (!$sql_arr) {
|
if (!$sql_arr) {
|
||||||
$this->db->query(
|
$this->db->query(
|
||||||
|
@ -538,6 +544,9 @@ class kolab_storage_cache
|
||||||
*/
|
*/
|
||||||
private function _sync_unlock()
|
private function _sync_unlock()
|
||||||
{
|
{
|
||||||
|
if (!$this->ready)
|
||||||
|
return;
|
||||||
|
|
||||||
$this->db->query(
|
$this->db->query(
|
||||||
"UPDATE kolab_cache SET msguid=0, created='' ".
|
"UPDATE kolab_cache SET msguid=0, created='' ".
|
||||||
"WHERE resource=? AND type=?",
|
"WHERE resource=? AND type=?",
|
||||||
|
|
Loading…
Add table
Reference in a new issue