Commit 80af18808723e2fc3122f0d084f928cf4008b67e
1 parent
d5c5c41c67
Exists in
master
add stable version
Showing 47 changed files with 579 additions and 265 deletions Side-by-side Diff
- __pycache__/app.cpython-310.pyc
- __pycache__/routes.cpython-310.pyc
- app.py
- components/k2test/.idea/.gitignore
- components/k2test/.idea/gittest.iml
- components/k2test/.idea/inspectionProfiles/profiles_settings.xml
- components/k2test/.idea/misc.xml
- components/k2test/.idea/modules.xml
- components/k2test/.idea/vcs.xml
- components/k2test/__pycache__/__init__.cpython-310.pyc
- components/k2test/history.txt
- components/k2test/k2test/__pycache__/__init__.cpython-310.pyc
- components/k2test/k2test/__pycache__/views.cpython-310.pyc
- components/k2test/k2test/languages/en/LC_MESSAGES/messages.mo
- components/k2test/k2test/languages/en/LC_MESSAGES/messages.po
- components/k2test/k2test/languages/uk/LC_MESSAGES/messages.mo
- components/k2test/k2test/languages/uk/LC_MESSAGES/messages.po
- components/k2test/k2test/templates/new2.html
- components/k2test/k2test/views.py
- components/k2test/requirements.txt
- components/k2test/setup.py
- db/database.db
- k2/__pycache__/k2cfg.cpython-310.pyc
- k2/__pycache__/k2obj.cpython-310.pyc
- k2/__pycache__/k2rout.cpython-310.pyc
- k2/k2cfg.py
- k2/k2obj.py
- k2/k2rout.py
- languages/babel_translation_directories.yml
- languages/en/LC_MESSAGES/messages.mo
- languages/en/LC_MESSAGES/messages.po
- languages/pl/LC_MESSAGES/messages.mo
- languages/pl/LC_MESSAGES/messages.po
- languages/uk/LC_MESSAGES/messages.mo
- languages/uk/LC_MESSAGES/messages.po
- routes.py
- templates/base.html
- templates/component-info-site.html
- templates/component-info.html
- templates/dashboard-add.html
- templates/dashboard-list.html
- templates/dashboard.html
- yml/admin_menu.yml
- yml/admin_menu_prav.yml
- yml/gruntcontrols.yml
- yml/roles.yml
- yml/users.yml
__pycache__/app.cpython-310.pyc
No preview for this file type
__pycache__/routes.cpython-310.pyc
No preview for this file type
app.py
| ... | ... | @@ -17,20 +17,21 @@ |
| 17 | 17 | # init db |
| 18 | 18 | k2().init_db(app) |
| 19 | 19 | CORS(app) |
| 20 | -jwt = JWTManager(app) | |
| 21 | 20 | |
| 21 | + | |
| 22 | 22 | #translate |
| 23 | 23 | k2.load_babel_translation_directories() |
| 24 | 24 | app.config['BABEL_TRANSLATION_DIRECTORIES'] = k2.babel_translation_directories |
| 25 | 25 | app.config['BABEL_DEFAULT_LOCALE'] = k2.default_language |
| 26 | -app.config['BABEL_LANGUAGES'] = { | |
| 27 | - 'en': 'English', | |
| 28 | - 'uk': 'Українська', | |
| 29 | - 'pl': 'Polski' | |
| 30 | -} | |
| 26 | +app.config['BABEL_LANGUAGES'] = k2.languages | |
| 31 | 27 | app.config['BABEL_DEFAULT_TIMEZONE'] = k2.timezone |
| 32 | 28 | babel = Babel(app) |
| 33 | 29 | babel.init_app(app, locale_selector=k2.get_locale) |
| 30 | + | |
| 31 | +#menu | |
| 32 | +@app.context_processor | |
| 33 | +def inject_static_variable(): | |
| 34 | + return {'menu': k2.menu} | |
| 34 | 35 | |
| 35 | 36 | # flask routing |
| 36 | 37 | from routes import * |
components/k2test/.idea/.gitignore
components/k2test/.idea/gittest.iml
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<module type="PYTHON_MODULE" version="4"> | |
| 3 | - <component name="NewModuleRootManager"> | |
| 4 | - <content url="file://$MODULE_DIR$"> | |
| 5 | - <excludeFolder url="file://$MODULE_DIR$/venv" /> | |
| 6 | - </content> | |
| 7 | - <orderEntry type="inheritedJdk" /> | |
| 8 | - <orderEntry type="sourceFolder" forTests="false" /> | |
| 9 | - </component> | |
| 10 | -</module> |
components/k2test/.idea/inspectionProfiles/profiles_settings.xml
components/k2test/.idea/misc.xml
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project version="4"> | |
| 3 | - <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (gittest)" project-jdk-type="Python SDK" /> | |
| 4 | - <component name="PyCharmProfessionalAdvertiser"> | |
| 5 | - <option name="shown" value="true" /> | |
| 6 | - </component> | |
| 7 | -</project> |
components/k2test/.idea/modules.xml
components/k2test/.idea/vcs.xml
components/k2test/__pycache__/__init__.cpython-310.pyc
No preview for this file type
components/k2test/history.txt
components/k2test/k2test/__pycache__/__init__.cpython-310.pyc
No preview for this file type
components/k2test/k2test/__pycache__/views.cpython-310.pyc
No preview for this file type
components/k2test/k2test/languages/en/LC_MESSAGES/messages.mo
No preview for this file type
components/k2test/k2test/languages/en/LC_MESSAGES/messages.po
components/k2test/k2test/languages/uk/LC_MESSAGES/messages.mo
No preview for this file type
components/k2test/k2test/languages/uk/LC_MESSAGES/messages.po
components/k2test/k2test/templates/new2.html
components/k2test/k2test/views.py
| 1 | -from flask import render_template, redirect, request, jsonify | |
| 2 | -from flask_babel import gettext | |
| 3 | -from flask_login import login_user, current_user, logout_user, login_required | |
| 4 | -from flask import current_app as k2 | |
| 5 | -from flask import Blueprint, json | |
| 6 | -from flask_sqlalchemy import SQLAlchemy | |
| 7 | - | |
| 8 | - | |
| 9 | -#bliueprint | |
| 10 | -k2test = Blueprint('k2test', __name__, template_folder='templates', static_folder='static') | |
| 11 | - | |
| 12 | -#component routes | |
| 13 | -@k2test.route('/new') | |
| 14 | -def new_component(): | |
| 15 | - db = k2.extensions['sqlalchemy'].db | |
| 16 | - connection = db.engine.connect() | |
| 17 | - query = db.text("SELECT email, login FROM k2users") | |
| 18 | - result = connection.execute(query).fetchall() | |
| 19 | - rows = [dict(email=row.email, login=row.login) for row in result] | |
| 20 | - # Перетворення результату на JSON | |
| 21 | - json_result = json.dumps(rows) | |
| 22 | - return json_result | |
| 23 | - | |
| 24 | -@k2test.route('/new2') | |
| 25 | -def new_component2(): | |
| 26 | - return render_template('new2.html') | |
| 27 | - | |
| 28 | -@k2test.route('/new3') | |
| 29 | -def new_component3(): | |
| 30 | - return jsonify({'data': 'page new3'}) | |
| 31 | - | |
| 32 | -@k2test.route('/new4') | |
| 33 | -def new_component4(): | |
| 34 | - return jsonify({'data': 'page new4'}) | |
| 35 | - | |
| 36 | -# menu items for admin | |
| 37 | -@k2test.route('/menu-admin-items') | |
| 38 | -def menu_items(): | |
| 39 | - data = [ | |
| 40 | - { | |
| 41 | - 'title': 'Test items', | |
| 42 | - 'icon': {'icon': 'mdi-chart-timeline-variant'}, | |
| 43 | - 'children': [ | |
| 44 | - {'title': 'Test 3', 'to': 'k2test-new3'}, | |
| 45 | - {'title': 'Test 4', 'to': 'k2test-new4'}, | |
| 46 | - {'title': 'Test 5', 'to': 'k2test-new5'}, | |
| 47 | - {'title': 'Test 6', 'to': 'k2test-new6'}, | |
| 48 | - {'title': 'Test 7', 'to': 'k2test-new7'} | |
| 49 | - ], | |
| 50 | - } | |
| 51 | - | |
| 52 | - ] | |
| 53 | - return data |
components/k2test/requirements.txt
| 1 | -Flask-Login==0.6.2 |
components/k2test/setup.py
| 1 | -from setuptools import setup, find_packages | |
| 2 | - | |
| 3 | -setup( | |
| 4 | - name='k2test', | |
| 5 | - version='1.0.0', | |
| 6 | - description='Description of my project', | |
| 7 | - author='k2 cloud', | |
| 8 | - author_email='rs@corp2.net', | |
| 9 | - keywords="k2test, k2", | |
| 10 | - python_requires=">=3.7, <=3.11.2", | |
| 11 | - packages=['k2test'], | |
| 12 | - package_data={ # Optional | |
| 13 | - }, | |
| 14 | - install_requires=[""], | |
| 15 | -) |
db/database.db
No preview for this file type
k2/__pycache__/k2cfg.cpython-310.pyc
No preview for this file type
k2/__pycache__/k2obj.cpython-310.pyc
No preview for this file type
k2/__pycache__/k2rout.cpython-310.pyc
No preview for this file type
k2/k2cfg.py
| ... | ... | @@ -7,26 +7,34 @@ |
| 7 | 7 | import pytz |
| 8 | 8 | import os |
| 9 | 9 | import sys |
| 10 | -from flask import session | |
| 10 | +from flask import session, request | |
| 11 | +from flask_login import LoginManager | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | - | |
| 14 | 14 | class k2(k2obj): |
| 15 | 15 | version = '2.5.1.27' |
| 16 | 16 | db = SQLAlchemy() |
| 17 | 17 | domain = 'http://127.0.0.1:5000/' |
| 18 | - update_domain ='http://185.174.172.137/' | |
| 19 | - venv_bin_path = os.path.join(os.path.dirname(sys.prefix), 'venv/Scripts') | |
| 18 | + update_domain = 'http://127.0.0.1:8000/' #'http://185.174.172.137/' | |
| 19 | + venv_bin_path = os.path.join(os.path.dirname(sys.prefix), 'venv/Scripts') #for windows | |
| 20 | + #venv_bin_path = os.path.join(os.path.dirname(sys.prefix), 'venv/bin') #for linux | |
| 20 | 21 | json_sort_keys = False |
| 21 | 22 | timezone = pytz.timezone('Europe/Kiev') |
| 22 | 23 | secret_key = 'JH&INH987gFDHdsagh&8dwbjdw8ckw' |
| 23 | 24 | default_language = 'en' |
| 24 | 25 | current_language = '' |
| 25 | 26 | babel_translation_directories = '' |
| 27 | + languages = { | |
| 28 | + 'en': 'English', | |
| 29 | + 'uk': 'Українська', | |
| 30 | + 'pl': 'Polski' | |
| 31 | + } | |
| 26 | 32 | components = '' |
| 33 | + login_manager = LoginManager() | |
| 27 | 34 | |
| 28 | 35 | |
| 29 | 36 | |
| 37 | + | |
| 30 | 38 | def __init__(self): |
| 31 | 39 | super().__init__() |
| 32 | 40 | |
| ... | ... | @@ -34,7 +42,7 @@ |
| 34 | 42 | def load_babel_translation_directories(cls): |
| 35 | 43 | with open('languages/babel_translation_directories.yml', 'r') as f: |
| 36 | 44 | data = yaml.safe_load(f) |
| 37 | - print(data['babel_translation_directories']) | |
| 45 | + #print(data['babel_translation_directories']) | |
| 38 | 46 | cls.babel_translation_directories = data['babel_translation_directories'] |
| 39 | 47 | |
| 40 | 48 | @classmethod |
| ... | ... | @@ -59,6 +67,8 @@ |
| 59 | 67 | with open('languages/babel_translation_directories.yml', 'w') as f: |
| 60 | 68 | yaml.dump(data, f) |
| 61 | 69 | |
| 70 | + | |
| 71 | + | |
| 62 | 72 | # load database settings from yml file |
| 63 | 73 | def init_db_uri(self): |
| 64 | 74 | with open('db/db.yml', 'r') as f: |
| ... | ... | @@ -73,4 +83,8 @@ |
| 73 | 83 | db_path = '../db/database.db' |
| 74 | 84 | app.config['SQLALCHEMY_BINDS'] = {'db2': f'sqlite:///{db_path}'} |
| 75 | 85 | self.db.init_app(app) |
| 86 | + | |
| 87 | + def init_lm(self, app): | |
| 88 | + # Initialize LoginManager | |
| 89 | + self.login_manager.init_app(app) |
k2/k2obj.py
k2/k2rout.py
| ... | ... | @@ -16,9 +16,9 @@ |
| 16 | 16 | from .k2admmenu import K2admin_menus, K2admin_Menus_Prava |
| 17 | 17 | from sqlalchemy import text |
| 18 | 18 | from flask_jwt_extended import get_jwt_identity, jwt_required |
| 19 | +from flask_login import login_user, current_user, logout_user, login_required | |
| 19 | 20 | |
| 20 | 21 | |
| 21 | - | |
| 22 | 22 | # initialize db |
| 23 | 23 | # migrate = Migrate(app, db) |
| 24 | 24 | |
| ... | ... | @@ -83,7 +83,7 @@ |
| 83 | 83 | components = Component.query.all() |
| 84 | 84 | components_names = [component.name for component in components] |
| 85 | 85 | if 'k2site' in components_names: |
| 86 | - return redirect(url_for('k2test.new_component2')) #змінити на ендпоінт головної k2site | |
| 86 | + return redirect(url_for('k2site.new_component2')) #змінити на ендпоінт головної k2site | |
| 87 | 87 | else: |
| 88 | 88 | return redirect('/dashboard') |
| 89 | 89 | |
| 90 | 90 | |
| ... | ... | @@ -112,9 +112,10 @@ |
| 112 | 112 | @components_bp.route('/dashboard') |
| 113 | 113 | def dashboard(): |
| 114 | 114 | components = Component.query.all() |
| 115 | + components_names = [] | |
| 115 | 116 | components_names = [component.name for component in components] |
| 116 | 117 | if 'k2site' in components_names: |
| 117 | - return redirect(url_for('components_bp.component_list_dasb')) # змінити на ендпоінт головної k2site | |
| 118 | + return redirect(url_for('components.component_list_dasb')) # змінити на ендпоінт головної k2site | |
| 118 | 119 | else: |
| 119 | 120 | # Компоненти доступні для встановлення |
| 120 | 121 | # GET-запит до API |
| ... | ... | @@ -155,6 +156,14 @@ |
| 155 | 156 | return render_template('component-info.html', selected_component=selected_component) |
| 156 | 157 | |
| 157 | 158 | |
| 159 | +@components_bp.route('/show_components-site/<string:component_id>') | |
| 160 | +def show_components_site(component_id): | |
| 161 | + response = requests.get(f'{k2.update_domain}api/components') | |
| 162 | + json_data = response.json() | |
| 163 | + selected_component = next((component for component in json_data if component['id'] == component_id), None) | |
| 164 | + return render_template('component-info-site.html', selected_component=selected_component) | |
| 165 | + | |
| 166 | + | |
| 158 | 167 | @components_bp.route('/install_components_git/<string:component_id>') |
| 159 | 168 | def install_components_git(component_id): |
| 160 | 169 | # Шлях до головної папки проекту |
| 161 | 170 | |
| ... | ... | @@ -265,9 +274,15 @@ |
| 265 | 274 | # Шлях до файлу, до якого потрібно додати роути |
| 266 | 275 | file_path = 'routes.py' |
| 267 | 276 | # Код, який потрібно додати |
| 268 | - code = f'''from components.{selected_component['name']}.{selected_component['name']}.views import {selected_component['name']}\napp.register_blueprint({selected_component['name']}, url_prefix='/{selected_component['name']}')''' | |
| 269 | - # selected_component['dependencies'] | |
| 277 | + if component_name == 'k2grid_base': | |
| 278 | + code = f'''from components.{selected_component['name']}.{selected_component['name']}.views import {selected_component['name']}\napp.register_blueprint({selected_component['name']}, url_prefix='/')''' | |
| 279 | + elif component_name == 'k2site': | |
| 280 | + code = f'''from components.{selected_component['name']}.{selected_component['name']}.views import {selected_component['name']}\napp.register_blueprint({selected_component['name']}, url_prefix='/{selected_component['name']}')\nlogin_manager = k2().init_lm(app)''' | |
| 281 | + else: | |
| 282 | + code = f'''from components.{selected_component['name']}.{selected_component['name']}.views import {selected_component['name']}\napp.register_blueprint({selected_component['name']}, url_prefix='/{selected_component['name']}')''' | |
| 270 | 283 | |
| 284 | + | |
| 285 | + | |
| 271 | 286 | # Відкриття файлу у режимі дозапису |
| 272 | 287 | with open(file_path, 'a') as file: |
| 273 | 288 | # Запис нового коду у файл |
| 274 | 289 | |
| 275 | 290 | |
| ... | ... | @@ -311,11 +326,20 @@ |
| 311 | 326 | get_admin_menu() |
| 312 | 327 | |
| 313 | 328 | |
| 314 | - # install requirements | |
| 329 | + ## install requirements for windows | |
| 330 | + #venv_bin_path = os.path.join(os.path.dirname(sys.prefix), 'venv/Scripts') | |
| 331 | + #requirements_file = os.path.join('components', selected_component_name, "requirements.txt") | |
| 332 | + #if os.path.isfile(requirements_file): | |
| 333 | + # pip_command = f"{venv_bin_path}/python -m pip install -r {requirements_file}" | |
| 334 | + # subprocess.run(pip_command, shell=True, check=True) | |
| 335 | + | |
| 336 | + #install requirements for linux | |
| 337 | + venv_bin_path = os.path.join(os.path.dirname(sys.prefix), 'venv/bin') | |
| 315 | 338 | requirements_file = os.path.join('components', selected_component_name, "requirements.txt") |
| 316 | 339 | if os.path.isfile(requirements_file): |
| 317 | - pip_command = f"{k2.venv_bin_path}/python -m pip install -r {requirements_file}" | |
| 340 | + pip_command = f"{venv_bin_path}/python3 -m pip install -r {requirements_file}" | |
| 318 | 341 | subprocess.run(pip_command, shell=True, check=True) |
| 342 | + | |
| 319 | 343 | return f'''Requirements installed successfully |
| 320 | 344 | \n \n please wait installing requirments components... |
| 321 | 345 | <meta http-equiv="refresh" content="1;url=/install-requirments-components" />''' |
| ... | ... | @@ -362,7 +386,7 @@ |
| 362 | 386 | |
| 363 | 387 | component.installed = False |
| 364 | 388 | db.session.commit() |
| 365 | - | |
| 389 | + response = requests.get(f"{k2.domain}/k2site/new_component2") | |
| 366 | 390 | return 'Component successfully turn off <meta http-equiv="refresh" content="1;url=/dashboard" />' |
| 367 | 391 | |
| 368 | 392 | |
| ... | ... | @@ -383,7 +407,8 @@ |
| 383 | 407 | # Оновлюємо статус компоненти |
| 384 | 408 | component.installed = True |
| 385 | 409 | db.session.commit() |
| 386 | - return 'Dependencies added successfully <meta http-equiv="refresh" content="1;url=/dashboard" />' | |
| 410 | + response = requests.get(f"{k2.domain}/k2site/new_component2") | |
| 411 | + return 'Dependencies added successfully <meta http-equiv="refresh" content="1;url=/dashboard" />' | |
| 387 | 412 | |
| 388 | 413 | |
| 389 | 414 | @components_bp.route('/remove-component/<string:component_id>') |
| ... | ... | @@ -410,6 +435,7 @@ |
| 410 | 435 | except Exception as e: |
| 411 | 436 | # Повертаємо повідомлення про помилку видалення |
| 412 | 437 | return 'Error removing component: ' + str(e) |
| 438 | + response = requests.get(f"{k2.domain}/k2site/new_component2") | |
| 413 | 439 | |
| 414 | 440 | |
| 415 | 441 | # @components_bp.route('/component/add') |
| ... | ... | @@ -453,7 +479,7 @@ |
| 453 | 479 | data.append(response.json()[0]) |
| 454 | 480 | prev_menu = response.json()[0]['title'] |
| 455 | 481 | for item in response.json()[0]['children']: |
| 456 | - name_menu = str(item['to']).replace('/','-') | |
| 482 | + name_menu = 'k2itm'+ item['to'].replace('/','-') | |
| 457 | 483 | caption_menu = item['title'] |
| 458 | 484 | add_menu_with_permissions_db(name_menu, prev_menu, caption_menu) |
| 459 | 485 | components = Component.query.all() |
| 460 | 486 | |
| 461 | 487 | |
| 462 | 488 | |
| 463 | 489 | |
| 464 | 490 | |
| 465 | 491 | |
| 466 | 492 | |
| 467 | 493 | |
| ... | ... | @@ -465,38 +491,40 @@ |
| 465 | 491 | #prev_menu = |
| 466 | 492 | prev_menu = response.json()[0]['title'] |
| 467 | 493 | for item in response.json()[0]['children']: |
| 468 | - name_menu = item['to'] | |
| 494 | + name_menu = 'k2itm'+ item['to'].replace('/','-') | |
| 469 | 495 | caption_menu = item['title'] |
| 470 | 496 | add_menu_with_permissions_db(name_menu, prev_menu, caption_menu) |
| 471 | 497 | else: |
| 472 | - data | |
| 498 | + continue | |
| 473 | 499 | # add component_name key for menu items |
| 474 | - for item in data: | |
| 475 | - item['component_name'] = components_names | |
| 476 | - k2.menu = data | |
| 477 | - return k2.menu | |
| 500 | + #for item in data: | |
| 501 | + # item['component_name'] = components_names | |
| 502 | + #k2.menu = data | |
| 503 | + return data | |
| 478 | 504 | |
| 479 | 505 | |
| 506 | + | |
| 507 | + | |
| 480 | 508 | @components_bp.route('/api/main-menu/') |
| 481 | -@jwt_required() | |
| 509 | +@login_required | |
| 482 | 510 | def get_admin_menu(): |
| 483 | - current_user = get_jwt_identity() | |
| 484 | - role_id = current_user['user_role'] | |
| 511 | + components = Component.query.all() | |
| 512 | + components_names = [component.name for component in components] | |
| 513 | + if 'k2site' in components_names: | |
| 514 | + role_id = current_user.get_role_id() | |
| 485 | 515 | filter_menu = [] |
| 486 | 516 | response = requests.get(f"{k2.domain}api/add-to-menu") |
| 487 | 517 | menu_items_list = K2admin_menus.get_menu_items_by_roles(role_id) |
| 488 | - | |
| 518 | + #print(menu_items_list) | |
| 489 | 519 | for item in response.json(): |
| 490 | 520 | filtered_children = [] |
| 491 | 521 | for im in item['children']: |
| 492 | - | |
| 493 | - if im['to'] in menu_items_list: | |
| 522 | + if 'k2itm' + im['to'].replace('/','-') in menu_items_list: | |
| 494 | 523 | filtered_children.append(im) |
| 495 | 524 | if filtered_children: |
| 496 | 525 | item['children'] = filtered_children |
| 497 | 526 | filter_menu.append(item) |
| 498 | - filter_menu.append({"heading": 'APPS & PAGES'}) | |
| 499 | - | |
| 527 | + # filter_menu.append({"heading": 'APPS & PAGES'}) | |
| 500 | 528 | return jsonify(filter_menu) |
| 501 | 529 | |
| 502 | 530 | |
| ... | ... | @@ -536,6 +564,7 @@ |
| 536 | 564 | db.session.commit() |
| 537 | 565 | |
| 538 | 566 | @components_bp.route('/component-add') |
| 567 | +@login_required | |
| 539 | 568 | def component_add_dasb(): |
| 540 | 569 | try: |
| 541 | 570 | response = requests.get(f'{k2.update_domain}api/components') |
| 542 | 571 | |
| 543 | 572 | |
| 544 | 573 | |
| 545 | 574 | |
| 546 | 575 | |
| ... | ... | @@ -556,18 +585,24 @@ |
| 556 | 585 | 'description'] else False)] |
| 557 | 586 | else: |
| 558 | 587 | filtered_components = component_server |
| 588 | + components = Component.query.all() | |
| 589 | + components_names = [component.name for component in components] | |
| 559 | 590 | |
| 560 | 591 | return render_template('dashboard-add.html', |
| 561 | - component_server=filtered_components, | |
| 562 | - ) | |
| 592 | + component_server=filtered_components, search_query=search_query, components_names=components_names ) | |
| 563 | 593 | |
| 594 | + | |
| 595 | + | |
| 564 | 596 | @components_bp.route('/component-list') |
| 597 | +@login_required | |
| 565 | 598 | def component_list_dasb(): |
| 566 | 599 | components = Component.query.all() |
| 600 | + | |
| 567 | 601 | return render_template('dashboard-list.html', components=components) |
| 568 | 602 | |
| 569 | 603 | |
| 570 | 604 | |
| 605 | + | |
| 571 | 606 | @components_bp.route('/menu-admin-items') |
| 572 | 607 | def menu_items(): |
| 573 | 608 | menu = [ |
| ... | ... | @@ -575,8 +610,8 @@ |
| 575 | 610 | "title": 'Add components', |
| 576 | 611 | "icon": {"icon": 'mdi-account-circle-outline'}, |
| 577 | 612 | "children": [ |
| 578 | - {'title': 'Install components', 'to': 'component-add'}, | |
| 579 | - {'title': 'Installed components', 'to': 'component-list'}, | |
| 613 | + {'title': 'Install new components', 'to': '/component-add'}, | |
| 614 | + {'title': 'Installed components', 'to': '/component-list'}, | |
| 580 | 615 | |
| 581 | 616 | ], |
| 582 | 617 | }] |
languages/babel_translation_directories.yml
| 1 | -babel_translation_directories: languages;components/k2test/k2test/languages;components/k2auth/k2auth/languages;components/k2adm/k2adm/languages | |
| 1 | +babel_translation_directories: languages;components/k2site/k2site/languages;components/k2adm/k2adm/languages;components/k2test/k2test/languages;components/k2grid_base/k2grid_base/languages |
languages/en/LC_MESSAGES/messages.mo
No preview for this file type
languages/en/LC_MESSAGES/messages.po
| ... | ... | @@ -27,4 +27,19 @@ |
| 27 | 27 | |
| 28 | 28 | msgid "t_components_shop" |
| 29 | 29 | msgstr "Add component" |
| 30 | + | |
| 31 | +msgid "t_components_delete" | |
| 32 | +msgstr "Delete component" | |
| 33 | + | |
| 34 | +msgid "t_close_popup" | |
| 35 | +msgstr "Close" | |
| 36 | + | |
| 37 | +msgid "t_delete_popup" | |
| 38 | +msgstr "Delete" | |
| 39 | + | |
| 40 | +msgid "t_turn_of_component" | |
| 41 | +msgstr "Turn off component" | |
| 42 | + | |
| 43 | +msgid "t_turn_on_component" | |
| 44 | +msgstr "Turn on component" |
languages/pl/LC_MESSAGES/messages.mo
No preview for this file type
languages/pl/LC_MESSAGES/messages.po
| ... | ... | @@ -32,4 +32,19 @@ |
| 32 | 32 | |
| 33 | 33 | msgid "t_components_shop" |
| 34 | 34 | msgstr "Dodaj komponent" |
| 35 | + | |
| 36 | +msgid "t_components_delete" | |
| 37 | +msgstr "Usuń komponent" | |
| 38 | + | |
| 39 | +msgid "t_close_popup" | |
| 40 | +msgstr "Zamknij" | |
| 41 | + | |
| 42 | +msgid "t_delete_popup" | |
| 43 | +msgstr "Usuń" | |
| 44 | + | |
| 45 | +msgid "t_turn_of_component" | |
| 46 | +msgstr "Wyłącz komponent" | |
| 47 | + | |
| 48 | +msgid "t_turn_on_component" | |
| 49 | +msgstr "Włącz komponent" |
languages/uk/LC_MESSAGES/messages.mo
No preview for this file type
languages/uk/LC_MESSAGES/messages.po
| ... | ... | @@ -32,4 +32,19 @@ |
| 32 | 32 | |
| 33 | 33 | msgid "t_components_shop" |
| 34 | 34 | msgstr "Додати компоненту" |
| 35 | + | |
| 36 | +msgid "t_components_delete" | |
| 37 | +msgstr "Видалити компоненту" | |
| 38 | + | |
| 39 | +msgid "t_close_popup" | |
| 40 | +msgstr "Закрити" | |
| 41 | + | |
| 42 | +msgid "t_delete_popup" | |
| 43 | +msgstr "Видалити" | |
| 44 | + | |
| 45 | +msgid "t_turn_of_component | |
| 46 | +msgstr "Вимкнути" | |
| 47 | + | |
| 48 | +msgid "t_turn_on_component" | |
| 49 | +msgstr "Увімкнути" |
routes.py
templates/base.html
| 1 | -<!DOCTYPE html> | |
| 2 | -<html> | |
| 3 | -<head> | |
| 4 | - <title>{% block title %}{% endblock %}</title> | |
| 5 | - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}"> | |
| 6 | - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bootstrap.min.css') }}"> | |
| 7 | - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | |
| 8 | - <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script> | |
| 9 | - <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> | |
| 10 | - | |
| 11 | - | |
| 12 | - | |
| 13 | - {% block styles %} | |
| 14 | - <!-- Підключення CSS-стилів --> | |
| 15 | - {% endblock %} | |
| 16 | -</head> | |
| 17 | -<body> | |
| 18 | -######################## | |
| 19 | - <div class="content"> | |
| 20 | - {% block content %}dashboard{% endblock %} | |
| 21 | - </div> | |
| 22 | -<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | |
| 23 | - <footer> | |
| 24 | - © 2023 Корпорація k2 | |
| 25 | - </footer> | |
| 26 | - | |
| 27 | - | |
| 28 | -{% block scripts %} | |
| 29 | - <!-- Підключення скриптів JavaScript --> | |
| 30 | - {% endblock %} | |
| 31 | -</body> | |
| 32 | -</html> |
templates/component-info-site.html
| 1 | +{% extends 'base.html' %} | |
| 2 | +{% block styles %} | |
| 3 | +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> | |
| 4 | + | |
| 5 | + <style> | |
| 6 | + .bd-placeholder-img { | |
| 7 | + font-size: 1.125rem; | |
| 8 | + text-anchor: top; | |
| 9 | + -webkit-user-select: none; | |
| 10 | + -moz-user-select: none; | |
| 11 | + user-select: none; | |
| 12 | + } | |
| 13 | + | |
| 14 | + @media (min-width: 768px) { | |
| 15 | + .bd-placeholder-img-lg { | |
| 16 | + font-size: 3.5rem; | |
| 17 | + } | |
| 18 | + } | |
| 19 | + | |
| 20 | + .b-example-divider { | |
| 21 | + height: 3rem; | |
| 22 | + background-color: rgba(0, 0, 0, .1); | |
| 23 | + border: solid rgba(0, 0, 0, .15); | |
| 24 | + border-width: 1px 0; | |
| 25 | + box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15); | |
| 26 | + } | |
| 27 | + | |
| 28 | + @media (min-width: 992px) { | |
| 29 | + .rounded-lg-3 { border-radius: .3rem; } | |
| 30 | + } | |
| 31 | + </style> | |
| 32 | + | |
| 33 | + | |
| 34 | +{% endblock %} | |
| 35 | +{% block content %} | |
| 36 | +<div id="popupBackdrop"> | |
| 37 | + <div class="loader"> | |
| 38 | + Встановлення компоненти... <i class="fa-solid fa-cog fa-spin fa-xl"></i> | |
| 39 | + </div> | |
| 40 | +</div> | |
| 41 | + | |
| 42 | + {% if selected_component %} | |
| 43 | +<div class="text-center border-bottom"> | |
| 44 | + <img class="d-block mx-auto mb-4" src="{{ url_for('static', filename='img/logo-k2.png')}}" alt="" width="200"> | |
| 45 | + <h3 class="display-4 fw-bold">K2CloudERP-2.5.1.27</h3> | |
| 46 | + <h1 class="display-4 fw-bold">{{selected_component.name|title}}</h1> | |
| 47 | + <div class="col-lg-6 mx-auto"> | |
| 48 | + <p class="lead mb-4">{{selected_component.description|title}} - | |
| 49 | + quickly design and customize responsive mobile-first components with Python and Bootstrap. | |
| 50 | + </p> | |
| 51 | + <p class="lead mb-4">Посилання на репозиторій: {{selected_component.git_link}}</p> | |
| 52 | + <p class="lead mb-4">Версія: {{selected_component.version}}</p> | |
| 53 | + <p class="lead mb-4">Розробка: K2 Cloud</p> | |
| 54 | + <div class="d-grid gap-2 d-sm-flex justify-content-sm-center mb-5"> | |
| 55 | + | |
| 56 | + <a href="/install_components/{{ selected_component.id }}" id="installBtn" class="btn btn-primary btn-lg px-4 me-sm-3" onclick="showLoader()">Встановити компоненту</a> | |
| 57 | + </div> | |
| 58 | + </div> | |
| 59 | + <div class="overflow-hidden" style="max-height: 30vh;"> | |
| 60 | + <div class="container px-5"> | |
| 61 | + <img src="https://corp2.eu/media/assets/images/service/k2cloud.jpg" class="img-fluid border rounded-3 shadow-lg mb-4" alt="Example image" width="700" height="500" loading="lazy"> | |
| 62 | + </div> | |
| 63 | + </div> | |
| 64 | + </div> | |
| 65 | + | |
| 66 | + {% else %} | |
| 67 | + Помилка завантаження компоненти з сервера | |
| 68 | + {% endif %} | |
| 69 | + | |
| 70 | +<script> | |
| 71 | +function showLoader() { | |
| 72 | + document.getElementById("popupBackdrop").style.display = "block"; | |
| 73 | +} | |
| 74 | + | |
| 75 | +function hideLoader() { | |
| 76 | + document.getElementById("popupBackdrop").style.display = "none"; | |
| 77 | +} | |
| 78 | + | |
| 79 | +window.onload = function() { | |
| 80 | + hideLoader(); | |
| 81 | +}; | |
| 82 | +</script> | |
| 83 | + | |
| 84 | + | |
| 85 | +{% endblock %} |
templates/component-info.html
| 1 | -{% if 'base.html' in template_list %} | |
| 2 | - {% extends 'base.html' %} | |
| 3 | -{% else %} | |
| 4 | - | |
| 5 | -{% endif %} | |
| 6 | - | |
| 7 | 1 | {% block styles %} |
| 8 | 2 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> |
| 9 | - | |
| 10 | 3 | <style> |
| 11 | 4 | .bd-placeholder-img { |
| 12 | 5 | font-size: 1.125rem; |
| 13 | 6 | |
| ... | ... | @@ -34,9 +27,22 @@ |
| 34 | 27 | .rounded-lg-3 { border-radius: .3rem; } |
| 35 | 28 | } |
| 36 | 29 | </style> |
| 30 | +{% endblock %} | |
| 31 | +<!DOCTYPE html> | |
| 32 | +<html> | |
| 33 | +<head> | |
| 34 | + <title>{% block title %}{% endblock %}</title> | |
| 35 | + <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}"> | |
| 36 | + <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bootstrap.min.css') }}"> | |
| 37 | + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | |
| 38 | + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script> | |
| 39 | + <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> | |
| 37 | 40 | |
| 38 | 41 | |
| 39 | -{% endblock %} | |
| 42 | +</head> | |
| 43 | +<body> | |
| 44 | + | |
| 45 | + | |
| 40 | 46 | {% block content %} |
| 41 | 47 | <div id="popupBackdrop"> |
| 42 | 48 | <div class="loader"> |
| ... | ... | @@ -88,4 +94,13 @@ |
| 88 | 94 | |
| 89 | 95 | |
| 90 | 96 | {% endblock %} |
| 97 | + | |
| 98 | +<footer> | |
| 99 | + © 2023 Корпорація k2 | |
| 100 | + </footer> | |
| 101 | + | |
| 102 | + </div> | |
| 103 | + | |
| 104 | +</body> | |
| 105 | +</html> |
templates/dashboard-add.html
| 1 | 1 | {% extends 'base.html' %} |
| 2 | 2 | |
| 3 | - | |
| 4 | 3 | {% block styles %} |
| 5 | 4 | <style> |
| 6 | 5 | .table { |
| 7 | 6 | |
| ... | ... | @@ -27,20 +26,7 @@ |
| 27 | 26 | } |
| 28 | 27 | </style> |
| 29 | 28 | {% endblock %} |
| 30 | -<!DOCTYPE html> | |
| 31 | -<html> | |
| 32 | -<head> | |
| 33 | - <title>{% block title %}{% endblock %}</title> | |
| 34 | - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}"> | |
| 35 | - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bootstrap.min.css') }}"> | |
| 36 | - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | |
| 37 | - <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script> | |
| 38 | - <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> | |
| 39 | 29 | |
| 40 | - | |
| 41 | -</head> | |
| 42 | -<body> | |
| 43 | - | |
| 44 | 30 | <div class="content"> |
| 45 | 31 | {% block content %} |
| 46 | 32 | |
| 47 | 33 | |
| ... | ... | @@ -64,11 +50,11 @@ |
| 64 | 50 | <div> |
| 65 | 51 | <h2>{{ component.name|title }}</h2> |
| 66 | 52 | <p>{{ component.description }}</p> |
| 67 | - <p>ВЕРСІЯ {{ component.latest_version }}</p> | |
| 53 | + <p>version {{ component.latest_version }}</p> | |
| 68 | 54 | {% if component.name in components_names %} |
| 69 | 55 | <button type="button" class="btn btn-success">Installed</button> |
| 70 | 56 | {% else %} |
| 71 | - <a href="" class="btn btn-primary">Install</a> | |
| 57 | + <a href="/show_components-site/{{ component.id }}" class="btn btn-primary">Install</a> | |
| 72 | 58 | {% endif %} |
| 73 | 59 | </div> |
| 74 | 60 | </div> |
| ... | ... | @@ -85,7 +71,4 @@ |
| 85 | 71 | |
| 86 | 72 | |
| 87 | 73 | </div> |
| 88 | - | |
| 89 | -</body> | |
| 90 | -</html> |
templates/dashboard-list.html
| ... | ... | @@ -26,20 +26,6 @@ |
| 26 | 26 | } |
| 27 | 27 | </style> |
| 28 | 28 | {% endblock %} |
| 29 | -<!DOCTYPE html> | |
| 30 | -<html> | |
| 31 | -<head> | |
| 32 | - <title>{% block title %}{% endblock %}</title> | |
| 33 | - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}"> | |
| 34 | - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bootstrap.min.css') }}"> | |
| 35 | - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | |
| 36 | - <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script> | |
| 37 | - <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> | |
| 38 | - | |
| 39 | - | |
| 40 | -</head> | |
| 41 | -<body> | |
| 42 | - | |
| 43 | 29 | <div class="content"> |
| 44 | 30 | {% block content %} |
| 45 | 31 | |
| ... | ... | @@ -51,7 +37,6 @@ |
| 51 | 37 | <th>{{gettext('t_name')}}</th> |
| 52 | 38 | <th>{{gettext('t_description')}}</th> |
| 53 | 39 | <th>{{gettext('t_version')}}</th> |
| 54 | - <th>{{gettext('t_dependencies')}}</th> | |
| 55 | 40 | <th>{{gettext('t_git_link')}}</th> |
| 56 | 41 | <th>{{gettext('t_install_at')}}</th> |
| 57 | 42 | <th>{{gettext('t_status')}}</th> |
| ... | ... | @@ -70,7 +55,6 @@ |
| 70 | 55 | <td>{{ component.name }}</td> |
| 71 | 56 | <td>{{ component.description }}</td> |
| 72 | 57 | <td>{{ component.version }}</td> |
| 73 | - <td>{{ component.dependencies }}</td> | |
| 74 | 58 | <td>{{ component.git_link }}</td> |
| 75 | 59 | <td>{{ component.date_installed }}</td> |
| 76 | 60 | <td> |
| 77 | 61 | |
| 78 | 62 | |
| ... | ... | @@ -82,12 +66,12 @@ |
| 82 | 66 | </td> |
| 83 | 67 | <td> |
| 84 | 68 | {% if component.installed %} |
| 85 | - <a href="/remove_dependencies/{{ component.id }}" class="btn btn-primary">Вимкнути</a> | |
| 69 | + <a href="/remove_dependencies/{{ component.id }}" class="btn btn-primary">{{gettext('t_turn_of_component')}}</a> | |
| 86 | 70 | {% else %} |
| 87 | - <a href="/add_dependencies/{{ component.id }}" class="btn btn-primary">Увімкнути</a> | |
| 71 | + <a href="/add_dependencies/{{ component.id }}" class="btn btn-primary">{{gettext('t_turn_on_component')}}</a> | |
| 88 | 72 | <!-- Button trigger modal --> |
| 89 | 73 | <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#components-{{ component.id }}"> |
| 90 | - Видалити | |
| 74 | +{{gettext('t_delete_popup')}} | |
| 91 | 75 | </button> |
| 92 | 76 | |
| 93 | 77 | <!-- Modal --> |
| 94 | 78 | |
| 95 | 79 | |
| ... | ... | @@ -95,15 +79,15 @@ |
| 95 | 79 | <div class="modal-dialog"> |
| 96 | 80 | <div class="modal-content"> |
| 97 | 81 | <div class="modal-header"> |
| 98 | - <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1> | |
| 82 | + <h1 class="modal-title fs-5" id="exampleModalLabel">Title</h1> | |
| 99 | 83 | <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
| 100 | 84 | </div> |
| 101 | 85 | <div class="modal-body"> |
| 102 | - Видалити компоненту? | |
| 86 | + {{gettext('t_components_delete')}}? | |
| 103 | 87 | </div> |
| 104 | 88 | <div class="modal-footer"> |
| 105 | - <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> | |
| 106 | - <a href="/remove-component/{{ component.id }}" class="btn btn-danger">Видалити</a> | |
| 89 | + <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{gettext('t_close_popup')}}</button> | |
| 90 | + <a href="/remove-component/{{ component.id }}" class="btn btn-danger">{{gettext('t_delete_popup')}}</a> | |
| 107 | 91 | </div> |
| 108 | 92 | </div> |
| 109 | 93 | </div> |
| 110 | 94 | |
| 111 | 95 | |
| ... | ... | @@ -117,12 +101,7 @@ |
| 117 | 101 | |
| 118 | 102 | |
| 119 | 103 | |
| 120 | - | |
| 121 | 104 | {% endblock %} |
| 122 | 105 | |
| 123 | - | |
| 124 | 106 | </div> |
| 125 | - | |
| 126 | -</body> | |
| 127 | -</html> |
templates/dashboard.html
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | <div class="content"> |
| 44 | 44 | {% block content %} |
| 45 | 45 | <h1>K2CloudERP-2.5.1.27</h1> |
| 46 | -<p> <a href="{{ url_for('components.change_language', lang='en') }}">en</a> | <a href="{{ url_for('components.change_language', lang='pl') }}">pl</a> | <a href="">uk</a></p> | |
| 46 | +<p> <a href="{{ url_for('components.change_language', lang='en') }}">en</a> | <a href="{{ url_for('components.change_language', lang='pl') }}">pl</a> | <a href="{{ url_for('components.change_language', lang='uk') }}">uk</a></p> | |
| 47 | 47 | {{language}} |
| 48 | 48 | |
| 49 | 49 |
yml/admin_menu.yml
| 1 | +select: | |
| 2 | + select menuid, namemenu, scriptrun, prevmenu, prevmenu_text, module_name, del, active, | |
| 3 | + createuser, createdate, updateuser, updatedate, order_ins, caption, url/*, t */ | |
| 4 | + from k2admin_menus | |
| 5 | + | |
| 6 | +table: k2admin_menus | |
| 7 | +sortname: order_ins | |
| 8 | +typeid: 1 | |
| 9 | + | |
| 10 | +# Детально | |
| 11 | +detile: admin_menu_prav | |
| 12 | + | |
| 13 | +addtool_button: | |
| 14 | + 0: | |
| 15 | + caption: Синхр. | |
| 16 | + title: Загрузка списка пунктов меню | |
| 17 | + id: rights | |
| 18 | + icon: "ui-icon-extlink" | |
| 19 | + action: "loadMenuItems()" | |
| 20 | + position: last | |
| 21 | + | |
| 22 | +height: 150 | |
| 23 | + | |
| 24 | +sortorder: asc | |
| 25 | +caption: Доступ к меню | |
| 26 | +fields: | |
| 27 | + menuid: | |
| 28 | + field: menuid | |
| 29 | + caption: ID | |
| 30 | + width: 40 | |
| 31 | + readonly: true | |
| 32 | + align: left | |
| 33 | + hidden: true | |
| 34 | + type_field: text | |
| 35 | + primary_key: true | |
| 36 | + | |
| 37 | + caption: | |
| 38 | + field: caption | |
| 39 | + caption: Меню | |
| 40 | + width: 400 | |
| 41 | + readonly: false | |
| 42 | + align: left | |
| 43 | + type_field: text | |
| 44 | + | |
| 45 | + namemenu: | |
| 46 | + field: namemenu | |
| 47 | + caption: Идентификатор меню | |
| 48 | + width: 200 | |
| 49 | + readonly: false | |
| 50 | + align: left | |
| 51 | + hidden: false | |
| 52 | + type_field: text | |
| 53 | + | |
| 54 | + module_name: | |
| 55 | + field: module_name | |
| 56 | + caption: Название модуля | |
| 57 | + width: 200 | |
| 58 | + readonly: false | |
| 59 | + align: left | |
| 60 | + hidden: false | |
| 61 | + type_field: text | |
| 62 | + | |
| 63 | +# t: | |
| 64 | +# field: t | |
| 65 | +# caption: Параметр t | |
| 66 | +# width: 100 | |
| 67 | +# readonly: false | |
| 68 | +# align: left | |
| 69 | +# hidden: false | |
| 70 | + | |
| 71 | + url: | |
| 72 | + field: url | |
| 73 | + caption: URL | |
| 74 | + width: 250 | |
| 75 | + readonly: false | |
| 76 | + align: left | |
| 77 | + hidden: false | |
| 78 | + type_field: text | |
| 79 | + | |
| 80 | + order_ins: | |
| 81 | + field: order_ins | |
| 82 | + caption: Сортировка | |
| 83 | + width: 75 | |
| 84 | + readonly: false | |
| 85 | + align: left | |
| 86 | + hidden: false | |
| 87 | + type_field: text | |
| 88 | + | |
| 89 | + active: | |
| 90 | + field: active | |
| 91 | + caption: Акт. | |
| 92 | + width: 50 | |
| 93 | + readonly: false | |
| 94 | + type_field: checkbox | |
| 95 | + def_value: 1 | |
| 96 | + align: center | |
| 97 | + | |
| 98 | + del: | |
| 99 | + field: del | |
| 100 | + caption: Удал. | |
| 101 | + width: 50 | |
| 102 | + readonly: false | |
| 103 | + type_field: checkbox | |
| 104 | + def_value: 0 | |
| 105 | + align: center | |
| 106 | + hidden: true |
yml/admin_menu_prav.yml
| 1 | +select: | |
| 2 | + select m.pravrepid, m.menuid, m.username, m.r, m.w, m.i, m.d, m.c, | |
| 3 | + m.exp, m.imp, m.settable, m.cutpast, m.enable, m.magazinsid, m.del, | |
| 4 | + m.active, m.createuser, m.createdate, m.updateuser, m.updatedate, m.order_ins, | |
| 5 | + m.roleid, r.rolename from k2admin_menus_prava m | |
| 6 | + | |
| 7 | + left join k2roles r | |
| 8 | + on m.roleid = r.roleid | |
| 9 | + | |
| 10 | +table: k2admin_menus_prava | |
| 11 | +sortname: pravrepid | |
| 12 | +typeid: 1 | |
| 13 | + | |
| 14 | +height: 590 | |
| 15 | + | |
| 16 | +where: " WHERE (menuid='{masterid}') " | |
| 17 | +getmaster: true | |
| 18 | +masterid: menuid | |
| 19 | + | |
| 20 | +sortorder: asc | |
| 21 | +caption: Права | |
| 22 | +fields: | |
| 23 | + pravrepid: | |
| 24 | + field: pravrepid | |
| 25 | + alias: m.pravrepid | |
| 26 | + caption: ID | |
| 27 | + width: 40 | |
| 28 | + readonly: true | |
| 29 | + align: left | |
| 30 | + hidden: true | |
| 31 | + primary_key: true | |
| 32 | + | |
| 33 | + roleid: | |
| 34 | + field: roleid | |
| 35 | + alias: m.roleid | |
| 36 | + caption: ID ролі | |
| 37 | + width: 200 | |
| 38 | + readonly: false | |
| 39 | + align: left | |
| 40 | + type_field: DropDown | |
| 41 | + multy: false | |
| 42 | + hidden: true | |
| 43 | + sql: | |
| 44 | + select roleid as k, rolename as v | |
| 45 | + from k2roles | |
| 46 | + order by rolename | |
| 47 | + | |
| 48 | + rolename: | |
| 49 | + field: rolename | |
| 50 | + caption: Права | |
| 51 | + alias: r.rolename | |
| 52 | + | |
| 53 | + username: | |
| 54 | + field: username | |
| 55 | + alias: m.username | |
| 56 | + caption: Пользователь | |
| 57 | + width: 150 | |
| 58 | + readonly: false | |
| 59 | + align: left | |
| 60 | + | |
| 61 | + r: | |
| 62 | + field: r | |
| 63 | + alias: m.r | |
| 64 | + caption: Чтение | |
| 65 | + width: 50 | |
| 66 | + readonly: false | |
| 67 | + align: center | |
| 68 | + type_field: checkbox | |
| 69 | + def_value: 1 | |
| 70 | + | |
| 71 | + w: | |
| 72 | + field: w | |
| 73 | + alias: m.w | |
| 74 | + caption: Запись | |
| 75 | + width: 50 | |
| 76 | + readonly: false | |
| 77 | + align: center | |
| 78 | + type_field: checkbox | |
| 79 | + def_value: 1 | |
| 80 | + | |
| 81 | + i: | |
| 82 | + field: i | |
| 83 | + alias: m.i | |
| 84 | + caption: Вставка | |
| 85 | + width: 50 | |
| 86 | + readonly: false | |
| 87 | + align: center | |
| 88 | + type_field: checkbox | |
| 89 | + def_value: 1 | |
| 90 | + | |
| 91 | + d: | |
| 92 | + field: d | |
| 93 | + alias: m.d | |
| 94 | + caption: Удаление | |
| 95 | + width: 50 | |
| 96 | + readonly: false | |
| 97 | + align: center | |
| 98 | + type_field: checkbox | |
| 99 | + def_value: 1 | |
| 100 | + | |
| 101 | + c: | |
| 102 | + field: c | |
| 103 | + alias: m.c | |
| 104 | + caption: Копирование | |
| 105 | + width: 50 | |
| 106 | + readonly: false | |
| 107 | + align: center | |
| 108 | + type_field: checkbox | |
| 109 | + def_value: 0 | |
| 110 | + | |
| 111 | + exp: | |
| 112 | + field: exp | |
| 113 | + alias: m.exp | |
| 114 | + caption: Экспорт | |
| 115 | + width: 50 | |
| 116 | + readonly: false | |
| 117 | + align: center | |
| 118 | + type_field: checkbox | |
| 119 | + def_value: 0 | |
| 120 | + | |
| 121 | + imp: | |
| 122 | + field: imp | |
| 123 | + alias: m.imp | |
| 124 | + caption: Импорт | |
| 125 | + width: 50 | |
| 126 | + readonly: false | |
| 127 | + align: center | |
| 128 | + type_field: checkbox | |
| 129 | + def_value: 0 | |
| 130 | + | |
| 131 | + settable: | |
| 132 | + field: settable | |
| 133 | + alias: m.settable | |
| 134 | + caption: "Настройка<br>таблиц" | |
| 135 | + width: 50 | |
| 136 | + readonly: false | |
| 137 | + align: center | |
| 138 | + type_field: checkbox | |
| 139 | + def_value: 1 | |
| 140 | + | |
| 141 | + cutpast: | |
| 142 | + field: cutpast | |
| 143 | + alias: m.cutpast | |
| 144 | + caption: "Копирование<br>в буфер" | |
| 145 | + width: 50 | |
| 146 | + readonly: false | |
| 147 | + align: center | |
| 148 | + type_field: checkbox | |
| 149 | + def_value: 1 | |
| 150 | + | |
| 151 | + enable: | |
| 152 | + field: enable | |
| 153 | + alias: m.enable | |
| 154 | + caption: "Активность<br>элементов" | |
| 155 | + width: 50 | |
| 156 | + readonly: false | |
| 157 | + align: center | |
| 158 | + type_field: checkbox | |
| 159 | + def_value: 1 | |
| 160 | + | |
| 161 | + active: | |
| 162 | + field: active | |
| 163 | + alias: m.active | |
| 164 | + caption: Акт. | |
| 165 | + width: 50 | |
| 166 | + readonly: false | |
| 167 | + align: left | |
| 168 | + type_field: checkbox | |
| 169 | + def_value: 1 | |
| 170 | + | |
| 171 | + del: | |
| 172 | + field: del | |
| 173 | + alias: m.del | |
| 174 | + caption: Удал. | |
| 175 | + width: 50 | |
| 176 | + readonly: false | |
| 177 | + align: left | |
| 178 | + type_field: checkbox | |
| 179 | + def_value: 0 | |
| 180 | + hidden: true |
yml/gruntcontrols.yml
yml/roles.yml
| ... | ... | @@ -14,6 +14,8 @@ |
| 14 | 14 | readonly: true |
| 15 | 15 | align: left |
| 16 | 16 | hidden: true |
| 17 | + type_field: text | |
| 18 | + primary_key: true | |
| 17 | 19 | |
| 18 | 20 | rolename: |
| 19 | 21 | field: rolename |
| ... | ... | @@ -21,6 +23,7 @@ |
| 21 | 23 | width: 250 |
| 22 | 24 | readonly: false |
| 23 | 25 | align: left |
| 26 | + type_field: text | |
| 24 | 27 | |
| 25 | 28 | order_roles: |
| 26 | 29 | field: order_roles |
| ... | ... | @@ -28,6 +31,7 @@ |
| 28 | 31 | width: 100 |
| 29 | 32 | readonly: false |
| 30 | 33 | align: right |
| 34 | + type_field: text | |
| 31 | 35 | |
| 32 | 36 | commentrole: |
| 33 | 37 | field: commentrole |
| ... | ... | @@ -35,7 +39,7 @@ |
| 35 | 39 | width: 150 |
| 36 | 40 | readonly: false, |
| 37 | 41 | align: left |
| 38 | - | |
| 42 | + type_field: text | |
| 39 | 43 | |
| 40 | 44 | active: |
| 41 | 45 | field: active |
yml/users.yml
| ... | ... | @@ -17,8 +17,7 @@ |
| 17 | 17 | typeid: 1 |
| 18 | 18 | rows: 20 |
| 19 | 19 | sortname: create_datetime |
| 20 | -sortorder: desc | |
| 21 | -detile: k2users_obl | |
| 20 | +sortorder: desc | |
| 22 | 21 | caption: <%lnUsers%> |
| 23 | 22 | readonly_form: |
| 24 | 23 | who_create: |
| 25 | 24 | |
| 26 | 25 | |
| 27 | 26 | |
| 28 | 27 | |
| 29 | 28 | |
| 30 | 29 | |
| ... | ... | @@ -30,28 +29,33 @@ |
| 30 | 29 | user_id: |
| 31 | 30 | field: user_id |
| 32 | 31 | caption: ID |
| 32 | + alias: u.user_id | |
| 33 | 33 | width: 40 |
| 34 | 34 | readonly: true |
| 35 | 35 | align: left |
| 36 | 36 | hidden: true |
| 37 | + type_field: text | |
| 38 | + primary_key: true | |
| 37 | 39 | |
| 38 | 40 | order_ins: |
| 39 | 41 | field: order_ins |
| 42 | + alias: u.order_ins | |
| 40 | 43 | caption: № |
| 41 | 44 | width: 40 |
| 42 | 45 | readonly: true |
| 43 | 46 | align: left |
| 44 | 47 | hidden: true |
| 45 | - | |
| 48 | + type_field: text | |
| 46 | 49 | |
| 47 | - | |
| 48 | 50 | login: |
| 49 | 51 | field: login |
| 50 | 52 | caption: Email |
| 53 | + alias: u.login | |
| 51 | 54 | width: 100 |
| 52 | 55 | width_form: 250 |
| 53 | 56 | readonly: false |
| 54 | 57 | align: left |
| 58 | + type_field: text | |
| 55 | 59 | |
| 56 | 60 | act: |
| 57 | 61 | field: " " |
| 58 | 62 | |
| 59 | 63 | |
| ... | ... | @@ -85,13 +89,16 @@ |
| 85 | 89 | |
| 86 | 90 | name: |
| 87 | 91 | field: name |
| 92 | + alias: u.name | |
| 88 | 93 | caption: Ім'я |
| 89 | 94 | width: 250 |
| 90 | 95 | readonly: false |
| 91 | 96 | align: left |
| 97 | + type_field: text | |
| 92 | 98 | |
| 93 | 99 | birth_date: |
| 94 | 100 | field: birth_date |
| 101 | + alias: u.birth_date | |
| 95 | 102 | caption: Дата<br>народження |
| 96 | 103 | width: 100 |
| 97 | 104 | width_form: 250 |
| 98 | 105 | |
| 99 | 106 | |
| 100 | 107 | |
| 101 | 108 | |
| ... | ... | @@ -107,22 +114,27 @@ |
| 107 | 114 | width_form: 250 |
| 108 | 115 | readonly: false |
| 109 | 116 | align: left |
| 117 | + type_field: text | |
| 110 | 118 | |
| 111 | 119 | phone: |
| 112 | 120 | field: phone |
| 121 | + alias: u.phone | |
| 113 | 122 | caption: Номер |
| 114 | 123 | width: 100 |
| 115 | 124 | width_form: 250 |
| 116 | 125 | readonly: false |
| 117 | 126 | align: left |
| 127 | + type_field: text | |
| 118 | 128 | |
| 119 | 129 | tab_number: |
| 120 | 130 | field: tab_number |
| 131 | + alias: u.tab_number | |
| 121 | 132 | caption: Таб. номер |
| 122 | 133 | width: 75 |
| 123 | 134 | width_form: 250 |
| 124 | 135 | readonly: false |
| 125 | - align: left | |
| 136 | + align: left | |
| 137 | + type_field: text | |
| 126 | 138 | |
| 127 | 139 | |
| 128 | 140 | rolename: |
| ... | ... | @@ -132,6 +144,7 @@ |
| 132 | 144 | width: 150 |
| 133 | 145 | width_form: 250 |
| 134 | 146 | readonly: false |
| 147 | + type_field: text | |
| 135 | 148 | align: left |
| 136 | 149 | # type_field: DropDown |
| 137 | 150 | multy: false |
| 138 | 151 | |
| ... | ... | @@ -142,10 +155,12 @@ |
| 142 | 155 | |
| 143 | 156 | roleid: |
| 144 | 157 | field: roleid |
| 158 | + alias: u.roleid | |
| 145 | 159 | caption: |
| 146 | 160 | width: 150 |
| 147 | 161 | readonly: true |
| 148 | 162 | hidden: true |
| 163 | + type_field: text | |
| 149 | 164 | |
| 150 | 165 | department_name: |
| 151 | 166 | field: department_name |
| ... | ... | @@ -154,6 +169,7 @@ |
| 154 | 169 | width: 150 |
| 155 | 170 | width_form: 250 |
| 156 | 171 | readonly: false |
| 172 | + type_field: text | |
| 157 | 173 | align: left |
| 158 | 174 | # type_field: DropDown |
| 159 | 175 | multy: false |
| 160 | 176 | |
| ... | ... | @@ -166,10 +182,12 @@ |
| 166 | 182 | |
| 167 | 183 | departmentid: |
| 168 | 184 | field: departmentid |
| 185 | + alias: u.departmentid | |
| 169 | 186 | caption: |
| 170 | 187 | width: 150 |
| 171 | 188 | readonly: true |
| 172 | - hidden: true | |
| 189 | + hidden: true | |
| 190 | + type_field: text | |
| 173 | 191 | |
| 174 | 192 | |
| 175 | 193 |