Added breadcrumb and control bar.

This commit is contained in:
Tom Needham 2011-10-03 22:59:40 +01:00
commit 02d7b1a1fc
190 changed files with 2611 additions and 600 deletions

5
.gitignore vendored
View File

@ -28,3 +28,8 @@ RCS/*
# eclipse
.project
.settings
# netbeans
nbproject
.DS_Store

View File

@ -36,20 +36,17 @@ abstract class Sabre_CalDAV_Backend_Abstract {
* If the creation was a success, an id must be returned that can be used to reference
* this calendar in other methods, such as updateCalendar.
*
* This function must return a server-wide unique id that can be used
* later to reference the calendar.
*
* @param string $principalUri
* @param string $calendarUri
* @param array $properties
* @return string|int
* @return void
*/
abstract function createCalendar($principalUri,$calendarUri,array $properties);
/**
* Updates properties on this node,
* Updates properties for a calendar.
*
* The properties array uses the propertyName in clark-notation as key,
* The mutations array uses the propertyName in clark-notation as key,
* and the array value for the property value. In the case a property
* should be deleted, the property value will be null.
*
@ -79,10 +76,10 @@ abstract class Sabre_CalDAV_Backend_Abstract {
* (424 Failed Dependency) because the request needs to be atomic.
*
* @param string $calendarId
* @param array $properties
* @param array $mutations
* @return bool|array
*/
public function updateCalendar($calendarId, array $properties) {
public function updateCalendar($calendarId, array $mutations) {
return false;
@ -97,7 +94,7 @@ abstract class Sabre_CalDAV_Backend_Abstract {
abstract function deleteCalendar($calendarId);
/**
* Returns all calendar objects within a calendar object.
* Returns all calendar objects within a calendar.
*
* Every item contains an array with the following keys:
* * id - unique identifier which will be used for subsequent updates

View File

@ -129,7 +129,6 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
* @param string $principalUri
* @param string $calendarUri
* @param array $properties
* @return mixed
*/
public function createCalendar($principalUri,$calendarUri, array $properties) {
@ -173,9 +172,9 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
}
/**
* Updates a calendars properties
* Updates properties for a calendar.
*
* The properties array uses the propertyName in clark-notation as key,
* The mutations array uses the propertyName in clark-notation as key,
* and the array value for the property value. In the case a property
* should be deleted, the property value will be null.
*
@ -205,10 +204,10 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
* (424 Failed Dependency) because the request needs to be atomic.
*
* @param string $calendarId
* @param array $properties
* @param array $mutations
* @return bool|array
*/
public function updateCalendar($calendarId, array $properties) {
public function updateCalendar($calendarId, array $mutations) {
$newValues = array();
$result = array(
@ -219,13 +218,13 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
$hasError = false;
foreach($properties as $propertyName=>$propertyValue) {
foreach($mutations as $propertyName=>$propertyValue) {
// We don't know about this property.
if (!isset($this->propertyMap[$propertyName])) {
$hasError = true;
$result[403][$propertyName] = null;
unset($properties[$propertyName]);
unset($mutations[$propertyName]);
continue;
}
@ -237,7 +236,7 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
// If there were any errors we need to fail the request
if ($hasError) {
// Properties has the remaining properties
foreach($properties as $propertyName=>$propertyValue) {
foreach($mutations as $propertyName=>$propertyValue) {
$result[424][$propertyName] = null;
}
@ -284,7 +283,7 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
}
/**
* Returns all calendar objects within a calendar object.
* Returns all calendar objects within a calendar.
*
* Every item contains an array with the following keys:
* * id - unique identifier which will be used for subsequent updates

View File

@ -12,7 +12,7 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_CalDAV_Calendar implements Sabre_DAV_ICollection, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
class Sabre_CalDAV_Calendar implements Sabre_CalDAV_ICalendar, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
/**
* This is an array with calendar information
@ -178,6 +178,8 @@ class Sabre_CalDAV_Calendar implements Sabre_DAV_ICollection, Sabre_DAV_IPropert
public function createFile($name,$calendarData = null) {
$calendarData = stream_get_contents($calendarData);
// Converting to UTF-8, if needed
$calendarData = Sabre_DAV_StringUtil::ensureUTF8($calendarData);
$supportedComponents = $this->calendarInfo['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set'];
if ($supportedComponents) {

View File

@ -9,7 +9,7 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_DAVACL_IACL {
class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_CalDAV_ICalendarObject, Sabre_DAVACL_IACL {
/**
* Sabre_CalDAV_Backend_Abstract
@ -93,6 +93,9 @@ class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_DAVACL
if (is_resource($calendarData))
$calendarData = stream_get_contents($calendarData);
// Converting to UTF-8, if needed
$calendarData = Sabre_DAV_StringUtil::ensureUTF8($calendarData);
$supportedComponents = $this->calendarInfo['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set'];
if ($supportedComponents) {
$supportedComponents = $supportedComponents->getValue();

18
3rdparty/Sabre/CalDAV/ICalendar.php vendored Normal file
View File

@ -0,0 +1,18 @@
<?php
/**
* Calendar interface
*
* Implement this interface to allow a node to be recognized as an calendar.
*
* @package Sabre
* @subpackage CalDAV
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_CalDAV_ICalendar extends Sabre_DAV_ICollection {
}

View File

@ -0,0 +1,20 @@
<?php
/**
* CalendarObject interface
/**
* Extend the ICalendarObject interface to allow your custom nodes to be picked up as
* CalendarObjects.
*
* Calendar objects are resources such as Events, Todo's or Journals.
*
* @package Sabre
* @subpackage CalDAV
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_CalDAV_ICalendarObject extends Sabre_DAV_IFile {
}

View File

@ -114,7 +114,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
public function getSupportedReportSet($uri) {
$node = $this->server->tree->getNodeForPath($uri);
if ($node instanceof Sabre_CalDAV_Calendar || $node instanceof Sabre_CalDAV_CalendarObject) {
if ($node instanceof Sabre_CalDAV_ICalendar || $node instanceof Sabre_CalDAV_ICalendarObject) {
return array(
'{' . self::NS_CALDAV . '}calendar-multiget',
'{' . self::NS_CALDAV . '}calendar-query',
@ -143,7 +143,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
$server->propertyMap['{' . self::NS_CALDAV . '}supported-calendar-component-set'] = 'Sabre_CalDAV_Property_SupportedCalendarComponentSet';
$server->resourceTypeMapping['Sabre_CalDAV_Calendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
$server->resourceTypeMapping['Sabre_CalDAV_ICalendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
$server->resourceTypeMapping['Sabre_CalDAV_Principal_ProxyRead'] = '{http://calendarserver.org/ns/}calendar-proxy-read';
$server->resourceTypeMapping['Sabre_CalDAV_Principal_ProxyWrite'] = '{http://calendarserver.org/ns/}calendar-proxy-write';
@ -326,7 +326,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
} // instanceof IPrincipal
if ($node instanceof Sabre_CalDAV_CalendarObject) {
if ($node instanceof Sabre_CalDAV_ICalendarObject) {
// The calendar-data property is not supposed to be a 'real'
// property, but in large chunks of the spec it does act as such.
// Therefore we simply expose it as a property.

View File

@ -14,7 +14,7 @@ class Sabre_CalDAV_Version {
/**
* Full version number
*/
const VERSION = '1.5.0';
const VERSION = '1.5.3';
/**
* Stability : alpha, beta, stable

View File

@ -112,6 +112,8 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca
public function createFile($name,$vcardData = null) {
$vcardData = stream_get_contents($vcardData);
// Converting to UTF-8, if needed
$vcardData = Sabre_DAV_StringUtil::ensureUTF8($vcardData);
$this->carddavBackend->createCard($this->addressBookInfo['id'],$name,$vcardData);

View File

@ -67,6 +67,8 @@ class Sabre_CardDAV_Backend_PDO extends Sabre_CardDAV_Backend_Abstract {
'{DAV:}displayname' => $row['displayname'],
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
'{http://calendarserver.org/ns/}getctag' => $row['ctag'],
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
new Sabre_CardDAV_Property_SupportedAddressData(),
);
}

View File

@ -88,6 +88,9 @@ class Sabre_CardDAV_Card extends Sabre_DAV_File implements Sabre_CardDAV_ICard,
if (is_resource($cardData))
$cardData = stream_get_contents($cardData);
// Converting to UTF-8, if needed
$cardData = Sabre_DAV_StringUtil::ensureUTF8($cardData);
$this->carddavBackend->updateCard($this->addressBookInfo['id'],$this->cardData['uri'],$cardData);
$this->cardData['carddata'] = $cardData;

View File

@ -95,9 +95,10 @@ class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
public function getSupportedReportSet($uri) {
$node = $this->server->tree->getNodeForPath($uri);
if ($node instanceof Sabre_CardDAV_AddressBook || $node instanceof Sabre_CardDAV_ICard) {
if ($node instanceof Sabre_CardDAV_IAddressBook || $node instanceof Sabre_CardDAV_ICard) {
return array(
'{' . self::NS_CARDDAV . '}addressbook-multiget',
'{' . self::NS_CARDDAV . '}addressbook-query',
);
}
return array();

View File

@ -0,0 +1,69 @@
<?php
/**
* Supported-address-data property
*
* This property is a representation of the supported-address-data property
* in the CardDAV namespace.
*
* @package Sabre
* @subpackage CardDAV
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_CardDAV_Property_SupportedAddressData extends Sabre_DAV_Property {
/**
* supported versions
*
* @var array
*/
protected $supportedData = array();
/**
* Creates the property
*
* @param array $components
*/
public function __construct(array $supportedData = null) {
if (is_null($supportedData)) {
$supportedData = array(
array('contentType' => 'text/vcard', 'version' => '3.0'),
array('contentType' => 'text/vcard', 'version' => '4.0'),
);
}
$this->supportedData = $supportedData;
}
/**
* Serializes the property in a DOMDocument
*
* @param Sabre_DAV_Server $server
* @param DOMElement $node
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
$doc = $node->ownerDocument;
$prefix =
isset($server->xmlNamespaces[Sabre_CardDAV_Plugin::NS_CARDDAV]) ?
$server->xmlNamespaces[Sabre_CardDAV_Plugin::NS_CARDDAV] :
'card';
foreach($this->supportedData as $supported) {
$caldata = $doc->createElementNS(Sabre_CardDAV_Plugin::NS_CARDDAV, $prefix . ':address-data-type');
$caldata->setAttribute('content-type',$supported['contentType']);
$caldata->setAttribute('version',$supported['version']);
$node->appendChild($caldata);
}
}
}

View File

@ -18,11 +18,11 @@ class Sabre_CardDAV_Version {
/**
* Full version number
*/
const VERSION = '0.2';
const VERSION = '1.5.3';
/**
* Stability : alpha, beta, stable
*/
const STABILITY = 'alpha';
const STABILITY = 'stable';
}

View File

@ -69,8 +69,15 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
if ($method!='GET') return true;
try {
$node = $this->server->tree->getNodeForPath($uri);
if ($node instanceof Sabre_DAV_IFile) return true;
} catch (Sabre_DAV_Exception_FileNotFound $e) {
// We're simply stopping when the file isn't found to not interfere
// with other plugins.
return;
}
if ($node instanceof Sabre_DAV_IFile)
return;
$this->server->httpResponse->sendStatus(200);
$this->server->httpResponse->setHeader('Content-Type','text/html; charset=utf-8');
@ -165,6 +172,8 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
'{DAV:}getlastmodified',
),1);
$parent = $this->server->tree->getNodeForPath($path);
if ($path) {
@ -189,6 +198,7 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
$type = null;
if (isset($file[200]['{DAV:}resourcetype'])) {
$type = $file[200]['{DAV:}resourcetype']->getValue();
@ -246,7 +256,7 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
$html.= "<tr><td colspan=\"4\"><hr /></td></tr>";
if ($this->enablePost) {
if ($this->enablePost && $parent instanceof Sabre_DAV_ICollection) {
$html.= '<tr><td><form method="post" action="">
<h3>Create new folder</h3>
<input type="hidden" name="sabreAction" value="mkcol" />

View File

@ -738,6 +738,34 @@ class Sabre_DAV_Server {
$body = $this->httpRequest->getBody();
// Intercepting Content-Range
if ($this->httpRequest->getHeader('Content-Range')) {
/**
Content-Range is dangerous for PUT requests: PUT per definition
stores a full resource. draft-ietf-httpbis-p2-semantics-15 says
in section 7.6:
An origin server SHOULD reject any PUT request that contains a
Content-Range header field, since it might be misinterpreted as
partial content (or might be partial content that is being mistakenly
PUT as a full representation). Partial content updates are possible
by targeting a separately identified resource with state that
overlaps a portion of the larger resource, or by using a different
method that has been specifically defined for partial updates (for
example, the PATCH method defined in [RFC5789]).
This clarifies RFC2616 section 9.6:
The recipient of the entity MUST NOT ignore any Content-*
(e.g. Content-Range) headers that it does not understand or implement
and MUST return a 501 (Not Implemented) response in such cases.
OTOH is a PUT request with a Content-Range currently the only way to
continue an aborted upload request and is supported by curl, mod_dav,
Tomcat and others. Since some clients do use this feature which results
in unexpected behaviour (cf PEAR::HTTP_WebDAV_Client 1.0.1), we reject
all PUT requests with a Content-Range for now.
*/
throw new Sabre_DAV_Exception_NotImplemented('PUT with Content-Range is not allowed.');
}
// Intercepting the Finder problem
if (($expected = $this->httpRequest->getHeader('X-Expected-Entity-Length')) && $expected > 0) {
@ -798,7 +826,10 @@ class Sabre_DAV_Server {
} else {
// If we got here, the resource didn't exist yet.
$this->createFile($this->getRequestUri(),$body);
if (!$this->createFile($this->getRequestUri(),$body)) {
// For one reason or another the file was not created.
return;
}
$this->httpResponse->setHeader('Content-Length','0');
$this->httpResponse->sendStatus(201);
@ -1378,22 +1409,26 @@ class Sabre_DAV_Server {
* It was important to get this done through a centralized function,
* allowing plugins to intercept this using the beforeCreateFile event.
*
* This method will return true if the file was actually created
*
* @param string $uri
* @param resource $data
* @return void
* @return bool
*/
public function createFile($uri,$data) {
list($dir,$name) = Sabre_DAV_URLUtil::splitPath($uri);
if (!$this->broadcastEvent('beforeBind',array($uri))) return;
if (!$this->broadcastEvent('beforeCreateFile',array($uri,$data))) return;
if (!$this->broadcastEvent('beforeBind',array($uri))) return false;
if (!$this->broadcastEvent('beforeCreateFile',array($uri,$data))) return false;
$parent = $this->tree->getNodeForPath($dir);
$parent->createFile($name,$data);
$this->tree->markDirty($dir);
$this->broadcastEvent('afterBind',array($uri));
return true;
}
/**

120
3rdparty/Sabre/DAV/SimpleFile.php vendored Normal file
View File

@ -0,0 +1,120 @@
<?php
/**
* SimpleFile
*
* The 'SimpleFile' class is used to easily add read-only immutable files to
* the directory structure. One usecase would be to add a 'readme.txt' to a
* root of a webserver with some standard content.
*
* @package Sabre
* @subpackage DAV
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
/**
* File contents
*
* @var string
*/
protected $contents = array();
/**
* Name of this resource
*
* @var string
*/
protected $name;
/**
* A mimetype, such as 'text/plain' or 'text/html'
*
* @var string
*/
protected $mimeType;
/**
* Creates this node
*
* The name of the node must be passed, as well as the contents of the
* file.
*
* @param string $name
* @param string $contents
*/
public function __construct($name, $contents, $mimeType = null) {
$this->name = $name;
$this->contents = $contents;
$this->mimeType = $mimeType;
}
/**
* Returns the node name for this file.
*
* This name is used to construct the url.
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Returns the data
*
* This method may either return a string or a readable stream resource
*
* @return mixed
*/
public function get() {
return $this->contents;
}
/**
* Returns the size of the file, in bytes.
*
* @return int
*/
public function getSize() {
return strlen($this->contents);
}
/**
* Returns the ETag for a file
*
* An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
* The ETag is an arbritrary string, but MUST be surrounded by double-quotes.
*
* Return null if the ETag can not effectively be determined
*/
public function getETag() {
return '"' . md5($this->contents) . '"';
}
/**
* Returns the mime-type for a file
*
* If null is returned, we'll assume application/octet-stream
*/
public function getContentType() {
return $this->mimeType;
}
}
?>

View File

@ -64,6 +64,27 @@ class Sabre_DAV_StringUtil {
}
}
/**
* This method takes an input string, checks if it's not valid UTF-8 and
* attempts to convert it to UTF-8 if it's not.
*
* Note that currently this can only convert ISO-8559-1 to UTF-8 (latin-1),
* anything else will likely fail.
*
* @param string $input
* @return string
*/
static public function ensureUTF8($input) {
$encoding = mb_detect_encoding($input , array('UTF-8','ISO-8859-1'), true);
if ($encoding === 'ISO-8859-1') {
return utf8_encode($input);
} else {
return $input;
}
}

View File

@ -30,8 +30,13 @@ class Sabre_DAV_URLUtil {
*/
static function encodePath($path) {
$path = explode('/',$path);
return implode('/',array_map(array('Sabre_DAV_URLUtil','encodePathSegment'), $path));
$valid_chars = '/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.~()';
$newStr = '';
for( $i=0; isset($path[$i]); ++$i ) {
if( strpos($valid_chars,($c=$path[$i]))===false ) $newStr .= '%'.sprintf('%02x',ord($c));
else $newStr .= $c;
}
return $newStr;
}
@ -45,35 +50,13 @@ class Sabre_DAV_URLUtil {
*/
static function encodePathSegment($pathSegment) {
$valid_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.~()';
$newStr = '';
for($i=0;$i<strlen($pathSegment);$i++) {
$c = ord($pathSegment[$i]);
if(
/* Unreserved chacaters */
($c>=0x41 /* A */ && $c<=0x5a /* Z */) ||
($c>=0x61 /* a */ && $c<=0x7a /* z */) ||
($c>=0x30 /* 0 */ && $c<=0x39 /* 9 */) ||
$c===0x5f /* _ */ ||
$c===0x2d /* - */ ||
$c===0x2e /* . */ ||
$c===0x7E /* ~ */ ||
/* Reserved, but no reserved purpose */
$c===0x28 /* ( */ ||
$c===0x29 /* ) */
) {
$newStr.=$pathSegment[$i];
} else {
$newStr.='%' . str_pad(dechex($c), 2, '0', STR_PAD_LEFT);
}
for( $i=0; isset($pathSegment[$i]); ++$i ) {
if( strpos($valid_chars,($c=$pathSegment[$i]))===false ) $newStr .= '%'.sprintf('%02x',ord($c));
else $newStr .= $c;
}
return $newStr;
}
/**
@ -103,6 +86,7 @@ class Sabre_DAV_URLUtil {
case 'ISO-8859-1' :
$path = utf8_encode($path);
}
return $path;

View File

@ -14,11 +14,11 @@ class Sabre_DAV_Version {
/**
* Full version number
*/
const VERSION = '1.5.0';
const VERSION = '1.5.3';
/**
* Stability : alpha, beta, stable
*/
const STABILITY = 'alpha';
const STABILITY = 'stable';
}

View File

@ -68,12 +68,19 @@ class Sabre_DAVACL_Principal extends Sabre_DAV_Node implements Sabre_DAVACL_IPri
*/
public function getAlternateUriSet() {
if (isset($this->principalProperties['{http://sabredav.org/ns}email-address'])) {
return array('mailto:' . $this->principalProperties['{http://sabredav.org/ns}email-address']);
} else {
return array();
$uris = array();
if (isset($this->principalProperties['{DAV:}alternate-URI-set'])) {
$uris = $this->principalProperties['{DAV:}alternate-URI-set'];
}
if (isset($this->principalProperties['{http://sabredav.org/ns}email-address'])) {
$uris[] = 'mailto:' . $this->principalProperties['{http://sabredav.org/ns}email-address'];
}
return array_unique($uris);
}
/**

View File

@ -14,7 +14,7 @@ class Sabre_DAVACL_Version {
/**
* Full version number
*/
const VERSION = '1.4.4';
const VERSION = '1.5.2';
/**
* Stability : alpha, beta, stable

View File

@ -23,7 +23,7 @@ class Sabre_HTTP_Response {
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
200 => 'Ok',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authorative Information',

View File

@ -14,7 +14,7 @@ class Sabre_HTTP_Version {
/**
* Full version number
*/
const VERSION = '1.4.1';
const VERSION = '1.5.3';
/**
* Stability : alpha, beta, stable

View File

@ -128,6 +128,44 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
}
/**
* Adds a new componenten or element
*
* You can call this method with the following syntaxes:
*
* add(Sabre_VObject_Parameter $element)
* add(string $name, $value)
*
* The first version adds an Parameter
* The second adds a property as a string.
*
* @param mixed $item
* @param mixed $itemValue
* @return void
*/
public function add($item, $itemValue = null) {
if ($item instanceof Sabre_VObject_Parameter) {
if (!is_null($itemValue)) {
throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
}
$this->parameters[] = $item;
} elseif(is_string($item)) {
if (!is_scalar($itemValue)) {
throw new InvalidArgumentException('The second argument must be scalar');
}
$this->parameters[] = new Sabre_VObject_Parameter($item,$itemValue);
} else {
throw new InvalidArgumentException('The first argument must either be a Sabre_VObject_Element or a string');
}
}
/* ArrayAccess interface {{{ */
/**

View File

@ -42,16 +42,10 @@ class Sabre_VObject_Reader {
*/
static function read($data) {
// Detecting line endings
if (strpos($data,"\r\n")!==false) {
$newLine = "\r\n";
} elseif (strpos($data,"\r")) {
$newLine = "\r";
} else {
$newLine = "\n";
}
// Normalizing newlines
$data = str_replace(array("\r","\n\n"), array("\n","\n"), $data);
$lines = explode($newLine, $data);
$lines = explode("\n", $data);
// Unfolding lines
$lines2 = array();

View File

@ -14,7 +14,7 @@ class Sabre_VObject_Version {
/**
* Full version number
*/
const VERSION = '1.2.0';
const VERSION = '1.2.2';
/**
* Stability : alpha, beta, stable

View File

@ -10,6 +10,7 @@ select.chzn-select {
display: inline-block;
zoom: 1;
*display: inline;
vertical-align: bottom;
}
.chzn-container .chzn-drop {
background: #fff;

2
README
View File

@ -4,7 +4,7 @@ It is alpha software in development and should be treated accordingly.
http://ownCloud.org
Installation instructions: http://owncloud.org/index.php/Installation
Installation instructions: http://owncloud.org/install
Source code: http://gitorious.org/owncloud
Mailing list: http://mail.kde.org/mailman/listinfo/owncloud

View File

@ -0,0 +1,33 @@
<?php
/**
* ownCloud - user_ldap
*
* @author Dominik Schmidt
* @copyright 2011 Dominik Schmidt dev@dominik-schmidt.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC_APP::registerAdmin('admin_export','settings');
// add settings page to navigation
$entry = array(
'id' => "admin_export_settings",
'order'=>1,
'href' => OC_Helper::linkTo( "admin_export", "settings.php" ),
'name' => 'Export'
);

View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<info>
<id>admin_export</id>
<name>Import/Export</name>
<description>Import/Export your owncloud data</description>
<version>0.1</version>
<licence>AGPL</licence>
<author>Thomas Schmidt</author>
<require>2</require>
</info>

View File

@ -0,0 +1,96 @@
<?php
/**
* ownCloud - admin export
*
* @author Thomas Schmidt
* @copyright 2011 Thomas Schmidt tom@opensuse.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC_Util::checkAdminUser();
OC_Util::checkAppEnabled('admin_export');
if (isset($_POST['admin_export'])) {
$root = OC::$SERVERROOT . "/";
$zip = new ZipArchive();
$filename = sys_get_temp_dir() . "/owncloud_export_" . date("y-m-d_H-i-s") . ".zip";
error_log("Creating export file at: " . $filename);
if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) {
exit("Cannot open <$filename>\n");
}
if (isset($_POST['owncloud_system'])) {
// adding owncloud system files
error_log("Adding owncloud system files to export");
zipAddDir($root, $zip, false);
foreach (array(".git", "3rdparty", "apps", "core", "files", "l10n", "lib", "ocs", "search", "settings", "tests") as $dirname) {
zipAddDir($root . $dirname, $zip, true, basename($root) . "/");
}
}
if (isset($_POST['owncloud_config'])) {
// adding owncloud config
// todo: add database export
error_log("Adding owncloud config to export");
zipAddDir($root . "config/", $zip, true, basename($root) . "/");
$zip->addFile($root . '/data/.htaccess', basename($root) . "/data/owncloud.db");
}
if (isset($_POST['user_files'])) {
// adding user files
$zip->addFile($root . '/data/.htaccess', basename($root) . "/data/.htaccess");
$zip->addFile($root . '/data/index.html', basename($root) . "/data/index.html");
foreach (OC_User::getUsers() as $i) {
error_log("Adding owncloud user files of $i to export");
zipAddDir($root . "data/" . $i, $zip, true, basename($root) . "/data/");
}
}
$zip->close();
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . basename($filename));
header("Content-Length: " . filesize($filename));
ob_end_clean();
readfile($filename);
unlink($filename);
} else {
// fill template
$tmpl = new OC_Template('admin_export', 'settings');
return $tmpl->fetchPage();
}
function zipAddDir($dir, $zip, $recursive=true, $internalDir='') {
$dirname = basename($dir);
$zip->addEmptyDir($internalDir . $dirname);
$internalDir.=$dirname.='/';
if ($dirhandle = opendir($dir)) {
while (false !== ( $file = readdir($dirhandle))) {
if (( $file != '.' ) && ( $file != '..' )) {
if (is_dir($dir . '/' . $file) && $recursive) {
zipAddDir($dir . '/' . $file, $zip, $recursive, $internalDir);
} elseif (is_file($dir . '/' . $file)) {
$zip->addFile($dir . '/' . $file, $internalDir . $file);
}
}
}
closedir($dirhandle);
} else {
error_log("Was not able to open directory: " . $dir);
}
}

View File

@ -0,0 +1,13 @@
<form id="export" action="#" method="post">
<fieldset class="personalblock">
<legend><strong><?php echo $l->t('Export this ownCloud instance');?></strong></legend>
<p><?php echo $l->t('This will create a compressed file that contains the data of this owncloud instance.
Please choose which components should be included:');?>
</p>
<p><input type="checkbox" id="user_files" name="user_files" value="true"><label for="user_files"><?php echo $l->t('User files');?></label><br/>
<input type="checkbox" id="owncloud_system" name="owncloud_system" value="true"><label for="owncloud_system"><?php echo $l->t('ownCloud system files');?></label><br/>
<input type="checkbox" id="owncloud_config" name="owncloud_config" value="true"><label for="owncloud_config"><?php echo $l->t('ownCloud configuration');?></label>
</p>
<input type="submit" name="admin_export" value="Export" />
</fieldset>
</form>

View File

@ -25,6 +25,7 @@ require_once('../../lib/base.php');
// Check if we are a user
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('bookmarks');
require_once('bookmarksHelper.php');

View File

@ -28,6 +28,7 @@ require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){

View File

@ -28,6 +28,7 @@ require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
$params=array(
htmlspecialchars_decode($_GET["url"]),

View File

@ -28,6 +28,7 @@ require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){

View File

@ -28,6 +28,7 @@ require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
// $metadata = array();

View File

@ -28,6 +28,7 @@ require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
$query = OC_DB::prepare("
UPDATE *PREFIX*bookmarks

View File

@ -28,6 +28,7 @@ require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
$params=array(OC_User::getUser());
$CONFIG_DBTYPE = OC_Config::getValue( 'dbtype', 'sqlite' );

View File

@ -25,6 +25,7 @@ require_once('../../lib/base.php');
// Check if we are a user
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('bookmarks');
OC_App::setActiveNavigationEntry( 'bookmarks_index' );

View File

@ -1,8 +1,8 @@
<div class="bookmarks_addBm">
<p><label class="bookmarks_label">Address</label><input type="text" id="bookmark_add_url" class="bookmarks_input" value="<? echo $_['URL']; ?>"/></p>
<p><label class="bookmarks_label">Title</label><input type="text" id="bookmark_add_title" class="bookmarks_input" value="<? echo $_['TITLE']; ?>" /></p>
<p><label class="bookmarks_label">Description</label><input type="text" id="bookmark_add_description" class="bookmarks_input" value="<? echo $_['DESCRIPTION']; ?>" /></p>
<p><label class="bookmarks_label">Tags</label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
<p><label class="bookmarks_label"> </label><label class="bookmarks_hint">Hint: Use space to separate tags.</label></p>
<p><label class="bookmarks_label"></label><input type="submit" id="bookmark_add_submit" /></p>
<p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" value="<?php echo $_['URL']; ?>"/></p>
<p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" value="<?php echo $_['TITLE']; ?>" /></p>
<p><label class="bookmarks_label"><?php echo $l->t('Description'); ?></label><input type="text" id="bookmark_add_description" class="bookmarks_input" value="<?php echo $_['DESCRIPTION']; ?>" /></p>
<p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
<p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
<p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
</div>

View File

@ -1,30 +1,27 @@
<input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_GET['tag'])) echo htmlentities($_GET['tag']); ?>" />
<h2 class="bookmarks_headline"><?php echo isset($_GET["tag"]) ? 'Bookmarks with tag: ' . urldecode($_GET["tag"]) : 'All bookmarks'; ?></h2>
<h2 class="bookmarks_headline"><?php echo isset($_GET["tag"]) ? $l->t('Bookmarks with tag: ') . urldecode($_GET["tag"]) : $l->t('All bookmarks'); ?></h2>
<div class="bookmarks_menu">
<input type="button" class="bookmarks_addBtn" value="Add Bookmark"/>&nbsp;
<a class="bookmarks_addBml" href="javascript:var url = encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkTo('bookmarks', 'addBm.php', null, true); ?>?url='+url, 'owncloud-bookmarks');" title="Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.">Add page to ownCloud</a>
<input type="button" class="bookmarks_addBtn" value="<?php echo $l->t('Add bookmark'); ?>"/>&nbsp;
<a class="bookmarks_addBml" href="javascript:var url = encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkTo('bookmarks', 'addBm.php', null, true); ?>?url='+url, 'owncloud-bookmarks');" title="<?php echo $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?>"><?php echo $l->t('Add page to ownCloud'); ?></a>
</div>
<div class="bookmarks_add">
<input type="hidden" id="bookmark_add_id" value="0" />
<p><label class="bookmarks_label">Address</label><input type="text" id="bookmark_add_url" class="bookmarks_input" /></p>
<p><label class="bookmarks_label">Title</label><input type="text" id="bookmark_add_title" class="bookmarks_input" />
<p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" /></p>
<p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" />
<img class="loading_meta" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" /></p>
<p><label class="bookmarks_label">Description</label><input type="text" id="bookmark_add_description" class="bookmarks_input" />
<p><label class="bookmarks_label"><?php echo $l->t('Description'); ?></label><input type="text" id="bookmark_add_description" class="bookmarks_input" />
<img class="loading_meta" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" /></p>
<p><label class="bookmarks_label">Tags</label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
<p><label class="bookmarks_label"> </label><label class="bookmarks_hint">Hint: Use space to separate tags.</label></p>
<p><label class="bookmarks_label"></label><input type="submit" id="bookmark_add_submit" /></p>
<p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
<p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
<p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
</div>
<div class="bookmarks_sorting pager">
<ul>
<li class="bookmarks_sorting_recent">Recent Bookmarks</li>
<li class="bookmarks_sorting_clicks">Most clicks</li>
<li class="bookmarks_sorting_recent"><?php echo $l->t('Recent Bookmarks'); ?></li>
<li class="bookmarks_sorting_clicks"><?php echo $l->t('Most clicks'); ?></li>
</ul>
</div>
<div class="clear"></div>
<div class="bookmarks_list">
<noscript>
JavaScript is needed to display your Bookmarks
</noscript>
You have no bookmarks
<?php echo $l->t('You have no bookmarks'); ?>
</div>

View File

@ -10,6 +10,7 @@ require_once ("../../../lib/base.php");
if(!OC_USER::isLoggedIn()) {
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
OC_JSON::checkAppEnabled('calendar');
$calendarid = $_POST['calendarid'];
OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
$cal = OC_Calendar_Calendar::findCalendar($calendarid);

View File

@ -10,6 +10,7 @@ require_once ("../../../lib/base.php");
if(!OC_USER::isLoggedIn()) {
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
OC_JSON::checkAppEnabled('calendar');
$currentview = $_GET["v"];
OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", $currentview);
?>

View File

@ -11,6 +11,7 @@ $l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
OC_JSON::checkAppEnabled('calendar');
$output = new OC_TEMPLATE("calendar", "part.choosecalendar");
$output -> printpage();
?>

View File

@ -12,6 +12,7 @@ $l10n = new OC_L10N('calendar');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$userid = OC_User::getUser();
$calendarid = OC_Calendar_Calendar::addCalendar($userid, $_POST['name'], $_POST['description'], 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']);

View File

@ -0,0 +1,11 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
echo OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'weekend', '{"Monday":"false","Tuesday":"false","Wednesday":"false","Thursday":"false","Friday":"false","Saturday":"true","Sunday":"true"}');
?>

View File

@ -12,6 +12,7 @@ $l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
OC_JSON::checkAppEnabled('calendar');
$cal = $_POST["calendarid"];
$calendar = OC_Calendar_Calendar::findCalendar($cal);

View File

@ -12,6 +12,7 @@ $l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
OC_JSON::checkAppEnabled('calendar');
$id = $_POST['id'];
$data = OC_Calendar_Object::find($id);

View File

@ -0,0 +1,12 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
$duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', "60");
OC_JSON::encodedPrint(array("duration" => $duration));
?>

View File

@ -11,9 +11,21 @@ $l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
$calendarcolor_options = array(
'ff0000', // "Red"
'00ff00', // "Green"
'ffff00', // "Yellow"
'808000', // "Olive"
'ffa500', // "Orange"
'ff7f50', // "Coral"
'ee82ee', // "Violet"
'ecc255', // dark yellow
);
OC_JSON::checkAppEnabled('calendar');
$calendar = OC_Calendar_Calendar::findCalendar($_GET['calendarid']);
$tmpl = new OC_Template("calendar", "part.editcalendar");
$tmpl->assign('new', false);
$tmpl->assign('calendarcolor_options', $calendarcolor_options);
$tmpl->assign('calendar', $calendar);
$tmpl->printPage();
?>

View File

@ -13,6 +13,7 @@ $l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
OC_JSON::checkAppEnabled('calendar');
$errarr = OC_Calendar_Object::validateRequest($_POST);
if($errarr){

View File

@ -13,6 +13,7 @@ $l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
OC_JSON::checkAppEnabled('calendar');
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
@ -28,9 +29,10 @@ if($calendar['userid'] != OC_User::getUser()){
$object = Sabre_VObject_Reader::read($data['calendardata']);
$vevent = $object->VEVENT;
$dtstart = $vevent->DTSTART;
$dtend = $vevent->DTEND;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch($dtstart->getDateType()) {
case Sabre_VObject_Element_DateTime::LOCALTZ:
case Sabre_VObject_Element_DateTime::LOCAL:
$startdate = $dtstart->getDateTime()->format('d-m-Y');
$starttime = $dtstart->getDateTime()->format('H:i');
$enddate = $dtend->getDateTime()->format('d-m-Y');
@ -54,6 +56,11 @@ if (isset($vevent->CATEGORIES)){
$categories = explode(',', $vevent->CATEGORIES->value);
$categories = array_map('trim', $categories);
}
foreach($categories as $category){
if (!in_array($category, $category_options)){
array_unshift($category_options, $category);
}
}
$repeat = isset($vevent->CATEGORY) ? $vevent->CATEGORY->value : '';
$description = isset($vevent->DESCRIPTION) ? $vevent->DESCRIPTION->value : '';

View File

@ -0,0 +1,12 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
$firstdayofweek = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'firstdayofweek', "1");
OC_JSON::encodedPrint(array("firstdayofweek" => $firstdayofweek));
?>

View File

@ -10,6 +10,61 @@ require_once ("../../../lib/base.php");
if(!OC_USER::isLoggedIn()) {
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
$output = new OC_TEMPLATE("calendar", "part.getcal");
$output -> printpage();
?>
OC_JSON::checkAppEnabled('calendar');
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
$events = array();
$return = array('calendars'=>array());
foreach($calendars as $calendar) {
$tmp = OC_Calendar_Object::all($calendar['id']);
$events = array_merge($events, $tmp);
$return['calendars'][$calendar['id']] = array(
'displayname' => $calendar['displayname'],
'color' => '#'.$calendar['calendarcolor']
);
}
$select_year = $_GET["year"];
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
foreach($events as $event)
{
if ($select_year != substr($event['startdate'], 0, 4))
continue;
$object = Sabre_VObject_Reader::read($event['calendardata']);
$vevent = $object->VEVENT;
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
$start_dt = $dtstart->getDateTime();
$start_dt->setTimezone(new DateTimeZone($user_timezone));
$end_dt = $dtend->getDateTime();
$end_dt->setTimezone(new DateTimeZone($user_timezone));
$year = $start_dt->format('Y');
$month = $start_dt->format('n') - 1; // return is 0 based
$day = $start_dt->format('j');
$hour = $start_dt->format('G');
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
$hour = 'allday';
}
$return_event = array();
foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop)
{
$return_event[$prop] = $event[$prop];
}
$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
$return_event['description'] = $event['summary'];
if ($hour == 'allday')
{
$return_event['allday'] = true;
}
if (isset($return[$year][$month][$day][$hour]))
{
$return[$year][$month][$day][$hour][] = $return_event;
}
else
{
$return[$year][$month][$day][$hour] = array(1 => $return_event);
}
}
OC_JSON::encodedPrint($return);

View File

@ -1,9 +0,0 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
?>

View File

@ -0,0 +1,103 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
error_reporting(E_ALL);
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
$data = OC_Calendar_Object::find($_POST["id"]);
$calendarid = $data["calendarid"];
$cal = $calendarid;
$id = $_POST["id"];
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
if(OC_User::getUser() != $calendar["userid"]){
OC_JSON::error();
exit;
}
$newdate = $_POST["newdate"];
$caldata = array();
//modified part of editeventform.php
$object = Sabre_VObject_Reader::read($data['calendardata']);
$vevent = $object->VEVENT;
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch($dtstart->getDateType()) {
case Sabre_VObject_Element_DateTime::LOCALTZ:
case Sabre_VObject_Element_DateTime::LOCAL:
$startdate = $dtstart->getDateTime()->format('d-m-Y');
$starttime = $dtstart->getDateTime()->format('H:i');
$enddate = $dtend->getDateTime()->format('d-m-Y');
$endtime = $dtend->getDateTime()->format('H:i');
$allday = false;
break;
case Sabre_VObject_Element_DateTime::DATE:
$startdate = $dtstart->getDateTime()->format('d-m-Y');
$starttime = '00:00';
$dtend->getDateTime()->modify('-1 day');
$enddate = $dtend->getDateTime()->format('d-m-Y');
$endtime = '23:59';
$allday = true;
break;
}
$caldata["title"] = isset($vevent->SUMMARY) ? $vevent->SUMMARY->value : '';
$caldata["location"] = isset($vevent->LOCATION) ? $vevent->LOCATION->value : '';
$caldata["categories"] = array();
if (isset($vevent->CATEGORIES)){
$caldata["categories"] = explode(',', $vevent->CATEGORIES->value);
$caldata["categories"] = array_map('trim', $categories);
}
foreach($caldata["categories"] as $category){
if (!in_array($category, $category_options)){
array_unshift($category_options, $category);
}
}
$caldata["repeat"] = isset($vevent->CATEGORY) ? $vevent->CATEGORY->value : '';
$caldata["description"] = isset($vevent->DESCRIPTION) ? $vevent->DESCRIPTION->value : '';
//end part of editeventform.php
$startdatearray = explode("-", $startdate);
$starttimearray = explode(":", $starttime);
$startunix = mktime($starttimearray[0], $starttimearray[1], 0, $startdatearray[1], $startdatearray[0], $startdatearray[2]);
$enddatearray = explode("-", $enddate);
$endtimearray = explode(":", $endtime);
$endunix = mktime($endtimearray[0], $endtimearray[1], 0, $enddatearray[1], $enddatearray[0], $enddatearray[2]);
$difference = $endunix - $startunix;
if(strlen($newdate) > 10){
$newdatestringarray = explode("-", $newdate);
if($newdatestringarray[1] == "allday"){
$allday = true;
$newdatestringarray[1] = "00:00";
}else{
if($allday == true){
$difference = 3600;
}
$allday = false;
}
}else{
$newdatestringarray = array();
$newdatestringarray[0] = $newdate;
$newdatestringarray[1] = $starttime;
}
$newdatearray = explode(".", $newdatestringarray[0]);
$newtimearray = explode(":", $newdatestringarray[1]);
$newstartunix = mktime($newtimearray[0], $newtimearray[1], 0, $newdatearray[1], $newdatearray[0], $newdatearray[2]);
$newendunix = $newstartunix + $difference;
if($allday == true){
$caldata["allday"] = true;
}else{
unset($caldata["allday"]);
}
$caldata["from"] = date("d-m-Y", $newstartunix);
$caldata["fromtime"] = date("H:i", $newstartunix);
$caldata["to"] = date("d-m-Y", $newendunix);
$caldata["totime"] = date("H:i", $newendunix);
//modified part of editevent.php
$vcalendar = Sabre_VObject_Reader::read($data["calendardata"]);
OC_Calendar_Object::updateVCalendarFromRequest($caldata, $vcalendar);
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
OC_JSON::success();
//end part of editevent.php
?>

View File

@ -11,11 +11,12 @@ $l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
OC_JSON::checkAppEnabled('calendar');
$calendar = array(
'id' => 'new',
'displayname' => 'Test',
'description' => 'Test calendar',
'calendarcolor' => 'black',
'displayname' => '',
'description' => '',
'calendarcolor' => '',
);
$tmpl = new OC_Template('calendar', 'part.editcalendar');
$tmpl->assign('new', true);

View File

@ -13,6 +13,7 @@ $l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
OC_JSON::checkAppEnabled('calendar');
$errarr = OC_Calendar_Object::validateRequest($_POST);
if($errarr){

View File

@ -13,6 +13,7 @@ $l10n = new OC_L10N('calendar');
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
OC_JSON::checkAppEnabled('calendar');
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
@ -28,21 +29,21 @@ if($starttime != 'undefined' && !is_nan($starttime) && !$allday){
$starttime = '0';
$startminutes = '00';
}else{
$starttime = date('H');
$starttime = date('G');
$startminutes = date('i');
}
$endday = $startday;
$endmonth = $startmonth;
$endyear = $startyear;
$endtime = $starttime;
$endminutes = $startminutes;
if($endtime == 23) {
$endday++;
$endtime = 0;
} else {
$endtime++;
}
$datetimestamp = mktime($starttime, $startminutes, 0, $startmonth, $startday, $startyear);
$duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', "60");
$datetimestamp = $datetimestamp + ($duration * 60);
$endmonth = date("m", $datetimestamp);
$endday = date("d", $datetimestamp);
$endyear = date("Y", $datetimestamp);
$endtime = date("G", $datetimestamp);
$endminutes = date("i", $datetimestamp);
$tmpl = new OC_Template('calendar', 'part.newevent');
$tmpl->assign('calendar_options', $calendar_options);

View File

@ -0,0 +1,30 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
$weekenddays = array("Monday"=>"false", "Tuesday"=>"false", "Wednesday"=>"false", "Thursday"=>"false", "Friday"=>"false", "Saturday"=>"false", "Sunday"=>"false");
for($i = 0;$i < count($_POST["weekend"]); $i++){
switch ($_POST["weekend"][$i]){
case "Monday":
case "Tuesday":
case "Wednesday":
case "Thursday":
case "Friday":
case "Saturday":
case "Sunday":
break;
default:
OC_JSON::error();
exit;
}
$weekenddays[$_POST["weekend"][$i]] = "true";
}
$setValue = json_encode($weekenddays);
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'weekend', $setValue);
OC_JSON::success();
?>

View File

@ -0,0 +1,17 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
if(isset($_POST["duration"])){
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'duration', $_POST["duration"]);
OC_JSON::success();
}else{
OC_JSON::error();
}
?>

View File

@ -0,0 +1,16 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
if(isset($_POST["firstdayofweek"])){
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'firstdayofweek', $_POST["firstdayofweek"]);
OC_JSON::success();
}else{
OC_JSON::error();
}
?>

View File

@ -0,0 +1,17 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
if(isset($_POST["timeformat"])){
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
OC_JSON::success();
}else{
OC_JSON::error();
}
?>

View File

@ -13,6 +13,7 @@ $l=new OC_L10N('calendar');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
// Get data
if( isset( $_POST['timezone'] ) ){

View File

@ -0,0 +1,12 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
$timeformat = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'timeformat', "24");
OC_JSON::encodedPrint(array("timeformat" => $timeformat));
?>

View File

@ -12,6 +12,7 @@ $l10n = new OC_L10N('calendar');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$calendarid = $_POST['id'];
OC_Calendar_Calendar::editCalendar($calendarid, $_POST['name'], $_POST['description'], null, null, null, $_POST['color']);

View File

@ -10,6 +10,7 @@
$RUNTIME_NOSETUPFS = true;
require_once('../../lib/base.php');
OC_Util::checkAppEnabled('calendar');
// Backends
$authBackend = new OC_Connector_Sabre_Auth();

View File

@ -45,6 +45,7 @@
.weekend_thead, .weekend_row{height: 20px;text-align: center;text-align: center;background: #F3F3F3;}
.thisday{background: #FFFABC;}
.event {position:relative;}
.event.colored {border-bottom: 1px solid white;}
.popup {display: none; position: absolute; z-index: 1000; background: #eeeeee; color: #000000; border: 1px solid #1a1a1a; font-size: 90%;}
.event_popup {width: 280px; height: 40px; padding: 10px;}
@ -57,3 +58,6 @@ color:#A9A9A9;
}
select#category{width:140px;}
button.category{margin:0 3px;}
.calendar-colorpicker-color{display:inline-block;width:20px;height:20px;margin-right:2px;cursor:pointer;}
.calendar-colorpicker-color.active{background-image:url("../../../core/img/jquery-ui/ui-icons_222222_256x240.png");background-position:-62px -143px;}

View File

@ -8,10 +8,13 @@
require_once ("../../lib/base.php");
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$cal = $_GET["calid"];
$event = $_GET["eventid"];
if(isset($cal)){
$calendar = OC_Calendar_Calendar::findCalendar($cal);
if($calendar["userid"] != OC_User::getUser()){
header( 'Location: '.OC_Helper::linkTo('', 'index.php'));
OC_JSON::error();
exit;
}
$calobjects = OC_Calendar_Object::all($cal);
@ -20,4 +23,16 @@ header("Content-Disposition: inline; filename=calendar.ics");
for($i = 0;$i <= count($calobjects); $i++){
echo $calobjects[$i]["calendardata"] . "\n";
}
}elseif(isset($event)){
$data = OC_Calendar_Object::find($_GET["eventid"]);
$calendarid = $data["calendarid"];
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
if($calendar["userid"] != OC_User::getUser()){
OC_JSON::error();
exit;
}
header("Content-Type: text/Calendar");
header("Content-Disposition: inline; filename=" . $data["summary"] . ".ics");
echo $data["calendardata"];
}
?>

View File

@ -8,6 +8,7 @@
require_once ('../../lib/base.php');
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
// Create default calendar ...
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
if( count($calendars) == 0){

View File

@ -8,6 +8,8 @@
Calendar={
space:' ',
firstdayofweek: '',
weekend: '',
Date:{
normal_year_cal: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
leap_year_cal: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
@ -79,7 +81,7 @@ Calendar={
},
UI:{
weekdays: ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
weekdays: '',
formatDayShort:function(day){
if (typeof(day) == 'undefined'){
day = Calendar.Date.current.getDay();
@ -124,7 +126,7 @@ Calendar={
$('#'+this.currentview + "_radio").removeClass('active');
this.currentview = view;
//sending ajax request on every change view
$("#sysbox").load(oc_webroot + "/apps/calendar/ajax/changeview.php?v="+view);
$("#sysbox").load(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view);
//not necessary to check whether the response is true or not
switch(view) {
case "onedayview":
@ -153,6 +155,7 @@ Calendar={
Calendar.UI.updateView()
});
},
drageventid: '',
updateDate:function(direction){
if(direction == 'forward' && this.current.forward) {
this.current.forward();
@ -178,18 +181,19 @@ Calendar={
if( typeof (this.events[year]) == "undefined") {
this.events[year] = []
}
$.getJSON(oc_webroot + "/apps/calendar/ajax/getcal.php?year=" + year, function(newevents, status) {
$.getJSON(OC.filePath('calendar', 'ajax', 'getcal.php') + "?year=" + year, function(jsondata, status) {
if(status == "nosession") {
alert("You are not logged in. That can happen if you don't use owncloud for a long time.");
document.location(oc_webroot);
}
if(status == "parsingfail" || typeof (newevents) == "undefined") {
if(status == "parsingfail" || typeof (jsondata) == "undefined") {
$.ready(function() {
$( "#parsingfail_dialog" ).dialog();
});
} else {
if (typeof(newevents[year]) != 'undefined'){
Calendar.UI.events[year] = newevents[year];
if (typeof(jsondata[year]) != 'undefined'){
Calendar.UI.calendars = jsondata['calendars'];
Calendar.UI.events[year] = jsondata[year];
}
$(document).ready(function() {
Calendar.UI.updateView();
@ -218,7 +222,7 @@ Calendar={
if (!events) {
return;
}
var weekday = (date.getDay()+6)%7;
var weekday = (date.getDay()+7-Calendar.firstdayofweek)%7;
if( typeof (events["allday"]) != "undefined") {
var eventnumber = 1;
var eventcontainer = this.current.getEventContainer(week, weekday, "allday");
@ -244,7 +248,17 @@ Calendar={
.data('event_info', event)
.hover(this.createEventPopup,
this.hideEventPopup)
.draggable({
drag: function() {
Calendar.UI.drageventid = event.id;
}
})
.click(this.editEvent);
var color = this.calendars[event['calendarid']]['color'];
if (color){
event_holder.css('background-color', color)
.addClass('colored');
}
eventcontainer.append(event_holder);
},
startEventDialog:function(){
@ -286,7 +300,7 @@ Calendar={
// TODO: save event
$('#event').dialog('destroy').remove();
}else{
$('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/neweventform.php?d=' + date + '&t=' + time, Calendar.UI.startEventDialog);
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'neweventform.php') + '?d=' + date + '&t=' + time, Calendar.UI.startEventDialog);
}
},
editEvent:function(event){
@ -297,12 +311,12 @@ Calendar={
// TODO: save event
$('#event').dialog('destroy').remove();
}else{
$('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/editeventform.php?id=' + id, Calendar.UI.startEventDialog);
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'editeventform.php') + '?id=' + id, Calendar.UI.startEventDialog);
}
},
submitDeleteEventForm:function(url){
var post = $( "#event_form" ).serialize();
$("#errorbox").html("");
$("#errorbox").empty();
$.post(url, post, function(data){
if(data.status == 'success'){
$('#event').dialog('destroy').remove();
@ -315,7 +329,7 @@ Calendar={
},
validateEventForm:function(url){
var post = $( "#event_form" ).serialize();
$("#errorbox").html("");
$("#errorbox").empty();
$.post(url, post,
function(data){
if(data.status == "error"){
@ -352,6 +366,12 @@ Calendar={
}
},"json");
},
moveevent:function(eventid, newstartdate){
$.post(OC.filePath('calendar', 'ajax', 'moveevent.php'), { id: eventid, newdate: newstartdate},
function(data) {
console.log("Event moved successfully");
});
},
showadvancedoptions:function(){
$("#advanced_options").css("display", "block");
$("#advanced_options_button").css("display", "none");
@ -425,7 +445,7 @@ Calendar={
if(check == false){
return false;
}else{
$.post(oc_webroot + "/apps/calendar/ajax/deletecalendar.php", { calendarid: calid},
$.post(OC.filePath('calendar', 'ajax', 'deletecalendar.php'), { calendarid: calid},
function(data) {
Calendar.UI.loadEvents();
$('#choosecalendar_dialog').dialog('destroy').remove();
@ -438,7 +458,7 @@ Calendar={
if($('#choosecalendar_dialog').dialog('isOpen') == true){
$('#choosecalendar_dialog').dialog('moveToTop');
}else{
$('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/choosecalendar.php', function(){
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'choosecalendar.php'), function(){
$('#choosecalendar_dialog').dialog({
width : 600,
close : function(event, ui) {
@ -450,7 +470,7 @@ Calendar={
},
activation:function(checkbox, calendarid)
{
$.post(oc_webroot + "/apps/calendar/ajax/activation.php", { calendarid: calendarid, active: checkbox.checked?1:0 },
$.post(OC.filePath('calendar', 'ajax', 'activation.php'), { calendarid: calendarid, active: checkbox.checked?1:0 },
function(data) {
checkbox.checked = data == 1;
Calendar.UI.loadEvents();
@ -458,14 +478,43 @@ Calendar={
},
newCalendar:function(object){
var tr = $(document.createElement('tr'))
.load(oc_webroot + "/apps/calendar/ajax/newcalendar.php");
.load(OC.filePath('calendar', 'ajax', 'newcalendar.php'));
$(object).closest('tr').after(tr).hide();
},
edit:function(object, calendarid){
var tr = $(document.createElement('tr'))
.load(oc_webroot + "/apps/calendar/ajax/editcalendar.php?calendarid="+calendarid);
.load(OC.filePath('calendar', 'ajax', 'editcalendar.php') + "?calendarid="+calendarid,
function(){Calendar.UI.Calendar.colorPicker(this)});
$(object).closest('tr').after(tr).hide();
},
colorPicker:function(container){
// based on jquery-colorpicker at jquery.webspirited.com
var obj = $('.colorpicker', container);
var picker = $('<div class="calendar-colorpicker"></div>');
var size = 20;
//build an array of colors
var colors = {};
$(obj).children('option').each(function(i, elm) {
colors[i] = {};
colors[i].color = $(elm).val();
colors[i].label = $(elm).text();
});
for (var i in colors) {
picker.append('<span class="calendar-colorpicker-color ' + (colors[i].color == $(obj).children(":selected").val() ? ' active' : '') + '" rel="' + colors[i].label + '" style="background-color: #' + colors[i].color + '; width: ' + size + 'px; height: ' + size + 'px;"></span>');
}
picker.delegate(".calendar-colorpicker-color", "click", function() {
$(obj).val($(this).attr('rel'));
$(obj).change();
picker.children('.calendar-colorpicker-color.active').removeClass('active');
$(this).addClass('active');
});
$(obj).after(picker);
$(obj).css({
position: 'absolute',
left: -10000
});
},
submit:function(button, calendarid){
var displayname = $("#displayname_"+calendarid).val();
var active = $("#edit_active_"+calendarid+":checked").length;
@ -490,7 +539,7 @@ Calendar={
cancel:function(button, calendarid){
$(button).closest('tr').prev().show().next().remove();
},
},
},/*
OneDay:{
forward:function(){
Calendar.Date.forward_day();
@ -499,7 +548,7 @@ Calendar={
Calendar.Date.backward_day();
},
removeEvents:function(){
$("#onedayview .calendar_row").html("");
$("#onedayview .calendar_row").empty();
},
renderCal:function(){
$("#datecontrol_date").val(Calendar.UI.formatDayShort() + Calendar.space + Calendar.Date.current.getDate() + Calendar.space + Calendar.UI.formatMonthShort() + Calendar.space + Calendar.Date.current.getFullYear());
@ -520,7 +569,7 @@ Calendar={
return $(document.createElement('p'))
.html(time + event['description'])
},
},
},*/
OneWeek:{
forward:function(){
Calendar.Date.forward_week();
@ -530,7 +579,7 @@ Calendar={
},
removeEvents:function(){
for( i = 0; i <= 6; i++) {
$("#oneweekview ." + Calendar.UI.weekdays[i]).html("");
$("#oneweekview ." + Calendar.UI.weekdays[i]).empty();
}
$("#oneweekview .thisday").removeClass("thisday");
},
@ -539,7 +588,23 @@ Calendar={
var dates = this.generateDates();
var today = new Date();
for(var i = 0; i <= 6; i++){
$("#oneweekview th." + Calendar.UI.weekdays[i]).html(Calendar.UI.formatDayShort((i+1)%7) + Calendar.space + dates[i].getDate() + Calendar.space + Calendar.UI.formatMonthShort(dates[i].getMonth()));
$("#oneweekview th." + Calendar.UI.weekdays[i]).html(Calendar.UI.formatDayShort((i+Calendar.firstdayofweek)%7) + Calendar.space + dates[i].getDate() + Calendar.space + Calendar.UI.formatMonthShort(dates[i].getMonth()));
$("#oneweekview td." + Calendar.UI.weekdays[i] + ".allday").attr('title', dates[i].getDate() + "." + String(parseInt(dates[i].getMonth()) + 1) + "." + dates[i].getFullYear() + "-" + "allday");
$("#oneweekview td." + Calendar.UI.weekdays[i] + ".allday").droppable({
drop: function() {
Calendar.UI.moveevent(Calendar.UI.drageventid, this.title);
Calendar.UI.loadEvents();
}
});
for(var ii = 0;ii <= 23; ii++){
$("#oneweekview td." + Calendar.UI.weekdays[i] + "." + String(ii)).attr('title', dates[i].getDate() + "." + String(parseInt(dates[i].getMonth()) + 1) + "." + dates[i].getFullYear() + "-" + String(ii) + ":00");
$("#oneweekview td." + Calendar.UI.weekdays[i] + "." + String(ii)).droppable({
drop: function() {
Calendar.UI.moveevent(Calendar.UI.drageventid, this.title);
Calendar.UI.loadEvents();
}
});
}
if(dates[i].getDate() == today.getDate() && dates[i].getMonth() == today.getMonth() && dates[i].getFullYear() == today.getFullYear()){
$("#oneweekview ." + Calendar.UI.weekdays[i]).addClass("thisday");
}
@ -570,14 +635,18 @@ Calendar={
if(dayofweek == 0) {
dayofweek = 7;
}
date.setDate(date.getDate() - dayofweek + 1);
if(Calendar.firstdayofweek > dayofweek){
date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek - 7);
}else{
date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek);
}
for(var i = 0; i <= 6; i++) {
dates[i] = new Date(date)
date.setDate(date.getDate() + 1);
}
return dates;
},
},
},/*
FourWeeks:{
forward:function(){
Calendar.Date.forward_week();
@ -587,7 +656,7 @@ Calendar={
},
removeEvents:function(){
$('#fourweeksview .day.thisday').removeClass('thisday');
$('#fourweeksview .day .events').html('');
$('#fourweeksview .day .events').empty();
},
renderCal:function(){
var calw1 = Calendar.Date.calw();
@ -674,7 +743,7 @@ Calendar={
}
return dates;
},
},
},*/
OneMonth:{
forward:function(){
Calendar.Date.forward_month();
@ -684,7 +753,7 @@ Calendar={
},
removeEvents:function(){
$('#onemonthview .day.thisday').removeClass('thisday');
$('#onemonthview .day .events').html('');
$('#onemonthview .day .events').empty();
},
renderCal:function(){
$("#datecontrol_date").val(Calendar.UI.formatMonthLong() + Calendar.space + Calendar.Date.current.getFullYear());
@ -712,6 +781,13 @@ Calendar={
var month = dates[i].getMonth();
var year = dates[i].getFullYear();
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday] + " .dateinfo").html(dayofmonth + Calendar.space + Calendar.UI.formatMonthShort(month));
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).attr('title', dayofmonth + "." + String(parseInt(month) + 1) + "." + year);
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).droppable({
drop: function() {
Calendar.UI.moveevent(Calendar.UI.drageventid, this.title);
Calendar.UI.loadEvents();
}
});
if(dayofmonth == today.getDate() && month == today.getMonth() && year == today.getFullYear()){
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).addClass('thisday');
}
@ -776,7 +852,11 @@ Calendar={
dayofweek = 7;
this.rows++;
}
date.setDate(date.getDate() - dayofweek + 1);
if(Calendar.firstdayofweek > dayofweek){
date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek - 7);
}else{
date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek);
}
for(var i = 0; i <= 41; i++) {
dates[i] = new Date(date)
date.setDate(date.getDate() + 1);
@ -786,7 +866,7 @@ Calendar={
},
List:{
removeEvents:function(){
this.eventContainer = $('#listview #events').html('');
this.eventContainer = $('#listview #events').empty();
this.startdate = new Date();
this.enddate = new Date();
this.enddate.setDate(this.enddate.getDate());

View File

@ -3,9 +3,61 @@ $(document).ready(function(){
OC.msg.startSaving('#calendar .msg')
// Serialize the data
var post = $( "#timezone" ).serialize();
$.post( oc_webroot + '/apps/calendar/ajax/settimezone.php', post, function(data){
OC.msg.finishedSaving('#calendar .msg', data);
$.post( OC.filePath('calendar', 'ajax', 'settimezone.php'), post, function(data){
//OC.msg.finishedSaving('#calendar .msg', data);
});
return false;
});
$("#timezone").chosen();
$("#firstdayofweek").change( function(){
var data = $("#firstdayofweek").serialize();
$.post( OC.filePath('calendar', 'ajax', 'setfirstdayofweek.php'), data, function(data){
if(data == "error"){
console.log("saving first day of week failed");
}
});
});
$.getJSON(OC.filePath('calendar', 'ajax', 'firstdayofweek.php'), function(jsondata, status) {
$("#select_" + jsondata.firstdayofweek).attr('selected',true);
$("#firstdayofweek").chosen();
});
$.getJSON(OC.filePath('calendar', 'ajax', 'daysofweekend.php'), function(jsondata, status) {
for(day in jsondata){
if(jsondata[day] == "true"){
$("#selectweekend_" + day).attr('selected',true);
}
}
$("#weekend").chosen();
});
$("#timeformat").change( function(){
var data = $("#timeformat").serialize();
$.post( OC.filePath('calendar', 'ajax', 'settimeformat.php'), data, function(data){
if(data == "error"){
console.log("saving timeformat failed");
}
});
});
$.getJSON(OC.filePath('calendar', 'ajax', 'timeformat.php'), function(jsondata, status) {
$("#" + jsondata.timeformat).attr('selected',true);
$("#timeformat").chosen();
});
$("#duration").blur( function(){
var data = $("#duration").val();
$.post( OC.filePath('calendar', 'ajax', 'setduration.php'), {duration: data}, function(data){
if(data == "error"){
console.log("saving duration failed");
}
});
});
$.getJSON(OC.filePath('calendar', 'ajax', 'duration.php'), function(jsondata, status) {
$("#duration").val(jsondata.duration);
});
$("#weekend").change( function(){
var data = $("#weekend").serialize();
$.post( OC.filePath('calendar', 'ajax', 'setdaysofweekend.php'), data, function(data){
if(data == "error"){
console.log("saving days of weekend failed");
}
});
});
});

View File

@ -286,6 +286,30 @@ class OC_Calendar_Object{
}
}
public static function getDTEndFromVEvent($vevent)
{
if ($vevent->DTEND) {
$dtend = $vevent->DTEND;
}else{
$dtend = clone $vevent->DTSTART;
if ($vevent->DURATION){
$duration = strval($vevent->DURATION);
$invert = 0;
if ($duration[0] == '-'){
$duration = substr($duration, 1);
$invert = 1;
}
if ($duration[0] == '+'){
$duration = substr($duration, 1);
}
$interval = new DateInterval($duration);
$interval->invert = $invert;
$dtend->getDateTime()->add($interval);
}
}
return $dtend;
}
public static function getCategoryOptions($l10n)
{
return array(
@ -482,6 +506,7 @@ class OC_Calendar_Object{
}
$vevent->DTSTART = $dtstart;
$vevent->DTEND = $dtend;
unset($vevent->DURATION);
if($location != ""){
$vevent->LOCATION = $location;

View File

@ -1,5 +1,5 @@
<?php
$hours = array(
$hours24 = array(
'allday' => $l->t('All day'),
0 => '0',
1 => '1',
@ -26,9 +26,58 @@ $hours = array(
22 => '22',
23 => '23',
);
$weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
$hoursampm = array(
'allday' => $l->t('All day'),
0 => '12 a.m.',
1 => '1 a.m.',
2 => '2 a.m.',
3 => '3 a.m.',
4 => '4 a.m.',
5 => '5 a.m.',
6 => '6 a.m.',
7 => '7 a.m.',
8 => '8 a.m.',
9 => '9 a.m.',
10 => '10 a.m.',
11 => '11 a.m.',
12 => '12 p.m.',
13 => '1 p.m.',
14 => '2 p.m.',
15 => '3 p.m.',
16 => '4 p.m.',
17 => '5 p.m.',
18 => '6 p.m.',
19 => '7 p.m.',
20 => '8 p.m.',
21 => '9 p.m.',
22 => '10 p.m.',
23 => '11 p.m.',
);
if(OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'timeformat', "24") == "24"){
$hours = $hours24;
}else{
$hours = $hoursampm;
}
$weekdaynames = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
$dayforgenerator = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'firstdayofweek', "1");
$weekdays = array();
for($i = 0;$i <= 6; $i++){
$weekdays[$i] = $weekdaynames[$dayforgenerator];
if($dayforgenerator == 6){
$dayforgenerator = 0;
}else{
$dayforgenerator++;
}
}
$weekendjson = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'weekend', '{"Monday":"false","Tuesday":"false","Wednesday":"false","Thursday":"false","Friday":"false","Saturday":"true","Sunday":"true"}');
$weekend = json_decode($weekendjson, true);
$weekenddays = array("sunday"=>$weekend["Sunday"], "monday"=>$weekend["Monday"], "tuesday"=>$weekend["Tuesday"], "wednesday"=>$weekend["Wednesday"], "thursday"=>$weekend["Thursday"], "friday"=>$weekend["Friday"], "saturday"=>$weekend["Saturday"]);
?>
<script type="text/javascript">
<?php
echo "var weekdays = new Array('".$weekdays[0]."','".$weekdays[1]."','".$weekdays[2]."','".$weekdays[3]."','".$weekdays[4]."','".$weekdays[5]."','".$weekdays[6]."');\n";
?>
Calendar.UI.weekdays = weekdays;
Calendar.UI.daylong = new Array("<?php echo $l -> t("Sunday");?>", "<?php echo $l -> t("Monday");?>", "<?php echo $l -> t("Tuesday");?>", "<?php echo $l -> t("Wednesday");?>", "<?php echo $l -> t("Thursday");?>", "<?php echo $l -> t("Friday");?>", "<?php echo $l -> t("Saturday");?>");
Calendar.UI.dayshort = new Array("<?php echo $l -> t("Sun.");?>", "<?php echo $l -> t("Mon.");?>", "<?php echo $l -> t("Tue.");?>", "<?php echo $l -> t("Wed.");?>", "<?php echo $l -> t("Thu.");?>", "<?php echo $l -> t("Fri.");?>", "<?php echo $l -> t("Sat.");?>");
Calendar.UI.monthlong = new Array("<?php echo $l -> t("January");?>", "<?php echo $l -> t("February");?>", "<?php echo $l -> t("March");?>", "<?php echo $l -> t("April");?>", "<?php echo $l -> t("May");?>", "<?php echo $l -> t("June");?>", "<?php echo $l -> t("July");?>", "<?php echo $l -> t("August");?>", "<?php echo $l -> t("September");?>", "<?php echo $l -> t("October");?>", "<?php echo $l -> t("November");?>", "<?php echo $l -> t("December");?>");
@ -37,6 +86,7 @@ $weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'satur
Calendar.UI.cws_label = "<?php echo $l->t("Weeks");?>";
Calendar.UI.more_before = String('<?php echo $l->t('More before {startdate}') ?>');
Calendar.UI.more_after = String('<?php echo $l->t('More after {enddate}') ?>');
Calendar.firstdayofweek = parseInt("<?php echo OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'firstdayofweek', "1"); ?>");
//use last view as default on the next
Calendar.UI.setCurrentView("<?php echo OC_Preferences::getValue(OC_USER::getUser(), "calendar", "currentview", "onemonthview") ?>");
var totalurl = "<?php echo OC_Helper::linkTo('calendar', 'caldav.php', null, true) . '/calendars'; ?>";
@ -93,7 +143,7 @@ $weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'satur
<tr>
<th class="calendar_time"><?php echo $l->t("Time");?></th>
<?php foreach($weekdays as $weekdaynr => $weekday): ?>
<th class="calendar_row <?php echo $weekday ?> <?php echo $weekdaynr > 4 ? 'weekend_thead' : '' ?>" onclick="Calendar.UI.newEvent('#oneweekview th.<?php echo $weekday ?>');"></th>
<th class="calendar_row <?php echo $weekday ?> <?php echo $weekenddays[$weekday] == "true" ? 'weekend_thead' : '' ?>" onclick="Calendar.UI.newEvent('#oneweekview th.<?php echo $weekday ?>');"></th>
<?php endforeach; ?>
</tr>
</thead>
@ -102,7 +152,7 @@ $weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'satur
<tr>
<td class="calendar_time"><?php echo $time_label?></td>
<?php foreach($weekdays as $weekdaynr => $weekday): ?>
<td class="<?php echo $weekday ?> <?php echo $time ?> calendar_row <?php echo $weekdaynr > 4 ? 'weekend_row' : '' ?>" onclick="Calendar.UI.newEvent('#oneweekview th.<?php echo $weekday ?>', '<?php echo $time ?>');"></td>
<td class="<?php echo $weekday ?> <?php echo $time ?> calendar_row <?php echo $weekenddays[$weekday] == "true" ? 'weekend_row' : '' ?>" onclick="Calendar.UI.newEvent('#oneweekview th.<?php echo $weekday ?>', '<?php echo $time ?>');"></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
@ -139,7 +189,7 @@ $weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'satur
<thead>
<tr>
<?php foreach($weekdays as $weekdaynr => $weekday): ?>
<th class="calendar_row <?php echo $weekdaynr > 4 ? 'weekend_thead' : '' ?> <?php echo $weekday ?>"><?php echo $l->t(ucfirst($weekday));?></th>
<th class="calendar_row <?php echo $weekenddays[$weekday] == "true" ? 'weekend_thead' : '' ?> <?php echo $weekday ?>"><?php echo $l->t(ucfirst($weekday));?></th>
<?php endforeach; ?>
</tr>
</thead>
@ -147,7 +197,7 @@ $weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'satur
<?php foreach(range(1, 6) as $week): ?>
<tr class="week_<?php echo $week ?>">
<?php foreach($weekdays as $weekdaynr => $weekday): ?>
<td class="day <?php echo $weekday ?> <?php echo $weekdaynr > 4 ? 'weekend' : '' ?>" onclick="Calendar.UI.newEvent('#onemonthview .week_<?php echo $week ?> .<?php echo $weekday ?>')">
<td class="day <?php echo $weekday ?> <?php echo $weekenddays[$weekday] == "true" ? 'weekend' : '' ?>" onclick="Calendar.UI.newEvent('#onemonthview .week_<?php echo $week ?> .<?php echo $weekday ?>')">
<div class="dateinfo"></div>
<div class="events"></div>
</td>

View File

@ -11,12 +11,12 @@ for($i = 0; $i < count($option_calendars); $i++){
}
?>
<tr>
<td colspan="4">
<td colspan="6">
<a href="#" onclick="Calendar.UI.Calendar.newCalendar(this);"><?php echo $l->t('New Calendar') ?></a>
</td>
</tr>
<tr>
<td colspan="4">
<td colspan="6">
<p style="margin: 0 auto;width: 90%;"><input style="display:none;width: 90%;float: left;" type="text" id="caldav_url" onmouseover="$('#caldav_url').select();" title="<?php echo $l->t("CalDav Link"); ?>"><img id="caldav_url_close" style="height: 20px;vertical-align: middle;display: none;" src="../../core/img/actions/delete.svg" alt="close" onclick="$('#caldav_url').hide();$('#caldav_url_close').hide();"/></p>
</td>
</tr>

View File

@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
?>
<td id="<?php echo $_['new'] ? 'new' : 'edit' ?>calendar_dialog" title="<?php echo $_['new'] ? $l->t("New calendar") : $l->t("Edit calendar"); ?>" colspan="4">
<td id="<?php echo $_['new'] ? 'new' : 'edit' ?>calendar_dialog" title="<?php echo $_['new'] ? $l->t("New calendar") : $l->t("Edit calendar"); ?>" colspan="6">
<table width="100%" style="border: 0;">
<tr>
<th><?php echo $l->t('Displayname') ?></th>
@ -34,7 +34,14 @@
<tr>
<th><?php echo $l->t('Calendar color') ?></th>
<td>
<input id="calendarcolor_<?php echo $_['calendar']['id'] ?>" type="text" value="<?php echo $_['calendar']['calendarcolor'] ?>">
<select id="calendarcolor_<?php echo $_['calendar']['id'] ?>" class="colorpicker">
<?php
if (!isset($_['calendar']['calendarcolor'])) {$_['calendar']['calendarcolor'] = false;}
foreach($_['calendarcolor_options'] as $color){
echo '<option value="' . $color . '"' . ($_['calendar']['calendarcolor'] == $color ? ' selected="selected"' : '') . '>' . $color . '</option>';
}
?>
</select>
</td>
</tr>
</table>

View File

@ -6,6 +6,7 @@
<span id="actions">
<input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/editevent.php');">
<input type="button" class="submit" style="float: left;" name="delete" value="<?php echo $l->t("Delete");?>" onclick="Calendar.UI.submitDeleteEventForm('ajax/deleteevent.php');">
<input type="button" class="submit" style="float: right;" name="export" value="<?php echo $l->t("Export");?>" onclick="window.location='export.php?eventid=<?php echo $_['id'] ?>';">
</span>
</form>
</div>

View File

@ -12,8 +12,8 @@
<td>
<select id="category" name="categories[]" multiple="multiple" title="<?php echo $l->t("Select category") ?>">
<?php
foreach($_['category_options'] as $category){
if (!isset($_['categories'])) {$_['categories'] = array();}
foreach($_['category_options'] as $category){
echo '<option value="' . $category . '"' . (in_array($category, $_['categories']) ? ' selected="selected"' : '') . '>' . $category . '</option>';
}
?>
@ -22,8 +22,8 @@
<td>
<select style="width:140px;" name="calendar">
<?php
foreach($_['calendar_options'] as $calendar){
if (!isset($_['calendar'])) {$_['calendar'] = false;}
foreach($_['calendar_options'] as $calendar){
echo '<option value="' . $calendar['id'] . '"' . ($_['calendar'] == $calendar['id'] ? ' selected="selected"' : '') . '>' . $calendar['displayname'] . '</option>';
}
?>

View File

@ -1,57 +0,0 @@
<?php
/**
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
$events = array();
foreach($calendars as $calendar) {
$tmp = OC_Calendar_Object::all($calendar['id']);
$events = array_merge($events, $tmp);
}
$select_year = $_GET["year"];
$return_events = array();
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
foreach($events as $event)
{
if ($select_year != substr($event['startdate'], 0, 4))
continue;
$start_dt = new DateTime($event['startdate'], new DateTimeZone('UTC'));
$start_dt->setTimezone(new DateTimeZone($user_timezone));
$end_dt = new DateTime($event['enddate'], new DateTimeZone('UTC'));
$end_dt->setTimezone(new DateTimeZone($user_timezone));
$year = $start_dt->format('Y');
$month = $start_dt->format('n') - 1; // return is 0 based
$day = $start_dt->format('j');
$hour = $start_dt->format('G');
// hack
if (strstr($event['calendardata'], 'DTSTART;VALUE=DATE:')) {
$hour = 'allday';
}
$return_event = array();
foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop)
{
$return_event[$prop] = $event[$prop];
}
$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
$return_event['description'] = $event['summary'];
if ($hour == 'allday')
{
$return_event['allday'] = true;
}
if (isset($return_events[$year][$month][$day][$hour]))
{
$return_events[$year][$month][$day][$hour][] = $return_event;
}
else
{
$return_events[$year][$month][$day][$hour] = array(1 => $return_event);
}
}
OC_JSON::encodedPrint($return_events);
?>

View File

@ -1,15 +1,18 @@
<?php
/**
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OC_UTIL::addScript('', 'jquery.multiselect');
OC_UTIL::addStyle('', 'jquery.multiselect');
?>
<form id="calendar">
<fieldset class="personalblock">
<label for="timezone"><strong><?php echo $l->t('Timezone');?></strong></label>
<select id="timezone" name="timezone">
<select style="display: none;" id="timezone" name="timezone">
<?php
$continent = '';
foreach($_['timezones'] as $timezone):
@ -24,6 +27,34 @@
echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>';
endif;
endforeach;?>
</select><span class="msg"></span>
</select>&nbsp;&nbsp;
<label for="timeformat"><strong><?php echo $l->t('Timeformat');?></strong></label>
<select style="display: none;" id="timeformat" title="<?php echo "timeformat"; ?>" name="timeformat">
<option value="24" id="24h"><?php echo $l->t("24h"); ?></option>
<option value="ampm" id="ampm"><?php echo $l->t("12h"); ?></option>
</select><br />
<label for="firstdayofweek"><strong><?php echo $l->t('First day of the week');?></strong></label>
<select style="display: none;" id="firstdayofweek" name="firstdayofweek">
<?php
$weekdays = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
for($i = 0;$i <= 6;$i++){
echo '<option value="'.$i.'" id="select_'.$i.'">' . $l->t($weekdays[$i]) . '</option>';
}
?>
</select><br />
<label for="weekend"><strong><?php echo $l->t('Days of weekend');?></strong></label>
<select id="weekend" name="weekend[]" style="width: 50%;" multiple="multiple" title="<?php echo $l->t("Weekend"); ?>">
<?php
$weekdays = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
for($i = 0;$i <= 6;$i++){
echo '<option value="'.$weekdays[$i].'" id="selectweekend_' . $weekdays[$i] . '">' . $l->t($weekdays[$i]) . '</option>';
}
?>
</select><br />
<label for="duration"><strong><?php echo $l->t('Event duration');?></strong></label>
<input type="text" maxlength="3" size="3" style="width: 2em;" id="duration" name="duration" /> <?php echo $l->t("Minutes");?>
<br />
<?php echo $l->t('Calendar CalDAV syncing address:');?>
<?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?><br />
</fieldset>
</form>

View File

@ -28,6 +28,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$addressbook = OC_Contacts_Addressbook::find( $aid );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){

View File

@ -28,6 +28,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$card = OC_Contacts_VCard::find( $id );
if( $card === false ){

View File

@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$addressbook = OC_Contacts_Addressbook::find( $id );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){

View File

@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$card = OC_Contacts_VCard::find( $id );
if( $card === false ){

View File

@ -31,6 +31,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$card = OC_Contacts_VCard::find( $id );
if( $card === false ){

View File

@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$card = OC_Contacts_VCard::find( $id );

View File

@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$card = OC_Contacts_VCard::find( $id );
if( $card === false ){

View File

@ -27,6 +27,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$addressbooks = OC_Contacts_Addressbook::all(OC_USER::getUser());
$tmpl = new OC_Template('contacts','part.addcardform');

View File

@ -28,6 +28,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$card = OC_Contacts_VCard::find( $id );
if( $card === false ){

View File

@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$card = OC_Contacts_VCard::find( $id );
if( $card === false ){

View File

@ -17,3 +17,6 @@ OC_App::addNavigationEntry( array(
'href' => OC_Helper::linkTo( 'contacts', 'index.php' ),
'icon' => OC_Helper::imagePath( 'settings', 'users.svg' ),
'name' => 'Contacts' ));
OC_APP::registerPersonal('contacts','settings');

View File

@ -24,6 +24,7 @@
$RUNTIME_NOSETUPFS = true;
require_once('../../lib/base.php');
OC_Util::checkAppEnabled('contacts');
// Backends
$authBackend = new OC_Connector_Sabre_Auth();

View File

@ -29,6 +29,7 @@ require_once('../../lib/base.php');
// Check if we are a user
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
// Check if the user has an addressbook
$addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser());

View File

@ -34,7 +34,7 @@ $(document).ready(function(){
if(jsondata.status == 'success'){
$('#leftcontent [data-id="'+jsondata.data.id+'"]').remove();
$('#rightcontent').data('id','');
$('#rightcontent').html('');
$('#rightcontent').empty();
}
else{
alert(jsondata.data.message);

View File

@ -22,18 +22,13 @@
// Init owncloud
require_once('../../lib/base.php');
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
$id = $_GET['id'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo $l10n->t('You need to log in.');
exit();
}
$card = OC_Contacts_VCard::find( $id );
if( $card === false ){
echo $l10n->t('Contact could not be found.');

View File

@ -0,0 +1,6 @@
<?php
$tmpl = new OC_Template( 'contacts', 'settings');
return $tmpl->fetchPage();
?>

View File

@ -0,0 +1,7 @@
<form id="mediaform">
<fieldset class="personalblock">
<strong>Contacts</strong><br />
CardDAV syncing address:
<?php echo OC_Helper::linkTo('apps/contacts', 'carddav.php', null, true); ?><br />
</fieldset>
</form>

Some files were not shown because too many files have changed in this diff Show More