Skip to content

Instantly share code, notes, and snippets.

@jammykam
jammykam / Attach.cs
Last active December 17, 2017 17:20
Restrict Media Upload in Content Editor in Sitecore 7.2
using LaunchSitecore.Applications;
using Sitecore;
using Sitecore.Exceptions;
using Sitecore.Pipelines.Attach;
using System;
using System.Collections.Generic;
namespace LaunchSitecore.Pipelines.Attach
{
@jammykam
jammykam / SwitchingLinkProvider
Last active September 21, 2017 02:57
Sitecore Site Specific Link Provider for up to SC 8.1
using System;
using System.Collections.Specialized;
using System.Web;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Links;
using Sitecore.Web;
namespace Sitecore.Custom.Links
@jammykam
jammykam / StringExtensions.tt
Created February 3, 2015 23:30
Hedgehog CodeGen - Glass Mapper v3
<#+
public static string TitleCase(string word)
{
string newWord = System.Text.RegularExpressions.Regex.Replace(word, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1+");
newWord = System.Globalization.CultureInfo.InvariantCulture.TextInfo.ToTitleCase(newWord);
newWord = newWord.Replace("+", "");
return newWord;
}
public static string CamelCase(string word)
@jammykam
jammykam / ControlSources
Last active August 29, 2015 14:16
Custom Sitecore Control for storing Key/Value Data with Lookups
<configuration xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<controlSources>
<source mode="on" namespace="MyProject.Shell" assembly="MyProject" prefix="contentExtension"/>
</controlSources>
</sitecore>
</configuration>
@jammykam
jammykam / CustomLookup.cs
Last active August 29, 2015 14:16
Custom Lookup Field with labels
using System;
using System.Collections.Specialized;
using System.Web;
using System.Web.UI;
using Sitecore;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Shell.Applications.ContentEditor;
using Sitecore.StringExtensions;
@jammykam
jammykam / SOLR Switch Single Core.xml
Last active October 19, 2016 21:13
SOLR Switch Config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="ContentSearch.Solr.ServiceBaseAddress">
<patch:attribute name="value">http://localhost:8984/solr</patch:attribute>
</setting>
</settings>
<contentSearch>
<configuration>
<indexes hint="list:AddIndex">
using Sitecore;
using Sitecore.Diagnostics;
using Sitecore.Resources;
using Sitecore.Web.UI;
using Telerik.Web.UI;
using Sitecore.Data.Items;
namespace RTEDropList
{
public class EditorConfiguration : Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration
@jammykam
jammykam / InsertFormWizard.cs
Last active January 22, 2016 02:39
Updated form selector to allow selection of existing forms
using System;
using System.Text;
using Sitecore;
using Sitecore.Data.Items;
using Sitecore.Globalization;
using Sitecore.Web.UI.HtmlControls;
using Sitecore.Web.UI.Sheer;
namespace Sitecore.Custom.WFFM.UI
{
@jammykam
jammykam / SelectRendering.xml
Created October 5, 2015 13:14
Updated Sitecore Tabbed Select Rendering Dialog
<?xml version="1.0" encoding="utf-8" ?>
<control xmlns:def="Definition" xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense">
<Sitecore.Shell.Applications.Dialogs.SelectRendering>
<FormDialog ID="Dialog" Icon="Core/32x32/open_document.png" Header="Open Item"
Text="Select the item that you wish to open. Then click the Open button." OKButton="Open">
<Stylesheet Src="SelectItemWithThumbnails.css" DeviceDependant="true" />
<CodeBeside Type="MyProject.Custom.Dialogs.SelectRenderingTabbed.SelectRenderingForm, MyProject.Custom"/>
<DataContext ID="DataContext" Root="/"/>
@jammykam
jammykam / SelectRendering.xml
Created December 22, 2015 20:32
Tabbed Rendering Selector
<?xml version="1.0" encoding="utf-8" ?>
<control xmlns:def="Definition" xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense">
<Sitecore.Shell.Applications.Dialogs.SelectRendering>
<FormDialog ID="Dialog" Icon="Core/32x32/open_document.png" Header="Open Item"
Text="Select the item that you wish to open. Then click the Open button." OKButton="Open">
<Stylesheet Src="SelectItemWithThumbnails.css" DeviceDependant="true" />
<CodeBeside Type="MyProject.CMS.Custom.Dialogs.SelectRenderingTabbed.SelectRenderingForm, ARM.CMS.Custom"/>
<DataContext ID="DataContext" Root="/"/>