Share dropdown updates, making public links now works
This commit is contained in:
parent
96ab35a331
commit
8f01abf054
|
@ -1,4 +1,8 @@
|
||||||
#dialog { display:block; position:absolute; z-index:100; width:25em; right:0; margin-right:3em; background:#eee; padding-bottom:1em;
|
#dropdown { display:block; position:absolute; z-index:100; width:16em; right:0; margin-right:7em; background:#eee; padding:1em;
|
||||||
-moz-box-shadow:0 1px 1px #777; -webkit-box-shadow:0 1px 1px #777; box-shadow:0 1px 1px #777;
|
-moz-box-shadow:0 1px 1px #777; -webkit-box-shadow:0 1px 1px #777; box-shadow:0 1px 1px #777;
|
||||||
-moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em;
|
-moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em;
|
||||||
-moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
|
-moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
|
||||||
|
#shared_list>ul { list-style-type: none; }
|
||||||
|
#public { border-top:1px solid #ddd; margin-top:1em; padding-top:0.5em; }
|
||||||
|
a.unshare { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; }
|
||||||
|
a.unshare:hover { background:#fff; -moz-box-shadow:0 0 10px #fff; -webkit-box-shadow:0 0 10px #fff; box-shadow:0 0 10px #fff; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
|
|
@ -1,13 +1,14 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#dialog').live('mouseleave', function(event) {
|
$(this).click(function() {
|
||||||
if ($(this).is(':visible')) {
|
if ($('#dropdown').is(':visible')) {
|
||||||
$(this).hide('blind', function() {
|
$('#dropdown').hide('blind', function() {
|
||||||
$(this).remove();
|
$('#dropdown').remove();
|
||||||
|
$('tr').removeClass('mouseOver');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FileActions.register('all', 'Share', OC.imagePath('core', 'actions/share'), function(filename) {
|
FileActions.register('all', 'Share', OC.imagePath('core', 'actions/share'), function(filename) {
|
||||||
createShareDialog(filename, $('#dir').val()+'/'+filename);
|
createShareDropdown(filename, $('#dir').val()+'/'+filename);
|
||||||
});
|
});
|
||||||
$('.share').click(function(event) {
|
$('.share').click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -23,48 +24,111 @@ $(document).ready(function() {
|
||||||
} else {
|
} else {
|
||||||
filenames = lastFileName;
|
filenames = lastFileName;
|
||||||
}
|
}
|
||||||
createShareDialog(filenames, files);
|
createShareDropdown(filenames, files);
|
||||||
});
|
});
|
||||||
$('#uid_shared_with').live('keyup', function() {
|
$('#uid_shared_with').live('keyup', function() {
|
||||||
$(this).autocomplete({
|
$(this).autocomplete({
|
||||||
source: '../apps/files_sharing/ajax/userautocomplete.php'
|
source: OC.linkTo('files_sharing','ajax/userautocomplete.php')
|
||||||
|
});
|
||||||
|
$('.ui-autocomplete').click(function(event) {
|
||||||
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$('button.remove-uid_shared_with').live('click', function(event) {
|
$('.permissions').live('change', function() {
|
||||||
event.preventDefault();
|
// TODO Modify item ajax call
|
||||||
alert("remove");
|
});
|
||||||
// TODO Remove corresponding row
|
$('.unshare').live('click', function() {
|
||||||
|
var source = $('#dropdown').data('file');
|
||||||
|
var uid_shared_with = $(this).data('uid_shared_with');
|
||||||
|
var data='source='+encodeURIComponent(source)+'&uid_shared_with='+encodeURIComponent(uid_shared_with);
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: OC.linkTo('files_sharing','ajax/unshare.php'),
|
||||||
|
cache: false,
|
||||||
|
data: data,
|
||||||
|
success: function() {
|
||||||
|
$(this).parent().remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#makelink').live('change', function() {
|
||||||
|
if (this.checked) {
|
||||||
|
var path = $('#dropdown').data('file');
|
||||||
|
var expire = 0;
|
||||||
|
var data = 'path='+path+'&expire='+expire;
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: OC.linkTo('files_publiclink','ajax/makelink.php'),
|
||||||
|
cache: false,
|
||||||
|
data: data,
|
||||||
|
success: function(token) {
|
||||||
|
if (token) {
|
||||||
|
var link = OC.linkTo('files_publiclink','get.php')+'?token='+token;
|
||||||
|
$('#link').show('blind');
|
||||||
|
$('#link').val(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var token = $(this).attr('data-token');
|
||||||
|
var data = "token="+token;
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: OC.linkTo('files_publiclink','ajax/deletelink.php'),
|
||||||
|
cache: false,
|
||||||
|
data: data,
|
||||||
|
success: function(){
|
||||||
|
$('#token').hide('blind');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function createShareDialog(filenames, files) {
|
function createShareDropdown(filenames, files) {
|
||||||
var html = "<div id='dialog' style='display: none'>";
|
var html = "<div id='dropdown' data-file='"+files+"'>";
|
||||||
html += "<div id='private'>";
|
html += "<div id='private'>";
|
||||||
html += "<label for='uid_shared_with'><strong>Share with</strong></label><input placeholder='User or Group' id='uid_shared_with' />";
|
html += "<input placeholder='User or Group' id='uid_shared_with' />";
|
||||||
html += "<input type='checkbox' name='permissions' id='permissions' value='1' /><label for='permissions'>allow editing</label><br />";
|
html += "<input type='checkbox' name='permissions' id='permissions' value='1' /><label for='permissions'>can edit</label>";
|
||||||
html += "<br />";
|
|
||||||
html += "<div id='shared_list'></div>";
|
html += "<div id='shared_list'></div>";
|
||||||
$.getJSON(OC.linkTo('files_sharing','ajax/getitem.php'), { source: files }, function(users) {
|
|
||||||
var list = "";
|
|
||||||
$.each(users, function(index, row) {
|
|
||||||
list += row.uid_shared_with;
|
|
||||||
list += "<input type='checkbox' name='share_private_permissions' value='1' /><label>allow editing</label><br />";
|
|
||||||
if (row.permissions > 0) {
|
|
||||||
$('share_private_permissions').prop('checked', true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$(list).appendTo('#shared_list');
|
|
||||||
});
|
|
||||||
html += "</div>";
|
html += "</div>";
|
||||||
html += "<hr />";
|
|
||||||
html += "<div id='public'>";
|
html += "<div id='public'>";
|
||||||
html += "<input type='checkbox' name='public_link' id='public_link' value='1' /><label for='public_link'>make public</label>";
|
html += "<input type='checkbox' name='makelink' id='makelink' value='1' /><label for='makelink'>make public</label>";
|
||||||
html += "<input type='checkbox' name='public_link_write' id='public_link_write' value='1' /><label for='public_link_write'>allow upload</label>";
|
html += "<input type='checkbox' name='public_link_write' id='public_link_write' value='1' /><label for='public_link_write'>allow upload</label>";
|
||||||
html += "<div id='link'>";
|
html += "<br />";
|
||||||
html += "</div>";
|
html += "<input id='link' style='display:none;width:100%' />";
|
||||||
html += "</div>";
|
html += "</div>";
|
||||||
$('tr[data-file="'+filenames+'"]').addClass('mouseOver');
|
$('tr[data-file="'+filenames+'"]').addClass('mouseOver');
|
||||||
$(html).appendTo($('tr[data-file="'+filenames+'"] td.filename'));
|
$(html).appendTo($('tr[data-file="'+filenames+'"] td.filename'));
|
||||||
$('#dialog').show('blind');
|
$.getJSON(OC.linkTo('files_sharing','ajax/getitem.php'), { source: files }, function(users) {
|
||||||
|
if (users) {
|
||||||
|
var list = "<ul>";
|
||||||
|
$.each(users, function(index, row) {
|
||||||
|
list += "<li>";
|
||||||
|
list += row.uid_shared_with;
|
||||||
|
list += "<input type='checkbox' name='permissions' data-uid_shared_with='"+row.uid_shared_with+"' /><label>can edit</label>";
|
||||||
|
list += "<a href='#' title='Unshare' class='unshare' data-uid_shared_with='"+row.uid_shared_with+"'><img src='"+OC.imagePath('core','actions/delete')+"'/></a>";
|
||||||
|
list += "</li>";
|
||||||
|
if (row.permissions > 0) {
|
||||||
|
$('share_private_permissions').prop('checked', true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
list += "</ul>";
|
||||||
|
$(list).appendTo('#shared_list');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// TODO Create gettoken.php
|
||||||
|
//$.getJSON(OC.linkTo('files_publiclink','ajax/gettoken.php'), { path: files }, function(token) {
|
||||||
|
var token;
|
||||||
|
if (token) {
|
||||||
|
var link = OC.linkTo('files_publiclink','get.php')+'?token='+token;
|
||||||
|
$('#makelink').attr('checked', true);
|
||||||
|
$('#link').show('blind');
|
||||||
|
$('#link').val(link);
|
||||||
|
}
|
||||||
|
//});
|
||||||
|
$('#dropdown').show('blind');
|
||||||
|
$('#dropdown').click(function(event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ table td.filename a, table td.login, table td.logout, table td.download, table t
|
||||||
table td.filename .nametext, .modified { float:left; padding:.3em 0; }
|
table td.filename .nametext, .modified { float:left; padding:.3em 0; }
|
||||||
table td.filename .nametext { width:80%; }
|
table td.filename .nametext { width:80%; }
|
||||||
table td.filename form { float:left; font-size:.85em; }
|
table td.filename form { float:left; font-size:.85em; }
|
||||||
#fileList tr input[type=checkbox] { display:none; float:left; margin:.7em 0 0 1em; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ }
|
#fileList tr td.filename>input[type=checkbox]:first-child { display:none; float:left; margin:.7em 0 0 1em; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ }
|
||||||
#fileList tr input[type=checkbox]:checked, #fileList tr:hover input[type=checkbox] { display:inline; }
|
#fileList tr td.filename>input[type=checkbox]:checked:first-child, #fileList tr:hover td.filename>input[type=checkbox]:first-child { display:inline; }
|
||||||
#fileList tr.selected td.filename a, #fileList tr:hover td.filename a { background-image:none !important }
|
#fileList tr.selected td.filename a, #fileList tr:hover td.filename a { background-image:none !important }
|
||||||
#select_all { float:left; margin:0.2em; margin-left:0.6em; }
|
#select_all { float:left; margin:0.2em; margin-left:0.6em; }
|
||||||
#uploadsize-message,#delete-confirm { display:none; }
|
#uploadsize-message,#delete-confirm { display:none; }
|
||||||
|
|
Loading…
Reference in New Issue