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

Property List - Show/Hide Property for CMS editors based on other Property value

$
0
0

Background:

I need to implement the ability for CMS editors to associate a list of facets to a page type.

They need to be able to select the facets from a pre-defined list, reorder the facets and add ranges for range facets.

I'm using Episerver CMS 10.10.4. 

Issue:

I'm trying to use property lists to define the facets and the facet ranges, so I don't implement a custom property from scratch. However, I couldn't find a solution that works with property lists for hiding the ranges when adding/editing non-range facets

e.g. 

I've tried adding a block to contain the property list or the property list item, but that breaks out the display for the property list.

References: 

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

https://developerschallenges.com/2017/11/02/episerver-all-properties-component-for-showing-and-hiding-content-using-a-drop-down/

Does anyone have an idea on how I can achieve this?

Code:

public class ProductListingPage : SitePage
{
        [Display(
            Name = "Custom Facets to display on page")]
        public virtual IList<CustomFilter> CustomFacetsList { get; set; }
}

[PropertyDefinitionTypePlugIn]
public class CustomFilterProperty: PropertyListBase
{
}
public class CustomFilter
{
	[SelectOne(SelectionFactoryType = typeof(FacetDefinitionSelectionFactory))]
	[Required]
	public string Filter { get; set; }
	[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor))]
	public IList Ranges { get; set; }
}
[PropertyDefinitionTypePlugIn]
public class RangeFilterProperty: PropertyListBase
{
}
public class RangeFilter
{
	public int? From { get; set; }
	public int? To { get; set; }
}

[EditorDescriptorRegistration(TargetType = typeof(IList))]
public class CustomFilterCollectionEditorDescriptor: CollectionEditorDescriptor
{
	public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable attributes)
	{
		ClientEditingClass = "app/editors/CustomFilterCollection";
		base.ModifyMetadata(metadata, attributes);
	}
}

CustomFilterCollection.js

define(["dojo/_base/array","dojo/_base/declare","dojo/_base/lang","epi-cms/contentediting/editors/CollectionEditor"
],
function (
    array,
    declare,
    lang,
    CollectionEditor
) {
    return declare([CollectionEditor], {
        _getGridDefinition: function () {
            var result = this.inherited(arguments);
            result.ranges.formatter = function (values) {
                return values != null ? values.map(msc => msc.from + " - " + msc.to).join("
") : ""; }; return result; } }); });

How can I find out if a block is being used on any published page?

$
0
0

I have an episerver project that has lots of blocks over time some of these blocks are no longer needed, is there a way to see if a created block is being used on any pages in my episerver project?

Potentially want to remove block types that will no longer be used from the code, but I'm not sure if it may break something down the line.

SiteSeeker 4.2.91.1 upgrade, This operation is only valid on generic types

$
0
0

I upgraded SiteSeeker libraries from 4.2.89.1 to 4.2.91.1.

The site was using this type of solution to add a custom meta tag for UnifiedFile:
http://blogg.siteseeker.se/2012/06/27/anvand-siteseekers-indexeringsstod-for-filer-i-episerver/

After upgrade I got this error on startup: "This operation is only valid on generic types"

I solved it by using my own "siteseeker/fileinformation.aspx"-ish file but a bit annoying that things break without notes in the release log.

Still waiting for a call back from support...

Upgrade to version 11: This request has probably been tampered with

$
0
0

Hi,

I am upgrading a solution from 7.5 to 11. So far I have got the solution working fine in version 10.10.4.
When trying to upgrade further to 11.3.2, I keep getting the classical "This request has probably been tampered with. Close the browser and try again.", with irregular intervals on localhost.

I am also trying to upgrade from MVC 4 to 5 when moving from v 10 to 11.

Has anyone experienced the same when upgrading to v 11 and found a solution?

Get parent page block

$
0
0

I am trying to get the parent block (which is a property) in the child page. 

I got this 

var page = contentRepository.Get<PageData>(currentPage.ParentLink);

But how to get the property?

PROPERTY LIST - Can't see all items in Episerver back end, is this a bug?

$
0
0

I am working on my first Episerver Project and I have come across a problem with the UI.

I have a block Type with a PROPERTY LIST property. However when I add more than five items you can't see them all in UI.


http://pasteboard.co/Hf2ynJ4.png  < Screen shot
I have another 10 Rows I can't see.... 
Is this a bug in Episerver??

How to: Get block Items from a ContentArea based on its type

$
0
0

I have a page type with a ContentArea as one of its properties

(currentPage.PrimaryComponentArea)

How can I get the block items stored in this property based on its type.

I also want to be to access properties on the block so I need to convert it from ContentAreaItem to the actuall block type.

 public ActionResult Index(RatePlanPageType currentPage)
        {
          ..........
          var allItems = currentPage.PrimaryComponentArea.Items;
          var blocks = allItems.Where(x => bla bla bla  < Can I do it using linq
        }

this is my first Episerver project so I hope this is not a stupid question.

Determining if a page is being moved from the recycle bin

$
0
0

In Global.asax.cs I need a way to figure out whether a page is being moved from the recycle bin to some other place in the tree. The only possible way to detect this as far as I know is to traverse the tree all the way up to see if it goes to PageReference.StartPage or PageReference.WasteBasket.

Is there any better way?


The image cannot be displayed because it contains errors

$
0
0

When I upload an image to Episerver media via the back office.

For some reason when I then go to the URL for the image I see this error:

The image [URL] cannot be displayed because it contains errors.

However when I go to the App_Data > Blobs > and navigate to one of the images I have uploaded when I load the image in to the browser it works with no issues.


I have no idea, why or how to fix it. Has anyone come across this kind of thing before? any ideas about how I can debug this issue?

FallbackWithMaster vs Fallback LanguageLoaderOption

$
0
0

Hi,

There are FallbackWithMaster & Fallback  LanguageLoaderOptions which DefaultContentLoader uses to load a content. FallbackWithMaster loads content like Fallback, additionally in case of no available fallback language it loads from the Master language. So, FallbackWithMaster looks like a better option to use always. Any information around use cases, which option to use when? 

No OWIN authentication manager is associated with the request.

$
0
0

Hi guys,

I want to add an Web API end point to my episerver project. I have set up the URL end point by following these simple steps.


https://world.episerver.com/blogs/rejaie-johnson/dates/2017/5/episerver-cms--web-api/

However when I try and access my end point URL I get the following error:
No OWIN authentication manager is associated with the request.

I have tried 

adding this line to my WebConfig

<add key="owin:AutomaticAppStartup" value="true"/>

But I get the same error.

The API will return a PDF file based on some paramerters and is public facing so needs no Authentication as such.


Any ideas? - 



unable to access image files

$
0
0

I have image file stored in my episerver website Admin mode > File Management. But when I try to open the images eror 404 come that page doesnot exist.

If i view the thumnails of the image still the images are not showing up.

Conditional Validation on a BlockType/PageType

$
0
0

I have a Block Type wich has these two properties.

[CultureSpecific]
[Display(
Name = "Display PDF Button", GroupName = TabNames.PDFCustomisation, Order = 0)]
public virtual bool DisplayPdfButton { get; set; }
[CultureSpecific]
[Required]
[Display(
Name = "Download Pdf Text", GroupName = TabNames.PDFCustomisation, Order = 1)]
public virtual string DownloadPdfText { get; set; }



I only want DownloadPdfText to be required if the user sets DisplayPdfButton to True. - Is this possible to do in Episerver?

Where can I find the demo projects (source] to see how to build the search facets?

$
0
0

any links, ideas, directions will be very much appreciated.

thank you

PROPERTY LIST - Is it possible to Customize appearance in back office

$
0
0


I'm using a property list in the back office.

I have an image as one of the properties, the problem I have is it only shows the content Id in the property list table, this is a really poor UI experince.
In addition one of the properties are a URL, again instead of showing a friendly URL it shows and internal URL, again not a very good UI experince for a content editor.

Is there a way to change this?

https://pasteboard.co/Hgp1zyk.png  < Screen Shot 

I am new to EPI server and though I have come accross some good features, what is kind of disapoiting are elements of the UI, a property list table like this could look much much better than this.

Can I customise it?


Episerver Certification - Practice Tests

$
0
0

Hi Guys, 

I have been working on my first Episerver project over the last few weeks, coming from an Umbraco Back ground I can see lots of similar concepts and now I understand the basics I am starting to enjoy this Episerver thing.

When learning something new I have always found it useful to read the documentation, but all so where possible do a certification.

I haven't decided yet if I will take up an Episerver Certification, but are there any practice/mock questions avalible? Then I can study each each question, a great way to jumpstart learning.

Page Type Node Becomes None Editable when intercepting PublishedContent Event

$
0
0

I am hooking in to the PublishedContent Event within Episerver, so when a user publishes a particular page type some logic is performed (create pdf) and a string value is saved in to one of the properties.(the path to the pdf)

This is working, the PDF is created and the path to the PDF is also saved.

However the problem I have is after the publish is complete, all the properties become readonly, I have to click another node, then click that one again before I can edit it. - Is this normal, or is it something to do with the way I do the save?

This is my code:

public void Initialize(InitializationEngine context)
        {
            var events = ServiceLocator.Current.GetInstance<IContentEvents>();
            events.PublishedContent += EventsPublishedContent;
        }
        private void EventsPublishedContent(object sender, ContentEventArgs e)
        {
            if (e.Content is myType)
            {
                var currentPage = e.Content as RatePlanPageType;
                var pdfPath = businessLogic.CreatePdf(e.content);
                var clone = currentPage.CreateWritableClone();
                clone.Property["PdfFiles"].Value = pdfPath;
                var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
                contentRepository.Save(clone, SaveAction.Save);
            }

This is a screen shot after saving

If I click another node in the tree, then click this one again, it goes back to normal and all the data is saved correctly.

System.InvalidOperationException on ImageServiceClient

$
0
0

I use EPiServer.ImageLibrary ImageServiceClient RenderImage method to render a cropped image. This was the code before upgrade to EPiServer CMS 11.5 and this was working fine.

var imageService = new ImageServiceClient("ImageServiceClientEndPoint");

After the upgrade, this code shows a compile error;

'ImageServiceClient.ImageServiceClient(string)' is obsolete: 'Use constructor that takes options instead, read options from container' 

Accordingly, I changed the code as follows;

ImageServiceOptions options = new ImageServiceOptions();
options.ClientEndpoint = "ImageServiceClientEndPoint";
var imageService = new ImageServiceClient(options);

Then I was able to compile successfully. But now this throws this exception;

System.InvalidOperationException: 'Could not find endpoint element with name 'ImageServiceClientEndPoint' and contract 'EPiServer.ImageLibrary.IImageService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.'

What have I done wrong here? 

Running Episerver In a Load balanced environment.

$
0
0

We are running Episerver in a Load balanced enviroment, we have 3 nodes.

1 Node is dedicated to the CMS (so www.website.com/episerver)

then the other two nodes are dedicated to the public facing website (so www.website.com)


I have currently added some functionality that generates a PDF file during the Publishevent when logged in to episerver. This fuuncotality is working correctly but the issue I have is.....

becuase its a load balanced enviroment the generated PDF is not on the other nodes, so the link to it on the website fails.


My first instinict to solve this problem is to contact the people that manage our servers and ask them to set up replication on the folder the PDFs are saved too, but for reasons I won't bore you with, we can't actually do that.

So....... I was thinking, currently when a bit of media file is uploaded via the CMS, we don't need to do anything special to make the media available on the public facing website, so I can assume that replication for the media is already set up.

Instead of generated the PDF and writing it to the disk, I was thinking if I programaticly create a media entry in to Episerver it should be replicated and work in our Load balanced enviroment with out having to make any changes to the servers.

Is this possible? If so can someone help me out with some code samples of how to create a new media item?

Any other ideas of how I can solve this issue?

Learning about working with AI features as a developer

$
0
0

Hi everyone,

I cannot find any place to read how can I configure AI features on EPiServer and what can I do with it as a developer. I could only find the white papers in here, but it is not for developers. It is full of sales person talks about the AI without specifying any technical data.

https://www.episerver.com/success/think/thank-you-for-downloading/ai-guides-engage-thank-you/?fileid=377582f7-6b53-4aa1-aca8-7202e0bde706&mkt_tok=eyJpIjoiWkRRM056QTFaVGxrWldReCIsInQiOiJjOUs3dTBBdDhvdmxJcVhaSStlb1dNeW40MDJMNHZRRTVUam4rTmVJU3pldlF6NjZTajFvaXhtM3JYZjA3NnQrQ0dsNlF3Z0hpVUpmekJsY0Q0NVM5Wk9oNnNFdElcLzRiSDdIVlBiNEd4eGFHSHNxVUJ2YVlDZENQVDJpZ1hwUm0ifQ==

Am I looking into a wrong place? 

Viewing all 9076 articles
Browse latest View live