parent
d72b85684f
commit
56ed8ba70b
@ -0,0 +1,24 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2011 Thomas Tanghus <thomas@tanghus.net> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
OCP\JSON::checkLoggedIn(); |
||||
OCP\JSON::checkAppEnabled('contacts'); |
||||
|
||||
$books = OC_Contacts_Addressbook::all(OCP\USER::getUser()); |
||||
if(count($books) > 1) { |
||||
$addressbooks = array(); |
||||
foreach($books as $book) { |
||||
$addressbooks[] = array('id' => $book['id'], 'name' => $book['displayname']); |
||||
} |
||||
$tmpl = new OCP\Template("contacts", "part.selectaddressbook"); |
||||
$tmpl->assign('addressbooks', $addressbooks); |
||||
$page = $tmpl->fetchPage(); |
||||
OCP\JSON::success(array('data' => array( 'type' => 'dialog', 'page' => $page ))); |
||||
} else { |
||||
OCP\JSON::success(array('data' => array( 'type' => 'result', 'id' => $books[0]['id'] ))); |
||||
} |
@ -0,0 +1,10 @@ |
||||
<div id="selectaddressbook_dialog" title="<?php echo $l->t("Select Address Books"); ?>">
|
||||
<form> |
||||
<select id="adr_type" name="parameters[ADR][TYPE]" size="1"> |
||||
<?php foreach($_['addressbooks'] as $addressbook) { ?> |
||||
<option value="<?php echo $addressbook['id']; ?>"><?php echo $addressbook['name']; ?></option>
|
||||
<?php } ?> |
||||
</select> |
||||
</form> |
||||
</div> |
||||
|
Loading…
Reference in new issue