Support for smileys
This commit is contained in:
parent
66a25ffdef
commit
249e35d9fc
67 changed files with 86 additions and 0 deletions
|
|
@ -49,6 +49,7 @@ this.toolbar = [
|
|||
['forecolor','backcolor','separator'],
|
||||
['HorizontalRule','Createlink','InsertImage','InsertTable','htmlmode','separator'],
|
||||
['Macros','separator'],
|
||||
['Smileys','separator'],
|
||||
|
||||
// ['custom1','custom2','custom3','separator'],
|
||||
['popupeditor']]; //,'about']];
|
||||
|
|
@ -83,6 +84,7 @@ this.fontstyles = [ // make sure these exist in the header of page the conte
|
|||
|
||||
this.btnList = {
|
||||
// buttonName: commandID, title, onclick, image,
|
||||
"smileys": ['Smileys', 'Insert Smiley', 'editor_action(this.id)', 'ed_smiley.gif'],
|
||||
"bold": ['Bold', 'Bold', 'editor_action(this.id)', 'ed_format_bold.gif'],
|
||||
"italic": ['Italic', 'Italic', 'editor_action(this.id)', 'ed_format_italic.gif'],
|
||||
"underline": ['Underline', 'Underline', 'editor_action(this.id)', 'ed_format_underline.gif'],
|
||||
|
|
@ -309,6 +311,14 @@ function editor_action(button_id) {
|
|||
//
|
||||
// CUSTOM BUTTONS START HERE
|
||||
//
|
||||
// Insert a smiley
|
||||
else if (cmdID == 'Smileys') { // insert some text from a popup window
|
||||
var myTitle = "Insert a Smiley";
|
||||
var myText = showModalDialog(_editor_url + "popups/insert_smiley.pl",
|
||||
myTitle, // str or obj specified here can be read from dialog as "window.dialogArguments"
|
||||
"resizable: yes; help: no; status: no; scroll: yes; ");
|
||||
if (myText) { editor_insertHTML(objname, myText); }
|
||||
}
|
||||
|
||||
// Custom1
|
||||
else if (cmdID == 'custom1') {
|
||||
|
|
|
|||
BIN
www/extras/htmlArea/images/ed_smiley.gif
Normal file
BIN
www/extras/htmlArea/images/ed_smiley.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 135 B |
76
www/extras/htmlArea/popups/insert_smiley.pl
Executable file
76
www/extras/htmlArea/popups/insert_smiley.pl
Executable file
|
|
@ -0,0 +1,76 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
|
||||
my ($httpSmileysPath, $fileSmileysPath, @smileys, $smile, $pos, $columns);
|
||||
|
||||
# $fileSmileysPath = '/home/WebGUI/www/extras/smileys'; # Define this if you're having problems determinating
|
||||
# the path to the smileys dir automaticcally.
|
||||
|
||||
$httpSmileysPath = "/extras/smileys"; # Web path to the smileys dir
|
||||
$columns = 3; # Smileys column width
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
|
||||
if(defined($ENV{SCRIPT_FILENAME}) && $fileSmileysPath eq '') {
|
||||
$fileSmileysPath = $ENV{SCRIPT_FILENAME};
|
||||
$fileSmileysPath =~ s#(/[^/]+){3}$##; # Two dirs up from this script level
|
||||
$fileSmileysPath .= "/smileys";
|
||||
}
|
||||
|
||||
print <<EOM;
|
||||
<!-- Content-type: text/html //-->
|
||||
|
||||
<html style="width:200px; Height: 200px;">
|
||||
<head>
|
||||
<title>Insert Smileys</title>
|
||||
<style>
|
||||
html, body, button, div, input, select, fieldset { font-family: MS Shell Dlg; font-size: 8pt; };
|
||||
</style>
|
||||
|
||||
<script language="javascript">
|
||||
function insertSmiley() {
|
||||
var img = window.event.srcElement;
|
||||
if (img) {
|
||||
var src = img.src.replace(/^[a-z]*:[/][/][^/]*/, "");
|
||||
window.returnValue = '<IMG border=0 align=absmiddle src=' + src + '>';
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script language='JavaScript' type='text/javascript'>
|
||||
function cancel() {
|
||||
window.returnValue = null;
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#D6D3CE" topmargin=15 leftmargin=10>
|
||||
<div align="center">
|
||||
<FIELDSET style="width:80%">
|
||||
<LEGEND>Choose a smiley to insert</LEGEND>
|
||||
<br><table align="center" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
EOM
|
||||
|
||||
opendir(DIR,$fileSmileysPath) or die "Couldn't open $fileSmileysPath\n";
|
||||
@smileys = readdir(DIR);
|
||||
closedir(DIR);
|
||||
$pos = 0;
|
||||
foreach $smile (@smileys)
|
||||
{
|
||||
chomp($smile);
|
||||
next if ($smile !~ /gif$|jpg$|jpeg$|bmp$/);
|
||||
if ($pos++ >= $columns) {
|
||||
print "</tr><tr>\n";
|
||||
$pos = 1;
|
||||
}
|
||||
|
||||
print '<td valign="top" align="center"><IMG onclick='."'insertSmiley()'".' border=0 src="'.$httpSmileysPath.'/'.$smile.'"></td>'."\n";
|
||||
|
||||
}
|
||||
print "</tr></table></FIELDSET></div></body></html>";
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue