[icinga-checkins] icinga.org: icinga-web/master: * static content: fixed repeating templates

git at icinga.org git at icinga.org
Fri Jan 22 13:29:27 CET 2010


Module: icinga-web
Branch: master
Commit: 2132d3ca8314b4d689c9b8c3cc516e166c38ea2d
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=2132d3ca8314b4d689c9b8c3cc516e166c38ea2d

Author: Christian Doebler <christian.doebler at netways.de>
Date:   Fri Jan 22 09:29:16 2010 +0100

* static content: fixed repeating templates

---

 .../models/System/StaticContentModel.class.php     |   14 +++++++++-----
 res/xml/icinga-tactical-overview-template.xml      |    2 ++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/app/modules/Cronks/models/System/StaticContentModel.class.php b/app/modules/Cronks/models/System/StaticContentModel.class.php
index 26dd7d7..d6ed153 100644
--- a/app/modules/Cronks/models/System/StaticContentModel.class.php
+++ b/app/modules/Cronks/models/System/StaticContentModel.class.php
@@ -287,8 +287,8 @@ class Cronks_System_StaticContentModel extends ICINGACronksBaseModel
 		$numRepeatDefinitions = count($templateVariables[0]);
 
 		for ($x = 0; $x < $numRepeatDefinitions; $x++) {
-			$currentVariable = $templateVariables[1][$x];
-			$variablePattern = '/\${' . $currentVariable . ':repeat}(.*)\${' . $currentVariable . ':repeat_end}/s';
+			$id = $templateVariables[1][$x];
+			$variablePattern = '/\${' . $id . ':repeat}(.*)\${' . $id . ':repeat_end}/s';
 			preg_match_all($variablePattern, $content, $templateSubVariables);
 			$numSubTemplates = count($templateSubVariables[0]);
 
@@ -299,9 +299,13 @@ class Cronks_System_StaticContentModel extends ICINGACronksBaseModel
 
 				$variablePattern = '/\${([A-Za-z0-9_\-]+):([A-Z_]+)}/s';
 				preg_match_all($variablePattern, $subContentTemplate, $subTemplateSubVariables);
-				$numSubTemplateSubVariables = count($subTemplateSubVariables);
-				for ($z = 0; $z < $numSubTemplateSubVariables; $z++) {
-					$subContent .= $this->substituteTemplateVariables($subContentTemplate, $subTemplateSubVariables, $z);
+				$numSubTemplateSubVariables = count($subTemplateSubVariables[0]);
+
+				$numDataResults = count($this->templateData[$id]['data']);
+				for ($dataOffset = 0; $dataOffset < $numDataResults; $dataOffset++) {
+					for ($z = 0; $z < $numSubTemplateSubVariables; $z++) {
+						$subContent .= $this->substituteTemplateVariables($subContentTemplate, $subTemplateSubVariables, $dataOffset);
+					}
 				}
 
 				// substitute template variable by generated sub content
diff --git a/res/xml/icinga-tactical-overview-template.xml b/res/xml/icinga-tactical-overview-template.xml
index b9d4be1..511a0bf 100644
--- a/res/xml/icinga-tactical-overview-template.xml
+++ b/res/xml/icinga-tactical-overview-template.xml
@@ -163,11 +163,13 @@
 					</td>
 				</tr>
 			</table>
+			<!--
 			${HOST_NAMES:repeat}
 				<br/>
 				${HOST_NAMES:HOST_NAME} |
 				<br/> 
 			${HOST_NAMES:repeat_end}
+			-->
 		]]>
     </template_code>
 </template>
\ No newline at end of file





More information about the icinga-checkins mailing list