[Hastymail-cvs] SF.net SVN: hastymail:[1120] trunk/hastymail2/plugins
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2009-10-30 05:11:49
|
Revision: 1120 http://hastymail.svn.sourceforge.net/hastymail/?rev=1120&view=rev Author: sailfrog Date: 2009-10-30 05:11:43 +0000 (Fri, 30 Oct 2009) Log Message: ----------- new plugin (not complete) that uses javascript to supply extended information about each setting on the options page Added Paths: ----------- trunk/hastymail2/plugins/js_help/ trunk/hastymail2/plugins/js_help/README trunk/hastymail2/plugins/js_help/ajax.php trunk/hastymail2/plugins/js_help/config.php trunk/hastymail2/plugins/js_help/display.php trunk/hastymail2/plugins/js_help/work.php Added: trunk/hastymail2/plugins/js_help/README =================================================================== --- trunk/hastymail2/plugins/js_help/README (rev 0) +++ trunk/hastymail2/plugins/js_help/README 2009-10-30 05:11:43 UTC (rev 1120) @@ -0,0 +1,2 @@ +Incomplete version of a plugin that uses javascript to supply extened information about the settings on the options page. +When the plugin is ready for use I will update this file Added: trunk/hastymail2/plugins/js_help/ajax.php =================================================================== --- trunk/hastymail2/plugins/js_help/ajax.php (rev 0) +++ trunk/hastymail2/plugins/js_help/ajax.php 2009-10-30 05:11:43 UTC (rev 1120) @@ -0,0 +1,52 @@ +<?php + +/* ajax.php: Plugin file responsible for handling ajax callbacks + Copyright (C) 2002-2009 Hastymail Development group + + This file is part of Hastymail. + + Hastymail is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Hastymail is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Hastymail; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +* $Id:$ +*/ +function ajax_js_help_get_help($opt_name, $tools) { + $str = $tools->get_hm_strings(); + $res = ''; + foreach ($str as $i => $v) { + if (starts_with($opt_name, $v)) { + if (!isset($tools->str[$i])) { + $res = 'This option is not supported yet<br />#'.$i.': '.$v; + } + else { + $res = $tools->str[$i]; + } + break; + } + } + if (!$res) { + //$res = 'This is a plugin option. These are not supported yet'; + } + return $res; +} +function starts_with($string, $test_string) { + if (strstr($string, '<span')) { + $string = trim(preg_replace("/\<span.+/", '', $string)); + } + if (trim($string) == trim($test_string)) { + return true; + } + return false; +} +?> Added: trunk/hastymail2/plugins/js_help/config.php =================================================================== --- trunk/hastymail2/plugins/js_help/config.php (rev 0) +++ trunk/hastymail2/plugins/js_help/config.php 2009-10-30 05:11:43 UTC (rev 1120) @@ -0,0 +1,52 @@ +<?php + +/* config.php: Plugin file responsible for defining how the plugin interacts with Hastymail + Copyright (C) 2002-2009 Hastymail Development group + + This file is part of Hastymail. + + Hastymail is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Hastymail is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Hastymail; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +* $Id:$ +*/ + +$js_help_hooks = array( + 'work_hooks' => array('init'), + 'display_hooks' => array('options_page_top'), + 'page_hook' => false, +); + +$js_help_langs = array( + 'en_US' => array( + 196 => 'The <b>Theme</b> option sets the colors, fonts, and icons to different arrangements. Themes can be made with nothing but CSS, and can be expanded using PHP templates. We could use more themes if anybody is interested :)', + 197 => 'The <b>Display Mode</b> controls the final XHTML output. When set to "Simple" javascript and css are excluded and the page is very size is very small. The default is the full XHTML interface', + 198 => 'The <b>Timezone</b> setting adjusts the clock and displayed date fields to the selected zone. The default is the server timezone.', + 199 => 'The <b>Clock date/time format</b> sets the format for the clock in the toolbar at the top of the page. You can set the format for the date and time individually', + 200 => 'The <b>Message date/time fomrat</b> sets the format for date fields in messages. You can set the format for the date and time individually', + 201 => 'The <b>FIrst page after login</b> setting determines what page is first displayed just after you login. The default is the mailbox view of the INBOX', + 202 => 'The <b>Font size</b> controls the font size of text in the interface. 100% is based on the default size set in the current theme. All of the themes currently set this to 10pt', + 203 => 'The <b>Language</b> setting determines the language used in the interface. When not using English if any text is displayed in English it is because it has not been translated yet. We could use translation help :)', + 204 => 'The <b>Confirm before deleting</b> option will prompt you with a javascript confirmation dialog whenever a delete action is performed', + 205 => 'The <b>Show folder list</b> option displays a folder tree on the left side of the display.', + 499 => 'The <b>Do not show the folder list icons</b> option hides the folder icons displayed in the folder tree when the <b>Show folder list</b> option is enabled', + 498 => 'The <b>Do not show read/unread message list icons</b> option hides the envelope icon images from message lists on the mailbox, new, and search pages', + 206 => 'The <b>Auto switch to simple mode for PDAs</b> setting will automatically enable the "Simple" <b>Display Mode</b> when a handheld device like a PDA or phone is detected', + 427 => 'The <b>Expunge INBOX on logout</b> setting causes all messages flagged for deletion to be expunged from the INBOX when logging out', + 447 => 'The <b>Hide deleted messages</b> option will cause messages with the delete flag set to be excluded from message listings', + + + ) +); +?> Added: trunk/hastymail2/plugins/js_help/display.php =================================================================== --- trunk/hastymail2/plugins/js_help/display.php (rev 0) +++ trunk/hastymail2/plugins/js_help/display.php 2009-10-30 05:11:43 UTC (rev 1120) @@ -0,0 +1,26 @@ +<?php + +/* display.php: Plugin file responsible for the output of XHTML into existing Hastymail pages. + Copyright (C) 2002-2009 Hastymail Development group + + This file is part of Hastymail. + + Hastymail is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Hastymail is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Hastymail; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +* $Id:$ +*/ +function js_help_options_page_top($tools) { + return '<div id="js_help_div"></div>'; +} Added: trunk/hastymail2/plugins/js_help/work.php =================================================================== --- trunk/hastymail2/plugins/js_help/work.php (rev 0) +++ trunk/hastymail2/plugins/js_help/work.php 2009-10-30 05:11:43 UTC (rev 1120) @@ -0,0 +1,84 @@ +<?php + +/* work.php: Plugin file responsible for the backend processing + Copyright (C) 2002-2009 Hastymail Development group + + This file is part of Hastymail. + + Hastymail is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Hastymail is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Hastymail; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +* $Id:$ +*/ + +function js_help_init($tools) { + if ($tools->get_page() != 'options') { + return; + } + $tools->register_ajax_callback('get_help', 1, false); + $tools->add_js_event_handler('document', 'onmouseover', 'js_help'); + $tools->add_js_event_handler('document', 'onmouseout', 'clear_help'); + $tools->add_js('<script type="text/javascript">'.$tools->start_cdata().' + var jh_timeout_id = 0; + function clear_help(e) { + document.getElementById("js_help_div").style.display = "none"; + targ = get_target(e); + if (targ.className == "opt_leftcol") { + targ.style.fontWeight = "normal"; + targ.style.backgroundColor = "transparent"; + targ.style.border = "none"; + } + } + function callback_js_help_get_help(output) { + if (output) { + document.getElementById("js_help_div").style.display = "block"; + document.getElementById("js_help_div").innerHTML = output; + } + } + function get_target(e) { + var targ; + if (!e) { e = window.event; } + if (e.target) { targ = e.target; } + else { if (e.srcElement) { targ = e.srcElement; } } + if (targ.nodeType == 3) { targ = targ.parentNode; } + return targ; + } + function js_help(e) { + if (e) { + targ = get_target(e); + if (targ.className == "opt_leftcol") { + if (targ.firstChild.nodeType == 3) { + targ.style.fontWeight = "bold"; + targ.style.backgroundColor = "#f5f5f5"; + targ.style.border = "solid 1px #ccc"; + if (jh_timeout_id) { + clearTimeout(jh_timeout_id); + jh_timeout_id = 0; + } + var lookup_function = function() {hm_ajax_js_help_get_help(targ.innerHTML, false);}; + jh_timeout_id = setTimeout(lookup_function, 250); + } + } + } + } + '.$tools->end_cdata().'</script> + <style type="text/css"> + #js_help_div{ + display: block; max-width: 300px; position: fixed; top: 80px; right: 50px; font-weight: normal; + background: #f5f5f5; display: none; color: #333; border: solid 1px #ccc; padding: 30px; + } + </style> + '); +} +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |