diff --git a/public/assets/css/app.css b/public/assets/css/app.css index 31ba69bf3a9a25aa5973e629bbeef8b727f47677..71916b91301535c97550b1938012ab914e2f724a 100755 --- a/public/assets/css/app.css +++ b/public/assets/css/app.css @@ -629,4 +629,8 @@ audio::-webkit-media-controls-mute-button { /*background-color: lightgrey;*/ pointer-events: none; opacity: 0.7; +} + +.icon-nav { + height: 26px; } \ No newline at end of file diff --git a/public/assets/images/Icon/ballot-white.png b/public/assets/images/Icon/ballot-white.png new file mode 100644 index 0000000000000000000000000000000000000000..27ea40348ffae7ceafe97342441a7bd0ae266b8b Binary files /dev/null and b/public/assets/images/Icon/ballot-white.png differ diff --git a/public/assets/images/Icon/ballot.png b/public/assets/images/Icon/ballot.png new file mode 100644 index 0000000000000000000000000000000000000000..140220df84faaedbe60da18a5fd180eca73109d6 Binary files /dev/null and b/public/assets/images/Icon/ballot.png differ diff --git a/public/assets/images/Icon/bell-white.png b/public/assets/images/Icon/bell-white.png new file mode 100644 index 0000000000000000000000000000000000000000..e6f467da0e6ee44ba954efe5b33dc448abaa17d1 Binary files /dev/null and b/public/assets/images/Icon/bell-white.png differ diff --git a/public/assets/images/Icon/dashboard-white.png b/public/assets/images/Icon/dashboard-white.png new file mode 100644 index 0000000000000000000000000000000000000000..509ad075c2e54e08342ab090dc39e272ebd5a858 Binary files /dev/null and b/public/assets/images/Icon/dashboard-white.png differ diff --git a/public/assets/images/Icon/dashboard.png b/public/assets/images/Icon/dashboard.png new file mode 100644 index 0000000000000000000000000000000000000000..1aceae8e03eb1879d45969f060a644143f483c8c Binary files /dev/null and b/public/assets/images/Icon/dashboard.png differ diff --git a/public/assets/images/Icon/notebook-white.png b/public/assets/images/Icon/notebook-white.png new file mode 100644 index 0000000000000000000000000000000000000000..e61dc50dbe45f97489c1bbab183796caac52eb47 Binary files /dev/null and b/public/assets/images/Icon/notebook-white.png differ diff --git a/public/assets/images/Icon/notebook.png b/public/assets/images/Icon/notebook.png new file mode 100644 index 0000000000000000000000000000000000000000..79a427382236245a4e7bc273e42f6803c9ddca1d Binary files /dev/null and b/public/assets/images/Icon/notebook.png differ diff --git a/src/Manager/WiktionaryManager.php b/src/Manager/WiktionaryManager.php index fbe33c2a7dc2060902e180f80b309717c2314e01..2df69e339360f6c9fb4dec8822b3f6b818843589 100644 --- a/src/Manager/WiktionaryManager.php +++ b/src/Manager/WiktionaryManager.php @@ -46,39 +46,70 @@ class WiktionaryManager return $this->lastSearch['data']; } - //$time_start = microtime(true); /*Debug*/ - - $url = 'http://localhost:5000/search/' . $language . '/' . $language . '/' . $word . '/a_wikstraktor'; - $client = HttpClient::create(); - $result = null; + // usage: wikstraktor.py [-h] [-l LANGUAGE] [-w WIKI_LANGUAGE] [-m MOT] +// [-f DESTINATION_FILE] [-A] [-C] +// +// Interroger un wiktionnaire +// ex : +// ‣./wikstraktor.py -m blue +// ‣./wikstraktor.py -m blue -f blue.json -A -C +// ‣./wikstraktor.py -l en -w fr -m blue -f blue.json -A -C + +// options: +// -h, --help show this help message and exit +// -l LANGUAGE, --language LANGUAGE +// la langue du mot +// -w WIKI_LANGUAGE, --wiki_language WIKI_LANGUAGE +// la langue du wiki +// -m MOT, --mot MOT le mot à chercher +// -f DESTINATION_FILE, --destination_file DESTINATION_FILE +// le fichier dans lequel stocker le résultat +// -A, --force_ascii json avec que des caractères ascii +// -C, --compact json sans indentation + + + //$time_start = microtime(true); /*Debug*/ + + if ($_ENV['WIKTIONARY_TOOL'] == 'WIKSTRAKTOR') { + $command = $_ENV['WIKSTRAKTOR_COMMAND'] . ' -l ' . $language . ' -w ' . $language . ' -m "' . $word . '" -A -C 2>&1'; + $result = exec($command); + //dump($word);dump($command);dump(microtime(true)-$time_start);dump($result);die();/*Debug*/ + } else { + + + //$time_start = microtime(true); /*Debug*/ + + $url = 'http://localhost:5000/search/' . $language . '/' . $language . '/' . $word . '/a_wikstraktor'; + $client = HttpClient::create(); + $result = null; // Make the initial request with a timeout - try { - $response = $client->request('GET', $url); - // dump($response->getStatusCode());die(); - - // Check the HTTP status code - if ($response->getStatusCode() === 200) { - // Server is up and returned a successful response - $result = $response->getContent(); - } - } catch (TransportExceptionInterface $exception) { - if (empty(exec('ps aux | grep "[a]pp.py"'))) { - // Server is down, restart it - exec('nohup /var/www/live-query-wiktextract/venv/bin/python3 /var/www/live-query-wiktextract/src/app.py'); - if (!empty(exec('ps aux | grep "[a]pp.py"'))) { - $response = $client->request('GET', $url); - - if ($response->getStatusCode() === 200) { - // Server is up and returned a successful response - $result = $response->getContent(); + try { + $response = $client->request('GET', $url); + // dump($response->getStatusCode());die(); + + // Check the HTTP status code + if ($response->getStatusCode() === 200) { + // Server is up and returned a successful response + $result = $response->getContent(); + } + } catch (TransportExceptionInterface $exception) { + if (empty(exec('ps aux | grep "[a]pp.py"'))) { + // Server is down, restart it + exec('nohup /var/www/live-query-wiktextract/venv/bin/python3 /var/www/live-query-wiktextract/src/app.py'); + if (!empty(exec('ps aux | grep "[a]pp.py"'))) { + $response = $client->request('GET', $url); + + if ($response->getStatusCode() === 200) { + // Server is up and returned a successful response + $result = $response->getContent(); + } + } else { + throw new \Exception('Server is down'); } - } else { - throw new \Exception('Server is down'); } } } - //dump(gettype($result));dump($url);dump(microtime(true)-$time_start);dump($result);/*Debug*/ // Output and error handling diff --git a/templates/base.html.twig b/templates/base.html.twig index b389d0eae1b229567177cd13f6170f82c02489d3..a014398aa5dd34a980a72727f30812cb466df5f8 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -25,6 +25,7 @@ <script src="{{ asset('assets/js/jquery.mjs.nestedSortable.js') }}"></script> <script src="{{ asset('bundles/fosjsrouting/js/router.min.js') }}"></script> <script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}"></script> +{# <script src="https://kit.fontawesome.com/3729f42e63.js" crossorigin="anonymous"></script>#} <script src="{{ asset('assets/js/app.js') }}"></script> {% endblock %} </head> diff --git a/templates/nav.html.twig b/templates/nav.html.twig index 26a60210c4e9991ba44ac66e8737b7d7048e5d34..baee7ed693d247af2b76e01d267e97837a3d0a10 100644 --- a/templates/nav.html.twig +++ b/templates/nav.html.twig @@ -22,7 +22,7 @@ </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle {{ 'app_lexicon' in app.request.attributes.get('_route') ? 'active' }}" data-bs-toggle="dropdown" href="#"> - <i class="bi bi-nav bi-journals"></i> {{ "Lexiques"|trans }}</a> + <img src="{{ asset('assets/images/Icon/notebook-white.png') }}" class="icon-nav"> {{ "Lexiques"|trans }}</a> <ul class="dropdown-menu"> {% for lexicon in lexicon_manager.myLexicons(app.user) %} <li><a class="dropdown-item {{ lexicon.user ? 'fw-bold' }}" href="{{ path('app_lexicon_show', {id: lexicon.id}) }}">{{ lexicon }}</a></li> @@ -40,106 +40,39 @@ </li>#} <li class="nav-item"> <a class="nav-link {{ 'app_dashboard' in app.request.attributes.get('_route') ? 'active' }}" href="{{ path('app_dashboard_index') }}"> - <i class="bi bi-nav bi-speedometer"></i> {{ "Tableau de bord"|trans }}</a> + <img src="{{ asset('assets/images/Icon/dashboard-white.png') }}" class="icon-nav"> {{ "Tableau de bord"|trans }}</a> </li> - {% if is_granted('ROLE_ADMIN') %} + {% if is_granted('ROLE_ADMIN') %} <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle {{ 'app_lexicon' in app.request.attributes.get('_route') ? 'active' }}" data-bs-toggle="dropdown" href="#"> - <i class="bi bi-nav bi-journals"></i> {{ "Lexiques"|trans }}</a> + <i class="fa fa-nav fa-cog"></i></a> <ul class="dropdown-menu"> - {% for lexicon in lexicon_manager.myLexicons(app.user) %} - <li><a class="dropdown-item {{ lexicon.user ? 'fw-bold' }}" href="{{ path('app_lexicon_show', {id: lexicon.id}) }}">{{ lexicon }}</a></li> - {% endfor %} - <li><a class="dropdown-item" href="{{ path('app_group_new') }}"><i class="fa fa-plus-circle"></i> {{ "Créer un lexique de groupe"|trans }}</a></li> - </ul> - </li> - {# <li class="nav-item">#} - {# <a class="nav-link {{ 'app_group' in app.request.attributes.get('_route') ? 'active' }}" href="{{ path('app_group_index') }}">#} - {# <i class="fa fa-nav fa-users"></i> {{ "Groupes"|trans }}</a>#} - {# </li>#} -{# <li class="nav-item">#} -{# <a class="nav-link {{ 'app_friend' in app.request.attributes.get('_route') ? 'active' }}" href="{{ path('app_friend_index') }}">#} -{# <i class="bi bi-nav bi-person-heart"></i> {{ "Amis"|trans }}</a>#} -{# </li>#} - <li class="nav-item"> - <a class="nav-link {{ 'app_dashboard' in app.request.attributes.get('_route') ? 'active' }}" href="#"> - <i class="bi bi-nav bi-speedometer"></i> {{ "Tableau de bord"|trans }}</a> - </li> - {% if is_granted('ROLE_ADMIN') %} - <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle {{ 'app_lexicon' in app.request.attributes.get('_route') ? 'active' }}" data-bs-toggle="dropdown" href="#"> - <i class="fa fa-nav fa-cog"></i></a> - <ul class="dropdown-menu"> - - <li> - <a class="dropdown-item" href="{{ path('app_user_index') }}"> - <i class="bi bi-nav bi-person"></i> {{ "Utilisateurs"|trans }}</a> - </li> - {# <li>#} - {# <a class="dropdown-item" href="{{ path('app_lexicon_index') }}"><i class="bi bi-nav bi-card-list"></i> Lexiques</a>#} - {# </li>#} - <li> - <a class="dropdown-item" href="{{ path('app_client_index') }}"> - <i class="bi bi-nav bi-window"></i> {{ "Applis clientes"|trans }}</a> - </li> + <li> + <a class="dropdown-item" href="{{ path('app_user_index') }}"> + <i class="bi bi-nav bi-person"></i> {{ "Utilisateurs"|trans }}</a> + </li> + {# <li>#} + {# <a class="dropdown-item" href="{{ path('app_lexicon_index') }}"><i class="bi bi-nav bi-card-list"></i> Lexiques</a>#} + {# </li>#} + <li> + <a class="dropdown-item" href="{{ path('app_client_index') }}"> + <i class="bi bi-nav bi-window"></i> {{ "Applis clientes"|trans }}</a> + </li> + <li> + <a class="dropdown-item" href="{{ path('app.swagger_ui') }}"><i class="bi bi-nav bi-terminal"></i> Swagger</a> + </li> + {% if app.environment|upper == 'DEV' %} <li> - <a class="dropdown-item" href="{{ path('app.swagger_ui') }}"><i class="bi bi-nav bi-terminal"></i> Swagger</a> + <a class="dropdown-item" href="{{ path('app_wiktionnary_search') }}"><i class="bi bi-nav bi-book"></i> {{ "Wiktionnaire"|trans }}</a> </li> - {% if app.environment|upper == 'DEV' %} - <li> - <a class="dropdown-item" href="{{ path('app_wiktionnary_search') }}"><i class="bi bi-nav bi-book"></i> {{ "Wiktionnaire"|trans }}</a> - </li> - {% endif %} - </ul> - </li> - {% endif %} - - - {# <li class="nav-item dropdown">#} - {# <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">#} - {# Dropdown#} - {# </a>#} - {# <ul class="dropdown-menu">#} - {# <li><a class="dropdown-item" href="#">Groupes</a></li>#} - {# <li><a class="dropdown-item" href="#">Amis</a></li>#} - {# <li><hr class="dropdown-divider"></li>#} - {# <li><a class="dropdown-item" href="#">Something else here</a></li>#} - {# </ul>#} - {# </li>#} - {# <li class="nav-item">#} - {# <a class="nav-link disabled">Disabled</a>#} - {# </li>#} - </ul> - - <ul class="navbar-nav ms-auto mb-2 mb-lg-0 me-2"> - <li class="nav-item"><a class="nav-link {{ 'app_user_profile' in app.request.attributes.get('_route') ? 'active' }}" href="{{ path('app_user_profile') }}"><i class="bi bi-nav bi-person-circle"></i> {{ app.user }}</a></li> - <li class="nav-item" title="{{ "Déconnexion"|trans }}"> - <a class="nav-link" style="padding-left: 0;" href="{{ path('app_logout') }}"> - <i class="fa fa-times-circle text-danger"></i> - <span class="d-xl-none">{{ "Déconnexion"|trans }}</span> - </a> + {% endif %} + </ul> </li> - {% endif %} - - {# <li class="nav-item dropdown">#} - {# <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">#} - {# Dropdown#} - {# </a>#} - {# <ul class="dropdown-menu">#} - {# <li><a class="dropdown-item" href="#">Groupes</a></li>#} - {# <li><a class="dropdown-item" href="#">Amis</a></li>#} - {# <li><hr class="dropdown-divider"></li>#} - {# <li><a class="dropdown-item" href="#">Something else here</a></li>#} - {# </ul>#} - {# </li>#} - {# <li class="nav-item">#} - {# <a class="nav-link disabled">Disabled</a>#} - {# </li>#} </ul> <ul class="navbar-nav ms-auto mb-2 mb-lg-0 me-2">