diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php index 9164f86913..c9102c4a2e 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;$ichildren[$line]->parameters);$i++){ $name = $vcard->children[$line]->parameters[$i]->name; if(array_key_exists($name,$postparameters)){ @@ -77,7 +80,14 @@ for($i=0;$ichildren[$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 629c220732..fede92b61c 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 ad64c777ee..e226c48ae5 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 1cc3a5dfd6..24b512e532 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 56602f25c0..4865fae764 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 037e3629bb..627053547a 100644 --- a/apps/contacts/templates/part.addcardform.php +++ b/apps/contacts/templates/part.addcardform.php @@ -43,7 +43,7 @@
  • -
  • diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php index dbd125dc95..afef431126 100644 --- a/apps/contacts/templates/part.property.php +++ b/apps/contacts/templates/part.property.php @@ -23,15 +23,18 @@

    t('Phone'); ?>

    - + 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); ?> () diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index 9340ce7c71..bd18d86b47 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -42,9 +42,9 @@

    -

    - +