]> 91.132.146.200 Git - bibliotheca-php.git/commitdiff
page titles. Deletion of a collection removes the storage too
authorBanana <mail@bananas-playground.net>
Sun, 17 Jan 2021 18:58:47 +0000 (19:58 +0100)
committerBanana <mail@bananas-playground.net>
Sun, 17 Jan 2021 18:58:47 +0000 (19:58 +0100)
21 files changed:
upgrade/from-version-1.0.txt
webclient/index.php
webclient/lib/managecollections.class.php
webclient/lib/summoner.class.php
webclient/lib/tentacle.class.php
webclient/lib/trite.class.php
webclient/view/default/advancedsearch/advancedsearch.php
webclient/view/default/auth/auth.php
webclient/view/default/collections/collections.php
webclient/view/default/entry/entry.php
webclient/view/default/main.php
webclient/view/default/managecollectionfields/managecollectionfields.php
webclient/view/default/managecolletions/managecolletions.php
webclient/view/default/manageentry/manageentry.html
webclient/view/default/manageentry/manageentry.php
webclient/view/default/managegroups/managegroups.php
webclient/view/default/managetags/managetags.php
webclient/view/default/manageusers/manageusers.php
webclient/view/default/profile/profile.php
webclient/view/default/tags/tags.php
webclient/view/default/tool/tool.php

index 968a1582a236bf1fc796be3a293f1c41fccbb633..87ae5a260831ecaa93bc14e12b0e0fa065091b27 100644 (file)
@@ -13,3 +13,4 @@ INSERT INTO `#REPLACEME#_menu` (`id`, `text`, `action`, `icon`, `owner`, `group`
 DELETE FROM `#REPLACEME#_menu` WHERE `bib_menu`.`id` = 13;
 INSERT INTO `#REPLACEME#_menu` (`id`, `text`, `action`, `icon`, `owner`, `group`, `rights`, `position`, `category`) VALUES (NULL, 'Groups', 'managegroups', 'users', '1', '1', 'rw-------', '5', 'manage');
 UPDATE `#REPLACEME#_menu` SET `position` = '6' WHERE `bib_menu`.`id` = 16;
+UPDATE `#REPLACEME#_menu` SET `group` = '2', `rights` = 'rw-rw----' WHERE `bib_menu`.`id` = 14;
index 0492f88a48ea915c66149bb9c551e3b63b9d1f3f..acfe2f6f34f7f2070ab91c05abcf3a6c721fafe6 100644 (file)
@@ -59,6 +59,7 @@ $DB = false;
 $TemplateData = array();
 $TemplateData['pagination'] = array();
 $TemplateData['searchAction'] = 'index.php';
+$TemplateData['pageTitle'] = 'Dashboard';
 # the view
 $View = Summoner::themefile('dashboard/dashboard.html', UI_THEME);
 # the script
@@ -97,7 +98,7 @@ if(isset($_GET['p']) && !empty($_GET['p'])) {
        $View = Summoner::themefile($_requestMode.'/'.$_requestMode.'.html', UI_THEME);
 }
 
-# now inlcude the script
+# now include the script
 # this sets information into $Data and can overwrite $View
 if(!empty($ViewScript)) {
        require_once $ViewScript;
index 6abecea6e1c7b53050e3454e054ec9d21f646658..11d737fa9766daa45077f11df00961217c7bdaf0 100644 (file)
@@ -415,6 +415,8 @@ class ManageCollections {
                                $this->_DB->query($queryStrEntry);
                                $this->_DB->query($queryStrFields);
 
+                               Summoner::recursive_remove_directory(PATH_STORAGE.'/'.$id);
+
                                $ret = true;
                        }
                        catch (Exception $e) {
index 8e00afa2d5a5f12c0b89c7c86854134ee3095bd1..5a285d05d3d4c39b3767694cc45c01f48c61957f 100644 (file)
@@ -377,9 +377,9 @@ class Summoner {
        }
 
        /**
-        * delete and/or empty a diretory
+        * delete and/or empty a directory
         *
-        * $empty = true => empty the diretory but do not delete it
+        * $empty = true => empty the directory but do not delete it
         *
         * @param string $directory
         * @param bool $empty
index cca6271580420456bc8d55837bef53ed50dc1e3f..7e6bab423d0df34d72656972989bb5cf491d4a18 100644 (file)
@@ -50,7 +50,7 @@ class Tentacle {
         * Validate if given action is a valid tool and if the user has access
         *
         * @param string $identifier
-        * @return bool
+        * @return bool|mixed
         */
        public function validate($identifier) {
                $ret = false;
index 211142a14ae97c4edf34ed6f35f27272e44f3ed4..b323a36d1f04343bc9437dbee2981a2233dd7d7e 100644 (file)
@@ -252,6 +252,9 @@ class Trite {
                                        if(!empty($result['value'])) {
                                                $ret[$result['id']]['entries'][$result['value']] = $result['value'];
                                        }
+                                       elseif(!isset($ret[$result['id']]['entries'])) {
+                                               $ret[$result['id']]['entries'] = array();
+                                       }
                                }
                        }
                } catch (Exception $e) {
index 1b883110b16fc4233994c8b2559faf403da6aee4..5ce42ca18bb9be0f9fe8f6a99cb2a0fca1e3f9e7 100644 (file)
@@ -27,6 +27,7 @@ if(isset($_GET['collection']) && !empty($_GET['collection'])) {
        $_collection = Summoner::validate($_collection,'digit') ? $_collection : false;
 }
 
+$TemplateData['pageTitle'] = 'Advanced search';
 $TemplateData['loadedCollection'] = array();
 $TemplateData['collections'] = array();
 $TemplateData['collectionFields'] = array();
index 6939a46f79283a92c93c2d34ccffd9a074ee5cc1..a5be9a464d1b5128a6366fccdd0d8fc1de341b89 100644 (file)
@@ -18,6 +18,8 @@
 
 // passwords used here: password_hash("somePassword", PASSWORD_DEFAULT);
 
+$TemplateData['pageTitle'] = 'Auth';
+
 if(isset($_GET['m']) && !empty($_GET['m'])) {
        if($_GET['m'] == "logout") {
                $Doomguy->logOut();
index 1200856dd7bb59bd68e2cc635ca6ccdb9bf6af42..32530691738beca4188bc7e16b482bca4596f60f 100644 (file)
@@ -49,6 +49,7 @@ if(isset($_POST['navSearch'])) {
 
 require_once(Summoner::themefile('system/pagination_before.php',UI_THEME));
 
+$TemplateData['pageTitle'] = "Collection overview";
 $TemplateData['loadedCollection'] = array();
 $TemplateData['storagePath'] = '';
 $TemplateData['entries'] = array();
@@ -93,6 +94,9 @@ if(!empty($_collection)) {
                if (!empty($_search)) {
                        $TemplateData['search'] = $_search;
                }
+
+               $TemplateData['pageTitle'] = $Trite->param('name');
+
        }
        else {
                $TemplateData['message']['content'] = "Can not load given collection.";
index 704ba3effa9a670184560fd2be626bb5b7b37859..f6e775273439b36edb668126d8eea8cd6ff216b1 100644 (file)
@@ -35,6 +35,7 @@ if(isset($_GET['id']) && !empty($_GET['id'])) {
        $_id = Summoner::validate($_id,'digit') ? $_id : false;
 }
 
+$TemplateData['pageTitle'] = '?';
 $TemplateData['fieldViewDefault'] = Summoner::themefile('entry/field-unknown.html', UI_THEME);
 $TemplateData['entry'] = array();
 $TemplateData['loadedCollection'] = array();
@@ -51,6 +52,13 @@ if(!empty($_collection) && !empty($_id)) {
 
                $ManageEntry->setCollection($Trite->param('id'));
                $TemplateData['showEdit'] = $ManageEntry->canEditEntry($_id);
+
+               if(isset($TemplateData['entry']['fields']['title'])) {
+                       $TemplateData['pageTitle'] = $TemplateData['entry']['fields']['title']['value'].' - '.$Trite->param('name');
+               }
+               else {
+                       $TemplateData['pageTitle'] = ' - '.$Trite->param('name');
+               }
        }
        else {
                $TemplateData['message']['content'] = 'Can not load given collection.';
index 48511ccf0f5449a5d8e205b7797d7dccb42d199a..3e6f72260eb6af3461f6fdc7b4b79a2dd718461d 100644 (file)
@@ -10,7 +10,7 @@
        <script type="text/javascript" src="view/default/ui/js/uikit-icons.min.js"></script>
 
        <meta name="author" content="https://www.bananas-playground.net/projekt/bibliotheca" />
-       <title>Bibliotheca</title>
+       <title><?php echo $TemplateData['pageTitle']; ?> - Bibliotheca</title>
 </head>
 <body>
        <header>
index 1a70cbd9f223cf2cc22fea4bd49e76136046b84d..8ef81258e66bcff20cacfa73e0084103ab95df79 100644 (file)
@@ -27,6 +27,8 @@ $ManangeCollectionFields = new ManageCollectionFields($DB,$Doomguy);
 $TemplateData['availableFields'] = $ManangeCollectionFields->getAvailableFields();
 $TemplateData['existingFields'] = array();
 
+$TemplateData['pageTitle'] = 'Manage collection fields';
+
 $_id = false;
 if(isset($_GET['id']) && !empty($_GET['id'])) {
        $_id = trim($_GET['id']);
index b029a3bdbb79c3632216d63868fae3cac9108263..21111637d90bd317bc271665ce6ef8a402b80b91 100644 (file)
@@ -31,6 +31,8 @@ $TemplateData['editData']['rights'] = Summoner::prepareRightsArray('rwxr--r--');
 $TemplateData['editData']['tool'] = array();
 $TemplateData['existingFields'] = array();
 
+$TemplateData['pageTitle'] = 'Manage collection';
+
 // @todo providing the id is enough
 $_editMode = false;
 if(isset($_GET['m']) && !empty($_GET['m'])) {
index 4bb63977e83137c72be5367df9ab6942ea52952a..573d7206d45510908c9419edc77b18ee90cd1885 100644 (file)
@@ -29,6 +29,7 @@ if(!empty($TemplateData['editFields'])) {
                        if(!empty($TemplateData['editData']['_isOwner'])) {
                        ?>
 
+                       <hr class="uk-margin-medium">
                        <div class="uk-margin">
                                <div class="uk-form-label">Rights</div>
                                <div class="uk-form-controls uk-form-controls-text">
index 29720e199a6a5d3daa24cf706f5a6856d2ba6aa3..ba7f5d91090c77c6788a02654cd7b78de588de2f 100644 (file)
@@ -21,6 +21,7 @@ $Trite = new Trite($DB,$Doomguy);
 require_once 'lib/manageentry.class.php';
 $ManangeEntry = new Manageentry($DB,$Doomguy);
 
+$TemplateData['pageTitle'] = 'Manage entry - ';
 $TemplateData['editFields'] = array();
 $TemplateData['editData'] = array();
 $TemplateData['loadedCollection'] = '';
@@ -50,6 +51,8 @@ if(!empty($_collection)) {
                $TemplateData['editFields'] = $ManangeEntry->getEditFields();
                $TemplateData['availableTools'] = $Trite->getAvailableTools();
 
+               $TemplateData['pageTitle'] = 'Add - '.$Trite->param('name');
+
                if(!empty($_id)) {
                        $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $_collection . '/' . $_id;
 
@@ -60,6 +63,9 @@ if(!empty($_collection)) {
                                $TemplateData['message']['content'] = "Entry has no value in title field.";
                                $TemplateData['message']['status'] = "error";
                        }
+                       else {
+                               $TemplateData['pageTitle'] = 'Edit - '.$TemplateData['editData']['title'].' - '.$Trite->param('name');
+                       }
                }
 
                if(isset($_POST['submitForm'])) {
@@ -149,5 +155,6 @@ if(!empty($_collection)) {
        }
 }
 else {
+       $TemplateData['pageTitle'] .= 'collection overview';
        $TemplateData['existingCollections'] = $Trite->getCollections("write");
 }
index 422009190538ed1bbf7fffbe7c2d9d3661ad4dda..2936ffb8e6d11bf6bcad2486c45cfea93ad4b5d6 100644 (file)
@@ -20,6 +20,8 @@ $Possessed = new Possessed($DB, $Doomguy);
 $TemplateData['existingGroups'] = $Possessed->getGroups();
 $TemplateData['editData'] = false;
 
+$TemplateData['pageTitle'] = 'Manage groups';
+
 $_id = false;
 if(isset($_GET['id']) && !empty($_GET['id'])) {
        $_id = trim($_GET['id']);
index 4560353905d5dcfc0d48eebefa41eed3dbcdf244..329b57d3fed330470224143cadebf04aa6e22061 100644 (file)
@@ -35,6 +35,7 @@ if(isset($_GET['id']) && !empty($_GET['id'])) {
 
 $TemplateData['loadedCollection'] = array();
 $TemplateData['collections'] = array();
+$TemplateData['pageTitle'] = 'Manage tags';
 
 if(!empty($_collection)) {
        $TemplateData['loadedCollection'] = $Trite->load($_collection, "write");
index 09c11bb3cc0247ad3ea67cad40309082d283648a..7c431ffd5343b378accbe472363afbf529f843e8 100644 (file)
@@ -21,6 +21,7 @@ $TemplateData['existingGroups'] = $Possessed->getGroups();
 $TemplateData['existingUsers'] = $Possessed->getUsers();
 $TemplateData['editData'] = false;
 $TemplateData['editData']['groups'] = array();
+$TemplateData['pageTitle'] = 'Manage users';
 
 $_id = false;
 if(isset($_GET['id']) && !empty($_GET['id'])) {
index 7d6397e0feebe631a2a79cd875251bef63e77e6e..2deb759e39dcb8b385fe90e7fa9dcbc50a32a09c 100644 (file)
@@ -19,6 +19,7 @@ require_once 'lib/possessed.class.php';
 $Possessed = new Possessed($DB, $Doomguy);
 
 $TemplateData['editData'] = $Doomguy->getAllUserData();
+$TemplateData['pageTitle'] = 'Profile';
 
 if(!empty($TemplateData['editData'])) {
        if(isset($_POST['submitForm'])) {
index edc5c2b1c70df2105c0c99ee7f605cf0866279b9..d64bf97512cb948e31f714fde28979256ddab5be 100644 (file)
@@ -33,6 +33,7 @@ if(isset($_GET['id']) && !empty($_GET['id'])) {
        $_id = Summoner::validate($_id,'digit') ? $_id : false;
 }
 
+$TemplateData['pageTitle'] = 'Tags - ';
 $TemplateData['loadedCollection'] = array();
 $TemplateData['tags'] = array();
 $TemplateData['search'] = false;
@@ -56,6 +57,8 @@ if(!empty($_collection)) {
                }
 
                $Trite->getTags();
+
+               $TemplateData['pageTitle'] = $Trite->param('name');
        }
        else {
                $TemplateData['message']['content'] = "Can not load given collection.";
@@ -63,5 +66,6 @@ if(!empty($_collection)) {
        }
 }
 else {
+       $TemplateData['pageTitle'] .= 'collection overview';
        $TemplateData['collections'] = $Trite->getCollections();
 }
index 2ca39e287bd4b0a9260de46a7d2f4667b6db1097..cb568f5c585086fc07862b859bcccf598330d26a 100644 (file)
 
 require_once 'lib/tentacle.class.php';
 $Tools = new Tentacle($DB,$Doomguy);
-require_once 'lib/managecollections.class.php';
-$ManangeCollections = new ManageCollections($DB,$Doomguy);
 require_once 'lib/managecollectionfields.class.php';
 $ManangeCollectionsFields = new ManageCollectionFields($DB, $Doomguy);
 require_once  'lib/manageentry.class.php';
 $Manageentry = new Manageentry($DB,$Doomguy);
+require_once 'lib/trite.class.php';
+$Trite = new Trite($DB,$Doomguy);
 
+$TemplateData['pageTitle'] = 'Tool';
 $TemplateData['tool'] = array();
 $TemplateData['tool']['viewFile'] = '';
 $TemplateData['collection'] = array();
@@ -49,15 +50,15 @@ if(isset($_GET['t']) && !empty($_GET['t'])) {
 }
 
 if(!empty($_collection) && !empty($_t)) {
-       $collection = $ManangeCollections->getCollection($_collection,"write");
+       $collection = $Trite->load($_collection,"write");
        $toolInfo = $Tools->validate($_t);
 
        if(!empty($collection) && !empty($toolInfo)) {
                $TemplateData['tool'] = $toolInfo;
                $TemplateData['collection'] = $collection;
 
-               $ManangeCollectionsFields->setCollection($_collection);
-               $Manageentry->setCollection($_collection);
+               $ManangeCollectionsFields->setCollection($Trite->param('id'));
+               $Manageentry->setCollection($Trite->param('id'));
 
                if(!empty($_id)) {
                        $TemplateData['editEntry'] = $Manageentry->getEditData($_id);
@@ -68,6 +69,8 @@ if(!empty($_collection) && !empty($_t)) {
                if(file_exists($_toolFile) && file_exists($_toolViewFile)) {
                        require_once $_toolFile;
                        $TemplateData['tool']['viewFile'] = $_toolViewFile;
+
+                       $TemplateData['pageTitle'] .= ' - '.$toolInfo['name'];
                }
                else {
                        $TemplateData['tool']['viewFile'] = '';