]> 91.132.146.200 Git - bibliotheca-php.git/commitdiff
bulk edit now available
authorBanana <mail@bananas-playground.net>
Sun, 28 Feb 2021 17:16:04 +0000 (18:16 +0100)
committerBanana <mail@bananas-playground.net>
Sun, 28 Feb 2021 17:16:04 +0000 (18:16 +0100)
22 files changed:
CHANGELOG
TODO
documentation/bulk-edit.txt [new file with mode: 0644]
documentation/fields.txt
upgrade/from-version-1.0.txt
webclient/lib/manageentry.class.php
webclient/lib/mancubus.class.php
webclient/lib/trite.class.php
webclient/view/default/advancedsearch/advancedsearch.html
webclient/view/default/bulkedit/bulkedit.html [new file with mode: 0644]
webclient/view/default/bulkedit/bulkedit.php [new file with mode: 0644]
webclient/view/default/manageentry/field-lookupmultiple.html
webclient/view/default/manageentry/field-number.html
webclient/view/default/manageentry/field-selection.html
webclient/view/default/manageentry/field-text.html
webclient/view/default/manageentry/field-text3.html
webclient/view/default/manageentry/field-textarea.html
webclient/view/default/manageentry/field-year.html
webclient/view/default/manageentry/manageentry.html
webclient/view/default/manageentry/manageentry.php
webclient/view/default/tags/tags.php
webclient/view/default/ui/js/suggest-tag.js

index 98d1d2843a7cf2a2464b0e4a49d2e5accd969a01..5804c49accbe36b63da0281180fa3674ffb6e4ba 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,9 +3,9 @@
        * Missing changelog file
        * api has its own log file now.
        * User profile for editing own settings.
-       * Collection management has the option to update entry rights with the 
+       * Collection management has the option to update entry rights with the
                collection ones.
-       * Entry rights can now be managed. More info about user and rights can 
+       * Entry rights can now be managed. More info about user and rights can
                be found in documentation.
        * User management: Honor rights from current logged in user
        * Group management now available. But no relation check yet.
        * Documentation for tools
        * Documentation for tool imdbweb grabber. Default config added.
        * Fixed bug #3
-       * Added feature #2. There is now a new definition which defines the default 
-               targets of the imdb grabber values. See the config-imdbweb.php.default 
+       * Added feature #2. There is now a new definition which defines the default
+               targets of the imdb grabber values. See the config-imdbweb.php.default
                for more details
        * Added sort filter. Collection has a default sort field config now.
                Sort fields are the simple fields. See fields documentation.
+       * Fields do have a new inputValidation option. See fields documentation for more info.
+               Currently used to allow whitespace in a tag
+       * Mass edit of entries. Entries found with advanced search can now be editied.
+               Upload fields are not supported yet.
 
 1.0 - Castle 20210106
        * First usable version
diff --git a/TODO b/TODO
index 517e11c1189061986f3208fd8673bd436e11b7a6..3720f2cd83fa0350b8265f388079f22718c14014 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,7 +1,6 @@
-* Mass edit of entries
+* 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
-* stats overview page. amount of entries. file / cache and db storage. Version info and where to find it.
 * Export of an entry, collection or everything. Stored on disk.
 * Import of the export
 
@@ -9,4 +8,4 @@
 * Field management: Web interface
 * minimal theme
 * Automatic upgrade from DB changes
-* PHP 7 syntax ans specifications
+* PHP 7 syntax and specifications
diff --git a/documentation/bulk-edit.txt b/documentation/bulk-edit.txt
new file mode 100644 (file)
index 0000000..eda6eeb
--- /dev/null
@@ -0,0 +1,9 @@
+With the help if the advanced search found entries can be edited.
+Choose which field should be altered.
+Options are displayed below the input fild.
+Not every type of field has all options.
+Add does add the input to the existing data.
+Replace does a complete replace of the existing data.
+Clear removes the existing data regardles of input.
+
+Upload fields are not supported yet.
index d3279a019be6ab6fc4c29e0d7a762b1d51595a0d..7a56bab8c146633c3226cf1ebcec21f876ddbd06 100644 (file)
@@ -41,6 +41,10 @@ Every field with entry* is a simple search field and can be used in global searc
 createstring
 The SQL create string which is run as you add it to your collection. Not everyone needs one!
 
+inputValidation
+Defines the additional input validation. Currently only allowSpace is available. Used for lookupmultiple field to
+allow tags with whitespace in its values.
+
 value
 The value which is displayed as a selection for the user. Needed for a selection type field
 
index 86c6e132001e1c909788db899ee3caa0a6b859ed..70a927dc3279d1d42a9b8e058dbf991747db1af0 100644 (file)
@@ -24,3 +24,11 @@ INSERT INTO `#REPLACEME#_menu` (`id`, `text`, `action`, `icon`, `owner`, `group`
 UPDATE `#REPLACEME#_menu` SET `position` = '6' WHERE `#REPLACEME#_menu`.`id` = 16;
 UPDATE `#REPLACEME#_menu` SET `group` = '2', `rights` = 'rw-rw----' WHERE `#REPLACEME#_menu`.`id` = 14;
 ALTER TABLE `#REPLACEME#_collection` ADD `defaultSortField` VARCHAR(16) NOT NULL AFTER `defaultSearchField`;
+INSERT INTO `#REPLACEME#_menu` (`id`, `text`, `action`, `icon`, `owner`, `group`, `rights`, `position`, `category`) VALUES (NULL, 'Bulkedit', 'bulkedit', '', '1', '2', 'rw-rw----', '0', '');
+ALTER TABLE `#REPLACEME#_sys_fields` ADD `inputValidation` VARCHAR(32) NOT NULL AFTER `createstring`;
+UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_sys_fields`.`id` = 18;
+UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_sys_fields`.`id` = 19;
+UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_sys_fields`.`id` = 7;
+UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_sys_fields`.`id` = 8;
+UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_sys_fields`.`id` = 20;
+UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_sys_fields`.`id` = 26;
index 82fe6f9ee9e47949b959036370fabd9039700bec..76054a1092c8638517da0ef1d2e608c153001692 100644 (file)
@@ -89,7 +89,7 @@ class Manageentry {
 
                if(!empty($this->_collectionId)) {
                        $queryStr = "SELECT `cf`.`fk_field_id` AS id, `sf`.`type`, `sf`.`displayname`, `sf`.`identifier`,
-                                                       `sf`.`value`
+                                                       `sf`.`value`, `sf`.`inputValidation`
                                                FROM `".DB_PREFIX."_collection_fields_".$this->_DB->real_escape_string($this->_collectionId)."` AS cf
                                                LEFT JOIN `".DB_PREFIX."_sys_fields` AS sf ON `cf`.`fk_field_id` = `sf`.`id`
                                                ORDER BY `cf`.`sort`";
@@ -121,7 +121,7 @@ class Manageentry {
         * @param string $entryId Number
         * @return array
         */
-       public function getEditData($entryId) {
+       public function getEditData(string $entryId): array {
                $ret = array();
 
                if(!empty($this->_collectionId) && !empty($entryId)) {
@@ -157,16 +157,17 @@ class Manageentry {
         * Create an entry with given data
         *
         * @param array $data
-        * @param number $owner
-        * @param number $group
+        * @param string $owner Number
+        * @param string $group Number
         * @param string $rights
         * @param mixed $update Either false for no update or the ID to update
-        * @return mixed
+        * @return int
         */
-       public function create($data, $owner, $group, $rights, $update=false) {
-               $ret = false;
+       public function create(array $data, string $owner, string $group, string $rights, $update=false): int {
+               $ret = 0;
 
                if(DEBUG) error_log("[DEBUG] ".__METHOD__." data: ".var_export($data,true));
+               if(DEBUG) error_log("[DEBUG] ".__METHOD__." update: ".var_export($update,true));
 
                if(!empty($data) && !empty($owner) && !empty($group) && !empty($rights)) {
 
@@ -187,8 +188,7 @@ class Manageentry {
 
                        if(DEBUG) error_log("[DEBUG] ".__METHOD__." queryData: ".var_export($queryData,true));
 
-                       if(!empty($queryData['init'])) {
-
+                       if(!empty($queryData['init']) || ($update !== false && is_numeric($update))) {
 
                                $queryStr = "INSERT INTO `".DB_PREFIX."_collection_entry_".$this->_collectionId."`
                                                                SET `modificationuser` = '".$this->_DB->real_escape_string($owner)."',
@@ -201,6 +201,7 @@ class Manageentry {
                                                                `rights`= '".$this->_DB->real_escape_string($rights)."',";
                                }
                                $queryStr .= implode(", ",$queryData['init']);
+                               $queryStr = trim($queryStr,",");
                                if($update !== false && is_numeric($update)) {
                                        $queryStr .= " WHERE `id` = '".$this->_DB->real_escape_string($update)."'";
                                }
@@ -313,7 +314,7 @@ class Manageentry {
         * @param string $entryId Number
         * @return bool
         */
-       public function canEditEntry($entryId) {
+       public function canEditEntry(string $entryId): bool {
                $ret = false;
 
                if(!empty($entryId) && !empty($this->_collectionId)) {
index db754df27ed1e182ce56fea8437ead3a0f8554fa..a9d65e6d4ad09be2f3637e3c4bd04b722c70dd97 100644 (file)
@@ -119,7 +119,7 @@ class Mancubus {
         * @param string $search Search string to search for
         * @return array
         */
-       public function getLatest($selections, $entries, $search='') {
+       public function getLatest(string $selections, string $entries, $search=''): array {
                $ret = array();
 
                $queryStr = "SELECT `c`.`id`, `c`.`name`, `c`.`description`, `c`.`created`,
@@ -183,10 +183,16 @@ class Mancubus {
         *              'exactTagMatch' => true to make a binary compare. false for match against search
         * )
         *
+        * return array(
+        *              'results' => array(),
+        *              'amount' => int,
+        *              'ids' => array()
+        * )
+        *
         * @param array $searchData
         * @return array
         */
-       public function getEntries($searchData=array()) {
+       public function getEntries($searchData=array()): array {
                $ret = array();
 
                if(!empty($this->_collectionId)) {
@@ -276,6 +282,7 @@ class Mancubus {
                                                $result = $this->_mergeEntryWithFields($result, $_entryFields);
 
                                                $ret['results'][$result['id']] = $result;
+                                               $ret['ids'][] = $result['id'];
                                        }
 
                                        $queryStrCount = "SELECT COUNT(t.id) AS amount ".$queryFrom.$queryJoin.$queryWhere;
@@ -295,10 +302,11 @@ class Mancubus {
 
        /**
         * Retrieve all the data needed to display the entry for given entryId
+        *
         * @param string $entryId Number
         * @return array|mixed
         */
-       public function getEntry($entryId) {
+       public function getEntry(string $entryId): array {
                $ret = array();
 
                if(!empty($this->_collectionId) && !empty($entryId)) {
index 3d1c98863a26cc79073db754ff2f9fc811bd88a7..718a7565ece70fa4c4e00e0fcc1e2ca923b3f5d6 100644 (file)
@@ -198,6 +198,8 @@ class Trite {
         * @return array
         */
        public function getCollectionFields(): array {
+               if(empty($this->_id)) return array();
+
                if(!empty($this->_cacheExistingCollectionFields)) {
                        return $this->_cacheExistingCollectionFields;
                }
index c89c0469115295769155a8bed08d9e7c23e895f6..18a07d922f7dc855ab7db761e5c0051732a36971 100644 (file)
 </script>
 <button class="uk-button uk-button-default uk-button-small"
         type="button" uk-toggle="target: #searchFrame; animation: uk-animation-scale-down; cls: uk-hidden">Toggle search</button>
+<?php if(!empty($TemplateData['entries'])) { ?>
+<form method="post" action="index.php?p=bulkedit&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>" class="uk-display-inline-block">
+       <button type="submit" class="uk-button uk-button-default uk-button-small">Bulkedit these results</button>
+       <?php foreach($TemplateData['entries']['ids'] as $f) { ?>
+       <input type="hidden" name="bulkedit[]" value="<?php echo $f; ?>" />
+       <?php } ?>
+</form>
+<?php } ?>
+
 <?php } ?>
 
 <div class="uk-grid-small uk-grid-row-small uk-grid-row-small <?php if(!empty($TemplateData['search'])) { ?>uk-hidden<?php } ?>"
diff --git a/webclient/view/default/bulkedit/bulkedit.html b/webclient/view/default/bulkedit/bulkedit.html
new file mode 100644 (file)
index 0000000..7769aaa
--- /dev/null
@@ -0,0 +1,39 @@
+<h3 class="uk-h3">Bulkedit these entries in: <a href="index.php?p=colletions&collection<?php echo $TemplateData['loadedCollection']['id']; ?>"><?php echo $TemplateData['loadedCollection']['name']; ?></a></h3>
+
+<?php if(!empty($TemplateData['itemsToWorkWith'])) { ?>
+
+<div class="uk-grid-small uk-grid-row-small" uk-grid>
+       <div class="uk-width-1-2">
+               <form class="uk-form-horizontal uk-margin-small" method="post" enctype="multipart/form-data">
+                       <ul>
+                               <?php foreach($TemplateData['itemsToWorkWith'] as $entry) { ?>
+                               <input type="hidden" name="bulkedit[]" value="<?php echo $entry['id']; ?>" />
+                               <li><a href="index.php?p=entry&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>&id=<?php echo $entry['id']; ?>"><?php echo $entry['title']; ?></a></li>
+                               <?php } ?>
+                       </ul>
+
+<?php
+       foreach($TemplateData['editFields'] as $field) {
+               $field['bulkedit'] = true;
+               $_editFieldView = Summoner::themefile('manageentry/field-'.$field['type'].'.html', UI_THEME);
+               if(file_exists($_editFieldView)) {
+                       require $_editFieldView;
+               }
+               else {
+                       require $TemplateData['_editFieldViewDefault'];
+               }
+       }
+?>
+                       <div class="uk-margin">
+                               <button class="uk-button uk-button-primary" type="submit" name="submitForm">
+                                       Save
+                               </button>
+                       </div>
+
+               </form>
+       </div>
+       <div class="uk-width-1-2"></div>
+</div>
+<script type="text/javascript" src="view/default/ui/js/suggest-tag.js"></script>
+
+<?php } ?>
diff --git a/webclient/view/default/bulkedit/bulkedit.php b/webclient/view/default/bulkedit/bulkedit.php
new file mode 100644 (file)
index 0000000..73f7880
--- /dev/null
@@ -0,0 +1,131 @@
+<?php
+/**
+ * Bibliotheca
+ *
+ * Copyright 2018-2021 Johannes Keßler
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once 'lib/trite.class.php';
+$Trite = new Trite($DB,$Doomguy);
+require_once 'lib/manageentry.class.php';
+$ManageEntry = new Manageentry($DB,$Doomguy);
+
+$_collection = false;
+if(isset($_GET['collection']) && !empty($_GET['collection'])) {
+       $_collection = trim($_GET['collection']);
+       $_collection = Summoner::validate($_collection,'digit') ? $_collection : false;
+}
+
+$TemplateData['loadedCollection'] = array();
+$TemplateData['pageTitle'] = 'Bulkedit';
+$TemplateData['itemsToWorkWith'] = array();
+
+if(!empty($_collection)) {
+       $TemplateData['loadedCollection'] = $Trite->load($_collection, "write");
+       if(!empty($TemplateData['loadedCollection'])) {
+               $ManageEntry->setCollection($Trite->param('id'));
+
+               if(isset($_POST['bulkedit']) && !empty($_POST['bulkedit'])) {
+                       foreach($_POST['bulkedit'] as $e) {
+                               $TemplateData['itemsToWorkWith'][] = $ManageEntry->getEditData($e);
+                       }
+
+                       // needs this editData array since manageentry functionality is used
+                       $TemplateData['editData'] = array();
+                       $TemplateData['editFields'] = $ManageEntry->getEditFields();
+
+                       // @see manageentry for similar process
+                       if(isset($_POST['submitForm'])) {
+                               $fdata = $_POST['fdata'];
+                               $fupload = array('name' => ''); // match $_FILES
+                               if(!empty($_FILES) && isset($_FILES['fdata'])) {
+                                       $fupload = $_FILES['fdata'];
+                               }
+                               $_fieldsToSave = array();
+                               // default
+                               $_owner = $Doomguy->param('id');
+                               $_group = $Trite->param('group');
+                               $_rights = $Trite->param('rights');
+
+                               if (!empty($fdata)) {
+                                       foreach ($TemplateData['editFields'] as $fieldId=>$fieldData) {
+                                               if(isset($fdata['additionalEditOption'][$fieldData['identifier']])
+                                                       && !empty($fdata['additionalEditOption'][$fieldData['identifier']])) {
+
+                                                       $fieldData['bulkeditMethod'] = $fdata['additionalEditOption'][$fieldData['identifier']];
+                                                       if(isset($fdata[$fieldData['identifier']])) {
+                                                               $_value = trim($fdata[$fieldData['identifier']]);
+                                                               $fieldData['valueToSave'] = trim($fdata[$fieldData['identifier']]);
+                                                               $_fieldsToSave[$fieldData['identifier']] = $fieldData;
+                                                       } elseif(isset($fupload['name'][$fieldData['identifier']])) {
+                                                               // special case upload
+                                                               // $_FILES data is combined
+                                                               $fieldData['uploadData'] = $fupload;
+
+                                                               $_fieldsToSave[$fieldData['identifier']] = $fieldData;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               // now update the entries with the gathered data to save
+                               if(!empty($_fieldsToSave)) {
+                                       $_messages = array();
+                                       foreach ($TemplateData['itemsToWorkWith'] as $entry) {
+                                               foreach ($_fieldsToSave as $ident=>$data) {
+                                                       switch ($data['bulkeditMethod']) {
+                                                               case 'add':
+                                                                       if(is_array($entry[$ident])) { // lookup multiple
+                                                                               $data['valueToSave'] = implode(",", $entry[$ident]) . $data['valueToSave'];
+                                                                       }
+                                                                       else {
+                                                                               $data['valueToSave'] = $entry[$ident] . $data['valueToSave'];
+                                                                       }
+                                                               break;
+
+                                                               case 'replace':
+                                                                       // leave it as it is
+                                                               break;
+
+                                                               case 'empty':
+                                                                       $data['valueToSave'] = '';
+                                                               break;
+                                                       }
+
+                                                       $_fieldsToSave[$ident] = $data;
+                                               }
+
+                                               $do = $ManageEntry->create($_fieldsToSave, $_owner, $_group, $_rights, $entry['id']);
+                                               if ($do !== 0) {
+                                                       $_messages[] = "Entry updated: ".$entry['id'];
+                                               } else {
+                                                       $_messages[] = "Entry could not be updated. See log for more details: ".$entry['id'];
+                                               }
+                                       }
+
+                                       $TemplateData['message']['content'] = implode("<br />",$_messages);
+                                       $TemplateData['message']['status'] = "info";
+                               }
+                       }
+               }
+               else {
+                       $TemplateData['message']['content'] = "Missing required search items to work with.";
+                       $TemplateData['message']['status'] = "error";
+               }
+       }
+       else {
+               $TemplateData['message']['content'] = "Can not load given collection.";
+               $TemplateData['message']['status'] = "error";
+       }
+}
index b6134a033bb5db6e3b986afc5640788bc04d6c18..d4dbb38cbe7d015dc21708631fda8c9e0aad310e 100644 (file)
@@ -24,9 +24,17 @@ if(Summoner::ifset($TemplateData['editData'], $field['identifier'])) {
                <input class="uk-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']; ?>')"
+                       onkeypress="addTag(event,'<?php echo $field['identifier']; ?>','<?php echo $field['inputValidation']; ?>')"
                        placeholder="Write and press enter."
                >
+               <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+               <select class="uk-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>
 </div>
 
index fca6035d3bd0c3e435967a6de756ad7aa64159b9..1148a10a5d6f89051c690fab7e817ed8652c54ab 100644 (file)
@@ -5,5 +5,12 @@
                       name="fdata[<?php echo $field['identifier']; ?>]"
                       value="<?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?>"
                >
+               <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+               <select class="uk-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>
 </div>
index 65cf8a1a6091a32d4941c5f745d7881752b24edd..8618bd3b0449d37fdd2e049a01dd5315769c3389 100644 (file)
@@ -9,5 +9,12 @@
                        ><?php echo $v; ?></option>
                        <?php } ?>
                </select>
+               <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+               <select class="uk-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>
 </div>
index 82761c638f806d727b1e60c63b6fb4ff0c550cc3..0c918942a3ab9614eca049f813dc3844ef77bb6e 100644 (file)
@@ -5,5 +5,13 @@
                   name="fdata[<?php echo $field['identifier']; ?>]"
                   value="<?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?>"
                >
+               <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+               <select class="uk-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>
 </div>
index 72563538a8f282ee7bda91fb0d76ba7c6ae1c4ae..d7dcba1bf8d9ed96aec4da465b6c06bce3f4172f 100644 (file)
@@ -4,5 +4,13 @@
                <textarea class="uk-textarea" autocomplete="off"
                                  id="<?php echo $field['identifier']; ?>" rows="3"
                                  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']; ?>]">
+                       <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>
 </div>
index ca66b436d1389afb07cb5ceb2dbd5191899bb422..07189a45326fb41d8d0616fa81061832e8d1f95f 100644 (file)
@@ -4,5 +4,13 @@
                <textarea class="uk-textarea" autocomplete="off"
                        id="<?php echo $field['identifier']; ?>" rows="6"
                        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']; ?>]">
+                       <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>
 </div>
index 4b0158e1248f321912c700f6d5bdb6dd8ba05c97..19882b0140d8f7b319e59b14ad16fb41257d9878 100644 (file)
@@ -6,5 +6,12 @@
                        name="fdata[<?php echo $field['identifier']; ?>]"
                        value="<?php echo Summoner::ifset($TemplateData['editData'], $field['identifier']); ?>"
                >
+               <?php if(Summoner::ifset($field,'bulkedit')) { ?>
+               <select class="uk-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>
 </div>
index 573d7206d45510908c9419edc77b18ee90cd1885..a8b054f00793033dc6bdfc0972d3181c4f175c11 100644 (file)
@@ -92,7 +92,7 @@ if(!empty($TemplateData['editFields'])) {
                        </div>
                </form>
        </div>
-       <div>
+       <div class="uk-width-1-3">
                <?php if(!empty($TemplateData['availableTools'])) { ?>
                <h4>Available tools</h4>
                <ul>
index ba7f5d91090c77c6788a02654cd7b78de588de2f..ea442089e0ab17d6e69170de5fac61b03ade1d79 100644 (file)
@@ -19,7 +19,7 @@
 require_once 'lib/trite.class.php';
 $Trite = new Trite($DB,$Doomguy);
 require_once 'lib/manageentry.class.php';
-$ManangeEntry = new Manageentry($DB,$Doomguy);
+$ManageEntry = new Manageentry($DB,$Doomguy);
 
 $TemplateData['pageTitle'] = 'Manage entry - ';
 $TemplateData['editFields'] = array();
@@ -46,9 +46,9 @@ if(!empty($_collection)) {
        $TemplateData['loadedCollection'] = $Trite->load($_collection, "write");
 
        if(!empty($TemplateData['loadedCollection'])) {
-               $ManangeEntry->setCollection($Trite->param('id'));
+               $ManageEntry->setCollection($Trite->param('id'));
 
-               $TemplateData['editFields'] = $ManangeEntry->getEditFields();
+               $TemplateData['editFields'] = $ManageEntry->getEditFields();
                $TemplateData['availableTools'] = $Trite->getAvailableTools();
 
                $TemplateData['pageTitle'] = 'Add - '.$Trite->param('name');
@@ -57,7 +57,7 @@ if(!empty($_collection)) {
                        $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $_collection . '/' . $_id;
 
                        // prefill template data. Used also later to check if on edit mode
-                       $TemplateData['editData'] = $ManangeEntry->getEditData($_id);
+                       $TemplateData['editData'] = $ManageEntry->getEditData($_id);
                        // special case. Title field should be always available.
                        if(!isset($TemplateData['editData']['title'])) {
                                $TemplateData['message']['content'] = "Entry has no value in title field.";
@@ -108,7 +108,7 @@ if(!empty($_collection)) {
                                // special case. Title field should be always available.
                                if(!empty($TemplateData['editData']['title'])) { // EDIT
                                        if(isset($fdata['doDelete'])) {
-                                               $do = $ManangeEntry->delete($_id);
+                                               $do = $ManageEntry->delete($_id);
                                                if ($do === true) {
                                                        $TemplateData['refresh'] = 'index.php?p=collections&collection='.$_collection;
                                                } else {
@@ -116,7 +116,7 @@ if(!empty($_collection)) {
                                                        $TemplateData['message']['status'] = "error";
                                                }
                                        } elseif (!empty($_fieldsToSave) && isset($_fieldsToSave['title'])) {
-                                               $do = $ManangeEntry->create($_fieldsToSave, $_owner, $_group, $_rights, $_id);
+                                               $do = $ManageEntry->create($_fieldsToSave, $_owner, $_group, $_rights, $_id);
                                                if ($do !== 0) {
                                                        $TemplateData['refresh'] = 'index.php?p=entry&collection='.$_collection.'&id='.$_id;
                                                } else {
@@ -128,7 +128,7 @@ if(!empty($_collection)) {
                                else { // ADD
                                        // special case. Title field should be always available.
                                        if (!empty($_fieldsToSave) && isset($_fieldsToSave['title'])) {
-                                               $do = $ManangeEntry->create($_fieldsToSave, $_owner, $_group, $_rights);
+                                               $do = $ManageEntry->create($_fieldsToSave, $_owner, $_group, $_rights);
                                                if (!empty($do)) {
                                                        $TemplateData['message']['content'] = "<a href='index.php?p=manageentry&collection=".$_collection."&id=".$do."'>View your new entry</a>";
                                                        $TemplateData['message']['status'] = "success";
index d64bf97512cb948e31f714fde28979256ddab5be..6288b43a8a4132f462de348fe9ffe90aa3e39f07 100644 (file)
@@ -41,7 +41,7 @@ $TemplateData['search'] = false;
 $_search = false;
 if(isset($_POST['navSearch'])) {
        $_search = trim($_POST['navSearch']);
-       $_search = Summoner::validate($_search,'text') ? $_search :  false;
+       $_search = Summoner::validate($_search) ? $_search :  false;
 }
 
 
index 24b39121413fbb3f7838fb9d2f5554f2b0774a0d..04d5184d6776aac46c2b51d40c4cc83b0d82ae1e 100644 (file)
@@ -25,7 +25,7 @@ function removeTag(tagString,targetStartString) {
  * @param Object e
  * @param String targetStartString
  */
-function addTag(e,targetStartString) {
+function addTag(e,targetStartString,allowWhiteSpace) {
        e = e || window.event;
 
        if(e.keyCode === 13) {
@@ -34,7 +34,12 @@ function addTag(e,targetStartString) {
                let listBox = document.getElementById(targetStartString + '-listbox');
                let newTagTemplate = document.getElementById(targetStartString + '-template');
 
-               let checkString = _checkForSpaceString(elem.value,'nospace');
+               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;
@@ -145,8 +150,12 @@ function _fillTagTemplate(el,newTagString,targetStartString) {
  * @returns boolean
  * @private
  */
-function _checkForSpaceString(stringTocheck) {
+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;
        }