SimplePortal

Support => English Support => Topic started by: MazdaClubTR on November 11, 2009, 05:35:02 AM

Title: Shoutbox reverse order
Post by: MazdaClubTR on November 11, 2009, 05:35:02 AM
I was trying the shoutbox option and wanted to try th shoutbox to be used as a chat . So I put it in the reverse order and realised that when reverse order is set the users viewer see the first  few messages in the box rather than the last post. You are forced to scroll down.

Is it possible to make it go to last post ?

P.S. Although I have set the versions of SMF and SP in my profile forum warns me to change it..

Title: Re: Shoutbox reverse order
Post by: Nathaniel on November 11, 2009, 07:02:35 PM
Code: ("Find (/Themes/default/PortalShoutbox.template.php)") [Select]
<script language="Javascript" type="text/javascript"><!-- // --><![CDATA[';
Code: ("Replace") [Select]
<script language="Javascript" type="text/javascript"><!-- // --><![CDATA[';

if ($shoutbox['reverse'])
echo '
var objDiv = document.getElementById("shouts_', $shoutbox['id'], '");
objDiv.scrollTop = objDiv.scrollHeight;';
Title: Re: Shoutbox reverse order
Post by: MazdaClubTR on November 14, 2009, 11:49:04 AM
When I do that I get a theme parse error..
Title: Re: Shoutbox reverse order
Post by: Nathaniel on November 14, 2009, 05:25:42 PM
Can you attach your '/Themes/default/PortalShoutbox.template.php' file?
Title: Re: Shoutbox reverse order
Post by: Ardd0 on November 20, 2009, 08:17:01 PM
I tried that code and no parse error, however the scroll bar now starts in the middle, not starting at the bottom yet but on the upside it's halfway there :)
Title: Re: Shoutbox reverse order
Post by: Ardd0 on November 28, 2009, 05:16:29 PM
Can you attach your '/Themes/default/PortalShoutbox.template.php' file?
Here's a copy of my PortalShoutbox.template.php if this will help.

 I'm using SMF forum 2.0 RC2 and SP 2.3.1 (for some reason this does not want to show up on my profile)

Any help with this would be very greatly appreciated.  :nervous-happy:
Title: Re: Shoutbox reverse order
Post by: Nathaniel on December 10, 2009, 04:39:02 AM
@Ardd0
Try the attached file.

@MazdaClubTR,
Could you please attach your file?
Title: Re: Shoutbox reverse order
Post by: MazdaClubTR on December 10, 2009, 07:53:00 AM
Hi Nathaniel

Sorry for late response but due to some other problem (not anything related to SP ) I had to uninstall SP from test site.

I will try it again as soon as I reinstall.
Title: Re: Shoutbox reverse order
Post by: MazdaClubTR on December 10, 2009, 09:05:04 AM
Hi Nathaniel,

I reinstalled SP and tried it. This time it works but the newest shout doesnt shift the old ones up even auto refresh is set. You have to refresh the whole page.

Title: Re: Shoutbox reverse order
Post by: Nathaniel on December 10, 2009, 06:53:31 PM
I forgot that another few edits are required for that:

Code: ("Find (Themes/default/portal.js or Themes/default/scripts/portal.js)") [Select]
var shoutbox_id, updated, error, warning, shout, id, author, time, timeclean, delete_link, body, is_me, new_body = '';
Code: ("Replace") [Select]
var shoutbox_id, updated, error, warning, reverse, shout, id, author, time, timeclean, delete_link, body, is_me, new_body = '';
Code: ("Find (Themes/default/portal.js or Themes/default/scripts/portal.js)") [Select]
      warning = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("warning")[0].childNodes[0].nodeValue;
Code: ("Replace") [Select]
      warning = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("warning")[0].childNodes[0].nodeValue;
      reverse = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("reverse")[0].childNodes[0].nodeValue;

Code: ("Find (Themes/default/portal.js or Themes/default/scripts/portal.js)") [Select]
         setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body);
Code: ("Replace") [Select]
         setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body);

         if (reverse != 0)
            document.getElementById('shouts_' + shoutbox_id).scrollTop = document.getElementById('shouts_' + shoutbox_id).scrollHeight;
         else
            document.getElementById('shouts_' + shoutbox_id).scrollTop = 0;

Code: ("Find (Themes/default/PortalShoutbox.template..php)") [Select]
<warning>', !empty($context['SPortal']['shoutbox']['warning']) ? htmlspecialchars($context['SPortal']['shoutbox']['warning']) : 0, '</warning>';
Code: ("Replace") [Select]
   <warning>', !empty($context['SPortal']['shoutbox']['warning']) ? htmlspecialchars($context['SPortal']['shoutbox']['warning']) : 0, '</warning>
   <reverse>', !empty($context['SPortal']['shoutbox']['reverse']) ? 1 : 0, '</reverse>';
Title: Re: Shoutbox reverse order
Post by: MazdaClubTR on December 11, 2009, 03:15:20 AM
Thanks, I will try that as soon as possible..
Title: Re: Shoutbox reverse order
Post by: Nathaniel on December 18, 2009, 09:09:43 PM
Thanks, I will try that as soon as possible..

Any updates on this issue? Did you manage to apply the edits and get this to work properly?
Title: Re: Shoutbox reverse order
Post by: Ardd0 on December 23, 2009, 06:10:18 PM
@Ardd0
Try the attached file.

@MazdaClubTR,
Could you please attach your file?
Sorry for the late reply I just got back to that. THANKS for the help with this :) I'll try the attached file and the other edits as well.

 The oddest thing is that the original edit worked for the shoutbox in the admin section but no other...go figure.
Title: Re: Shoutbox reverse order
Post by: Ardd0 on December 23, 2009, 07:54:23 PM
Thanks, I will try that as soon as possible..

Any updates on this issue? Did you manage to apply the edits and get this to work properly?
I tried all the edits and there is improvement the scroll bar goes to and stays at the bottom when you send a shout but still starts roughly in the center when the page is loaded, I used the attachment you sent as well as the portal.js edits

 here's the URL of my site http://www.hypercrites.org

 you are welcome to any kind of acess that would help just let me know and I'll set you up :)
Title: Re: Shoutbox reverse order
Post by: MazdaClubTR on January 06, 2010, 02:09:36 AM
Any updates on this issue? Did you manage to apply the edits and get this to work properly?

Sorry for the late reply Nathaniel but I had to stop testing SP cause of the following problem. With the same banners I dont have the issue at all on my production site.

http://simpleportal.net/index.php?topic=4070.0
Title: Re: Shoutbox reverse order
Post by: Ardd0 on January 09, 2010, 01:02:39 AM
This workaround graciously provided by a friend seems to have solve the problem of the scroll bar starting in the center when a page is loaded, it now snaps to the bottom and shows the newest post. I used this in conjunction with the edits you have provided and it seems a viable workaround.

 In the PortalShoutbox.template.php

 this
Code: [Select]
  if ($shoutbox['reverse'])
      echo '
      var objDiv = document.getElementById("shouts_', $shoutbox['id'], '");
      objDiv.scrollTop = objDiv.scrollHeight;';
 

 was changed to this
 
Code: [Select]
if ($shoutbox['reverse'])
      echo 'sp_refresh_shout('.$shoutbox['id'].');';

 I have tested this with both Firefox and IE and it seems to work well in both.
Title: Re: Shoutbox reverse order
Post by: [SiNaN] on January 20, 2010, 02:19:50 PM
I, unfortunately, don't have time to go over all the posts; so do we have anyone here having problems or is this issue solved?
Title: Re: Shoutbox reverse order
Post by: Clara Listensprechen on January 20, 2010, 11:20:59 PM
I'm not sure if this fix produced the secondary problem: snapping to only the first two lines of the last shout instead of the end of the last shout; that's a problem that ensued after one of the fixes that was tried.  I'll have to yank Ardd's chain on that first, I think.
Title: Re: Shoutbox reverse order
Post by: Ardd0 on January 21, 2010, 02:38:57 PM
I, unfortunately, don't have time to go over all the posts; so do we have anyone here having problems or is this issue solved?

 You can mark this one resolved as far as I am concerned I posted the fix for this and the addition of an audible alert as a package here http://simpleportal.net/index.php?topic=4350.0

 Thanks for looking in on this you bring a really good vibe here :)
Title: Re: Shoutbox reverse order
Post by: [SiNaN] on January 21, 2010, 03:23:41 PM
I guess I'll keep this open until MazdaClubTR verifies the issue is fixed.
Title: Re: Shoutbox reverse order
Post by: MazdaClubTR on January 28, 2010, 05:27:07 PM
Thanks Sinan,

You better mark it as solved. I had to stop testing.


Sorry for the late reply Nathaniel but I had to stop testing SP cause of the following problem. With the same banners I dont have the issue at all on my production site.

http://simpleportal.net/index.php?topic=4070.0

Title: Re: Shoutbox reverse order
Post by: [SiNaN] on January 29, 2010, 09:39:57 AM
Okay, did.

For others having issues; please start a new topic.
SimplePortal 2.3.8 © 2008-2024, SimplePortal