Questtype ?Textinput?: add support for field sizes (Issue #252) and general improvements
This commit is contained in:
commit
8d903135a5
3476 changed files with 599099 additions and 0 deletions
53
questtypes/submit/html/quest.tpl
Normal file
53
questtypes/submit/html/quest.tpl
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php if(!is_null($exception)) : ?>
|
||||
<p class="error">
|
||||
<?php if($exception->getNestedException() instanceof \hhu\z\exceptions\WrongFiletypeException) : ?>
|
||||
<?=sprintf(_('File has wrong type “%s”'), $exception->getNestedException()->getType())?>
|
||||
<?php elseif($exception->getNestedException() instanceof \hhu\z\exceptions\WrongFiletypeException) : ?>
|
||||
<?=_('File exceeds size maximum')?>
|
||||
<?php elseif($exception->getNestedException() instanceof \hhu\z\exceptions\FileUploadException) : ?>
|
||||
<?=sprintf(_('Error during file upload: %s'), $exception->getNestedException()->getNestedMessage())?>
|
||||
<?php else : ?>
|
||||
<?=$exception->getNestedException()->getMessage()?>
|
||||
<?php endif ?>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
<?php if(!$solved && (is_null($lastStatus) || count($submissions) == 0 || $lastStatus['created'] > $submissions[count($submissions)-1]['created'])) : ?>
|
||||
<form method="post" enctype="multipart/form-data" class="submit">
|
||||
<input type="file" name="answers" required="required" accept="<?=implode(',', array_map(function($m) { return $m['mimetype']; }, $mimetypes))?>" />
|
||||
<p><?=_('Allowed file types')?>:</p>
|
||||
<ul>
|
||||
<?php foreach($mimetypes as &$mimetype) : ?>
|
||||
<li><?=sprintf(_('%s-files'), strtoupper(explode('/',$mimetype['mimetype'])[1]))?> <?php if($mimetype['size'] > 0) : ?>(<?=_('max.')?> <?=round($mimetype['size']/(1024*1024),2)?> MiB)<?php endif ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<input type="submit" name="submit" value="<?=_('solve')?>" />
|
||||
</form>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if(count($submissions) > 0) : ?>
|
||||
<h2><?=_('Your submissions')?></h2>
|
||||
<ol class="admnql">
|
||||
<?php foreach($submissions as $index => &$submission) : ?>
|
||||
<li>
|
||||
<a href="<?=$linker->link(array('uploads','seminary',$seminary['url'], $submission['upload']['url']))?>"><?=$submission['upload']['name']?></a><span><?=sprintf(_('submitted at %s on %s h'), $dateFormatter->format(new \DateTime($submission['created'])), $timeFormatter->format(new \DateTime($submission['created'])))?></span>
|
||||
<?php if($lastStatus['status'] == 1 && ($index > 0 || count($submissions) == 1)) : ?>
|
||||
<p><?=_('This submission is waiting for approval')?></p>
|
||||
<?php endif ?>
|
||||
<?php if(count($submission['comments']) > 0) : ?>
|
||||
<ol>
|
||||
<?php foreach($submission['comments'] as &$comment) : ?>
|
||||
<li>
|
||||
<?php if(array_key_exists('user', $comment) && array_key_exists('character', $comment['user'])) : ?>
|
||||
<p class="fwb"><?=sprintf(_('Approved on %s at %s'), $dateFormatter->format(new \DateTime($comment['created'])), $timeFormatter->format(new \DateTime($comment['created'])))?></p>
|
||||
<?php endif ?>
|
||||
<?php if(!empty($comment['comment'])) : ?>
|
||||
<p><?=\hhu\z\Utils::t($comment['comment'])?></p>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
<?php endif ?>
|
||||
33
questtypes/submit/html/submission.tpl
Normal file
33
questtypes/submit/html/submission.tpl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php if(count($submissions) > 0) : ?>
|
||||
<ol class="admnql">
|
||||
<?php foreach($submissions as &$submission) : ?>
|
||||
<li>
|
||||
<p><a href="<?=$linker->link(array('uploads','seminary',$seminary['url'], $submission['upload']['url']))?>"><?=$submission['upload']['name']?></a></p>
|
||||
<p><small><?=sprintf(_('submitted at %s on %s h'), $dateFormatter->format(new \DateTime($submission['created'])), $timeFormatter->format(new \DateTime($submission['created'])))?></small></p>
|
||||
<?php if(count($submission['comments']) > 0) : ?>
|
||||
<ol>
|
||||
<?php foreach($submission['comments'] as &$comment) : ?>
|
||||
<li>
|
||||
<?php if(array_key_exists('user', $comment) && array_key_exists('character', $comment['user'])) : ?>
|
||||
<p class="fwb"><?=sprintf(_('Approved by %s on %s at %s'), $comment['user']['character']['name'], $dateFormatter->format(new \DateTime($comment['created'])), $timeFormatter->format(new \DateTime($comment['created'])))?></p>
|
||||
<?php endif ?>
|
||||
<p><?=\hhu\z\Utils::t($comment['comment'])?></p>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
<?php endif ?>
|
||||
|
||||
<form method="post" class="logreg">
|
||||
<?php $submission = array_pop($submissions); ?>
|
||||
<?php if(!$solved) : ?>
|
||||
<?=_('Comment')?><br />
|
||||
<textarea name="characterdata[comment]"></textarea><br />
|
||||
<input type="hidden" name="characterdata[submission_id]" value="<?=$submission['id']?>" />
|
||||
<input type="submit" name="submit" value="<?=_('solved')?>" />
|
||||
<input type="submit" name="submit" value="<?=_('unsolved')?>" />
|
||||
<?php endif ?>
|
||||
</form>
|
||||
Loading…
Add table
Add a link
Reference in a new issue