7 Replies Latest reply on Mar 31, 2004 8:16 AM by Maarten Volders

    Complex index page without recoding core

    Maarten Volders Newbie

      HI, here I am again with some questions:

      Is it possible to create a complex index page without having to recode the core of Nukes? With complex I mean, it's own template, including summaries of news (dynamically off cource ... ).

      I looked at the code and I think the only way is to recode the core, the only thing i can change is the name of the homepage (located in the repository). I would prefering to create an index page through the admin console without having to recode the core.

      Any suggestions or remarks of how this is perhaps going to change in the future.

      Grtz

        • 1. Re: Complex index page without recoding core
          Sherman Wood Apprentice


          When you say "index page", I assume that you mean the default page someone sees.

          You do not have to change the core really.

          Create a module that has an operation that produces the page you want.

          public void welcome(Page page) {
           if (getApi().userLoggedIn()) {
           // render the page
           } else {
           page.sendRedirect("index.html");
           }
           }
          
          

          Have your own version of the nukes.ear/nukes.sar jboss-service.xml that has the CoreModule configured like:

          <attribute name="DefaultUserPage">index.html?module=myIndexPage&amp;op=welcome</attribute>
          


          Done!


          Sherman



          • 2. Re: Complex index page without recoding core
            Maarten Volders Newbie

            k, great, this will at least help me started.

            But still some other issues concerning this:
            - is it possible to have multiple templates (for the skeleton of the complete page, not an individual module). So that I can say that i.e. my start page has that skeleton design, but my other pages have another skeleton design

            - I noticed that when rendering the body, this is done in a new frame, and the framelength is hard-coded in the core on 600 ... are their work arounds for that ...... ?

            Thx

            • 3. Re: Complex index page without recoding core
              Maarten Volders Newbie

              I wrote the custom indexpage module and that works, but it's not being called for my startpage. So I looked in the xml files and found an other attribute called StartPage. If I understand that correctly, that one calls a module.

              But I don't understand what happens then, how can I say that for my startpage he needs to use the same url as the defaultuserpage, i.e.
              index.html?module=dcaIndexPage&amp;op=welcome

              Grtz

              • 4. Re: Complex index page without recoding core
                Maarten Volders Newbie

                Solved my problem for the startpage, i figured out that i needed a method called main in my custom module. Sometimes the answer is so stupid :) But I'm getting there.

                The other questions, about the different skeletons templates are still open.

                • 5. Re: Complex index page without recoding core
                  Sherman Wood Apprentice


                  - is it possible to have multiple templates (for the skeleton of the complete page, not an individual module). So that I can say that i.e. my start page has that skeleton design, but my other pages have another skeleton design


                  Can you change the theme on the fly during login?

                  - I noticed that when rendering the body, this is done in a new frame, and the framelength is hard-coded in the core on 600 ... are their work arounds for that ...... ?


                  Where is this hardcoding? This should all be in the theme.


                  Sherman

                  • 6. Re: Complex index page without recoding core
                    Maarten Volders Newbie

                    The hardcoding is in:

                    private void print(Page page, String fileId, String contentType, String content, Integer id)
                    {
                    Level level = secGetLevel(fileId + "::");

                    if (contentType == null || !contentType.startsWith("text/"))
                    {
                    page.openTable();
                    page.print("<iframe width=\"100%\" height=\"600\" src=\"" + page.getServerBase() + fileId + "\">");
                    page.print("Your browser do not support iframes");
                    page.print("");
                    page.closeTable();
                    return;
                    }

                    you can see that the height is set to 600.

                    -----

                    I know that a user can set his own template / theme. But that's not what I wanna do, I need to (portal look and feel):
                    - have a startpage with a specific layout
                    - have a bunch of other pages that have a complete different layout then the start page, so not only the template for the module.

                    Is just want to know what the easiest (and how) way is to do this. And all of these templates should come out of the database, but I allready know how to do this with the HtmlLoader so :) I know something :)

                    I just found a another problem, can css files or js files be stored (pff course BUT) in the database and then retrieved from them to be used inside the template, now all the examples just have a css file somewhere in their jar.

                    • 7. Re: Complex index page without recoding core
                      Maarten Volders Newbie

                      Forgot to mention that is hardcoding is in file: HtmlModule

                      sowry :(