[Openvas-commits] r12217 - in trunk/gsa: . src src/html
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Nov 29 21:14:20 CET 2011
Author: mattm
Date: 2011-11-29 21:14:19 +0100 (Tue, 29 Nov 2011)
New Revision: 12217
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 note edit icons working.
* src/gsad_omp.c (REQUIRE_PARAM): New macro.
(edit_note_omp): Make param errors a bit nicer.
(save_note_omp): For get_result call get_report for the delta case instead
of get_result.
* src/html/omp.xsl (note-detailed): Add delta result details cases of the
edit icons.
Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog 2011-11-29 18:13:16 UTC (rev 12216)
+++ trunk/gsa/ChangeLog 2011-11-29 20:14:19 UTC (rev 12217)
@@ -1,5 +1,17 @@
2011-11-29 Matthew Mundell <matthew.mundell at greenbone.net>
+ Get the result details delta case of the note edit icons working.
+
+ * src/gsad_omp.c (REQUIRE_PARAM): New macro.
+ (edit_note_omp): Make param errors a bit nicer.
+ (save_note_omp): For get_result call get_report for the delta case instead
+ of get_result.
+
+ * src/html/omp.xsl (note-detailed): Add delta result details cases of the
+ edit icons.
+
+2011-11-29 Matthew Mundell <matthew.mundell at greenbone.net>
+
Get the note and override delete icons working, even directly after a
delete operation.
Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c 2011-11-29 18:13:16 UTC (rev 12216)
+++ trunk/gsa/src/gsad_omp.c 2011-11-29 20:14:19 UTC (rev 12217)
@@ -8454,6 +8454,16 @@
"\" was NULL.", \
backurl)
+#define REQUIRE_PARAM(arg, backurl) \
+ if (params_value (params, arg) == NULL) \
+ return gsad_message (credentials, \
+ "Internal error", __FUNCTION__, __LINE__, \
+ "An internal error occurred." \
+ " Diagnostics: Required parameter \"" \
+ arg \
+ "\" was NULL.", \
+ backurl)
+
/**
* @brief Get one result, XSL transform the result.
*
@@ -9595,23 +9605,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 a note. "
- "The note remains as it was. "
- "Diagnostics: Required parameter was NULL.",
- "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("report_id", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("first_result", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("max_results", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("sort_field", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("sort_order", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("levels", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("notes", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("overrides", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("result_hosts_only", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("search_phrase", "/omp?cmd=get_notes");
+ REQUIRE_PARAM ("min_cvss_base", "/omp?cmd=get_notes");
if (sscanf (params_value (params, "first_result"), "%u", &first_result)
!= 1)
@@ -9971,16 +9975,28 @@
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_note, 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_note, 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_note, 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_note);
- g_free (first);
- g_free (max);
return ret;
}
Modified: trunk/gsa/src/html/omp.xsl
===================================================================
--- trunk/gsa/src/html/omp.xsl 2011-11-29 18:13:16 UTC (rev 12216)
+++ trunk/gsa/src/html/omp.xsl 2011-11-29 20:14:19 UTC (rev 12217)
@@ -11722,6 +11722,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_note&note_id={@id}&next=get_result&result_id={../../@id}&task_id={../../../../task/@id}&name={../../../../task/name}&report_id={../../../../../report/@id}&first_result={../../../../results/@start}&max_results={../../../../results/@max}&sort_field={../../../../sort/field/text()}&sort_order={../../../../sort/field/order}&levels={../../../../filters/text()}&notes={../../../../filters/notes}&overrides={../../../../filters/apply_overrides}&result_hosts_only={../../../../filters/result_hosts_only}&search_phrase={../../../../filters/phrase}&min_cvss_base={../../../../filters/min_cvss_base}&apply_min_cvss_base={number (string-length (../../../../../../filters/min_cvss_base) > 0)}&delta_report_id={../../../../delta/report/@id}&delta_states={../../../../filters/delta/text()}&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&note_id={@id}&next=get_result&result_id={../../../@id}&task_id={../../../../../task/@id}&name={../../../../../task/name}&report_id={../../../../../@id}&first_result={../../../../../results/@start}&max_results={../../../../../results/@max}&sort_field={../../../../../sort/field/text()}&sort_order={../../../../../sort/field/order}&levels={../../../../../filters/text()}&notes={../../../../../filters/notes}&overrides={../../../../../filters/apply_overrides}&result_hosts_only={../../../../../filters/result_hosts_only}&search_phrase={../../../../../filters/phrase}&min_cvss_base={../../../../../filters/min_cvss_base}&apply_min_cvss_base={number (string-length (../../../../../../filters/min_cvss_base) > 0)}&delta_report_id={../../../../../delta/report/@id}&delta_states={../../../../../filters/delta/text()}&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'">
<a href="/omp?cmd=edit_note&note_id={@id}&next=get_result&result_id={../../@id}&task_id={../../../../../../task/@id}&name={../../../../../../task/name}&report_id={../../../../../../report/@id}&first_result={../../../../../../results/@start}&max_results={../../../../../../results/@max}&sort_field={../../../../../../sort/field/text()}&sort_order={../../../../../../sort/field/order}&levels={../../../../../../filters/text()}&notes={../../../../../../filters/notes}&overrides={../../../../../../filters/apply_overrides}&result_hosts_only={../../../../../../filters/result_hosts_only}&search_phrase={../../../../../../filters/phrase}&min_cvss_base={../../../../../../filters/min_cvss_base}&apply_min_cvss_base={number (string-length (../../../../../../filters/min_cvss_base) > 0)}&token={/envelope/token}"
title="Edit Note"
More information about the Openvas-commits
mailing list