Coder Social home page Coder Social logo

christophlehmann / pagetreefilter Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 1.0 237 KB

TYPO3 Extension for highlighting pages with records and content elements in the pagetree

License: GNU General Public License v3.0

PHP 56.49% HTML 5.96% CSS 1.21% JavaScript 13.32% Shell 23.03%
swissarmyknife typo3-extension

pagetreefilter's Introduction

TYPO3 Extension: Pagetree Filter

It adds a wizard like the new content element wizard that helps finding content elements and records in the page tree. With a few clicks you know where they are used. You can also see what elements are not used.

Screenshots

Highlight pages with image elements

Example

The filter wizard

The Wizard

Example filters

Highlight pages with...

  • sys_category records: table=sys_category
  • image content elements: table=tt_content CType=image
  • hidden image content elements: table=tt_content CType=image hidden=1
  • content elements where the elements header starts with rocket: table=tt_content header=rocket*
  • content elements where the elements header ends with launch: table=tt_content header=*launch
  • content elements where the elements header contains rocketlaunch: table=tt_content header=*rocketlaunch*

Installation

composer require christophlehmann/pagetreefilter

Configuration

Enable for non admin users (User TSconfig)

tx_pagetreefilter.enable = 1

PageId

The wizard needs a page id for fetching Page TSconfig in order to gather possible content elements and plugins. This page id is determined by

  1. First WebMount in case the user is no admin
  2. Extension configuration: pageId (default: 1)

Let the rocket start. Made with โ™ฅ by Christoph Lehmann

pagetreefilter's People

Contributors

christophlehmann avatar sypets avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sypets taieb123

pagetreefilter's Issues

Invalid argument supplied for foreach in WizardController::keepOnlyListTypeAndCTypeInDefaultValues

1/1) #1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: Invalid argument supplied for foreach() in /var/www/site-uol11/htdocs/typo3conf/ext/pagetreefilter/Classes/Controller/WizardController.php line 162

WizardController:: keepOnlyListTypeAndCTypeInDefaultValues

When debugging this, I have an array $wizards with one entry which only contains a 'header' entry. I am not sure if this is (configuration) problem on my end. The problem did not occur when testing this extension with TYPO3 v10. I am now testing with v11.

$wizards = [
    'common' => [
       'header' => 'Typical page element'
    ],
   // ....
]

Versions

pagetreefilter: 1.5.0 or main
TYPO3 core 11.5.16

PHP 8 error with undefined array index

I get an error running the extension in TYPO3 11 with PHP 8:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476107295: PHP Warning: Undefined array key "hideTable" in /var/www/html/src/private/typo3conf/ext/pagetreefilter/Classes/Controller/NewContentElementController.php line 63

The adminOnly setting might also need an isset check before accessing it.

I'm not sure which branch to target the issue to, NewContentElementController does not exist in master anymore.

if ((bool)$tableConfiguration['ctrl']['hideTable'] === false &&

TypeError because of return value of isWizardEnabled()

Return value of Lemming\PageTreeFilter\Utility\ConfigurationUtility::isWizardEnabled() must be of the type bool, string returned

in /var/www/site-uol/htdocs/typo3conf/ext/pagetreefilter/Classes/Utility/ConfigurationUtility.php line 24
        }

        $isEnabledForNormalUser = $backendUser->getTSConfig()['tx_pagetreefilter.']['enable'] ?? 0 == 1;

        return $isEnabledForNormalUser;
    }

    public static function getPageId()
    {

Problem happens if you set tx_pagetreefilter.enable = 1 in group TSconfig and then switch to user. If $backendUser->getTSConfig()['tx_pagetreefilter.']['enable'] is true, the value of this will be returned which is a string.

Versions

  • TYPO3 10.4.20
  • PHP 7.4
  • pagetreefilter: master

I like this extension, will probably test some more

Mass editing

TYPO3 has the possibility for mass editing records, but you have to change the fields for every single record.

Based on a filter like "table=pages foo=1" this extension could provide links for mass editing filtered records. Steps could be

  1. Apply filter
  2. Choose fields for mass editing
  3. Show the fields in a pseudo form and pre-define the new values
  4. Show the mass editing form and "just control" if the pre-defined valued could be applied.
  5. Save

Tree context

Be able to filter in the subtree of a given page

Button Initialisation sometimes fail

It is fixed in 11.5, but exist in 10.4.

In Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Modal.ts:461 the await in the append() seems to be the reason for it.

Call to undefined method Doctrine\DBAL\Driver\Mysqli\MysqliStatement::fetchAllAssociative()

TYPO3 10.4.21
PHP 7.3.25
EXT:pagetreefilter 0.1.0
Installation is not based on composer

error message:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: Call to undefined method Doctrine\DBAL\Driver\Mysqli\MysqliStatement::fetchAllAssociative() | Error thrown in file /....../...../typo3conf/ext/pagetreefilter/Classes/Controller/NewContentElementController.php in line 120. Requested URL: https://www.........de/typo3/index.php?route=%%2Fajax%%2Fpagetreefilter%%2Ffetchfilter&token=--AnonymizedToken--

Problems with large results sets

If constraint has large result set, fetching pagetree takes much longer than without constraints and may result in errors.

I am assuming the extension may be fetching too many results. In the core - to handle the previous performance problems in the page tree - not the entire pagetree is fetched - only the expanded part. (After several changes in the pagetree mechanism).

If I fetch with this extension "pagetreefilter" using a constraint with a large result set I get one of:

  • Page tree error (error message)
  • A spinner making the pagetree and the text field unresponsive so you can only abort with reload (actually a problem in the TYPO3 core, I think)

I still find the extension very nice and quite useful. The editors on our site will most likely not get this problem as they see only a much smaller subset of pages (due to the mount points used).

I am not using this yet in production, it might be nice to be able to find a way to solve these problems. Will upgrade to v11 soon.

System

I am using

  • TYPO3 10.4.26 (latest)
  • pagetreefilter 0.2.1 (latest for v10)

site has about 40 000 pages.

select count(*) from pages where sys_language_uid=0 and not deleted;
+----------+
| count(*) |
+----------+
|    40932 |
+----------+

Reproduce

  1. use constraints such as
  • table=pages
  • table=pages doktype=1

Watching the result times in the Network tab of developer tools, I also see long response times for the filterData requests, e.g. - 29s

error messages

Browser console:

PageTree.js?bust=1648368554:486 Uncaught SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (d3.js?bust=1648368554:8:28915)
    at XMLHttpRequest.c (d3.js?bust=1648368554:6:16638)

image

No message in TYPO3 log (log file with ERROR log level).

This may be related to these core issues:

Possible solution

It might be a possible solution to get number of results first and if too large reject the constraint and fall back to original behaviour of TYPO3 or abort the current filter with an error message ("result set too large"). (Have not really thought this through though, just tossing out ideas. Difficulty is not just detemining what kind of result set is "too large").

Feature: Custom filters

I like to see, which pages are/not in the Solr Index Queue. Ideally i see all pages with different colors for each state.

  • Add example "access restricted pages" enabled by default
  • Implement access permission for non-admin users

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.