Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created September 21, 2012 18:42
Show Gist options
  • Save mhulse/3763158 to your computer and use it in GitHub Desktop.
Save mhulse/3763158 to your computer and use it in GitHub Desktop.
Caché DTI ContentPublisher: v7.7.3; Getting summary template group name to determine which photo version to use.
<csp:comment>
Using the "Summary Story Layout Groups" name (Lightning: Setup >> Web Site >> Story Layout - Summary) to pull a specific photo size.
The summary group name and the "Picture Version" name must match in order for this code to work.
</csp:comment>
#[ new group set group = ##class(csp.rg.assets.methods.setups).summaryGroupName($get(%request.Data("psid", 1)), $get(gSection), $get(gMapping), $get(gSlot)) ]#
<csp:if condition=($length(group))>
#[ new picid set picid = ##class(dt.cms.support.Rules).extractPicture(group, gStory, 0) ]#
<csp:if condition='picid>0'>
<figure>
<dti:story:image field="#(group)#" alt="Story image" />
<figcaption>
<small><rg:story:image:caption field="#(group)#" property="byline" table="fileheader" />/<rg:story:image:caption field="#(group)#" property="source" table="fileheader" /></small>
<p><rg:story:image:caption field="#(group)#" property="caption" table="fileheader" /></p>
</figcaption>
</figure>
</csp:if>
#[ kill picid ]#
</csp:if>
#[ kill group ]#
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="summary" arguments='psid:%String, section:dt.cms.schema.Section, mapping:dt.cms.schema.Mapping, slot:dt.cms.schema.Slot' returntype="dt.cms.schema.LayoutSummary" procedureblock="1">
set return = ""
if ($isobject(section) && $isobject(mapping)) {
if ($length(psid)) {
// Warning: gArea, and gSlot, do not exist in preview mode!!!
set return = ##class(dt.cms.support.Utilities).getSummaryLayout(section, ##class(dt.cms.support.Rules).getSlot(mapping, section, 0), mapping)
} else {
if ($isobject(slot)) {
set return = ##class(dt.cms.support.Utilities).getSummaryLayout(section, slot, mapping)
}
}
}
quit return
</script>
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="summaryName" arguments='psid:%String, section:dt.cms.schema.Section, mapping:dt.cms.schema.Mapping, slot:dt.cms.schema.Slot' returntype="%String" procedureblock="1">
quit ..summary(psid, section, mapping, slot).name
</script>
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="summaryGroupName" arguments='psid:%String, section:dt.cms.schema.Section, mapping:dt.cms.schema.Mapping, slot:dt.cms.schema.Slot' returntype="%String" procedureblock="1">
quit ..summary(psid, section, mapping, slot).slotLayoutID.name
</script>
<csp:comment>
#(##class(csp.rg.assets.methods.setups).summaryGroupName($get(%request.Data("psid", 1)), gSection, gMapping, $get(gSlot)))#
</csp:comment>
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
#[ new limit set limit = $case($data(%request.Data("limit", 1)), 1:$get(%request.Data("limit", 1)), :25) kill %request.Data("limit") ]#
<dti:story:element:exist field="WebSummary">
<dti:story:element field="WebSummary" />
<dti:else>
<p>#(##class(csp.rg.assets.methods.story).storyText(gStory, "textonly", limit))# &hellip;</p>
</dti:story:element:exist>
<article>
<header>
<p class="category">#(##class(csp.rg.assets.methods.category).catName(gStory.story.subCategoryId))#</p>
<hgroup>
<h1 class="pekro"><dti:story:link>#(##class(csp.rg.assets.methods.story).headline(gStory))#</dti:story:link></h1>
#[ new subhead set subhead = ##class(csp.rg.assets.methods.story).subHeadline(gStory) ]#
<csp:if condition=($length(subhead))>
<h2 class="quekto">#(subhead)#</h2>
</csp:if>
#[ kill subhead ]#
</hgroup>
</header>
<dti:file:include base="assets" file="/includes/picsummary.csp" />
<dti:file:include base="assets" file="/includes/summary.csp?limit=15" />
</article>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment