Quantcast
Channel: Developer to developer
Viewing all 9076 articles
Browse latest View live

Cannot add blocks to the custom page type

$
0
0

So I have created a page type and I am using this code for that

 [ContentType(DisplayName = "Dashboard Page", GUID = "84e59e7c-0dac-4574-b87e-6c3c141e405c", Description = "Dashboard of custom logged in users")]
    public class DashboardPage : StandardPage
    {
    }

The issue I am facing is that I cannot add Block to the pages created under this page type. Am I missing something?


Specified view 'PurchaseOrder-ObjectView' can not be located in 'Order' app in Commerce Manager - Purchare Order (Edit)

$
0
0

Hi,

Is anyone here experience an error when clicking the Edit and/or View Purchase Order? The message returned is "Specified view 'PurchaseOrder-ObjectView' can not be located in 'Order' app"

I've checked the Apps folder and the PurchaseOrder-ObjectView.xml is existing in the folder. Any ideas on how to resolve this issue?

FYI. Restarting the App Service Commerce can resolve this issue but since we can't find yet the root cause of it, the issue always recur.

Regards,

SJ

Commerce: 10.5

Issue with rendering of symbols, i.e <, when using PropertyFor

$
0
0

Hi,

when trying to render a property using propertyfor with the value "word <3 word" we get a wierd result. The preview looks good, but on the page it render it as "word <3>", cutting away the rest of the string and adding a ">". 

Below is a snippet of the code

the property

public virtual string Headline { get; set; }

and the propertyfor

@Html.PropertyFor(m => m.Headline, new { CustomTag = "h2", CssClass = "content-block_heading" })

Is there a limitation in how symbol are handled by propertyfor? Or is it something else I have overlooked?

Get all instances of a certain block type in EPiServer 8

$
0
0

I may have missed the deep dive lesson on the EPiServer repository API's and figured there should be a simple way to retreive all blocks of a certain type that are published. But no, there seem to be no such thing and the other examples on this forum either perform horribly or are bad implementations that doesn't consider multiple versions, publish status and so on.

This is my routine at the moment, does anyone have any advice to make this a bit cleaner?

// loading a block type
var contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
var blockType = contentTypeRepository.Load<ContactBlock>();
// get usages, this also includes versions
var contentModelUsage = ServiceLocator.Current.GetInstance<IContentModelUsage>();
var usages = contentModelUsage.ListContentOfContentType(blockType);
var repository = ServiceLocator.Current.GetInstance<IContentRepository>();
var contactBlocks =
    usages.Select(u => repository.Get<IContent>(u.ContentLink))
        .Where(x =>
            // ...filter published
            (x as IVersionable).Status.Equals(VersionStatus.Published)
            // remove deleted&& !x.IsDeleted)
        .FilterForVisitor()
        .Cast<ContactBlock>();



Thanks

Custom Login

$
0
0

Hello,

I am going to make a custom login module for users who won't have anything to do CMS admin. Those users will have access to some certain parts of the website which the not logged in users won't have. 

I have a user database somewhere else and I will get an api endpoint to authenticate the user. I would get an authentication token along with list of modules etc which will help me give access to certain parts of the website. 

What is my best bet to use here? I googled a bit and found web api 2 solution. Is that the way to go or should I consider something else? Is there some tutorial I can refer to?

Regards

Attach custom page under some already existing page

$
0
0

I have followed this https://world.episerver.com/blogs/Daniel-Ovaska/Dates/2016/6/creating-a-custom-login-page/ tutorial to create a custom login for my application. 

What I want is to attach this page to start page some how so that I don't have to go into the admin/edit part and create from there. I don't people to be able to create multiple pages under this template. 

Because right now it comes in the edit panel as a new page type. I don't want that. Its going to be one page

Get all pages of a certain page type

$
0
0

How can I get a list of all the pages under a certain page type? 

I am trying to create a page where I will show a list of all the articles which would be under page type Article Page. 

I have found a soultion which let me gets all the decandants but I would like to get all pages irrespective of the parent but only based on the page type. 

Focus Zx1

$
0
0

Focus Zx1

percent, is caused by injuries related to acts of violence, which often involve firearms and knives. The rest is due to sports accidents, falls and accidents at work. 55 percent of spinal cord injury victims are between the ages of 16 and 30. More than 80 percent of patients w Focus Zx1 h spinal cord injuries are men. Fuente: Facts and Figures at a Glance, May 2001. National Spinal Cord Injury Statistical Center (www.spinalcord.uab.edu). Back to top of page How does the spinal cord work? To understand what happens because of a spinal cord injury.

http://www.supplementschoice.com/focus-zx1/


Setting up CMS for integration tests

$
0
0

I'm trying to find out the best way to execute Integration-tests against the CMS. Not to be confused with Unit-tests for which we could use mocks of the relevant Episerver-related implementations. We would like to have a solution which enables us to have context which we can make operations against like we would in a real Episerver-site. This is the flow I'm imagining in the best of worlds:

  1. Create an Episerver instance on demand using an empty Episerver database-template (in a testproject)
  2. Applying an exportpackage to the instance
  3. Run automated tests against the instance
  4. Pull down the instance and end the tests

I've seen examples that I've tried to replicate but I'm not fully succeeding yet. So my question is if there is anyone out there whos has pulled this (or similar) off and can give any guidance? Is this feasible or just a pipe-dream? :)

TinyMCE not loading after upgrading from 8.11 to 9.12

$
0
0

Hi,

So I am running into a weird problem.

I updated our site from 8.11 to 9.12. After doing this, the CMS is not loading the tinyMCE editor. I am getitng this error http://localhost:59458/Util/Editor/tinymce/plugins//editor_plugin.js?moduleArea=Util net::ERR_ABORTED

I am looking around for Util/Editor, but I can't find it.  Where shoudl it be? 

How do I allow TinyMCE to accept some html tags?

$
0
0

Hi,

I am updating our version of EpiServer CMS from 8.11 to 9.12. After the updagrade the previous customization was breaking tinyMCE. So removing it fixed it. Yet now I still have to impelment that change.

Where are the instructions that I can follow so that I can allow the html tags that the communication department wants to use? 

Which Url Redirect Manager would you install? pros and cons

Restricts Page using user groups

$
0
0

Hi all,

Is there any way to restrict the pages based on  the user groups?

Thanks

Template Coordinator

$
0
0

So we have upgraded a site to version 11.2 episerver cms and running into a problem in regards to the template coordinator.  It appears to be ignoring the display option tag and just falling back to the default=true value by default(of course right?).  This is all fine but appears to be ignoring my display options.  This was working before the upgrade so not sure what has changed in the decision algorithm to determine template model-> and views but curious if anyone has ran into this and what their solution was.  Attached is the template coordinator code.

  [ServiceConfiguration(typeof(IViewTemplateModelRegistrator))]
    public class TemplateCoordinator : IViewTemplateModelRegistrator
    {
public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
viewTemplateModelRegistrator.RegisterBlock<CTABlock>("IconBulletBlock", false, new[] { GlobalSettings.DisplayOptions.CTAIconBullet });
}
}
 public static class TemplateCoordinatorExtensions
    {
        public static void RegisterBlock<T>(this TemplateModelCollection viewTemplateModelRegistrator, string viewName, bool availableWithoutTag, params string[] tags)
        {
            viewTemplateModelRegistrator.Add(typeof(T), new TemplateModel
            {
                Name = viewName,
                Inherit = true,
                AvailableWithoutTag = availableWithoutTag,
                Path = TemplateCoordinator.BlockPartialPath(viewName + ".cshtml"),
                Tags = tags
            });
        }
}

Custom page property

$
0
0

Hello,

So I am trying to get a custom page property set in the admin panel. The structure shold be like this class

    public class Indexer
    {
        public string name { get; set; }
        public List<Lookup> options { get; set; } = new List<Lookup>();
    }

So when I go to editor I want to see something like

Continent      List of continent

Regions        List of regions

I am trying to create custom properties but haven't had any success as of yet. Do you guys think that this is something that could be done? 


Restriction of DisplayOptions tag not working

$
0
0

Hi,

I am using multiple display options on my website and am trying to set up a block so that it only uses one of the display options. I have got the following display options set:

    public class SungardDisplayOptionsProvider : IDisplayOptionsProvider
    {
        public const string FullWidthTag = "full";
        public const string OneHundredTag = "100";
        public const string SeventyTag = "70";
        public void InitializeOptions(EPiServer.Web.DisplayOptions options)
        {
            options
            .Add("full", "/displayoptions/full", FullWidthTag, string.Empty, "epi-icon__layout--full")
            .Add("onehundred", "/displayoptions/onehundred", OneHundredTag, string.Empty, "epi-icon__layout--full")
            .Add("seventy", "/displayoptions/seventy", SeventyTag, string.Empty, "epi-icon__layout--full")
            .Add("fifty", "/displayoptions/fifty", ContentAreaDisplayOptions.Fifty, string.Empty, "epi-icon__layout--one-third")
            .Add("thirty", "/displayoptions/thirty", ContentAreaDisplayOptions.Thirty, string.Empty, "epi-icon__layout--one-third")
            .Add("twentyfive", "/displayoptions/twentyfive", ContentAreaDisplayOptions.TwentyFive, string.Empty, "epi-icon__layout--quarter");
        }
    }

In my TemplateCoordinator I do the following:

        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(CaseStudyFullWidthTextBlock), new TemplateModel
            {
                Tags = new[] { SungardDisplayOptionsProvider.FullWidthTag },
                AvailableWithoutTag = false,
                Path = BlockPath("CaseStudyFullWidthText.cshtml"),

            });

However, when I look at the CMS, I can see the following:

"The block 'Full width text block' cannot be displayed as /displayoptions/onehundred

The block 'Full width text block' cannot be displayed as /displayoptions/thirty

The block 'Full width text block' cannot be displayed as /displayoptions/seventy

The block 'Full width text block' cannot be displayed as /displayoptions/fifty

The block 'Full width text block' when displayed as /displayoptions/full

The 'CaseStudyFullWidthTextBlock' can not be displayed using the 'Full' display option

The block 'Full width text block' cannot be displayed as /displayoptions/twentyfive"

As you can see, it looks like it's trying to display the display option with the "full" tag as requested, but for some reason it can't. Even more strangely, If I set AvailableWithoutTag to true, all the views get rendered correctly for the block, including "full". This leads me to think there is a bug in episerver (I'm using version 9), but maybe i'm missing something?

Thanks for any help,

Sam

Episerver two dropdown list connected

$
0
0

So I am trying to create two dropdown list in Episerver using Selection factory. But I want to connect them somehow.

Something like Country -> Region,

is there a way that I could do that without using DOJO? Or do I have to use it?

[SelectOne(SelectionFactoryType = typeof(CustomCountryFactory))]
public string Country { get; set; }
[SelectOne(SelectionFactoryType = typeof(CustomCountryFactory1))]
public string Region{ get; set; }



public class CustomCountryFactory : ISelectionFactory
{
public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
{
var languages = new List<SelectItem>
{
new SelectItem() { Text = "All", Value = "All" },
new SelectItem() { Text = "Norway", Value = "Norway" },
new SelectItem() { Text = "Sweden", Value = "Sweden" },
};
return languages;
}
}

For the other selection factory I am not sure what to do.

Multiple drop-down linked together

$
0
0

So I am using Selection factory to populate my dropdowns. 

Is it possible to populate a dropdown based on another dropdown?

Like Country -> Region example

Inter connected drop-downs not working

$
0
0

So I have followed this tutorial

https://world.episerver.com/blogs/Duong-Nguyen/Dates/2014/1/Country-Region-drop-down-lists-in-All-properties-mode/

in my effort to create dependent drop downs. 

    public class LocationBlock : BlockData
    {
        [SelectOne(SelectionFactoryType = typeof(CountrySelectionFactory))]
        public virtual string Country { get; set; }
        [SelectOne(SelectionFactoryType = typeof(RegionSelectionFactory))]
        [ClientEditor(ClientEditingClass = "alloy/editors/FilterableSelectionEditor", SelectionFactoryType = typeof(RegionSelectionFactory))]
        public virtual string Region { get; set; }
    }
    public class ArticlePage : StandardPage
    {
        [Display(GroupName = "IndexData")]
        public virtual LocationBlock Location { get; set; }
    }
class CountrySelectionFactory : ISelectionFactory
    {
        public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
        {
            return new Country[]
            {
            new Country() { CountryCode = "US", Name = "United States" },
            new Country() { CountryCode = "SE", Name = "Sweden" }
            };
        }
    }
    class RegionSelectionFactory : ISelectionFactory
    {
        public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
        {
            return new Region[]
            {
            new Region() { CountryCode = "US", RegionCode = "NY", Name = "New York" },
            new Region() { CountryCode = "US", RegionCode = "CA", Name = "California" },
            new Region() { CountryCode = "SE", RegionCode = "AB", Name = "Stockholm" },
            new Region() { CountryCode = "SE", RegionCode = "O", Name = "Västra Götaland" }
            };
        }
    }
    class Country : ISelectItem
    {
        public string CountryCode { get; set; }
        public string Name { get; set; }
        public string Text
        {
            get
            {
                return Name;
            }
        }
        public object Value
        {
            get
            {
                return CountryCode;
            }
        }
    }
    class Region : ISelectItem
    {
        public string CountryCode { get; set; }
        public string RegionCode { get; set; }
        public string Name { get; set; }
        public string Text
        {
            get
            {
                return Name;
            }
        }
        public object Value
        {
            get
            {
                return String.Format("{0}-{1}", CountryCode, RegionCode);
            }
        }
    }
    [EditorDescriptorRegistration(TargetType = typeof(LocationBlock))]
    public class LocationBlockEditorDescriptor : EditorDescriptor
    {
        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            base.ModifyMetadata(metadata, attributes);
            metadata.Properties.Cast<ExtendedMetadata>().First().GroupSettings.ClientLayoutClass = "alloy/LocationBlockContainer";
            metadata.Properties.Cast<ExtendedMetadata>().First().ClientEditingClass = "alloy/editors/FilterableSelectionEditor";
        }
    }




After that I created a ClientResources folder in my root. Under that I created Scripts folder and placed LocationBlockConatiner there and under Scripts I created another folder named Editors and placed my FilterableSelectionEditor there. 

I created a module.config file and the code in it looks like this

<?xml version="1.0" encoding="utf-8"?><module><dojo><!-- Add a mapping from alloy to ~/ClientResources/Scripts to the dojo loader configuration --><paths><add name="alloy" path="~/ClientResources/Scripts" /><!--<add name="alloy" path="~/ClientResources" />--></paths></dojo></module>

LocationBlockContainer is this

define(["dojo/_base/declare","dojo/_base/lang","epi/shell/layout/SimpleContainer"
],
    function (
        declare,
        lang,
        SimpleContainer
    ) {
        return declare([SimpleContainer], {
            countryDropdown: null,
            regionDropdown: null,
            addChild: function (child) {
                // Summar: Add a widget to the container
                this.inherited(arguments);
                if (child.name.indexOf("country") >= 0) {
                    // If it's the country drop down list
                    this.countryDropdown = child;
                    // Connect to change event to update the region drop down list
                    this.own(this.countryDropdown.on("change", lang.hitch(this, this._updateRegionDropdown)));
                } else if (child.name.indexOf("region") >= 0) {
                    // If it's the region drop down list
                    this.regionDropdown = child;
                    // Update the region drop down
                    this._updateRegionDropdown(this.countryDropdown.value);
                }
            },
            _updateRegionDropdown: function (country) {
                console.log(1);
                if (country !== ""&& this.previousCountry === "") {
                    this.previousCountry = country;
                }
                // Clear the current value
                if (country !== this.previousCountry) {
                    this.regionDropdown.set("value", null);
                    this.previousCountry = country;
                }
                console.log(this.regionDropdown);
                // Set the filter
                this.regionDropdown.set("filter", function (region) {
                    console.log(region);
                    return region.value.indexOf(country) === 0;
                });
            }
        });
    });

FilterableSelectionEditor.js is this

define(["dojo/_base/declare","dojo/_base/array","epi-cms/contentediting/editors/SelectionEditor"
],
    function (
        declare,
        array,
        SelectionEditor
    ) {
        return declare([SelectionEditor], {
            _allOptions: null,
            filter: null,
            _setOptionsAttr: function (options) {
                // summary: set the options
                this._allOptions = options;
                this.inherited(arguments, [array.filter(options, this.filter || function () {
                    // return all options if no filter function provided.
                    return true;
                }, this)]);
            },
            _setFilterAttr: function (filter) {
                // summary: set the option filter function
                this._set("filter", filter);
                this.set("options", this._allOptions);
            }
        });
    });

It doesn't seem to work. When I select Country the Regions are emptied and then every region is added again because the end result shows all the regions no matter what country I have selected. 

Any help here would be really appreciated. 

Media search not working

$
0
0

Hi,

Within the CMS -> Edit -> Assets Pane -> Media Tab, I am not able to search. Anything I type in returns "No results found" in the results window. I have tried reindexing the website, typing text into the fields and publishing, but nothing has worked. I do not get any errors in the logs either. Any help with the next steps I could take would be appreciated. This is using Episerver 9.

Thanks,

Sam

Viewing all 9076 articles
Browse latest View live


Latest Images