Author: jfthomps
Date: Fri Jun 23 19:54:55 2017
New Revision: 1799697

URL: http://svn.apache.org/viewvc?rev=1799697&view=rev
Log:
VCL-919 - Allow customization of notification messages sent to users

siteconfig.php:
-modified Messages::getHTML: moved html for invalidmsgfieldspane to an earlier 
part of the html so that the box defaults to a higher position; it was a little 
out of the messages box
-modified AJvalidateMessagesPoll: no longer depend on 
usermessage_needs_validating (backend removed the entry); just look for and 
user message fields that were not set by the webcode and contain "invalidfields"

siteconfig.js: modified messages.prototype.updateInvalidContent: updated to 
handle invalid fields being separated into keys (i.e. message, subject, etc)

Modified:
    vcl/trunk/web/.ht-inc/siteconfig.php
    vcl/trunk/web/js/siteconfig.js

Modified: vcl/trunk/web/.ht-inc/siteconfig.php
URL: 
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/siteconfig.php?rev=1799697&r1=1799696&r2=1799697&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/siteconfig.php (original)
+++ vcl/trunk/web/.ht-inc/siteconfig.php Fri Jun 23 19:54:55 2017
@@ -3170,6 +3170,30 @@ class Messages {
                        $h .= "</div>\n";
                }
 
+               $h .= "<div dojoType=dojox.layout.FloatingPane\n";
+               $h .= "      id=\"invalidmsgfieldspane\"\n";
+               $h .= "      resizable=\"true\"\n";
+               $h .= "      closable=\"true\"\n";
+               $h .= "      title=\"" . i("Invalid Message Fields") . "\"\n";
+               $h .= "      style=\"width: 400px; ";
+               $h .=               "height: 200px; ";
+               $h .=               "visibility: hidden; ";
+               $h .=               "text-align: left; ";
+               $h .=               "border: solid 2px red;\"\n";
+               $h .= ">\n";
+               $h .= "<script type=\"dojo/method\" event=\"minimize\">\n";
+               $h .= "  this.hide();\n";
+               $h .= "</script>\n";
+               $h .= "<script type=\"dojo/method\" event=\"close\">\n";
+               $h .= "  this.hide();\n";
+               $h .= "  return false;\n";
+               $h .= "</script>\n";
+               $h .= "<div style=\"padding: 4px;\">\n";
+               $h .= _("The following messages have invalid items included for 
substitution. Please correct the message contents and save them again for the 
backend to validate.") . "<br><br>\n";
+               $h .= "   <div id=\"invalidmsgfieldcontent\"></div>\n";
+               $h .= "</div>\n";
+               $h .= "</div>\n";
+
                $h .= "<br>\n";
                $h .= "<div id=\"defaultmessagesdiv\" class=\"hidden 
highlightnotice\"><br><strong>";
                $h .= i('There is no message set specifically for this 
affiliation. The default message is being used and is displayed below.');
@@ -3213,30 +3237,6 @@ class Messages {
                $h .= "   </div>\n";
                $h .= "</div>\n";
 
-               $h .= "<div dojoType=dojox.layout.FloatingPane\n";
-               $h .= "      id=\"invalidmsgfieldspane\"\n";
-               $h .= "      resizable=\"true\"\n";
-               $h .= "      closable=\"true\"\n";
-               $h .= "      title=\"" . i("Invalid Message Fields") . "\"\n";
-               $h .= "      style=\"width: 400px; ";
-               $h .=               "height: 200px; ";
-               $h .=               "visibility: hidden; ";
-               $h .=               "text-align: left; ";
-               $h .=               "border: solid 2px red;\"\n";
-               $h .= ">\n";
-               $h .= "<script type=\"dojo/method\" event=\"minimize\">\n";
-               $h .= "  this.hide();\n";
-               $h .= "</script>\n";
-               $h .= "<script type=\"dojo/method\" event=\"close\">\n";
-               $h .= "  this.hide();\n";
-               $h .= "  return false;\n";
-               $h .= "</script>\n";
-               $h .= "<div style=\"padding: 4px;\">\n";
-               $h .= _("The following messages have invalid items included for 
substitution. Please correct the message contents and save them again for the 
backend to validate.") . "<br><br>\n";
-               $h .= "   <div id=\"invalidmsgfieldcontent\"></div>\n";
-               $h .= "</div>\n";
-               $h .= "</div>\n";
-
                $cdata = $this->basecdata;
                $h .= "<div id=\"messagesmsg\"></div>\n";
                $cont = addContinuationsEntry('AJsaveMessages', $cdata);
@@ -3371,14 +3371,12 @@ class Messages {
        ///
        
////////////////////////////////////////////////////////////////////////////////
        function AJvalidateMessagesPoll() {
-               $query = "SELECT v1.name, "
-                      .        "v1.value "
-                      . "FROM variable v1, "
-                      .      "variable v2 "
-                      . "WHERE v1.setby != 'webcode' AND "
-                      .       "v1.setby IS NOT NULL AND "
-                      .       "v2.name = 'usermessage_needs_validating' AND "
-                      .       "v1.timestamp > DATE_SUB(v2.timestamp, INTERVAL 
5 MINUTE)";
+               $query = "SELECT name, "
+                      .        "value "
+                      . "FROM variable "
+                      . "WHERE setby != 'webcode' AND "
+                      .       "setby IS NOT NULL AND "
+                      .       "value LIKE '%invalidfields%'";
                $qh = doQuery($query);
                $invalids = array();
                while($row = mysql_fetch_assoc($qh)) {

Modified: vcl/trunk/web/js/siteconfig.js
URL: 
http://svn.apache.org/viewvc/vcl/trunk/web/js/siteconfig.js?rev=1799697&r1=1799696&r2=1799697&view=diff
==============================================================================
--- vcl/trunk/web/js/siteconfig.js (original)
+++ vcl/trunk/web/js/siteconfig.js Fri Jun 23 19:54:55 2017
@@ -790,19 +790,21 @@ messages.prototype.updateInvalidContent
                var item = this.invalids[key];
                if(parts.length == 2) {
                        msg += 'Message: ' + parts[0] + ' -&gt; ' + parts[1] + 
'<br>';
-                       for(var i = 0; i < item.length; i++) {
-                               msg += item[i] + '<br>';
-                       }
-                       msg += '<br>';
                }
                else {
                        msg += 'Affiliation: ' + parts[2] + '<br>';
                        msg += 'Message: ' + parts[0] + ' -&gt; ' + parts[1] + 
'<br>';
-                       for(var i = 0; i < item.length; i++) {
-                               msg += item[i] + '<br>';
+               }
+
+               for(key in item) {
+                       if(item === undefined)
+                               continue;
+                       msg += key + ":<br>";
+                       for(var i = 0; i < item[key].length; i++) {
+                               msg += '&nbsp;&nbsp;' + item[key][i] + '<br>';
                        }
-                       msg += '<br>';
                }
+               msg += '<br>';
        }
        dojo.byId('invalidmsgfieldcontent').innerHTML = msg;
        if(dijit.byId('invalidmsgfieldspane').domNode.style.visibility != 
'visible')


Reply via email to