Skip to content

Commit

Permalink
Basic support to show data recieved by WebHook
Browse files Browse the repository at this point in the history
Release 1.1
  • Loading branch information
Vitexus committed Feb 18, 2017
1 parent 4f7d39c commit 9e829e4
Show file tree
Hide file tree
Showing 13 changed files with 357 additions and 51 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -11,6 +11,7 @@ Umožňuje:
* zobrazovat strukturu evidence
* odesílat přímé požadavky na server a zobrazovat výsledky
* Nastavovat ChangesAPI a přidávat WebHooks
* Zobrazovat data přijatá WebHookem
* Test odpovědi WebHook skriptu zpracovávajícího změny z FlexiBee
* Hromadně zakládat a rušit účetní období
* Rozlišit evidnece které jsou z důvodu licence nedostupné
Expand Down
2 changes: 1 addition & 1 deletion composer.json
@@ -1,7 +1,7 @@
{
"name": "spoje.net/flexplorer",
"description": "Průzkumník a editor evidencí FlexiBee",
"version": "1.0",
"version": "1.1",
"license": "GPL-2.0",
"type": "project",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion debian/conf/composer.json
@@ -1,7 +1,7 @@
{
"name": "vitexsoftware/flexplorer",
"description": "Průzkumník a editor evidencí FlexiBee",
"version": "0.9.0.2",
"version": "1.1",
"type": "project",
"authors": [
{
Expand Down
Binary file modified i18n/cs_CZ/LC_MESSAGES/flexplorer.mo
Binary file not shown.
103 changes: 67 additions & 36 deletions i18n/cs_CZ/LC_MESSAGES/flexplorer.po
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Flexplorer\n"
"POT-Creation-Date: 2016-10-28 16:50+0100\n"
"PO-Revision-Date: 2016-11-23 12:33+0100\n"
"POT-Creation-Date: 2017-02-18 03:26+0100\n"
"PO-Revision-Date: 2017-02-18 03:28+0100\n"
"Last-Translator: Vítězslav Dvořák <info@vitexsoftware.cz>\n"
"Language-Team: Vitex Software <info@vitexsoftware.cz>\n"
"Language: cs_CZ\n"
Expand All @@ -24,11 +24,27 @@ msgstr "O Aplikaci"
msgid "Used Libraries"
msgstr "Použité knihovny"

#: ../src/changesapi.php:26
#: ../src/change.php:22
msgid "Changes recieved"
msgstr "Přijaté změny"

#: ../src/changes.php:32
msgid "FlexiBee WebHook income"
msgstr "Data přijatá WebHookem"

#: ../src/changes.php:38
msgid "Delete All"
msgstr "Smazat všechny"

#: ../src/changes.php:45 ../src/changesapi.php:111
msgid "Target to FlexPlorer"
msgstr "Naseměrovat na FlexPlorer"

#: ../src/changesapi.php:27
msgid "ChangesAPI was enabled"
msgstr "API Změn bylo povoleno"

#: ../src/changesapi.php:32
#: ../src/changesapi.php:33
msgid "ChangesAPI was disabled"
msgstr "API změn bylo zakázáno"

Expand All @@ -37,80 +53,80 @@ msgstr "API změn bylo zakázáno"
msgid "Hook %s was registered"
msgstr "Hook %s byl registrován"

#: ../src/changesapi.php:65
#: ../src/changesapi.php:66
#, php-format
msgid "Hook %s not registered"
msgstr "Hook %s nebyl registrován"

#: ../src/changesapi.php:74
#: ../src/changesapi.php:75
msgid "Hook was unregistered"
msgstr "Hook byl odregistrován"

#: ../src/changesapi.php:76
#: ../src/changesapi.php:77
msgid "Hook was not unregistered"
msgstr "Hook nebyl odregistrován"

#: ../src/changesapi.php:84
#: ../src/changesapi.php:85
msgid "Hook refreshed"
msgstr "Hook občerstven"

#: ../src/changesapi.php:86
#: ../src/changesapi.php:87
msgid "Hook refresh failed"
msgstr "Obnovení hooku nebylo úspěšné"

#: ../src/changesapi.php:91
#: ../src/changesapi.php:92
msgid "ChangesAPI Tool"
msgstr "Nástroj pro API Změn"

#: ../src/changesapi.php:95
#: ../src/changesapi.php:96
msgid "Enable"
msgstr "Povolit"

#: ../src/changesapi.php:95
#: ../src/changesapi.php:96
msgid "Disable"
msgstr "Zakázat"

#: ../src/changesapi.php:95 ../src/classes/ui/MainMenu.php:120
#: ../src/changesapi.php:96 ../src/classes/ui/MainMenu.php:120
msgid "Changes API"
msgstr "API Změn"

#: ../src/changesapi.php:98
#: ../src/changesapi.php:99
msgid ""
"If it is turned on , FlexiBee records all changes made ​​to the database "
"company in the changelog and provides a list of changes recovered"
msgstr ""
"Je-li to zapnuto, FlexiBee zaznamenává všechny změny provedené v databázi "
"firmy do changelogu a umožňuje seznam změn zpětně získat."

#: ../src/changesapi.php:100 ../src/fakechange.php:91
#: ../src/changesapi.php:105 ../src/fakechange.php:91
msgid "Web Hook"
msgstr "Web Hook"

#: ../src/changesapi.php:103
#: ../src/changesapi.php:107
msgid ""
"When the database FlexiBee to change the POST HTTP request sent to all "
"registered URL"
msgstr ""
"dyž dojde v databázi FlexiBee ke změně, je odeslán POST HTTP request na "
"všechna zaregistrovaná URL"

#: ../src/changesapi.php:107 ../src/fakechange.php:64
#: ../src/changesapi.php:114 ../src/fakechange.php:64
msgid "Data format"
msgstr "Formát dat"

#: ../src/changesapi.php:110
#: ../src/changesapi.php:117
msgid "Skip URL test"
msgstr "Přeskoč test URL"

#: ../src/changesapi.php:110
#: ../src/changesapi.php:117
msgid "Suppress URL functionality test"
msgstr "Přeskoč test funkčnosti URL"

#: ../src/changesapi.php:114 ../src/fakechange.php:67
#: ../src/changesapi.php:121 ../src/fakechange.php:67
msgid "Last version"
msgstr "Poslední verze"

#: ../src/changesapi.php:115
#: ../src/changesapi.php:122
#, php-format
msgid ""
"Version of which will begin sending FOLLOW changes , ie. The next higher "
Expand All @@ -122,11 +138,11 @@ msgstr ""
"verze. Defaultní hodnota je rovna aktuální globální verzi (globalVersion) v "
"momentě registrace hooku. Přípustné hodnoty jsou z intervalu: [0, %s]."

#: ../src/changesapi.php:120
#: ../src/changesapi.php:127
msgid "Security Code"
msgstr "Bezečnostní kód"

#: ../src/changesapi.php:121
#: ../src/changesapi.php:128
#, php-format
msgid ""
"Any string (eg. %s) that will be sent with each change notifications in the "
Expand All @@ -137,19 +153,19 @@ msgstr ""
"HTTP hlavičce. Slouží k jednoduchému ověření, zda patří příchozí notifikace "
"Vámi registrovanému hooku. Název klíče v HTTP hlavičce je X-FB-Hook-SecKey."

#: ../src/changesapi.php:126 ../src/ucetniobdobi.php:58
#: ../src/changesapi.php:133 ../src/ucetniobdobi.php:58
msgid "Perform operation"
msgstr "Vykonej operaci"

#: ../src/changesapi.php:140
#: ../src/changesapi.php:147
msgid "Test"
msgstr "Test\t"

#: ../src/changesapi.php:150
#: ../src/changesapi.php:157
msgid "Webhooks registered"
msgstr "Registrované WebHooky"

#: ../src/changesapi.php:153
#: ../src/changesapi.php:160
msgid "ChangesAPI & WebHooks"
msgstr "ChangesAPI & WebHooks"

Expand Down Expand Up @@ -193,6 +209,15 @@ msgstr "Byla použita adresa %s"
msgid "Error %s obataing %s"
msgstr "Chyba %s získání %s"

#: ../src/classes/HookReciever.php:80
#, php-format
msgid "WebHook %s triggered"
msgstr "Webhook byl %s byl přijat"

#: ../src/classes/HookReciever.php:100
msgid "Empty WebHook request"
msgstr "Webhook vrátil prázdnou odezvu"

#: ../src/classes/Searcher.php:109
msgid "No search results"
msgstr "Žádné výsledky vyhledávání"
Expand Down Expand Up @@ -314,7 +339,7 @@ msgstr "Uprav"
#: ../src/classes/ui/DataGrid.php:114
#, fuzzy
msgid "Delete"
msgstr "Smazat záznam"
msgstr "Smazat"

#: ../src/classes/ui/DataGrid.php:123
msgid "Select All"
Expand Down Expand Up @@ -401,11 +426,16 @@ msgstr "Evidence"
msgid "Tools"
msgstr "Nástroje"

#: ../src/classes/ui/MainMenu.php:121 ../src/fakechange.php:53
#: ../src/classes/ui/MainMenu.php:121
#, fuzzy
msgid "Changes Recieved"
msgstr "API Změn"

#: ../src/classes/ui/MainMenu.php:122 ../src/fakechange.php:53
msgid "WebHook test"
msgstr "Test\tWebHooku"

#: ../src/classes/ui/MainMenu.php:122 ../src/ucetniobdobi.php:47
#: ../src/classes/ui/MainMenu.php:123 ../src/ucetniobdobi.php:47
msgid "Accounting period"
msgstr "Účetní období"

Expand Down Expand Up @@ -694,15 +724,15 @@ msgstr "Požadavek"
msgid "WebHook probe"
msgstr "Zkouška webhooku"

#: ../src/index.php:18
#: ../src/index.php:15
msgid "FlexiBee info"
msgstr "FlexiBee info"

#: ../src/index.php:30
#: ../src/index.php:27
msgid "server info"
msgstr "Informace o serveru"

#: ../src/index.php:32
#: ../src/index.php:29
msgid "license info"
msgstr "informace o licenci"

Expand All @@ -723,7 +753,8 @@ msgid "Login History"
msgstr "Historie přihlášení"

#: ../src/login.php:83
msgid "FlexiBee server URL. ex.: https://localhost:5434"
#, fuzzy
msgid "FlexiBee server URL. ex.:"
msgstr "FlexiBee servr URL. např.: https://localhost:5434"

#: ../src/login.php:84
Expand Down Expand Up @@ -856,7 +887,7 @@ msgstr "Nástroj pro hromadné zakládání účetních období"
#: ../src/viewevidence.php:24
#, fuzzy
msgid "Evidence proprties overview"
msgstr "Přehled vlastností evidence"
msgstr "Přehled"

#: ../src/viewevidence.php:32
msgid "Structure"
Expand All @@ -865,7 +896,7 @@ msgstr "Struktura"
#: ../src/viewevidence.php:47
#, fuzzy
msgid "Custom query"
msgstr "Uživatelský požadavek"
msgstr "Dotaz"

#~ msgid "Query does not sent yet"
#~ msgstr "Dotaz nebyl zatím odeslán"
Expand Down
29 changes: 29 additions & 0 deletions src/change.php
@@ -0,0 +1,29 @@
<?php

namespace Flexplorer;

/**
* Flexplorer - Show WebHook data recieved.
*
* @author Vítězslav Dvořák <vitex@arachne.cz>
* @copyright 2016-2017 Vitex Software
*/
require_once 'includes/Init.php';

$oPage->onlyForLogged();

$file = $oPage->getRequestValue('file');
$sender = new Flexplorer();
$sender->lastResponseCode = 200;
$sender->lastCurlResponse = json_encode(json_decode(file_get_contents(sys_get_temp_dir().'/'.basename($file))),
JSON_PRETTY_PRINT);


$oPage->addItem(new ui\PageTop(_('Changes recieved').': '.$file));


$oPage->container->addItem(new ui\ShowResponse($sender));

$oPage->addItem(new ui\PageBottom());

$oPage->draw();
52 changes: 52 additions & 0 deletions src/changes.php
@@ -0,0 +1,52 @@
<?php
/**
* Flexplorer - Hlavní strana.
*
* @author Vítězslav Dvořák <vitex@arachne.cz>
* @copyright 2016-2017 Vitex Software
*/

namespace Flexplorer;

require_once 'includes/Init.php';

$delete = $oPage->getRequestValue('delete');

$oPage->onlyForLogged();

$chages = [];

$d = dir(sys_get_temp_dir());
while (false !== ($entry = $d->read())) {
if (strstr($entry, 'flexplorer-change')) {
if ($delete === 'all') {
unlink(sys_get_temp_dir().'/'.$entry);
} else {
$chages[] = $entry;
}
}
}
$d->close();


$oPage->addItem(new ui\PageTop(_('FlexiBee WebHook income')));

$oPage->container->addItem(new ui\ChangesLister($chages));

if (count($chages)) {
$oPage->container->addItem(new \Ease\TWB\LinkButton('?delete=all',
_('Delete All'), 'danger'));
} else {

$webHookUrl = str_replace(basename(__FILE__), 'webhook.php',
\Ease\Page::phpSelf());

$oPage->container->addItem(new \Ease\TWB\LinkButton("changesapi.php?hookurl=".urlencode($webHookUrl),
_('Target to FlexPlorer'), 'success', ['class' => 'button button-xs']));


$oPage->addStatusMessage('WebHook not triggered yet');
}
$oPage->addItem(new ui\PageBottom());

$oPage->draw();

0 comments on commit 9e829e4

Please sign in to comment.