1/*2 * Copyright 2000-2001,2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.modules.actions.controls;
1819// Turbine stuff20import org.apache.turbine.modules.Action;
21import org.apache.turbine.util.RunData;
2223// Jetspeed stuff24import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
25import org.apache.jetspeed.services.logging.JetspeedLogger;
26import org.apache.jetspeed.services.rundata.JetspeedRunData;
27import org.apache.jetspeed.om.profile.Entry;
2829/***30 * Change the state of a portlet to maximized. This setting is not persistent.31 * Since the maximized state affects the whole screen, this action redirects32 * the user to a new template and store the state to go to when clicking on33 * restore34 * 35 * @author <a href="mailto:re_carrasco@bco011.sonda.cl">Roberto Carrasco</a>36 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>37 * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>38 */39publicclassMaximizeextends Action
40 {
4142/***43 * Static initialization of the logger for this class44 */45privatestaticfinalJetspeedLogger logger = JetspeedLogFactoryService.getLogger(Maximize.class.getName());
4647/***48 * @param rundata The RunData object for the current request49 */50publicvoid doPerform( RunData rundata ) throws Exception
51 {
52// Only logged in users can maximize53if( rundata.getUser() == null)
54 {
55return;
56 }
57// Get jsp_peid parmameter. If it does not exist, then do nothing58 String peid = rundata.getParameters().getString("js_peid");
59if ( peid == null )
60 {
61return;
62 }
6364// Get the Portlet using the PSML document and the PEID65JetspeedRunData jdata = (JetspeedRunData)rundata;
6667// Get the Portlet using the PSML document and the PEID68Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
69if ( entry == null )
70 {
71 logger.warn("Failed to get PEID (" + peid + ") entry for User ("72 + rundata.getUser().getName() + ")");
73return;
74 }
7576//record that this portlet is now maximized77 jdata.getUser().setTemp("js_peid",peid);
7879 }
80 }