error label for 'no access' and info label for 'empty directory'
This commit is contained in:
parent
2cca641d2e
commit
c506c7b0da
@ -3,6 +3,7 @@
|
|||||||
namespace ManiaControl\Maps;
|
namespace ManiaControl\Maps;
|
||||||
|
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
|
use FML\Controls\Label;
|
||||||
use FML\Controls\Labels\Label_Button;
|
use FML\Controls\Labels\Label_Button;
|
||||||
use FML\Controls\Labels\Label_Text;
|
use FML\Controls\Labels\Label_Text;
|
||||||
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
||||||
@ -154,6 +155,14 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
$mapFiles = $this->scanMapFiles($folderPath);
|
$mapFiles = $this->scanMapFiles($folderPath);
|
||||||
|
|
||||||
if (is_array($mapFiles)) {
|
if (is_array($mapFiles)) {
|
||||||
|
if (empty($mapFiles)) {
|
||||||
|
$emptyLabel = new Label();
|
||||||
|
$frame->add($emptyLabel);
|
||||||
|
$emptyLabel->setY(20)
|
||||||
|
->setTextColor('aaa')
|
||||||
|
->setText('No files found.')
|
||||||
|
->setTranslate(true);
|
||||||
|
} else {
|
||||||
foreach ($mapFiles as $filePath => $fileName) {
|
foreach ($mapFiles as $filePath => $fileName) {
|
||||||
$shortFilePath = substr($filePath, strlen($folderPath));
|
$shortFilePath = substr($filePath, strlen($folderPath));
|
||||||
|
|
||||||
@ -203,6 +212,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
->setSize(3, 3)
|
->setSize(3, 3)
|
||||||
->setTextSize(2)
|
->setTextSize(2)
|
||||||
->setText('Add')
|
->setText('Add')
|
||||||
|
->setTranslate(true)
|
||||||
->setAction(self::ACTION_ADD_FILE);
|
->setAction(self::ACTION_ADD_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,6 +224,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
->setSize(3, 3)
|
->setSize(3, 3)
|
||||||
->setTextSize(2)
|
->setTextSize(2)
|
||||||
->setText('Erase')
|
->setText('Erase')
|
||||||
|
->setTranslate(true)
|
||||||
->setAction(self::ACTION_ERASE_FILE);
|
->setAction(self::ACTION_ERASE_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,8 +232,14 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
$posY -= 4;
|
$posY -= 4;
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: show error label
|
$errorLabel = new Label();
|
||||||
|
$frame->add($errorLabel);
|
||||||
|
$errorLabel->setY(20)
|
||||||
|
->setTextColor('f30')
|
||||||
|
->setText('No access to the directory.')
|
||||||
|
->setTranslate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, self::WIDGET_NAME);
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, self::WIDGET_NAME);
|
||||||
|
Loading…
Reference in New Issue
Block a user