Remove hardcoded http:// when generating public links

This commit is contained in:
Michael Gapczynski 2011-08-11 16:56:09 -04:00
parent c65046773d
commit 9e35d5a886
1 changed files with 10 additions and 9 deletions

View File

@ -14,7 +14,6 @@ $(document).ready(function() {
} else { } else {
createDropdown(filename, $('#dir').val()+'/'+filename); createDropdown(filename, $('#dir').val()+'/'+filename);
} }
}); });
}; };
@ -33,7 +32,7 @@ $(document).ready(function() {
if (!($(event.target).hasClass('drop')) && $(event.target).parents().index($('#dropdown')) == -1) { if (!($(event.target).hasClass('drop')) && $(event.target).parents().index($('#dropdown')) == -1) {
if ($('#dropdown').is(':visible')) { if ($('#dropdown').is(':visible')) {
$('#dropdown').hide('blind', function() { $('#dropdown').hide('blind', function() {
$('#dropdown').remove();S $('#dropdown').remove();
$('tr').removeClass('mouseOver'); $('tr').removeClass('mouseOver');
}); });
} }
@ -111,9 +110,7 @@ $(document).ready(function() {
data: data, data: data,
success: function(token) { success: function(token) {
if (token) { if (token) {
$('#link').data('token', token); showPublicLink(token);
$('#link').val('http://'+location.host+OC.linkTo('files_publiclink','get.php')+'?token='+token);
$('#link').show('blind');
} }
} }
}); });
@ -178,10 +175,7 @@ function createDropdown(filename, files) {
}); });
$.getJSON(OC.linkTo('files_publiclink', 'ajax/getlink.php'), { path: files }, function(token) { $.getJSON(OC.linkTo('files_publiclink', 'ajax/getlink.php'), { path: files }, function(token) {
if (token) { if (token) {
$('#makelink').attr('checked', true); showPublicLink(token);
$('#link').data('token', token);
$('#link').val('http://'+location.host+OC.linkTo('files_publiclink','get.php')+'?token='+token);
$('#link').show();
} }
}); });
$('#dropdown').show('blind'); $('#dropdown').show('blind');
@ -202,3 +196,10 @@ function addUser(uid_shared_with, permissions, parentFolder) {
$('#share_with').trigger('liszt:updated'); $('#share_with').trigger('liszt:updated');
$(user).appendTo('#shared_list'); $(user).appendTo('#shared_list');
} }
function showPublicLink(token) {
$('#makelink').attr('checked', true);
$('#link').data('token', token);
$('#link').val(parent.location.protocol+"//"+location.host+OC.linkTo('files_publiclink','get.php')+'?token='+token);
$('#link').show('blind');
}