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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Sep 27 20:48:04 CEST 2011


Author: mattm
Date: 2011-09-27 20:48:00 +0200 (Tue, 27 Sep 2011)
New Revision: 11706

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/gsad.c
   trunk/gsa/src/gsad_oap.c
   trunk/gsa/src/gsad_omp.c
   trunk/gsa/src/gsad_omp.h
   trunk/gsa/src/html/gsad.xsl
   trunk/gsa/src/html/omp.xsl
Log:
	Add a My Settings page.

	* src/gsad.c (init_validator): Add get_my_settings to cmds.
	(exec_omp_get): Add get_my_settings.

	* src/gsad_oap.c (xsl_transform_oap): Add TIMEZONE to ENVELOPE.

	* src/gsad_omp.c (xsl_transform_oap): Add TIMEZONE to ENVELOPE.
	(get_my_settings_omp): New function.

	* src/gsad_omp.h: Add header accordingly.

	* src/html/gsad.xsl (html-gsa-logo): Link username to My Settings.
	(html-gsa-navigation): Add My Settings.
	(timezone): New template.

	* src/html/omp.xsl (my_settings): New template.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2011-09-27 16:40:55 UTC (rev 11705)
+++ trunk/gsa/ChangeLog	2011-09-27 18:48:00 UTC (rev 11706)
@@ -1,5 +1,25 @@
 2011-09-27  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	Add a My Settings page.
+
+	* src/gsad.c (init_validator): Add get_my_settings to cmds.
+	(exec_omp_get): Add get_my_settings.
+
+	* src/gsad_oap.c (xsl_transform_oap): Add TIMEZONE to ENVELOPE.
+
+	* src/gsad_omp.c (xsl_transform_oap): Add TIMEZONE to ENVELOPE.
+	(get_my_settings_omp): New function.
+
+	* src/gsad_omp.h: Add header accordingly.
+
+	* src/html/gsad.xsl (html-gsa-logo): Link username to My Settings.
+	(html-gsa-navigation): Add My Settings.
+	(timezone): New template.
+
+	* src/html/omp.xsl (my_settings): New template.
+
+2011-09-27  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	Use the timezone given in the OMP AUTHENTICATE.  Store this timezone in
 	the session.  Similarly for the user role, adding the role to the
 	page header.

Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c	2011-09-27 16:40:55 UTC (rev 11705)
+++ trunk/gsa/src/gsad.c	2011-09-27 18:48:00 UTC (rev 11706)
@@ -501,6 +501,7 @@
                          "|(get_info)"
                          "|(get_lsc_credential)"
                          "|(get_lsc_credentials)"
+                         "|(get_my_settings)"
                          "|(get_note)"
                          "|(get_notes)"
                          "|(get_nvts)"
@@ -1528,6 +1529,7 @@
   ELSE (get_info)
   ELSE (get_lsc_credential)
   ELSE (get_lsc_credentials)
+  ELSE (get_my_settings)
   ELSE (get_note)
   ELSE (get_notes)
   ELSE (get_override)

Modified: trunk/gsa/src/gsad_oap.c
===================================================================
--- trunk/gsa/src/gsad_oap.c	2011-09-27 16:40:55 UTC (rev 11705)
+++ trunk/gsa/src/gsad_oap.c	2011-09-27 18:48:00 UTC (rev 11706)
@@ -203,11 +203,14 @@
                                  "<token>%s</token>"
                                  "<caller>%s</caller>"
                                  "<time>%s</time>"
+                                 "<timezone>%s</timezone>"
                                  "<login>%s</login>"
                                  "<role>%s</role>",
                                  credentials->token,
                                  credentials->caller ? credentials->caller : "",
                                  ctime_now,
+                                 credentials->timezone
+                                   ? credentials->timezone : "",
                                  credentials->username,
                                  credentials->role);
   g_string_append (string, res);

Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c	2011-09-27 16:40:55 UTC (rev 11705)
+++ trunk/gsa/src/gsad_omp.c	2011-09-27 18:48:00 UTC (rev 11706)
@@ -151,11 +151,14 @@
                                  "<token>%s</token>"
                                  "<caller>%s</caller>"
                                  "<time>%s</time>"
+                                 "<timezone>%s</timezone>"
                                  "<login>%s</login>"
                                  "<role>%s</role>",
                                  credentials->token,
                                  credentials->caller ? credentials->caller : "",
                                  ctime_now,
+                                 credentials->timezone
+                                   ? credentials->timezone : "",
                                  credentials->username,
                                  credentials->role);
   g_string_append (string, res);
@@ -13787,6 +13790,20 @@
                     params_value (params, "sort_order"), NULL);
 }
 
+/**
+ * @brief Returns page with user's settings.
+ *
+ * @param[in]  credentials  Credentials of user issuing the action.
+ * @param[in]  params       Request parameters.
+ *
+ * @return Result of XSL transformation.
+ */
+char *
+get_my_settings_omp (credentials_t * credentials, params_t *params)
+{
+  return xsl_transform_omp (credentials, g_strdup ("<my_settings/>"));
+}
+
 
 /* Manager communication. */
 

Modified: trunk/gsa/src/gsad_omp.h
===================================================================
--- trunk/gsa/src/gsad_omp.h	2011-09-27 16:40:55 UTC (rev 11705)
+++ trunk/gsa/src/gsad_omp.h	2011-09-27 18:48:00 UTC (rev 11706)
@@ -159,6 +159,8 @@
 char * restore_omp (credentials_t *, params_t *);
 char * empty_trashcan_omp (credentials_t *, params_t *);
 
+char * get_my_settings_omp (credentials_t *, params_t *);
+
 int authenticate_omp (const gchar *, const gchar *, gchar **, gchar **);
 
 char * get_info_omp (credentials_t *, params_t *);

Modified: trunk/gsa/src/html/gsad.xsl
===================================================================
--- trunk/gsa/src/html/gsad.xsl	2011-09-27 16:40:55 UTC (rev 11705)
+++ trunk/gsa/src/html/gsad.xsl	2011-09-27 18:48:00 UTC (rev 11706)
@@ -514,7 +514,7 @@
           </xsl:when>
           <xsl:otherwise>
             Logged in as <div style="display: inline;"><xsl:value-of select="/envelope/role"/></div>
-            <b><xsl:value-of select="$username"/></b> |
+            <b><a href="/omp?cmd=get_my_settings&amp;token={/envelope/token}"><xsl:value-of select="$username"/></a></b> |
           </xsl:otherwise>
         </xsl:choose>
         <a href="/logout?token={/envelope/token}" title="Logout" style="margin-left:3px;">Logout</a>
@@ -790,6 +790,7 @@
      <ul>
       <li class="pointy"></li>
       <li><a href="/omp?cmd=get_trash&amp;token={/envelope/token}">Trashcan</a></li>
+      <li><a href="/omp?cmd=get_my_settings&amp;token={/envelope/token}">My Settings</a></li>
       <li class="last"><a href="/omp?cmd=get_system_reports&amp;duration=86400&amp;slave_id=0&amp;token={/envelope/token}">Performance</a></li>
      </ul>
     </li>
@@ -1016,6 +1017,9 @@
 <xsl:template match="time">
 </xsl:template>
 
+<xsl:template match="timezone">
+</xsl:template>
+
 <xsl:template match="role">
 </xsl:template>
 

Modified: trunk/gsa/src/html/omp.xsl
===================================================================
--- trunk/gsa/src/html/omp.xsl	2011-09-27 16:40:55 UTC (rev 11705)
+++ trunk/gsa/src/html/omp.xsl	2011-09-27 18:48:00 UTC (rev 11706)
@@ -12804,6 +12804,39 @@
   </div>
 </xsl:template>
 
+<!-- MY SETTINGS -->
+
+<xsl:template match="my_settings">
+  <xsl:apply-templates select="gsad_msg"/>
+
+  <div class="gb_window">
+    <div class="gb_window_part_left"></div>
+    <div class="gb_window_part_right"></div>
+    <div class="gb_window_part_center">My Settings
+      <a href="/help/my_settings.html?token={/envelope/token}"
+         title="Help: My Settings">
+        <img src="/img/help.png"/>
+      </a>
+    </div>
+    <div class="gb_window_part_content_no_pad">
+      <div id="tasks">
+        <table class="gbntable" cellspacing="2" cellpadding="4" border="0">
+          <tr class="gbntablehead2">
+            <td>Name</td>
+            <td>Value</td>
+            <td width="100">Actions</td>
+          </tr>
+          <tr>
+            <td>Timezone</td>
+            <td><xsl:value-of select="/envelope/timezone"/></td>
+            <td></td>
+          </tr>
+        </table>
+      </div>
+    </div>
+  </div>
+</xsl:template>
+
 <!-- COMMANDS_RESPONSE -->
 
 <xsl:template match="commands_response">



More information about the Openvas-commits mailing list