mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
+13
-2
@@ -61,7 +61,7 @@ class site_api:
|
||||
|
||||
def list(self):
|
||||
_list = public.M('sites').where('', ()).field(
|
||||
'id,name,path,status,ps,addtime').limit('0,5').order('id desc').select()
|
||||
'id,name,path,status,ps,addtime,edate').limit('0,5').order('id desc').select()
|
||||
_ret = {}
|
||||
_ret['data'] = _list
|
||||
|
||||
@@ -101,7 +101,7 @@ class site_api:
|
||||
self.sitePort = port.strip().replace(' ', '')
|
||||
|
||||
# 写入数据库
|
||||
pid = public.M('sites').add('name,path,status,ps,addtime',
|
||||
pid = public.M('sites').add('name,path,status,ps,addtime,edate',
|
||||
(self.siteName, self.sitePath, '1', ps, ''))
|
||||
|
||||
# public.M('domain').add('pid,name,port,addtime',
|
||||
@@ -109,3 +109,14 @@ class site_api:
|
||||
data = {}
|
||||
data['siteStatus'] = False
|
||||
return public.getJson(data)
|
||||
|
||||
def delete(self, sid):
|
||||
public.M('sites').where("id=?", (sid,)).delete()
|
||||
return public.returnJson(True, '站点删除成功!')
|
||||
|
||||
def setEndDate(self, sid, edate):
|
||||
result = public.M('sites').where(
|
||||
'id=?', (sid,)).setField('edate', edate)
|
||||
siteName = public.M('sites').where('id=?', (sid,)).getField('name')
|
||||
public.writeLog('TYPE_SITE', '设置成功,站点到期后将自动停止!', (siteName, edate))
|
||||
return public.returnJson(True, '设置成功,站点到期后将自动停止!')
|
||||
|
||||
@@ -94,7 +94,8 @@ CREATE TABLE IF NOT EXISTS `sites` (
|
||||
`status` TEXT,
|
||||
`index` TEXT,
|
||||
`ps` TEXT,
|
||||
`addtime` TEXT
|
||||
`addtime` TEXT,
|
||||
`edate` TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `domain` (
|
||||
|
||||
+9
-1
@@ -38,6 +38,13 @@ def getRootDir():
|
||||
return public.getJson(data)
|
||||
|
||||
|
||||
@site.route('set_end_date', methods=['POST'])
|
||||
def setEndDate():
|
||||
sid = request.form.get('id', '').encode('utf-8')
|
||||
edate = request.form.get('edate', '').encode('utf-8')
|
||||
return site_api.site_api().setEndDate(sid, edate)
|
||||
|
||||
|
||||
@site.route('add', methods=['POST'])
|
||||
def add():
|
||||
webname = request.form.get('webinfo', '').encode('utf-8')
|
||||
@@ -50,4 +57,5 @@ def add():
|
||||
|
||||
@site.route('delete', methods=['POST'])
|
||||
def delete():
|
||||
pass
|
||||
sid = request.form.get('id', '').encode('utf-8')
|
||||
return site_api.site_api().delete(sid)
|
||||
|
||||
+43
-41
@@ -90,10 +90,10 @@ function getWeb(page, search) {
|
||||
dates = '0000-00-00';
|
||||
}
|
||||
var loadT = layer.msg(lan.site.saving_txt, { icon: 16, time: 0, shade: [0.3, "#000"]});
|
||||
$.post('/site?action=SetEdate','id='+id+'&edate='+dates,function(rdata){
|
||||
$.post('/site/set_end_date','id='+id+'&edate='+dates,function(rdata){
|
||||
layer.close(loadT);
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:5});
|
||||
});
|
||||
},'json');
|
||||
}
|
||||
});
|
||||
this.click();
|
||||
@@ -230,7 +230,8 @@ function webAdd(type) {
|
||||
<div class='line'>\
|
||||
<span class='tname'>根目录</span>\
|
||||
<div class='info-r c4'>\
|
||||
<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>\
|
||||
<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+"\
|
||||
@@ -269,23 +270,25 @@ function webAdd(type) {
|
||||
})
|
||||
|
||||
$('#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');
|
||||
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);
|
||||
}
|
||||
|
||||
var placeholder = $("#inputPath").attr('placeholder');
|
||||
$("#inputPath").val(placeholder+'/'+ress);
|
||||
|
||||
if(res.length > 15){
|
||||
res = res.substr(0,15);
|
||||
}
|
||||
|
||||
$("#Wbeizhu").val(ress);
|
||||
})
|
||||
|
||||
//备注
|
||||
@@ -295,7 +298,7 @@ function webAdd(type) {
|
||||
if (len > 20) {
|
||||
str = str.substring(0, 20);
|
||||
$(this).val(str);
|
||||
layer.msg(lan.site.domain_len_msg, {
|
||||
layer.msg('不能超出20个字符!', {
|
||||
icon: 0
|
||||
});
|
||||
}
|
||||
@@ -522,11 +525,11 @@ function webDelete(wid, wname){
|
||||
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+path, function(ret){
|
||||
$.post("/site/delete","id=" + wid + "&webname=" + wname + path, function(ret){
|
||||
layer.closeAll();
|
||||
layer.msg(ret.msg,{icon:ret.status?1:2})
|
||||
getWeb(1);
|
||||
});
|
||||
},'json');
|
||||
},thtml);
|
||||
}
|
||||
|
||||
@@ -546,7 +549,7 @@ function allDeleteSite(){
|
||||
var thtml = "<div class='options'>\
|
||||
<label style=\"width:100%;\"><input type='checkbox' id='delpath' name='path'><span>"+lan.site.all_del_info+"</span></label>\
|
||||
</div>";
|
||||
SafeMessage(lan.site.all_del_site,"<a style='color:red;'>"+lan.get('del_all_site',[dataList.length])+"</a>",function(){
|
||||
safeMessage(lan.site.all_del_site,"<a style='color:red;'>"+lan.get('del_all_site',[dataList.length])+"</a>",function(){
|
||||
layer.closeAll();
|
||||
var path = '';
|
||||
if($("#delpath").is(":checked")){
|
||||
@@ -784,17 +787,16 @@ function delDomain(wid, wname, domain, port,type) {
|
||||
* @param {String} domain 源文本
|
||||
* @return bool
|
||||
*/
|
||||
function IsDomain(domain) {
|
||||
//domain = 'http://'+domain;
|
||||
var re = new RegExp();
|
||||
re.compile("^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
|
||||
if (re.test(domain)) {
|
||||
return (true);
|
||||
} else {
|
||||
return (false);
|
||||
}
|
||||
function isDomain(domain) {
|
||||
//domain = 'http://'+domain;
|
||||
var re = new RegExp();
|
||||
re.compile("^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
|
||||
if (re.test(domain)) {
|
||||
return (true);
|
||||
} else {
|
||||
return (false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -804,13 +806,13 @@ function IsDomain(domain) {
|
||||
* @param {String} name 主域名
|
||||
*/
|
||||
function WebBackup(id, name) {
|
||||
var loadT =layer.msg(lan.database.backup_the, {icon:16,time:0,shade: [0.3, '#000']});
|
||||
var data = "id="+id;
|
||||
$.post('/site?action=ToBackup', data, function(rdata) {
|
||||
layer.closeAll();
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2})
|
||||
getBackup(id);
|
||||
});
|
||||
var loadT =layer.msg(lan.database.backup_the, {icon:16,time:0,shade: [0.3, '#000']});
|
||||
var data = "id="+id;
|
||||
$.post('/site?action=ToBackup', data, function(rdata) {
|
||||
layer.closeAll();
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2})
|
||||
getBackup(id);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user