summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-08-09 10:42:50 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-08-09 10:42:50 -0400
commitec6aed847585565f703e0c8bef0b75782bfe4560 (patch)
treeae8e3a897143ea2198381dfb736ae82b2949dd49 /apps
parent9a8eb7298c16ea3c10019d04695be04d6205a701 (diff)
parent1419d7f2b02a2182eb746443b62572f1b4b3f655 (diff)
downloadnextcloud-server-ec6aed847585565f703e0c8bef0b75782bfe4560.tar.gz
nextcloud-server-ec6aed847585565f703e0c8bef0b75782bfe4560.zip
Merge branch 'master' into sharing
Diffstat (limited to 'apps')
-rw-r--r--apps/contacts/ajax/addcard.php54
-rw-r--r--apps/contacts/ajax/addphoto.php59
-rw-r--r--apps/contacts/ajax/addproperty.php73
-rw-r--r--apps/contacts/ajax/deletebook.php44
-rw-r--r--apps/contacts/ajax/deletecard.php50
-rw-r--r--apps/contacts/ajax/deleteproperty.php62
-rw-r--r--apps/contacts/ajax/getdetails.php (renamed from apps/contacts/details.php)9
-rw-r--r--apps/contacts/ajax/setphoto.php77
-rw-r--r--apps/contacts/ajax/setproperty.php93
-rw-r--r--apps/contacts/ajax/showaddcard.php39
-rw-r--r--apps/contacts/ajax/showaddproperty.php51
-rw-r--r--apps/contacts/ajax/showsetproperty.php62
-rw-r--r--apps/contacts/carddav.php20
-rw-r--r--apps/contacts/css/styles.css2
-rw-r--r--apps/contacts/index.php11
-rw-r--r--apps/contacts/js/interface.js148
-rw-r--r--apps/contacts/lib/addressbook.php73
-rw-r--r--apps/contacts/lib/connector_sabre.php26
-rw-r--r--apps/contacts/templates/_details.php4
-rw-r--r--apps/contacts/templates/index.php15
-rw-r--r--apps/contacts/templates/part.addcardform.php13
-rw-r--r--apps/contacts/templates/part.addpropertyform.php43
-rw-r--r--apps/contacts/templates/part.contacts.php (renamed from apps/contacts/templates/_contacts.php)2
-rw-r--r--apps/contacts/templates/part.details.php22
-rw-r--r--apps/contacts/templates/part.property.php50
-rw-r--r--apps/contacts/templates/part.setpropertyform.php21
-rw-r--r--apps/contacts/temporaryupdate.php20
-rw-r--r--apps/files_publiclink/appinfo/app.php2
-rw-r--r--apps/media/appinfo/app.php30
-rw-r--r--apps/media/css/music.css5
-rw-r--r--apps/media/css/player.css24
-rw-r--r--apps/media/index.php10
-rw-r--r--apps/media/js/collection.js152
-rw-r--r--apps/media/js/music.js20
-rw-r--r--apps/media/js/playlist.js10
-rw-r--r--apps/media/js/settings.js65
-rw-r--r--apps/media/templates/collection.php17
-rw-r--r--apps/media/templates/music.php74
-rw-r--r--apps/media/templates/player.php22
-rw-r--r--apps/media/templates/playlist.php30
-rw-r--r--apps/media/templates/settings.php23
-rw-r--r--apps/user_ldap/appinfo/app.php2
-rw-r--r--apps/user_openid/appinfo/app.php2
-rw-r--r--apps/user_openid/js/settings.js12
-rw-r--r--apps/user_openid/settings.php10
-rw-r--r--apps/user_openid/templates/settings.php6
46 files changed, 1302 insertions, 357 deletions
diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php
new file mode 100644
index 00000000000..24766931d71
--- /dev/null
+++ b/apps/contacts/ajax/addcard.php
@@ -0,0 +1,54 @@
+<?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');
+
+$aid = $_POST['id'];
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $aid );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your addressbook!'))));
+ exit();
+}
+
+$fn = $_POST['fn'];
+
+$vcard = new Sabre_VObject_Component('VCARD');
+$vcard->add(new Sabre_VObject_Property('FN',$fn));
+$vcard->add(new Sabre_VObject_Property('UID',OC_Contacts_Addressbook::createUID()));
+$id = OC_Contacts_Addressbook::addCard($aid,$vcard->serialize());
+
+$details = OC_Contacts_Addressbook::structureContact($vcard);
+$tmpl = new OC_Template('contacts','part.details');
+$tmpl->assign('details',$details);
+$tmpl->assign('id',$id);
+$page = $tmpl->fetchPage();
+
+echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'page' => $page )));
diff --git a/apps/contacts/ajax/addphoto.php b/apps/contacts/ajax/addphoto.php
new file mode 100644
index 00000000000..03d5e6b3ceb
--- /dev/null
+++ b/apps/contacts/ajax/addphoto.php
@@ -0,0 +1,59 @@
+<?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');
+
+$id = $_POST['id'];
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+$card = OC_Contacts_Addressbook::findCard( $id );
+if( $card === false ){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
+ exit();
+}
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
+ exit();
+}
+
+$vcard = Sabre_VObject_Reader::read($card['carddata']);
+$mimetype = $_FILES['photo']['type'] ? $_FILES['photo']['type'] : 'image/jpeg';
+$photobase = base64_encode(file_get_contents($_FILES['photo']['tmp_name']));
+$photo = new Sabre_VObject_Property( 'PHOTO', $photobase );
+$photo->parameters[] = new Sabre_VObject_Parameter('TYPE',$mimetype);
+$photo->parameters[] = new Sabre_VObject_Parameter('ENCODING','b');
+$vcard->add($photo);
+
+$line = count($vcard->children) - 1;
+$checksum = md5($vcard->children[$line]->serialize());
+
+OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
+echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'line' => $line, 'checksum' => $checksum )));
diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php
new file mode 100644
index 00000000000..d92566d6a18
--- /dev/null
+++ b/apps/contacts/ajax/addproperty.php
@@ -0,0 +1,73 @@
+<?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');
+
+$id = $_POST['id'];
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+$card = OC_Contacts_Addressbook::findCard( $id );
+if( $card === false ){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
+ exit();
+}
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
+ exit();
+}
+
+$vcard = Sabre_VObject_Reader::read($card['carddata']);
+
+$name = $_POST['name'];
+$value = $_POST['value'];
+$parameters = isset($_POST['parameteres'])?$_POST['parameters']:array();
+
+if(is_array($value)){
+ $value = OC_Contacts_Addressbook::escapeSemicolons($value);
+}
+$property = new Sabre_VObject_Property( $name, $value );
+$parameternames = array_keys($parameters);
+foreach($parameternames as $i){
+ $property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]);
+}
+
+$vcard->add($property);
+
+$line = count($vcard->children) - 1;
+$checksum = md5($property->serialize());
+
+OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
+
+$tmpl = new OC_Template('contacts','part.property');
+$tmpl->assign('property',OC_Contacts_Addressbook::structureProperty($property,$line));
+$page = $tmpl->fetchPage();
+
+echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));
diff --git a/apps/contacts/ajax/deletebook.php b/apps/contacts/ajax/deletebook.php
new file mode 100644
index 00000000000..ba36c494cdf
--- /dev/null
+++ b/apps/contacts/ajax/deletebook.php
@@ -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');
+
+$id = $_GET['id'];
+
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $id );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
+ exit();
+}
+
+OC_Contacts_Addressbook::deleteAddressbook($id);
+echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id )));
diff --git a/apps/contacts/ajax/deletecard.php b/apps/contacts/ajax/deletecard.php
new file mode 100644
index 00000000000..839936d3fad
--- /dev/null
+++ b/apps/contacts/ajax/deletecard.php
@@ -0,0 +1,50 @@
+<?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');
+
+$id = $_GET['id'];
+
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+
+$card = OC_Contacts_Addressbook::findCard( $id );
+if( $card === false ){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
+ exit();
+}
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
+ exit();
+}
+
+OC_Contacts_Addressbook::deleteCard($id);
+echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id )));
diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php
new file mode 100644
index 00000000000..9f8b5dbbaf1
--- /dev/null
+++ b/apps/contacts/ajax/deleteproperty.php
@@ -0,0 +1,62 @@
+<?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');
+
+$id = $_GET['id'];
+$line = $_GET['line'];
+$checksum = $_GET['checksum'];
+
+
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+
+$card = OC_Contacts_Addressbook::findCard( $id );
+if( $card === false ){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
+ exit();
+}
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
+ exit();
+}
+
+$vcard = Sabre_VObject_Reader::read($card['carddata']);
+
+if(md5($vcard->children[$line]->serialize()) != $checksum ){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!'))));
+ exit();
+}
+
+unset($vcard->children[$line]);
+
+OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
+echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id )));
diff --git a/apps/contacts/details.php b/apps/contacts/ajax/getdetails.php
index 7ab1b64de24..4ee3625afc2 100644
--- a/apps/contacts/details.php
+++ b/apps/contacts/ajax/getdetails.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../lib/base.php');
+require_once('../../../lib/base.php');
$id = $_GET['id'];
@@ -29,7 +29,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
- echo $l10n->t('You need to log in!');
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
@@ -48,10 +48,9 @@ if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
$vcard = Sabre_VObject_Reader::read($card['carddata']);
$details = OC_Contacts_Addressbook::structureContact($vcard);
-
-$tmpl = new OC_Template('contacts','_details');
+$tmpl = new OC_Template('contacts','part.details');
$tmpl->assign('details',$details);
$tmpl->assign('id',$id);
$page = $tmpl->fetchPage();
-echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));
+echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'page' => $page )));
diff --git a/apps/contacts/ajax/setphoto.php b/apps/contacts/ajax/setphoto.php
new file mode 100644
index 00000000000..c29b5326027
--- /dev/null
+++ b/apps/contacts/ajax/setphoto.php
@@ -0,0 +1,77 @@
+<?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');
+
+$id = $_POST['id'];
+$line = $_POST['line'];
+$checksum = $_POST['checksum'];
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+$card = OC_Contacts_Addressbook::findCard( $id );
+if( $card === false ){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
+ exit();
+}
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
+ exit();
+}
+
+$vcard = Sabre_VObject_Reader::read($card['carddata']);
+$mimetype = $_FILES['photo']['type'] ? $_FILES['photo']['type'] : 'image/jpeg';
+$photobase = base64_encode(file_get_contents($_FILES['photo']['tmp_name']));
+
+if(md5($vcard->children[$line]->serialize()) != $checksum){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!'))));
+ exit();
+}
+
+// replace photo
+$vcard->children[$line]->setValue($photobase);
+$encoding = $type = false;
+foreach($vcard->children[$line]->parameters as &$parameter){
+ if($parameter->name == 'TYPE'){
+ $parameter->value = $mimetype;
+ $type = true;
+ }
+ elseif($parameter->name == 'ENCODING'){
+ $parameter->value = 'b';
+ $encoding = true;
+ }
+} unset($parameter);
+if(!$encoding) $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter('ENCODING','b');
+if(!$type) $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter('TYPE',$mimetype);
+
+$checksum = md5($vcard->children[$line]->serialize());
+
+OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
+echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'line' => $line, 'checksum' => $checksum )));
diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php
new file mode 100644
index 00000000000..6f33c68631a
--- /dev/null
+++ b/apps/contacts/ajax/setproperty.php
@@ -0,0 +1,93 @@
+<?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');
+
+$id = $_POST['id'];
+$line = $_POST['line'];
+$checksum = $_POST['checksum'];
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+$card = OC_Contacts_Addressbook::findCard( $id );
+if( $card === false ){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
+ exit();
+}
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
+ exit();
+}
+
+$vcard = Sabre_VObject_Reader::read($card['carddata']);
+
+if(md5($vcard->children[$line]->serialize()) != $checksum){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!'))));
+ exit();
+}
+
+// Set the value
+$value = $_POST['value'];
+if(is_array($value)){
+ $value = OC_Contacts_Addressbook::escapeSemicolons($value);
+}
+$vcard->children[$line]->setValue($value);
+
+// Add parameters
+$postparameters = isset($_POST['parameters'])?$_POST['parameters']:array();
+for($i=0;$i<count($vcard->children[$line]->parameters);$i++){
+ $name = $vcard->children[$line]->parameters[$i]->name;
+ if(array_key_exists($name,$postparameters)){
+ if($postparameters[$name] == '' || is_null($postparameters[$name])){
+ unset($vcard->children[$line]->parameters[$i]);
+ }
+ else{
+ $vcard->children[$line]->parameters[$i]->value = $postparameters[$name];
+ }
+ unset($postparameters[$name]);
+ }
+}
+$missingparameters = array_keys($postparameters);
+foreach($missingparameters as $i){
+ if(!$postparameters[$i] == '' && !is_null($postparameters[$i])){
+ $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($i,$postparameters[$i]);
+ }
+}
+
+// Do checksum and be happy
+$checksum = md5($vcard->children[$line]->serialize());
+
+OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
+
+$tmpl = new OC_Template('contacts','part.property');
+$tmpl->assign('property',OC_Contacts_Addressbook::structureProperty($vcard->children[$line],$line));
+$page = $tmpl->fetchPage();
+
+echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page, 'line' => $line, 'oldchecksum' => $_POST['checksum'] )));
diff --git a/apps/contacts/ajax/showaddcard.php b/apps/contacts/ajax/showaddcard.php
new file mode 100644
index 00000000000..41ebb41d3e9
--- /dev/null
+++ b/apps/contacts/ajax/showaddcard.php
@@ -0,0 +1,39 @@
+<?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');
+
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+$addressbooks = OC_Contacts_Addressbook::allAddressbooks(OC_USER::getUser());
+$tmpl = new OC_Template('contacts','part.addcardform');
+$tmpl->assign('addressbooks',$addressbooks);
+$page = $tmpl->fetchPage();
+
+echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));
diff --git a/apps/contacts/ajax/showaddproperty.php b/apps/contacts/ajax/showaddproperty.php
new file mode 100644
index 00000000000..becc39b120a
--- /dev/null
+++ b/apps/contacts/ajax/showaddproperty.php
@@ -0,0 +1,51 @@
+<?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');
+
+$id = $_GET['id'];
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+$card = OC_Contacts_Addressbook::findCard( $id );
+if( $card === false ){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
+ exit();
+}
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
+ exit();
+}
+
+$tmpl = new OC_Template('contacts','part.addpropertyform');
+$tmpl->assign('id',$id);
+$page = $tmpl->fetchPage();
+
+echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));
diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php
new file mode 100644
index 00000000000..75c3ff88f5f
--- /dev/null
+++ b/apps/contacts/ajax/showsetproperty.php
@@ -0,0 +1,62 @@
+<?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');
+
+$id = $_GET['id'];
+$line = $_GET['line'];
+$checksum = $_GET['checksum'];
+$l10n = new OC_L10N('contacts');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
+ exit();
+}
+
+$card = OC_Contacts_Addressbook::findCard( $id );
+if( $card === false ){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
+ exit();
+}
+
+$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
+if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
+ exit();
+}
+
+$vcard = Sabre_VObject_Reader::read($card['carddata']);
+if(md5($vcard->children[$line]->serialize()) != $checksum){
+ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!'))));
+ exit();
+}
+
+
+$tmpl = new OC_Template('contacts','part.setpropertyform');
+$tmpl->assign('id',$id);
+$tmpl->assign('checksum',$checksum);
+$tmpl->assign('property',OC_Contacts_Addressbook::structureProperty($vcard->children[$line],$line));
+$page = $tmpl->fetchPage();
+
+echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));
diff --git a/apps/contacts/carddav.php b/apps/contacts/carddav.php
index ae2c5b97363..581bf4a717b 100644
--- a/apps/contacts/carddav.php
+++ b/apps/contacts/carddav.php
@@ -1,4 +1,24 @@
<?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/>.
+ *
+ */
// Do not load FS ...
$RUNTIME_NOSETUPFS = true;
diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css
index 8d1c8b69c3f..c7680f4a716 100644
--- a/apps/contacts/css/styles.css
+++ b/apps/contacts/css/styles.css
@@ -1 +1 @@
-
+.contacts_propertyname {float:left;}
diff --git a/apps/contacts/index.php b/apps/contacts/index.php
index 1e01b1c9fbd..0d4ff83ef81 100644
--- a/apps/contacts/index.php
+++ b/apps/contacts/index.php
@@ -37,6 +37,12 @@ if( !OC_User::isLoggedIn()){
$addressbooks = OC_Contacts_Addressbook::allAddressbooks(OC_User::getUser());
if( count($addressbooks) == 0){
OC_Contacts_Addressbook::addAddressbook(OC_User::getUser(),'default','Default Address Book');
+ $addressbooks = OC_Contacts_Addressbook::allAddressbooks(OC_User::getUser());
+}
+$prefbooks = OC_Preferences::getValue(OC_User::getUser(),'contacts','openaddressbooks',null);
+if(is_null($prefbooks)){
+ $prefbooks = $addressbooks[0]['id'];
+ OC_Preferences::setValue(OC_User::getUser(),'contacts','openaddressbooks',$prefbooks);
}
// Load the files we need
@@ -48,7 +54,7 @@ $id = isset( $_GET['id'] ) ? $_GET['id'] : null;
// sort addressbooks (use contactsort)
usort($addressbooks,'contacts_namesort');
// Addressbooks to load
-$openaddressbooks = explode(';',OC_Preferences::getValue(OC_User::getUser(),'contacts','openaddressbooks',null));
+$openaddressbooks = explode(';',$prefbooks);
$contacts = array();
foreach( $openaddressbooks as $addressbook ){
@@ -63,7 +69,8 @@ usort($contacts,'contacts_namesort');
$details = array();
if( !is_null($id) || count($contacts)){
- $contact = OC_Contacts_Addressbook::findCard(is_null($id)?$contacts[0]['id']:$id);
+ if(is_null($id)) $id = $contacts[0]['id'];
+ $contact = OC_Contacts_Addressbook::findCard($id);
$vcard = Sabre_VObject_Reader::read($contact['carddata']);
$details = OC_Contacts_Addressbook::structureContact($vcard);
}
diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js
index 6af160b3927..0aae7d15d45 100644
--- a/apps/contacts/js/interface.js
+++ b/apps/contacts/js/interface.js
@@ -1,9 +1,15 @@
$(document).ready(function(){
- $('.contacts_contacts').find('li').live('click',function(){
+ /* $('.contacts_addressbooksexpander').click(function(){
+ $('.contacts_addressbooksdetails').toggle();
+ return false;
+ });*/
+
+ $('#contacts_contacts li').live('click',function(){
var id = $(this).attr('x-id');
- $.getJSON('details.php',{'id':id},function(jsondata){
+ $.getJSON('ajax/getdetails.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
- $('.contacts_details').html(jsondata.data.page);
+ $('#contacts_details').attr('x-id',jsondata.data.id);
+ $('#contacts_details').html(jsondata.data.page);
}
else{
alert(jsondata.data.message);
@@ -12,8 +18,140 @@ $(document).ready(function(){
return false;
});
- $('.contacts_addressbooksexpander').click(function(){
- $('.contacts_addressbooksdetails').toggle();
+ $('#contacts_deletecard').live('click',function(){
+ var id = $('#contacts_details').attr('x-id');
+ $.getJSON('ajax/deletecard.php',{'id':id},function(jsondata){
+ if(jsondata.status == 'success'){
+ $('#contacts_contacts [x-id="'+jsondata.data.id+'"]').remove();
+ $('#contacts_details').attr('x-id','');
+ $('#contacts_details').html('');
+ }
+ else{
+ alert(jsondata.data.message);
+ }
+ });
+ return false;
+ });
+
+ $('#contacts_addproperty').live('click',function(){
+ var id = $('#contacts_details').attr('x-id');
+ $.getJSON('ajax/showaddproperty.php',{'id':id},function(jsondata){
+ if(jsondata.status == 'success'){
+ $('#contacts_details').append(jsondata.data.page);
+ }
+ else{
+ alert(jsondata.data.message);
+ }
+ });
return false;
});
+
+ $('#contacts_addpropertyform [name="name"]').live('change',function(){
+ $('#contacts_addpropertyform #contacts_addresspart').remove();
+ $('#contacts_addpropertyform #contacts_phonepart').remove();
+ $('#contacts_addpropertyform #contacts_fieldpart').remove();
+ $('#contacts_addpropertyform #contacts_generic').remove();
+ if($(this).val() == 'ADR'){
+ $('#contacts_addresspart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
+ }
+ else if($(this).val() == 'TEL'){
+ $('#contacts_phonepart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
+ }
+ else if($(this).val() == 'NOTE'){
+ $('#contacts_fieldpart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
+ }
+ else{
+ $('#contacts_generic').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
+ }
+ });
+
+ $('#contacts_addpropertyform input[type="submit"]').live('click',function(){
+ $.post('ajax/addproperty.php',$('#contacts_addpropertyform').serialize(),function(jsondata){
+ if(jsondata.status == 'success'){
+ $('#contacts_details').append(jsondata.data.page);
+ $('#contacts_addpropertyform').remove();
+ }
+ else{
+ alert(jsondata.data.message);
+ }
+ }, 'json');
+ return false;
+ });
+
+ $('#contacts_newcontact').click(function(){
+ $.getJSON('ajax/showaddcard.php',{},function(jsondata){
+ if(jsondata.status == 'success'){
+ $('#contacts_details').attr('x-id','');
+ $('#contacts_details').html(jsondata.data.page);
+ }
+ else{
+ alert(jsondata.data.message);
+ }
+ });
+ return false;
+ });
+
+ $('#contacts_addcardform input[type="submit"]').live('click',function(){
+ $.post('ajax/addcard.php',$('#contacts_addcardform').serialize(),function(jsondata){
+ if(jsondata.status == 'success'){
+ $('#contacts_details').attr('x-id',jsondata.data.id);
+ $('#contacts_details').html(jsondata.data.page);
+ }
+ else{
+ alert(jsondata.data.message);
+ }
+ }, 'json');
+ return false;
+ });
+
+ $('.contacts_property [x-use="edit"]').live('click',function(){
+ var id = $('#contacts_details').attr('x-id');
+ var checksum = $(this).parent().parent().attr('x-checksum');
+ var line = $(this).parent().parent().attr('x-line');
+ $.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum, 'line': line },function(jsondata){
+ if(jsondata.status == 'success'){
+ $('.contacts_property[x-line="'+line+'"][x-checksum="'+checksum+'"] .contacts_propertyvalue').html(jsondata.data.page);
+ }
+ else{
+ alert(jsondata.data.message);
+ }
+ });
+ return false;
+ });
+
+ $('#contacts_setpropertyform input[type="submit"]').live('click',function(){
+ $.post('ajax/setproperty.php',$('#contacts_setpropertyform').serialize(),function(jsondata){
+ if(jsondata.status == 'success'){
+ $('.contacts_property[x-line="'+jsondata.data.line+'"][x-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page);
+ }
+ else{
+ alert(jsondata.data.message);
+ }
+ },'json');
+ return false;
+ });
+
+ $('.contacts_property [x-use="delete"]').live('click',function(){
+ var id = $('#contacts_details').attr('x-id');
+ var checksum = $(this).parent().parent().attr('x-checksum');
+ var line = $(this).parent().parent().attr('x-line');
+ $.getJSON('ajax/deleteproperty.php',{'id': id, 'checksum': checksum, 'line': line },function(jsondata){
+ if(jsondata.status == 'success'){
+ $('.contacts_property[x-line="'+line+'"][x-checksum="'+checksum+'"]').remove();
+ }
+ else{
+ alert(jsondata.data.message);
+ }
+ });
+ return false;
+ });
+
+
+ $('.contacts_property').live('mouseenter',function(){
+ $(this).find('span').show();
+ });
+
+ $('.contacts_property').live('mouseleave',function(){
+ $(this).find('span').hide();
+ });
});
diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php
index c0f26c7df55..cb7b0b4671a 100644
--- a/apps/contacts/lib/addressbook.php
+++ b/apps/contacts/lib/addressbook.php
@@ -78,7 +78,7 @@ class OC_Contacts_Addressbook{
$uris[] = $i['uri'];
}
- $uri = self::createURI('name', $uris );
+ $uri = self::createURI($name, $uris );
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($userid,$name,$uri,$description,1));
@@ -167,14 +167,14 @@ class OC_Contacts_Addressbook{
$uri = $property->value.'.vcf';
}
}
- $uri = self::createUID().'.vcf';
+ if(is_null($uri)) $uri = self::createUID().'.vcf';
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
- self::touch($id);
+ self::touchAddressbook($id);
- return OC_DB::insertid;
+ return OC_DB::insertid();
}
public static function addCardFromDAVData($id,$uri,$data){
@@ -189,13 +189,13 @@ class OC_Contacts_Addressbook{
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
- self::touch($id);
+ self::touchAddressbook($id);
- return OC_DB::insertid;
+ return OC_DB::insertid();
}
public static function editCard($id, $data){
- $oldcard = self::findCard($id,$aid,$uri);
+ $oldcard = self::findCard($id);
$fn = null;
$card = Sabre_VObject_Reader::read($data);
foreach($card->children as $property){
@@ -207,7 +207,7 @@ class OC_Contacts_Addressbook{
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
$result = $stmt->execute(array($fn,$data,time(),$id));
- self::touch($oldcard['addressbookid']);
+ self::touchAddressbook($oldcard['addressbookid']);
return true;
}
@@ -226,20 +226,20 @@ class OC_Contacts_Addressbook{
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
$result = $stmt->execute(array($fn,$data,time(),$oldcard['id']));
- self::touch($oldcard['addressbookid']);
+ self::touchAddressbook($oldcard['addressbookid']);
return true;
}
public static function deleteCard($id){
- $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
+ $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
$stmt->execute(array($id));
return true;
}
public static function deleteCardFromDAVData($aid,$uri){
- $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE addressbookid = ? AND uri=?' );
+ $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
$stmt->execute(array($aid,$uri));
return true;
@@ -265,23 +265,60 @@ class OC_Contacts_Addressbook{
return $userid;
}
+ public static function escapeSemicolons($value){
+ foreach($value as &$i ){
+ $i = implode("\\\\;", explode(';', $i));
+ } unset($i);
+ return implode(';',$value);
+ }
+
+ public static function unescapeSemicolons($value){
+ $array = explode(';',$value);
+ for($i=0;$i<count($array);$i++){
+ if(substr($array[$i],-2,2)=="\\\\"){
+ if(isset($array[$i+1])){
+ $array[$i] = substr($array[$i],0,count($array[$i])-2).';'.$array[$i+1];
+ unset($array[$i+1]);
+ }
+ else{
+ $array[$i] = substr($array[$i],0,count($array[$i])-2).';';
+ }
+ $i = $i - 1;
+ }
+ }
+ return $array;
+ }
+
public static function structureContact($object){
$details = array();
+ $line = 0;
foreach($object->children as $property){
- $temp = array(
- 'name' => $property->name,
- 'value' => ($property->name == 'PHOTO' || $property->name == 'LOGO' ? null : $property->value ),
- 'parameters' => array());
- foreach($property->parameters as $parameter){
- $temp['parameters'][] = array( 'name' => $parameter->name, 'value' => $parameter->value);
- }
+ $temp = self::structureProperty($property,$line);
if(array_key_exists($property->name,$details)){
$details[$property->name][] = $temp;
}
else{
$details[$property->name] = array($temp);
}
+ $line++;
}
return $details;
}
+
+ public static function structureProperty($property,$line=null){
+ $value = $property->value;
+ if($property->name == 'ADR'){
+ $value = self::unescapeSemicolons($value);
+ }
+ $temp = array(
+ 'name' => $property->name,
+ 'value' => $value,
+ 'line' => $line,
+ 'parameters' => array(),
+ 'checksum' => md5($property->serialize()));
+ foreach($property->parameters as $parameter){
+ $temp['parameters'][$parameter->name] = $parameter->value;
+ }
+ return $temp;
+ }
}
diff --git a/apps/contacts/lib/connector_sabre.php b/apps/contacts/lib/connector_sabre.php
index 98e2598b3a7..96a90dfc5de 100644
--- a/apps/contacts/lib/connector_sabre.php
+++ b/apps/contacts/lib/connector_sabre.php
@@ -1,13 +1,23 @@
<?php
-
/**
- * PDO CardDAV backend
- *
- * @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
+ * 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/>.
+ *
*/
/**
diff --git a/apps/contacts/templates/_details.php b/apps/contacts/templates/_details.php
deleted file mode 100644
index e27b17ef2eb..00000000000
--- a/apps/contacts/templates/_details.php
+++ /dev/null
@@ -1,4 +0,0 @@
-Name <?php echo $_['details']['FN'][0]['value']; ?>
-<?php if(array_key_exists('PHOTO',$_['details'])): ?>
- <img src="photo.php?id=<?php echo $_['id']; ?>">
-<?php endif; ?> \ No newline at end of file
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index ca189cb4c8a..e6dd45739bc 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -3,7 +3,8 @@ OC_Util::addScript('contacts','interface');
OC_Util::addStyle('contacts','styles');
?>
-<div class="contacts_addressbooks">
+<?php
+/*<div class="contacts_addressbooks">
<div class="contacts_addressbooksexpander">
Addressbooks
</div>
@@ -13,12 +14,14 @@ OC_Util::addStyle('contacts','styles');
<?php endforeach; ?>
<br>To use this addressbook, use .../apps/contacts/carddav.php/addressbooks/USERNAME/addressbookname.php
</div>
-</div>
-<div class="contacts_contacts leftcontent">
+</div>*/
+?>
+<div id="contacts_contacts" class="leftcontent">
<ul>
- <?php echo $this->inc("_contacts"); ?>
+ <?php echo $this->inc("part.contacts"); ?>
</ul>
+ <a id="contacts_newcontact"><?php echo $l->t('Add Contact'); ?></a>
</div>
-<div class="contacts_details rightcontent">
- <?php echo $this->inc("_details"); ?>
+<div id="contacts_details" class="rightcontent" x-id="<?php echo $_['id']; ?>">
+ <?php echo $this->inc("part.details"); ?>
</div>
diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php
new file mode 100644
index 00000000000..94a59fe097c
--- /dev/null
+++ b/apps/contacts/templates/part.addcardform.php
@@ -0,0 +1,13 @@
+<form id="contacts_addcardform">
+ <?php if(count($_['addressbooks'])==1): ?>
+ <input type="hidden" name="id" value="<?php echo $_['addressbooks'][0]['id']; ?>">
+ <?php else: ?>
+ <select name="id" size="1">
+ <?php foreach($_['addressbooks'] as $addressbook): ?>
+ <option value="<?php echo $addressbook['id']; ?>"><?php echo $addressbook['displayname']; ?></option>
+ <?php endforeach; ?>
+ </select>
+ <?php endif; ?>
+ <input type="text" name="fn" value=""><br>
+ <input type="submit">
+</form>
diff --git a/apps/contacts/templates/part.addpropertyform.php b/apps/contacts/templates/part.addpropertyform.php
new file mode 100644
index 00000000000..ff9090b76d8
--- /dev/null
+++ b/apps/contacts/templates/part.addpropertyform.php
@@ -0,0 +1,43 @@
+<form id="contacts_addpropertyform">
+ <input type="hidden" name="id" value="<?php echo $_['id']; ?>">
+ <select name="name" size="1">
+ <option value="BDAY"><?php echo $l->t('Birthday'); ?></option>
+ <option value="ADR"><?php echo $l->t('Address'); ?></option>
+ <option value="TEL"><?php echo $l->t('Telephone'); ?></option>
+ <option value="EMAIL" selected="selected"><?php echo $l->t('Email'); ?></option>
+ <option value="ORG"><?php echo $l->t('Organization'); ?></option>
+ </select>
+ <div id="contacts_generic">
+ <input type="text" name="value" value="">
+ </div>
+ <input type="submit">
+</form>
+<div id="contacts_addcontactsparts" style="display:none;">
+ <div id="contacts_addresspart">
+ <select name="parameters[TYPE]" size="1">
+ <option value="WORK"><?php echo $l->t('Work'); ?></option>
+ <option value="HOME" selected="selected"><?php echo $l->t('Home'); ?></option>
+ </select>
+ <?php echo $l->t('PO Box'); ?> <input type="text" name="value[0]" value="">
+ <?php echo $l->t('Extended Address'); ?> <input type="text" name="value[1]" value="">
+ <?php echo $l->t('Street Name'); ?> <input type="text" name="value[2]" value="">
+ <?php echo $l->t('City'); ?> <input type="text" name="value[3]" value="">
+ <?php echo $l->t('Region'); ?> <input type="text" name="value[4]" value="">
+ <?php echo $l->t('Postal Code'); ?> <input type="text" name="value[5]" value="">
+ <?php echo $l->t('Country'); ?> <input type="text" name="value[6]" value="">
+ </div>
+ <div id="contacts_phonepart">
+ <select name="parameters[TYPE]" size="1">
+ <option value="WORK"><?php echo $l->t('Work'); ?></option>
+ <option value="CELL" selected="selected"><?php echo $l->t('Mobile'); ?></option>
+ <option value="HOME"><?php echo $l->t('Home'); ?></option>
+ </select>
+ <input type="text" name="value" value="">
+ </div>
+ <div id="contacts_fieldpart">
+ <textarea type="text" name="value"></textarea>
+ </div>
+ <div id="contacts_generic">
+ <input type="text" name="value" value="">
+ </div>
+</div>
diff --git a/apps/contacts/templates/_contacts.php b/apps/contacts/templates/part.contacts.php
index bf633b79b04..fa6d4790cfc 100644
--- a/apps/contacts/templates/_contacts.php
+++ b/apps/contacts/templates/part.contacts.php
@@ -1,3 +1,3 @@
<?php foreach( $_['contacts'] as $contact ): ?>
- <li x-id="<?php echo $contact['id']; ?>"><a href="index.php?id=<?php echo $contact['id']; ?>"><?php echo $contact['name']; ?></a></li>
+ <li x-id="<?php echo $contact['id']; ?>"><a href="index.php?id=<?php echo $contact['id']; ?>"><?php echo $contact['name']; ?></a> </li>
<?php endforeach; ?>
diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php
new file mode 100644
index 00000000000..4aca8dbc790
--- /dev/null
+++ b/apps/contacts/templates/part.details.php
@@ -0,0 +1,22 @@
+<?php if(array_key_exists('PHOTO',$_['details'])): ?>
+ <img src="photo.php?id=<?php echo $_['id']; ?>">
+<?php endif; ?>
+<?php echo $this->inc('part.property', array('property' => $_['details']['FN'][0])); ?>
+<?php if(isset($_['details']['BDAY'])): // Emails first ?>
+ <?php echo $this->inc('part.property', array('property' => $_['details']['BDAY'][0])); ?>
+<?php endif; ?>
+<?php if(isset($_['details']['ORG'])): // Emails first ?>
+ <?php echo $this->inc('part.property', array('property' => $_['details']['ORG'][0])); ?>
+<?php endif; ?>
+
+<?php foreach(array('EMAIL','TEL','ADR') as $type): ?>
+ <?php if(isset($_['details'][$type])): // Emails first ?>
+ <br>
+ <?php foreach($_['details'][$type] as $property): ?>
+ <?php echo $this->inc('part.property',array('property' => $property )); ?>
+ <?php endforeach; ?>
+ <?php endif; ?>
+<?php endforeach; ?>
+
+<a id="contacts_deletecard"><img src="../../core/img/actions/delete.png"></a>
+<a id="contacts_addproperty"><img src="../../core/img/actions/download.png"></a>
diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php
new file mode 100644
index 00000000000..1a4266b3a2b
--- /dev/null
+++ b/apps/contacts/templates/part.property.php
@@ -0,0 +1,50 @@
+<div class="contacts_property" x-line="<?php echo $_['property']['line']; ?>" x-checksum="<?php echo $_['property']['checksum']; ?>">
+ <?php if($_['property']['name'] == 'FN'): ?>
+ <div class="contacts_propertyname"><?php echo $l->t('Name'); ?></div>
+ <div class="contacts_propertyvalue">
+ <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
+ <?php echo $_['property']['value']; ?>
+ </div>
+ <?php elseif($_['property']['name'] == 'BDAY'): ?>
+ <div class="contacts_propertyname"><?php echo $l->t('Birthday'); ?></div>
+ <div class="contacts_propertyvalue">
+ <?php echo $l->l('date',new DateTime($_['property']['value'])); ?>
+ <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
+ <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
+ </div>
+ <?php elseif($_['property']['name'] == 'ORG'): ?>
+ <div class="contacts_propertyname"><?php echo $l->t('Organisation'); ?></div>
+ <div class="contacts_propertyvalue">
+ <?php echo $_['property']['value']; ?>
+ <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
+ <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
+ </div>
+ <?php elseif($_['property']['name'] == 'EMAIL'): ?>
+ <div class="contacts_propertyname"><?php echo $l->t('Email'); ?></div>
+ <div class="contacts_propertyvalue">
+ <?php echo $_['property']['value']; ?>
+ <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
+ <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
+ </div>
+ <?php elseif($_['property']['name'] == 'TEL'): ?>
+ <div class="contacts_propertyname"><?php echo $l->t('Telefon'); ?></div>
+ <div class="contacts_propertyvalue">
+ <?php echo $_['property']['value']; ?>
+ <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
+ <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
+ </div>
+ <?php elseif($_['property']['name'] == 'ADR'): ?>
+ <div class="contacts_propertyname"><?php echo $l->t('Address'); ?></div>
+ <div class="contacts_propertyvalue">
+ <?php echo $l->t('PO Box'); ?> <?php echo $_['property']['value'][0]; ?><br>
+ <?php echo $l->t('Extended Address'); ?> <?php echo $_['property']['value'][1]; ?><br>
+ <?php echo $l->t('Street Name'); ?> <?php echo $_['property']['value'][2]; ?><br>
+ <?php echo $l->t('City'); ?> <?php echo $_['property']['value'][3]; ?><br>
+ <?php echo $l->t('Region'); ?> <?php echo $_['property']['value'][4]; ?><br>
+ <?php echo $l->t('Postal Code'); ?> <?php echo $_['property']['value'][5]; ?><br>
+ <?php echo $l->t('Country'); ?> <?php echo $_['property']['value'][6]; ?>
+ <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
+ <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
+ </div>
+ <?php endif; ?>
+</div>
diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php
new file mode 100644
index 00000000000..cd774ee6593
--- /dev/null
+++ b/apps/contacts/templates/part.setpropertyform.php
@@ -0,0 +1,21 @@
+<form id="contacts_setpropertyform">
+ <input type="hidden" name="checksum" value="<?php echo $_['property']['checksum']; ?>">
+ <input type="hidden" name="line" value="<?php echo $_['property']['line']; ?>">
+ <input type="hidden" name="id" value="<?php echo $_['id']; ?>">
+ <?php if($_['property']['name']=='ADR'): ?>
+ <?php echo $l->t('PO Box'); ?> <input type="text" name="value[0]" value="<?php echo $_['property']['value'][0]; ?>">
+ <?php echo $l->t('Extended Address'); ?> <input type="text" name="value[1]" value="<?php echo $_['property']['value'][1]; ?>">
+ <?php echo $l->t('Street Name'); ?> <input type="text" name="value[2]" value="<?php echo $_['property']['value'][2]; ?>">
+ <?php echo $l->t('City'); ?> <input type="text" name="value[3]" value="<?php echo $_['property']['value'][3]; ?>">
+ <?php echo $l->t('Region'); ?> <input type="text" name="value[4]" value="<?php echo $_['property']['value'][4]; ?>">
+ <?php echo $l->t('Postal Code'); ?> <input type="text" name="value[5]" value="<?php echo $_['property']['value'][5]; ?>">
+ <?php echo $l->t('Country'); ?> <input type="text" name="value[6]" value="<?php echo $_['property']['value'][6]; ?>">
+ <?php elseif($_['property']['name']=='TEL'): ?>
+ <input type="text" name="value" value="<?php echo $_['property']['value']; ?>">
+ <?php elseif($_['property']['name']=='NOTE'): ?>
+ <textarea type="text" name="value"><?php echo $_['property']['value']; ?></textarea>
+ <?php else: ?>
+ <input type="text" name="value" value="<?php echo $_['property']['value']; ?>">
+ <?php endif; ?>
+ <input type="submit">
+</form>
diff --git a/apps/contacts/temporaryupdate.php b/apps/contacts/temporaryupdate.php
index bb5ff7604f3..4b6453364e3 100644
--- a/apps/contacts/temporaryupdate.php
+++ b/apps/contacts/temporaryupdate.php
@@ -1,4 +1,24 @@
<?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');
$connector = new OC_Connector_Sabre_Principal;
diff --git a/apps/files_publiclink/appinfo/app.php b/apps/files_publiclink/appinfo/app.php
index 17646b3e5b5..e2d8d27c007 100644
--- a/apps/files_publiclink/appinfo/app.php
+++ b/apps/files_publiclink/appinfo/app.php
@@ -1,6 +1,6 @@
<?php
-OC_App::addNavigationSubEntry('files_index', array( "id" => "files_publiclink_administration", "order" => 1, "href" => OC_Helper::linkTo( "files_publiclink", "admin.php" ), "name" => "Public Links"));
+OC_App::addNavigationEntry(array( "id" => "files_publiclink_administration", "order" => 2, "href" => OC_Helper::linkTo( "files_publiclink", "admin.php" ), "name" => "Public Links"));
?>
diff --git a/apps/media/appinfo/app.php b/apps/media/appinfo/app.php
index 4cdb36d4504..bc80536a969 100644
--- a/apps/media/appinfo/app.php
+++ b/apps/media/appinfo/app.php
@@ -27,34 +27,4 @@ OC_Util::addScript('media','loader');
OC_App::register( array( 'order' => 3, 'id' => 'media', 'name' => 'Media' ));
OC_App::addNavigationEntry( array( 'id' => 'media_index', 'order' => 2, 'href' => OC_Helper::linkTo( 'media', 'index.php' ), 'icon' => OC_Helper::imagePath( 'media', 'media.png' ), 'name' => 'Music' ));
-
-// add subnavigations
-$entry = array(
- 'id' => "media_playlist",
- 'order'=>1,
- 'href' => '#playlist',
- 'name' => 'Playlist'
-);
-OC_App::addNavigationSubEntry( "media_index", $entry);
-$entry = array(
- 'id' => "media_collection",
- 'order'=>1,
- 'href' => '#collection',
- 'name' => 'Collection'
-);
-OC_App::addNavigationSubEntry( "media_index", $entry);
-// $entry = array(
-// 'id' => "media_recent",
-// 'order'=>1,
-// 'href' => '#recent',
-// 'name' => 'Most Recent'
-// );
-// OC_App::addNavigationSubEntry( "media_index", $entry);
-// $entry = array(
-// 'id' => "media_mostplayer",
-// 'order'=>1,
-// 'href' => '#mostplayed',
-// 'name' => 'Most Played'
-// );
-// OC_App::addNavigationSubEntry( "media_index", $entry);
?>
diff --git a/apps/media/css/music.css b/apps/media/css/music.css
index 3637234ab13..dd9b8ea70d9 100644
--- a/apps/media/css/music.css
+++ b/apps/media/css/music.css
@@ -3,7 +3,7 @@
li button.right.prettybutton{font-size:1em;}
#collection{padding-top:1em;position:relative;width:70ex;float:left;}
#collection li.album,#collection li.song{margin-left:3ex;}
-#playlist{width:100%;border-spacing:0;}
+#playlist{border-spacing:0;}
#playlist th{background-color:#ccc; text-align:left; font-size:1.2em; padding:0.2em}
#playlist tr.selected{background-color:#eee;}
#playlist tr.current{background-color:#ccc;}
@@ -12,7 +12,8 @@ li button.right.prettybutton{font-size:1em;}
#collection li,#playlist li{list-style-type:none;}
.template{display:none}
-#collection{display:none}/*hide the collection initially*/
#collection li{padding-right:10px;}
img.remove{float:right;}
#searchresults input.play, #searchresults input.add{float:right; height:16px; width:16px;}
+#collection tr.collapsed td.album, #collection tr.collapsed td.title{color:#ddd}
+a.expander{float:right;display:block}
diff --git a/apps/media/css/player.css b/apps/media/css/player.css
index 94dd4d63605..6cf424a8ea1 100644
--- a/apps/media/css/player.css
+++ b/apps/media/css/player.css
@@ -1,29 +1,25 @@
-#jp-interface{position:fixed;z-index:100;width:25em;left:201px;top:-20px;height:60px;border-bottom:none;}
-#jp-interface div.player{height:0px}
-#jp-interface ul.jp-controls{list-style-type:none;padding:0;}
-#jp-interface ul.jp-controls li{display:inline;}
-#jp-interface ul.jp-controls a{position:absolute;overflow:hidden;text-indent:-9999px;}
-a.jp-play,a.jp-pause{width:40px;height:40px;z-index:1;top:20px;left:48px;}
+#controls ul.jp-controls{list-style-type:none;padding:0;}
+#controls ul.jp-controls li{display:inline;}
+#controls ul.jp-controls a{position:absolute;overflow:hidden;text-indent:-9999px;}
+a.jp-play,a.jp-pause{width:40px;height:40px;z-index:1;top:0;left:48px;}
a.jp-play{background:url("../img/jplayer.blue.monday.png") 0 0 no-repeat;}
a.jp-play:hover{background:url("../img/jplayer.blue.monday.png") -41px 0 no-repeat;}
a.jp-pause{background:url("../img/jplayer.blue.monday.png") 0 -42px no-repeat;display:none;}
a.jp-pause:hover{background:url("../img/jplayer.blue.monday.png") -41px -42px no-repeat;}
-a.jp-stop{top:26px;left:126px;background:url("../img/jplayer.blue.monday.png") 0 -83px no-repeat;width:28px;height:28px;z-index:1;}
-a.jp-stop:hover{background:url("../img/jplayer.blue.monday.png") -29px -83px no-repeat;}
-a.jp-previous{left:20px;top:26px;background:url("../img/jplayer.blue.monday.png") 0 -112px no-repeat;width:28px;height:28px;}
+a.jp-previous{left:20px;top:.5em;background:url("../img/jplayer.blue.monday.png") 0 -112px no-repeat;width:28px;height:28px;}
a.jp-previous:hover{background:url("../img/jplayer.blue.monday.png") -29px -112px no-repeat;}
-a.jp-next{left:88px;top:26px;background:url("../img/jplayer.blue.monday.png") 0 -141px no-repeat;width:28px;height:28px;}
+a.jp-next{left:88px;top:.5em;background:url("../img/jplayer.blue.monday.png") 0 -141px no-repeat;width:28px;height:28px;}
a.jp-next:hover{background:url("../img/jplayer.blue.monday.png") -29px -141px no-repeat;}
-div.jp-progress{position:absolute;overflow:hidden;background-color:#293b51;top:32px;left:164px;width:122px;height:15px;}
+div.jp-progress{position:absolute;overflow:hidden;background-color:#293b51;top:1em;left:164px;width:122px;height:15px;}
div.jp-seek-bar{background:url("../img/jplayer.blue.monday.png") 0 -202px repeat-x;width:0;height:100%;cursor:pointer;}
div.jp-play-bar{background:url("../img/jplayer.blue.monday.png") 0 -218px repeat-x;width:0;height:100%;}
div.jp-seeking-bg{background:url("../img/pbar-ani.gif");}
-a.jp-mute,a.jp-unmute{height:15px;width:18px;top:32px;left:296px;}
+a.jp-mute,a.jp-unmute{height:15px;width:18px;top:1em;left:296px;}
a.jp-mute{background:url("../img/jplayer.blue.monday.png") 0 -186px no-repeat;}
a.jp-mute:hover{background:url("../img/jplayer.blue.monday.png") -19px -170px no-repeat;}
a.jp-unmute{background:url("../img/jplayer.blue.monday.png") 0 -170px no-repeat;display:none;}
a.jp-unmute:hover{background:url("../img/jplayer.blue.monday.png") -19px -186px no-repeat;}
-div.jp-volume-bar{position:absolute;overflow:hidden;background:url("../img/jplayer.blue.monday.png") 0 -250px repeat-x;width:46px;height:5px;cursor:pointer;top:37px;left:324px;}
+div.jp-volume-bar{position:absolute;overflow:hidden;background:url("../img/jplayer.blue.monday.png") 0 -250px repeat-x;width:46px;height:5px;cursor:pointer;top:1.3em;left:324px;}
div.jp-volume-bar-value{background:url("../img/jplayer.blue.monday.png") 0 -256px repeat-x;width:0;height:5px;}
-div.jp-current-time,div.jp-duration{position:absolute;font-size:.64em;font-style:oblique;top:45px;left:164px;width:122px;}
+div.jp-current-time,div.jp-duration{position:absolute;font-size:.64em;font-style:oblique;top:1em;left:164px;width:122px;}
div.jp-duration{text-align:right;}
diff --git a/apps/media/index.php b/apps/media/index.php
index a7128aaad42..fe724b45ddf 100644
--- a/apps/media/index.php
+++ b/apps/media/index.php
@@ -42,17 +42,9 @@ OC_Util::addScript('media','jquery.jplayer.min');
OC_Util::addStyle('media','player');
OC_Util::addStyle('media','music');
-OC_App::setActiveNavigationEntry( 'media_playlist' );
+OC_App::setActiveNavigationEntry( 'media_index' );
$tmpl = new OC_Template( 'media', 'music', 'user' );
-
-$player = new OC_Template( 'media', 'player');
-$playlist = new OC_Template( 'media', 'playlist');
-$collection= new OC_Template( 'media', 'collection');
-
-$tmpl->assign('player',$player->fetchPage());
-$tmpl->assign('playlist',$playlist->fetchPage());
-$tmpl->assign('collection',$collection->fetchPage());
$tmpl->printPage();
?>
diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js
index 520ce7d1129..df7b79e332d 100644
--- a/apps/media/js/collection.js
+++ b/apps/media/js/collection.js
@@ -49,68 +49,106 @@ Collection={
Collection.load(Collection.display)
}else{
if(Collection.parent){
- Collection.parent.children('li.artist').remove();
- var template=Collection.parent.children('li.template');
- for(var i=0;i<Collection.artists.length;i++){
- var artist=Collection.artists[i];
- var li=template.clone();
- li.data('artist',artist);
- li.removeClass('template');
- li.addClass('artist');
- li.data('type','artist');
- li.children('span').text(artist.artist_name);
- Collection.addButtons(li);
- Collection.parent.append(li);
- }
+ Collection.parent.find('tr:not(.template)').remove();
+ var template=Collection.parent.find('tr.template');
+ var lastArtist='';
+ var lastAlbum='';
+ $.each(Collection.artists,function(index,artist){
+ $.each(artist.albums,function(index,album){
+ $.each(album.songs,function(index,song){
+ var tr=template.clone().removeClass('template');
+ tr.find('td.title a').text(song.song_name);
+ tr.find('td.title a').click(function(event){
+ event.preventDefault();
+ PlayList.add(song);
+ PlayList.render();
+ });
+ if(artist.artist_name!=lastArtist){
+ tr.find('td.artist a').click(function(event){
+ event.preventDefault();
+ PlayList.add(artist);
+ PlayList.render();
+ });
+ tr.find('td.artist a').text(artist.artist_name);
+ if(artist.albums.length>1){
+ var expander=$('<a class="expander">&gt;</a>');
+ expander.data('expanded',true);
+ expander.click(function(event){
+ var tr=$(this).parent().parent();
+ if(expander.data('expanded')){
+ Collection.hideArtist(tr.data('artist'));
+ }else{
+ Collection.showArtist(tr.data('artist'));
+ }
+ });
+ tr.children('td.artist').append(expander);
+ }
+ }
+ if(album.album_name!=lastAlbum){
+ tr.find('td.album a').click(function(event){
+ event.preventDefault();
+ PlayList.add(album);
+ PlayList.render();
+ });
+ tr.find('td.album a').text(album.album_name);
+ if(album.songs.length>1){
+ var expander=$('<a class="expander">&gt;</a>');
+ expander.data('expanded',true);
+ expander.click(function(event){
+ var tr=$(this).parent().parent();
+ if(expander.data('expanded')){
+ Collection.hideAlbum(tr.data('album'));
+ }else{
+ Collection.showAlbum(tr.data('album'));
+ }
+ });
+ tr.children('td.album').append(expander);
+ }
+ }
+ tr.attr('data-artist',artist.artist_name);
+ tr.attr('data-album',album.album_name);
+ lastArtist=artist.artist_name;
+ lastAlbum=album.album_name;
+
+ Collection.parent.find('tbody').append(tr);
+ });
+ Collection.hideAlbum(artist.artist_name,album.album_name);
+ });
+ Collection.hideArtist(artist.artist_name);
+ });
}
}
},
+ showArtist:function(artist){
+ Collection.parent.find('tr[data-artist="'+artist+'"]').show();
+ Collection.parent.find('tr[data-artist="'+artist+'"]').first().removeClass('collapsed');
+ Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').data('expanded',true);
+ Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').addClass('expanded');
+ Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').text('v');
+ },
+ hideArtist:function(artist){
+ if(Collection.parent.find('tr[data-artist="'+artist+'"]').length>1){
+ Collection.parent.find('tr[data-artist="'+artist+'"]').hide();
+ Collection.parent.find('tr[data-artist="'+artist+'"]').first().show();
+ Collection.parent.find('tr[data-artist="'+artist+'"]').first().addClass('collapsed');
+ Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').data('expanded',false);
+ Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').removeClass('expanded');
+ Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').text('>');
+ }
+ },
+ showAlbum:function(artist,album){
+ Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').show();
+ },
+ hideAlbum:function(artist,album){
+ Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').hide();
+ Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').last().show();
+ },
parent:null,
hide:function(){
if(Collection.parent){
Collection.parent.hide();
}
},
- showAlbums:function(artistLi){
- $('ul.albums').parent().removeClass('active');
- $('ul.albums').remove();
- var artist=artistLi.data('artist');
- if(artist){
- var template=Collection.parent.children('li.template');
- var ul=$('<ul class="albums"></ul>');
- for(var i=0;i<artist.albums.length;i++){
- var li=template.clone();
- var album=artist.albums[i];
- li.removeClass('template');
- li.addClass('album');
- li.data('album',album);
- li.data('type','album');
- li.children('span').text(album.album_name);
- Collection.addButtons(li);
- ul.append(li);
- }
- artistLi.append(ul);
- }
- },
- showSongs:function(albumLi){
- $('ul.songs').parent().removeClass('active');
- $('ul.songs').remove();
- var album=albumLi.data('album');
- var template=Collection.parent.children('li.template');
- var ul=$('<ul class="songs"></ul>');
- for(var i=0;i<album.songs.length;i++){
- var li=template.clone();
- var song=album.songs[i];
- li.removeClass('template');
- li.addClass('song');
- li.data('song',song);
- li.data('type','song');
- li.children('span').text(song.song_name);
- Collection.addButtons(li);
- ul.append(li);
- }
- albumLi.append(ul);
- },
registerPlay:function(){
var item=PlayList.items[PlayList.current];
var song=Collection.findSong(item.artist,item.album,item.name);
@@ -198,14 +236,6 @@ Collection={
$(document).ready(function(){
Collection.parent=$('#collection');
Collection.load();
- $('#collection li.artist>span').live('click',function(){
- $(this).parent().toggleClass('active');
- Collection.showAlbums($(this).parent());
- });
- $('#collection li.album>span').live('click',function(){
- $(this).parent().toggleClass('active');
- Collection.showSongs($(this).parent());
- });
Collection.parent.hide();
$('#scan input.start').click(function(){
$('#scan input.start').hide();
diff --git a/apps/media/js/music.js b/apps/media/js/music.js
index 4e11b2951be..7034824cad8 100644
--- a/apps/media/js/music.js
+++ b/apps/media/js/music.js
@@ -1,23 +1,4 @@
$(document).ready(function(){
- //load the collection
- $('#navigation a[href="#collection"]').click(function(){
- $('#navigation li.subentry a.active').removeClass('active');
- $(this).addClass('active');
- PlayList.hide();
- Collection.display();
- });
- $('#navigation a[href="#playlist"]').click(function(){
- $('#navigation li.subentry a.active').removeClass('active');
- $(this).addClass('active');
- PlayList.render();
- Collection.hide();
- });
- var tab=window.location.href.slice(window.location.href.indexOf('#') + 1);
- PlayList.init('mp3',function(){
- if(tab=='collection'){
- $('#navigation a[href="#collection"]').trigger('click');
- }
- });
OC.search.customResults.Music=function(row,item){
var parts=item.link.substr(item.link.indexOf('#')+1).split('&');
var data={};
@@ -43,6 +24,7 @@ $(document).ready(function(){
});
row.find('div.name').append(button);
}
+ Collection.display();
});
diff --git a/apps/media/js/playlist.js b/apps/media/js/playlist.js
index a15c34f93f9..636ae29c555 100644
--- a/apps/media/js/playlist.js
+++ b/apps/media/js/playlist.js
@@ -10,19 +10,9 @@ PlayList.render=function(){
tr.removeClass('template');
tr.data('name',item.name);
tr.data('artist',item.artist);
- tr.data('album',item.album);
- tr.data('time',item.length);
- tr.data('plays',item.playcount);
tr.children('td.name').children('span').text(item.name);
tr.children('td.artist').text(item.artist);
tr.children('td.album').text(item.album);
- var secconds=(item.length%60);
- if(secconds<10){
- secconds='0'+secconds;
- }
- var length=Math.floor(item.length/60)+':'+secconds;
- tr.children('td.time').text(length);
- tr.children('td.plays').text(item.playcount);
tr.data('index',i);
tr.click(function(){
PlayList.play($(this).data('index'));
diff --git a/apps/media/js/settings.js b/apps/media/js/settings.js
deleted file mode 100644
index 3dabd86a497..00000000000
--- a/apps/media/js/settings.js
+++ /dev/null
@@ -1,65 +0,0 @@
-$(document).ready(function() {
- $("button.scan").click(function(event){
- event.preventDefault();
- var parent=$(this).parent().parent();
- var path=parent.children('input').val();
- scan(path);
- });
- $("button.rescan").live('click', function(event) {
- event.preventDefault();
- var parent=$(this).parent().parent();
- var path=parent.contents().filter(function(){ return(this.nodeType == 3); }).text();
- path=path.trim();
- scan(path);
- });
- $("button.delete").live('click', function(event) {
- event.preventDefault();
- var parent=$(this).parent().parent();
- var path=parent.contents().filter(function(){ return(this.nodeType == 3); }).text();
- path=path.trim();
- var data="action=delete&path="+path;
- $.ajax({
- type: 'POST',
- url: 'ajax/api.php',
- cache: false,
- data: data,
- success: function(){
- parent.remove();
- }
- });
- });
- $( "#scanpath" ).autocomplete({
- source: "../../files/ajax/autocomplete.php?dironly=true",
- minLength: 1
- });
- $('#autoupdate').change(function(){
- $.ajax({
- url: 'ajax/autoupdate.php',
- data: "autoupdate="+$(this).attr('checked')
- });
- })
-});
-
-function scan(path){
- var data="action=scan&path="+path;
- $.ajax({
- type: 'POST',
- url: 'ajax/api.php',
- cache: false,
- data: data,
- success: function(songCount){
- var found=false;
- $('#folderlist').children('li').each(function(){
- var otherPath=$(this).contents().filter(function(){ return(this.nodeType == 3); }).text();
- otherPath=otherPath.trim();
- if(otherPath==path){
- found=true;
- $(this).children("span").html(songCount+" songs <button class='rescan prettybutton'>Rescan</button></span>");
- }
- })
- if(!found){
- $('#folderlist').children().last().before("<li>"+path+"<span class='right'>"+songCount+" songs <button class='rescan prettybutton'>Rescan</button></span></li>");
- }
- }
- });
-}
diff --git a/apps/media/templates/collection.php b/apps/media/templates/collection.php
deleted file mode 100644
index f47cba24868..00000000000
--- a/apps/media/templates/collection.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<div id='scan'>
- <p id='scancount' style='display:none'><span class='songCount'>0</span> Songs scanned</p>
- <div id="scanprogressbar"></div>
- <input type='button' class='start' value='Recan Collection'></input>
- <input type='button' class='stop' style='display:none' value='Pause'></input>
-</div>
-<ul id='collection'>
- <li class='artist'>
- <img src="<?php echo image_path('files','loading.gif') ?>" alt='loading'/>Loading Collection...
- </li>
- <li class='template'>
- <span></span>
- <button class='add'>Add</button>
- <button class='play'>Play</button>
- </li>
-</ul>
-
diff --git a/apps/media/templates/music.php b/apps/media/templates/music.php
index 7a61d59c9ba..5d0b0b6f0c4 100644
--- a/apps/media/templates/music.php
+++ b/apps/media/templates/music.php
@@ -1,3 +1,71 @@
-<?php echo $_['player'];?>
-<?php echo $_['collection'];?>
-<?php echo $_['playlist'];?>
+<div id="controls">
+ <ul class="jp-controls">
+ <li><a href="#" class="jp-play" tabindex="1">play</a></li>
+ <li><a href="#" class="jp-pause" tabindex="1">pause</a></li>
+ <li><a href="#" class="jp-mute" tabindex="1">mute</a></li>
+ <li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li>
+ <li><a href="#" class="jp-previous" tabindex="1">previous</a></li>
+ <li><a href="#" class="jp-next" tabindex="1">next</a></li>
+ </ul>
+ <div class="jp-progress">
+ <div class="jp-seek-bar">
+ <div class="jp-play-bar"></div>
+ </div>
+ </div>
+ <div class="jp-volume-bar">
+ <div class="jp-volume-bar-value"></div>
+ </div>
+ <div class="jp-current-time"></div>
+ <div class="jp-duration"></div>
+ <div class="player" id="jp-player"></div>
+</div>
+
+<div id="leftcontent">
+<table id="playlist">
+ <thead>
+ <tr>
+ <th class="name"><input id="selectAll" type="checkbox">Name</th>
+ <th class="artist">Artist</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ The playlist is empty
+ </td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr class="template">
+ <td class="name">
+ <input type="checkbox">
+ <span></span>
+ </td>
+ <td class="artist"></td>
+ </tr>
+ </tfoot>
+</table>
+</div>
+
+<div id="rightcontent">
+<div id="scan">
+ <p id="scancount" style="display:none"><span class="songCount">0</span> Songs scanned</p>
+ <div id="scanprogressbar"></div>
+ <input type="button" class="start" value="Rescan Collection"></input>
+ <input type="button" class="stop" style="display:none" value="Pause"></input>
+</div>
+<table id="collection">
+ <thead>
+ <th>Artist</th>
+ <th>Album</th>
+ <th>Title</th>
+ </thead>
+ <tbody>
+ <tr class="template">
+ <td class="artist"><a/></td>
+ <td class="album"><a/></td>
+ <td class="title"><a/></td>
+ </tr>
+ </tbody>
+</table>
+</div>
diff --git a/apps/media/templates/player.php b/apps/media/templates/player.php
deleted file mode 100644
index 31b06e097bc..00000000000
--- a/apps/media/templates/player.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<div id="jp-interface">
- <ul class="jp-controls">
- <li><a href="#" class="jp-play" tabindex="1">play</a></li>
- <li><a href="#" class="jp-pause" tabindex="1">pause</a></li>
- <li><a href="#" class="jp-stop" tabindex="1">stop</a></li>
- <li><a href="#" class="jp-mute" tabindex="1">mute</a></li>
- <li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li>
- <li><a href="#" class="jp-previous" tabindex="1">previous</a></li>
- <li><a href="#" class="jp-next" tabindex="1">next</a></li>
- </ul>
- <div class="jp-progress">
- <div class="jp-seek-bar">
- <div class="jp-play-bar"></div>
- </div>
- </div>
- <div class="jp-volume-bar">
- <div class="jp-volume-bar-value"></div>
- </div>
- <div class="jp-current-time"></div>
- <div class="jp-duration"></div>
- <div class='player' id='jp-player'></div>
-</div>
diff --git a/apps/media/templates/playlist.php b/apps/media/templates/playlist.php
deleted file mode 100644
index bdc6ef59bb0..00000000000
--- a/apps/media/templates/playlist.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<table id='playlist'>
- <thead>
- <tr>
- <th class='name'><input id='selectAll' type='checkbox'>Name</th>
- <th class='artist'>Artist</th>
- <th class='album'>Album</th>
- <th class='time'>Time</th>
- <th class='plays'>Plays</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- The playlist is empty
- </td>
- </tr>
- </tbody>
- <tfoot>
- <tr class='template'>
- <td class='name'>
- <input type='checkbox'>
- <span></span>
- </td>
- <td class='artist'></td>
- <td class='album'></td>
- <td class='time'></td>
- <td class='plays'></td>
- </tr>
- </tfoot>
-</table> \ No newline at end of file
diff --git a/apps/media/templates/settings.php b/apps/media/templates/settings.php
deleted file mode 100644
index 45c60761507..00000000000
--- a/apps/media/templates/settings.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<form id="quota">
- <fieldset>
- <legend>Music Directories</legend>
- <ul id='folderlist'>
- <?php foreach($_['folders'] as $folder):?>
- <li>
- <?php echo $folder['name'];?>
- <span class='right'>
- <?php echo $folder['songs'];?> songs
- <button class='rescan prettybutton'>Rescan</button>
- <button class='delete prettybutton'>Delete</button>
- </span>
- </li>
- <?php endforeach; ?>
- <li>
- <input placeholder='path' id='scanpath'/>
- <span class='right'><button class='scan prettybutton'>Scan</button></span>
- </li>
- </ul>
- <label for="autoupdate" title='Automaticaly scan new files in above directories'>Auto Update</label>
- <input type='checkbox' <?php if($_['autoupdate']){echo 'checked="checked"';};?> id='autoupdate' title='Automaticaly scan new files in above directories'>
- </fieldset>
-</form> \ No newline at end of file
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php
index 7f20372ea8d..a6fca415012 100644
--- a/apps/user_ldap/appinfo/app.php
+++ b/apps/user_ldap/appinfo/app.php
@@ -36,4 +36,4 @@ $entry = array(
'href' => OC_Helper::linkTo( "user_ldap", "settings.php" ),
'name' => 'LDAP'
);
-OC_App::addNavigationSubEntry( "core_users", $entry);
+// OC_App::addNavigationSubEntry( "core_users", $entry);
diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php
index 93b178ac706..3cdf2664e81 100644
--- a/apps/user_openid/appinfo/app.php
+++ b/apps/user_openid/appinfo/app.php
@@ -19,6 +19,8 @@ if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'='))
OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName));
OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName));
+OC_APP::registerPersonal('user_openid','settings');
+
require_once 'apps/user_openid/user_openid.php';
//active the openid backend
diff --git a/apps/user_openid/js/settings.js b/apps/user_openid/js/settings.js
new file mode 100644
index 00000000000..b85ce2d3522
--- /dev/null
+++ b/apps/user_openid/js/settings.js
@@ -0,0 +1,12 @@
+$(document).ready(function(){
+ $('#openidform input').blur(function(event){
+ event.preventDefault();
+ var post = $( "#openidform" ).serialize();
+ $.post( 'ajax/openid.php', post, function(data){
+ if( data.status == "success" ){
+ }else{
+ alert('error while setting OpenID');
+ }
+ });
+ });
+});
diff --git a/apps/user_openid/settings.php b/apps/user_openid/settings.php
new file mode 100644
index 00000000000..d85eaebb5ee
--- /dev/null
+++ b/apps/user_openid/settings.php
@@ -0,0 +1,10 @@
+<?php
+
+$tmpl = new OC_Template( 'user_openid', 'settings');
+$identity=OC_Preferences::getValue(OC_User::getUser(),'user_openid','identity','');
+$tmpl->assign('identity',$identity);
+
+OC_Util::addScript('user_openid','settings');
+
+return $tmpl->fetchPage();
+?> \ No newline at end of file
diff --git a/apps/user_openid/templates/settings.php b/apps/user_openid/templates/settings.php
new file mode 100644
index 00000000000..fff1eff09e0
--- /dev/null
+++ b/apps/user_openid/templates/settings.php
@@ -0,0 +1,6 @@
+<form id="openidform">
+ <fieldset>
+ <legend><?php echo $l->t( 'OpenID' );?></legend>
+ <input type="text" name='identity' id='identity' value="<?php echo $_['identity']; ?>" placeholder="OpenID for <?php echo OC_User::getUser();?>" />
+ </fieldset>
+</form> \ No newline at end of file