diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php index 8588b9168f7..dfa5fb8c78a 100644 --- a/apps/calendar/templates/part.eventform.php +++ b/apps/calendar/templates/part.eventform.php @@ -13,9 +13,7 @@    t("Calendar");?>: @@ -23,9 +21,7 @@ @@ -66,9 +62,7 @@ diff --git a/apps/contacts/ajax/getdetails.php b/apps/contacts/ajax/getdetails.php index 0e76de61afb..260fb53a686 100644 --- a/apps/contacts/ajax/getdetails.php +++ b/apps/contacts/ajax/getdetails.php @@ -51,10 +51,22 @@ if(is_null($vcard)){ exit(); } +$property_types = array( + 'ADR' => $l10n->t('Address'), + 'TEL' => $l10n->t('Telephone'), + 'EMAIL' => $l10n->t('Email'), + 'ORG' => $l10n->t('Organization'), +); +$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); + $details = OC_Contacts_VCard::structureContact($vcard); $tmpl = new OC_Template('contacts','part.details'); $tmpl->assign('details',$details); $tmpl->assign('id',$id); +$tmpl->assign('property_types',$property_types); +$tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $page = $tmpl->fetchPage(); OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page ))); diff --git a/apps/contacts/ajax/showaddcard.php b/apps/contacts/ajax/showaddcard.php index 2f534f0fe2d..98367758fd4 100644 --- a/apps/contacts/ajax/showaddcard.php +++ b/apps/contacts/ajax/showaddcard.php @@ -29,9 +29,14 @@ $l10n = new OC_L10N('contacts'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); +$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); + $addressbooks = OC_Contacts_Addressbook::all(OC_USER::getUser()); $tmpl = new OC_Template('contacts','part.addcardform'); $tmpl->assign('addressbooks',$addressbooks); +$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/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php index 6188f4773c3..4ec3dd7d8e1 100644 --- a/apps/contacts/ajax/showsetproperty.php +++ b/apps/contacts/ajax/showsetproperty.php @@ -61,11 +61,13 @@ if(is_null($line)){ exit(); } +$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); $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); $page = $tmpl->fetchPage(); OC_JSON::success(array('data' => array( 'page' => $page ))); diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index a6795c7935b..56602f25c0a 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -372,4 +372,24 @@ class OC_Contacts_VCard{ return null; } } + public static function getTypesOfProperty($l, $prop){ + switch($prop){ + case 'ADR': + return array( + 'WORK' => $l->t('Work'), + 'HOME' => $l->t('Home'), + ); + case 'TEL': + return array( + 'HOME' => $l->t('Home'), + 'CELL' => $l->t('Mobile'), + 'WORK' => $l->t('Work'), + 'TEXT' => $l->t('Text'), + 'VOICE' => $l->t('Voice'), + 'FAX' => $l->t('Fax'), + 'VIDEO' => $l->t('Video'), + 'PAGER' => $l->t('Pager'), + ); + } + } } diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php index a596ad8163a..037e3629bb9 100644 --- a/apps/contacts/templates/part.addcardform.php +++ b/apps/contacts/templates/part.addcardform.php @@ -7,9 +7,7 @@
  • @@ -46,14 +44,7 @@
  • @@ -67,8 +58,7 @@
  • diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php index 212be283d80..f5bd75809b1 100644 --- a/apps/contacts/templates/part.details.php +++ b/apps/contacts/templates/part.details.php @@ -27,10 +27,7 @@

    @@ -44,8 +41,7 @@

  • @@ -80,14 +76,7 @@

    diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index eb8a67a8aa5..811b9626ce4 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -5,6 +5,12 @@

      +
    1. + + +
    2. diff --git a/lib/template.php b/lib/template.php index 440b62003e7..d1439199e1e 100644 --- a/lib/template.php +++ b/lib/template.php @@ -98,6 +98,33 @@ function relative_modified_date($timestamp) { else { return $l->t('years ago'); } } +function html_select_options($options, $selected, $params=array()) { + if (!is_array($selected)){ + $selected=array($selected); + } + if (isset($params['combine']) && $params['combine']){ + $options = array_combine($options, $options); + } + $value_name = $label_name = false; + if (isset($params['value'])){ + $value_name = $params['value']; + } + if (isset($params['label'])){ + $label_name = $params['label']; + } + $html = ''; + foreach($options as $value => $label){ + if ($value_name && is_array($label)){ + $value = $label[$value_name]; + } + if ($label_name && is_array($label)){ + $label = $label[$label_name]; + } + $select = in_array($value, $selected) ? ' selected="selected"' : ''; + $html .= ''; + } + return $html; +} /** * This class provides the templates for owncloud.