Skip to content

Instantly share code, notes, and snippets.

View gillissm's full-sized avatar

Scott Gillis gillissm

View GitHub Profile
@gillissm
gillissm / z.CustomSMTP.config.xml
Created December 7, 2016 17:23
Sitecore EXM 3.4 Custom SMTP Patch File, with specific notes for use with Amazon AWS
<!--For usage remove *xml* from file name. -->
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<exm>
<eds>
<smtpSettings type="Sitecore.EDS.Core.Net.Smtp.SmtpSettings, Sitecore.EDS.Core" singleInstance="true">
<server>email-smtp.us-west-2.amazonaws.com</server>
<port>25</port>
<userName>SMTP Username as provided by AWS, NOT your Amazon account username</userName>
@gillissm
gillissm / CustomerTypeVisitDimensionBase.cs
Last active April 1, 2016 17:51
Code samples used to help explain the steps requried for Sitecore Experience Anayltics custom dimensions.
using Sitecore.Analytics.Aggregation.Data.Model;
using Sitecore.ExperienceAnalytics.Aggregation.Dimensions;
using System;
namespace TheCodeAttic.ExperienceAnalytics.Aggregation
{
public class CustomerTypeVisitDimensionBase : VisitDimensionBase
{
public CustomerTypeVisitDimensionBase(Guid dimensionId): base(dimensionId)
{
@gillissm
gillissm / BasicReportingRebuild.cs
Created March 14, 2016 14:17
Following class shows the basic commands required to trigger a Sitecore Reporting Database rebuild
using Sitecore.Analytics.Aggregation.History;
using Sitecore.Analytics.Aggregation.History.Remoting;
using Sitecore.Configuration;
using Sitecore.Xml;
using System;
using System.Xml;
namespace TheCodeAttic.ExperienceAnalytics.Aggregation
{
public class RebuildReports
@gillissm
gillissm / SampleReportData.json
Created March 4, 2016 19:49
Sample of the JSON from a Sitecore Experience Anayltics Report Query
{
"totalRecordCount": 13,
"messages": [],
"data": {
"localization": {
"fields": [
{
"field": "key",
"translations": {}
},
@gillissm
gillissm / TheCodeAttic.CustomContentEditorCommands.xml
Created February 23, 2016 01:59
Sample Sitecore command patch config file. This samples supports the custom commands to collapse and expand all feild sections in the content editor.
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<commands>
<command name="thecodeattic:collapseall"
type="TheCodeAttic.CustomContentEditorButtons.CollapseAllCommand, TheCodeAttic.CustomContentEditorButtons"/>
<command name="thecodeattic:expandall"
type="TheCodeAttic.CustomContentEditorButtons.ExpandAllCommand, TheCodeAttic.CustomContentEditorButtons"/>
</commands>
</sitecore>
@gillissm
gillissm / ContentEditor_ToggleSection_Snippet.js
Created February 23, 2016 01:58
JS Snippet taken from Sitecore's Content Editor.js that supports the toggle of field sections
scContentEditor.prototype.toggleSection = function (id, sectionName) {
var el = document.getElementById(id);
if (el == null) {
return;
}
var nextSibling = el.nextSibling;
var visible = nextSibling.style.display == "none";
el.className = visible ? "scEditorSectionCaptionExpanded" : "scEditorSectionCaptionCollapsed";
@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();");
}
@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 / 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 / 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);
}