modifs.mineures sans commentaires
This commit is contained in:
parent
70e9c4d268
commit
f3af19406b
|
@ -15,22 +15,40 @@ class showmorePlugin extends BasePlugin {
|
||||||
/** @var string classe du panneau caché par défaut */
|
/** @var string classe du panneau caché par défaut */
|
||||||
const INVITE_CONTENT = "En savoir plus...";
|
const INVITE_CONTENT = "En savoir plus...";
|
||||||
const PANEL_CLASS = "showmore-panel";
|
const PANEL_CLASS = "showmore-panel";
|
||||||
|
|
||||||
|
function __construct(?array $params=null) {
|
||||||
|
$this->containerClass = $params["container_class"] ?? static::CONTAINER_CLASS;
|
||||||
|
$this->inviteClass = $params["invite_class"] ?? self::INVITE_CLASS;
|
||||||
|
$this->inviteContent = $params["invite_content"] ?? self::INVITE_CONTENT;
|
||||||
|
$this->panelClass = $params["panel_class"] ?? self::PANEL_CLASS;
|
||||||
|
$this->onShow = $params["on_show"] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string $containerClass;
|
||||||
|
|
||||||
|
protected string $inviteClass, $inviteContent;
|
||||||
|
|
||||||
|
protected string $panelClass;
|
||||||
|
|
||||||
|
protected ?string $onShow;
|
||||||
|
|
||||||
function startc(): array {
|
function startc(): array {
|
||||||
return v::sdiv(["class" => self::CONTAINER_CLASS]);
|
return v::sdiv(["class" => $this->containerClass]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function invite($vs=null): array {
|
function invite($vs=null): array {
|
||||||
if ($vs === null) $vs = self::INVITE_CONTENT;
|
$vs ??= $this->inviteContent;
|
||||||
return v::a([
|
return v::a([
|
||||||
"class" => self::INVITE_CLASS,
|
"class" => $this->inviteClass,
|
||||||
"href" => "#",
|
"href" => "#",
|
||||||
$vs,
|
$vs,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function startp(): array {
|
function startp(): array {
|
||||||
return v::sdiv(["class" => [self::PANEL_CLASS, "hidden"]]);
|
return v::sdiv([
|
||||||
|
"class" => [$this->panelClass, "hidden"],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function endp(): array {
|
function endp(): array {
|
||||||
|
@ -76,7 +94,10 @@ jQuery.noConflict()(function($) {
|
||||||
$(".<?=self::INVITE_CLASS?>").click(function() {
|
$(".<?=self::INVITE_CLASS?>").click(function() {
|
||||||
let $this = $(this);
|
let $this = $(this);
|
||||||
$this.addClass("hidden");
|
$this.addClass("hidden");
|
||||||
$this.closest(".<?=self::CONTAINER_CLASS?>").find(".<?=self::PANEL_CLASS?>").removeClass("hidden");
|
let $container = $this.closest(".<?=self::CONTAINER_CLASS?>");
|
||||||
|
let $panel = $container.find(".<?=self::PANEL_CLASS?>");
|
||||||
|
$panel.removeClass("hidden");
|
||||||
|
<?=$this->onShow?>
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -107,8 +107,8 @@ class RunFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function haveWorked(int $serial, ?int &$currentSerial=null): bool {
|
function haveWorked(int $serial, ?int &$currentSerial=null, ?array $data=null): bool {
|
||||||
$data = $this->read();
|
$data ??= $this->read();
|
||||||
$currentSerial = $data["serial"];
|
$currentSerial = $data["serial"];
|
||||||
return $serial !== $currentSerial;
|
return $serial !== $currentSerial;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ class RunFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
function warnIfLocked(?array $data=null): bool {
|
function warnIfLocked(?array $data=null): bool {
|
||||||
if ($data === null) $data = $this->read();
|
$data ??= $this->read();
|
||||||
if ($data["locked"]) {
|
if ($data["locked"]) {
|
||||||
msg::warning("$data[name]: possède le verrou depuis $data[date_lock]");
|
msg::warning("$data[name]: possède le verrou depuis $data[date_lock]");
|
||||||
return true;
|
return true;
|
||||||
|
@ -172,22 +172,22 @@ class RunFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** tester si l'application a déjà été démarrée au moins une fois */
|
/** tester si l'application a déjà été démarrée au moins une fois */
|
||||||
function wasStarted(): bool {
|
function wasStarted(?array $data=null): bool {
|
||||||
$data = $this->read();
|
$data ??= $this->read();
|
||||||
return $data["date_start"] !== null;
|
return $data["date_start"] !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** tester si l'application est démarrée et non arrêtée */
|
/** tester si l'application est démarrée et non arrêtée */
|
||||||
function isStarted(?array &$data=null): bool {
|
function isStarted(?array $data=null): bool {
|
||||||
$data = $this->read();
|
$data ??= $this->read();
|
||||||
return $data["date_start"] !== null && $data["date_stop"] === null;
|
return $data["date_start"] !== null && $data["date_stop"] === null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vérifier si l'application marquée comme démarrée tourne réellement
|
* vérifier si l'application marquée comme démarrée tourne réellement
|
||||||
*/
|
*/
|
||||||
function isRunning(?array &$data=null): bool {
|
function isRunning(?array $data=null): bool {
|
||||||
$data = $this->read();
|
$data ??= $this->read();
|
||||||
if ($data["date_start"] === null) return false;
|
if ($data["date_start"] === null) return false;
|
||||||
if ($data["date_stop"] !== null) return false;
|
if ($data["date_stop"] !== null) return false;
|
||||||
if (!posix_kill($data["pid"], 0)) {
|
if (!posix_kill($data["pid"], 0)) {
|
||||||
|
@ -216,14 +216,14 @@ class RunFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** tester si l'application est déjà été stoppée au moins une fois */
|
/** tester si l'application est déjà été stoppée au moins une fois */
|
||||||
function wasStopped(): bool {
|
function wasStopped(?array $data=null): bool {
|
||||||
$data = $this->read();
|
$data ??= $this->read();
|
||||||
return $data["date_stop"] !== null;
|
return $data["date_stop"] !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** tester si l'application a été démarrée puis arrêtée */
|
/** tester si l'application a été démarrée puis arrêtée */
|
||||||
function isStopped(?array &$data=null): bool {
|
function isStopped(?array $data=null): bool {
|
||||||
$data = $this->read();
|
$data ??= $this->read();
|
||||||
return $data["date_start"] !== null && $data["date_stop"] !== null;
|
return $data["date_start"] !== null && $data["date_stop"] !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,8 +250,8 @@ class RunFile {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$done = true;
|
$done = true;
|
||||||
if (!$updateDone) return null;
|
if ($updateDone) return ["is_done" => $done];
|
||||||
return ["is_done" => $done];
|
else return null;
|
||||||
});
|
});
|
||||||
return $done;
|
return $done;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue