]> 91.132.146.200 Git - bibliotheca-php.git/commitdiff
theme 98: cleanups and manageentry. looks good now. Needs testing
authorBanana <mail@bananas-playground.net>
Sun, 30 Apr 2023 10:31:26 +0000 (12:31 +0200)
committerBanana <mail@bananas-playground.net>
Sun, 30 Apr 2023 10:31:26 +0000 (12:31 +0200)
19 files changed:
TODO
webclient/view/98/managecollectionfields/managecollectionfields.html
webclient/view/98/managecolletions/managecolletions.html
webclient/view/98/manageentry/field-lookupmultiple.html [new file with mode: 0644]
webclient/view/98/manageentry/field-number.html [new file with mode: 0644]
webclient/view/98/manageentry/field-selection.html [new file with mode: 0644]
webclient/view/98/manageentry/field-text.html [new file with mode: 0644]
webclient/view/98/manageentry/field-text3.html [new file with mode: 0644]
webclient/view/98/manageentry/field-textarea.html [new file with mode: 0644]
webclient/view/98/manageentry/field-unknown.html [new file with mode: 0644]
webclient/view/98/manageentry/field-upload.html [new file with mode: 0644]
webclient/view/98/manageentry/field-upload_multiple.html [new file with mode: 0644]
webclient/view/98/manageentry/field-year.html [new file with mode: 0644]
webclient/view/98/manageentry/manageentry.html [new file with mode: 0644]
webclient/view/98/managegroups/managegroups.html
webclient/view/98/managetags/managetags.html
webclient/view/98/manageusers/manageusers.html
webclient/view/98/ui/js/suggest-tag.js [new file with mode: 0644]
webclient/view/default/manageentry/manageentry.php

diff --git a/TODO b/TODO
index f9c384e8f38203f635411b614733b1549f00f50a..2f847c1b9186aad3d38a82bf1f5cc4b54572177d 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,6 @@
 * fix bulkedit
 * change multiple-attachment to a field which tells it is used for a image gallery
+* update JS and remove deprecations
 * complete profile view. Groups still missing.
 * minimal theme
 ** https://watercss.kognise.dev/
index f919ad62adc4adab0f1846a001c818ea4fbd4761..fb163d053a092954fc236f976e3687c96c1f5c9b 100644 (file)
@@ -1,6 +1,6 @@
-<h3 class="uk-h3">Manage your fields for: <a href="index.php?p=managecolletions&m=edit&id=<?php echo $TemplateData['editData']['id']; ?>"><?php echo $TemplateData['editData']['name']; ?></a></h3>
+<h3 >Manage your fields for: <a href="index.php?p=managecolletions&m=edit&id=<?php echo $TemplateData['editData']['id']; ?>"><?php echo $TemplateData['editData']['name']; ?></a></h3>
 
-<h4 class="uk-h4">Add or remove a field</h4>
+<h4 >Add or remove a field</h4>
 <p>
        Just use drag and drop below to add, remove or order your fields.<br />
        Removing a field will <b>remove</b> the stored data from the collection.<br />
@@ -41,7 +41,7 @@
 <form method="post" onsubmit="return saveOrderAndSubmit()">
        <input type="hidden" name="fdata[fieldSortString]" id="fieldSort"
           value="<?php echo Summoner::ifset($TemplateData['editData'], 'fieldSortString'); ?>">
-       <input class="uk-button uk-button-primary" type="submit" name="submitForm" value="Save">
+       <input type="submit" name="submitForm" value="Save">
 </form>
 
 
index b0d7232e372bca92d000392b0ad80013c5bcf6e6..00e1b10e5a12d5959944f61632003200a70c18cf 100644 (file)
        </div>
 </form>
 
-<h4 class="uk-h4">Available collections</h4>
+<h4>Available collections</h4>
 <div class="sunken-panel">
        <table width="100%">
                <thead>
diff --git a/webclient/view/98/manageentry/field-lookupmultiple.html b/webclient/view/98/manageentry/field-lookupmultiple.html
new file mode 100644 (file)
index 0000000..d2e9315
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+$existingFieldValue = array();
+if(Summoner::ifset($TemplateData['editData'], $field['identifier'])) {
+       $existingFieldValue = $TemplateData['editData'][$field['identifier']];
+}
+?>
+<div class="field-row-stacked">
+       <label for="<?php echo $field['identifier']; ?>-input"><?php echo $field['displayname']; ?></label>
+
+       <div class="input-multiple-listbox" id="<?php echo $field['identifier']; ?>-listbox">
+       <?php
+       if(!empty($existingFieldValue)) {
+               foreach($existingFieldValue as $ev) { ?>
+
+               <div class="input-multiple-template" id="<?php echo $field['identifier']; ?>-<?php echo $ev; ?>">
+                       <a onclick="removeTag('<?php echo $ev; ?>','<?php echo $field['identifier']; ?>')" title="click to remove"><span><?php echo $ev; ?></span>></a>
+               </div>
+
+       <?php
+               }
+       }
+       ?>
+       </div>
+       <input id="<?php echo $field['identifier']; ?>-input" type="text" autocomplete="off"
+               name="<?php echo $field['identifier']; ?>-input"
+               list="<?php echo $field['identifier']; ?>-datalist"
+               onkeypress="addTag(event,'<?php echo $field['identifier']; ?>','<?php echo $field['inputValidation']; ?>')"
+               placeholder="Write and press enter."
+       >
+       <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+       <select name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">
+               <option value="">Select bulk edit option</option>
+               <option value="add">Add</option>
+               <option value="replace">Replace</option>
+               <option value="empty">Clear</option>
+       </select>
+       <?php } ?>
+
+</div>
+
+<datalist id="<?php echo $field['identifier']; ?>-datalist">
+       <?php
+               if(isset($field['suggestion'])) {
+                       foreach($field['suggestion'] as $t) {
+       ?>
+       <option value="<?php echo $t; ?>"><?php echo $t; ?></option>
+       <?php
+                       }
+               }
+       ?>
+</datalist>
+
+<input type="hidden" name="fdata[<?php echo $field['identifier']; ?>]" id="<?php echo $field['identifier']; ?>-save" value="<?php echo implode(',',$existingFieldValue); ?>" />
+
+<div class="input-multiple-template" id="<?php echo $field['identifier']; ?>-template" style="display: none;">
+       <a onclick="removeTag('','<?php echo $field['identifier']; ?>')" title="click to remove"><span></span></a>
+</div>
diff --git a/webclient/view/98/manageentry/field-number.html b/webclient/view/98/manageentry/field-number.html
new file mode 100644 (file)
index 0000000..1e68465
--- /dev/null
@@ -0,0 +1,16 @@
+<div class="field-row-stacked">
+       <label for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
+       <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']); ?>"
+       />
+
+       <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+       <select name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">
+               <option value="">Select bulk edit option</option>
+               <option value="replace">Replace</option>
+               <option value="empty">Clear</option>
+       </select>
+       <?php } ?>
+</div>
diff --git a/webclient/view/98/manageentry/field-selection.html b/webclient/view/98/manageentry/field-selection.html
new file mode 100644 (file)
index 0000000..28bd051
--- /dev/null
@@ -0,0 +1,19 @@
+<div class="field-row-stacked">
+       <label for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
+       <select id="<?php echo $field['identifier']; ?>" name="fdata[<?php echo $field['identifier']; ?>]">
+               <option value="">Please select</option>
+               <?php foreach($field['options'] as $k=>$v) { ?>
+               <option value="<?php echo $v; ?>"
+                       <?php if(Summoner::ifsetValue($TemplateData['editData'], $field['identifier'],$v)) echo 'selected'; ?>
+               ><?php echo $v; ?></option>
+               <?php } ?>
+       </select>
+
+       <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+       <select name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">
+               <option value="">Select bulk edit option</option>
+               <option value="replace">Replace</option>
+               <option value="empty">Clear</option>
+       </select>
+       <?php } ?>
+</div>
diff --git a/webclient/view/98/manageentry/field-text.html b/webclient/view/98/manageentry/field-text.html
new file mode 100644 (file)
index 0000000..2d94cd3
--- /dev/null
@@ -0,0 +1,34 @@
+<div class="field-row-stacked">
+       <label for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?>
+               (<span id="<?php echo $field['identifier']; ?>_counter"><?php echo 128-strlen(Summoner::ifset($TemplateData['editData'], $field['identifier'])); ?></span>)
+       </label>
+       <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"
+       />
+
+       <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+       <select name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">
+               <option value="">Select bulk edit option</option>
+               <option value="add">Add</option>
+               <option value="replace">Replace</option>
+               <option value="empty">Clear</option>
+       </select>
+       <?php } ?>
+</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>
diff --git a/webclient/view/98/manageentry/field-text3.html b/webclient/view/98/manageentry/field-text3.html
new file mode 100644 (file)
index 0000000..41183c6
--- /dev/null
@@ -0,0 +1,34 @@
+<div class="field-row-stacked">
+       <label for="<?php echo $field['identifier']; ?>">
+               <?php echo $field['displayname']; ?>
+               (<span id="<?php echo $field['identifier']; ?>_counter" ><?php echo 255-strlen(Summoner::ifset($TemplateData['editData'], $field['identifier'])); ?></span>)
+       </label>
+       <textarea autocomplete="off"
+                         id="<?php echo $field['identifier']; ?>"
+                         rows="3" maxlength="255"
+                         name="fdata[<?php echo $field['identifier']; ?>]"><?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?></textarea>
+
+       <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+       <select  name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">
+               <option value="">Select bulk edit option</option>
+               <option value="add">Add</option>
+               <option value="replace">Replace</option>
+               <option value="empty">Clear</option>
+       </select>
+       <?php } ?>
+</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>
diff --git a/webclient/view/98/manageentry/field-textarea.html b/webclient/view/98/manageentry/field-textarea.html
new file mode 100644 (file)
index 0000000..b89c5b9
--- /dev/null
@@ -0,0 +1,15 @@
+<div class="field-row-stacked">
+       <label for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
+       <textarea autocomplete="off"
+               id="<?php echo $field['identifier']; ?>"
+        rows="10"
+               name="fdata[<?php echo $field['identifier']; ?>]"><?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?></textarea>
+       <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+       <select name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">
+               <option value="">Select bulk edit option</option>
+               <option value="add">Add</option>
+               <option value="replace">Replace</option>
+               <option value="empty">Clear</option>
+       </select>
+       <?php } ?>
+</div>
diff --git a/webclient/view/98/manageentry/field-unknown.html b/webclient/view/98/manageentry/field-unknown.html
new file mode 100644 (file)
index 0000000..8f3488f
--- /dev/null
@@ -0,0 +1,3 @@
+<div class="field-row-stacked">
+       <label>Missing template for: <?php echo $field['identifier']; ?></label>
+</div>
diff --git a/webclient/view/98/manageentry/field-upload.html b/webclient/view/98/manageentry/field-upload.html
new file mode 100644 (file)
index 0000000..2cd1889
--- /dev/null
@@ -0,0 +1,18 @@
+<div class="field-row-stacked">
+       <label for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
+
+               <input type="file" id="<?php echo $field['identifier']; ?>" multiple="false"
+                  name="fdata[<?php echo $field['identifier']; ?>]"
+               />
+
+               <?php if(Summoner::ifset($TemplateData['editData'], $field['identifier'])) { ?>
+               <?php echo '<a href="'.$TemplateData['storagePath'].'/'.Summoner::ifset($TemplateData['editData'], $field['identifier']).'">'.Summoner::ifset($TemplateData['editData'], $field['identifier']).'</a>'; ?>
+               <input type="checkbox" value="<?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?>"
+                          name="fdata[<?php echo $field['identifier']; ?>_delete]"
+                          title="Delete"
+                          id="fdata[<?php echo $field['identifier']; ?>_delete"
+               />
+               <label for="fdata[<?php echo $field['identifier']; ?>_delete">Delete</label>
+               <?php } ?>
+
+</div>
diff --git a/webclient/view/98/manageentry/field-upload_multiple.html b/webclient/view/98/manageentry/field-upload_multiple.html
new file mode 100644 (file)
index 0000000..0d1423a
--- /dev/null
@@ -0,0 +1,23 @@
+<div class="field-row-stacked">
+       <label for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
+       <input type="file" id="<?php echo $field['identifier']; ?>" multiple="true"
+               name="fdata[<?php echo $field['identifier']; ?>][]"
+       />
+
+       <?php
+       if(isset($TemplateData['editData']) && !empty($TemplateData['editData'][$field['identifier']])) {
+               foreach($TemplateData['editData'][$field['identifier']] as $e) {
+       ?>
+               <a target="_blank" href="<?php echo $TemplateData['storagePath'].'/'.$e; ?>"><?php echo $e; ?></a>
+               <input type="checkbox" value="<?php echo $e; ?>"
+                               name="fdata[<?php echo $field['identifier']; ?>_delete][]"
+                               title="Delete"
+                               id="<?php echo $field['identifier']; ?>_delete"
+               />
+               <label for="<?php echo $field['identifier']; ?>_delete">Delete</label>
+               <br>
+       <?php
+               }
+       }
+       ?>
+</div>
diff --git a/webclient/view/98/manageentry/field-year.html b/webclient/view/98/manageentry/field-year.html
new file mode 100644 (file)
index 0000000..143893d
--- /dev/null
@@ -0,0 +1,16 @@
+<div class="field-row-stacked">
+       <label for="<?php echo $field['identifier']; ?>"><?php echo $field['displayname']; ?></label>
+       <input id="<?php echo $field['identifier']; ?>" type="number" autocomplete="off"
+               placeholder="YYYY" min="0000" max="9999"
+               name="fdata[<?php echo $field['identifier']; ?>]"
+               value="<?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?>"
+       />
+
+       <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+       <select name="fdata[additionalEditOption][<?php echo $field['identifier']; ?>]">
+               <option value="">Select bulk edit option</option>
+               <option value="replace">Replace</option>
+               <option value="empty">Clear</option>
+       </select>
+       <?php } ?>
+</div>
diff --git a/webclient/view/98/manageentry/manageentry.html b/webclient/view/98/manageentry/manageentry.html
new file mode 100644 (file)
index 0000000..442071c
--- /dev/null
@@ -0,0 +1,137 @@
+<?php
+if(!empty($TemplateData['editFields'])) {
+       $_entry = '';
+       if(!empty($TemplateData['editData']) && isset($TemplateData['editData']['id'])) {
+               $_entry = $TemplateData['editData']['id'];
+?>
+               <h3>Update an entry in: <a href="index.php?p=collections&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>"><?php echo $TemplateData['loadedCollection']['name']; ?></a></h3>
+               <p>
+                       <a href="index.php?p=entry&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>&id=<?php echo $TemplateData['editData']['id']; ?>">View entry</a>
+               </p>
+<?php } else { ?>
+               <h3>Add an entry to: <a href="index.php?p=collections&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>"><?php echo $TemplateData['loadedCollection']['name']; ?></a></h3>
+<?php } ?>
+
+<?php if(!empty($TemplateData['availableTools'])) { ?>
+<h4>Available tools</h4>
+<ul>
+       <?php foreach($TemplateData['availableTools'] as $tool) { ?>
+       <li><a href="index.php?p=tool&t=<?php echo $tool['action']; ?>&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>&id=<?php echo $_entry; ?>"
+              target="<?php echo $tool['target']; ?>"><?php echo $tool['name']; ?> (<?php echo $tool['description']; ?>)</a></li>
+       <?php } ?>
+</ul>
+<?php } ?>
+
+<script type="text/javascript" src="view/98/ui/js/suggest-tag.js"></script>
+
+<form class="maxSizeForm" method="post" enctype="multipart/form-data">
+
+       <?php
+       foreach($TemplateData['editFields'] as $field) {
+               $_editFieldView = Summoner::themefile('manageentry/field-'.$field['type'].'.html', UI_THEME);
+               if(file_exists($_editFieldView)) {
+                       require $_editFieldView;
+               }
+               else {
+                       require $TemplateData['_editFieldViewDefault'];
+               }
+       }
+
+       if(!empty($TemplateData['editData']['_isOwner'])) {
+       ?>
+
+       <div class="field-row-stacked">
+               <label>Rights *</label></td>
+
+               <table>
+                       <thead>
+                       <tr>
+                               <th>User</th>
+                               <th>Group</th>
+                               <th>Other</th>
+                       </tr>
+                       </thead>
+                       <tbody>
+                       <tr>
+                               <td>
+                                       <input id="user_read" type="checkbox" name="fdata[rights][user][read]" value="1"
+                                       <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'read', 'r')) echo "checked"; ?>>
+                                       <label for="user_read">r &nbsp; &nbsp; &nbsp;</label>
+
+                                       <input id="user_write" type="checkbox" name="fdata[rights][user][write]" value="1"
+                                       <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'write', 'w')) echo "checked"; ?>>
+                                       <label for="user_write">w &nbsp; &nbsp; &nbsp;</label>
+
+                                       <input id="user_delete" type="checkbox" name="fdata[rights][user][delete]" value="1"
+                                       <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'delete', 'x')) echo "checked"; ?>>
+                                       <label for="user_delete">x &nbsp; &nbsp; &nbsp;</label>
+                               </td>
+                               <td>
+                                       <input id="group_read" type="checkbox" name="fdata[rights][group][read]" value="1"
+                                       <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'read', 'r')) echo "checked"; ?>>
+                                       <label for="group_read">r &nbsp; &nbsp; &nbsp;</label>
+
+                                       <input id="group_write" type="checkbox" name="fdata[rights][group][write]" value="1"
+                                       <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'write', 'w')) echo "checked"; ?>>
+                                       <label for="group_write">w &nbsp; &nbsp; &nbsp;</label>
+
+                                       <input id="group_delete" type="checkbox" name="fdata[rights][group][delete]" value="1"
+                                       <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'delete', 'x')) echo "checked"; ?>>
+                                       <label for="group_delete">x &nbsp; &nbsp; &nbsp;</label>
+                               </td>
+                               <td>
+                                       <input id="other_read" type="checkbox" name="fdata[rights][other][read]" value="1"
+                                       <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'read', 'r')) echo "checked"; ?>>
+                                       <label for="other_read">r &nbsp; &nbsp; &nbsp;</label>
+
+                                       <input id="other_write" type="checkbox" name="fdata[rights][other][write]" value="1"
+                                       <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'write', 'w')) echo "checked"; ?>>
+                                       <label for="other_write">w &nbsp; &nbsp; &nbsp;</label>
+
+                                       <input id="other_delete" type="checkbox" name="fdata[rights][other][delete]" value="1"
+                                       <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'delete', 'x')) echo "checked"; ?>>
+                                       <label for="other_delete">x &nbsp; &nbsp; &nbsp;</label>
+                               </td>
+                       </tr>
+                       </tbody>
+               </table>
+       </div>
+
+       <?php } ?>
+
+       <?php if(!empty($TemplateData['editData']['_canDelete'])) { ?>
+
+       <div class="field-row-stacked">
+               <input id="doDelete" type="checkbox" name="fdata[doDelete]" value="1">
+               <label for="doDelete">Delete</label>
+       </div>
+
+       <?php } ?>
+
+       <div class="field-row-stacked">
+               <input type="submit" name="submitForm" value="Save">
+       </div>
+</form>
+
+<?php } else { ?>
+<h3>Please select a collection first</h3>
+<div class="sunken-panel">
+       <table width="100%">
+               <thead>
+               <tr>
+                       <th width="100px">Name</th>
+                       <th>Description</th>
+               </tr>
+               </thead>
+               <tbody>
+               <?php foreach($TemplateData['existingCollections'] as $k=>$v) { ?>
+               <tr>
+                       <td><a href="index.php?p=manageentry&collection=<?php echo $k; ?>"><?php echo $v['name']; ?></a></td>
+                       <td><?php echo $v['description']; ?></td>
+               <tr>
+                       <?php } ?>
+               </tbody>
+       </table>
+</div>
+
+<?php } ?>
index fdd151f4780212a2068aaba7c68a7785358c1954..2b49990f207f9a4c0bb144c58d79aa9a2a9ebc08 100644 (file)
@@ -1,5 +1,5 @@
-<h3 class="uk-h3">Group management</h3>
-<h4 class="uk-h4">Add or modify a group</h4>
+<h3>Group management</h3>
+<h4>Add or modify a group</h4>
 
 <form class="maxSizeForm" method="post">
        <div class="field-row-stacked">
@@ -30,7 +30,7 @@
        </div>
 </form>
 
-<h4 class="uk-h4">Available groups</h4>
+<h4>Available groups</h4>
 <div class="sunken-panel">
        <table width="100%">
                <thead>
index d023f3a993ec28227fcd546c65cfe4934cd67e9a..6b2170f27bb0c1bc6e08815cf63327425385ae67 100644 (file)
@@ -1,6 +1,6 @@
 <?php if(!empty($TemplateData['loadedCollection'])) { ?>
 
-       <h3 class="uk-h3">Manage Tags in: <a href="index.php?p=collections&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>"><?php echo $TemplateData['loadedCollection']['name']; ?></a></h3>
+       <h3 >Manage Tags in: <a href="index.php?p=collections&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>"><?php echo $TemplateData['loadedCollection']['name']; ?></a></h3>
        <p>
                The actions are top down. If you choose to move and rename, only move will be executed.<br />
                Deletion will remove without recover!<br />
index 8b13ffd358a9b482bfcaf45c1071c9dfc284f382..4ba84731cf7b1f933f8b629c89b55da69fbd2a74 100644 (file)
@@ -1,5 +1,5 @@
-<h3 class="uk-h3">User management</h3>
-<h4 class="uk-h4">Add or modify a user</h4>
+<h3>User management</h3>
+<h4>Add or modify a user</h4>
 
 <form method="post" class="maxSizeForm">
        <div class="field-row-stacked">
@@ -65,7 +65,7 @@
        </div>
 </form>
 
-<h4 class="uk-h4">Available users</h4>
+<h4>Available users</h4>
 <div class="sunken-panel">
        <table width="100%">
                <thead>
diff --git a/webclient/view/98/ui/js/suggest-tag.js b/webclient/view/98/ui/js/suggest-tag.js
new file mode 100644 (file)
index 0000000..77f6a9a
--- /dev/null
@@ -0,0 +1,165 @@
+/**
+ * remove a tag from the tag "cloud"
+ *
+ * @param tagString
+ * @param targetStartString
+ */
+function removeTag(tagString,targetStartString) {
+       let toRemove = document.getElementById(targetStartString + '-' + tagString);
+       let saveInput = document.getElementById(targetStartString + '-save');
+
+       if(toRemove && saveInput) {
+               let newSaveValue = _removeFromCommaString(saveInput.value,tagString);
+               saveInput.value = newSaveValue;
+               toRemove.remove();
+       }
+       else {
+               console.log("Delete element not found");
+       }
+}
+
+/**
+ * add a tag to the visible tag "cloud" and hidden form input
+ * used in the form for saving
+ *
+ * @param e
+ * @param targetStartString
+ * @param allowWhiteSpace
+ */
+function addTag(e,targetStartString,allowWhiteSpace) {
+       e = e || window.event;
+
+       if(e.keyCode === 13) {
+               let elem = e.srcElement || e.target;
+               let saveInput = document.getElementById(targetStartString + '-save');
+               let listBox = document.getElementById(targetStartString + '-listbox');
+               let newTagTemplate = document.getElementById(targetStartString + '-template');
+
+               let validateMethod = false;
+               if (allowWhiteSpace !== undefined && allowWhiteSpace.length > 0) {
+                       validateMethod = allowWhiteSpace;
+               }
+
+               let checkString = _checkForSpaceString(elem.value,validateMethod);
+
+               if(saveInput && listBox && elem && newTagTemplate && checkString) {
+                       let toAdd = elem.value;
+                       let newSaveValue = _appendToCommaString(saveInput.value,toAdd);
+
+                       let newT = newTagTemplate.cloneNode(true);
+                       newT = _fillTagTemplate(newT,toAdd,targetStartString);
+                       listBox.appendChild(newT);
+
+                       saveInput.value = newSaveValue;
+               }
+
+               elem.value = '';
+               e.preventDefault();
+       }
+}
+
+/**
+ * add given string to given existing string seperated with a comma
+ *
+ * @returns {string}
+ * @private
+ * @param theString
+ * @param toAdd
+ */
+function _appendToCommaString(theString,toAdd) {
+       if(theString.length > 0 && toAdd.length > 0) {
+               let theArray = theString.split(',');
+               if(!theArray.includes(toAdd)) {
+                       theString = theString + "," + toAdd
+               }
+       }
+       else if (toAdd.length > 0) {
+               theString = toAdd;
+       }
+
+       return theString;
+}
+
+/**
+ * add given string to given existing string seperated with a comma
+ *
+ * @returns {string}
+ * @private
+ * @param theString
+ * @param toRemove
+ */
+function _removeFromCommaString(theString,toRemove) {
+       if(theString.length > 0 && toRemove.length > 0) {
+               let theArray = theString.split(',');
+
+               if(theArray.includes(toRemove)) {
+                       for( let i = theArray.length-1; i >= 0; i--){
+                               if ( theArray[i] === toRemove) theArray.splice(i, 1);
+                       }
+
+                       theString = theArray.join(",");
+               }
+       }
+
+       return theString;
+}
+
+/**
+ * remove from given list the given value if it exists
+ *
+ * @private
+ * @param list
+ * @param value
+ */
+function _removeFromDatalist(list, value) {
+       if(list.options.length > 0 && value && value.length > 0) {
+               for (i = 0; i < list.options.length; i++) {
+                       if(list.options[i].value == value) {
+                               list.options[i].remove();
+                       }
+               }
+       }
+}
+
+/**
+ * fill the tag template with the right data and js calls
+ * depends on the html template created in the html code
+ *
+ * @returns Object the cloned el
+ * @private
+ * @param el
+ * @param newTagString
+ * @param targetStartString
+ */
+function _fillTagTemplate(el,newTagString,targetStartString) {
+       el.removeAttribute('style');
+       el.setAttribute('id',targetStartString + '-' + newTagString);
+
+       let spanEl = el.querySelector('span');
+       spanEl.innerHTML = newTagString;
+
+       let aEl = el.querySelector('a');
+       aEl.setAttribute('onclick', "removeTag('"+newTagString+"','"+targetStartString+"');");
+
+       return el;
+}
+
+/**
+ * simple check if the string is empty or contains whitespace chars
+ *
+ * @returns boolean
+ * @private
+ * @param stringTocheck
+ * @param validateMethod
+ */
+function _checkForSpaceString(stringTocheck,validateMethod) {
+       let check = stringTocheck.replace(/\s/gm,'');
+       if(validateMethod && validateMethod == "allowSpace") {
+               check = stringTocheck.trim();
+       }
+
+       if(check === stringTocheck && check.length > 0) {
+               return true;
+       }
+       return false;
+}
index b5bf291194598be123e401fb95fad211882e8f2e..4b2916b2c3365ffc390c45bf774ad24d8da7cd6f 100644 (file)
@@ -127,7 +127,7 @@ if(!empty($_collection)) {
                                }
                                else { // ADD
                                        // special case. Title field should be always available.
-                                       if (!empty($_fieldsToSave) && isset($_fieldsToSave['title'])) {
+                                       if (!empty($_fieldsToSave) && !empty($_fieldsToSave['title']['valueToSave'])) {
                                                $do = $ManageEntry->create($_fieldsToSave, $_owner, $_group, $_rights);
                                                if (!empty($do)) {
                                                        $TemplateData['message']['content'] = "<a href='index.php?p=entry&collection=".$_collection."&id=".$do."'>View your new entry</a> | <a href='index.php?p=manageentry&collection=".$_collection."&id=".$do."'>Edit your new entry</a>";