Skip to content

Instantly share code, notes, and snippets.

View gillissm's full-sized avatar

Scott Gillis gillissm

View GitHub Profile
@gillissm
gillissm / TheCodeAttic.UseLocalMTA.Patch.xml
Last active April 9, 2017 20:28
Sitecore Email Experience Manager Configuration Patch File for Local MTA configuration
<!--NOTE: Before use be sure to rename to '.config' Using the XML extension to provide better visual formatting.-->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<!-- Set it to "true" if you want use the SMTP settings below.
You should purchase the right of using the "UseLocalMTA" setting first. -->
<setting name="UseLocalMTA">
<patch:attribute name="value">true</patch:attribute>
</setting>
@gillissm
gillissm / ActionTemplate.cs
Created February 10, 2016 20:58
Basic Action Template for creating a Web Forms for Marketers custom action
using Sitecore.Forms.Core.Rules;
namespace TheCodeAttic.SharedSource.WFFM.PopulateFieldAction
{
public class ActionTemplate<T> : ReadValue<T> where T : ConditionalRuleContext
{
protected override object GetValue()
{
string retVal = string.Empty;
/// This value is inherited from ReadValue<T>.
@gillissm
gillissm / ContactFacetSwitch.cs
Created February 10, 2016 21:08
Step 4: Retrieving from the Contact Facet
switch (this.Name.ToLower())
{
case "first name":
retValue = Tracker.Current.Contact.GetFacet<IContactPersonalInfo>("Personal").FirstName;
break;
case "last name":
retValue = Tracker.Current.Contact.GetFacet<IContactPersonalInfo>("Personal").Surname;
break;
case "email":
IContactEmailAddresses ea = Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails");
@gillissm
gillissm / TrackerAssertCommands.cs
Created February 10, 2016 21:08
Step 3: Tracker assert commands
Assert.IsNotNull((object)Tracker.Current, "Tracker.Current");
Assert.IsNotNull((object)Tracker.Current.Contact, "Tracker.Current.Contact");
@gillissm
gillissm / GetContactFacetValue.cs
Last active February 10, 2016 21:19
Custom Web Forms for Marketers Action Setup
//Step 1:Using Statements
using Sitecore.Analytics;
using Sitecore.Analytics.Model.Entities;
using Sitecore.Diagnostics;
using Sitecore.Forms.Core.Rules;
using System.Linq;
//Step 2: Basic Code Structure
namespace TheCodeAttic.SharedSource.WFFM.PopulateFieldAction
{
@gillissm
gillissm / ContactFacetDialog.xaml.xml
Created February 10, 2016 21:14
Basic Sitecore Sheer Dialog XML
<?xml version="1.0" encoding="utf-8" ?>
<xamlControls
xmlns:x="http://www.sitecore.net/xaml"
xmlns:ajax="http://www.sitecore.net/ajax"
xmlns:asp="http://www.sitecore.net/microsoft/webcontrols"
xmlns:html="http://www.sitecore.net/microsoft/htmlcontrols">
<ContactFacetDialog x:inherits="TheCodeAttic.SharedSource.WFFM.PopulateFieldAction.Sheer.ContactFacetDialog,TheCodeAttic.SharedSource.WFFM.PopulateFieldAction">
<Sitecore.Controls.DialogPage runat="server" >
@gillissm
gillissm / ContactFacetDialog.cs
Created February 10, 2016 21:15
Execute method for the Contact Facet Dialog XAML code behind
public void Execute(XElement element, string name, UrlString parameters, string value)
{
Assert.ArgumentNotNull((object)element, "element");
Assert.ArgumentNotNull((object)name, "name");
Assert.ArgumentNotNull((object)parameters, "parameters");
Assert.ArgumentNotNull((object)value, "value");
UrlString str = new UrlString("/sitecore/shell/~/xaml/ContactFacetDialog.aspx?ti=Contact Facet Picker&txt=Select a contact facet property&spk="+value);
SheerResponse.ShowModalDialog(str.ToString(), true);
}
@gillissm
gillissm / ContactFacetExist.cs
Last active February 10, 2016 21:19
Override Execute method for a custom Sitecore Conditional Rule
protected override bool Execute(T ruleContext)
{
Assert.ArgumentNotNull((object)ruleContext, "ruleContext");
Assert.IsNotNull((object)Tracker.Current, "Tracker.Current must be not null");
Assert.IsNotNull((object)Tracker.Current.Contact, "Tracker.Current.Contact must be not null");
if (string.IsNullOrWhiteSpace(ContactFacetMemberPath) || Tracker.Current.Contact == null)
return false;
//Custom method that reads the facet member XML path and using reflection retrieves the value.
@gillissm
gillissm / zz.Solr.Index.CorePatch.xml
Created February 11, 2016 20:43
Sitecore Experience Manager 8.0 and Sitecore Experience Manager 8.1 Solr Index Core Naming Patch file.
<!-- NOTE: After download rename to '.CONFIG', xml is used for better formating in Gist-->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="sitecore_master_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
<param desc="core">itembuckets</param>
</index>
<index id="sitecore_web_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
@gillissm
gillissm / CollapseAllCommand.cs
Last active February 23, 2016 02:00
File snippets that support the creation of custom Sitecore Content Editor button commands to collapse and expand field section accordions
using Sitecore.Shell.Framework.Commands;
namespace TheCodeAttic.CustomContentEditorButtons
{
public class CollapseAllCommand : Command
{
public override void Execute(CommandContext context)
{
Sitecore.Context.ClientPage.ClientResponse.Eval("TheCodeAttic_CollapseAll();");
}