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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Dec 17 12:42:00 CET 2009


Author: mattm
Date: 2009-12-17 12:41:59 +0100 (Thu, 17 Dec 2009)
New Revision: 6171

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/gsad.c
   trunk/gsa/src/html/src/omp.xsl
Log:
	Add sort buttons for task and status to the get_status page.

	* src/html/src/omp.xsl (sort): New template.
	(html-task-table): Add task and status sort buttons.

	* src/gsad.c (init_validator): Add '_' to sort_field.
	(exec_omp_post): Pass sort field and order to get_status_omp.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2009-12-17 11:35:22 UTC (rev 6170)
+++ trunk/gsa/ChangeLog	2009-12-17 11:41:59 UTC (rev 6171)
@@ -1,3 +1,13 @@
+2009-12-17  Matthew Mundell <matthew.mundell at intevation.de>
+
+	Add sort buttons for task and status to the get_status page.
+
+	* src/html/src/omp.xsl (sort): New template.
+	(html-task-table): Add task and status sort buttons.
+
+	* src/gsad.c (init_validator): Add '_' to sort_field.
+	(exec_omp_post): Pass sort field and order to get_status_omp.
+
 2009-12-17  Felix Wolfsteller <felix.wolfsteller at intevation.de>
 
 	Use versioning mechanism as in the other OpenVAS CMake-based projects,

Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c	2009-12-17 11:35:22 UTC (rev 6170)
+++ trunk/gsa/src/gsad.c	2009-12-17 11:41:59 UTC (rev 6171)
@@ -215,7 +215,7 @@
   openvas_validator_add (validator, "report_id",  "^[a-z0-9\\-]+$");
   openvas_validator_add (validator, "role",       "^[[:alnum:] ]{1,40}$");
   openvas_validator_add (validator, "task_id",    "^[a-z0-9\\-]+$");
-  openvas_validator_add (validator, "sort_field", "^[[:alnum:] ]{1,20}$");
+  openvas_validator_add (validator, "sort_field", "^[_[:alnum:] ]{1,20}$");
   openvas_validator_add (validator, "sort_order", "^(ascending)|(descending)$");
   openvas_validator_add (validator, "uuid",       "^[0-9abcdefABCDEF.]{1,40}$");
 
@@ -1181,7 +1181,10 @@
     }
   else if (!strcmp (con_info->req_parms.cmd, "get_status"))
     {
-      con_info->response = get_status_omp (credentials, NULL, NULL, NULL);
+      con_info->response = get_status_omp (credentials,
+                                           NULL,
+                                           con_info->req_parms.sort_field,
+                                           con_info->req_parms.sort_order);
     }
   else if (!strcmp (con_info->req_parms.cmd, "save_config"))
     {

Modified: trunk/gsa/src/html/src/omp.xsl
===================================================================
--- trunk/gsa/src/html/src/omp.xsl	2009-12-17 11:35:22 UTC (rev 6170)
+++ trunk/gsa/src/html/src/omp.xsl	2009-12-17 11:41:59 UTC (rev 6171)
@@ -38,6 +38,9 @@
 
 <!-- NAMED TEMPLATES -->
 
+<xsl:template match="sort">
+</xsl:template>
+
 <xsl:template name="html-task-table">
   <div class="gb_window">
     <div class="gb_window_part_left"></div>
@@ -57,8 +60,94 @@
       <div id="tasks">
         <table class="gbntable" cellspacing="2" cellpadding="4" border="0">
           <tr class="gbntablehead2">
-            <td rowspan="2">Task</td>
-            <td width="1" rowspan="2">Status</td>
+            <td rowspan="2">
+              Task
+              <xsl:choose>
+                <xsl:when test="sort/field/text()='name'">
+                  <xsl:choose>
+                    <xsl:when test="sort/field/order/text()='ascending'">
+                      <img src="/img/ascending_inactive.png"
+                           border="0"
+                           style="margin-left:3px;"/>
+                      <a href="/omp?cmd=get_status&amp;sort_field=name&amp;sort_order=descending"
+                         title="Sort Descending">
+                        <img src="/img/descending.png"
+                             border="0"
+                             style="margin-left:3px;"/>
+                      </a>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <a href="/omp?cmd=get_status&amp;sort_field=name&amp;sort_order=ascending"
+                         title="Sort Ascending">
+                        <img src="/img/ascending.png"
+                             border="0"
+                             style="margin-left:3px;"/>
+                      </a>
+                      <img src="/img/descending_inactive.png" border="0" style="margin-left:3px;"/>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </xsl:when>
+                <xsl:otherwise>
+                  <a href="/omp?cmd=get_status&amp;sort_field=name&amp;sort_order=ascending"
+                     title="Sort Ascending">
+                    <img src="/img/ascending.png"
+                         border="0"
+                         style="margin-left:3px;"/>
+                  </a>
+                  <a href="/omp?cmd=get_status&amp;sort_field=name&amp;sort_order=descending"
+                     title="Sort Descending">
+                    <img src="/img/descending.png"
+                         border="0"
+                         style="margin-left:3px;"/>
+                  </a>
+                </xsl:otherwise>
+              </xsl:choose>
+            </td>
+            <td width="1" rowspan="2">
+              Status
+              <xsl:choose>
+                <xsl:when test="sort/field/text()='run_status'">
+                  <xsl:choose>
+                    <xsl:when test="sort/field/order/text()='ascending'">
+                      <img src="/img/ascending_inactive.png"
+                           border="0"
+                           style="margin-left:3px;"/>
+                      <a href="/omp?cmd=get_status&amp;sort_field=run_status&amp;sort_order=descending"
+                         title="Sort Descending">
+                        <img src="/img/descending.png"
+                             border="0"
+                             style="margin-left:3px;"/>
+                      </a>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <a href="/omp?cmd=get_status&amp;sort_field=run_status&amp;sort_order=ascending"
+                         title="Sort Ascending">
+                        <img src="/img/ascending.png"
+                             border="0"
+                             style="margin-left:3px;"/>
+                      </a>
+                      <img src="/img/descending_inactive.png"
+                           border="0"
+                           style="margin-left:3px;"/>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </xsl:when>
+                <xsl:otherwise>
+                  <a href="/omp?cmd=get_status&amp;sort_field=run_status&amp;sort_order=ascending"
+                     title="Sort Ascending">
+                    <img src="/img/ascending.png"
+                         border="0"
+                         style="margin-left:3px;"/>
+                  </a>
+                  <a href="/omp?cmd=get_status&amp;sort_field=run_status&amp;sort_order=descending"
+                     title="Sort Descending">
+                    <img src="/img/descending.png"
+                         border="0"
+                         style="margin-left:3px;"/>
+                  </a>
+                </xsl:otherwise>
+              </xsl:choose>
+            </td>
             <td colspan="3">Reports</td>
             <td rowspan="2">Threat</td>
             <td rowspan="2">Trend</td>



More information about the Openvas-commits mailing list