[Openvas-commits] r13213 - in trunk/gsa: . src src/html

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Mon Apr 9 11:04:57 CEST 2012


Author: mattm
Date: 2012-04-09 11:04:57 +0200 (Mon, 09 Apr 2012)
New Revision: 13213

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/gsad.c
   trunk/gsa/src/gsad_omp.c
   trunk/gsa/src/html/omp.xsl
Log:
	* src/gsad.c (init_validator): Allow max to be negative and empty.

	* src/gsad_omp.c (create_target_omp): Add max to GET_TARGETS.
	(get_targets_omp): If max is NULL use -2 instead of -1, to get the Rows
	Per Page rows instead of all rows.

	* src/html/omp.xsl (html-targets-table): Use -2 for max in reset, to get
	Rows Per Page rows instead of all.  When Rows is -1 make it empty, because
	that looks nicer.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2012-04-09 08:59:24 UTC (rev 13212)
+++ trunk/gsa/ChangeLog	2012-04-09 09:04:57 UTC (rev 13213)
@@ -1,3 +1,15 @@
+2012-04-09  Matthew Mundell <matthew.mundell at greenbone.net>
+
+	* src/gsad.c (init_validator): Allow max to be negative and empty.
+
+	* src/gsad_omp.c (create_target_omp): Add max to GET_TARGETS.
+	(get_targets_omp): If max is NULL use -2 instead of -1, to get the Rows
+	Per Page rows instead of all rows.
+
+	* src/html/omp.xsl (html-targets-table): Use -2 for max in reset, to get
+	Rows Per Page rows instead of all.  When Rows is -1 make it empty, because
+	that looks nicer.
+
 2012-04-06  Matthew Mundell <matthew.mundell at greenbone.net>
 
 	* src/html/omp.xsl (get_trash): Correct odds and evens.

Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c	2012-04-09 08:59:24 UTC (rev 13212)
+++ trunk/gsa/src/gsad.c	2012-04-09 09:04:57 UTC (rev 13213)
@@ -665,7 +665,7 @@
   openvas_validator_add (validator, "format_id", "^[a-z0-9\\-]+$");
   /* Validator for  modify_auth group, e.g. "method:ldap". */
   openvas_validator_add (validator, "group",        "^method:(ads|ldap|ldap_connect)$");
-  openvas_validator_add (validator, "max",          "^[0-9]+$");
+  openvas_validator_add (validator, "max",          "^(-?[0-9]+|)$");
   openvas_validator_add (validator, "max_results",  "^[0-9]+$");
   openvas_validator_add (validator, "format",     "^[-[:alnum:]]{1,15}$");
   openvas_validator_add (validator, "host",       "^[[:alnum:]\\.]{1,80}$");

Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c	2012-04-09 08:59:24 UTC (rev 13212)
+++ trunk/gsa/src/gsad_omp.c	2012-04-09 09:04:57 UTC (rev 13213)
@@ -4455,6 +4455,7 @@
 
   if (openvas_server_sendf_xml (&session,
                                "<get_targets"
+                               " max=\"-2\""
                                " filter=\"%s\""
                                " sort_field=\"name\""
                                " sort_order=\"ascending\"/>",
@@ -5764,7 +5765,7 @@
                                 " sort_order=\"%s\"/>",
                                 filter ? filter : "",
                                 first ? first : "1",
-                                max ? max : "-1",
+                                max ? max : "-2",
                                 sort_field ? sort_field : "name",
                                 sort_order ? sort_order : "ascending")
       == -1)

Modified: trunk/gsa/src/html/omp.xsl
===================================================================
--- trunk/gsa/src/html/omp.xsl	2012-04-09 08:59:24 UTC (rev 13212)
+++ trunk/gsa/src/html/omp.xsl	2012-04-09 09:04:57 UTC (rev 13213)
@@ -5417,7 +5417,7 @@
               <input type="submit" value="Reset" title="Reset"/>
             <input type="hidden" name="filter" value=""/>
             <input type="hidden" name="first" value=""/>
-            <input type="hidden" name="max" value=""/>
+            <input type="hidden" name="max" value="-2"/>
           </form>
         </div>
         <form action="" method="get">
@@ -5436,9 +5436,18 @@
                    value="{targets/@start}"
                    maxlength="400"/>
             Rows:
-            <input type="text" name="max" size="5"
-                   value="{targets/@max}"
-                   maxlength="400"/>
+            <xsl:choose>
+              <xsl:when test="targets/@max = '-1'">
+                <input type="text" name="max" size="5"
+                       value=""
+                       maxlength="400"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <input type="text" name="max" size="5"
+                       value="{targets/@max}"
+                       maxlength="400"/>
+              </xsl:otherwise>
+            </xsl:choose>
           </div>
         </form>
       </div>



More information about the Openvas-commits mailing list