public override ItemDefinition GetItemDefinition(ID itemId, Sitecore.Data.DataProviders.CallContext context) { if (_cacheClearer == null) { lock (_lockObj) { if (_cacheClearer == null) { _cacheClearer = new MongoOplogCacheClearer(this.ConnectionString, this.MongoDatabase, this.Collection, this.MappingCollection); new Thread(_cacheClearer.Start).Start(); } } } if (!_initialized) { lock (_lockObj) { if (!_initialized) { _cacheClearer.AddDatabase(this.Database); _initialized = true; } } } return null; }
public object ComputeFieldValue(Sitecore.ContentSearch.IIndexable indexable) { var sitecoreIndexable = indexable as SitecoreIndexableItem; if (sitecoreIndexable == null || !sitecoreIndexable.Item.TemplateName.Equals(TemplateKey,StringComparison.InvariantCultureIgnoreCase)) return null; return sitecoreIndexable.Item.Axes.SelectSingleItem("./ancestor-or-self::*[@@templatekey='folder']").Name + " content"; }
/// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(Sitecore.PrintStudio.PublishingEngine.PrintContext printContext, System.Xml.Linq.XElement output) { if (!string.IsNullOrEmpty(this.ChildDataKeyName)) { printContext.Settings.Parameters[this.ChildDataKeyName] = this.DataSource; } if (!string.IsNullOrEmpty(this.DataSources)) { foreach (var dataSource in this.DataSources.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)) { this.DataSource = dataSource; if (!string.IsNullOrEmpty(this.ChildDataKeyName)) { printContext.Settings.Parameters[this.ChildDataKeyName] = dataSource; } RenderChildren(printContext, output); } return; } this.RenderChildren(printContext, output); }
protected override bool DoProcessRequest(HttpContext context, MediaRequest request, Sitecore.Resources.Media.Media media) { Assert.ArgumentNotNull(context, "context"); Assert.ArgumentNotNull(request, "request"); Assert.ArgumentNotNull(media, "media"); if (this.Modified(context, media, request.Options) == Sitecore.Tristate.False) { Event.RaiseEvent("media:request", new object[] { request }); this.SendMediaHeaders(media, context); context.Response.StatusCode = 0x130; return true; } // Gets media stream for the requested media item thumbnail MediaStream stream = ProcessThumbnail(request, media); if (stream == null) { return false; } Event.RaiseEvent("media:request", new object[] { request }); this.SendMediaHeaders(media, context); this.SendStreamHeaders(stream, context); using (stream) { context.Response.AddHeader("Content-Length", stream.Stream.Length.ToString()); WebUtil.TransmitStream(stream.Stream, context.Response, Settings.Media.StreamBufferSize); } return true; }
protected override AccessResult GetItemAccess(Sitecore.Data.Items.Item item, Account account, AccessRight accessRight, PropagationType propagationType) { // //This method applies the specified AccessRight. Since the custom AccessRight //has been extended to support additional properties (max comments and //time range), these properties must be considered. var result = base.GetItemAccess(item, account, accessRight, propagationType); // // if (result == null || result.Permission != AccessPermission.Allow) { return result; } // // if (accessRight.Name != BucketRights.AddComments) { return result; } // // var right = accessRight as BucketAccessRight; if (right != null) { result = GetItemAccess(item, account, right); } return result; }
/// <summary> /// If CDN is enabled for this request, replace the outgoing media url with the cdn version /// </summary> /// <param name="item"></param> /// <param name="options"></param> /// <returns></returns> public override string GetMediaUrl(Sitecore.Data.Items.MediaItem item, MediaUrlOptions options) { string hostname = CDNManager.GetCDNHostName(); string url = base.GetMediaUrl(item, options); bool shouldReplace = !string.IsNullOrEmpty(hostname) && // cdnHostname exists for site Sitecore.Context.PageMode.IsNormal; // PageMode is normal bool dontReplace = !CDNManager.IsMediaPubliclyAccessible(item) || // media is publicly accessible CDNManager.IsMediaAnalyticsTracked(item); // media is analytics tracked CDNUrlState contextState = CDNUrlSwitcher.CurrentValue; if (contextState == CDNUrlState.Enabled) { shouldReplace = true; } else if (contextState == CDNUrlState.Disabled) { UrlString url2 = new UrlString(url); url2[CDNManager.StopToken] = "1"; url = url2.ToString(); shouldReplace = false; } if (shouldReplace && !dontReplace) // media not DMS tracked { return CDNManager.ReplaceMediaUrl(url, hostname); } else { return url; } }
public void ValidateInsertOptions() { var contentEditor = Sitecore.GoTo <ContentEditorPage>(); //Create node contentEditor.TreePanel.ExpandByXpath(_homePath) .RightClick() .ExpandByXpath <MessageBoxFrame>("Insert", "PageToTest") .SetText("PageToTest Name") .ClickOk(); var popup = contentEditor.TreePanel .ExpandByXpath("Data") .RightClick(); popup.ExpandByXpath("Insert"); try { CollectionAssert.AreEquivalent("InsertOption to test", popup.GetItemsList(ScPopupEl.MenuLevel.Second)); } finally { //Remove created node contentEditor.TreePanel .ExpandByXpath("PageToTest") .RightClick() .ExpandByXpath <MessageBoxFrame>("Delete") .ClickOk(); } }
/// <summary> /// Store source value to use to determine if an item is cloned as value is removed when items are published /// http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2013/02/Identify-Cloned-Items-Sitecore-ASPNET-CMS-Publishing-Target-Databases.aspx /// </summary> /// <param name="context"></param> public override void Process(Sitecore.Publishing.Pipelines.PublishItem.PublishItemContext context) { base.Process(context); Item versionToPublish = context.VersionToPublish; if (!context.Aborted && versionToPublish != null && versionToPublish.InheritsTemplate(BasePageNEWItem.TemplateId) && versionToPublish.Source != null && versionToPublish.IsClone) { BasePageNEWItem target = context.PublishOptions.TargetDatabase.GetItem( versionToPublish.ID, versionToPublish.Language); if (target.InnerItem != null && target.SourceItem.Field.Value != versionToPublish.Source.ID.ToString()) { using (new Sitecore.Data.Items.EditContext(target.InnerItem, updateStatistics: false, silent: true)) { target.InnerItem[target.SourceItem.Field.InnerField.Name] = versionToPublish.ID.ToString(); } } } }
/// <summary> /// Preliminary render action invoked before RenderContent <see cref="RenderContent"/>. /// </summary> /// <param name="printContext">The print context.</param> protected override void BeginRender(Sitecore.PrintStudio.PublishingEngine.PrintContext printContext) { if (!string.IsNullOrEmpty(this.RenderingItem["Item Field"])) { var dataItem = this.GetDataItem(printContext); var data = dataItem[this.RenderingItem["Item Field"]]; if (!string.IsNullOrEmpty(this.RenderingItem["Item Selector"])) { var xpath = this.RenderingItem["Item Selector"]; if (!string.IsNullOrEmpty(xpath)) { var items = dataItem.Axes.SelectItems(xpath); if (items != null) { //this.DataSources = string.Join("|", items.Select(t => t.ID.ToString()).ToArray()); foreach (Item lookup in items) { this.DataSources = lookup[this.RenderingItem["Item Field"]]; } } } } Logger.Info("found DataSources: " + this.DataSources); Logger.Info("found DataSource: " + this.DataSource); } }
/// <summary> /// Processes the specified arguments. /// </summary> /// <param name="args">The arguments.</param> public override void Process(Sitecore.Commerce.Pipelines.ServicePipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.ArgumentNotNull(args.Request, "args.request"); Assert.ArgumentNotNull(args.Result, "args.result"); RefSFArguments.TranslateEntityToOrderAddressRequest request = (RefSFArguments.TranslateEntityToOrderAddressRequest)args.Request; Assert.ArgumentNotNull(request.SourceParty, "request.SourceParty"); Assert.ArgumentNotNull(request.DestinationAddress, "request.DestinationAddress"); if (request.SourceParty is ConnectOrderModels.CommerceParty) { this.TranslateCommerceParty(request.SourceParty as ConnectOrderModels.CommerceParty, request.DestinationAddress); } else if (request.SourceParty is EmailParty) { this.TranslateEmailParty(request.SourceParty as EmailParty, request.DestinationAddress); } else { this.TranslateCustomParty(request.SourceParty, request.DestinationAddress); } TranslateEntityToOrderAddressResult result = (TranslateEntityToOrderAddressResult)args.Result; result.Address = request.DestinationAddress; }
public override List<SkinnyItem> RunQuery(Sitecore.Search.QueryBase query, bool showAllVersions) { using (var scope = QueryTraceHelper.GetQueryTraceScope(query)) { return base.RunQuery(query, showAllVersions); } }
/// <summary> /// Gets the field. /// </summary> /// <param name="field">The field.</param> /// <param name="config">The config.</param> /// <param name="context">The context.</param> /// <returns>System.Object.</returns> public override object GetField(Sitecore.Data.Fields.Field field, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) { if (field == null) return string.Empty; if (config.Setting == SitecoreFieldSettings.RichTextRaw) { return field.Value; } Guid fieldGuid = field.ID.Guid; // shortest route - we know whether or not its rich text if (isRichTextDictionary.ContainsKey(fieldGuid)) { return GetResult(field, isRichTextDictionary[fieldGuid]); } // we don't know - it might still be rich text bool isRichText = field.TypeKey == _richTextKey; isRichTextDictionary.TryAdd(fieldGuid, isRichText); // now we know it isn't rich text - return the raw result. return GetResult(field, isRichText); }
private bool InheritsFromTemplate(TemplateItem templateItem, Sitecore.Data.ID templateId) { return templateItem.ID == templateId || (templateItem.BaseTemplates != null && templateItem.BaseTemplates .Where(baseTempl => InheritsFromTemplate(baseTempl, templateId)).Count() > 0); }
public override string GetItemUrl(Sitecore.Data.Items.Item item, Sitecore.Links.UrlOptions options) { Assert.ArgumentNotNull(item, "item"); Assert.ArgumentNotNull(options, "options"); // Store real item for later use Item realItem = item; // Check if item is an wildcard item bool isWildcardItem = item.IsDatasourceItemForWildcard(); if (isWildcardItem) { item = Context.Database.GetItem(WildcardProvider.GetSetting(item.TemplateID).ItemID); } if (item == null) { item = realItem; } string text = base.GetItemUrl(item, options); if (isWildcardItem) { text = WildcardProvider.GetWildcardItemUrl(item, realItem, UseDisplayName); } return text.ToLower(); }
/// <summary> /// Retrieve field editor options controlling the field editor, /// including the fields displayed. /// </summary> /// <param name="args">Pipeline arguments.</param> /// <param name="form">Form parameters.</param> /// <returns>Field editor options.</returns> protected override Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions GetOptions(Sitecore.Web.UI.Sheer.ClientPipelineArgs args,NameValueCollection form) { Sitecore.Diagnostics.Assert.IsNotNull(args, "args"); Sitecore.Diagnostics.Assert.IsNotNull(form, "form"); Sitecore.Diagnostics.Assert.IsNotNullOrEmpty(args.Parameters[URI], URI); Sitecore.Data.ItemUri uri = Sitecore.Data.ItemUri.Parse(args.Parameters[URI]); Sitecore.Diagnostics.Assert.IsNotNull(uri, URI); Sitecore.Diagnostics.Assert.IsNotNullOrEmpty(args.Parameters["flds"], "flds"); string flds = args.Parameters["flds"]; Sitecore.Data.Items.Item item = Sitecore.Data.Database.GetItem(uri); Sitecore.Diagnostics.Assert.IsNotNull(item, "item"); List<Sitecore.Data.FieldDescriptor> fields = new List<Sitecore.Data.FieldDescriptor>(); foreach (string fieldName in flds.Split('|')) { if (item.Fields[fieldName] != null) { fields.Add(new Sitecore.Data.FieldDescriptor(item, item.Fields[fieldName].Name)); } } // Field editor options. Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions options = new Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions(form, fields); options.PreserveSections = false; options.DialogTitle = "Update Item"; options.Icon = item.Appearance.Icon; return options; }
private static void GetCustomRules(Sitecore.Pipelines.InsertRenderings.InsertRenderingsArgs args, Sitecore.Data.Items.Item item, RenderingReference reference) { string configId = Sitecore.Configuration.Settings.GetSetting("customRulesConfigFolder"); if (string.IsNullOrEmpty(configId)) { Error("Sitecore setting 'customRulesConfigFolder' not found", args.ContextItem); return; } Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; Item configFolder = db.GetItem(configId); if (configFolder == null) { Error(string.Format("Config folder {0} not found", configId), args.ContextItem); return; } if (configFolder.HasChildren && configFolder.Children.Any(r => !string.IsNullOrEmpty(r["rendering"]) && new ID(r["rendering"]) == reference.RenderingID)) { Item configItem = configFolder.Children.First(r => new ID(r["rendering"]) == reference.RenderingID); Item datasourceItem = db.GetItem(configItem["item"]); if (datasourceItem == null) { Error(string.Format("No Item containing rules set on config item at {0}", configItem.Paths.FullPath), args.ContextItem); return; } string fieldName = configItem["rule field"]; RunPromoRule(args, item, reference, datasourceItem, fieldName); } }
public object ComputeFieldValue(Sitecore.ContentSearch.IIndexable indexable) { var indexableItem = indexable as SitecoreIndexableItem; if (indexableItem == null) return null; var item = (Sitecore.Data.Items.Item)indexableItem; if (item == null) return null; var latLon = item[SourceFieldName]; if (latLon == "" || latLon == "NULL") return null; // Convert from georss point to normal X, Y format latLon = latLon.Replace(" ", ", "); var spatialContext = SpatialContext.GEO; var geohashTree = new GeohashPrefixTree(spatialContext, 10); var strategy = new RecursivePrefixTreeStrategy(geohashTree, FieldName); var shape = spatialContext.ReadShape(latLon); var grid = strategy.GetGrid(); int levelForDistance = grid.GetLevelForDistance(strategy.DistErrPct); IList<Node> list = grid.GetNodes(shape, levelForDistance, true); return list.Select(node => node.GetTokenString()); }
/// <summary> /// This function will be used to add /// table cell /// </summary> /// <param name="tableRow">Table Row</param> /// <param name="aField">Field</param> /// <param name="fieldType">Type of field</param> /// <returns></returns> private static TableCell AddTableCell(TableRow tableRow, Sitecore.Data.Fields.Field aField, FieldTypes fieldType) { TableCell tableCell1 = new TableCell(); string valueToPrint = "NA"; switch (fieldType) { case FieldTypes.DateTime: if ((aField != null) && !string.IsNullOrEmpty(aField.Value)) { string dateFormat = "r"; DateTime createdDate = DateTime.Now; createdDate = Sitecore.DateUtil.IsoDateToDateTime(aField.Value); valueToPrint = createdDate.ToString(dateFormat); } else { valueToPrint = "NA"; } break; case FieldTypes.Text: valueToPrint = ((aField != null) && !string.IsNullOrEmpty(aField.Value)) ? aField.Value : "NA"; break; default: valueToPrint = ((aField != null) && !string.IsNullOrEmpty(aField.Value)) ? aField.Value : "NA"; break; } tableCell1.Text = valueToPrint; tableRow.Cells.Add(tableCell1); return tableCell1; }
public void UpdateField(Sitecore.Data.Fields.Field field, string importValue, IImportOptions importOptions) { var selectionSource = field.Item.Database.SelectSingleItem(field.Source); if (selectionSource != null) { var query = ID.IsID(importValue) ? ".//*[@@id='" + ID.Parse(importValue) + "']" : "." + Sitecore.StringUtil.EnsurePrefix('/', importValue.Replace(importOptions.TreePathValuesImportSeparator, "/")); var selectedItem = selectionSource.Axes.SelectSingleItem(query); if (selectedItem != null) { field.Value = selectedItem.ID.ToString(); return; } } if (importOptions.InvalidLinkHandling == InvalidLinkHandling.SetBroken) { field.Value = importValue; } else if (importOptions.InvalidLinkHandling == InvalidLinkHandling.SetEmpty) { field.Value = string.Empty; } }
protected virtual AccessResult HandleDaysToAllowComments(Sitecore.Data.Items.Item item, Account account, BucketAccessRight right) { // //Allow commenting if the value is -1 since that value means comments //may be added indefinitely. //if (right.DaysToAllowComments == -1) //{ // var ex = new AccessExplanation("Comments can be added indefinitely."); // return new AccessResult(AccessPermission.Allow, ex); //} // //Deny commenting if the item has not been updated within the allowed //time range. var d1 = item.Statistics.Updated; var d2 = d1.AddDays(1.0); if (DateTime.Compare(d1, d2) != -1) { var ex = new AccessExplanation("Comments cannot be added after {0} {1}.", d2.ToLongDateString(), d2.ToLongTimeString()); return new AccessResult(AccessPermission.Deny, ex); } // //No other rules need to be implemented, so allow comments. var ex1 = new AccessExplanation("Comments can be added until {0} {1}.", d2.ToLongDateString(), d2.ToLongTimeString()); return new AccessResult(AccessPermission.Allow, ex1); }
protected void AddNotification(string message, Sitecore.Data.Items.Item item, Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs args) { Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs.ContentEditorWarning warning = args.Add(); warning.Title = "Item Naming"; warning.Text = message; warning.Icon = "/assets/img/about.png"; }
/// <summary> /// Gets the field. /// </summary> /// <param name="field">The field.</param> /// <param name="config">The config.</param> /// <param name="context">The context.</param> /// <returns>System.Object.</returns> public override object GetField(Sitecore.Data.Fields.Field field, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) { var data = field.GetBlobStream(); MemoryStream stream = null; if (data.CanRead) { stream = new MemoryStream(); byte[] buffer = new byte[2048]; int bytesRead; while ((bytesRead = data.Read(buffer, 0, buffer.Length)) > 0) { stream.Write(buffer, 0, bytesRead); } data.Close(); stream.Seek(0, SeekOrigin.Begin); } return stream; }
/// <summary> /// Preliminary render action invoked before RenderContent <see cref="RenderContent"/>. /// </summary> /// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(Sitecore.PrintStudio.PublishingEngine.PrintContext printContext, System.Xml.Linq.XElement output) { if (!string.IsNullOrEmpty(this.ChildDataKeyName)) { printContext.Settings.Parameters[this.ChildDataKeyName] = this.DataSource; } if (!string.IsNullOrEmpty(this.RenderingItem["Search Query"])) { string searches = this.RenderingItem["Search Query"]; using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext()) { var items = LinqHelper.CreateQuery(context, SearchStringModel.ParseDatasourceString(searches)) .Select(toItem => toItem.GetItem()); //This gives us our IQueryable foreach (var item in items) { this.DataSource = item.ID.ToString(); if (!string.IsNullOrEmpty(this.ChildDataKeyName)) { printContext.Settings.Parameters[this.ChildDataKeyName] = item.ID.ToString(); } Logger.LogMessage("Found item: " + item.Name); RenderChildren(printContext, output); } } } }
/// <summary> /// Retrieve field editor options controlling the field editor, /// including the fields displayed. /// </summary> /// <param name="args">Pipeline arguments.</param> /// <param name="form">Form parameters.</param> /// <returns>Field editor options.</returns> protected override Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions GetOptions(Sitecore.Web.UI.Sheer.ClientPipelineArgs args,NameValueCollection form) { Sitecore.Diagnostics.Assert.IsNotNull(args, "args"); Sitecore.Diagnostics.Assert.IsNotNull(form, "form"); Sitecore.Diagnostics.Assert.IsNotNullOrEmpty(args.Parameters[URI], URI); Sitecore.Data.ItemUri uri = Sitecore.Data.ItemUri.Parse(args.Parameters[URI]); Sitecore.Diagnostics.Assert.IsNotNull(uri, URI); Sitecore.Data.Items.Item item = Sitecore.Data.Database.GetItem(uri); Sitecore.Diagnostics.Assert.IsNotNull(item, "item"); List<Sitecore.Data.FieldDescriptor> fields = new List<Sitecore.Data.FieldDescriptor>(); try { foreach (string fieldName in GetFieldNames()) { fields.Add(new Sitecore.Data.FieldDescriptor(item, item.Fields[fieldName].Name)); } } catch (Exception ex) { Logger.Error(string.Format("Could not initialize blogentry fieldeditor. Error {0}, Stacktrace; {1}", ex.Message, ex.StackTrace), this); } // Field editor options. Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions options = new Sitecore.Shell.Applications.WebEdit.PageEditFieldEditorOptions(form, fields); options.PreserveSections = false; options.DialogTitle = "Assign categories to the current entry"; options.Icon = item.Appearance.Icon; return options; }
protected override void Evaluate(Sitecore.Pipelines.InsertRenderings.InsertRenderingsArgs args, Sitecore.Data.Items.Item item) { RuleList<ConditionalRenderingsRuleContext> globalRules = this.GetGlobalRules(item); foreach (RenderingReference reference in new List<RenderingReference>((IEnumerable<RenderingReference>)args.Renderings)) { string conditions = reference.Settings.Conditions; if (!string.IsNullOrEmpty(conditions)) { List<Item> conditionItems = this.GetConditionItems(item.Database, conditions); if (conditionItems.Count > 0) { RuleList<ConditionalRenderingsRuleContext> rules = RuleFactory.GetRules<ConditionalRenderingsRuleContext>((IEnumerable<Item>)conditionItems, "Rule"); ConditionalRenderingsRuleContext renderingsRuleContext = new ConditionalRenderingsRuleContext(args.Renderings, reference); renderingsRuleContext.Item = item; ConditionalRenderingsRuleContext ruleContext = renderingsRuleContext; rules.Run(ruleContext); } } if (globalRules != null) { ConditionalRenderingsRuleContext renderingsRuleContext = new ConditionalRenderingsRuleContext(args.Renderings, reference); renderingsRuleContext.Item = item; ConditionalRenderingsRuleContext ruleContext = renderingsRuleContext; globalRules.Run(ruleContext); } GetCustomRules(args, item, reference); } }
protected override void SetSelectedItemsOnChecklist(Sitecore.Shell.Applications.ContentEditor.Checklist list) { var listValue = GetSelectedFlagItemsAsString(this.Source); if (!string.IsNullOrEmpty(listValue)) { list.Value = listValue; } }
public bool ExecFilter(Sitecore.Data.Items.Item item) { if (item != null) { return item.Versions.Count > 1; } return false; }
public bool ExecFilter(Sitecore.Data.Items.Item item) { if (item != null) { return item.Locking.IsLocked(); } return false; }
protected void AddNotification(string message, Sitecore.Data.Items.Item item, Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs args, Item redirectitem) { Sitecore.Pipelines.GetContentEditorWarnings.GetContentEditorWarningsArgs.ContentEditorWarning note = args.Add(); note.Title = Translate.Text("Redirect Manager"); note.Text = String.Format(Translate.Text("The URL \"{0}\" is currently redirecting to this page."), redirectitem["Requested Url"]); note.AddOption(Translate.Text("Review the redirect definition"), string.Format("item:load(id={0}, language={1}, version={2})", redirectitem.ID, redirectitem.Language, redirectitem.Version)); note.AddOption(Translate.Text("Delete the redirect definition"), string.Format("redirectmanager:delete(id={0}, language={1}, version={2}, item={3})", redirectitem.ID, redirectitem.Language, redirectitem.Version, item.ID)); }
private bool DoProcessRequest(HttpContext context, Sitecore.Resources.Media.Media media) { var helper = new MediaHelper(media.MediaData.MediaItem); string redirectUrl = helper.GetCloudBasedMediaUrl(); context.Response.Redirect(redirectUrl, false); context.ApplicationInstance.CompleteRequest(); return true; }
public override object GetValue(SitecoreFieldNamePrefixAttribute fieldNamePrefixAttribute, System.Reflection.PropertyInfo pi, Sitecore.Mvc.Presentation.Rendering rendering) { string fieldName = ResolveFieldName(fieldNamePrefixAttribute, pi, FieldName); LinkField field = fieldsHelper.GetLinkField(rendering.Item, fieldName); return field.Target; }
public void ElementPublishCancel() { var contentEditor = Sitecore.GoTo <ContentEditorPage>(); contentEditor.TreePanel.ExpandByXpath(_homePath); contentEditor.RibbonPanel.SwitchTo <PublishRibbonPanel>().ClickPublishItem(); new PublishItemFrame().ClickCancel(); }
public void ElementCreateAndDelete() { var pageName = "NickQ"; var contentTree = Sitecore.GoTo <ContentEditorPage>().TreePanel; contentTree.ExpandByXpath(_homePath) .RightClick() .ExpandByXpath <MessageBoxFrame>("Insert", "Page") .SetText(pageName) .ClickOk(); contentTree.ExpandByXpath(pageName) .RightClick() .ExpandByXpath <MessageBoxFrame>("Delete") .ClickOk(); Sitecore.Dispose(); }
public void BasePageCreation() { var contentEditor = Sitecore.GoTo <ContentEditorPage>(); contentEditor.TreePanel.ExpandByXpath(_homePath) .SetFocus() .RightClick() .ExpandByXpath <MessageBoxFrame>("Insert", "Page") .SetText("a_123") .ClickOk(); var contentPanel = contentEditor.EditorPanel.Content; Console.WriteLine(contentPanel.Info); Console.WriteLine(contentPanel.MessageBarText); contentPanel.GetControl <ScTextBox>("Styling", "Body Css Class").SetText("SSSSSSSSSSSSSS"); contentPanel.GetControl <ScCheckBox>("Sitemap Settings", "No-index").Click(); contentPanel.GetControl <ScCombobox>("Sitemap Settings", "Change frequency").SelectByText("yearly"); }