############################################################## 
## MOD Title:          Smilies Dropdown Menu Add-on 4 Advanced Quick Reply
## MOD Author:         Nightrider < phpbb@4fxearth.net > (Blake) http://4fxearth.net/phpBB2
## MOD Description:    Adds 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.0
## 
## Installation Level: Easy 
## Installation Time:  5 minutes 
## Files To Edit: 2 
## 		 		  quick_reply.php 
##				  templates/subSilver/quick_reply.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: 
## 
##  The Advanced Quick Reply MOD MUST BE installed before installing this MOD...
## 
############################################################## 
## MOD History: 
## 
##   2007-06-25 - 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 ]------------------------------------------------ 
# 
quick_reply.php 
# 
#-----[ FIND ]------------------------------------------------ 
# 
generate_smilies_row();
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
		generate_smilies_dropdown2();
# 
#-----[ FIND ]------------------------------------------------ 
# 
function generate_smilies_row() 
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
// 
// Create a drop down list with installed smilies. 
// 
function generate_smilies_dropdown2() 
{ 
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->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 ]------------------------------------------------ 
# 
templates/subSilver/quick_reply.tpl 
# 
#-----[ FIND ]------------------------------------------------ 
# 
</script>
# 
#-----[ BEFORE, 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_image2.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 ]------------------------------------------------ 
# 
{L_QUOTE_SELECTED}
# 
#-----[ IN-LINE FIND ]------------------------------------------------ 
# 
></td>
#
# 
#-----[ IN-LINE REPLACE WITH ]------------------------------------------------ 
# 
>
#
#-----[ AFTER, ADD ]------------------------------------------ 
# 
            					<!-- Start Smilies Dropdown menu Mod -->
            					<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_image2" 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><br />
            					<!-- End Smilies Dropdown menu Mod --> 
						</td>
# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM