From: Banana Date: Sun, 30 Apr 2023 10:31:26 +0000 (+0200) Subject: theme 98: cleanups and manageentry. looks good now. Needs testing X-Git-Tag: 1.5~4 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=b8891f381ac92fadc6915d9a3a4cc858baf5c64d;p=bibliotheca-php.git theme 98: cleanups and manageentry. looks good now. Needs testing --- diff --git a/TODO b/TODO index f9c384e..2f847c1 100644 --- 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/ diff --git a/webclient/view/98/managecollectionfields/managecollectionfields.html b/webclient/view/98/managecollectionfields/managecollectionfields.html index f919ad6..fb163d0 100644 --- a/webclient/view/98/managecollectionfields/managecollectionfields.html +++ b/webclient/view/98/managecollectionfields/managecollectionfields.html @@ -1,6 +1,6 @@ -

Manage your fields for:

+

Manage your fields for:

-

Add or remove a field

+

Add or remove a field

Just use drag and drop below to add, remove or order your fields.
Removing a field will remove the stored data from the collection.
@@ -41,7 +41,7 @@

- +
diff --git a/webclient/view/98/managecolletions/managecolletions.html b/webclient/view/98/managecolletions/managecolletions.html index b0d7232..00e1b10 100644 --- a/webclient/view/98/managecolletions/managecolletions.html +++ b/webclient/view/98/managecolletions/managecolletions.html @@ -176,7 +176,7 @@ -

Available collections

+

Available collections

diff --git a/webclient/view/98/manageentry/field-lookupmultiple.html b/webclient/view/98/manageentry/field-lookupmultiple.html new file mode 100644 index 0000000..d2e9315 --- /dev/null +++ b/webclient/view/98/manageentry/field-lookupmultiple.html @@ -0,0 +1,57 @@ + +
+ + +
+ + +
+ > +
+ + +
+ + + + + +
+ + + + + + + + + + diff --git a/webclient/view/98/manageentry/field-number.html b/webclient/view/98/manageentry/field-number.html new file mode 100644 index 0000000..1e68465 --- /dev/null +++ b/webclient/view/98/manageentry/field-number.html @@ -0,0 +1,16 @@ +
+ + + + + + +
diff --git a/webclient/view/98/manageentry/field-selection.html b/webclient/view/98/manageentry/field-selection.html new file mode 100644 index 0000000..28bd051 --- /dev/null +++ b/webclient/view/98/manageentry/field-selection.html @@ -0,0 +1,19 @@ +
+ + + + + + +
diff --git a/webclient/view/98/manageentry/field-text.html b/webclient/view/98/manageentry/field-text.html new file mode 100644 index 0000000..2d94cd3 --- /dev/null +++ b/webclient/view/98/manageentry/field-text.html @@ -0,0 +1,34 @@ +
+ + + + + + +
+ + diff --git a/webclient/view/98/manageentry/field-text3.html b/webclient/view/98/manageentry/field-text3.html new file mode 100644 index 0000000..41183c6 --- /dev/null +++ b/webclient/view/98/manageentry/field-text3.html @@ -0,0 +1,34 @@ +
+ + + + + + +
+ + diff --git a/webclient/view/98/manageentry/field-textarea.html b/webclient/view/98/manageentry/field-textarea.html new file mode 100644 index 0000000..b89c5b9 --- /dev/null +++ b/webclient/view/98/manageentry/field-textarea.html @@ -0,0 +1,15 @@ +
+ + + + + +
diff --git a/webclient/view/98/manageentry/field-unknown.html b/webclient/view/98/manageentry/field-unknown.html new file mode 100644 index 0000000..8f3488f --- /dev/null +++ b/webclient/view/98/manageentry/field-unknown.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/webclient/view/98/manageentry/field-upload.html b/webclient/view/98/manageentry/field-upload.html new file mode 100644 index 0000000..2cd1889 --- /dev/null +++ b/webclient/view/98/manageentry/field-upload.html @@ -0,0 +1,18 @@ +
+ + + + + + '.Summoner::ifset($TemplateData['editData'], $field['identifier']).''; ?> + + + + +
diff --git a/webclient/view/98/manageentry/field-upload_multiple.html b/webclient/view/98/manageentry/field-upload_multiple.html new file mode 100644 index 0000000..0d1423a --- /dev/null +++ b/webclient/view/98/manageentry/field-upload_multiple.html @@ -0,0 +1,23 @@ +
+ + + + + + + +
+ +
diff --git a/webclient/view/98/manageentry/field-year.html b/webclient/view/98/manageentry/field-year.html new file mode 100644 index 0000000..143893d --- /dev/null +++ b/webclient/view/98/manageentry/field-year.html @@ -0,0 +1,16 @@ +
+ + + + + + +
diff --git a/webclient/view/98/manageentry/manageentry.html b/webclient/view/98/manageentry/manageentry.html new file mode 100644 index 0000000..442071c --- /dev/null +++ b/webclient/view/98/manageentry/manageentry.html @@ -0,0 +1,137 @@ + +

Update an entry in:

+

+ View entry +

+ +

Add an entry to:

+ + + +

Available tools

+ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +
UserGroupOther
+ > + + + > + + + > + + + > + + + > + + + > + + + > + + + > + + + > + +
+
+ + + + + +
+ + +
+ + + +
+ +
+ + + +

Please select a collection first

+
+ + + + + + + + + $v) { ?> + + + + + + +
NameDescription
+
+ + diff --git a/webclient/view/98/managegroups/managegroups.html b/webclient/view/98/managegroups/managegroups.html index fdd151f..2b49990 100644 --- a/webclient/view/98/managegroups/managegroups.html +++ b/webclient/view/98/managegroups/managegroups.html @@ -1,5 +1,5 @@ -

Group management

-

Add or modify a group

+

Group management

+

Add or modify a group

@@ -30,7 +30,7 @@
-

Available groups

+

Available groups

diff --git a/webclient/view/98/managetags/managetags.html b/webclient/view/98/managetags/managetags.html index d023f3a..6b2170f 100644 --- a/webclient/view/98/managetags/managetags.html +++ b/webclient/view/98/managetags/managetags.html @@ -1,6 +1,6 @@ -

Manage Tags in:

+

Manage Tags in:

The actions are top down. If you choose to move and rename, only move will be executed.
Deletion will remove without recover!
diff --git a/webclient/view/98/manageusers/manageusers.html b/webclient/view/98/manageusers/manageusers.html index 8b13ffd..4ba8473 100644 --- a/webclient/view/98/manageusers/manageusers.html +++ b/webclient/view/98/manageusers/manageusers.html @@ -1,5 +1,5 @@ -

User management

-

Add or modify a user

+

User management

+

Add or modify a user

@@ -65,7 +65,7 @@
-

Available users

+

Available users

diff --git a/webclient/view/98/ui/js/suggest-tag.js b/webclient/view/98/ui/js/suggest-tag.js new file mode 100644 index 0000000..77f6a9a --- /dev/null +++ b/webclient/view/98/ui/js/suggest-tag.js @@ -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; +} diff --git a/webclient/view/default/manageentry/manageentry.php b/webclient/view/default/manageentry/manageentry.php index b5bf291..4b2916b 100644 --- a/webclient/view/default/manageentry/manageentry.php +++ b/webclient/view/default/manageentry/manageentry.php @@ -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'] = "View your new entry | Edit your new entry";