diff --git a/README.md b/README.md new file mode 100644 index 0000000..fb4d325 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# ws.skautis.cz +Webová aplikace pro vývojáře chtějící pracovat s informačním systémem [SkautIS](https://is.skaut.cz/). +Aplikace je dostupná na [ws.skautis.cz](https://ws.skautis.cz/) + +Aplikace poskytuje: + - Základní informace pro vývojáře. + - Testovací rozhraní pro zkoušení API callů. + - Formulář pro žádost o povolení aplikace (získání ``ID_Application`` / ``appId``) + +## Lokální environment +Pro lokální spuštění je potřeba [docker](https://www.docker.com/) a [docker-compose](https://docs.docker.com/compose/). + +```bash +# Spustí container +docker-compose up -d +``` + +Aplikace je poté dostupná na [http://127.0.0.1/](http://127.0.0.1/). \ No newline at end of file diff --git a/app/config/config.ci.local.neon b/app/config/config.ci.local.neon index 76cd6a4..1a84ef5 100644 --- a/app/config/config.ci.local.neon +++ b/app/config/config.ci.local.neon @@ -1,6 +1,7 @@ skautis: applicationId: c9f6e8b1-2863-4fa6-9b5f-8b7e6f6aac91 testMode: true + cache: true parameters: sendEmail: FALSE diff --git a/app/config/config.local.example.neon b/app/config/config.local.example.neon index bb57147..0322eb5 100644 --- a/app/config/config.local.example.neon +++ b/app/config/config.local.example.neon @@ -5,6 +5,7 @@ skautis: applicationId : c9f6e8b1-2863-4fa6-9b5f-8b7e6f6aac91 testMode : true #isTestMode? profiler: true + cache: true tracy: bar: diff --git a/app/config/config.neon b/app/config/config.neon index 8c7c72f..ab21bc8 100644 --- a/app/config/config.neon +++ b/app/config/config.neon @@ -10,18 +10,25 @@ php: date.timezone: Europe/Prague # zlib.output_compression: yes -nette: - session: - autoStart: smart - expiration: "+ 3 days" - application: - mapping: - *: App\*Module\*Presenter - debugger: - email: sinacek@gmail.com - strictMode: TRUE - maxDepth: 6 - maxLen: 500 +session: + autoStart: smart + expiration: "+ 3 days" + + + +application: + mapping: + *: App\*Module\*Presenter + debugger: true + +di: + debugger: true + +tracy: + email: sinacek@gmail.com + strictMode: true + maxDepth: 6 + maxLength: 500 extensions: skautis: Skautis\Nette\SkautisExtension diff --git a/app/model/BaseService.php b/app/model/BaseService.php index 2a107cf..ffadc05 100644 --- a/app/model/BaseService.php +++ b/app/model/BaseService.php @@ -3,8 +3,9 @@ /** * @author Hána František */ -abstract class BaseService extends Nette\Object +abstract class BaseService { + use Nette\SmartObject; /** * reference na třídu typu Table diff --git a/app/model/Mail/MailService.php b/app/model/Mail/MailService.php index ebe74fd..71919e5 100644 --- a/app/model/Mail/MailService.php +++ b/app/model/Mail/MailService.php @@ -3,8 +3,9 @@ use Nette\Application\UI\ITemplate; use Nette\Mail\Message; -class MailService extends Nette\Object +class MailService { + use Nette\SmartObject; public $mailer; diff --git a/app/model/Mail/mail.request.latte b/app/model/Mail/mail.request.latte index 93c1783..5d99b3e 100644 --- a/app/model/Mail/mail.request.latte +++ b/app/model/Mail/mail.request.latte @@ -44,6 +44,6 @@
-

Odesláno z formuláře na {$baseUri}

+

Odesláno z formuláře na {$baseUrl}

diff --git a/app/model/SkautISAuthenticator.php b/app/model/SkautISAuthenticator.php index a72143a..ccfacdc 100755 --- a/app/model/SkautISAuthenticator.php +++ b/app/model/SkautISAuthenticator.php @@ -3,15 +3,17 @@ namespace Sinacek; use Nette; +use Nette\Security\IIdentity; /** * používat pouze pro data ze skautISu, nikdy nenechávat aby uživatel zadal sám svoje ID! * @author Hána František */ -class SkautisAuthenticator extends Nette\Object implements Nette\Security\IAuthenticator +class SkautisAuthenticator implements Nette\Security\IAuthenticator { + use Nette\SmartObject; - public function authenticate(array $credentials) + public function authenticate(array $credentials): IIdentity { $data = $credentials[0]; return new Nette\Security\Identity($data->ID_User); diff --git a/app/model/UserService.php b/app/model/UserService.php index 0f4f4d1..9c9752d 100644 --- a/app/model/UserService.php +++ b/app/model/UserService.php @@ -8,7 +8,7 @@ class UserService extends BaseService /** * varcí ID role aktuálně přihlášeného uživatele - * @return type + * @return int|null */ public function getRoleId() { @@ -58,7 +58,7 @@ public function getPersonalDetail() /** * kontroluje jestli je přihlášení platné - * @return type + * @return bool */ public function isLoggedIn($hardCheck = FALSE) { diff --git a/app/presenters/BasePresenter.php b/app/presenters/BasePresenter.php index 5353b1a..e9f6e20 100644 --- a/app/presenters/BasePresenter.php +++ b/app/presenters/BasePresenter.php @@ -3,7 +3,7 @@ namespace App; use Nette; -use WebLoader; +//use WebLoader; abstract class BasePresenter extends Nette\Application\UI\Presenter { @@ -59,36 +59,36 @@ public function beforeRender() } } - public function createComponentCss() - { - $files = new WebLoader\FileCollection(WWW_DIR . '/css'); - $compiler = WebLoader\Compiler::createCssCompiler($files, WWW_DIR . '/webtemp'); - - $control = new WebLoader\Nette\CssLoader($compiler, $this->webtempUrl); - $control->setMedia('screen'); - $files->addFiles([ - 'bootstrap.min.css', - 'bootstrap-responsive.min.css', - 'jquery-ui-1.8.css', - 'site.css' - ]); - return $control; - } +// public function createComponentCss() +// { +// $files = new WebLoader\FileCollection(WWW_DIR . '/css'); +// $compiler = WebLoader\Compiler::createCssCompiler($files, WWW_DIR . '/webtemp'); +// +// $control = new WebLoader\Nette\CssLoader($compiler, $this->webtempUrl); +// $control->setMedia('screen'); +// $files->addFiles([ +// 'bootstrap.min.css', +// 'bootstrap-responsive.min.css', +// 'jquery-ui-1.8.css', +// 'site.css' +// ]); +// return $control; +// } - public function createComponentJs() - { - $files = new WebLoader\FileCollection(WWW_DIR . '/js'); - $compiler = WebLoader\Compiler::createJsCompiler($files, WWW_DIR . '/webtemp'); - $files->addFiles([ - 'jquery-v1.11.1.js', - 'jquery.ui.min.js', - 'bootstrap.js', - 'combobox.js', - 'nette.ajax.js', - 'netteForms.js', - 'my.js', - ]); - return new WebLoader\Nette\JavaScriptLoader($compiler, $this->webtempUrl); - } +// public function createComponentJs() +// { +// $files = new WebLoader\FileCollection(WWW_DIR . '/js'); +// $compiler = WebLoader\Compiler::createJsCompiler($files, WWW_DIR . '/webtemp'); +// $files->addFiles([ +// 'jquery-v1.11.1.js', +// 'jquery.ui.min.js', +// 'bootstrap.js', +// 'combobox.js', +// 'nette.ajax.js', +// 'netteForms.js', +// 'my.js', +// ]); +// return new WebLoader\Nette\JavaScriptLoader($compiler, $this->webtempUrl); +// } } diff --git a/app/presenters/TestPresenter.php b/app/presenters/TestPresenter.php index d839e62..7d863ca 100644 --- a/app/presenters/TestPresenter.php +++ b/app/presenters/TestPresenter.php @@ -5,6 +5,7 @@ use Nette\Application\UI\Form; use Nette\Neon\Neon; use Skautis\Skautis; +use Skautis\Wsdl\WebServiceName; use Tracy\Debugger; /** @@ -31,7 +32,7 @@ protected function startup() $this->skautis->init($post); } $this->template->skautIsAppId = $this->skautis->getConfig()->getAppId(); - $this->wsdl = $this->skautis->getWsdlManager()->getSupportedWebServices(); + $this->wsdl = array_values(WebServiceName::getConstants()); } public function renderDefault() @@ -53,7 +54,8 @@ public function createComponentTestForm($name) $form->getElementPrototype()->class("aja"); $form->addSelect("wsdl", "WSDL", $this->wsdl) ->addRule(Form::FILLED, "Musís vybrat WSDL") - ->setDefaultValue("9"); + // Pozice OrganisationUnit v poli. + ->setDefaultValue("12"); $form->addText("service", "Funkce") ->setDefaultValue("unitAll") ->addRule(FORM::FILLED, "Vypln service"); diff --git a/app/router/RouterFactory.php b/app/router/RouterFactory.php index 2c4c793..c24b6be 100644 --- a/app/router/RouterFactory.php +++ b/app/router/RouterFactory.php @@ -18,8 +18,7 @@ class RouterFactory */ public function __construct($ssl) { - // Disable https for development - Route::$defaultFlags = $ssl ? Route::SECURED : 0; + } /** diff --git a/app/templates/@layout.latte b/app/templates/@layout.latte index 7308b47..a7f59a1 100644 --- a/app/templates/@layout.latte +++ b/app/templates/@layout.latte @@ -5,8 +5,20 @@ {block #title|striptags|trim}SkautIS Web Services{/block} - {control css} - {control js} + + + + + + + + + + + + + +