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

Contacts: One more inline js var down - one more to go ;)

This commit is contained in:
Thomas Tanghus 2013-01-25 16:09:51 +01:00
parent a94d8b2906
commit 5475d3f16e
2 changed files with 9 additions and 2 deletions

View File

@ -74,6 +74,14 @@ utils.moveCursorToEnd = function(el) {
} }
}; };
utils.linkToRemote = function(service) {
return window.location.protocol + '//' + window.location.host + utils.linkToRemoteBase(service);
};
utils.linkToRemoteBase = function(service) {
return OC.webroot + '/remote.php/' + service;
};
if (typeof Object.create !== 'function') { if (typeof Object.create !== 'function') {
Object.create = function (o) { Object.create = function (o) {
function F() {} function F() {}
@ -811,7 +819,7 @@ OC.Contacts = OC.Contacts || {
var id = parseInt($(this).parents('li').first().data('id')); var id = parseInt($(this).parents('li').first().data('id'));
var book = self.contacts.addressbooks[id]; var book = self.contacts.addressbooks[id];
var uri = (book.owner === oc_current_user ) ? book.uri : book.uri + '_shared_by_' + book.owner; var uri = (book.owner === oc_current_user ) ? book.uri : book.uri + '_shared_by_' + book.owner;
var link = totalurl+'/'+encodeURIComponent(oc_current_user)+'/'+encodeURIComponent(uri); var link = utils.linkToRemote('carddav')+'/addressbooks/'+encodeURIComponent(oc_current_user)+'/'+encodeURIComponent(uri);
var $dropdown = $('<div id="dropdown" class="drop"><input type="text" value="' + link + '" /></div>'); var $dropdown = $('<div id="dropdown" class="drop"><input type="text" value="' + link + '" /></div>');
$dropdown.appendTo($(this).parents('li').first()); $dropdown.appendTo($(this).parents('li').first());
var $input = $dropdown.find('input'); var $input = $dropdown.find('input');

View File

@ -1,6 +1,5 @@
<div id='notification'></div> <div id='notification'></div>
<script type='text/javascript'> <script type='text/javascript'>
var totalurl = '<?php echo OCP\Util::linkToRemote('carddav'); ?>addressbooks';
var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>'; var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>';
</script> </script>
<form class="float" id="file_upload_form" action="<?php echo OCP\Util::linkTo('contacts', 'ajax/uploadphoto.php'); ?>" method="post" enctype="multipart/form-data" target="file_upload_target"> <form class="float" id="file_upload_form" action="<?php echo OCP\Util::linkTo('contacts', 'ajax/uploadphoto.php'); ?>" method="post" enctype="multipart/form-data" target="file_upload_target">