Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Ektron Content List

Posted on July 2, 2015 By David Kittell

This is a collection of a few other scripts that I’ve posted here but this script concatenates widget and alias listings into one column so that you only have one row per content item.

SET NOCOUNT ON

DECLARE @Domain VARCHAR(50)

SET @Domain = '/'

SELECT
	--TOP 30
	CASE
		WHEN c.content_type IN (
				1,
				2,
				3,
				4,
				101,
				102,
				103,
				1102
				)
			THEN 'Content Tab'
		WHEN c.content_type IN (
				7,
				106
				)
			THEN 'Library Tab'
		END AS 'Type',
	c.[content_id] AS 'Content ID',
	c.[content_title] AS 'Content Title',
	CASE
		WHEN c.[content_status] = 'A'
			THEN 'Approved'
		WHEN c.[content_status] = 'O'
			THEN 'Checked Out'
		WHEN c.[content_status] = 'I'
			THEN 'Checked In'
		WHEN c.[content_status] = 'S'
			THEN 'Submitted for Approval'
		WHEN c.[content_status] = 'M'
			THEN 'Marked for Deletion'
		WHEN c.[content_status] = 'P'
			THEN 'Pending Go Live Date'
		WHEN c.[content_status] = 'T'
			THEN 'Awaiting Completion of Associated Tasks'
		WHEN c.[content_status] = 'D'
			THEN 'Pending Deletion'
		END AS ContentStatus,
	c.[date_created] AS 'Date Created',
	(u.first_name + ' ' + u.last_name) AS 'Created By',
	c.[last_edit_date] AS 'Last Edit Date',
	(c.[last_edit_fname] + ' ' + c.[last_edit_lname]) AS 'Last Editor',
	CASE content_type
		WHEN - 1
			THEN CAST(content_type AS VARCHAR(5)) + ' - AllTypes'
		WHEN 1
			THEN CAST(content_type AS VARCHAR(5)) + ' - Content'
		WHEN 2
			THEN CAST(content_type AS VARCHAR(5)) + ' - Forms'
		WHEN 3
			THEN CAST(content_type AS VARCHAR(5)) + ' - Archive Content'
		WHEN 4
			THEN CAST(content_type AS VARCHAR(5)) + ' - Archive Forms'
		WHEN 7
			THEN CAST(content_type AS VARCHAR(5)) + ' - PDF Assets'
		WHEN 8
			THEN CAST(content_type AS VARCHAR(5)) + ' - Assets'
		WHEN 9
			THEN CAST(content_type AS VARCHAR(5)) + ' - Archive Assets'
		WHEN 12
			THEN CAST(content_type AS VARCHAR(5)) + ' - Archive Media'
		WHEN 99
			THEN CAST(content_type AS VARCHAR(5)) + ' - Non Library Content'
		WHEN 101
			THEN CAST(content_type AS VARCHAR(5)) + ' - MS Office Assets'
		WHEN 102
			THEN CAST(content_type AS VARCHAR(5)) + ' - PDF Assets'
		WHEN 103
			THEN CAST(content_type AS VARCHAR(5)) + ' - PDF Assets'
		WHEN 106
			THEN CAST(content_type AS VARCHAR(5)) + ' - PNG Image Assets'
		WHEN 104
			THEN CAST(content_type AS VARCHAR(5)) + ' - Multimedia'
		WHEN 1102
			THEN CAST(content_type AS VARCHAR(5)) + ' - Archived PDF Assets'
		WHEN 1111
			THEN CAST(content_type AS VARCHAR(5)) + ' - Discussion Topic'
		WHEN 3333
			THEN CAST(content_type AS VARCHAR(5)) + ' - Catalog Entry'
		ELSE CAST(content_type AS VARCHAR(5))
		END AS 'Content Type',
	CASE c.[searchable]
		WHEN 1
			THEN 'Yes'
		WHEN 0
			THEN 'No'
		END AS Searchable,
	CASE
		WHEN (
				rtrim(ltrim(STUFF((
								SELECT ', ' + title
								FROM widget_types wt
								WHERE c.content_html LIKE '%' + wt.title + '%'
								FOR XML PATH('')
								), 1, 1, '')))
				) IS NULL
			THEN 'No Widgets'
		ELSE (
				rtrim(ltrim(STUFF((
								SELECT ', ' + title
								FROM widget_types wt
								WHERE c.content_html LIKE '%' + wt.title + '%'
								FOR XML PATH('')
								), 1, 1, '')))
				)
		END AS 'Widget(s)',
	tt.template_filename AS 'Template Filename',
	cft.FolderPath,
	(
		CASE
			WHEN rtrim(ltrim(STUFF((
								SELECT ', ' + (@Domain + uam.[urlaliasnm])
								FROM [UrlAliasMapping] uam
								WHERE uam.TargetID = c.content_id
								FOR XML PATH('')
								), 1, 1, ''))) IS NULL
				THEN 'No Alias'
			ELSE rtrim(ltrim(STUFF((
								SELECT ', ' + (@Domain + uam.[urlaliasnm])
								FROM [UrlAliasMapping] uam
								WHERE uam.TargetID = c.content_id
								FOR XML PATH('')
								), 1, 1, '')))
			END
		) AS 'Alias List',
	(
		CASE
			WHEN (@Domain + uam.[urltargetnm]) IS NULL
				THEN 'No Alias'
			ELSE (@Domain + uam.[urltargetnm])
			END
		) AS NonAliasURL,
	CASE
		WHEN c.content_type IN (
				1,
				2,
				3,
				4,
				101,
				102,
				103,
				1102
				)
			THEN (@Domain + tt.template_filename + '?id=' + CAST(c.content_id AS VARCHAR(20)))
		WHEN c.content_type IN (
				7,
				106
				)
			THEN (
					SELECT [filename]
					FROM library l
					WHERE c.content_id = l.content_id
					)
		END AS 'View Item'
FROM [content] c
LEFT OUTER JOIN users u ON c.[user_id] = u.user_id
LEFT OUTER JOIN [content_folder_tbl] cft ON c.folder_id = cft.folder_id
LEFT OUTER JOIN templates_tbl tt ON c.template_id = tt.template_id
LEFT OUTER JOIN [UrlAliasMapping] uam ON uam.TargetID = c.content_id
ORDER BY cft.FolderPath,
	c.content_title
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code Ektron MSSQL MSSQL - Ektron MSSQL - Ektron 8.7 SQL

Post navigation

Previous post
Next post

Related Posts

File Exists

Posted on December 14, 2013October 26, 2015

Public Function FileExists(ByVal FileFullPath As String) _ As Boolean Dim f As New IO.FileInfo(FileFullPath) Return f.Exists End Function Originally Posted on December 14, 2013Last Updated on October 26, 2015 All information on this site is shared with the intention to help. Before any source code or program is ran on…

Read More

Check Instance Of Application

Posted on May 9, 2014October 26, 2015

Preferred Method: Project Menu -> Properties -> Application -> Check Box: Make Single Instance Application Non-Preferred Method: This code will look in your task manager for the same name of your application, if it exists it will prevent another copy of it from running. ‘ Make sure they only have…

Read More

Delphix Web API – PowerShell Run Masking Job

Posted on April 19, 2018

Take note of the Global Variables $BaseURL and $LogFilePath, make sure you set them to your values. The idea for this script is to run this as part of a database restore/migration. Drop all access to the database to do the restore/migration, then run the script for Delphix, and then…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes