def lvlmgr(parent_lid=''): admin_verify() if request.method == 'GET': bread_nav = cmstools.get_bread_nav(parent_lid) name = request.get_cookie('name', secret=secret) current_lvls = cmstools.get_next_lvls(parent_lid) user_type = request.get_cookie('user_type', secret=secret) id = request.get_cookie('id', secret=secret) return template('tpls/lvlmgr.tpl', name=name, id=id, current_lvls=current_lvls, parent_lid=parent_lid, bread_nav=bread_nav, user_type=user_type) if request.method == 'POST': action = request.forms.getunicode('action') if action == 'add': name = request.forms.getunicode('name') parent_lid = request.forms.getunicode('parent_lid') cmstools.add_level(name, parent_lid) elif action == 'edit': name = request.forms.getunicode('name').strip() lid = request.forms.getunicode('lid') cmstools.edit_level(name, lid) url = '/lvlmgr/' + parent_lid if parent_lid else '/lvlmgr' redirect(url)
def lvlmgr(parent_lid=''): admin_verify() if request.method == 'GET': bread_nav = cmstools.get_bread_nav(parent_lid) name = request.get_cookie('name',secret=secret) current_lvls = cmstools.get_next_lvls(parent_lid) user_type = request.get_cookie('user_type',secret=secret) id = request.get_cookie('id',secret=secret) return template('tpls/lvlmgr.tpl', name=name, id=id, current_lvls=current_lvls, parent_lid=parent_lid, bread_nav=bread_nav, user_type=user_type) if request.method == 'POST': action = request.forms.getunicode('action') if action == 'add': name = request.forms.getunicode('name') parent_lid = request.forms.getunicode('parent_lid') cmstools.add_level(name,parent_lid) elif action == 'edit': name = request.forms.getunicode('name').strip() lid = request.forms.getunicode('lid') cmstools.edit_level(name,lid) url = '/lvlmgr/' + parent_lid if parent_lid else '/lvlmgr' redirect(url)
def ctxmgr(lid='', page=0): uid = request.get_cookie('id', secret=secret) login_verify() if request.method == 'GET': name = request.get_cookie('name', secret=secret) user_type = request.get_cookie('user_type', secret=secret) power = cmstools.get_power(uid) powers = [] next_lvls = [] bread_nav_dec = [] if power: for p in power: powers.append(cmstools.get_sub_lvls(str(p.id))) if powers and lid: bread_nav = cmstools.get_bread_nav(lid) ids = set().union(*powers) ids = {str(i.id) for i in ids} for bn in bread_nav: if bn[0] in ids: bread_nav_dec.append(bn) next_lvls = cmstools.get_next_lvls(lid) news = cmstools.get_news(lid) return template('tpls/ctxmgr.tpl', name=name, id=uid, lid=lid, user_type=user_type, power=power, bread_nav=bread_nav_dec, next_lvls=next_lvls, news=news) elif request.method == "POST": action = request.forms.getunicode('action') if action == "add": add_ctx() elif action == "release": print('.........', action) release()
def ctxmgr(lid='',page=0): uid = request.get_cookie('id',secret=secret) login_verify() if request.method == 'GET': name = request.get_cookie('name',secret=secret) user_type = request.get_cookie('user_type',secret=secret) power = cmstools.get_power(uid) powers = [] next_lvls = [] bread_nav_dec = [] if power: for p in power: powers.append(cmstools.get_sub_lvls(str(p.id))) if powers and lid: bread_nav = cmstools.get_bread_nav(lid) ids = set().union(*powers) ids = {str(i.id) for i in ids} for bn in bread_nav: if bn[0] in ids: bread_nav_dec.append(bn) next_lvls = cmstools.get_next_lvls(lid) news = cmstools.get_news(lid) return template('tpls/ctxmgr.tpl', name=name, id=uid, lid=lid, user_type=user_type, power=power, bread_nav=bread_nav_dec, next_lvls=next_lvls, news=news) elif request.method == "POST": action = request.forms.getunicode('action') if action == "add": add_ctx() elif action == "release": print('.........',action) release()