Closed (won't fix)
Project:
Smileys
Version:
5.x-1.2-beta
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 May 2008 at 15:20 UTC
Updated:
8 Jun 2008 at 13:13 UTC
I wanted to limit the smilies shown in the default panel and then show all in the pop up box. Here are my alterations:
-- Open smileys.module
-- Find
function _smileys_list($refresh = 0, $whereclause = '') {
if($whereclause != '') {
$whereclause = ' WHERE ' . $whereclause;
}
static $list;
if (!$list || $refresh) {
$result = db_query('SELECT * FROM {smileys} ' . $whereclause);
$list = array();
while ($a = db_fetch_object($result)) {
$list[] = $a;
}
}
return $list;
}
-- Replace with:
/* WE DOUPLICATE THIS TO HAVE A LIMIT IN THE NORMAL VIEW */
function _smileys_list($refresh = 0, $whereclause = '') {
if($whereclause != '') {
$whereclause = ' WHERE ' . $whereclause;
}
static $list;
if (!$list || $refresh) {
$result = db_query('SELECT * FROM {smileys} ' . $whereclause);
$list = array();
while ($a = db_fetch_object($result)) {
$list[] = $a;
}
}
return $list;
}
/* WE DOUPLICATE THIS TO HAVE A LIMIT IN THE NORMAL VIEW
THIS ONE HAS A LIMIT ON IT - EDIT THE NUMBER AFTER
THE WORD LIMIT
*/
function _smileys_list_limit($refresh = 0, $whereclause = '') {
if($whereclause != '') {
$whereclause = ' WHERE ' . $whereclause;
}
static $list;
if (!$list || $refresh) {
$result = db_query('SELECT * FROM {smileys} ' . $whereclause . ' LIMIT 26');
$list = array();
while ($a = db_fetch_object($result)) {
$list[] = $a;
}
}
return $list;
}
-- Find:
function _smileys_select_table() {
$content = '';
$list = _smileys_list();
foreach ($list as $smiley) {
$acronyms = explode(' ', $smiley->acronyms);
$alt = check_plain(implode(' ', $acronyms));
$desc = implode(' ', $acronyms);
$content .= '<span><img src="'. check_url(base_path() . $smiley->image) .'" title="'. check_plain($smiley->description) .'" alt="'. $acronyms[0] .'" class="smiley-class"/></span>';
}
return $content;
}
-- Replace with:
/* WE DOUPLICATE THIS TO HAVE A LIMIT IN THE NORMAL VIEW */
function _smileys_select_table() {
$content = '';
$list = _smileys_list();
foreach ($list as $smiley) {
$acronyms = explode(' ', $smiley->acronyms);
$alt = check_plain(implode(' ', $acronyms));
$desc = implode(' ', $acronyms);
$content .= '<span><img src="'. check_url(base_path() . $smiley->image) .'" title="'. check_plain($smiley->description) .'" alt="'. $acronyms[0] .'" class="smiley-class"/></span>';
}
return $content;
}
/* WE DOUPLICATE THIS TO HAVE A LIMIT IN THE NORMAL VIEW
THIS ONE HAS A LIMIT ON IT
*/
function _smileys_select_table_limit() {
$content = '';
$list = _smileys_list_limit();
foreach ($list as $smiley) {
$acronyms = explode(' ', $smiley->acronyms);
$alt = check_plain(implode(' ', $acronyms));
$desc = implode(' ', $acronyms);
$content .= '<span><img src="'. check_url(base_path() . $smiley->image) .'" title="'. check_plain($smiley->description) .'" alt="'. $acronyms[0] .'" class="smiley-class"/></span>';
}
return $content;
}
-- Find:
function theme_smileys_select_table() {
drupal_add_js(array('smileys' => array('basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='))), 'setting');
drupal_add_js(drupal_get_path('module', 'smileys') .'/smileys.js');
drupal_add_css(drupal_get_path('module', 'smileys') .'/smileys.css');
return '<div class="smileys">'. _smileys_select_table() .'</div>';
}
-- Replace with:
/* WE REPLACED THIS AND ALTERED IT TO SHOW LIMIT
function theme_smileys_select_table() {
drupal_add_js(array('smileys' => array('basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='))), 'setting');
drupal_add_js(drupal_get_path('module', 'smileys') .'/smileys.js');
drupal_add_css(drupal_get_path('module', 'smileys') .'/smileys.css');
return '<div class="smileys">'. _smileys_select_table() .'</div>';
}
*/
function theme_smileys_select_table() {
drupal_add_js(array('smileys' => array('basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='))), 'setting');
drupal_add_js(drupal_get_path('module', 'smileys') .'/smileys.js');
drupal_add_css(drupal_get_path('module', 'smileys') .'/smileys.css');
return '<div class="smileys">'. _smileys_select_table_limit() .'</div>';
}
I hope this is some help. Maybe this could be included into the smileys admin config?
Comments
Comment #1
Gurpartap Singh commentedThis feature is already included in Smileys development branch!!!
Comment #2
Gurpartap Singh commentedComment #3
Gurpartap Singh commented