Compare commits
No commits in common. "39db9923944f77da8dd795b62cc1f7fafb64f1bb" and "52945ac7f7afb80e9d695308e979c308ed0ff452" have entirely different histories.
39db992394
...
52945ac7f7
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Maps;
|
namespace ManiaControl\Maps;
|
||||||
|
|
||||||
use finfo;
|
|
||||||
use ZipArchive;
|
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
use FML\Controls\Label;
|
use FML\Controls\Label;
|
||||||
use FML\Controls\Entry;
|
use FML\Controls\Entry;
|
||||||
@ -44,7 +42,6 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
const ACTION_INSPECT_FILE = 'MapsDirBrowser.InspectFile.';
|
const ACTION_INSPECT_FILE = 'MapsDirBrowser.InspectFile.';
|
||||||
const ACTION_ADD_FILE = 'MapsDirBrowser.AddFile.';
|
const ACTION_ADD_FILE = 'MapsDirBrowser.AddFile.';
|
||||||
const ACTION_ERASE_FILE = 'MapsDirBrowser.EraseFile.';
|
const ACTION_ERASE_FILE = 'MapsDirBrowser.EraseFile.';
|
||||||
const ACTION_CREATE_FOLDER = 'MapsDirBrowser.CreateFolder';
|
|
||||||
const ACTION_DOWNLOAD_FILE = 'MapsDirBrowser.DownloadFile';
|
const ACTION_DOWNLOAD_FILE = 'MapsDirBrowser.DownloadFile';
|
||||||
const WIDGET_NAME = 'MapsDirBrowser.Widget';
|
const WIDGET_NAME = 'MapsDirBrowser.Widget';
|
||||||
const CACHE_FOLDER_PATH = 'FolderPath';
|
const CACHE_FOLDER_PATH = 'FolderPath';
|
||||||
@ -71,7 +68,6 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_INSPECT_FILE), $this, 'handleInspectFile');
|
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_INSPECT_FILE), $this, 'handleInspectFile');
|
||||||
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_ADD_FILE), $this, 'handleAddFile');
|
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_ADD_FILE), $this, 'handleAddFile');
|
||||||
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_ERASE_FILE), $this, 'handleEraseFile');
|
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_ERASE_FILE), $this, 'handleEraseFile');
|
||||||
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_CREATE_FOLDER), $this, 'handleCreateFolder');
|
|
||||||
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_DOWNLOAD_FILE), $this, 'handleDownloadFile');
|
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_DOWNLOAD_FILE), $this, 'handleDownloadFile');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +140,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
|
$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
|
||||||
|
|
||||||
$innerWidth = $width - 2;
|
$innerWidth = $width - 2;
|
||||||
$innerHeigth = $height - 27;
|
$innerHeigth = $height - 22;
|
||||||
|
|
||||||
$lineHeight = 4.;
|
$lineHeight = 4.;
|
||||||
|
|
||||||
@ -185,12 +181,12 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
|
|
||||||
$tooltipLabel = new Label();
|
$tooltipLabel = new Label();
|
||||||
$repositionnedFrame->addChild($tooltipLabel);
|
$repositionnedFrame->addChild($tooltipLabel);
|
||||||
$tooltipLabel->setPosition(3, $height * -1 + 15);
|
$tooltipLabel->setPosition(3, $height * -1 + 10);
|
||||||
$tooltipLabel->setSize($width * 0.8, 5);
|
$tooltipLabel->setSize($width * 0.8, 5);
|
||||||
$tooltipLabel->setHorizontalAlign($tooltipLabel::LEFT);
|
$tooltipLabel->setHorizontalAlign($tooltipLabel::LEFT);
|
||||||
$tooltipLabel->setTextSize(1);
|
$tooltipLabel->setTextSize(1);
|
||||||
|
|
||||||
// Back button
|
// Download button
|
||||||
$backButton = new Label_Button();
|
$backButton = new Label_Button();
|
||||||
$repositionnedFrame->addChild($backButton);
|
$repositionnedFrame->addChild($backButton);
|
||||||
$backButton->setStyle($backButton::STYLE_CardMain_Quit);
|
$backButton->setStyle($backButton::STYLE_CardMain_Quit);
|
||||||
@ -198,59 +194,23 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
$backButton->setScale(0.5);
|
$backButton->setScale(0.5);
|
||||||
$backButton->setText('Back');
|
$backButton->setText('Back');
|
||||||
$backButton->setPosition(3, $height * -1 + 5);
|
$backButton->setPosition(3, $height * -1 + 5);
|
||||||
$backButton->setSize(5, 10);
|
|
||||||
$backButton->setAction(MapCommands::ACTION_OPEN_MAPLIST);
|
$backButton->setAction(MapCommands::ACTION_OPEN_MAPLIST);
|
||||||
|
|
||||||
// Create folder button
|
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$repositionnedFrame->addChild($label);
|
$repositionnedFrame->addChild($label);
|
||||||
$label->setPosition(54, $height * -1 + 10);
|
$label->setPosition(25, $height * -1 + 5);
|
||||||
$label->setSize(25, 5);
|
|
||||||
$label->setHorizontalAlign($label::LEFT);
|
|
||||||
$label->setTextSize(1);
|
|
||||||
$label->setText('Create folder: ');
|
|
||||||
$label->setAreaFocusColor("00000000");
|
|
||||||
$label->setAreaColor("00000000");
|
|
||||||
|
|
||||||
$entry = new Entry();
|
|
||||||
$repositionnedFrame->addChild($entry);
|
|
||||||
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
|
|
||||||
$entry->setHorizontalAlign($entry::LEFT);
|
|
||||||
$entry->setPosition(72, $height * -1 + 10);
|
|
||||||
$entry->setTextSize(1);
|
|
||||||
$entry->setSize(50, 4);
|
|
||||||
$entry->setName("Name");
|
|
||||||
|
|
||||||
//Search for Map-Name
|
|
||||||
$createFolderButton = $this->maniaControl->getManialinkManager()->getElementBuilder()->buildRoundTextButton(
|
|
||||||
'Create',
|
|
||||||
18,
|
|
||||||
5,
|
|
||||||
self::ACTION_CREATE_FOLDER
|
|
||||||
);
|
|
||||||
$repositionnedFrame->addChild($createFolderButton);
|
|
||||||
$createFolderButton->setPosition(123 + 18/2, $height * -1 + 10);
|
|
||||||
|
|
||||||
// Download button
|
|
||||||
$label = new Label_Text();
|
|
||||||
$repositionnedFrame->addChild($label);
|
|
||||||
$label->setPosition(45, $height * -1 + 5);
|
|
||||||
$label->setSize(27, 5);
|
|
||||||
$label->setHorizontalAlign($label::LEFT);
|
$label->setHorizontalAlign($label::LEFT);
|
||||||
$label->setTextSize(1);
|
$label->setTextSize(1);
|
||||||
$label->setText('Download from URL: ');
|
$label->setText('Download from URL: ');
|
||||||
$label->setAreaFocusColor("00000000");
|
|
||||||
$label->setAreaColor("00000000");
|
|
||||||
$label->addTooltipLabelFeature($tooltipLabel, 'Support Map.Gbx and Zip files');
|
|
||||||
|
|
||||||
$entry = new Entry();
|
$entry = new Entry();
|
||||||
$repositionnedFrame->addChild($entry);
|
$repositionnedFrame->addChild($entry);
|
||||||
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
|
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
|
||||||
$entry->setHorizontalAlign($entry::LEFT);
|
$entry->setHorizontalAlign($entry::LEFT);
|
||||||
$entry->setPosition(72, $height * -1 + 5);
|
$entry->setPosition(53, $height * -1 + 5);
|
||||||
$entry->setTextSize(1);
|
$entry->setTextSize(1);
|
||||||
$entry->setSize(50, 4);
|
$entry->setSize($width * 0.35, 4);
|
||||||
$entry->setName("URL");
|
$entry->setName("Value");
|
||||||
|
|
||||||
//Search for Map-Name
|
//Search for Map-Name
|
||||||
$downloadButton = $this->maniaControl->getManialinkManager()->getElementBuilder()->buildRoundTextButton(
|
$downloadButton = $this->maniaControl->getManialinkManager()->getElementBuilder()->buildRoundTextButton(
|
||||||
@ -260,7 +220,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
self::ACTION_DOWNLOAD_FILE
|
self::ACTION_DOWNLOAD_FILE
|
||||||
);
|
);
|
||||||
$repositionnedFrame->addChild($downloadButton);
|
$repositionnedFrame->addChild($downloadButton);
|
||||||
$downloadButton->setPosition(123 + 18/2, $height * -1 + 5);
|
$downloadButton->setPosition(53 + 18 / 2 + $width * 0.35, $height * -1 + 5);
|
||||||
|
|
||||||
$mapFiles = $this->scanMapFiles($folderPath);
|
$mapFiles = $this->scanMapFiles($folderPath);
|
||||||
|
|
||||||
@ -548,33 +508,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle 'CreateFolder' page action
|
|
||||||
*
|
|
||||||
* @param array $actionCallback
|
|
||||||
* @param Player $player
|
|
||||||
*/
|
|
||||||
public function handleCreateFolder(array $actionCallback, Player $player) {
|
|
||||||
$name = trim($actionCallback[1][3][0]["Value"]);
|
|
||||||
|
|
||||||
var_dump($actionCallback);
|
|
||||||
if ($name === "") return;
|
|
||||||
|
|
||||||
$folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH);
|
|
||||||
if (mkdir($folderPath . $name, 755, true)) {
|
|
||||||
$message = "Successfully created directory ". $name;
|
|
||||||
$this->maniaControl->getChat()->sendSuccess($message, $player);
|
|
||||||
Logger::log($message . " by " . $player->nickname);
|
|
||||||
|
|
||||||
$this->showManiaLink($player, $name);
|
|
||||||
} else {
|
|
||||||
$message = "Failed to create directory ". $name;
|
|
||||||
$this->maniaControl->getChat()->sendError($message, $player);
|
|
||||||
Logger::logError($message . " by " . $player->nickname);
|
|
||||||
|
|
||||||
$this->showManiaLink($player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle 'handleDownloadFile' page action
|
* Handle 'handleDownloadFile' page action
|
||||||
@ -583,8 +517,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handleDownloadFile(array $actionCallback, Player $player) {
|
public function handleDownloadFile(array $actionCallback, Player $player) {
|
||||||
$url = trim($actionCallback[1][3][1]["Value"]);
|
$url = trim($actionCallback[1][3][0]["Value"]);
|
||||||
if ($url === "") return;
|
|
||||||
$folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH);
|
$folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH);
|
||||||
if (filter_var($url, FILTER_VALIDATE_URL)) {
|
if (filter_var($url, FILTER_VALIDATE_URL)) {
|
||||||
|
|
||||||
@ -598,32 +531,6 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
}
|
}
|
||||||
$filePath = "";
|
$filePath = "";
|
||||||
|
|
||||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
|
||||||
if ($finfo->buffer($file) === "application/zip") {
|
|
||||||
$zip = new ZipArchive();
|
|
||||||
|
|
||||||
// Create a temporary file
|
|
||||||
$tempFile = tempnam(sys_get_temp_dir(), 'zip');
|
|
||||||
file_put_contents($tempFile, $file);
|
|
||||||
|
|
||||||
$open = $zip->open($tempFile);
|
|
||||||
|
|
||||||
if ($open === true) {
|
|
||||||
$zip->extractTo($folderPath);
|
|
||||||
$zip->close();
|
|
||||||
$message = "Succesfully extracted zip archive from ". $url;
|
|
||||||
$this->maniaControl->getChat()->sendSuccess($message, $player);
|
|
||||||
Logger::log($message . " by " . $player->nickname);
|
|
||||||
} else {
|
|
||||||
$message = "Cannot extract archive from ". $url;
|
|
||||||
$this->maniaControl->getChat()->sendError($message, $player);
|
|
||||||
Logger::logError($message . " by " . $player->nickname);
|
|
||||||
}
|
|
||||||
// Clean up the temporary file
|
|
||||||
unlink($tempFile);
|
|
||||||
} else {
|
|
||||||
$fileName = "";
|
|
||||||
|
|
||||||
$contentdispositionheader = "";
|
$contentdispositionheader = "";
|
||||||
foreach ($headers as $key => $value) {
|
foreach ($headers as $key => $value) {
|
||||||
if (strtolower($key) === "content-disposition") {
|
if (strtolower($key) === "content-disposition") {
|
||||||
@ -657,26 +564,26 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
$isUtf8 = false;
|
$isUtf8 = false;
|
||||||
foreach ($attrNames as $attrName => $utf8) {
|
foreach ($attrNames as $attrName => $utf8) {
|
||||||
if (!empty($attributes[$attrName])) {
|
if (!empty($attributes[$attrName])) {
|
||||||
$fileName = trim($attributes[$attrName]);
|
$filename = trim($attributes[$attrName]);
|
||||||
$isUtf8 = $utf8;
|
$isUtf8 = $utf8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fileName !== null) {
|
if ($filename !== null) {
|
||||||
if ($isUtf8 && strpos(strtolower($fileName), "utf-8''") === 0 && $fileName = substr($fileName, strlen("utf-8''"))) {
|
if ($isUtf8 && strpos(strtolower($filename), "utf-8''") === 0 && $filename = substr($filename, strlen("utf-8''"))) {
|
||||||
$filePath = $folderPath . FileUtil::getClearedFileName(rawurldecode($fileName));
|
$filePath = $folderPath . FileUtil::getClearedFileName(rawurldecode($filename));
|
||||||
}
|
}
|
||||||
if (substr($fileName, 0, 1) === '"' && substr($fileName, -1, 1) === '"') {
|
if (substr($filename, 0, 1) === '"' && substr($filename, -1, 1) === '"') {
|
||||||
$filePath = $folderPath . substr($fileName, 1, -1);
|
$filePath = $folderPath . substr($filename, 1, -1);
|
||||||
} else {
|
} else {
|
||||||
$filePath = $folderPath . $fileName;
|
$filePath = $folderPath . $filename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isMapFileName($filePath)) {
|
if (!$this->isMapFileName($filePath)) {
|
||||||
$message = "File is not a map: " . $fileName;
|
$message = "File is not a map: " . $filename;
|
||||||
$this->maniaControl->getChat()->sendError($message, $player);
|
$this->maniaControl->getChat()->sendError($message, $player);
|
||||||
Logger::logError($message);
|
Logger::logError($message);
|
||||||
return;
|
return;
|
||||||
@ -685,12 +592,11 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
$path = parse_url($url, PHP_URL_PATH);
|
$path = parse_url($url, PHP_URL_PATH);
|
||||||
|
|
||||||
// extracted basename
|
// extracted basename
|
||||||
$fileName = basename($path);
|
$filePath = $folderPath . basename($path);
|
||||||
|
|
||||||
if (!$this->isMapFileName($fileName)) {
|
if (!$this->isMapFileName($filePath)) {
|
||||||
$fileName .= ".Map.Gbx";
|
$filePath .= ".Map.Gbx";
|
||||||
}
|
}
|
||||||
$filePath = $folderPath . $fileName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filePath != "") {
|
if ($filePath != "") {
|
||||||
@ -703,19 +609,13 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
}
|
}
|
||||||
$bytes = file_put_contents($filePath, $file);
|
$bytes = file_put_contents($filePath, $file);
|
||||||
if (!$bytes || $bytes <= 0) {
|
if (!$bytes || $bytes <= 0) {
|
||||||
$message = "Failed to write file " . $filePath;
|
$message = "Impossible to determine filename";
|
||||||
$this->maniaControl->getChat()->sendError($message, $player);
|
$this->maniaControl->getChat()->sendError($message, $player);
|
||||||
Logger::logError($message . " by " . $player->nickname);
|
Logger::logError($message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = "Succesfully downloaded the map ". $fileName;
|
|
||||||
$this->maniaControl->getChat()->sendSuccess($message, $player);
|
|
||||||
Logger::log($message . " by " . $player->nickname);
|
|
||||||
}
|
}
|
||||||
}
|
$this->showManiaLink($player, $folderPath);
|
||||||
|
|
||||||
$this->showManiaLink($player);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$asyncHttpRequest->getData();
|
$asyncHttpRequest->getData();
|
||||||
|
@ -169,26 +169,6 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$repositionnedFrame->addChild($pagesFrame);
|
$repositionnedFrame->addChild($pagesFrame);
|
||||||
$pagesFrame->setY(-1);
|
$pagesFrame->setY(-1);
|
||||||
|
|
||||||
$descriptionLabel = new Label();
|
|
||||||
$repositionnedFrame->addChild($descriptionLabel);
|
|
||||||
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP);
|
|
||||||
$descriptionLabel->setPosition(3, $height * -1 + 16);
|
|
||||||
$descriptionLabel->setSize($width - 30, 20);
|
|
||||||
$descriptionLabel->setTextSize(1);
|
|
||||||
$descriptionLabel->setTranslate(true);
|
|
||||||
$descriptionLabel->setVisible(false);
|
|
||||||
$descriptionLabel->setMaxLines(5);
|
|
||||||
$descriptionLabel->setLineSpacing(1);
|
|
||||||
|
|
||||||
$tooltip = new Label();
|
|
||||||
$repositionnedFrame->addChild($tooltip);
|
|
||||||
$tooltip->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP);
|
|
||||||
$tooltip->setPosition(3, $height * -1 + 5);
|
|
||||||
$tooltip->setSize($width - 30, 5);
|
|
||||||
$tooltip->setTextSize(1);
|
|
||||||
$tooltip->setTranslate(true);
|
|
||||||
$tooltip->setVisible(false);
|
|
||||||
|
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
foreach ($pluginClasses as $pluginClass) {
|
foreach ($pluginClasses as $pluginClass) {
|
||||||
@ -208,7 +188,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
|
|
||||||
$activeQuad = new Quad_Icons64x64_1();
|
$activeQuad = new Quad_Icons64x64_1();
|
||||||
$pluginFrame->addChild($activeQuad);
|
$pluginFrame->addChild($activeQuad);
|
||||||
$activeQuad->setPosition(5, 0, 1);
|
$activeQuad->setPosition(2.5, -0.1, 1);
|
||||||
$activeQuad->setSize($entryHeight * 0.9, $entryHeight * 0.9);
|
$activeQuad->setSize($entryHeight * 0.9, $entryHeight * 0.9);
|
||||||
if ($active) {
|
if ($active) {
|
||||||
$activeQuad->setSubStyle($activeQuad::SUBSTYLE_LvlGreen);
|
$activeQuad->setSubStyle($activeQuad::SUBSTYLE_LvlGreen);
|
||||||
@ -219,38 +199,44 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$nameLabel = new Label_Text();
|
$nameLabel = new Label_Text();
|
||||||
$pluginFrame->addChild($nameLabel);
|
$pluginFrame->addChild($nameLabel);
|
||||||
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
|
$nameLabel->setHorizontalAlign($nameLabel::LEFT);
|
||||||
$nameLabel->setX(7.5);
|
$nameLabel->setX(5);
|
||||||
$nameLabel->setSize($width - 50, $entryHeight);
|
$nameLabel->setSize($width - 50, $entryHeight);
|
||||||
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
|
$nameLabel->setStyle($nameLabel::STYLE_TextCardSmall);
|
||||||
$nameLabel->setTextSize(2);
|
$nameLabel->setTextSize(2);
|
||||||
$nameLabel->setText($pluginClass::getName());
|
$nameLabel->setText($pluginClass::getName());
|
||||||
|
|
||||||
|
$descriptionLabel = new Label();
|
||||||
|
$pageFrame->addChild($descriptionLabel);
|
||||||
|
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP);
|
||||||
|
$descriptionLabel->setPosition(3, $height * -1 + 16);
|
||||||
|
$descriptionLabel->setSize($width - 30, 20);
|
||||||
|
$descriptionLabel->setTextSize(1);
|
||||||
|
$descriptionLabel->setTranslate(true);
|
||||||
|
$descriptionLabel->setVisible(false);
|
||||||
|
$descriptionLabel->setMaxLines(5);
|
||||||
|
$descriptionLabel->setLineSpacing(1);
|
||||||
$description = "Author: {$pluginClass::getAuthor()}\nVersion: {$pluginClass::getVersion()}\nDesc: {$pluginClass::getDescription()}";
|
$description = "Author: {$pluginClass::getAuthor()}\nVersion: {$pluginClass::getVersion()}\nDesc: {$pluginClass::getDescription()}";
|
||||||
$nameLabel->addTooltipLabelFeature($descriptionLabel,$description);
|
$nameLabel->addTooltipLabelFeature($descriptionLabel,$description);
|
||||||
|
|
||||||
$quad = new Quad_Icons128x32_1();
|
$quad = new Quad_Icons128x32_1();
|
||||||
$pluginFrame->addChild($quad);
|
$pluginFrame->addChild($quad);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_Settings);
|
$quad->setSubStyle($quad::SUBSTYLE_Settings);
|
||||||
$quad->setX($width - 37);
|
$quad->setX($width - 45);
|
||||||
$quad->setZ(1);
|
$quad->setZ(1);
|
||||||
$quad->setSize(5, 5);
|
$quad->setSize(5, 5);
|
||||||
$quad->setAction(self::ACTION_PREFIX_SETTINGS . $pluginClass);
|
$quad->setAction(self::ACTION_PREFIX_SETTINGS . $pluginClass);
|
||||||
$quad->addTooltipLabelFeature($tooltip, "Open settings of ". $pluginClass::getName());
|
|
||||||
|
|
||||||
$statusChangeButton = new Label_Button();
|
$statusChangeButton = new Label_Button();
|
||||||
$pluginFrame->addChild($statusChangeButton);
|
$pluginFrame->addChild($statusChangeButton);
|
||||||
$statusChangeButton->setHorizontalAlign($statusChangeButton::RIGHT);
|
$statusChangeButton->setHorizontalAlign($statusChangeButton::RIGHT);
|
||||||
$statusChangeButton->setX($width - 6);
|
$statusChangeButton->setX($width - 6);
|
||||||
$statusChangeButton->setStyle($statusChangeButton::STYLE_CardButtonSmallS);
|
$statusChangeButton->setStyle($statusChangeButton::STYLE_CardButtonSmall);
|
||||||
if ($active) {
|
if ($active) {
|
||||||
$statusChangeButton->setText('Deactivate');
|
$statusChangeButton->setText('Deactivate');
|
||||||
$statusChangeButton->setAction(self::ACTION_PREFIX_DISABLEPLUGIN . $pluginClass);
|
$statusChangeButton->setAction(self::ACTION_PREFIX_DISABLEPLUGIN . $pluginClass);
|
||||||
$statusChangeButton->addTooltipLabelFeature($tooltip, "Deactivate plugin ". $pluginClass::getName());
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$statusChangeButton->setText('Activate');
|
$statusChangeButton->setText('Activate');
|
||||||
$statusChangeButton->setAction(self::ACTION_PREFIX_ENABLEPLUGIN . $pluginClass);
|
$statusChangeButton->setAction(self::ACTION_PREFIX_ENABLEPLUGIN . $pluginClass);
|
||||||
$statusChangeButton->addTooltipLabelFeature($tooltip, "Activate plugin ". $pluginClass::getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pluginUpdates && array_key_exists($pluginClass::getId(), $pluginUpdates)) {
|
if ($pluginUpdates && array_key_exists($pluginClass::getId(), $pluginUpdates)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user