Skip to content

Instantly share code, notes, and snippets.

package com.sdl.webapp.common.impl;
import com.sdl.webapp.common.api.MediaHelper;
import com.sdl.webapp.common.api.ScreenWidth;
import com.sdl.webapp.common.api.WebRequestContext;
import com.sdl.webapp.common.api.contextengine.ContextEngine;
import com.sdl.webapp.common.api.localization.Localization;
import com.sdl.webapp.common.api.localization.LocalizationNotFoundException;
import com.sdl.webapp.common.api.localization.LocalizationNotResolvedException;
import com.sdl.webapp.common.api.localization.LocalizationResolver;
@bkoopman
bkoopman / HTML Design Configuration.xsd
Created December 15, 2014 14:49
HTML Design Configuration Schema
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sdl.com/web/schemas/html-design" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" xmlns:xlink="http://www.w3.org/1999/xlink" elementFormDefault="qualified" targetNamespace="http://www.sdl.com/web/schemas/html-design">
<xsd:import namespace="http://www.tridion.com/ContentManager/5.0/Instance" schemaLocation="cm_xml_inst.xsd"></xsd:import>
<xsd:annotation>
<xsd:appinfo>
<tcm:Labels xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
<tcm:Label ElementName="design" Metadata="false">HTML design (packaged in zip file)</tcm:Label>
<tcm:Label ElementName="build" Metadata="false">HTML design build files (packaged in zip file)</tcm:Label>
<tcm:Label ElementName="version" Metadata="false">Version Number</tcm:Label>
<tcm:Label ElementName="favicon" Metadata="false">Favicon</tcm:Label>
<tcm:Label ElementName="variables" Metadata="false">Bootstrap configuration</tcm:Label>
@bkoopman
bkoopman / PublishHtmlDesignParameters.xsd
Created December 15, 2014 14:40
Publish HTML Design Parameters Schema
<xsd:schema targetNamespace="http://www.sdl.com/web/schemas/publishhtmldesign" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" xmlns="http://www.sdl.com/web/schemas/publishhtmldesign" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:import namespace="http://www.tridion.com/ContentManager/5.0/Instance" schemaLocation="cm_xml_inst.xsd"/>
<xsd:annotation>
<xsd:appinfo>
<tcm:Labels xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
<tcm:Label ElementName="drive" Metadata="false">Drive letter where temp directory will be created (defaults to the drive where SDL Tridion is installed, the TcmHomeDirectory)</tcm:Label>
<tcm:Label ElementName="cleanup" Metadata="false">Cleanup of temp directory (leave empty for automatic cleanup, or set to: false)</tcm:Label>
</tcm:Labels>
</xsd:appinfo>
</xsd:annotation>
@bkoopman
bkoopman / PublishHtmlDesign.cs
Created December 15, 2014 14:36
Publish HTML Design TBB
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using Sdl.Web.Tridion.Common;
using Tridion.ContentManager;
using Tridion.ContentManager.CommunicationManagement;
@bkoopman
bkoopman / dwt-xpm-example.html
Last active August 29, 2015 14:11
DWT XPM Example for making HTML attributes editable
${FieldStartMarker("image")}
${FieldValueStartMarker()}
<div style="background:url(@@Component.Fields.image@@);">
<!-- whatever, but keep in mind you cannot edit the stuff inside this anymore -->
</div>
${FieldValueEndMarker()}
${FieldEndMarker()}
@bkoopman
bkoopman / updated-xpm-jquery-plugin.js
Last active August 29, 2015 14:11
Updated version of xpm-jquery-plugin.js
/**
* XPM specific functions
*/
(function($) {
// initialize global variable
SDL_ENV.isInXpm = false;
// check and set global variable
$.fn.checkIfInXpm = function() {
// check via availability of Tridion objects
$localization.getResource("Tridion.Extensions.UI.FBI.Strings", "LABEL_NAME")
<%$ Resources: Tridion.Extensions.UI.FBI.Strings, LABEL_NAME %>
<localization>
<cfg:clientresource clientname="Tridion.Extensions.UI.FBI.Strings"
servertype="Tridion.Extensions.UI.FBI.Editor.Resources.Tridion.Extensions.UI.FBI.Strings, Tridion.Extensions.UI.FBI.Editor"/>
</localization>
[TcmTemplateTitle("Add ECL Metadata into Package and Component")]
public class AddEclMetadataIntoPackageAndComponent : Base.TemplateBase
{
// ecl metadata fieldname
const string SkuField = "sku";
public override void Transform(Engine engine, Package package)
{
Initialize(engine, package);