modifs.mineures sans commentaires
This commit is contained in:
parent
92ad052682
commit
70e9c4d268
|
@ -71,6 +71,9 @@ abstract class Application {
|
|||
*/
|
||||
const USE_RUNLOCK = false;
|
||||
|
||||
/** @var bool faut-il installer le gestionnaire de signaux? */
|
||||
const USE_SIGNAL_HANDLER = false;
|
||||
|
||||
protected static function _app_init(): void {
|
||||
config::set_fact(config::FACT_CLI_APP);
|
||||
|
||||
|
@ -137,10 +140,26 @@ abstract class Application {
|
|||
static function run(?Application $app=null): void {
|
||||
$unlock = false;
|
||||
$stop = false;
|
||||
register_shutdown_function(function () use (&$unlock, &$stop) {
|
||||
if ($unlock) app::get()->getRunfile()->release();
|
||||
if ($stop) app::get()->getRunfile()->wfStop();
|
||||
});
|
||||
$shutdownHandler = function () use (&$unlock, &$stop) {
|
||||
if ($unlock) {
|
||||
app::get()->getRunfile()->release();
|
||||
$unlock = false;
|
||||
}
|
||||
if ($stop) {
|
||||
app::get()->getRunfile()->wfStop();
|
||||
$stop = false;
|
||||
}
|
||||
};
|
||||
register_shutdown_function($shutdownHandler);
|
||||
if (static::USE_SIGNAL_HANDLER) {
|
||||
$signalHandler = function(int $signo, $siginfo) {
|
||||
self::exit(255);
|
||||
};
|
||||
pcntl_signal(SIGHUP, $signalHandler);
|
||||
pcntl_signal(SIGINT, $signalHandler);
|
||||
pcntl_signal(SIGQUIT, $signalHandler);
|
||||
pcntl_signal(SIGTERM, $signalHandler);
|
||||
}
|
||||
try {
|
||||
static::_app_init();
|
||||
if (static::USE_RUNFILE) {
|
||||
|
|
|
@ -3,6 +3,7 @@ namespace nur\v\bs3\vc;
|
|||
|
||||
use nur\b\params\Tparametrable;
|
||||
use nur\b\ValueException;
|
||||
use nur\func;
|
||||
use nur\v\vo;
|
||||
|
||||
/**
|
||||
|
@ -14,7 +15,9 @@ class CListGroup extends _CItemList {
|
|||
const CONTAINER = null;
|
||||
|
||||
const PARAMETRABLE_PARAMS_SCHEMA = [
|
||||
"list_group_class" => ["?array", null, "classe CSS de la liste"],
|
||||
"container" => ["string", "ul", "container de la liste: ul ou div"],
|
||||
"item_func" => ["?callable", null, "fonction avec la signature (\$vs, \$item) retournant l'élément à afficher"],
|
||||
];
|
||||
|
||||
function __construct(?iterable $items=null, ?array $params=null) {
|
||||
|
@ -24,6 +27,8 @@ class CListGroup extends _CItemList {
|
|||
parent::__construct($items, $params);
|
||||
}
|
||||
|
||||
protected $ppListGroupClass;
|
||||
|
||||
private $ctag, $itag;
|
||||
|
||||
function pp_setContainer(string $container): self {
|
||||
|
@ -42,6 +47,14 @@ class CListGroup extends _CItemList {
|
|||
return $this;
|
||||
}
|
||||
|
||||
/** @var array */
|
||||
protected $itemCtx;
|
||||
|
||||
function pp_setItemFunc($itemFunc): void {
|
||||
if ($itemFunc === null) $this->itemCtx = null;
|
||||
else $this->itemCtx = func::_prepare($itemFunc);
|
||||
}
|
||||
|
||||
/** retourner le contenu associé au conteneur */
|
||||
function container(): ?array {
|
||||
return null;
|
||||
|
@ -49,7 +62,7 @@ class CListGroup extends _CItemList {
|
|||
|
||||
protected function _printStartContainer($container): void {
|
||||
vo::start($this->ctag, [
|
||||
"class" => "list-group",
|
||||
"class" => ["list-group", $this->ppListGroupClass],
|
||||
$this->container(),
|
||||
]);
|
||||
}
|
||||
|
@ -64,7 +77,11 @@ class CListGroup extends _CItemList {
|
|||
|
||||
/** retourner le contenu associé à l'élément spécifié. */
|
||||
function item($item): ?iterable {
|
||||
return [$item];
|
||||
$vs = [$item];
|
||||
if ($this->itemCtx !== null) {
|
||||
$vs = func::_call($this->itemCtx, [$vs, $item]);
|
||||
}
|
||||
return $vs;
|
||||
}
|
||||
|
||||
protected function _printStartItem(): void {
|
||||
|
|
|
@ -30,7 +30,11 @@ class autorefreshPlugin extends BasePlugin {
|
|||
<script type="text/javascript">
|
||||
jQuery.noConflict()(function($) {
|
||||
var autorefreshTimeout = null;
|
||||
function autorefreshEnabled() {
|
||||
return $("#autorefresh").is(":checked");
|
||||
}
|
||||
function autorefreshUpdate(enabled) {
|
||||
if (typeof(enabled) === 'undefined') enabled = autorefreshEnabled();
|
||||
if (enabled && autorefreshTimeout == null) {
|
||||
autorefreshTimeout = setTimeout(function() { location.reload(); }, <?=$this->delay?>);
|
||||
} else if (!enabled && autorefreshTimeout != null) {
|
||||
|
@ -42,7 +46,7 @@ jQuery.noConflict()(function($) {
|
|||
$("#autorefresh").click(function() {
|
||||
autorefreshUpdate($(this).is(":checked"));
|
||||
});
|
||||
autorefreshUpdate($("#autorefresh").is(":checked"));
|
||||
autorefreshUpdate();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue