PDA

View Full Version : NavManager



s0ct0j0c
21-04-2011, 02:34 PM
I wrote this (somewhat) little navigation manager to help out board administrators organize their navigation bar as well as learn XenForo. This is probably the fourth or fifth revision I've done internally, one being complex enough to support tabbed breadcrumb navigation. All of them were horrendously buggy and hacky though, so I finally settled on this version.

Please note that while I am a software engineer, I've never done any web development work before, so I have little experience with PHP (or JavaScript which I did a bit of). Coupled with the fact that I'm learning XenForo there are probably areas where I could have done things better. Feel free to comment if you dig through the source. I'd also like to say that I looked over and used modified versions of the admin_navigation stuff (as well as a lot of other bits) to make this.

The Good:



It works as far as I know. I've tested it along the way, but if there's anything I've learned from software development it's that someone, somewhere can break it =). So please report any bugs, I'm sure there are plenty.
It supports adding both primary and secondary tabs. It automatically creates the necessary phrases as well as the links templates. This add-on essentially usurps the way XenForo currently handles custom tabs.
It also should support other add-on tabs, although add-on tabs will be added after tabs in this add-on. I haven't actually tested this, so take it with a grain of salt.

The Bad:


I had to limit things all around. While it calls it a tree in the Applications menu, it's limited to a shallow one. Only primary links and secondary links are allowed. You can't have a tertiary link or anything like that. Most likely not a problem, but it is a limitation.
Adding a navigation node can be a bit confusing, so please ask if you have any questions.
Style support I couldn't really figure out. If you have a sufficiently different style you might have to do some editing of the navmanager_header and navmanager_navigation templates. These replace the header and navigation templates since there was no suitable hook in the navigation template to remove the default tabs.

The Ugly:


There's no proper permissions support in this version. Secondary links have a permissions field you can enter (possibly with the help of a callback function to load the necessary data), but Primary links do not have any permissions. If it's primary, it is always visible. Even though secondary links can have permissions, the way it's used isn't exactly user friendly.

Well now that I've scared you all away, here are some pictures!
Demo:
http://xenforomods.info/attachments/screen-shot-2011-03-31-at-4-09-21-pm-png.7041/http://xenforomods.info/attachments/screen-shot-2011-03-31-at-4-08-22-pm-png.7042/http://xenforomods.info/attachments/screen-shot-2011-03-31-at-4-07-41-pm-png.7043/