0
votes

I am very new to Orchard.

I have created a new theme, based on the Minty theme. The only real change is the layout, where I have adapted the html from an existing asp.net masterpage to match the orchard style razor layout.cshtml. I have experience with MVC and razor, so no problem on that side... unless I have missed something vital.

The problem is the login page. Clicking the sign in link takes me to the correct url without errors, but not login form gets rendered. I have checked that this is the case by Inspecting Element in google chrome.

I am aware that setting up widgets, etc, I can make content appear. However, I can't find how the login form gets inserted when the login url gets requested. I presume it uses the Orchard.Users module, but not sure how. Does it need a specific zone? I can't see why, but see how else.

As a result, I can't solve my problem...

Any pointers?

Any books or other learning media?

The code for my layout.cshtml is:

@functions {
    // To support the layout classifaction below. Implementing as a razor function because we can, could otherwise be a Func<string[], string, string> in the code block following.
    string CalcuClassify(string[] zoneNames, string classNamePrefix) {
        var zoneCounter = 0;
        var zoneNumsFilled = string.Join("", zoneNames.Select(zoneName => { ++zoneCounter; return Model[zoneName] != null ? zoneCounter.ToString() : "";}).ToArray());
        return HasText(zoneNumsFilled) ? classNamePrefix + zoneNumsFilled : "";
    }
}
@{
    /* Global includes for the theme
    ***************************************************************/

    SetMeta("X-UA-Compatible", "IE=edge,chrome=1");
    Style.Include("http://fonts.googleapis.com/css?family=Handlee");
    Style.Include("http://html5shiv.googlecode.com/svn/trunk/html5.js");
    Style.Include("site.css");
    Script.Require("jQuery").AtHead();
    Script.Require("jQueryUI_Core").AtHead();
    Script.Require("jQueryUI_Tabs").AtHead();
    Script.Include("http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.4/modernizr.min.js").AtHead();
    Style.Include("TagDefaults.css");
    Style.Include("LayoutStructure.css");
    Style.Include("LayoutStyling.css");
    Style.Include("TopMenu.css");
    Style.Include("LeftBlock.css");
    Style.Include("RightBlock.css");
    Style.Include("MenuAdapter.css");
    Style.Include("Content.css");
    Style.Include("FloatedBoxes.css");
    Style.Include("Helen.css");

    /* Some useful shortcuts or settings
    ***************************************************************/

    Func<dynamic, dynamic> Zone = x => Display(x); // Zone as an alias for Display to help make it obvious when we're displaying zones

    /* Layout classification based on filled zones
    ***************************************************************/

    //Add classes to the wrapper div to toggle aside widget zones on and off
    var asideClass = CalcuClassify(new [] {"Sidebar"}, "aside-"); // for aside-1, aside-2 or aside-12 if any of the aside zones are filled
    if (HasText(asideClass)) {
        Model.Classes.Add(asideClass);
    }

    //Add classes to the wrapper div to toggle tripel widget zones on and off
    var tripelClass = CalcuClassify(new [] {"TripelFirst", "TripelSecond", "TripelThird"}, "tripel-"); // for tripel-1, triple-2, etc. if any of the tripel zones are filled
    if (HasText(tripelClass)) {
        Model.Classes.Add(tripelClass);
    }

    //Add classes to the wrapper div to toggle quad widget zones on and off
    var footerQuadClass = CalcuClassify(new [] {"FooterQuadFirst", "FooterQuadSecond", "FooterQuadThird", "FooterQuadFourth"}, "split-"); // for quad-1, quad-2, etc. if any of the quad zones are filled
    if (HasText(footerQuadClass)) {
        Model.Classes.Add(footerQuadClass);
    }

    var slideshowClass = CalcuClassify(new[] {"HomeSlideshow"}, "slideshow-");
    if (HasText(slideshowClass)) {
        Model.Classes.Add(slideshowClass);
    }

    /* Inserting some ad hoc shapes
    ***************************************************************/

    //WorkContext.Layout.Header.Add(New.Branding(), "5"); // Site name and link to the home page
    //WorkContext.Layout.Footer.Add(New.BadgeOfHonor(), "5"); // Powered by Orchard
    WorkContext.Layout.Footer.Add(New.User(), "10"); // Login and dashboard links

    /* Last bit of code to prep the layout wrapper
    ***************************************************************/

    Model.Id = "layout-wrapper";
    var tag = Tag(Model, "div"); // using Tag so the layout div gets the classes, id and other attributes added to the Model
}

@tag.StartElement        
<a name="top"></a>
    <div id="SiteHeader">
        &nbsp;
    </div>
    <div id="PageContainer">
        <div style="position: absolute; Left:-80px; top:-88px;z-index:1000;">
            <img id="bird" title="Pheasant" src="/Themes/TheFarmsBlogs/Styles/Images/PositionedImages/pheasant.gif" />
        </div>

        <div class="SiteMenu"><p>Hello Menu</p></div>
        <div id="Specialized">  
        <div id="PageName">
            <!-- 
                PageName NOT in use!
             -->
        </div>

        @if (Model.RightColumn != null) {
        <div id="RightCol">
            @Zone(Model.RightColumn)
        </div>
        }
        <!-- Page divided into two main columns, of which the left column is subdivided as necessary -->
        <div id="LeftCol">
            <div id="PageBanner">
                <div id="PageBannerLeft">

                    @if (Model.MainImage != null) {
                    <div id="PageBannerImage">
                        @Zone(Model.MainImage)
                    </div>
                    }
                    @if(Model.TheStrip != null) {
                    <div id="TheStrip">
                        @Zone(Model.TheStrip)
                    </div>
                    }                   
                </div>
            </div>            
            <div id="SpecializedContent">
            @if(@Model.content != null)
            {
                @Zone(Model.content)
            }
            </div>
        </div>
        <div id="SpecializedFooter">
            &nbsp;
        </div>
    </div>

    <div id="PageFooter">
        &nbsp;
        @if (Model.FooterPage != null){ 
            @Zone(Model.FooterPage)
        }
    </div>
</div>
<div id="SiteFooter">
    @Display(Model.Footer)
    The Farms Ltd - &copy; 2007
</div>        
@tag.EndElement

PS: the branding and badge of honour are commented out as I am only enabling bit by bit to eliminate the source of errors. It will be in the live site.

ADDENDUM:

See Bertrand Le Roy's answer below. The Orchard.Users module requires a Content zone with a Capital C. That instantly cured the problem.

I added this as Bertrand's response was tentative, and I wanted to reinforce that the problem was the name of the zone.

1
What do you mean by "a custom layout"? Also not sure what you mean by "where does the logon page come from".Bertrand Le Roy
@BertrandLeRoy: Thanks your reply, I have edited the question. Sorry about the previous it was late.awrigley

1 Answers

5
votes

In Orchard.Users, look for Controllers/AccountController.cs. In there, there is a LogOn action. It creates a LogOn shape that it then puts in a shape result. This then gets resolved as the Views/LogOn.cshtml template (which you can override in your theme by just dropping a file with the same name in there, for example a copy of the original that you can tweak). The LogOn template will be rendered within the theme's layout, in the Content zone. Does this answer your question?

I think the mistake you made was to name your Content zone content (notice the casing).