Compare commits
41 Commits
83d50657ef
...
merge_dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c5ebdcfbf | |||
| 7560354677 | |||
| 2dddcab2f2 | |||
| 3a4f9e5606 | |||
| 35f03282af | |||
| 42b9925e60 | |||
| 772db778b7 | |||
| 1583da5816 | |||
| 8e12c7e515 | |||
| be06cb0ef9 | |||
| 4053d17981 | |||
| 7a95c5c3ef | |||
| c573d29eb1 | |||
| f2c3ffe87b | |||
| a28ebd1958 | |||
| 97330ad8e5 | |||
| 2a900c2726 | |||
| fb6676c468 | |||
| 2e01e3eeb3 | |||
| f6f1eefa82 | |||
| 442405735d | |||
| 845518b3ef | |||
| f11a3f0463 | |||
| b132b9e087 | |||
| 1df287c122 | |||
| 309bec8d77 | |||
| 0bfae14abc | |||
| 724e3c6342 | |||
| 131d9dd9b1 | |||
| 4faeb12156 | |||
| 73ce9c0ce3 | |||
| e03fe21db3 | |||
| 3b4e83a4e2 | |||
| 2d0f98d36c | |||
| 7d971710b5 | |||
| 9fa8403e95 | |||
| 03b8f760dc | |||
| cd77473d5e | |||
| 082e3107e6 | |||
| 8f01426ea6 | |||
| 3668d7a549 |
@@ -96,27 +96,27 @@ def sortByLength(inputStr):
|
||||
return len(inputStr)
|
||||
|
||||
|
||||
def add_domain(request, url, add_lang=False):
|
||||
domain = get_domain_by_request(request)
|
||||
if add_lang:
|
||||
cur_lang = get_cur_lang_by_request(request)
|
||||
return '{0}/{1}/{2}'.format(domain, cur_lang, url)
|
||||
else:
|
||||
return '{0}{1}'.format(domain, url)
|
||||
|
||||
|
||||
def get_domain_by_request(request):
|
||||
from project_sets import domain
|
||||
if request.query_params and 'domain' in request.query_params:
|
||||
return request.query_params['domain']
|
||||
return domain
|
||||
|
||||
|
||||
def get_cur_lang_by_request(request):
|
||||
from project_sets import lang
|
||||
if request.query_params and 'cur_lang' in request.query_params:
|
||||
return request.query_params['cur_lang']
|
||||
return lang
|
||||
# def add_domain(request, url, add_lang=False):
|
||||
# domain = get_domain_by_request(request)
|
||||
# if add_lang:
|
||||
# cur_lang = get_cur_lang_by_request(request)
|
||||
# return '{0}/{1}/{2}'.format(domain, cur_lang, url)
|
||||
# else:
|
||||
# return '{0}{1}'.format(domain, url)
|
||||
#
|
||||
#
|
||||
# def get_domain_by_request(request):
|
||||
# from pAerBim.project_sets import domain
|
||||
# if request.query_params and 'domain' in request.query_params:
|
||||
# return request.query_params['domain']
|
||||
# return domain
|
||||
#
|
||||
#
|
||||
# def get_cur_lang_by_request(request):
|
||||
# from project_sets import lang
|
||||
# if request.query_params and 'cur_lang' in request.query_params:
|
||||
# return request.query_params['cur_lang']
|
||||
# return lang
|
||||
|
||||
|
||||
def get_img_type_by_request(request):
|
||||
|
||||
BIN
BaseModels/wkhtmltopdf/bin/wkhtmltoimage.exe
Normal file
BIN
BaseModels/wkhtmltopdf/bin/wkhtmltoimage.exe
Normal file
Binary file not shown.
BIN
BaseModels/wkhtmltopdf/bin/wkhtmltopdf.exe
Normal file
BIN
BaseModels/wkhtmltopdf/bin/wkhtmltopdf.exe
Normal file
Binary file not shown.
BIN
BaseModels/wkhtmltopdf/bin/wkhtmltox.dll
Normal file
BIN
BaseModels/wkhtmltopdf/bin/wkhtmltox.dll
Normal file
Binary file not shown.
52
BaseModels/wkhtmltopdf/include/wkhtmltox/dllbegin.inc
Normal file
52
BaseModels/wkhtmltopdf/include/wkhtmltox/dllbegin.inc
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2010 wkhtmltopdf authors
|
||||
*
|
||||
* This file is part of wkhtmltopdf.
|
||||
*
|
||||
* wkhtmltopdf is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wkhtmltopdf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with wkhtmltopdf. If not, see <http: *www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __WKHTMLTOPDF_DLLBEGIN__
|
||||
#define __WKHTMLTOPDF_DLLBEGIN__
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#ifdef BUILDING_DLL
|
||||
#define DLL_PUBLIC __declspec(dllexport)
|
||||
#else
|
||||
#define DLL_PUBLIC __declspec(dllimport)
|
||||
#endif
|
||||
#define DLL_LOCAL
|
||||
#else
|
||||
#if __GNUC__ >= 4
|
||||
#define DLL_PUBLIC __attribute__ ((visibility("default")))
|
||||
#define DLL_LOCAL __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define DLL_PUBLIC
|
||||
#define DLL_LOCAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined _WIN32
|
||||
#define CALLTYPE __stdcall
|
||||
#else
|
||||
#define CALLTYPE
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define CAPI(type) extern "C" DLL_PUBLIC type CALLTYPE
|
||||
#else
|
||||
#define CAPI(type) DLL_PUBLIC type CALLTYPE
|
||||
#endif
|
||||
|
||||
#endif /*__WKHTMLTOPDF_DLLBEGIN__*/
|
||||
28
BaseModels/wkhtmltopdf/include/wkhtmltox/dllend.inc
Normal file
28
BaseModels/wkhtmltopdf/include/wkhtmltox/dllend.inc
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2010 wkhtmltopdf authors
|
||||
*
|
||||
* This file is part of wkhtmltopdf.
|
||||
*
|
||||
* wkhtmltopdf is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wkhtmltopdf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with wkhtmltopdf. If not, see <http: *www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef __WKHTMLTOPDF_DLLBEGIN__
|
||||
|
||||
#undef __WKHTMLTOPDF_DLLBEGIN__
|
||||
#undef DLL_PUBLIC
|
||||
#undef DLL_LOCAL
|
||||
#undef CAPI
|
||||
#undef CALLTYPE
|
||||
|
||||
#endif /*__WKHTMLTOPDF_DLLBEGIN__*/
|
||||
64
BaseModels/wkhtmltopdf/include/wkhtmltox/image.h
Normal file
64
BaseModels/wkhtmltopdf/include/wkhtmltox/image.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright 2010 wkhtmltopdf authors
|
||||
*
|
||||
* This file is part of wkhtmltopdf.
|
||||
*
|
||||
* wkhtmltopdf is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wkhtmltopdf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with wkhtmltopdf. If not, see <http: *www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __IMAGE_H__
|
||||
#define __IMAGE_H__
|
||||
#include <wkhtmltox/dllbegin.inc>
|
||||
|
||||
struct wkhtmltoimage_global_settings;
|
||||
typedef struct wkhtmltoimage_global_settings wkhtmltoimage_global_settings;
|
||||
|
||||
struct wkhtmltoimage_converter;
|
||||
typedef struct wkhtmltoimage_converter wkhtmltoimage_converter;
|
||||
|
||||
typedef void (*wkhtmltoimage_str_callback)(wkhtmltoimage_converter * converter, const char * str);
|
||||
typedef void (*wkhtmltoimage_int_callback)(wkhtmltoimage_converter * converter, const int val);
|
||||
typedef void (*wkhtmltoimage_void_callback)(wkhtmltoimage_converter * converter);
|
||||
|
||||
CAPI(int) wkhtmltoimage_init(int use_graphics);
|
||||
CAPI(int) wkhtmltoimage_deinit();
|
||||
CAPI(int) wkhtmltoimage_extended_qt();
|
||||
CAPI(const char *)wkhtmltoimage_version();
|
||||
|
||||
CAPI(wkhtmltoimage_global_settings *) wkhtmltoimage_create_global_settings();
|
||||
|
||||
CAPI(int) wkhtmltoimage_set_global_setting(wkhtmltoimage_global_settings * settings, const char * name, const char * value);
|
||||
CAPI(int) wkhtmltoimage_get_global_setting(wkhtmltoimage_global_settings * settings, const char * name, char * value, int vs);
|
||||
|
||||
CAPI(wkhtmltoimage_converter *) wkhtmltoimage_create_converter(wkhtmltoimage_global_settings * settings, const char * data);
|
||||
CAPI(void) wkhtmltoimage_destroy_converter(wkhtmltoimage_converter * converter);
|
||||
|
||||
CAPI(void) wkhtmltoimage_set_warning_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb);
|
||||
CAPI(void) wkhtmltoimage_set_error_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb);
|
||||
CAPI(void) wkhtmltoimage_set_phase_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_void_callback cb);
|
||||
CAPI(void) wkhtmltoimage_set_progress_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb);
|
||||
CAPI(void) wkhtmltoimage_set_finished_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb);
|
||||
CAPI(int) wkhtmltoimage_convert(wkhtmltoimage_converter * converter);
|
||||
/* CAPI(void) wkhtmltoimage_begin_conversion(wkhtmltoimage_converter * converter); */
|
||||
/* CAPI(void) wkhtmltoimage_cancel(wkhtmltoimage_converter * converter); */
|
||||
|
||||
CAPI(int) wkhtmltoimage_current_phase(wkhtmltoimage_converter * converter);
|
||||
CAPI(int) wkhtmltoimage_phase_count(wkhtmltoimage_converter * converter);
|
||||
CAPI(const char *) wkhtmltoimage_phase_description(wkhtmltoimage_converter * converter, int phase);
|
||||
CAPI(const char *) wkhtmltoimage_progress_string(wkhtmltoimage_converter * converter);
|
||||
CAPI(int) wkhtmltoimage_http_error_code(wkhtmltoimage_converter * converter);
|
||||
CAPI(long) wkhtmltoimage_get_output(wkhtmltoimage_converter * converter, const unsigned char **);
|
||||
|
||||
#include <wkhtmltox/dllend.inc>
|
||||
#endif /*__IMAGE_H__*/
|
||||
76
BaseModels/wkhtmltopdf/include/wkhtmltox/pdf.h
Normal file
76
BaseModels/wkhtmltopdf/include/wkhtmltox/pdf.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright 2010 wkhtmltopdf authors
|
||||
*
|
||||
* This file is part of wkhtmltopdf.
|
||||
*
|
||||
* wkhtmltopdf is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wkhtmltopdf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with wkhtmltopdf. If not, see <http: *www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PDF_H__
|
||||
#define __PDF_H__
|
||||
#include <wkhtmltox/dllbegin.inc>
|
||||
|
||||
struct wkhtmltopdf_global_settings;
|
||||
typedef struct wkhtmltopdf_global_settings wkhtmltopdf_global_settings;
|
||||
|
||||
struct wkhtmltopdf_object_settings;
|
||||
typedef struct wkhtmltopdf_object_settings wkhtmltopdf_object_settings;
|
||||
|
||||
struct wkhtmltopdf_converter;
|
||||
typedef struct wkhtmltopdf_converter wkhtmltopdf_converter;
|
||||
|
||||
typedef void (*wkhtmltopdf_str_callback)(wkhtmltopdf_converter * converter, const char * str);
|
||||
typedef void (*wkhtmltopdf_int_callback)(wkhtmltopdf_converter * converter, const int val);
|
||||
typedef void (*wkhtmltopdf_void_callback)(wkhtmltopdf_converter * converter);
|
||||
|
||||
CAPI(int) wkhtmltopdf_init(int use_graphics);
|
||||
CAPI(int) wkhtmltopdf_deinit();
|
||||
CAPI(int) wkhtmltopdf_extended_qt();
|
||||
CAPI(const char *) wkhtmltopdf_version();
|
||||
|
||||
CAPI(wkhtmltopdf_global_settings *) wkhtmltopdf_create_global_settings();
|
||||
CAPI(void) wkhtmltopdf_destroy_global_settings(wkhtmltopdf_global_settings *);
|
||||
|
||||
CAPI(wkhtmltopdf_object_settings *) wkhtmltopdf_create_object_settings();
|
||||
CAPI(void) wkhtmltopdf_destroy_object_settings(wkhtmltopdf_object_settings *);
|
||||
|
||||
CAPI(int) wkhtmltopdf_set_global_setting(wkhtmltopdf_global_settings * settings, const char * name, const char * value);
|
||||
CAPI(int) wkhtmltopdf_get_global_setting(wkhtmltopdf_global_settings * settings, const char * name, char * value, int vs);
|
||||
CAPI(int) wkhtmltopdf_set_object_setting(wkhtmltopdf_object_settings * settings, const char * name, const char * value);
|
||||
CAPI(int) wkhtmltopdf_get_object_setting(wkhtmltopdf_object_settings * settings, const char * name, char * value, int vs);
|
||||
|
||||
|
||||
CAPI(wkhtmltopdf_converter *) wkhtmltopdf_create_converter(wkhtmltopdf_global_settings * settings);
|
||||
CAPI(void) wkhtmltopdf_destroy_converter(wkhtmltopdf_converter * converter);
|
||||
|
||||
CAPI(void) wkhtmltopdf_set_warning_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb);
|
||||
CAPI(void) wkhtmltopdf_set_error_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb);
|
||||
CAPI(void) wkhtmltopdf_set_phase_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_void_callback cb);
|
||||
CAPI(void) wkhtmltopdf_set_progress_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb);
|
||||
CAPI(void) wkhtmltopdf_set_finished_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb);
|
||||
/* CAPI(void) wkhtmltopdf_begin_conversion(wkhtmltopdf_converter * converter); */
|
||||
/* CAPI(void) wkhtmltopdf_cancel(wkhtmltopdf_converter * converter); */
|
||||
CAPI(int) wkhtmltopdf_convert(wkhtmltopdf_converter * converter);
|
||||
CAPI(void) wkhtmltopdf_add_object(
|
||||
wkhtmltopdf_converter * converter, wkhtmltopdf_object_settings * setting, const char * data);
|
||||
|
||||
CAPI(int) wkhtmltopdf_current_phase(wkhtmltopdf_converter * converter);
|
||||
CAPI(int) wkhtmltopdf_phase_count(wkhtmltopdf_converter * converter);
|
||||
CAPI(const char *) wkhtmltopdf_phase_description(wkhtmltopdf_converter * converter, int phase);
|
||||
CAPI(const char *) wkhtmltopdf_progress_string(wkhtmltopdf_converter * converter);
|
||||
CAPI(int) wkhtmltopdf_http_error_code(wkhtmltopdf_converter * converter);
|
||||
CAPI(long) wkhtmltopdf_get_output(wkhtmltopdf_converter * converter, const unsigned char **);
|
||||
|
||||
#include <wkhtmltox/dllend.inc>
|
||||
#endif /*__PDF_H__*/
|
||||
BIN
BaseModels/wkhtmltopdf/uninstall.exe
Normal file
BIN
BaseModels/wkhtmltopdf/uninstall.exe
Normal file
Binary file not shown.
BIN
BaseModels/wkhtmltox/bin/libwkhtmltox.a
Normal file
BIN
BaseModels/wkhtmltox/bin/libwkhtmltox.a
Normal file
Binary file not shown.
BIN
BaseModels/wkhtmltox/bin/wkhtmltoimage.exe
Normal file
BIN
BaseModels/wkhtmltox/bin/wkhtmltoimage.exe
Normal file
Binary file not shown.
BIN
BaseModels/wkhtmltox/bin/wkhtmltopdf.exe
Normal file
BIN
BaseModels/wkhtmltox/bin/wkhtmltopdf.exe
Normal file
Binary file not shown.
BIN
BaseModels/wkhtmltox/bin/wkhtmltox.dll
Normal file
BIN
BaseModels/wkhtmltox/bin/wkhtmltox.dll
Normal file
Binary file not shown.
54
BaseModels/wkhtmltox/include/wkhtmltox/dllbegin.inc
Normal file
54
BaseModels/wkhtmltox/include/wkhtmltox/dllbegin.inc
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
|
||||
* vi:set ts=4 sts=4 sw=4 noet :
|
||||
*
|
||||
* Copyright 2010-2020 wkhtmltopdf authors
|
||||
*
|
||||
* This file is part of wkhtmltopdf.
|
||||
*
|
||||
* wkhtmltopdf is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wkhtmltopdf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with wkhtmltopdf. If not, see <http: *www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __WKHTMLTOPDF_DLLBEGIN__
|
||||
#define __WKHTMLTOPDF_DLLBEGIN__
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#ifdef BUILDING_DLL
|
||||
#define DLL_PUBLIC __declspec(dllexport)
|
||||
#else
|
||||
#define DLL_PUBLIC __declspec(dllimport)
|
||||
#endif
|
||||
#define DLL_LOCAL
|
||||
#else
|
||||
#if __GNUC__ >= 4
|
||||
#define DLL_PUBLIC __attribute__ ((visibility("default")))
|
||||
#define DLL_LOCAL __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define DLL_PUBLIC
|
||||
#define DLL_LOCAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined _WIN32
|
||||
#define CALLTYPE __stdcall
|
||||
#else
|
||||
#define CALLTYPE
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define CAPI(type) extern "C" DLL_PUBLIC type CALLTYPE
|
||||
#else
|
||||
#define CAPI(type) DLL_PUBLIC type CALLTYPE
|
||||
#endif
|
||||
|
||||
#endif /*__WKHTMLTOPDF_DLLBEGIN__*/
|
||||
30
BaseModels/wkhtmltox/include/wkhtmltox/dllend.inc
Normal file
30
BaseModels/wkhtmltox/include/wkhtmltox/dllend.inc
Normal file
@@ -0,0 +1,30 @@
|
||||
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
|
||||
* vi:set ts=4 sts=4 sw=4 noet :
|
||||
*
|
||||
* Copyright 2010-2020 wkhtmltopdf authors
|
||||
*
|
||||
* This file is part of wkhtmltopdf.
|
||||
*
|
||||
* wkhtmltopdf is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wkhtmltopdf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with wkhtmltopdf. If not, see <http: *www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef __WKHTMLTOPDF_DLLBEGIN__
|
||||
|
||||
#undef __WKHTMLTOPDF_DLLBEGIN__
|
||||
#undef DLL_PUBLIC
|
||||
#undef DLL_LOCAL
|
||||
#undef CAPI
|
||||
#undef CALLTYPE
|
||||
|
||||
#endif /*__WKHTMLTOPDF_DLLBEGIN__*/
|
||||
76
BaseModels/wkhtmltox/include/wkhtmltox/image.h
Normal file
76
BaseModels/wkhtmltox/include/wkhtmltox/image.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
|
||||
* vi:set ts=4 sts=4 sw=4 noet :
|
||||
*
|
||||
* Copyright 2010-2020 wkhtmltopdf authors
|
||||
*
|
||||
* This file is part of wkhtmltopdf.
|
||||
*
|
||||
* wkhtmltopdf is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wkhtmltopdf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with wkhtmltopdf. If not, see <http: *www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __IMAGE_H__
|
||||
#define __IMAGE_H__
|
||||
|
||||
#ifdef BUILDING_WKHTMLTOX
|
||||
#include "dllbegin.inc"
|
||||
#else
|
||||
#include <wkhtmltox/dllbegin.inc>
|
||||
#endif
|
||||
|
||||
struct wkhtmltoimage_global_settings;
|
||||
typedef struct wkhtmltoimage_global_settings wkhtmltoimage_global_settings;
|
||||
|
||||
struct wkhtmltoimage_converter;
|
||||
typedef struct wkhtmltoimage_converter wkhtmltoimage_converter;
|
||||
|
||||
typedef void (*wkhtmltoimage_str_callback)(wkhtmltoimage_converter * converter, const char * str);
|
||||
typedef void (*wkhtmltoimage_int_callback)(wkhtmltoimage_converter * converter, const int val);
|
||||
typedef void (*wkhtmltoimage_void_callback)(wkhtmltoimage_converter * converter);
|
||||
|
||||
CAPI(int) wkhtmltoimage_init(int use_graphics);
|
||||
CAPI(int) wkhtmltoimage_deinit();
|
||||
CAPI(int) wkhtmltoimage_extended_qt();
|
||||
CAPI(const char *)wkhtmltoimage_version();
|
||||
|
||||
CAPI(wkhtmltoimage_global_settings *) wkhtmltoimage_create_global_settings();
|
||||
|
||||
CAPI(int) wkhtmltoimage_set_global_setting(wkhtmltoimage_global_settings * settings, const char * name, const char * value);
|
||||
CAPI(int) wkhtmltoimage_get_global_setting(wkhtmltoimage_global_settings * settings, const char * name, char * value, int vs);
|
||||
|
||||
CAPI(wkhtmltoimage_converter *) wkhtmltoimage_create_converter(wkhtmltoimage_global_settings * settings, const char * data);
|
||||
CAPI(void) wkhtmltoimage_destroy_converter(wkhtmltoimage_converter * converter);
|
||||
|
||||
CAPI(void) wkhtmltoimage_set_warning_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb);
|
||||
CAPI(void) wkhtmltoimage_set_error_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb);
|
||||
CAPI(void) wkhtmltoimage_set_phase_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_void_callback cb);
|
||||
CAPI(void) wkhtmltoimage_set_progress_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb);
|
||||
CAPI(void) wkhtmltoimage_set_finished_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb);
|
||||
CAPI(int) wkhtmltoimage_convert(wkhtmltoimage_converter * converter);
|
||||
/* CAPI(void) wkhtmltoimage_begin_conversion(wkhtmltoimage_converter * converter); */
|
||||
/* CAPI(void) wkhtmltoimage_cancel(wkhtmltoimage_converter * converter); */
|
||||
|
||||
CAPI(int) wkhtmltoimage_current_phase(wkhtmltoimage_converter * converter);
|
||||
CAPI(int) wkhtmltoimage_phase_count(wkhtmltoimage_converter * converter);
|
||||
CAPI(const char *) wkhtmltoimage_phase_description(wkhtmltoimage_converter * converter, int phase);
|
||||
CAPI(const char *) wkhtmltoimage_progress_string(wkhtmltoimage_converter * converter);
|
||||
CAPI(int) wkhtmltoimage_http_error_code(wkhtmltoimage_converter * converter);
|
||||
CAPI(long) wkhtmltoimage_get_output(wkhtmltoimage_converter * converter, const unsigned char **);
|
||||
|
||||
#ifdef BUILDING_WKHTMLTOX
|
||||
#include "dllend.inc"
|
||||
#else
|
||||
#include <wkhtmltox/dllend.inc>
|
||||
#endif
|
||||
|
||||
#endif /*__IMAGE_H__*/
|
||||
88
BaseModels/wkhtmltox/include/wkhtmltox/pdf.h
Normal file
88
BaseModels/wkhtmltox/include/wkhtmltox/pdf.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
|
||||
* vi:set ts=4 sts=4 sw=4 noet :
|
||||
*
|
||||
* Copyright 2010-2020 wkhtmltopdf authors
|
||||
*
|
||||
* This file is part of wkhtmltopdf.
|
||||
*
|
||||
* wkhtmltopdf is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wkhtmltopdf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with wkhtmltopdf. If not, see <http: *www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PDF_H__
|
||||
#define __PDF_H__
|
||||
|
||||
#ifdef BUILDING_WKHTMLTOX
|
||||
#include "dllbegin.inc"
|
||||
#else
|
||||
#include <wkhtmltox/dllbegin.inc>
|
||||
#endif
|
||||
|
||||
struct wkhtmltopdf_global_settings;
|
||||
typedef struct wkhtmltopdf_global_settings wkhtmltopdf_global_settings;
|
||||
|
||||
struct wkhtmltopdf_object_settings;
|
||||
typedef struct wkhtmltopdf_object_settings wkhtmltopdf_object_settings;
|
||||
|
||||
struct wkhtmltopdf_converter;
|
||||
typedef struct wkhtmltopdf_converter wkhtmltopdf_converter;
|
||||
|
||||
typedef void (*wkhtmltopdf_str_callback)(wkhtmltopdf_converter * converter, const char * str);
|
||||
typedef void (*wkhtmltopdf_int_callback)(wkhtmltopdf_converter * converter, const int val);
|
||||
typedef void (*wkhtmltopdf_void_callback)(wkhtmltopdf_converter * converter);
|
||||
|
||||
CAPI(int) wkhtmltopdf_init(int use_graphics);
|
||||
CAPI(int) wkhtmltopdf_deinit();
|
||||
CAPI(int) wkhtmltopdf_extended_qt();
|
||||
CAPI(const char *) wkhtmltopdf_version();
|
||||
|
||||
CAPI(wkhtmltopdf_global_settings *) wkhtmltopdf_create_global_settings();
|
||||
CAPI(void) wkhtmltopdf_destroy_global_settings(wkhtmltopdf_global_settings *);
|
||||
|
||||
CAPI(wkhtmltopdf_object_settings *) wkhtmltopdf_create_object_settings();
|
||||
CAPI(void) wkhtmltopdf_destroy_object_settings(wkhtmltopdf_object_settings *);
|
||||
|
||||
CAPI(int) wkhtmltopdf_set_global_setting(wkhtmltopdf_global_settings * settings, const char * name, const char * value);
|
||||
CAPI(int) wkhtmltopdf_get_global_setting(wkhtmltopdf_global_settings * settings, const char * name, char * value, int vs);
|
||||
CAPI(int) wkhtmltopdf_set_object_setting(wkhtmltopdf_object_settings * settings, const char * name, const char * value);
|
||||
CAPI(int) wkhtmltopdf_get_object_setting(wkhtmltopdf_object_settings * settings, const char * name, char * value, int vs);
|
||||
|
||||
|
||||
CAPI(wkhtmltopdf_converter *) wkhtmltopdf_create_converter(wkhtmltopdf_global_settings * settings);
|
||||
CAPI(void) wkhtmltopdf_destroy_converter(wkhtmltopdf_converter * converter);
|
||||
|
||||
CAPI(void) wkhtmltopdf_set_warning_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb);
|
||||
CAPI(void) wkhtmltopdf_set_error_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb);
|
||||
CAPI(void) wkhtmltopdf_set_phase_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_void_callback cb);
|
||||
CAPI(void) wkhtmltopdf_set_progress_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb);
|
||||
CAPI(void) wkhtmltopdf_set_finished_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb);
|
||||
/* CAPI(void) wkhtmltopdf_begin_conversion(wkhtmltopdf_converter * converter); */
|
||||
/* CAPI(void) wkhtmltopdf_cancel(wkhtmltopdf_converter * converter); */
|
||||
CAPI(int) wkhtmltopdf_convert(wkhtmltopdf_converter * converter);
|
||||
CAPI(void) wkhtmltopdf_add_object(
|
||||
wkhtmltopdf_converter * converter, wkhtmltopdf_object_settings * setting, const char * data);
|
||||
|
||||
CAPI(int) wkhtmltopdf_current_phase(wkhtmltopdf_converter * converter);
|
||||
CAPI(int) wkhtmltopdf_phase_count(wkhtmltopdf_converter * converter);
|
||||
CAPI(const char *) wkhtmltopdf_phase_description(wkhtmltopdf_converter * converter, int phase);
|
||||
CAPI(const char *) wkhtmltopdf_progress_string(wkhtmltopdf_converter * converter);
|
||||
CAPI(int) wkhtmltopdf_http_error_code(wkhtmltopdf_converter * converter);
|
||||
CAPI(long) wkhtmltopdf_get_output(wkhtmltopdf_converter * converter, const unsigned char **);
|
||||
|
||||
#ifdef BUILDING_WKHTMLTOX
|
||||
#include "dllend.inc"
|
||||
#else
|
||||
#include <wkhtmltox/dllend.inc>
|
||||
#endif
|
||||
|
||||
#endif /*__PDF_H__*/
|
||||
@@ -7,6 +7,7 @@ from django.utils.translation import gettext as _
|
||||
from django import forms
|
||||
from django.utils.text import slugify
|
||||
from django.db.models import Min
|
||||
from django.contrib import messages
|
||||
|
||||
|
||||
class DocArtForm(forms.ModelForm):
|
||||
@@ -19,6 +20,26 @@ class DocArtForm(forms.ModelForm):
|
||||
self.fields['parent'].queryset = DocArt.objects.exclude(id__exact=self.instance.id)
|
||||
|
||||
|
||||
|
||||
|
||||
def make_assign_versions_action(version):
|
||||
def assign_to_version(modeladmin, request, queryset):
|
||||
|
||||
for art in queryset:
|
||||
if version not in art.versions.all():
|
||||
art.versions.add(version) # Method on Order model
|
||||
messages.info(request, f"Статье {art} назначена версия {version.name}")
|
||||
|
||||
assign_to_version.short_description = _(f"Назначить версию {version.name}")
|
||||
# We need a different '__name__' for each action - Django
|
||||
# uses this as a key in the drop-down box.
|
||||
assign_to_version.__name__ = _(f"Назначить версию {version.name}")
|
||||
|
||||
return assign_to_version
|
||||
|
||||
|
||||
|
||||
|
||||
class Admin_DocArt(SuperModelAdmin, Admin_Trans_BaseModelViewPage):
|
||||
form = DocArtForm
|
||||
|
||||
@@ -93,6 +114,20 @@ class Admin_DocArt(SuperModelAdmin, Admin_Trans_BaseModelViewPage):
|
||||
# inlines = [Admin_StackedInline_Block]
|
||||
actions = ["create_copy_arts"]
|
||||
|
||||
def get_actions(self, request):
|
||||
actions = super(Admin_DocArt, self).get_actions(request)
|
||||
|
||||
versions = DocVersion.objects.filter(enable=True)
|
||||
for version in versions:
|
||||
action = make_assign_versions_action(version)
|
||||
actions[action.__name__] = (action,
|
||||
action.__name__,
|
||||
action.short_description)
|
||||
|
||||
return actions
|
||||
|
||||
|
||||
|
||||
@admin.action(description=_("Создать копии выбранных статей"))
|
||||
def create_copy_arts(self, request, queryset):
|
||||
from BaseModels.functions import create_url
|
||||
|
||||
@@ -71,12 +71,17 @@ class DocArt(BaseModelViewPage):
|
||||
if not version:
|
||||
version = self.get_last_version()
|
||||
|
||||
art = DocArt.objects.filter(
|
||||
enable=True,
|
||||
versions=version,
|
||||
order__lt=self.order,
|
||||
parent=self.parent
|
||||
).order_by('-order').first()
|
||||
kwargs = {
|
||||
'enable': True,
|
||||
'versions': version,
|
||||
'parent': self.parent
|
||||
}
|
||||
if self.order:
|
||||
kwargs['order__lt'] = self.order
|
||||
|
||||
art = DocArt.objects.exclude(
|
||||
id=self.id
|
||||
).filter(**kwargs).order_by('-order').first()
|
||||
|
||||
if art:
|
||||
while art.get_last_child(version=version):
|
||||
@@ -94,12 +99,18 @@ class DocArt(BaseModelViewPage):
|
||||
|
||||
art = self.get_first_child(version=version)
|
||||
if not art:
|
||||
art = DocArt.objects.filter(
|
||||
enable=True,
|
||||
versions=version,
|
||||
order__gt=self.order,
|
||||
parent=self.parent
|
||||
).order_by('order').first()
|
||||
|
||||
kwargs = {
|
||||
'enable': True,
|
||||
'versions': version,
|
||||
'parent': self.parent
|
||||
}
|
||||
if self.order:
|
||||
kwargs['order__gt'] = self.order
|
||||
|
||||
art = DocArt.objects.exclude(
|
||||
id=self.id
|
||||
).filter(**kwargs).order_by('order').first()
|
||||
|
||||
if not art and self.parent:
|
||||
art = DocArt.objects.filter(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
from django.http import HttpResponse, Http404, FileResponse, HttpResponseRedirect
|
||||
from django.template import loader, RequestContext
|
||||
@@ -9,15 +10,18 @@ from GeneralApp.funcs import get_inter_http_respose
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.urls import reverse
|
||||
from collections import OrderedDict
|
||||
|
||||
from django.template.loader import render_to_string
|
||||
from urllib.parse import unquote
|
||||
|
||||
def get_tree_arts(art, arts, sel_arts_ids):
|
||||
|
||||
docs_tree = OrderedDict()
|
||||
|
||||
docs_tree.update({
|
||||
art_item.name: {
|
||||
art_item.id: {
|
||||
'url': art_item.url,
|
||||
'id': art_item.id,
|
||||
'name': art_item.name,
|
||||
# 'id': art_item.id,
|
||||
'children': get_tree_arts(art_item, arts, sel_arts_ids),
|
||||
'active': art_item.id in sel_arts_ids
|
||||
} for art_item in arts.filter(parent=art)
|
||||
@@ -25,22 +29,74 @@ def get_tree_arts(art, arts, sel_arts_ids):
|
||||
return docs_tree
|
||||
|
||||
|
||||
# def get_tree_arts(art, arts):
|
||||
#
|
||||
# docs_tree = OrderedDict()
|
||||
# docs_tree.update({
|
||||
# art['name']: {
|
||||
# 'url': art['url'],
|
||||
# 'id': art['id'],
|
||||
# 'children': get_tree_arts(art, DocArt.objects.filter(parent=art)),
|
||||
# } for art in arts.filter(parent=None)
|
||||
# })
|
||||
# return docs_tree
|
||||
|
||||
|
||||
|
||||
def _response_pdf(path):
|
||||
|
||||
filePDF = open(path, 'rb')
|
||||
|
||||
content = filePDF.read()
|
||||
# content = str(content)
|
||||
filePDF.close()
|
||||
|
||||
response = HttpResponse(content, content_type='application/pdf')
|
||||
response['Content-Disposition'] = 'filename="{fn}"'.format(fn=os.path.basename(path))
|
||||
return response
|
||||
|
||||
|
||||
def pdf_render(request, template, context, file_name):
|
||||
from BaseModels.functions import url_translit
|
||||
from GeneralApp.funcs_options import get_options_by_opt_types
|
||||
|
||||
filename = url_translit(file_name)
|
||||
|
||||
html = render_to_string(template, context, request)
|
||||
|
||||
sets = get_options_by_opt_types(['domain'], only_vals=True, w_prefix=True)
|
||||
if settings.DEBUG:
|
||||
sets['domain'] = 'http://127.0.0.1:8019'
|
||||
while 'src="/' in html:
|
||||
html = html.replace('src="/', f'src="{sets["domain"]}/')
|
||||
# html = unquote(html)
|
||||
|
||||
|
||||
f = open(f'{settings.PDF_FOLDER}/{filename}.html', 'w')
|
||||
f.write(html)
|
||||
f.close()
|
||||
|
||||
os.system(
|
||||
'{wkhtmltopdf} '
|
||||
# '--margin-top 20mm '
|
||||
# '--encoding windows-1250 '
|
||||
'--enable-local-file-access '
|
||||
'--load-error-handling ignore '
|
||||
'--enable-internal-links '
|
||||
'--keep-relative-links '
|
||||
'--print-media-type '
|
||||
'--encoding UTF-8 '
|
||||
# '--default-header '
|
||||
# '--minimum-font-size 20mm '
|
||||
'{pdf_folder}/{file_name}.html '
|
||||
'{pdf_folder}/{file_name}.pdf'.format(
|
||||
wkhtmltopdf=settings.WKHTML_TO_PDF, pdf_folder=settings.PDF_FOLDER, file_name=filename)
|
||||
)
|
||||
path = settings.PDF_FOLDER + '/' + filename + '.pdf'
|
||||
# os.system(u'{wkhtmltopdf} {print_folder}/order{filename}.html {print_folder}/order{filename}.pdf'.format(wkhtmltopdf=settings.WKHTML_TO_PDF, print_folder=settings.PRINT_FOLDER))
|
||||
return _response_pdf(path)
|
||||
|
||||
|
||||
|
||||
def DocsView(request, version=None, art_url=None):
|
||||
|
||||
|
||||
|
||||
if art_url and version:
|
||||
|
||||
generate_pdf = False
|
||||
if request.GET and 'pdf' in request.GET and request.GET['pdf'] == 'true':
|
||||
generate_pdf = True
|
||||
|
||||
kwargs = {
|
||||
'enable': True,
|
||||
'url': art_url,
|
||||
@@ -83,10 +139,19 @@ def DocsView(request, version=None, art_url=None):
|
||||
'allow_versions': versions,
|
||||
'breadcrumbs': breadcrumbs,
|
||||
'prev_article': art.get_prev_article(version=vers_obj),
|
||||
'next_article': art.get_next_article(version=vers_obj)
|
||||
'next_article': art.get_next_article(version=vers_obj),
|
||||
'pdf_render': generate_pdf
|
||||
}
|
||||
t = loader.get_template('pages/p_documentation.html')
|
||||
return get_inter_http_respose(t, Dict, request)
|
||||
|
||||
if not generate_pdf:
|
||||
tpl = 'pages/p_documentation.html'
|
||||
t = loader.get_template(tpl)
|
||||
return get_inter_http_respose(t, Dict, request)
|
||||
else:
|
||||
tpl = 'blocks/b_documentation_article.html'
|
||||
# tpl = 'pages/p_documentation.html'
|
||||
return pdf_render(request, tpl, Dict, art.name)
|
||||
|
||||
except DocArt.DoesNotExist:
|
||||
raise Http404
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
from django import forms
|
||||
import copy
|
||||
|
||||
from django import forms
|
||||
from django.contrib import admin
|
||||
from sets.admin import *
|
||||
from .models import *
|
||||
from django.contrib import admin
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
# from nested_inline.admin import NestedStackedInline, NestedTabularInline, NestedModelAdmin, NestedInline
|
||||
from super_inlines.admin import SuperInlineModelAdmin, SuperModelAdmin
|
||||
@@ -31,7 +33,9 @@ class Admin_FileUnit(Admin_Trans_BaseModelViewPage):
|
||||
fn.short_description = 'Файл'
|
||||
|
||||
def fn_full_path(self, obj):
|
||||
return obj.file.url
|
||||
from urllib.parse import unquote_plus
|
||||
res = unquote_plus(obj.file.url, encoding="utf-8")
|
||||
return res
|
||||
fn_full_path.short_description = 'Линк для использования в HTML'
|
||||
|
||||
fieldsets = [
|
||||
@@ -47,7 +51,7 @@ class Admin_FileUnit(Admin_Trans_BaseModelViewPage):
|
||||
]
|
||||
|
||||
list_display = [
|
||||
'image_thumb',
|
||||
# 'image_thumb',
|
||||
'id',
|
||||
'fn',
|
||||
'fn_full_path',
|
||||
@@ -55,7 +59,7 @@ class Admin_FileUnit(Admin_Trans_BaseModelViewPage):
|
||||
'order', 'modifiedDT', 'createDT'
|
||||
]
|
||||
|
||||
list_display_links = ['id', 'image_thumb']
|
||||
list_display_links = ['id']
|
||||
list_editable = ['order']
|
||||
|
||||
list_filter = ['modifiedDT', 'createDT']
|
||||
@@ -129,6 +133,77 @@ class Admin_StackedInline_Block(Admin_Trans_GenericBaseIconStackedInline, SuperI
|
||||
|
||||
|
||||
|
||||
class Admin_PageAddingBlocksTemplate(Admin_BaseIconModel):
|
||||
from ServicesApp.admin import Admin_StackedInline_BlockPluginPresentation
|
||||
from SlidesApp.admin import Admin_StackedInline_Slide
|
||||
|
||||
fieldsets = [
|
||||
(None, {
|
||||
'classes': ['wide'],
|
||||
'fields': ('name',
|
||||
# 'url',
|
||||
# 'title',
|
||||
# 'description', 'text',
|
||||
# 'picture',
|
||||
# 'order',
|
||||
)
|
||||
}),
|
||||
# ('SEO', {
|
||||
# 'classes': ['wide', 'collapse'],
|
||||
# 'fields': (
|
||||
# 'seo_title', 'seo_description', 'seo_keywords', 'seo_text',
|
||||
# )
|
||||
# }),
|
||||
]
|
||||
|
||||
def get_list_display(self, request):
|
||||
if request.user.is_superuser:
|
||||
# self.list_display.append()
|
||||
d_list = copy.copy(self.list_display)
|
||||
d_list.append('name_plural')
|
||||
return d_list
|
||||
return self.list_display
|
||||
|
||||
def get_changelist_instance(self, request):
|
||||
if request.user.is_superuser:
|
||||
self.list_editable.append('name_plural')
|
||||
return super(Admin_PageAddingBlocksTemplate, self).get_changelist_instance(request)
|
||||
|
||||
|
||||
list_display = [
|
||||
# 'image_thumb',
|
||||
'id',
|
||||
'name',
|
||||
'enable',
|
||||
# 'url',
|
||||
# 'title',
|
||||
# 'order',
|
||||
'modifiedDT', 'createDT'
|
||||
]
|
||||
|
||||
list_display_links = ['id', 'name']
|
||||
list_editable = ['enable']
|
||||
|
||||
list_filter = ['modifiedDT', 'createDT']
|
||||
search_fields = ['name']
|
||||
# filter_horizontal = ['options']
|
||||
|
||||
inlines = [
|
||||
Admin_StackedInline_Slide,
|
||||
Admin_StackedInline_BlockPluginPresentation,
|
||||
Admin_StackedInline_Block,
|
||||
# AdminStacked_FAQitem,
|
||||
]
|
||||
|
||||
def has_delete_permission(self, request, obj=None):
|
||||
if request.user.is_superuser:
|
||||
return True
|
||||
|
||||
if not obj or obj.name_plural in ['documentation', 'contacts']:
|
||||
return False
|
||||
|
||||
admin.site.register(PageAddingBlocksTemplate, Admin_PageAddingBlocksTemplate)
|
||||
|
||||
|
||||
|
||||
class Admin_StaticPage(SuperModelAdmin, Admin_Trans_BaseModelViewPage):
|
||||
|
||||
@@ -40,11 +40,15 @@ def get_inter_Dict(user, context_Dict):
|
||||
feedback_form.initial = {'form_name': form_name}
|
||||
Dict.update({'feedback_form': feedback_form})
|
||||
|
||||
from DocsApp.models import DocArt
|
||||
arts_exists = DocArt.objects.filter(enable=True).exists()
|
||||
|
||||
Dict.update({
|
||||
'sections': sections,
|
||||
'logo': get_logo_url(),
|
||||
'hide_form_field_description': hide_form_field_description,
|
||||
'footer_contacts': get_footer_contacts(),
|
||||
'allow_documentation': arts_exists,
|
||||
})
|
||||
# from SubscribesApp.funcs import get_cur_user_subscribe
|
||||
# user_subscribe = get_cur_user_subscribe(user)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from .models import *
|
||||
|
||||
def get_options_by_opt_types(opt_types, only_vals=False):
|
||||
def get_options_by_opt_types(opt_types, only_vals=False, w_prefix=False):
|
||||
if type(opt_types) == str:
|
||||
kwargs = {'opt_type': opt_types}
|
||||
elif type(opt_types) == dict:
|
||||
@@ -10,8 +10,15 @@ def get_options_by_opt_types(opt_types, only_vals=False):
|
||||
|
||||
opts = Option.objects.filter(**kwargs)
|
||||
if opts and only_vals:
|
||||
opts = opts.values('opt_type', 'value')
|
||||
opts = {item['opt_type']: item['value'] for item in opts}
|
||||
opts = opts.values('opt_type', 'value', 'prefix')
|
||||
res_Dict = {}
|
||||
for item in opts:
|
||||
val = item['value']
|
||||
if w_prefix and item['prefix']:
|
||||
val = item['prefix'] + val
|
||||
res_Dict.update({item['opt_type']: val})
|
||||
return res_Dict
|
||||
|
||||
return opts
|
||||
|
||||
def get_first_option_value_by_opt_type(opt_type):
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# Generated by Django 4.2.7 on 2024-07-15 17:00
|
||||
|
||||
import datetime
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('GeneralApp', '0026_fileunit_alter_office_work_time_from_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='PageAddingBlocksTemplate',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.TextField(blank=True, help_text='Название', null=True, verbose_name='Название')),
|
||||
('name_plural', models.TextField(blank=True, null=True, verbose_name='Название (множественное число)')),
|
||||
('order', models.IntegerField(blank=True, null=True, verbose_name='Очередность отображения')),
|
||||
('createDT', models.DateTimeField(auto_now_add=True, verbose_name='Дата и время создания')),
|
||||
('modifiedDT', models.DateTimeField(blank=True, null=True, verbose_name='Дата и время последнего изменения')),
|
||||
('enable', models.BooleanField(db_index=True, default=True, verbose_name='Включено')),
|
||||
('json_data', models.JSONField(blank=True, default=dict, verbose_name='Дополнительные данные')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Шаблон настройки дополнительных блоков на странице',
|
||||
'verbose_name_plural': 'Шаблоны настройки дополнительных блоков на странице',
|
||||
},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='fileunit',
|
||||
options={'verbose_name': 'Файл', 'verbose_name_plural': 'Файлы'},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='office',
|
||||
name='work_time_from',
|
||||
field=models.TimeField(default=datetime.datetime(2024, 7, 15, 9, 0), verbose_name='Время работы с'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='office',
|
||||
name='work_time_from_en',
|
||||
field=models.TimeField(default=datetime.datetime(2024, 7, 15, 9, 0), null=True, verbose_name='Время работы с'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='office',
|
||||
name='work_time_from_ru',
|
||||
field=models.TimeField(default=datetime.datetime(2024, 7, 15, 9, 0), null=True, verbose_name='Время работы с'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='office',
|
||||
name='work_time_to',
|
||||
field=models.TimeField(default=datetime.datetime(2024, 7, 15, 18, 0), verbose_name='Время работы до'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='office',
|
||||
name='work_time_to_en',
|
||||
field=models.TimeField(default=datetime.datetime(2024, 7, 15, 18, 0), null=True, verbose_name='Время работы до'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='office',
|
||||
name='work_time_to_ru',
|
||||
field=models.TimeField(default=datetime.datetime(2024, 7, 15, 18, 0), null=True, verbose_name='Время работы до'),
|
||||
),
|
||||
]
|
||||
@@ -12,6 +12,13 @@ from colorfield.fields import ColorField
|
||||
from filebrowser.fields import FileBrowseField
|
||||
from filebrowser.base import FileObject
|
||||
|
||||
|
||||
class PageAddingBlocksTemplate(BaseModel):
|
||||
class Meta:
|
||||
verbose_name = _('Шаблон настройки дополнительных блоков на странице')
|
||||
verbose_name_plural = _('Шаблоны настройки дополнительных блоков на странице')
|
||||
|
||||
|
||||
class FileUnit(BaseModel):
|
||||
file = FileBrowseField(verbose_name=_('Файл'), max_length=250, directory="files/")
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ X_FRAME_OPTIONS = 'SAMEORIGIN'
|
||||
# Application definition
|
||||
|
||||
FILEBROWSER_SHOW_IN_DASHBOARD = False
|
||||
LIST_PER_PAGE = 100
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'colorfield',
|
||||
@@ -163,7 +164,9 @@ USE_TZ = False
|
||||
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = 'media/'
|
||||
# MEDIA_ROOT = 'media/'
|
||||
import os
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = '/'
|
||||
@@ -197,6 +200,10 @@ LANG_INFO = dict(django.conf.locale.LANG_INFO.items()) #+ EXTRA_LANG_INFO.items(
|
||||
django.conf.locale.LANG_INFO = LANG_INFO
|
||||
|
||||
|
||||
from filebrowser.sites import site
|
||||
site.directory = ""
|
||||
|
||||
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||
@@ -207,7 +214,7 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/"
|
||||
CKEDITOR_UPLOAD_PATH = "uploads/"
|
||||
CKEDITOR_RESTRICT_BY_DATE = False
|
||||
CKEDITOR_RESTRICT_BY_USER = True
|
||||
CKEDITOR_RESTRICT_BY_USER = False
|
||||
CKEDITOR_BROWSE_SHOW_DIRS = True
|
||||
|
||||
CKEDITOR_IMAGE_BACKEND = "pillow"
|
||||
@@ -270,6 +277,9 @@ CKEDITOR_CONFIGS = {
|
||||
}
|
||||
}
|
||||
|
||||
PDF_FOLDER = 'media/pdf'
|
||||
WKHTML_TO_PDF = 'BaseModels\wkhtmltopdf\{0}\wkhtmltopdf'.format(u'bin')
|
||||
|
||||
|
||||
try:
|
||||
import db_local_sets
|
||||
|
||||
@@ -6,5 +6,5 @@ django-modeltranslation==0.18.11
|
||||
Pillow==10.1.0
|
||||
psycopg2-binary==2.9.9
|
||||
django-super-inlines
|
||||
django-filebrowser-4.0.3
|
||||
# django-filebrowser-4.0.3
|
||||
django-filebrowser-no-grappelli==4.0.2
|
||||
@@ -1690,7 +1690,7 @@ body.n_scroll{
|
||||
.documentation_version{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 40px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.documentation_version_switcher{
|
||||
@@ -1799,6 +1799,7 @@ body.n_scroll{
|
||||
display: flex;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
|
||||
@@ -1815,9 +1816,9 @@ body.n_scroll{
|
||||
}
|
||||
|
||||
.tree_documentation_arrow_img{
|
||||
width: 12px;
|
||||
height: 7px;
|
||||
padding: 9px 6px;
|
||||
width: 7px;
|
||||
height: 12px;
|
||||
padding: 6px 9px;
|
||||
}
|
||||
|
||||
.tree_documentation_container_first_level_txt{
|
||||
@@ -1827,6 +1828,7 @@ body.n_scroll{
|
||||
margin-left: 3px;
|
||||
display: block;
|
||||
text-decoration: unset;
|
||||
line-height: 25px;
|
||||
}
|
||||
.tree_documentation_container_second_level_txt{
|
||||
font-size: 16px;
|
||||
@@ -1835,6 +1837,7 @@ body.n_scroll{
|
||||
margin-left: 3px;
|
||||
display: block;
|
||||
text-decoration: unset;
|
||||
line-height: 24px;
|
||||
}
|
||||
.tree_documentation_container_first_level_txt.chose{
|
||||
color: #0C54A0FF;
|
||||
@@ -1864,7 +1867,7 @@ body.n_scroll{
|
||||
}
|
||||
|
||||
.elements_third_level_content_part_tree{
|
||||
margin-left: 50px;
|
||||
margin-left: 40px;
|
||||
}
|
||||
|
||||
.element_third_level_content_part_tree{
|
||||
@@ -1905,6 +1908,7 @@ body.n_scroll{
|
||||
|
||||
.content_part_tree_els h1{
|
||||
font-size: 40px;
|
||||
margin-top: 0!important;
|
||||
}
|
||||
|
||||
.name_article_tree{
|
||||
@@ -2028,3 +2032,17 @@ body.n_scroll{
|
||||
height: 10px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.btn_download_in_pdf{
|
||||
padding: 18px 90px;
|
||||
background: #0C54A0;
|
||||
color: #FFFFFF;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
text-decoration: unset;
|
||||
border-radius: 5px;
|
||||
display: block;
|
||||
margin-top: 20px;
|
||||
width: fit-content;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
@@ -6,7 +6,25 @@
|
||||
|
||||
}
|
||||
|
||||
@media(max-width: 1150px){
|
||||
.flex_container_buttons_3d_security_designer{
|
||||
display: block;
|
||||
}
|
||||
.flex_container_buttons_3d_security_designer .btn_download_plugin {
|
||||
width: 100%;
|
||||
margin-right: 0;
|
||||
}
|
||||
.flex_container_buttons_3d_security_designer .btn_inf_about_plugin {
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.one_item_documentation_switcher_content_part{
|
||||
font-size: 12px;
|
||||
}
|
||||
.cur_documentation_version{
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -50,7 +68,7 @@
|
||||
}
|
||||
.tree_documentation_container {
|
||||
width: unset;
|
||||
height: 100vh;
|
||||
height: calc(100vh - 172px);
|
||||
overflow-y: auto;
|
||||
padding: 0 15px;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ $(document).ready(function (){
|
||||
setInfInCurtainDocumentationMobile()
|
||||
setButtonOpenMobileDocCurtain()
|
||||
}
|
||||
windowScrollDocPage()
|
||||
})
|
||||
|
||||
function setButtonOpenMobileDocCurtain () {
|
||||
@@ -98,6 +99,7 @@ function setInfInCurtainDocumentationMobile () {
|
||||
}
|
||||
|
||||
function openDocCurtainMobile () {
|
||||
$("body").css({'overflow':'hidden'})
|
||||
let $curtain = $(".left_curtain_documentation")
|
||||
let $block_overlay = $(".block_overlay")
|
||||
$curtain.css({left:0})
|
||||
@@ -107,6 +109,7 @@ function openDocCurtainMobile () {
|
||||
}
|
||||
|
||||
function closeDocCurtainMobile () {
|
||||
$("body").css({'overflow':'unset'})
|
||||
let $curtain = $(".left_curtain_documentation")
|
||||
let $block_overlay = $(".block_overlay")
|
||||
$curtain.css({left:'-320px'})
|
||||
@@ -507,22 +510,28 @@ function transitToDocumentation() {
|
||||
window.location.href = window.location.origin + '/' + getLang() + '/docs/3dsd/'
|
||||
}
|
||||
|
||||
function openVersionSwitcher(el){
|
||||
let $parent = el.closest(".documentation_version_switcher")
|
||||
let $content_part = $parent.querySelector(".documentation_switcher_content_part")
|
||||
let $arrow = $parent.querySelector(".documentation_switcher_arrow_picture")
|
||||
$content_part.classList.toggle("hidden")
|
||||
if ($arrow.style.rotate === '0deg' || $arrow.style.rotate === '') {
|
||||
$($arrow).animate({rotate: '180deg'},200)
|
||||
let height = $content_part.offsetHeight
|
||||
$content_part.style.bottom = '-' + height + "px"
|
||||
$parent.style.borderBottom = '1px solid #fff'
|
||||
} else {
|
||||
$($arrow).animate({rotate: '0deg'},200)
|
||||
$parent.style.borderBottom = '1px solid #CCCED1FF'
|
||||
}
|
||||
let switcherWorking = false
|
||||
|
||||
$("body")[0].setAttribute("onclick",'closeVersionSwitcherOnBody()')
|
||||
function openVersionSwitcher(el){
|
||||
if (!switcherWorking){
|
||||
switcherWorking = true
|
||||
let $parent = el.closest(".documentation_version_switcher")
|
||||
let $content_part = $parent.querySelector(".documentation_switcher_content_part")
|
||||
let $arrow = $parent.querySelector(".documentation_switcher_arrow_picture")
|
||||
$content_part.classList.toggle("hidden")
|
||||
if ($arrow.style.rotate === '0deg' || $arrow.style.rotate === '') {
|
||||
$($arrow).css({rotate: '180deg'})
|
||||
let height = $content_part.offsetHeight
|
||||
$content_part.style.bottom = '-' + height + "px"
|
||||
$parent.style.borderBottom = '1px solid #fff'
|
||||
$("body")[0].setAttribute("onclick",'closeVersionSwitcherOnBody()')
|
||||
} else {
|
||||
$($arrow).css({rotate: '0deg'})
|
||||
$parent.style.borderBottom = '1px solid #CCCED1FF'
|
||||
$("body")[0].setAttribute("onclick",'')
|
||||
}
|
||||
switcherWorking = false
|
||||
}
|
||||
}
|
||||
|
||||
function closeVersionSwitcherOnBody () {
|
||||
@@ -532,9 +541,19 @@ function closeVersionSwitcherOnBody () {
|
||||
$version_switcher_container_content.addClass("hidden")
|
||||
$(".documentation_version_switcher").css({borderBottom: '1px solid #CCCED1FF'})
|
||||
if ($arrow.style.rotate !== '180deg'){
|
||||
$($arrow).animate({rotate: '180deg'},200)
|
||||
$($arrow).css({rotate: '180deg'})
|
||||
|
||||
} else {
|
||||
$($arrow).animate({rotate: '0deg'},200)
|
||||
$($arrow).css({rotate: '0deg'})
|
||||
}
|
||||
if ($('.documentation_switcher_arrow_picture')[1]){
|
||||
let arrow1 = $('.documentation_switcher_arrow_picture')[1]
|
||||
if (arrow1.style.rotate !== '180deg'){
|
||||
$(arrow1).css({rotate: '180deg'})
|
||||
|
||||
} else {
|
||||
$(arrow1).css({rotate: '0deg'})
|
||||
}
|
||||
}
|
||||
$("body")[0].setAttribute("onclick",'')
|
||||
}
|
||||
@@ -578,21 +597,33 @@ function showContentPartTree (el) {
|
||||
let $arrow = $parent.querySelector(".tree_documentation_arrow_img")
|
||||
$content_part.classList.toggle("hidden")
|
||||
if ($arrow.style.rotate === '0deg' || $arrow.style.rotate === ''){
|
||||
$($arrow).animate({rotate: '180deg'})
|
||||
$($arrow).css({rotate: '90deg'})
|
||||
} else {
|
||||
$($arrow).animate({rotate: '0deg'})
|
||||
$($arrow).css({rotate: '0deg'})
|
||||
}
|
||||
let scroll = $(window)[0].scrollY
|
||||
if ($(".left_curtain_documentation")[1]) {
|
||||
$($(".left_curtain_documentation")[1]).find(".tree_documentation_container").css({height: 'fit-content'})
|
||||
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[1].offsetHeight - 172
|
||||
$($(".left_curtain_documentation")[1]).find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
|
||||
}
|
||||
}
|
||||
let waitingTop = null
|
||||
let maxScroll = null
|
||||
$(window).scroll(function (){
|
||||
|
||||
function windowScrollDocPage (){
|
||||
if (getInfoAboutUser()[0] !== 'laptop' && getInfoAboutUser()[0] !== 'mobile'){
|
||||
if (window.location.href.includes("docs")){
|
||||
let $curtain = $(".left_curtain_documentation")
|
||||
let scroll = $(window)[0].scrollY
|
||||
if (scroll === 0){
|
||||
waitingTop = $(".left_curtain_documentation")[0].getBoundingClientRect().top - 172
|
||||
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'fit-content'})
|
||||
maxScroll = $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
|
||||
if (scroll !== 0){
|
||||
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
|
||||
}
|
||||
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
|
||||
}
|
||||
let $new_curtain = $($curtain[1])
|
||||
|
||||
@@ -608,12 +639,18 @@ $(window).scroll(function (){
|
||||
$($curtain[0]).css({opacity:0})
|
||||
$($curtain[0]).find(".tree_documentation_container").css({display:'none'})
|
||||
} else if (scroll < waitingTop && waitingTop) {
|
||||
$curtain.find(".tree_documentation_container")[0].innerHTML = $new_curtain.find(".tree_documentation_container")[0].innerHTML
|
||||
$new_curtain.remove()
|
||||
$($curtain[0]).css({opacity:1})
|
||||
$($curtain[0]).find(".tree_documentation_container").css({display:'block'})
|
||||
} else if (!waitingTop){
|
||||
waitingTop = $(".left_curtain_documentation")[0].getBoundingClientRect().top - 172
|
||||
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'fit-content'})
|
||||
maxScroll = $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
|
||||
if (scroll !== 0){
|
||||
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
|
||||
}
|
||||
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
|
||||
}
|
||||
} else {
|
||||
if (!$curtain[1]){
|
||||
@@ -622,6 +659,62 @@ $(window).scroll(function (){
|
||||
let $new_curtain_tree = $new_curtain.find(".tree_documentation_container")
|
||||
$new_curtain_tree.css({height: 'calc(100vh - 245px);'})
|
||||
}
|
||||
$new_curtain.find(".tree_documentation_container").css({height:'fit-content'})
|
||||
$new_curtain.css({position:'absolute',bottom: 0,top: 'unset'})
|
||||
$($curtain[0]).css({opacity:0})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$(window).scroll(function (){
|
||||
if (getInfoAboutUser()[0] !== 'laptop' && getInfoAboutUser()[0] !== 'mobile'){
|
||||
if (window.location.href.includes("docs")){
|
||||
let $curtain = $(".left_curtain_documentation")
|
||||
let scroll = $(window)[0].scrollY
|
||||
if (scroll === 0){
|
||||
waitingTop = $(".left_curtain_documentation")[0].getBoundingClientRect().top - 172
|
||||
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'fit-content'})
|
||||
maxScroll = $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
|
||||
if (scroll !== 0){
|
||||
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
|
||||
}
|
||||
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
|
||||
}
|
||||
let $new_curtain = $($curtain[1])
|
||||
|
||||
if (scroll < maxScroll || !maxScroll){
|
||||
if (!$curtain[1] && waitingTop){
|
||||
$new_curtain = $curtain.clone()
|
||||
$new_curtain.insertAfter($curtain)
|
||||
let $new_curtain_tree = $new_curtain.find(".tree_documentation_container")
|
||||
$new_curtain_tree.css({height: 'calc(100vh - 245px);'})
|
||||
}
|
||||
if (scroll >= waitingTop && waitingTop){
|
||||
$new_curtain.css({position:'fixed',top: 166,bottom:"unset"})
|
||||
$($curtain[0]).css({opacity:0})
|
||||
$($curtain[0]).find(".tree_documentation_container").css({display:'none'})
|
||||
} else if (scroll < waitingTop && waitingTop) {
|
||||
$curtain.find(".tree_documentation_container")[0].innerHTML = $new_curtain.find(".tree_documentation_container")[0].innerHTML
|
||||
$new_curtain.remove()
|
||||
$($curtain[0]).css({opacity:1})
|
||||
$($curtain[0]).find(".tree_documentation_container").css({display:'block'})
|
||||
} else if (!waitingTop){
|
||||
waitingTop = $(".left_curtain_documentation")[0].getBoundingClientRect().top - 172
|
||||
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'fit-content'})
|
||||
maxScroll = $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
|
||||
if (scroll !== 0){
|
||||
maxScroll = scroll + $(".documentation_block")[0].getBoundingClientRect().bottom - $(".left_curtain_documentation")[0].offsetHeight - 172
|
||||
}
|
||||
$(".left_curtain_documentation").find(".tree_documentation_container").css({height: 'calc(100vh - 300px)'})
|
||||
}
|
||||
} else {
|
||||
if (!$curtain[1]){
|
||||
$new_curtain = $curtain.clone()
|
||||
$new_curtain.insertAfter($curtain)
|
||||
let $new_curtain_tree = $new_curtain.find(".tree_documentation_container")
|
||||
$new_curtain_tree.css({height: 'calc(100vh - 245px);'})
|
||||
}
|
||||
$new_curtain.find(".tree_documentation_container").css({height:'fit-content'})
|
||||
$new_curtain.css({position:'absolute',bottom: 0,top: 'unset'})
|
||||
$($curtain[0]).css({opacity:0})
|
||||
}
|
||||
|
||||
3
static/images/arrow_for_doc_tree.svg
Normal file
3
static/images/arrow_for_doc_tree.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="7" height="12" viewBox="0 0 7 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.53362 6.53082L1.06056 12.0028L-4.63675e-08 10.942L4.94258 6.00043L-3.60497e-07 1.05882L1.06056 -0.00193982L6.53362 5.47005C6.67431 5.61071 6.75335 5.8015 6.75335 6.00043C6.75335 6.19937 6.67431 6.39016 6.53362 6.53082Z" fill="#0C54A0"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 390 B |
@@ -30,6 +30,7 @@
|
||||
</div>
|
||||
<div class="container_els_curtain">
|
||||
{# <a class="txt_curtain_el standart_txt">{% translate "Поддержка" %}</a>#}
|
||||
{# <a href="{% url 'docs_main' %}" class="txt_curtain_el standart_txt">{% translate "Поддержка" %}</a>#}
|
||||
<a href="{% url 'contacts' %}" class="txt_curtain_el standart_txt">{% translate "Контакты" %}</a>
|
||||
</div>
|
||||
|
||||
|
||||
56
templates/blocks/b_documentation_article.html
Normal file
56
templates/blocks/b_documentation_article.html
Normal file
@@ -0,0 +1,56 @@
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% if pdf_render %}
|
||||
|
||||
<HEAD>
|
||||
{# <meta charset="windows-1251">#}
|
||||
<meta charset="UTF-8">
|
||||
{% include 'head_includes/fonts_include.html' %}
|
||||
<style>
|
||||
* {
|
||||
font-family: -apple-system, 'Roboto', sans-serif;
|
||||
}
|
||||
</style>
|
||||
</HEAD>
|
||||
{% endif %}
|
||||
|
||||
<div class="content_part_tree_els">
|
||||
{# <div class="name_article_tree">#}
|
||||
{# #}
|
||||
{# </div>#}
|
||||
{# <div class="description_article_tree">#}
|
||||
{# {{ cur_article.text }}#}
|
||||
{# </div>#}
|
||||
{{ cur_article.text|safe }}
|
||||
{% if not pdf_render %}
|
||||
<div class="controls_content_part_tree_els">
|
||||
<div class="control_content_part_tree_el left">
|
||||
{% if prev_article %}
|
||||
<picture class="arrow_control_content_part_tree_el_picture">
|
||||
<source srcset="{% static "images/arrow_control_part_tree_el.svg" %}">
|
||||
<img class="arrow_control_content_part_tree_el_img" src="{% static "images/arrow_control_part_tree_el.svg" %}" alt="">
|
||||
</picture>
|
||||
|
||||
<div class="txt_control_content_part_tree_el" data-url="{% url 'docs_art_page' cur_version.url prev_article.url %}" onclick="changeCurArticle(this)">
|
||||
{% trans "Предыдущий" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="control_content_part_tree_el right">
|
||||
{% if next_article %}
|
||||
<div class="txt_control_content_part_tree_el" data-url="{% url 'docs_art_page' cur_version.url next_article.url %}" onclick="changeCurArticle(this)">
|
||||
{% trans "Следующий" %}
|
||||
</div>
|
||||
<picture class="arrow_control_content_part_tree_el_picture">
|
||||
<source srcset="{% static "images/arrow_control_part_tree_el.svg" %}">
|
||||
<img class="arrow_control_content_part_tree_el_img" src="{% static "images/arrow_control_part_tree_el.svg" %}" alt="">
|
||||
</picture>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a class="btn_download_in_pdf" target="_blank" href="?pdf=true">{% trans "Скачать в PDF" %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -10,7 +10,9 @@
|
||||
</a>
|
||||
<div class="right_part_header">
|
||||
{# <a class="standart_txt text_header pointer">Поддержка</a>#}
|
||||
<a href="{% url 'docs_main' %}" class="standart_txt text_header last_left pointer">{% translate "Документация" %}</a>
|
||||
{% if allow_documentation %}
|
||||
{# <a href="{% url 'docs_main' %}" class="standart_txt text_header last_left pointer">{% trans "Поддержка" %}</a>#}
|
||||
{% endif %}
|
||||
<a href="{% url 'contacts' %}" class="standart_txt text_header last_left pointer">{% translate "Контакты" %}</a>
|
||||
<div class="splitter_text_header"></div>
|
||||
<div class="language_select close">
|
||||
|
||||
@@ -68,41 +68,41 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tree_documentation_container">
|
||||
{% for name, obj in doc_tree.items %}
|
||||
{% for id, obj in doc_tree.items %}
|
||||
<div class="tree_documentation_container_first_level">
|
||||
<div class="tree_documentation_container_first_line">
|
||||
{% if obj.children %}
|
||||
<picture class="tree_documentation_arrow_picture" onclick="showContentPartTree(this)">
|
||||
<source srcset="{% static "images/arrow_for_documentation_switcher.svg" %}">
|
||||
<img class="tree_documentation_arrow_img" src="{% static "images/arrow_for_documentation_switcher.svg" %}" alt="">
|
||||
<picture class="tree_documentation_arrow_picture" onclick="showContentPartTree(this)" {% if obj.active %}style="rotate: 90deg;"{% endif %}>
|
||||
<source srcset="{% static "images/arrow_for_doc_tree.svg" %}">
|
||||
<img class="tree_documentation_arrow_img" src="{% static "images/arrow_for_doc_tree.svg" %}" alt="">
|
||||
</picture>
|
||||
{% endif %}
|
||||
<a class="tree_documentation_container_first_level_txt {% if not obj.children %}margin {% endif %}{% if cur_article.url == obj.url %}chose{% endif %}" href="{% url 'docs_art_page' cur_version.url obj.url %}">
|
||||
{{ name }}
|
||||
{{ obj.name }}
|
||||
</a>
|
||||
</div>
|
||||
{% if obj.children %}
|
||||
<div class="content_part_tree_documentation_container {% if not obj.active %}hidden{% endif %}">
|
||||
{% for name, obj in obj.children.items %}
|
||||
{% for id, obj in obj.children.items %}
|
||||
|
||||
<div class="tree_documentation_container_second_level">
|
||||
<div class="tree_documentation_container_first_line">
|
||||
{% if obj.children %}
|
||||
<picture class="tree_documentation_arrow_picture" onclick="showContentPartTree(this)">
|
||||
<source srcset="{% static "images/arrow_for_documentation_switcher.svg" %}">
|
||||
<img class="tree_documentation_arrow_img" src="{% static "images/arrow_for_documentation_switcher.svg" %}" alt="">
|
||||
<picture class="tree_documentation_arrow_picture" onclick="showContentPartTree(this)" {% if obj.active %}style="rotate: 90deg;"{% endif %}>
|
||||
<source srcset="{% static "images/arrow_for_doc_tree.svg" %}">
|
||||
<img class="tree_documentation_arrow_img" src="{% static "images/arrow_for_doc_tree.svg" %}" alt="">
|
||||
</picture>
|
||||
{% endif %}
|
||||
<a class="tree_documentation_container_second_level_txt {% if not obj.children %}margin {% endif %}{% if cur_article.url == obj.url %}chose{% endif %}" href="{% url 'docs_art_page' cur_version.url obj.url %}">
|
||||
{{ name }}
|
||||
{{ obj.name }}
|
||||
</a>
|
||||
</div>
|
||||
{% if obj.children %}
|
||||
<div class="content_part_tree_documentation_container min_padding hidden">
|
||||
<div class="content_part_tree_documentation_container min_padding {% if not obj.active %}hidden{% endif %}">
|
||||
<div class="elements_third_level_content_part_tree">
|
||||
{% for name,obj in obj.children.items %}
|
||||
{% for id,obj in obj.children.items %}
|
||||
<a class="element_third_level_content_part_tree {% if cur_article.url == obj.url %}chose{% endif %}" href="{% url 'docs_art_page' cur_version.url obj.url %}">
|
||||
{{ name }}
|
||||
{{ obj.name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
@@ -117,40 +117,7 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="content_part_tree_els">
|
||||
{# <div class="name_article_tree">#}
|
||||
{# #}
|
||||
{# </div>#}
|
||||
{# <div class="description_article_tree">#}
|
||||
{# {{ cur_article.text }}#}
|
||||
{# </div>#}
|
||||
{{ cur_article.text|safe }}
|
||||
<div class="controls_content_part_tree_els">
|
||||
<div class="control_content_part_tree_el left">
|
||||
{% if prev_article %}
|
||||
<picture class="arrow_control_content_part_tree_el_picture">
|
||||
<source srcset="{% static "images/arrow_control_part_tree_el.svg" %}">
|
||||
<img class="arrow_control_content_part_tree_el_img" src="{% static "images/arrow_control_part_tree_el.svg" %}" alt="">
|
||||
</picture>
|
||||
|
||||
<div class="txt_control_content_part_tree_el" data-url="{% url 'docs_art_page' cur_version.url prev_article.url %}" onclick="changeCurArticle(this)">
|
||||
{% trans "Предыдущий" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="control_content_part_tree_el right">
|
||||
{% if next_article %}
|
||||
<div class="txt_control_content_part_tree_el" data-url="{% url 'docs_art_page' cur_version.url next_article.url %}" onclick="changeCurArticle(this)">
|
||||
{% trans "Следующий" %}
|
||||
</div>
|
||||
<picture class="arrow_control_content_part_tree_el_picture">
|
||||
<source srcset="{% static "images/arrow_control_part_tree_el.svg" %}">
|
||||
<img class="arrow_control_content_part_tree_el_img" src="{% static "images/arrow_control_part_tree_el.svg" %}" alt="">
|
||||
</picture>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include "blocks/b_documentation_article.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user