public override void Apply(T ruleContext) { Assert.ArgumentNotNull(ruleContext, "ruleContext"); Assert.ArgumentNotNullOrEmpty(Name, "Name"); foreach (var rendering in ruleContext.SelectedRenderings) { // Simple case, no parameters, nothing to remove if (string.IsNullOrWhiteSpace(rendering.Parameters)) { continue; } // Parse case var urlString = new UrlString(rendering.Parameters); if (string.IsNullOrEmpty(urlString.Parameters[Name])) { continue; // does not exist, nothing to remove } urlString.Remove(Name); rendering.Parameters = urlString.GetUrl(); ruleContext.HasLayoutChange = true; BotLog.Log.Info($"UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) cleared parameter {Name}"); Log.Info($"DESIGNBOT:: UPDATED rendering {rendering.ItemID} ({rendering.Placeholder}{rendering.UniqueId}) cleared parameter {Name}", this); } }
/// <summary> /// Overide Sitecore choosing which version to open and get the latest instead /// </summary> /// <param name="urlString">Raw Url String</param> /// <param name="itemId">Id of the Item that will have the its version checked</param> private static void AddLatestVersionToUrlString(UrlString urlString, string itemId) { urlString.Remove(Util.Constants.VersionQueryStringKeyName); urlString.Add(Util.Constants.VersionQueryStringKeyName, Context.ContentDatabase.GetItem(itemId).Versions.GetLatestVersion().Version.ToString()); }
/// <summary> /// Overide Sitecore choosing which version to open and get the latest instead /// </summary> /// <param name="urlString">Raw Url String</param> /// <param name="itemId">Id of the Item that will have the its version checked</param> private static void AddLatestVersionToUrlString(UrlString urlString, string itemId) { urlString.Remove(Util.Constants.VersionQueryStringKeyName); urlString.Add(Util.Constants.VersionQueryStringKeyName, Context.ContentDatabase.GetItem(itemId).Versions.GetLatestVersion().Version.ToString()); }
/// <summary> /// Rewrites media urls to point to CDN hostname and dehydrates querystring into filename /// </summary> /// <param name="inputUrl">/path/to/file.ext?a=1&b=2</param> /// <returns>http://cdnHostname/path/to/file!cf!a=1!b=2.ext</returns> public virtual string ReplaceMediaUrl(string inputUrl, string cdnHostname) { // string versionKey = inputUrl + "_v"; // string updatedKey = inputUrl + "_d"; string cachedKey = string.Concat(WebUtil.GetScheme(), inputUrl); try { string cachedUrl = this._cache.GetUrl(cachedKey); if (!string.IsNullOrEmpty(cachedUrl)) { return cachedUrl; } // ignore fully qualified urls or data: if (WebUtil.IsExternalUrl(inputUrl) || inputUrl.StartsWith("data:") || inputUrl.StartsWith("//")) { return inputUrl; } UrlString url = new UrlString(WebUtil.NormalizeUrl(inputUrl)); UrlString originalUrl = new UrlString(WebUtil.NormalizeUrl(inputUrl)); // if the stoptoken ex. ?nfc=1 is non-empty, don't replace this url if (!string.IsNullOrEmpty(url[this.StopToken])) { url.Remove(this.StopToken); } else { if (!string.IsNullOrEmpty(cdnHostname)) { url.HostName = cdnHostname; // insert CDN hostname } if (CDNSettings.MatchProtocol) { url.Protocol = WebUtil.GetScheme(); } url.Path = StringUtil.EnsurePrefix('/', url.Path); // ensure first "/" before ~/media if (CDNSettings.FilenameVersioningEnabled) { // NOTE: DOREL CHANGE: THIS CHANGE IS NEEDED TO ADDING PARAMS TO MEDIA THAT HAVE "/~/media/" string mediaLinkPrefixWithDash = Settings.Media.MediaLinkPrefix.Replace("~", "-"); string mediaLinkPrefixWithTilde = Settings.Media.MediaLinkPrefix.Replace("-", "~"); // NOTE: DOREL CHANGE: use url.Path instead of inputUrl, because url.Path already start with "/" anyway (because of previous EnsurePrefix) // if this is a media library request if (url.Path.Contains(mediaLinkPrefixWithDash) || url.Path.Contains(mediaLinkPrefixWithTilde)) { string version = url["vs"] ?? string.Empty; string updated = string.Empty; // get sitecore path of media item string mediaItemPath = this.GetMediaItemPath(url.Path); if (!string.IsNullOrEmpty(mediaItemPath) && Sitecore.Context.Database != null) { Item mediaItem = string.IsNullOrEmpty(version) ? Sitecore.Context.Database.SelectSingleItem(mediaItemPath) : Sitecore.Context.Database.GetItem(mediaItemPath, Sitecore.Context.Language, Sitecore.Data.Version.Parse(version)); if (mediaItem == null) { // no change to url url = originalUrl; } else { // do not replace url if media item isn't public or requires Analytics processing // keep local url for this case if (!this.IsMediaPubliclyAccessible(mediaItem) || this.IsMediaAnalyticsTracked(mediaItem)) { // no change to url url = originalUrl; } else { version = mediaItem.Version.Number.ToString(); // NOTE: DOREL CHANGE: if media item doesn't have corresponding language version, then get statistic from existing language version if (!mediaItem.Statistics.Updated.Equals(DateTime.MinValue)) { updated = DateUtil.ToIsoDate(mediaItem.Statistics.Updated); } else { Language languageInternational = LanguageManager.GetLanguage("en"); Item mediaItemInternational = string.IsNullOrEmpty(version) ? Sitecore.Context.Database.GetItem(mediaItemPath, languageInternational) : Sitecore.Context.Database.GetItem(mediaItemPath, languageInternational, Sitecore.Data.Version.Parse(version)); if (mediaItemInternational != null && !mediaItemInternational.Statistics.Updated.Equals(DateTime.MinValue)) { updated = DateUtil.ToIsoDate(mediaItemInternational.Statistics.Updated); } else { foreach (Language language in mediaItem.Languages) { Item mediaItemLanguage = string.IsNullOrEmpty(version) ? Sitecore.Context.Database.GetItem(mediaItemPath, language) : Sitecore.Context.Database.GetItem(mediaItemPath, language, Sitecore.Data.Version.Parse(version)); if (mediaItemLanguage != null && !mediaItemLanguage.Statistics.Updated.Equals(DateTime.MinValue)) { updated = DateUtil.ToIsoDate(mediaItemLanguage.Statistics.Updated); break; } } } } } } } if (!string.IsNullOrEmpty(version)) { // append version number qs url.Add("vs", version); } if (!string.IsNullOrEmpty(updated)) { // append timestamp qs url.Add("d", updated); } } else // else this is a static file url { string updated = string.Empty; if (FileUtil.FileExists(url.Path)) { DateTime lastWrite = FileUtil.GetFileWriteTime(url.Path); updated = DateUtil.ToIsoDate(lastWrite); } if (!string.IsNullOrEmpty(updated)) { // append timestamp qs url.Add("d", updated); } if (CDNSettings.MinifyEnabled && (url.Path.EndsWith(".css") || url.Path.EndsWith(".js"))) { url.Add("min", "1"); } } } } string outputUrl = url.ToString().TrimEnd('?'); // prevent trailing ? with blank querystring this._cache.SetUrl(cachedKey, outputUrl); return outputUrl; } catch (Exception ex) { Log.Error(string.Format("ReplaceMediaUrl {0} {1}", cdnHostname, inputUrl), ex, this); return inputUrl; } }
/// <summary> /// Rewrites media urls to point to CDN hostname and dehydrates querystring into filename /// </summary> /// <param name="inputUrl">/path/to/file.ext?a=1&b=2</param> /// <returns>http://cdnHostname/path/to/file!cf!a=1!b=2.ext</returns> public virtual string ReplaceMediaUrl(string inputUrl, string cdnHostname) { //string versionKey = inputUrl + "_v"; //string updatedKey = inputUrl + "_d"; string cachedKey = string.Concat(WebUtil.GetScheme(), inputUrl); try { string cachedUrl = _cache.GetUrl(cachedKey); if (!string.IsNullOrEmpty(cachedUrl)) { return(cachedUrl); } // ignore fully qualified urls or data: if (WebUtil.IsExternalUrl(inputUrl) || inputUrl.StartsWith("data:") || inputUrl.StartsWith("//")) { return(inputUrl); } UrlString url = new UrlString(WebUtil.NormalizeUrl(inputUrl)); UrlString originalUrl = new UrlString(WebUtil.NormalizeUrl(inputUrl)); // if the stoptoken ex. ?nfc=1 is non-empty, don't replace this url if (!string.IsNullOrEmpty(url[this.StopToken])) { url.Remove(this.StopToken); } else { if (!string.IsNullOrEmpty(cdnHostname)) { url.HostName = cdnHostname; // insert CDN hostname } if (CDNSettings.MatchProtocol) { url.Protocol = WebUtil.GetScheme(); } url.Path = StringUtil.EnsurePrefix('/', url.Path); //ensure first "/" before ~/media if (CDNSettings.FilenameVersioningEnabled) { // if this is a media library request if (inputUrl.Contains(Settings.Media.MediaLinkPrefix)) { string version = url["vs"] ?? string.Empty; string updated = string.Empty; // get sitecore path of media item string mediaItemPath = GetMediaItemPath(url.Path); if (!string.IsNullOrEmpty(mediaItemPath) && Sitecore.Context.Database != null) { Item mediaItem = null; if (!string.IsNullOrEmpty(version)) { mediaItem = Sitecore.Context.Database.GetItem(mediaItemPath, Sitecore.Context.Language, Sitecore.Data.Version.Parse(version)); } else { mediaItem = Sitecore.Context.Database.SelectSingleItem(mediaItemPath); } if (mediaItem == null) { // no change to url url = originalUrl; } else { // do not replace url if media item isn't public or requires Analytics processing // keep local url for this case if (!this.IsMediaPubliclyAccessible(mediaItem) || IsMediaAnalyticsTracked(mediaItem)) { // no change to url url = originalUrl; } else { version = mediaItem.Version.Number.ToString(); updated = DateUtil.ToIsoDate(mediaItem.Statistics.Updated); } } } if (!string.IsNullOrEmpty(version)) { // append version number qs url.Add("vs", version); } if (!string.IsNullOrEmpty(updated)) { // append timestamp qs url.Add("d", updated); } } else // else this is a static file url { string updated = string.Empty; if (string.IsNullOrEmpty(updated)) { if (FileUtil.FileExists(url.Path)) { DateTime lastWrite = FileUtil.GetFileWriteTime(url.Path); updated = DateUtil.ToIsoDate(lastWrite); } } if (!string.IsNullOrEmpty(updated)) { // append timestamp qs url.Add("d", updated); } if (CDNSettings.MinifyEnabled && (url.Path.EndsWith(".css") || url.Path.EndsWith(".js"))) { url.Add("min", "1"); } } } } string outputUrl = url.ToString().TrimEnd('?');//prevent trailing ? with blank querystring _cache.SetUrl(cachedKey, outputUrl); return(outputUrl); } catch (Exception ex) { Log.Error(string.Format("ReplaceMediaUrl {0} {1}", cdnHostname, inputUrl), ex, this); return(inputUrl); } }
public override void Commit() { var parms = new UrlString(); foreach (var pair in ParameterDictionary.Parameters) { if (pair.Value != null) { parms[pair.Key] = pair.Value; } } foreach (var property in DynamicProperties) { string v; var value = property.Value; if (value == null) { v = string.Empty; } else if (property.Type == typeof(bool?)) { if (value is string) { v = (value as string == @"1") || (string.Compare(value as string, @"true", StringComparison.InvariantCultureIgnoreCase) == 0) ? @"1" : @"0"; } else { v = (bool)value ? @"1" : @"0"; } } else if (property.Type == typeof(DateTime)) { if (value is string) { v = value as string; } else { var dateTime = (DateTime)value; v = dateTime == DateTime.MinValue ? string.Empty : DateTimeExtensions.ToIsoDate(dateTime); } } else if (property.Type == typeof(DataBinding)) { if (value is string) { v = value as string; } else { v = ((DataBinding)value).Binding; } var dataBindingConverter = property.Converter as DataBindingConverter; if (dataBindingConverter != null && dataBindingConverter.Values != null) { var item = v; var tuple = dataBindingConverter.Values.FirstOrDefault(t => t.Item1 == item); if (tuple != null) { v = tuple.Item2; } } if (string.Compare(property.TypeName, "Checkbox", StringComparison.InvariantCultureIgnoreCase) == 0) { if (string.Compare(v, "True", StringComparison.InvariantCultureIgnoreCase) == 0) { v = "1"; } else if (string.Compare(v, "False", StringComparison.InvariantCultureIgnoreCase) == 0) { v = "0"; } } if (string.Compare(property.TypeName, "TriState", StringComparison.InvariantCultureIgnoreCase) == 0) { if (v == "1" || string.Compare(v, "True", StringComparison.InvariantCultureIgnoreCase) == 0) { v = "1"; } else if (v == "0" || string.Compare(v, "False", StringComparison.InvariantCultureIgnoreCase) == 0) { v = "0"; } else if (v == "-" || string.Compare(v, "Indetermined", StringComparison.InvariantCultureIgnoreCase) == 0) { v = "-"; } } } else if (property.Type == typeof(DropDownValue)) { if (value is string) { v = value as string; } else { var tuple = ((DropDownValue)value).Value; v = tuple != null ? tuple.Item2 : string.Empty; } } else { v = value.ToString(); } if (!string.IsNullOrEmpty(v)) { parms[property.Name] = v; } else { parms.Remove(property.Name); } } Parameters = parms.ToString(); }
/// <summary> /// Rewrites media urls to point to CDN hostname and dehydrates querystring into filename /// </summary> /// <param name="inputUrl">/path/to/file.ext?a=1&b=2</param> /// <returns>http://cdnHostname/path/to/file!cf!a=1!b=2.ext</returns> public virtual string ReplaceMediaUrl(string inputUrl, string cdnHostname) { //string versionKey = inputUrl + "_v"; //string updatedKey = inputUrl + "_d"; string cachedKey = string.Concat(WebUtil.GetScheme(), inputUrl); try { string cachedUrl = _cache.GetUrl(cachedKey); if (!string.IsNullOrEmpty(cachedUrl)) { return cachedUrl; } // ignore fully qualified urls or data: if (WebUtil.IsExternalUrl(inputUrl) || inputUrl.StartsWith("data:") || inputUrl.StartsWith("//")) return inputUrl; UrlString url = new UrlString(WebUtil.NormalizeUrl(inputUrl)); UrlString originalUrl = new UrlString(WebUtil.NormalizeUrl(inputUrl)); // if the stoptoken ex. ?nfc=1 is non-empty, don't replace this url if (!string.IsNullOrEmpty(url[this.StopToken])) { url.Remove(this.StopToken); } else { if (!string.IsNullOrEmpty(cdnHostname)) url.HostName = cdnHostname; // insert CDN hostname if (CDNSettings.MatchProtocol) url.Protocol = WebUtil.GetScheme(); url.Path = StringUtil.EnsurePrefix('/', url.Path); //ensure first "/" before ~/media if (CDNSettings.FilenameVersioningEnabled) { // if this is a media library request if (inputUrl.Contains(Settings.Media.MediaLinkPrefix)) { string version = url["vs"] ?? string.Empty; string updated = string.Empty; // get sitecore path of media item string mediaItemPath = GetMediaItemPath(url.Path); if (!string.IsNullOrEmpty(mediaItemPath) && Sitecore.Context.Database != null) { Item mediaItem = null; if (!string.IsNullOrEmpty(version)) { mediaItem = Sitecore.Context.Database.GetItem(mediaItemPath, Sitecore.Context.Language, Sitecore.Data.Version.Parse(version)); } else { mediaItem = Sitecore.Context.Database.SelectSingleItem(mediaItemPath); } if (mediaItem == null) { // no change to url url = originalUrl; } else { // do not replace url if media item isn't public or requires Analytics processing // keep local url for this case if (!this.IsMediaPubliclyAccessible(mediaItem) || IsMediaAnalyticsTracked(mediaItem)) { // no change to url url = originalUrl; } else { version = mediaItem.Version.Number.ToString(); updated = DateUtil.ToIsoDate(mediaItem.Statistics.Updated); } } } if (!string.IsNullOrEmpty(version)) { // append version number qs url.Add("vs", version); } if (!string.IsNullOrEmpty(updated)) { // append timestamp qs url.Add("d", updated); } } else // else this is a static file url { string updated = string.Empty; if (string.IsNullOrEmpty(updated)) { if (FileUtil.FileExists(url.Path)) { DateTime lastWrite = FileUtil.GetFileWriteTime(url.Path); updated = DateUtil.ToIsoDate(lastWrite); } } if (!string.IsNullOrEmpty(updated)) { // append timestamp qs url.Add("d", updated); } if (CDNSettings.MinifyEnabled && (url.Path.EndsWith(".css") || url.Path.EndsWith(".js"))) url.Add("min", "1"); } } } string outputUrl = url.ToString().TrimEnd('?');//prevent trailing ? with blank querystring _cache.SetUrl(cachedKey, outputUrl); return outputUrl; } catch (Exception ex) { Log.Error(string.Format("ReplaceMediaUrl {0} {1}", cdnHostname, inputUrl), ex, this); return inputUrl; } }
private void ParseTemplate([NotNull] XElement templateElement) { Debug.ArgumentNotNull(templateElement, nameof(templateElement)); var parameterValues = new UrlString(Parameters); DynamicProperties.Clear(); foreach (var field in templateElement.Elements()) { var n = field.GetAttributeValue("name"); if (DynamicProperties.Any(p => p.Name == n)) { continue; } var displayName = field.GetAttributeValue("displayname"); var category = field.GetAttributeValue("category"); var typeName = field.GetAttributeValue("type"); var subType = field.GetAttributeValue("subtype"); var description = field.GetAttributeValue("description"); var bindModeString = field.GetAttributeValue("bindmode"); var editor = field.GetAttributeValue("editor"); var value = HttpUtility.UrlDecode(parameterValues[n] ?? string.Empty); var bindMode = BindingMode.None; if (!string.IsNullOrEmpty(bindModeString)) { Enum.TryParse(bindModeString, out bindMode); } List <Tuple <string, string> > values = null; var valuesElement = field.Element("values"); if (valuesElement != null) { values = new List <Tuple <string, string> >(); foreach (var element in valuesElement.Elements()) { values.Add(new Tuple <string, string>(element.GetAttributeValue("displayname", element.Value), element.Value)); } } parameterValues.Remove(n); object actualValue = null; Type type; if (bindMode == BindingMode.ReadWrite || bindMode == BindingMode.Write || string.Compare(category, @"Data Bindings", StringComparison.InvariantCultureIgnoreCase) == 0) { type = typeof(DataBinding); var bindingValue = value; if (string.Compare(typeName, @"checkbox", StringComparison.InvariantCultureIgnoreCase) == 0) { if (value == @"1" || string.Compare(value, @"true", StringComparison.InvariantCultureIgnoreCase) == 0) { bindingValue = "True"; } else if (value == @"0" || string.Compare(value, @"false", StringComparison.InvariantCultureIgnoreCase) == 0) { bindingValue = "False"; } } if (values != null) { var item = values.FirstOrDefault(i => i.Item2 == bindingValue); if (item != null) { bindingValue = item.Item1; } } actualValue = new DataBinding(bindingValue); } else if (string.Compare(typeName, @"checkbox", StringComparison.InvariantCultureIgnoreCase) == 0) { type = typeof(bool?); if (value == @"1" || string.Compare(value, @"true", StringComparison.InvariantCultureIgnoreCase) == 0) { actualValue = true; } else if (value == @"0" || string.Compare(value, @"false", StringComparison.InvariantCultureIgnoreCase) == 0) { actualValue = false; } } else if (string.Compare(typeName, @"tristate", StringComparison.InvariantCultureIgnoreCase) == 0) { type = typeof(bool?); if (value == @"1" || string.Compare(value, @"true", StringComparison.InvariantCultureIgnoreCase) == 0) { actualValue = true; } else if (value == @"0" || string.Compare(value, @"false", StringComparison.InvariantCultureIgnoreCase) == 0) { actualValue = false; } else if (value == @"-") { actualValue = null; } } else if (string.Compare(typeName, @"datetime", StringComparison.InvariantCultureIgnoreCase) == 0 || string.Compare(typeName, @"date", StringComparison.InvariantCultureIgnoreCase) == 0) { type = typeof(DateTime); actualValue = value != null?DateTimeExtensions.FromIso(value) : DateTime.MinValue; } else if (values != null) { type = typeof(DropDownValue); var item = values.FirstOrDefault(i => i.Item2 == value) ?? new Tuple <string, string>(value, value); actualValue = new DropDownValue(item); } else { type = typeof(string); actualValue = value; } var dynamicProperty = new DynamicProperty(GetType(), n, displayName, type, typeName, category, description, editor, actualValue, this); dynamicProperty.Modified += RaiseModified; dynamicProperty.PropertyChanged += RaisePropertyChanged; if (type == typeof(DataBinding)) { dynamicProperty.Converter = new DataBindingConverter(values); } else if (type == typeof(DropDownValue) && values != null) { dynamicProperty.Converter = new DropDownValueConverter(values); } if (bindMode == BindingMode.Read) { dynamicProperty.IsReadOnly = true; } if (n == "Id") { OldId = value; } dynamicProperty.Attributes["subtype"] = subType; dynamicProperty.Attributes["bindmode"] = bindMode; DynamicProperties.Add(dynamicProperty); } ParameterDictionary.Parameters.Clear(); foreach (string key in parameterValues.Parameters.Keys) { ParameterDictionary.Parameters[key] = parameterValues.Parameters[key]; } }
/// <summary> /// Overide Sitecore choosing which version to open and get the latest instead /// </summary> /// <param name="urlString">Raw Url String</param> /// <param name="itemId">Id of the Item that will have the its version checked</param> private static void AddLatestVersionToUrlString(UrlString urlString, string itemId, string language) { try { urlString.Remove(Util.Constants.VersionQueryStringKeyName); urlString.Add(Util.Constants.VersionQueryStringKeyName, Context.ContentDatabase.GetItem(itemId, LanguageManager.GetLanguage(language)).Versions.GetLatestVersion().Version.ToString()); } catch (Exception exception) { Log.Audit("Trying to access an item that does exist from the recently opened tabs", exception); } }
/// <summary> /// Overide Sitecore choosing which version to open and get the latest instead /// </summary> /// <returns>Void</returns> private static void AddLatestVersionToUrlString(CommandContext context, UrlString urlString) { urlString.Remove("vs"); urlString.Add("vs", Context.ContentDatabase.GetItem(context.Parameters[0]).Versions.GetLatestVersion(). Version.ToString()); }
/// <summary> /// Run Form /// </summary> /// <param name="args"> /// The args. /// </param> protected void Run(ClientPipelineArgs args) { if (!args.IsPostBack) { var rendering = GetRendering(ShortID.Decode(args.Parameters["uniqueid"])); if (rendering == null) { return; } var urlString = new UrlString(UIUtil.GetUri("control:MediaFramework.EmbedMedia")); urlString["mo"] = "webedit"; if (!string.IsNullOrEmpty(rendering.Parameters)) { var collection = StringUtil.GetNameValues(rendering.Parameters, '=', '&'); foreach (string key in collection) { urlString[key] = collection[key]; } } if (ID.IsID(rendering.Datasource)) { urlString[Constants.PlayerParameters.ItemId] = rendering.Datasource; } string activePage = args.Parameters[Constants.PlayerParameters.ActivePage]; if (!string.IsNullOrEmpty(activePage)) { urlString[Constants.PlayerParameters.ActivePage] = activePage; } Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), "1100", "600", string.Empty, true); args.WaitForPostBack(); } else { Assert.ArgumentNotNull(args, "args"); if (args.HasResult) { var formValue = WebUtil.GetFormValue("scLayout"); var id = ShortID.Decode(WebUtil.GetFormValue("scDeviceID")); var uniqueId = ShortID.Decode(args.Parameters["uniqueid"]); var layoutDefinition = WebEditUtil.ConvertJSONLayoutToXML(formValue); var parsedLayout = LayoutDefinition.Parse(layoutDefinition); var device = parsedLayout.GetDevice(id); var deviceIndex = parsedLayout.Devices.IndexOf(device); var index = device.GetIndex(uniqueId); var rendering = (RenderingDefinition)device.Renderings[index]; UrlString url = new UrlString(this.GetParameters(args.Result)); string itemId = url[Constants.PlayerParameters.ItemId]; url.Remove(Constants.PlayerParameters.ItemId); rendering.Datasource = new ID(itemId).ToString(); rendering.Parameters = url.ToString(); parsedLayout.Devices[deviceIndex] = device; var updatedLayout = parsedLayout.ToXml(); var layout = GetLayout(updatedLayout); SheerResponse.SetAttribute("scLayoutDefinition", "value", layout); SheerResponse.Eval("window.parent.Sitecore.PageModes.ChromeManager.handleMessage('chrome:rendering:propertiescompleted');"); } } }
/// <summary> /// Overide Sitecore choosing which version to open and get the latest instead /// </summary> /// <returns>Void</returns> private static void AddLatestVersionToUrlString(CommandContext context, UrlString urlString) { urlString.Remove("vs"); urlString.Add("vs", Context.ContentDatabase.GetItem(context.Parameters[0]).Versions.GetLatestVersion(). Version.ToString()); }