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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Sep 5 21:18:41 CEST 2011


Author: mattm
Date: 2011-09-05 21:18:39 +0200 (Mon, 05 Sep 2011)
New Revision: 11562

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/gsad.c
   trunk/gsa/src/gsad_omp.c
   trunk/gsa/src/html/omp.xsl
Log:
	Add report scrolling to Asset Details page.

	* src/gsad.c (init_validator): Add pos.
	(get_report_omp): Send host and pos to Manager.  Remove search_phrase
	hack.

	* src/gsad_omp.c (get_report_omp): If host is given send host as
	search_phrase and wrap in get_asset.

	* src/html/omp.xsl (host, report [assets]): Add report scrolling.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2011-09-05 19:15:40 UTC (rev 11561)
+++ trunk/gsa/ChangeLog	2011-09-05 19:18:39 UTC (rev 11562)
@@ -1,5 +1,18 @@
 2011-09-05  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	Add report scrolling to Asset Details page.
+
+	* src/gsad.c (init_validator): Add pos.
+	(get_report_omp): Send host and pos to Manager.  Remove search_phrase
+	hack.
+
+	* src/gsad_omp.c (get_report_omp): If host is given send host as
+	search_phrase and wrap in get_asset.
+
+	* src/html/omp.xsl (host, report [assets]): Add report scrolling.
+
+2011-09-05  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	Add Asset Details page.
 
 	* src/gsad_omp.c (get_report_omp): If host is given send host as

Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c	2011-09-05 19:15:40 UTC (rev 11561)
+++ trunk/gsa/src/gsad.c	2011-09-05 19:18:39 UTC (rev 11562)
@@ -688,6 +688,7 @@
   openvas_validator_alias (validator, "override_task_id", "optional_task_id");
   openvas_validator_alias (validator, "passphrase",   "lsc_password");
   openvas_validator_alias (validator, "password:name", "preference_name");
+  openvas_validator_alias (validator, "pos",           "number");
   openvas_validator_alias (validator, "result_hosts_only", "boolean");
   openvas_validator_alias (validator, "result_task_id", "optional_task_id");
   openvas_validator_alias (validator, "period",       "optional_number");

Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c	2011-09-05 19:15:40 UTC (rev 11561)
+++ trunk/gsa/src/gsad_omp.c	2011-09-05 19:18:39 UTC (rev 11562)
@@ -7186,7 +7186,7 @@
   const char *escalator_id, *search_phrase, *min_cvss_base, *type;
   const char *notes, *overrides, *result_hosts_only, *report_id, *sort_field;
   const char *sort_order, *result_id, *delta_report_id, *format_id;
-  const char *first_result, *max_results, *host;
+  const char *first_result, *max_results, *host, *pos;
 
   escalator_id = params_value (params, "escalator_id");
   if (escalator_id == NULL)
@@ -7214,6 +7214,7 @@
 
   type = params_value (params, "type");
   host = params_value (params, "host");
+  pos = params_value (params, "pos");
 
   notes = params_value (params, "notes");
   if (notes == NULL)
@@ -7494,7 +7495,8 @@
 
   if (openvas_server_sendf (&session,
                             "<get_reports"
-                            "%s"
+                            "%s%s%s%s"
+                            " pos=\"%s\""
                             " notes=\"%i\""
                             " notes_details=\"1\""
                             " apply_overrides=\"%i\""
@@ -7515,6 +7517,10 @@
                             (type && (strcmp (type, "assets") == 0))
                              ? " type=\"assets\""
                              : "",
+                            host ? " host=\"" : "",
+                            host ? host : "",
+                            host ? "\"" : "",
+                            pos ? pos : "1",
                             strcmp (notes, "0") ? 1 : 0,
                             strcmp (overrides, "0") ? 1 : 0,
                             strcmp (result_hosts_only, "0") ? 1 : 0,
@@ -7536,7 +7542,7 @@
                                 : "ascending"),
                             levels->str,
                             delta_states->str,
-                            host ? host : search_phrase,
+                            search_phrase,
                             min_cvss_base)
       == -1)
     {

Modified: trunk/gsa/src/html/omp.xsl
===================================================================
--- trunk/gsa/src/html/omp.xsl	2011-09-05 19:15:40 UTC (rev 11561)
+++ trunk/gsa/src/html/omp.xsl	2011-09-05 19:18:39 UTC (rev 11562)
@@ -10272,6 +10272,7 @@
        </a>
     </div>
     <div class="gb_window_part_content">
+      <xsl:variable name="report_count" select="detail[name = 'report_count' and source/name = 'openvasmd']/value"/>
       <div class="float_right">
         <a href="?cmd=get_report&amp;type=assets&amp;overrides=1&amp;levels=hm&amp;token={/envelope/token}">Back to Assets</a>
       </div>
@@ -10305,14 +10306,29 @@
           </td>
         </tr>
         <tr>
-          <td>Last Report:</td>
+          <td>Report:</td>
           <td>
             <xsl:choose>
               <xsl:when test="start/text() != ''">
-                <a href="/omp?cmd=get_report&amp;report_id={detail[name = 'report/@id' and source/name = 'openvasmd']/value}&amp;notes=1&amp;overrides=1&amp;result_hosts_only=1&amp;search_phrase={ip}&amp;token={/envelope/token}">
+                <xsl:variable name="pos" select="detail[name/text() = 'report/pos']/value"/>
+                <xsl:choose>
+                  <xsl:when test="$pos &lt; $report_count">
+                    <a href="/omp?cmd=get_report&amp;type=assets&amp;host={ip}&amp;pos={$pos + 1}&amp;notes=1&amp;overrides=1&amp;result_hosts_only=1&amp;search_phrase={}&amp;token={/envelope/token}">
+                      &lt;&lt;
+                    </a>
+                  </xsl:when>
+                </xsl:choose>
+                <a style="margin-left: 5px; margin-right: 5px;" href="/omp?cmd=get_report&amp;report_id={detail[name = 'report/@id' and source/name = 'openvasmd']/value}&amp;notes=1&amp;overrides=1&amp;result_hosts_only=1&amp;search_phrase={ip}&amp;token={/envelope/token}">
                   <xsl:value-of select="substring(start/text(),5,6)"/>
                   <xsl:value-of select="substring(start/text(),20,21)"/>
                 </a>
+                <xsl:choose>
+                  <xsl:when test="$pos &gt; 1">
+                    <a href="/omp?cmd=get_report&amp;type=assets&amp;host={ip}&amp;pos={$pos - 1}&amp;notes=1&amp;overrides=1&amp;result_hosts_only=1&amp;search_phrase={}&amp;token={/envelope/token}">
+                      &gt;&gt;
+                    </a>
+                  </xsl:when>
+                </xsl:choose>
               </xsl:when>
               <xsl:otherwise>(not finished)</xsl:otherwise>
             </xsl:choose>
@@ -10346,7 +10362,7 @@
         <tr>
           <td>Reports:</td>
           <td>
-            <xsl:value-of select="detail[name = 'report_count' and source/name = 'openvasmd']/value"/>
+            <xsl:value-of select="$report_count"/>
           </td>
         </tr>
         <tr>
@@ -11259,7 +11275,7 @@
           </xsl:choose>
         </td>
         <td>
-          <a href="/omp?cmd=get_report&amp;type=assets&amp;get_asset=1&amp;host={ip}&amp;notes=1&amp;overrides=1&amp;result_hosts_only=1&amp;search_phrase={ip}&amp;token={/envelope/token}"
+          <a href="/omp?cmd=get_report&amp;type=assets&amp;host={ip}&amp;pos=1&amp;notes=1&amp;overrides=1&amp;result_hosts_only=1&amp;search_phrase={}&amp;token={/envelope/token}"
              title="Asset Details" style="margin-left:3px;">
             <img src="/img/details.png" border="0" alt="Details"/>
           </a>



More information about the Openvas-commits mailing list