Direct link to open lexicon on a specified namespace and topic

Hi,

I’m looking for a way to open directly the lexicon with a selected namespace and a specific topic for my customer.
The link from the manager just contain ?a=workspaces/lexicon and I wonder if we can add other parameters like &topic=mytopic&namespace=mynamespace (but obviously it’s not working with them ^^)

You should be able to preselect the namespace with &ns=mynamespace in the url. But as far as I can tell this is not possible for topics.

yes it’s working :slight_smile: But IMHO the topic should be preselected on the same way…

In fact I’m using Quickstart buttons addon and I wonder if there is not a way to select the good topic by using the Javascript Handler field :

I don’t think the “Javascript Handler” can be used for that. My understanding is, that this field can be used to execute some javascript instead of following a link.

What you would need is to execute some javascript code after the new page is loaded. For that you had to somehow inject some javascript code into the page, probably with a plugin.

1 Like

thank you for your insight :slight_smile:

Maybe you could do the following:
Install the extra LexiconEditor and then change the code to read namespace and topic from the url.

For this, change these two lines

to

,'namespace': MODx.request['ns'] ? MODx.request['ns'] : 'core'
,topic: MODx.request['topic'] ? MODx.request['topic'] : ''

Then clear the browser cache and call the CMP with manager/?a=home&namespace=lexiconeditor&ns=mynamespace&topic=mytopic.


Maybe also comment out this line as there seems to be no such css-file.

Thanks for the tip !
I had improved it by setting keys.
And it’s working !
It’s not perfect but I have created a pull request : Add 2 LexiconEditor's settings : topic and language by Spheerys · Pull Request #4 · jdaehne/LexiconEditor · GitHub

I took a look at your pull request:

  • Did you also change the file core/components/lexiconeditor/controllers/default/home.class.php to read the new system settings? Because this file is not included in your pull request.
  • I don’t think these lines are necessary as the ‘system/language/getlist’-processor doesn’t read these properties
  • To fix the issue with the “Clear Filter”-Button you could try changing this code

to this:

this.store.baseParams = {
	action: 'workspace/lexicon/getList'
	,'namespace': LexiconEditor.config.namespace
	,'topic': LexiconEditor.config.topic
	,'language': LexiconEditor.config.language
};
this.getBottomToolbar().changePage(1);
var tb = this.getTopToolbar();

var tcl = tb.getComponent('language');
tcl.setValue(LexiconEditor.config.language || 'en');
1 Like

You are right, I forgot to add the home.class.php modifications :frowning:
I have set this at line 37 :

        $this->lexiconeditor->options = array(
            'assetsUrl' => $assetsUrl,
            'connectorUrl' => $connectorsUrl,
            'namespace' => $this->modx->getOption('lexiconeditor.namespace'),
            'topic' => $this->modx->getOption('lexiconeditor.topic'),
            'language' => $this->modx->getOption('lexiconeditor.language'),
        );

And for the clear filter bug you get it, it’s working well now !
I will try to update my PR or make a new one :slight_smile:

PR updated : Add 2 LexiconEditor's settings : topic and language by Spheerys · Pull Request #4 · jdaehne/LexiconEditor · GitHub

Thank again @halftrainedharry :slight_smile:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.