diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php index 0cecd3bdc06033cd0caac3c4c7b055a08e95a553..dd5b90651f56321b93c96d65de91a9eb59890527 100644 --- a/apps/contacts/ajax/addcard.php +++ b/apps/contacts/ajax/addcard.php @@ -68,11 +68,16 @@ foreach( $add as $propname){ } $id = OC_Contacts_VCard::add($aid,$vcard->serialize()); +$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); + $details = OC_Contacts_VCard::structureContact($vcard); $name = $details['FN'][0]['value']; $tmpl = new OC_Template('contacts','part.details'); $tmpl->assign('details',$details); $tmpl->assign('id',$id); +$tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $page = $tmpl->fetchPage(); OC_JSON::success(array('data' => array( 'id' => $id, 'name' => $name, 'page' => $page ))); diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php index 18e00872473c90721258edadd0b0a647fd5556b6..9164f86913dd1d0dd9286729f1284c41b052bb10 100644 --- a/apps/contacts/ajax/setproperty.php +++ b/apps/contacts/ajax/setproperty.php @@ -94,7 +94,12 @@ $checksum = md5($vcard->children[$line]->serialize()); OC_Contacts_VCard::edit($id,$vcard->serialize()); +$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); + $tmpl = new OC_Template('contacts','part.property'); +$tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line],$line)); $page = $tmpl->fetchPage(); diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php index 4ec3dd7d8e1d2991dc7ff9e5e4a556c515c17c26..2ec4b89b8247b28e70877b7ef3ec7a10422a0e91 100644 --- a/apps/contacts/ajax/showsetproperty.php +++ b/apps/contacts/ajax/showsetproperty.php @@ -62,12 +62,14 @@ if(is_null($line)){ } $adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); $tmpl = new OC_Template('contacts','part.setpropertyform'); $tmpl->assign('id',$id); $tmpl->assign('checksum',$checksum); $tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line])); $tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $page = $tmpl->fetchPage(); OC_JSON::success(array('data' => array( 'page' => $page ))); diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 7e93d6183ed0d5ef6ae9e62b64ceb0262a2fc4b2..29d41d3c4c45b948217ebf3a543d1b8bc1327c34 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -75,8 +75,14 @@ if( !is_null($id) || count($contacts)){ $details = OC_Contacts_VCard::structureContact($vcard); } +$l10n = new OC_L10N('contacts'); +$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); + // Process the template $tmpl = new OC_Template( 'contacts', 'index', 'user' ); +$tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $tmpl->assign('addressbooks', $addressbooks); $tmpl->assign('contacts', $contacts); $tmpl->assign('details', $details ); diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php index 4bc3a4d85f82ad0eae46554618542073669859dd..dbd125dc959d1241707a5335706c220f45e16e3f 100644 --- a/apps/contacts/templates/part.property.php +++ b/apps/contacts/templates/part.property.php @@ -24,7 +24,16 @@ <p class="contacts_property_data"> <?php echo $_['property']['value']; ?> <?php if(isset($_['property']['parameters']['TYPE'])): ?> - (<?php echo $l->t(ucwords(str_replace('cell','mobile',strtolower($_['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))); + } +?> + (<?php echo $label; ?>) <?php endif; ?> <span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span> <span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span> @@ -34,7 +43,16 @@ <?php echo $l->t('Address'); ?> <?php if(isset($_['property']['parameters']['TYPE'])): ?> <br> - (<?php echo $l->t(ucwords($_['property']['parameters']['TYPE'])); ?>) +<?php + $type = $_['property']['parameters']['TYPE']; + if (isset($_['adr_types'][strtoupper($type)])){ + $label=$_['adr_types'][strtoupper($type)]; + } + else{ + $label=$l->t(ucwords(strtolower($type))); + } +?> + (<?php echo $label; ?>) <?php endif; ?> </p> <p class="contacts_property_data"> diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index 811b9626ce496e436480b7e3193205a5ea2cef7b..9340ce7c7132f5e448f44fc66a51bf341c599384 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -42,7 +42,10 @@ </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']; ?>"></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'])) ?> + </select></p> <?php elseif($_['property']['name']=='EMAIL'): ?> <p class="contacts_property_name"><label for="email"><?php echo $l->t('Email'); ?></label></p> <p class="contacts_property_data"><input id="email" type="text" name="value" value="<?php echo $_['property']['value']; ?>"></p>