Skip to content

Commit 96ef24a

Browse files
committed
Source Directory renamed for PSR4
1 parent 41ba795 commit 96ef24a

22 files changed

+1075
-5
lines changed

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,12 @@ composer.lock
1717
/debian/ease-framework-bricks-doc.substvars
1818
/debian/ease-framework-bricks-doc.debhelper.log
1919
/debian/ease-framework-bricks-doc/
20-
/debian/ease-framework-bricks/
20+
/debian/ease-framework-bricks/
21+
/debian/php-ease-bootstrap-widgets/
22+
/debian/php-ease-bootstrap-widgets-doc/
23+
/debian/.debhelper/
24+
/debian/php-ease-bootstrap-widgets.debhelper.log
25+
/debian/php-ease-bootstrap-widgets-doc.debhelper.log
26+
/debian/php-ease-bootstrap-widgets-doc.substvars
27+
/debian/php-ease-bootstrap-widgets.substvars
28+
/debian/files

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"autoload": {
1212
"psr-4": {
13-
"Ease\\TWB\\Widgets\\": "src/Ease/ui"
13+
"Ease\\TWB\\Widgets\\": "src/Ease/TWB/Widgets"
1414
}
1515
},
1616
"autoload-dev": {
@@ -20,12 +20,12 @@
2020
"Test\\Ease\\TWB\\": "vendor/vitexsoftware/ease-framework/tests/src/Ease/TWB"
2121
}
2222
},
23-
"minimum-stability": "dev",
23+
"minimum-stability": "stable",
2424
"require": {
25-
"vitexsoftware/ease-bootstrap": "*"
25+
"vitexsoftware/ease-bootstrap": ">=0.4.3"
2626
},
2727
"require-dev": {
28-
"phpunit/phpunit": "^8"
28+
"phpunit/phpunit": ">=9"
2929
},
3030
"type": "library",
3131
"homepage": "http://v.s.cz/ease.php",

debian/rules

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ override_dh_auto_test:
1111

1212
override_dh_install:
1313
#./debian/apigendoc.sh
14+
jq '.address = "'`dpkg-parsechangelog | sed -n 's/^Version: //p'`'"' debian/composer.json |sponge debian/composer.json
1415
dh_install
1516
sed -e "/includeCss/c\ \$$this->includeCss(\'\/javascript\/bootstrap\/css\/bootstrap-switch.css\');" -i debian/php-ease-bootstrap-widgets/usr/share/php/EaseTWBWidgets/TWBSwitch.php
1617
sed -e "/includeJavascript/c\ \$$this->includeJavascript(\'\/javascript\/bootstrap\/js\/bootstrap-switch.js\');" -i debian/php-ease-bootstrap-widgets/usr/share/php/EaseTWBWidgets/TWBSwitch.php
18+
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
/**
3+
* EasePHP Bricks - Browsing History.
4+
*
5+
* @author Vítězslav Dvořák <vitex@arachne.cz>
6+
* @copyright 2016-2018 Vitex Software
7+
*/
8+
9+
namespace Ease\TWB\Widgets;
10+
11+
/**
12+
* Show history of visited pages in app
13+
*
14+
* @param mixed $content
15+
* @param array $properties
16+
*/
17+
class BrowsingHistory extends \Ease\Html\DivTag
18+
{
19+
20+
/**
21+
* Show history of visited pages in app
22+
*
23+
* @param mixed $content
24+
* @param array $properties
25+
*/
26+
public function __construct($content = null, $properties = null)
27+
{
28+
$webPage = \Ease\WebPage::singleton();
29+
if (is_null($properties)) {
30+
$properties = [];
31+
}
32+
$properties['id'] = 'history';
33+
34+
if (!isset($_SESSION['history'])) {
35+
$_SESSION['history'] = [];
36+
}
37+
38+
parent::__construct(null, $properties);
39+
40+
$currentUrl = \Ease\Document::phpSelf(false);
41+
$currentTitle = $webPage->pageTitle;
42+
43+
44+
foreach ($_SESSION['history'] as $hid => $page) {
45+
if ($page['url'] == $currentUrl) {
46+
unset($_SESSION['history'][$hid]);
47+
}
48+
}
49+
array_unshift($_SESSION['history'],
50+
['url' => $currentUrl, 'title' => $currentTitle]);
51+
foreach ($_SESSION['history'] as $bookmark) {
52+
$this->addItem(new \Ease\Html\SpanTag(new \Ease\Html\ATag($bookmark['url'],
53+
[new \Ease\TWB\GlyphIcon('bookmark'), ' '.$bookmark['title']]),
54+
['class' => 'hitem']));
55+
}
56+
}
57+
58+
/**
59+
* Add Css
60+
*/
61+
function finalize()
62+
{
63+
$this->addCss('
64+
.hitem { background-color: #B5FFC4; margin: 5px; border-radius: 15px 50px 30px 5px; padding-left: 3px; padding-right: 10px; }
65+
#history { margin: 5px; }
66+
');
67+
parent::finalize();
68+
}
69+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/*
3+
* To change this license header, choose License Headers in Project Properties.
4+
* To change this template file, choose Tools | Templates
5+
* and open the template in the editor.
6+
*/
7+
8+
namespace Ease\TWB\Widgets;
9+
10+
/**
11+
* Description of LangSelect
12+
*
13+
* @author vitex
14+
*/
15+
class LangSelect extends \Ease\Html\UlTag
16+
{
17+
18+
public function __construct($properties = [])
19+
{
20+
parent::__construct(null, $properties);
21+
$locale = \Ease\Shared::locale();
22+
foreach ($locale->availble() as $code => $name) {
23+
$name = substr($name, 0, strpos($name,' ('));
24+
if (\Ease\Locale::$localeUsed == $code) {
25+
$this->addItemSmart(new \Ease\Html\StrongTag(new \Ease\Html\ATag('?locale='.$code,
26+
$name)));
27+
} else {
28+
$this->addItemSmart(new \Ease\Html\ATag('?locale='.$code, $name));
29+
}
30+
}
31+
}
32+
}

src/Ease/TWB/Widgets/LiveAge.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* EasePHPbricks - Live Age
4+
*
5+
* @author Vítězslav Dvořák <vitex@arachne.cz>
6+
* @copyright 2018 Vitex Software
7+
*/
8+
9+
namespace Ease\TWB\Widgets;
10+
11+
/**
12+
* LiveAge
13+
*
14+
* @author Vítězslav Dvořák <info@vitexsoftware.cz>
15+
*/
16+
class LiveAge extends \Ease\Html\TimeTag
17+
{
18+
19+
/**
20+
* Show live time to timestamp
21+
*
22+
* @param long $timestamp UnixTime
23+
* @param array $properties TimeTag properties
24+
*/
25+
public function __construct($timestamp, $properties = [])
26+
{
27+
$age = time() - $timestamp;
28+
$days = floor($age / 86400);
29+
$dater = new \DateTime();
30+
$dater->setTimestamp($timestamp);
31+
$properties['datetime'] = $dater->format('Y-m-d\TH:i:s');
32+
parent::__construct($days.' '._('days').', '.gmdate("G:i:s", $age),
33+
$properties);
34+
$this->setTagID();
35+
36+
$this->addJavaScript('
37+
var timestamp'.$this->getTagID().' = '.$age.';
38+
39+
function component(x, v) {
40+
return Math.floor(x / v);
41+
}
42+
43+
var $div'.$this->getTagID().' = $(\'#'.$this->getTagID().'\');
44+
45+
setInterval(function() {
46+
47+
timestamp'.$this->getTagID().'++;
48+
49+
var days'.$this->getTagID().' = component(timestamp'.$this->getTagID().', 24 * 60 * 60),
50+
hours'.$this->getTagID().' = component(timestamp'.$this->getTagID().', 60 * 60) % 24,
51+
minutes'.$this->getTagID().' = component(timestamp'.$this->getTagID().', 60) % 60,
52+
seconds'.$this->getTagID().' = component(timestamp'.$this->getTagID().', 1) % 60;
53+
54+
$div'.$this->getTagID().'.html(days'.$this->getTagID().' + " '._('days').', " + hours'.$this->getTagID().' + ":" + minutes'.$this->getTagID().' + ":" + seconds'.$this->getTagID().');
55+
56+
}, 1000);
57+
');
58+
}
59+
}

src/Ease/TWB/Widgets/MainMenu.php

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?php
2+
/**
3+
* EaseBricks - Main menu.
4+
*
5+
* @author Vítězslav Dvořák <vitex@arachne.cz>
6+
* @copyright 2015 Spoje.Net
7+
*/
8+
9+
namespace Ease\TWB\Widgets;
10+
11+
class MainMenu extends \Ease\Html\NavTag
12+
{
13+
14+
/**
15+
* Vytvoří hlavní menu.
16+
*/
17+
public function __construct()
18+
{
19+
parent::__construct(null, ['id' => 'MainMenu']);
20+
}
21+
22+
/**
23+
* Vložení menu.
24+
*/
25+
public function afterAdd()
26+
{
27+
$nav = $this->addItem(new BootstrapMenu());
28+
$user = \Ease\Shared::user();
29+
$userID = \Ease\Shared::user()->getUserID();
30+
31+
switch (get_class($user)) {
32+
case 'SpojeNet\System\User': //Admin
33+
$nav->addMenuItem(new NavBarSearchBox('search', 'search.php'));
34+
$nav->addDropDownMenu('<img width=30 src=images/gear.svg> '._('Scripts'),
35+
[
36+
'invoicematch.php' => \Ease\TWB\Part::GlyphIcon('piggy-bank').' '._('Invoice matching (Take so long)'),
37+
// 'invoice2flexibee.php' => \Ease\TWB\Part::GlyphIcon('plus') . '&nbsp;' . _('Faktury do Flexibee'),
38+
// 'address2flexibee.php' => \Ease\TWB\Part::GlyphIcon('plus') . '&nbsp;' . _('Adresář do Flexibee'),
39+
]
40+
);
41+
$nav->addDropDownMenu('<img width=30 src=images/contract_150.png> '._('Oders'),
42+
array_merge([
43+
'contracttodo.php' => new \Ease\Html\ImgTag('images/copying.svg',
44+
'TODO', ['height' => '20px']).'&nbsp; '._('Orders TODO'),
45+
// 'zavazky.php' => \Ease\TWB\Part::GlyphIcon('transfer').' '._('Měsíční závazky'),
46+
// 'pohledavky.php' => \Ease\TWB\Part::GlyphIcon('transfer').' '._('Měsíční pohledávky'),
47+
// 'contract-reset.php' => \Ease\TWB\Part::GlyphIcon('repeat').' '._('Reset autogenerace'),
48+
// 'contract.php' => \Ease\TWB\Part::GlyphIcon('plus').' '._('Nová smlouva'),
49+
// 'contracts.php' => \Ease\TWB\Part::GlyphIcon('list').'&nbsp;'._('Přehled smluv'),
50+
// 'rspcntrcts.php' => \Ease\TWB\Part::GlyphIcon('user').'&nbsp;'._('Respondenti'),
51+
])
52+
);
53+
$nav->addDropDownMenu('<img width=30 src=images/order.svg> '._('Proposal'),
54+
[
55+
'adminpricelist.php' => \Ease\TWB\Part::GlyphIcon('th-list').' '._('Pricelist'),
56+
]
57+
);
58+
59+
$nav->addDropDownMenu('<img width=30 src=images/users_150.png> '._('Users'),
60+
array_merge([
61+
'createaccount.php' => \Ease\TWB\Part::GlyphIcon('plus').' '._('New user'),
62+
'users.php' => \Ease\TWB\Part::GlyphIcon('list').'&nbsp;'._('User overview'),
63+
'' => '',
64+
], $this->getMenuList(\Ease\Shared::user(), 'user'))
65+
);
66+
break;
67+
case 'SpojeNet\System\Customer': //Customer
68+
$nav->addMenuItem(new \Ease\Html\ATag('pricelist.php',
69+
'<img width=30 src=images/cennik.png> '._('Pricelist')));
70+
71+
$subregId = $user->adresar->getExternalID('subreg');
72+
$ipexId = $user->adresar->getExternalID('ipex');
73+
$lmsId = $user->adresar->getExternalID('lms.cstmr');
74+
75+
if ($subregId || $ipexId) {
76+
$productsMenuItems = [];
77+
if ($ipexId) {
78+
$productsMenuItems['voip.php'] = \Ease\TWB\Part::GlyphIcon('th-list').' '._('VoIP');
79+
}
80+
if ($subregId) {
81+
$productsMenuItems['dns.php'] = \Ease\TWB\Part::GlyphIcon('th-list').' '._('Domains');
82+
}
83+
$nav->addDropDownMenu('<img width=30 src=images/products.svg> '._('Products'),
84+
$productsMenuItems);
85+
}
86+
87+
if ($lmsId) {
88+
$statsMenuItems['isp.php'] = \Ease\TWB\Part::GlyphIcon('th-list').' '._('Traffic');
89+
$nav->addDropDownMenu('<img width=30 src=images/stats.svg> '._('Stats'),
90+
$statsMenuItems);
91+
}
92+
93+
$nav->addDropDownMenu('<img width=30 src=images/order.svg> '._('Orders'),
94+
[
95+
'orderform.php' => \Ease\TWB\Part::GlyphIcon('plus').' '._('New order'),
96+
// 'pricelist.php' => \Ease\TWB\Part::GlyphIcon('th-list').' '._('Pricelist'),
97+
'myorders.php' => \Ease\TWB\Part::GlyphIcon('list').'&nbsp;'._('My orders')]
98+
);
99+
100+
break;
101+
case 'Ease\Anonym': //Anonymous
102+
default:
103+
break;
104+
}
105+
}
106+
107+
/**
108+
* Přidá do stránky javascript pro skrývání oblasti stavových zpráv.
109+
*/
110+
public function finalize()
111+
{
112+
$this->addCss('body {
113+
padding-top: 60px;
114+
padding-bottom: 40px;
115+
}');
116+
117+
\Ease\JQuery\Part::jQueryze($this);
118+
\Ease\Shared::webPage()->addCss('.dropdown-menu { overflow-y: auto } ');
119+
\Ease\Shared::webPage()->addJavaScript("$('.dropdown-menu').css('max-height',$(window).height()-100);",
120+
null, true);
121+
$this->includeJavaScript('js/slideupmessages.js');
122+
}
123+
}

0 commit comments

Comments
 (0)