Sitecore displays multiple 'en' language options on publish - sitecore

We have an instance of Sitecore 7.5 (141003) running on an internal dev server (we're slowly going through the process of upgrading).
We have an odd issue where when you publish an item as an admin you see the following under the "Publishing Language" heading:
Select all
English
English
English
Under sitecore > System > Languages we have a single 'en' item, but with the following code we see that we have three 'en' items (Item ID matches the item under System > Languages) and two 'en-us' items (no Item ID):
<%# Page Language="C#" Debug="true" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<script runat="server">
void Page_Load(object sender, System.EventArgs e)
{
if (HttpContext.Current == null || Sitecore.Context.Database == null)
{
Response.Write("No context.");
return;
}
var languages = Sitecore.Data.Managers.LanguageManager.GetLanguages(Sitecore.Context.Database);
foreach (var language in languages)
{
Response.Write(Sitecore.Data.Managers.LanguageManager.GetLanguageItemId(language, Sitecore.Context.Database) + "<br />");
Response.Write(language.CultureInfo + "<br />");
}
}
</script>
</div>
</body>
</html>
Additionally, if I run the following query against the Master database, I see only the one item.
USE XXXSitecore_Master
SELECT TOP 10 *
FROM Items
WHERE ID = 'AF584191-45C9-4201-8740-5409F4CF8BDD'
Since this is a development server database backup and restores have been used to get it current with another server, but I believe packaging was also used.
I'm confused why there are multiple versions of 'en' with the same Item ID being returned.
How could we go about finding where these additional English languages are coming from, so that we could ultimately go through and clean them up?
Edit 1
Publish Site displays the same three English options.
Looking at the Language section in the Versions tab, English: English is displayed three times, with 12 versions for each (and all three highlighted), and then English (United States): English (United States) is displayed twice, with 2 versions for each.
Looking at the Versions, we have 10 through 1, and then 1 twice more. The date and last person to update are the same. So there are 12 versions, but version 1 is listed three times. Unable to look at the database at this time to see what I can find out about the three version 1 instances.

We had similar issue in Sitecore 8 (after adding/removing languages several times and had an exception in our code at the same time). Have no clear answer why that happened but I've created that 'virtual language' item again and then deleted it properly. That solved the issue. BTW: as far as I remember Sitecore did not allowed to create new language as it was 'existing' so we've created language item in clean Sitecore and moved it with package.

Related

Django - Google Analytics not tracking properly

Followed a tutorial and added google analytics to my django site by placeing the tracking code into the head of my base.html as well as a different page that does not extend from base.
<!DOCTYPE html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-trackcode"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-trackcode');
</script>
</head>
However the other day I ran a facebook ad and sent over 200 clicks to my site, google only tracked 30 of these clicks. And when viewing my pages it does not seem to properly track individual pages and only tracked 3 pages, the majority of the traffic is just under the root domain.
(its a blog style site so i need to see exactly what pages users are most interested in)

Prevent FOUC in context of a Kentico 10 website

Zurb Foundation recommends adding class="no-js" to the page html tag to prevent against Flash of Unstyled Content (FOUC).
We are using Kentico CMS. I'm looking for the "Kentico way" of adding a class to the html element tag in the master page. We are using the CMS portal engine.
What we're going for
<html class="no-js"
Willing to fall back into ASP.NET if there's not a more approachable way using Kentico macros or its API.
On your master page portal template you can add some code like this to make that modification:
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (CurrentDocument != null)
{
CMS.UIControls.ContentPage page= this.Page as CMS.UIControls.ContentPage;
if (page != null)
{
page.XmlNamespace += " class='no-js'";
}
}
}
</script>
You can also modify the \CMSPages\PortalTemplate.aspx page as well but that is not supported or recommended by Kentico as it typically breaks the upgrade path.
The quickest way I know of is to modify CMSPages\PortalTemplate.aspx to add your class in there.
<%# Page Language="C#" AutoEventWireup="true" Inherits="CMSPages_PortalTemplate" ValidateRequest="false" MaintainScrollPositionOnPostback="true" EnableEventValidation="false" Codebehind="PortalTemplate.aspx.cs" %>
<%=DocType%>
<html <%=XHtmlNameSpace%> <%=XmlNamespace%> class="no-js">
<head id="head" runat="server" enableviewstate="false">
...
The “no-js” is à default value. If, indeed, your browser DOES SUPPORT JavaScript, the “no-is" class will be stripped by the Modernizr engine.
Modernizr is a JavaScript library and it will check the browser capabilities and update the html class="” mention.
For example, if your browser supports the flexbox technology, the flexbox class will be added to the html class list. Otherwise, no-flexbox class will be added.
Later, when using CSS framework (Bootstrap or Foundation), some strategies could be used to emulate a missing feature.

Kentico - New fields on existing document types won't render

In Kentico 7, I added 3 new fields to the Page (menu item) document type: small_desc, long_desc and icon_class - this is in addition to the existing fields MenuItemID, MenuItemName and MenuItemTeaserImage.
On a Repeater WebPart I added the following transformation:
<li class="...">
<a class="<%# Eval("icon_class") %>" href="<%# GetDocumentUrl() %>">
<%# Eval("MenuItemName") %>
</a>
<p class="..."><%# Eval("small_desc") %></p>
</li>
A strange thing happens. While viewing the page with the Repeater in Preview mode, everything renders correctly:
<li class="...">
<a class="unique_class" href="/url.htm">
Document Title
</a>
<p class="...">A description I just added to the document.</p>
</li>
But in Live mode, I see:
<li class="...">
<a class="" href="/url.htm">
Document Title
</a>
<p class="..."></p>
</li>
So...
We've run through a plethora of troubleshooting steps...
there are absolutely no exceptions in our Event Log
everything is checked in
server cache cleared
application restarted
browser cache cleared and hard reloaded on multiple browsers and machines
My assumption was Kentico didn't like it when you add new fields to existing (Kentico default) document types. I cloned a completely new document type earlier, added all brand spanking new fields, ran a repeater on a list of new documents, and every single field showed up. I'm certain I could do that - just clone Page (menu item) and recreate all of my pages, but for (I hope) obvious reasons I'm not going to do that. Kentico Support hasn't been able to give any good direction so I turn to you smart folks!
What are the columns set in the repeater's Columns property? Isn't it possible that there are set some of them and you are missing the new ones? If it is blank, all the columns should be loaded (not good for performance though).

How to insert a HTML page into an APEX Region?

I have the following HTML page which works perfectly fine as a HTML page; however when I try put it into APEX by entering the code into a Region it just goes all wrong.
When the submit button is pressed, it takes the user to a new page with the IFRAME on rather than just refreshing the page as it does in a HTML page. The other issue is the aesthetics, it looks perfect in Firefox but in IE the IFRAME is half way down the page. When investigating in Firebug I see no attributes which would cause this.
Is there a method of embedding a HTML page into an APEX form page?
<!DOCTYPE html>
<html>
<body>
<head>
</head>
<form action="http://ukserver/orderlist.asp" target="orderResults">
Enter Order Number: <input id="ord" type="text" name="ord" maxlength="50" size="20"/>
<input type="submit" value="Submit"/>
</form>
<iframe id="orderResults" name="orderResults" src="blank.html" width="100%" height="50%">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
This is the page in FireFox which as you can see looks ok.
This is the page in IE which is incorrect
Update:
The HTML page seems to work perfectly in the HTML header of the APEX page but its above my tabs and region which isnt the place where i want it. I tried to find an order (1112) and it returned the following 'File not found' which is correct.
Hi Tony, I created another IFRAME and i guess I'm half way there. I now just have to get the HTML form working, please see below:
It sounds like you have a PDF file in a folder on a server somewhere for each order. If the names of the files are predictable given the order number then you should be able to generate a link something like this:
1) Create an item to accept the order number e.g. P12_ORDER_NUMBER.
2) Create a button to submit the page
3) Create a report that displays when P12_ORDER_NUMBER is not null and selects:
select '//server/path/fileprefix' || :P12_ORDER_NUMBER || '.pdf' as url
from dual;
4) Convert the report column into a link via the column attributes so that clicking on it launches the file.

Managing a list in umbraco 5

I have recently started working on an umbraco 5 project and am finding it a bit of a struggle compared with umbraco 4. What I am trying to do is have a list of items that are managed in the content section of the site where users can add items to a list, this list is then used in drop downs and page categories throughout the site.
I am looking for the best way to do this, I am currently part way through creating a property editor that manages a list of text boxes but not sure if this is the best way of doing it, and Im currently not entirely sure of how to go about doing even this. I can save one property no problem, but a dynamic list?
Can anybody give me some idea of how they would go about doing this with some code examples, theres not a huge amount of resources for 5 out there at the minute.
Many thanks to those who contribute.
UPDATE
I have now copied the multiple textstring property editor from the source code and am looking to update it to have an extra text input. Its using the knockout javascript library of which Im not too familar with, below is the code I have so far, does anyone know how I would update this to save both text values to the database?
<ul class="relatedlinks-textstring-inputs" data-bind="template: { name: 'textstringRow', foreach: textstrings }"></ul>
<script id="textstringRow" type="text/html">
<li style='width: 250px;'>Name<input type="text" data-bind="value: value" />Url<input type="text" data-bind="value: value" /></li>
</script>
#Html.HiddenFor(x => Model.Value, new Dictionary<string, object> { { "data-bind", "value: value" } })