Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: emanuele on February 11, 2012, 10:21:02 AM

Title: Allow select multiple boards for message icons
Post by: emanuele on February 11, 2012, 10:21:02 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3216)

This mod revises the admin interface used to add/remove new message icons from boards.

In a default install of SMF if you want to have a message icon available in more than one board, but less than all you have to add new icons with the same image and specify for each of these icons in which board they are visible, one by one.

With this mod the admin interface is changed in a way that for each icon you can select in which boards this icon will be available.

The option "Available In All Boards" is equivalent to the previous select option with the same name: the icon will be available in all the boards irrespective of the boards selected just below.

Selecting "Available In All Boards" will not remove the selected boards (but these will not be displayed in the "edit message icons" list, see for example "Thumb Up" in the screenshots).

In the page where all the icons are listed the column "Board" is changed to "Boards" and if the icon is available in more than one board a list of all those boards is created.

If while editing an icon all the boards are deselected as well as "Available In All Boards", the icon is removed from the database.

The mod doesn't change the database, so any change is completely compatible with a default installation of SMF.

Many thanks to Kays for the many hours he spent finding my mistakes!

Available at github: https://github.com/emanuele45/Boards-Icons-Multiboard
Title: Re: Allow select multiple boards for message icons
Post by: SilverKnight on February 12, 2012, 06:35:52 PM
Good mod, should really be added to smf by default.
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on June 02, 2012, 09:16:43 AM
Amen on the default, I was gunning for that when I was on the team....all you need to do is make the field for boards accept commas and voila! Ha ha

Thanks so much for this mod, it's perfect!
Title: Re: Allow select multiple boards for message icons
Post by: emanuele on June 14, 2012, 06:15:59 AM
Reporting here the link to the bug, so I can close it on mantis.

http://dev.simplemachines.org/mantis/view.php?id=4988

I'll fix it...sooner or later... :P
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on June 16, 2012, 12:08:55 AM
Sorry bout that, I was too afraid to uninstall ha ha.
Title: Re: Allow select multiple boards for message icons
Post by: emanuele on June 16, 2012, 04:57:27 AM
No problem!

It's a bug in the end! ;D
Title: Re: Allow select multiple boards for message icons
Post by: WasdMan on July 04, 2012, 05:02:13 AM
Hungarian Language:

ISO:
Quote<file name="$languagedir/Modifications.hungarian.php" error="skip">
      <operation>
         <search position="end" />
         <add><![CDATA[
$txt['icons_boards_desc'] = 'Fórum ikonokat lehet használni';
$txt['icons_select_usable_boards'] = 'Táblák mutatása';
$txt['messageicon_delete_confirm'] = 'Ezt az üzenet ikont biztosan törölni akarod?';
]]></add>
      </operation>
   </file>

UTF8:
Quote<file name="$languagedir/Modifications.hungarian-utf8.php" error="skip">
      <operation>
         <search position="end" />
         <add><![CDATA[
$txt['icons_boards_desc'] = 'Fórum ikonokat lehet használni';
$txt['icons_select_usable_boards'] = 'Táblák mutatása';
$txt['messageicon_delete_confirm'] = 'Ezt az üzenet ikont biztosan törölni akarod?';
]]></add>
      </operation>
   </file>
Title: Re: Allow select multiple boards for message icons
Post by: emanuele on July 04, 2012, 09:14:50 AM
Thank you WasdMan!
The first time i'll upgrade the mod (most likely to fix the previously reported bug), I'll include your translation as well!
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on July 04, 2012, 06:45:27 PM
Yay!
Title: Re: Allow select multiple boards for message icons
Post by: Biology Forums on July 10, 2012, 02:09:20 PM
There should be a 1.x version of this.
Title: Re: Allow select multiple boards for message icons
Post by: Arantor on July 10, 2012, 05:24:28 PM
1.1.x was first released 6 years ago, it's time to consider more modern software.
Title: Re: Allow select multiple boards for message icons
Post by: emanuele on July 11, 2012, 03:27:32 PM
Feel free to port it.
From me there will be a 2.1 version...unless...

/me goes create a new branch and ask for opinions :P

Even though the way the mod is implemented is rather hackish and don't know how good it would fit into a 2.1...
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on July 13, 2012, 02:03:10 AM
Just change the DB to allow the boards to be #, #, #, # and then the code to accept that sort of method, instead of one single number only :).
Title: Re: Allow select multiple boards for message icons
Post by: Arantor on July 13, 2012, 10:03:27 AM
That's not an efficient method of doing it. There are better ways of doing it than shoving the database in a direction that is terribly outdated.
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on July 13, 2012, 11:08:16 AM
If it works fine there's no reason to reject it because it's an old method. Not all old things are bad.
Title: Re: Allow select multiple boards for message icons
Post by: Arantor on July 13, 2012, 11:12:31 AM
No, really, there is.

There are old techniques that are used because back when they were used, things were different. Except that now, some years later, better techniques are used.

The technique you're suggesting is much the same as how SMF stores what groups can see what boards, amongst other things. Except that it's one of the performance hurting aspects of the DB design because it's slow to search through (and this would require a search)
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on July 13, 2012, 11:46:12 PM
How would board icons require a search?
Title: Re: Allow select multiple boards for message icons
Post by: Arantor on July 14, 2012, 12:23:11 PM
Under your proposal it would have to apply a search to find the list of icons valid for a given board. This is distinctly not efficient (and would have to be specially rewritten for PostgreSQL and SQLite too, as it happens)
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on July 15, 2012, 12:30:17 AM
Then do the reverse and have it save by board, not icon. Then the search only happens in admin.
Title: Re: Allow select multiple boards for message icons
Post by: Arantor on July 15, 2012, 09:36:12 AM
And posting.

There's still an overhead involved in finding the board's icons and then splitting it out, an overhead that doesn't necessarily apply by not using a technique that's outdated and horribly inefficient and instead using MySQL the way it was designed to be used.
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on July 16, 2012, 08:34:12 AM
No it doesnt, because you simply find the row for the board you're in and then it has all the icons to display in it.

It only happens in admin cause you find all the boards that have the icon in it, the reverse.
Title: Re: Allow select multiple boards for message icons
Post by: Arantor on July 16, 2012, 08:35:34 AM
If you're convinced it's not a problem, go implement it.
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on July 18, 2012, 10:07:11 AM
I don't know how to code sources
Title: Re: Allow select multiple boards for message icons
Post by: emanuele on July 18, 2012, 04:50:50 PM
I just wanted to say I don't like the fact I had to use an encoded name to know which icon I'm editing...lol

BTW Arantor is right, find_in_set is not a solution...
Title: Re: Allow select multiple boards for message icons
Post by: Jade Elizabeth on July 18, 2012, 11:53:52 PM
Well it is a quick and easy fix vs recoding the whole thing that's all I was saying.