Re: [PROPOSAL] Keel look and feel (Attn: Pierre)

Raoul Pierre <[email protected]>
Newsgroups gmane.comp.java.keel.devel
Message-ID <[email protected]>
Shash

Herewith a menubar.jsp modified. I quickly tested it. Seem ok.

Pierre

Shash Chatterjee a écrit :

> Pierre,
>
>> Herewith the jsp file I use with the css menu. Some changes from the 
>> file I posted the 05/04/05. Mainly, nothing appends when you clik on 
>> the menu bar or on a menu without model or url.
>
> Answering your previous email: didn't need to use the included JSP, 
> since Sitemesh essentially allows us to centralize common elements to 
> be defined in the <HEAD> section of the page.  So, I just defined the 
> <script/> tag to have the "body..." definition for the .htc file, and 
> it worked.  Thanks.
>
> I couldn't use the updated menubar.jsp since I converted to use JSTL 
> tags instead of the Struts tags.  I had to do this because the 
> look&feel needs to work with any JSP-based clnt-*, not just Struts (I 
> plan to do a Sitemesh decorator using Velocity as well).   So, 
> attached is the new version of your "old" menubar.jsp, could you 
> please make the updates to it instead?
>
> Thanks,
> Shash
>
> PS: The menu-items that have nested elements have an empty href (like: 
> <li class="submenu"><a href="">Keel</a>), clicking on those cause all 
> kinds of undesirable effects, based on the page you are on. Can you 
> correct that, maybe even a href="#"?
menubar.jsp (text/plain, 5.5 KB)
<jsp:directive.page language="java" />
<jsp:directive.include file="/common/taglibs.jspf" />

<%-- The output from this jsp can be included anywhere in the (X)HTML page.
     It uses the app-navigate parameter "menu" to make nested lists.
     
     No Javascript here, only CSS!
     
     Note: when the cursor goes out of any menu area, all the submenus vanish
           *immediatly*. To get some latence time, Javascript is needed.
           
     Note: 
       - no model or empty => try to use an url if any, otherwise nothing appends
       - no url => nothing appends (but app-crud doesn't create a menu with neither model nor url)
       - empty url => href="", i.e. come back on the same page, but it seems this 
                      behavior isn't always sure (as it depends the way browser completes the path)
     
     --%>


<div id="navbar">
<c:if test="${! empty menu}">
  <ul class="level1">
  <c:forEach var="topelement" items="${menu.map['nested']}">
    <c:set var="topelement_title" value="${topelement.map['attributes'].map['title']}" />
    <li class="submenu">
      <a name="${topelement_title}">${topelement_title}</a>
      <ul class="level2">
      <c:forEach var="secondelement" items="${topelement.map['nested']}">
        <c:set var="secondelement_title" value="${secondelement.map['attributes'].map['title']}" />
        <c:set var="secondelement_type" value="href"/>
        <c:choose>
        <c:when test="${! empty secondelement.map['attributes'].map['model']}">
          <c:set var="secondelement_model" value="${secondelement.map['attributes'].map['model']}" />
          <c:url var="secondelement_path" value="/model.do?model=${secondelement_model}"/>
          <c:choose>
          <c:when test="${! empty secondelement.map['attributes'].map['parameters']}">
            <c:set var="secondelement_parameters" value="${secondelement.map['attributes'].map['parameters']}" />
          </c:when> 
          <c:otherwise>         
            <c:set var="secondelement_parameters" value=""/>
          </c:otherwise>         
          </c:choose>
        </c:when> 
        <c:otherwise>         
          <c:choose>
          <c:when test="${secondelement.map['attributes'].map['url'] != null}"><%-- explicit equality test to force coercing rule  --%>
            <c:set var="secondelement_url" value="${secondelement.map['attributes'].map['url']}" />
            <c:url var="secondelement_path" value="${secondelement_url}"/>
          </c:when> 
          <c:otherwise>         
            <c:set var="secondelement_path" value="${secondelement_title}"/>
            <c:set var="secondelement_type" value="name"/>
          </c:otherwise>         
          </c:choose>
          <c:set var="secondelement_parameters" value=""/>
        </c:otherwise>         
        </c:choose>
        
        <li class="submenu">
          <a ${secondelement_type}="${secondelement_path}${secondelement_parameters}">${secondelement_title}
          <c:choose>
          <c:when test="${empty secondelement.map['nested']}">
              </a>
          </c:when>
          <c:otherwise>
              <span>&gt;</span></a><%-- TODO: use an image ? and keep the character by default --%>
              <ul class="level3">
              <c:forEach var="thirdelement" items="${secondelement.map['nested']}">
                <c:set var="thirdelement_title" value="${thirdelement.map['attributes'].map['title']}" />
                <c:set var="thirdelement_type" value="href"/>
                <c:choose>
                <c:when test="${! empty thirdelement.map['attributes'].map['model']}">
                    <c:set var="thirdelement_model" value="${thirdelement.map['attributes'].map['model']}" />
                    <c:url var="thirdelement_path" value="/model.do?model=${thirdelement_model}"/>
                    <c:choose>
                    <c:when test="${! empty thirdelement.map['attributes'].map['parameters']}">
                      <c:set var="thirdelement_parameters" value="${thirdelement.map['attributes'].map['parameters']}" />
                    </c:when> 
                    <c:otherwise>         
                      <c:set var="thirdelement_parameters" value=""/>
                    </c:otherwise>         
                    </c:choose>
                </c:when>                
                <c:otherwise>
                    <c:choose>
                    <c:when test="${thirdelement.map['attributes'].map['url'] != null}"><%-- explicit equality test to force coercing rule  --%>
                      <c:set var="thirdelement_url" value="${thirdelement.map['attributes'].map['url']}" />
                      <c:url var="thirdelement_path" value="${thirdelement_url}"/>
                    </c:when> 
                    <c:otherwise>         
                      <c:set var="thirdelement_path" value="${thirdelement_title}"/>
                      <c:set var="thirdelement_type" value="name"/>
                    </c:otherwise>         
                    </c:choose>
                    <c:set var="thirdelement_parameters" value=""/>
                </c:otherwise>
                </c:choose> <%-- third element : model empty ? --%>
                <li><a ${thirdelement_type}="${thirdelement_path}${thirdelement_parameters}">${thirdelement_title}</a></li>
              </c:forEach> <%-- third element --%>
              </ul>
          </c:otherwise>
          </c:choose> <%-- second element : model empty ? --%>
        </li>
      </c:forEach> <%-- all second-level elements --%>
      </ul>
    </li>
  </c:forEach> <%-- top level elements --%>
  </ul>
</c:if> <%-- menu --%>
</div>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.