diff --git a/class/core/site_api.py b/class/core/site_api.py index 51212cf6a..71d8143d6 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -1137,14 +1137,14 @@ class site_api: def modifySiteTypeNameApi(self): # 修改网站分类名称 name = request.form.get('name', '').strip().encode('utf-8') + mid = request.form.get('id', '').encode('utf-8') if not name: return public.returnJson(False, "分类名称不能为空") if len(name) > 18: return public.returnJson(False, "分类名称长度不能超过6个汉字或18位字母") - if public.M('site_types').where('id=?', (get.id,)).count() == 0: + if public.M('site_types').where('id=?', (mid,)).count() == 0: return public.returnJson(False, "指定分类不存在!") - public.M('site_types').where( - 'id=?', (get.id,)).setField('name', get.name) + public.M('site_types').where('id=?', (mid,)).setField('name', name) return public.returnJson(True, "修改成功!") def setSiteTypeApi(self): diff --git a/plugins/openresty/js/openresty.js b/plugins/openresty/js/openresty.js index f688c50f8..ad28cab74 100755 --- a/plugins/openresty/js/openresty.js +++ b/plugins/openresty/js/openresty.js @@ -151,7 +151,7 @@ function nginxSoftMain(name, version) { layer.open({ type: 1, area: '640px', - title: name + lan.soft.admin, + title: name + '管理', closeBtn: 2, shift: 0, content: '
\ diff --git a/route/static/app/site.js b/route/static/app/site.js index be2d8da0d..00efdbc84 100755 --- a/route/static/app/site.js +++ b/route/static/app/site.js @@ -2267,13 +2267,29 @@ function changeDefault(type){ onlineEditFile(0,vhref); } + +function getClassType(){ + var select = $('.site_type > select'); + $.post('/site/get_site_types',function(rdata){ + $(select).html(''); + $(select).append(''); + for (var i = 0; i'+rdata[i]['name']+''); + } + },'json'); +} +getClassType(); + + + + function setClassType(){ $.post('/site/get_site_types',function(rdata){ - var list = '',name =''; + + var list = ''; for (var i = 0; i\ - 编辑 | 删除\ + list +='' + rdata[i]['name'] + '\ + 编辑 | 删除\ '; } @@ -2295,6 +2311,8 @@ function setClassType(){
\ ' }); + + },'json'); } @@ -2305,9 +2323,9 @@ function addClassType(){ if (rdata.status){ layer.closeAll(); setClassType(); + getClassType(); } },{icon:rdata.status?1:2}); - // layer.msg(rdata.msg,{icon:rdata.status?1:2}); },'json'); } @@ -2322,12 +2340,51 @@ function removeClassType(id,name){ if (rdata.status){ layer.closeAll(); setClassType(); + getClassType(); } },{icon:rdata.status?1:2}); },'json'); }); } +function editClassType(id,name){ + if (id == 0){ + layer.msg('默认分类不可删除/不可编辑!',{icon:2}); + return; + } + + layer.open({ + type: 1, + area: '350px', + title: '修改分类管理【' + name + '】', + closeBtn: 2, + shift: 0, + content: "
\ +
\ + 分类名称\ +
\ +
\ +
\ + \ +
\ +
" + }); + + $('#site_type_mod').unbind().click(function(){ + var _name = $('input[name=site_type_mod]').val(); + $.post('/site/modify_site_type_name','id='+id+'&name='+_name, function(rdata){ + showMsg(rdata.msg,function(){ + if (rdata.status){ + layer.closeAll(); + setClassType(); + getClassType(); + } + },{icon:rdata.status?1:2}); + },'json'); + + }); +} + diff --git a/route/templates/default/site.html b/route/templates/default/site.html index 0ed199694..2e2b851bb 100755 --- a/route/templates/default/site.html +++ b/route/templates/default/site.html @@ -52,8 +52,8 @@
站点分类: