summaryrefslogtreecommitdiffstats
path: root/apps/contacts/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'apps/contacts/ajax')
-rw-r--r--apps/contacts/ajax/contact/add.php8
-rw-r--r--apps/contacts/ajax/contact/addproperty.php7
-rw-r--r--apps/contacts/ajax/contact/deleteproperty.php7
-rw-r--r--apps/contacts/ajax/contact/details.php1
-rw-r--r--apps/contacts/ajax/contact/saveproperty.php5
-rw-r--r--apps/contacts/ajax/savecrop.php31
6 files changed, 39 insertions, 20 deletions
diff --git a/apps/contacts/ajax/contact/add.php b/apps/contacts/ajax/contact/add.php
index 6aaf5a9df35..043e947dc4b 100644
--- a/apps/contacts/ajax/contact/add.php
+++ b/apps/contacts/ajax/contact/add.php
@@ -49,4 +49,10 @@ if(!$id) {
exit();
}
-OCP\JSON::success(array('data' => array( 'id' => $id, 'aid' => $aid )));
+OCP\JSON::success(array(
+ 'data' => array(
+ 'id' => $id,
+ 'aid' => $aid,
+ 'lastmodified' => OC_Contacts_VCard::lastModified($vcard)->format('U')
+ )
+));
diff --git a/apps/contacts/ajax/contact/addproperty.php b/apps/contacts/ajax/contact/addproperty.php
index ca28140edf1..df064367ef1 100644
--- a/apps/contacts/ajax/contact/addproperty.php
+++ b/apps/contacts/ajax/contact/addproperty.php
@@ -144,4 +144,9 @@ if(!OC_Contacts_VCard::edit($id, $vcard)) {
bailOut($l10n->t('Error adding contact property: '.$name));
}
-OCP\JSON::success(array('data' => array( 'checksum' => $checksum )));
+OCP\JSON::success(array(
+ 'data' => array(
+ 'checksum' => $checksum,
+ 'lastmodified' => OC_Contacts_VCard::lastModified($vcard)->format('U'))
+ )
+);
diff --git a/apps/contacts/ajax/contact/deleteproperty.php b/apps/contacts/ajax/contact/deleteproperty.php
index 9c3f09f8610..d7545ff1fbf 100644
--- a/apps/contacts/ajax/contact/deleteproperty.php
+++ b/apps/contacts/ajax/contact/deleteproperty.php
@@ -44,4 +44,9 @@ if(!OC_Contacts_VCard::edit($id, $vcard)) {
bailOut($l10n->t('Error deleting contact property.'));
}
-OCP\JSON::success(array('data' => array( 'id' => $id )));
+OCP\JSON::success(array(
+ 'data' => array(
+ 'id' => $id,
+ 'lastmodified' => OC_Contacts_VCard::lastModified($vcard)->format('U'),
+ )
+));
diff --git a/apps/contacts/ajax/contact/details.php b/apps/contacts/ajax/contact/details.php
index 0e07f9ec3d8..c22f18937d7 100644
--- a/apps/contacts/ajax/contact/details.php
+++ b/apps/contacts/ajax/contact/details.php
@@ -53,5 +53,6 @@ if(isset($details['PHOTO'])) {
$details['id'] = $id;
$details['displayname'] = $card['fullname'];
$details['addressbookid'] = $card['addressbookid'];
+$details['lastmodified'] = OC_Contacts_App::lastModified($vcard)->format('U');
OC_Contacts_App::setLastModifiedHeader($vcard);
OCP\JSON::success(array('data' => $details));
diff --git a/apps/contacts/ajax/contact/saveproperty.php b/apps/contacts/ajax/contact/saveproperty.php
index f9880c78834..799038b6f1d 100644
--- a/apps/contacts/ajax/contact/saveproperty.php
+++ b/apps/contacts/ajax/contact/saveproperty.php
@@ -148,5 +148,6 @@ if(!OC_Contacts_VCard::edit($id, $vcard)) {
OCP\JSON::success(array('data' => array(
'line' => $line,
'checksum' => $checksum,
- 'oldchecksum' => $_POST['checksum']))
-);
+ 'oldchecksum' => $_POST['checksum']
+ 'lastmodified' => OC_Contacts_VCard::lastModified($vcard)->format('U')
+));
diff --git a/apps/contacts/ajax/savecrop.php b/apps/contacts/ajax/savecrop.php
index 1df5299c7a6..2483d0f7128 100644
--- a/apps/contacts/ajax/savecrop.php
+++ b/apps/contacts/ajax/savecrop.php
@@ -62,17 +62,17 @@ if($data) {
if($image->crop($x1, $y1, $w, $h)) {
if(($image->width() <= 200 && $image->height() <= 200)
|| $image->resize(200)) {
- $card = OC_Contacts_App::getContactVCard($id);
- if(!$card) {
+ $vcard = OC_Contacts_App::getContactVCard($id);
+ if(!$vcard) {
OC_Cache::remove($tmpkey);
bailOut(OC_Contacts_App::$l10n
->t('Error getting contact object.'));
}
- if($card->__isset('PHOTO')) {
+ if($vcard->__isset('PHOTO')) {
OCP\Util::writeLog('contacts',
'savecrop.php: PHOTO property exists.',
OCP\Util::DEBUG);
- $property = $card->__get('PHOTO');
+ $property = $vcard->__get('PHOTO');
if(!$property) {
OC_Cache::remove($tmpkey);
bailOut(OC_Contacts_App::$l10n
@@ -83,27 +83,28 @@ if($data) {
= new Sabre_VObject_Parameter('ENCODING', 'b');
$property->parameters[]
= new Sabre_VObject_Parameter('TYPE', $image->mimeType());
- $card->__set('PHOTO', $property);
+ $vcard->__set('PHOTO', $property);
} else {
OCP\Util::writeLog('contacts',
'savecrop.php: files: Adding PHOTO property.',
OCP\Util::DEBUG);
- $card->addProperty('PHOTO',
+ $vcard->addProperty('PHOTO',
$image->__toString(), array('ENCODING' => 'b',
'TYPE' => $image->mimeType()));
}
$now = new DateTime;
- $card->setString('REV', $now->format(DateTime::W3C));
- if(!OC_Contacts_VCard::edit($id, $card)) {
+ $vcard->setString('REV', $now->format(DateTime::W3C));
+ if(!OC_Contacts_VCard::edit($id, $vcard)) {
bailOut(OC_Contacts_App::$l10n->t('Error saving contact.'));
}
- $tmpl = new OCP\Template("contacts", "part.contactphoto");
- $tmpl->assign('id', $id);
- $tmpl->assign('refresh', true);
- $tmpl->assign('width', $image->width());
- $tmpl->assign('height', $image->height());
- $page = $tmpl->fetchPage();
- OCP\JSON::success(array('data' => array('page'=>$page)));
+ OCP\JSON::success(array(
+ 'data' => array(
+ 'id' => $id,
+ 'width' => $image->width(),
+ 'height' => $image->height(),
+ 'lastmodified' => OC_Contacts_App::lastModified($vcard)->format('U')
+ )
+ ));
} else {
bailOut(OC_Contacts_App::$l10n->t('Error resizing image'));
}