KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > deprecated > taglibs > button > AdminButtonTag


1 package org.jahia.deprecated.taglibs.button;
2
3 import javax.servlet.jsp.JspException JavaDoc;
4
5 import org.jahia.data.JahiaData;
6 import org.jahia.exceptions.JahiaException;
7 import org.jahia.services.usermanager.JahiaUser;
8
9
10 /**
11  * Class AdminButtonTag : draw the full link ("<a href...>...</a>") allowing to
12  * to access the administration page
13  *
14  * @author Jerome Tamiotti
15  */

16 public class AdminButtonTag extends AbstractButtonTag {
17
18     private String JavaDoc title = "Administration";
19     private String JavaDoc style = "";
20
21     public void setTitle(String JavaDoc title) {
22         this.title = title;
23     }
24
25     public void setStyle(String JavaDoc style) {
26         this.style = style;
27     }
28
29     public String JavaDoc getTitle() {
30         return this.title;
31     }
32
33     public String JavaDoc getStyle() {
34         return this.style;
35     }
36
37     public boolean testRights (JahiaData jData) {
38         // test if the user is an administrator
39
JahiaUser user = jData.params().getUser();
40         return user.isAdminMember( jData.params().getSiteID() );
41     }
42
43     public String JavaDoc getLauncher(JahiaData jData) throws JahiaException {
44         // returns the URL that accesses the administration page
45
return jData.gui().html().drawAdministrationLauncher();
46     }
47
48     public int doEndTag() throws JspException JavaDoc {
49         // let's reinitialize the tag variables to allow tag object reuse in
50
// pooling.
51
title = "Administration";
52         style = "";
53         return EVAL_PAGE;
54     }
55
56 }
57
Popular Tags