View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.common.ui.server.start;
17  
18  import java.io.IOException;
19  import java.io.PrintWriter;
20  
21  import javax.servlet.ServletException;
22  import javax.servlet.http.HttpServlet;
23  import javax.servlet.http.HttpServletRequest;
24  import javax.servlet.http.HttpServletResponse;
25  
26  import org.kuali.rice.core.config.ConfigContext;
27  import org.kuali.student.common.util.security.SecurityUtils;
28  
29  public class IndexPageServlet extends HttpServlet {
30  
31  	private static final long serialVersionUID = 1L;
32  
33  	@Override
34  	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
35  			throws ServletException, IOException {
36  		processRequest(req, resp);
37  	}
38  
39  	@Override
40  	protected void doGet(HttpServletRequest request,
41  			HttpServletResponse response) throws ServletException, IOException {
42  		processRequest(request, response);
43  	}
44  
45  	private void processRequest(HttpServletRequest request,
46  			HttpServletResponse response) throws IOException {
47  		response.setContentType("text/html");
48  		PrintWriter out = response.getWriter();
49  		
50  		//Get the username
51  		String username = SecurityUtils.getCurrentPrincipalName();
52  		
53  		//Get the Rice Application Url
54  		String riceUrl = ConfigContext.getCurrentContextConfig().getProperty("ks.rice.url");
55  		if(null==riceUrl||riceUrl.isEmpty()){
56  			riceUrl = ConfigContext.getCurrentContextConfig().getProperty("application.url");
57  		}
58  		
59  		out.println("		<html>\n"
60  			      + " 		<head>\n"
61  				  + "	    <style type=\"text/css\">\n"
62  						+ "        .KS-Header-Logo-Spacer {\n"
63  						+ "            width: 100%;\n"
64  						+ "            height:30px;\n"
65  						+ "            background-color: #dddddd;\n"
66  						+ "            color: #777777;\n"
67  						+ "            font: 30px helvetica, sans-serif;\n"
68  						+ "            padding-top: 8px;\n"
69  						+ "            padding-bottom: 8px;\n"
70  						+ "            padding-left: 10px;\n"
71  						+ "          }\n"
72  						+ "          .KS-Header-Link {\n"
73  						+ "            color: #ffffff;\n"
74  						+ "            text-decoration: none;\n"
75  						+ "            font: 10px helvetica, sans-serif;\n"
76  						+ "            text-align: right;\n"
77  						+ "            padding-right: 0px;\n"
78  						+ "          }\n"
79  						+ "\n"
80  						+ "          .KS-Header-Link-Focus {\n"
81  						+ "            cursor: pointer;\n"
82  						+ "            text-decoration: underline;\n"
83  						+ "          }\n"
84  						+ "          .page-title {\n"
85  						+ "            font: bold 18px helvetica, sans-serif;\n"
86  						+ "            border: solid thin #aaaaaa;\n"
87  						+ "            padding-top: 5px;\n"
88  						+ "            padding-bottom: 5px;\n"
89  						+ "            padding-left: 1em;\n"
90  						+ "            z-index: 99999999;\n"
91  						+ "            background-color: #eeeeee;\n"
92  						+ "          }\n"
93  						+ "          \n"
94  						+ "          .user-name {\n"
95  						+ "            width: 100%;\n"
96  						+ "            height:2em;\n"
97  						+ "            background-color: #a70b3b;\n"
98  						+ "            margin-bottom: .5em;\n"
99  						+ "            text-align: right;\n"
100 						+ "          }\n"
101 						+ "           .user-Link {\n"
102 						+ "            position: relative;\n"
103 						+ "            top: 3px;\n"
104 						+ "            right: 60px;\n"
105 						+ "            color: #ffffff;\n"
106 						+ "            text-decoration: none;\n"
107 						+ "            font: 12px helvetica, sans-serif;\n"
108 						+ "            padding-right: 5px;\n"
109 						+ "          }   \n"
110 						+ "          \n"
111 						+ "         .user-button {\n"
112 						+ "            position: relative;\n"
113 						+ "            top: -16px;\n"
114 						+ "            right: 10px;\n"
115 						+ "          }  \n"
116 						+ "\n"
117 						+ "          .mock-header {\n"
118 						+ "            font: 12px helvetica, sans-serif;\n"
119 						+ "            background-color: #ffffff;\n"
120 						+ "\n"
121 						+ "          }\n"
122 						+ "          \n"
123 						+ "          .menu-panel{\n"
124 						+ "          	display:inline;\n"
125 						+ "          }\n"
126 						+ "          \n"
127 						+ "          .mock-Kew {\n"
128 						+ "			display:inline;\n"
129 						+ "          }\n"
130 						+ "          .mock-row {\n"
131 						+ "            height: 250px;\n"
132 						+ "          }\n"
133 						+ "          .mock-actionlist {\n"
134 						+ "            border-collapse: collapse;\n"
135 						+ "            border: 1px solid #000;\n"
136 						+ "            text-align: center;\n"
137 						+ "            padding: 50px;\n"
138 						+ "            font: 36px helvetica, san-serif;\n"
139 						+ "            color: #aaaaaa;\n"
140 						+ "          }\n"
141 						+ "          \n"
142 						+ "          .bottom-layout{\n"
143 						+ "          	width: 100%;\n"
144 						+ "          }\n"
145 						+ "        \n"
146 						+ "        \n"
147 						+ ".ExampleStyledList ul {\n"
148 						+ "padding: 0;\n"
149 						+ "padding-top: 0px;\n"
150 						+ "margin: 0px;\n"
151 						+ " list-style-type: none;\n"
152 						+ " padding-bottom: 1em;\n"
153 						+ " border-style: solid;\n"
154 						+ " border-width: 1px;\n"
155 						+ "	background-color: white;\n"
156 						+ " -moz-border-radius: 1em; \n"
157 						+ " -webkit-border-radius: 1em;\n"
158 						+ " width: 12em;\n"
159 						+ "}\n"
160 						+ ".ExampleStyledList {\n"
161 						+ "\n"
162 						+ " margin-top: 1em;\n"
163 						+ " margin-bottom: 0.1em;\n"
164 						+ " width: 8em;\n"
165 						+ " font-weight: bold;\n"
166 						+ "}\n"
167 						+ ".ExampleStyledList a {\n"
168 						+ "	margin-bottom: 3px;\n"
169 						+ "	border: 1px solid white;\n"
170 						+ "	border-left: 3px solid white;\n"
171 						+ "	color: black;\n"
172 						+ " display: block;\n"
173 						+ " width: 9.5em;\n"
174 						+ " margin: 0.5em;\n"
175 						+ " padding: 0.5em;\n"
176 						+ "\n"
177 						+ " -moz-border-radius: 0.5em; \n"
178 						+ " -webkit-border-radius: 0.5em;\n"
179 						+ " border-radius: 0.5em;\n"
180 						+ " text-decoration: none;\n"
181 						+ "}\n"
182 						+ ".ExampleStyledList a:hover {\n"
183 						+ "	background-color: #f4f4f4;\n"
184 						+ "	border: 1px solid black;\n"
185 						+ "	border-left: 3px solid #990000;\n"
186 						+ "	cursor: pointer;\n"
187 						+ "	color: #ab0000;\n"
188 						+ "\n"
189 						+ "}\n"
190 						+ "\n"
191 						+ ".task-table{\n"
192 						+ "margin-left: 4em;\n"
193 						+ "\n"
194 						+ "}\n"
195 						+ "        </style>		\n"
196 						+ "	</head>\n"
197 						+ "	<body>\n"
198 						+ "	<img src=\"kru_banner2.jpg\">\n"
199 						+ "	<div class=\"user-name\"><a href=\".\" class=\"user-link\">"
200 						+ username
201 						+ "</a>\n"
202 						+ "<a href=\"./j_spring_security_logout\" class=\"user-link\">Logout</a></div>\n"
203 						+ "<table style=\"vertical-align: top; height: 500px\">\n"
204 						+ "<tr >\n"
205 						+ "<td style=\"vertical-align: top;\">\n"
206 						+ "\n"
207 						+ "	<span class=\"ExampleStyledList\">\n"
208 						+ "	<ul> \n"
209 						+ "		<li><a href=\"org.kuali.student.core.organization.ui.OrgEntry/OrgEntry.jsp\">Organizations</a> </li> \n"
210 						+ "		<li><a href=\"org.kuali.student.lum.lu.ui.main.LUMMain/LUMMain.jsp\">Curriculum Management</a> </li> \n"
211 						+ "		<li><a href=\""
212 						+ riceUrl
213 						+ "/portal.do?selectedTab=main\">Rice</a></li>\n"
214 						+ "	</ul>\n"
215 						+ "	</span>\n"
216 						+ "	</td>\n"
217 						+ "	<td style=\"vertical-align: top;\">\n"
218 						+ "    <table class=\"task-table\"><tr class=\"mock-row\"><td class=\"mock-actionList\">KEW action list</td></tr></table> \n"
219 						+ "    </td>\n"
220 						+ "</tr>\n"
221 						+ "</table>\n"
222 						+ "	\n"
223 						+ "</body></html>");
224 	}
225 }