Compare commits
No commits in common. "90528e61e527182aad9d49854380ecb7c5dd3337" and "4f45e213c3fc283606a6e13aab3478ee194697cf" have entirely different histories.
90528e61e5
...
4f45e213c3
@ -1,2 +0,0 @@
|
|||||||
ALTER TABLE `maps`
|
|
||||||
ADD `unlisted` TINYINT(1) NOT NULL DEFAULT 0;
|
|
@ -241,7 +241,7 @@ button.green:enabled:hover, button.green:enabled:focus, a.button.green:hover, a.
|
|||||||
background-color: #1b7d31;
|
background-color: #1b7d31;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text], select, textarea {
|
input, select, textarea {
|
||||||
background-color: #f9fafb;
|
background-color: #f9fafb;
|
||||||
border: solid #c8d2e1 1px;
|
border: solid #c8d2e1 1px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
@ -250,26 +250,22 @@ input[type=text], select, textarea {
|
|||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text], select {
|
input, select {
|
||||||
height: 30px;
|
height: 30px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=checkbox], input[type=radio] {
|
|
||||||
margin-right: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
resize: none;
|
resize: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text].big, select.big, textarea.big, div.inputWithButton>input[type=text] {
|
input.big, select.big, textarea.big, div.inputWithButton>input {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text].big, select.big, div.inputWithButton>input[type=text] {
|
input.big, select.big, div.inputWithButton>input {
|
||||||
height: 35px;
|
height: 35px;
|
||||||
line-height: 35px;
|
line-height: 35px;
|
||||||
padding: 0 6px;
|
padding: 0 6px;
|
||||||
@ -284,19 +280,19 @@ input.fullWidth, select.fullWidth, textarea.fullWidth {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text]:disabled, select:disabled, textarea:disabled {
|
input:disabled, select:disabled, textarea:disabled {
|
||||||
background-color: #dfdfdf;
|
background-color: #dfdfdf;
|
||||||
border: solid #dfdfdf 1px;
|
border: solid #dfdfdf 1px;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text]:focus, select:focus, textarea:focus {
|
input:focus, select:focus, textarea:focus {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border: solid #29457f 2px;
|
border: solid #29457f 2px;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text]:focus, select:focus {
|
input:focus, select:focus {
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,16 +300,16 @@ textarea:focus {
|
|||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text].big:focus, select.big:focus {
|
input.big:focus, select.big:focus {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.inputWithButton>input[type=text] {
|
div.inputWithButton>input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0 83px 0 6px;
|
padding: 0 83px 0 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.inputWithButton>input[type=text]:focus {
|
div.inputWithButton>input:focus {
|
||||||
padding: 0 82px 0 5px;
|
padding: 0 82px 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,10 +13,6 @@ div.mapItem.new {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.mapItem.unlisted {
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.mapItem>div.title {
|
div.mapItem>div.title {
|
||||||
background-color: #28a745;
|
background-color: #28a745;
|
||||||
color: white;
|
color: white;
|
||||||
@ -79,8 +75,19 @@ div.mapItem>div.buttonContainer {
|
|||||||
grid-auto-flow: column;
|
grid-auto-flow: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#restrictions input {
|
||||||
|
height: auto;
|
||||||
|
margin: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#restrictions input[type=range] {
|
||||||
|
height: 1.5em;
|
||||||
|
margin-left: 2em;
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
#timeLimitType {
|
#timeLimitType {
|
||||||
margin-left: 1.5em;
|
margin-left: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 1504px) {
|
@media screen and (min-width: 1504px) {
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
MapEditor.metadata.name = form.elements.name.value;
|
MapEditor.metadata.name = form.elements.name.value;
|
||||||
MapEditor.metadata.description = form.elements.description.value;
|
MapEditor.metadata.description = form.elements.description.value;
|
||||||
MapEditor.metadata.unlisted = form.elements.unlisted.checked;
|
|
||||||
|
|
||||||
document.getElementById('mapName').innerHTML = form.elements.name.value ? form.elements.name.value : '[unnamed map]';
|
document.getElementById('mapName').innerHTML = form.elements.name.value ? form.elements.name.value : '[unnamed map]';
|
||||||
|
|
||||||
@ -255,9 +254,6 @@
|
|||||||
if (MapEditor.metadata.description !== null) {
|
if (MapEditor.metadata.description !== null) {
|
||||||
data.append('description', MapEditor.metadata.description);
|
data.append('description', MapEditor.metadata.description);
|
||||||
}
|
}
|
||||||
if (MapEditor.metadata.unlisted !== null) {
|
|
||||||
data.append('unlisted', MapEditor.metadata.unlisted);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var placeId in MapEditor.added) {
|
for (var placeId in MapEditor.added) {
|
||||||
if (!MapEditor.added.hasOwnProperty(placeId)) {
|
if (!MapEditor.added.hasOwnProperty(placeId)) {
|
||||||
|
@ -81,7 +81,6 @@ class MapAdminController implements ISecured
|
|||||||
'mapId' => $mapId,
|
'mapId' => $mapId,
|
||||||
'mapName' => $map->getName(),
|
'mapName' => $map->getName(),
|
||||||
'mapDescription' => str_replace('<br>', "\n", $map->getDescription()),
|
'mapDescription' => str_replace('<br>', "\n", $map->getDescription()),
|
||||||
'mapUnlisted' => $map->getUnlisted(),
|
|
||||||
'bounds' => $map->getBounds()->toArray(),
|
'bounds' => $map->getBounds()->toArray(),
|
||||||
'places' => &$places
|
'places' => &$places
|
||||||
]);
|
]);
|
||||||
@ -176,9 +175,6 @@ class MapAdminController implements ISecured
|
|||||||
if (isset($_POST['description'])) {
|
if (isset($_POST['description'])) {
|
||||||
$map->setDescription(str_replace(["\n", "\r\n"], '<br>', $_POST['description']));
|
$map->setDescription(str_replace(["\n", "\r\n"], '<br>', $_POST['description']));
|
||||||
}
|
}
|
||||||
if (isset($_POST['unlisted'])) {
|
|
||||||
$map->setUnlisted((bool)$_POST['unlisted']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->pdm->saveToDb($map);
|
$this->pdm->saveToDb($map);
|
||||||
|
|
||||||
|
@ -30,19 +30,12 @@ class MapsController
|
|||||||
['maps', 'bound_north_lat'],
|
['maps', 'bound_north_lat'],
|
||||||
['maps', 'bound_east_lng'],
|
['maps', 'bound_east_lng'],
|
||||||
['maps', 'area'],
|
['maps', 'area'],
|
||||||
['maps', 'unlisted'],
|
|
||||||
new RawExpression('COUNT(places.id) AS num_places')
|
new RawExpression('COUNT(places.id) AS num_places')
|
||||||
]);
|
]);
|
||||||
$select->leftJoin('places', ['places', 'map_id'], '=', ['maps', 'id']);
|
$select->leftJoin('places', ['places', 'map_id'], '=', ['maps', 'id']);
|
||||||
$select->groupBy(['maps', 'id']);
|
$select->groupBy(['maps', 'id']);
|
||||||
$select->orderBy('name');
|
$select->orderBy('name');
|
||||||
|
|
||||||
$user = $this->request->user();
|
|
||||||
$isAdmin = $user !== null && $user->hasPermission(IUser::PERMISSION_ADMIN);
|
|
||||||
if (!$isAdmin) {
|
|
||||||
$select->where(['maps', 'unlisted'], '=', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $select->execute();
|
$result = $select->execute();
|
||||||
|
|
||||||
$maps = [];
|
$maps = [];
|
||||||
@ -52,10 +45,11 @@ class MapsController
|
|||||||
$maps[] = $map;
|
$maps[] = $map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user = $this->request->user();
|
||||||
return new HtmlContent('maps', [
|
return new HtmlContent('maps', [
|
||||||
'maps' => $maps,
|
'maps' => $maps,
|
||||||
'isLoggedIn' => $user !== null,
|
'isLoggedIn' => $user !== null,
|
||||||
'isAdmin' => $isAdmin
|
'isAdmin' => $user !== null && $user->hasPermission(IUser::PERMISSION_ADMIN)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ class Map extends Model
|
|||||||
{
|
{
|
||||||
protected static string $table = 'maps';
|
protected static string $table = 'maps';
|
||||||
|
|
||||||
protected static array $fields = ['name', 'description', 'bound_south_lat', 'bound_west_lng', 'bound_north_lat', 'bound_east_lng', 'area', 'unlisted'];
|
protected static array $fields = ['name', 'description', 'bound_south_lat', 'bound_west_lng', 'bound_north_lat', 'bound_east_lng', 'area'];
|
||||||
|
|
||||||
private string $name = '';
|
private string $name = '';
|
||||||
|
|
||||||
@ -16,8 +16,6 @@ class Map extends Model
|
|||||||
|
|
||||||
private float $area = 0.0;
|
private float $area = 0.0;
|
||||||
|
|
||||||
private bool $unlisted = false;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->bounds = Bounds::createDirectly(-90.0, -180.0, 90.0, 180.0);
|
$this->bounds = Bounds::createDirectly(-90.0, -180.0, 90.0, 180.0);
|
||||||
@ -63,11 +61,6 @@ class Map extends Model
|
|||||||
$this->area = $area;
|
$this->area = $area;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUnlisted(bool $unlisted): void
|
|
||||||
{
|
|
||||||
$this->unlisted = $unlisted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName(): string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
@ -107,9 +100,4 @@ class Map extends Model
|
|||||||
{
|
{
|
||||||
return $this->area;
|
return $this->area;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnlisted(): bool
|
|
||||||
{
|
|
||||||
return $this->unlisted;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,6 @@
|
|||||||
<form id="metadataForm" class="marginTop" data-no-submit="true">
|
<form id="metadataForm" class="marginTop" data-no-submit="true">
|
||||||
<input class="fullWidth" type="text" name="name" value="<?= $mapName ?>" placeholder="Name of the map">
|
<input class="fullWidth" type="text" name="name" value="<?= $mapName ?>" placeholder="Name of the map">
|
||||||
<textarea class="fullWidth marginTop" name="description" rows="4" placeholder="Description of the map"><?= $mapDescription ?></textarea>
|
<textarea class="fullWidth marginTop" name="description" rows="4" placeholder="Description of the map"><?= $mapDescription ?></textarea>
|
||||||
<div class="marginTop">
|
|
||||||
<input type="checkbox" id="unlisted" name="unlisted" <?= $mapUnlisted ? 'checked' : '' ?>><label for="unlisted">Unlisted</label>
|
|
||||||
</div>
|
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<button class="marginTop marginRight" type="submit">Apply</button><!--
|
<button class="marginTop marginRight" type="submit">Apply</button><!--
|
||||||
--><button id="closeMetadataButton" class="gray marginTop" type="button">Close</button>
|
--><button id="closeMetadataButton" class="gray marginTop" type="button">Close</button>
|
||||||
|
@ -42,25 +42,36 @@ TODO: condition!
|
|||||||
</div>
|
</div>
|
||||||
<p class="bold center marginTop marginBottom">OR</p>
|
<p class="bold center marginTop marginBottom">OR</p>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<div id="restrictions" class="marginTop marginBottom">
|
<div id="restrictions" class="marginTop marginBottom">
|
||||||
<h3>Optional restrictions</h3>
|
<h3>Optional restrictions</h3>
|
||||||
<div class="marginTop">
|
<div>
|
||||||
<input type="checkbox" id="timerEnabled" name="timerEnabled" value="timerEnabled" /><label id="timeLimitLabel" for="timerEnabled">Time limit measured in seconds</label>
|
<div>
|
||||||
|
<input type="checkbox" id="timerEnabled" name="timerEnabled" value="timerEnabled" />
|
||||||
|
<label id="timeLimitLabel" for="timerEnabled">Time limit measured in seconds</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="range" id="timeLimit" name="timeLimit" min="10" max="1800" step="10" value="300" />
|
||||||
|
</div>
|
||||||
|
<div id="timeLimitType">
|
||||||
|
<label>Time limit</label>
|
||||||
|
<input type="radio" id="timeLimitTypeGame" name="timeLimitType" value="game" checked />
|
||||||
|
<label for="timeLimitTypeGame">for the whole game</label>
|
||||||
|
<input type="radio" id="timeLimitTypeRound" name="timeLimitType" value="round" />
|
||||||
|
<label for="timeLimitTypeRound">per round</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="timeLimitType">
|
<div>
|
||||||
<input class="fullWidth" type="range" id="timeLimit" name="timeLimit" min="10" max="1800" step="10" value="300" />
|
<input type="checkbox" id="noMove" name="noMove" value="noMove" />
|
||||||
<input type="radio" id="timeLimitTypeGame" name="timeLimitType" value="game" checked /><label for="timeLimitTypeGame">for the whole game</label>
|
<label for="noMove">No movement allowed</label>
|
||||||
<input class="marginLeft" type="radio" id="timeLimitTypeRound" name="timeLimitType" value="round" /><label for="timeLimitTypeRound">per round</label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="marginTop">
|
<div>
|
||||||
<input type="checkbox" id="noMove" name="noMove" value="noMove" /><label for="noMove">No movement allowed</label>
|
<input type="checkbox" id="noZoom" name="noZoom" value="noZoom" />
|
||||||
|
<label for="noZoom">No zoom allowed</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="marginTop">
|
<div>
|
||||||
<input type="checkbox" id="noZoom" name="noZoom" value="noZoom" /><label for="noZoom">No zoom allowed</label>
|
<input type="checkbox" id="noPan" name="noPan" value="noPan" />
|
||||||
</div>
|
<label for="noPan">No camera change allowed</label>
|
||||||
<div class="marginTop">
|
|
||||||
<input type="checkbox" id="noPan" name="noPan" value="noPan" /><label for="noPan">No camera change allowed</label>
|
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="mapId" id="challengeMapId" />
|
<input type="hidden" name="mapId" id="challengeMapId" />
|
||||||
</div>
|
</div>
|
||||||
@ -75,7 +86,7 @@ TODO: condition!
|
|||||||
@section(main)
|
@section(main)
|
||||||
<div id="mapContainer">
|
<div id="mapContainer">
|
||||||
<?php foreach ($maps as $map): ?>
|
<?php foreach ($maps as $map): ?>
|
||||||
<div class="mapItem <?= $map['unlisted'] ? 'unlisted' : '' ?>">
|
<div class="mapItem">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<p class="title"><?= $map['name'] ?></p>
|
<p class="title"><?= $map['name'] ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user