Project

General

Profile

Actions

Bug #24753

closed

ClickMenu Items from own extensions wont work anymore

Added by Klaus Hinum over 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-01-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

ClickMenu Items (from own extensions that were created with the old Kickstarter) wont show up any more since I upgraded from 4.4 to 4.5-RC1. Perhaps as the Kickstarter searched to position of the delete icon that I cant find anymore.

(issue imported from #M17245)


Files


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #24782: Old Contextmenu: Partly broken - Mount as TreeRoot / Hide / Unhide / DeleteClosedSteffen Gebert2011-01-24

Actions
Related to TYPO3 Core - Feature #24812: Pagetree -Provide a default contextmenu action to open custom urlsClosedErnesto Baschny2011-01-25

Actions
Actions #1

Updated by Stefan Galinski over 13 years ago

Sorry, but the backwards-compatibility of clickmenu entries couldn't be reimplemented for the new pagetree.

Actions #2

Updated by Chris topher over 13 years ago

Have you opened an issue to update kickstarter accordingly?

What will this break? Would a note in News.txt make sense?

Actions #3

Updated by Stefan Galinski over 13 years ago

I didn't created an entry for the kickstarter, because the documentation howto still needs to be written. However you just need to extend the new option.contextmenu tsconfig setting with the new entry, add your ExtDirect provider and extend the commands javascript object.

Actions #4

Updated by Steffen Gebert over 13 years ago

just ;-)

Actions #5

Updated by Chris topher over 13 years ago

The question more was, if it will break many installations.
I don't know which and how many extensions add their entries to the context menu. If so, we should put a small note to News.txt.

Actions #6

Updated by Klaus Hinum over 13 years ago

Hmm breaks two extensions from me for a project. Can you give me a simple example code on how to add an entry?

Actions #7

Updated by Sven Juergens over 13 years ago

it would break one of my extensions too.
so it would be very nice to have an example. May be an example Extension which can be relased to ter

Actions #8

Updated by Jigal van Hemert over 13 years ago

The system extension extra_page_cm_options isn't working ? Maybe that would be a good example!

Actions #9

Updated by Stefan Galinski over 13 years ago

Unfortunatly you are right that this extension needs to be fixed somehow, but I don' think that this will be possible without to removing the old context menu completly. Looks like a job for 4.6 there this task needs to be done. Afterwards it can be dropped completly... So it's not a good example for a demo. ;-)

Actions #10

Updated by Stefan Galinski over 13 years ago

Correction: Only the mount as temporary tree db mount doesn't working. This can be fixed, but it's another RFC. Anyway it cannot be an example, because it's just for the old context menu.

Actions #11

Updated by Jigal van Hemert over 13 years ago

I meant :
- this extension is shipped as system extension,
- it is obviously not working with the new pagetree
- people are asking for an example

Wouldn't it be great if the extension could be resuscitated to have (similar) extra menu options for the new pagetree? Both an example and a working system extension.

If it can't be brought back to live before the release we should remove it from the packages?

Actions #12

Updated by Stefan Galinski over 13 years ago

- this extension is shipped as system extension,

The system extension can be dropped after the final removal of the old contextmenu. It's just a small compatibility issue that needs to be fixed inside the old code now. Otherwise you would need to replace all existing instances of the old contextmenu. This is planned for 4.6, but not now.

it is obviously not working with the new pagetree

It's not indented that this extension will still work with the new pagetree as the context menu actions are already integrated. See my last comment for more...

- people are asking for an example

However the idea is nice to use it as an example, but it would be to much work as it uses the back reference heavily that isn't available anymore. I'am for an extremly simple demo with a small "Hello World" message provided by an ExtDirect data provider and executed inside a javascript callback. Maybe with some additional infos, how you can access the node attributes. Anybody who is interested in the tree interaction itself should look at the existing pagetree context menu actions.

Actions #14

Updated by Ernesto Baschny over 13 years ago

Just for your information and what I have discovered myself (never having used this functionality before, sorry):

As far as I understood it (by reading the code), adding context menu actions to the new tree is done by addint to the default UserTS. For example the impext sysext does it, see ext_tables.php:

// special context menu actions for the import/export module
$importExportActions = '
9000 = DIVIDER
9100 = ITEM
9100 {
name = exportT3d
label = LLL:EXT:impexp/app/locallang.xml:export
spriteIcon = actions-document-export-t3d
callbackAction = exportT3d
}
9200 = ITEM
9200 {
name = importT3d
label = LLL:EXT:impexp/app/locallang.xml:import
spriteIcon = actions-document-import-t3d
callbackAction = importT3d
}
';
// context menu user default configuration
$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'] .= '
options.contextMenu.table {
pages_root.items {
' . $importExportActions . '
}
pages.items.1000 {
' . $importExportActions . '
}
}
';

The only remaining piece of the puzzle would be to know what "callback" a regular extension could call. Normally an extension wants to load something in the content frame and get the page-id passed to it, meaning:

TYPO3.Backend.ContentContainer.setUrl('typo3/mod.php?M=moduleName>&id=<pageId>');

So it might be helpful to have this kind of helped method so that extensions could more easily add "working" items:

9200 = ITEM
9200 {
name = myCoolAddition
label = LLL:EXT:myext/locallang.xml:myCoolAddition
spriteIcon = actions-document-import-t3d
callbackModule = web_txmyextM1
}

or something which then magically would add the required javascript callback.

Actions #15

Updated by Stefan Galinski over 13 years ago

I attached a small extension that demonstrates the concept of adding new context menu actions. IMHO it needs to be simplified in the future by providing some API functions, but at least it's usable.

BTW: Don't throw away your old code as the old context menus are still available!

Actions #16

Updated by Ernesto Baschny over 13 years ago

Stefan, thanks for the feedback.

Could it be made possible to add at least a javascript callback for the most "common" use-case (which is what I described above => start a module in the ContentContainer and a "id=" parameter), so that the process of adding these kind of context menus doesn't involve adding .js files, ExtDirect callbacks, etc to every extension?

The custom way is of course cool and can be handy, but is a huge overheade not required for 90% of the use-cases.

What do you think?

Actions #17

Updated by Stefan Galinski over 13 years ago

I simply don't know how I can get the URL. You would need to execute an extdirect call to fetch the URL and afterwards open the new URL in the content frame. And the price-winning question: Which ExtDirect method needs to be called?

IMHO a better approach would be the dynamic creation of a javascript file with all custom context menu actions. Only the ExtDirect code would be needed afterwards. Also the approach described in my demo extension should be available for more complex actions. Another feature for 4.6...

EDIT:
Another advantage of the dynamic creation would be the removal of the ExtDirect class. You just would need to add the typoscript code and a small register call in your ext_localconf.php.

Actions #18

Updated by Stefan Galinski over 13 years ago

BTW: Can you add a note to the NEWS.txt that the contextmenu actions needs to be rewritten for the new pagetree?

Actions #19

Updated by Ernesto Baschny over 13 years ago

As soon as you wrote the documentation for it, I'll add a link to it in the release notes. :) Thanks!

About the "which URL", the URL is simply loading a module and passing a "id=" to it. The kind of backend modules that everybody creates when using the kickstarter! Its nothing fancy, no ExtDirect required or involved to know how to create them. The callback simply needs to do this:

TYPO3.Backend.ContentContainer.setUrl('typo3/mod.php?M=<moduleName>&id=<pageId>');

The extension itself decides on the <moduleName>, the pagetree should fill in the <pageId> and then the module is ready. Or do I miss something?

Actions #20

Updated by Ernesto Baschny over 13 years ago

The URL might also be an "old school" module, so a callback JS method where I can pass the whole URL would be nice

$url = t3lib_extMgm::extRelPath('user_cm').'cm1/index.php?id=###ID###';

...
9200 = ITEM
9200 {
name = myCoolAddition
label = LLL:EXT:myext/locallang.xml:myCoolAddition
spriteIcon = actions-document-import-t3d
callbackAction = loadContentContainer(' . $url . ')
}

...

And then the callbackAction "loadContentContainer" (or something like this, which would be shipped with the core) could simple replace the ###ID### by the current nodes ID.

Actions #21

Updated by Stefan Galinski about 13 years ago

Hi Ernesto, I got an idea how to solve it. Will do that this evening... Thanks for the inspiration! :-)

Actions #22

Updated by Stefan Galinski about 13 years ago

A solution is provided here:

http://bugs.typo3.org/view.php?id=17312

Actions #23

Updated by Ernesto Baschny about 13 years ago

Start using the new API (in parallel to the old one) to provide clickmenus in the ExtJS tree (and in 4.6 probably all click menus). The ease API (#24812) will be part of 4.5 already.

Actions

Also available in: Atom PDF