Fixes in lang
This commit is contained in:
parent
44ffe2da55
commit
95f464c78c
4 changed files with 78 additions and 70 deletions
120
admin/app.py
120
admin/app.py
|
|
@ -2,7 +2,7 @@ from settings import config
|
|||
from flask import g, url_for, request, session, make_response
|
||||
from paramecio2.libraries.generate_admin_class import GenerateAdminClass
|
||||
from paramecio2.libraries.lists import SimpleList
|
||||
from paramecio2.libraries.i18n import I18n
|
||||
from paramecio2.libraries.i18n import I18n, PGetText
|
||||
from paramecio2.modules.admin import admin_app, t as admin_t
|
||||
from paramecio2.libraries.db.webmodel import WebModel
|
||||
from paramecio2.libraries.lists import AjaxList
|
||||
|
|
@ -22,6 +22,10 @@ try:
|
|||
except:
|
||||
import json
|
||||
|
||||
pgettext=PGetText(__file__+'/../')
|
||||
|
||||
_=pgettext.gettext
|
||||
|
||||
env=env_theme(__file__)
|
||||
|
||||
t=PTemplate(env)
|
||||
|
|
@ -34,7 +38,7 @@ t.env.directories.insert(2, '../pastafari2/templates/admin')
|
|||
@admin_app.route('/webservers/servers/')
|
||||
def webservers():
|
||||
|
||||
return t.load_template('webservers.phtml', title=I18n.lang('webservers', 'webservers', 'Webservers'), path_module='admin_app.webservers')
|
||||
return t.load_template('webservers.phtml', title=_('Webservers'), path_module='admin_app.webservers')
|
||||
|
||||
@admin_app.route('/get_webservers', methods=['POST'])
|
||||
def get_webservers():
|
||||
|
|
@ -47,7 +51,7 @@ def get_webservers():
|
|||
count_data=[]
|
||||
sql_data=[]
|
||||
|
||||
fields=[[I18n.lang('webservers', 'hostname', 'Hostname'), True], ['IP', True], [I18n.lang('webservers', 'options', 'Options'), False]]
|
||||
fields=[[_('Hostname'), True], ['IP', True], [_('Options'), False]]
|
||||
arr_order_fields=['hostname', 'ip']
|
||||
|
||||
count_query=['select count(webserver.id) as num_elements from webserver', count_data]
|
||||
|
|
@ -73,12 +77,12 @@ def get_webservers():
|
|||
|
||||
def options_options(row_id, row):
|
||||
|
||||
#arr_options=['<a href="{}">{}</a>'.format(url_for('admin_app.virtualhost', server_id=row_id), I18n.lang('webserver', 'server_users', 'Server users'))]
|
||||
arr_options=['<a href="{}">{}</a>'.format(url_for('admin_app.virtualhost', webserver_id=row_id), I18n.lang('webserver', 'websites', 'Websites'))]
|
||||
#arr_options=['<a href="{}">{}</a>'.format(url_for('admin_app.virtualhost', server_id=row_id), _('Server users'))]
|
||||
arr_options=['<a href="{}">{}</a>'.format(url_for('admin_app.virtualhost', webserver_id=row_id), _('Websites'))]
|
||||
#
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.ports', webserver_id=row_id), I18n.lang('webserver', 'http_ports', 'HTTP Ports')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format("", I18n.lang('webserver', 'edit', 'Edit')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.delete_webserver', webserver_id=row_id), I18n.lang('webserver', 'delete', 'Delete')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.ports', webserver_id=row_id), _('HTTP Ports')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format("", _('Edit')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.delete_webserver', webserver_id=row_id), _('Delete')))
|
||||
|
||||
return '<br />'.join(arr_options)
|
||||
|
||||
|
|
@ -113,7 +117,7 @@ def delete_webserver(webserver_id):
|
|||
|
||||
if arr_webserver:
|
||||
|
||||
return t.load_template('del_webserver.phtml', title=I18n.lang('webservers', 'remove_webserver', 'Remove webserver'), path_module='admin_app.webservers', webserver_id=arr_webserver['id'], domain=arr_webserver['server_id'])
|
||||
return t.load_template('del_webserver.phtml', title=_('Remove webserver'), path_module='admin_app.webservers', webserver_id=arr_webserver['id'], domain=arr_webserver['server_id'])
|
||||
|
||||
else:
|
||||
return ""
|
||||
|
|
@ -167,7 +171,7 @@ def ports(webserver_id):
|
|||
|
||||
if type(form_admin).__name__=='str':
|
||||
|
||||
return t.load_template('ports.phtml', title=I18n.lang('webservers', 'server_ports', 'Server ports'), path_module='admin_app.ports', form_admin=form_admin, webserver_id=webserver_id, hostname=arr_webserver['server_id'])
|
||||
return t.load_template('ports.phtml', title=_('Server ports'), path_module='admin_app.ports', form_admin=form_admin, webserver_id=webserver_id, hostname=arr_webserver['server_id'])
|
||||
else:
|
||||
|
||||
return form_admin
|
||||
|
|
@ -179,7 +183,7 @@ def ports(webserver_id):
|
|||
|
||||
if arr_webserver:
|
||||
|
||||
return t.load_template('virtualhosts.phtml', title=I18n.lang('webservers', 'virtualhost', 'Virtual Hosts'), path_module='admin_app.webservers', webserver_id=webserver_id)
|
||||
return t.load_template('virtualhosts.phtml', title=_('Virtual Hosts'), path_module='admin_app.webservers', webserver_id=webserver_id)
|
||||
|
||||
else:
|
||||
|
||||
|
|
@ -225,27 +229,27 @@ def server_users(virtualhost_id):
|
|||
|
||||
#admin.post_update=
|
||||
|
||||
#return t.load_template('serverusers.phtml', title=I18n.lang('webservers', 'server_users', 'Server users'), path_module='admin_app.server_users', admin=admin)
|
||||
#return t.load_template('serverusers.phtml', title=_('Server users'), path_module='admin_app.server_users', admin=admin)
|
||||
|
||||
form_admin=admin.show()
|
||||
|
||||
if type(form_admin).__name__=='str':
|
||||
|
||||
return t.load_template('serverusers.phtml', title=I18n.lang('webservers', 'ftp_users', 'FTP users'), path_module='admin_app.webservers', form_admin=form_admin, webserver_id=webserver_id)
|
||||
return t.load_template('serverusers.phtml', title=_('FTP users'), path_module='admin_app.webservers', form_admin=form_admin, webserver_id=webserver_id)
|
||||
else:
|
||||
|
||||
return form_admin
|
||||
|
||||
def option_users(url, row_id, row):
|
||||
|
||||
#arr_options=['<a href="{}">{}</a>'.format(url_for('admin_app.virtualhost, user_id=user_id), I18n.lang('webserver', 'server_users', 'Server users'))]
|
||||
#arr_options=['<a href="{}">{}</a>'.format(url_for('admin_app.virtualhost, user_id=user_id), _('Server users'))]
|
||||
#
|
||||
#arr_options.append('<a href="{}">{}</a>'.format("", I18n.lang('webserver', 'edit', 'Edit')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format("", I18n.lang('webserver', 'delete', 'Delete')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format("", _('Edit')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format("", _('Delete')))
|
||||
|
||||
#return '<br />'.join(arr_options)
|
||||
|
||||
arr_options=[] #['<a href="'+url_for('admin_app.virtualhost', user_id=row_id)+'">'+I18n.lang('webservers', 'virtualhosts', 'Virtual Hosts')+'</a>']
|
||||
arr_options=[] #['<a href="'+url_for('admin_app.virtualhost', user_id=row_id)+'">'+_('Virtual Hosts')+'</a>']
|
||||
|
||||
arr_options+=SimpleList.standard_options(url, row_id, row)
|
||||
|
||||
|
|
@ -269,7 +273,7 @@ def virtualhost(webserver_id):
|
|||
|
||||
if arr_webserver:
|
||||
|
||||
return t.load_template('virtualhosts.phtml', title=I18n.lang('webservers', 'virtualhost', 'Virtual Hosts'), path_module='admin_app.webservers', webserver_id=webserver_id, hostname=arr_webserver['hostname'])
|
||||
return t.load_template('virtualhosts.phtml', title=_('Virtual Hosts'), path_module='admin_app.webservers', webserver_id=webserver_id, hostname=arr_webserver['hostname'])
|
||||
|
||||
else:
|
||||
|
||||
|
|
@ -279,10 +283,10 @@ def options_vhosts(row_id, row):
|
|||
|
||||
arr_options=[]
|
||||
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.server_users', virtualhost_id=row_id), I18n.lang('webserver', 'ftp_users', 'Ftp users')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.webapps', virtualhost_id=row_id), I18n.lang('webserver', 'webapps', 'Webapps')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.edit_virtualhost', virtualhost_id=row_id), I18n.lang('webserver', 'edit', 'Edit')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.virtualhost_delete', virtualhost_id=row_id), I18n.lang('webserver', 'delete', 'Delete')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.server_users', virtualhost_id=row_id), _('Ftp users')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.webapps', virtualhost_id=row_id), _('Webapps')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.edit_virtualhost', virtualhost_id=row_id), _('Edit')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.virtualhost_delete', virtualhost_id=row_id), _('Delete')))
|
||||
|
||||
return '<br />'.join(arr_options)
|
||||
|
||||
|
|
@ -302,7 +306,7 @@ def get_virtualhosts():
|
|||
count_data=[]
|
||||
sql_data=[user_id]
|
||||
|
||||
fields=[[I18n.lang('webservers', 'domain', 'Domain'), True], [I18n.lang('webservers', 'user', 'User'), True], [I18n.lang('webservers', 'options', 'Options'), False]]
|
||||
fields=[[_('Domain'), True], [_('User'), True], [_('Options'), False]]
|
||||
arr_order_fields=['domain']
|
||||
|
||||
count_query=['select count(virtualhost.id) as num_elements from virtualhost', count_data]
|
||||
|
|
@ -347,18 +351,18 @@ def add_virtualhost(webserver_id):
|
|||
virtual.fields['webserver_id'].default_value=request.args.get('webserver_id', webserver_id)
|
||||
|
||||
#virtual.fields['cgi_type'].name_form=SelectForm
|
||||
#virtual.fields['cgi_type'].extra_parameters=[{'': I18n.lang('webservers', 'anything', 'Anything cgi content'), 'php74': 'PHP 7.4 (php-fpm)', 'php80': 'PHP 8.0 (php-fpm)', 'php81': 'PHP 8.1 (php-fpm)', 'php82': 'PHP 8.2 (php-fpm)', 'python3': 'Python3 (mod_wsgi)'}]
|
||||
virtual.fields['username'].label=I18n.lang('webservers', 'username_vhost', 'Virtualhost user')
|
||||
virtual.fields['username'].help=I18n.lang('webservers', 'username_vhost_explain', 'The virtualhost is saved inside unix user. You can set the username in this field')
|
||||
#virtual.fields['cgi_type'].extra_parameters=[{'': _('Anything cgi content'), 'php74': 'PHP 7.4 (php-fpm)', 'php80': 'PHP 8.0 (php-fpm)', 'php81': 'PHP 8.1 (php-fpm)', 'php82': 'PHP 8.2 (php-fpm)', 'python3': 'Python3 (mod_wsgi)'}]
|
||||
virtual.fields['username'].label=_('Virtualhost user')
|
||||
virtual.fields['username'].help=_('The virtualhost is saved inside unix user. You can set the username in this field')
|
||||
|
||||
virtual.fields['cgi_type'].default_value=request.args.get('cgi_type', '')
|
||||
|
||||
virtual.fields['ip'].label=I18n.lang('webservers', 'ip_if_empty', 'Ip of virtualhost, empty if server default')
|
||||
virtual.fields['ip'].help=I18n.lang('webservers', 'ip_if_empty_explain', 'Ip of virtualhost, empty if server default. If you don\'t know that value your need, leave it empty')
|
||||
virtual.fields['ip'].label=_('Ip of virtualhost, empty if server default')
|
||||
virtual.fields['ip'].help=_('Ip of virtualhost, empty if server default. If you don\'t know that value your need, leave it empty')
|
||||
|
||||
virtual.fields['domain'].help=I18n.lang('webservers', 'domain_explain', 'The domain of new website')
|
||||
virtual.fields['domain'].help=_('The domain of new website')
|
||||
|
||||
virtual.fields['port'].help=I18n.lang('webservers', 'port_explain', 'Change the base port used for the website if you want use behind of a reverse proxy')
|
||||
virtual.fields['port'].help=_('Change the base port used for the website if you want use behind of a reverse proxy')
|
||||
|
||||
virtual.fields['port'].default_value=80
|
||||
|
||||
|
|
@ -370,10 +374,10 @@ def add_virtualhost(webserver_id):
|
|||
|
||||
"""
|
||||
virtual.forms['password']=PasswordForm('password', '')
|
||||
virtual.forms['password'].label=I18n.lang('webservers', 'user_password', 'User password')
|
||||
virtual.forms['password'].help=I18n.lang('webservers', 'user_password_explain', 'User password used for the user if you want access to this server using this user. <strong>Remember, the password is not saved in pastafari</strong>')
|
||||
virtual.forms['password'].label=_('User password')
|
||||
virtual.forms['password'].help=_('User password used for the user if you want access to this server using this user. <strong>Remember, the password is not saved in pastafari</strong>')
|
||||
virtual.forms['repeat_password']=PasswordForm('repeat_password', '')
|
||||
virtual.forms['repeat_password'].label=I18n.lang('webservers', 'rpeat_user_password', 'Repeat User password')
|
||||
virtual.forms['repeat_password'].label=_('Repeat User password')
|
||||
"""
|
||||
|
||||
|
||||
|
|
@ -385,7 +389,7 @@ def add_virtualhost(webserver_id):
|
|||
|
||||
form=show_form({}, arr_form, t, yes_error=True, pass_values=False, modelform_tpl='forms/modelform.phtml')
|
||||
|
||||
return t.load_template('add_virtualhost.phtml', title=I18n.lang('webservers', 'add_website', 'Add Website'), path_module='admin_app.webservers', form=form, webserver_id=webserver_id)
|
||||
return t.load_template('add_virtualhost.phtml', title=_('Add Website'), path_module='admin_app.webservers', form=form, webserver_id=webserver_id)
|
||||
|
||||
|
||||
@admin_app.route('/save_virtualhost/', methods=['POST'])
|
||||
|
|
@ -529,7 +533,7 @@ def virtualhost_progress(webserver_id):
|
|||
#Webservers list >> Web users >> Virtual Hosts
|
||||
#cursor=db.query('select `usersftp`.`id` from `usersftp`')
|
||||
|
||||
return_tree='<p><a href="'+url_for('admin_app.webservers')+'">'+I18n.lang('webservers', 'webservers_list', 'Webservers list')+'</a> >> <a href="'+url_for('admin_app.virtualhost', webserver_id=webserver_id)+'">'+I18n.lang('webservers', 'websites', 'Websites')+'</a></p>'
|
||||
return_tree='<p><a href="'+url_for('admin_app.webservers')+'">'+_('Webservers list')+'</a> >> <a href="'+url_for('admin_app.virtualhost', webserver_id=webserver_id)+'">'+_('Websites')+'</a></p>'
|
||||
|
||||
return load_progress(db, t, return_tree=return_tree, path_module='admin_app.webservers')
|
||||
|
||||
|
|
@ -546,7 +550,7 @@ def virtualhost_delete(virtualhost_id):
|
|||
|
||||
#arr_user=usersftp.select_a_row(arr_virtualhost['user_id'], [], True)
|
||||
|
||||
return t.load_template('del_virtualhost.phtml', title=I18n.lang('webservers', 'remove_virtualhost', 'Remove Virtual Host'), path_module='admin_app.webservers', webserver_id=arr_virtualhost['webserver_id'], virtualhost_id=virtualhost_id, domain=arr_virtualhost['domain'])
|
||||
return t.load_template('del_virtualhost.phtml', title=_('Remove Virtual Host'), path_module='admin_app.webservers', webserver_id=arr_virtualhost['webserver_id'], virtualhost_id=virtualhost_id, domain=arr_virtualhost['domain'])
|
||||
|
||||
@admin_app.route('/delete_virtualhost/', methods=['POST'])
|
||||
def delete_virtualhost():
|
||||
|
|
@ -634,8 +638,8 @@ def edit_virtualhost(virtualhost_id):
|
|||
|
||||
#virtual=VirtualHost(db)
|
||||
|
||||
virtual.fields['aliases'].label=I18n.lang('webservers', 'domain_alias', 'Domain aliases')
|
||||
virtual.fields['aliases'].help=I18n.lang('webservers', 'domain_alias_explain', 'Domain aliases are the other domain names of this server. For example www.domain.com, other-site.domain.com. You can separate the domains with commas')
|
||||
virtual.fields['aliases'].label=_('Domain aliases')
|
||||
virtual.fields['aliases'].help=_('Domain aliases are the other domain names of this server. For example www.domain.com, other-site.domain.com. You can separate the domains with commas')
|
||||
|
||||
virtual.fields['webserver_id'].name_form=HiddenForm
|
||||
virtual.fields['webserver_id'].extra_parameters=[]
|
||||
|
|
@ -643,41 +647,41 @@ def edit_virtualhost(virtualhost_id):
|
|||
#virtual.fields['webserver_id'].default_value=arr_vhost['webserver_id']
|
||||
|
||||
#virtual.fields['cgi_type'].name_form=SelectForm
|
||||
#virtual.fields['cgi_type'].extra_parameters=[{'': I18n.lang('webservers', 'anything', 'Anything cgi content'), 'php74': 'PHP 7.4 (php-fpm)', 'php80': 'PHP 8.0 (php-fpm)', 'php81': 'PHP 8.1 (php-fpm)', 'php82': 'PHP 8.2 (php-fpm)', 'python3': 'Python3 (mod_wsgi)'}]
|
||||
#virtual.fields['cgi_type'].extra_parameters=[{'': _('Anything cgi content'), 'php74': 'PHP 7.4 (php-fpm)', 'php80': 'PHP 8.0 (php-fpm)', 'php81': 'PHP 8.1 (php-fpm)', 'php82': 'PHP 8.2 (php-fpm)', 'python3': 'Python3 (mod_wsgi)'}]
|
||||
|
||||
#virtual.fields['cgi_type'].default_value=arr_vhost['cgi_type']
|
||||
|
||||
virtual.fields['ip'].label=I18n.lang('webservers', 'ip_if_empty', 'Ip of virtualhost, empty if server default')
|
||||
virtual.fields['ip'].help=I18n.lang('webservers', 'ip_if_empty_explain', 'Ip of virtualhost, empty if server default. If you don\'t know that value your need, leave it empty')
|
||||
virtual.fields['ip'].label=_('Ip of virtualhost, empty if server default')
|
||||
virtual.fields['ip'].help=_('Ip of virtualhost, empty if server default. If you don\'t know that value your need, leave it empty')
|
||||
|
||||
virtual.fields['domain'].help=I18n.lang('webservers', 'domain_explain', 'The domain of new website')
|
||||
virtual.fields['domain'].help=_('The domain of new website')
|
||||
|
||||
virtual.fields['port'].help=I18n.lang('webservers', 'port_explain', 'Change the base port used for the website if you want use behind of a reverse proxy. The port need to be specified in http ports edit in webservers')
|
||||
virtual.fields['ssl_port'].help=I18n.lang('webservers', 'port_explain', 'Change the base port used for the website if you want use behind of a reverse proxy. The port need to be specified in http ports edit in webservers')
|
||||
virtual.fields['port'].help=_('Change the base port used for the website if you want use behind of a reverse proxy. The port need to be specified in http ports edit in webservers')
|
||||
virtual.fields['ssl_port'].help=_('Change the base port used for the website if you want use behind of a reverse proxy. The port need to be specified in http ports edit in webservers')
|
||||
|
||||
virtual.fields['ssl'].name_form=SelectForm
|
||||
virtual.fields['ssl'].extra_parameters=[{0: 'No', 1: 'Lets Encrypt', 2: 'SSL Files'}]
|
||||
|
||||
virtual.fields['redirect_ssl'].name_form=SelectForm
|
||||
virtual.fields['redirect_ssl'].extra_parameters=[{0: I18n.lang('webservers', 'no', 'No'), 1: I18n.lang('webservers', 'yes', 'Yes')}]
|
||||
virtual.fields['redirect_ssl'].extra_parameters=[{0: _('No'), 1: _('Yes')}]
|
||||
|
||||
virtual.fields['indexes'].name_form=SelectForm
|
||||
virtual.fields['indexes'].extra_parameters=[{0: I18n.lang('webservers', 'no', 'No'), 1: I18n.lang('webservers', 'yes', 'Yes')}]
|
||||
virtual.fields['indexes'].help=I18n.lang('webservers', 'add_support_for_show_files_if_index_not_exists', 'Add support show files if index.html not exists?')
|
||||
virtual.fields['indexes'].extra_parameters=[{0: _('No'), 1: _('Yes')}]
|
||||
virtual.fields['indexes'].help=_('Add support show files if index.html not exists?')
|
||||
|
||||
virtual.fields['allow_override'].name_form=SelectForm
|
||||
virtual.fields['allow_override'].extra_parameters=[{0: I18n.lang('webservers', 'no', 'No'), 1: I18n.lang('webservers', 'yes', 'Yes')}]
|
||||
virtual.fields['allow_override'].help=I18n.lang('webservers', 'add_support_for_.htaccess', 'Add support for htaccess?')
|
||||
virtual.fields['allow_override'].extra_parameters=[{0: _('No'), 1: _('Yes')}]
|
||||
virtual.fields['allow_override'].help=_('Add support for htaccess?')
|
||||
|
||||
|
||||
virtual.fields['php'].label=I18n.lang('webservers', 'php_support', 'PHP support')
|
||||
virtual.fields['php'].label=_('PHP support')
|
||||
virtual.fields['php'].name_form=SelectForm
|
||||
if arr_vhost['distro']!='arch':
|
||||
virtual.fields['php'].extra_parameters=[{'': 'No php support', '7.4': 'PHP 7.4', '8.0': 'PHP 8.0', '8.1': 'PHP 8.1', '8.2': 'PHP 8.2', '8.3': 'PHP 8.3'}]
|
||||
else:
|
||||
virtual.fields['php'].extra_parameters=[{'': 'No php support', '8.1': 'PHP 8.1 (On Arch, php-legacy for maximum compatibility)'}]
|
||||
|
||||
virtual.fields['php'].help=I18n.lang('webservers', 'add_php_support_to_virtualhost', 'Add support to php to virtualhost. You can choose ophp version that you prefer')
|
||||
virtual.fields['php'].help=_('Add support to php to virtualhost. You can choose ophp version that you prefer')
|
||||
|
||||
#'port', 'ssl_port',
|
||||
|
||||
|
|
@ -691,17 +695,17 @@ def edit_virtualhost(virtualhost_id):
|
|||
|
||||
arr_form['ssl_crt']=TextForm('ssl_crt', '')
|
||||
|
||||
arr_form['ssl_crt'].help=I18n.lang('webservers', 'ssl_crt_explain', 'Certificate text from file of ssl certificate, normally ending with .crt')
|
||||
arr_form['ssl_crt'].help=_('Certificate text from file of ssl certificate, normally ending with .crt')
|
||||
|
||||
arr_form['ssl_crt'].label=I18n.lang('webservers', 'ssl_crt', 'Ssl certificate')
|
||||
arr_form['ssl_crt'].label=_('Ssl certificate')
|
||||
|
||||
arr_form['ssl_crt'].css='hide_form'
|
||||
|
||||
arr_form['ssl_key']=TextForm('ssl_key', '')
|
||||
|
||||
arr_form['ssl_key'].help=I18n.lang('webservers', 'ssl_key_explain', 'Key text from file of ssl certificate, normally ending with .key')
|
||||
arr_form['ssl_key'].help=_('Key text from file of ssl certificate, normally ending with .key')
|
||||
|
||||
arr_form['ssl_key'].label=I18n.lang('webservers', 'ssl_key', 'Ssl key')
|
||||
arr_form['ssl_key'].label=_('Ssl key')
|
||||
|
||||
arr_form['ssl_key'].css='hide_form'
|
||||
|
||||
|
|
@ -710,7 +714,7 @@ def edit_virtualhost(virtualhost_id):
|
|||
|
||||
form=show_form(arr_vhost, arr_form, t, yes_error=True, pass_values=True, modelform_tpl='forms/modelform.phtml')
|
||||
|
||||
return t.load_template('edit_virtualhost.phtml', title=I18n.lang('webservers', 'edit_virtualhost', 'Edit Virtual Host'), path_module='admin_app.webservers', form=form, webserver_id=arr_vhost['webserver_id'], virtualhost_id=virtualhost_id)
|
||||
return t.load_template('edit_virtualhost.phtml', title=_('Edit Virtual Host'), path_module='admin_app.webservers', form=form, webserver_id=arr_vhost['webserver_id'], virtualhost_id=virtualhost_id)
|
||||
|
||||
pass
|
||||
|
||||
|
|
@ -919,11 +923,11 @@ def change_user_password():
|
|||
user=request.form.get('user', '')
|
||||
|
||||
if user=='':
|
||||
error_form['#user_error']=I18n.lang('webservers', 'error_you_need_an_user', 'Error: you need an user')
|
||||
error_form['#user_error']=_('Error: you need an user')
|
||||
error=1
|
||||
|
||||
if ssh_pub_key=='':
|
||||
error_form['#ssh_pub_key_error']=I18n.lang('webservers', 'error_you_need_a_ssh_pub_key', 'Error: you need a ssh public key')
|
||||
error_form['#ssh_pub_key_error']=_('Error: you need a ssh public key')
|
||||
error=1
|
||||
|
||||
#username=arr_webserver['username']
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from settings import config
|
|||
from flask import g, url_for, request, session, make_response
|
||||
from paramecio2.libraries.generate_admin_class import GenerateAdminClass
|
||||
from paramecio2.libraries.lists import SimpleList
|
||||
from paramecio2.libraries.i18n import I18n
|
||||
from paramecio2.libraries.i18n import I18n, PGetText
|
||||
from paramecio2.modules.admin import admin_app, t as admin_t
|
||||
from paramecio2.libraries.db.webmodel import WebModel
|
||||
from paramecio2.libraries.lists import AjaxList
|
||||
|
|
@ -22,6 +22,10 @@ try:
|
|||
except:
|
||||
import json
|
||||
|
||||
pgettext=PGetText(__file__+'/../')
|
||||
|
||||
_=pgettext.gettext
|
||||
|
||||
env=env_theme(__file__)
|
||||
|
||||
t=PTemplate(env)
|
||||
|
|
@ -60,7 +64,7 @@ def webapps(virtualhost_id):
|
|||
|
||||
pass
|
||||
|
||||
return t.load_template('webapps.phtml', title=I18n.lang('webservers', 'webapps', 'Webapps'), path_module='admin_app.webservers', domain=arr_vhost['domain'], webserver_id=arr_vhost['webserver_id'], virtualhost_id=virtualhost_id, server_id=arr_server['id'])
|
||||
return t.load_template('webapps.phtml', title=_('Webapps'), path_module='admin_app.webservers', domain=arr_vhost['domain'], webserver_id=arr_vhost['webserver_id'], virtualhost_id=virtualhost_id, server_id=arr_server['id'])
|
||||
|
||||
return {}
|
||||
|
||||
|
|
@ -68,10 +72,10 @@ def options_webapps(row_id, row):
|
|||
|
||||
arr_options=[]
|
||||
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.server_users', virtualhost_id=row_id), I18n.lang('webserver', 'ftp_users', 'Ftp users')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.webapps', virtualhost_id=row_id), I18n.lang('webserver', 'webapps', 'Webapps')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.edit_virtualhost', virtualhost_id=row_id), I18n.lang('webserver', 'edit', 'Edit')))
|
||||
arr_options.append('<a class="delete_webapp" data-webapp="'+row['app_name']+'" data-id="'+str(row_id)+'" href="{}">{}</a>'.format("", I18n.lang('webserver', 'delete', 'Delete')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.server_users', virtualhost_id=row_id), _('Ftp users')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.webapps', virtualhost_id=row_id), _('Webapps')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.edit_virtualhost', virtualhost_id=row_id), _('Edit')))
|
||||
arr_options.append('<a class="delete_webapp" data-webapp="'+row['app_name']+'" data-id="'+str(row_id)+'" href="{}">{}</a>'.format("", _('Delete')))
|
||||
|
||||
return '<br />'.join(arr_options)
|
||||
|
||||
|
|
@ -88,7 +92,7 @@ def get_webapps():
|
|||
count_data=[]
|
||||
sql_data=[virtualhost_id]
|
||||
|
||||
fields=[[I18n.lang('webservers', 'app_name', 'App'), True], [I18n.lang('webservers', 'path', 'Path'), True], [I18n.lang('webservers', 'options', 'Options'), False]]
|
||||
fields=[[_('App'), True], [_('Path'), True], [_('Options'), False]]
|
||||
arr_order_fields=['app_name']
|
||||
|
||||
count_query=['select count(webapp.id) as num_elements from webapp', count_data]
|
||||
|
|
@ -129,7 +133,7 @@ def add_new_app(virtualhost_id):
|
|||
with vhost.query('select serverdbtask.id as server_id, serverdbtask.ip, webserver.id from serverdbtask, webserver WHERE webserver.id=%s AND webserver.server_id=serverdbtask.id', [arr_vhost['webserver_id']]) as cursor:
|
||||
arr_server=cursor.fetchone()
|
||||
|
||||
return t.load_template('add_webapp.phtml', title=I18n.lang('webservers', 'add_webapp', 'Add webapp'), path_module='admin_app.webservers', domain=arr_vhost['domain'], webserver_id=arr_vhost['webserver_id'], virtualhost_id=virtualhost_id, scripts_lists=scripts_lists, server_id=arr_server['server_id'])
|
||||
return t.load_template('add_webapp.phtml', title=_('Add webapp'), path_module='admin_app.webservers', domain=arr_vhost['domain'], webserver_id=arr_vhost['webserver_id'], virtualhost_id=virtualhost_id, scripts_lists=scripts_lists, server_id=arr_server['server_id'])
|
||||
|
||||
return {}
|
||||
|
||||
|
|
@ -152,7 +156,7 @@ def add_new_app_form(virtualhost_id):
|
|||
# tpl_form=f.read()
|
||||
tpl_form=t.load_template(tpl_form_path)
|
||||
|
||||
return t.load_template('add_webapp_form.phtml', title=I18n.lang('webservers', 'add_webapp', 'Add webapp'), path_module='admin_app.webservers', domain=arr_vhost['domain'], webserver_id=arr_vhost['webserver_id'], virtualhost_id=virtualhost_id, tpl_form=tpl_form)
|
||||
return t.load_template('add_webapp_form.phtml', title=_('Add webapp'), path_module='admin_app.webservers', domain=arr_vhost['domain'], webserver_id=arr_vhost['webserver_id'], virtualhost_id=virtualhost_id, tpl_form=tpl_form)
|
||||
|
||||
return {}
|
||||
|
||||
|
|
@ -161,7 +165,7 @@ def delete_webapp(webapp_id):
|
|||
|
||||
#db=g.connection
|
||||
|
||||
#return t.load_template('del_virtualhost.phtml', title=I18n.lang('webservers', 'remove_virtualhost', 'Remove Virtual Host'), path_module='admin_app.webservers', webserver_id=arr_virtualhost['webserver_id'], virtualhost_id=virtualhost_id, domain=arr_virtualhost['domain'])
|
||||
#return t.load_template('del_virtualhost.phtml', title=_('Remove Virtual Host'), path_module='admin_app.webservers', webserver_id=arr_virtualhost['webserver_id'], virtualhost_id=virtualhost_id, domain=arr_virtualhost['domain'])
|
||||
|
||||
# Create task and redirect to multiprogress
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue