############################################################## 
## MOD Title:          Smilies Dropdown Menu
## MOD Author:         Afkamm < phpbb@afkamm.co.uk >
## MOD Description:    Makes a drop down menu which contains a list of all the smilies	installed
##					   on your board. When you select a smiley, it appears next to the box.
##		 			   The code is then inserted like normal when you click the smiley.
## MOD Version:        1.0.1
## Compatibility:      2.0.11
##
## Installation Level: Easy
## Installation Time:  5 minutes
## Files To Edit: 5
##			posting.php
##			privmsg.php
##			includes/functions_post.php
##			language/lang_english/lang_main.php
##			templates/subSilver/posting_body.tpl
##
## Included Files:     0
##
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes:
##
## 1. EasyMOD
## -----------
## This MOD is compatible with EasyMOD of Nuttzy and can be
## installed by it but is not yet certified EMC (EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## 2. MOD compatibility
## -----------
## This MOD is compatible with the "Bottom aligned signature"
## http://www.golfexpert.net/phpBB
##
## 3 Official last version link
## -----------
## Meanwhile the phpBB group validation and as the MOD is not yet
## in the phpBB MOD database, check this official link for updates...
## http://www.golfexpert.net/phpBB
## 
############################################################## 
## MOD History: 
## 
##   2004-02-12 - Version 1.0.2
##      - Fix rewrite because the "nowrap" instruction for post
##        buttons not always applied
##
##   2003-07-29 - Version 1.0.1
##      - Fix rewrite to be compatible with the
##        "Bottom-Aligned-Signature" MOD of John B. Abela
##        http://www.phpbb.com/phpBB/viewtopic.php?t=11225
##      - How-to rewrite to be EasyMOD compatible
##
##   2003-07-10 - Version 1.0.0
##      - Initial final release
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ OPEN ]------------------------------------------------
# 
posting.php 

# 
#-----[ FIND ]------------------------------------------------
# 
// Generate smilies listing for page output
generate_smilies('inline', PAGE_POSTING);

# 
#-----[ AFTER, ADD ]------------------------------------------
#
// Generate smilies dropdown
generate_smilies_dropdown();

#
#-----[ OPEN ]------------------------------------------------
#
privmsg.php

#
#-----[ FIND ]------------------------------------------------
#
	generate_smilies('inline', PAGE_PRIVMSGS);

#
#-----[ AFTER, ADD ]------------------------------------------
#
	// Generate smilies dropdown
	generate_smilies_dropdown();

#
#-----[ OPEN ]------------------------------------------------
#
includes/functions_post.php

#
#-----[ FIND ]------------------------------------------------
# 
	if ($mode == 'window')
	{
		$template->pparse('smiliesbody');

		include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
	}
}

#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// Create a drop down list with installed smilies.
//
function generate_smilies_dropdown()
{
global $db, $board_config, $template, $lang, $phpbb_root_path;

	// Get all the smilies.
	$sql = "SELECT code, smile_url FROM " . SMILIES_TABLE . " ORDER BY code ASC";
	$result = $db->sql_query($sql);
	if( !$result ) { message_die(GENERAL_ERROR, "Couldn't obtain smilies from database", "", __LINE__, __FILE__, $sql); }
	$smile_row = $db->sql_fetchrowset($result);
	$count = $db->sql_numrows($result);

	// Setup the drop down menu of smiley filenames for the add part of the page.
	$filename_list = '';
	for ($i=1; $i<=$count; $i++) {
		$filename_list .= '<option value="' . $smile_row[$i]['smile_url'] . '" id=" ' . $smile_row[$i]['code'] . ' ">' . $smile_row[$i]['code'] . '</option>';
	}

	$template->set_filenames(array(
		"body" => "posting_body.tpl")
	);

	$template->assign_vars(array(
		"L_SMILIES" => $lang['dropdown_title'],
		"L_SMILEY_MENU1" => $lang['dropdown_smilies1'],
		"L_SMILEY_MENU2" => $lang['dropdown_smilies2'],
		"SMILEY_IMG" => $board_config['smilies_path'] . '/' . $smile_row[1]['smile_url'],
		"SMILEY_CODE" => $smile_row[1]['code'],
		"S_SMILEY_BASEDIR" => $board_config['smilies_path'],
		"S_DROP_DOWN" => $filename_list)
	);

} // End generate_smilies_dropdown

#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------------
#
$lang['bbcode_f_help'] = 'Font size: [size=x-small]small text[/size]';

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start Smilies Dropdown menu Mod
$lang['dropdown_title'] = 'Smilies';
$lang['dropdown_smilies1'] = 'Select a smiley.';
$lang['dropdown_smilies2'] = 'Click smiley to enter code.';
// End Smilies Dropdown menu Mod

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/posting_body.tpl

# 
#-----[ FIND ]------------------------------------------------
# 
f_help = "{L_BBCODE_F_HELP}";

# 
#-----[ AFTER, ADD ]------------------------------------------
# 
// Start smilies drop down menu mod
smile1_help = "{L_SMILEY_MENU1}";
smile2_help = "{L_SMILEY_MENU2}";

// This function was taken from phpBB smiley admin panel
function update_smiley(newimage) {
	document.smiley_image.src = "{S_SMILEY_BASEDIR}/" + newimage;
}

// This function taken and modified from the UBB version.
function emoticon_drop(text) {
	emoticon_code = "" + text;
	current_msg = document.post.message.value;

	document.post.message.value = current_msg+emoticon_code;
	document.post.message.focus();
	return;
}
// End smilies drop down menu mod

#
#-----[ FIND ]------------------------------------------------
#
#				  <td nowrap="nowrap" align="right"><span class="gensmall"><a href="javascript:bbstyle(-1)" class="genmed" onMouseOver="helpline('a')">{L_BBCODE_CLOSE_TAGS}</a></span></td>
#				</tr>
				  <td colspan="{S_SMILIES_COLSPAN}"><span  class="nav"><a href="{U_MORE_SMILIES}" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=300,resizable=yes,scrollbars=yes,WIDTH=250');return false;" target="_phpbbsmilies" class="nav">{L_MORE_SMILIES}</a></span></td>
				</tr>
# 
#-----[ AFTER, ADD ]------------------------------------------
# 
				<!-- Start Smilies Dropdown menu Mod -->
				<tr>
				  <td>&nbsp;</td>
				</tr>
				<tr>
				  <td><span class="genmed">&nbsp;{L_SMILIES}:
					<select name="smile_url" onchange="update_smiley(this.options[selectedIndex].value);" onmouseover="helpline('smile1')">
					  {S_DROP_DOWN}
					</select>
					<img name="smiley_image" src="{SMILEY_IMG}" border="0" alt="" onmouseover="helpline('smile2'); this.style.cursor='hand';" onclick="emoticon_drop(document.post.smile_url.options[document.post.smile_url.selectedIndex].id)" />
				  </span></td>
				</tr>
				<!-- End Smilies Dropdown menu Mod -->

# 
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
# 
# EoM 