diff --git a/smileybutton/icon.gif b/smileybutton/icon.gif deleted file mode 100644 index 6ce09471..00000000 Binary files a/smileybutton/icon.gif and /dev/null differ diff --git a/smileybutton/smileybutton.css b/smileybutton/smileybutton.css deleted file mode 100755 index 916e0416..00000000 --- a/smileybutton/smileybutton.css +++ /dev/null @@ -1,21 +0,0 @@ - -img.smiley_preview { - max-height: 25px; - max-width: 25px; -} - -table.smiley-preview { - border: 1px solid #AAAAAA; -} - -#smileybutton-enable-label { - float: left; - width: 200px; - margin-bottom: 25px; -} - -#smileybutton-checkbox { - float: left; -} - - diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index d53794b9..50a61606 100755 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -2,68 +2,42 @@ /** * Name: Smileybutton * Description: Adds a smileybutton to the Inputbox - * Version: 0.1 - * Author: Johannes Schwab + * Version: 0.2 + * Author: Johannes Schwab */ function smileybutton_install() { - - /** - * - * Register hooks for jot_tool and plugin_settings - * - */ - + //Register hooks register_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - register_hook('plugin_settings', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings'); - register_hook('plugin_settings_post', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings_post'); logger("installed smileybutton"); } function smileybutton_uninstall() { - - /** - * - * Delet registered hooks - * - */ - + //Delet registered hooks unregister_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - unregister_hook('plugin_settings', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings'); - unregister_hook('plugin_settings_post', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings_post'); - + logger("removed smileybutton"); } function show_button($a, &$b) { + // Disable if theme is quattro + // TODO add style for quattro + if (current_theme() == 'quattro') + return; + + // Disable for mobile because most mobiles have a smiley key for ther own + if ($a->is_mobile || $a->is_tablet) + return; /** * - * Check if it is a local user and he has enabled smileybutton - * - */ - - if(! local_user()) { - $nobutton = false; - } else { - $nobutton = get_pconfig(local_user(), 'smileybutton', 'nobutton'); - } - - /** - * - * Prepare the Smilie-Arrays - * - */ - - /** - * - * I have copied this from /include/text.php, removed dobles - * and some escapes. + * I have copied this from /include/text.php, removed doubles + * and escaped them. * */ @@ -120,22 +94,12 @@ function show_button($a, &$b) { 'red' ); - /** - * - * Call hooks to get aditional smileies from other addons - * - */ - + // Call hooks to get aditional smileies from other addons $params = array('texts' => $texts, 'icons' => $icons, 'string' => ""); //changed call_hooks('smilie', $params); - /** - * - * Generate html for smileylist - * - */ - - $s = "\t\n"; + //Generate html for smiley list + $s = "
\n\t"; for($x = 0; $x < count($params['texts']); $x ++) { $icon = $params['icons'][$x]; $icon = str_replace('/>', 'onclick="smileybutton_addsmiley(\'' . $params['texts'][$x] . '\')"/>', $icon); @@ -145,139 +109,58 @@ function show_button($a, &$b) { $s .= "\n\t"; } } - $s .= "\t
\n"; + $s .= "\t"; - /** - * - * Add css to page - * - */ + //Add css to header + $css_file = 'addon/smileybutton/view/'.current_theme().'.css'; + if (! file_exists($css_file)) + $css_file = 'addon/smileybutton/view/default.css'; + $css_url = $a->get_baseurl().'/'.$css_file; - $a->page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= ''."\r\n"; - /** - * - * Add the button to the Inputbox - * - */ - if (! $nobutton) { - $b = "
\n"; - $b .= "\tget_baseurl() . "/addon/smileybutton/icon.gif\" onclick=\"toggle_smileybutton()\" alt=\"smiley\">\n"; - $b .= "\t
\n"; - } + + //Get the correct image for the theme + $image = 'addon/smileybutton/view/'.current_theme().'.png'; + if (! file_exists($image)) + $image = 'addon/smileybutton/view/default.png'; + $image_url = $a->get_baseurl().'/'.$image; - - /** - * - * Write the smileies to an (hidden) div - * - */ + //Add the hmtl and script to the page + $b = <<< EOT +
+ smiley +
- if ($nobutton) { - $b .= "\t
\n"; - } else { - $b .= "\t
\n"; - } - $b .= $s . "\n"; - $b .= "
\n"; + - /** - * - * Function to show and hide the smiley-list in the hidden div - * - */ - - $b .= "\n"; -} - - - - - -/** - * - * Set the configuration - * - */ - -function smileybutton_settings_post($a,$post) { - if(! local_user()) - return; - if($_POST['smileybutton-submit']) - set_pconfig(local_user(),'smileybutton','nobutton',intval($_POST['smileybutton'])); - -} - - -/** - * - * Add configuration-dialog to form - * - */ - - -function smileybutton_settings(&$a,&$s) { - - if(! local_user()) - return; - - /* Add our stylesheet to the page so we can make our settings look nice */ - - $a->page['htmlhead'] .= '' . "\r\n"; - - /* Get the current state of our config variable */ - - $nobutton = get_pconfig(local_user(),'smileybutton','nobutton'); - $checked = (($nobutton) ? ' checked="checked" ' : ''); - - /* Add some HTML to the existing form */ - - $s .= '
'; - $s .= '

Smileybutton settings

'; - $s .= '
'; - - $s .= 'You can hide the button and show the smilies directly.

'; - - $s .= ''; - $s .= ''; - - $s .= '
'; - - /* provide a submit button */ - - $s .= '
'; + +EOT; } diff --git a/smileybutton/view/default.css b/smileybutton/view/default.css new file mode 100644 index 00000000..16120360 --- /dev/null +++ b/smileybutton/view/default.css @@ -0,0 +1,13 @@ +img.smiley_button { + height: 18px; + width: 18px; +} + +img.smiley_preview { + max-height: 25px; + max-width: 25px; +} + +table.smiley-preview { + border: 1px solid #AAAAAA; +} diff --git a/smileybutton/view/default.png b/smileybutton/view/default.png new file mode 100644 index 00000000..6ad02a18 Binary files /dev/null and b/smileybutton/view/default.png differ diff --git a/smileybutton/view/default.svg b/smileybutton/view/default.svg new file mode 100644 index 00000000..c39e68df --- /dev/null +++ b/smileybutton/view/default.svg @@ -0,0 +1,99 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/smileybutton/view/duepuntozero.css b/smileybutton/view/duepuntozero.css new file mode 100644 index 00000000..0f4ef4ae --- /dev/null +++ b/smileybutton/view/duepuntozero.css @@ -0,0 +1,21 @@ +img.smiley_button { + height: 18px; + width: 18px; + position: relative; + left: 285px; + top: -45px; +} + +img.smiley_preview { + max-height: 25px; + max-width: 25px; +} + +table.smiley-preview { + border: 1px solid #AAAAAA; + -moz-border-radius: 3px; + border-radius: 3px; + position: relative; + left: 285px; + top: -36px; +} diff --git a/smileybutton/view/duepuntozero.png b/smileybutton/view/duepuntozero.png new file mode 100644 index 00000000..b9ee401d Binary files /dev/null and b/smileybutton/view/duepuntozero.png differ diff --git a/smileybutton/view/frost.css b/smileybutton/view/frost.css new file mode 100644 index 00000000..42e18f05 --- /dev/null +++ b/smileybutton/view/frost.css @@ -0,0 +1,21 @@ +img.smiley_button { + height: 25; + width: 25px; + position: relative; + left: 335px; + top: -45px; +} + +img.smiley_preview { + max-height: 25px; + max-width: 25px; +} + +table.smiley-preview { + border: 1px solid #AAAAAA; + -moz-border-radius: 3px; + border-radius: 3px; + position: relative; + left: 285px; + top: -36px; +} diff --git a/smileybutton/view/frost.png b/smileybutton/view/frost.png new file mode 100644 index 00000000..6ad02a18 Binary files /dev/null and b/smileybutton/view/frost.png differ diff --git a/smileybutton/view/smoothly.css b/smileybutton/view/smoothly.css new file mode 100644 index 00000000..14ed961a --- /dev/null +++ b/smileybutton/view/smoothly.css @@ -0,0 +1,21 @@ +img.smiley_button { + height: 22px; + width: 22px; + position: relative; + left: -330px; + margin: 4px; + -moz-border-radius: 0px; + border-radius: 0px; +} + +img.smiley_preview { + max-height: 25px; + max-width: 25px; +} + +table.smiley-preview { + border: 1px solid #AAAAAA; + -moz-border-radius: 5px; + border-radius: 5px; + margin: 5px; +} diff --git a/smileybutton/view/smoothly.png b/smileybutton/view/smoothly.png new file mode 100644 index 00000000..312a0c33 Binary files /dev/null and b/smileybutton/view/smoothly.png differ diff --git a/smileybutton/view/smoothly.svg b/smileybutton/view/smoothly.svg new file mode 100644 index 00000000..8f5d26a2 --- /dev/null +++ b/smileybutton/view/smoothly.svg @@ -0,0 +1,112 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/smileybutton/view/vier.css b/smileybutton/view/vier.css new file mode 100644 index 00000000..4f237800 --- /dev/null +++ b/smileybutton/view/vier.css @@ -0,0 +1,15 @@ +img.smiley_button { + height: 18px; + width: 18px; + margin-right: 18px; +} + +img.smiley_preview { + max-height: 25px; + max-width: 25px; +} + +table.smiley-preview { + border: 1px solid #999999; + margin-left: 10px; +} diff --git a/smileybutton/view/vier.png b/smileybutton/view/vier.png new file mode 100644 index 00000000..440f6a37 Binary files /dev/null and b/smileybutton/view/vier.png differ diff --git a/smileybutton/view/vier.svg b/smileybutton/view/vier.svg new file mode 100644 index 00000000..4b86d960 --- /dev/null +++ b/smileybutton/view/vier.svg @@ -0,0 +1,99 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + +