Skip to content

Instantly share code, notes, and snippets.

@contensis
contensis / import-into-new-forms-module.vbs
Created July 30, 2014 14:03
Code used to import data into the 'new' forms module in Contensis.
Option Strict On
Imports CMS_API
Imports Contensis.FormsModule.Controls
Module Module1
Sub Main()
' Initialise Contensis
CMS_API.initsettings("localhost")
PostForm()
@contensis
contensis / propertied-razor-views.xml
Created August 8, 2014 14:13
Propertied Razor Views
<control name="Person Razor" showInMenu="true" viewingGroup="1">
<properties>
<category name="Person">
<text name="Title">
<options>
<option label="Mr" value="Mr" />
<option label="Mrs" value="Mrs" />
<option label="Miss" value="Miss" />
<option label="Ms" value="Ms" />
<option label="Dr" value="Dr" />
@contensis
contensis / sample_controls.xml
Created August 12, 2014 10:23
Two example controls, a razor view and a server control.
<control packagePath="/razor/Razor1.cshtml" name="Razor1" showInMenu="true" viewingGroup="1">
<properties>
<text name="prop1" description="Razor1 Prop1" />
</properties>
</control>
<control isRazor="false" type="PackageTest.Control1, PackageTest.dll" name="Control1" displayMode="inline" showInMenu="true" viewingGroup="1">
<properties>
<text name="prop1" description="Control1 Prop1" default="Hello" editor="multiple" />
</properties>
@contensis
contensis / database-mirroring.xml
Created August 13, 2014 15:35
SQL Server Database mirroring support within Contensis R7+
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:schemaLocation="file://contensis_settings.xsd" xmlns="http://tempuri.org/contensis_settings.xsd">
<!--All values must be completed without spaces-->
<!--Contensis installations-->
<contensis_instance>
<settingsID>cms.company.co.uk</settingsID>
<alias>cms.company.co.uk</alias>
<dbconSERVER>Server01</dbconSERVER>
<dbconFAILOVERSERVER>Server02,1433</dbconFAILOVERSERVER>
<dbconDATABASE>cms-contensis_company</dbconDATABASE>
@contensis
contensis / Load Structured Content Image (VB.NET)
Created September 23, 2014 08:56
Load Structured Content Image
Dim imageNode As Node = GetNodeByContentId(imageContentId)
@If imageNode IsNot Nothing Then
@<div class="sys_article-image"><img src="@imageNode.FullPath" alt="@imageNode.Title" /></div>
End If
@Functions
Function GetNodeByContentId(contentId As Integer) As Node
@contensis
contensis / bp_ContentUpdatedAndByWhom.sql
Created October 3, 2014 12:21
T-SQL for creating a bespoke report to show content ordered by modified date
GO
/****** Object: StoredProcedure [dbo].[bp_ContentUpdatedAndByWhom] Script Date: 03/10/2014 12:57:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[bp_ContentUpdatedAndByWhom]
AS
BEGIN
@contensis
contensis / create_custom_report_base.sql
Created October 3, 2014 13:43
Create Custom Report
CREATE PROC [dbo].[bp_AliasList]
AS
SELECT
WP_ID as ItemID,
WPV_ID as ItemVersionID,
2 as ItemWorkflowType,
0 as ItemContentTypeID,
F_ID as ItemFolderID,
WP_Label as ItemLabel,
@contensis
contensis / custom_report_config.xml
Created October 3, 2014 13:43
Custom report Config
<toolbar overrides="ContentFilterDropDown">
<tools name="ContentFilterDropDown">
<tool name="Aliases" tooltip="List of website Aliases">
<params>
<param name="DialogueKey_StoredProcedure">bp_AliasList</param>
<param name="DialogueKey_Title">List of website Aliases</param>
<param name="DialogueKey_Extended">1</param>
</params>
</tool>
</tools>
@contensis
contensis / default_render_template
Created October 7, 2014 09:28
Default Render Template
<!--PageDirs-->
<%@ Page language="VB" Inherits="CMS_API.Page" %>
<%@ Import Namespace="CMS_API.DataView" %>
<%@ Import Namespace="CMS_API" %>
<%@ Import Namespace="Contensis.Framework.Web" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.Mail"%>
<%@ Register TagPrefix="contensis_controls" Namespace="CMS_API.Utilities.Controls" Assembly="CMS_API" %>
<%@ Register TagPrefix="CMS_API_WEBUI_WEBCONTROLS" Namespace="CMS_API.WebUI.WebControls" Assembly="CMS_API.WebUI.WebControls" %>
@contensis
contensis / working-with-js.vbs
Created October 10, 2014 08:40
Working with JavaScript Files
' If the same URL is registered twice it will only output one reference.
' The URL is used as a key to prevent duplicates.
' Add a JavaScript file before the opening body tag
CurrentContext.Page.Scripts.Add("app.js")
' Add a JavaScript file before the closing body tag
CurrentContext.Page.Scripts.Add("app.js", ScriptLocation.BodyEnd)
' Add a JavaScript file before the opening body tag