Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ds 191 posts 223 karma points
    Sep 12, 2011 @ 14:40
    ds
    0

    Llink in xml file

    Hi again Dimitri,

    I have come across with a problem on which I need your help. I have a slidehow on my homepage which gets its data from an xml file. In that file

    <?xml version="1.0"?>
    <opml version="1.1"> 
        <head>
            <title>My gallery</title>
        </head>
        <body>   
            <outline type="rss" xmlUrl="http://www.mypage.com/news/mypage.aspx" />
            <outline type="xml" xmlUrl="http://www.mypage.com/news/video.aspx" />
        </body>
    </opml>

    What I try to achieve is that when you change language from language selector, I should change mypage.aspx into mypage.aspx?lang=en  as you might guess. That is why I try to create an xslt file for desired result

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
      <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library"
                    xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
                    xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
                    xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
                    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
    <xsl:output method="xml" omit-xml-declaration="yes" />
    <xsl:param name="currentPage" />
    <xsl:include href="../xslt/LanguageParameter.xslt" />
    <xsl:template match="/">
    <xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
    <opml version="1.1">  
      <head>     
        <title>My gallery</title>
      </head> 
      <body>
      <xsl:choose>
        <xsl:when test="Exslt.ExsltRegularExpressions:test($requestLang, '^[a-zA-Z][a-zA-Z]$') = 1 and $requestLang = en">
          <outline type="rss" xmlUrl="http://www.mypage.com/news/mypage.aspx?lang=en"/>
        </xsl:when>
        <xsl:otherwise>   
            <outline type="rss" xmlUrl="http://www.mypage.com/news/mypage.aspx" />
        </xsl:otherwise>
      </xsl:choose>
        <outline type="xml" xmlUrl="http://www.mypage.com/news/video.aspx" />
      </body>
    </opml>
    </xsl:template>
    </xsl:stylesheet>

    Even though I get xml result, nothing happens if I would ever add ?lang=en paramater into url and always get the <outline type="rss" xmlUrl="http://www.mypage.com/news/mypage.aspx"/>.

  • dimi309 245 posts 579 karma points
    Sep 12, 2011 @ 16:27
    dimi309
    0

    Hello again ds!

    Could you try to use this?

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
      <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library"
                    xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
                    xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
                    xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
                    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
    <xsl:output method="xml" omit-xml-declaration="yes" />
    <xsl:param name="currentPage" />
    <xsl:include href="../xslt/LanguageParameter.xslt" />
    <xsl:template match="/">
    <xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
    <opml version="1.1">  
      <head>     
        <title>My gallery</title>
      </head> 
      <body>
    <xsl:choose
        <outline type="rss" xmlUrl="http://www.mypage.com/news/mypage.aspx?lang={$langISO}" />
        <outline type="xml" xmlUrl="http://www.mypage.com/news/video.aspx" />
      </body>
    </opml>
    </xsl:template>
    </xsl:stylesheet>

    Let me know if it works for you.

    Best regards,

    Dimitri

     

  • ds 191 posts 223 karma points
    Sep 13, 2011 @ 09:16
    ds
    0

    Hi Dimitri,

    Your code snippet works and it changes if you would ever change lang paramater like in the following but the problem is that I have to set this xml file path in Adobe Flash so after setting file path and publishes a swf file, no matter your code works, it gets the default language in this case english. This is where I am stuck at right now.

    <?xml version="1.0"?>
    <opmlversion="1.1">  
       
    <head>
           
    <title>My gallery</title>
       
    </head>
       
    <body>    
           
    <outlinetype="rss"xmlUrl="http://www.mypage.com/news/mypage.aspx?lang=en|gr"/>
           
    <outlinetype="xml"xmlUrl="http://www.mypage.com/news/video.aspx"/>
       
    </body>
    </opml>

    mypage.aspx has a template which is attacted to RSS created by xslt. I also changed that xslt rss code snippet like in the following but if you would ever click a news in slideshows which in turns forwards you news detail page, I get "A potentially dangerous Request.QueryString value was detected from the client (~/<link xmlns:media="...helper">  <a href="/news/k...")."

      <xsl:template match="* [@isDoc]">
        <xsl:if test="position() &lt;= $RSSNoItems">
          <item>
            <title>
              <!--<xsl:value-of select="@nodeName"/>   -->
                      <xsl:call-template name="PropertyReferenceTranslation">
                        <xsl:with-param name="nodeId" select="@id" />
                        <xsl:with-param name="Property" select="'title'" />
                        <xsl:with-param name="langISO" select="$langISO" />
                      </xsl:call-template>      
            </title>
            <link>
              <!--<xsl:value-of select="$SiteURL"/>
              <xsl:value-of select="umbraco.library:NiceUrl(@id)"/>-->
            <a href="{concat(umbraco.library:NiceUrl(@id), '?lang=', $langISO)}" ></a>
            </link>
            <description>
              <!--<xsl:value-of select="newsDescription" disable-output-escaping="yes"/>-->  
                     <xsl:call-template name="PropertyReferenceTranslation">
                        <xsl:with-param name="nodeId" select="@id" />
                        <xsl:with-param name="Property" select="'newsDescription'" />
                        <xsl:with-param name="langISO" select="$langISO" />
                      </xsl:call-template>
            </description>      
            <pubDate>
              <xsl:value-of select="umbraco.library:FormatDateTime(@createDate,'r')" />
            </pubDate>
            <dc:date.Taken>
              <xsl:value-of select="umbraco.library:FormatDateTime(@createDate,'r')" />
            </dc:date.Taken>
            <author>
               <xsl:value-of select="@writerName"/>
             </author>        
             <guid>
               <xsl:value-of select="$SiteURL"/>
               <xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
             </guid>
            <media:content url="{umbracoFile}" />
            <media:title type="plain">
                      <xsl:call-template name="PropertyReferenceTranslation">
                        <xsl:with-param name="nodeId" select="@id" />
                        <xsl:with-param name="Property" select="'title'" />
                        <xsl:with-param name="langISO" select="$langISO" />
                      </xsl:call-template>          
              <!--<xsl:value-of select="title"/>-->  
            </media:title>
            <media:description type="html">
                      <xsl:call-template name="PropertyReferenceTranslation">
                        <xsl:with-param name="nodeId" select="@id" />
                        <xsl:with-param name="Property" select="'newsDescription'" />
                        <xsl:with-param name="langISO" select="$langISO" />
                      </xsl:call-template>
              <!--<xsl:value-of select="newsDescription"/>-->  
            </media:description>
            <media:credit role="Software Developer">Deniz Karadal</media:credit>     
          </item>
        </xsl:if>
      </xsl:template>

     

    The more important I think I have just found a bug which polyglot prevents all button controls working in explorer.  I have discovered that it is related to "language selector" and it is still not validated against w3c validator. For example if I would attach language selector on master template, button controls ie. login page is unable to work at all.

    If you need to have a closer look, I can just simply suplly credentials to you. In this case please let me know your mail where I can contact you all details and my webpage address

  • dimi309 245 posts 579 karma points
    Sep 13, 2011 @ 23:26
    dimi309
    0

    Hello ds!

    About your first problem, if I understood it correctly, I think that you may be having trouble due to .NET4 security. I am not an expert in this matter, but as far as I have been able to find out, the equals (=) sign in a URL can be considered dangerous by the system so it may cause this exception. This is just a wild guess but, given this error, maybe your parameter gets filtered out and that's why you get the english version, if that is the default language on your site.
    I don't know if it's a good idea but I have found this article about switching off this sort of URL validation.

    Regarding the language selector not being validated and not allowing the button controls to work, are you sure that the issue is not due to something else apart from the language selector or the package? I have been using the package on my site and after the latest corrections the control does not produce any errors on validator.w3.org. Also, I have had no problems with buttons or even web forms. To illustrate this I have set up a little test page on my site:

    http://dimitros.net/sayhello?lang=en

    It is a simple form where you can enter a name or any word and it will respond by saying hello to that name once you click the Say Hello button. This seems to work without any problem. Also, if you try validating the page, you will see that, even though there is a language selector at the top left, no error associated with it is returned by the validator (just an error related to a Facebook specific link rel, which I had added). Maybe you can check the html source of this page and see if there is something fundamentally different between its structure and the structure of your pages?

    In any case, I do not think that it is a good idea that I log in to your back office. There would be a couple of issues arising from such a thing, security related and otherwise. But if you have any further questions I would be happy help you if I can.

    Best regards,

    Dimitri

  • ds 191 posts 223 karma points
    Sep 14, 2011 @ 16:06
    ds
    0

    Hi Dimitri,

    Thanks for the valuable feedback. About my first problem, I try to pass a variable to flash so xml file path should be set according to selected language but I am far to conclusion for the time being. For the A potentially dangerous Request.QueryString, I will check your suggestion though but I have not had time for it as well

    The most biggest problem I faced is button controls on explorer. Here is a page on my website under http://bit.ly/qqGNMA

    If you would have a closer look at and try to click the button, you would realize that it does not work. What I did is to remove language selector from header and then It worked. I also checked from w3c validator under http://bit.ly/qLh3zk . As you would see, it is all related to language selector.


     

     

  • dimi309 245 posts 579 karma points
    Sep 14, 2011 @ 23:56
    dimi309
    0

    Hello Deniz!

    You're welcome!

    Thanks for the links. I've had a look at the site. I think it's very nicely styled by the way.

    About the issues, indeed there was still a problem with the markup of the language selector. I was leaving a tag open. The reason this didn't show up when I was validating the my site was that I am using HTML5 where, for some strange reason, this is allowed :)

    This was not the only problem however. I have noticed that the web pages with forms on the site you have shown me are structured like web forms. Basically each entire page is a form. I had made the language selector so that it is independent of a web form, carrying its own little html form around it. This however means that when it is placed in another form, issues can arise: Markup issues because I think that it is recommended not to place forms inside other forms and also possibly functionality issues like the ones you are facing.

    I have prepared a new version of the package in order to resolve this. So, I suggest you download the new version, PolyglotXslt_1.23.zip and try to use it (after uninstalling the previous version).

    In this new version I have corrected the markup and I have also added a new macro, called "Language Selector For WebForm". You can either try to place the original language selector outside the form on your pages, or, if that is not possible you could use the "Language Selector For WebForm" instead. I have made this for such situations, so that it can be placed inside forms without interfering with them.

    I hope that this works. Let me know :)

    Best regards,

    Dimitri

  • ds 191 posts 223 karma points
    Sep 15, 2011 @ 09:19
    ds
    0

    Hi Dimitri!,

    You have really helped me a lot and I think I might consider myself as test user for your package in that manner :)

    Before configuring last steps for your package, there is couple of points on which I need your help again.

    First, all button controls work on explorer (Thumbs up). Moreover I will validate against w3c validator.

    1) I set default language as Turkish. When I hit homepage(you already know my site url),  apart from menu which is Turkish, rest is set as English. I have already added <add key="uPolyglotDefaultLanguage" value="tr" /> between appSettings in web.config, <xsl:variable name="initlang">tr</xsl:variable> as initlang in LanguageParamater of xslt, setpageculture macro right after body tag. Do I miss something?

    2) On sub pages, I am able to set 2nd level Navigation using TranslatedNavigation macro. What I am trying to achieve in here is that on subpages display 3rd level as well if there is ever any.

    SubPageMenu : 

    -Level2
        -Level3
        -Level3
    -Level2
    -Level2
        -Level3

    3) I have a loginview structure like in the following:

     <asp:LoginView ID="LoginView1" runat="server">
        <AnonymousTemplate>
            <span class="input"><umbraco:Item field="#You are not logged-in:" runat="server"></umbraco:Item> <asp:LoginStatus ID="LoginStatus1" runat="server" /> <umbraco:Item field="#Or" runat="server"></umbraco:Item> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="/Register.aspx"><umbraco:Item field="#Register" runat="server"></umbraco:Item></asp:HyperLink></span>
        </AnonymousTemplate>
        <LoggedInTemplate>
            <span class="input"><umbraco:Item field="#Hello" runat="server"></umbraco:Item> <asp:LoginName ID="LoginName1" runat="server" /> <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="/ControlPanel.aspx"><umbraco:Item field="#Control Panel" runat="server"></umbraco:Item></asp:HyperLink> | <asp:LoginStatus ID="LoginStatus2" runat="server" /></span>
        </LoggedInTemplate>
    </asp:LoginView>                            

    It is translated as you change language ie. english but upon clicking the english version, it is displayed again default language which in this case Turkish.

  • dimi309 245 posts 579 karma points
    Sep 15, 2011 @ 16:30
    dimi309
    0

    Hello Deniz!

    Indeed the package has progressed a lot thanks to your feedback and extensive testing! You are certainly an official tester! :)

    I'm glad the controls are working now. Thanks for the thumbs up!

    I have just had a chance to have a look now and it seems to me that you have already solved issue 1 and 2? The language seems to be switching properly even on the menu on the right...

    About the third issue, I think you need to somehow append the ?lang=(tr or en) parameter to the hyperlinks. It might be a little difficult to do that within <asp:Hyperlink> tags, which I see are being used in the code. Perhaps, instead of those, you could generate <a href> links the way we had discussed in the thread "Language Selector" (page 1 message 5), by using a macro like the one I had listed there? (the first code listing in the message).

    I hope that this helps!

    Cheers,

    Dimitri

  • ds 191 posts 223 karma points
    Sep 15, 2011 @ 17:08
    ds
    0

    Hi Dimitri!,

    Regarding 1st question, I appended div tag along with id=LanguageSelector

            <div id="LanguageSelector">
              <umbraco:Macro Alias="LanguageSelectorForWebForm" runat="server"></umbraco:Macro>
            </div>

    perhaps you might need to make a correction for that to the polyglot package cause that was the only way I could find to make it work.

    I have not solved the issue regarding the 2nd question. As I pointed out I need to show 3rd level if there is so need still your help on that actually.

    I will try your suggestion about third issue but what about adding lang paramater to loginstatus?

    <asp:LoginStatus ID="LoginStatus1"runat="server"/>

    Regards,

    Deniz

  • dimi309 245 posts 579 karma points
    Sep 15, 2011 @ 19:37
    dimi309
    0

    Hi Deniz!

    About the first question, the visual studio drop down list component which I am using for web forms creates a long auto-generated id. I thought that a div like the one you have put around it would help a lot for css styling but I didn't think that it would actually cause problems in the functionality. So thank you very much for the tip! I will investigate this.

    Sorry about not understanding that the 2nd question was not resolved. I see now. You need another TranslatedNavigation macro & xslt, which would support a second level. I have had a look at your html markup and, based on it, I believe that the xslt should be something like this:

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE xsl:stylesheet [
      <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library"
                    xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
                    xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
                    xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
                    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
      <xsl:output method="xml" omit-xml-declaration="yes" />
      <xsl:param name="currentPage" />
      <xsl:include href="../xslt/LanguageParameter.xslt" />
      <xsl:include href="../xslt/PropertyReferenceTranslation.xslt" />
      <xsl:template match="/">
        <xsl:param name="UlCssId" select="macro/UlCssId" />
        <xsl:param name="Level" select="macro/Level" />
        <xsl:param name="NaviHideProperty" select="macro/NaviHideProperty" />
        <xsl:param name="CurrentItemCssClass" select="macro/CurrentItemCssClass" />
        <xsl:param name="TitlePropertyAlias" select="macro/TitlePropertyAlias" />
        <ul id="{$UlCssId}">
          <xsl:for-each select="$currentPage/ancestor-or-self::*[@level=$Level and @isDoc]/child::*[@isDoc]">
            <xsl:variable name="hide">
              <xsl:choose>
                <xsl:when test="string-length($NaviHideProperty)!=0">
                  <xsl:value-of select="child::*[name()=$NaviHideProperty]" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="child::*[name()='umbracoNaviHide']" />
                </xsl:otherwise>
              </xsl:choose>
            </xsl:variable>
            <xsl:if test="$hide!='1' or string-length($hide)=0">
              <xsl:variable name="link">
                <xsl:choose>
                  <xsl:when test="string-length($langISO)=0">
                    <xsl:value-of disable-output-escaping="yes" select="umbraco.library:NiceUrl(@id)" />
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of disable-output-escaping="yes" select="concat(umbraco.library:NiceUrl(@id), '?lang=', $langISO)" />
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:variable>
              <xsl:variable name="currentPageTypeAlias" select="name()" />
              <xsl:variable name="title">
                <xsl:call-template name="PropertyReferenceTranslation">
                  <xsl:with-param name="nodeId" select="@id" />
                  <xsl:with-param name="Property" select="$TitlePropertyAlias" />
                  <xsl:with-param name="langISO" select="$langISO" />
                </xsl:call-template>
              </xsl:variable>
              <xsl:variable name="currentCss">
                <xsl:if test="contains(umbraco.library:NiceUrl($currentPage/@id),umbraco.library:NiceUrl(@id))">
                  <xsl:value-of select="$CurrentItemCssClass" />
                </xsl:if>
              </xsl:variable>
              <li class="{$currentCss}">
                <a href="{$link}" title="{$title}">
                  <xsl:value-of disable-output-escaping="yes" select="$title" />
                </a>
                <xsl:for-each select="child::*[@isDoc]">
                  <xsl:variable name="hideChild">
                    <xsl:choose>
                      <xsl:when test="string-length($NaviHideProperty)!=0">
                        <xsl:value-of select="child::*[name()=$NaviHideProperty]" />
                      </xsl:when>
                      <xsl:otherwise>
                        <xsl:value-of select="child::*[name()='umbracoNaviHide']" />
                      </xsl:otherwise>
                    </xsl:choose>
                  </xsl:variable>
                  <xsl:if test="($hideChild!='1' or string-length($hideChild)=0) and
                                  Exslt.ExsltRegularExpressions:test(name(), '_TranslationFolder') != 1 ">
                     <xsl:variable name="linkChild">
                      <xsl:choose>
                        <xsl:when test="string-length($langISO)=0">
                          <xsl:value-of disable-output-escaping="yes" select="umbraco.library:NiceUrl(@id)" />
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of disable-output-escaping="yes" select="concat(umbraco.library:NiceUrl(@id), '?lang=', $langISO)" />
                        </xsl:otherwise>
                      </xsl:choose>
                       </xsl:variable>
                       <xsl:variable name="titleChild">
                          <xsl:call-template name="PropertyReferenceTranslation">
                            <xsl:with-param name="nodeId" select="@id" />
                            <xsl:with-param name="Property" select="$TitlePropertyAlias" />
                            <xsl:with-param name="langISO" select="$langISO" />
                          </xsl:call-template>
                        </xsl:variable>  
                     <ul><li><a href="{$linkChild}" title="{$titleChild}"><xsl:value-of select="$titleChild" /></a></li></ul>
                  </xsl:if>
                </xsl:for-each>
              </li>
            </xsl:if>
          </xsl:for-each>
        </ul>
      </xsl:template>
    </xsl:stylesheet>

    Maybe you can try adding this to your system. I would name it something like Translated2LevelNavigation.xslt (don't delete or modify the original Translated Navigation xslt or macro). You then need to create a corresponding macro and link it to the xslt. Don't forget to declare the exact same parameters in the macro as those declared in the Translated Navigation macro, otherwise it will not work. You can then replace the translated navigation of your second level menu with this one. I think it will work, or will require very few modifications, but let me know.

    Finally, about the asp:LoginStatus tag, I am not sure but you might not need to do anything about it. The asp:HyperLink tags just render <a href> tags on the client. But I suspect that the asp:LoginStatus tag will just do a postback when someone logs in, so the language parameter should stay put in the url and the language should remain the same. This is just an assumption though, so let me know how it went! :)

    Best regards,


    Dimitri

  • ds 191 posts 223 karma points
    Sep 15, 2011 @ 22:27
    ds
    0

    Hi Dimitri!

    I tried your suggestion about the second question, just need a minor adjustment. Please have a look at http://bit.ly/qHa9Lj .Try to click 3rd level link which is "Maximum Tariff" for example. Upon clicking it would show again only 2nd level links. What I try to achieve in here, keep persistence of 2nd and 3rd level structure shown whole time.

    About loginstatus, I can translate loginstatus for AnonymousTemplate but there is no way for loginstatus of LoggedInTemplate cause it should logout the user and display again AnonymousTemplate which in this case not possible. I think it would be a good idea to support loginview function for polyglot package. Just a suggestion.

                  <asp:LoginView ID="LoginView1" runat="server">
                    <AnonymousTemplate>
                        <span class="input"><umbraco:Item field="#You are not logged-in:" runat="server"></umbraco:Item> <umbraco:Macro url="/Login.aspx" dictionaryItem="Login" Alias="HeaderTopMenuLoginview" runat="server"></umbraco:Macro> <umbraco:Item field="#Or" runat="server"></umbraco:Item> <umbraco:Macro url="/Register.aspx" dictionaryItem="Register" Alias="HeaderTopMenuLoginview" runat="server"></umbraco:Macro></span>
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        <span class="input"><umbraco:Item field="#Hello" runat="server"></umbraco:Item> <asp:LoginName ID="LoginName1" runat="server" /> <umbraco:Macro url="/ControlPanel.aspx" dictionaryItem="Control Panel" Alias="HeaderTopMenuLoginview" runat="server"></umbraco:Macro> | <asp:LoginStatus ID="LoginStatus2" runat="server" /></span>
                    </LoggedInTemplate>
                  </asp:LoginView>

    Best Regards,

    Deniz

     

  • dimi309 245 posts 579 karma points
    Sep 15, 2011 @ 23:16
    dimi309
    0

    Hi Deniz!

    Could you please let me know what you are passing as the "Level" parameter to the modified Translated Navigation macro in your template? It could have nothing to do with the problem but it will help if I know while I am thinking about a solution.

    Thanks for the information about the login status! I will look into this and see how I can improve things.

    Cheers,

    Dimitri

  • ds 191 posts 223 karma points
    Sep 16, 2011 @ 07:49
    ds
    0

    Hi Dimitri!,

    I am passing that macro

    <umbraco:Macro UlCssId="sidebarInnerTopMenuNavSub" Level="2" NaviHideProperty="" CurrentItemCssClass="" TitlePropertyAlias="title" Alias="TranslatedNavigationSub" runat="server"></umbraco:Macro>
  • dimi309 245 posts 579 karma points
    Sep 16, 2011 @ 09:34
    dimi309
    0

    Good morning Deniz!

    I have tested the xslt locally and I cannot reproduce this problem... It always seems to work.

    This might be a silly question, but are you sure that you are using the exact same modified translated navigation macro for the level 2 menu in both pages and not the original?

    Best regards,

    Dimitri

     

  • ds 191 posts 223 karma points
    Sep 16, 2011 @ 10:40
    ds
    0

    Good morning Dimitri!

    It is not a silly question at all cause you are right that the templates for level2 and level3 pages were different so I made the correction and it works. Sorry for the inconvenience. Doing many things at the same time causes such things. I have tons of things to do.

    I hope you would come up with an idea with loginview function. By the way I will finish to translate and check every detail of polyglot package on my website on the weekend and let you know about the results.

    Best Regards,

    Deniz

  • dimi309 245 posts 579 karma points
    Sep 16, 2011 @ 11:31
    dimi309
    0

    Hi Deniz!

    I hear you! Deploying a new site can be quite stressful! :)

    By the way, you might already be aware of these, but here's a couple of pointers on security. You might not want to do these while developing locally but on a public site they are very important:

    1) In every Umbraco's web.config file there is a setting:

    <add key="umbracoDebugMode" value="true" />

    It's set to true by default. It has to be set to false, otherwise everyone will be able to see a lot of sensitive information about the site whenever it crashes.

    2) In the same file there is also a <customErrors> tag. This has to be set like this:


    <customErrors mode="On" defaultRedirect="error.aspx" />


    (error.aspx is a page you can create informing visitors that there was an error. You can even create an error.html page and just put it into your root umbraco folder and declare that one instead)

    Again, the above is to avoid people seeing sensitive information about your site if it crashes. You can also set mode="RemoteOnly" if you want the errors to show up when you are connected locally but not to anyone who is connected remotely.

    3) Finally in the the folder "config", in the file "umbracoSettings.config" there is an <errors> tag and inside it there is an <error404> tag. You can set this one to the id of a page you can develop to inform visitors that a page they have requested was not found. Otherwise they get a message by Umbraco, which has intentionally been made ugly :)

    I don't know if you have already done these things but I am just mentioning them because they can really shield your site against malicious attacks.

    I will let you know when I manage to do something about LoginView.

    Good luck with the rest of the work!

    Cheers,

    Dimitri

  • dimi309 245 posts 579 karma points
    Sep 18, 2011 @ 19:35
    dimi309
    0

    Hello Deniz!

    I have made some tests on a local site regarding the LoginStatus issue you had mentioned.

    I hope I have understood the problem you have described correctly. I have noticed in the tests that everything worked ok appart from one thing. I could log in and out of my site and the language would be maintained and everything would be translated. The only thing that would reset the language would be clicking on the "Login" link of LoginStatus. That would redirect me to the login page but the language parameter would not be taken into consideration.

    I have noticed that the reason was that the "Login" button takes all parameters and places them in a "ReturnUrl" parameter. I was able to solve this with some code locally. It is a bit of a hack, and I cannot take responsibility for how it will behave if you use it, so please test it well if you do so.

    This is the code. You could try adding it somewhere towards the top of the template of your login page:

    <%
        string requestLang = Request.Params["lang"];
        if (String.IsNullOrEmpty(requestLang))
        {
            string language = string.Empty;
            try
            {
                string req = Request.Url.ToString();
                if (req.Contains("lang="))
                {
                    language = req.Substring(req.IndexOf("lang=") + 5, 2);
                }
            }
            catch
            {
                
            }

            if (string.IsNullOrEmpty(language)) language = "tr";

            if (Request.Params.Count == 0)
            {
                Response.Redirect(string.Format("{0}{1}{2}", Request.Url.ToString(), "?lang=", language));
            }
            else
            {
              Response.Redirect(Request.Url.ToString().Replace("?Return", string.Format("{0}{1}{2}", "?lang=", language, "&Return")));
            }
        }
    %>

    I hope that it helps!

    Best regards,

    Dimitri

  • ds 191 posts 223 karma points
    Sep 19, 2011 @ 10:26
    ds
    0

    Hi Dimitri!,

    Sorry for late response. Had a day off for relaxing :) Firstly, I took your suggestion into consideration about security issues. About loginstatus, I appreciate your help.

    Based on your suggestion, I made some changes and it works now. You could try and have a look at it. Second eye is always better than one. I want to share code about loginstatus.

    I created a usercontrol for loginview and attached it using macro on master template.

    On user control

    <asp:LoginView ID="LoginView1" runat="server">
        <AnonymousTemplate>
            <span class="input"><umbraco:Item field="#You are not logged-in:" runat="server"></umbraco:Item> <asp:LoginStatus ID="LoginStatus1" runat="server" /> <umbraco:Item field="#Or" runat="server"></umbraco:Item> <umbraco:Macro url="/Register.aspx" dictionaryItem="Register" Alias="HeaderTopMenuLoginview" runat="server"></umbraco:Macro></span>
        </AnonymousTemplate>
        <LoggedInTemplate>
            <span class="input"><umbraco:Item field="#Hello" runat="server"></umbraco:Item> <asp:LoginName ID="LoginName1" runat="server" /> <umbraco:Macro url="/ControlPanel.aspx" dictionaryItem="Control Panel" Alias="HeaderTopMenuLoginview" runat="server"></umbraco:Macro> | <asp:LoginStatus ID="LoginStatus2" runat="server" /></span>
        </LoggedInTemplate>
    </asp:LoginView> 

    Code-Behind user control

            protected void Page_Load(object sender, EventArgs e)
            {
                var ls = (LoginStatus)LoginView1.FindControl("LoginStatus1");
                var ls2 = (LoginStatus)LoginView1.FindControl("LoginStatus2");
                if (ls != null)
                {
                    ls.LoginText = umbraco.library.GetDictionaryItem("Login");
                }

                if (ls2 != null)
                {
                    ls2.LogoutText = umbraco.library.GetDictionaryItem("LogOut");
                }
            }

     and login page template

    <%@ Master Language="C#" MasterPageFile="~/masterpages/umbMaster.master" AutoEventWireup="true" %> 
    <asp:content contentplaceholderid="cp_content" runat="server">
    <%
        string requestLang = Request.Params["lang"];
        if (String.IsNullOrEmpty(requestLang))
        {
            string language = string.Empty;
            try
            {
                string req = Request.Url.ToString();
                if (req.Contains("lang="))
                {
                    language = req.Substring(req.IndexOf("lang=") + 5, 2);
                }
            }
            catch
            {
                
            }

            if (string.IsNullOrEmpty(language)) language = "tr";

            if (Request.Params.Count == 0)
            {
                Response.Redirect(string.Format("{0}{1}{2}", Request.Url.ToString(), "?lang=", language));
            }
            else
            {
              Response.Redirect(Request.Url.ToString().Replace("?Return", string.Format("{0}{1}{2}", "?lang=", language, "&Return")));
            }
        }
    %>
      <div id="leftcontent">
        <div id="page-bgtop">
            <div class="post">
              <h2 class="title"><span><umbraco:Macro Property="title" Alias="PropertyTranslation" runat="server"></umbraco:Macro></span></h2>          
               <div class="entry">
                  <umbraco:Macro Alias="Login" runat="server"></umbraco:Macro>
               </div>
            </div>   
        </div>
      </div>  
    </asp:content>

     

    I thank you all the effort you have shown so far and would like to get your opinion about my website. Tell me what you like and do no like or what else must be done etc?

    Best Regards,

    Deniz

  • dimi309 245 posts 579 karma points
    Sep 20, 2011 @ 00:20
    dimi309
    0

    Hello Deniz!

    You're welcome! Good to hear that this worked!

    As far as I can see, the code looks ok. Also the site seems to be quite robust and well structured (I have also noticed the language stays the same now, when the login link is clicked). I'm not sure what else I could comment on. I like the style and colours and the way everything looks.

    So, since we've been talking for a while, I hope it's not too much to say congratulations for your project!

    And many thanks for all your feedback, regarding the Polyglot package!

    Best regards,

    Dimitri

Please Sign in or register to post replies

Write your reply to:

Draft