OJS 3: add menu/submenu in navbar

Is there any way to add other menu or submenu in navbar? I am using bootstrap theme. I think the available menus are not enough

2 Likes

Hi @kawahyu,

For now that’ll require template changes (or template overrides using a theme plugin). In the future we may add tools to customize the menus via the setup interface, but we haven’t gotten there yet.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

It is a great hope for the upcoming tool. Thanks @asmecher

This would actually be fairly simple to accomplish with a plugin which would override the template and maybe read/write the menu items from journal_settings table. Maybe this could even be included in a theme plugin although I do not know how the admin stuff (for example Templates::Management::Settings::website hook) would work in a theme plugin context.

Here is a navigation plugin I did:

It still needs some work and there are of course some problems with it, but seemes to be working fairly well.

Nice @ajnyga! Is there anything special I need to do to ensure the database tables are created? They’re not getting created for me when the plugin is enabled.

One of my goals for moving OJS 3 towards a more stable plugin architecture is to develop an extensible pattern for menus. Most likely this will take the form of defining them in an array or object, and then passing them through a hook, so that plugins can add, move or remove items.

This is primarily designed for the backend, so that plugins can extend the UI in sensible ways without having to override template files. That will help multiple plugins interact with each other safely.

But it could also be used for frontend navigation menus for cool things like what you’ve built here. One hiccup will be that many themes might opt for a completely different navigation setup, splitting items into different menus in different places. Having a system that would register a menu, so that your plugin could allow any frontend menus registered by the current theme to be manipulated, would be nice.

Hi,

Yeah, I noticed the problem with themes already when I checked the Bootstrap. I just hard coded the menu css classes in my plugin and they of course only apply the default theme now. (see the readme for other problems)

This is definitely far from perfect, but it was a good excercise to get to know the new grid functions etc.

The way Wordpress handels menus would of course be an optimal solution.

About the database tables, I think that you need to run php tools/upgrade.php upgrade to get the schema.xml to create the needed tables. Or php tools/dbXMLtoSQL.php -schema execute plugins/generic/navigation/schema.xml. At least I could not figure out how to make it create the tables just by enabling the plugin.

1 Like

Ah yeah, the database upgrade did it. :thumbsup:

1 Like

Hi @ajnyga, thanks for your navigation

Is this the only way to install your navigation plugin?
Run php tools/dbXMLtoSQL.php -schema execute plugins/generic/navigation/schema.xml
Honestly, I have no idea to do it. Can I install it by just uploading the zip files to ojs file in cpanel like installing new theme?

Hi,

Not that I know of. I actually thought that enabling the plugin would run the schema.xml file but it seems that you need that shell command to create the database. @asmecher probably knows best.

Would you mind to give any steps on how to run it?

You basically need to open some kind of terminal program and connect to your server. I use PuTTY. Then you go to your ojs folder and run that command. It is hard to give better instructions because I am not even sure if you have a service provider that enables you to use shell access or if you can run php from command line.

I guess another option could be that you download the plugin and turn the folder into a tar.gz-package and then go to your OJS settings => plugins => “Upload A New Plugin”. I am not sure, but it could be that this would create the tables as well? But for it to work, your config.inc.php has to have correct tar path.

Well, hope it can be installed by adding a new plugin.
I will ask my server provider about > shell access and command line

Ok, asking your service provider is a good idea. I am definitely the wrong person to give you instructions about linux and command lines :grin:

Thanks for plugin.
Could you help me with installation, please.
I’ve created navigation.tar.gz archive then istalled it with “Upload A New Plugin” in admin-panel. Then it was massege that plugin is installed well. But after that site stopped working. So i have to delete the folder with plugin… and site started working again.
In MySQL who tables were created “navigation” and “navigation_settings” …

Could you help to install it, please/

PS really strange that the developers did not add this very-very important option in OJS3.

@asmecher ! thansk for support OJS.
This option is very necessary for all who use the platform!!!
Unfortunately, this is a big omission… so we could not tie static page with main navbar menu!!!
we would be very grateful for solving this problem.
Thanks again. Sincerely.

Hi,

The plugin was really an experiment I wanted to share so I did not plan to provide much support for it.

Did you install it as a site plugin or from a journal? I know that there is a problem with it that is causing the settings tab to crash but that only occurs when notifications are shown.

I would subscribe to that…

I am convinced that plugin is worth it to pay the utmost attention… really!
Each CMS has this functionality… to form main navigation menu.
OJS 2 has this function. Sadly, OJS3 does not.

I have installed as site plugin: Settings >>> Website >>> Plugins >>> Upload a new plugin …
(navigation.tar.gz)…

@asmecher, many thanks for OJS 3 !

Could i ask you to add the function for menu/submenu adding/editing in navbar (main menu), please…
this function is really needed !
in OJS 3.0.2 Milestone I could not find it. Is it possible to do?
thank you in advance

1 Like