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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 23 18:59:28 CET 2011


Author: mattm
Date: 2011-11-23 18:59:27 +0100 (Wed, 23 Nov 2011)
New Revision: 12175

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/gsad_omp.c
   trunk/gsa/src/html/omp.xsl
Log:
	* src/gsad_omp.c (create_note_omp, save_note_omp): Pass active state
	through.

	* src/html/omp.xsl (html-report-table, note, html-notes-table): Add active
	column.
	(html-create-note-form, html-edit-note-form): Add active field.
	(note [details]): Add active field.
	(note-detailed): Add active status above modification time.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2011-11-23 17:55:02 UTC (rev 12174)
+++ trunk/gsa/ChangeLog	2011-11-23 17:59:27 UTC (rev 12175)
@@ -1,3 +1,14 @@
+2011-11-23  Matthew Mundell <matthew.mundell at greenbone.net>
+
+	* src/gsad_omp.c (create_note_omp, save_note_omp): Pass active state
+	through.
+
+	* src/html/omp.xsl (html-report-table, note, html-notes-table): Add active
+	column.
+	(html-create-note-form, html-edit-note-form): Add active field.
+	(note [details]): Add active field.
+	(note-detailed): Add active status above modification time.
+
 2011-11-23  Michael Wiegand <michael.wiegand at greenbone.net>
 
 	Post release version bump.

Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c	2011-11-23 17:55:02 UTC (rev 12174)
+++ trunk/gsa/src/gsad_omp.c	2011-11-23 17:59:27 UTC (rev 12175)
@@ -8934,7 +8934,8 @@
   const char *min_cvss_base, *text, *task_id;
   /* For get_report. */
   const char *levels, *result_hosts_only, *notes, *overrides, *report_id;
-  const char *first_result, *max_results, *sort_order, *sort_field;
+  const char *first_result, *max_results, *sort_order, *sort_field, *active;
+  const char *days;
 
   next = params_value (params, "next");
   search_phrase = params_value (params, "search_phrase");
@@ -9008,7 +9009,9 @@
                          "Diagnostics: OID was NULL.",
                          "/omp?cmd=get_notes");
 
-  if (threat == NULL || port == NULL || hosts == NULL)
+  active = params_value (params, "active");
+
+  if (threat == NULL || port == NULL || hosts == NULL || active == NULL)
     return gsad_message (credentials,
                          "Internal error", __FUNCTION__, __LINE__,
                          "An internal error occurred while creating a new note. "
@@ -9044,6 +9047,7 @@
   text = params_value (params, "text");
 
   create_note = g_strdup_printf ("<create_note>"
+                                 "<active>%s</active>"
                                  "<nvt oid=\"%s\"/>"
                                  "<hosts>%s</hosts>"
                                  "<port>%s</port>"
@@ -9052,6 +9056,9 @@
                                  "<task id=\"%s\"/>"
                                  "<result id=\"%s\"/>"
                                  "</create_note>",
+                                 strcmp (active, "1")
+                                  ? active
+                                  : (days ? days : "-1"),
                                  oid,
                                  hosts,
                                  port,
@@ -9816,7 +9823,7 @@
   unsigned int first_result, max_results;
   const char *sort_field, *sort_order, *levels, *notes, *overrides;
   const char *result_hosts_only, *search_phrase, *min_cvss_base;
-  const char *oid, *task_id, *task_name, *result_id;
+  const char *oid, *task_id, *task_name, *result_id, *active, *days;
 
   note_id = params_value (params, "note_id");
 
@@ -9869,8 +9876,10 @@
   task_id = params_value (params, "task_id");
   task_name = params_value (params, "name");
   result_id = params_value (params, "result_id");
+  active = params_value (params, "active");
 
-  if (next == NULL || note_task_id == NULL || note_result_id == NULL)
+  if (next == NULL || note_task_id == NULL || note_result_id == NULL
+      || active == NULL)
     return gsad_message (credentials,
                          "Internal error", __FUNCTION__, __LINE__,
                          "An internal error occurred while saving a note. "
@@ -9985,6 +9994,7 @@
     }
 
   modify_note = g_strdup_printf ("<modify_note note_id=\"%s\">"
+                                 "<active>%s</active>"
                                  "<hosts>%s</hosts>"
                                  "<port>%s</port>"
                                  "<threat>%s</threat>"
@@ -9993,6 +10003,9 @@
                                  "<result id=\"%s\"/>"
                                  "</modify_note>",
                                  note_id,
+                                 strcmp (active, "1")
+                                  ? active
+                                  : (days ? days : "-1"),
                                  hosts ? hosts : "",
                                  port ? port : "",
                                  threat ? threat : "",

Modified: trunk/gsa/src/html/omp.xsl
===================================================================
--- trunk/gsa/src/html/omp.xsl	2011-11-23 17:55:02 UTC (rev 12174)
+++ trunk/gsa/src/html/omp.xsl	2011-11-23 17:59:27 UTC (rev 12175)
@@ -2412,6 +2412,7 @@
           <tr class="gbntablehead2">
             <td>NVT</td>
             <td>Text</td>
+            <td>Active</td>
             <td width="100">Actions</td>
           </tr>
           <xsl:variable name="task_id"><xsl:value-of select="task/@id"/></xsl:variable>
@@ -8946,6 +8947,27 @@
 
         <table border="0" cellspacing="0" cellpadding="3" width="100%">
           <tr>
+            <td valign="center" width="125">
+              Active
+            </td>
+            <td>
+              <div>
+                <input type="radio" name="active" value="-1" checked="1"/>
+                yes, always
+              </div>
+              <div>
+                <input type="radio" name="active" value="1"/>
+                yes, for the next
+                <input type="text" name="days" size="3" maxlength="7" value="30"/>
+                days
+              </div>
+              <div>
+                <input type="radio" name="active" value="0"/>
+                no
+              </div>
+            </td>
+          </tr>
+          <tr>
             <td valign="top" width="125">
               Hosts
             </td>
@@ -9101,6 +9123,66 @@
             </td>
           </tr>
           <tr>
+            <td valign="center">Active</td>
+            <td>
+              <xsl:choose>
+                <xsl:when test="get_overrides_response/override/active='1' and string-length(get_overrides_response/override/end_time) &gt; 0">
+                  <div>
+                    <input type="radio" name="active" value="-1"/>
+                    yes, always
+                  </div>
+                  <div>
+                    <input type="radio" name="active" value="-2" checked="1"/>
+                    yes, until
+                    <xsl:value-of select="get_overrides_response/override/end_time"/>
+                  </div>
+                  <div>
+                    <input type="radio" name="active" value="1"/>
+                    yes, for the next
+                    <input type="text" name="days" size="3" maxlength="7" value="30"/>
+                    days
+                  </div>
+                  <div>
+                    <input type="radio" name="active" value="0"/>
+                    no
+                  </div>
+                </xsl:when>
+                <xsl:when test="get_overrides_response/override/active='1'">
+                  <div>
+                    <input type="radio" name="active" value="-1" checked="1"/>
+                    yes, always
+                  </div>
+                  <div>
+                    <input type="radio" name="active" value="1"/>
+                    yes, for the next
+                    <input type="text" name="days" size="3" maxlength="7" value="30"/>
+                    days
+                  </div>
+                  <div>
+                    <input type="radio" name="active" value="0"/>
+                    no
+                  </div>
+                </xsl:when>
+                <xsl:otherwise>
+                  <div>
+                    <input type="radio" name="active" value="-1"/>
+                    yes, always
+                  </div>
+                  <div>
+                    <input type="radio" name="active" value="1"/>
+                    yes, for the next
+                    <input type="text" name="days" size="3" maxlength="7" value="30"/>
+                    days
+                  </div>
+                  <div>
+                    <input type="radio" name="active" value="0" checked="1"/>
+                    no
+                  </div>
+                </xsl:otherwise>
+              </xsl:choose>
+            </td>
+          </tr>
+          <tr>
             <td valign="top" width="125">
               Hosts
             </td>
@@ -9289,6 +9371,16 @@
       </xsl:choose>
     </td>
     <td>
+      <xsl:choose>
+        <xsl:when test="active='0'">
+          no
+        </xsl:when>
+        <xsl:otherwise>
+          yes
+        </xsl:otherwise>
+      </xsl:choose>
+    </td>
+    <td>
       <xsl:call-template name="delete-icon">
         <xsl:with-param name="type" select="'note'"/>
         <xsl:with-param name="id" select="@id"/>
@@ -9410,6 +9502,23 @@
           <td>Last Modified:</td>
           <td><xsl:value-of select="gsa:long-time (modification_time)"/></td>
         </tr>
+        <tr>
+          <td>Active:</td>
+          <td>
+            <xsl:choose>
+              <xsl:when test="active='0'">
+                no
+              </xsl:when>
+              <xsl:when test="active='1' and string-length (end_time) &gt; 0">
+                yes, until
+                <xsl:value-of select="gsa:long-time (end_time)"/>
+              </xsl:when>
+              <xsl:otherwise>
+                yes
+              </xsl:otherwise>
+            </xsl:choose>
+          </td>
+        </tr>
       </table>
 
       <h1>Application</h1>
@@ -9521,6 +9630,7 @@
           <tr class="gbntablehead2">
             <td>NVT</td>
             <td>Text</td>
+            <td>Active</td>
             <td width="100">Actions</td>
           </tr>
           <xsl:apply-templates select="note"/>
@@ -11489,6 +11599,18 @@
         <xsl:with-param name="string"><xsl:value-of select="text"/></xsl:with-param>
       </xsl:call-template>
     </pre>
+    <div>
+      <xsl:choose>
+        <xsl:when test="active='0'">
+        </xsl:when>
+        <xsl:when test="active='1' and string-length (end_time) &gt; 0">
+          Active until:
+          <xsl:value-of select="gsa:long-time (end_time)"/>.
+        </xsl:when>
+        <xsl:otherwise>
+        </xsl:otherwise>
+      </xsl:choose>
+    </div>
     <xsl:if test="$note-buttons = 1">
       <div class="float_right" style="text-align:right">
         <div style="display: inline">



More information about the Openvas-commits mailing list