summaryrefslogtreecommitdiffstats
path: root/apps/contacts/ajax
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2011-11-05 20:33:42 +0100
committerBart Visscher <bartv@thisnet.nl>2011-11-09 22:19:52 +0100
commitef124c3e21ceae49f0f704589a833d1208d99c65 (patch)
tree896f352cd5abd17fee6c300f4c389883ebd3320a /apps/contacts/ajax
parent938c5ef21ce2870befcc16335998d48ad773433a (diff)
downloadnextcloud-server-ef124c3e21ceae49f0f704589a833d1208d99c65.tar.gz
nextcloud-server-ef124c3e21ceae49f0f704589a833d1208d99c65.zip
Use a function to generate select options
Diffstat (limited to 'apps/contacts/ajax')
-rw-r--r--apps/contacts/ajax/getdetails.php12
-rw-r--r--apps/contacts/ajax/showaddcard.php5
-rw-r--r--apps/contacts/ajax/showsetproperty.php2
3 files changed, 19 insertions, 0 deletions
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 )));