home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 May / CMCD0505.ISO / Software / Shareware / Programare / bugzero / jsp / _header.jspf < prev    next >
Text File  |  2005-02-02  |  7KB  |  176 lines

  1. <%@ page language="java"
  2.     contentType="text/html"
  3.     session="true"
  4.     import="com.websina.util.*,com.websina.bean.Person,com.websina.util.log.Log"
  5.     errorPage="error.jsp" 
  6. %>
  7. <%@ include file="_charset.jspf" %>
  8. <%
  9.   boolean guestPrefsAllowed = false;  // true to allow guest users see the Prefs page
  10.   boolean notifyOriginalAuthor = false; // true to always cc email to original author
  11.  
  12.   String flag = com.websina.util.SystemUtil.getProperty("system.jsp.guestPrefsAllowed");
  13.   if (flag != null && flag.equalsIgnoreCase("true")) {
  14.     guestPrefsAllowed = true;
  15.   }
  16.   flag = com.websina.util.SystemUtil.getProperty("system.jsp.notifyOriginalAuthor");
  17.   if (flag != null && flag.equalsIgnoreCase("true")) {
  18.     notifyOriginalAuthor = true;
  19.   }
  20.  
  21.   String contextPath = request.getContextPath();
  22.   Person person = (Person)session.getAttribute("person");
  23.   if(person == null) { 
  24.     String projectId = request.getParameter("projectId");
  25.     String entryId = request.getParameter("entryId");
  26.     String requestUri = request.getRequestURI();
  27.     StringBuffer buf = new StringBuffer("?msg=");    
  28.     buf.append(com.websina.util.URLEncoder.encode(MessageCode.get("servlet.session_error")));
  29.     buf.append("&requestUri=").append(requestUri.trim());    
  30.     if (projectId != null && projectId.trim().length()>0) {
  31.        buf.append("&projectId="+projectId.trim()); 
  32.     }
  33.     if (entryId != null && entryId.trim().length()>0) {
  34.        buf.append("&entryId="+entryId.trim()); 
  35.     }
  36.     response.sendRedirect("login.jsp"+buf.toString());
  37.     return;
  38.   }
  39.   if(person.isAdmin()) { 
  40.     response.sendRedirect("error.jsp?error="
  41.       + com.websina.util.URLEncoder.encode(MessageCode.get("servlet.not_user")));
  42.     return;
  43.   } else {
  44.     String projectId = request.getParameter("projectId");
  45.     if (projectId != null && projectId.length()>0) {
  46.       if (person.switchProject(projectId) == null) {
  47.         String error = MessageCode.get("servlet.login.project_access_denied");
  48.         error = StringUtil.replace(error, projectId);
  49.         response.sendRedirect("error.jsp?error="+com.websina.util.URLEncoder.encode(error));
  50.         return;
  51.       }
  52.     }    
  53.   }
  54.   Label label = Label.getInstance();
  55.  
  56.   String currentQueryName = null;
  57.   com.websina.bean.Query currentQuery = null;
  58.   String uri = request.getRequestURI();
  59.   if (uri.indexOf("home.jsp") != -1) {
  60.     currentQuery = person.getQuery();
  61.     if (!currentQuery.isLoaded()) {
  62.       currentQuery.loadFilter();
  63.     }
  64.   } else {
  65.     currentQuery = (com.websina.bean.Query)session.getAttribute("query");
  66.   }
  67.   if (currentQuery != null) {
  68.     currentQueryName = currentQuery.getQueryName();
  69.   }
  70. %>
  71. <%@ include file="_cache.jspf" %>
  72. <script LANGUAGE="JavaScript" src="script/utils.js"></script>
  73. <script LANGUAGE="JavaScript" src="script/query.js"></script>
  74. <LINK rel="StyleSheet" href="css/styles.css" type="text/css">
  75.  
  76. <%--/// you may customize the interface below ///--%> 
  77.  
  78. <%--/// the logo image ///--%>
  79. <table class="header" cellspacing=0 cellpadding=0 width="100%" border=0>    
  80. <tr><td valign=top>
  81.     <a title="About..." href="#" onClick="window.open ('about.jsp','_blank','height=240,width=340')">
  82.     <img border=0 src="img/<%=label.get("logo.gif")%>"></a>
  83. </td>
  84. <td align=right valign=bottom>
  85.  
  86. <%--/// the prefs buttons ///--%>
  87.   <% if (guestPrefsAllowed || person.isAllowed("prefs")) { %>
  88.         <a href="prefs.jsp" class="clickme">
  89.         <%=label.get("prefs_button")%></a> 
  90.   <% } %> 
  91.         <a href="help.jsp" class="clickme">
  92.         <%=label.get("help_button")%></a> 
  93.         <a href="<%=contextPath%>/servlet/login?action=logoff" class="clickme">
  94.         <%=label.get("logoff_button")%></a>  
  95. </td></tr>
  96. </table>
  97.  
  98. <%--/// the main navigation buttons ///--%>
  99. <table class="nav" cellspacing=0 cellpadding=0 width="100%" border=0>    
  100. <form style="margin-top:0;margin-bottom:0;"
  101. action="edit.jsp" name="editForm" onSubmit="trim(editForm.entryId); return(editForm.entryId.value.length>0);">
  102. <tr><td>  
  103.       <a href="home.jsp" class="clickme"> 
  104.       <%=label.get("home_button")%></a>
  105.   <% if (person.isAllowed("create")) { %>
  106.         <a href="create.jsp" class="clickme">
  107.       <%=label.get("create_button")%></a>
  108.   <% } 
  109.      if (person.isAllowed("query")) { %>
  110.         <a href="query.jsp" class="clickme">
  111.       <%=label.get("query_button")%></a>
  112.   <% } 
  113.      if (person.isAllowed("report")) { %>
  114.         <a href="report.jsp" class="clickme">
  115.       <%=label.get("report_button")%></a>
  116.   <% } %>
  117.         <a href="projects.jsp" class="clickme">
  118.       <%=label.get("project_button")%></a>
  119.       <nobr>  <a href="#" class="clickme"
  120.              onClick="trim(editForm.entryId);if(editForm.entryId.value.length>0)submit();">
  121.              <%=label.get("open_button")%></a>
  122.              <input type=hidden name="projectId", value="<%=person.getProject()%>">
  123.              <input type=text name="entryId" size=6 
  124.              style="font-size:12px;
  125.                    font-face:arial;
  126.                    margin-bottom:0;
  127.                    margin-top:0;"></nobr>
  128. </td>
  129. <% if (person.isProjectAdmin()) { %>
  130. <td align=right>
  131.       <a href="admin/project.jsp" class="clickme">
  132.       <%=label.get("open_admin_button")%></a>  
  133. </td>
  134. <% } %>
  135. </tr>
  136. </form>
  137. </table>
  138.  
  139. <noscript><font color=red><b>Warning: Javascript is required and must be enabled in your browser!</b></font></noscript>
  140. <table cellspacing=0 cellpadding=0 width="100%" border=0>
  141. <tr>
  142. <td align=right>
  143.  
  144. <%--/// the switch project menu ///--%>   
  145. <form name="projectForm" style="margin-top:2px;margin-bottom:2px;">
  146. <font color="#888888" size=-1>  
  147. <b><%=person.getFullname()%> / <%=person.getAccessCode()%></b></font>  
  148.         <select name="project" 
  149.            style="font-size:14px;font-face:arial;"
  150.            onChange="location.href='<%=contextPath%>/servlet/login?action=relogin&projectId='+projectForm.project.options[projectForm.project.selectedIndex].value;">
  151.         <%=ListMaker.makeOptionList(person.getProjectList(), person.getProject()) %>
  152.         </select>
  153. </form>
  154. </td></tr>
  155.  
  156. <%--/// the stored query menu ///--%>
  157. <tr><td class="f1">
  158. <% if (uri.indexOf("query.jsp") == -1
  159.        && person.getStoredQuery() != null && !person.getStoredQuery().isEmpty()) { %>
  160. <form style="margin-top:0;margin-bottom:0;" method="post"
  161. name="queryForm" action="<%=contextPath%>/servlet/query" <%=acceptCharset%>>
  162. <input type="hidden" name="action">
  163.   <font color="#666666" size=-1><b><%=label.get("stored_query")%></b></font>  
  164.     <select name="query_name" style="MARGIN-BOTTOM: 1px"
  165.        onChange="do_query(queryForm, 'submit_stored_query');">
  166.        <%=ListMaker.makeOptionList(person.getStoredQuery().getValue(), currentQueryName)%>
  167.     </select>
  168.     <input class="button" type="button" value="<%=label.get("go_button")%>" 
  169.      onClick="do_query(queryForm, 'submit_stored_query'); return false;">
  170. </form>
  171. <% } %>
  172. </td></tr>
  173. </table>
  174. <p>
  175.  
  176.