Compare commits
80 Commits
availabili
...
v3.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dd517ec79 | ||
|
|
edeaa0a4a1 | ||
|
|
2528778651 | ||
|
|
f89f3701df | ||
|
|
86f2f841bf | ||
|
|
098f6655c8 | ||
|
|
bb2cba13ce | ||
|
|
32b8900e0c | ||
|
|
e6a8e8f65a | ||
|
|
b6ba0f547e | ||
|
|
8991600303 | ||
|
|
beaa76feb2 | ||
|
|
f6718dd889 | ||
|
|
2ac20337fa | ||
|
|
a62ac84220 | ||
|
|
a7d7525645 | ||
|
|
e0161826d8 | ||
|
|
01dfc2e836 | ||
|
|
cc07d9fd9c | ||
|
|
838dfe14e5 | ||
|
|
2ca1ba0384 | ||
|
|
d81a7787b0 | ||
|
|
54f6db9a2a | ||
|
|
afbb5cb459 | ||
|
|
25d0c05d56 | ||
|
|
376c830319 | ||
|
|
b8f3629783 | ||
|
|
1147654009 | ||
|
|
71e71b75ee | ||
|
|
686590bd3a | ||
|
|
40ba508874 | ||
|
|
01bef2ceaa | ||
|
|
42072b7cc4 | ||
|
|
b216ba7120 | ||
|
|
88c0d82daa | ||
|
|
2a7430158a | ||
|
|
2a11400725 | ||
|
|
5463fa2420 | ||
|
|
7261f0f358 | ||
|
|
a6ac5a2ec1 | ||
|
|
143ada00eb | ||
|
|
268c6cfaa7 | ||
|
|
d8cdec48fe | ||
|
|
3707706759 | ||
|
|
025802ad93 | ||
|
|
14cd71516c | ||
|
|
92c0a8e6ca | ||
|
|
e3dc8140b0 | ||
|
|
0d4637756c | ||
|
|
7426f3f641 | ||
|
|
536a39e21f | ||
|
|
6361eb8d24 | ||
|
|
a466c9be3e | ||
|
|
7ccf71d478 | ||
|
|
ee5b7b4db6 | ||
|
|
9c166dba50 | ||
|
|
32befb4fe0 | ||
|
|
6c19f6dc4e | ||
|
|
b2fdfb0c49 | ||
|
|
16f376bca1 | ||
|
|
7752008152 | ||
|
|
bb07e43367 | ||
|
|
fadedaab2b | ||
|
|
04abe91562 | ||
|
|
a0f43fdd6e | ||
|
|
7a94570ab8 | ||
|
|
e2d3585014 | ||
|
|
3378493baa | ||
|
|
ae64651585 | ||
|
|
4357ca8d20 | ||
|
|
38a2cd0f48 | ||
|
|
31b081a882 | ||
|
|
27936ab9c7 | ||
|
|
5e775f870a | ||
|
|
d2928cb4e6 | ||
|
|
c30aa4ddeb | ||
|
|
16ee08385e | ||
|
|
0dd5fd5cd3 | ||
|
|
8826aa8056 | ||
|
|
78863696b7 |
9
3rdparty/Sabre/HTTP/BasicAuth.php
vendored
9
3rdparty/Sabre/HTTP/BasicAuth.php
vendored
@@ -36,6 +36,15 @@ class Sabre_HTTP_BasicAuth extends Sabre_HTTP_AbstractAuth {
|
||||
// Most other webservers
|
||||
$auth = $this->httpRequest->getHeader('Authorization');
|
||||
|
||||
// Support PHP running as CGI which does not set the auth header automatically.
|
||||
// Note: Redirect Rule is needed in .htaccess to make this work:
|
||||
// RewriteEngine on
|
||||
// RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
||||
//
|
||||
if (!$auth && isSet($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
|
||||
$auth = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
|
||||
}
|
||||
|
||||
if (!$auth) return false;
|
||||
|
||||
if (strpos(strtolower($auth),'basic')!==0) return false;
|
||||
|
||||
2
README
2
README
@@ -4,7 +4,7 @@ It is alpha software in development and should be treated accordingly.
|
||||
|
||||
http://ownCloud.org
|
||||
|
||||
Installation instructions: http://owncloud.org/install
|
||||
Installation instructions: http://owncloud.org/support/setup-and-installation/
|
||||
Source code: http://gitorious.org/owncloud
|
||||
|
||||
Mailing list: http://mail.kde.org/mailman/listinfo/owncloud
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
function bailOut($msg) {
|
||||
OC_JSON::error(array('data' => array('message' => $msg)));
|
||||
OC_Log::write('contacts','ajax/addcard.php: '.$msg, OC_Log::DEBUG);
|
||||
exit();
|
||||
}
|
||||
|
||||
// Check if we are a user
|
||||
OC_JSON::checkLoggedIn();
|
||||
@@ -31,12 +36,22 @@ $l=new OC_L10N('contacts');
|
||||
$aid = $_POST['id'];
|
||||
$addressbook = OC_Contacts_App::getAddressbook( $aid );
|
||||
|
||||
$fn = $_POST['fn'];
|
||||
$fn = trim($_POST['fn']);
|
||||
$values = $_POST['value'];
|
||||
$parameters = $_POST['parameters'];
|
||||
|
||||
$vcard = new OC_VObject('VCARD');
|
||||
$vcard->setUID();
|
||||
|
||||
$n = isset($values['N'][0])?trim($values['N'][0]).';':';';
|
||||
$n .= isset($values['N'][1])?trim($values['N'][1]).';':';';
|
||||
$n .= isset($values['N'][2])?trim($values['N'][2]).';;':';;';
|
||||
|
||||
if(!$fn || ($n == ';;;;')) {
|
||||
bailOut('You have to enter both the extended name and the display name.');
|
||||
}
|
||||
|
||||
$vcard->setString('N',$n);
|
||||
$vcard->setString('FN',$fn);
|
||||
|
||||
// Data to add ...
|
||||
@@ -58,6 +73,10 @@ foreach( $add as $propname){
|
||||
} else {
|
||||
$prop_parameters = array();
|
||||
}
|
||||
if(is_array($value)){
|
||||
ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
|
||||
$value = OC_VObject::escapeSemicolons($value);
|
||||
}
|
||||
$vcard->addProperty($propname, $value); //, $prop_parameters);
|
||||
$line = count($vcard->children) - 1;
|
||||
foreach ($prop_parameters as $key=>$element) {
|
||||
@@ -77,7 +96,7 @@ foreach( $add as $propname){
|
||||
$id = OC_Contacts_VCard::add($aid,$vcard->serialize());
|
||||
if(!$id) {
|
||||
OC_JSON::error(array('data' => array('message' => $l->t('There was an error adding the contact.'))));
|
||||
OC_Log::write('contacts','ajax/addcard.php: Recieved non-positive ID on adding card: '.$name, OC_Log::ERROR);
|
||||
OC_Log::write('contacts','ajax/addcard.php: Recieved non-positive ID on adding card: '.$id, OC_Log::ERROR);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,24 @@ if(!is_array($value)){
|
||||
}
|
||||
$parameters = isset($_POST['parameters']) ? $_POST['parameters'] : array();
|
||||
|
||||
// Prevent setting a duplicate entry
|
||||
$current = $vcard->select($name);
|
||||
foreach($current as $item) {
|
||||
$tmpvalue = (is_array($value)?implode(';', $value):$value);
|
||||
if($tmpvalue == $item->value) {
|
||||
OC_JSON::error(array('data' => array('message' => $l->t('Trying to add duplicate property: ').$name.': '.$tmpvalue)));
|
||||
OC_Log::write('contacts','ajax/addproperty.php: Trying to add duplicate property: '.$name.': '.$tmpvalue, OC_Log::DEBUG);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($value)) {
|
||||
ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
|
||||
$value = array_map('strip_tags', $value);
|
||||
} else {
|
||||
$value = strip_tags($value);
|
||||
}
|
||||
|
||||
$property = $vcard->addProperty($name, $value); //, $parameters);
|
||||
|
||||
$line = count($vcard->children) - 1;
|
||||
|
||||
@@ -15,7 +15,13 @@ OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('contacts');
|
||||
|
||||
$userid = OC_User::getUser();
|
||||
$bookid = OC_Contacts_Addressbook::add($userid, $_POST['name'], null);
|
||||
$name = trim(strip_tags($_POST['name']));
|
||||
if(!$name) {
|
||||
OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add addressbook with an empty name.'))));
|
||||
OC_Log::write('contacts','ajax/createaddressbook.php: Cannot add addressbook with an empty name.', OC_Log::ERROR);
|
||||
exit();
|
||||
}
|
||||
$bookid = OC_Contacts_Addressbook::add($userid, $name, null);
|
||||
if(!$bookid) {
|
||||
OC_JSON::error(array('data' => array('message' => $l->t('Error adding addressbook.'))));
|
||||
OC_Log::write('contacts','ajax/createaddressbook.php: Error adding addressbook: '.$_POST['name'], OC_Log::ERROR);
|
||||
|
||||
@@ -33,6 +33,11 @@ $checksum = $_GET['checksum'];
|
||||
|
||||
$vcard = OC_Contacts_App::getContactVCard( $id );
|
||||
$line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum);
|
||||
if(is_null($line)){
|
||||
$l=new OC_L10N('contacts');
|
||||
OC_JSON::error(array('data' => array( 'message' => $l->t('Information about vCard is incorrect. Please reload the page.'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
unset($vcard->children[$line]);
|
||||
|
||||
|
||||
@@ -36,8 +36,13 @@ $line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum);
|
||||
// Set the value
|
||||
$value = $_POST['value'];
|
||||
if(is_array($value)){
|
||||
ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
|
||||
$value = array_map('strip_tags', $value);
|
||||
$value = OC_VObject::escapeSemicolons($value);
|
||||
} else {
|
||||
$value = strip_tags($value);
|
||||
}
|
||||
OC_Log::write('contacts','ajax/setproperty.php: setting: '.$vcard->children[$line]->name.': '.$value, OC_Log::DEBUG);
|
||||
$vcard->children[$line]->setValue($value);
|
||||
|
||||
// Add parameters
|
||||
@@ -87,6 +92,9 @@ $phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
|
||||
if ($vcard->children[$line]->name == 'FN'){
|
||||
$tmpl = new OC_Template('contacts','part.property.FN');
|
||||
}
|
||||
elseif ($vcard->children[$line]->name == 'N'){
|
||||
$tmpl = new OC_Template('contacts','part.property.N');
|
||||
}
|
||||
else{
|
||||
$tmpl = new OC_Template('contacts','part.property');
|
||||
}
|
||||
|
||||
@@ -33,6 +33,11 @@ $checksum = $_GET['checksum'];
|
||||
$vcard = OC_Contacts_App::getContactVCard( $id );
|
||||
|
||||
$line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum);
|
||||
if(is_null($line)){
|
||||
$l=new OC_L10N('contacts');
|
||||
OC_JSON::error(array('data' => array( 'message' => $l->t('Information about vCard is incorrect. Please reload the page.'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
$adr_types = OC_Contacts_App::getTypesOfProperty('ADR');
|
||||
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
|
||||
|
||||
@@ -16,7 +16,14 @@ OC_JSON::checkAppEnabled('contacts');
|
||||
|
||||
$bookid = $_POST['id'];
|
||||
|
||||
if(!OC_Contacts_Addressbook::edit($bookid, $_POST['name'], null)) {
|
||||
$name = trim(strip_tags($_POST['name']));
|
||||
if(!$name) {
|
||||
OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot update addressbook with an empty name.'))));
|
||||
OC_Log::write('contacts','ajax/updateaddressbook.php: Cannot update addressbook with an empty name.', OC_Log::ERROR);
|
||||
exit();
|
||||
}
|
||||
|
||||
if(!OC_Contacts_Addressbook::edit($bookid, $name, null)) {
|
||||
OC_JSON::error(array('data' => array('message' => $l->t('Error updating addressbook.'))));
|
||||
OC_Log::write('contacts','ajax/updateaddressbook.php: Error adding addressbook: ', OC_Log::ERROR);
|
||||
//exit();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#leftcontent a { height: 23px; display: block; margin: 0 0 0 0; padding: 0 0 0 25px; }
|
||||
#chooseaddressbook {margin-right: 170px; float: right;}
|
||||
#contacts_details_name { font-weight:bold;font-size:1.1em;margin-left:25%;}
|
||||
#contacts_details_name_n { font-size:0.8em;margin-left:25%;color:#666;}
|
||||
#contacts_details_photo { margin:.5em 0em .5em 25%; }
|
||||
|
||||
#contacts_deletecard {position:absolute;top:15px;right:25px;}
|
||||
@@ -12,41 +13,15 @@
|
||||
#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%;float:left; clear: right; }
|
||||
#contacts_setproperty_button { margin-left:25%; }
|
||||
|
||||
dl.form
|
||||
{
|
||||
width: 100%;
|
||||
float: left;
|
||||
clear: right;
|
||||
margin: 1em;
|
||||
padding: 0;
|
||||
}
|
||||
#contacts_addcardform legend,label { font-weight: bold; width: 10em; overflow: ellipsis; }
|
||||
#contacts_addcardform legend { padding-left: 3em; font-size:1.1em; }
|
||||
#contacts_addcardform input[type="text"] { width: 25em; }
|
||||
#contacts_addcardform input[type="email"] { width: 15em; }
|
||||
#contacts_addcardform input[type="tel"] { width: 15em; }
|
||||
|
||||
.form dt
|
||||
{
|
||||
display: table-cell;
|
||||
clear: left;
|
||||
float: left;
|
||||
min-width: 10em;
|
||||
margin: 0;
|
||||
padding-top: 0.5em;
|
||||
padding-right: 1em;
|
||||
font-weight: bold;
|
||||
text-align:right;
|
||||
vertical-align: text-bottom;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
.form dd
|
||||
{
|
||||
display: table-cell;
|
||||
clear: right;
|
||||
float: left;
|
||||
min-width: 20em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
top: 0px;
|
||||
}
|
||||
dl.form { width: 100%; float: left; clear: right; margin: 1em; padding: 0; }
|
||||
.form dt { display: table-cell; clear: left; float: left; min-width: 10em; margin: 0; padding-top: 0.5em; padding-right: 1em;font-weight: bold; text-align:right; vertical-align: text-bottom; bottom: 0px; }
|
||||
.form dd { display: table-cell; clear: right; float: left; min-width: 20em; margin: 0; padding: 0; white-space: nowrap; top: 0px; }
|
||||
.form input { position: relative; width: 20em; }
|
||||
|
||||
.contacts_property_data ul, ol.contacts_property_data { list-style:none; }
|
||||
@@ -60,18 +35,3 @@ dl.form
|
||||
.chzn-container.chzn-container-active .chzn-choices { border-bottom-left-radius: 0;border-bottom-right-radius: 0; }
|
||||
.chzn-container .chzn-drop { border-bottom-left-radius: 0.5em;border-bottom-right-radius: 0.5em; }
|
||||
|
||||
/* Form setup ----------------------------------------------------------------*/
|
||||
/* .forme {} */
|
||||
/* .forme ul, .forme ol { list-style:none; } */
|
||||
/* .forme .inputs, .forme .buttons { overflow: hidden; } */
|
||||
|
||||
/* Labels --------------------------------------------------------------------*/
|
||||
/* .forme .input .label { width:25%; float:left; display:block; } */
|
||||
|
||||
/* Inputs --------------------------------------------------------------------*/
|
||||
/* .forme .stringish input { width:72%; } */
|
||||
/* .forme .text textarea { width:72%; } */
|
||||
|
||||
/* Buttons -------------------------------------------------------------------*/
|
||||
/* .forme .buttons { padding-left:25%; } */
|
||||
/* .forme .button { float:left; padding-left:0.5em; } */
|
||||
|
||||
@@ -124,9 +124,11 @@ Contacts={
|
||||
url = OC.filePath('contacts', 'ajax', 'updateaddressbook.php');
|
||||
}
|
||||
$.post(url, { id: bookid, name: displayname, active: active, description: description },
|
||||
function(data){
|
||||
if(data.status == 'success'){
|
||||
$(button).closest('tr').prev().html(data.page).show().next().remove();
|
||||
function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$(button).closest('tr').prev().html(jsondata.page).show().next().remove();
|
||||
} else {
|
||||
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
|
||||
}
|
||||
});
|
||||
Contacts.UI.Contacts.update();
|
||||
|
||||
@@ -85,10 +85,10 @@ class OC_Contacts_App{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(is_null($line)){
|
||||
/*if(is_null($line)){
|
||||
OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('Information about vCard is incorrect. Please reload the page.'))));
|
||||
exit();
|
||||
}
|
||||
}*/
|
||||
return $line;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ class OC_Contacts_VCard{
|
||||
* ['carddata']
|
||||
*/
|
||||
public static function all($id){
|
||||
$result = null;
|
||||
if(is_array($id)) {
|
||||
$id_sql = join(',', array_fill(0, count($id), '?'));
|
||||
$prep = 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid IN ('.$id_sql.') ORDER BY fullname';
|
||||
@@ -58,13 +59,20 @@ class OC_Contacts_VCard{
|
||||
OC_Log::write('contacts','OC_Contacts_VCard:all, ids: '.join(',', $id),OC_Log::DEBUG);
|
||||
OC_Log::write('contacts','SQL:'.$prep,OC_Log::DEBUG);
|
||||
}
|
||||
} else {
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? ORDER BY fullname' );
|
||||
$result = $stmt->execute(array($id));
|
||||
} elseif($id) {
|
||||
try {
|
||||
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? ORDER BY fullname' );
|
||||
$result = $stmt->execute(array($id));
|
||||
} catch(Exception $e) {
|
||||
OC_Log::write('contacts','OC_Contacts_VCard:all:, exception: '.$e->getMessage(),OC_Log::DEBUG);
|
||||
OC_Log::write('contacts','OC_Contacts_VCard:all, ids: '. $id,OC_Log::DEBUG);
|
||||
}
|
||||
}
|
||||
$cards = array();
|
||||
while( $row = $result->fetchRow()){
|
||||
$cards[] = $row;
|
||||
if(!is_null($result)) {
|
||||
while( $row = $result->fetchRow()){
|
||||
$cards[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $cards;
|
||||
@@ -108,10 +116,9 @@ class OC_Contacts_VCard{
|
||||
if(!is_null($card)){
|
||||
$fn = $card->getAsString('FN');
|
||||
$uid = $card->getAsString('UID');
|
||||
if(is_null($uid)){
|
||||
if(!$uid){
|
||||
$card->setUID();
|
||||
$uid = $card->getAsString('UID');
|
||||
//$data = $card->serialize();
|
||||
};
|
||||
$uri = $uid.'.vcf';
|
||||
|
||||
@@ -158,14 +165,19 @@ class OC_Contacts_VCard{
|
||||
* @return insertid
|
||||
*/
|
||||
public static function addFromDAVData($id,$uri,$data){
|
||||
$fn = null;
|
||||
$email = null;
|
||||
$fn = $n = $uid = $email = null;
|
||||
$card = OC_VObject::parse($data);
|
||||
if(!is_null($card)){
|
||||
foreach($card->children as $property){
|
||||
if($property->name == 'FN'){
|
||||
$fn = $property->value;
|
||||
}
|
||||
if($property->name == 'N'){
|
||||
$n = $property->value;
|
||||
}
|
||||
if($property->name == 'UID'){
|
||||
$uid = $property->value;
|
||||
}
|
||||
if($property->name == 'EMAIL' && is_null($email)){
|
||||
$email = $property->value;
|
||||
}
|
||||
@@ -180,6 +192,10 @@ class OC_Contacts_VCard{
|
||||
$card->addProperty('EMAIL', $email);
|
||||
$data = $card->serialize();
|
||||
}
|
||||
if(!$uid) {
|
||||
$card->setUID();
|
||||
$data = $card->serialize();
|
||||
}
|
||||
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
|
||||
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
|
||||
@@ -260,7 +276,7 @@ class OC_Contacts_VCard{
|
||||
* @return boolean
|
||||
*/
|
||||
public static function delete($id){
|
||||
// FIXME: Add error checking.
|
||||
// FIXME: Add error checking. Touch addressbook.
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
|
||||
$stmt->execute(array($id));
|
||||
|
||||
@@ -285,6 +301,7 @@ class OC_Contacts_VCard{
|
||||
// FIXME: Add error checking. Deleting a card gives an Kontact/Akonadi error.
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
|
||||
$stmt->execute(array($aid,$uri));
|
||||
OC_Contacts_Addressbook::touch($aid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,9 @@ if( is_null($content)){
|
||||
}
|
||||
}
|
||||
if($image->loadFromBase64($child->value)) {
|
||||
if($image->width() > 200 || $image->height() > 200) {
|
||||
$image->resize(200);
|
||||
}
|
||||
header('Content-Type: '.$mime);
|
||||
$image();
|
||||
exit();
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<form class="formtastic" id="contacts_addcardform">
|
||||
<?php
|
||||
$l=new OC_L10N('contacts');
|
||||
?>
|
||||
<form id="contacts_addcardform">
|
||||
<?php if(count($_['addressbooks'])==1): ?>
|
||||
<input type="hidden" name="id" value="<?php echo $_['addressbooks'][0]['id']; ?>">
|
||||
<?php else: ?>
|
||||
<fieldset class="inputs">
|
||||
<dl class="form">
|
||||
<dt>
|
||||
<label class="label" for="id"><?php echo $l->t('Addressbook'); ?></label>
|
||||
<label for="id"><?php echo $l->t('Addressbook'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<select name="id" size="1">
|
||||
@@ -18,13 +21,37 @@
|
||||
<fieldset class="inputs">
|
||||
<dl class="form">
|
||||
<dt>
|
||||
<label class="label" for="fn"><?php echo $l->t('Name'); ?></label>
|
||||
<label for="n1"><?php echo $l->t('Given name'); ?></label>
|
||||
</dd>
|
||||
<dd>
|
||||
<input id="fn" type="text" name="fn" value=""><br>
|
||||
<input id="n1" type="text" name="value[N][1]" value="">
|
||||
</dd>
|
||||
<dt>
|
||||
<label class="label" for="org"><?php echo $l->t('Organization'); ?></label>
|
||||
<label for="n0"><?php echo $l->t('Family name'); ?></label>
|
||||
</dd>
|
||||
<dd>
|
||||
<input id="n0" type="text" name="value[N][0]" value="">
|
||||
</dd>
|
||||
<dt>
|
||||
<label for="n2"><?php echo $l->t('Additional names'); ?></label>
|
||||
</dd>
|
||||
<dd>
|
||||
<input id="n2" type="text" name="value[N][2]" value="">
|
||||
<input type="hidden" name="value[N][4]" value="">
|
||||
<input type="hidden" name="value[N][5]" value="">
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<fieldset class="inputs">
|
||||
<dl class="form">
|
||||
<dt>
|
||||
<label for="fn"><?php echo $l->t('Display name'); ?></label>
|
||||
</dd>
|
||||
<dd>
|
||||
<input id="fn" type="text" name="fn" placeholder="<?php echo $l->t('How you want the name displayed in the list'); ?>" value="">
|
||||
</dd>
|
||||
<dt>
|
||||
<label for="org"><?php echo $l->t('Organization'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input id="org" type="text" name="value[ORG]" value="">
|
||||
@@ -34,16 +61,16 @@
|
||||
<fieldset class="inputs">
|
||||
<dl class="form">
|
||||
<dt>
|
||||
<label class="label" for="email"><?php echo $l->t('Email'); ?></label>
|
||||
<label for="email"><?php echo $l->t('Email'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input id="email" type="text" name="value[EMAIL]" value="">
|
||||
<input id="email" type="email" name="value[EMAIL]" value="">
|
||||
</dd>
|
||||
<dt>
|
||||
<label for="tel"><?php echo $l->t('Telephone'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="phone" id="tel" name="value[TEL]" value="">
|
||||
<input type="tel" id="tel" name="value[TEL]" value="">
|
||||
<select id="TEL" name="parameters[TEL][TYPE][]" multiple="multiple">
|
||||
<?php echo html_select_options($_['phone_types'], 'CELL') ?>
|
||||
</select>
|
||||
@@ -54,7 +81,7 @@
|
||||
<legend><?php echo $l->t('Address'); ?></legend>
|
||||
<dl class="form">
|
||||
<dt>
|
||||
<label class="label" for="adr_type"><?php echo $l->t('Type'); ?></label>
|
||||
<label for="adr_type"><?php echo $l->t('Type'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<select id="adr_type" name="parameters[ADR][TYPE]" size="1">
|
||||
@@ -62,44 +89,48 @@
|
||||
</select>
|
||||
</dd>
|
||||
<dt>
|
||||
<label class="label" for="adr_pobox"><?php echo $l->t('PO Box'); ?></label>
|
||||
<label for="adr_pobox"><?php echo $l->t('PO Box'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="adr_pobox" name="value[ADR][0]" value="">
|
||||
<input type="text" id="adr_pobox" name="value[ADR][0]" placeholder="<?php echo $l->t('Post Office box'); ?>" value="">
|
||||
</dd>
|
||||
<dd>
|
||||
<dt>
|
||||
<!-- dt>
|
||||
<label class="label" for="adr_extended"><?php echo $l->t('Extended'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="adr_extended" name="value[ADR][1]" value="">
|
||||
</dd>
|
||||
</dd -->
|
||||
<dt>
|
||||
<label class="label" for="adr_street"><?php echo $l->t('Street'); ?></label>
|
||||
<label for="adr_street"><?php echo $l->t('Street'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="adr_street" name="value[ADR][2]" value="">
|
||||
<input style="width: 12em;" type="text" id="adr_street" name="value[ADR][2]" placeholder="<?php echo $l->t('Street name and no.'); ?>" value="">
|
||||
<label for="adr_extended"><?php echo $l->t('Extended'); ?></label>
|
||||
<input style="width: 7em;" type="text" id="adr_extended" name="value[ADR][1]" placeholder="<?php echo $l->t('Apart. no., floor'); ?>" value="">
|
||||
</dd>
|
||||
<dt>
|
||||
<label class="label" for="adr_city"><?php echo $l->t('City'); ?></label>
|
||||
<label for="adr_city"><?php echo $l->t('City'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="adr_city" name="value[ADR][3]" value="">
|
||||
<input style="width: 12em;" type="text" id="adr_city" name="value[ADR][3]" value="">
|
||||
<label for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
|
||||
<input style="width: 5em;" type="text" id="adr_zipcode" name="value[ADR][5]" value="">
|
||||
</dd>
|
||||
<dt>
|
||||
<label class="label" for="adr_region"><?php echo $l->t('Region'); ?></label>
|
||||
<label for="adr_region"><?php echo $l->t('Region'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="adr_region" name="value[ADR][4]" value="">
|
||||
<input type="text" id="adr_region" name="value[ADR][4]" placeholder="<?php echo $l->t('E.g. state or province'); ?>" value="">
|
||||
</dd>
|
||||
<dt>
|
||||
<!-- dt>
|
||||
<label class="label" for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="adr_zipcode" name="value[ADR][5]" value="">
|
||||
</dd>
|
||||
</dd -->
|
||||
<dt>
|
||||
<label class="label" for="adr_country"><?php echo $l->t('Country'); ?></label>
|
||||
<label for="adr_country"><?php echo $l->t('Country'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="adr_country" name="value[ADR][6]" value="">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php if(array_key_exists('FN',$_['details'])): ?>
|
||||
<?php echo $this->inc('part.property.FN', array('property' => $_['details']['FN'][0])); ?>
|
||||
<?php echo $this->inc('part.property.N', array('property' => $_['details']['N'][0])); ?>
|
||||
<a href="export.php?contactid=<?php echo $_['id']; ?>"><img class="svg action" id="contacts_downloadcard" src="<?php echo image_path('', 'actions/download.svg'); ?>" title="<?php echo $l->t('Download contact');?>" /></a>
|
||||
<img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" />
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
<div id="messagebox">
|
||||
<table width="100%" style="border: 0;">
|
||||
<tr>
|
||||
<th id="messagebox_msg"></th>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="messagebox_msg"></div>
|
||||
</di>
|
||||
|
||||
4
apps/contacts/templates/part.property.N.php
Normal file
4
apps/contacts/templates/part.property.N.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<p id="contacts_details_name_n" class="contacts_property" data-checksum="<?php echo $_['property']['checksum']; ?>">
|
||||
(<?php echo $_['property']['value'][0].', '.$_['property']['value'][1].' '.$_['property']['value'][2]; ?>)
|
||||
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
|
||||
</p>
|
||||
@@ -1,46 +1,79 @@
|
||||
<form id="contacts_setpropertyform">
|
||||
<input type="hidden" name="checksum" value="<?php echo $_['property']['checksum']; ?>">
|
||||
<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
|
||||
<?php if($_['property']['name']=='FN'): ?>
|
||||
<?php if($_['property']['name']=='N'): ?>
|
||||
<p class="contacts_property_name">
|
||||
<dl class="contacts_property_data form">
|
||||
<dt><label for="n1"><?php echo $l->t('Given name'); ?></label></dt>
|
||||
<dd><input id="n1" type="text" name="value[1]" value="<?php echo $_['property']['value'][1]; ?>"></dd>
|
||||
<dt><label for="n0"><?php echo $l->t('Family name'); ?></dt>
|
||||
<dd><input id="n0" type="text" name="value[0]" value="<?php echo $_['property']['value'][0]; ?>"></dd>
|
||||
<dt><label for="n2"><?php echo $l->t('Additional names'); ?></dt>
|
||||
<dd><input id="n2" type="text" name="value[2]" value="<?php echo $_['property']['value'][2]; ?>">
|
||||
<input id="n3" type="hidden" name="value[3]" value="<?php echo $_['property']['value'][3]; ?>">
|
||||
<input id="n4" type="hidden" name="value[4]" value="<?php echo $_['property']['value'][4]; ?>">
|
||||
</dd>
|
||||
</dl>
|
||||
</p>
|
||||
<?php elseif($_['property']['name']=='FN'): ?>
|
||||
<p class="contacts_property_data"><input id="fn" type="text" name="value" value="<?php echo $_['property']['value']; ?>"></p>
|
||||
<?php elseif($_['property']['name']=='ADR'): ?>
|
||||
<p class="contacts_property_name"><label for="adr_pobox"><?php echo $l->t('Address'); ?></label></p>
|
||||
<ol class="contacts_property_data" id="contacts_addresspart">
|
||||
<li class="input">
|
||||
<dl class="contacts_property_data form" id="contacts_addresspart">
|
||||
<dt>
|
||||
<label class="label" for="adr_type"><?php echo $l->t('Type'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<select id="adr_type" name="parameters[TYPE]" size="1">
|
||||
<?php echo html_select_options($_['adr_types'], strtoupper($_['property']['parameters']['TYPE'])) ?>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
</dd>
|
||||
<dt>
|
||||
<label for="adr_pobox"><?php echo $l->t('PO Box'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input id="adr_pobox" type="text" name="value[0]" value="<?php echo $_['property']['value'][0] ?>">
|
||||
</li>
|
||||
<li>
|
||||
</dd>
|
||||
<!-- dt>
|
||||
<label for="adr_extended"><?php echo $l->t('Extended'); ?></label>
|
||||
<input id="adr_extended" type="text" name="value[1]" value="<?php echo $_['property']['value'][1] ?>">
|
||||
</li>
|
||||
<li>
|
||||
</dt>
|
||||
<dd>
|
||||
<input style="width: 7em;" id="adr_extended" type="text" name="value[1]" value="<?php echo $_['property']['value'][1] ?>">
|
||||
</dd -->
|
||||
<dt>
|
||||
<label for="adr_street"><?php echo $l->t('Street'); ?></label>
|
||||
<input id="adr_street" type="text" name="value[2]" value="<?php echo $_['property']['value'][2] ?>">
|
||||
</li>
|
||||
<li>
|
||||
</dt>
|
||||
<dd>
|
||||
<input style="width: 12em;" id="adr_street" type="text" name="value[2]" value="<?php echo $_['property']['value'][2] ?>">
|
||||
<label for="adr_extended"><?php echo $l->t('Extended'); ?></label><input style="width: 7em;" id="adr_extended" type="text" name="value[1]" value="<?php echo $_['property']['value'][1] ?>">
|
||||
</dd>
|
||||
<dt>
|
||||
<label for="adr_city"><?php echo $l->t('City'); ?></label>
|
||||
<input id="adr_city" type="text" name="value[3]" value="<?php echo $_['property']['value'][3] ?>">
|
||||
</li>
|
||||
<li>
|
||||
<label for="adr_region"><?php echo $l->t('Region'); ?></label>
|
||||
<input id="adr_region" type="text" name="value[4]" value="<?php echo $_['property']['value'][4] ?>">
|
||||
</li>
|
||||
<li>
|
||||
</dt>
|
||||
<dd>
|
||||
<input style="width: 12em;" id="adr_city" type="text" name="value[3]" value="<?php echo $_['property']['value'][3] ?>">
|
||||
<label for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
|
||||
<input id="adr_zipcode" type="text" name="value[5]" value="<?php echo $_['property']['value'][5] ?>">
|
||||
</li>
|
||||
<li>
|
||||
<input style="width: 5em;" id="adr_zipcode" type="text" name="value[5]" value="<?php echo $_['property']['value'][5] ?>">
|
||||
</dd>
|
||||
<dt>
|
||||
<label for="adr_region"><?php echo $l->t('Region'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input id="adr_region" type="text" name="value[4]" value="<?php echo $_['property']['value'][4] ?>">
|
||||
</dd>
|
||||
<!-- dt>
|
||||
<label for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input style="width: 7em;" id="adr_zipcode" type="text" name="value[5]" value="<?php echo $_['property']['value'][5] ?>">
|
||||
</dd -->
|
||||
<dt>
|
||||
<label for="adr_country"><?php echo $l->t('Country'); ?></label>
|
||||
<input id="adr_country" type="text" name="value[6]" value="<?php echo $_['property']['value'][6] ?>">
|
||||
</li>
|
||||
</ol>
|
||||
</dt>
|
||||
<dd>
|
||||
<input style="width: 25em;" id="adr_country" type="text" name="value[6]" value="<?php echo $_['property']['value'][6] ?>">
|
||||
</dd>
|
||||
</dl>
|
||||
<?php elseif($_['property']['name']=='TEL'): ?>
|
||||
<p class="contacts_property_name"><label for="tel"><?php echo $l->t('Phone'); ?></label></p>
|
||||
<p class="contacts_property_data"><input id="tel" type="phone" name="value" value="<?php echo $_['property']['value'] ?>">
|
||||
|
||||
@@ -569,7 +569,13 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||
return $storage->getLocalFile($this->getInternalPath($source));
|
||||
}
|
||||
}
|
||||
|
||||
public function touch($path, $mtime=null){
|
||||
$source = $this->getSource($path);
|
||||
if ($source) {
|
||||
$storage = OC_Filesystem::getStorage($source);
|
||||
return $storage->touch($this->getInternalPath($source),$time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -28,7 +28,7 @@ require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
|
||||
// Get paramteres
|
||||
$filecontents = htmlspecialchars_decode($_POST['filecontents']);
|
||||
$filecontents = $_POST['filecontents'];
|
||||
$path = isset($_POST['path']) ? $_POST['path'] : '';
|
||||
$mtime = isset($_POST['mtime']) ? $_POST['mtime'] : '';
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<info>
|
||||
<id>files_texteditor</id>
|
||||
<name>Text Editor</name>
|
||||
<description>Simple plain text editor based on Ace editor.</description>
|
||||
<version>0.3</version>
|
||||
<licence>AGPL</licence>
|
||||
<author>Tom Needham</author>
|
||||
|
||||
@@ -11,7 +11,7 @@ function getFileExtension(file){
|
||||
function setSyntaxMode(ext){
|
||||
// Loads the syntax mode files and tells the editor
|
||||
var filetype = new Array();
|
||||
// Todo finish these
|
||||
// add file extensions like this: filetype["extension"] = "filetype":
|
||||
filetype["h"] = "c_cpp";
|
||||
filetype["c"] = "c_cpp";
|
||||
filetype["clj"] = "clojure";
|
||||
@@ -27,8 +27,14 @@ function setSyntaxMode(ext){
|
||||
filetype["js"] = "javascript";
|
||||
filetype["json"] = "json";
|
||||
filetype["latex"] = "latex";
|
||||
filetype["ly"] = "latex";
|
||||
filetype["ily"] = "latex";
|
||||
filetype["lua"] = "lua";
|
||||
filetype["markdown"] = "markdown"; // also: .md .markdown .mdown .mdwn
|
||||
filetype["markdown"] = "markdown";
|
||||
filetype["md"] = "markdown";
|
||||
filetype["mdown"] = "markdown";
|
||||
filetype["mdwn"] = "markdown";
|
||||
filetype["mkd"] = "markdown";
|
||||
filetype["ml"] = "ocaml";
|
||||
filetype["mli"] = "ocaml";
|
||||
filetype["pl"] = "perl";
|
||||
@@ -56,18 +62,16 @@ function setSyntaxMode(ext){
|
||||
|
||||
function showControls(filename,writeperms){
|
||||
// Loads the control bar at the top.
|
||||
$('.actions,#file_action_panel').fadeOut('slow').promise().done(function() {
|
||||
// Load the new toolbar.
|
||||
var editorcontrols;
|
||||
if(writeperms=="true"){
|
||||
var editorcontrols = '<button id="editor_save">'+t('files_texteditor','Save')+'</button><div class="separator"></div><label for="gotolineval">Go to line:</label><input type="text" id="gotolineval"><div class="separator"></div>';
|
||||
}
|
||||
var html = '<label for="editorseachval">Search:</label><input type="text" name="editorsearchval" id="editorsearchval"><div class="separator"></div><button id="editor_close">'+t('files_texteditor','Close')+'</button>';
|
||||
$('#controls').append(html);
|
||||
$('#editorbar').fadeIn('slow');
|
||||
var breadcrumbhtml = '<div class="crumb svg" id="breadcrumb_file" style="background-image:url("../core/img/breadcrumb.png")"><p>'+filename+'</p></div>';
|
||||
$('.actions').before(breadcrumbhtml).before(editorcontrols);
|
||||
});
|
||||
// Load the new toolbar.
|
||||
var editorbarhtml = '<div id="editorcontrols" style="display: none;"><div class="crumb svg last" id="breadcrumb_file" style="background-image:url("../core/img/breadcrumb.png")"><p>'+filename+'</p></div>';
|
||||
if(writeperms=="true"){
|
||||
editorbarhtml += '<button id="editor_save">'+t('files_texteditor','Save')+'</button><div class="separator"></div>';
|
||||
}
|
||||
editorbarhtml += '<label for="gotolineval">Go to line:</label><input stype="text" id="gotolineval"><label for="editorseachval">Search:</label><input type="text" name="editorsearchval" id="editorsearchval"><div class="separator"></div><button id="editor_close">'+t('files_texteditor','Close')+'</button></div>';
|
||||
// Change breadcrumb classes
|
||||
$('#controls .last').removeClass('last');
|
||||
$('#controls').append(editorbarhtml);
|
||||
$('#editorcontrols').fadeIn('slow');
|
||||
}
|
||||
|
||||
function bindControlEvents(){
|
||||
@@ -144,7 +148,7 @@ function doFileSave(){
|
||||
// Show saving spinner
|
||||
$("#editor_save").die('click',doFileSave);
|
||||
$('#save_result').remove();
|
||||
$('#editor_save').text(t('files_texteditor','Saving...'));//after('<img id="saving_icon" src="'+OC.filePath('core','img','loading.gif')+'"></img>');
|
||||
$('#editor_save').text(t('files_texteditor','Saving...'));
|
||||
// Get the data
|
||||
var filecontents = window.aceEditor.getSession().getValue();
|
||||
// Send the data
|
||||
@@ -182,8 +186,10 @@ function showFileEditor(dir,filename){
|
||||
// Save mtime
|
||||
$('#editor').attr('data-mtime', result.data.mtime);
|
||||
// Initialise the editor
|
||||
showControls(filename,result.data.write);
|
||||
$('.actions,#file_action_panel').fadeOut('slow');
|
||||
$('table').fadeOut('slow', function() {
|
||||
// Show the control bar
|
||||
showControls(filename,result.data.write);
|
||||
// Update document title
|
||||
document.title = filename;
|
||||
$('#editor').text(result.data.filecontents);
|
||||
@@ -191,6 +197,7 @@ function showFileEditor(dir,filename){
|
||||
$('#editor').attr('data-filename', filename);
|
||||
window.aceEditor = ace.edit("editor");
|
||||
aceEditor.setShowPrintMargin(false);
|
||||
aceEditor.getSession().setUseWrapMode(true);
|
||||
if(result.data.write=='false'){
|
||||
aceEditor.setReadOnly(true);
|
||||
}
|
||||
@@ -215,8 +222,9 @@ function showFileEditor(dir,filename){
|
||||
// Fades out the editor.
|
||||
function hideFileEditor(){
|
||||
// Fades out editor controls
|
||||
$('#controls > :not(.actions,#file_access_panel,.crumb),#breadcrumb_file').fadeOut('slow',function(){
|
||||
$('#editorcontrols').fadeOut('slow',function(){
|
||||
$(this).remove();
|
||||
$(".crumb:last").addClass('last');
|
||||
});
|
||||
// Fade out editor
|
||||
$('#editor').fadeOut('slow', function(){
|
||||
|
||||
33
apps/tasks/ajax/addtask.php
Normal file
33
apps/tasks/ajax/addtask.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
||||
$cid = $_POST['id'];
|
||||
$calendar = OC_Calendar_Calendar::findCalendar( $cid );
|
||||
if( $calendar === false || $calendar['userid'] != OC_USER::getUser()){
|
||||
OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your calendar!'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
$errors = OC_Task_VTodo::validateRequest($_POST, $l10n);
|
||||
if (!empty($errors)) {
|
||||
OC_JSON::error(array('data' => array( 'errors' => $errors )));
|
||||
exit();
|
||||
}
|
||||
|
||||
$vcalendar = OC_Task_VTodo::createVCalendarFromRequest($_POST);
|
||||
$id = OC_Calendar_Object::add($cid, $vcalendar->serialize());
|
||||
|
||||
$priority_options = OC_Task_VTodo::getPriorityOptions($l10n);
|
||||
$tmpl = new OC_Template('tasks','part.details');
|
||||
$tmpl->assign('priority_options', $priority_options);
|
||||
$tmpl->assign('details',$vcalendar->VTODO);
|
||||
$tmpl->assign('id',$id);
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
|
||||
15
apps/tasks/ajax/addtaskform.php
Normal file
15
apps/tasks/ajax/addtaskform.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
|
||||
$tmpl = new OC_Template('tasks','part.addtaskform');
|
||||
$tmpl->assign('calendars',$calendars);
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
OC_JSON::success(array('data' => array( 'page' => $page )));
|
||||
44
apps/tasks/ajax/delete.php
Normal file
44
apps/tasks/ajax/delete.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Addressbook
|
||||
*
|
||||
* @author Jakob Sack
|
||||
* @copyright 2011 Jakob Sack mail@jakobsack.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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
||||
$id = $_GET['id'];
|
||||
$task = OC_Calendar_Object::find( $id );
|
||||
if( $task === false ){
|
||||
OC_JSON::error(array('data' => array( 'message' => $l10n->t('Can not find Task!'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
$calendar = OC_Calendar_Calendar::findCalendar( $task['calendarid'] );
|
||||
if( $calendar === false || $calendar['userid'] != OC_USER::getUser()){
|
||||
OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your task!'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
OC_Calendar_Object::delete($id);
|
||||
OC_JSON::success(array('data' => array( 'id' => $id )));
|
||||
40
apps/tasks/ajax/edittask.php
Normal file
40
apps/tasks/ajax/edittask.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
||||
$id = $_POST['id'];
|
||||
$task = OC_Calendar_Object::find( $id );
|
||||
if( $task === false ){
|
||||
OC_JSON::error(array('data' => array( 'message' => $l10n->t('Can not find Task!'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
$calendar = OC_Calendar_Calendar::findCalendar( $task['calendarid'] );
|
||||
if( $calendar === false || $calendar['userid'] != OC_USER::getUser()){
|
||||
OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your task!'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
$errors = OC_Task_VTodo::validateRequest($_POST, $l10n);
|
||||
if (!empty($errors)) {
|
||||
OC_JSON::error(array('data' => array( 'errors' => $errors )));
|
||||
exit();
|
||||
}
|
||||
|
||||
$vcalendar = Sabre_VObject_Reader::read($task['calendardata']);
|
||||
OC_Task_VTodo::updateVCalendarFromRequest($_POST, $vcalendar);
|
||||
OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
||||
|
||||
$priority_options = OC_Task_VTodo::getPriorityOptions($l10n);
|
||||
$tmpl = new OC_Template('tasks','part.details');
|
||||
$tmpl->assign('priority_options', $priority_options);
|
||||
$tmpl->assign('details', $vcalendar->VTODO);
|
||||
$tmpl->assign('id', $id);
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
|
||||
43
apps/tasks/ajax/edittaskform.php
Normal file
43
apps/tasks/ajax/edittaskform.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
||||
$id = $_GET['id'];
|
||||
$task = OC_Calendar_Object::find( $id );
|
||||
if( $task === false ){
|
||||
OC_JSON::error(array('data' => array( 'message' => $l10n->t('Can not find Task!'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
$calendar = OC_Calendar_Calendar::findCalendar( $task['calendarid'] );
|
||||
if( $calendar === false || $calendar['userid'] != OC_USER::getUser()){
|
||||
OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your task!'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
$details = Sabre_VObject_Reader::read($task['calendardata'])->VTODO;
|
||||
$categories = array();
|
||||
if (isset($details->CATEGORIES)){
|
||||
$categories = explode(',', $details->CATEGORIES->value);
|
||||
$categories = array_map('trim', $categories);
|
||||
}
|
||||
|
||||
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
|
||||
$percent_options = range(0, 100, 10);
|
||||
$priority_options = OC_Task_VTodo::getPriorityOptions($l10n);
|
||||
|
||||
$tmpl = new OC_Template('tasks','part.edittaskform');
|
||||
$tmpl->assign('category_options', $category_options);
|
||||
$tmpl->assign('percent_options', $percent_options);
|
||||
$tmpl->assign('priority_options', $priority_options);
|
||||
$tmpl->assign('task',$task);
|
||||
$tmpl->assign('details',$details);
|
||||
$tmpl->assign('categories', $categories);
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
OC_JSON::success(array('data' => array( 'page' => $page )));
|
||||
21
apps/tasks/ajax/getdetails.php
Normal file
21
apps/tasks/ajax/getdetails.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('tasks');
|
||||
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
||||
$id = $_GET['id'];
|
||||
$task = OC_Calendar_Object::find($id);
|
||||
$details = Sabre_VObject_Reader::read($task['calendardata'])->VTODO;
|
||||
|
||||
$priority_options = OC_Task_VTodo::getPriorityOptions($l10n);
|
||||
$tmpl = new OC_Template('tasks','part.details');
|
||||
$tmpl->assign('priority_options', $priority_options);
|
||||
$tmpl->assign('details',$details);
|
||||
$tmpl->assign('id',$id);
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
|
||||
16
apps/tasks/appinfo/app.php
Normal file
16
apps/tasks/appinfo/app.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
$l=new OC_L10N('tasks');
|
||||
OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php';
|
||||
OC::$CLASSPATH['OC_Task_VTodo'] = 'apps/tasks/lib/vtodo.php';
|
||||
|
||||
OC_App::register( array(
|
||||
'order' => 11,
|
||||
'id' => 'tasks',
|
||||
'name' => 'Tasks' ));
|
||||
|
||||
OC_App::addNavigationEntry( array(
|
||||
'id' => 'tasks_index',
|
||||
'order' => 11,
|
||||
'href' => OC_Helper::linkTo( 'tasks', 'index.php' ),
|
||||
//'icon' => OC_Helper::imagePath( 'tasks', 'icon.png' ),
|
||||
'name' => $l->t('Tasks')));
|
||||
10
apps/tasks/appinfo/info.xml
Normal file
10
apps/tasks/appinfo/info.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>tasks</id>
|
||||
<name>Tasks</name>
|
||||
<version>0.1</version>
|
||||
<licence>AGPL</licence>
|
||||
<author>Bart Visscher</author>
|
||||
<require>2</require>
|
||||
<description>Tasks view from calendar</description>
|
||||
</info>
|
||||
4
apps/tasks/css/style.css
Normal file
4
apps/tasks/css/style.css
Normal file
@@ -0,0 +1,4 @@
|
||||
#task_details th { padding:2px; text-align:right ;vertical-align:top; }
|
||||
#task_details td { padding:2px; text-align:left ;vertical-align:top; }
|
||||
.error_msg{color:red;}
|
||||
.error{border-color:red;border-width:2px;}
|
||||
50
apps/tasks/index.php
Normal file
50
apps/tasks/index.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Tasks Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* 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_Util::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('tasks');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
|
||||
if( count($calendars) == 0){
|
||||
header('Location: ' . OC_HELPER::linkTo('calendar', 'index.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
|
||||
|
||||
$tasks = array();
|
||||
foreach( $calendars as $calendar ){
|
||||
$calendar_tasks = OC_Calendar_Object::all($calendar['id']);
|
||||
foreach( $calendar_tasks as $task ){
|
||||
if($task['objecttype']!='VTODO'){
|
||||
continue;
|
||||
}
|
||||
if(is_null($task['summary'])){
|
||||
continue;
|
||||
}
|
||||
$tasks[] = array( 'name' => $task['summary'], 'id' => $task['id'] );
|
||||
}
|
||||
}
|
||||
|
||||
if( !is_null($id) || count($tasks)){
|
||||
if(is_null($id)) $id = $tasks[0]['id'];
|
||||
$task = OC_Calendar_Object::find($id);
|
||||
$details = Sabre_VObject_Reader::read($task['calendardata'])->VTODO;
|
||||
}
|
||||
|
||||
OC_UTIL::addScript('tasks', 'tasks');
|
||||
OC_UTIL::addStyle('tasks', 'style');
|
||||
OC_APP::setActiveNavigationEntry('tasks_index');
|
||||
$output = new OC_Template('tasks', 'tasks', 'user');
|
||||
$output->assign('tasks', $tasks);
|
||||
$output->assign('details', $details);
|
||||
$output->assign('id',$id);
|
||||
$output -> printPage();
|
||||
113
apps/tasks/js/tasks.js
Normal file
113
apps/tasks/js/tasks.js
Normal file
@@ -0,0 +1,113 @@
|
||||
$(document).ready(function(){
|
||||
/*-------------------------------------------------------------------------
|
||||
* Actions for startup
|
||||
*-----------------------------------------------------------------------*/
|
||||
if( $('#tasks li').length > 0 ){
|
||||
$('#tasks li').first().addClass('active');
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Event handlers
|
||||
*-----------------------------------------------------------------------*/
|
||||
$('#tasks li').live('click',function(){
|
||||
var id = $(this).data('id');
|
||||
var oldid = $('#task_details').data('id');
|
||||
if(oldid != 0){
|
||||
$('#tasks li[data-id="'+oldid+'"]').removeClass('active');
|
||||
}
|
||||
$.getJSON('ajax/getdetails.php',{'id':id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$('#task_details').data('id',jsondata.data.id);
|
||||
$('#task_details').html(jsondata.data.page);
|
||||
$('#tasks li[data-id="'+jsondata.data.id+'"]').addClass('active');
|
||||
}
|
||||
else{
|
||||
alert(jsondata.data.message);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#tasks_delete').live('click',function(){
|
||||
var id = $('#task_details').data('id');
|
||||
$.getJSON('ajax/delete.php',{'id':id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$('#tasks [data-id="'+jsondata.data.id+'"]').remove();
|
||||
$('#task_details').data('id','');
|
||||
$('#task_details').html('');
|
||||
}
|
||||
else{
|
||||
alert(jsondata.data.message);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#tasks_newtask').click(function(){
|
||||
$.getJSON('ajax/addtaskform.php',{},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$('#task_details').data('id','');
|
||||
$('#task_details').html(jsondata.data.page);
|
||||
}
|
||||
else{
|
||||
alert(jsondata.data.message);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#tasks_addtaskform input[type="submit"]').live('click',function(){
|
||||
$.post('ajax/addtask.php',$('#tasks_addtaskform').serialize(),function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$('#task_details').data('id',jsondata.data.id);
|
||||
$('#task_details').html(jsondata.data.page);
|
||||
}
|
||||
else{
|
||||
alert(jsondata.data.message);
|
||||
}
|
||||
}, 'json');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#tasks_edit').live('click',function(){
|
||||
var id = $('#task_details').data('id');
|
||||
$.getJSON('ajax/edittaskform.php',{'id':id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$('#task_details').html(jsondata.data.page);
|
||||
}
|
||||
else{
|
||||
alert(jsondata.data.message);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#tasks_edittaskform #percent_complete').live('change',function(event){
|
||||
if ($(event.target).val() == 100){
|
||||
$('#tasks_edittaskform #complete').show();
|
||||
}else{
|
||||
$('#tasks_edittaskform #complete').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#tasks_edittaskform input[type="submit"]').live('click',function(){
|
||||
$.post('ajax/edittask.php',$('#tasks_edittaskform').serialize(),function(jsondata){
|
||||
$('.error_msg').remove();
|
||||
$('.error').removeClass('error');
|
||||
if(jsondata.status == 'success'){
|
||||
$('#task_details').data('id',jsondata.data.id);
|
||||
$('#task_details').html(jsondata.data.page);
|
||||
}
|
||||
else{
|
||||
var errors = jsondata.data.errors;
|
||||
for (k in errors){
|
||||
$('#'+k).addClass('error')
|
||||
.after('<span class="error_msg">'+errors[k]+'</span>');
|
||||
}
|
||||
$('.error_msg').effect('highlight', {}, 3000);
|
||||
$('.error').effect('highlight', {}, 3000);
|
||||
}
|
||||
}, 'json');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
186
apps/tasks/lib/vtodo.php
Normal file
186
apps/tasks/lib/vtodo.php
Normal file
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Calendar
|
||||
*
|
||||
* @author Bart Visscher
|
||||
* @copyright 2011 Bart Visscher bartv@thisnet.nl
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class manages our calendars
|
||||
*/
|
||||
class OC_Task_VTodo extends OC_Calendar_Object{
|
||||
public static function getPriorityOptions($l10n)
|
||||
{
|
||||
return array(
|
||||
'' => $l10n->t('Unspecified'),
|
||||
'1' => $l10n->t('1=highest'),
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => $l10n->t('5=medium'),
|
||||
'6' => '6',
|
||||
'7' => '7',
|
||||
'8' => '8',
|
||||
'9' => $l10n->t('9=lowest'),
|
||||
);
|
||||
}
|
||||
public static function validateRequest($request, $l10n)
|
||||
{
|
||||
$errors = array();
|
||||
if($request['summary'] == ''){
|
||||
$errors['summary'] = $l10n->t('Empty Summary');
|
||||
}
|
||||
|
||||
if(isset($request['categories']) && !is_array($request['categories'])){
|
||||
$errors['categories'] = $l10n->t('Not an array');
|
||||
}
|
||||
|
||||
try {
|
||||
$timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
new DateTime($request['due'], $timezone);
|
||||
} catch (Exception $e) {
|
||||
$errors['due'] = $l10n->t('Invalid date/time');
|
||||
}
|
||||
|
||||
if ($request['percent_complete'] < 0 || $request['percent_complete'] > 100){
|
||||
$errors['percent_complete'] = $l10n->t('Invalid percent complete');
|
||||
}
|
||||
if ($request['percent_complete'] == 100 && !empty($request['completed'])){
|
||||
try {
|
||||
$timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
new DateTime($request['completed'], $timezone);
|
||||
} catch (Exception $e) {
|
||||
$errors['completed'] = $l10n->t('Invalid date/time');
|
||||
}
|
||||
}
|
||||
|
||||
$priority_options = OC_Task_VTodo::getPriorityOptions($l10n);
|
||||
if (!in_array($request['priority'], array_keys($priority_options))) {
|
||||
$errors['priority'] = $l10n->t('Invalid priority');
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
public static function createVCalendarFromRequest($request)
|
||||
{
|
||||
$vcalendar = new Sabre_VObject_Component('VCALENDAR');
|
||||
$vcalendar->add('PRODID', 'ownCloud Calendar');
|
||||
$vcalendar->add('VERSION', '2.0');
|
||||
|
||||
$now = new DateTime();
|
||||
|
||||
$vtodo = new Sabre_VObject_Component('VTODO');
|
||||
$vcalendar->add($vtodo);
|
||||
|
||||
$created = new Sabre_VObject_Element_DateTime('CREATED');
|
||||
$created->setDateTime($now, Sabre_VObject_Element_DateTime::UTC);
|
||||
$vtodo->add($created);
|
||||
|
||||
$uid = self::createUID();
|
||||
$vtodo->add('UID',$uid);
|
||||
|
||||
return self::updateVCalendarFromRequest($request, $vcalendar);
|
||||
}
|
||||
|
||||
public static function updateVCalendarFromRequest($request, $vcalendar)
|
||||
{
|
||||
$summary = $request['summary'];
|
||||
$categories = $request['categories'];
|
||||
$priority = $request['priority'];
|
||||
$percent_complete = $request['percent_complete'];
|
||||
$completed = $request['completed'];
|
||||
$location = $request['location'];
|
||||
$due = $request['due'];
|
||||
$description = $request['description'];
|
||||
|
||||
$now = new DateTime();
|
||||
$vtodo = $vcalendar->VTODO[0];
|
||||
|
||||
$last_modified = new Sabre_VObject_Element_DateTime('LAST-MODIFIED');
|
||||
$last_modified->setDateTime($now, Sabre_VObject_Element_DateTime::UTC);
|
||||
$vtodo->__set('LAST-MODIFIED', $last_modified);
|
||||
|
||||
$dtstamp = new Sabre_VObject_Element_DateTime('DTSTAMP');
|
||||
$dtstamp->setDateTime($now, Sabre_VObject_Element_DateTime::UTC);
|
||||
$vtodo->DTSTAMP = $dtstamp;
|
||||
|
||||
$vtodo->SUMMARY = $summary;
|
||||
|
||||
if ($location != '') {
|
||||
$vtodo->LOCATION = $location;
|
||||
}else{
|
||||
unset($vtodo->LOCATION);
|
||||
}
|
||||
|
||||
if ($categories != '') {
|
||||
$vtodo->CATEGORIES = join(',',$categories);
|
||||
}else{
|
||||
unset($vtodo->CATEGORIES);
|
||||
}
|
||||
|
||||
if ($priority != '') {
|
||||
$vtodo->PRIORITY = $priority;
|
||||
}else{
|
||||
unset($vtodo->PRIORITY);
|
||||
}
|
||||
|
||||
if ($description != '') {
|
||||
$vtodo->DESCRIPTION = $description;
|
||||
}else{
|
||||
unset($vtodo->DESCRIPTION);
|
||||
}
|
||||
|
||||
if ($due) {
|
||||
$due_property = new Sabre_VObject_Element_DateTime('DUE');
|
||||
$timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$due_property->setDateTime(new DateTime($due, $timezone));
|
||||
$vtodo->DUE = $due_property;
|
||||
} else {
|
||||
unset($vtodo->DUE);
|
||||
}
|
||||
|
||||
if (!empty($percent_complete)) {
|
||||
$vtodo->__set('PERCENT-COMPLETE', $percent_complete);
|
||||
}else{
|
||||
$vtodo->__unset('PERCENT-COMPLETE');
|
||||
}
|
||||
|
||||
if ($percent_complete == 100){
|
||||
if (!$completed){
|
||||
$completed = 'now';
|
||||
}
|
||||
} else {
|
||||
$completed = null;
|
||||
}
|
||||
if ($completed) {
|
||||
$completed_property = new Sabre_VObject_Element_DateTime('COMPLETED');
|
||||
$timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$completed_property->setDateTime(new DateTime($completed, $timezone));
|
||||
$vtodo->COMPLETED = $completed_property;
|
||||
} else {
|
||||
unset($vtodo->COMPLETED);
|
||||
}
|
||||
|
||||
return $vcalendar;
|
||||
}
|
||||
}
|
||||
|
||||
15
apps/tasks/templates/part.addtaskform.php
Normal file
15
apps/tasks/templates/part.addtaskform.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<form id="tasks_addtaskform">
|
||||
<?php if(count($_['calendars'])==1): ?>
|
||||
<input type="hidden" name="id" value="<?php echo $_['calendars'][0]['id']; ?>">
|
||||
<?php else: ?>
|
||||
<label for="id"><?php echo $l->t('Calendar'); ?></label>
|
||||
<select name="id" size="1">
|
||||
<?php foreach($_['calendars'] as $calendar): ?>
|
||||
<option value="<?php echo $calendar['id']; ?>"><?php echo $calendar['displayname']; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<br>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->inc('part.taskform'); ?>
|
||||
<input type="submit" name="submit" value="<?php echo $l->t('Create Task'); ?>">
|
||||
</form>
|
||||
42
apps/tasks/templates/part.details.php
Normal file
42
apps/tasks/templates/part.details.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php if(isset($_['details']->SUMMARY)): ?>
|
||||
<table>
|
||||
<?php
|
||||
echo $this->inc('part.property', array('label' => $l->t('Summary'), 'property' => $_['details']->SUMMARY));
|
||||
if(isset($_['details']->LOCATION)):
|
||||
echo $this->inc('part.property', array('label' => $l->t('Location'), 'property' => $_['details']->LOCATION));
|
||||
endif;
|
||||
if(isset($_['details']->CATEGORIES)):
|
||||
echo $this->inc('part.property', array('label' => $l->t('Categories'), 'property' => $_['details']->CATEGORIES));
|
||||
endif;
|
||||
if(isset($_['details']->DUE)):
|
||||
echo $this->inc('part.property', array('label' => $l->t('Due'), 'property' => $_['details']->DUE[0]));
|
||||
endif;
|
||||
if(isset($_['details']->PRIORITY)):
|
||||
echo $this->inc('part.property', array('label' => $l->t('Priority'), 'property' => $_['details']->PRIORITY[0], 'options' => $_['priority_options']));
|
||||
endif;
|
||||
if($_['details']->__isset('PERCENT-COMPLETE') || isset($_['details']->COMPLETED)):
|
||||
?>
|
||||
<tr>
|
||||
<th>
|
||||
<?php echo $l->t('Complete') ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php if($_['details']->__isset('PERCENT-COMPLETE')):
|
||||
echo $_['details']->__get('PERCENT-COMPLETE')->value.' % ';
|
||||
endif;
|
||||
if(isset($_['details']->COMPLETED)):
|
||||
echo $l->t('on '). $l->l('datetime', $_['details']->COMPLETED[0]->getDateTime());
|
||||
endif;
|
||||
echo '</tr>';
|
||||
endif;
|
||||
if(isset($_['details']->DESCRIPTION)):
|
||||
echo $this->inc('part.property', array('label' => $l->t('Description'), 'property' => $_['details']->DESCRIPTION));
|
||||
endif; ?>
|
||||
</table>
|
||||
<form>
|
||||
<input type="button" id="tasks_delete" value="<?php echo $l->t('Delete');?>">
|
||||
<input type="button" id="tasks_edit" value="<?php echo $l->t('Edit');?>">
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<?php var_dump($_['details']); ?>
|
||||
<?php endif ?>
|
||||
5
apps/tasks/templates/part.edittaskform.php
Normal file
5
apps/tasks/templates/part.edittaskform.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<form id="tasks_edittaskform">
|
||||
<input type="hidden" name="id" value="<?php echo $_['task']['id']; ?>">
|
||||
<?php echo $this->inc('part.taskform'); ?>
|
||||
<input type="submit" name="submit" value="<?php echo $l->t('Update Task'); ?>">
|
||||
</form>
|
||||
22
apps/tasks/templates/part.property.php
Normal file
22
apps/tasks/templates/part.property.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<tr>
|
||||
<th>
|
||||
<?php echo $_['label'] ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
switch (get_class($_['property']))
|
||||
{
|
||||
case 'Sabre_VObject_Element_DateTime':
|
||||
echo $l->l('datetime', $_['property']->getDateTime());
|
||||
break;
|
||||
default:
|
||||
$value = $_['property']->value;
|
||||
if (isset($_['options']))
|
||||
{
|
||||
$value = $_['options'][$value];
|
||||
}
|
||||
echo nl2br($value);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
42
apps/tasks/templates/part.taskform.php
Normal file
42
apps/tasks/templates/part.taskform.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<label for="summary"><?php echo $l->t('Summary'); ?></label>
|
||||
<input type="text" id="summary" name="summary" placeholder="<?php echo $l->t('Summary of the task');?>" value="<?php echo isset($_['details']->SUMMARY) ? $_['details']->SUMMARY[0]->value : '' ?>">
|
||||
<br>
|
||||
<label for="location"><?php echo $l->t('Location'); ?></label>
|
||||
<input type="text" id="location" name="location" placeholder="<?php echo $l->t('Location of the task');?>" value="<?php echo isset($_['details']->LOCATION) ? $_['details']->LOCATION[0]->value : '' ?>">
|
||||
<br>
|
||||
<label for="categories"><?php echo $l->t('Categories'); ?></label>
|
||||
<select name="categories[]" multiple="multiple">
|
||||
<?php
|
||||
var_dump($_['categories']);
|
||||
foreach($_['category_options'] as $category){
|
||||
echo '<option value="' . $category . '"' . (in_array($category, $_['categories']) ? ' selected="selected"' : '') . '>' . $category . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br>
|
||||
<label for="due"><?php echo $l->t('Due'); ?></label>
|
||||
<input type="text" id="due" name="due" placeholder="<?php echo $l->t('Due date') ?>" value="<?php echo isset($_['details']->DUE) ? $l->l('datetime', $_['details']->DUE[0]->getDateTime()) : '' ?>">
|
||||
<br>
|
||||
<select name="percent_complete" id="percent_complete">
|
||||
<?php
|
||||
foreach($_['percent_options'] as $percent){
|
||||
echo '<option value="' . $percent . '"' . (($_['details']->__get('PERCENT-COMPLETE') && $percent == $_['details']->__get('PERCENT-COMPLETE')->value) ? ' selected="selected"' : '') . '>' . $percent . ' %</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label for="percent_complete"><?php echo $l->t('Complete'); ?></label>
|
||||
<span id="complete"<?php echo ($_['details']->__get('PERCENT-COMPLETE') && $_['details']->__get('PERCENT-COMPLETE')->value == 100) ? '' : ' style="display:none;"' ?>><label for="completed"><?php echo $l->t('completed on'); ?></label>
|
||||
<input type="text" id="completed" name="completed" value="<?php echo isset($_['details']->COMPLETED) ? $l->l('datetime', $_['details']->COMPLETED[0]->getDateTime()) : '' ?>"></span>
|
||||
<br>
|
||||
<label for="priority"><?php echo $l->t('Priority'); ?></label>
|
||||
<select name="priority">
|
||||
<?php
|
||||
foreach($_['priority_options'] as $priority => $label){
|
||||
echo '<option value="' . $priority . '"' . ((isset($_['details']->PRIORITY) && $priority == $_['details']->PRIORITY->value) ? ' selected="selected"' : '') . '>' . $label . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br>
|
||||
<label for="description"><?php echo $l->t('Description'); ?></label><br>
|
||||
<textarea placeholder="<?php echo $l->t('Description of the task');?>" name="description"><?php echo isset($_['details']->DESCRIPTION) ? $_['details']->DESCRIPTION[0]->value : '' ?></textarea>
|
||||
<br>
|
||||
3
apps/tasks/templates/part.tasks.php
Normal file
3
apps/tasks/templates/part.tasks.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php foreach( $_['tasks'] as $task ): ?>
|
||||
<li data-id="<?php echo $task['id']; ?>"><a href="index.php?id=<?php echo $task['id']; ?>"><?php echo $task['name']; ?></a> </li>
|
||||
<?php endforeach; ?>
|
||||
13
apps/tasks/templates/tasks.php
Normal file
13
apps/tasks/templates/tasks.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<div id="controls">
|
||||
<form>
|
||||
<input type="button" id="tasks_newtask" value="<?php echo $l->t('Add Task'); ?>">
|
||||
</form>
|
||||
</div>
|
||||
<div id="tasks" class="leftcontent">
|
||||
<ul>
|
||||
<?php echo $this->inc("part.tasks"); ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="task_details" class="rightcontent" data-id="<?php echo $_['id']; ?>">
|
||||
<?php echo $this->inc("part.details"); ?>
|
||||
</div>
|
||||
@@ -32,13 +32,13 @@ define('OC_USER_BACKEND_LDAP_DEFAULT_PORT', 389);
|
||||
define('OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME', 'uid');
|
||||
|
||||
// register user backend
|
||||
OC_User::useBackend( "LDAP" );
|
||||
OC_User::useBackend( 'LDAP' );
|
||||
|
||||
// add settings page to navigation
|
||||
$entry = array(
|
||||
'id' => "user_ldap_settings",
|
||||
'id' => 'user_ldap_settings',
|
||||
'order'=>1,
|
||||
'href' => OC_Helper::linkTo( "user_ldap", "settings.php" ),
|
||||
'href' => OC_Helper::linkTo( 'user_ldap', 'settings.php' ),
|
||||
'name' => 'LDAP'
|
||||
);
|
||||
// OC_App::addNavigationSubEntry( "core_users", $entry);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_display_name', 'ldap_tls', 'ldap_nocase');
|
||||
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_userlist_filter', 'ldap_login_filter', 'ldap_display_name', 'ldap_tls', 'ldap_nocase'. 'ldap_quota_def', 'ldap_quota_attr', 'ldap_email_attr');
|
||||
|
||||
if ($_POST) {
|
||||
foreach($params as $param){
|
||||
@@ -29,12 +29,12 @@ if ($_POST) {
|
||||
}
|
||||
elseif('ldap_tls' == $param) {
|
||||
// unchecked checkboxes are not included in the post paramters
|
||||
OC_Appconfig::setValue('user_ldap', $param, 0);
|
||||
OC_Appconfig::setValue('user_ldap', $param, 0);
|
||||
}
|
||||
elseif('ldap_nocase' == $param) {
|
||||
OC_Appconfig::setValue('user_ldap', $param, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,16 @@
|
||||
<p><label for="ldap_dn"><?php echo $l->t('Name');?></label><input type="text" id="ldap_dn" name="ldap_dn" value="<?php echo $_['ldap_dn']; ?>" />
|
||||
<label for="ldap_password"><?php echo $l->t('Password');?></label><input type="password" id="ldap_password" name="ldap_password" value="<?php echo $_['ldap_password']; ?>" />
|
||||
<small><?php echo $l->t('Leave both empty for anonymous bind for search, then bind with users credentials.');?></small></p>
|
||||
<p><label for="ldap_base"><?php echo $l->t('Base');?></label><input type="text" id="ldap_base" name="ldap_base" value="<?php echo $_['ldap_base']; ?>" />
|
||||
<label for="ldap_filter"><?php echo $l->t('Filter (use %%uid placeholder)');?></label><input type="text" id="ldap_filter" name="ldap_filter" value="<?php echo $_['ldap_filter']; ?>" /></p>
|
||||
<p><label for="ldap_base"><?php echo $l->t('Base');?></label><input type="text" id="ldap_base" name="ldap_base" value="<?php echo $_['ldap_base']; ?>" /></p>
|
||||
<p><label for="ldap_login_filter"><?php echo $l->t('User Login Filter');?></label><input type="text" id="ldap_login_filter" name="ldap_login_filter" value="<?php echo $_['ldap_login_filter']; ?>" /><small><?php echo $l->t('use %%uid placeholder, e.g. uid=%%uid');?></small></p>
|
||||
<p><label for="ldap_userlist_filter"><?php echo $l->t('User List Filter');?></label><input type="text" id="ldap_userlist_filter" name="ldap_userlist_filter" value="<?php echo $_['ldap_userlist_filter']; ?>" /><small><?php echo $l->t('without any placeholder, e.g. "objectClass=person".');?> </p>
|
||||
<p><label for="ldap_display_name"><?php echo $l->t('Display Name Field');?></label><input type="text" id="ldap_display_name" name="ldap_display_name" value="<?php echo $_['ldap_display_name']; ?>" />
|
||||
<small><?php echo $l->t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?></small></p>
|
||||
<p><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1"<?php if ($_['ldap_tls']) echo ' checked'; ?>><label for="ldap_tls"><?php echo $l->t('Use TLS');?></label></p>
|
||||
<p><input type="checkbox" id="ldap_nocase" name="ldap_nocase" value="1"<?php if ($_['ldap_nocase']) echo ' checked'; ?>><label for="ldap_nocase"><?php echo $l->t('Case insensitve LDAP server (Windows)');?></label></p>
|
||||
<p><label for="ldap_quota_attr">Quota Attribute</label><input type="text" id="ldap_quota_attr" name="ldap_quota_attr" value="<?php echo $_['ldap_quota_attr']; ?>" />
|
||||
<label for="ldap_quota_def">Quota Default</label><input type="text" id="ldap_quota_def" name="ldap_quota_def" value="<?php echo $_['ldap_quota_def']; ?>" />bytes</p>
|
||||
<p><label for="ldap_email_attr">Email Attribute</label><input type="text" id="ldap_email_attr" name="ldap_email_attr" value="<?php echo $_['ldap_email_attr']; ?>" /></p>
|
||||
<input type="submit" value="Save" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -32,10 +32,17 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||
protected $ldap_dn;
|
||||
protected $ldap_password;
|
||||
protected $ldap_base;
|
||||
protected $ldap_filter;
|
||||
protected $ldap_login_filter;
|
||||
protected $ldap_userlist_filter;
|
||||
protected $ldap_tls;
|
||||
protected $ldap_nocase;
|
||||
protected $ldap_display_name;
|
||||
protected $ldap_quota;
|
||||
protected $ldap_quota_def;
|
||||
protected $ldap_email;
|
||||
|
||||
// will be retrieved from LDAP server
|
||||
protected $ldap_dc = false;
|
||||
|
||||
function __construct() {
|
||||
$this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host','');
|
||||
@@ -43,16 +50,20 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||
$this->ldap_dn = OC_Appconfig::getValue('user_ldap', 'ldap_dn','');
|
||||
$this->ldap_password = OC_Appconfig::getValue('user_ldap', 'ldap_password','');
|
||||
$this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base','');
|
||||
$this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter','');
|
||||
$this->ldap_login_filter = OC_Appconfig::getValue('user_ldap', 'ldap_login_filter','');
|
||||
$this->ldap_userlist_filter = OC_Appconfig::getValue('user_ldap', 'ldap_userlist_filter','objectClass=person');
|
||||
$this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0);
|
||||
$this->ldap_nocase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0);
|
||||
$this->ldap_display_name = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME);
|
||||
$this->ldap_quota_attr = OC_Appconfig::getValue('user_ldap', 'ldap_quota_attr','');
|
||||
$this->ldap_quota_def = OC_Appconfig::getValue('user_ldap', 'ldap_quota_def','');
|
||||
$this->ldap_email_attr = OC_Appconfig::getValue('user_ldap', 'ldap_email_attr','');
|
||||
|
||||
if( !empty($this->ldap_host)
|
||||
&& !empty($this->ldap_port)
|
||||
&& ((!empty($this->ldap_dn) && !empty($this->ldap_password)) || (empty($this->ldap_dn) && empty($this->ldap_password)))
|
||||
&& !empty($this->ldap_base)
|
||||
&& !empty($this->ldap_filter)
|
||||
&& !empty($this->ldap_login_filter)
|
||||
&& !empty($this->ldap_display_name)
|
||||
)
|
||||
{
|
||||
@@ -66,6 +77,32 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||
ldap_unbind($this->ds);
|
||||
}
|
||||
|
||||
private function setQuota( $uid ) {
|
||||
if( !$this->ldap_dc )
|
||||
return false;
|
||||
|
||||
if(!empty($this->ldap_quota_attr)) {
|
||||
$quota = $this->ldap_dc[strtolower($this->ldap_quota_attr)][0];
|
||||
} else {
|
||||
$quota = false;
|
||||
}
|
||||
$quota = $quota != -1 ? $quota : $this->ldap_quota_def;
|
||||
OC_Preferences::setValue($uid, 'files', 'quota', OC_Helper::computerFileSize($quota));
|
||||
}
|
||||
|
||||
private function setEmail( $uid ) {
|
||||
if( !$this->ldap_dc )
|
||||
return false;
|
||||
|
||||
$email = OC_Preferences::getValue($uid, 'settings', 'email', '');
|
||||
if ( !empty( $email ) )
|
||||
return false;
|
||||
|
||||
$email = $this->ldap_dc[$this->ldap_email_attr][0];
|
||||
OC_Preferences::setValue($uid, 'settings', 'email', $email);
|
||||
}
|
||||
|
||||
//Connect to LDAP and store the resource
|
||||
private function getDs() {
|
||||
if(!$this->ds) {
|
||||
$this->ds = ldap_connect( $this->ldap_host, $this->ldap_port );
|
||||
@@ -74,18 +111,19 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||
if($this->ldap_tls)
|
||||
ldap_start_tls($this->ds);
|
||||
}
|
||||
|
||||
//TODO: Not necessary to perform a bind each time, is it?
|
||||
// login
|
||||
if(!empty($this->ldap_dn)) {
|
||||
$ldap_login = @ldap_bind( $this->ds, $this->ldap_dn, $this->ldap_password );
|
||||
if(!$ldap_login)
|
||||
if(!$ldap_login) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->ds;
|
||||
}
|
||||
|
||||
private function getDn( $uid ) {
|
||||
private function getDc( $uid ) {
|
||||
if(!$this->configured)
|
||||
return false;
|
||||
|
||||
@@ -95,35 +133,47 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||
return false;
|
||||
|
||||
// get dn
|
||||
$filter = str_replace('%uid', $uid, $this->ldap_filter);
|
||||
$filter = str_replace('%uid', $uid, $this->ldap_login_filter);
|
||||
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
|
||||
$entries = ldap_get_entries( $this->getDs(), $sr );
|
||||
|
||||
if( $entries['count'] == 0 )
|
||||
if( $entries['count'] == 0 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $entries[0]['dn'];
|
||||
$this->ldap_dc = $entries[0];
|
||||
|
||||
return $this->ldap_dc;
|
||||
}
|
||||
|
||||
public function checkPassword( $uid, $password ) {
|
||||
if(!$this->configured){
|
||||
return false;
|
||||
}
|
||||
$dn = $this->getDn( $uid );
|
||||
if( !$dn )
|
||||
$dc = $this->getDc( $uid );
|
||||
if( !$dc )
|
||||
return false;
|
||||
|
||||
if (!@ldap_bind( $this->getDs(), $dn, $password ))
|
||||
if (!@ldap_bind( $this->getDs(), $dc['dn'], $password )) {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if(!empty($this->ldap_quota_attr) || !empty($this->ldap_quota_def)) {
|
||||
$this->setQuota($uid);
|
||||
}
|
||||
|
||||
if(!empty($this->ldap_email_attr)) {
|
||||
$this->setEmail($uid);
|
||||
}
|
||||
|
||||
if($this->ldap_nocase) {
|
||||
$filter = str_replace('%uid', $uid, $this->ldap_filter);
|
||||
$filter = str_replace('%uid', $uid, $this->ldap_login_filter);
|
||||
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
|
||||
$entries = ldap_get_entries( $this->getDs(), $sr );
|
||||
if( $entries['count'] == 1 ) {
|
||||
foreach($entries as $row) {
|
||||
$ldap_display_name = strtolower($this->ldap_display_name);
|
||||
if(isset($row[$ldap_display_name])) {
|
||||
$ldap_display_name = strtolower($this->ldap_display_name);
|
||||
if(isset($row[$ldap_display_name])) {
|
||||
return $row[$ldap_display_name][0];
|
||||
}
|
||||
}
|
||||
@@ -131,35 +181,34 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||
else {
|
||||
return $uid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
return $uid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function userExists( $uid ) {
|
||||
if(!$this->configured){
|
||||
return false;
|
||||
}
|
||||
$dn = $this->getDn($uid);
|
||||
$dn = $this->getDc($uid);
|
||||
return !empty($dn);
|
||||
}
|
||||
|
||||
|
||||
public function getUsers()
|
||||
{
|
||||
if(!$this->configured)
|
||||
return false;
|
||||
|
||||
|
||||
// connect to server
|
||||
$ds = $this->getDs();
|
||||
if( !$ds )
|
||||
return false;
|
||||
|
||||
|
||||
// get users
|
||||
$filter = 'objectClass=person';
|
||||
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
|
||||
$sr = ldap_search( $this->getDs(), $this->ldap_base, $this->ldap_userlist_filter );
|
||||
$entries = ldap_get_entries( $this->getDs(), $sr );
|
||||
if( $entries['count'] == 0 )
|
||||
return false;
|
||||
@@ -169,7 +218,7 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||
// TODO ldap_get_entries() seems to lower all keys => needs review
|
||||
$ldap_display_name = strtolower($this->ldap_display_name);
|
||||
if(isset($row[$ldap_display_name])) {
|
||||
$users[] = $row[$ldap_display_name][0];
|
||||
$users[] = $row[$ldap_display_name][0];
|
||||
}
|
||||
}
|
||||
// TODO language specific sorting of user names
|
||||
|
||||
@@ -127,4 +127,4 @@ div.jp-play-bar, div.jp-seek-bar { padding:0; }
|
||||
li.error { width:640px; margin:4em auto; padding:1em 1em 1em 4em; background:#ffe .8em .8em no-repeat; color: #FF3B3B; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
|
||||
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { overflow: hidden; text-overflow: ellipsis; }
|
||||
.hint { background-image: url('/core/img/actions/info.png'); background-repeat:no-repeat; color: #777777; padding-left: 25px; background-position: 0 0.3em;}
|
||||
.separator { display: inline; border-left: 1px solid #d3d3d3; border-right: 1px solid #fff; height: 10px; width:0px; margin: 4px; }
|
||||
.separator { display: inline; border-left: 1px solid #d3d3d3; border-right: 1px solid #fff; height: 10px; width:0px; margin: 4px; }
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
|
||||
<field>
|
||||
<name>configvalue</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<type>clob</type>
|
||||
<notnull>true</notnull>
|
||||
<length>255</length>
|
||||
</field>
|
||||
|
||||
|
||||
|
||||
</declaration>
|
||||
|
||||
</table>
|
||||
@@ -405,7 +405,7 @@
|
||||
</declaration>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<table>
|
||||
|
||||
<name>*dbprefix*properties</name>
|
||||
|
||||
@@ -92,6 +92,15 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the last modification time of the file (mtime) to the value given
|
||||
* in the second parameter or to now if the second param is empty.
|
||||
* Even if the modification time is set to a custom value the access time is set to now.
|
||||
*/
|
||||
public function touch($mtime) {
|
||||
OC_Filesystem::touch($this->path, $mtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates properties on this node,
|
||||
*
|
||||
@@ -110,13 +119,16 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!array_key_exists( $propertyName, $existing )){
|
||||
$query = OC_DB::prepare( 'INSERT INTO *PREFIX*properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)' );
|
||||
$query->execute( array( OC_User::getUser(), $this->path, $propertyName,$propertyValue ));
|
||||
}
|
||||
else{
|
||||
$query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertyvalue = ? WHERE userid = ? AND propertypath = ? AND propertyname = ?' );
|
||||
$query->execute( array( $propertyValue,OC_User::getUser(), $this->path, $propertyName ));
|
||||
if( strcmp( $propertyName, "lastmodified")) {
|
||||
$this->touch($propertyValue);
|
||||
} else {
|
||||
if(!array_key_exists( $propertyName, $existing )){
|
||||
$query = OC_DB::prepare( 'INSERT INTO *PREFIX*properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)' );
|
||||
$query->execute( array( OC_User::getUser(), $this->path, $propertyName,$propertyValue ));
|
||||
} else {
|
||||
$query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertyvalue = ? WHERE userid = ? AND propertypath = ? AND propertyname = ?' );
|
||||
$query->execute( array( $propertyValue,OC_User::getUser(), $this->path, $propertyName ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,5 +53,6 @@ class OC_Filestorage{
|
||||
public function hash($type,$path,$raw){}
|
||||
public function free_space($path){}
|
||||
public function search($query){}
|
||||
public function touch($path, $mtime=null){}
|
||||
public function getLocalFile($path){}// get a path to a local version of the file, whether the original file is local or remote
|
||||
}
|
||||
|
||||
@@ -70,6 +70,21 @@ class OC_Filestorage_Local extends OC_Filestorage{
|
||||
public function fileatime($path){
|
||||
return fileatime($this->datadir.$path);
|
||||
}
|
||||
public function touch($path, $mtime=null){
|
||||
// sets the modification time of the file to the given value.
|
||||
// If mtime is nil the current time is set.
|
||||
// note that the access time of the file always changes to the current time.
|
||||
if(!is_null($mtime)){
|
||||
$result=touch( $this->datadir.$path, $mtime );
|
||||
}else{
|
||||
$result=touch( $this->datadir.$path);
|
||||
}
|
||||
if( $result ) {
|
||||
clearstatcache( true, $this->datadir.$path );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
public function file_get_contents($path){
|
||||
return file_get_contents($this->datadir.$path);
|
||||
}
|
||||
|
||||
@@ -369,6 +369,9 @@ class OC_Filesystem{
|
||||
static public function fileatime($path){
|
||||
return self::basicOperation('fileatime',$path);
|
||||
}
|
||||
static public function touch($path, $mtime=null){
|
||||
return self::basicOperation('touch',$path,array($mtime));
|
||||
}
|
||||
static public function file_get_contents($path){
|
||||
return self::basicOperation('file_get_contents',$path,array('read'));
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class OC_Setup {
|
||||
OC_Config::setValue('datadirectory', $datadir);
|
||||
OC_Config::setValue('dbtype', $dbtype);
|
||||
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
|
||||
OC_Config::setValue('installedat',microtime(true));
|
||||
OC_Config::setValue('installedat',microtime(true));
|
||||
OC_Config::setValue('lastupdatedat',microtime(true));
|
||||
if($dbtype == 'mysql') {
|
||||
$dbuser = $options['dbuser'];
|
||||
|
||||
@@ -78,4 +78,3 @@ class OC_Updater{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -62,7 +62,7 @@ class OC_Util {
|
||||
* @return array
|
||||
*/
|
||||
public static function getVersion(){
|
||||
return array(3,00,0);
|
||||
return array(3,00,1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ class OC_Util {
|
||||
* @return string
|
||||
*/
|
||||
public static function getVersionString(){
|
||||
return '3';
|
||||
return '2012 beta 1';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user