%
-- Plugin Name: Send Files
-- Description: Generate multiple weblinks and send them
-- Author: wftpserver (https://www.wftpserver.com)
-- Version: 1.4
local tab = {}
tab.plugin_enabled = true
tab.extbutton_name = LANG["str_app_sendfile"] or "Send Files"
tab.extbutton_func = "make_multiple_weblinks()"
tab.extbutton_icon = "plugins/sendfiles/icon.gif"
tab.need_selectfile = false
local str_sendfile_tips = LANG["str_sendfile_tips"] or "Generate the web links for the following files/folders:"
local smtperror = ""
if c_CanSendMessage() == false then
smtperror = "alert('"..LANG["str_no_smtpconfig"].."'); return false;"
end
tab.extjs = [[
function make_multiple_weblinks()
{
]]..smtperror..[[
var filelist = getCheckedDirlist(0);
var dirlist = getCheckedDirlist(1);
if(filelist == "" && dirlist == "")
{
if(selectedRow == null)
{
alert("]]..LANG['error_nofile']..[[");
return false;
}
else
{
filelist = selectedRow.cells[0].getAttribute("name");
}
}
var temp_filelist = filelist.replace(/\|\|/ig, "\n");
var temp_dirlist = dirlist.replace(/\|\|/ig, "\n");
showMessagebox("Send Files","
",null,530,400);
$("input_files").value = temp_filelist + "\n" + temp_dirlist;
if(isIE)
{
$("btn_submit").onclick = function(){send_weblinks();};
$("btn_cancel").onclick = function(){top.closewindow();};
}
}
function send_weblinks()
{
var xmlhttpObj = isIE ? new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
var expiretime = htmldecode($("expiretime").value);
var downloadlimit = htmldecode($("downloadlimit").value);
var downloadpass = htmldecode($("downloadpass").value);
var mailaddress = htmldecode($("mail_address").value);
var sender_mailaddress = htmldecode($("sender_mail_address").value);
var mail_message = htmldecode($("mail_message").value);
var weblink_url = "]]..c_GetWeblinkURL()..[[";
var localaddress = weblink_url;
if(localaddress == "")
localaddress = location.href.replace(/\#/g,"");
var filelist = getCheckedDirlist(0);
var dirlist = getCheckedDirlist(1);
if(filelist == "" && dirlist == "")
{
if(selectedRow != null)
{
if(selectedRow.cells[2].innerHTML == "]]..LANG['list_directory']..[[")
dirlist = selectedRow.cells[0].getAttribute("name");
else
filelist = selectedRow.cells[0].getAttribute("name");
}
}
if(mailaddress == "" || mailaddress == "]]..LANG['str_multiple_emails']..[[")
{
alert("]]..LANG['str_invalid_email']..[[");
$("mail_address").focus();
return false;
}
$("waitingdiv").style.display = "";
xmlhttpObj.open("POST","plugins/sendfiles/generate_weblinks.html");
xmlhttpObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttpObj.onreadystatechange = function(){
if (xmlhttpObj.readyState == 4)
{
ajaxlock = false;
if (xmlhttpObj.status == 200)
{
try
{
if(xmlhttpObj.responseText != "")
{
alert(xmlhttpObj.responseText);
}
unselectAll();
top.closewindow();
}
catch(e)
{
}
finally
{
$("waitingdiv").style.display = "none";
}
}
else
{
$("waitingdiv").style.display = "none";
}
}
};
xmlhttpObj.send("filelist="+urlEncode(filelist)+"&dirlist="+urlEncode(dirlist)+"&mailaddress="+urlEncode(mailaddress)+"&sender_mailaddress="+urlEncode(sender_mailaddress)+"&mail_message="+urlEncode(mail_message)+"&localaddress="+urlEncode(localaddress)+"&expiretime="+urlEncode(expiretime)+"&downloadlimit="+urlEncode(downloadlimit)+"&downloadpass="+urlEncode(downloadpass)+"&r="+Math.random());
}
]]
register_plugin(tab)
%>