aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/contacts/ajax/setproperty.php12
-rw-r--r--apps/contacts/css/formtastic.css8
-rw-r--r--apps/contacts/css/styles.css11
-rw-r--r--apps/contacts/js/interface.js12
-rw-r--r--apps/contacts/lib/vcard.php20
-rw-r--r--apps/contacts/templates/part.addcardform.php2
-rw-r--r--apps/contacts/templates/part.property.php19
-rw-r--r--apps/contacts/templates/part.setpropertyform.php6
8 files changed, 63 insertions, 27 deletions
diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php
index 9164f86913d..c9102c4a2ee 100644
--- a/apps/contacts/ajax/setproperty.php
+++ b/apps/contacts/ajax/setproperty.php
@@ -70,6 +70,9 @@ $vcard->children[$line]->setValue($value);
// Add parameters
$postparameters = isset($_POST['parameters'])?$_POST['parameters']:array();
+if ($vcard->children[$line]->name == 'TEL' && !array_key_exists('TYPE', $postparameters)){
+ $postparameters['TYPE']='';
+}
for($i=0;$i<count($vcard->children[$line]->parameters);$i++){
$name = $vcard->children[$line]->parameters[$i]->name;
if(array_key_exists($name,$postparameters)){
@@ -77,7 +80,14 @@ for($i=0;$i<count($vcard->children[$line]->parameters);$i++){
unset($vcard->children[$line]->parameters[$i]);
}
else{
- $vcard->children[$line]->parameters[$i]->value = $postparameters[$name];
+ unset($vcard->children[$line][$name]);
+ $values = $postparameters[$name];
+ if (!is_array($values)){
+ $values = array($values);
+ }
+ foreach($values as $value){
+ $vcard->children[$line]->add($name, $value);
+ }
}
unset($postparameters[$name]);
}
diff --git a/apps/contacts/css/formtastic.css b/apps/contacts/css/formtastic.css
index 629c220732b..fede92b61ca 100644
--- a/apps/contacts/css/formtastic.css
+++ b/apps/contacts/css/formtastic.css
@@ -94,16 +94,14 @@ This stylesheet forms part of the Formtastic Rails Plugin
/* INPUTS
--------------------------------------------------------------------------------------------------*/
.formtastic .inputs {
- overflow:hidden; /* clear containing floats */
-}
-
-.formtastic .input {
- overflow:hidden; /* clear containing floats */
padding:0.5em 0; /* padding and negative margin juggling is for Firefox */
margin-top:-0.5em;
margin-bottom:1em;
}
+.formtastic .input {
+}
+
/* LEFT ALIGNED LABELS
--------------------------------------------------------------------------------------------------*/
diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css
index ad64c777ee7..e226c48ae54 100644
--- a/apps/contacts/css/styles.css
+++ b/apps/contacts/css/styles.css
@@ -3,16 +3,21 @@
#contacts_deletecard {position:absolute;top:15px;right:0;}
#contacts_details_list { list-style:none; }
-#contacts_details_list li { overflow:hidden; }
#contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em;color:#666; }
-#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%; overflow:hidden; }
+#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%;float:left; }
#contacts_addproperty_button, #contacts_setproperty_button { margin-left:25%; }
-.contacts_property_data ul, .contacts_property_data ol { list-style:none; }
+.contacts_property_data ul, ol.contacts_property_data { list-style:none; }
.contacts_property_data li { overflow: hidden; }
.contacts_property_data li label { width:20%; float:left; text-align:right;padding-right:0.3em; }
+.contacts_property_data input { float:left; }
.contacts_property_data li input { width:70%;overflow:hidden; }
+.chzn-container { margin:3px 0 0; }
+.chzn-container .chzn-choices { border-radius: 0.5em; }
+.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; } */
diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js
index 1cc3a5dfd63..24b512e532b 100644
--- a/apps/contacts/js/interface.js
+++ b/apps/contacts/js/interface.js
@@ -82,7 +82,8 @@ $(document).ready(function(){
$.getJSON('ajax/showaddcard.php',{},function(jsondata){
if(jsondata.status == 'success'){
$('#rightcontent').data('id','');
- $('#rightcontent').html(jsondata.data.page);
+ $('#rightcontent').html(jsondata.data.page)
+ .find('select').chosen();
}
else{
alert(jsondata.data.message);
@@ -111,7 +112,8 @@ $(document).ready(function(){
var checksum = $(this).parents('li').first().data('checksum');
$.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum },function(jsondata){
if(jsondata.status == 'success'){
- $('.contacts_property[data-checksum="'+checksum+'"]').html(jsondata.data.page);
+ $('.contacts_property[data-checksum="'+checksum+'"]').html(jsondata.data.page)
+ .find('select').chosen();
}
else{
alert(jsondata.data.message);
@@ -148,10 +150,12 @@ $(document).ready(function(){
$('.contacts_property').live('mouseenter',function(){
- $(this).find('span').show();
+ $(this).find('span[data-use]').show();
});
$('.contacts_property').live('mouseleave',function(){
- $(this).find('span').hide();
+ $(this).find('span[data-use]').hide();
});
+
+ $('#contacts_addcardform select').chosen();
});
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index 56602f25c0a..4865fae7642 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -296,7 +296,13 @@ class OC_Contacts_VCard{
$property = new Sabre_VObject_Property( $name, $value );
$parameternames = array_keys($parameters);
foreach($parameternames as $i){
- $property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]);
+ $values = $parameters[$i];
+ if (!is_array($values)){
+ $values = array($values);
+ }
+ foreach($values as $value){
+ $property->add($i, $value);
+ }
}
$vcard->add($property);
@@ -352,7 +358,17 @@ class OC_Contacts_VCard{
$parameter->name = 'PREF';
$parameter->value = '1';
}
- $temp['parameters'][$parameter->name] = $parameter->value;
+ if ($property->name == 'TEL' && $parameter->name == 'TYPE'){
+ if (isset($temp['parameters'][$parameter->name])){
+ $temp['parameters'][$parameter->name][] = $parameter->value;
+ }
+ else{
+ $temp['parameters'][$parameter->name] = array($parameter->value);
+ }
+ }
+ else{
+ $temp['parameters'][$parameter->name] = $parameter->value;
+ }
}
return $temp;
}
diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php
index 037e3629bb9..627053547ad 100644
--- a/apps/contacts/templates/part.addcardform.php
+++ b/apps/contacts/templates/part.addcardform.php
@@ -43,7 +43,7 @@
</li>
<li class="fragment">
<label for="tel_type"><?php echo $l->t('Type'); ?></label>
- <select id="TEL" name="parameters[TEL][TYPE]" size="1">
+ <select id="TEL" name="parameters[TEL][TYPE][]" multiple="multiple">
<?php echo html_select_options($_['phone_types'], 'CELL') ?>
</select>
</li>
diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php
index dbd125dc959..afef4311260 100644
--- a/apps/contacts/templates/part.property.php
+++ b/apps/contacts/templates/part.property.php
@@ -23,15 +23,18 @@
<p class="contacts_property_name"><?php echo $l->t('Phone'); ?></p>
<p class="contacts_property_data">
<?php echo $_['property']['value']; ?>
- <?php if(isset($_['property']['parameters']['TYPE'])): ?>
+ <?php if(isset($_['property']['parameters']['TYPE']) && !empty($_['property']['parameters']['TYPE'])): ?>
<?php
- $type = $_['property']['parameters']['TYPE'];
- if (isset($_['phone_types'][strtoupper($type)])){
- $label=$_['phone_types'][strtoupper($type)];
- }
- else{
- $label=$l->t(ucwords(strtolower($type)));
- }
+ $types = array();
+ foreach($_['property']['parameters']['TYPE'] as $type):
+ if (isset($_['phone_types'][strtoupper($type)])){
+ $types[]=$_['phone_types'][strtoupper($type)];
+ }
+ else{
+ $types[]=$l->t(ucwords(strtolower($type)));
+ }
+ endforeach;
+ $label = join(' ', $types);
?>
(<?php echo $label; ?>)
<?php endif; ?>
diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php
index 9340ce7c713..bd18d86b47e 100644
--- a/apps/contacts/templates/part.setpropertyform.php
+++ b/apps/contacts/templates/part.setpropertyform.php
@@ -42,9 +42,9 @@
</ol>
<?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']; ?>">
- <select id="tel_type" name="parameters[TYPE]" size="1">
- <?php echo html_select_options($_['phone_types'], strtoupper($_['property']['parameters']['TYPE'])) ?>
+ <p class="contacts_property_data"><input id="tel" type="phone" name="value" value="<?php echo $_['property']['value'] ?>">
+ <select id="tel_type<?php echo $_['property']['checksum'] ?>" name="parameters[TYPE][]" multiple="multiple">
+ <?php echo html_select_options($_['phone_types'], ($_['property']['parameters']['TYPE'])) ?>
</select></p>
<?php elseif($_['property']['name']=='EMAIL'): ?>
<p class="contacts_property_name"><label for="email"><?php echo $l->t('Email'); ?></label></p>