mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
Simplify FTP configuration using new format
This commit is contained in:
parent
673cd48db0
commit
a36bc03970
9 changed files with 155 additions and 201 deletions
|
|
@ -1,78 +1,68 @@
|
|||
<load target="./js/config.js" usecdn="true" />
|
||||
<load target="../install/lang/lang.xml" usecdn="true" />
|
||||
<load target="../../session/tpl/js/session.js" usecdn="true" />
|
||||
<load target="./js/config.js" />
|
||||
<load target="../../session/tpl/js/session.js" />
|
||||
<div class="x_page-header">
|
||||
<h1>{$lang->menu_gnb_sub['adminConfigurationFtp']} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_ftp" target="_blank">{$lang->help}</a></h1>
|
||||
</div>
|
||||
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/admin/tpl/config_ftp/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
<p class="x_help-block">{$lang->detail_about_ftp_info}</p>
|
||||
<form action="./" id="ftp_form" method="post" enctype="multipart/form-data" class="x_form-horizontal" ruleset="installFtpInfo">
|
||||
<input type="hidden" name="module" value="install" />
|
||||
<input type="hidden" name="act" value="procInstallAdminSaveFTPInfo" />
|
||||
<input type="hidden" name="success_return_url" value="{base64_decode($success_return_url)}" />
|
||||
<p>{$lang->detail_about_ftp_info}</p>
|
||||
<form action="./" id="ftp_form" method="post" class="x_form-horizontal" ruleset="installFtpInfo">
|
||||
<input type="hidden" name="module" value="admin" />
|
||||
<input type="hidden" name="act" value="procAdminUpdateFTPInfo" />
|
||||
<input type="hidden" name="success_return_url" value="{$success_return_url}" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/admin/tpl/config_ftp/1" />
|
||||
<section class="section">
|
||||
<h1>{$lang->subtitle_primary}</h1>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="ftp_user">{$lang->user_id}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" name="ftp_user" id="ftp_user" value="{$ftp_info->ftp_user}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="ftp_password">{$lang->password}</label>
|
||||
<div class="x_controls">
|
||||
<input type="password" name="ftp_password" id="ftp_password" value="" />
|
||||
<p class="x_help-block">{$lang->about_ftp_password}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="__xe_path" class="x_control-group" hidden>
|
||||
<label class="x_control-label" for="ftp_root_path">{$lang->msg_ftp_installed_ftp_realpath}</label>
|
||||
<div class="x_controls">
|
||||
<span class="x_input-append">
|
||||
<input type="text" name="ftp_root_path" id="ftp_root_path" value="{$ftp_info->ftp_root_path}" />
|
||||
<a href="#ftpSuggestion" onclick="getFTPList(); return false;" class="x_btn tgAnchor">{$lang->ftp_get_list}</a>
|
||||
</span>
|
||||
<div id="ftpSuggestion" class="x_thumbnail">
|
||||
</div>
|
||||
<p class="x_help-block" style="margin-top:10px">{$lang->msg_ftp_installed_realpath} : {_XE_PATH_}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section" style="margin-bottom:0">
|
||||
<h1>{$lang->subtitle_advanced}</h1>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="ftp_host">{$lang->ftp_host}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" name="ftp_host" id="ftp_host" value="{$ftp_info->ftp_host ? $ftp_info->ftp_host : '127.0.0.1'}" /> Default : 127.0.0.1
|
||||
<input type="text" name="ftp_host" id="ftp_host" value="{$ftp_info['host'] ?: 'localhost'}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="ftp_port">{$lang->ftp_port}</label>
|
||||
<div class="x_controls">
|
||||
<input type="number" name="ftp_port" id="ftp_port" value="{$ftp_info->ftp_port ? $ftp_info->ftp_port : '21'}" /> Default : 21
|
||||
<input type="number" name="ftp_port" id="ftp_port" value="{$ftp_info['port'] ?: '21'}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="ftp_user">{$lang->user_id}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" name="ftp_user" id="ftp_user" value="{$ftp_info['user']}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="ftp_pass">{$lang->password}</label>
|
||||
<div class="x_controls">
|
||||
<input type="password" name="ftp_pass" id="ftp_pass" value="" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="ftp_path">{$lang->msg_ftp_installed_ftp_realpath}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" name="ftp_path" id="ftp_path" style="min-width:90%" value="{$ftp_info['path'] ?: _XE_PATH_}" />
|
||||
<br />
|
||||
<p class="x_help-block">{$lang->msg_ftp_autodetected_ftp_realpath} : {_XE_PATH_}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<div class="x_control-label">{$lang->use_ftp_passive_mode}</div>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline" for="ftp_passive_y">
|
||||
<input type="radio" name="ftp_pasv" id="ftp_passive_y" value="Y" checked="checked"|cond="$ftp_info->ftp_pasv == 'Y'" />
|
||||
<label class="x_inline" for="ftp_pasv_y">
|
||||
<input type="radio" name="ftp_pasv" id="ftp_pasv_y" value="Y" checked="checked"|cond="$ftp_info['pasv']" />
|
||||
{$lang->cmd_yes}
|
||||
</label>
|
||||
<label class="x_inline" for="ftp_passive_n">
|
||||
<input type="radio" name="ftp_pasv" id="ftp_passive_n" value="N" checked="checked"|cond="$ftp_info->ftp_pasv != 'Y'" />
|
||||
<label class="x_inline" for="ftp_pasv_n">
|
||||
<input type="radio" name="ftp_pasv" id="ftp_pasv_n" value="N" checked="checked"|cond="!$ftp_info['pasv']" />
|
||||
{$lang->cmd_no}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="sftp_n">{$lang->use_sftp_support}</label>
|
||||
<label class="x_control-label">{$lang->use_sftp_support}</label>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline" for="sftp_y"><input type="radio" name="sftp" id="sftp_y" value="Y" checked="checked"|cond="$ftp_info->sftp == 'Y'" disabled|cond="!$sftp_support" />{$lang->cmd_yes}</label>
|
||||
<label class="x_inline" for="sftp_n"><input type="radio" name="sftp" id="sftp_n" value="N" checked="checked"|cond="$ftp_info->sftp != 'Y'" /> {$lang->cmd_no}</label>
|
||||
<label class="x_inline" for="ftp_sftp_y"><input type="radio" name="ftp_sftp" id="ftp_sftp_y" value="Y" checked="checked"|cond="$ftp_info['sftp']" disabled|cond="!$sftp_support" /> {$lang->cmd_yes}</label>
|
||||
<label class="x_inline" for="ftp_sftp_n"><input type="radio" name="ftp_sftp" id="ftp_sftp_n" value="N" checked="checked"|cond="!$ftp_info['sftp']" /> {$lang->cmd_no}</label>
|
||||
<p class="x_help-black" cond="!$sftp_support">{$lang->disable_sftp_support}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -80,47 +70,4 @@
|
|||
<div class="btnArea" style="margin-top:0">
|
||||
<input type="submit" value="{$lang->cmd_save}" class="x_btn x_btn-primary x_pull-right" />
|
||||
</div>
|
||||
</form>
|
||||
<style>
|
||||
#ftpSuggestion{padding:8px 15px;margin:2px 0;position:absolute;background:#fff;box-shadow:1px 1px 1px #eee;width:188px;z-index:99}
|
||||
#ftpSuggestion ul{margin:0;padding:0;list-style:none}
|
||||
#ftpSuggestion button{overflow:visible;padding:0;background:none;border:0;display:block;width:100%;text-align:left}
|
||||
#ftpSuggestion button:hover,
|
||||
#ftpSuggestion button:focus{font-weight:bold}
|
||||
</style>
|
||||
<script>
|
||||
jQuery(function($){
|
||||
$('#ftp_form').submit(function(){
|
||||
if($(this).data('found')){
|
||||
return true;
|
||||
}
|
||||
|
||||
$('input[name="ftp_root_path"]').val('');
|
||||
|
||||
param = {
|
||||
'ftp_user': $('#ftp_user').val(),
|
||||
'ftp_password': $('#ftp_password').val(),
|
||||
'ftp_host': $('#ftp_host').val(),
|
||||
'ftp_port': $('#ftp_port').val(),
|
||||
'ftp_pasv': $('input:radio[name="ftp_pasv"]:checked').val(),
|
||||
'sftp': $('input:radio[name="sftp"]:checked').val()
|
||||
}
|
||||
|
||||
$.exec_json('admin.getAdminFTPPath', param, function(data){
|
||||
if(data.error) return;
|
||||
|
||||
if(!data.found_path){
|
||||
alert('{$lang->msg_find_xe_path_fail}');
|
||||
$('#__xe_path').show();
|
||||
$('#ftp_form').data('found', true);
|
||||
return;
|
||||
}
|
||||
|
||||
$('input[name="ftp_root_path"]').val(data.found_path);
|
||||
$('#ftp_form').data('found', true).submit();
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -16,90 +16,6 @@ function viewSiteSearch(){
|
|||
jQuery(".site_keyword_search").css("display","");
|
||||
}
|
||||
|
||||
function getFTPList(pwd)
|
||||
{
|
||||
var form = jQuery("#ftp_form").get(0);
|
||||
if(typeof(pwd) != 'undefined')
|
||||
{
|
||||
form.ftp_root_path.value = pwd;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!form.ftp_root_path.value && typeof(form.sftp) != 'undefined' && form.sftp.checked)
|
||||
{
|
||||
form.ftp_root_path.value = xe_root;
|
||||
}
|
||||
else
|
||||
{
|
||||
form.ftp_root_path.value = "/";
|
||||
}
|
||||
}
|
||||
|
||||
var params = [];
|
||||
//ftp_pasv not used
|
||||
params.ftp_user = jQuery("#ftp_user").val();
|
||||
params.ftp_password =jQuery("#ftp_password").val();
|
||||
params.ftp_host = jQuery("#ftp_host").val();
|
||||
params.ftp_port = jQuery("#ftp_port").val();
|
||||
params.ftp_root_path = jQuery("#ftp_root_path").val();
|
||||
params.sftp = jQuery("input[name=sftp]:checked").val();
|
||||
|
||||
exec_xml('admin', 'getAdminFTPList', params, completeGetFtpInfo, ['list', 'error', 'message'], params, form);
|
||||
}
|
||||
|
||||
function removeFTPInfo()
|
||||
{
|
||||
var params = {};
|
||||
exec_xml('install', 'procInstallAdminRemoveFTPInfo', params, filterAlertMessage, ['error', 'message'], params);
|
||||
}
|
||||
|
||||
function completeGetFtpInfo(ret_obj)
|
||||
{
|
||||
if(ret_obj.error !== 0)
|
||||
{
|
||||
alert(ret_obj.error);
|
||||
alert(ret_obj.message);
|
||||
return;
|
||||
}
|
||||
var e = jQuery("#ftpSuggestion").empty();
|
||||
|
||||
var list = "";
|
||||
if(!jQuery.isArray(ret_obj.list.item))
|
||||
{
|
||||
ret_obj.list.item = [ret_obj.list.item];
|
||||
}
|
||||
|
||||
pwd = jQuery("#ftp_form").get(0).ftp_root_path.value;
|
||||
if(pwd != "/")
|
||||
{
|
||||
arr = pwd.split("/");
|
||||
arr.pop();
|
||||
arr.pop();
|
||||
arr.push("");
|
||||
target = arr.join("/");
|
||||
list = list + "<li><button type='button' onclick=\"getFTPList('"+target+"')\">../</button></li>";
|
||||
}
|
||||
|
||||
for(var i=0;i<ret_obj.list.item.length;i++)
|
||||
{
|
||||
var v = ret_obj.list.item[i];
|
||||
if(v == "../")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if( v == "./")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
list = list + "<li><button type='button' onclick=\"getFTPList('"+pwd+v+"')\">"+v+"</button></li>";
|
||||
}
|
||||
}
|
||||
list = "<ul>"+list+"</ul>";
|
||||
e.append(jQuery(list));
|
||||
}
|
||||
|
||||
var icon = null;
|
||||
function deleteIcon(iconname){
|
||||
var params = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue