This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
### Displays a 'Draft Site' message in Experience Editor ### | |
.Description | |
The $text variable below should be edited as required. | |
#> | |
$title = "Displaying Draft Site" | |
$text = "You are viewing the draft (Master DB) version of the site." | |
$icon = @{$true="Office/32x32/information.png";$false="Applications/16x16/warning.png"}[$SitecoreVersion.Major -gt 7] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
### Moves all SXA Draft Sites to Top of list so they load on the CM before the non-Draft sites ### | |
.Description | |
Before running this script open the SXA Site Manager from the Powershell Toolbox to ensure all sites are up to date. | |
All Draft sites will be moved to the top of this field: "/sitecore/system/Settings/Foundation/Experience Accelerator/Multisite/Management/Sites" | |
#> | |
$sxaSitesList = Get-Item -Path "master:/sitecore/system/Settings/Foundation/Experience Accelerator/Multisite/Management/Sites" | |
$orderField = $sxaSitesList.Fields["Order"].Value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
### Context Menu script to creates a single SXA Draft Site - for use on the CM Instance ### | |
.Description | |
Should be created in the Content Menu section, e.g: /sitecore/system/Modules/PowerShell/Script Library/{YOUR SCRIPT LIBRARY}/Content Editor/Context Menu | |
Duplicates the existing Site Grouping item and adds 'DRAFT' to the name. | |
Sets the environment to 'Draft' and database to 'master' also sets the target hostname to the current CM instance Url. | |
Moves the new Draft site to the top of the list so it is loaded before the non-Draft site. | |
#> | |
Import-Function -Name "Get-CmUrl" | |
Import-Function -Name "Move-Preview-Site-To-Top" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
### Creates Draft Sites for all existing Sites - for use on the CM Instance ### | |
.Description | |
For each site -> Duplicates the existing Site Grouping item and adds 'DRAFT' to the name. | |
Sets the environment to 'Draft' and database to 'master' also sets the target hostname to the current CM instance Url. | |
#> | |
$rootItem = Get-Item -Path "/sitecore/content" | |
$sxaSites = Get-ChildItem -Path "/sitecore/content/Sites" | |
$successCount = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration | |
name="Foundation.SiteCron" | |
description="SiteCron definition items" | |
dependencies="Foundation.Serialization" | |
patch:after="configuration[@name='Foundation.Serialization']" | |
extends="Helix.Foundation"> | |
<predicate type="Unicorn.Predicates.SerializationPresetPredicate, Unicorn" singleInstance="true"> | |
<include name="ModulesTemplatesSitecron" database="master" path="/sitecore/templates/Modules/Sitecron" /> | |
<include name="SystemSitecron" database="master" path="/sitecore/system/Modules/Sitecron"> | |
<exclude childrenOfPath="OOTB/SiteCron Execution Reports" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddTableRows : WebEdit | |
{ | |
private string RowsToAdd { get; set; } | |
public override void Execute(CommandContext context) | |
{ | |
Assert.ArgumentNotNull((object)context, nameof(context)); | |
ItemUri queryString = ItemUri.ParseQueryString(); | |
if (queryString != (ItemUri)null) | |
{ | |
Item obj = Database.GetItem(queryString); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ITable : ISitecoreItem | |
{ | |
bool HasHeaderRow { get; set; } | |
bool HasFooterRow { get; set; } | |
IEnumerable<ITableRow> TableRows { get; set; } | |
} | |
public interface ITableRow : ISitecoreItem | |
{ | |
IEnumerable<ITableCell> TableCells { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inherits MyWebsite.Models.ITable | |
@{ | |
var tableRowsToSkip = 0; | |
if (DataSource.HasHeaderRow) | |
{ | |
tableRowsToSkip = 1; | |
} | |
var tableRowsToRemove = 1; | |
if (DataSource.HasFooterRow && DataSource.HasHeaderRow) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Execute(IJobExecutionContext context) | |
{ | |
//get details of Job | |
JobDataMap dataMap = context.JobDetail.JobDataMap; | |
string itemId = dataMap.GetString(SitecronConstants.FieldNames.ItemID); | |
Database masterDb = Sitecore.Configuration.Factory.GetDatabase("master"); | |
Item jobItem = masterDb.GetItem(new ID(itemId)); | |
try | |
{ |