Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/).
1 change: 1 addition & 0 deletions app/config/config.ci.local.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
skautis:
applicationId: c9f6e8b1-2863-4fa6-9b5f-8b7e6f6aac91
testMode: true
cache: true

parameters:
sendEmail: FALSE
1 change: 1 addition & 0 deletions app/config/config.local.example.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ skautis:
applicationId : c9f6e8b1-2863-4fa6-9b5f-8b7e6f6aac91
testMode : true #isTestMode?
profiler: true
cache: true

tracy:
bar:
Expand Down
31 changes: 19 additions & 12 deletions app/config/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
strictMode: TRUE
maxDepth: 6
maxLen: 500
session:
autoStart: smart
expiration: "+ 3 days"



application:
mapping:
*: App\*Module\*Presenter
debugger: true

di:
debugger: true

tracy:
email: [email protected] #[email protected]
strictMode: true
maxDepth: 6
maxLength: 500

extensions:
skautis: Skautis\Nette\SkautisExtension
Expand Down
3 changes: 2 additions & 1 deletion app/model/BaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion app/model/Mail/MailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion app/model/Mail/mail.request.latte
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
</tr>
</table>
<hr/>
<p>Odesláno z formuláře na {$baseUri}</p>
<p>Odesláno z formuláře na {$baseUrl}</p>
</body>
</html>
6 changes: 4 additions & 2 deletions app/model/SkautISAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
*/
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);
Expand Down
4 changes: 2 additions & 2 deletions app/model/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -58,7 +58,7 @@ public function getPersonalDetail()

/**
* kontroluje jestli je přihlášení platné
* @return type
* @return bool
*/
public function isLoggedIn($hardCheck = FALSE)
{
Expand Down
62 changes: 31 additions & 31 deletions app/presenters/BasePresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App;

use Nette;
use WebLoader;
//use WebLoader;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proč nahrazovat webloader za include jednotlivých souborů? to je cesta zpět za mě

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Protože WebLoader mel posledni commit před několika lety a neni kompatibilni s Nette 3.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u hospodareni mame webpack nebo pak fmasa jeste doporucoval gulp


abstract class BasePresenter extends Nette\Application\UI\Presenter
{
Expand Down Expand Up @@ -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);
// }

}
5 changes: 3 additions & 2 deletions app/presenters/TestPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Nette\Application\UI\Form;
use Nette\Neon\Neon;
use Skautis\Skautis;
use Skautis\Wsdl\WebServiceName;
use Tracy\Debugger;

/**
Expand All @@ -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()
Expand All @@ -53,7 +54,7 @@ public function createComponentTestForm($name)
$form->getElementPrototype()->class("aja");
$form->addSelect("wsdl", "WSDL", $this->wsdl)
->addRule(Form::FILLED, "Musís vybrat WSDL")
->setDefaultValue("9");
->setDefaultValue("12");
$form->addText("service", "Funkce")
->setDefaultValue("unitAll")
->addRule(FORM::FILLED, "Vypln service");
Expand Down
3 changes: 1 addition & 2 deletions app/router/RouterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class RouterFactory
*/
public function __construct($ssl)
{
// Disable https for development
Route::$defaultFlags = $ssl ? Route::SECURED : 0;

}

/**
Expand Down
16 changes: 14 additions & 2 deletions app/templates/@layout.latte
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@
<title>{block #title|striptags|trim}SkautIS Web Services{/block}</title>
<meta name="keywords" content=""/>
<meta name="author" content="www.sinacek.cz"/>
{control css}
{control js}

<link rel="stylesheet" href="{$baseUrl}/css/bootstrap.min.css">
<link rel="stylesheet" href="{$baseUrl}/css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="{$baseUrl}/css/jquery-ui-1.8.css">
<link rel="stylesheet" href="{$baseUrl}/css/site.css">

<script type="text/javascript" src="{$baseUrl}/js/jquery-v1.11.1.js"></script>
<script type="text/javascript" src="{$baseUrl}/js/jquery.ui.min.js"></script>
<script type="text/javascript" src="{$baseUrl}/js/bootstrap.js"></script>
<script type="text/javascript" src="{$baseUrl}/js/combobox.js"></script>
<script type="text/javascript" src="{$baseUrl}/js/nette.ajax.js"></script>
<script type="text/javascript" src="{$baseUrl}/js/netteForms.js"></script>
<script type="text/javascript" src="{$baseUrl}/js/my.js"></script>

<script type="text/javascript">
function changeRole(id) {
$.post({link changeRole!}, { roleId: id});
Expand Down
6 changes: 3 additions & 3 deletions app/templates/Default/default.latte
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
Pro použití knihovny v projektu s Nette využijte rozšíření, které najdete na <a
href="https://github.com/skaut/SkautisNette">github.com/skaut/SkautisNete</a>. Rozšíření přidává
skautIS panel do debug baru Nette.<br/>
<img src='{$baseUri}/images/data/skautis-panel.png'/>
<img src='{$baseUrl}/images/data/skautis-panel.png'/>
</ul>

<h3 id="asp">ASP.NET (C#)</h3>
<ul>

<li><strong>Registr organizačních jednotek</strong><br>
Zdrojové kódy demo aplikace "Registr organizačních jednotek" stáhnete <a href="{$baseUri}/_upload/UnitRegistry_Code.zip">zde</a>. Autorem aplikace
Zdrojové kódy demo aplikace "Registr organizačních jednotek" stáhnete <a href="{$baseUrl}/_upload/UnitRegistry_Code.zip">zde</a>. Autorem aplikace
je Jerry - Ondřej Peřina.
</li>
</ul>
Expand All @@ -62,7 +62,7 @@
</ul>
<h2>4) Další materiály </h2>
<ul>
<li><a href="{$baseUri}/_upload/user-type.docx">Textová dokumentace: Jak získat informace o typu uživatele ze skautISu</a> (Jerry)</li>
<li><a href="{$baseUrl}/_upload/user-type.docx">Textová dokumentace: Jak získat informace o typu uživatele ze skautISu</a> (Jerry)</li>
</ul>
</div>
</div>
2 changes: 1 addition & 1 deletion app/templates/Error/@layout.latte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="keywords" content="404"/>
<meta name="author" content="www.sinacek.cz"/>
<meta name="robots" content="{$robots}" n:ifset="$robots">
<link rel="stylesheet" type="text/css" href="{$baseUri}/css/error.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="{$baseUrl}/css/error.css" media="screen"/>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2900685-25']);
Expand Down
2 changes: 1 addition & 1 deletion app/templates/Test.default.latte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@


<h2>Návod k testovacímu rozhraní</h2>
<img src="{$baseUri}/images/data/tutorial.png" alt="obrázek testovacího rozhraní" class="well"/>
<img src="{$baseUrl}/images/data/tutorial.png" alt="obrázek testovacího rozhraní" class="well"/>
<ol>
<li>(Povinné) Výběr webové služby - kompletní seznam je na <a href="https://test-is.skaut.cz/JunakWebservice/">test-is.skaut.cz/JunakWebservice/</a>
</li>
Expand Down
19 changes: 8 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
{
"name": "ws.skautis.cz",
"name": "skaut/ws.skautis.cz",
"type": "project",
"require": {
"php": ">= 5.6",
"nette/nette": "2.3.*",
"skautis/skautis": "2.*@dev",
"skautis/nette": "2.*@dev",
"janmarek/webloader": "2.5.*",
"php": ">= 7.2",
"nette/nette": "^3.0",
"skautis/skautis": "3.0.0-alpha",
"skautis/nette": "3.0.0-alpha",
"nextras/mail-panel": "^2.3",
"dibi/dibi": "3.0.*"
"dibi/dibi": "^3.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.8",
"codeception/codeception": "^2.2",
"codeception/mockery-module": "^0.2.2"
"squizlabs/php_codesniffer": "^3.4"
},
"minimum-stability": "RC"
"minimum-stability": "stable"
}
Loading