home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 May
/
CMCD0505.ISO
/
Software
/
Shareware
/
Programare
/
bugzero
/
jsp
/
_header.jspf
< prev
next >
Wrap
Text File
|
2005-02-02
|
7KB
|
176 lines
<%@ page language="java"
contentType="text/html"
session="true"
import="com.websina.util.*,com.websina.bean.Person,com.websina.util.log.Log"
errorPage="error.jsp"
%>
<%@ include file="_charset.jspf" %>
<%
boolean guestPrefsAllowed = false; // true to allow guest users see the Prefs page
boolean notifyOriginalAuthor = false; // true to always cc email to original author
String flag = com.websina.util.SystemUtil.getProperty("system.jsp.guestPrefsAllowed");
if (flag != null && flag.equalsIgnoreCase("true")) {
guestPrefsAllowed = true;
}
flag = com.websina.util.SystemUtil.getProperty("system.jsp.notifyOriginalAuthor");
if (flag != null && flag.equalsIgnoreCase("true")) {
notifyOriginalAuthor = true;
}
String contextPath = request.getContextPath();
Person person = (Person)session.getAttribute("person");
if(person == null) {
String projectId = request.getParameter("projectId");
String entryId = request.getParameter("entryId");
String requestUri = request.getRequestURI();
StringBuffer buf = new StringBuffer("?msg=");
buf.append(com.websina.util.URLEncoder.encode(MessageCode.get("servlet.session_error")));
buf.append("&requestUri=").append(requestUri.trim());
if (projectId != null && projectId.trim().length()>0) {
buf.append("&projectId="+projectId.trim());
}
if (entryId != null && entryId.trim().length()>0) {
buf.append("&entryId="+entryId.trim());
}
response.sendRedirect("login.jsp"+buf.toString());
return;
}
if(person.isAdmin()) {
response.sendRedirect("error.jsp?error="
+ com.websina.util.URLEncoder.encode(MessageCode.get("servlet.not_user")));
return;
} else {
String projectId = request.getParameter("projectId");
if (projectId != null && projectId.length()>0) {
if (person.switchProject(projectId) == null) {
String error = MessageCode.get("servlet.login.project_access_denied");
error = StringUtil.replace(error, projectId);
response.sendRedirect("error.jsp?error="+com.websina.util.URLEncoder.encode(error));
return;
}
}
}
Label label = Label.getInstance();
String currentQueryName = null;
com.websina.bean.Query currentQuery = null;
String uri = request.getRequestURI();
if (uri.indexOf("home.jsp") != -1) {
currentQuery = person.getQuery();
if (!currentQuery.isLoaded()) {
currentQuery.loadFilter();
}
} else {
currentQuery = (com.websina.bean.Query)session.getAttribute("query");
}
if (currentQuery != null) {
currentQueryName = currentQuery.getQueryName();
}
%>
<%@ include file="_cache.jspf" %>
<script LANGUAGE="JavaScript" src="script/utils.js"></script>
<script LANGUAGE="JavaScript" src="script/query.js"></script>
<LINK rel="StyleSheet" href="css/styles.css" type="text/css">
<%--/// you may customize the interface below ///--%>
<%--/// the logo image ///--%>
<table class="header" cellspacing=0 cellpadding=0 width="100%" border=0>
<tr><td valign=top>
<a title="About..." href="#" onClick="window.open ('about.jsp','_blank','height=240,width=340')">
<img border=0 src="img/<%=label.get("logo.gif")%>"></a>
</td>
<td align=right valign=bottom>
<%--/// the prefs buttons ///--%>
<% if (guestPrefsAllowed || person.isAllowed("prefs")) { %>
<a href="prefs.jsp" class="clickme">
<%=label.get("prefs_button")%></a>
<% } %>
<a href="help.jsp" class="clickme">
<%=label.get("help_button")%></a>
<a href="<%=contextPath%>/servlet/login?action=logoff" class="clickme">
<%=label.get("logoff_button")%></a>
</td></tr>
</table>
<%--/// the main navigation buttons ///--%>
<table class="nav" cellspacing=0 cellpadding=0 width="100%" border=0>
<form style="margin-top:0;margin-bottom:0;"
action="edit.jsp" name="editForm" onSubmit="trim(editForm.entryId); return(editForm.entryId.value.length>0);">
<tr><td>
<a href="home.jsp" class="clickme">
<%=label.get("home_button")%></a>
<% if (person.isAllowed("create")) { %>
<a href="create.jsp" class="clickme">
<%=label.get("create_button")%></a>
<% }
if (person.isAllowed("query")) { %>
<a href="query.jsp" class="clickme">
<%=label.get("query_button")%></a>
<% }
if (person.isAllowed("report")) { %>
<a href="report.jsp" class="clickme">
<%=label.get("report_button")%></a>
<% } %>
<a href="projects.jsp" class="clickme">
<%=label.get("project_button")%></a>
<nobr> <a href="#" class="clickme"
onClick="trim(editForm.entryId);if(editForm.entryId.value.length>0)submit();">
<%=label.get("open_button")%></a>
<input type=hidden name="projectId", value="<%=person.getProject()%>">
<input type=text name="entryId" size=6
style="font-size:12px;
font-face:arial;
margin-bottom:0;
margin-top:0;"></nobr>
</td>
<% if (person.isProjectAdmin()) { %>
<td align=right>
<a href="admin/project.jsp" class="clickme">
<%=label.get("open_admin_button")%></a>
</td>
<% } %>
</tr>
</form>
</table>
<noscript><font color=red><b>Warning: Javascript is required and must be enabled in your browser!</b></font></noscript>
<table cellspacing=0 cellpadding=0 width="100%" border=0>
<tr>
<td align=right>
<%--/// the switch project menu ///--%>
<form name="projectForm" style="margin-top:2px;margin-bottom:2px;">
<font color="#888888" size=-1>
<b><%=person.getFullname()%> / <%=person.getAccessCode()%></b></font>
<select name="project"
style="font-size:14px;font-face:arial;"
onChange="location.href='<%=contextPath%>/servlet/login?action=relogin&projectId='+projectForm.project.options[projectForm.project.selectedIndex].value;">
<%=ListMaker.makeOptionList(person.getProjectList(), person.getProject()) %>
</select>
</form>
</td></tr>
<%--/// the stored query menu ///--%>
<tr><td class="f1">
<% if (uri.indexOf("query.jsp") == -1
&& person.getStoredQuery() != null && !person.getStoredQuery().isEmpty()) { %>
<form style="margin-top:0;margin-bottom:0;" method="post"
name="queryForm" action="<%=contextPath%>/servlet/query" <%=acceptCharset%>>
<input type="hidden" name="action">
<font color="#666666" size=-1><b><%=label.get("stored_query")%></b></font>
<select name="query_name" style="MARGIN-BOTTOM: 1px"
onChange="do_query(queryForm, 'submit_stored_query');">
<%=ListMaker.makeOptionList(person.getStoredQuery().getValue(), currentQueryName)%>
</select>
<input class="button" type="button" value="<%=label.get("go_button")%>"
onClick="do_query(queryForm, 'submit_stored_query'); return false;">
</form>
<% } %>
</td></tr>
</table>
<p>