From: Tyler A. <fi...@us...> - 2001-02-22 13:24:50
|
Update of /cvsroot/squirrelmail/squirrelmail/plugins/quicksave In directory usw-pr-cvs1:/tmp/cvs-serv26402/quicksave Added Files: Tag: sm-1_0 README setup.php Log Message: * Added all the plugins to the 1.0 branch. Hope that this is still the correct thing to do -- don't want to make people mad. * Will add them to the 1.1 branch shortly. * Are we going to make a new policy for plugin people to include their plugin in the CVS for whatever SquirrelMail versions the plugin works with? Just the newest stable branch and the experimental branch? * If these should NOT be here, let me know and I'll remove all plugins from 1.0 and the soon-to-have-them 1.1 branches. --- NEW FILE --- QuickSave Plugin ------------------- This automatically saves the email message you're composing against accidentally being wiped out by refreshing the right frame or otherwise leaving the Compose page. Think of it as anti-anti-caching :) It's all very simple javascript on the Compose page, and a form that we're using for storagin in the left_main page. You won't ever know that it's installed unless you've lost a message and it can be recovered. If there are problems, or JavaScript inconsistancies, please notify me (Ray Black) at al...@ac..., or else post to the squirrelmail-plugins list. It should be noted that this plugin requires at least SquirrelMail version 1.0pre3. Changes ------------------- 0.3: only fields which have values will be saved and/or restored 0.2: bug fixes, requirements updated 0.1: initial release (duh) To Install: ------------------- 1. Unarchive the file $ cd plugins $ tar -zxvf quicksave-0.X.tar.gz 2. Run conf.pl, choose "8" from the main menu, and add "quicksave" as a new plugin. Save and exit. 3. Done --- NEW FILE --- <? function squirrelmail_plugin_init_quicksave() { global $squirrelmail_plugin_hooks; $squirrelmail_plugin_hooks["left_main_after"]["quicksave"] = "quicksave_left_main_after"; $squirrelmail_plugin_hooks["compose_bottom"]["quicksave"] = "quicksave_compose_bottom"; $squirrelmail_plugin_hooks["compose_form"]["quicksave"] = "quicksave_compose_form"; } function quicksave_left_main_after() { // QuickSave plugin echo "<form name=quicksave>\n"; echo "\t<input type=hidden value=\"\" name=send_to>\n"; echo "\t<input type=hidden value=\"\" name=send_to_cc>\n"; echo "\t<input type=hidden value=\"\" name=send_to_bcc>\n"; echo "\t<input type=hidden value=\"\" name=subject>\n"; echo "\t<input type=hidden value=\"\" name=body>\n"; echo "\t<input type=hidden value=0 name=is_active>\n"; echo "</form>\n"; // end -- QuickSave plugin } function quicksave_compose_bottom() { // QuickSave plugin echo "<script language=Javascript>\n"; echo "<!--\n"; echo "function QuickSave_swap(from_form, to_form)\n"; echo "{\n"; echo " if ( from_form.send_to.value.length >= 1 )\n"; echo " to_form.send_to.value = from_form.send_to.value;\n"; echo " if ( from_form.send_to_cc.value.length >= 1 )\n"; echo " to_form.send_to_cc.value = from_form.send_to_cc.value;\n"; echo " if ( from_form.send_to_bcc.value.length >= 1 )\n"; echo " to_form.send_to_bcc.value = from_form.send_to_bcc.value;\n"; echo " if ( from_form.subject.value.length >= 1 )\n"; echo " to_form.subject.value = from_form.subject.value;\n"; echo " if ( from_form.body.value.length >= 1 )\n"; echo " to_form.body.value = from_form.body.value;\n"; echo " self.setTimeout('QuickSave_swap(document.compose, parent.left.document.quicksave)', 10000);\n"; echo " QuickSave_activate(true);\n"; echo " return true;\n"; echo "}\n"; echo "\n"; echo "function QuickSave_activate(do_we_save)\n"; echo "{\n"; echo " if ( do_we_save )\n"; echo " parent.left.document.quicksave.is_active.value = 1;\n"; echo " else\n"; echo " parent.left.document.quicksave.is_active.value = 0;\n"; echo " return true;\n"; echo "}\n"; echo "\n"; echo " // we check to see if we restore, but we only do this once\n"; echo "if ( parent.left.document.quicksave.is_active.value == 1 )\n"; echo "{\n"; echo " if ( confirm('There is a QuickSaved email!\\nDo you wish to restore it?') )\n"; echo " {\n"; echo " QuickSave_swap(parent.left.document.quicksave, document.compose);\n"; echo " alert('Email restored!\\nPlease try to be more careful in the future! \;\)');\n"; echo " }\n"; echo " else\n"; echo " {\n"; echo " QuickSave_swap(document.compose, parent.left.document.quicksave);\n"; echo " }\n"; echo "}\n"; echo "else\n"; echo "{\n"; echo " QuickSave_swap(document.compose, parent.left.document.quicksave);\n"; echo "}\n"; echo "//-->\n"; echo "</script>\n"; // end -- QuickSave plugin } function quicksave_compose_form() { echo " onSubmit=\"QuickSave_activate(false);\""; } |