#set ($longGroupId = $getterUtil.getLong($groupId))
#set ($journalArticleService = $portal.getClass().forName("com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil"))
#set ($journalArticleResourceService = $portal.getClass().forName("com.liferay.portlet.journal.service.JournalArticleResourceLocalServiceUtil"))
#set ($assetEntryService = $portal.getClass().forName("com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil"))
#set ($assetTagService = $portal.getClass().forName("com.liferay.portlet.asset.service.AssetTagLocalServiceUtil"))
#set ($localeTransformer = $portal.getClass().forName('com.liferay.portlet.journal.util.LocaleTransformerListener').newInstance())
#set ($VOID = $localeTransformer.setLanguageId($request.theme-display.language-id))
#set ($usedArticleIds = $portal.getClass().forName('java.util.HashSet').newInstance())
#set ($journalArticleClassName = "com.liferay.portlet.journal.model.JournalArticle")
#set ($journalArticleResourceClassName = "com.liferay.portlet.journal.model.JournalArticleResource")
#set ($journalArticles = $journalArticleService.getStructureArticles($longGroupId, $SlideStructureId.getData()))
#set ($validJournalArticles = $portal.getClass().forName("java.util.ArrayList").newInstance())
#set($validDelay = $getterUtil.getLong($SlideAutoadvanceDelay.getData(), 7) * 1000 + 800)
-
#foreach ($journalArticle in $journalArticles)
#if (!$usedArticleIds.contains($journalArticle.getArticleId()))
#set ($VOID = $usedArticleIds.add($journalArticle.getArticleId()))
#set ($articleResource = $journalArticle.getArticleResource())
#set ($assetEntry = $assetEntryService.getEntry($journalArticleClassName, $articleResource.getPrimaryKey()))
#set ($tagNames = $assetEntry.getTagNames())
#set ($showJournalArticle = true)
#foreach ($tagName in $tagNames)
#if ($tagName == "inactive")
#set ($showJournalArticle = false)
#end
#end
#if ($showJournalArticle)
#set ($mostRecentArticle = $journalArticleService.getLatestArticle($longGroupId, $journalArticle.getArticleId(), 0))
$validJournalArticles.add($mostRecentArticle)
#end
#end
#end
#set ($startSlideIndex = $mathTool.random(0, $validJournalArticles.size()) + 1)
#foreach ($slide in $validJournalArticles)
#set ($xml = $localeTransformer.onXml($slide.content))
#set ($contentDoc = $saxReaderUtil.read($xml))
#set ($dynamicElements = $contentDoc.getRootElement().elements("dynamic-element"))
#foreach ($dynamicElement in $dynamicElements)
#set ($attributeName = $dynamicElement.attribute("name").getText())
#if ($attributeName == "Background-Image")
#set ($Background-Image = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Forground-Image")
#set ($Forground-Image = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Forground-Image-Top-Pos")
#set ($Forground-Image-Top-Pos = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Forground-Image-Left-Pos")
#set ($Forground-Image-Left-Pos = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Text-Image")
#set ($Text-Image = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Text-Image-Top-Pos")
#set ($Text-Image-Top-Pos = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Text-Image-Left-Pos")
#set ($Text-Image-Left-Pos = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Button-Target")
#set ($Button-Target = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Button-Top-Pos")
#set ($Button-Top-Pos = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Button-Left-Pos")
#set ($Button-Left-Pos = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Button-Text")
#set ($Button-Text = $!dynamicElement.elements().get(0).getText())
#end
#if ($attributeName == "Button-Target-Render-As-Tag")
#set ($Button-Target-Render-As-Tag = $!dynamicElement.elements().get(0).getText())
#end
#end
- #end