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

_ContentMixin.getCurrentContext() returns incorrect context on ContentArea->Create a new Block

$
0
0

I have a custom component on a block that uses the _ContextMixin as described in the following link

https://world.episerver.com/documentation/developer-guides/CMS/user-interface/Context-sensitive-components/

If I create a new block the context describes the block where the property exists as expected.

If I, on the other hand, have a page with a ContentArea and clicks the "Create a new block" link on that content area, the context returned is not the block context but the page context where the ContentArea is located.


How should I store this data - maybe Property List? Ideas Please

$
0
0

I am currently intergrating Episerver with an API.

Its pretty simple, I post a form from my Episerver website, and the form data gets sent to the API and is processed by some other system.

I have already made a hardcoded HTML form and got the form posting to my API with no problems. - So I have got that bit to work.


Now what I need to do, is create managment functiality for the form it self.....


Requirements

A user can create a form.
One of the fields in the form needs to have a drop downlist with a dyamic list of values (configured in episerver).
The rest of the fields that appear on the form (just strings) are determined by what the user selects from the drop downlist.

(there is a fixed list of fields that could be on the form) I need to store this list somewhere in episerver.

I need for someone to be able to log on to episerver, create a new "API Form Block" enter a list of items for the drop downlist, and then for each item in that list, select from a fixed number of form fields to be assosiatited with that drop down list item.

I appriciate that there are many parts to this question, and I understand I will need to write some front end code to show/hide the correct fields based on the dropdown selection, im not asking for advice about how to do any of that.

The main thing I want suggestions on, is what features of episerver can help me to store the data structure Required, I have started looking at the PopertyList but not to sure if this is the correct approach, how could I assosiate a row in a Propertylist with Sevral rows in another PropertyList? 

This is my first EPI server project, so I'm hoping there might be something I don't know about in episerver which will make this task easy.


Ideas please........? 


UPDATE:

I have started trying to implement this using a Property List. I know how to create a basic property list, but is it possible to have a selection of check boxes in a property list? Something like this:

mvc razor does not reckognize @Html.BeginForm

$
0
0

Hi 

I looking into an admin addon. 

It is created with mvc razor.

But when I try yo use @using (Html.BeginForm from a view i get the following error:

System.Web.Mvc.HtmlHelper<"Model">' does not contain a definition for 'BeginForm' and no extension method 'BeginForm' accepting a first argument of type

Can anyone point me in the right direction?

Thanks

Managed header /footer

$
0
0

Hi, Im trying to createa managed header and footer but am unsure of the best approach.

Right now, I have a simple Header Block that utilizes LinkItemCollection

[ContentType(DisplayName = "Header Block")]
    public class HeaderBlock : BlockData
    {
        public virtual LinkItemCollection Pages { get; set; }
    }

What I would like to do is keep this block, add it to the home page and have it inherit to all the other pages.

Can i do this? Is there another way to achieve this same outcome?

Thanks,

A

Episerver ediotrial Mode became slow day after day

$
0
0

Episerver take much time to open editor mode day after day maybe due to huge pages. But is there any way to make its first . Can we do databse reindexing?or eviserver have inbuilt any job for that?

Calendar list

$
0
0
I wan't to show a text "No events", when there are no evens. How can i get the number of items that are shown in a calendar listing when using the EPiServer Calendar control?

PreviewableText field to be "normal" on initial screen

$
0
0

I have marked a field with the Previewabletext UIHint because the value should very rarely be changed after creation.  But that means it uses the same previewable behavior on the initial page creation screen as well -- is it possible to make it be a "regular" text box on initial creation, then "previewable" for all subsequent edits?

Only in Live - Wildcard Custom Redirects not working (BVN 404 handler)

$
0
0

Hi Guys,

I'm using the BVN 404 handler nuget package to do redirects in my episerver website.

I have a developer, staging and live enviroment.

One of the redirect rules I have is a wild card one. (Box checked)

so for example:

OLD URL: /uk/products/


Should go to the NEW URL

/uk/services/

as I have the wild card box ticked

/uk/products/productname - Should also be redirected.

This is working in my developer and staging enviroments, but the WILD CARD is not working on our live website. 

So on live you only get redirected if the URL is the exact match... So

/uk/products/ 

 that will work and you are redirected. but it only half works in live becuase

/uk/products/productName 

is not working in live but is working locally and in our staging enviroment.

I can't work out why, I have checked on the live server to make sure there are no other IIS re-write rules that may be conflicting, I have also made sure we have the same rules in both enviroments, but it still is not working. 

Does anyone have any ideas about what could cuase this?

What other things can I check on live?

Any ideas?


Filter displayoptions depending on block

$
0
0

Hi!

This subject has been discussed earlier but it always ends upp with someone linking to a solution from the past 80's telling me i need to manipulate the dojoscript for the displayoptions menu. Well i was inspired by the way they handle the tinyMCE component where i could just create some code behind calls with parameters and voila, it renders as i want it. I want this for the DisplayOptions menu to thus making it how it really should work in the first place. No you are wrong EPiServer. It doesnt work as people really want it to. I said NO. Quit it, you can argue if you want but you are WRONG.

The DisplayOption should clearly work in the same way tinyMCE work. I got a block with a default DisplayOption. I can now enable DisplayOptions i want to be able to choose from by filtering. The ones not in the filter shouldn't render in the DisplayOptions menu. And i don't want to do this by editing in some dojoscript. Every time there are EPiServer updates making the edited file be overwritten and BS like that.

So, are there any real solutions to the issue? Not from the 80's...

Thank you for making the time reading this rant over a simple thing like wanting a filtering function for DisplayOptions visible in the menu depending if the block has like a allowedDisplayOptionsAttribute...

Image is to illustrate the current solutions available for the issue. It's outdated...

80s

Gzip compression on IIS - Can't get it to work with or without episerver.

$
0
0

I have an existing IIS application, and I am trying to get GZIP server side compression to work. The application runs on EPIServer CMS (which I am not that familiar with) - Thinking this could be related to the CMS somehow, as a first step...

I decided to create a new IIS application and this time using Umbraco (another CMS that I am very familiar with) - I have created a basic page with some CSS files and images, but when I look in the response headers I can't see the:

Content-Encoding: gzip



header.

This is what I have tried and checked.

1. Working locally, I am running windows 10. and IIS 10
2. I have enabled Dyamic Content Compression and Static Content Compression under Internet Information Services > Performance Features in Windows Features
3. For the locally set up website in IIS I have ensured that the compression section has both Enable Dynamic & Static check boxes are ticked.
4. In my web-config file I have added this single line

<system.webServer>
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="false" />

When the Webconfig has this line I inspect the headers in my browser

**REQUEST HEADERS**

Accept: text/css,*/*;q=0.1
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Host: umbracotest.site
Proxy-Connection: keep-alive
Referer: http://umbracotest.site/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36



**RESPONSE HEADERS**

Accept-Ranges: bytes
Content-Type: text/css
Date: Tue, 01 May 2018 15:09:02 GMT
ETag: "03739d0e978d31:0"
Last-Modified: Tue, 19 Dec 2017 16:52:54 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding



5. If I change that webconfig line slightly - dynamicCompressionBeforeCache="false" to true - *then I just get a whole bunch of symbols in the browser - does that mean anything?*

6. If I add a few more lines in to my webconfig to look like this:

` <system.webServer> <httpCompression><staticTypes><add mimeType="text/*" enabled="true" /><add mimeType="message/*" enabled="true" /><add mimeType="application/javascript" enabled="true" /><add mimeType="application/x-javascript" enabled="true" /><add mimeType="image/jpeg" enabled="true" /><add mimeType="image/png" enabled="true" /><add mimeType="image/svg" enabled="true" /><add mimeType="*/*" enabled="false" /></staticTypes><dynamicTypes><add mimeType="text/*" enabled="true" /><add mimeType="message/*" enabled="true" /><add mimeType="application/javascript" enabled="true" /><add mimeType="application/x-javascript" enabled="true" /><add mimeType="image/jpeg" enabled="true" /><add mimeType="*/*" enabled="false" /></dynamicTypes><scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"
dynamicCompressionLevel="8" /></httpCompression><urlCompression doDynamicCompression="true" doStaticCompression="true"
dynamicCompressionBeforeCache="false" />`



headers are still the same.

7. C:\inetpub\temp\IIS Temporary Compressed Files\MYAPPPOOL-NAME << this folder is created but empty.

This is a ASP.net MVC application
Any ideas?

Multiple actions inside a single page controller

$
0
0

So I have been trying to do the following things

  1. Create a custom login for my website users
  2. After log in user fo to there dashboard something like dashboard/index
  3. Now I want to have sub views as follows
    1. dashboard/reports
    2. dashboard/singleReport (maybe I need a new page type for reports here)
    3. dashboard/someAction
    4. ...

The issue I am having is that should I create page types for each of these pages? I would not be adding content through the CMS into these views but the data would be coming from some external api.

It seems strange to create page types for just one page and also not adding data from cms. 

In MVC I was able to have one controller with multiple actions and that okay but here its not the case. I did wrote this code but it seems like wrong way of doing it

    public class DashboardPageController : PageControllerBase<DashboardPage>
    {
        public async Task<ActionResult> Index(DashboardPage currentPage)
        {
            /* Implementation of action. You can create your own view model class that you pass to the view or
             * you can pass the page type for simpler templates */
            MockRystadApi api = new MockRystadApi();
            var model = new DashboardPageModel(currentPage);
            foreach(var item in await api.GetReports())
            {
                model.Reports.Add(new DashboardPageModel.Report{
                    AvailableForModules = item.AvailableForModules,
                    SmallDescription = item.SmallDescription,
                    Title = item.Title,
                    Id = item.Id
                });
            }
            return View(model);
        }
        public ActionResult Report(DashboardPage currentPage, String id)
        {
            MockRystadApi api = new MockRystadApi();
            var model = new DashboardPageModel(currentPage);
            int reportId = int.Parse(id);
            var report = api.GetReport(reportId).Result;
            model.SingleReport.Id = report.Id;
            model.SingleReport.Title = report.Title;
            model.SingleReport.SmallDescription = report.SmallDescription;
            model.SingleReport.AvailableForModules = report.AvailableForModules;
            return View(model);
        }
    }

The issue with the above code is that both the actions require DashboardPageModel to be set. So I would have to fiddle with the model properties. Like when I am viewing all the reports I have the property SingleReport to be null and when I am showing overview of a single report all other data is null. 

Can I get some help here?

Using a CDN with Episerver

$
0
0

I have an existing Episerver project, all the images and media are genrally uploaded via the back office's media section.

Recently they have significantly inrecressed the amount of media on the website, and are considring, using some kind of CDN to serve the content.

Is it possible to use a CDN with episerver - I would like the back office users not to have to do anything diffrent than they do now, so still upload the images in the normal way.

Has anyone ever done something like this? where do I start?

GZIP on IIS causing CSS to output symbols/garbage - intermittently

$
0
0

I have a MVC application that is using GZIP to compress the content before it gets to the client.

This is working, however intermittently CSS files are being returned as symbols:

[![enter image description here][1]][1]

I had a few issues getting GZIP to work but in the end I added some code to my Application_BeginRequest method to force everything to get GZIPed, the web application is running on a Content Management System, so I am avoiding any CMS related paths:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (!Request.RawUrl.ToLower().Contains(".mp4")&& !Request.RawUrl.ToLower().Contains("episerver")&& !Request.RawUrl.ToLower().Contains("app_themes")&& !Request.RawUrl.ToLower().Contains("util"))
{
HttpContext context = HttpContext.Current;
context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress);
HttpContext.Current.Response.AppendHeader("Content-encoding", "gzip");
HttpContext.Current.Response.Cache.VaryByHeaders["Accept-encoding"] = true;
}


After a big of googling, I think this may have something to do with staticCompressionIgnoreHitFrequency, though I don't fully understand why.

The symbols seem to show up with I clear the cache and request the CSS file again.

can I set staticCompressionIgnoreHitFrequency in the C# code some how?

Can anyone come up with an explanation of whats going on here?

**UPDATE:**
This seems to happen only when I do hard refresh.

So I put a break point in visual studio to see if there was a difference between the request with out a hard refresh and the request with a hard refresh, and the only diffrence I could see is that the header If-Modified-Since is always null if I do a hard refesh, so I have put in an extra if statement like this:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
string IfModifiedSince = HttpContext.Current.Request.Headers["If-Modified-Since"];
if (!string.IsNullOrEmpty(IfModifiedSince))
{
if (!Request.RawUrl.ToLower().Contains(".mp4")
//&& !Request.RawUrl.ToLower().Contains(".css")
//&& !Request.RawUrl.ToLower().Contains(".js")&& !Request.RawUrl.ToLower().Contains("episerver")&& !Request.RawUrl.ToLower().Contains("app_themes")&& !Request.RawUrl.ToLower().Contains("util"))
{
HttpContext context = HttpContext.Current;
context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress);
HttpContext.Current.Response.AppendHeader("Content-encoding", "gzip");
HttpContext.Current.Response.AppendHeader("Vary", "Content-Encoding");
HttpContext.Current.Response.Cache.VaryByHeaders["Accept-encoding"] = true;
}
}



This seems to solve the problem, but I'm not sure if this is just a work around.... would really appreciate if someone can shed some light on this?

Salesforce Embedded Identity

Development Techniques For Web Designers

$
0
0

Website designers are the people behind the overall look of the website, whereas the developers are responsible for creating the feel of the website, in more common words the functionalities and the user experience (UX).

However, there is a lot to be said about the divide that is there between the website designers and the developers. Although there is a breed of humans that can do either of the tasks effectively, they are few and far between. and these are some web development point which every developer needs to know.


On-page Editor Labels Missing on Touch Screens

$
0
0

I have a laptop with a touch screen; however, I use a mouse with it 99% of the time. When you hover over a property in the On-page editor, you typically get a green bordered box and a label for the property in the top, left corner. But if you have a touch-enabled device, this doesn't work.

Some JavaScript in Dojo is responsible for adding a dijitHover class on mouseover, but if the device supports touch, the class doesn't get added, even though you're still using a mouse.

I found an article that talks about this issue in Chrome, but the suggested workaround no longer applies, and the issue affects multiple browsers now.

Redirect all URLs so they end with /

images with a space in the name are not displayed...

$
0
0

Hello everyone,

I have noticed that if I have an image in the media library with a space in the name, for instance: 'art_vacation time.png', they are not displayed and not found (even if I hit them directly) via teh website.

Even though if I go to the media library I can view them no problem. 

Any sugggestions, besided removing the space from the name?

thank you,

HF

Is there a way to stop users from accidentally expiring page

$
0
0

Hi,

    We recently have one instance where the user accidentally expired one of the landing pages. Is there any way to avoid such incidents like having restricted access to users.

Also, is there a way to register which user expired this page? I see there is a table called tblActivityLog, but can't see it getting updated when I expire a page or removing expiring.

Episerver version is 10.9

Any inputs?

Thanks,

Rams

i18n files

$
0
0

Looking to create i18n files w/ key value pairings for english and french and display on their appropriate channels...

example: 

my-french-i18n.file
-----------------
my.header = my french translation


my-english.i18n.file
------------------
my.header = my english translation


Then in the razor file, something like
------------------
<p>i18n['my.header']</p>
or
<p>i18n.getValueByKey('my.header')</p>




Cant seem to find docs on this aywhere...
How does this work in episerver?
Can someone point me in the right direction?

Thanks,

CC

Viewing all 9076 articles
Browse latest View live