SimplePortal

Development => Feature Requests => Declined Requests => Topic started by: newsman on February 18, 2012, 03:39:32 PM

Title: Shout "room" selector
Post by: newsman on February 18, 2012, 03:39:32 PM
Would like to see..... multiple shout boxes that switch on the fly....

Say: left-middle-right block layout.

In the middle blok the shoutbox.
In the right block a shout "room" selector.

  Shoutbox                                                                  Rooms         
|-----------------------------------------------------------|   |----------------------------------|
say: blabla                                                                   -Public                         
say: nej nej                                                                  -Helpdesk
say: JoJo                                                                      -Private Staff
say: hihi
say: goto helpdesk
say: Need help ?
|-----------------------------------------------------------|   |----------------------------------|

When someone needs another room Like helpdesk they click on Helpdesk. The page refreshes and only the shoutbox changes to helpdesk, the rest of the portal page stays the same.

When they are done they click on Public and the whole portal page refreshes but only the shoutbox blok switches back to the public shoutbox.

Staff could use a private shout "room" and switch on the fly....

Greetz
Title: Re: Shout "room" selector
Post by: Kryzen on February 18, 2012, 03:46:25 PM
Hey! Welcome to Simple Portal. :) Try this: http://www.simplemachines.org/community/index.php?topic=466369.0
Title: Re: Shout "room" selector
Post by: newsman on February 18, 2012, 04:01:18 PM
I knew that one. It directs to different pages. It does not leave the rest of the original front page "unchanged" it just switches out the whole page. At least that's what it did for me..... maybe i screwed something up....?

I don't wanna clone 5 front pages only for the shoutbox to change, that's too difficult with complex front pages. I just want the shoutbox block to swap on 1 and the same frontpage (after refresh)

Let's call it block switching.... :)

Would something like this be possible ?

Greetz
Title: Re: Shout "room" selector
Post by: Kryzen on February 18, 2012, 04:08:23 PM
I'm afraid that's not possible, but it sounds like a very awesome idea. It would take some time to implement though, but it's worth requesting it as a feature for sure. I'll see what I can do. ;)
Title: Re: Shout "room" selector
Post by: newsman on February 18, 2012, 04:19:25 PM
Would open up a whole new concept in my opinion.....

For example:

Shoutboxes that change on the fly and thus creating shoutbox rooms same like chatrooms.
 
Different blocks which would switch on the fly and be controlled with selectors. Different custom "Who's online" blocks that users can control themselves, "last topic" or rather "last post's" selector... click and switch...

Greetz
Title: Re: Shout "room" selector
Post by: newsman on February 19, 2012, 10:28:39 AM
Maybe an easier way would be too make <TABS> above shoutbox ?


____________________________
|General | Private | Admin | Sports |
----------------------------------------------------------------
Refresh icon, smiley icon etc etc
----------------------------------------------------------------
Say: haha
Say: NeyNey
etc
etc

----------------------------------------------------------------


Would this be possible/easier ?

Greetz
Title: Re: Shout "room" selector
Post by: Chen Zhen on February 19, 2012, 04:38:10 PM
This is a good idea.
imo a drop-down menu would be better.
Title: Re: Shout "room" selector
Post by: Devil jimmy on February 20, 2012, 08:07:19 AM
this already exists
this is stated on the forum owner bluedevil
I'm not sure I can post the link here
but you can ask him He is a member here
works perfectly
Title: Re: Shout "room" selector
Post by: newsman on February 28, 2012, 11:06:28 AM
No it doesn't exist.

As stated before the bleudevil's chat room uses different pages to display the different rooms. When changing chat room the whole page changes to a different one.

A normal shout box is displayed on the portal page together with other blocks. Using this approach with the solution from bluedevil would mean you would have to create multiple <cloned> portal pages. 1 for each chat room and switch between different pages. All <cloned> pages would need the same (extra) blocks from the original portal page. A lot of work and very confusing when you chance 1 block on the portal page you would also have to change that same block on the "cloned" pages also.

I want to give the current SHOUT block an extra option. The idea is to have only change the shout box <on the fly> on 1 and the same portal page. Thus creating the same effect as in a real chat with different chat rooms. In effect making the shout behave the same as a "real" chat.

Many many people are looking too have some kind of live chat with multiple rooms on their forum which is fully integrated in SMF. Login permissions etc etc. Currently this is one of the most requested features, i think.

In essence the simpleportal shout box is a chat with a single room and more important it's fully integrated in SMF. So we only need the option of having more "rooms".

The options how ? I stated before.

It being a whole page refresh when changing "shout-rooms" selected through an new "shout-rooms" block or added <tabs> to the shout for selecting the "shout-rooms".




One other option would be to have multiple shout rooms and multiple shout-rooms in the database. I think this is already so now.
The shoutbox name is stored in the database as: sp_shoutboxes > id_shoutbox > name
The shoutbox date is stored in the databse as:  sp_shouts > body

When changing shout-room the normal refresh would simply jump to another database entry and change the title and content of the shout.

Let's say we create 2 shouts.

One called PUBLIC and in the database it's called:  id_shoutbox=1
and one called PRIVATE and in the database it's called:  id_shoutbox=2.

What we would need is a separate block (or tabs) for the room categories, so we can select what "shout-room" we want to see. This block reads and displays the database title of all the shout boxes we created. It simply read the title name from database (sp_shoutboxes > name) and displays those names.

When we are in the <public> "shout-room" and we chance the "shout-room" by clicking <private> in the "shout-categories" block we FORCE a refresh and clear all data in the current shout box so all is empty.

And then we also switch what we read from the database, from <public:id_shoutbox=1> to <private:id_shoutbox=2> and read all the new data and display that instead of the old data. In effect we only swapped out the data inside the shout box. For the user it "LOOKS" like he switched to another room.

In short:

The whole switch would only require a <clear current shoutbox> and a chance of <id_shoutbox=1> to <id_shoutbox=2>.
The same idea as bluedevil but not switching out the pages but only switch what we read from the database.

DATABASE:
Current shout:  id_shoutbox=1, name PUBLIC read and display data from : sp_shouts, id_shoutbox=1, BODY

SWITCHING ROOM:
"Shout-rooms" block> select id_shoutbox=2, name PRIVATE > clear all shoutbox data

DATABASE
display NEW shout: id_shoutbox=2, name PRIVATE read and display data from : sp_shouts, id_shoutbox=2, BODY


I hope I explained it clearly enough ?

Sadly I am not skilled enough to write this in PHP. Maybe one of you knows if this is even possible and finds the time to do this.

Greetz
Title: Re: Shout "room" selector
Post by: newsman on March 02, 2012, 08:35:14 AM
No takers, probably not a good idea after all  :'(

Greetz
Title: Re: Shout "room" selector
Post by: grafitus on March 02, 2012, 10:16:57 AM
Good idea. But we *just* love simplicity. ;)
Title: Re: Shout "room" selector
Post by: newsman on March 05, 2012, 10:55:42 AM
All portals have some kind of "simple" shout.

Portals with an integrated "chat"-like function would have a much wanted feature that would give it an advantage over other portals.

Simple would be no portal at all....

....but I get the point.

Greetz
Title: Re: Shout "room" selector
Post by: [SiNaN] on March 06, 2012, 06:03:01 AM
Just to demonstrate the power of SimplePortal...

Code: [Select]
global $context, $user_info, $txt, $scripturl, $settings, $options;

$shoutboxes = array(
// shoutbox id => label
1 => 'Room 1',
2 => 'Room 2'
// 3 => 'Room 3',
// 4 => 'Room 4',
// 5 => 'Room 5',
);
if ($context['user']['is_guest'])
$default = !empty($_COOKIE['sp_current_room']) ? (int) $_COOKIE['sp_current_room'] : 0;
else
$default = !empty($options['sp_current_room']) ? (int) $options['sp_current_room'] : 0;
if ($default === 0)
$default = current(array_keys($shoutboxes));

$shoutbox = sportal_get_shoutbox($default);

$can_moderate = allowedTo('sp_admin') || allowedTo('sp_manage_shoutbox');
if (!$can_moderate && !empty($shoutbox['moderator_groups']))
$can_moderate = count(array_intersect($user_info['groups'], $shoutbox['moderator_groups'])) > 0;

$shout_parameters = array(
'limit' => $shoutbox['num_show'],
'bbc' => $shoutbox['allowed_bbc'],
'reverse' => $shoutbox['reverse'],
'cache' => $shoutbox['caching'],
'can_moderate' => $can_moderate,
);
$shoutbox['shouts'] = sportal_get_shouts($shoutbox['id'], $shout_parameters);

$shoutbox['warning'] = parse_bbc($shoutbox['warning']);
$context['can_shout'] = $context['user']['is_logged'];

echo '
<div class="shoutbox_container">
<div class="shoutbox_info flow_auto">
<select id="room_select" onchange="sp_update_room(); return false;" style="float: right;">';

foreach ($shoutboxes as $id => $name)
echo '
<option value="', $id, '"', $default == $id ? ' selected="selected"' : '', '>', $name, '</option>';

echo '
</select>
<div id="shoutbox_load_', $shoutbox['id'], '" style="float: right; display: none;"><img src="', $settings['sp_images_url'], '/loading.gif" alt="" /></div>
<a id="shoutbox_refresh" href="', $scripturl, '?action=portal;sa=shoutbox;shoutbox_id=', $shoutbox['id'], '" onclick="sp_refresh_room(); return false;">', sp_embed_image('refresh'), '</a> <a id="shoutbox_history" href="', $scripturl, '?action=portal;sa=shoutbox;shoutbox_id=', $shoutbox['id'], '">', sp_embed_image('history'), '</a>
</div>
<div class="shoutbox_body">
<ul class="shoutbox_list_compact" id="shouts_', $shoutbox['id'], '"', !empty($shoutbox['height']) ? ' style="height: ' . $shoutbox['height'] . 'px;"' : '', '>';

if (!empty($shoutbox['warning']))
echo '
<li class="shoutbox_warning smalltext">', $shoutbox['warning'], '</li>';

if (!empty($shoutbox['shouts']))
foreach ($shoutbox['shouts'] as $shout)
echo '
<li class="smalltext">', !$shout['is_me'] ? '<strong>' . $shout['author']['link'] . ':</strong> ' : '', $shout['text'], '<br />', !empty($shout['delete_link_js']) ? '<span class="shoutbox_delete">' . $shout['delete_link_js'] . '</span>' : '' , '<span class="smalltext shoutbox_time">', $shout['time'], '</span></li>';
else
echo '
<li class="smalltext">', $txt['sp_shoutbox_no_shout'], '</li>';

echo '
</ul>
</div>';

if ($context['can_shout'])
echo '
<div class="shoutbox_input smalltext">
<input type="text" name="new_shout" id="new_shout_', $shoutbox['id'], '" class="shoutbox_input sp_float_left input_text" onkeypress="if (sp_catch_enter(event)) { sp_submit_room(); return false; }" />
<input type="submit" name="submit_shout" id="shoutbox_submit" value="', $txt['sp_shoutbox_button'], '" class="sp_float_right button_submit" onclick="sp_submit_room(); return false;" />
</div>';

echo '
</div>
<script language="Javascript" type="text/javascript"><!-- // --><![CDATA[
var current_room = ', $default, ';
function sp_update_room()
{
var new_room = document.getElementById("room_select").value;
document.getElementById("shoutbox_load_" + current_room).id = "shoutbox_load_" + new_room;
document.getElementById("shoutbox_refresh").href = document.getElementById("shoutbox_refresh").href.replace(/shoutbox_id=\d+/, "shoutbox_id=" + new_room);
document.getElementById("shoutbox_history").href = document.getElementById("shoutbox_history").href.replace(/shoutbox_id=\d+/, "shoutbox_id=" + new_room);
document.getElementById("shouts_" + current_room).id = "shouts_" + new_room;';

if ($context['can_shout'])
echo '
document.getElementById("new_shout_" + current_room).id = "new_shout_" + new_room;';

if ($context['user']['is_guest'])
echo '
document.cookie = "sp_current_room=" + new_room;';
else
echo '
smf_setThemeOption("sp_current_room", new_room, null, "' . $context['session_id'] . '", "' . $context['session_var'] . '");';

echo '
current_room = new_room;
sp_refresh_room();
}
function sp_refresh_room()
{
sp_refresh_shout(current_room, 0);
}
function sp_submit_room()
{
sp_submit_shout(current_room, \'', $context['session_var'], '\', \'', $context['session_id'], '\');
}
// ]]></script>';

You just need to create separate shoutboxes for each room and change the $shoutboxes array at the beginning of the code accordingly.

There are a few limitations in this code, such as no smileys, styling options, and auto refresh and obviously it won't work unless you have JavaScript enabled. They could be added but I'm no longer the young The Amazing Coder who can spend time on it.

Attached a screenshot as well.
Title: Re: Shout "room" selector
Post by: [SiNaN] on March 07, 2012, 10:47:45 AM
I should add that this isn't something many would benefit. So I would leave it up to people who need it to customize it on their own.
SimplePortal 2.3.8 © 2008-2024, SimplePortal