diff --git a/class/core/site_api.py b/class/core/site_api.py index f934bbd71..f653a7644 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -91,14 +91,16 @@ class site_api: return public.returnJson(True, public.getNumLines(logPath, 1000)) def getSitePhpVersion(self, siteName): - conf = public.readFile( - public.getServerDir() + '/openresty/nginx/conf/vhost/' + siteName + '.conf') + conf = public.readFile(self.getHostConf(siteName)) rep = "enable-php-([0-9]{2,3})\.conf" tmp = re.search(rep, conf).groups() data = {} data['phpversion'] = tmp[0] return public.getJson(data) + def getHostConf(self, siteName): + return public.getServerDir() + '/openresty/nginx/conf/vhost/' + siteName + '.conf' + def addDomain(self, domain, webname, pid): pass diff --git a/route/site.py b/route/site.py index 282a64de9..d4ac15e48 100644 --- a/route/site.py +++ b/route/site.py @@ -49,6 +49,13 @@ def getSitePhpVersion(): return site_api.site_api().getSitePhpVersion(siteName) +@site.route('get_host_conf', methods=['POST']) +def getHostConf(): + siteName = request.form.get('siteName', '').encode('utf-8') + host = site_api.site_api().getHostConf(siteName) + return public.getJson({'host': host}) + + @site.route('get_root_dir', methods=['POST']) def getRootDir(): data = {} diff --git a/static/app/site.js b/static/app/site.js index cf7d9dcce..922b6efc9 100755 --- a/static/app/site.js +++ b/static/app/site.js @@ -178,17 +178,12 @@ function webAdd(type) { ", }); if ($(".success-msg").height() < 150) { - $(".success-msg").find("img").css({ - "width": "150px", - "margin-top": "30px" - }); + $(".success-msg").find("img").css({"width": "150px","margin-top": "30px"}); } } } else { - layer.msg(ret.msg, { - icon: 2 - }); + layer.msg(ret.msg, {icon: 2}); } layer.close(loadT); },'json'); @@ -1020,9 +1015,9 @@ function webEdit(id,website,endTime,addtime){ +"

"+lan.site.site_menu_3+"

" +"

"+lan.site.site_menu_4+"

" +"

"+lan.site.site_menu_5+"

" - +"

"+lan.site.site_menu_6+"

" + +"

"+lan.site.site_menu_6+"

" +"

"+lan.site.site_menu_7+"

" - +"

"+lan.site.site_menu_8+"

" + +"

"+lan.site.site_menu_8+"

" +"

"+lan.site.site_menu_10+"

" +"

"+lan.site.site_menu_11+"

" +"

"+lan.site.site_menu_12+"

" @@ -2083,7 +2078,7 @@ function ChangeSaveSSL(siteName){ } //PHP版本 -function PHPVersion(siteName){ +function phpVersion(siteName){ $.post('/site/get_site_php_version','siteName='+siteName,function(version){ console.log(version); if(version.status === false){ @@ -2143,50 +2138,6 @@ function PHPVersion(siteName){ },'json'); } -//tomcat -function toTomcat(siteName){ - $.post('/site?action=GetSitePHPVersion','siteName='+siteName,function(version){ - if(version.status === false){ - layer.msg(lan.site.a_n_n,{icon:5}); - return; - } - $.post('/site?action=GetPHPVersion',function(rdata){ - var versionSelect =''; - if(version.tomcatversion){ - var tomcat_checked = ''; - if(version.tomcat != -1) tomcat_checked = 'checked'; - versionSelect += '
\ -
\ - \ -
\ - \ -
' - }else{ - layer.msg(lan.site.tomcat_err_msg,{icon:2}); - versionSelect = ''+lan.site.tomcat_err_msg1+'' - } - - $("#webedit-con").html(versionSelect); - }); - }); -} -//设置Tomcat -function Tomcat(siteName){ - var data = 'siteName='+siteName; - var loadT = layer.msg(lan.public.config,{icon:16,time:0,shade: [0.3, '#000']}); - $.post('/site?action=SetTomcat',data,function(rdata){ - layer.close(loadT); - layer.msg(rdata.msg,{icon:rdata.status?1:2}); - }); -} - //设置PHP版本 function SetPHPVersion(siteName){ @@ -2199,14 +2150,15 @@ function SetPHPVersion(siteName){ } //配置文件 -function ConfigFile(webSite){ - $.post('/files?action=GetFileBody','path=/www/server/panel/vhost/'+getCookie('serverType')+'/'+webSite+'.conf',function(rdata){ +function configFile(webSite){ + var info = syncPost('/site/get_host_conf', {siteName:webSite}); + $.post('/files/get_body','path='+info['host'],function(rdata){ var mBody = "
\ - \ + \
\ - \ + \ \
\
"; @@ -2220,23 +2172,23 @@ function ConfigFile(webSite){ $("#SaveConfigFileBtn").click(function(){ $("#configBody").empty(); $("#configBody").text(editor.getValue()); - SaveConfigFile(webSite,rdata.encoding); + saveConfigFile(webSite,rdata.data.encoding, info['host']); }) - }); + },'json'); } //保存配置文件 -function SaveConfigFile(webSite,encoding){ - var data = 'encoding='+encoding+'&data='+encodeURIComponent($("#configBody").val())+'&path=/www/server/panel/vhost/'+getCookie('serverType')+'/'+webSite+'.conf'; - var loadT = layer.msg(lan.site.saving_txt,{icon:16,time:0,shade: [0.3, '#000']}); - $.post('/files?action=SaveFileBody',data,function(rdata){ +function saveConfigFile(webSite,encoding,path){ + var data = 'encoding='+encoding+'&data='+encodeURIComponent($("#configBody").val())+'&path='+path; + var loadT = layer.msg('保存中...',{icon:16,time:0,shade: [0.3, '#000']}); + $.post('/files/save_body',data,function(rdata){ layer.close(loadT); if(rdata.status){ layer.msg(rdata.msg,{icon:1}); }else{ layer.msg(rdata.msg,{icon:2,time:0,shade:0.3,shadeClose:true}); } - }); + },'json'); } //伪静态