[BETA] Smiley management

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

[BETA] Smiley management

Post by Merlin Sythove »

Code: Select all

############################################################################### 
## MOD Title: 
##    MOD Smiley_management
## MOD author: 
##    Merlin Sythove Merlin@silvercircle.org
## MOD co-author: Throckmorton
## MOD description: 
##    The Smiley management system is and Admin panel replacement that 
##    allows you to organise smileys into pages, add seasonal pages 
##    (Christmas smileys etc.) and work with "themed pages" (smileys 
##    for a specific phpBB theme). It is easy to replace pages, copy them,
##    export and import pages, the user can select various pages etc.
##
## MOD Version:       1.0.3 
## Installation level:  medium
## Installation time:  30 Minutes manually
##
##
Preview screen shot of the admin interface:
http://www.silvercircle.org/phpBB_mods/ ... erface.jpg

Preview screen shot of the user interface:
http://www.silvercircle.org/phpBB_mods/ ... erface.jpg

Html document with extensive documentation
http://www.silvercircle.org/phpBB_mods/ ... manual.htm

Version 1.0.3 - April 26 2006: Zip file with MOD instructions and replacement files:
http://www.silvercircle.org/phpBB_mods/ ... 01.0.3.zip

EDIT: January 28 2006: Throckmorton has done a lot on this mod. I have just now removed a few more bugs that affected the special pages for MODs and ADMINs.
All comments and tips and tweaks up to page 11 of this topic have been included.

EDIT: April 26 2006: Version 1.0.3, fully Easymod tested, last bugs taken out, all comments bugs and tips up to page 14 of this topic have been included.
Last edited by Merlin Sythove on Wed Apr 26, 2006 7:13 pm, edited 7 times in total.

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3496
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Post by bonelifer »

Nice mod.
Knowledge Base | phpBB Board Rules | Search Customisation Database
Image
Please don't contact me via PM or email for phpBB support .

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Thanks! I haven't had any comments yet - wondered if anyone has ever tried it apart from myself... :D

Akrat2
Registered User
Posts: 17
Joined: Fri Jan 09, 2004 9:06 pm

Post by Akrat2 »

It looks great... Installing it now...

Throckmorton
Registered User
Posts: 364
Joined: Tue Oct 07, 2003 7:07 pm
Location: Naperville, IL

Post by Throckmorton »

Has anyone been able to install this and get it to work?

MUCH correcting is needed to get this to even attempt to function. The last error I have that I can't get rid of is when trying to use the admin panel. I'm getting:

Warning: sort() expects parameter 1 to be array, null given in D:\InetPub\WebSites\Test\Forums\admin\admin_smilies.php on line 75


Mod Author:
Have you tried installing this through EasyMOD? Even if you don't want to use EasyMOD, it's a good check of the quality of your installation script.

You append "_new" to the smiley table name in the code but you didn't create it that way.

There is at least one place where the $ is left off of a variable name.

And what's with all the SQL in the admin file? Why not just add the appropriate --[ SQL ]-- section to the script or create a seperate "install.php" file that get's run once?

I've tried cleaning this up some, but I still have the error above.

Code: Select all

############################################################################### 
## MOD Title: MOD Smiley_management
## MOD author: Merlin Sythove Merlin@silvercircle.org
## MOD description: 
##    The Smiley management system is and Admin panel replacement that 
##    allows you to organise smileys into pages, add seasonal pages 
##    (Christmas smileys etc.) and work with "themed pages" (smileys 
##    for a specific phpBB theme). It is easy to replace pages, copy them,
##    export and import pages, the user can select various pages etc.
##
## MOD Version:           0.9.0 
## Installation level:    medium
## Installation time:     30 Minutes manually
##
##
## Included Files: 
##   images/smiles/copy_paste.gif
##   admin/admin_smilies.php (replacement file)
##   templates/subSilver/admin/smile_list_body.tpl (replacement file)
##   templates/subSilver/posting_smiles.tpl (replacement file)
##                 
## Files To Edit: 
##   posting.php
##   includes/bbcode.php
##   includes/functions_post.php
##   language/lang_english/lang_admin.php
##   templates/subSilver/posting_body.tpl
##                 
##
###############################################################################
## 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: 
##############################################################################
## MOD History:
## v0.9.0 Initial release
###############################################################################
## Before adding this mod to your forum, you should back up all files 
## related to this mod 
###############################################################################

# 
#-----[ DO THIS FIRST ]--------------------------------------------------------
# 

#     Create a PAK file from your current smiley collection using 
#     the current admin functions. You can import such a PAK file
#     later, but most importantly, you will now have a record at home
#     of all the smiley codes, like :-) and :green: and so on, that 
#     are in use, and you can later make sure that ALL of these codes
#     will have a smiley picture.
#     
#     This is what a single line in an old style PAK file looks like:
#     icon_arrow.gif=+:Arrow=+::arrow:
#     
#     And this is how you should read it, noting that "=+:" is the delimiter:
#     icon_arrow.gif   =+:   Arrow    =+:    :arrow:
#     The image file     Emoticon text         Code  

#
#-----[ COPY ]-------------------------------------------
#
copy root/copy_paste.gif to images/smiles/copy_paste.gif
copy root/admin_smilies.php to admin/admin_smilies.php
copy root/smile_list_body.tpl to templates/subSilver/admin/smile_list_body.tpl
copy root/posting_smilies.tpl to templates/subSilver/posting_smiles.tpl
# 
#-----[ OPEN ]-----------------------------------------------------------------
# 

  includes/constants.php

# 
#-----[ FIND ]-----------------------------------------------------------------
# 

  define('SMILIES_TABLE', $table_prefix.'smilies');

# 
#-----[ AFTER, ADD ]------------------------------------------------------------
# 

  //MOD Smiley_management
  define('SMILIES_PAGES_TABLE', $table_prefix.'smilies_pages');


# 
#-----[ OPEN ]-----------------------------------------------------------------
# 

  language/lang_english/lang_admin.php
  
# 
#-----[ FIND ]-----------------------------------------------------------------
#
 
//
// Smiley Management
//
$lang['smiley_title'] = 'Smiles Editing Utility';
$lang['smile_desc'] = 'From this page you can add, remove and edit the emoticons or smileys that your users can use in their posts and private messages.';

$lang['smiley_config'] = 'Smiley Configuration';
$lang['smiley_code'] = 'Smiley Code';
$lang['smiley_url'] = 'Smiley Image File';
$lang['smiley_emot'] = 'Smiley Emotion';
$lang['smile_add'] = 'Add a new Smiley';
$lang['Smile'] = 'Smile';
$lang['Emotion'] = 'Emotion';

$lang['Select_pak'] = 'Select Pack (.pak) File';
$lang['replace_existing'] = 'Replace Existing Smiley';
$lang['keep_existing'] = 'Keep Existing Smiley';
$lang['smiley_import_inst'] = 'You should unzip the smiley package and upload all files to the appropriate Smiley directory for your installation. Then select the correct information in this form to import the smiley pack.';
$lang['smiley_import'] = 'Smiley Pack Import';
$lang['choose_smile_pak'] = 'Choose a Smile Pack .pak file';
$lang['import'] = 'Import Smileys';
$lang['smile_conflicts'] = 'What should be done in case of conflicts';
$lang['del_existing_smileys'] = 'Delete existing smileys before import';
$lang['import_smile_pack'] = 'Import Smiley Pack';
$lang['export_smile_pack'] = 'Create Smiley Pack';
$lang['export_smiles'] = 'To create a smiley pack from your currently installed smileys, click %sHere%s to download the smiles.pak file. Name this file appropriately making sure to keep the .pak file extension.  Then create a zip file containing all of your smiley images plus this .pak configuration file.';

$lang['smiley_add_success'] = 'The Smiley was successfully added';
$lang['smiley_edit_success'] = 'The Smiley was successfully updated';
$lang['smiley_import_success'] = 'The Smiley Pack was imported successfully!';
$lang['smiley_del_success'] = 'The Smiley was successfully removed';
$lang['Click_return_smileadmin'] = 'Click %sHere%s to return to Smiley Administration';

# 
#-----[ REPLACE WITH ]---------------------------------------------------------
#

//
//MOD Smiley_Management
//
$lang['smiley_title'] = 'Smiley management';
$lang['smiley_description'] = 'Here you can manage your smilies and create multiple pages with smileys, set user access etc. for smileys in posts and private messages.';
$lang['none_selected'] = 'None selected';
$lang['page_general'] = "Smiley page";
$lang['page_details'] = 'Page properties';
$lang['page_id'] = 'Page';
$lang['page_access'] = 'Access';
$lang['page_access_list'] = 'Users,Moderators,Admin,Hidden';
$lang['page_name'] = 'Title';
$lang['page_columns'] = 'Columns';
$lang['page_column_width'] = 'Column width';
$lang['page_width'] = 'Page width';
$lang['page_height'] = 'Page height';
$lang['page_show_titles'] = 'Show titles';
$lang['page_default'] = 'Default page';

$lang['page_id_explain'] = 'Select a smiley page';
$lang['page_access_explain'] = 'Which users can see this page';
$lang['page_name_explain'] = 'Page title in smiley window';
$lang['page_columns_explain'] = 'Smileys next to each other';
$lang['page_column_width_explain'] = 'Column width in pixels';
$lang['page_width_explain'] = 'Page popup-width in pixels';
$lang['page_height_explain'] = 'Page popup-height in pixels';
$lang['page_show_titles_explain'] = 'Show smiley description';
$lang['page_default_explain'] = 'Default popup smiley page';

$lang['page_submit'] = 'Update';
$lang['page_open'] = 'Open';
$lang['page_operation'] = 'Operation';
$lang['page_operation_list'] = 'No operation,New blank page,Copy %s to new page,Delete %s (no warnings!),Export %s.pak, Export %s.pak (old style)';
$lang['page_operation_list_explain'] = 'Select an operation to perform. There is no warning for deletions!';
$lang['page_operation_submit'] = 'Execute';
$lang['page_import_pak'] = 'Import';
$lang['page_theme'] = 'Theme';
$lang['page_theme_explain'] = 'Smiley page for a specific theme. Make sure all themes have a copy.';
$lang['page_theme_list'] = 'All themes';

$lang['smiley_submit'] = 'Update';
$lang['smiley_operation'] = 'Operation';
$lang['smiley_operation_list'] = 'No operation,Add new smiley,Delete smiley (no warnings!)';
$lang['smiley_operation_list_explain'] = 'Select an operation to perform. There is no warning for deletions!';
$lang['smiley_operation_submit'] = 'Execute';

$lang['smiley_config'] = 'Smiley properties';
$lang['smiley_code_list'] = 'Default code';
$lang['smiley_code_list_explain'] = 'The code already in use for this image file';
$lang['smiley_code_copy_explain'] = 'Copy code and paste it in code field';
$lang['smiley_code'] = 'Code';
$lang['smiley_code_explain'] = 'Separate multiple codes with a space';
$lang['smiley_url'] = 'Image file';
$lang['smiley_url_explain'] = 'Select smiley image file';
$lang['smiley_emot'] = 'Emotion';
$lang['smiley_emotion_explain'] = 'Smiley meaning';
$lang['smiley_align_list'] = 'Default,Top,Middle,Bottom';
$lang['smiley_align_list_explain'] = 'Select the vertical alignment of the smiley relative to the text';
$lang['smile_add'] = 'Add a new smiley';
$lang['Smile'] = 'Smiley';
$lang['Emotion'] = 'Emotion';
$lang['Smileys'] = 'Smileys';
$lang['smiley_number'] = 'Number';
$lang['smiley_number_explain'] = 'Smiley sequential order number';
$lang['smiley_colspan'] = "Width";
$lang['smiley_colspan_explain'] = "Smiley width in columns in grid";
$lang['smiley_inline'] = 'Inline';
$lang['smiley_inline_explain'] = 'Show smiley also next to post editing area';
$lang['smiley_align'] = 'Alignment';
//END of MOD Smiley_Management



# 
#-----[ NEXT, AT THIS POINT, DO THIS ]-----------------------------------------
#

#     Open the admin panel, click on Manage Smileys in your navigation panel
#     on the left, let the new system create its own new tables. Verify that all
#     changes are successful by inspecting the message that is shown.
#
#     Note: Users are still using the old phpBB code to work with smileys and
#     that is no problem, everything still works even with the new table structure.
#
#     After the new tables have been created, you can remove the
#     code between //-----<cut here>----// to //-----<cut here>----// 
#     from admin_smileys.php since it will not be used again. 
#     Do this at some time in the future.



# 
#-----[ OPEN ]-----------------------------------------------------------------
# 
  posting.php

# 
#-----[ FIND ]-----------------------------------------------------------------
# 

  else if ( $mode == 'smilies' )
  {
  	generate_smilies('window', PAGE_POSTING);
  	exit;
  }
  
# 
#-----[ REPLACE WITH ]---------------------------------------------------------
# 

  else if ( $mode == 'smilies' )
  {
    //START MOD Smiley_management
    $page_id = ( !empty($HTTP_GET_VARS['page']) ) ? intval($HTTP_GET_VARS['page']) : 0;
  	generate_smilies('window', PAGE_POSTING, $page_id);
  	//END MOD Smiley_management
  	exit;
  }


# 
#-----[ OPEN ]-----------------------------------------------------------------
# 

  includes/bbcode.php
  
# 
#-----[ FIND ]-----------------------------------------------------------------
# This is the complete smilies_pass function

//
// Smilies code ... would this be better tagged on to the end of bbcode.php?
// Probably so and I'll move it before B2
//
function smilies_pass($message)
{
	static $orig, $repl;

	if (!isset($orig))
	{
		global $db, $board_config;
		$orig = $repl = array();

		$sql = 'SELECT * FROM ' . SMILIES_TABLE;
		if( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
		}
		$smilies = $db->sql_fetchrowset($result);

		if (count($smilies))
		{
			usort($smilies, 'smiley_sort');
		}

		for ($i = 0; $i < count($smilies); $i++)
		{
			$orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
			$repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
		}
	}

	if (count($orig))
	{
		$message = preg_replace($orig, $repl, ' ' . $message . ' ');
		$message = substr($message, 1, -1);
	}
	
	return $message;
}


# 
#-----[ REPLACE WITH ]---------------------------------------------------------
# Complete new function

//START MOD Smiley_management
//
// Smilies code
//
function smilies_pass($message)
{
	static $orig, $repl;

	if (!isset($orig))
	{
		// EDIT MSTheme: smilies are in templates/..../images/smiles
		global $db, $board_config, $theme, $userdata;
		$orig = $repl = array();

    //Smilies for parsing: No hidden pages (hidden > ADMIN) (assumed duplicate pages), 
    //and get only 1 of each themed set.
		$sql = "SELECT s.*
      FROM " . SMILIES_TABLE . " s, " . SMILIES_PAGES_TABLE . " p
		  WHERE p.id = s.page
		  AND code <> '' and smile_url <> ''
      AND access <= " . ADMIN . " 
      AND (theme = 0 OR theme = " . $userdata['user_style'] . ")
      ORDER BY code";		  
		if( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
		}
		$smilies = $db->sql_fetchrowset($result);

		for ($i = 0; $i < count($smilies); $i++)
		{
	    if (strpos($smilies[$i]['code'], ' ')>0) //multiple codes?
      { //Get all codes, create more records, sorting must be absolute correct
        $all_code = explode(' ', $smilies[$i]['code']);
        for ($k=1;$k<count($all_code);$k++)
        {
          $smilies[$i]['code'] = $all_code[$k]; //set code
          $smilies[] = $smilies[$i];            //add record
        }
        $smilies[$i]['code'] = $all_code[0];    //set first code
      }
    }
		if (count($smilies)) usort($smilies, 'smiley_sort');

    $smilies_path = $board_config['smilies_path']; //"images/smiles";//###
		for ($i = 0; $i < count($smilies); $i++)
		{
      $orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
      switch ($smilies[$i]['align'])
      {
        case 0: $align="-3px;";break;
        case 1: $align="top";break;
        case 2: $align="middle";break;
        case 3: $align="bottom";break;
      }
      $align = 'style="vertical-align:' . $align . '"';
      $repl[] = '<img src="'. smilies_path . '/' . $smilies[$i]['smile_url'] 
        . '" title="' . $smilies[$i]['emoticon'] . '" alt="[' . $smilies[$i]['emoticon'] 
        . ']" border="0" ' . $align . ' />';
		}
	}

	if (count($orig))
	{
		$message = preg_replace($orig, $repl, ' ' . $message . ' ');
		$message = substr($message, 1, -1);
	}

	return $message;
}
//END MOD Smiley_management


# 
#-----[ OPEN ]-----------------------------------------------------------------
# 
  includes/functions_post.php
  
# 
#-----[ FIND ]-----------------------------------------------------------------
# Complete function generate_smilies

//
// Fill smiley templates (or just the variables) with smileys
// Either in a window or inline
//
function generate_smilies($mode, $page_id)
{
	global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
	global $user_ip, $session_length, $starttime;
	global $userdata;

	$inline_columns = 4;
	$inline_rows = 5;
	$window_columns = 8;

	if ($mode == 'window')
	{
		$userdata = session_pagestart($user_ip, $page_id);
		init_userprefs($userdata);

		$gen_simple_header = TRUE;

		$page_title = $lang['Emoticons'] . " - $topic_title";
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);

		$template->set_filenames(array(
			'smiliesbody' => 'posting_smilies.tpl')
		);
	}

	$sql = "SELECT emoticon, code, smile_url   
		FROM " . SMILIES_TABLE . " 
		ORDER BY smilies_id";
	if ($result = $db->sql_query($sql))
	{
		$num_smilies = 0;
		$rowset = array();
		while ($row = $db->sql_fetchrow($result))
		{
			if (empty($rowset[$row['smile_url']]))
			{
				$rowset[$row['smile_url']]['code'] = str_replace("'", "\\'", str_replace('\\', '\\\\', $row['code']));
				$rowset[$row['smile_url']]['emoticon'] = $row['emoticon'];
				$num_smilies++;
			}
		}

		if ($num_smilies)
		{
			$smilies_count = ($mode == 'inline') ? min(19, $num_smilies) : $num_smilies;
			$smilies_split_row = ($mode == 'inline') ? $inline_columns - 1 : $window_columns - 1;

			$s_colspan = 0;
			$row = 0;
			$col = 0;

			while (list($smile_url, $data) = @each($rowset))
			{
				if (!$col)
				{
					$template->assign_block_vars('smilies_row', array());
				}

				$template->assign_block_vars('smilies_row.smilies_col', array(
					'SMILEY_CODE' => $data['code'],
					'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url,
					'SMILEY_DESC' => $data['emoticon'])
				);

				$s_colspan = max($s_colspan, $col + 1);

				if ($col == $smilies_split_row)
				{
					if ($mode == 'inline' && $row == $inline_rows - 1)
					{
						break;
					}
					$col = 0;
					$row++;
				}
				else
				{
					$col++;
				}
			}

			if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns)
			{
				$template->assign_block_vars('switch_smilies_extra', array());

				$template->assign_vars(array(
					'L_MORE_SMILIES' => $lang['More_emoticons'], 
					'U_MORE_SMILIES' => append_sid("posting.$phpEx?mode=smilies"))
				);
			}

			$template->assign_vars(array(
				'L_EMOTICONS' => $lang['Emoticons'], 
				'L_CLOSE_WINDOW' => $lang['Close_window'], 
				'S_SMILIES_COLSPAN' => $s_colspan)
			);
		}
	}

	if ($mode == 'window')
	{
		$template->pparse('smiliesbody');

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


# 
#-----[ REPLACE WITH ]---------------------------------------------------------
# Complete new function generate_smilies

//START MOD Smiley_management
//
// Fill smiley templates for window or inline
//
function generate_smilies($mode, $page_id, $page_id = 0) //Called from posting.php and privmsg.php
{
	global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
	global $user_ip, $session_length, $starttime;
	global $userdata;

	$inline_columns = 4;
	$inline_rows = 5;

	//******* Get data *******//
  if ($mode == 'window')
  {
    //Initialise separate form
		$userdata = session_pagestart($user_ip, $page_id);
		init_userprefs($userdata);
		$gen_simple_header = TRUE;		
  }
  
  //Get page list for both window and inline
	$sql = "SELECT *
    FROM " . SMILIES_PAGES_TABLE . " 
    WHERE access <= " . $userdata['user_level'] . " 
    AND (theme = 0 OR theme = " . $userdata['user_style'] . ")
    ORDER BY `default` DESC,title";		  
  $result = $db->sql_query($sql);
  if( !$result )
  {
  	message_die(GENERAL_ERROR, "Couldn't obtain smileys page list", "", __LINE__, __FILE__, $sql);
  }
  $row = $db->sql_fetchrowset($result);

  if ($mode == 'window')
  {  
    $verified = 0;
    for ($i=0;$i<count($row);$i++) //Check page_id
    {      
      //echo $row[$i]['title'] . "||" . $row[$i]['default'] , '<br />';
      if ($page_id == 0)
      { 
        if ($row[$i]['default'] )  $page_id = $row[$i]['id'];
      }
      if ($row[$i]['id'] == $page_id) $verified = 1;
    } 
    // echo   $page_id.'<br />';
    if (($page_id == 0 || $verified == 0) && count($row) > 0) $page_id = $row[0]['id'];    
    $url = "posting.$phpEx?mode=smilies&page=";
    for ($i=0;$i<count($row);$i++) //Build list
    {
      $page_list .= ($page_list ? ' :: ' : '');
      $page_list .= '<a href="' . $url . $row[$i]['id'] . '" >' . $row[$i]['title'] . '</a>';
      if ($row[$i]['id']==$page_id) $page_data = $row[$i];
    }    
		$page_title = $lang['Emoticons'] . ($page_data['title'] ? ' * ' . $page_data['title'] : '');
		$page_width = $page_data['width'];
	  $page_height = $page_data['height'];
	
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);
		$template->set_filenames(array(
			'smiliesbody' => 'posting_smilies.tpl')
		);

    //Get smilies
    $sql = "SELECT *
      FROM " . SMILIES_TABLE . " 
  	  WHERE code <> '' AND smile_url <> '' AND page = $page_id
      ORDER BY number";		  
  }
  else //$mode == 'inline'
  {
  	//First record is first default page
    $page_width = $row[0]['width'];
  	$page_height = $row[0]['height'];    
    $sql = "SELECT s.*
      FROM " . SMILIES_TABLE . " s, " . SMILIES_PAGES_TABLE . " p
      WHERE p.id = s.page      
  	  AND code <> '' AND smile_url <> '' AND inline = 1
      AND access <= " . $userdata['user_level'] . " 
      AND (theme = 0 OR theme = " . $userdata['user_style'] . ")
      ORDER BY number
      LIMIT " . ($inline_columns * $inline_rows);
  }
  
  $result = $db->sql_query($sql);
  if( !$result )
  {
  	message_die(GENERAL_ERROR, "Couldn't obtain smileys list", "", __LINE__, __FILE__, $sql);
  }
  $smilies = $db->sql_fetchrowset($result);
  
  //****** Fill template *******//
  $smilies_colspan = ($mode == 'inline') ? $inline_columns : $page_data['columns'];
  $smilies_path = $board_config['smilies_path']; 
	$row = 0; $col = 0;
  for ($i=0;$i<count($smilies);$i++)
  { 
    $all_code = explode(' ', $smilies[$i]['code']); //Select first code only from multiple to insert
    $code = str_replace("'", "\\'", str_replace('\\', '\\\\', $all_code[0]));
    $colspan = ($smilies[$i]['colspan'] ? $smilies[$i]['colspan'] : 1);     
    if ($col==0) $template->assign_block_vars('smilies_row', array());	  
  	$template->assign_block_vars('smilies_row.smilies_col', array(
			'SMILEY_CODE' => $code,
			'SMILEY_IMG' => $smilies_path . '/' . $smilies[$i]['smile_url'],
			'SMILEY_DESC' => $smilies[$i]['emoticon'],
  		'SMILEY_COLSPAN' => $colspan)
		);
    $col += $colspan;
    if ( $col >= $smilies_colspan) {$col = 0;	$row++;	}   
  } //Next smiley
  
	//More smilies button * Can't check if there are more smilies than just inline, assume there are:
  if ($mode == 'inline')
	{
		$template->assign_block_vars('switch_smilies_extra', array());
		$template->assign_vars(array(
      'L_MORE_SMILIES' => $lang['More_emoticons'],
			'U_MORE_SMILIES' => append_sid("posting.$phpEx?mode=smilies"))
		);
	}
	$template->assign_vars(array(
	  'S_PAGE_WIDTH' => $page_width,
	  'S_PAGE_HEIGHT' => $page_height,
    'S_PAGE_LIST' => $page_list,
    'S_SMILIES_COLSPAN' => $smilies_colspan,
		'L_EMOTICONS' => $lang['Emoticons'],
		'L_CLOSE_WINDOW' => $lang['Close_window'])
	);
  //Parse separate template
	if ($mode == 'window')
	{
		$template->pparse('smiliesbody');
		include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
	}
}	
//END MOD Smiley_management	


# 
#-----[ OPEN ]-----------------------------------------------------------------
# 

  templates/subSilver/posting_body.tpl

# 
#-----[ FIND ]-----------------------------------------------------------------
# 

  <table width="100" border="0" cellspacing="0" cellpadding="5">
	<tr align="center"> 
	  <td colspan="{S_SMILIES_COLSPAN}" class="gensmall"><b>{L_EMOTICONS}</b></td>
	</tr>
	<!-- BEGIN smilies_row -->
	<tr align="center" valign="middle"> 
	  <!-- BEGIN smilies_col -->
	  <td><a href="javascript:emoticon('{smilies_row.smilies_col.SMILEY_CODE}')"><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></a></td>
	  <!-- END smilies_col -->
	</tr>
	<!-- END smilies_row -->
	<!-- BEGIN switch_smilies_extra -->
	<tr align="center"> 
	  <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>
	<!-- END switch_smilies_extra -->
  </table>

# 
#-----[ REPLACE WITH ]---------------------------------------------------------
# 

  <table width="100" border="0" cellspacing="0" cellpadding="5">
	<tr align="center"> 
	  <td colspan="{S_SMILIES_COLSPAN}" class="gensmall"><b>{L_EMOTICONS}</b></td>
	</tr>
	<!-- BEGIN smilies_row -->
	<tr align="center" valign="middle"> 
	  <!-- BEGIN smilies_col -->
	  <td><a href="javascript:emoticon('{smilies_row.smilies_col.SMILEY_CODE}')"><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></a></td>
	  <!-- END smilies_col -->
	</tr>
	<!-- END smilies_row -->
	<!-- BEGIN switch_smilies_extra -->
	<tr align="center"> 
	  <td colspan="{S_SMILIES_COLSPAN}"><span  class="nav" style="white-space:nowrap;">
    <a class="nav" href="{U_MORE_SMILIES}" onclick="mywin=window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'outerWidth={S_PAGE_WIDTH},outerHeight={S_PAGE_HEIGHT},TOP=0,LEFT=0,resizable=yes,scrollbars=no');mywin.focus();return false;" >{L_MORE_SMILIES}</a></span></td>
	</tr>
	<!-- END switch_smilies_extra -->
  </table>
# 
#-----[ SAVE/CLOSE ALLE FILES ]------------------------------------------------ 
# 
# EoM

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

I'll have a look when I have a bit more time, it is possible that I have made bugfixes that are not in the download.

Throckmorton
Registered User
Posts: 364
Joined: Tue Oct 07, 2003 7:07 pm
Location: Naperville, IL

Post by Throckmorton »

Can you tell me what this function is trying to do:

Code: Select all

function set_vars(index)
{      
return;
  if (document.getElementById['smiley_cell_'+last_id])
  {
    document.getElementById['smiley_cell_'+last_id].style.borderColor = last_color;
  }
  last_id = index; 
  last_color = document.getElementById['smiley_cell_'+index].style.borderColor;
  document.getElementById['smiley_id'].value = index;
  document.getElementById['smiley_cell_'+index].style.borderColor = '#804040';  
  document.getElementById['smiley_code'].value = document.getElementById['smiley_code_'+index].value;
  document.getElementById['smiley_number'].value = document.getElementById['smiley_number_'+index].value;
  document.getElementById['smiley_old_number'].value = document.getElementById['smiley_number_'+index].value;
  document.getElementById['smiley_colspan'].value = document.getElementById['smiley_colspan_'+index].value;
  document.getElementById['smiley_emotion'].value = document.getElementById['smiley_emotion_'+index].value;
  document.getElementById['smiley_inline'].checked = (document.getElementById['smiley_inline_'+index].value == 1 ? 'checked' : '');    
  document.getElementById['smiley_align'].selectedIndex = document.getElementById['smiley_align_'+index].value;

  smiley_url = document.getElementById['smiley_image_'+index].value;
  for (i = 0; i < document.getElementById['smiley_url_list'].length; i++) 
  {
    if (document.getElementById['smiley_url_list'].options[i].value == smiley_url)
    {
      document.getElementById['smiley_url_list'].selectedIndex = i;
      break;
    }
  }    
  preview_smiley(smiley_url);
}
I can get it to stop erroring, but I find that if I just ignore it (with that "return;" at the beginning) everything seems to work just fine.

Note: Yes, I changed all the document.all's to document.GetElementById but that was no help.

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

This function retrieves all the variables when you click on a smiley in the list of smileys, and displays them in the smiley properties area on the right.

Throckmorton
Registered User
Posts: 364
Joined: Tue Oct 07, 2003 7:07 pm
Location: Naperville, IL

Post by Throckmorton »

Okay, I see. Something is calling it when the page first loads and that is causing javascript errors.

Can you help me fix that?

<edited to add>
This seems to help:

Code: Select all

if (!index)
  {
    return;
  }
Your thoughts?

Then...

In:

Code: Select all

    <!-- Smiley properties -->
    <table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center" width="100%" style="margin-top:4px;">
    <colgroup><col width="30%"><col width="70%"></colgroup>
      <input type="hidden" name="smiley_id" value="">
    	<tr>
    		<th class="thHead" colspan="2">{L_SMILEY_CONFIG}</th>
    	</tr>    	
from smile_list_body.tpl, where is "L_SMILEY_CONFIG" supposed to get its value from?

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

OK, first things first. With me, with IE and with Firefox, I get no javascript errors when I open the smiley management page. Are you using a different browser?

Throckmorton
Registered User
Posts: 364
Joined: Tue Oct 07, 2003 7:07 pm
Location: Naperville, IL

Post by Throckmorton »

I get the error in both IE 6 and FireFox 1.0.6.

This is with your mod installed on a virgin (my test) installation of phpBB 2.0.17.

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

OK, usually with javascript you get an indication of where the error is. Can you give me details?

Throckmorton
Registered User
Posts: 364
Joined: Tue Oct 07, 2003 7:07 pm
Location: Naperville, IL

Post by Throckmorton »

I've wiped the install for the moment, but basically, index = 0 on page load so all the calls here:

Code: Select all

  last_color = document.all['smiley_cell_'+index].style.borderColor;
  document.all['smiley_id'].value = index;
  document.all['smiley_cell_'+index].style.borderColor = '#804040';  
  document.all['smiley_code'].value = document.all['smiley_code_'+index].value;
  document.all['smiley_number'].value = document.all['smiley_number_'+index].value;
  document.all['smiley_old_number'].value = document.all['smiley_number_'+index].value;
  document.all['smiley_colspan'].value = document.all['smiley_colspan_'+index].value;
  document.all['smiley_emotion'].value = document.all['smiley_emotion_'+index].value;
  document.all['smiley_inline'].checked = (document.all['smiley_inline_'+index].value == 1 ? 'checked' : '');    
  document.all['smiley_align'].selectedIndex = document.all['smiley_align_'+index].value;
fail with "document.all['smiley_cell_'+index]..." is not an object errors. If you rem out a line, the error will show up on the next line.

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

This is my file in templates/subSilver/admin/smile_list_body.tpl:

Code: Select all

<script language="javascript" type="text/javascript"> 
<!-- 
var last_color;
var last_id;
function set_vars(index) {      
  if (document.all['smiley_cell_'+last_id])
  {
    document.all['smiley_cell_'+last_id].style.borderColor = last_color;
  }
  last_id = index; 
  last_color = document.all['smiley_cell_'+index].style.borderColor;
  document.all['smiley_id'].value = index;
  document.all['smiley_cell_'+index].style.borderColor = '#804040';  
  document.all['smiley_code'].value = document.all['smiley_code_'+index].value;
  document.all['smiley_number'].value = document.all['smiley_number_'+index].value;
  document.all['smiley_old_number'].value = document.all['smiley_number_'+index].value;
  document.all['smiley_colspan'].value = document.all['smiley_colspan_'+index].value;
  document.all['smiley_emotion'].value = document.all['smiley_emotion_'+index].value;
  document.all['smiley_inline'].checked = (document.all['smiley_inline_'+index].value == 1 ? 'checked' : '');    
  document.all['smiley_align'].selectedIndex = document.all['smiley_align_'+index].value;

  smiley_url = document.all['smiley_image_'+index].value;
  for (i = 0; i < document.all['smiley_url_list'].length; i++) 
  {
    if (document.all['smiley_url_list'].options[i].value == smiley_url)
    {
      document.all['smiley_url_list'].selectedIndex = i;
      break;
    }
  }    
  preview_smiley(smiley_url);
}
function preview_smiley(smiley_url)
{
	if (!smiley_url) smiley_url = "spacer.gif";
	if (smiley_url == "spacer.gif")  document.all['smiley_code_list'].selectedIndex = 0;
  document.smiley_preview.src = "{S_SMILEY_BASEDIR}/" + smiley_url;            
  for (i = 0; i < document.all['smiley_code_list'].length; i++) 
  {    
    if (document.all['smiley_code_list'].options[i].value.indexOf(smiley_url) > 0)
    {
      document.all['smiley_code_list'].selectedIndex = i;
      break;
    }
  }    
}
function copypastecode()
{
  i = document.all['smiley_code_list'].selectedIndex;
  document.all['smiley_code'].value = document.all['smiley_code_list'][i].text;
}
//--> 
</script>
<body onload="set_vars({S_SMILEY_ID});">
<h1 align="center">{L_SMILEY_TITLE}</h1>
<!--P>{L_SMILEY_DESCRIPTION}</p-->
<table height="700" cellspacing="4" cellpadding="0" border="0" align="center" style="margin-top:0px;">
<colgroup><col width="{P_WIDTH}"><col width="250"></colgroup>
<form method="post" action="{S_SMILEY_ACTION}">

<tr >  
  <td valign="top">

<!-- Page operations -->    
    <table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center" width="100%">    
    <tr>      
      <th class="thHead" colspan="2">{L_PAGE_GENERAL}</th>
    <tr>
  	<tr>
  		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_ID}</td>
  		<td class="row2" >
  		  <input type="hidden" name="page_id" value="{S_PAGE_ID}">
        <select name="page_id" style="width:134px;" title="{L_PAGE_ID_EXPLAIN}">{S_PAGE_LIST}</select>
        <input class="mainoption" type="submit" name="page_select" value="{L_PAGE_OPEN}">      
      </td>
  	</tr>
  	<tr>
   		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_OPERATION}</td>
  		<td class="row2" ><select name="page_operation_list" style="width:134;" title="{L_PAGE_OPERATION_LIST_EXPLAIN}">{S_PAGE_OPERATION_LIST}</select>
      <input class="mainoption" type="submit" name="page_operation_submit" value="{L_PAGE_OPERATION_SUBMIT}">      
      </td>
  	</tr>
    <!--tr>
      <td class="catBottom" align="center" colspan="2">&nbsp;</td>
    </tr-->    
    </table>
    <!-- End Page operations -->    
    
    <!-- Smiley table -->  
    <table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center" width="100%" style="margin-top:4px;">    	
      <input type="hidden"  name="smiles" value="0"><!-- need fake zero element here -->
      <tr>
    		<th class="thHead" colspan="{P_COLUMNS}">{L_SMILEYS} * {P_TITLE}</th>
    	</tr>
      {S_TABLE_SPACER}
    	<!-- BEGIN smilies_row -->
    	<tr>
    	  <!-- BEGIN smilies_col -->
    		<input type="hidden" name="smiley_code_{smilies_row.smilies_col.ID}" value="{smilies_row.smilies_col.CODE}">
        <input type="hidden" name="smiley_page_{smilies_row.smilies_col.ID}" value="{smilies_row.smilies_col.PAGE}">
        <input type="hidden" name="smiley_number_{smilies_row.smilies_col.ID}" value="{smilies_row.smilies_col.NUMBER}">        
        <input type="hidden" name="smiley_colspan_{smilies_row.smilies_col.ID}" value="{smilies_row.smilies_col.COLSPAN}">
        <input type="hidden" name="smiley_inline_{smilies_row.smilies_col.ID}" value="{smilies_row.smilies_col.INLINE}">
        <input type="hidden" name="smiley_emotion_{smilies_row.smilies_col.ID}" value="{smilies_row.smilies_col.EMOT}">
        <input type="hidden" name="smiley_image_{smilies_row.smilies_col.ID}" value="{smilies_row.smilies_col.SMILEY_IMG}">
        <input type="hidden" name="smiley_id_{smilies_row.smilies_col.ID}" value="{smilies_row.smilies_col.ID}">
        <input type="hidden" name="smiley_align_{smilies_row.smilies_col.ID}" value="{smilies_row.smilies_col.ALIGN}">
  		
        <td id="smiley_cell_{smilies_row.smilies_col.ID}" colspan="{smilies_row.smilies_col.COLSPAN}" class="row2" align="center" style="border:1px solid {T_TR_COLOR3};" style="cursor:pointer;" onclick="javascript:set_vars({smilies_row.smilies_col.ID});"  >
        <!--a class="genmed" href="#" onclick="javascript:set_vars({smilies_row.smilies_col.ID});this.blur();return false;" > <!--  * {smilies_row.smilies_col.CODE} -->
        <img src="{S_SMILEY_BASEDIR}/{smilies_row.smilies_col.SMILEY_IMG}" title="{smilies_row.smilies_col.EMOT}" style="border:none;cursor:pointer" />
        
        <!-- BEGIN switch_title -->
        <br /><a class="genmed" href="#" onclick="javascript:set_vars({smilies_row.smilies_col.ID});this.blur();return false;" >{smilies_row.smilies_col.EMOT}</a>
        <!-- END switch_title -->
        </td>
  		  <!-- END smilies_col -->
    	</tr>
      <!-- END smilies_row -->    	
    </table>
    <!-- end smiley table -->    
    
    <!-- Smiley operations -->
    <table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center" width="100%" style="margin-top:4px;">
    <!--colgroup><col width="30%"><col width="70%"></colgroup-->
      <!--tr>
    		<th class="thHead" colspan="2">Smiley operations</th>
    	</tr-->    	
    	<tr>
     		<td class="row2">{L_SMILEY_OPERATION}</td>
    		<td class="row2" ><select name="smiley_operation_list" style="width:134;" title="{L_SMILEY_OPERATION_LIST_EXPLAIN}">{S_SMILEY_OPERATION_LIST}</select>
        <input class="mainoption" type="submit" name="smiley_operation_submit" value="{L_SMILEY_OPERATION_SUBMIT}">        
        </td>
    	</tr>
      <!--tr>
        <td class="catBottom" align="center" colspan="2">          
        </td>
      </tr-->
    </table>  
    <!-- end Smiley operations -->
    
  </td>

  <td valign="top">
    
    <!-- Page properties -->
    <table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center" width="100%" >
    <colgroup><col width="30%"><col width="70%"></colgroup>
    <tr>  
      <th class="thHead" colspan="2">{L_PAGE_DETAILS}</th>
    </tr>
  	<tr >
  		<td class="row2" style="padding:4px 4px 1px 4px;">{L_PAGE_NAME}</td>
  		<td class="row2" style="padding:4px 4px 1px 4px;"><input class="post" type="text" name="page_title" title="{L_PAGE_NAME_EXPLAIN}" value="{S_PAGE_TITLE}" /></td>
  	</tr>
  	<tr>
  		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_ACCESS}</td>
  		<td class="row2" style="padding:1px 4px 1px 4px;"><select name="page_access" style="width:134;" title="{L_PAGE_ACCESS_EXPLAIN}" >{S_PAGE_ACCESS_LIST}</select></td>
  	</tr>
  	<tr>
  		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_THEME}</td>
  		<td class="row2" style="padding:1px 4px 1px 4px;"><select name="page_theme" style="width:134;" title="{L_PAGE_THEME_EXPLAIN}" >{S_PAGE_THEME_LIST}</select></td>
  	</tr>
  	<tr>
  		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_COLUMNS}</td>
  		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="post" type="text" name="page_columns" title="{L_PAGE_COLUMNS_EXPLAIN}" value="{S_PAGE_COLUMNS}" /></td>
  	</tr>
  	<tr>
  		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_COLUMN_WIDTH}</td>
  		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="post" type="text" name="page_column_width" title="{L_PAGE_COLUMN_WIDTH_EXPLAIN}" value="{S_PAGE_COLUMN_WIDTH}" /></td>
  	</tr>
  	<tr>
  		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_WIDTH}</td>
  		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="post" type="text" name="page_width" title="{L_PAGE_WIDTH_EXPLAIN}" value="{S_PAGE_WIDTH}" /></td>
  	</tr>
  	<tr>
  		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_HEIGHT}</td>
  		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="post" type="text" name="page_height" title="{L_PAGE_HEIGHT_EXPLAIN}" value="{S_PAGE_HEIGHT}" /></td>
  	</tr>
   	<tr>
  		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_SHOW_TITLES}</td>
  		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="checkbox" type="checkbox" name="page_show_titles" title="{L_PAGE_SHOW_TITLES_EXPLAIN}" {S_PAGE_SHOW_TITLES} /></td>
  	</tr>
   	<tr>
  		<td class="row2" style="padding:1px 4px 1px 4px;">{L_PAGE_DEFAULT}</td>
  		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="checkbox" type="checkbox" name="page_default" title="{L_PAGE_DEFAULT_EXPLAIN}" {S_PAGE_DEFAULT} /></td>
  	</tr>
    <tr>
   		<td class="catBottom" align="center" colspan="2" style="padding:4px;">              
       <input class="mainoption" type="submit" name="page_submit" value="{L_PAGE_SUBMIT}"  /></td>
    </tr>
    </table>
    <!-- end page properties -->

<!-- Smiley properties -->
    <table class="forumline" cellspacing="1" cellpadding="4" border="0" align="center" width="100%" style="margin-top:4px;">
    <colgroup><col width="30%"><col width="70%"></colgroup>
      <input type="hidden" name="smiley_id" value="">
    	<tr>
    		<th class="thHead" colspan="2">{L_SMILEY_CONFIG}</th>
    	</tr>    	
    	<tr height="32">
    		<td class="row2" style="padding:1px 4px 1px 4px;">{L_SMILE}</td>
    		<td class="row2" >&nbsp;<img name="smiley_preview" src="{S_SMILEY_BASEDIR}/spacer.gif" style="border:none;"/>&nbsp;</td>
    	</tr>
    	<tr>
    		<td class="row2" style="padding:1px 4px 1px 4px;">{L_SMILEY_URL}</td>
    		<td class="row2" style="padding:1px 4px 1px 4px;"><select name="smiley_url_list" style="width:134;" title="{L_SMILEY_URL_EXPLAIN}" onchange="preview_smiley(this.options[selectedIndex].value);">{S_FILENAME_OPTIONS}</select> </td>
    	</tr>
    	<tr>
    		<td class="row2" style="padding:1px 4px 1px 4px;">{L_SMILEY_CODE_LIST}</td>
    		<td class="row2" style="padding:1px 4px 1px 4px;"><select name="smiley_code_list" title = "{L_SMILEY_CODE_LIST_EXPLAIN}" style="width:134;" >{S_SMILEY_CODE_LIST}</select> 
        <a href="#" onclick="javascript:copypastecode();return false;">        
        <img src="{I_COPYPASTE}" title="{L_SMILEY_CODE_COPY_EXPLAIN}" style="vertical-align:top;border:none;"></a>
        </td>
    	</tr>
    	<tr>
    		<td class="row2" style="padding:1px 4px 1px 4px;">{L_SMILEY_CODE}</td>
    		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="post" type="text" title = "{L_CODE_EXPLAIN}" name="smiley_code" value="" /></td>
    	</tr>
    	<tr>
    		<td class="row2" style="padding:1px 4px 1px 4px;">{L_SMILEY_EMOTION}</td>
    		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="post" type="text" name="smiley_emotion" title="{L_SMILEY_EMOTION_EXPLAIN}" value="" /></td>
    	</tr>
      <tr>
    		<td class="row2" style="padding:1px 4px 1px 4px;">{L_SMILEY_NUMBER}</td>
    		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="post" type="text" name="smiley_number" title="{L_SMILEY_NUMBER_EXPLAIN}" value="" /></td>
    	</tr>
     	<tr>
    		<td class="row2" style="padding:1px 4px 1px 4px;">{L_SMILEY_COLSPAN}</td>
    		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="post" type="text" name="smiley_colspan" title="{L_SMILEY_COLSPAN_EXPLAIN}" value="" /></td>
    	</tr>
     	<tr>
    		<td class="row2" style="padding:1px 4px 1px 4px;">{L_SMILEY_ALIGN}</td>
    		<td class="row2" style="padding:1px 4px 1px 4px;"><select name="smiley_align" style="width:134;" title="{L_SMILEY_ALIGN_LIST_EXPLAIN}">{S_SMILEY_ALIGN_LIST}</select> 
    	</tr>
     	<tr>
    		<td class="row2" style="padding:1px 4px 1px 4px;">{L_SMILEY_INLINE}</td>
    		<td class="row2" style="padding:1px 4px 1px 4px;"><input class="checkbox" type="checkbox" name="smiley_inline" title="{L_SMILEY_INLINE_EXPLAIN}" value="" /></td>
    	</tr>

      <tr>
    		<td class="catBottom" colspan="2" align="center" style="padding:4px;">
          <input type="hidden" name="smiley_old_number" value="">
          <input class="mainoption" type="submit" name="smiley_submit" value="{L_SMILEY_SUBMIT}" />
        </td>
    	</tr>
    </table>
    <!-- end Smiley properties -->
  </td>
</tr>  
</form>
</table>
Please verify that yours is identical or use this one just for testing.
Does the error occur?

If it does, after
last_id = index;
add
last_id = 1;

Does the error still occur?

Throckmorton
Registered User
Posts: 364
Joined: Tue Oct 07, 2003 7:07 pm
Location: Naperville, IL

Post by Throckmorton »

Merlin Sythove wrote: This is my file in templates/subSilver/admin/smile_list_body.tpl:

Code: Select all

<snip>
Please verify that yours is identical or use this one just for testing.
Does the error occur?


Okay, I used that one. Yes, the error occurs this line:

Code: Select all

last_color = document.all['smiley_cell_'+index].style.borderColor;
This is the exact error:
The FireFox JavaScript Error Console wrote: Error: document.all["smiley_cell_" + index] has no properties

Additionally, this php error is back:
Warning: sort() expects parameter 1 to be array, null given in D:\InetPub\WebSites\Test\Forums\admin\admin_smilies.php on line 72

I had fixed that earlier, but I don't recall how.
Merlin Sythove wrote: If it does, after
last_id = index;
add
last_id = 1;

Does the error still occur?

Yes, it does. There was no change. Same error, same line.

Post Reply

Return to “[2.0.x] MODs in Development”