[WIP] Menu Button Manager mod

Started by Kays, February 21, 2013, 06:03:11 PM

Previous topic - Next topic

Kays

Well I don't dare call it a menu editor since there's a few available already.  ;)

I've always had an idea on how a menu editor should work but have been kinda perplexed with the complexities involved in re-ordering buttons. Then a while ago I realised that the manage boards script did more or less what a button manger should do. So I went to put my ideas to the test and this is the result. So far.

How it works
On first install the mod takes the existing button array and adds that to the database. Then this is output to a flat file which is included instead on the original button array. Then any time a button is added, removed, moved or edited. The database and this flat file gets updated. Any new buttons added by a mod will be added automatically when that mod is installed.

Features

  • When installed, all existing buttons are added to the buttons list
  • The ability to add, edit, move  and hide buttons. All but the original 29 can be removed.
  • Support for multiple levels of buttons. Though only three will show by default.
  • View permissions can be set either by member group or manual input.
  • Built in icon support. Disabled by default. There's also a member option to disable.
  • If a mod is installed afterwards which does add a button. This button will be added to the buttons list automatically. As well it will be automatically removed if that mod is uninstalled.
  • Support for a second menu.
  • Multilingual button support.

Portal compatibility
It is compatible with all portals with the following exceptions:

  • PortaMX creates dynamic buttons which cannot be added to the buttons list. As a result these buttons cannot be moved or have icons added to them
  • Dream Portal. Dream menu should be used to create buttons for any "Pages" but not for editing any existing buttons.

As well added active button highlighting for "pages" created by Simple Portal & ADk Portal

Incompatibilities
The following mods are incompatible and should be uninstalled first.
Menu Editor Lite
Menu Icons
Menu Order

Still got a bit of work to do on it. So I'm looking for feedback on it's functionality. And what I've missed so far. ::)

Updated to Beta 3.1. As well as some bug and functionality fixes. Added the capability to display multiple languages without the need to edit the language files.

Update to Beta 3.2 Fix the bugs pointed out by Ema. Added support for the second menu. Including a SSI function. Unfortunately this is very theme dependent.

Updated to Beta 4.0. Verified portal compatibility (see above). New buttons are now added automatically and there's no longer the need to enter the permissions for them.

Updated to Beta 4.1 Fixed a bug in display permissions for the second level buttons. Added Aeva & SimpleDesk compatbility

Updated to Beta 4.2 http://www.simplemachines.org/community/index.php?topic=498146.msg3530698#msg3530698

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Arantor

Interesting, very interesting.

As far as validating PHP goes, there's actually no easy way to do it. There is a half assed workaround that I use - I take the string, put return true; in front of it then @eval it. (Putting the return at the front prevents anything else running)

If I get true back, the string must at least parse, if I get false back, I know that something failed to parse.

Kays

Cool thanks for that. :)

Just using @eval seems to work also. I just want to catch it at the $_POST level and trigger a fatal_lang_error before it gets processed.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Arantor

Hmm, I would consider bare eval to be a bit dangerous personally.

Kays

In what way? I'm just checking the output for a true or false return.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Arantor

I'm just naturally paranoid about security and see no reason to be running code unless I know it's safe. If you're only ever accepting this from $_POST, you don't have to worry about injection via CSRF for example, which would be bad...

Kays

It's just a true/false check for basic syntax errors so it doesn't get processed if there is one.

I'm not using the output from it in any other way.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

dimspace

Good idea.. (is there an attachment? I cant see one).

be interesting to see how it copes with my subs file which is a bit of a mess. (im getting endlessly frustrated by mods that decide not to use the subs file to add menu items)

certainly make life easier for those of us that like our menus just so

Kays

Thanks, the file is attached to the first post.

Just don't know if you can see it or not in this board.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Arantor

Need to be in the Community Customizer group (I think that's its name) to see attachments here.

Shambles

This looks like a highly promising idea which I'll be keeping an eye on. Thanks :)

It's a shame that regular members can't get involved with the intrinsics of your idea. The attachment visibility policy in this board seems somewhat at odds with this statement:

Mod Development » Topic: How this works
Quote from: Suki on June 22, 2012, 12:45:40 PM
...
You may submit your mod to the modsite at the same time you open a new topic on this board, however, your mod will only be approved until the community and/or the team members had already reviewed your mod.
...

Arantor

Joining the group is easy, head to your profile > group membership ;)

Suki

This board is not for public/general testing. It is for those who wish to help out in the mod's review process.

The attachments restriction is simply because most of the mods posted here haven't been properly reviewed, if you want to use this mod then wait until it has been reviewed by the community along hand with the customizers.

The attachments restriction was planned from the very beginning, if I happily let everyone download everything here then the team would have complaints because some mod broke their precious forum and since it was downloaded here, the team gets full blame.

By going to your profile and request membership you acknowledge you know what you are doing and whats this board is for.

The original idea also contemplated myself (as lead cus at that time) to actually take the time and review all membership request, even having a quick interview, if I saw the person requesting membership for the wrong reasons then I simply will reject the request explaining how the board works.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Kays

The reason I posted this here is that although it does work fine for me. I'm not quite comfortable with it yet and would rather see people who can get themselves put of a problem kicking the tires and taking it for a test spin.

Once I do feel comfortable with it. I'll look at a way to make this a bit more public since I will be looking for user feedback also. ;)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

dimspace

Quote from: Suki on February 22, 2013, 09:00:32 AM
The attachments restriction was planned from the very beginning, if I happily let everyone download everything here then the team would have complaints because some mod broke their precious forum and since it was downloaded here, the team gets full blame.

By going to your profile and request membership you acknowledge you know what you are doing and whats this board is for.



thanks for explaining. Im comfortable tinkering with things (i do very religious backups of all affected files prior to installing anything - even approved mods), as even approved things dont always work as expected.

emanuele

* emanuele posts here because he wants to keep track of the topic. :D


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

kat

* K@ posts here for the same reason.

I seem to remember Bloc adding something, like this, for Helios.

Can't remember if the order of the items could be changed, though.

Mick.


Kays

Thanks, but it's a bit too quiet here so I'm going to move to SMF Coding Discussion

Just updated to beta 3.1. Fixed a few problems I noticed and added way to input multilingual language strings.

Quote from: K@ on March 05, 2013, 03:14:35 PM
* K@ posts here for the same reason.

I think I forgot to mention that this is for SMF 2.x and not 1.1.  :P

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

emanuele

A couple of small issues:
* $txt['menu_utilities'] is missing from the package,
* unix is case sensitive! :P (loadTemplate('manageButtons'); in the function EditMenu)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Advertisement: