Many fixes
This commit is contained in:
parent
7c11620287
commit
f0c9014a9a
6 changed files with 25 additions and 30 deletions
|
|
@ -170,7 +170,7 @@ class SimpleList:
|
||||||
|
|
||||||
self.model.limit='limit '+str(begin_page)+','+str(self.limit_pages)
|
self.model.limit='limit '+str(begin_page)+','+str(self.limit_pages)
|
||||||
|
|
||||||
list_items=self.model.select(self.fields)
|
list_items=self.model.select(self.fields, True)
|
||||||
|
|
||||||
pages=Pages.show( begin_page, total_elements, num_elements, link ,initial_num_pages=self.initial_num_pages, variable='begin_page', label='', func_jscript='')
|
pages=Pages.show( begin_page, total_elements, num_elements, link ,initial_num_pages=self.initial_num_pages, variable='begin_page', label='', func_jscript='')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,8 +160,8 @@ class BooleanField(IntegerField):
|
||||||
value=int(value)
|
value=int(value)
|
||||||
|
|
||||||
if value==0:
|
if value==0:
|
||||||
value=self.yes_text
|
|
||||||
else:
|
|
||||||
value=self.no_text
|
value=self.no_text
|
||||||
|
else:
|
||||||
|
value=self.yes_text
|
||||||
|
|
||||||
return str(value)
|
return str(value)
|
||||||
|
|
|
||||||
|
|
@ -510,7 +510,7 @@ class WebModel:
|
||||||
|
|
||||||
conditions[0]+=" AND `"+table_name+"`.`"+self.fields[field].identifier_field+"`=`"+self.name+"`.`"+field+"`"
|
conditions[0]+=" AND `"+table_name+"`.`"+self.fields[field].identifier_field+"`=`"+self.name+"`.`"+field+"`"
|
||||||
|
|
||||||
sql= "select count(`"+field_to_count+"`) from "+", ".join(tables_to_select)+conditions[0]
|
sql= "select count(`"+field_to_count+"`) from "+", ".join(tables_to_select)+' '+conditions[0]
|
||||||
|
|
||||||
cursor=self.sqlclass.query(sql, conditions[1], self.connection_id)
|
cursor=self.sqlclass.query(sql, conditions[1], self.connection_id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import os, sys, traceback, inspect, resource
|
import os, sys, traceback, inspect, resource
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from bottle import route, get, post, run, default_app, abort, request, response, static_file, load
|
from bottle import route, get, post, run, default_app, abort, request, response, static_file, load, hook
|
||||||
from settings import config, modules
|
from settings import config, modules
|
||||||
from beaker.middleware import SessionMiddleware
|
from beaker.middleware import SessionMiddleware
|
||||||
from mimetypes import guess_type
|
from mimetypes import guess_type
|
||||||
|
|
@ -167,6 +167,12 @@ if config.session_enabled==True:
|
||||||
"""
|
"""
|
||||||
app = SessionMiddleware(app, config.session_opts, environ_key=config.cookie_name)
|
app = SessionMiddleware(app, config.session_opts, environ_key=config.cookie_name)
|
||||||
|
|
||||||
|
# Clean last slash
|
||||||
|
|
||||||
|
@hook('before_request')
|
||||||
|
def strip_path():
|
||||||
|
request.environ['PATH_INFO'] = request.environ['PATH_INFO'].rstrip('/')
|
||||||
|
|
||||||
def run_app(app):
|
def run_app(app):
|
||||||
|
|
||||||
run(app=app, host=config.host, server=config.server_used, port=config.port, debug=config.debug, reloader=config.reloader)
|
run(app=app, host=config.host, server=config.server_used, port=config.port, debug=config.debug, reloader=config.reloader)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ from bottle import get,post,response,request
|
||||||
from settings import config
|
from settings import config
|
||||||
from settings import config_admin
|
from settings import config_admin
|
||||||
from paramecio.citoplasma.lists import SimpleList
|
from paramecio.citoplasma.lists import SimpleList
|
||||||
|
from paramecio.citoplasma.adminutils import get_menu, get_language
|
||||||
from paramecio.citoplasma.generate_admin_class import GenerateAdminClass
|
from paramecio.citoplasma.generate_admin_class import GenerateAdminClass
|
||||||
from paramecio.citoplasma.httputils import GetPostFiles
|
from paramecio.citoplasma.httputils import GetPostFiles
|
||||||
from paramecio.cromosoma.formsutils import show_form, pass_values_to_form, set_extra_forms_user
|
from paramecio.cromosoma.formsutils import show_form, pass_values_to_form, set_extra_forms_user
|
||||||
|
|
@ -28,7 +29,7 @@ import copy
|
||||||
|
|
||||||
load_lang(['paramecio', 'admin'], ['paramecio', 'common'])
|
load_lang(['paramecio', 'admin'], ['paramecio', 'common'])
|
||||||
|
|
||||||
key_encrypt=create_key_encrypt()
|
key_encrypt=config.key_encrypt #create_key_encrypt()
|
||||||
|
|
||||||
module_admin=path.dirname(__file__)
|
module_admin=path.dirname(__file__)
|
||||||
|
|
||||||
|
|
@ -70,16 +71,9 @@ def home(module='', submodule=''):
|
||||||
|
|
||||||
s['id']=s.get('id', 0)
|
s['id']=s.get('id', 0)
|
||||||
|
|
||||||
s['lang']=s.get('lang', None)
|
lang_selected=get_language(s)
|
||||||
|
|
||||||
lang_selected=None
|
user_admin.set_conditions('WHERE id=%s', [s['id']])
|
||||||
|
|
||||||
if s['lang']!=None:
|
|
||||||
lang_selected=s['lang']
|
|
||||||
else:
|
|
||||||
s['lang']=I18n.default_lang
|
|
||||||
|
|
||||||
user_admin.conditions=['WHERE id=%s', [s['id']]]
|
|
||||||
|
|
||||||
# Check if user id exists in session
|
# Check if user id exists in session
|
||||||
|
|
||||||
|
|
@ -91,19 +85,7 @@ def home(module='', submodule=''):
|
||||||
|
|
||||||
#Load menu
|
#Load menu
|
||||||
|
|
||||||
menu=OrderedDict()
|
menu=get_menu(config_admin.modules_admin)
|
||||||
|
|
||||||
#modules_admin.append([I18n.lang('panel', 'servers_config', 'Server\'s configuration'), [I18n.lang('panel', 'servers_types', 'Server\'s types'), 'modules.panel.admin.types'], 'servers_config'])
|
|
||||||
|
|
||||||
for mod in config_admin.modules_admin:
|
|
||||||
if type(mod[1]).__name__!='list':
|
|
||||||
menu[mod[2]]=mod
|
|
||||||
else:
|
|
||||||
|
|
||||||
menu[mod[2]]=mod[0]
|
|
||||||
|
|
||||||
for submod in mod[1]:
|
|
||||||
menu[submod[2]]=submod
|
|
||||||
#pass
|
#pass
|
||||||
|
|
||||||
if module in menu:
|
if module in menu:
|
||||||
|
|
@ -285,7 +267,7 @@ def register():
|
||||||
|
|
||||||
user_admin=UserAdmin(connection)
|
user_admin=UserAdmin(connection)
|
||||||
|
|
||||||
user_admin.conditions=['WHERE privileges=%s', 2]
|
user_admin.conditions=['WHERE privileges=%s', [2]]
|
||||||
|
|
||||||
c=user_admin.select_count()
|
c=user_admin.select_count()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
<%def name="check_menu(module)">\
|
||||||
|
% if module[:1]=='/':
|
||||||
|
${module}\
|
||||||
|
% else:
|
||||||
|
${'/admin/'+module}\
|
||||||
|
% endif
|
||||||
|
</%def>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
@ -44,7 +51,7 @@ ${HeaderHTML.header_home()|n}
|
||||||
% for module in menu:
|
% for module in menu:
|
||||||
% if type(menu[module]).__name__=='list':
|
% if type(menu[module]).__name__=='list':
|
||||||
% if menu[module][0]!="":
|
% if menu[module][0]!="":
|
||||||
<a href="${make_url('admin/'+module)}">${menu[module][0]}</a>
|
<a href="${make_url(check_menu(module).strip())|n}">${menu[module][0]}</a>
|
||||||
% endif
|
% endif
|
||||||
% else:
|
% else:
|
||||||
% if menu[module]!="":
|
% if menu[module]!="":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue