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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 30 07:36:49 CET 2011


Author: mattm
Date: 2011-11-30 07:36:45 +0100 (Wed, 30 Nov 2011)
New Revision: 12218

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/gsad_omp.c
   trunk/gsa/src/html/omp.xsl
Log:
	Get the result details delta case of the override edit icons working.

	* src/gsad_omp.c (edit_override_omp): Make param errors a bit nicer.
	(save_override_omp): For get_result call get_report for the delta case
	instead of get_result.

	* src/html/omp.xsl (note-detailed): Correct edit icons min_cvss_base path.
	(override-detailed): Add delta result details cases of the edit icons.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2011-11-29 20:14:19 UTC (rev 12217)
+++ trunk/gsa/ChangeLog	2011-11-30 06:36:45 UTC (rev 12218)
@@ -1,3 +1,14 @@
+2011-11-30  Matthew Mundell <matthew.mundell at greenbone.net>
+
+	Get the result details delta case of the override edit icons working.
+
+	* src/gsad_omp.c (edit_override_omp): Make param errors a bit nicer.
+	(save_override_omp): For get_result call get_report for the delta case
+	instead of get_result.
+
+	* src/html/omp.xsl (note-detailed): Correct edit icons min_cvss_base path.
+	(override-detailed): Add delta result details cases of the edit icons.
+
 2011-11-29  Matthew Mundell <matthew.mundell at greenbone.net>
 
 	Get the result details delta case of the note edit icons working.

Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c	2011-11-29 20:14:19 UTC (rev 12217)
+++ trunk/gsa/src/gsad_omp.c	2011-11-30 06:36:45 UTC (rev 12218)
@@ -10985,23 +10985,17 @@
   if ((strcmp (next, "get_result") == 0)
       || (strcmp (next, "get_report") == 0))
     {
-      if ((params_value (params, "report_id") == NULL)
-          || (params_value (params, "first_result") == NULL)
-          || (params_value (params, "max_results") == NULL)
-          || (params_value (params, "sort_field") == NULL)
-          || (params_value (params, "sort_order") == NULL)
-          || (params_value (params, "levels") == NULL)
-          || (params_value (params, "notes") == NULL)
-          || (params_value (params, "overrides") == NULL)
-          || (params_value (params, "result_hosts_only") == NULL)
-          || (params_value (params, "search_phrase") == NULL)
-          || (params_value (params, "min_cvss_base") == NULL))
-        return gsad_message (credentials,
-                             "Internal error", __FUNCTION__, __LINE__,
-                             "An internal error occurred while editing an override. "
-                             "The override remains as it was. "
-                             "Diagnostics: Required parameter was NULL.",
-                             "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("report_id", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("first_result", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("max_results", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("sort_field", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("sort_order", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("levels", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("notes", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("overrides", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("result_hosts_only", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("search_phrase", "/omp?cmd=get_overrides");
+      REQUIRE_PARAM ("min_cvss_base", "/omp?cmd=get_overrides");
 
       if (sscanf (params_value (params, "first_result"), "%u", &first_result)
           != 1)
@@ -11364,16 +11358,29 @@
 
   if (strcmp (next, "get_result") == 0)
     {
-      gchar *first = g_strdup_printf ("%u", first_result);
-      gchar *max = g_strdup_printf ("%u", max_results);
-      char *ret = get_result (credentials, result_id, task_id, task_name,
-                              overrides, modify_override, report_id,
-                              first, max, levels, search_phrase, notes,
-                              overrides, min_cvss_base, result_hosts_only,
-                              sort_field, sort_order, NULL, NULL);
+      char *ret;
+
+      if (params_value (params, "delta_report_id"))
+        ret = get_report (credentials, params, modify_override, NULL, NULL,
+                          NULL);
+      else
+        {
+          gchar *first, *max;
+
+          first = g_strdup_printf ("%u", first_result);
+          max = g_strdup_printf ("%u", max_results);
+
+          ret = get_result (credentials, result_id, task_id, task_name,
+                            overrides, modify_override, report_id,
+                            first, max, levels, search_phrase, notes,
+                            overrides, min_cvss_base, result_hosts_only,
+                            sort_field, sort_order, NULL, NULL);
+
+          g_free (first);
+          g_free (max);
+        }
+
       g_free (modify_override);
-      g_free (first);
-      g_free (max);
       return ret;
     }
 

Modified: trunk/gsa/src/html/omp.xsl
===================================================================
--- trunk/gsa/src/html/omp.xsl	2011-11-29 20:14:19 UTC (rev 12217)
+++ trunk/gsa/src/html/omp.xsl	2011-11-30 06:36:45 UTC (rev 12218)
@@ -11723,14 +11723,14 @@
         </a>
         <xsl:choose>
           <xsl:when test="$next='get_result' and $delta = 1">
-            <a href="/omp?cmd=edit_note&amp;note_id={@id}&amp;next=get_result&amp;result_id={../../@id}&amp;task_id={../../../../task/@id}&amp;name={../../../../task/name}&amp;report_id={../../../../../report/@id}&amp;first_result={../../../../results/@start}&amp;max_results={../../../../results/@max}&amp;sort_field={../../../../sort/field/text()}&amp;sort_order={../../../../sort/field/order}&amp;levels={../../../../filters/text()}&amp;notes={../../../../filters/notes}&amp;overrides={../../../../filters/apply_overrides}&amp;result_hosts_only={../../../../filters/result_hosts_only}&amp;search_phrase={../../../../filters/phrase}&amp;min_cvss_base={../../../../filters/min_cvss_base}&amp;apply_min_cvss_base={number (string-length (../../../../../../filters/min_cvss_base) &gt; 0)}&amp;delta_report_id={../../../../delta/report/@id}&amp;delta_states={../../../../filters/delta/text()}&amp;token={/envelope/token}"
+            <a href="/omp?cmd=edit_note&amp;note_id={@id}&amp;next=get_result&amp;result_id={../../@id}&amp;task_id={../../../../task/@id}&amp;name={../../../../task/name}&amp;report_id={../../../../../report/@id}&amp;first_result={../../../../results/@start}&amp;max_results={../../../../results/@max}&amp;sort_field={../../../../sort/field/text()}&amp;sort_order={../../../../sort/field/order}&amp;levels={../../../../filters/text()}&amp;notes={../../../../filters/notes}&amp;overrides={../../../../filters/apply_overrides}&amp;result_hosts_only={../../../../filters/result_hosts_only}&amp;search_phrase={../../../../filters/phrase}&amp;min_cvss_base={../../../../filters/min_cvss_base}&amp;apply_min_cvss_base={number (string-length (../../../../filters/min_cvss_base) &gt; 0)}&amp;delta_report_id={../../../../delta/report/@id}&amp;delta_states={../../../../filters/delta/text()}&amp;token={/envelope/token}"
                title="Edit Note"
                style="margin-left:3px;">
               <img src="/img/edit.png" border="0" alt="Edit"/>
             </a>
           </xsl:when>
           <xsl:when test="$next='get_result' and $delta = 2">
-            <a href="/omp?cmd=edit_note&amp;note_id={@id}&amp;next=get_result&amp;result_id={../../../@id}&amp;task_id={../../../../../task/@id}&amp;name={../../../../../task/name}&amp;report_id={../../../../../@id}&amp;first_result={../../../../../results/@start}&amp;max_results={../../../../../results/@max}&amp;sort_field={../../../../../sort/field/text()}&amp;sort_order={../../../../../sort/field/order}&amp;levels={../../../../../filters/text()}&amp;notes={../../../../../filters/notes}&amp;overrides={../../../../../filters/apply_overrides}&amp;result_hosts_only={../../../../../filters/result_hosts_only}&amp;search_phrase={../../../../../filters/phrase}&amp;min_cvss_base={../../../../../filters/min_cvss_base}&amp;apply_min_cvss_base={number (string-length (../../../../../../filters/min_cvss_base) &gt; 0)}&amp;delta_report_id={../../../../../delta/report/@id}&amp;delta_states={../../../../../filters/delta/text()}&amp;token={/envelope/token}"
+            <a href="/omp?cmd=edit_note&amp;note_id={@id}&amp;next=get_result&amp;result_id={../../../@id}&amp;task_id={../../../../../task/@id}&amp;name={../../../../../task/name}&amp;report_id={../../../../../@id}&amp;first_result={../../../../../results/@start}&amp;max_results={../../../../../results/@max}&amp;sort_field={../../../../../sort/field/text()}&amp;sort_order={../../../../../sort/field/order}&amp;levels={../../../../../filters/text()}&amp;notes={../../../../../filters/notes}&amp;overrides={../../../../../filters/apply_overrides}&amp;result_hosts_only={../../../../../filters/result_hosts_only}&amp;search_phrase={../../../../../filters/phrase}&amp;min_cvss_base={../../../../../filters/min_cvss_base}&amp;apply_min_cvss_base={number (string-length (../../../../../filters/min_cvss_base) &gt; 0)}&amp;delta_report_id={../../../../../delta/report/@id}&amp;delta_states={../../../../../filters/delta/text()}&amp;token={/envelope/token}"
                title="Edit Note"
                style="margin-left:3px;">
               <img src="/img/edit.png" border="0" alt="Edit"/>
@@ -11903,6 +11903,20 @@
           <img src="/img/details.png" border="0" alt="Details"/>
         </a>
         <xsl:choose>
+          <xsl:when test="$next='get_result' and $delta = 1">
+            <a href="/omp?cmd=edit_override&amp;override_id={@id}&amp;next=get_result&amp;result_id={../../@id}&amp;task_id={../../../../task/@id}&amp;name={../../../../task/name}&amp;report_id={../../../../../@id}&amp;first_result={../../../../results/@start}&amp;max_results={../../../../results/@max}&amp;sort_field={../../../../sort/field/text()}&amp;sort_order={../../../../sort/field/order}&amp;levels={../../../../filters/text()}&amp;notes={../../../../filters/notes}&amp;overrides={../../../../filters/overrides}&amp;result_hosts_only={../../../../filters/result_hosts_only}&amp;search_phrase={../../../../filters/phrase}&amp;min_cvss_base={../../../../filters/min_cvss_base}&amp;apply_min_cvss_base={number (string-length (../../../../filters/min_cvss_base) &gt; 0)}&amp;delta_report_id={../../../../delta/report/@id}&amp;delta_states={../../../../filters/delta/text()}&amp;token={/envelope/token}"
+               title="Edit Override"
+               style="margin-left:3px;">
+              <img src="/img/edit.png" border="0" alt="Edit"/>
+            </a>
+          </xsl:when>
+          <xsl:when test="$next='get_result' and $delta = 2">
+            <a href="/omp?cmd=edit_override&amp;override_id={@id}&amp;next=get_result&amp;result_id={../../../@id}&amp;task_id={../../../../../task/@id}&amp;name={../../../../../task/name}&amp;report_id={../../../../../@id}&amp;first_result={../../../../../results/@start}&amp;max_results={../../../../../results/@max}&amp;sort_field={../../../../../sort/field/text()}&amp;sort_order={../../../../../sort/field/order}&amp;levels={../../../../../filters/text()}&amp;notes={../../../../../filters/notes}&amp;overrides={../../../../../filters/overrides}&amp;result_hosts_only={../../../../../filters/result_hosts_only}&amp;search_phrase={../../../../../filters/phrase}&amp;min_cvss_base={../../../../../filters/min_cvss_base}&amp;apply_min_cvss_base={number (string-length (../../../../../filters/min_cvss_base) &gt; 0)}&amp;delta_report_id={../../../../../delta/report/@id}&amp;delta_states={../../../../../filters/delta/text()}&amp;token={/envelope/token}"
+               title="Edit Override"
+               style="margin-left:3px;">
+              <img src="/img/edit.png" border="0" alt="Edit"/>
+            </a>
+          </xsl:when>
           <xsl:when test="$next='get_result'">
             <a href="/omp?cmd=edit_override&amp;override_id={@id}&amp;next=get_result&amp;result_id={../../@id}&amp;task_id={../../../../../../task/@id}&amp;name={../../../../../../task/name}&amp;report_id={../../../../../../report/@id}&amp;first_result={../../../../../../results/@start}&amp;max_results={../../../../../../results/@max}&amp;sort_field={../../../../../../sort/field/text()}&amp;sort_order={../../../../../../sort/field/order}&amp;levels={../../../../../../filters/text()}&amp;notes={../../../../../../filters/notes}&amp;overrides={../../../../../../filters/overrides}&amp;result_hosts_only={../../../../../../filters/result_hosts_only}&amp;search_phrase={../../../../../../filters/phrase}&amp;min_cvss_base={../../../../../../filters/min_cvss_base}&amp;apply_min_cvss_base={number (string-length (../../../../../../filters/min_cvss_base) &gt; 0)}&amp;token={/envelope/token}"
                title="Edit Override"



More information about the Openvas-commits mailing list