01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. The ASF licenses this file to You
04: * under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License. For additional information regarding
15: * copyright in this work, please see the NOTICE file in the top level
16: * directory of this distribution.
17: */
18:
19: package org.apache.roller.ui.core.tags.menu;
20:
21: import javax.servlet.http.HttpServletRequest;
22: import javax.servlet.jsp.JspException;
23: import org.apache.commons.logging.Log;
24: import org.apache.commons.logging.LogFactory;
25: import org.apache.roller.ui.core.RollerSession;
26:
27: /**
28: * Draws the most complete possible Roller navigation bar based on request
29: * parameters userName, folderId and authenticated user (if there is one).
30: *
31: * @jsp.tag name="EditorNavigationBar"
32: */
33: public class EditorNavigationBarTag extends MenuTag {
34:
35: private static Log mLogger = LogFactory
36: .getLog(EditorNavigationBarTag.class);
37:
38: public String view() {
39: return emit();
40: }
41:
42: public int doEndTag(java.io.PrintWriter pw) throws JspException {
43: try {
44: HttpServletRequest request = (HttpServletRequest) pageContext
45: .getRequest();
46: RollerSession rollerSession = RollerSession
47: .getRollerSession(request);
48: if (rollerSession != null
49: && rollerSession.isGlobalAdminUser()) {
50: return super .doEndTag(pw);
51: } else {
52: return EVAL_PAGE;
53: }
54: } catch (Exception e) {
55: mLogger.error("EditorNavigationBarTag exception", e);
56: throw new JspException(e);
57: }
58: }
59:
60: }
|