<%
include("language.html")
if _SESSION["logined"] ~= nil then

local domain = _GET["domain"] or _POST["domain"]
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FTP Messages</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<%if _COOKIE["admin_lang"] == "schinese" or _COOKIE["admin_lang"] == "tchinese" or _COOKIE["admin_lang"] == "japanese" then%>
body {margin:0;padding:0;font:12px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
textarea {font:12px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
<%else%>
body {margin:0;padding:0;font:11px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
textarea {font:11px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
<%end%>
img {border:0px;}

button{
border:none;background:none;padding:0;
margin:0;width:auto;overflow:visible;text-align:center;
white-space:nowrap;height:24px;line-height:24px;
cursor:pointer;
color:#000;
margin-left:2px;
margin-top:2px;
}
button span, button em{
display:block;height:24px;line-height:22px;margin:0;
}	
button span{
font-size:8pt;
padding-left:12px;
background:url("images/button_left.gif") no-repeat 0 0;
}
<%if _COOKIE["admin_lang"] == "schinese" or _COOKIE["admin_lang"] == "tchinese" or _COOKIE["admin_lang"] == "japanese" then%>
button em{
font-style:normal;padding-right:14px;
background:url("images/button.gif") no-repeat 101% 0;
}
<%else%>
button em{
font-style:normal;padding-right:10px;
background:url("images/button.gif") no-repeat 100% 0;
}
<%end%>
button:hover{
filter:alpha(opacity=60);
opacity:0.60;
color:#5488C9;
}
button span:hover{
filter:alpha(opacity=60);
opacity:0.60;
color:#5488C9;
}
.buttonhover{
filter:alpha(opacity=60);
opacity:0.60;
color:#5488C9;
}


.listhead
{
		border-top: 1px solid white; border-right: 1px solid #ACA899; border-left: 1px solid white; border-bottom: 2px solid #E1E2E3;
		font: 12px/22px arial; cursor: hand; text-align: center; background-color: #EFEFEF; overflow:hidden; height:18px;
}

.listhead2
{
		border-top: 1px solid white; border-right: 1px solid #ACA899; border-left: 1px solid white; border-bottom: 2px solid #FCC247;
		font: 12px/22px arial; cursor: hand; text-align: center; background-color: #FAF9F4; overflow:hidden; height:18px;
}

.listtr01
{
		background-color: #FFFFFF;
		padding: 2px;
		height:26px;
}

.listtr02
{
		background-color: #3366CC;
		color: #FFF;
		padding: 2px;
		height:26px;
}
</style>

<script language="javascript" src="include/common.js"></script>
<script language="javascript">
var selectedRow = null;
var lastObj = null;
var domain = "<%=domain%>";
var inputID = "";

var ajaxlock = false;
var xmlhttp,page,post;
xmlhttp = isIE ? new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest();

function ajaxRequest(pagename,poststring,method)
{
	if(ajaxlock == false)
	{	
		delete xmlhttp;
		xmlhttp = isIE ? new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest();

		ajaxlock = true;
		page = pagename;
		post = poststring;

		if(method == "GET")
			xmlhttp.open("GET",page+".html"+post);
		else
			xmlhttp.open("POST",page+".html");

		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.onreadystatechange = ajaxResponse;
		if(method != "GET")
			xmlhttp.send(post);
		else
			xmlhttp.send("");
		$("waitingdiv").style.display = "";
	}
}

function ajaxResponse()
{
	ajaxlock = false;
	$("waitingdiv").style.display = "none";
	if (xmlhttp.readyState == 4)
	{
		if (xmlhttp.status == 200)
		{
			try
			{
				switch(page)
				{
					case 'admin_set_message':	doSubmit_result();break;
				}
			}
			catch(e)
			{
				alert("<%=LANG['error_ajax']%>");
			}
		}
		else
		{
			alert("<%=LANG['error_ajax']%>");
		}
	}
}


function do_list_click(obj,strInput)
{
	var row_index = obj.rowIndex-1;
	if(selectedRow != $("maintable").rows[row_index])
	{
		if(lastObj != null)
			lastObj.className = "listtr01";

		selectedRow = $("maintable").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
	}
	else
	{
		inputID = strInput;
		showMessagebox("<%=LANG['title_ftpmessage']%>("+inputID+")","<table width='100%' border='0' cellpadding='2' cellspacing='3' style='background-color:#E6E6E6;'><tr><td><textarea id='area_message' style='width:330px;height:150px;'>"+htmldecode($(inputID).value)+"</textarea></td></tr><tr><td height=10></td></tr><tr><td><button id='btn_submit' type='submit' onclick='return ModifyMessage_submit()'><span><em><%=LANG['button_submit']%></em></span></button>&nbsp;<button id='btn_cancel' onclick='top.closewindow();'><span><em><%=LANG['button_cancel']%></em></span></button>&nbsp;<button id='btn_default' onclick='DefaultMessage();'><span><em><%=LANG['button_resetdefault']%></em></span></button></td></tr></table>",null,370,230);
		top.$("area_message").focus();

		top.$("btn_submit").onclick = function(){return ModifyMessage_submit();};
		top.$("btn_cancel").onclick = function(){top.closewindow();};
		top.$("btn_default").onclick = function(){DefaultMessage();};
	}

	return false;
}

function ModifyMessage_submit()
{
	if(inputID != "")
		$(inputID).value = top.$("area_message").value;
	top.closewindow();
}

function DefaultMessage()
{
	if(inputID != "")
		top.$("area_message").value = $(inputID+"_default").value;
}


function doSubmit()
{
	var paramStr = "";
	var welcome = encodeURIComponent($("welcome").value);
	var login = encodeURIComponent($("login").value);
	var change_dir = encodeURIComponent($("change_dir").value);
	var dir_list = encodeURIComponent($("dir_list").value);
	var file_upload = encodeURIComponent($("file_upload").value);
	var file_download = encodeURIComponent($("file_download").value);
	var system_command = encodeURIComponent($("system_command").value);
	var quit_command = encodeURIComponent($("quit_command").value);
	paramStr = "domain="+domain+"&welcome="+welcome+"&login="+login+"&change_dir="+change_dir+"&dir_list="+dir_list+"&file_upload="+file_upload+"&file_download="+file_download+"&system_command="+system_command+"&quit_command="+quit_command+"&r="+Math.random();
	ajaxRequest("admin_set_message",paramStr);
}

function doSubmit_result()
{
	top.closewindow();
}
</script>
</head>
<body style="background-color:#E6E6E6;padding:4px;">

<div id="waitingdiv" style="position:absolute; z-index:100; top:0px; left:0px; width:100%; height:100%; background:#777; filter:alpha(opacity=60); opacity:0.60; display:none;" align="center">
<div style="position:absolute; top:20%; left:20%; width:250px; height:100px;"><img src="images/loading2.gif" border="0">
<H2><b><%=LANG["title_updating"]%></b></H2></div></div>

<div style="padding:3px;">
	<table cellSpacing="0" cellPadding="0" border="0"><tr>
		<td><img src="images/message48.png">&nbsp;&nbsp;&nbsp;</td><td><%=LANG["str_ftpmessage_tip"]%></td>
	</tr></table>
</div>

<div style="padding-top:2px; overflow-x:hidden;">
	<table id="listhead" width="99%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;border-left:1px solid #919B9C;border-top:1px solid #919B9C;">
	<tr>
	<td class="listhead" width="35%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable', 0)"><%=LANG["title_ftpmessage"]%></td>
	<td class="listhead" width="65%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable', 1)"><%=LANG["title_expanation"]%></td>
	</tr>
	</table>
</div>


<table id="listtable" width="99%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed; border:1px solid #919B9C;">
	<thead><tr height="0">
	<td width="35%"></td>
	<td width="65%"></td>
	</tr></thead>
	<tbody id="maintable">
	<tr class="listtr01" onmouseup="do_list_click(this,'welcome');"><td>Welcome Message</td><td><%=LANG["str_ftpmessage1"]%></td></tr>
	<input id="welcome" type="hidden" value="<%=specialhtml_encode(c_GetOptionStr(domain,DOPTION_MESSAGE_WELCOME_STR))%>">
	<input id="welcome_default" type="hidden" value="%ServerName ready...">
	<tr class="listtr01" onmouseup="do_list_click(this,'login');"><td>User Login</td><td><%=LANG["str_ftpmessage2"]%></td></tr>
	<input id="login" type="hidden" value="<%=specialhtml_encode(c_GetOptionStr(domain,DOPTION_MESSAGE_LOGIN_STR))%>">
	<input id="login_default" type="hidden" value="User %Name logged in.">
	<tr class="listtr01" onmouseup="do_list_click(this,'change_dir');"><td>Change Directory</td><td><%=LANG["str_ftpmessage3"]%></td></tr>
	<input id="change_dir" type="hidden" value="<%=specialhtml_encode(c_GetOptionStr(domain,DOPTION_MESSAGE_CHANGE_DIR_STR))%>">
	<input id="change_dir_default" type="hidden" value="CWD command ok. &quot;%Dir&quot; is current directory.">
	<tr class="listtr01" onmouseup="do_list_click(this,'dir_list');"><td>Directory List</td><td><%=LANG["str_ftpmessage4"]%></td></tr>
	<input id="dir_list" type="hidden" value="<%=specialhtml_encode(c_GetOptionStr(domain,DOPTION_MESSAGE_DIR_LIST_STR))%>">
	<input id="dir_list_default" type="hidden" value="Transfer ok.">
	<tr class="listtr01" onmouseup="do_list_click(this,'file_upload');"><td>File Upload</td><td><%=LANG["str_ftpmessage5"]%></td></tr>
	<input id="file_upload" type="hidden" value="<%=specialhtml_encode(c_GetOptionStr(domain,DOPTION_MESSAGE_FILE_UPLOAD_STR))%>">
	<input id="file_upload_default" type="hidden" value="File received ok. Transferred:%ConTransferBytes;Average speed is:%ConTransferSpeedKBS">
	<tr class="listtr01" onmouseup="do_list_click(this,'file_download');"><td>File Download</td><td><%=LANG["str_ftpmessage6"]%></td></tr>
	<input id="file_download" type="hidden" value="<%=specialhtml_encode(c_GetOptionStr(domain,DOPTION_MESSAGE_FILE_DOWNLOAD_STR))%>">
	<input id="file_download_default" type="hidden" value="File sent ok. Transferred:%ConTransferBytes;Average speed is:%ConTransferSpeedKBS">
	<tr class="listtr01" onmouseup="do_list_click(this,'system_command');"><td>System Command</td><td><%=LANG["str_ftpmessage7"]%></td></tr>
	<input id="system_command" type="hidden" value="<%=specialhtml_encode(c_GetOptionStr(domain,DOPTION_MESSAGE_SYSTEM_COMMAND_STR))%>">
	<input id="system_command_default" type="hidden" value="UNIX Type: L8">
	<tr class="listtr01" onmouseup="do_list_click(this,'quit_command');"><td>Quit Command</td><td><%=LANG["str_ftpmessage8"]%></td></tr>
	<input id="quit_command" type="hidden" value="<%=specialhtml_encode(c_GetOptionStr(domain,DOPTION_MESSAGE_QUIT_COMMAND_STR))%>">
	<input id="quit_command_default" type="hidden" value="Goodbye.">
	</tbody>
</table>

<div style="margin-top:10px;width:100%;text-align:center;">
<button type='submit' onclick='doSubmit();'><span><em><%=LANG["button_submit"]%></em></span></button>&nbsp;
<button onclick='top.closewindow();'><span><em><%=LANG["button_cancel"]%></em></span></button>
</div>

</body>
</html>

<% 
else
	print("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>")
	print("<script>alert('"..LANG["session_expire"].."');top.location='admin_login.html';</script>")
end 
%>

<noscript><center><H2><%=LANG["error_nojavascript"]%></H2></center></noscript>