Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created September 18, 2014 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhulse/9a2fe838f9f1fc3ae7c1 to your computer and use it in GitHub Desktop.
Save mhulse/9a2fe838f9f1fc3ae7c1 to your computer and use it in GitHub Desktop.
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Get subheadline CSP methods.
<script language="cache" method="dboStoryStatus" arguments="cmsStory:dt.cms.schema.CMSStory=-1" returntype="%Integer" procedureblock="1">
/// About: Return 1 if the given story has a status of "ready", "output", "web" or "archive".
/// Example call:
/// ##class(csp.rg.assets.methods.story).dboStoryStatus()
set return = 0
/*
**
** SQL to check current status list:
** SELECT statusName, statusId FROM dbo.status ORDER BY statusId ASC
**
** "-" = 0
** "Notes" = 1
** "Raw" = 2
** "In Progress" = 3
** "Story Completed = 4
** "First Edit" = 5
** "Rimmed" = 9
** "Ready" = 10
** "Output" = 1018
** "Web" = 1019
** "Archive" = 118709
** "Hold" = 632458
**
*/
if ($isobject(cmsStory) && $isobject(cmsStory.story)) {
set statusId = 0
; DBO.story Status Id:
set statusId = cmsStory.story.statusId
; Check if statusId is "ready", "web", "output" or "archive":
set:((statusId = 10) || (statusId = 1018) || (statusId = 1019) || (statusId = 118709)) return = 1 // Could also do: statusId >= 10
}
quit return
</script>
<script language="cache" method="subHeadline" arguments="cmsStory:dt.cms.schema.CMSStory=-1" returntype="%String" procedureblock="1">
/// About: If "WebHeadLine" or "Headline" exist, returns RG-specific sub headline based on The Register-Guard order of precedence:
/// 3) "Deck"
/// 4) "QuickRead"
/// Arguments:
/// @param01: "cmsStory"
/// A valid CMSStory object.
set return = ""
if ($isobject(cmsStory)) {
if ($length(##class(dt.cms.support.Rules).extractStoryElement("WebDeck", cmsStory, 0))) {
set return = ##class(dt.cms.support.Rules).extractStoryElement("WebDeck", cmsStory, 0, "textonly")
} else {
// The story status MUST be "ready", "output", "web" or "archive" and "WebHeadline" or "Headline" must exist:
if ((..dboStoryStatus(cmsStory) = 1) && ($length(##class(dt.cms.support.Rules).extractStoryElement("WebHeadline", cmsStory, 0, "textonly")) || $length(##class(dt.cms.support.Rules).extractStoryElement("Headline", cmsStory, 0, "textonly")))) {
set return = ##class(dt.cms.support.Rules).extractStoryElement("Deck", cmsStory, 0, "textonly")
if ('$length(return)) {
set return = ##class(dt.cms.support.Rules).extractStoryElement("QuickRead", cmsStory, 0, "textonly")
}
}
}
}
quit return
</script>
<csp:comment>
<csp:object name="gStory" classname="dt.cms.schema.CMSStory" objid="25802356">
#(..subHeadline(gStory))#
</csp:comment>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment