logo

Member
Member
Offline Offline
Posts: 46
SVN 663: Emoticon administration has issue with selected icon w/FIX

Polishing issue due to a slight bug with Emoticons administration.

When navigating to Emoticons in the administration, it defaults to the first alphanumerical image in the drop down, but doesn't give the preview, stating none is selected. If you try to select the already-selected one, it does nothing. You have to select another, then the default one again to make it load.

Here's my little fix.

Open:
Code:
Layouts/Admin/Emoticons.php


First, lets forcibly remove the error, but setting the value that's expected in _POST if there's no _POST. Add a check, and if not set, then set it.

Find:
Code:

                  if ($file != "." && $file != ".." && $file != 'index.php' && $file != '.svn') {
                      $body .= '<option value="' . $file . '" ' . (errors() && $file == $_POST['image'] ? 'selected="selected"' : '') . '>' . $file . '</option>';


Replace With:
Code:

                  if ($file != "." && $file != ".." && $file != 'index.php' && $file != '.svn') {
                      if (!(isset($_POST['image']))) { $_POST['image'] = $file;}
                      $body .= '<option value="' . $file . '" ' . (errors() && $file == $_POST['image'] ? 'selected="selected"' : '') . '>' . $file . '</option>';


Regarding putting the isset in the loop, after the first iteration, it'll be set and will fail the if check on subsequent iterations.

Next, to get rid of the error check in the image display, since we're forcing the hand of what would cause the error.

Find:
Code:

        <td>Emoticon Preview: <img src="' . (errors() ? 'images/emoticons/' . $_POST['image'] : '') . '" id="preview" alt="none selected"/></td>


Replace With:
Code:

      <td>Emoticon Preview: <img src="images/emoticons/' . $_POST['image'] . '" id="preview" alt="'. substr($_POST['image'], 0, strrpos($_POST['image'], '.')) .'"/></td>


You'll notice I also changed the alt text, so every icon doesn't have the alt text none selected and instead has the name of the image file, with the extension removed.
Last Edit: 25th September, 2009, 12:32:44 PM by FWishbringer
eoCMS Developer
eoCMS Developer
Offline Offline
avatar
Posts: 1528
Re: SVN 663: Emoticon administration has issue with selected icon w/FIX

Fixed

Please do not PM me requesting support or anything, use the forums, thats what they are here for
eoCMS Designer
eoCMS Designer
Offline Offline
avatar
Posts: 1290
tbarkass_willamson@hotmail.com
Re: SVN 663: Emoticon administration has issue with selected icon w/FIX

This bug has been deemed [Fixed] by an eoCMS developer. If you dispute the Fix, please PM a developer, giving details of why. This topic can then be unlocked allowing for further discussion.

Seen a bug? Report it!

Jump to:


0.08 seconds Queries: 13