[icinga-checkins] icinga.org: icinga-web/cdoebler/default: * added base for static content

git at icinga.org git at icinga.org
Tue Jan 19 16:09:43 CET 2010


Module: icinga-web
Branch: cdoebler/default
Commit: 0514db8a267acffedc0f9bdf021c52105b538d80
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=0514db8a267acffedc0f9bdf021c52105b538d80

Author: Christian Doebler <christian.doebler at netways.de>
Date:   Tue Jan 19 16:09:24 2010 +0100

* added base for static content

---

 app/config/cronks.xml                              |   11 ++++
 .../actions/System/StaticContentAction.class.php   |   43 +++++++++++++
 .../System/TacticalOverviewAction.class.php        |   23 -------
 .../{TacticalOverview.xml => StaticContent.xml}    |    0 
 .../models/System/StaticContentModel.class.php     |   18 ++++++
 ...verviewSuccess.php => StaticContentSuccess.php} |    0 
 .../Cronks/validate/System/StaticContent.xml       |   22 +++++++
 .../Cronks/validate/System/TacticalOverview.xml    |   13 ----
 .../System/StaticContentSuccessView.class.php      |   33 ++++++++++
 .../System/TacticalOverviewSuccessView.class.php   |   13 ----
 res/xml/icinga-tactical-overview-template.xml      |   64 ++++++++++++++++++++
 11 files changed, 191 insertions(+), 49 deletions(-)

diff --git a/app/config/cronks.xml b/app/config/cronks.xml
index 07d67f9..bac21c1 100644
--- a/app/config/cronks.xml
+++ b/app/config/cronks.xml
@@ -140,6 +140,17 @@
 			<parameter name="parameter"></parameter>
 		</parameter>
 
+		<parameter name="icingaTacticalOverview">
+			<parameter name="module">Cronks</parameter>
+			<parameter name="action">System.StaticContent</parameter>
+			<parameter name="hide">true</parameter>
+			<parameter name="description">Icinga Tactical Overview</parameter>
+			<parameter name="name">Tactical Overview</parameter>
+			<parameter name="parameter">
+				<parameter name="template">icinga-tactical-overview-template</parameter>
+			</parameter>
+		</parameter>
+
 		<parameter name="portalView1Col">
 			<parameter name="module">Cronks</parameter>
 			<parameter name="action">System.PortalView</parameter>
diff --git a/app/modules/Cronks/actions/System/StaticContentAction.class.php b/app/modules/Cronks/actions/System/StaticContentAction.class.php
new file mode 100644
index 0000000..4b22922
--- /dev/null
+++ b/app/modules/Cronks/actions/System/StaticContentAction.class.php
@@ -0,0 +1,43 @@
+<?php
+
+class Cronks_System_StaticContentAction extends ICINGACronksBaseAction
+{
+	/**
+	 * Returns the default view if the action does not serve the request
+	 * method used.
+	 *
+	 * @return     mixed <ul>
+	 *                     <li>A string containing the view name associated
+	 *                     with this action; or</li>
+	 *                     <li>An array with two indices: the parent module
+	 *                     of the view to be executed and the view to be
+	 *                     executed.</li>
+	 *                   </ul>
+	 */
+	public function getDefaultViewName()
+	{
+		return 'Success';
+	}
+
+	public function executeRead(AgaviParameterHolder $rd) {
+		return $this->getDefaultViewName();
+	}
+	
+	public function executeWrite(AgaviParameterHolder $rd) {
+		return $this->getDefaultViewName();
+	}
+	
+	public function isSecure() {
+		return true;
+	}
+	
+	public function getCredentials() {
+		return array ('icinga.user');
+	}
+	
+	public function handleError(AgaviParameterHolder $rd) {
+		return $this->getDefaultViewName();
+	}
+}
+
+?>
\ No newline at end of file
diff --git a/app/modules/Cronks/actions/System/TacticalOverviewAction.class.php b/app/modules/Cronks/actions/System/TacticalOverviewAction.class.php
deleted file mode 100644
index 31f8595..0000000
--- a/app/modules/Cronks/actions/System/TacticalOverviewAction.class.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-class Cronks_System_TacticalOverviewAction extends ICINGACronksBaseAction
-{
-	/**
-	 * Returns the default view if the action does not serve the request
-	 * method used.
-	 *
-	 * @return     mixed <ul>
-	 *                     <li>A string containing the view name associated
-	 *                     with this action; or</li>
-	 *                     <li>An array with two indices: the parent module
-	 *                     of the view to be executed and the view to be
-	 *                     executed.</li>
-	 *                   </ul>
-	 */
-	public function getDefaultViewName()
-	{
-		return 'Success';
-	}
-}
-
-?>
\ No newline at end of file
diff --git a/app/modules/Cronks/cache/System/TacticalOverview.xml b/app/modules/Cronks/cache/System/StaticContent.xml
similarity index 100%
rename from app/modules/Cronks/cache/System/TacticalOverview.xml
rename to app/modules/Cronks/cache/System/StaticContent.xml
diff --git a/app/modules/Cronks/models/System/StaticContentModel.class.php b/app/modules/Cronks/models/System/StaticContentModel.class.php
new file mode 100644
index 0000000..3261f92
--- /dev/null
+++ b/app/modules/Cronks/models/System/StaticContentModel.class.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * @author Christian Doebler <christian.doebler at netways.de>
+ */
+class Cronks_System_StaticContentModel extends ICINGACronksBaseModel
+{
+
+	private $api = false;
+
+	public function __construct () {
+		$this->api = AppKitFactories::getInstance()->getFactory('IcingaData');
+	}
+
+	
+
+}
+
+?>
\ No newline at end of file
diff --git a/app/modules/Cronks/templates/System/TacticalOverviewSuccess.php b/app/modules/Cronks/templates/System/StaticContentSuccess.php
similarity index 100%
rename from app/modules/Cronks/templates/System/TacticalOverviewSuccess.php
rename to app/modules/Cronks/templates/System/StaticContentSuccess.php
diff --git a/app/modules/Cronks/validate/System/StaticContent.xml b/app/modules/Cronks/validate/System/StaticContent.xml
new file mode 100644
index 0000000..071a728
--- /dev/null
+++ b/app/modules/Cronks/validate/System/StaticContent.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ae:configurations
+	xmlns="http://agavi.org/agavi/config/parts/validators/1.0"
+	xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0"
+	parent="%core.module_dir%/Cronks/config/validators.xml"
+>
+	<ae:configuration>
+		
+		<validators>
+
+			<validator class="string" name="template" required="true">
+					<argument>template</argument>
+					
+					<errors>
+						<error>Validation of template failed!</error>
+					</errors>
+			</validator>
+
+		</validators>
+		
+	</ae:configuration>
+</ae:configurations>
diff --git a/app/modules/Cronks/validate/System/TacticalOverview.xml b/app/modules/Cronks/validate/System/TacticalOverview.xml
deleted file mode 100644
index bfa516d..0000000
--- a/app/modules/Cronks/validate/System/TacticalOverview.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ae:configurations
-	xmlns="http://agavi.org/agavi/config/parts/validators/1.0"
-	xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0"
-	parent="%core.module_dir%/Cronks/config/validators.xml"
->
-	<ae:configuration>
-		
-		<validators>
-		</validators>
-		
-	</ae:configuration>
-</ae:configurations>
diff --git a/app/modules/Cronks/views/System/StaticContentSuccessView.class.php b/app/modules/Cronks/views/System/StaticContentSuccessView.class.php
new file mode 100644
index 0000000..4682df6
--- /dev/null
+++ b/app/modules/Cronks/views/System/StaticContentSuccessView.class.php
@@ -0,0 +1,33 @@
+<?php
+
+class Cronks_System_StaticContentSuccessView extends ICINGACronksBaseView
+{
+	public function executeHtml(AgaviRequestDataHolder $rd)
+	{
+		$this->setupHtml($rd);
+
+		$template_file = sprintf(
+			'%s/%s.xml', 
+			AgaviConfig::get('de.icinga.web.xml_template_folder'), 
+			$rd->getParameter('template')
+		);
+		
+		$template = new IcingaTemplateXmlParser($template_file);
+		$template->parseTemplate();
+		
+		$worker = new IcingaTemplateWorker();
+		$worker->setTemplate($template);
+		$worker->setApi(AppKitFactories::getInstance()->getFactory('IcingaData')->API());
+		
+		$layout_class = $template->getSectionParams('option')->getParameter('layout');
+		$layout = AppKitClassUtil::createInstance($layout_class);
+		
+		$layout->setContainer($this->getContainer());
+		$layout->setWorker($worker);
+		$layout->setParameters($rd);
+		
+		return $layout->getLayoutContent();
+	}
+}
+
+?>
\ No newline at end of file
diff --git a/app/modules/Cronks/views/System/TacticalOverviewSuccessView.class.php b/app/modules/Cronks/views/System/TacticalOverviewSuccessView.class.php
deleted file mode 100644
index d60eeb8..0000000
--- a/app/modules/Cronks/views/System/TacticalOverviewSuccessView.class.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-class Cronks_System_TacticalOverviewSuccessView extends ICINGACronksBaseView
-{
-	public function executeHtml(AgaviRequestDataHolder $rd)
-	{
-		$this->setupHtml($rd);
-
-		$this->setAttribute('_title', 'System.TacticalOverview');
-	}
-}
-
-?>
\ No newline at end of file
diff --git a/res/xml/icinga-tactical-overview-template.xml b/res/xml/icinga-tactical-overview-template.xml
new file mode 100644
index 0000000..5dccb9a
--- /dev/null
+++ b/res/xml/icinga-tactical-overview-template.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<template>
+    
+    <!-- 
+    	Meta description of the templates, that anybody
+    	knows what the template is doing
+    -->
+    <meta>
+        <parameter name="name">Default template for Tactical Overview</parameter>
+        <parameter name="description">Displays a Tactical Overview</parameter>
+        <parameter name="author">icinga-web developers</parameter>
+    </meta>
+
+	<datasources>
+		<datasource>
+			<type>IcingaApi</type>
+			<target></target>
+			
+		</datasource>
+	</datasources>
+
+    <!--
+    	html template
+    -->
+    <template>
+    	<!-- /* <![CDATA[ */
+			<table border="0" cellpadding="0" cellspacing="4">
+				<tr>
+					<td>Monitoring Performance</td>
+				</tr>
+				<tr>
+					<td>
+						<table border="0" cellpadding="0" cellspacing="0">
+							<tr>
+								<td>Service Check Execution Time:</td>
+								<td>0.04 / 81.01 / 0.782 sec</td>
+							</tr>
+							<tr>
+								<td>Service Check Latency:</td>
+								<td>0.00 / 90.91 / 1.878 sec</td>
+							</tr>
+							<tr>
+								<td>Host Check Execution Time:</td>
+								<td>0.04 / 10.21 / 0.195 sec</td>
+							</tr>
+							<tr>
+								<td>Host Check Latency:</td>
+								<td>0.00 / 5.94 / 2.388 sec</td>
+							</tr>
+							<tr>
+								<td># Active Host / Service Checks:</td>
+								<td>205 / 3295</td>
+							</tr>
+							<tr>
+								<td># Passive Host / Service Checks:</td>
+								<td>0 / 13</td>
+							</tr>
+						</table>
+					</td>
+				</tr>
+			</table>
+		/* ]]> */ -->
+    </template>    
+</template>
\ No newline at end of file





More information about the icinga-checkins mailing list