001: /*
002: * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/CmsShowOrgUnitResourceList.java,v $
003: * Date : $Date: 2008-02-27 12:05:26 $
004: * Version: $Revision: 1.4 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.workplace.tools.accounts;
033:
034: import org.opencms.db.CmsUserSettings;
035: import org.opencms.jsp.CmsJspActionElement;
036: import org.opencms.main.CmsException;
037: import org.opencms.main.OpenCms;
038: import org.opencms.workplace.list.A_CmsListExplorerDialog;
039: import org.opencms.workplace.list.CmsListIndependentAction;
040: import org.opencms.workplace.list.CmsListMetadata;
041: import org.opencms.workplace.list.I_CmsListResourceCollector;
042:
043: import java.util.ArrayList;
044: import java.util.Collections;
045: import java.util.List;
046:
047: /**
048: * List for org unit resources.<p>
049: *
050: * @author Michael Moossen
051: *
052: * @version $Revision: 1.4 $
053: *
054: * @since 6.5.4
055: */
056: public class CmsShowOrgUnitResourceList extends A_CmsListExplorerDialog {
057:
058: /** list id constant. */
059: public static final String LIST_ID = "our";
060:
061: /** The internal collector instance. */
062: private I_CmsListResourceCollector m_collector;
063:
064: /** Stores the value of the request parameter for the user id. */
065: private String m_paramOufqn;
066:
067: /**
068: * Public constructor.<p>
069: *
070: * @param jsp an initialized JSP action element
071: */
072: public CmsShowOrgUnitResourceList(CmsJspActionElement jsp) {
073:
074: super (jsp, LIST_ID, Messages.get().container(
075: Messages.GUI_ORGUNIT_RESOURCES_LIST_NAME_0));
076: List resourceList;
077: try {
078: resourceList = OpenCms.getOrgUnitManager()
079: .getResourcesForOrganizationalUnit(getCms(),
080: getParamOufqn());
081: } catch (CmsException e) {
082: resourceList = new ArrayList();
083: }
084: Collections.sort(resourceList);
085: m_collector = new CmsShowOrgUnitResourcesCollector(this ,
086: resourceList);
087: getList().getMetadata().getIndependentAction(
088: CmsListIndependentAction.ACTION_EXPLORER_SWITCH_ID)
089: .setVisible(false);
090: }
091:
092: /**
093: * @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions()
094: */
095: public void executeListMultiActions() {
096:
097: throwListUnsupportedActionException();
098: }
099:
100: /**
101: * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
102: */
103: public void executeListSingleActions() {
104:
105: throwListUnsupportedActionException();
106: }
107:
108: /**
109: * @see org.opencms.workplace.list.A_CmsListExplorerDialog#getCollector()
110: */
111: public I_CmsListResourceCollector getCollector() {
112:
113: return m_collector;
114: }
115:
116: /**
117: * Returns the organizational unit fqn parameter value.<p>
118: *
119: * @return the organizational unit fqn parameter value
120: */
121: public String getParamOufqn() {
122:
123: return m_paramOufqn;
124: }
125:
126: /**
127: * Sets the organizational unit fqn parameter value.<p>
128: *
129: * @param ouFqn the organizational unit fqn parameter value
130: */
131: public void setParamOufqn(String ouFqn) {
132:
133: if (ouFqn == null) {
134: ouFqn = "";
135: }
136: m_paramOufqn = ouFqn;
137: }
138:
139: /**
140: * @see org.opencms.workplace.list.A_CmsListDialog#defaultActionHtmlStart()
141: */
142: protected String defaultActionHtmlStart() {
143:
144: return getList().listJs() + dialogContentStart(getParamTitle());
145: }
146:
147: /**
148: * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
149: */
150: protected void fillDetails(String detailId) {
151:
152: // no op
153: }
154:
155: /**
156: * @see org.opencms.workplace.list.A_CmsListExplorerDialog#getListItems()
157: */
158: protected List getListItems() throws CmsException {
159:
160: String storedSiteRoot = getCms().getRequestContext()
161: .getSiteRoot();
162: try {
163: getCms().getRequestContext().setSiteRoot("");
164: return super .getListItems();
165: } finally {
166: getCms().getRequestContext().setSiteRoot(storedSiteRoot);
167: }
168: }
169:
170: /**
171: * @see org.opencms.workplace.list.A_CmsListExplorerDialog#isColumnVisible(int)
172: */
173: protected boolean isColumnVisible(int colFlag) {
174:
175: boolean isVisible = (colFlag == CmsUserSettings.FILELIST_TITLE);
176: isVisible = isVisible
177: || (colFlag == LIST_COLUMN_TYPEICON.hashCode());
178: isVisible = isVisible
179: || (colFlag == LIST_COLUMN_LOCKICON.hashCode());
180: isVisible = isVisible
181: || (colFlag == LIST_COLUMN_PROJSTATEICON.hashCode());
182: isVisible = isVisible
183: || (colFlag == LIST_COLUMN_NAME.hashCode());
184: return isVisible;
185: }
186:
187: /**
188: * @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata)
189: */
190: protected void setMultiActions(CmsListMetadata metadata) {
191:
192: // no LMAs, and remove default search action
193: metadata.setSearchAction(null);
194: }
195: }
|