Revize f115c8b5
Přidáno uživatelem Filip Jani před asi 6 roky(ů)
app/AdminModule/presenters/BaseAdminPresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\AdminModule\Presenters; |
|
5 |
|
|
6 |
use App\Enum\EUserRole; |
|
7 |
use Nette; |
|
8 |
|
|
9 |
/** |
|
10 |
* Základní presenter od kterého dědí všechny presentery v AdminModulu, |
|
11 |
* zajišťuje kontrolu práv uživatele |
|
12 |
* |
|
13 |
* @package App\AdminModule\Presenters |
|
14 |
*/ |
|
15 |
abstract class BaseAdminPresenter extends Nette\Application\UI\Presenter |
|
16 |
{ |
|
17 |
|
|
18 |
public function startup() |
|
19 |
{ |
|
20 |
parent::startup(); |
|
21 |
|
|
22 |
if (!$this->isUserAllowed()) |
|
23 |
{ |
|
24 |
throw new Nette\Application\ForbiddenRequestException(); |
|
25 |
} |
|
26 |
} |
|
27 |
|
|
28 |
/** |
|
29 |
* Vrací TRUE pokud má uživatel přístup do administrace |
|
30 |
* |
|
31 |
* @return bool |
|
32 |
*/ |
|
33 |
protected function isUserAllowed() |
|
34 |
{ |
|
35 |
return $this->user->isLoggedIn() && $this->user->isInRole(EUserRole::ADMIN); |
|
36 |
} |
|
37 |
} |
app/AdminModule/presenters/DefaultPresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\AdminModule\Presenters; |
|
4 |
|
|
5 |
/** |
|
6 |
* Presenter zobrazující se po přihlášení do Administrace |
|
7 |
* |
|
8 |
* @package App\AdminModule\Presenters |
|
9 |
*/ |
|
10 |
final class DefaultPresenter extends BaseAdminPresenter |
|
11 |
{ |
|
12 |
} |
app/AdminModule/templates/@layout.latte | ||
---|---|---|
1 |
<!DOCTYPE html> |
|
2 |
<html lang="en"> |
|
3 |
<head> |
|
4 |
<meta charset="UTF-8"> |
|
5 |
|
|
6 |
<title>{ifset title}{include title|stripHtml} | {/ifset}Old Babylonian Text Corpus</title> |
|
7 |
|
|
8 |
<!-- jQuery --> |
|
9 |
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" |
|
10 |
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" |
|
11 |
crossorigin="anonymous"></script> |
|
12 |
|
|
13 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.js" |
|
14 |
integrity="sha256-wqAoCRn9//AnHSl4qbXVhqdvmgFQqN5Elqp4Eb2wOXA=" crossorigin="anonymous"></script> |
|
15 |
|
|
16 |
<!-- Bootstrap CDN --> |
|
17 |
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" |
|
18 |
integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> |
|
19 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" |
|
20 |
integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" |
|
21 |
crossorigin="anonymous"></script> |
|
22 |
|
|
23 |
<!-- Bootstrap Select --> |
|
24 |
<link rel="stylesheet" |
|
25 |
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/css/bootstrap-select.min.css"> |
|
26 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/bootstrap-select.min.js"></script> |
|
27 |
|
|
28 |
<!-- Bootstrap Datepicker --> |
|
29 |
<link rel="stylesheet" |
|
30 |
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker3.min.css" |
|
31 |
integrity="sha256-mlKJFBS1jbZwwDrZD1ApO7YFS6MA1XDN37jZ9GDFC64=" crossorigin="anonymous"/> |
|
32 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/js/bootstrap-datepicker.min.js" |
|
33 |
integrity="sha256-tW5LzEC7QjhG0CiAvxlseMTs2qJS7u3DRPauDjFJ3zo=" crossorigin="anonymous"></script> |
|
34 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/locales/bootstrap-datepicker.cs.min.js" |
|
35 |
integrity="sha256-pbW7ult8QcDlimj+JQplrsCieqCvQ/8VGr7ZdTuev8c=" crossorigin="anonymous"></script> |
|
36 |
|
|
37 |
<!-- Font awesome --> |
|
38 |
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" |
|
39 |
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous"> |
|
40 |
|
|
41 |
<link rel="stylesheet" href="{$basePath}/css/admin/style.css"> |
|
42 |
|
|
43 |
<script src="https://nette.github.io/resources/js/netteForms.min.js"></script> |
|
44 |
<script src="{$basePath}/js/nette.ajax.js"></script> |
|
45 |
|
|
46 |
</head> |
|
47 |
<body> |
|
48 |
<!--Navbar--> |
|
49 |
<div class="jumbotron jumbotron-fluid header-logo"> |
|
50 |
<div class="container text-center"> |
|
51 |
<div class="display-4"><a n:href=":Front:Homepage:">Old Babylonian Text Corpus</a></div> |
|
52 |
</div> |
|
53 |
</div> |
|
54 |
<nav class="navbar navbar-expand-lg navbar-dark bg-primary" style="background-color: #003366 !important;"> |
|
55 |
<ul class="navbar-nav mr-auto"> |
|
56 |
<li class="nav-item"> |
|
57 |
<a class="nav-link" href="search-texts.html">Search & edit texts</a> |
|
58 |
</li> |
|
59 |
<li class="nav-item"> |
|
60 |
<a class="nav-link" href="#">Search dictionary</a> |
|
61 |
</li> |
|
62 |
<li class="nav-item"> |
|
63 |
<a class="nav-link" href="#">Text catalogue</a> |
|
64 |
</li> |
|
65 |
<li class="nav-item"> |
|
66 |
<a class="nav-link" href="#">Catalogue of cuneiform signs</a> |
|
67 |
</li> |
|
68 |
<li class="nav-item"> |
|
69 |
<a class="nav-link" href="#">Contact & members</a> |
|
70 |
</li> |
|
71 |
<li class="nav-item"> |
|
72 |
<a class="nav-link" href="#">Input new text</a> |
|
73 |
</li> |
|
74 |
<li class="nav-item active"> |
|
75 |
<a class="nav-link" n:href="Default:default">Admin</a> |
|
76 |
</li> |
|
77 |
</ul> |
|
78 |
{if $user->loggedIn} |
|
79 |
<span class="navbar-text" style="padding-right: 1rem"> |
|
80 |
User: <strong>{$user->getIdentity()->username}</strong> |
|
81 |
</span> |
|
82 |
{/if} |
|
83 |
<div class="navbar-nav nav-item"> |
|
84 |
{if $user->loggedIn} |
|
85 |
<a class="nav-link" n:href=":Front:Homepage:logout">Logout</a> |
|
86 |
<a class="nav-link" href="#">Change Password</a> |
|
87 |
{else} |
|
88 |
<a class="nav-link" n:href=":Front:Homepage:login">Login</a> |
|
89 |
{/if} |
|
90 |
</div> |
|
91 |
</nav> |
|
92 |
|
|
93 |
<ul class="nav"> |
|
94 |
<!-- Aktualní zvýraznění linku se dá udělat takhle --> |
|
95 |
<!-- - do n:class se dá isLinkCurrent a odkaz na presenter --> |
|
96 |
<!-- <li class="nav-item"><a n:href="Default:default" n:class="nav-link, $presenter->isLinkCurrent('Default:*') ? active" title="Users"> |
|
97 |
Users </a></li> --> |
|
98 |
|
|
99 |
<li class="nav-item"><a href="#" class="nav-link" title="Users"> |
|
100 |
Users </a></li> |
|
101 |
<li class="nav-item"><a href="#" class="nav-link active" title="Groups"> |
|
102 |
Groups </a></li> |
|
103 |
<li class="nav-item"><a href="#" class="nav-link" title="Rules"> |
|
104 |
Rules </a></li> |
|
105 |
|
|
106 |
<li class="nav-item"><a href="#" class="nav-link" title="Book"> |
|
107 |
Book </a></li> |
|
108 |
<li class="nav-item"><a href="#" class="nav-link" title="Transliteration"> |
|
109 |
Transliteration </a></li> |
|
110 |
<li class="nav-item"><a href="#" class="nav-link" title="Book type"> |
|
111 |
Book type </a></li> |
|
112 |
<li class="nav-item"><a href="#" class="nav-link" title="Object type"> |
|
113 |
Object type </a></li> |
|
114 |
<li class="nav-item"><a href="#" class="nav-link" title="Surface type"> |
|
115 |
Surface type </a></li> |
|
116 |
|
|
117 |
<li class="nav-item"><a href="#" class="nav-link" title="Museum"> |
|
118 |
Museum </a></li> |
|
119 |
<li class="nav-item"><a href="#" class="nav-link" title="Origin"> |
|
120 |
Origin </a></li> |
|
121 |
<li class="nav-item"><a href="#" class="nav-link" title="Upload"> |
|
122 |
Upload texts </a></li> |
|
123 |
<li class="nav-item"><a href="#" class="nav-link" title="Replace"> |
|
124 |
Mass replace </a></li> |
|
125 |
</ul> |
|
126 |
|
|
127 |
<!--Content--> |
|
128 |
<div class="content"> |
|
129 |
<div n:foreach="$flashes as $flash" n:class="alert, 'alert-' . $flash->type">{$flash->message}</div> |
|
130 |
|
|
131 |
{include content} |
|
132 |
</div> |
|
133 |
|
|
134 |
{ifset scripts}{include scripts}{/ifset} |
|
135 |
|
|
136 |
<!--Footer--> |
|
137 |
<footer class="footer"> |
|
138 |
<div class="container"> |
|
139 |
<div class="text-center"> |
|
140 |
© Furat Rahman - Faculty of Philosophy - University of West Bohemia in Pilsen and Cuneiform Circle 2002-2005<br> |
|
141 |
Created by Medici - Faculty of Applied Science - University of West Bohemia in Pilsen |
|
142 |
</div> |
|
143 |
</div> |
|
144 |
</footer> |
|
145 |
</body> |
|
146 |
</html> |
app/AdminModule/templates/Default/default.latte | ||
---|---|---|
1 |
{block content} |
app/FrontModule/component/ExampleGrid.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\FrontModule\Components; |
|
5 |
|
|
6 |
|
|
7 |
use App\Utils\DataGrid\DataGrid; |
|
8 |
use App\Model\Repository\LineRepository; |
|
9 |
use Ublaboo\DataGrid\Exception\DataGridException; |
|
10 |
|
|
11 |
/** |
|
12 |
* Ukázkový datagrid, bude smazán při předání |
|
13 |
* - všechny možnosti použití gridu lze vidět na |
|
14 |
* https://gitlab.com/Fifal/dvm/blob/21afc037e3604093197e140defc05925df0b8c28/web-project/app/components/variant/VariantGrid.php |
|
15 |
* |
|
16 |
* @package App\Components |
|
17 |
*/ |
|
18 |
class ExampleGrid extends DataGrid |
|
19 |
{ |
|
20 |
/** @var LineRepository */ |
|
21 |
private $lineRepository; |
|
22 |
|
|
23 |
public function __construct(LineRepository $lineRepository) |
|
24 |
{ |
|
25 |
$this->lineRepository = $lineRepository; |
|
26 |
|
|
27 |
parent::__construct(); |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* Abstraktní metoda, slouží k nastavení primárního klíče a nastavení datasource |
|
32 |
* 1. $this->setPrimaryKey(); |
|
33 |
* 2. $this->setDataSource(); |
|
34 |
* |
|
35 |
* @throws DataGridException |
|
36 |
*/ |
|
37 |
public function init() |
|
38 |
{ |
|
39 |
$this->setPrimaryKey(LineRepository::COLUMN_ID); |
|
40 |
$this->setDataSource($this->lineRepository->findAll()); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* Definice sloupečků, akcí, vyhledávácích filtrů gridu |
|
45 |
* |
|
46 |
* @throws DataGridException |
|
47 |
*/ |
|
48 |
public function define() |
|
49 |
{ |
|
50 |
$this->addColumnNumber(LineRepository::COLUMN_ID, "ID"); |
|
51 |
$this->addColumnText(LineRepository::COLUMN_TRANSLITERATION, "Transliterace"); |
|
52 |
$this->addFilterText(LineRepository::COLUMN_TRANSLITERATION, "Transliterace"); |
|
53 |
|
|
54 |
$this->addAction(LineRepository::COLUMN_TRANSLITERATION, "Smazat"); |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
interface IExampleGirdFactory |
|
59 |
{ |
|
60 |
/** |
|
61 |
* Funkce create je implementována již v předkovi |
|
62 |
* |
|
63 |
* @return ExampleGrid |
|
64 |
*/ |
|
65 |
public function create(); |
|
66 |
} |
app/FrontModule/component/Login/LoginForm.latte | ||
---|---|---|
1 |
<div class="col-3"> |
|
2 |
{form form class => 'form'} |
|
3 |
{label \App\Model\Repository\UserRepository::COLUMN_LOGIN} |
|
4 |
{input \App\Model\Repository\UserRepository::COLUMN_LOGIN class => 'form-control'} |
|
5 |
|
|
6 |
{label \App\Model\Repository\UserRepository::COLUMN_PASSWORD} |
|
7 |
{input \App\Model\Repository\UserRepository::COLUMN_PASSWORD class => 'form-control'} |
|
8 |
|
|
9 |
{input submit class => 'form-control btn btn-success mt-4'} |
|
10 |
{/form} |
|
11 |
</div> |
app/FrontModule/component/Login/LoginForm.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\FrontModule\Components; |
|
5 |
|
|
6 |
|
|
7 |
use App\Enum\EFlashMessage; |
|
8 |
use App\Model\Repository\UserRepository; |
|
9 |
use Nette\Application\UI\Control; |
|
10 |
use Nette\Application\UI\Form; |
|
11 |
use Nette\Security\AuthenticationException; |
|
12 |
|
|
13 |
class LoginForm extends Control |
|
14 |
{ |
|
15 |
public function render() |
|
16 |
{ |
|
17 |
$this->template->setFile(__DIR__ . '/LoginForm.latte'); |
|
18 |
$this->template->render(); |
|
19 |
} |
|
20 |
|
|
21 |
protected function createComponentForm() |
|
22 |
{ |
|
23 |
$form = new Form; |
|
24 |
|
|
25 |
$form->addText(UserRepository::COLUMN_LOGIN, 'Login'); |
|
26 |
$form->addPassword(UserRepository::COLUMN_PASSWORD, 'Password'); |
|
27 |
|
|
28 |
$form->addSubmit('submit', 'Login'); |
|
29 |
|
|
30 |
$form->onSuccess[] = [$this, 'formSuccess']; |
|
31 |
|
|
32 |
return $form; |
|
33 |
} |
|
34 |
|
|
35 |
public function formSuccess(Form $form) |
|
36 |
{ |
|
37 |
$values = $form->getValues(); |
|
38 |
|
|
39 |
try |
|
40 |
{ |
|
41 |
$this->presenter->user->login($values->{UserRepository::COLUMN_LOGIN}, $values->{UserRepository::COLUMN_PASSWORD}); |
|
42 |
} catch (AuthenticationException $ex) |
|
43 |
{ |
|
44 |
$this->presenter->flashMessage($ex->getMessage(), EFlashMessage::ERROR); |
|
45 |
$this->presenter->redirect('Homepage:login'); |
|
46 |
} |
|
47 |
|
|
48 |
$this->presenter->flashMessage('Přihlášení bylo úspěšné.', EFlashMessage::SUCCESS); |
|
49 |
$this->presenter->redirect('Homepage:default'); |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 |
interface ILoginFormFactory |
|
54 |
{ |
|
55 |
/** |
|
56 |
* @return LoginForm |
|
57 |
*/ |
|
58 |
public function create(); |
|
59 |
} |
app/FrontModule/presenters/Error4xxPresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\FrontModule\Presenters; |
|
4 |
|
|
5 |
use Nette; |
|
6 |
|
|
7 |
|
|
8 |
final class Error4xxPresenter extends Nette\Application\UI\Presenter |
|
9 |
{ |
|
10 |
public function startup() |
|
11 |
{ |
|
12 |
parent::startup(); |
|
13 |
if (!$this->getRequest()->isMethod(Nette\Application\Request::FORWARD)) { |
|
14 |
$this->error(); |
|
15 |
} |
|
16 |
} |
|
17 |
|
|
18 |
|
|
19 |
public function renderDefault(Nette\Application\BadRequestException $exception) |
|
20 |
{ |
|
21 |
// load template 403.latte or 404.latte or ... 4xx.latte |
|
22 |
$file = __DIR__ . "/templates/Error/{$exception->getCode()}.latte"; |
|
23 |
$this->template->setFile(is_file($file) ? $file : __DIR__ . '/templates/Error/4xx.latte'); |
|
24 |
} |
|
25 |
} |
app/FrontModule/presenters/ErrorPresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\FrontModule\Presenters; |
|
4 |
|
|
5 |
use Nette; |
|
6 |
use Nette\Application\Responses; |
|
7 |
use Nette\Http; |
|
8 |
use Tracy\ILogger; |
|
9 |
|
|
10 |
|
|
11 |
final class ErrorPresenter implements Nette\Application\IPresenter |
|
12 |
{ |
|
13 |
use Nette\SmartObject; |
|
14 |
|
|
15 |
/** @var ILogger */ |
|
16 |
private $logger; |
|
17 |
|
|
18 |
|
|
19 |
public function __construct(ILogger $logger) |
|
20 |
{ |
|
21 |
$this->logger = $logger; |
|
22 |
} |
|
23 |
|
|
24 |
|
|
25 |
public function run(Nette\Application\Request $request) |
|
26 |
{ |
|
27 |
$exception = $request->getParameter('exception'); |
|
28 |
|
|
29 |
if ($exception instanceof Nette\Application\BadRequestException) { |
|
30 |
list($module, , $sep) = Nette\Application\Helpers::splitName($request->getPresenterName()); |
|
31 |
return new Responses\ForwardResponse($request->setPresenterName($module . $sep . 'Error4xx')); |
|
32 |
} |
|
33 |
|
|
34 |
$this->logger->log($exception, ILogger::EXCEPTION); |
|
35 |
return new Responses\CallbackResponse(function (Http\IRequest $httpRequest, Http\IResponse $httpResponse) { |
|
36 |
if (preg_match('#^text/html(?:;|$)#', $httpResponse->getHeader('Content-Type'))) { |
|
37 |
require __DIR__ . '/templates/Error/500.phtml'; |
|
38 |
} |
|
39 |
}); |
|
40 |
} |
|
41 |
} |
app/FrontModule/presenters/HomepagePresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\FrontModule\Presenters; |
|
4 |
|
|
5 |
use App\FrontModule\Components\IExampleGirdFactory; |
|
6 |
use App\FrontModule\Components\ILoginFormFactory; |
|
7 |
use App\Enum\EFlashMessage; |
|
8 |
use Nette; |
|
9 |
|
|
10 |
|
|
11 |
final class HomepagePresenter extends Nette\Application\UI\Presenter |
|
12 |
{ |
|
13 |
/** @var IExampleGirdFactory */ |
|
14 |
private $exampleGridFactory; |
|
15 |
/** @var ILoginFormFactory */ |
|
16 |
private $loginFormFactory; |
|
17 |
|
|
18 |
public function __construct(IExampleGirdFactory $exampleGridFactory, ILoginFormFactory $loginFormFactory) |
|
19 |
{ |
|
20 |
parent::__construct(); |
|
21 |
|
|
22 |
$this->exampleGridFactory = $exampleGridFactory; |
|
23 |
$this->loginFormFactory = $loginFormFactory; |
|
24 |
} |
|
25 |
|
|
26 |
public function actionDefault() |
|
27 |
{ |
|
28 |
|
|
29 |
} |
|
30 |
|
|
31 |
public function actionLogin() |
|
32 |
{ |
|
33 |
if ($this->user->isLoggedIn()) |
|
34 |
{ |
|
35 |
$this->redirect('Homepage:default'); |
|
36 |
} |
|
37 |
} |
|
38 |
|
|
39 |
public function actionLogout() |
|
40 |
{ |
|
41 |
if ($this->getUser()->isLoggedIn()) |
|
42 |
{ |
|
43 |
$this->user->logout(true); |
|
44 |
|
|
45 |
$this->flashMessage('Odhlášení bylo úspěšné.', EFlashMessage::SUCCESS); |
|
46 |
$this->redirect('Homepage:default'); |
|
47 |
} |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* Komponenta přihlašovacího formuláře |
|
52 |
* |
|
53 |
* @return \App\FrontModule\Components\LoginForm |
|
54 |
*/ |
|
55 |
public function createComponentLoginForm() |
|
56 |
{ |
|
57 |
return $this->loginFormFactory->create(); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Vytvoření ukázkového gridu |
|
62 |
*/ |
|
63 |
public function createComponentDataGrid() |
|
64 |
{ |
|
65 |
return $this->exampleGridFactory->create(); |
|
66 |
} |
|
67 |
} |
app/FrontModule/templates/@layout.latte | ||
---|---|---|
1 |
<!DOCTYPE html> |
|
2 |
<html lang="en"> |
|
3 |
<head> |
|
4 |
<meta charset="UTF-8"> |
|
5 |
|
|
6 |
<title>{ifset title}{include title|stripHtml} | {/ifset}Old Babylonian Text Corpus</title> |
|
7 |
|
|
8 |
<!-- jQuery --> |
|
9 |
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" |
|
10 |
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" |
|
11 |
crossorigin="anonymous"></script> |
|
12 |
|
|
13 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.js" |
|
14 |
integrity="sha256-wqAoCRn9//AnHSl4qbXVhqdvmgFQqN5Elqp4Eb2wOXA=" crossorigin="anonymous"></script> |
|
15 |
|
|
16 |
<!-- Bootstrap CDN --> |
|
17 |
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" |
|
18 |
integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> |
|
19 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" |
|
20 |
integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" |
|
21 |
crossorigin="anonymous"></script> |
|
22 |
|
|
23 |
<!-- Bootstrap Select --> |
|
24 |
<link rel="stylesheet" |
|
25 |
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/css/bootstrap-select.min.css"> |
|
26 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/bootstrap-select.min.js"></script> |
|
27 |
|
|
28 |
<!-- Bootstrap Datepicker --> |
|
29 |
<link rel="stylesheet" |
|
30 |
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker3.min.css" |
|
31 |
integrity="sha256-mlKJFBS1jbZwwDrZD1ApO7YFS6MA1XDN37jZ9GDFC64=" crossorigin="anonymous"/> |
|
32 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/js/bootstrap-datepicker.min.js" |
|
33 |
integrity="sha256-tW5LzEC7QjhG0CiAvxlseMTs2qJS7u3DRPauDjFJ3zo=" crossorigin="anonymous"></script> |
|
34 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/locales/bootstrap-datepicker.cs.min.js" |
|
35 |
integrity="sha256-pbW7ult8QcDlimj+JQplrsCieqCvQ/8VGr7ZdTuev8c=" crossorigin="anonymous"></script> |
|
36 |
|
|
37 |
<!-- Font awesome --> |
|
38 |
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" |
|
39 |
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous"> |
|
40 |
|
|
41 |
<link rel="stylesheet" href="{$basePath}/css/front/style.css"> |
|
42 |
|
|
43 |
<script src="https://nette.github.io/resources/js/netteForms.min.js"></script> |
|
44 |
<script src="{$basePath}/js/nette.ajax.js"></script> |
|
45 |
|
|
46 |
</head> |
|
47 |
<body> |
|
48 |
<!--Navbar--> |
|
49 |
<div class="jumbotron jumbotron-fluid header-logo"> |
|
50 |
<div class="container text-center"> |
|
51 |
<div class="display-4"><a n:href=":Front:Homepage:">Old Babylonian Text Corpus</a></div> |
|
52 |
</div> |
|
53 |
</div> |
|
54 |
<nav class="navbar navbar-expand-lg navbar-dark bg-primary" style="background-color: #003366 !important;"> |
|
55 |
<ul class="navbar-nav mr-auto"> |
|
56 |
<li class="nav-item"> |
|
57 |
<a class="nav-link" href="search-texts.html">Search & edit texts</a> |
|
58 |
</li> |
|
59 |
<li class="nav-item"> |
|
60 |
<a class="nav-link" href="#">Search dictionary</a> |
|
61 |
</li> |
|
62 |
<li class="nav-item"> |
|
63 |
<a class="nav-link" href="#">Text catalogue</a> |
|
64 |
</li> |
|
65 |
<li class="nav-item"> |
|
66 |
<a class="nav-link" href="#">Catalogue of cuneiform signs</a> |
|
67 |
</li> |
|
68 |
<li class="nav-item"> |
|
69 |
<a class="nav-link" href="#">Contact & members</a> |
|
70 |
</li> |
|
71 |
<li class="nav-item"> |
|
72 |
<a class="nav-link" href="#">Input new text</a> |
|
73 |
</li> |
|
74 |
<li class="nav-item"> |
|
75 |
<a class="nav-link" n:href=":Admin:Default:">Admin</a> |
|
76 |
</li> |
|
77 |
</ul> |
|
78 |
{if $user->loggedIn} |
|
79 |
<span class="navbar-text" style="padding-right: 1rem"> |
|
80 |
User: <strong>{$user->getIdentity()->username}</strong> |
|
81 |
</span> |
|
82 |
{/if} |
|
83 |
<div class="navbar-nav nav-item"> |
|
84 |
{if $user->loggedIn} |
|
85 |
<a class="nav-link" n:href="Homepage:logout">Logout</a> |
|
86 |
<a class="nav-link" href="#">Change Password</a> |
|
87 |
{else} |
|
88 |
<a class="nav-link" n:href="Homepage:login">Login</a> |
|
89 |
{/if} |
|
90 |
</div> |
|
91 |
</nav> |
|
92 |
|
|
93 |
<!--Content--> |
|
94 |
<div class="content"> |
|
95 |
<div n:foreach="$flashes as $flash" n:class="alert, 'alert-' . $flash->type">{$flash->message}</div> |
|
96 |
|
|
97 |
{include content} |
|
98 |
</div> |
|
99 |
|
|
100 |
{ifset scripts}{include scripts}{/ifset} |
|
101 |
|
|
102 |
<!--Footer--> |
|
103 |
<footer class="footer"> |
|
104 |
<div class="container"> |
|
105 |
<div class="text-center"> |
|
106 |
© Furat Rahman - Faculty of Philosophy - University of West Bohemia in Pilsen and Cuneiform Circle 2002-2005<br> |
|
107 |
Created by Medici - Faculty of Applied Science - University of West Bohemia in Pilsen |
|
108 |
</div> |
|
109 |
</div> |
|
110 |
</footer> |
|
111 |
</body> |
|
112 |
</html> |
app/FrontModule/templates/Error/403.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Access Denied</h1> |
|
3 |
|
|
4 |
<p>You do not have permission to view this page. Please try contact the web |
|
5 |
site administrator if you believe you should be able to view this page.</p> |
|
6 |
|
|
7 |
<p><small>error 403</small></p> |
app/FrontModule/templates/Error/404.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Page Not Found</h1> |
|
3 |
|
|
4 |
<p>The page you requested could not be found. It is possible that the address is |
|
5 |
incorrect, or that the page no longer exists. Please use a search engine to find |
|
6 |
what you are looking for.</p> |
|
7 |
|
|
8 |
<p><small>error 404</small></p> |
app/FrontModule/templates/Error/405.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Method Not Allowed</h1> |
|
3 |
|
|
4 |
<p>The requested method is not allowed for the URL.</p> |
|
5 |
|
|
6 |
<p><small>error 405</small></p> |
app/FrontModule/templates/Error/410.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Page Not Found</h1> |
|
3 |
|
|
4 |
<p>The page you requested has been taken off the site. We apologize for the inconvenience.</p> |
|
5 |
|
|
6 |
<p><small>error 410</small></p> |
app/FrontModule/templates/Error/4xx.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Oops...</h1> |
|
3 |
|
|
4 |
<p>Your browser sent a request that this server could not understand or process.</p> |
app/FrontModule/templates/Error/500.phtml | ||
---|---|---|
1 |
<!DOCTYPE html><!-- "' --></textarea></script></style></pre></xmp></a></audio></button></canvas></datalist></details></dialog></iframe></listing></meter></noembed></noframes></noscript></optgroup></option></progress></rp></select></table></template></title></video> |
|
2 |
<meta charset="utf-8"> |
|
3 |
<meta name="robots" content="noindex"> |
|
4 |
<title>Server Error</title> |
|
5 |
|
|
6 |
<style> |
|
7 |
#nette-error { all: initial; position: absolute; top: 0; left: 0; right: 0; height: 70vh; min-height: 400px; display: flex; align-items: center; justify-content: center; z-index: 1000 } |
|
8 |
#nette-error div { all: initial; max-width: 550px; background: white; color: #333; display: block } |
|
9 |
#nette-error h1 { all: initial; font: bold 50px/1.1 sans-serif; display: block; margin: 40px } |
|
10 |
#nette-error p { all: initial; font: 20px/1.4 sans-serif; margin: 40px; display: block } |
|
11 |
#nette-error small { color: gray } |
|
12 |
</style> |
|
13 |
|
|
14 |
<div id=nette-error> |
|
15 |
<div> |
|
16 |
<h1>Server Error</h1> |
|
17 |
|
|
18 |
<p>We're sorry! The server encountered an internal error and |
|
19 |
was unable to complete your request. Please try again later.</p> |
|
20 |
|
|
21 |
<p><small>error 500</small></p> |
|
22 |
</div> |
|
23 |
</div> |
|
24 |
|
|
25 |
<script> |
|
26 |
document.body.insertBefore(document.getElementById('nette-error'), document.body.firstChild); |
|
27 |
</script> |
app/FrontModule/templates/Error/503.phtml | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
header('HTTP/1.1 503 Service Unavailable'); |
|
4 |
header('Retry-After: 300'); // 5 minutes in seconds |
|
5 |
|
|
6 |
?> |
|
7 |
<!DOCTYPE html> |
|
8 |
<meta charset="utf-8"> |
|
9 |
<meta name="robots" content="noindex"> |
|
10 |
<meta name="generator" content="Nette Framework"> |
|
11 |
|
|
12 |
<style> |
|
13 |
body { color: #333; background: white; width: 500px; margin: 100px auto } |
|
14 |
h1 { font: bold 47px/1.5 sans-serif; margin: .6em 0 } |
|
15 |
p { font: 21px/1.5 Georgia,serif; margin: 1.5em 0 } |
|
16 |
</style> |
|
17 |
|
|
18 |
<title>Site is temporarily down for maintenance</title> |
|
19 |
|
|
20 |
<h1>We're Sorry</h1> |
|
21 |
|
|
22 |
<p>The site is temporarily down for maintenance. Please try again in a few minutes.</p> |
app/FrontModule/templates/Homepage/default.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<div class="display-5">Old Babylonian Text Corpus by Cuneiform Circle</div> |
|
3 |
<hr> |
|
4 |
|
|
5 |
<div class="row"> |
|
6 |
<div class="col"> |
|
7 |
<dl class="row"> |
|
8 |
<dt class="col-sm-3">OB motto</dt> |
|
9 |
<dd class="col-sm-9">a-na D:na-bi-um-ma-lik a-wi-lim dam-qí-im ša D:AMAR.UTU ù D:na-bi-um GI.DUB.BA-šu ú-še-še-ru (AbB 3,33,1-4)</dd> |
|
10 |
</dl> |
|
11 |
|
|
12 |
<div class="alert alert-primary"> |
|
13 |
If you have interest in Old Babylonian Akkadian Texts, don't hesitate to join us! You are welcome! |
|
14 |
</div> |
|
15 |
</div> |
|
16 |
<div class="col"> |
|
17 |
<form method="get" action="/utf/utf/show2boger.php" onclick="this.target='_blank'" target="_blank"> |
|
18 |
<p class="blue"> |
|
19 |
<label for="borger">Input Borger's ABZ number:</label> |
|
20 |
<input class="td5" type="text" id="borger" name="borger" size="3" value="333"> |
|
21 |
<input class="tlacitko2" type="submit" value=" find "> |
|
22 |
</p> |
|
23 |
<p class="blue"> |
|
24 |
This is a quick search to find variants of signs according to Borger's number from Old Babylonian Graphemic Analyses. |
|
25 |
<a class="noline" href="/utf/utf/signs.html" onclick="this.target='_blank'"> |
|
26 |
Click here for an advanced search.</a> |
|
27 |
|
|
28 |
</p> |
|
29 |
<p> |
|
30 |
<a class="noline" href="/utf/utf/signs.html" target="blank"> |
|
31 |
<img src="http://sp105p02-kbs.ff.zcu.cz/img/gar3.gif" width="335" height="35" alt="signs"> |
|
32 |
</a> |
|
33 |
</p> |
|
34 |
</form> |
|
35 |
</div> |
|
36 |
</div> |
|
37 |
|
|
38 |
<hr> |
|
39 |
|
|
40 |
<p>Cuneiform Circle is a community of scholars engaged in the study of the Old Babylonian Akkadian. Our main goal is to create an Old Babylonian Text Corpus, an Old Babylonian Dictionary, and a List of Old Babylonian Cuneiform Signs.</p> |
|
41 |
|
|
42 |
<p>The Old Babylonian Text Corpus (OBTC) comprises a large text database of the Old Babylonian Akkadian Language (currently 144097 text lines, letters, documents, legal texts, royal inscriptions, omina, mathematical texts etc.).</p> |
|
43 |
|
|
44 |
<p><strong>All texts are available for search according to sign-chains (transliteration). The search engine in Old Babylonian Text Corpus verse 1 is available for everybody but the search is restricted to the following texts: Codex Hammurapi and AbB 5. The search in all 144097 lines of OBTC verse 2 is available for members only (see how to become a member) .</strong></p> |
|
45 |
|
|
46 |
<p><strong>Our service includes unique searchable lists of Old Babylonian Signs Variants as appearing in the hand copies selected for the graphemic analysis.</strong></p> |
|
47 |
|
|
48 |
<p>The work on the project is in progress. We have started in 1988-89 and have accomplished significant advances since. We are currently working towards improving the quality and scope of our databases. The full access to all materials and sources is given to active members only ( see our policy ).</p> |
|
49 |
{/block} |
|
50 |
|
|
51 |
{block scripts} |
|
52 |
<script> |
|
53 |
$(function () |
|
54 |
{ |
|
55 |
$.nette.init(); |
|
56 |
}); |
|
57 |
</script> |
|
58 |
{/block} |
app/FrontModule/templates/Homepage/login.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<div class="row"> |
|
3 |
<div class="col"> |
|
4 |
<h4>System authorization</h4> |
|
5 |
{control loginForm} |
|
6 |
</div> |
|
7 |
</div> |
|
8 |
{/block} |
app/component/ExampleGrid.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\Components; |
|
5 |
|
|
6 |
|
|
7 |
use App\Utils\DataGrid\DataGrid; |
|
8 |
use App\Model\Repository\LineRepository; |
|
9 |
use Ublaboo\DataGrid\Exception\DataGridException; |
|
10 |
|
|
11 |
/** |
|
12 |
* Ukázkový datagrid, bude smazán při předání |
|
13 |
* - všechny možnosti použití gridu lze vidět na |
|
14 |
* https://gitlab.com/Fifal/dvm/blob/21afc037e3604093197e140defc05925df0b8c28/web-project/app/components/variant/VariantGrid.php |
|
15 |
* |
|
16 |
* @package App\Components |
|
17 |
*/ |
|
18 |
class ExampleGrid extends DataGrid |
|
19 |
{ |
|
20 |
/** @var LineRepository */ |
|
21 |
private $lineRepository; |
|
22 |
|
|
23 |
public function __construct(LineRepository $lineRepository) |
|
24 |
{ |
|
25 |
$this->lineRepository = $lineRepository; |
|
26 |
|
|
27 |
parent::__construct(); |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* Abstraktní metoda, slouží k nastavení primárního klíče a nastavení datasource |
|
32 |
* 1. $this->setPrimaryKey(); |
|
33 |
* 2. $this->setDataSource(); |
|
34 |
* |
|
35 |
* @throws DataGridException |
|
36 |
*/ |
|
37 |
public function init() |
|
38 |
{ |
|
39 |
$this->setPrimaryKey(LineRepository::COLUMN_ID); |
|
40 |
$this->setDataSource($this->lineRepository->findAll()); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* Definice sloupečků, akcí, vyhledávácích filtrů gridu |
|
45 |
* |
|
46 |
* @throws DataGridException |
|
47 |
*/ |
|
48 |
public function define() |
|
49 |
{ |
|
50 |
$this->addColumnNumber(LineRepository::COLUMN_ID, "ID"); |
|
51 |
$this->addColumnText(LineRepository::COLUMN_TRANSLITERATION, "Transliterace"); |
|
52 |
$this->addFilterText(LineRepository::COLUMN_TRANSLITERATION, "Transliterace"); |
|
53 |
|
|
54 |
$this->addAction(LineRepository::COLUMN_TRANSLITERATION, "Smazat"); |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
interface IExampleGirdFactory |
|
59 |
{ |
|
60 |
/** |
|
61 |
* Funkce create je implementována již v předkovi |
|
62 |
* |
|
63 |
* @return ExampleGrid |
|
64 |
*/ |
|
65 |
public function create(); |
|
66 |
} |
app/component/Login/LoginForm.latte | ||
---|---|---|
1 |
<div class="col-3"> |
|
2 |
{form form class => 'form'} |
|
3 |
{label \App\Model\Repository\UserRepository::COLUMN_LOGIN} |
|
4 |
{input \App\Model\Repository\UserRepository::COLUMN_LOGIN class => 'form-control'} |
|
5 |
|
|
6 |
{label \App\Model\Repository\UserRepository::COLUMN_PASSWORD} |
|
7 |
{input \App\Model\Repository\UserRepository::COLUMN_PASSWORD class => 'form-control'} |
|
8 |
|
|
9 |
{input submit class => 'form-control btn btn-success mt-4'} |
|
10 |
{/form} |
|
11 |
</div> |
app/component/Login/LoginForm.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\Components; |
|
5 |
|
|
6 |
|
|
7 |
use App\Enum\EFlashMessage; |
|
8 |
use App\Model\Repository\UserRepository; |
|
9 |
use Nette\Application\UI\Control; |
|
10 |
use Nette\Application\UI\Form; |
|
11 |
use Nette\Security\AuthenticationException; |
|
12 |
|
|
13 |
class LoginForm extends Control |
|
14 |
{ |
|
15 |
public function render() |
|
16 |
{ |
|
17 |
$this->template->setFile(__DIR__ . '/LoginForm.latte'); |
|
18 |
$this->template->render(); |
|
19 |
} |
|
20 |
|
|
21 |
protected function createComponentForm() |
|
22 |
{ |
|
23 |
$form = new Form; |
|
24 |
|
|
25 |
$form->addText(UserRepository::COLUMN_LOGIN, 'Login'); |
|
26 |
$form->addPassword(UserRepository::COLUMN_PASSWORD, 'Password'); |
|
27 |
|
|
28 |
$form->addSubmit('submit', 'Login'); |
|
29 |
|
|
30 |
$form->onSuccess[] = [$this, 'formSuccess']; |
|
31 |
|
|
32 |
return $form; |
|
33 |
} |
|
34 |
|
|
35 |
public function formSuccess(Form $form) |
|
36 |
{ |
|
37 |
$values = $form->getValues(); |
|
38 |
|
|
39 |
try |
|
40 |
{ |
|
41 |
$this->presenter->user->login($values->{UserRepository::COLUMN_LOGIN}, $values->{UserRepository::COLUMN_PASSWORD}); |
|
42 |
} catch (AuthenticationException $ex) |
|
43 |
{ |
|
44 |
$this->presenter->flashMessage($ex->getMessage(), EFlashMessage::ERROR); |
|
45 |
$this->presenter->redirect('Homepage:login'); |
|
46 |
} |
|
47 |
|
|
48 |
$this->presenter->flashMessage('Přihlášení bylo úspěšné.', EFlashMessage::SUCCESS); |
|
49 |
$this->presenter->redirect('Homepage:default'); |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 |
interface ILoginFormFactory |
|
54 |
{ |
|
55 |
/** |
|
56 |
* @return LoginForm |
|
57 |
*/ |
|
58 |
public function create(); |
|
59 |
} |
app/config/components.neon | ||
---|---|---|
1 | 1 |
services: |
2 | 2 |
# Gridy |
3 |
- App\Components\IExampleGirdFactory |
|
3 |
- App\FrontModule\Components\IExampleGirdFactory
|
|
4 | 4 |
|
5 | 5 |
# Formuláře |
6 |
- App\Components\ILoginFormFactory |
|
6 |
- App\FrontModule\Components\ILoginFormFactory |
app/presenters/Error4xxPresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\Presenters; |
|
4 |
|
|
5 |
use Nette; |
|
6 |
|
|
7 |
|
|
8 |
final class Error4xxPresenter extends Nette\Application\UI\Presenter |
|
9 |
{ |
|
10 |
public function startup() |
|
11 |
{ |
|
12 |
parent::startup(); |
|
13 |
if (!$this->getRequest()->isMethod(Nette\Application\Request::FORWARD)) { |
|
14 |
$this->error(); |
|
15 |
} |
|
16 |
} |
|
17 |
|
|
18 |
|
|
19 |
public function renderDefault(Nette\Application\BadRequestException $exception) |
|
20 |
{ |
|
21 |
// load template 403.latte or 404.latte or ... 4xx.latte |
|
22 |
$file = __DIR__ . "/templates/Error/{$exception->getCode()}.latte"; |
|
23 |
$this->template->setFile(is_file($file) ? $file : __DIR__ . '/templates/Error/4xx.latte'); |
|
24 |
} |
|
25 |
} |
app/presenters/ErrorPresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\Presenters; |
|
4 |
|
|
5 |
use Nette; |
|
6 |
use Nette\Application\Responses; |
|
7 |
use Nette\Http; |
|
8 |
use Tracy\ILogger; |
|
9 |
|
|
10 |
|
|
11 |
final class ErrorPresenter implements Nette\Application\IPresenter |
|
12 |
{ |
|
13 |
use Nette\SmartObject; |
|
14 |
|
|
15 |
/** @var ILogger */ |
|
16 |
private $logger; |
|
17 |
|
|
18 |
|
|
19 |
public function __construct(ILogger $logger) |
|
20 |
{ |
|
21 |
$this->logger = $logger; |
|
22 |
} |
|
23 |
|
|
24 |
|
|
25 |
public function run(Nette\Application\Request $request) |
|
26 |
{ |
|
27 |
$exception = $request->getParameter('exception'); |
|
28 |
|
|
29 |
if ($exception instanceof Nette\Application\BadRequestException) { |
|
30 |
list($module, , $sep) = Nette\Application\Helpers::splitName($request->getPresenterName()); |
|
31 |
return new Responses\ForwardResponse($request->setPresenterName($module . $sep . 'Error4xx')); |
|
32 |
} |
|
33 |
|
|
34 |
$this->logger->log($exception, ILogger::EXCEPTION); |
|
35 |
return new Responses\CallbackResponse(function (Http\IRequest $httpRequest, Http\IResponse $httpResponse) { |
|
36 |
if (preg_match('#^text/html(?:;|$)#', $httpResponse->getHeader('Content-Type'))) { |
|
37 |
require __DIR__ . '/templates/Error/500.phtml'; |
|
38 |
} |
|
39 |
}); |
|
40 |
} |
|
41 |
} |
app/presenters/HomepagePresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\Presenters; |
|
4 |
|
|
5 |
use App\Components\IExampleGirdFactory; |
|
6 |
use App\Components\ILoginFormFactory; |
|
7 |
use App\Enum\EFlashMessage; |
|
8 |
use Nette; |
|
9 |
|
|
10 |
|
|
11 |
final class HomepagePresenter extends Nette\Application\UI\Presenter |
|
12 |
{ |
|
13 |
/** @var IExampleGirdFactory */ |
|
14 |
private $exampleGridFactory; |
|
15 |
/** @var ILoginFormFactory */ |
|
16 |
private $loginFormFactory; |
|
17 |
|
|
18 |
public function __construct(IExampleGirdFactory $exampleGridFactory, ILoginFormFactory $loginFormFactory) |
|
19 |
{ |
|
20 |
parent::__construct(); |
|
21 |
|
|
22 |
$this->exampleGridFactory = $exampleGridFactory; |
|
23 |
$this->loginFormFactory = $loginFormFactory; |
|
24 |
} |
|
25 |
|
|
26 |
public function actionDefault() |
|
27 |
{ |
|
28 |
|
|
29 |
} |
|
30 |
|
|
31 |
public function actionLogin() |
|
32 |
{ |
|
33 |
if ($this->user->isLoggedIn()) |
|
34 |
{ |
|
35 |
$this->redirect('Homepage:default'); |
|
36 |
} |
|
37 |
} |
|
38 |
|
|
39 |
public function actionLogout() |
|
40 |
{ |
|
41 |
if ($this->getUser()->isLoggedIn()) |
|
42 |
{ |
|
43 |
$this->user->logout(true); |
|
44 |
|
|
45 |
$this->flashMessage('Odhlášení bylo úspěšné.', EFlashMessage::SUCCESS); |
|
46 |
$this->redirect('Homepage:default'); |
|
47 |
} |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* Komponenta přihlašovacího formuláře |
|
52 |
* |
|
53 |
* @return \App\Components\LoginForm |
|
54 |
*/ |
|
55 |
public function createComponentLoginForm() |
|
56 |
{ |
|
57 |
return $this->loginFormFactory->create(); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Vytvoření ukázkového gridu |
|
62 |
*/ |
|
63 |
public function createComponentDataGrid() |
|
64 |
{ |
|
65 |
return $this->exampleGridFactory->create(); |
|
66 |
} |
|
67 |
} |
app/presenters/templates/@layout.latte | ||
---|---|---|
1 |
<!DOCTYPE html> |
|
2 |
<html lang="en"> |
|
3 |
<head> |
|
4 |
<meta charset="UTF-8"> |
|
5 |
|
|
6 |
<title>{ifset title}{include title|stripHtml} | {/ifset}Old Babylonian Text Corpus</title> |
|
7 |
|
|
8 |
<!-- jQuery --> |
|
9 |
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" |
|
10 |
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" |
|
11 |
crossorigin="anonymous"></script> |
|
12 |
|
|
13 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.js" |
|
14 |
integrity="sha256-wqAoCRn9//AnHSl4qbXVhqdvmgFQqN5Elqp4Eb2wOXA=" crossorigin="anonymous"></script> |
|
15 |
|
|
16 |
<!-- Bootstrap CDN --> |
|
17 |
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" |
|
18 |
integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> |
|
19 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" |
|
20 |
integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" |
|
21 |
crossorigin="anonymous"></script> |
|
22 |
|
|
23 |
<!-- Bootstrap Select --> |
|
24 |
<link rel="stylesheet" |
|
25 |
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/css/bootstrap-select.min.css"> |
|
26 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/bootstrap-select.min.js"></script> |
|
27 |
|
|
28 |
<!-- Bootstrap Datepicker --> |
|
29 |
<link rel="stylesheet" |
|
30 |
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker3.min.css" |
|
31 |
integrity="sha256-mlKJFBS1jbZwwDrZD1ApO7YFS6MA1XDN37jZ9GDFC64=" crossorigin="anonymous"/> |
|
32 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/js/bootstrap-datepicker.min.js" |
|
33 |
integrity="sha256-tW5LzEC7QjhG0CiAvxlseMTs2qJS7u3DRPauDjFJ3zo=" crossorigin="anonymous"></script> |
|
34 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/locales/bootstrap-datepicker.cs.min.js" |
|
35 |
integrity="sha256-pbW7ult8QcDlimj+JQplrsCieqCvQ/8VGr7ZdTuev8c=" crossorigin="anonymous"></script> |
|
36 |
|
|
37 |
<!-- Font awesome --> |
|
38 |
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" |
|
39 |
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous"> |
|
40 |
|
|
41 |
<link rel="stylesheet" href="{$basePath}/css/front/style.css"> |
|
42 |
|
|
43 |
<script src="https://nette.github.io/resources/js/netteForms.min.js"></script> |
|
44 |
<script src="{$basePath}/js/nette.ajax.js"></script> |
|
45 |
|
|
46 |
</head> |
|
47 |
<body> |
|
48 |
<!--Navbar--> |
|
49 |
<div class="jumbotron jumbotron-fluid header-logo"> |
|
50 |
<div class="container text-center"> |
|
51 |
<div class="display-4"><a href="landing-page.html">Old Babylonian Text Corpus</a></div> |
|
52 |
</div> |
|
53 |
</div> |
|
54 |
<nav class="navbar navbar-expand-lg navbar-dark bg-primary" style="background-color: #003366 !important;"> |
|
55 |
<ul class="navbar-nav mr-auto"> |
|
56 |
<li class="nav-item"> |
|
57 |
<a class="nav-link" href="search-texts.html">Search & edit texts</a> |
|
58 |
</li> |
|
59 |
<li class="nav-item"> |
|
60 |
<a class="nav-link" href="#">Search dictionary</a> |
|
61 |
</li> |
|
62 |
<li class="nav-item"> |
|
63 |
<a class="nav-link" href="#">Text catalogue</a> |
|
64 |
</li> |
|
65 |
<li class="nav-item"> |
|
66 |
<a class="nav-link" href="#">Catalogue of cuneiform signs</a> |
|
67 |
</li> |
|
68 |
<li class="nav-item"> |
|
69 |
<a class="nav-link" href="#">Contact & members</a> |
|
70 |
</li> |
|
71 |
<li class="nav-item"> |
|
72 |
<a class="nav-link" href="#">Input new text</a> |
|
73 |
</li> |
|
74 |
<li class="nav-item"> |
|
75 |
<a class="nav-link" href="admin.html">Admin</a> |
|
76 |
</li> |
|
77 |
</ul> |
|
78 |
{if $user->loggedIn} |
|
79 |
<span class="navbar-text" style="padding-right: 1rem"> |
|
80 |
User: <strong>{$user->getIdentity()->username}</strong> |
|
81 |
</span> |
|
82 |
{/if} |
|
83 |
<div class="navbar-nav nav-item"> |
|
84 |
{if $user->loggedIn} |
|
85 |
<a class="nav-link" n:href="Homepage:logout">Logout</a> |
|
86 |
<a class="nav-link" href="#">Change Password</a> |
|
87 |
{else} |
|
88 |
<a class="nav-link" n:href="Homepage:login">Login</a> |
|
89 |
{/if} |
|
90 |
</div> |
|
91 |
</nav> |
|
92 |
|
|
93 |
<!--Content--> |
|
94 |
<div class="content"> |
|
95 |
<div n:foreach="$flashes as $flash" n:class="alert, 'alert-' . $flash->type">{$flash->message}</div> |
|
96 |
|
|
97 |
{include content} |
|
98 |
</div> |
|
99 |
|
|
100 |
{ifset scripts}{include scripts}{/ifset} |
|
101 |
|
|
102 |
<!--Footer--> |
|
103 |
<footer class="footer"> |
|
104 |
<div class="container"> |
|
105 |
<div class="text-center"> |
|
106 |
© Furat Rahman - Faculty of Philosophy - University of West Bohemia in Pilsen and Cuneiform Circle 2002-2005<br> |
|
107 |
Created by Medici - Faculty of Applied Science - University of West Bohemia in Pilsen |
|
108 |
</div> |
|
109 |
</div> |
|
110 |
</footer> |
|
111 |
</body> |
|
112 |
</html> |
app/presenters/templates/Error/403.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Access Denied</h1> |
|
3 |
|
|
4 |
<p>You do not have permission to view this page. Please try contact the web |
|
5 |
site administrator if you believe you should be able to view this page.</p> |
|
6 |
|
|
7 |
<p><small>error 403</small></p> |
app/presenters/templates/Error/404.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Page Not Found</h1> |
|
3 |
|
|
4 |
<p>The page you requested could not be found. It is possible that the address is |
|
5 |
incorrect, or that the page no longer exists. Please use a search engine to find |
|
6 |
what you are looking for.</p> |
|
7 |
|
|
8 |
<p><small>error 404</small></p> |
app/presenters/templates/Error/405.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Method Not Allowed</h1> |
|
3 |
|
|
4 |
<p>The requested method is not allowed for the URL.</p> |
|
5 |
|
|
6 |
<p><small>error 405</small></p> |
app/presenters/templates/Error/410.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Page Not Found</h1> |
|
3 |
|
|
4 |
<p>The page you requested has been taken off the site. We apologize for the inconvenience.</p> |
|
5 |
|
|
6 |
<p><small>error 410</small></p> |
app/presenters/templates/Error/4xx.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<h1 n:block=title>Oops...</h1> |
|
3 |
|
|
4 |
<p>Your browser sent a request that this server could not understand or process.</p> |
app/presenters/templates/Error/500.phtml | ||
---|---|---|
1 |
<!DOCTYPE html><!-- "' --></textarea></script></style></pre></xmp></a></audio></button></canvas></datalist></details></dialog></iframe></listing></meter></noembed></noframes></noscript></optgroup></option></progress></rp></select></table></template></title></video> |
|
2 |
<meta charset="utf-8"> |
|
3 |
<meta name="robots" content="noindex"> |
|
4 |
<title>Server Error</title> |
|
5 |
|
|
6 |
<style> |
|
7 |
#nette-error { all: initial; position: absolute; top: 0; left: 0; right: 0; height: 70vh; min-height: 400px; display: flex; align-items: center; justify-content: center; z-index: 1000 } |
|
8 |
#nette-error div { all: initial; max-width: 550px; background: white; color: #333; display: block } |
|
9 |
#nette-error h1 { all: initial; font: bold 50px/1.1 sans-serif; display: block; margin: 40px } |
|
10 |
#nette-error p { all: initial; font: 20px/1.4 sans-serif; margin: 40px; display: block } |
|
11 |
#nette-error small { color: gray } |
|
12 |
</style> |
|
13 |
|
|
14 |
<div id=nette-error> |
|
15 |
<div> |
|
16 |
<h1>Server Error</h1> |
|
17 |
|
|
18 |
<p>We're sorry! The server encountered an internal error and |
|
19 |
was unable to complete your request. Please try again later.</p> |
|
20 |
|
|
21 |
<p><small>error 500</small></p> |
|
22 |
</div> |
|
23 |
</div> |
|
24 |
|
|
25 |
<script> |
|
26 |
document.body.insertBefore(document.getElementById('nette-error'), document.body.firstChild); |
|
27 |
</script> |
app/presenters/templates/Error/503.phtml | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
header('HTTP/1.1 503 Service Unavailable'); |
|
4 |
header('Retry-After: 300'); // 5 minutes in seconds |
|
5 |
|
|
6 |
?> |
|
7 |
<!DOCTYPE html> |
|
8 |
<meta charset="utf-8"> |
|
9 |
<meta name="robots" content="noindex"> |
|
10 |
<meta name="generator" content="Nette Framework"> |
|
11 |
|
|
12 |
<style> |
|
13 |
body { color: #333; background: white; width: 500px; margin: 100px auto } |
|
14 |
h1 { font: bold 47px/1.5 sans-serif; margin: .6em 0 } |
|
15 |
p { font: 21px/1.5 Georgia,serif; margin: 1.5em 0 } |
|
16 |
</style> |
|
17 |
|
|
18 |
<title>Site is temporarily down for maintenance</title> |
|
19 |
|
|
20 |
<h1>We're Sorry</h1> |
|
21 |
|
|
22 |
<p>The site is temporarily down for maintenance. Please try again in a few minutes.</p> |
app/presenters/templates/Homepage/default.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<div class="display-5">Old Babylonian Text Corpus by Cuneiform Circle</div> |
|
3 |
<hr> |
|
4 |
|
|
5 |
<div class="row"> |
|
6 |
<div class="col"> |
|
7 |
<dl class="row"> |
|
8 |
<dt class="col-sm-3">OB motto</dt> |
|
9 |
<dd class="col-sm-9">a-na D:na-bi-um-ma-lik a-wi-lim dam-qí-im ša D:AMAR.UTU ù D:na-bi-um GI.DUB.BA-šu ú-še-še-ru (AbB 3,33,1-4)</dd> |
|
10 |
</dl> |
|
11 |
|
|
12 |
<div class="alert alert-primary"> |
|
13 |
If you have interest in Old Babylonian Akkadian Texts, don't hesitate to join us! You are welcome! |
|
14 |
</div> |
|
15 |
</div> |
|
16 |
<div class="col"> |
|
17 |
<form method="get" action="/utf/utf/show2boger.php" onclick="this.target='_blank'" target="_blank"> |
|
18 |
<p class="blue"> |
|
19 |
<label for="borger">Input Borger's ABZ number:</label> |
|
20 |
<input class="td5" type="text" id="borger" name="borger" size="3" value="333"> |
|
21 |
<input class="tlacitko2" type="submit" value=" find "> |
|
22 |
</p> |
|
23 |
<p class="blue"> |
|
24 |
This is a quick search to find variants of signs according to Borger's number from Old Babylonian Graphemic Analyses. |
|
25 |
<a class="noline" href="/utf/utf/signs.html" onclick="this.target='_blank'"> |
|
26 |
Click here for an advanced search.</a> |
|
27 |
|
|
28 |
</p> |
|
29 |
<p> |
|
30 |
<a class="noline" href="/utf/utf/signs.html" target="blank"> |
|
31 |
<img src="http://sp105p02-kbs.ff.zcu.cz/img/gar3.gif" width="335" height="35" alt="signs"> |
|
32 |
</a> |
|
33 |
</p> |
|
34 |
</form> |
|
35 |
</div> |
|
36 |
</div> |
|
37 |
|
|
38 |
<hr> |
|
39 |
|
|
40 |
<p>Cuneiform Circle is a community of scholars engaged in the study of the Old Babylonian Akkadian. Our main goal is to create an Old Babylonian Text Corpus, an Old Babylonian Dictionary, and a List of Old Babylonian Cuneiform Signs.</p> |
|
41 |
|
|
42 |
<p>The Old Babylonian Text Corpus (OBTC) comprises a large text database of the Old Babylonian Akkadian Language (currently 144097 text lines, letters, documents, legal texts, royal inscriptions, omina, mathematical texts etc.).</p> |
|
43 |
|
|
44 |
<p><strong>All texts are available for search according to sign-chains (transliteration). The search engine in Old Babylonian Text Corpus verse 1 is available for everybody but the search is restricted to the following texts: Codex Hammurapi and AbB 5. The search in all 144097 lines of OBTC verse 2 is available for members only (see how to become a member) .</strong></p> |
|
45 |
|
|
46 |
<p><strong>Our service includes unique searchable lists of Old Babylonian Signs Variants as appearing in the hand copies selected for the graphemic analysis.</strong></p> |
|
47 |
|
|
48 |
<p>The work on the project is in progress. We have started in 1988-89 and have accomplished significant advances since. We are currently working towards improving the quality and scope of our databases. The full access to all materials and sources is given to active members only ( see our policy ).</p> |
|
49 |
{/block} |
|
50 |
|
|
51 |
{block scripts} |
|
52 |
<script> |
|
53 |
$(function () |
|
54 |
{ |
|
55 |
$.nette.init(); |
|
56 |
}); |
|
57 |
</script> |
|
58 |
{/block} |
app/presenters/templates/Homepage/login.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<div class="row"> |
|
3 |
<div class="col"> |
|
4 |
<h4>System authorization</h4> |
|
5 |
{control loginForm} |
|
6 |
</div> |
|
7 |
</div> |
Také k dispozici: Unified diff
Re #7332 přidání presenteru a vytvoření submodulů