alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

jforum example source code file (commonheader.jsp)

This example jforum source code file (commonheader.jsp) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - jforum tags/keywords

content-type, cookie, delim, delim, front, here, iterator, jspwikiuserprefs, print, set, standard, string, string, templatemanager

The jforum commonheader.jsp source code

<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
<%@ page import="com.ecyrd.jspwiki.*" %>
<%@ page import="com.ecyrd.jspwiki.ui.*" %>
<%@ page import="java.util.*" %>
  <link rel="stylesheet" media="screen, projection, print" type="text/css" href="
  <wiki:IncludeResources type="stylesheet"/>
  <script src="
  <wiki:IncludeResources type="script"/>
  <wiki:IncludeResources type="inlinecss" />
  <meta http-equiv="Content-Type" content="text/html; charset=
  <link rel="search" href="" />
  <link rel="help"   href="
  <link rel="start"  href="
  <link rel="stylesheet" type="text/css" media="print" href="
  <link rel="alternate stylesheet" type="text/css" href="
  <link rel="alternate stylesheet" type="text/css" href="
  <link rel="icon" type="image/png" href="
  <wiki:FeedDiscovery />
<%
  // cookie-format
  // skinname DELIM dateformat DELIM timezone DELIM editareaheight
  String DELIM  = "\u00a0";
  String prefSkinName = null;
  String prefDateFormat = "HH:mm dd-MMM-yyyy";
  String prefTimeZone = java.util.TimeZone.getDefault().getID();
  String prefEditAreaHeight = "24";

  Cookie[] cookies = request.getCookies();
  if (cookies != null)
  {
    for (int i = 0; i < cookies.length; i++)
    {
       if( "JSPWikiUserPrefs".equals( cookies[i].getName() ) )
       {
          String s = TextUtil.urlDecodeUTF8 (cookies[i].getValue() ) ;

          java.util.StringTokenizer st = new java.util.StringTokenizer (s, DELIM);

          if( st.hasMoreTokens() ) prefSkinName = st.nextToken();
          if( st.hasMoreTokens() ) prefDateFormat = st.nextToken();
          if( st.hasMoreTokens() ) prefTimeZone = st.nextToken();
          if( st.hasMoreTokens() ) prefEditAreaHeight = st.nextToken();

          break;
       }
    }
  }
  session.setAttribute("prefSkinName",       prefSkinName );
  session.setAttribute("prefDateFormat",     prefDateFormat );
  session.setAttribute("prefTimeZone",       prefTimeZone );
  session.setAttribute("prefEditAreaHeight", prefEditAreaHeight );

 %>

<%
    WikiContext context = WikiContext.findContext( pageContext );
   
    TemplateManager mgr = context.getEngine().getTemplateManager();
    
    Set skins = mgr.listSkins(pageContext,context.getTemplate());

    for( Iterator i = skins.iterator(); i.hasNext(); )
    {
        String skinName = (String)i.next();
%>
        <link rel="alternate stylesheet" type="text/css" href=" title="<%=skinName%>" /> 
<%
    }
%>

<% if(prefSkinName != null) { %>
 <link rel="stylesheet" type="text/css"
       href="<wiki:Link format='url' templatefile='<%="skins/"+prefSkinName%>'/>" />
<% } %>

<script type="text/javascript">Wiki.loadBrowserSpecificCSS("","","");

<%-- Here we define the "run when the page loads" -script. --%>
<script type="text/javascript">
function runOnLoad()
{ 
  TabbedSection.onPageLoad();
  SearchBox.onPageLoad();
  Wiki.onPageLoad();
  Sortable.onPageLoad();
  ZebraTable.onPageLoad();
  HighlightWord.onPageLoad();
  Collapsable.onPageLoad();
  GraphBar.onPageLoad();
  <wiki:IncludeResources type="jsfunction"/>
}

window.onload = runOnLoad;
</script>

Other jforum examples (source code examples)

Here is a short list of links related to this jforum commonheader.jsp source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.