How do I access zone code directly (I broke the CMS a little)

Trevor Chinn asked on August 10, 2016 12:27

Hello,

It's me again, once again clearly doing things that the CMS doesn't like. Using window.location within my code, I have seemingly broken the CMS's ability to load the design tab.

In preparation for the deployment of a new site, a coworker asked me to redirect all pages from the old site to the new site's top page.. the only problem is that having only worked here for one week, no one thought to give me access to those credentials yet. The two people who are in charge of that stuff took today and Friday off to give themselves a long break due to our public holiday tomorrow. In short, my coworker wanted the redirect done today but I had no way of doing it server side, as it should be done.

So I told this coworker that I could do a stopgap piece of JS in the master template which would throw the user to our new site once the DOM had finished parsing. I put it in the very top zone of the Master page template of the site. The redirects worked perfectly so I thought I would jump back in and comment the code a bit to let the other devs why such a strange piece of code was present.

That is when I discovered that I had broken the CMS with that one line of code <script>window.location = "www.google.com";</script>. It turns out that the CMS allows the JS to run in the design tab even when the "Web part content" checkbox is off. So anyway, what happens now is that when I try to edit any page through the design tab in the pages app, it instantly redirects the inner frame to the new site, which breaks it obviously.

What I am looking for is a way to edit that Zone's content directly, through a DB entry or something. I had a poke around the Database Objects section but couldn't find anything. I deleted the zone from the layout, which fixed the bug for the sub-pages, but for some reason the master template design tab still refuses to load. I tried disabling javascript in the browser but of course, Kentico is built almost entirely in JS which meant that I couldn't get the page to even load without it. I am totally stumped.

Image Text

All I need to do is delete one line from one defined zone, but I can't access it. Any and all help would be much appreciated.

Edit: Oh and by the way, reverting to previous "versions" did nothing to solve the problem.

Correct Answer

Anton Grekhovodov answered on August 10, 2016 12:42

Hi,

Firstly, try to do it in Page Templates application Image Text

Next time, wrap you code in if statement where you will check Viewmode:

{% if (ViewMode == "LiveSite") { %}
window.location = "test.com";
{% } |(identity)GlobalAdministrator%}

Also, you can change a webpart content manually on Webpart tab on screenshot above.

3 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Chinn answered on August 10, 2016 13:14

There is no way to comment here, so I suppose a follow up answer will have to do.

Anton, thank you for your advice. The design tab did not work in the Page Templates application, but I was able to roll back to a previous version successfully using that screen, which has now solved the problem. I don't know why the versioning didn't work from the Pages application, but I am very happy to have it all sorted out.

Oh, and thank you for that Viewmode snippet, I have implemented it and all is now well. Much appreciated!!!

0 votesVote for this answer Mark as a Correct answer

Saurav Kumar answered on August 10, 2016 13:44

Hi Trevor,

The versioning thing on Pages application rolls back the pages content whereas the changes you did was on the Page Template side (including the Master page changes) so it wasn't actually being rolled back from the pages application.

Thanks,
Saurav

1 votesVote for this answer Mark as a Correct answer

Anton Grekhovodov answered on August 10, 2016 13:48

You're welcome, Trevor) I'm happy that it helped you.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.