Package Icy Phoenix Modifications
File $Id: install_onmouse_over_topic_title_En.txt
Version for Icy Phoenix: 0.0.1
Author: ShadowKnyght < forum@cyber-mag.com > (James B) h**p://forum.cyber-mag.com
Original Author: emrag < emrah987@hotmail.com > (Emrah Türkmen) ***.canver.net (TURKEY)
Copyright: (c) 2004 Emrah Türkmen
Email: < forum@cyber-mag.com > < emrah987@hotmail.com >
License h**p://opensource.org/licenses/GPL-license.php GNU Public License
Extra credits for this file:
Modified for Icy Phoenix by Lopalong. < lopalong@iinet.net.au > 07 January 2009
Title:
Onmouse Over Topic Title Display First And Last Post
Description:
When you hover the mouse on a topic link you will see first and
last posted message as a hover title like vBulletin
Files To Edit: 3
viewforum.php
templates/mg_themes/viewforum_body.tpl
languages/lang_english/lang_extend_icy_phoenix.php
Included Files: None
Disclaimer:
There is no guarantee that there are no security problems within the MOD.
Comments:
Author Notes:
The javascript added to viewforum_body.tpl comes from Mojavlinux's MyCalendar 2.2.6
( h**p://***.mojavelinux.com/ )
WARNING - WARNING - WARNING:
Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#
#-----[ BEGIN MODIFICATION ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
viewforum.php
#
#----[ FIND ]------------------------------------------
#
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
// START Onmouse Over Topic Title Display First And Last Post
// display first message as title
// character limit for hover title
$chr_limit = '350';
$first_post = '<div class="roundedhc" style="height:18px; padding: 2px 0 2px 0; font-weight:bold;"> ' . $lang['Firstpost'] . '</div><br />';
$sql = "SELECT p.*, pt.post_text, pt.post_id, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND pt.post_id = p.post_id
ORDER BY p.post_time
LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Cannot obtain topic information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$post_test = $row['post_text'];
$first_post .= $row['post_text'];
// if message is longer than character limit break message
// and add "......More" at the last of message
if (strlen($first_post) > $chr_limit)
{
$first_post = substr($first_post, 0, $chr_limit);
$first_post .= '<span class="genmed" style="font-weight:bold;">' . $lang['More'] . '</span>';
}
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
if ( !$board_config['allow_html'] )
{
if ( $row['enable_html'] )
{
$first_message = preg_replace('#(<)([/]?.*?)(>)#is', "<
$first_message = preg_replace('#(<)([/]?.*?)(>)#is', "<\2>", $first_post);
<>", $first_post);
}
}
// Parse message for BBCode if required
if ( $board_config['allow_bbcode'] )
{
$first_post = $bbcode->parse( $board_config['allow_bbcode'] ) ? ($first_post) : preg_replace('/:[0-9a-z:]+]/si', ']', $first_post);
}
// Parse smilies
if ( $board_config['allow_smilies'] )
{
if ( $row['enable_smilies'] )
{
$first_post = $bbcode->parse($first_post);
}
}
// replace n with <Nothing>
$first_post = preg_replace("/[nr]{1,2}/", '', $first_post);
// escape from double and/or single quotes
$first_post = str_replace(array('"', '''), array('"', '\''), $first_post);
// if message have [hide] [/hide] tags
// there will be an error message instead of normal message
if ( preg_match("/[hide]/i", $first_post) && preg_match("/[/hide]/i", $first_post))
{
$first_post = '<div class="gen">' . $lang['Protected'] . '</div>';
}
// display first message as title
// Add last post to pop up text
$char_limit = '350';
$last_post = '<hr /><div class="roundedhc" style="height:18px; padding: 2px 0 2px 0; font-weight:bold;"> ' . $lang['Lastpost'] . '</div><br />';
$sql = "SELECT *, post_text, post_id, bbcode_uid
FROM " . POSTS_TEXT_TABLE . "
WHERE post_id=" . $topic_rowset[$i]['topic_last_post_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Cannot obtain topic information', '', __LINE__, __FILE__, $sql);
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$post2_test = $row['post_text'];
$last_post .= $row['post_text'];
if (strlen($last_post) > $char_limit)
{
$last_post=substr($last_post, 0, $char_limit) . '<span class="genmed" style="font-weight:bold;">' . $lang['More'] . '</span>';
}
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
if ( !$board_config['allow_html'] )
{
if ( $row['enable_html'] )
{
$last_message = preg_replace('#(<)([/]?.*?)(>)#is', "<
$last_message = preg_replace('#(<)([/]?.*?)(>)#is', "<\2>", $last_post);
<>", $last_post);
}
}
// Parse message for BBCode if required
if ( $board_config['allow_bbcode'] )
{
$last_post = $bbcode->parse( $board_config['allow_bbcode'] ) ? ($last_post) : preg_replace('/:[0-9a-z:]+]/si', ']', $last_post);
}
// Parse smilies
$last_post = $bbcode->parse($last_post);
// replace n with <Nothing>
$last_post = preg_replace("/[nr]{1,2}/", '', $last_post);
// escape from double and/or single quotes
$last_post = str_replace(array('"', '''), array('"', '\''), $last_post);
// if message has [hide] [/hide] tags
// there will be an error message instead of normal message
if ( preg_match("/[hide]/i", $last_post) && preg_match("/[/hide]/i", $last_post))
{
$last_post = '<div class="gen">' . $lang['Protected'] . '</div>';
}
// Join first and last post text
if (!($post_test == $post2_test))
{
$first_post .= $last_post;
}
// END Adding last post to pop up text
// END Onmouse Over Topic Title Display First And Last Post
#
#----[ FIND ]------------------------------------------
#
'TOPIC_FOLDER_IMG' => $topic_link['image'],
'L_TOPIC_FOLDER_ALT' => $topic_link['image_alt'],
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// START Onmouse Over Topic Title Display First And Last Post
'FIRST_POST' => $first_post,
// END Onmouse Over Topic Title Display First And Last Post
#
#-----[ OPEN ]------------------------------------------
#
templates/mg_themes/viewforum_body.tpl
#
#----[ FIND ]------------------------------------------
#
<div class="forumline nav-div">
<p class="nav-header">
#
#----[ BEFORE, ADD ]------------------------------------------
#
<!-- Onmouse Over Topic Title Display First And Last Post START -->
<!-- The javascript presents here comes from MyCalendar 2.2.6 from MojavLinux Modified further by ShadowKnyght -->
<script language="Javascript" type="text/javascript">
<!--
var agt = navigator.userAgent.toLowerCase();
var originalFirstChild;
function createTitle(which, string, x, y)
{
// record the original first child (protection when deleting)
if (typeof(originalFirstChild) == 'undefined')
{
originalFirstChild = document.body.firstChild;
}
x = document.all ? (event.clientX + document.body.scrollLeft) : x;
y = document.all ? (event.clientY + document.body.scrollTop) : y;
element = document.createElement('div');
element.style.position = 'absolute';
element.style.zIndex = 1000;
element.style.visibility = 'hidden';
excessWidth = 0;
if (document.all)
{
excessWidth = 50;
}
excessHeight = 20;
element.innerHTML = '<div class="row2g-left-top"><table width="350" cellspacing="0" cellpadding="3" border="2"><tr><td><table width="100%" class="row2g-left-top" cellspacing="0" cellpadding="4"><tr><td><span class="genmed">' + string + '</span></td></tr></table></td></tr></table></div>';
renderedElement = document.body.insertBefore(element, document.body.firstChild);
renderedWidth = renderedElement.offsetWidth;
renderedHeight = renderedElement.offsetHeight;
// fix overflowing off the right side of the screen
overFlowX = x + renderedWidth + excessWidth - document.body.offsetWidth;
x = overFlowX > 0 ? x - overFlowX : x;
// fix overflowing off the bottom of the screen
overFlowY = y + renderedHeight + excessHeight - window.innerHeight - window.pageYOffset;
y = overFlowY > 0 ? y - overFlowY : y;
renderedElement.style.top = (y + 15) + 'px';
renderedElement.style.left = (x + 15) + 'px';
// windows versions of mozilla are like too fast here...we have to slow it down
if (agt.indexOf('gecko') != -1 && agt.indexOf('win') != -1)
{
setTimeout("renderedElement.style.visibility = 'visible'", 1);
}
else
{
renderedElement.style.visibility = 'visible';
}
}
function destroyTitle()
{
// make sure we don't delete the actual page contents (javascript can get out of alignment)
if (document.body.firstChild != originalFirstChild)
{
document.body.removeChild(document.body.firstChild);
}
}
//-->
</script>
<!-- Onmouse Over Topic Title Display First And Last Post END -->
#
#----[ FIND ]------------------------------------------
#
{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_ATTACHMENT_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="{topicrow.TOPIC_CLASS}">{topicrow.TOPIC_TITLE}</a>{topicrow.CALENDAR_TITLE}
#
#----[ INLINE FIND ]------------------------------------------
#
class="{topicrow.TOPIC_CLASS}"
#
#----[ INLINE AFTER, ADD ]---------[ AND Include The Leading Space ]---------------------------------
#
onmouseover="createTitle(this, '{topicrow.FIRST_POST}', event.pageX, event.pageY);" onmouseout="destroyTitle();"
#
#-----[ OPEN ]------------------------------------------
#
languages/lang_english/lang_extend_icy_phoenix.php
#
#----[ FIND ]------------------------------------------
#
//$lang[''] = '';
#
#----[ BEFORE, ADD ]------------------------------------------
#
// START Onmouse Over Topic Title Display First And Last Post
$lang['Firstpost'] = 'First Post';
$lang['Lastpost'] = 'Last Post';
$lang['More'] = ' ......More';
$lang['Protected'] = '<b>Protected message:</b><br />If you are a <b>*registered user*</b> :<br />you must post a reply to this topic to see the message ';
// END Onmouse Over Topic Title Display First And Last Post
#
#-----[ SAVE ALL FILES/CLOSE ]------------------------------------------
#