protected override void SetEditorConfiguration(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata)
 {
     //we send some custom initialization parameters to our Dojo widget here!
     EditorConfiguration["choice1StoreName"] = "multipledropdownproperty.firstchoicedropdownreststore";
     EditorConfiguration["choice2StoreName"] = "multipledropdownproperty.secondchoicedropdownreststore";
     base.SetEditorConfiguration(metadata);
 }
 private void ContentEvents_PublishedContent(object sender, EPiServer.ContentEventArgs e)
 {
     if (e.Content is StoreLocationPage)
     {
         var storeLocation = e.Content as StoreLocationPage;
         // Update if not set already and warehouse code is added
         if (!string.IsNullOrEmpty(storeLocation.WarehouseCode) && string.IsNullOrEmpty(storeLocation.Address))
         {
             // Find the warehouse
             var warehouse = WarehouseHelper.GetWarehouse(storeLocation.WarehouseCode);
             if (warehouse != null)
             {
                 StoreLocationPage updatedPage = storeLocation.CreateWritableClone() as StoreLocationPage;
                 // Map properties to page
                 updatedPage.Address = SetupAddress(warehouse.ContactInformation.Line1, warehouse.ContactInformation.Line2);
                 updatedPage.City = warehouse.ContactInformation.City;
                 updatedPage.PostCode = warehouse.ContactInformation.PostalCode;
                 updatedPage.State = warehouse.ContactInformation.State;
                 updatedPage.Country = warehouse.ContactInformation.CountryName;
                 updatedPage.Telephone = warehouse.ContactInformation.DaytimePhoneNumber;
                 updatedPage.Fax = warehouse.ContactInformation.FaxNumber;
                 updatedPage.Email = warehouse.ContactInformation.Email;
                 // Update
                 var repository = ServiceLocator.Current.GetInstance<IContentRepository>();
                 repository.Save(updatedPage, EPiServer.DataAccess.SaveAction.ForceCurrentVersion);
             }
         }
     }
 }
예제 #3
0
 void Instance_PublishingContent(object sender, EPiServer.ContentEventArgs e)
 {
     if (e.Content as ParticipantBlock != null) {
         ParticipantBlock participant = (e.Content as ParticipantBlock);
         ParticipantLog.AddLogText("Saved", "Participant saved with e-mail "+participant.Email+" and status "+participant.AttendStatus, participant);
     }
 }
예제 #4
0
 public override IEnumerable<IParticipant> GetParticipants(EPiServer.Core.ContentReference EventPageBase)
 {
     List<IParticipant> participants = new List<IParticipant>();
     for(int i = 0; i < 10; i++)
         participants.Add(GenerateParticipant(EventPageBase, "test"+i+"@test.com", false, null, "Created test participant"));
     return participants;
 }
 public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context)
 {
     IContentEvents contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>();
     contentEvents.CreatedContent += ContentEventsOnCreatedContent;
     contentEvents.DeletedContent += ContentEventsOnDeletedContent;
     contentEvents.SavedContent += ContentEventsOnSavedContent;
 }
        public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            SelectionFactoryType = typeof(ColorSelectionFactory);
            ClientEditingClass = "alloy/editors/ColorPickerEditor";

            base.ModifyMetadata(metadata, attributes);
        }
예제 #7
0
        public override void SetDefaultValues(EPiServer.DataAbstraction.ContentType contentType)
        {
            Steps = 100;
            PagesCount = 100;

            base.SetDefaultValues(contentType);
        }
예제 #8
0
 public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata,
     IEnumerable<Attribute> attributes)
 {
     base.ModifyMetadata(metadata, attributes);
     var groupKeyAttribute = attributes.FirstOrDefault(a => typeof (TagsGroupKeyAttribute) == a.GetType()) as TagsGroupKeyAttribute;
     var cultureSpecificAttribute = attributes.FirstOrDefault(a => typeof(CultureSpecificAttribute) == a.GetType()) as CultureSpecificAttribute;
     EditorConfiguration["GroupKey"] = Helpers.TagsHelper.GetGroupKeyFromAttributes(groupKeyAttribute, cultureSpecificAttribute);
 }
        /// <summary>
        /// Initalize method
        /// </summary>
        /// <param name="context"></param>
        public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context)
        {
            var formTypeModelSynchronizer = ServiceLocator.Current.GetInstance<IFormTypeModelSynchronizer>();

            // Search for FormData implementations
            formTypeModelSynchronizer.Analyze();

            // Commit the forms
            formTypeModelSynchronizer.Commit();
        }
예제 #10
0
 public static string ContentUrl(this UrlHelper urlHelper, EPiServer.SpecializedProperties.LinkItem item)
 {
     var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>();
     IContent content = urlResolver.Route(new UrlBuilder(item.Href));
     if (content == null)
     {
         return item.Href.Replace("~/", "/");
     }
     return urlHelper.ContentUrl(content.ContentLink);
 }
예제 #11
0
 /// <summary>
 /// This method looks for exceptions in the DataSourceStatusEventArgs parameter and invalidates a validator with the corresponding exception message.
 /// </summary>
 /// <param name="sender">The sender (the SearchDataSource).</param>
 /// <param name="e">The <see cref="EPiServer.Web.WebControls.DataSourceStatusEventArgs"/> instance containing the event data.</param>
 protected void HandleErrors(object sender, EPiServer.Web.WebControls.DataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         CustomValidator1.ErrorMessage = e.Exception.Message;
         CustomValidator1.Text = e.Exception.Message;
         CustomValidator1.IsValid = false;
         e.ExceptionHandled = true;
     }
 }
예제 #12
0
 static void Instance_DeletedPage(object sender, EPiServer.PageEventArgs e)
 {
     if(e.Page != null && e.Page.PageLink != null) {
         List<Relation> relationsToDelete = RelationEngine.Instance.GetRelationsForPage(e.Page.PageLink.ID);
         foreach (Relation relation in relationsToDelete)
         {
             RelationEngine.Instance.DeleteRelation(relation);
         }
     }
 }
        private void SavingMediaFile(object sender, EPiServer.ContentEventArgs e)
        {
            var content = e.Content as MediaData;
            if (content == null)
                return;
            var fs = FileReader.GetFileSize(content);

            var mediaFile = content as IFileProperties;
            mediaFile.FileSize = fs;
        }
        public string Map(EPiServer.Core.PageData pageData, EPiServer.Core.PropertyData propertyData)
        {
            var links = propertyData as PropertyLinkCollection;
            if (links != null)
                return string.Format("[ {0} ]",
                                     String.Join(",", links.Select(
                                         l => string.Format("{{ \"href\":\"{0}\", \"text\":\"{1}\", \"target\":\"{2}\", \"title\":\"{3}\"  }}", l.Href, l.Text, l.Target, l.Title
                                                  ))));

            return "[]";
        }
예제 #15
0
        public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata,
            IEnumerable<Attribute> attributes)
        {
            base.ModifyMetadata(metadata, attributes);
            var groupKeyAttribute = attributes.FirstOrDefault(a => typeof (TagsGroupKeyAttribute) == a.GetType()) as TagsGroupKeyAttribute;
            var cultureSpecificAttribute = attributes.FirstOrDefault(a => typeof(CultureSpecificAttribute) == a.GetType()) as CultureSpecificAttribute;
            var getaAttribute = attributes.FirstOrDefault(a => typeof(GetaTagsAttribute) == a.GetType()) as GetaTagsAttribute;

            metadata.EditorConfiguration["GroupKey"] = Helpers.TagsHelper.GetGroupKeyFromAttributes(groupKeyAttribute, cultureSpecificAttribute);
            metadata.EditorConfiguration["allowSpaces"] = getaAttribute?.AllowSpaces ?? false;
            metadata.EditorConfiguration["allowDuplicates"] = getaAttribute?.AllowDuplicates ?? false;
            metadata.EditorConfiguration["readOnly"] = getaAttribute?.ReadOnly ?? false;
            metadata.EditorConfiguration["caseSensitive"] = getaAttribute?.CaseSensitive ?? true;
        }
        protected override bool ProcessXFormAction(System.Web.Mvc.Controller controller, EPiServer.XForms.Util.XFormPostedData post)
        {
            var xFormData = new XFormPageHelper().GetXFormData(controller, post);
            var xform = XForm.CreateInstance(xFormData.FormId);

            if (xform != null && xFormData.GetValue("formName").Equals("Yes", StringComparison.OrdinalIgnoreCase))
            {
                var from = post.SelectedSubmit.Sender;
                var to = post.SelectedSubmit.Receiver;
                PerformCustomAction(xFormData, post.SelectedSubmit.Subject, to, from);
             }

            return base.ProcessXFormAction(controller, post);
        }
예제 #17
0
        public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            ClientEditingClass = "bit.editors.BitForm";

            //var LivePath = "/BitForm";
            var LivePath = "/BitForm";

            this.EditorConfiguration["FormLivePath"] = LivePath;
            this.EditorConfiguration["FormSaveDef"] = string.Format("{0}/SaveDefinition/", LivePath);
            this.EditorConfiguration["FormGetDef"] = string.Format("{0}/GetDefinition/", LivePath);
            this.EditorConfiguration["FormSaveData"] = string.Format("{0}/SaveData/", LivePath);
            this.EditorConfiguration["FormGetData"] = string.Format("{0}/GetData/", LivePath);
            this.EditorConfiguration["FormViewData"] = string.Format("{0}/ViewData/", LivePath);

            base.ModifyMetadata(metadata, attributes);
        }
예제 #18
0
 private string GetDataType(EPiServer.Core.PropertyDataType propertyDataType)
 {
     switch (propertyDataType)
     {
         case EPiServer.Core.PropertyDataType.Boolean:
             return "bool";
         case EPiServer.Core.PropertyDataType.Category:
             return "CategoryCollection";
         case EPiServer.Core.PropertyDataType.Date:
             return "DateTime";
         case EPiServer.Core.PropertyDataType.FloatNumber:
             return "double";
         case EPiServer.Core.PropertyDataType.LinkCollection:
             return "LinkItemCollection";
         case EPiServer.Core.PropertyDataType.LongString:
             return "string";
         case EPiServer.Core.PropertyDataType.Number:
             return "int";
         case EPiServer.Core.PropertyDataType.PageReference:
             return "PageReference";
         case EPiServer.Core.PropertyDataType.PageType:
             return "int";
         case EPiServer.Core.PropertyDataType.String:
             return "string";
         default:
             return "object";
     }
 }
 public PermanentContentLinkMap Find(EPiServer.Core.ContentReference contentReference)
 {
     var pageMaps = _linkMaps.Where(map => map is PermanentContentLinkMap).Cast<PermanentContentLinkMap>();
     return pageMaps.SingleOrDefault(map => contentReference.CompareToIgnoreWorkID(map.ContentReference));
 }
        public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            ClientEditingClass = "epiimage.editors.EPiImage";

            base.ModifyMetadata(metadata, attributes);
        }
예제 #21
0
 public DataAccessBaseEx(EPiServer.Data.IDatabaseHandler handler)
     : base(handler)
 {
     this.Database = handler;
 }
예제 #22
0
 public abstract bool RuleExists(EPiServer.Data.Identity id);
예제 #23
0
 public abstract Rule GetRule(EPiServer.Data.Identity id);
 /// <summary>
 /// Constructs a new instance of <see cref="AttributeDisplayOptionsResolver"/>.
 /// </summary>
 /// <param name="displayOptions">A list of available displayoptions.</param>
 /// <param name="cache">An <see cref="IObjectInstanceCache"/> object used for caching.</param>
 public AttributeDisplayOptionsResolver(EPiServer.Web.DisplayOptions displayOptions, IObjectInstanceCache cache)
 {
     this.displayOptions = displayOptions;
     this.cache = cache;
 }
예제 #25
0
 public abstract EPiServer.Core.PageDataCollection SearchRelations(Rule rule, int pageID, string searchKeyWord, EPiServer.Core.PageReference hierarchyStart, bool isLeftRule);
예제 #26
0
 void events_PublishedContent(object sender, EPiServer.ContentEventArgs e)
 {
     RestHook.InvokeRestHooks("content_published", ContentAPiController.ConstructExpandoObject(e.Content));
 }
 public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context)
 {
     DataExporter.Exporting -= this.DataExporter_Exporting;
 }
 public PermanentLinkMap Find(EPiServer.UrlBuilder url)
 {
     var noLang = new UrlBuilder(url);
     noLang.QueryCollection.Remove("epslanguage");
     return _linkMaps.SingleOrDefault(map => map.MappedUrl == noLang.Uri || map.PermanentLinkUrl == noLang.Uri);
 }
 /// <summary>
 /// Uninitialize
 /// </summary>
 /// <param name="context"></param>
 public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context)
 {
 }
        public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            ClientEditingClass = "alloy/editors/MultipleImagesEditor";

              base.ModifyMetadata(metadata, attributes);
        }