',
+ );
+ }
+ $('#files-ul').html(content.join(''));
+}
+
+$(document).ready(function(){
+ $('.modal-trigger').leanModal();
+ $('.modal-trigger').on('click', fillModal);
+ $('#invertSelection').on('click', invertSelection);
+ $('#toggleHidden').on('click', toggleHidden);
+ $('#deleteInvit').on('click', deleteInvit);
+ $('#resendMail').on('click', resendMail);
+ $('#toggleVisibility').on('click', toggleVisibility);
+ $('#myInvitations input[type="checkbox"]').on('click', handleCheckboxClic);
+});
diff --git a/themes/default/public/js/lufi-up.js b/themes/default/public/js/lufi-up.js
index 67f86bb..89a962c 100644
--- a/themes/default/public/js/lufi-up.js
+++ b/themes/default/public/js/lufi-up.js
@@ -11,6 +11,8 @@ window.sliceLength = 2000000;
// Global zip objects for currently created zip file
window.zip = null;
window.zipSize = 0;
+// Init the list of files (used by LDAP invitation feature)
+window.filesURLs = [];
// Copy a link to clipboard
function copyToClipboard(txt) {
@@ -184,6 +186,28 @@ function updateMailLink() {
$('#mailto').attr('href', u);
}
+// [Invitation feature] Send URLs of files to server
+function sendFilesURLs() {
+ if (window.filesURLs.length > 0) {
+ $.ajax({
+ url: sendFilesURLsURL,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ urls: window.filesURLs
+ },
+ success: function(data, textStatus, jqXHR) {
+ if (data.success) {
+ Materialize.toast(data.msg, 6000, 'teal accent-3');
+ } else {
+ Materialize.toast(data.msg, 10000, 'red accent-2');
+ }
+ }
+ });
+ }
+}
+
+
// Start uploading the files (called from and from drop zone)
function handleFiles(f) {
var delay = $('#delete-day');
@@ -221,6 +245,7 @@ function handleFiles(f) {
} else {
if (window.fileList === undefined || window.fileList === null) {
window.fileList = Array.prototype.slice.call(f);
+ window.nbFiles = window.fileList.length;
$('#results').show();
uploadFile(0, delay.val(), del_at_first_view.is(':checked'));
} else {
@@ -492,6 +517,10 @@ function updateProgressBar(data) {
// Add the file to localStorage
addItem(data.name, url, data.size, del_at_first_view, created_at, delay, data.short, data.token);
+ if (isGuest && short !== null) {
+ window.filesURLs.push(JSON.stringify({ name: data.name, short: data.short, url: url, size: data.size, created_at: created_at, delay: delay, token: data.token }));
+ }
+
// Upload next file
window.fc++;
i++;
@@ -506,6 +535,9 @@ function updateProgressBar(data) {
if ($('#zip-files').is(':checked')) {
$('label[for="zip-files"]').click();
}
+ if (isGuest) {
+ sendFilesURLs();
+ }
}
} else {
@@ -522,6 +554,9 @@ function updateProgressBar(data) {
}
} else {
addAlertOnFile(data.msg, i, delay, del_at_first_view);
+ if (isGuest) {
+ sendFilesURLs();
+ }
}
}
}
diff --git a/themes/default/templates/index.html.ep b/themes/default/templates/index.html.ep
index ae47fcf..f01ad9d 100644
--- a/themes/default/templates/index.html.ep
+++ b/themes/default/templates/index.html.ep
@@ -22,6 +22,15 @@
+% }
+% if (stash('invitation')) {
+
+
+
+ <%= l('The link(s) of your file(s) will automatically be sent by mail to %1 (%2)', stash('invitation')->ldap_user, stash('invitation')->ldap_user_mail) %>
+
+
+
% }
@@ -71,12 +80,12 @@
<%= l('Files deleted at first download') %>
% }
-
+
config('force_burn_after_reading') %>
+ data-checked="<%= 'data-checked' if config('force_burn_after_reading') %>"
+ <%= 'disabled="disabled"' if config('force_burn_after_reading') %>
>
@@ -91,7 +100,7 @@
- % if (config('allow_pwd_on_files')) {
+ % if (config('allow_pwd_on_files') && (!stash('invitation'))) {