Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created June 16, 2012 10:07
Show Gist options
  • Save mhulse/2940867 to your computer and use it in GitHub Desktop.
Save mhulse/2940867 to your computer and use it in GitHub Desktop.
Caché DTI ContentPublisher: Tested in 7.6, 7.7.2: RG Skybox Example...
<script language="cache" runat="server">
/*
**
** GETs:
**
*/
set conf("section") = $get(%request.Data("s", 1)) // The current section.
set conf("parent") = $get(%request.Data("p", 1)) // The current section's parent.
/*
**
** FLAGS:
**
*/
set conf("skybox") = "" // Used in summary templates in order to determine what template the "Skybox" is using.
</script>
<csp:if condition='(##class(csp.web.assets.methods.area).inArea("Skybox 01", gSection))||(##class(csp.web.assets.methods.area).inArea("Skybox 02", gSection))'>
<csp:if condition='##class(csp.web.assets.methods.area).inArea("Skybox 01", gSection)'>
<dti:area:include name="Skybox 01" pageName="index.csp" />
</csp:if>
<csp:if condition='##class(csp.web.assets.methods.area).inArea("Skybox 02", gSection)'>
<dti:area:include name="Skybox 02" pageName="index.csp" />
</csp:if>
<csp:else></csp:if>
... stuff here ...
<csp:comment> BEGIN CITY/REGION </csp:comment>
<dti:section:use sid="#(##class(dt.cms.support.Rules).getSectionID(gPublication, "cityregion"))#">
<csp:if condition='##class(csp.web.assets.methods.area).inAreas("Top Story, Top Stories", gSection)'>
<h3 class="sep"><dti:section:link>Local News</dti:section:link></h3>
<div class="tabs">
<ul class="clear">
<li class="navFirst"><a href="#news-local-tab">Local</a></li>
<li><a href="#news-or-tab">Oregon</a></li>
<li><a href="#news-wa-tab">Washington</a></li>
</ul> <!-- /.clear -->
<hr>
<div class="rack">
<div id="news-local-tab">
<csp:if condition=(conf("skybox")'="cityregion")>
<csp:if condition='##class(csp.web.assets.methods.area).inArea("Top Story", gSection)'>
<div class="topStory">
<dti:area:include name="Top Story" pageName="index.csp" />
</div>
<!-- /.topStory -->
</csp:if>
</csp:if>
<csp:if condition='##class(csp.web.assets.methods.area).inArea("Top Stories", gSection)'>
<div class="bulletedStories">
<ul class="bull">
<custom:rg:story:topnslots publication="#(gPublication.getName())#" section="#(gSection.getName())#" pagelayoutname="section" grid="Section Grid" area="Top Stories" items="4" value="value" key="key">
<dti:story:use storyobj="#(value)#">
<li><dti:story:link>#(##class(csp.web.assets.methods.story).headline(gStory))#</dti:story:link></li>
</dti:story:use>
</custom:rg:story:topnslots>
</ul>
</div> <!-- /.bulletedStories -->
<div class="foot"><dti:section:link>More Local Stories &raquo;</dti:section:link></div>
</csp:if>
</div> <!-- /#news-local-tab -->
<hr>
<div id="news-or-tab">
<ul class="bull">#(##class(custom.rg.Scraper).scrape("wire-oregon-5-60", "projects.registerguard.com", "wire/a8dbce6f2a1f4e5d90c2a9e13af098c3/5/", 60))#</ul>
<csp:comment>
<ul class="bull">#(##class(csp.web.assets.methods.net).webResponse("special.registerguard.com", "/ap/cityregion/5/", 80, "text/html"))#</ul>
</csp:comment>
<div class="foot"><a href="http://hosted2.ap.org/OREUG/northwest">More Oregon Stories &raquo;</a></div>
</div> <!-- /#news-or-tab -->
<hr>
<div id="news-wa-tab">
<ul class="bull">#(##class(custom.rg.Scraper).scrape("wire-washington-5-60", "projects.registerguard.com", "wire/04ee9408d3494d62b4180aae818a8efd/5/", 60))#</ul>
<csp:comment>
<ul class="bull">#(##class(csp.web.assets.methods.net).webResponse("special.registerguard.com", "/ap/cityregion/5/", 80, "text/html"))#</ul>
</csp:comment>
<div class="foot"><a href="http://hosted2.ap.org/OREUG/northwest">More Washington Stories &raquo;</a></div>
</div> <!-- /#news-wa-tab -->
</div> <!-- /.rack -->
</div> <!-- /.tabs -->
<hr>
<csp:else>
<csp:comment> Else, nothing slotted... </csp:comment>
</csp:if>
</dti:section:use>
<csp:comment> END CITY/REGION </csp:comment>
... more stuff here ...
<div id="skybox" class="negative" style="background:#42454c url(#(##class(csp.web.assets.methods.image).imageUri("315pxw", gStory))#) no-repeat right top;">
<div class="v01">
<div class="bg">
<div class="wrap">
<csp:if condition='$length(##class(dt.cms.support.Rules).extractStory("category", gStory, 0))>1'>
<div class="spot"><dti:section:link><dti:story field="category"></dti:section:link></div>
</csp:if>
<div class="content">
<h4>
#[ new subhead set subhead = ##class(csp.web.assets.methods.story).subHeadline(gStory) ]#
<dti:story:link>#(##class(csp.web.assets.methods.story).headline(gStory))#</dti:story:link>
<csp:if condition=($length(subhead))>
<span class="hide">|</span> <b>#(subhead)#</b>
</csp:if>
#[ kill subhead ]#
</h4>
<dti:story:element:exist field="WebSummary">
<dti:story:element field="WebSummary" />
<dti:else>
<csp:if condition=(##class(csp.web.assets.methods.story).dboStoryStatus(gStory)'=1)>
<dti:story:element field="WebUpdateText" wordlimit="25" ellipsis="true" extract="textonly" />
<csp:else>
<dti:story:element:exist field="WebText">
<p><dti:story:element field="WebText" extract="textonly" wordlimit="25" ellipsis="true" /></p>
<dti:else>
<p><dti:story:element field="Text" extract="textonly" wordlimit="25" ellipsis="true" /></p>
</dti:story:element:exist>
</csp:if>
</dti:story:element:exist>
<div class="foot">
<dti:story:link>Full Story &hellip;</dti:story:link>
</div>
<dti:file:include base="assets" file="/includes/csp/story.related.stories.inc.csp" />
<dti:file:include base="assets" file="/includes/csp/story.related.links.inc.csp" />
</div> <!-- /.content -->
</div> <!-- /.wrap -->
</div> <!-- /.bg -->
</div> <!-- /.v01 -->
</div> <!-- /#skybox -->
<csp:comment>
Get the "Area" name.
Using the name for the skybox includes.
Allows us to have different looks/feels for skybox.
Warning: gArea (and gSlOt) does not exist in preview mode!!!
Until I can think of a fix, using a default of "skybox01" for the preview mode.
</csp:comment>
<script language="cache" runat="server">
new an
set an = ""
set:($Data(gArea)) an = $zstrip($zconvert(gArea.name, "L"), "*PCW")
set:('$length(an)) an = "skybox01"
</script>
<csp:if condition='$get(%request.Data("psid", 1))'>
#[ set conf("skybox") = $zconvert(##class(dt.cms.support.Utilities).getSummaryLayout(gSection, ##class(dt.cms.support.Rules).getSlot(gMapping, gSection, 0), gMapping).name, "L") ]#
<csp:else>
#[ set conf("skybox") = $zconvert(##class(dt.cms.support.Utilities).getSummaryLayout(gSection, gSlot, gMapping).name, "L") ]#
</csp:if>
<csp:if condition=(conf("skybox")="default")>
<dti:file:include base="assets" file="/includes/csp/#(an)#.inc.csp" />
<csp:else>
<dti:section:use sid="#(##class(dt.cms.support.Rules).getSectionID(gPublication, conf("skybox")))#">
<csp:comment> RG uses "custom:rg:story:topnslots". Everyone else use: "dti:story:topnslots"! </csp:comment>
<custom:rg:story:topnslots publication="#(gPublication.getName())#" section="#(gSection.getName())#" pagelayoutname="section" grid="Section Grid" area="Top Story" items="1" value="value" key="key">
<dti:story:use storyobj="#(value)#">
<dti:file:include base="assets" file="/includes/csp/#(an)#.inc.csp" />
</dti:story:use>
</custom:rg:story:topnslots>
</dti:section:use>
</csp:if>
#[ kill an ]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment