[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail:[14686] trunk/squirrelmail/plugins/squirrelspell
From:       Paul Lesniewski via squirrelmail-cvs <squirrelmail-cvs () lists ! sourceforge ! net>
Date:       2017-06-17 20:23:12
Message-ID: 1497730992.710805.19069 () sfp-scm-1 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 14686
          http://sourceforge.net/p/squirrelmail/code/14686
Author:   pdontthink
Date:     2017-06-17 20:23:12 +0000 (Sat, 17 Jun 2017)
Log Message:
-----------
Add ability to control the display of the "Check Spelling" button. Allows \
administrators to offer this plugin but keep it out of the way for users who do not \
want it. Put sqspell_show_button=0 in default preferences if it should be hidden by \
default.

Modified Paths:
--------------
    trunk/squirrelmail/plugins/squirrelspell/modules/options_main.mod
    trunk/squirrelmail/plugins/squirrelspell/sqspell_functions.php

Added Paths:
-----------
    trunk/squirrelmail/plugins/squirrelspell/modules/change_main_options.mod

Added: trunk/squirrelmail/plugins/squirrelspell/modules/change_main_options.mod
===================================================================
--- trunk/squirrelmail/plugins/squirrelspell/modules/change_main_options.mod	         \
                (rev 0)
+++ trunk/squirrelmail/plugins/squirrelspell/modules/change_main_options.mod	2017-06-17 \
20:23:12 UTC (rev 14686) @@ -0,0 +1,55 @@
+<?php
+/**
+ * change_main_options.mod
+ * -----------------------
+ * Squirrelspell module
+ *
+ * Copyright (c) 1999-2017 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This module changes the international dictionaries selection
+ * for the user. Called after LANG_SETUP module.
+ *
+ * @author Paul Lesniewski <paul@squirrelmail.org>
+ * @version $Id: lang_change.mod 14642 2017-01-27 20:31:33Z pdontthink $
+ * @package plugins
+ * @subpackage squirrelspell
+ */
+
+if (!sqgetGlobalVar('smtoken',$submitted_token, SQ_POST)) {
+    $submitted_token = '';
+}
+sm_validate_security_token($submitted_token, -1, TRUE);
+
+$main_options_changed_message = '<p><strong>';
+
+if (sqgetGlobalVar('sqspell_show_button', $sqspell_show_button, SQ_POST)
+ && !empty($sqspell_show_button))
+{
+   $sqspell_show_button = 1;
+   $main_options_changed_message .= sprintf(_("Settings changed: Set to show \"%s\" \
button"), _("Check Spelling")); +}
+else
+{
+   $sqspell_show_button = 0;
+   $main_options_changed_message .= sprintf(_("Settings changed: Set to hide \"%s\" \
button"), _("Check Spelling")); +}
+
+$main_options_changed_message .= '</strong></p>';
+
+setPref($data_dir, $username, 'sqspell_show_button', $sqspell_show_button);
+
+// so far the only thing this file does is change a checkbox,
+// so for now we can skip the confirmation page and just reload
+// the changed main options page (with a simple confirmation message)
+//
+require(SM_PATH . 'plugins/squirrelspell/modules/options_main.mod');
+
+/**
+ * For Emacs weenies:
+ * Local variables:
+ * mode: php
+ * End:
+ * vim: syntax=php
+ */
+

Modified: trunk/squirrelmail/plugins/squirrelspell/modules/options_main.mod
===================================================================
--- trunk/squirrelmail/plugins/squirrelspell/modules/options_main.mod	2017-06-17 \
                20:22:47 UTC (rev 14685)
+++ trunk/squirrelmail/plugins/squirrelspell/modules/options_main.mod	2017-06-17 \
20:23:12 UTC (rev 14686) @@ -15,8 +15,14 @@
  * @subpackage squirrelspell
  */
 
-global $SQSPELL_APP;
-$msg = '<p>'
+global $SQSPELL_APP, $main_options_changed_message;
+
+if (!empty($main_options_changed_message))
+   $msg = $main_options_changed_message;
+else
+   $msg = '';
+
+$msg .= '<p>'
   . _("Please choose which options you wish to set up:")
   . '</p>'
   . '<ul>'
@@ -46,6 +52,27 @@
     . '</li>';
 }
 $msg .= "</ul>\n";
+
+
+
+// add checkbox to enable/disable the spellcheck button on compose screen
+//
+$sqspell_show_button = getPref($data_dir, $username, 'sqspell_show_button', 1);
+$msg .= '<form method="post">'
+  . '<input type="hidden" name="MOD" value="change_main_options" />'
+  . '<input type="hidden" name="smtoken" value="' . sm_generate_security_token() . \
'" />' +  . '<p>'
+  . '<input type="checkbox" id="sqspell_show_button" name="sqspell_show_button" \
value="1"'; +if ($sqspell_show_button) {
+  $msg .= ' checked="checked"';
+}
+$msg .= ' /><label for="sqspell_show_button"> '
+     . sprintf(_("Show \"%s\" button when composing"), _("Check Spelling"))
+     . "</label>\n";
+$msg .= " <input type=\"submit\" value=\" "
+  . _("Make these changes") . " \" /></p></form>";
+
+
 sqspell_makePage( _("SquirrelSpell Options Menu"), null, $msg);
 
 /**

Modified: trunk/squirrelmail/plugins/squirrelspell/sqspell_functions.php
===================================================================
--- trunk/squirrelmail/plugins/squirrelspell/sqspell_functions.php	2017-06-17 \
                20:22:47 UTC (rev 14685)
+++ trunk/squirrelmail/plugins/squirrelspell/sqspell_functions.php	2017-06-17 \
20:23:12 UTC (rev 14686) @@ -57,11 +57,15 @@
  * @return void
  */
 function squirrelspell_setup_function() {
+
+  global $data_dir, $username;
+  $sqspell_show_button = getPref($data_dir, $username, 'sqspell_show_button', 1);
+
   /**
    * Check if this browser is capable of displaying SquirrelSpell
    * correctly.
    */
-  if (checkForJavascript()) {
+  if ($sqspell_show_button && checkForJavascript()) {
 
     global $oTemplate, $base_uri, $nbsp;
 

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
                https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic