1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Contacts: Fixed export.

This commit is contained in:
Thomas Tanghus 2012-11-15 03:51:46 +01:00
parent a489400dc6
commit a4e63b1afd
3 changed files with 16 additions and 5 deletions

View File

@ -12,9 +12,9 @@ OCP\App::checkAppEnabled('contacts');
$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : null;
$contactid = isset($_GET['contactid']) ? $_GET['contactid'] : null;
$nl = "\n";
if(isset($bookid)) {
if(!is_null($bookid)) {
try {
$addressbook = OCA\Contacts\Addressbook::find($id); // is owner access check
$addressbook = OCA\Contacts\Addressbook::find($bookid); // is owner access check
} catch(Exception $e) {
OCP\JSON::error(
array(
@ -40,7 +40,7 @@ if(isset($bookid)) {
}
$start += $batchsize;
}
}elseif(isset($contactid)) {
} elseif(!is_null($contactid)) {
try {
$data = OCA\Contacts\VCard::find($contactid);
} catch(Exception $e) {

View File

@ -68,6 +68,7 @@ $tmpl = new OCP\Template( "contacts", "contacts", "user" );
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize, false);
$tmpl->assign('uploadMaxHumanFilesize',
OCP\Util::humanFileSize($maxUploadFilesize), false);
$tmpl->assign('addressbooks', OCA\Contacts\Addressbook::all(OCP\USER::getUser()), false);
$tmpl->assign('phone_types', $phone_types, false);
$tmpl->assign('email_types', $email_types, false);
$tmpl->assign('adr_types', $adr_types, false);

View File

@ -24,8 +24,18 @@
<div id="contacts-settings">
<ul>
<li><button class="settings" title="<?php echo $l->t('Settings'); ?>"></button></li>
<li><button class="import"><?php echo $l->t('Import'); ?></button></li>
<li><button class="export"><?php echo $l->t('Export'); ?></button></li>
<li><h3 class="import" role="button"><?php echo $l->t('Import'); ?></h3></li>
<li><h3 class="export"><?php echo $l->t('Export'); ?></h3>
<ul class="hidden">
<?php foreach($_['addressbooks'] as $addressbook): ?>
<li>
<a role="button" href="<?php echo OCP\Util::linkToAbsolute('contacts', 'export.php'); ?>?bookid=<?php echo $addressbook['id'] ?>">
<?php echo $addressbook['displayname'] ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</li>
</ul>
</div>
</div>