Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Topic started by: Angelina Belle on August 27, 2009, 12:47:41 PM

Title: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on August 27, 2009, 12:47:41 PM
I think the interface would be improved if it were easy to add a custom message icon to several boards at once.

If, for example, a forum has three "buy, sell, or trade" boards, it would be appropriate to use a custom forsale.gif on all three of these boards, but not on any other boards in the forum.

An additional benefit to this approach would be that it would be more difficult (if not impossible, depending on the implementation) to add the same message icon more than once to the same table.

In the list of message icons, each would be listed once, with the associated boardnames listed in the "Board" column (which could now be headed "Boards").
Editing options would include deleting the icon, or in "add" or "modify", selecting or de-selecting one or more boards from the drop-down. Some explanatory text would be required to explain that the user should choose "All boards" or select any number of board names from the drop-down.

Implementing this change may require changing the structure of the table message_icons, so that a file name does not have to be associated with several different icon_ids. This might involve adding another table (message_icon_boards?) to reflect the one-to-many relationship between icons and boards.

$context['icons']['board'] would become an array, $context['icons']['boards'].

SQL statements for SELECT and INSERT would have to be changed. After the "modify" form has been submitted, the code would need to check to see if any boards currently associated with the icon are no long selected and so need to be deleted for that icon_id.

It sounds like a bit of work for a modest improvement in the interface! But I think it is worth scheduling into "ease of use" improvements.

Thanks for considering my enhancement suggestion.

AB
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Arantor on August 27, 2009, 02:59:50 PM
It will be another table for the one-to-many relation, but more to the point you'll slow down a fair amount of the forum because that table-join would apply on many different pages and in many contexts.

1.1 is only maintained, not actively developed, 2.0 is feature-locked - but it can be considered for 2.1. I don't know if there are any plans to update this feature generally; several other updates for this have been requested.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Jade Elizabeth on August 27, 2009, 03:39:11 PM
I want :D.

You know how phpmyadmin does that thingie on export? Where you can press control and select different tables?

I want it like that :D.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Arantor on August 27, 2009, 03:40:44 PM
That's how the interface would likely be (that's a select multiple).

The code is, unfortunately, somewhat uglier to do.

/me adds it to his to-do list under 'merits definite further investigation'.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Jade Elizabeth on August 27, 2009, 04:26:30 PM
Doesnt phpBB do it? :P








I honestly have no idea, I'm just being silly
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Arantor on August 27, 2009, 04:31:17 PM
Doesnt phpBB do it? :P

I don't know but that's almost enough reason to contemplate it!
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Jade Elizabeth on August 27, 2009, 04:37:46 PM
Doesnt phpBB do it? :P

I don't know but that's almost enough reason to contemplate it!

I bet MyBB, and IPB, and ... *mental blank*... VB...and... other software do it :D.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on August 27, 2009, 04:54:14 PM
For speed, you can put a static of the join in a third table. You have several rows per filename -- that's the way message_icons is now. At least all the rows for one filename can have the same icon_id. The only hit would occur in ManageSmileys.php, where you'd have to insert or delete from the new message_icon_boards (and sometimes insert or delete from message_icons), and then recreate the static message_icons_and_boards from the join of the two other tables.

Since the number number of times per second an admin is expected to be updating message icons and the boards they blong to is expected to be small, this should not be a big performance problem for the server.

Since it would be very unusual for these to be big tables, the duplication is not a big deal, space-wise, either.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Arantor on August 27, 2009, 05:12:30 PM
It's still a (yet one more) cross table join that would be being performed for many page loads, meaning that it will affect performance, even if the content is mostly static, plus the queries will have to be modified in multiple places, making it a large feature, or even a complex mod, to build.

That said it is doable, whether you relegate it to one or two new tables. It's on my to-do list and I'll look into it once I clear some of the other stuff I have first.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on August 27, 2009, 05:39:35 PM
I think you can avoid any additional cross-table joins by saving the output of the join as a table immediately after updating the two message_icons tables, and using that "snapshot" (sorry -- Oracle term)  for filling $context['icons'] whenever it is needed. Of course, there will be additional logic to filling $context['icons'].

I bet it could be a bigger hassle tracking down every use of $context['icons'], and changing how it is filled and used.

Thanks for considering the request; I think it will be a good feature in some future version of SMF.

AB
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Arantor on August 27, 2009, 05:51:56 PM
The problem with doing it is that it needs to be done in a way that is cross-DB compliant, meaning that you'd have to store that join output as a value in its own right, so perhaps forcing it into a single table somehow.

The list will be huge, yes... but it's on my list. I won't guarantee if/when I get to it, or whether the devs will put it into 2.1, but it's certainly food for thought.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on August 27, 2009, 07:33:02 PM
perhaps forcing it into a single table somehow.

Yep. Glad it's on the list.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Oldiesmann on August 27, 2009, 09:51:31 PM
Putting it into one table is easy. Just store the board IDs as a comma-separated list.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Jade Elizabeth on August 27, 2009, 09:53:08 PM
Putting it into one table is easy. Just store the board IDs as a comma-separated list.

THAT'S TOTALLY WHAT I SAID TO HER IN PM!!

Quote
I still don't even see the need for all that. Just put the board id's they're allowed in into the table and check against the ID on POST, not on viewing.

I meant what you said, with the end of what I said, but didnt know how to say it :-[.
I'm sick, so my brain is REALLY not functioning :(
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on August 31, 2009, 03:20:39 PM
Putting it into one table is easy. Just store the board IDs as a comma-separated list.
That is so not 3NF. But it would work. So "all" that is left is rewriting the code for
* using the icon_board array to make up the SQL insert statement
* unpacking the CSV list from icon_board field of message_icons into $context['icons'] -- which could have exactly the same form as it does now, to save rewriting in all the places where $context['icons'] is used.

AB
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Arantor on August 31, 2009, 03:47:34 PM
Oldiesmann's suggestion is entirely consistent with several data structures in SMF - many things are comma separated lists (e.g user ignore list, user secondary groups...)
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: 青山 素子 on September 01, 2009, 11:44:27 AM
That is so not 3NF. But it would work.

While it would be nice if everything could be fully normalized, sometimes it just can't without a significant performance hit.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on September 01, 2009, 12:10:18 PM
Sounds like a pragmatic approach.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Jade Elizabeth on September 01, 2009, 01:12:31 PM
/me is 100% lost with the last two replies
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on September 01, 2009, 01:33:26 PM
Database architecture -- third-normal form is almost an aesthetic ideal (http://en.wikipedia.org/wiki/Third_normal_form). It also offers the most flexibility for creating joins or views of the data for various purposes. When you want to mine very mulit-dimensional data, this is very useful.

Joins are resource intensive. If you don't NEED to slice and dice the data, you can pick a non-3NF "view" of the data for storage. Stuffing a list of attributes into a single field is very unaesthetic, but can be a good practical choice if it reduces the time to serve the page and/or load on the server(s).
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Jade Elizabeth on September 01, 2009, 02:14:04 PM
Remind me why you're aiming for docs when you could do mods or be a dev... LOL
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on September 01, 2009, 03:54:46 PM
'Cause I wanted to make ONE simple improvement to one doc.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Jade Elizabeth on September 01, 2009, 04:44:13 PM
Ha ha and we snagged you :D.


/me feels bad only cause she dragged you in, but doesnt regret it :D
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Arantor on September 01, 2009, 05:47:27 PM
But we're a team here - we cross our 'boundaries' and help each other. I'm in Support but do a fair amount of modding, for example.

Play to your strengths :)
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on September 01, 2009, 07:02:17 PM
I'm not aiming for docs, either. I'm only interested in 1 (OK 3) docs.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Arantor on September 01, 2009, 07:08:37 PM
Every contribution is appreciated; good documentation - especially of the technical variety - is always something every project needs and values.
Title: Re: Allow "multiple" in <select name="icon_board"
Post by: Angelina Belle on September 01, 2009, 07:57:50 PM
Thanks, Arantor. Actually, I think Jade & I get along pretty well. I want to USE SMF, but am happy to do my little bit to help. :)