Skip to content

Instantly share code, notes, and snippets.

@chrismrgn
chrismrgn / TranslateHelper.cs
Last active January 2, 2016 00:39
SDL Translation Manager API - Create Job
public void Translate(string identifiableObjectId, string owningRepositoryId)
{
if (!string.IsNullOrWhiteSpace(identifiableObjectId) && !string.IsNullOrWhiteSpace(owningRepositoryId))
{
//Create instance of TranslationJobManager
TranslationJobManager jobManager = new TranslationJobManager("DOMAIN\\USER");
//Create a PUSH job (job created at the source publication)
TranslationJob translationJob = jobManager.CreateJob("JobName", owningRepositoryId, TranslationJobType.PushJob);
@chrismrgn
chrismrgn / TranslationManagerPlugin.cs
Created January 3, 2014 13:30
Translation Manager Plugin Example
[TranslationManagerPlugIn]
class TranslationManagerPlugin
{
public TranslationManagerPlugin()
{
//Subscribe to Translation Manager events
TranslationJobManager.TranslationJobCreated += TranslationJobManager_TranslationJobCreated;
//TranslationJobManager.TranslationJobLoaded += TranslationJobManager_TranslationJobLoaded;
//TranslationJobManager.Error += TranslationJobManager_Error;
//TranslationJobManager.ItemSelected += TranslationJobManager_ItemSelected;
@chrismrgn
chrismrgn / AddClaimToADFClaimStore.cs
Last active August 29, 2015 14:05
Add Claim to Ambient Data Framework Claim Store from C#
AmbientDataContext.CurrentClaimStore.Put(new Uri("CLAIM_URI"),
CLAIM_VALUE,
Tridion.ContentDelivery.AmbientData.Runtime.ClaimType.Normal);
@chrismrgn
chrismrgn / AmbientDataFrameworkHttpModule.cs
Last active August 29, 2015 14:06
HTTPModule to add claims to Ambient Data Framework (ADF) Claim Store
using Tridion.ContentDelivery.AmbientData;
namespace Tridion.ADF.Modules.DayOfWeek
{
public class DayOfWeekModule : IHttpModule
{
public DayOfWeekModule() { }
void IHttpModule.Dispose() { }
@chrismrgn
chrismrgn / GetWebDavUrl.js
Last active September 7, 2016 20:47
Tridion WebDavUrl Bookmarklet Snippet
javascript: (function (UI, B, e, a, r, d)
{
try
{
while (r = UI.frames[e++])
{
if ((a = r.$display && r.$display.getView()) && a.getId() == B)
{
d = a;
break;
@chrismrgn
chrismrgn / PageTemplate.cshtml
Created December 30, 2014 23:33
PageTemplate.cshtml
@@model PageViewModel
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h1>@@Model.Title</h1>
<div>
@@if(Model.ComponentPresentations != null)
{
foreach (ComponentPresentation componentPresentation in Model.ComponentPresentations)
@chrismrgn
chrismrgn / ComponentTemplate.cshtml
Created December 30, 2014 23:43
ComponentTemplate.cshtml
@@model ProductsViewModel
</div>
<div>
<h2>@Component.title</h2>
<p>@Component.summary</p>
</div>
@foreach(var product in Component.products)
{
@chrismrgn
chrismrgn / PageContoller.cs
Created December 30, 2014 23:53
PageController.cs
public class PageController : Controller
{
public ActionResult RenderPage(string url)
{
TridionHelper utils = new TridionHelper();
PublicationMeta publicationMeta = utils.GetPublicationMetaByUrl("/");
if (String.IsNullOrEmpty(url))
url = "Index.html";
if (!Path.HasExtension(url))
@chrismrgn
chrismrgn / global.asax.cs
Created December 30, 2014 23:57
global.asax.cs
TridionPathProvider tridionPathProvider = new TridionPathProvider();
HostingEnvironment.RegisterVirtualPathProvider(tridionPathProvider);
@chrismrgn
chrismrgn / TridionPathProvider.cs
Created December 31, 2014 00:03
TridionPathProvider.cs
public class TridionPathProvider : VirtualPathProvider
{
public TridionPathProvider()
: base()
{
}
protected override void Initialize()
{
}