Customization > Mod Requests

Shoutbox open in a new window or new page (Full Chat icon)

(1/5) > >>

Divecall:
Hello!

It is possible to add a link or an icon (next to the existing one, like history, smileys, design...) and when a member click on that icon, the shoutbox (with all the last shouts from the history) open in a new window or in a new page but full functionally ?




Chen Zhen:
Divecall,

Yes this is possible by creating a page, adding one simple edit to a SP file & uploading one image file via FTP.

file: Themes / default / PortalShoutbox.template.php

Find:

--- Code: --- if ($context['can_shout'])
echo ' <a href="#smiley" onclick="sp_collapse_object(\'sb_smiley_', $shoutbox['id'], '\', false); return false;">', sp_embed_image('smiley'), '</a> <a href="#style" onclick="sp_collapse_object(\'sb_style_', $shoutbox['id'], '\', false); return false;">', sp_embed_image('style'), '</a>';

--- End code ---

Replace with:

--- Code: --- if ($context['can_shout'])
echo ' <a href="#smiley" onclick="sp_collapse_object(\'sb_smiley_', $shoutbox['id'], '\', false); return false;">', sp_embed_image('smiley'), '</a> <a href="#style" onclick="sp_collapse_object(\'sb_style_', $shoutbox['id'], '\', false); return false;">', sp_embed_image('style'), '</a>';

if ((!empty($_REQUEST['page']) ? $_REQUEST['page'] : false) != 'shoutbox1')
echo '&nbsp;&nbsp;<a href="javascript:void(0);" onclick="return fullPage()" title="Full Page">',sp_embed_image('full_page'),'</a>
<script type="text/javascript">function fullPage() {window.open("'.$scripturl.'?page=shoutbox1", "Shoutbox");return false;}</script>';
else
echo '&nbsp;&nbsp;<a href="javascript:void(0);" onclick="window.close()" title="Exit Full Page">',sp_embed_image('full_page'),'</a>';

--- End code ---


Now create a portal page on your forum: Admin -> Pages -> Add Page


* type in a page title of your choice
* make sure to enter the Page ID: shoutbox1
* page type should be set to: PHP
* in the Blocks options do not opt the same shoutbox (this option is for allowing other blocks to appear on the page)
* edit the integer for the shoutbox number in the php code shown below, to match your shoutbox#
Place this in the Body:

--- Code: ---global $sourcedir;

@require_once($sourcedir . '/PortalBlocks.php');
$parameters['shoutbox'] = 1;
$id = 41;
$return_parameters = false;
sp_shoutbox($parameters, $id, $return_parameters);

--- End code ---

Now upload the attached image file to: Themes / default / images / sp


Now when you display your shoutbox, an extra image/link will appear that will open a new window with your page that shows the opted shoutbox. Clicking the same image/link in the new page will then close it.



Divecall:
WOW...fast answer!

Thank you at first, i will test this at weekend.

If i have some problems, i will write this here.

 :applause:

Costa:
Sorry to bump this thread. But is possible in the new page set the height of the shoutbox bigger?
At least the double size.

Thanks in advance.

Chen Zhen:
Costa,

You can enter specifics for the window being opened within the javascript command.

ie.

--- Code: --- if ($context['can_shout'])
echo ' <a href="#smiley" onclick="sp_collapse_object(\'sb_smiley_', $shoutbox['id'], '\', false); return false;">', sp_embed_image('smiley'), '</a> <a href="#style" onclick="sp_collapse_object(\'sb_style_', $shoutbox['id'], '\', false); return false;">', sp_embed_image('style'), '</a>';

if ((!empty($_REQUEST['page']) ? $_REQUEST['page'] : false) != 'shoutbox1')
echo '&nbsp;&nbsp;<a href="javascript:void(0);" onclick="return fullPage()" title="Full Page">',sp_embed_image('full_page'),'</a>
<script type="text/javascript">function fullPage() {window.open("'.$scripturl.'?page=shoutbox1", "Shoutbox", "location=1,status=1,scrollbars=1, width=250,height=400");return false;}</script>';
else
echo '&nbsp;&nbsp;<a href="javascript:void(0);" onclick="window.close()" title="Exit Full Page">',sp_embed_image('full_page'),'</a>';

--- End code ---

Just edit this part from above:

--- Code: ---"location=1,status=1,scrollbars=1, width=250,height=400"

--- End code ---

.. with the specifics for the page being opened.

Here are some examples of the needed syntax: Click Here

Navigation

[0] Message Index

[#] Next page

Go to full version