diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-01-19 16:04:39 +0100 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-01-19 16:07:17 +0100 |
commit | 5bd117dd6db9e1ea27404970faf0a94490fce994 (patch) | |
tree | f095961355e6f53c716342dfc1a7ca44712a6c6e /apps/contacts/ajax | |
parent | dc942d6f3e5f4845cf1e3588ac6116da783d45c8 (diff) | |
download | nextcloud-server-5bd117dd6db9e1ea27404970faf0a94490fce994.tar.gz nextcloud-server-5bd117dd6db9e1ea27404970faf0a94490fce994.zip |
UI fixes in contact editor and address book dialog.
Error checking in ajax methods.
Localize menu entry.
Diffstat (limited to 'apps/contacts/ajax')
-rw-r--r-- | apps/contacts/ajax/addproperty.php | 5 | ||||
-rw-r--r-- | apps/contacts/ajax/getdetails.php | 3 | ||||
-rw-r--r-- | apps/contacts/ajax/setproperty.php | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php index 0050f5f49aa..f016820ce5f 100644 --- a/apps/contacts/ajax/addproperty.php +++ b/apps/contacts/ajax/addproperty.php @@ -35,7 +35,7 @@ $name = $_POST['name']; $value = $_POST['value']; if(!is_array($value)){ $value = trim($value); - if(!$value && in_array($name, array('TEL', 'EMAIL', 'ORG'))) { + if(!$value && in_array($name, array('TEL', 'EMAIL', 'ORG', 'BDAY', 'NICKNAME'))) { OC_JSON::error(array('data' => array('message' => $l->t('Cannot add empty property.')))); exit(); } @@ -72,6 +72,7 @@ foreach ($parameters as $key=>$element) { $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key,$element); } } +$checksum = md5($vcard->children[$line]->serialize()); if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) { OC_JSON::error(array('data' => array('message' => $l->t('Error adding contact property.')))); @@ -88,4 +89,4 @@ $tmpl->assign('phone_types',$phone_types); $tmpl->assign('property',OC_Contacts_VCard::structureProperty($property,$line)); $page = $tmpl->fetchPage(); -OC_JSON::success(array('data' => array( 'page' => $page ))); +OC_JSON::success(array('data' => array( 'checksum' => $checksum, 'page' => $page ))); diff --git a/apps/contacts/ajax/getdetails.php b/apps/contacts/ajax/getdetails.php index 8cc0f9cbb0f..4819916f4c3 100644 --- a/apps/contacts/ajax/getdetails.php +++ b/apps/contacts/ajax/getdetails.php @@ -28,6 +28,7 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); $id = $_GET['id']; +$new = isset($_GET['new']) ? true : false; $vcard = OC_Contacts_App::getContactVCard( $id ); -OC_Contacts_App::renderDetails($id, $vcard); +OC_Contacts_App::renderDetails($id, $vcard, $new); diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php index e0cd70236c8..cdc6d34c524 100644 --- a/apps/contacts/ajax/setproperty.php +++ b/apps/contacts/ajax/setproperty.php @@ -95,4 +95,4 @@ $tmpl->assign('phone_types',$phone_types); $tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line],$line)); $page = $tmpl->fetchPage(); -OC_JSON::success(array('data' => array( 'page' => $page, 'line' => $line, 'oldchecksum' => $_POST['checksum'] ))); +OC_JSON::success(array('data' => array( 'page' => $page, 'line' => $line, 'checksum' => $checksum, 'oldchecksum' => $_POST['checksum'] ))); |