summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin.html10
-rw-r--r--createStory.php2
-rw-r--r--index.php33
3 files changed, 35 insertions, 10 deletions
diff --git a/admin.html b/admin.html
index a17ff0f..000d7ea 100644
--- a/admin.html
+++ b/admin.html
@@ -7,7 +7,8 @@
<script src="js/bootstrap.min.js"></script>
<script>
function createNewStory() {
- var data = new FormData($('#create-story-form')[0]);
+ var form = $('#create-story-form')[0];
+ var data = new FormData(form);
//var file = $('#story-logo').prop('files')[0];
//data.append('file', file);
jQuery.ajax({
@@ -21,7 +22,8 @@
console.log("Success: Files sent!");
console.log(data);
console.log(textStatus);
- }).fail(function(jqXHR, textStatus){
+ $('#newSeriesModal').modal('hide');
+ forform }).fail(function(jqXHR, textStatus){
console.log("An error occurred, the files couldn't be sent!");
console.log(jqXHR);
console.log(textStatus);
@@ -83,6 +85,10 @@
<input type="text" class="form-control" id="story-name" name="story-name">
</div>
<div class="form-group">
+ <label for="story-description">Beschreibung der Kindergeschichte:</label>
+ <textarea class="form-control" rows="5" id="story-description" name="story-description"></textarea>
+ </div>
+ <div class="form-group">
<input type="file" name="story-logo" id="story-logo">
</div>
<button type="submit" class="btn btn-info btn-sm">Anlegen</button>
diff --git a/createStory.php b/createStory.php
index 6a115d9..83d9000 100644
--- a/createStory.php
+++ b/createStory.php
@@ -10,7 +10,7 @@ require_once(__DIR__.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'commons'.DIR
require_once(__DIR__.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'functions.stories.inc.php');
$storyName = getMandatoryPostParameter('story-name', '', true);
-$storyLogoFile = getOptionalPostParameter('story-logo');
+$storyLogoFile = getOptionalFileParameter('story-logo');
$storyDescription = getOptionalPostParameter('story-description');
$pathToStory = __DIR__.DIRECTORY_SEPARATOR.'stories'.DIRECTORY_SEPARATOR.generateDirectoryName($storyName);
diff --git a/index.php b/index.php
index 6ccf8d7..85b72ff 100644
--- a/index.php
+++ b/index.php
@@ -15,7 +15,8 @@ $characters = array();
foreach ($storiesDirContent as $storyName) {
$storyPath = $storiesDir.DIRECTORY_SEPARATOR.$storyName;
if (is_dir($storyPath)) {
- array_push($stories, $storyName);
+ $storyDescription = file_get_contents($storyPath.DIRECTORY_SEPARATOR.'description.txt');
+ $stories[$storyName] = $storyDescription;
if ($currentStoryIsSet && $currentStory == $storyName) {
$charactersDirContent = array_diff(scandir($storyPath), array('..', '.'));
foreach ($charactersDirContent as $character) {
@@ -72,22 +73,23 @@ $currentStoryName = visibleName($currentStory);
<ul class="nav navbar-nav">
<?php
foreach ($stories as $storyName) {
- $cssClass = ($storyName == $currentStory) ? " class=\"active\"" : "";
$visibleName = visibleName($storyName);
+ $cssClass = ($visibleName == $currentStoryName) ? " class=\"active\"" : "";
?>
- <li<?=$cssClass;?>><a href="index.php?story=<?=$storyName;?>"><?=$visibleName;?></a></li>
+ <li<?=$cssClass;?>><a href="index.php?story=<?=$storyName;?>"><?=$visibleName;?></a></li>
<?php
}
?>
-</ul>
+ </ul>
</div>
</div>
</nav>
<div class="spacer"></div>
<div class="container">
+<?php if ($currentStoryIsSet) { ?>
<div class="row">
<div class="col-md-7 text-center">
- <img class="img-fluid mb-3 mb-md-0 story-logo" src="<?=$currentStory?>/logo.png" alt="<?=$currentStoryName;?>" title="<?=$currentStoryName;?>">
+ <img class="img-fluid mb-3 mb-md-0 story-logo" src="stories/<?=urlencode($currentStory)?>/logo.png" alt="<?=$currentStoryName;?>" title="<?=$currentStoryName;?>">
</div>
</div>
<?php
@@ -97,7 +99,7 @@ $currentStoryName = visibleName($currentStory);
<!-- <?=$characterName;?> -->
<div class="row">
<div class="col-md-7 text-center">
- <img class="img-fluid rounded mb-3 mb-md-0 figure-pic" src="<?=$currentStory?>/<?=$character;?>/passphoto.png" alt="<?=$characterName;?>" title="<?=$characterName;?>">
+ <img class="img-fluid rounded mb-3 mb-md-0 figure-pic" src="stories/<?=urlencode($currentStory)?>/<?=urlencode($character);?>/passphoto.png" alt="<?=$characterName;?>" title="<?=$characterName;?>">
</div>
<div class="col-md-5">
<h3><?=$characterName;?></h3>
@@ -109,7 +111,24 @@ $currentStoryName = visibleName($currentStory);
<hr>
<?php
}
- ?>
+} else {
+ foreach ($stories as $story=>$storyDescription) {
+ $storyName = visibleName($story);
+?>
+ <div class="row">
+ <div class="col-md-7 text-center">
+ <img class="img-fluid mb-3 mb-md-0 story-logo" src="stories/<?=urlencode($story);?>/logo.png" alt="<?=$storyName;?>" title="<?=$storyName;?>">
+ </div>
+ <div class="col-md-5">
+ <h3><?=$storyName;?></h3>
+ <p class="figure-desc"><?=$storyDescription;?></p>
+ </div>
+ </div>
+ </div>
+<?
+ }
+}
+?>
</div>
</body>
</html>