summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/bookmarks/ajax/updateList.php60
-rw-r--r--apps/bookmarks/appinfo/app.php7
-rw-r--r--apps/bookmarks/js/bookmarksearch.js22
-rw-r--r--apps/bookmarks/l10n/xgettextfiles5
-rw-r--r--apps/bookmarks/lib/bookmarks.php117
-rw-r--r--apps/bookmarks/lib/search.php50
-rw-r--r--apps/contacts/ajax/addcard.php23
-rw-r--r--apps/contacts/ajax/addproperty.php15
-rw-r--r--apps/contacts/ajax/deleteproperty.php5
-rw-r--r--apps/contacts/ajax/setproperty.php6
-rw-r--r--apps/contacts/ajax/showsetproperty.php5
-rw-r--r--apps/contacts/css/styles.css58
-rw-r--r--apps/contacts/lib/app.php4
-rw-r--r--apps/contacts/lib/vcard.php2
-rw-r--r--apps/contacts/photo.php3
-rw-r--r--apps/contacts/templates/part.addcardform.php75
-rw-r--r--apps/contacts/templates/part.details.php1
-rw-r--r--apps/contacts/templates/part.messagebox.php6
-rw-r--r--apps/contacts/templates/part.property.N.php4
-rw-r--r--apps/contacts/templates/part.setpropertyform.php81
-rwxr-xr-xsettings/personal.php4
21 files changed, 389 insertions, 164 deletions
diff --git a/apps/bookmarks/ajax/updateList.php b/apps/bookmarks/ajax/updateList.php
index d2a5397452f..487e0d290e3 100644
--- a/apps/bookmarks/ajax/updateList.php
+++ b/apps/bookmarks/ajax/updateList.php
@@ -5,6 +5,7 @@
*
* @author Arthur Schiwon
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
+* @copyright 2012 David Iwanowitsch <david at unclouded dot de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -30,71 +31,20 @@ require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
-$params=array(OC_User::getUser());
-$CONFIG_DBTYPE = OC_Config::getValue( 'dbtype', 'sqlite' );
//Filter for tag?
-$filterTag = isset($_GET['tag']) ? '%' . htmlspecialchars_decode($_GET['tag']) . '%' : false;
-if($filterTag){
- $sqlFilterTag = 'HAVING tags LIKE ?';
- $params[] = $filterTag;
- if($CONFIG_DBTYPE == 'pgsql' ) {
- $sqlFilterTag = 'HAVING array_to_string(array_agg(tag), \' \') LIKE ?';
- }
-} else {
- $sqlFilterTag = '';
-}
+$filterTag = isset($_GET['tag']) ? htmlspecialchars_decode($_GET['tag']) : false;
$offset = isset($_GET['page']) ? intval($_GET['page']) * 10 : 0;
$sort = isset($_GET['sort']) ? ($_GET['sort']) : 'bookmarks_sorting_recent';
if($sort == 'bookmarks_sorting_clicks') {
- $sqlSort = 'clickcount DESC';
+ $sqlSortColumn = 'clickcount';
} else {
- $sqlSort = 'id DESC';
+ $sqlSortColumn = 'id';
}
-if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
- $_gc_separator = ', \' \'';
-} else {
- $_gc_separator = 'SEPARATOR \' \'';
-}
-
-if($CONFIG_DBTYPE == 'pgsql' ){
- $params[] = $offset;
- $query = OC_DB::prepare('
- SELECT id, url, title, array_to_string(array_agg(tag), \' \') as tags
- FROM *PREFIX*bookmarks
- LEFT JOIN *PREFIX*bookmarks_tags ON *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
- WHERE
- *PREFIX*bookmarks.user_id = ?
- GROUP BY id, url, title
- '.$sqlFilterTag.'
- ORDER BY *PREFIX*bookmarks.'.$sqlSort.'
- LIMIT 10
- OFFSET ?');
-} else {
- $query = OC_DB::prepare('
- SELECT id, url, title,
- CASE WHEN *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
- THEN GROUP_CONCAT( tag ' .$_gc_separator. ' )
- ELSE \' \'
- END
- AS tags
- FROM *PREFIX*bookmarks
- LEFT JOIN *PREFIX*bookmarks_tags ON 1=1
- WHERE (*PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
- OR *PREFIX*bookmarks.id NOT IN (
- SELECT *PREFIX*bookmarks_tags.bookmark_id FROM *PREFIX*bookmarks_tags
- )
- )
- AND *PREFIX*bookmarks.user_id = ?
- GROUP BY url
- '.$sqlFilterTag.'
- ORDER BY *PREFIX*bookmarks.'.$sqlSort.'
- LIMIT '.$offset.', 10');
-}
-$bookmarks = $query->execute($params)->fetchAll();
+$bookmarks = OC_Bookmarks_Bookmarks::findBookmarks($offset, $sqlSortColumn, $filterTag, true);
OC_JSON::success(array('data' => $bookmarks));
diff --git a/apps/bookmarks/appinfo/app.php b/apps/bookmarks/appinfo/app.php
index 44a1e47dff9..479d8ed4767 100644
--- a/apps/bookmarks/appinfo/app.php
+++ b/apps/bookmarks/appinfo/app.php
@@ -7,8 +7,13 @@
* See the COPYING-README file.
*/
+OC::$CLASSPATH['OC_Bookmarks_Bookmarks'] = 'apps/bookmarks/lib/bookmarks.php';
+
OC_App::register( array( 'order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks' ));
-OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OC_Helper::linkTo( 'bookmarks', 'index.php' ), 'icon' => OC_Helper::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => 'Bookmarks' ));
+$l = new OC_l10n('bookmarks');
+OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OC_Helper::linkTo( 'bookmarks', 'index.php' ), 'icon' => OC_Helper::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => $l->t('Bookmarks')));
OC_App::registerPersonal('bookmarks', 'settings');
+require_once('apps/bookmarks/lib/search.php');
+OC_Util::addScript('bookmarks','bookmarksearch');
diff --git a/apps/bookmarks/js/bookmarksearch.js b/apps/bookmarks/js/bookmarksearch.js
new file mode 100644
index 00000000000..e7a4fb18393
--- /dev/null
+++ b/apps/bookmarks/js/bookmarksearch.js
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2012 David Iwanowitsch <david at unclouded dot de>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+$(document).ready(function(){
+ OC.search.customResults['Bookm.'] = function(row,item){
+ var a=row.find('a');
+ a.attr('target','_blank');
+ a.click(recordClick);
+ }
+});
+
+function recordClick(event) {
+ var jsFileLocation = $('script[src*=bookmarksearch]').attr('src');
+ jsFileLocation = jsFileLocation.replace('js/bookmarksearch.js', '');
+ $.ajax({
+ url: jsFileLocation + 'ajax/recordClick.php',
+ data: 'url=' + encodeURI($(this).attr('href')),
+ });
+}
diff --git a/apps/bookmarks/l10n/xgettextfiles b/apps/bookmarks/l10n/xgettextfiles
new file mode 100644
index 00000000000..cd555432390
--- /dev/null
+++ b/apps/bookmarks/l10n/xgettextfiles
@@ -0,0 +1,5 @@
+../appinfo/app.php
+../lib/search.php
+../templates/settings.php
+../templates/addBm.php
+../templates/list.php
diff --git a/apps/bookmarks/lib/bookmarks.php b/apps/bookmarks/lib/bookmarks.php
new file mode 100644
index 00000000000..81c1b03981a
--- /dev/null
+++ b/apps/bookmarks/lib/bookmarks.php
@@ -0,0 +1,117 @@
+<?php
+/**
+ * ownCloud - bookmarks plugin
+ *
+ * @author Arthur Schiwon
+ * @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.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/>.
+ *
+ */
+
+/**
+ * This class manages bookmarks
+ */
+class OC_Bookmarks_Bookmarks{
+
+ /**
+ * @brief Finds all bookmarks, matching the filter
+ * @param offset result offset
+ * @param sqlSortColumn sort result with this column
+ * @param filter can be: empty -> no filter, a string -> filter this, a string array -> filter for all strings
+ * @param filterTagOnly if true, filter affacts only tags, else filter affects url, title and tags
+ * @return void
+ */
+ public static function findBookmarks($offset, $sqlSortColumn, $filter, $filterTagOnly){
+ //OC_Log::write('bookmarks', 'findBookmarks ' .$offset. ' '.$sqlSortColumn.' '. $filter.' '. $filterTagOnly ,OC_Log::DEBUG);
+ $CONFIG_DBTYPE = OC_Config::getValue( 'dbtype', 'sqlite' );
+
+ $params=array(OC_User::getUser());
+
+ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
+ $_gc_separator = ', \' \'';
+ } else {
+ $_gc_separator = 'SEPARATOR \' \'';
+ }
+
+ if($filter){
+ if($CONFIG_DBTYPE == 'pgsql' )
+ $tagString = 'array_to_string(array_agg(tag), \' \')';
+ else
+ $tagString = 'tags';
+
+ $sqlFilterTag = 'HAVING ';
+ if(is_array($filter)){
+ $first = true;
+ $filterstring = '';
+ foreach ($filter as $singleFilter){
+ $filterstring = $filterstring . ($first?'':' AND ') . $tagString.' LIKE ? ';
+ $params[] = '%'.$singleFilter.'%';
+ $first=false;
+ }
+ $sqlFilterTag = $sqlFilterTag . $filterstring;
+ } else{
+ $sqlFilterTag = $sqlFilterTag .$tagString.' LIKE ? ';
+ $params[] = '%'.$filter.'%';
+ }
+ } else {
+ $sqlFilterTag = '';
+ }
+
+ if($CONFIG_DBTYPE == 'pgsql' ){
+ $query = OC_DB::prepare('
+ SELECT id, url, title, '.($filterTagOnly?'':'url || title ||').' array_to_string(array_agg(tag), \' \') as tags
+ FROM *PREFIX*bookmarks
+ LEFT JOIN *PREFIX*bookmarks_tags ON *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
+ WHERE
+ *PREFIX*bookmarks.user_id = ?
+ GROUP BY id, url, title
+ '.$sqlFilterTag.'
+ ORDER BY *PREFIX*bookmarks.'.$sqlSortColumn.' DESC
+ LIMIT 10
+ OFFSET '. $offset);
+ } else {
+ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' )
+ $concatFunction = '(url || title || ';
+ else
+ $concatFunction = 'Concat(Concat( url, title), ';
+
+ $query = OC_DB::prepare('
+ SELECT id, url, title, '
+ .($filterTagOnly?'':$concatFunction).
+ 'CASE WHEN *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
+ THEN GROUP_CONCAT( tag ' .$_gc_separator. ' )
+ ELSE \' \'
+ END '
+ .($filterTagOnly?'':')').'
+ AS tags
+ FROM *PREFIX*bookmarks
+ LEFT JOIN *PREFIX*bookmarks_tags ON 1=1
+ WHERE (*PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
+ OR *PREFIX*bookmarks.id NOT IN (
+ SELECT *PREFIX*bookmarks_tags.bookmark_id FROM *PREFIX*bookmarks_tags
+ )
+ )
+ AND *PREFIX*bookmarks.user_id = ?
+ GROUP BY url
+ '.$sqlFilterTag.'
+ ORDER BY *PREFIX*bookmarks.'.$sqlSortColumn.' DESC
+ LIMIT '.$offset.', 10');
+ }
+
+ $bookmarks = $query->execute($params)->fetchAll();
+ return $bookmarks;
+ }
+}
+?>
diff --git a/apps/bookmarks/lib/search.php b/apps/bookmarks/lib/search.php
new file mode 100644
index 00000000000..59495db82ea
--- /dev/null
+++ b/apps/bookmarks/lib/search.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * ownCloud - bookmarks plugin
+ *
+ * @author David Iwanowitsch
+ * @copyright 2012 David Iwanowitsch <david at unclouded dot 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/>.
+ *
+ */
+
+class OC_Search_Provider_Bookmarks extends OC_Search_Provider{
+ function search($query){
+ $results=array();
+
+ $offset = 0;
+ $sqlSortColumn = 'id';
+
+ $searchquery=array();
+ if(substr_count($query, ' ') > 0){
+ $searchquery = explode(' ', $query);
+ }else{
+ $searchquery = $query;
+ }
+
+// OC_Log::write('bookmarks', 'search ' .$query ,OC_Log::DEBUG);
+ $bookmarks = OC_Bookmarks_Bookmarks::findBookmarks($offset, $sqlSortColumn, $searchquery, false);
+// OC_Log::write('bookmarks', 'found ' .count($bookmarks) ,OC_Log::DEBUG);
+ //$l = new OC_l10n('bookmarks'); //resulttype can't be localized, javascript relies on that type
+ foreach($bookmarks as $bookmark){
+ $results[]=new OC_Search_Result($bookmark['title'],'', $bookmark['url'],'Bookm.');
+ }
+
+ return $results;
+ }
+}
+new OC_Search_Provider_Bookmarks();
+
+?>
diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php
index 7e47659d23b..140d6a48095 100644
--- a/apps/contacts/ajax/addcard.php
+++ b/apps/contacts/ajax/addcard.php
@@ -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();
}
diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php
index f016820ce5f..c90af217c87 100644
--- a/apps/contacts/ajax/addproperty.php
+++ b/apps/contacts/ajax/addproperty.php
@@ -54,6 +54,21 @@ 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!
+}
+
$property = $vcard->addProperty($name, $value); //, $parameters);
$line = count($vcard->children) - 1;
diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php
index 89cf292f4f8..d745d3271db 100644
--- a/apps/contacts/ajax/deleteproperty.php
+++ b/apps/contacts/ajax/deleteproperty.php
@@ -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]);
diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php
index cdc6d34c524..cf3fe582247 100644
--- a/apps/contacts/ajax/setproperty.php
+++ b/apps/contacts/ajax/setproperty.php
@@ -36,8 +36,9 @@ $line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum);
// Set the value
$value = $_POST['value'];
if(is_array($value)){
- $value = OC_VObject::escapeSemicolons($value);
+ ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
}
+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 +88,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');
}
diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php
index e23fa21c56b..577230e4566 100644
--- a/apps/contacts/ajax/showsetproperty.php
+++ b/apps/contacts/ajax/showsetproperty.php
@@ -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');
diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css
index 4fcd8fc1131..58e1bf6c93e 100644
--- a/apps/contacts/css/styles.css
+++ b/apps/contacts/css/styles.css
@@ -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; } */
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index bc1e4974b30..580cc72d5eb 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -85,10 +85,6 @@ class OC_Contacts_App{
break;
}
}
- 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;
}
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index ceac2dcfad2..aefa2c74114 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -320,6 +320,8 @@ class OC_Contacts_VCard{
* ['value'] htmlspecialchars escaped value of property
* ['parameters'] associative array name=>value
* ['checksum'] checksum of whole property
+ * NOTE: $value is not escaped anymore. It shouldn't make any difference
+ * but we should look out for any problems.
*/
public static function structureProperty($property){
$value = $property->value;
diff --git a/apps/contacts/photo.php b/apps/contacts/photo.php
index 478ef829cae..756aae63c4d 100644
--- a/apps/contacts/photo.php
+++ b/apps/contacts/photo.php
@@ -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();
diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php
index 11457ff2697..17207d2ebcb 100644
--- a/apps/contacts/templates/part.addcardform.php
+++ b/apps/contacts/templates/part.addcardform.php
@@ -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="">
diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php
index 679ae5ede2f..5badd816155 100644
--- a/apps/contacts/templates/part.details.php
+++ b/apps/contacts/templates/part.details.php
@@ -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');?>" />
diff --git a/apps/contacts/templates/part.messagebox.php b/apps/contacts/templates/part.messagebox.php
index 3681bb6e3f3..5db10e7e6c5 100644
--- a/apps/contacts/templates/part.messagebox.php
+++ b/apps/contacts/templates/part.messagebox.php
@@ -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>
diff --git a/apps/contacts/templates/part.property.N.php b/apps/contacts/templates/part.property.N.php
new file mode 100644
index 00000000000..73d599ad7b4
--- /dev/null
+++ b/apps/contacts/templates/part.property.N.php
@@ -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>
diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php
index 3e0b8d49b52..49fa9662146 100644
--- a/apps/contacts/templates/part.setpropertyform.php
+++ b/apps/contacts/templates/part.setpropertyform.php
@@ -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>
+ </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 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] ?>">
- </li>
- <li>
+ </dd>
+ <!-- dt>
<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>
+ </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'] ?>">
diff --git a/settings/personal.php b/settings/personal.php
index 8e888760052..07030109de7 100755
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -24,8 +24,10 @@ $relative=round(($used/$total)*10000)/100;
$email=OC_Preferences::getValue(OC_User::getUser(), 'settings','email','');
-$lang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', 'en' );
+$lang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
$languageCodes=OC_L10N::findAvailableLanguages();
+sort ($languageCodes);
+
//put the current language in the front
unset($languageCodes[array_search($lang,$languageCodes)]);
array_unshift($languageCodes,$lang);