Skip to content

Instantly share code, notes, and snippets.

View mhulse's full-sized avatar
👋
👁 ❤️ open source software …

Michael Hulse mhulse

👋
👁 ❤️ open source software …
  • Instructure Inc.
  • Eugene, Oregon
View GitHub Profile
@mhulse
mhulse / subHeadline()
Created September 18, 2014 19:07
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
/*
**
@mhulse
mhulse / headline()
Created September 18, 2014 19:09
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Get headline 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
/*
**
@mhulse
mhulse / uri()
Created September 18, 2014 20:29
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Get story link CSP methods.
<script language="cache" method="uri" arguments="section:dt.cms.schema.Section=-1, story:dt.cms.schema.CMSStory=-1, layout:dt.cms.schema.LayoutFull=-1" returntype="%String" procedureblock="1">
/// Returns a story link; InCopy field "WebLink" trumps story link.
/// All parameters required.
/// Example call: ##class(csp.rg.assets.methods.story).uri(gSection, gStory, gFullLayout)
set return = ""
set:( ' $isobject(story)) story = ##class(dt.cms.schema.CMSStory).%OpenId(story)
@mhulse
mhulse / runDate()
Created September 18, 2014 21:18
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Get run date of story method.
<script language="cache" method="runDate" arguments='cmsStory:dt.cms.schema.CMSStory=-1' returntype="%String" procedureblock="1">
set return = ""
try {
set cmsStoryId = cmsStory.%Id()
&sql(
SELECT runDate INTO :return
FROM dbo.adDbPageInfo api, dbo.storyPageElements spe, dbo.story sty, dt_cms_schema.CMSStory cms
WHERE api.logicalPageId = spe.logicalPagesId
AND sty.storyId = spe.storyId
@mhulse
mhulse / dbo.FileHeader.xml
Created September 21, 2014 00:27
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: dbo.FileHeader READONLY modified class export.
<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="22">
<Class name="dbo.FileHeader">
<IncludeCode>Audience</IncludeCode>
<ProcedureBlock>0</ProcedureBlock>
<SqlRowIdPrivate>1</SqlRowIdPrivate>
<SqlTableName>FileHeader</SqlTableName>
<Super>%Persistent</Super>
<TimeCreated>61081,2615.061796</TimeCreated>
@mhulse
mhulse / blob.csp
Last active August 29, 2015 14:07
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Inspect and debug the gStory global; dumping data to see what’s there; stream a blob for inspection.
<script language="cache" method="OnPreHTTP" arguments="" returntype="%Boolean">
do %response.SetHeader("Content-Type", "text/plain")
set %response.CharSet = "utf-8"
quit 1
</script>
Story: http://registerguard.com/rg/news/local/32232112-75/its-getting-close-to-wire-for-eweb-master-development-contenders.html.csp
<csp:object name="gStory" classname="dt.cms.schema.CMSStory" objid="32232112">
Dump the CMSStory object:
@mhulse
mhulse / zwrite.csp
Created October 2, 2014 18:52
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Argumentless zwrite, useful when developing code for debug purposes.
<script language="cache" runat="server">
//--------------------------------------------------------------------------
//
// Debug:
//
//--------------------------------------------------------------------------
write !, "<pre>"
try {
@mhulse
mhulse / meta.csp
Created October 2, 2014 19:02
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Display useful debug information.
<csp:if condition='$data(%request.Data("meta", 1))'>
<hr>
<div class="wiffle">
<section>
<h1 class="head">Meta!</h1>
@mhulse
mhulse / uri.csp
Last active August 29, 2015 14:08
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Create a story URL programatically using COS.
#[ new id set id = $get(%request.Data("id", 1)) ]#
<csp:if condition='$number((id \ 1), 0)'>
<script language="cache" runat="server">
new publication, section, story, layout
set publication = ##class(dt.cms.schema.Publication).%OpenId(##class(dt.cms.support.Utilities).getPublicationID("rg")) // Publication name is "rg".
@mhulse
mhulse / foo.js
Last active August 29, 2015 14:16
Simple way to create a Jquery function for non-jQuery JS code.
// Create the plugin:
window.jQuery.fn.autosize = function() {
return autosize(this);
};
// Use the plugin:
jQuery(function($){
$('textarea').autosize();
});