Various visual and user interface improvements
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 16 Oct 2019 13:12:53 +0000 (09:12 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 16 Oct 2019 13:21:44 +0000 (09:21 -0400)
Separated admin edit of Selected Site and Global paramters into two forms
Added ability to set maximum cookie pop-up width
Updated default cookie pop-up text
Various fixes and updates to interaction with licensing and update server
Responsive layout improved for medium widths
Now using popup border color for button border color

defines.php
index.php
lib/opentools-update-checker/opentools-update-checker.php
lib/plugin-update-checker/github-checker.php
lib/plugin-update-checker/plugin-update-checker.php
models/adminServerStats.php
models/frontCookiePopUp.php
readme.txt
views/adminServerStats.html
views/ui/f6/form-edit-start.html
views/ui/f6/form-summary-start.html

index 450b3fd..c76d4ef 100755 (executable)
@@ -110,7 +110,7 @@ define('GLM_SERVERSTATS_PLUGIN_MODEL_PATH', GLM_SERVERSTATS_PLUGIN_PATH.'/models
 define('GLM_SERVERSTATS_PLUGIN_VIEW_PATH', GLM_SERVERSTATS_PLUGIN_PATH.'/views');
 
 // Update Server
-define('GLM_SERVERSTATS_PLUGIN_UPDATE_SERVER', 'http://www.gaslightmedia.com/update_server');
+define('GLM_SERVERSTATS_PLUGIN_UPDATE_SERVER', 'https://www.gaslightmedia.com/update_server');
 // define('GLM_SERVERSTATS_PLUGIN_UPDATE_SERVER', 'https://192.168.44.82/update_server');
 
 // Other
index 79335e8..ff62f01 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -174,9 +174,9 @@ if ( ( !empty( $_REQUEST['force_cookie'] ) || $websiteSettings['show_cookie_popu
 
     // Have WordPress include the cookie pop-up code just before the footer.
     function doCookiePopUp() {
-        include GLM_SERVERSTATS_PLUGIN_MODEL_PATH . '/frontCookiePopUp.php';
+        include GLM_SERVERSTATS_PLUGIN_MODEL_PATH.'/frontCookiePopUp.php';
     }
-    add_action( 'get_footer', '\GlmServerStats\doCookiePopUp' );
+    add_action( 'wp_footer', '\GlmServerStats\doCookiePopUp' );
 
 }
 
index 2cee653..7ae92f2 100644 (file)
@@ -30,7 +30,6 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_3_1 {
         $this->credvars = $credential_def;
         // Append the update credentials to the update server link
         $this->addQueryArgFilter(array($this, 'appendQueryArgsCredentials'));
-
     }
 
     protected function installOTHooks()
@@ -221,11 +220,19 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_3_1 {
         $this->setCredentials($this->slug, $credentials);
         $success = FALSE;
         $updateinfo = $this->requestInfo(array());
-
         if ($updateinfo && isset($updateinfo->download_url)) {
             $downloadurl = $updateinfo->download_url;
             $downloadurl = apply_filters('puc_check_download_query_args-'.$this->slug, $downloadurl);
 
+            if (GLM_SERVERSTATS_PLUGIN_HOST == 'DEVELOPMENT') {
+                stream_context_set_default( [
+                    'ssl' => [
+                        'verify_peer' => false,
+                        'verify_peer_name' => false,
+                    ],
+                ]);
+            }
+
             $headers = get_headers($downloadurl);
             list($version, $status_code, $msg) = explode(' ',$headers[0], 3);
 
index c2d506f..a65b625 100644 (file)
@@ -282,7 +282,7 @@ class PucGitHubChecker_3_1 extends PluginUpdateChecker_3_1 {
                        return $document;\r
                }\r
 \r
-               return new WP_Error(\r
+               return new \WP_Error(\r
                        'puc-github-http-error',\r
                        'GitHub API error. HTTP status: ' . $code\r
                );\r
index b9a9852..f321fe0 100644 (file)
@@ -169,6 +169,7 @@ class PluginUpdateChecker_3_1 {
      * @return PluginInfo_3_1\r
      */\r
     public function requestInfo($queryArgs = array()){\r
+\r
         //Query args to append to the URL. Plugins can add their own by using a filter callback (see addQueryArgFilter()).\r
         $installedVersion = $this->getInstalledVersion();\r
         $queryArgs['installed_version'] = ($installedVersion !== null) ? $installedVersion : '';\r
@@ -180,7 +181,9 @@ class PluginUpdateChecker_3_1 {
             'headers' => array(\r
                 'Accept' => 'application/json'\r
             ),\r
+            'sslverify' => (!GLM_SERVERSTATS_PLUGIN_HOST=='DEVELOPMENT')      // *** Added to permit testing with development server that uses a self-signed cert\r
         );\r
+\r
         $options = apply_filters('puc_request_info_options-'.$this->slug, $options);\r
 \r
         //The plugin info should be at 'http://your-api.com/url/here/$slug/info.json'\r
@@ -188,7 +191,6 @@ class PluginUpdateChecker_3_1 {
         if ( !empty($queryArgs) ){\r
             $url = add_query_arg($queryArgs, $url);\r
         }\r
-\r
         $result = wp_remote_get(\r
             $url,\r
             $options\r
@@ -205,6 +207,7 @@ class PluginUpdateChecker_3_1 {
             }\r
 \r
         } else {\r
+\r
             return false;\r
             /* Not generating error at this time as this could simply be a bad or missing key submitted\r
             $this->triggerError(\r
@@ -222,28 +225,28 @@ class PluginUpdateChecker_3_1 {
     /**\r
      * Check if $result is a successful update API response.\r
      *\r
-     * @param array|WP_Error $result\r
-     * @return true|WP_Error\r
+     * @param array WP_Error $result\r
+     * @return true WP_Error\r
      */\r
     private function validateApiResponse($result) {\r
 \r
         if ( is_wp_error($result) ) { /** @var WP_Error $result */\r
-            return new WP_Error($result->get_error_code(), 'WP HTTP Error: ' . $result->get_error_message());\r
+            return new \WP_Error($result->get_error_code(), 'WP HTTP Error: ' . $result->get_error_message());\r
         }\r
 \r
         if ( !isset($result['response']['code']) ) {\r
-            return new WP_Error('puc_no_response_code', 'wp_remote_get() returned an unexpected result.');\r
+            return new \WP_Error('puc_no_response_code', 'wp_remote_get() returned an unexpected result.');\r
         }\r
 \r
         if ( $result['response']['code'] !== 200 ) {\r
-            return new WP_Error(\r
+            return new \WP_Error(\r
                 'puc_unexpected_response_code',\r
                 'HTTP response code is ' . $result['response']['code'] . ' (expected: 200)'\r
             );\r
         }\r
 \r
         if ( empty($result['body']) ) {\r
-            return new WP_Error('puc_empty_response', 'The metadata file appears to be empty.');\r
+            return new \WP_Error('puc_empty_response', 'The metadata file appears to be empty.');\r
         }\r
 \r
         return true;\r
@@ -621,7 +624,7 @@ class PluginUpdateChecker_3_1 {
             //WordPress will try to copy the entire working directory ($source == $remoteSource). We can't rename\r
             //$remoteSource because that would break WordPress code that cleans up temporary files after update.\r
             if ( $this->isBadDirectoryStructure($remoteSource) ) {\r
-                return new WP_Error(\r
+                return new \WP_Error(\r
                     'puc-incorrect-directory-structure',\r
                     sprintf(\r
                         'The directory structure of the update is incorrect. All plugin files should be inside ' .\r
@@ -642,7 +645,7 @@ class PluginUpdateChecker_3_1 {
                 $upgrader->skin->feedback('Plugin directory successfully renamed.');\r
                 return $correctedSource;\r
             } else {\r
-                return new WP_Error(\r
+                return new \WP_Error(\r
                     'puc-rename-failed',\r
                     'Unable to rename the update to match the existing plugin directory.'\r
                 );\r
@@ -1043,7 +1046,7 @@ class PluginInfo_3_1 {
             || empty($apiResponse->name)\r
             || empty($apiResponse->version)\r
         ) {\r
-            return new WP_Error(\r
+            return new \WP_Error(\r
                 'puc-invalid-metadata',\r
                 "The plugin metadata file does not contain the required 'name' and/or 'version' keys."\r
             );\r
index 2151675..9ad24d3 100755 (executable)
@@ -128,7 +128,7 @@ class adminServerStats extends glmServerStatsBandwidthSupport
 
             }
 
-            if ($option == 'update_site') {
+            if ( $option == 'update_site' ) {
 
                 // Update the website table with certain values
                 $vals = filter_input_array( INPUT_POST,
@@ -154,7 +154,8 @@ class adminServerStats extends glmServerStatsBandwidthSupport
                         'color_text'            => FILTER_SANITIZE_STRING,
                         'color_buttontext'      => FILTER_SANITIZE_STRING,
                         'popup_border'          => FILTER_SANITIZE_STRING,
-                        'popup_position'        => FILTER_SANITIZE_STRING
+                        'popup_position'        => FILTER_SANITIZE_STRING,
+                        'popup_width'           => FILTER_VALIDATE_INT,
 
                     ),true
                 );
@@ -184,13 +185,17 @@ class adminServerStats extends glmServerStatsBandwidthSupport
                             color_text              = '".$vals['color_text']."',
                             color_buttontext        = '".$vals['color_buttontext']."',
                             popup_border            = '".$vals['popup_border']."',
-                            popup_position          = '".$vals['popup_position']."'
+                            popup_position          = '".$vals['popup_position']."',
+                            popup_width             = ".$vals['popup_width']."
                      WHERE name = '".$currentSiteName."'
                 ";
                 if (!$bwdb->query($sql)) {
                     printf("Error: %s\n", $bwdb->error);
                 }
 
+            }
+            if ( $option == 'update_settings' ) {
+
                 // Update Reporting From Contact and Title (GLM)
                 $glmFromContact = [
                     'name'          => filter_input( INPUT_POST, 'report_contact_name', FILTER_SANITIZE_STRING),
@@ -224,11 +229,17 @@ class adminServerStats extends glmServerStatsBandwidthSupport
             // Get list of sites in the bandwidth database
             $websites = $this->bandwidthLastMonthAllSites($sortBy);
 
-        } else {
-            // Get the settings for the currently selected site
-            $currentSite = bandwidthGetWebsiteSettingsFromName($currentSiteName);
         }
 
+        // Get the settings for the currently selected site
+        $currentSite = bandwidthGetWebsiteSettingsFromName($currentSiteName);
+
+        // Fix old positioning option
+        if ( $currentSite['popup_position'] == 'Top' ) {
+            $currentSite['popup_position'] = 'Top Left';
+        }
+
+
         // Get bandwidth stats for the current site
         $stats = $this->getStatsAndCheckTargetExceeded($currentSite);
 
@@ -250,12 +261,19 @@ class adminServerStats extends glmServerStatsBandwidthSupport
         // Default text to use if the Cookie Message text is not supplied
         if (trim($currentSite['cookie_message']) == '') {
             $currentSite['cookie_message'] =
-                '<p>This site uses temporary "Cookies" to store limited information that\'s '
-                .'required to provide you with a consistent user experience. We don\'t store '
-                .'personally identifying or other sensitive information in these Cookies and '
-                .'these Cookies are erased when you close your Web Browser unless otherwise '
-                .'stated when you click "Show more".</p><p>If you\'re on a public computer, '
-                .'be sure to close all Web Browsers when you\'re done!</p>';
+                '<p>This site uses "Cookies" to store limited information '
+                .'required to provide you with a consistent user experience. '
+                .'Click "Show more" for additional information.</p>';
+
+            $sql = "
+                UPDATE website
+                    SET cookie_message          = '".$currentSite['cookie_message']."'
+                 WHERE name = '".$currentSiteName."'
+            ";
+            if (!$bwdb->query($sql)) {
+                printf("Error: %s\n", $bwdb->error);
+            }
+
         }
 
         // Default text to use if reporting E-Mail content is not supplied
index ee80f5c..1fb9640 100755 (executable)
@@ -5,20 +5,24 @@ namespace GLMServerStats;
 $bwdb = mysqli_init();
 $settings = bandwidthDataConnect(GLM_SERVERSTATS_PLUGIN_HOSTNAME);
 
-if ( $settings['popup_position'] == 'Top' ) {
-    $position = 'position: absolute; top: 0px;';
-} else {
-    $position = 'position: fixed; bottom: 0;';
+if ( $settings['popup_position'] == 'Top Left' || $settings['popup_position'] == 'Top') { // Top left in for backward compatibiltiy with settings
+    $position = 'position: absolute; top: 0px; left: 0;';
+} elseif ( $settings['popup_position'] == 'Top Right' ) {
+    $position = 'position: absolute; top: 0px; right: 0;';
+} elseif ( $settings['popup_position'] == 'Bottom Right' ) {
+    $position = 'position: fixed; bottom: 0; right: 0;';
+} else { // Bottom left
+    $position = 'position: fixed; bottom: 0; left: 0;';
 }
 ?>
 <style>
     #cookieNoticeBox {
     <?php echo $position;?>
-        left: 0;
         width: -moz-calc(100% - 18px);
         width: -webkit-calc(100% - 18px);
         width: -o-calc(100% - 18px);
         width: calc(100% - 18px);
+        max-width: <?php echo $settings['popup_width']; ?>px;
         margin: 10px;
         border: <?php echo $settings['popup_border']; ?>;
         background: <?php echo $settings['color_background']; ?>;
@@ -41,7 +45,7 @@ if ( $settings['popup_position'] == 'Top' ) {
     #cookieNoticeBox .button {
         color: <?php echo $settings['color_buttontext']; ?>;
         background: <?php echo $settings['color_buttons']; ?>;
-        border: 1px solid black;
+        border: <?php echo $settings['popup_border']; ?>;
         border-radius: 10px;
 
         font-size: 1rem;
index 0ceccb7..cc3d6d2 100755 (executable)
@@ -29,6 +29,14 @@ e.g.
 1. Activate the plugin through the 'Plugins' menu in WordPress
 
 == Changelog ==
+= (pending) =
+* Separated admin edit of Selected Site and Global paramters into two forms.
+* Added ability to set maximum cookie pop-up width.
+* Updated default cookie pop-up text. (To get new default text, submit form with no "Cookie Message".
+* Various fixes and updates to interaction with licensing and update server.
+* Responsive layout improved for medium widths.
+* Now using popup border color for button border color also instead of just black
+
 = 4.1.7 =
 * Update to use wp_footer action for cookie pop ups.
 
index 21feec1..d98c780 100755 (executable)
 
                     {* Form Summary Start *}
                     {$ui = [
-                        'id'    => 'usageSettings',
-                        'title' => 'Settings Summary'
+                        'id'             => 'siteSettings',
+                        'title'          => 'Selected Site Summary',
+                        'blockMultiEdit' => 1
                     ]}
                     {include file="ui/f6/form-summary-start.html"}
 
 
                                     <div class="cell small-12 large-12 glm-f6-ui-nowrap"><u>Usage Reporting</u></div>
 
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Monthly Traffic Target:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.target|string_format:"%.1f"} GB</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Disk Space Usage Target:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.disk_target|string_format:"%.1f"} GB</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Show Usage Graphs:</b></div>
-                                    <div class="cell small-12 large-7">{if $currentSite.show_usage}Yes{else}No{/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Send Usage Reports:</b></div>
-                                    <div class="cell small-12 large-7">{if $currentSite.send_enabled}Yes{else}No{/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Customer Contact Name:</b></div>
-                                    <div class="cell small-12 large-7">{if !empty($currentSite.cust_contact_name)}{$currentSite.cust_contact_name}{else}(Not supplied){/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Customer Contact E-Mail:</b></div>
-                                    <div class="cell small-12 large-7">{if !empty($currentSite.cust_contact)}{$currentSite.cust_contact}{else}(Not supplied){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Monthly Traffic Target:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.target|string_format:"%.1f"} GB</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Disk Space Usage Target:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.disk_target|string_format:"%.1f"} GB</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Show Usage Graphs:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if $currentSite.show_usage}Yes{else}No{/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Send Usage Reports:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if $currentSite.send_enabled}Yes{else}No{/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Customer Contact Name:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($currentSite.cust_contact_name)}{$currentSite.cust_contact_name}{else}(Not supplied){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Customer Contact E-Mail:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($currentSite.cust_contact)}{$currentSite.cust_contact}{else}(Not supplied){/if}</div>
 
                                     <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Cookie Pop-Up</u></div>
 
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Show Cookie Pop-Up:</b></div>
-                                    <div class="cell small-12 large-7">
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Show Cookie Pop-Up:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">
                                         {if $currentSite.show_cookie_popup}Yes{else}No{/if}
                                         <br><a href="http://{$currentSite.name}?force_cookie=1" target="cookieTest">Click me to test Cookie Pop-Up</a>
                                     </div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Cookie Pop-Up Timeout:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.cookie_popup_timeout} Days</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Cookie Message:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.cookie_message|nl2br}</div>
-
-                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Cookie Pop-Up Colors</u></div>
-
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Background:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.color_background}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Buttons:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.color_buttons}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Text:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.color_text}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Button Text:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.color_buttontext}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Pop-Up Border:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.popup_border}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Position:</b></div>
-                                    <div class="cell small-12 large-7">{$currentSite.popup_position}</div>
-
-                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Privacy/Policy Page</u></div>
-
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Privacy and Policy Contact:</b></div>
-                                    <div class="cell small-12 large-7">{if !empty($currentSite.contact_name)}{$currentSite.contact_name}{else}(Name not set){/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap">&nbsp;</div>
-                                    <div class="cell small-12 large-7">{if !empty($currentSite.contact_org)}{$currentSite.contact_org}{else}(Organization not set){/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap">&nbsp;</div>
-                                    <div class="cell small-12 large-7">{if !empty($currentSite.contact_address)}{$currentSite.contact_address}{else}(Address line 1 not set){/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap">&nbsp;</div>
-                                    <div class="cell small-12 large-7">{if !empty($currentSite.contact_address2)}{$currentSite.contact_address2}{else}(Address line 2 not set){/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap">&nbsp;</div>
-                                    <div class="cell small-12 large-7">
-                                        {if !empty($currentSite.contact_city)}{$currentSite.contact_city}{else}(City not set){/if},
-                                        {if !empty($currentSite.contact_state)}{$currentSite.contact_state}{else}(State not set){/if}
-                                        {if !empty($currentSite.contact_zip)}{$currentSite.contact_zip}{else}(Zip not set){/if},
-                                    </div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Contact Phone:</b></div>
-                                    <div class="cell small-12 large-7">{if !empty($currentSite.contact_phone)}{$currentSite.contact_phone}{else}(Phone not set){/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Contact E-Mail Address:</b></div>
-                                    <div class="cell small-12 large-7">{if !empty($currentSite.contact_email)}{$currentSite.contact_email}{else}(Email not set){/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Privacy/Policy Page:</b></div>
-                                    <div class="cell small-12 large-7"><a href="{$moreInfoUrl}" target="policyPage">{$policyPageSlug}</a></div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Cookie Pop-Up Timeout:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.cookie_popup_timeout} Days</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Cookie Message:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.cookie_message|nl2br}</div>
 
                                 {include file="ui/f6/sub-section-end.html"}
 
                                 {* Sub-Section Start *}
                                     {$ui = [
-                                    'title'    => 'Global Settings',
+                                    'title'    => '',
                                     'wrapSize' => 6
                                 ]}
                                 {include file="ui/f6/sub-section-start.html"}
 
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Monthly Reporting Threshold:</b></div>
-                                    <div class="cell small-12 large-7">At or above {$threshold|string_format:"%.0f"}% of site's target levels</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Enable Sending Usage Reports:</b></div>
-                                    <div class="cell small-12 large-7">{if $sendReportsEnabled}YES{else}NO{/if}</div>
-
-                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Usage Report E-Mail "From:" Settings</u></div>
-
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Name:</b></div>
-                                    <div class="cell small-12 large-7">{if !empty($glmFromContact.name)}{$glmFromContact.name}{else}(Name not set){/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>E-Mail Address:</b></div>
-                                    <div class="cell small-12 large-7">{if !empty($glmFromContact.name)}{$glmFromContact.email}{else}(Email not set){/if}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Subject:</b></div>
-                                    <div class="cell small-12 large-7">{if !empty($glmFromContact.subject)}{$glmFromContact.subject}{else}(Subject not set){/if}</div>
-
-                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Usage Report E-Mail - Below Target %</u></div>
-
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Before Report:</b></div>
-                                    <div class="cell small-12 large-7">{wpautop($glmReportEmail.before_report)}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>After Report:</b></div>
-                                    <div class="cell small-12 large-7">{wpautop($glmReportEmail.after_report)}</div>
+                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Cookie Pop-Up Appearance</u></div>
+
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Background:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.color_background}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Buttons:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.color_buttons}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Text:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.color_text}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Button Text:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.color_buttontext}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Pop-Up Border:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.popup_border}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Position:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.popup_position}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Width:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{$currentSite.popup_width}px</div>
 
-                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Usage Report E-Mail - Above Target %</u></div>
+                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Privacy/Policy Page</u></div>
 
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>Before Report:</b></div>
-                                    <div class="cell small-12 large-7">{wpautop($glmReportEmail.before_report_above_target)}</div>
-                                    <div class="cell small-12 large-5 glm-f6-ui-nowrap"><b>After Report:</b></div>
-                                    <div class="cell small-12 large-7">{wpautop($glmReportEmail.after_report_above_target)}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Privacy and Policy Contact:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($currentSite.contact_name)}{$currentSite.contact_name}{else}(Name not set){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap">&nbsp;</div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($currentSite.contact_org)}{$currentSite.contact_org}{else}(Organization not set){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap">&nbsp;</div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($currentSite.contact_address)}{$currentSite.contact_address}{else}(Address line 1 not set){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap">&nbsp;</div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($currentSite.contact_address2)}{$currentSite.contact_address2}{else}(Address line 2 not set){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap">&nbsp;</div>
+                                    <div class="cell small-12 medium-8 large-7">
+                                        {if !empty($currentSite.contact_city)}{$currentSite.contact_city}{else}(City not set){/if},
+                                        {if !empty($currentSite.contact_state)}{$currentSite.contact_state}{else}(State not set){/if}
+                                        {if !empty($currentSite.contact_zip)}{$currentSite.contact_zip}{else}(Zip not set){/if},
+                                    </div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Contact Phone:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($currentSite.contact_phone)}{$currentSite.contact_phone}{else}(Phone not set){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Contact E-Mail Address:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($currentSite.contact_email)}{$currentSite.contact_email}{else}(Email not set){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Privacy/Policy Page:</b></div>
+                                    <div class="cell small-12 medium-8 large-7"><a href="{$moreInfoUrl}" target="policyPage">{$policyPageSlug}</a></div>
 
                                 {include file="ui/f6/sub-section-end.html"}
+
                             </div>
                         </div>
 
 
                     {* Form Edit Start *}
                     {$ui = [
-                        'id'    => 'usageSettings',
+                        'id'    => 'siteSettings',
                         'title' => 'Edit Settings'
                     ]}
                     {include file="ui/f6/form-edit-start.html"}
 
                             {* Sub-Section Start *}
                             {$ui = [
-                                'title' => 'Usage Reporting'
+                                'title' => 'Usage Reporting',
+                                'wrapSize' => 6
                             ]}
                             {include file="ui/f6/sub-section-start.html"}
 
                                             selected below.
                                             See &quot;Additional Notices&quot; to select other standard
                                             notices to display based on what is included in Web site.
-                                            '
+                                            ',
+                                'wrapSize' => 6
                             ]}
                             {include file="ui/f6/sub-section-start.html"}
 
 
                            {* Sub-Section Start *}
                                 {$ui = [
-                                'title' => 'Cookie Pop-Up Colors and Positioning'
+                                'title' => 'Cookie Pop-Up Colors and Positioning',
+                                'wrapSize' => 6
                             ]}
                             {include file="ui/f6/sub-section-start.html"}
 
                                     'value'   => {$currentSite.popup_position},
                                     'default' => 'top',
                                     'label'   => 'Pop-Up Position',
-                                    'list'    => ['Top' => 'Top', 'Bottom' => 'Bottom'],
+                                    'list'    => [
+                                        'Top Left' => 'Top Left',
+                                        'Top Right' => 'Top Right',
+                                        'Bottom Left' => 'Bottom Left',
+                                        'Bottom Right' => 'Bottom Right'
+                                    ],
                                     'noWrap'  => true
                                 ]}
                                 {include file="ui/f6/radioButtons.html"}
 
+                                {* popup_width *}
+                                {$ui = [
+                                    'field'     => 'popup_width',
+                                    'value'     => {$currentSite.popup_width},
+                                    'label'     => 'Cookie Pop-Up Width in Pixels',
+                                    'required'  => true,
+                                    'min'       => 200,
+                                    'max'       => 2000,
+                                    'width'     => 5,
+                                    'helpText'  => 'This is the maximum width for the cookie pop-up box. Depending on the site, the box may float to the left of the page.',
+                                    'errorText' => 'Must be between 200 and 2000 px.'
+                                ]}
+                                {include file="ui/f6/number.html"}
+
                             {include file="ui/f6/sub-section-end.html"}
 
                             {* Sub-Section Start *}
                             {$ui = [
-                                'title' => 'Privacy/Policy Page Contact Information'
+                                'title' => 'Privacy/Policy Page Contact Information',
+                                'wrapSize' => 6
                             ]}
                             {include file="ui/f6/sub-section-start.html"}
 
 
                         {include file="ui/f6/section-end.html"}
 
+                        {* Submit Button *}
+                        {$ui = [
+                            'class'  => 'primary',
+                            'label'  => 'Update Site Settings',
+                            'submit' => true
+                        ]}
+                        {include file="ui/f6/submit.html"}
+
+                    {include file="ui/f6/form-edit-end.html"}
+
+                {include file="ui/f6/grid-end.html"}
+
+            {include file="ui/f6/form-end.html"}
+
+            {* Form Start *}
+            {$ui = [
+                'action'                 => "{$thisUrl}?page={$thisPage}&selected_site={$currentSite.name}",
+                'method'                 => 'POST',
+                'validate'               => true,
+                'validateFocusMsg'       => true,
+                'leaveModifiedFormCheck' => true
+            ]}
+            {include file="ui/f6/form-start.html"}
+
+                <input type="hidden" name="option" value="update_settings">
+                <input type="hidden" name="site_sort" value="$site_sort">
+                <input type="hidden" name="selected_site" value="{$currentSite.name}">
+
+                {* Grid Start *}
+                {$ui = [
+                    'sectionColor' => '#ffE',
+                    'nowrap'       => true
+                ]}
+                {include file="ui/f6/grid-start.html"}
+
+                    {* Form Summary Start *}
+                    {$ui = [
+                        'id'    => 'usageSettings',
+                        'title' => 'Global Settings Summary',
+                        'blockMultiEdit' => 1
+                    ]}
+                    {include file="ui/f6/form-summary-start.html"}
+
+                        <div class="cell small-12 callout glm-f6-ui-section-start">
+                            <div class="grid-x grid-margin-x">
+
+                                {* Sub-Section Start *}
+                                    {$ui = [
+                                    'title'    => '',
+                                    'wrapSize' => 6
+                                ]}
+                                {include file="ui/f6/sub-section-start.html"}
+
+
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Monthly Reporting Threshold:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">At or above {$threshold|string_format:"%.0f"}% of site's target levels</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Enable Sending Usage Reports:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if $sendReportsEnabled}YES{else}NO{/if}</div>
+
+                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Usage Report E-Mail "From:" Settings</u></div>
+
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Name:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($glmFromContact.name)}{$glmFromContact.name}{else}(Name not set){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>E-Mail Address:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($glmFromContact.name)}{$glmFromContact.email}{else}(Email not set){/if}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Subject:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{if !empty($glmFromContact.subject)}{$glmFromContact.subject}{else}(Subject not set){/if}</div>
+
+                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Usage Report E-Mail - Below Target %</u></div>
+
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Before Report:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{wpautop($glmReportEmail.before_report)}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>After Report:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{wpautop($glmReportEmail.after_report)}</div>
+
+                                {include file="ui/f6/sub-section-end.html"}
+
+                                {* Sub-Section Start *}
+                                    {$ui = [
+                                    'title'    => '',
+                                    'wrapSize' => 6
+                                ]}
+                                {include file="ui/f6/sub-section-start.html"}
+
+                                    <div class="cell small-12 large-12 glm-f6-ui-nowrap"><br><u>Usage Report E-Mail - Above Target %</u></div>
+
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>Before Report:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{wpautop($glmReportEmail.before_report_above_target)}</div>
+                                    <div class="cell small-12 medium-4 large-5 glm-f6-ui-nowrap"><b>After Report:</b></div>
+                                    <div class="cell small-12 medium-8 large-7">{wpautop($glmReportEmail.after_report_above_target)}</div>
+
+                                {include file="ui/f6/sub-section-end.html"}
+                            </div>
+                        </div>
+
+
+
+                    {include file="ui/f6/form-summary-end.html"}
+
+                    {* Form Edit Start *}
+                    {$ui = [
+                        'id'    => 'usageSettings',
+                        'title' => 'Edit Settings'
+                    ]}
+                    {include file="ui/f6/form-edit-start.html"}
+
+
                         {* Section Start *}
                         {$ui = [
                             'title' => 'Global Settings'
 
                             {* Sub-Section Start *}
                             {$ui = [
-                                'title' => '<b>NOTE: </b>The settings below affect all sites!'
+                                'title' => '<b>NOTE: </b>The settings below affect all sites!',
+                                'wrapSize' => 6
                             ]}
                             {include file="ui/f6/sub-section-start.html"}
 
 
                             {* Sub-Section Start *}
                             {$ui = [
-                                'title' => 'Usage Report E-mail "From" Information'
+                                'title' => 'Usage Report E-mail "From" Information',
+                                'wrapSize' => 6
                             ]}
                             {include file="ui/f6/sub-section-start.html"}
 
 
                             {* Sub-Section Start *}
                             {$ui = [
-                                'title' => 'Usage Report E-mail Text - Below Target %'
+                                'title' => 'Usage Report E-mail Text - Below Target %',
+                                'wrapSize' => 6
                             ]}
                             {include file="ui/f6/sub-section-start.html"}
 
 
                             {* Sub-Section Start *}
                             {$ui = [
-                                'title' => 'Usage Report E-mail Text - Above Target %'
+                                'title' => 'Usage Report E-mail Text - Above Target %',
+                                'wrapSize' => 6
                             ]}
                             {include file="ui/f6/sub-section-start.html"}
 
                         {* Submit Button *}
                         {$ui = [
                             'class'  => 'primary',
-                            'label'  => 'Update All Settings',
+                            'label'  => 'Update Global Settings',
                             'submit' => true
                         ]}
                         {include file="ui/f6/submit.html"}
 
-                    {include file="ui/f6/form-edit-end.html"}
+                   {include file="ui/f6/form-edit-end.html"}
 
                 {include file="ui/f6/grid-end.html"}
 
index 4ecc176..16e63e4 100644 (file)
@@ -30,6 +30,7 @@
                     $('#{$ui.id}_edit').fadeOut('slow', function() {
                         $('#{$ui.id}_summary').fadeIn('slow');
                     });
+                    $('#{$ui.id}_summary').removeClass('glm_f6_ui_editopen');
                 });
             });
         </script>
index 0e64cc2..b7a999b 100644 (file)
@@ -10,7 +10,8 @@
     {$ui = [
         'id'               => string   required  Form id,
         'title'            => string             Optional title,
-        'edit_button_text' => string             Optional custom button text - Default is "Edit"
+        'edit_button_text' => string             Optional custom button text - Default is "Edit",
+        'blockMultiEdit'   => boolean            Block selecting edit if another edit is open
     ]}
 *}
 {$editButtonText = 'Edit'}
             jQuery(document).ready(function($){
                 $('#{$ui.id}_summary').show();
                 $('#{$ui.id}_edit_button').click(function(){
-                    $('#{$ui.id}_summary').fadeOut('slow', function() {
-                        $('#{$ui.id}_edit').fadeIn('slow');
-                    });
+                    if ({if !empty($ui.blockMultiEdit)}1{else}0{/if} && $('.glm_f6_ui_editopen')[0]) {
+                        alert('Please submit or close other form before opening this form.');
+                    } else {
+                        $('#{$ui.id}_summary').fadeOut('slow', function() {
+                            $('#{$ui.id}_edit').fadeIn('slow');
+                        });
+                        $('#{$ui.id}_summary').addClass('glm_f6_ui_editopen');
+                    }
                 });
             });
         </script>