* After adding an entry the option to view or edit the entry is now available
* Added game info tool.
* Added new fields for a game collection
+ * input and textarea do have a maxlength now. JS used to display the remaining chars
1.0 - Castle 20210106
* First usable version
-* input length check and display
-
* stats overview page. amount of entries. file / cache and db storage. Version info and where to find it.
* User and groupmanagement: Check where a user or group is used!
* Better error handling and display while adding / update and delete
-<p data-field-name="text3-description" class="uk-text-lead" data-field-id="<?php echo $field['identifier']; ?>"><?php echo Summoner::ifset($field, 'value'); ?></p>
+<p data-field-name="text3-description" class="uk-text-lead" data-field-id="<?php echo $field['identifier']; ?>"><?php echo nl2br(Summoner::ifset($field, 'value')); ?></p>
-<p data-field-name="textarea-content" data-field-id="<?php echo $field['identifier']; ?>" class="uk-dropcap"><?php echo Summoner::ifset($field, 'value'); ?></p>
+<p data-field-name="textarea-content" data-field-id="<?php echo $field['identifier']; ?>" class="uk-dropcap"><?php echo nl2br(Summoner::ifset($field, 'value')); ?></p>
-<p data-field-name="textarea" data-field-id="<?php echo $field['identifier']; ?>"><span class="uk-text-muted"><?php echo $field['displayname']; ?>:</span> <?php echo Summoner::ifset($field, 'value'); ?></p>
+<p data-field-name="textarea" data-field-id="<?php echo $field['identifier']; ?>"><span class="uk-text-muted"><?php echo $field['displayname']; ?>:</span> <?php echo nl2br(Summoner::ifset($field, 'value')); ?></p>
<div class="uk-margin">
<label class="uk-form-label" for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
<div class="uk-form-controls">
- <input class="uk-input" id="<?php echo $field['identifier']; ?>" type="number" autocomplete="off"
+ <input class="uk-input" id="<?php echo $field['identifier']; ?>" type="number"
+ autocomplete="off" maxlength="10"
name="fdata[<?php echo $field['identifier']; ?>]"
value="<?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?>"
>
<input class="uk-input" id="<?php echo $field['identifier']; ?>" type="text" autocomplete="off"
name="fdata[<?php echo $field['identifier']; ?>]"
value="<?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?>"
+ maxlength="128"
>
+ <small id="<?php echo $field['identifier']; ?>_counter" class="uk-float-right"><?php echo 128-strlen(Summoner::ifset($TemplateData['editData'], $field['identifier'])); ?></small>
<?php if(Summoner::ifset($field,'bulkedit')) { ?>
<select class="uk-select" name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">
<option value="">Select bulk edit option</option>
<?php } ?>
</div>
</div>
+
+<script type="text/javascript">
+ {
+ const inputElement = document.getElementById("<?php echo $field['identifier']; ?>");
+ const inputCounter = document.getElementById("<?php echo $field['identifier']; ?>_counter");
+
+ inputElement.addEventListener("input", event => {
+ const target = event.currentTarget;
+ const maxLength = target.getAttribute("maxlength");
+ const currentLength = target.value.length;
+
+ inputCounter.innerHTML = `${maxLength - currentLength}`;
+ });
+ }
+</script>
<label class="uk-form-label" for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
<div class="uk-form-controls">
<textarea class="uk-textarea" autocomplete="off"
- id="<?php echo $field['identifier']; ?>" rows="3"
+ id="<?php echo $field['identifier']; ?>"
+ rows="3" maxlength="255"
name="fdata[<?php echo $field['identifier']; ?>]"><?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?></textarea>
+ <small id="<?php echo $field['identifier']; ?>_counter" class="uk-float-right"><?php echo 255-strlen(Summoner::ifset($TemplateData['editData'], $field['identifier'])); ?></small>
<?php if(Summoner::ifset($field,'bulkedit')) { ?>
<select class="uk-select" name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">
<option value="">Select bulk edit option</option>
<?php } ?>
</div>
</div>
+
+<script type="text/javascript">
+ {
+ const textarea = document.getElementById("<?php echo $field['identifier']; ?>");
+ const textareaCounter = document.getElementById("<?php echo $field['identifier']; ?>_counter");
+
+ textarea.addEventListener("input", event => {
+ const target = event.currentTarget;
+ const maxLength = target.getAttribute("maxlength");
+ const currentLength = target.value.length;
+
+ textareaCounter.innerHTML = `${maxLength - currentLength}`;
+ });
+ }
+</script>
<label class="uk-form-label" for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
<div class="uk-form-controls">
<textarea class="uk-textarea" autocomplete="off"
- id="<?php echo $field['identifier']; ?>" rows="6"
+ id="<?php echo $field['identifier']; ?>"
+ rows="8"
name="fdata[<?php echo $field['identifier']; ?>]"><?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?></textarea>
<?php if(Summoner::ifset($field,'bulkedit')) { ?>
<select class="uk-select" name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">