mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 02:19:25 +08:00
update
This commit is contained in:
@@ -54,6 +54,10 @@ def getServerDir():
|
||||
return getRootDir() + '/server'
|
||||
|
||||
|
||||
def getWwwDir():
|
||||
return getRootDir() + '/wwwroot'
|
||||
|
||||
|
||||
def getOs():
|
||||
os = execShell('uname')
|
||||
return os[0].lower().strip()
|
||||
|
||||
@@ -31,6 +31,13 @@ def getPhpVersion():
|
||||
return site_api.site_api().getPhpVersion()
|
||||
|
||||
|
||||
@site.route('get_root_dir', methods=['POST'])
|
||||
def getRootDir():
|
||||
data = {}
|
||||
data['dir'] = public.getWwwDir()
|
||||
return public.getJson(data)
|
||||
|
||||
|
||||
@site.route('add', methods=['POST'])
|
||||
def add():
|
||||
webname = request.form.get('webinfo', '').encode('utf-8')
|
||||
|
||||
+30
-17
@@ -68,6 +68,21 @@ function mwsPost(path, args, callback){
|
||||
},'json');
|
||||
}
|
||||
|
||||
function syncPost(path, args){
|
||||
var retData;
|
||||
$.ajax({
|
||||
type : 'post',
|
||||
url : path,
|
||||
data : args,
|
||||
async : false,
|
||||
dataType:'json',
|
||||
success : function(data){
|
||||
retData = data;
|
||||
}
|
||||
});
|
||||
return retData;
|
||||
}
|
||||
|
||||
function repeatPwd(a) {
|
||||
$("#MyPassword").val(RandomStrPwd(a))
|
||||
}
|
||||
@@ -125,9 +140,7 @@ function getLocalTime(a) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function ChangePath(d) {
|
||||
function changePath(d) {
|
||||
setCookie("SetId", d);
|
||||
setCookie("SetName", "");
|
||||
var c = layer.open({
|
||||
@@ -151,18 +164,18 @@ function ChangePath(d) {
|
||||
setCookie("SetName", tmp[tmp.length - 1])
|
||||
}
|
||||
b = b.replace(/\/\//g, "/");
|
||||
GetDiskList(b);
|
||||
ActiveDisk()
|
||||
getDiskList(b);
|
||||
activeDisk();
|
||||
}
|
||||
|
||||
function GetDiskList(b) {
|
||||
function getDiskList(b) {
|
||||
var d = "";
|
||||
var a = "";
|
||||
var c = "path=" + b + "&disk=True";
|
||||
$.post("/files?action=GetDir", c, function(h) {
|
||||
$.post("/files/get_dir", c, function(h) {
|
||||
if(h.DISK != undefined) {
|
||||
for(var f = 0; f < h.DISK.length; f++) {
|
||||
a += "<dd onclick=\"GetDiskList('" + h.DISK[f].path + "')\"><span class='glyphicon glyphicon-hdd'></span> " + h.DISK[f].path + "</dd>"
|
||||
a += "<dd onclick=\"getDiskList('" + h.DISK[f].path + "')\"><span class='glyphicon glyphicon-hdd'></span> " + h.DISK[f].path + "</dd>"
|
||||
}
|
||||
$("#changecomlist").html(a)
|
||||
}
|
||||
@@ -177,7 +190,7 @@ function GetDiskList(b) {
|
||||
e = e.substring(0, 10) + "..."
|
||||
}
|
||||
}
|
||||
d += "<tr><td onclick=\"GetDiskList('" + h.PATH + "/" + g[0] + "')\" title='" + g[0] + "'><span class='glyphicon glyphicon-folder-open'></span>" + e + "</td><td>" + getLocalTime(g[2]) + "</td><td>" + g[3] + "</td><td>" + g[4] + "</td><td><span class='delfile-btn' onclick=\"NewDelFile('" + h.PATH + "/" + g[0] + "')\">X</span></td></tr>"
|
||||
d += "<tr><td onclick=\"getDiskList('" + h.PATH + "/" + g[0] + "')\" title='" + g[0] + "'><span class='glyphicon glyphicon-folder-open'></span>" + e + "</td><td>" + getLocalTime(g[2]) + "</td><td>" + g[3] + "</td><td>" + g[4] + "</td><td><span class='delfile-btn' onclick=\"NewDelFile('" + h.PATH + "/" + g[0] + "')\">X</span></td></tr>"
|
||||
}
|
||||
if(h.FILES != null && h.FILES != "") {
|
||||
for(var f = 0; f < h.FILES.length; f++) {
|
||||
@@ -201,9 +214,9 @@ function GetDiskList(b) {
|
||||
h.PATH += "/"
|
||||
}
|
||||
$("#PathPlace").find("span").html(h.PATH);
|
||||
ActiveDisk();
|
||||
activeDisk();
|
||||
return
|
||||
})
|
||||
},'json');
|
||||
}
|
||||
|
||||
function CreateFolder() {
|
||||
@@ -229,7 +242,7 @@ function CreateFolder() {
|
||||
icon: 2
|
||||
})
|
||||
}
|
||||
GetDiskList(b)
|
||||
getDiskList(b)
|
||||
})
|
||||
});
|
||||
$("#nameNOk").click(function() {
|
||||
@@ -251,11 +264,11 @@ function NewDelFile(c) {
|
||||
icon: 2
|
||||
})
|
||||
}
|
||||
GetDiskList(a)
|
||||
getDiskList(a)
|
||||
})
|
||||
}
|
||||
|
||||
function ActiveDisk() {
|
||||
function activeDisk() {
|
||||
var a = $("#PathPlace").find("span").text().substring(0, 1);
|
||||
switch(a) {
|
||||
case "C":
|
||||
@@ -285,7 +298,7 @@ function BackMyComputer() {
|
||||
$(".default").show();
|
||||
$(".file-list").hide();
|
||||
$("#PathPlace").find("span").html("");
|
||||
ActiveDisk()
|
||||
activeDisk()
|
||||
}
|
||||
|
||||
function BackFile() {
|
||||
@@ -300,7 +313,7 @@ function BackFile() {
|
||||
for(var b = 0; b < e; b++) {
|
||||
a += d[b] + "/"
|
||||
}
|
||||
GetDiskList(a.replace("//", "/"))
|
||||
getDiskList(a.replace("//", "/"))
|
||||
} else {
|
||||
a = d[0]
|
||||
}
|
||||
@@ -566,7 +579,7 @@ function isChineseChar(b) {
|
||||
return a.test(b)
|
||||
}
|
||||
|
||||
function SafeMessage(j, h, g, f) {
|
||||
function safeMessage(j, h, g, f) {
|
||||
if(f == undefined) {
|
||||
f = ""
|
||||
}
|
||||
|
||||
+35
-20
@@ -152,8 +152,6 @@ function webAdd(type) {
|
||||
var loadT = layer.msg(lan.public.the_get,{icon:16,time:0,shade: [0.3, "#000"]})
|
||||
var data = $("#addweb").serialize()+"&port="+webport+"&webinfo="+domain;
|
||||
|
||||
console.log(data);
|
||||
|
||||
$.post('/site/add', data, function(ret) {
|
||||
if(ret.status === false){
|
||||
layer.msg(ret.msg,{icon:ret.status?1:2})
|
||||
@@ -204,12 +202,15 @@ function webAdd(type) {
|
||||
for(var i=rdata.length-1;i>=0;i--){
|
||||
php_version += "<option value='"+rdata[i].version+"'>"+rdata[i].name+"</option>";
|
||||
}
|
||||
|
||||
var www = syncPost('/site/get_root_dir');
|
||||
|
||||
php_version += "</select><span id='php_w' style='color:red;margin-left: 10px;'></span></div>";
|
||||
layer.open({
|
||||
type: 1,
|
||||
skin: 'demo-class',
|
||||
area: '640px',
|
||||
title: lan.site.site_add,
|
||||
title: '添加网站',
|
||||
closeBtn: 2,
|
||||
shift: 0,
|
||||
shadeClose: false,
|
||||
@@ -221,15 +222,15 @@ function webAdd(type) {
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>"+lan.site.note+"</span>\
|
||||
<span class='tname'>备注</span>\
|
||||
<div class='info-r c4'>\
|
||||
<input id='Wbeizhu' class='bt-input-text' type='text' name='ps' placeholder='"+lan.site.note_ph+"' style='width:458px' />\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>"+lan.site.root_dir+"</span>\
|
||||
<span class='tname'>根目录</span>\
|
||||
<div class='info-r c4'>\
|
||||
<input id='inputPath' class='bt-input-text mr5' type='text' name='path' value='"+defaultPath+"/' placeholder='"+lan.site.web_root_dir+"' style='width:458px' /><span class='glyphicon glyphicon-folder-open cursor' onclick='ChangePath(\"inputPath\")'></span>\
|
||||
<input id='inputPath' class='bt-input-text mr5' type='text' name='path' value='"+www['dir']+"/' placeholder='"+www['dir']+"' style='width:458px' /><span class='glyphicon glyphicon-folder-open cursor' onclick='changePath(\"inputPath\")'></span>\
|
||||
</div>\
|
||||
</div>\
|
||||
"+php_version+"\
|
||||
@@ -266,6 +267,27 @@ function webAdd(type) {
|
||||
$('#php_w').text('');
|
||||
}
|
||||
})
|
||||
|
||||
$('#mainDomain').on('input', function() {
|
||||
// var array;
|
||||
// var res,ress;
|
||||
// var str = $(this).val().replace('http://','').replace('https://','');
|
||||
// var len = str.replace(/[^\x00-\xff]/g, "**").length;
|
||||
// array = str.split("\n");
|
||||
// ress =array[0].split(":")[0];
|
||||
// res = ress.replace(new RegExp(/([-.])/g), '_');
|
||||
// if(res.length > 15) res = res.substr(0,15);
|
||||
// if($("#inputPath").val().substr(0,defaultPath.length) == defaultPath) $("#inputPath").val(defaultPath+'/'+ress);
|
||||
// if(!isNaN(res.substr(0,1))) res = "sql"+res;
|
||||
// if(res.length > 15) res = res.substr(0,15);
|
||||
// $("#Wbeizhu").val(ress);
|
||||
// $("#ftp-user").val(res);
|
||||
// $("#data-user").val(res);
|
||||
// if(isChineseChar(str)) $('.btn-zhm').show();
|
||||
// else $('.btn-zhm').hide();
|
||||
console.log('123');
|
||||
})
|
||||
|
||||
//备注
|
||||
$('#Wbeizhu').on('input', function() {
|
||||
var str = $(this).val();
|
||||
@@ -306,7 +328,7 @@ function webPathEdit(id){
|
||||
<div class='line mt10'>\
|
||||
<span class='mr5'>"+lan.site.web_dir+"</span>\
|
||||
<input class='bt-input-text mr5' type='text' style='width:50%' placeholder='"+lan.site.web_root_dir+"' value='"+rdata+"' name='webdir' id='inputPath'>\
|
||||
<span onclick='ChangePath("inputPath")' class='glyphicon glyphicon-folder-open cursor mr20'></span>\
|
||||
<span onclick='changePath("inputPath")' class='glyphicon glyphicon-folder-open cursor mr20'></span>\
|
||||
<button class='btn btn-success btn-sm' onclick='SetSitePath("+id+")'>"+lan.public.save+"</button>\
|
||||
</div>\
|
||||
<div class='line mtb15'>\
|
||||
@@ -321,7 +343,7 @@ function webPathEdit(id){
|
||||
+'<div class="user_pw_tit" style="margin-top: -8px;padding-top: 11px;">'
|
||||
+'<span class="tit">'+lan.soft.pma_pass+'</span>'
|
||||
+'<span class="btswitch-p"><input '+(userini.pass?'checked':'')+' class="btswitch btswitch-ios" id="pathSafe" type="checkbox">'
|
||||
+'<label class="btswitch-btn phpmyadmin-btn" for="pathSafe" onclick="PathSafe('+id+')"></label>'
|
||||
+'<label class="btswitch-btn phpmyadmin-btn" for="pathSafe" onclick="pathSafe('+id+')"></label>'
|
||||
+'</span>'
|
||||
+'</div>'
|
||||
+'<div class="user_pw" style="margin-top: 10px;display:'+(userini.pass?'block;':'none;')+'">'
|
||||
@@ -350,7 +372,7 @@ function webPathEdit(id){
|
||||
}
|
||||
|
||||
//是否设置访问密码
|
||||
function PathSafe(id){
|
||||
function pathSafe(id){
|
||||
var isPass = $('#pathSafe').prop('checked');
|
||||
if(!isPass){
|
||||
$(".user_pw").show();
|
||||
@@ -491,23 +513,16 @@ function webStart(wid, wname) {
|
||||
*/
|
||||
function webDelete(wid, wname){
|
||||
var thtml = "<div class='options'>\
|
||||
<label><input type='checkbox' id='delftp' name='ftp'><span>FTP</span></label>\
|
||||
<label><input type='checkbox' id='deldata' name='data'><span>"+lan.site.database+"</span></label>\
|
||||
<label><input type='checkbox' id='delpath' name='path'><span>"+lan.site.root_dir+"</span></label>\
|
||||
</div>";
|
||||
SafeMessage(lan.site.site_del_title+"["+wname+"]",lan.site.site_del_info,function(){
|
||||
var ftp='',data='',path='';
|
||||
if($("#delftp").is(":checked")){
|
||||
ftp='&ftp=1';
|
||||
}
|
||||
if($("#deldata").is(":checked")){
|
||||
data='&database=1';
|
||||
}
|
||||
var info = '是否要删除同名根目录';
|
||||
safeMessage('删除站点'+"["+wname+"]",info, function(){
|
||||
var path='';
|
||||
if($("#delpath").is(":checked")){
|
||||
path='&path=1';
|
||||
}
|
||||
var loadT = layer.msg(lan.public.the,{icon:16,time:10000,shade: [0.3, '#000']});
|
||||
$.post("/site?action=DeleteSite","id=" + wid + "&webname=" + wname+ftp+data+path, function(ret){
|
||||
$.post("/site?action=DeleteSite","id=" + wid + "&webname=" + wname+path, function(ret){
|
||||
layer.closeAll();
|
||||
layer.msg(ret.msg,{icon:ret.status?1:2})
|
||||
getWeb(1);
|
||||
|
||||
Reference in New Issue
Block a user