001: /*
002: * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/projects/CmsProjectsList.java,v $
003: * Date : $Date: 2008-02-27 12:05:51 $
004: * Version: $Revision: 1.19 $
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.projects;
033:
034: import org.opencms.file.CmsProject;
035: import org.opencms.jsp.CmsJspActionElement;
036: import org.opencms.main.CmsException;
037: import org.opencms.main.CmsRuntimeException;
038: import org.opencms.main.OpenCms;
039: import org.opencms.util.CmsUUID;
040: import org.opencms.workplace.CmsDialog;
041: import org.opencms.workplace.list.A_CmsListDialog;
042: import org.opencms.workplace.list.A_CmsListExplorerDialog;
043: import org.opencms.workplace.list.CmsListColumnAlignEnum;
044: import org.opencms.workplace.list.CmsListColumnDefinition;
045: import org.opencms.workplace.list.CmsListDateMacroFormatter;
046: import org.opencms.workplace.list.CmsListDefaultAction;
047: import org.opencms.workplace.list.CmsListDirectAction;
048: import org.opencms.workplace.list.CmsListItem;
049: import org.opencms.workplace.list.CmsListItemActionIconComparator;
050: import org.opencms.workplace.list.CmsListItemDetails;
051: import org.opencms.workplace.list.CmsListItemDetailsFormatter;
052: import org.opencms.workplace.list.CmsListMetadata;
053: import org.opencms.workplace.list.CmsListMultiAction;
054: import org.opencms.workplace.list.CmsListOrderEnum;
055: import org.opencms.workplace.list.CmsListSearchAction;
056:
057: import java.io.IOException;
058: import java.util.ArrayList;
059: import java.util.Date;
060: import java.util.HashMap;
061: import java.util.Iterator;
062: import java.util.List;
063: import java.util.Map;
064:
065: import javax.servlet.ServletException;
066: import javax.servlet.http.HttpServletRequest;
067: import javax.servlet.http.HttpServletResponse;
068: import javax.servlet.jsp.PageContext;
069:
070: /**
071: * Main project management view.<p>
072: *
073: * @author Michael Moossen
074: *
075: * @version $Revision: 1.19 $
076: *
077: * @since 6.0.0
078: */
079: public class CmsProjectsList extends A_CmsListDialog {
080:
081: /** list action id constant. */
082: public static final String LIST_ACTION_DELETE = "ad";
083:
084: /** list action id constant. */
085: public static final String LIST_ACTION_EDIT = "ae";
086:
087: /** list action id constant. */
088: public static final String LIST_ACTION_FILES = "af";
089:
090: /** list action id constant. */
091: public static final String LIST_ACTION_LOCK = "al";
092:
093: /** list action id constant. */
094: public static final String LIST_ACTION_PUBLISH_DISABLED = "apd";
095:
096: /** list action id constant. */
097: public static final String LIST_ACTION_PUBLISH_ENABLED = "ape";
098:
099: /** list action id constant. */
100: public static final String LIST_ACTION_UNLOCK = "au";
101:
102: /** list column id constant. */
103: public static final String LIST_COLUMN_CREATION = "cc";
104:
105: /** list column id constant. */
106: public static final String LIST_COLUMN_DELETE = "cd";
107:
108: /** list column id constant. */
109: public static final String LIST_COLUMN_DESCRIPTION = "cr";
110:
111: /** list column id constant. */
112: public static final String LIST_COLUMN_EDIT = "ce";
113:
114: /** list column id constant. */
115: public static final String LIST_COLUMN_FILES = "cf";
116:
117: /** list column id constant. */
118: public static final String LIST_COLUMN_LOCK = "cl";
119:
120: /** list column id constant. */
121: public static final String LIST_COLUMN_MANAGER = "cm";
122:
123: /** list column id constant. */
124: public static final String LIST_COLUMN_NAME = "cn";
125:
126: /** list column id constant. */
127: public static final String LIST_COLUMN_OWNER = "co";
128:
129: /** list column id constant. */
130: public static final String LIST_COLUMN_PUBLISH = "cp";
131:
132: /** list column id constant. */
133: public static final String LIST_COLUMN_USER = "cu";
134:
135: /** list action id constant. */
136: public static final String LIST_DEFACTION_FILES = "df";
137:
138: /** list detail constant. */
139: public static final String LIST_DETAIL_RESOURCES = "dr";
140:
141: /** list id constant. */
142: public static final String LIST_ID = "lp";
143:
144: /** list action id constant. */
145: public static final String LIST_MACTION_DELETE = "md";
146:
147: /** list action id constant. */
148: public static final String LIST_MACTION_UNLOCK = "mu";
149:
150: /** Path to the list buttons. */
151: public static final String PATH_BUTTONS = "tools/projects/buttons/";
152:
153: /** list column id constant. */
154: public static final String LIST_COLUMN_ORGUNIT = "cou";
155:
156: /**
157: * Public constructor.<p>
158: *
159: * @param jsp an initialized JSP action element
160: */
161: public CmsProjectsList(CmsJspActionElement jsp) {
162:
163: super (jsp, LIST_ID, Messages.get().container(
164: Messages.GUI_PROJECTS_LIST_NAME_0), LIST_COLUMN_NAME,
165: CmsListOrderEnum.ORDER_ASCENDING, null);
166: }
167:
168: /**
169: * Public constructor with JSP variables.<p>
170: *
171: * @param context the JSP page context
172: * @param req the JSP request
173: * @param res the JSP response
174: */
175: public CmsProjectsList(PageContext context, HttpServletRequest req,
176: HttpServletResponse res) {
177:
178: this (new CmsJspActionElement(context, req, res));
179: }
180:
181: /**
182: * Deletes the project and closes the dialog.<p>
183: *
184: * @throws Exception if something goes wrong
185: */
186: public void actionDeleteProject() throws Exception {
187:
188: String pId = getJsp().getRequest().getParameter(
189: CmsEditProjectDialog.PARAM_PROJECTID);
190: getCms().deleteProject(new CmsUUID(pId));
191: refreshList();
192: actionCloseDialog();
193: }
194:
195: /**
196: * This method should handle every defined list multi action,
197: * by comparing <code>{@link #getParamListAction()}</code> with the id
198: * of the action to execute.<p>
199: *
200: * @throws CmsRuntimeException to signal that an action is not supported
201: *
202: */
203: public void executeListMultiActions() throws CmsRuntimeException {
204:
205: if (getParamListAction().equals(LIST_MACTION_DELETE)) {
206: // execute the delete multiaction
207: List removedItems = new ArrayList();
208: try {
209: Iterator itItems = getSelectedItems().iterator();
210: while (itItems.hasNext()) {
211: CmsListItem listItem = (CmsListItem) itItems.next();
212: CmsUUID pId = new CmsUUID(listItem.getId());
213: getCms().deleteProject(pId);
214: removedItems.add(listItem.getId());
215: }
216: } catch (CmsException e) {
217: throw new CmsRuntimeException(Messages.get().container(
218: Messages.ERR_DELETE_SELECTED_PROJECTS_0), e);
219: }
220: } else if (getParamListAction().equals(LIST_MACTION_UNLOCK)) {
221: // execute the unlock multiaction
222: try {
223: Iterator itItems = getSelectedItems().iterator();
224: while (itItems.hasNext()) {
225: CmsListItem listItem = (CmsListItem) itItems.next();
226: CmsUUID pId = new CmsUUID(listItem.getId());
227: getCms().unlockProject(pId);
228: }
229: } catch (CmsException e) {
230: throw new CmsRuntimeException(Messages.get().container(
231: Messages.ERR_UNLOCK_SELECTED_PROJECTS_0), e);
232: }
233: } else {
234: throwListUnsupportedActionException();
235: }
236: listSave();
237: }
238:
239: /**
240: * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
241: */
242: public void executeListSingleActions() throws IOException,
243: ServletException {
244:
245: CmsUUID projectId = new CmsUUID(getSelectedItem().getId());
246: String projectName = getSelectedItem().get(LIST_COLUMN_NAME)
247: .toString();
248:
249: Map params = new HashMap();
250: params.put(CmsEditProjectDialog.PARAM_PROJECTID, projectId
251: .toString());
252: // set action parameter to initial dialog call
253: params.put(CmsDialog.PARAM_ACTION, CmsDialog.DIALOG_INITIAL);
254:
255: if (getParamListAction().equals(LIST_DEFACTION_FILES)) {
256: // forward to the project files dialog
257: params.put(A_CmsListExplorerDialog.PARAM_SHOW_EXPLORER,
258: Boolean.TRUE.toString());
259: getToolManager().jspForwardTool(this , "/projects/files",
260: params);
261: } else if (getParamListAction().equals(LIST_ACTION_EDIT)) {
262: getToolManager().jspForwardTool(this , "/projects/edit",
263: params);
264: } else if (getParamListAction().equals(LIST_ACTION_FILES)) {
265: getToolManager().jspForwardTool(this , "/projects/files",
266: params);
267: } else if (getParamListAction().equals(
268: LIST_ACTION_PUBLISH_ENABLED)) {
269: getToolManager().jspForwardTool(this , "/projects/publish",
270: params);
271: } else if (getParamListAction().equals(LIST_ACTION_DELETE)) {
272: // execute the delete action
273: try {
274: getCms().deleteProject(projectId);
275: } catch (CmsException e) {
276: throw new CmsRuntimeException(Messages.get().container(
277: Messages.ERR_DELETE_PROJECT_1, projectName), e);
278: }
279: } else if (getParamListAction().equals(LIST_ACTION_LOCK)) {
280: // noop
281: } else if (getParamListAction().equals(LIST_ACTION_UNLOCK)) {
282: // execute the unlock action
283: try {
284: getCms().unlockProject(projectId);
285: } catch (CmsException e) {
286: throw new CmsRuntimeException(Messages.get().container(
287: Messages.ERR_UNLOCK_PROJECT_1, projectName), e);
288: }
289: } else {
290: throwListUnsupportedActionException();
291: }
292: listSave();
293: }
294:
295: /**
296: * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
297: */
298: protected void fillDetails(String detailId) {
299:
300: List projects = getList().getAllContent();
301: Iterator itProjects = projects.iterator();
302: while (itProjects.hasNext()) {
303: CmsListItem item = (CmsListItem) itProjects.next();
304: try {
305: if (detailId.equals(LIST_DETAIL_RESOURCES)) {
306: CmsProject project = getCms().readProject(
307: new CmsUUID(item.getId()));
308: StringBuffer html = new StringBuffer(512);
309: Iterator resources = getCms().readProjectResources(
310: project).iterator();
311: while (resources.hasNext()) {
312: html.append(resources.next().toString());
313: html.append("<br>");
314: }
315: item.set(LIST_DETAIL_RESOURCES, html.toString());
316: }
317: } catch (Exception e) {
318: // ignore
319: }
320: }
321: }
322:
323: /**
324: * @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
325: */
326: protected List getListItems() throws CmsException {
327:
328: List ret = new ArrayList();
329: // get content
330: List projects = getCms().getAllManageableProjects();
331: Iterator itProjects = projects.iterator();
332: while (itProjects.hasNext()) {
333: CmsProject project = (CmsProject) itProjects.next();
334: CmsListItem item = getList().newItem(
335: project.getUuid().toString());
336: item.set(LIST_COLUMN_NAME, project.getSimpleName());
337: item.set(LIST_COLUMN_DESCRIPTION, project.getDescription());
338: item.set(LIST_COLUMN_ORGUNIT, OpenCms.getOrgUnitManager()
339: .readOrganizationalUnit(getCms(),
340: project.getOuFqn()).getDisplayName(
341: getLocale()));
342: try {
343: item.set(LIST_COLUMN_OWNER, getCms().readUser(
344: project.getOwnerId()).getName());
345: } catch (Exception e) {
346: // ignore
347: }
348: try {
349: item.set(LIST_COLUMN_MANAGER, getCms().readGroup(
350: project.getManagerGroupId()).getSimpleName());
351: } catch (Exception e) {
352: // ignore
353: }
354: try {
355: item.set(LIST_COLUMN_USER, getCms().readGroup(
356: project.getGroupId()).getSimpleName());
357: } catch (Exception e) {
358: // ignore
359: }
360: item.set(LIST_COLUMN_CREATION, new Date(project
361: .getDateCreated()));
362: StringBuffer html = new StringBuffer(512);
363: Iterator resources = getCms().readProjectResources(project)
364: .iterator();
365: while (resources.hasNext()) {
366: html.append(resources.next().toString());
367: html.append("<br>");
368: }
369: item.set(LIST_DETAIL_RESOURCES, html.toString());
370: ret.add(item);
371: }
372:
373: // hide ou column if only one ou exists
374: try {
375: if (OpenCms.getOrgUnitManager().getOrganizationalUnits(
376: getCms(), "", true).isEmpty()) {
377: getList().getMetadata().getColumnDefinition(
378: LIST_COLUMN_ORGUNIT).setVisible(false);
379: } else {
380: getList().getMetadata().getColumnDefinition(
381: LIST_COLUMN_ORGUNIT).setVisible(true);
382: }
383: } catch (CmsException e) {
384: // noop
385: }
386:
387: return ret;
388: }
389:
390: /**
391: * @see org.opencms.workplace.CmsWorkplace#initMessages()
392: */
393: protected void initMessages() {
394:
395: // add specific dialog resource bundle
396: addMessages(Messages.get().getBundleName());
397: // add default resource bundles
398: super .initMessages();
399: }
400:
401: /**
402: * @see org.opencms.workplace.list.A_CmsListDialog#setColumns(org.opencms.workplace.list.CmsListMetadata)
403: */
404: protected void setColumns(CmsListMetadata metadata) {
405:
406: // create column for files
407: CmsListColumnDefinition filesCol = new CmsListColumnDefinition(
408: LIST_COLUMN_FILES);
409: filesCol.setName(Messages.get().container(
410: Messages.GUI_PROJECTS_LIST_COLS_FILES_0));
411: filesCol.setHelpText(Messages.get().container(
412: Messages.GUI_PROJECTS_LIST_COLS_FILES_HELP_0));
413: filesCol.setWidth("20");
414: filesCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
415: filesCol.setSorteable(false);
416: // add files action
417: CmsListDirectAction filesAction = new CmsListDirectAction(
418: LIST_ACTION_FILES);
419: filesAction.setName(Messages.get().container(
420: Messages.GUI_PROJECTS_LIST_ACTION_FILES_NAME_0));
421: filesAction.setHelpText(Messages.get().container(
422: Messages.GUI_PROJECTS_LIST_ACTION_FILES_HELP_0));
423: filesAction.setIconPath(PATH_BUTTONS + "project.png");
424: filesCol.addDirectAction(filesAction);
425: // add it to the list definition
426: metadata.addColumn(filesCol);
427:
428: // create column for lock/unlock
429: CmsListColumnDefinition lockCol = new CmsListColumnDefinition(
430: LIST_COLUMN_LOCK);
431: lockCol.setName(Messages.get().container(
432: Messages.GUI_PROJECTS_LIST_COLS_LOCK_0));
433: lockCol.setHelpText(Messages.get().container(
434: Messages.GUI_PROJECTS_LIST_COLS_LOCK_HELP_0));
435: lockCol.setWidth("20");
436: lockCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
437: lockCol
438: .setListItemComparator(new CmsListItemActionIconComparator());
439:
440: // lock action
441: CmsListDirectAction lockAction = new CmsListDirectAction(
442: LIST_ACTION_LOCK) {
443:
444: /**
445: * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible()
446: */
447: public boolean isVisible() {
448:
449: if (getItem() != null) {
450: try {
451: return getCms().countLockedResources(
452: new CmsUUID(getItem().getId())) == 0;
453: } catch (CmsException e) {
454: // noop
455: }
456: }
457: return super .isVisible();
458: }
459: };
460: lockAction.setName(Messages.get().container(
461: Messages.GUI_PROJECTS_LIST_ACTION_LOCK_NAME_0));
462: lockAction.setHelpText(Messages.get().container(
463: Messages.GUI_PROJECTS_LIST_ACTION_LOCK_HELP_0));
464: lockAction.setConfirmationMessage(Messages.get().container(
465: Messages.GUI_PROJECTS_LIST_ACTION_LOCK_CONF_0));
466: lockAction.setIconPath(PATH_BUTTONS + "project_lock.png");
467: lockAction.setEnabled(false);
468: lockCol.addDirectAction(lockAction);
469:
470: // unlock action
471: CmsListDirectAction unlockAction = new CmsListDirectAction(
472: LIST_ACTION_UNLOCK) {
473:
474: /**
475: * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible()
476: */
477: public boolean isVisible() {
478:
479: if (getItem() != null) {
480: try {
481: return getCms().countLockedResources(
482: new CmsUUID(getItem().getId())) != 0;
483: } catch (CmsException e) {
484: // noop
485: }
486: }
487: return super .isVisible();
488: }
489: };
490: unlockAction.setName(Messages.get().container(
491: Messages.GUI_PROJECTS_LIST_ACTION_UNLOCK_NAME_0));
492: unlockAction.setHelpText(Messages.get().container(
493: Messages.GUI_PROJECTS_LIST_ACTION_UNLOCK_HELP_0));
494: unlockAction.setConfirmationMessage(Messages.get().container(
495: Messages.GUI_PROJECTS_LIST_ACTION_UNLOCK_CONF_0));
496: unlockAction.setIconPath(PATH_BUTTONS + "project_unlock.png");
497: lockCol.addDirectAction(unlockAction);
498:
499: // add it to the list definition
500: metadata.addColumn(lockCol);
501:
502: // create column for publishing
503: CmsListColumnDefinition publishCol = new CmsListColumnDefinition(
504: LIST_COLUMN_PUBLISH);
505: publishCol.setName(Messages.get().container(
506: Messages.GUI_PROJECTS_LIST_COLS_PUBLISH_0));
507: publishCol.setHelpText(Messages.get().container(
508: Messages.GUI_PROJECTS_LIST_COLS_PUBLISH_HELP_0));
509: publishCol.setWidth("20");
510: publishCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
511: publishCol.setSorteable(false);
512:
513: // publish enabled action
514: CmsListDirectAction publishEnabledAction = new CmsListDirectAction(
515: LIST_ACTION_PUBLISH_ENABLED) {
516:
517: /**
518: * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible()
519: */
520: public boolean isVisible() {
521:
522: if (getItem() != null) {
523: try {
524: return getCms().countLockedResources(
525: new CmsUUID(getItem().getId())) == 0;
526: } catch (CmsException e) {
527: // noop
528: }
529: }
530: return super .isVisible();
531: }
532: };
533: publishEnabledAction
534: .setName(Messages
535: .get()
536: .container(
537: Messages.GUI_PROJECTS_LIST_ACTION_PUBLISH_ENABLED_NAME_0));
538: publishEnabledAction
539: .setHelpText(Messages
540: .get()
541: .container(
542: Messages.GUI_PROJECTS_LIST_ACTION_PUBLISH_ENABLED_HELP_0));
543: publishEnabledAction
544: .setConfirmationMessage(Messages
545: .get()
546: .container(
547: Messages.GUI_PROJECTS_LIST_ACTION_PUBLISH_ENABLED_CONF_0));
548: publishEnabledAction.setIconPath(PATH_BUTTONS
549: + "project_publish.png");
550: publishCol.addDirectAction(publishEnabledAction);
551:
552: // publish disabled action
553: CmsListDirectAction publishDisabledAction = new CmsListDirectAction(
554: LIST_ACTION_PUBLISH_DISABLED) {
555:
556: /**
557: * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible()
558: */
559: public boolean isVisible() {
560:
561: if (getItem() != null) {
562: try {
563: return getCms().countLockedResources(
564: new CmsUUID(getItem().getId())) != 0;
565: } catch (CmsException e) {
566: // noop
567: }
568: }
569: return super .isVisible();
570: }
571: };
572: publishDisabledAction
573: .setName(Messages
574: .get()
575: .container(
576: Messages.GUI_PROJECTS_LIST_ACTION_PUBLISH_DISABLED_NAME_0));
577: publishDisabledAction
578: .setHelpText(Messages
579: .get()
580: .container(
581: Messages.GUI_PROJECTS_LIST_ACTION_PUBLISH_DISABLED_HELP_0));
582: publishDisabledAction
583: .setConfirmationMessage(Messages
584: .get()
585: .container(
586: Messages.GUI_PROJECTS_LIST_ACTION_PUBLISH_DISABLED_CONF_0));
587: publishDisabledAction.setIconPath(PATH_BUTTONS
588: + "project_publish_disabled.png");
589: publishDisabledAction.setEnabled(false);
590: publishCol.addDirectAction(publishDisabledAction);
591:
592: // add it to the list definition
593: metadata.addColumn(publishCol);
594:
595: // create column for edition
596: CmsListColumnDefinition editCol = new CmsListColumnDefinition(
597: LIST_COLUMN_EDIT);
598: editCol.setName(Messages.get().container(
599: Messages.GUI_PROJECTS_LIST_COLS_EDIT_0));
600: editCol.setHelpText(Messages.get().container(
601: Messages.GUI_PROJECTS_LIST_COLS_EDIT_HELP_0));
602: editCol.setWidth("20");
603: editCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
604: editCol.setSorteable(false);
605: // add edit action
606: CmsListDirectAction editAction = new CmsListDirectAction(
607: LIST_ACTION_EDIT);
608: editAction.setName(Messages.get().container(
609: Messages.GUI_PROJECTS_LIST_ACTION_EDIT_NAME_0));
610: editAction.setHelpText(Messages.get().container(
611: Messages.GUI_PROJECTS_LIST_ACTION_EDIT_HELP_0));
612: editAction.setIconPath(PATH_BUTTONS + "project_edit.png");
613: editCol.addDirectAction(editAction);
614: // add it to the list definition
615: metadata.addColumn(editCol);
616:
617: // create column for deletion
618: CmsListColumnDefinition deleteCol = new CmsListColumnDefinition(
619: LIST_COLUMN_DELETE);
620: deleteCol.setName(Messages.get().container(
621: Messages.GUI_PROJECTS_LIST_COLS_DELETE_0));
622: deleteCol.setHelpText(Messages.get().container(
623: Messages.GUI_PROJECTS_LIST_COLS_DELETE_HELP_0));
624: deleteCol.setWidth("20");
625: deleteCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
626: deleteCol.setSorteable(false);
627: // add delete action
628: CmsListDirectAction deleteAction = new CmsListDirectAction(
629: LIST_ACTION_DELETE);
630: deleteAction.setName(Messages.get().container(
631: Messages.GUI_PROJECTS_LIST_ACTION_DELETE_NAME_0));
632: deleteAction.setHelpText(Messages.get().container(
633: Messages.GUI_PROJECTS_LIST_ACTION_DELETE_HELP_0));
634: deleteAction.setConfirmationMessage(Messages.get().container(
635: Messages.GUI_PROJECTS_LIST_ACTION_DELETE_CONF_0));
636: deleteAction.setIconPath(ICON_DELETE);
637: deleteCol.addDirectAction(deleteAction);
638: // add it to the list definition
639: metadata.addColumn(deleteCol);
640:
641: // create column for name
642: CmsListColumnDefinition nameCol = new CmsListColumnDefinition(
643: LIST_COLUMN_NAME);
644: nameCol.setName(Messages.get().container(
645: Messages.GUI_PROJECTS_LIST_COLS_NAME_0));
646: nameCol.setWidth("15%");
647: // create default edit action
648: CmsListDefaultAction defEditAction = new CmsListDefaultAction(
649: LIST_DEFACTION_FILES);
650: defEditAction.setName(Messages.get().container(
651: Messages.GUI_PROJECTS_LIST_DEFACTION_EDIT_NAME_0));
652: defEditAction.setHelpText(Messages.get().container(
653: Messages.GUI_PROJECTS_LIST_DEFACTION_EDIT_HELP_0));
654: nameCol.addDefaultAction(defEditAction);
655: // add it to the list definition
656: metadata.addColumn(nameCol);
657:
658: // add column for description
659: CmsListColumnDefinition descriptionCol = new CmsListColumnDefinition(
660: LIST_COLUMN_DESCRIPTION);
661: descriptionCol.setName(Messages.get().container(
662: Messages.GUI_PROJECTS_LIST_COLS_DESCRIPTION_0));
663: descriptionCol.setWidth("20%");
664: descriptionCol.setTextWrapping(true);
665: metadata.addColumn(descriptionCol);
666:
667: // add column for organizational units
668: CmsListColumnDefinition ouCol = new CmsListColumnDefinition(
669: LIST_COLUMN_ORGUNIT);
670: ouCol.setName(Messages.get().container(
671: Messages.GUI_PROJECTS_LIST_COLS_ORGUNIT_0));
672: ouCol.setWidth("15%");
673: metadata.addColumn(ouCol);
674:
675: // add column for owner user
676: CmsListColumnDefinition ownerCol = new CmsListColumnDefinition(
677: LIST_COLUMN_OWNER);
678: ownerCol.setName(Messages.get().container(
679: Messages.GUI_PROJECTS_LIST_COLS_OWNER_0));
680: ownerCol.setWidth("12%");
681: metadata.addColumn(ownerCol);
682:
683: // add column for manager group
684: CmsListColumnDefinition managerCol = new CmsListColumnDefinition(
685: LIST_COLUMN_MANAGER);
686: managerCol.setName(Messages.get().container(
687: Messages.GUI_PROJECTS_LIST_COLS_MANAGER_0));
688: managerCol.setWidth("12%");
689: metadata.addColumn(managerCol);
690:
691: // add column for user group
692: CmsListColumnDefinition userCol = new CmsListColumnDefinition(
693: LIST_COLUMN_USER);
694: userCol.setName(Messages.get().container(
695: Messages.GUI_PROJECTS_LIST_COLS_USER_0));
696: userCol.setWidth("12%");
697: metadata.addColumn(userCol);
698:
699: // add column for creation date
700: CmsListColumnDefinition creationCol = new CmsListColumnDefinition(
701: LIST_COLUMN_CREATION);
702: creationCol.setName(Messages.get().container(
703: Messages.GUI_PROJECTS_LIST_COLS_CREATION_0));
704: creationCol.setWidth("14%");
705: creationCol.setFormatter(CmsListDateMacroFormatter
706: .getDefaultDateFormatter());
707: metadata.addColumn(creationCol);
708: }
709:
710: /**
711: * @see org.opencms.workplace.list.A_CmsListDialog#setIndependentActions(org.opencms.workplace.list.CmsListMetadata)
712: */
713: protected void setIndependentActions(CmsListMetadata metadata) {
714:
715: // add publishing info details
716: CmsListItemDetails resourcesDetails = new CmsListItemDetails(
717: LIST_DETAIL_RESOURCES);
718: resourcesDetails.setAtColumn(LIST_COLUMN_NAME);
719: resourcesDetails.setVisible(false);
720: resourcesDetails.setShowActionName(Messages.get().container(
721: Messages.GUI_PROJECTS_DETAIL_SHOW_RESOURCES_NAME_0));
722: resourcesDetails
723: .setShowActionHelpText(Messages
724: .get()
725: .container(
726: Messages.GUI_PROJECTS_DETAIL_SHOW_RESOURCES_HELP_0));
727: resourcesDetails.setHideActionName(Messages.get().container(
728: Messages.GUI_PROJECTS_DETAIL_HIDE_RESOURCES_NAME_0));
729: resourcesDetails
730: .setHideActionHelpText(Messages
731: .get()
732: .container(
733: Messages.GUI_PROJECTS_DETAIL_HIDE_RESOURCES_HELP_0));
734: resourcesDetails.setName(Messages.get().container(
735: Messages.GUI_PROJECTS_DETAIL_RESOURCES_NAME_0));
736: resourcesDetails
737: .setFormatter(new CmsListItemDetailsFormatter(
738: Messages
739: .get()
740: .container(
741: Messages.GUI_PROJECTS_DETAIL_RESOURCES_NAME_0)));
742: metadata.addItemDetails(resourcesDetails);
743:
744: // makes the list searchable
745: CmsListSearchAction searchAction = new CmsListSearchAction(
746: metadata.getColumnDefinition(LIST_COLUMN_NAME));
747: searchAction.addColumn(metadata
748: .getColumnDefinition(LIST_COLUMN_DESCRIPTION));
749: metadata.setSearchAction(searchAction);
750: }
751:
752: /**
753: * @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata)
754: */
755: protected void setMultiActions(CmsListMetadata metadata) {
756:
757: // add the unlock project multi action
758: CmsListMultiAction unlockProject = new CmsListMultiAction(
759: LIST_MACTION_UNLOCK);
760: unlockProject.setName(Messages.get().container(
761: Messages.GUI_PROJECTS_LIST_MACTION_UNLOCK_NAME_0));
762: unlockProject.setHelpText(Messages.get().container(
763: Messages.GUI_PROJECTS_LIST_MACTION_UNLOCK_HELP_0));
764: unlockProject.setConfirmationMessage(Messages.get().container(
765: Messages.GUI_PROJECTS_LIST_MACTION_UNLOCK_CONF_0));
766: unlockProject.setIconPath(PATH_BUTTONS + "project_unlock.png");
767: metadata.addMultiAction(unlockProject);
768:
769: // add delete multi action
770: CmsListMultiAction deleteMultiAction = new CmsListMultiAction(
771: LIST_MACTION_DELETE);
772: deleteMultiAction.setName(Messages.get().container(
773: Messages.GUI_PROJECTS_LIST_MACTION_DELETE_NAME_0));
774: deleteMultiAction.setHelpText(Messages.get().container(
775: Messages.GUI_PROJECTS_LIST_MACTION_DELETE_HELP_0));
776: deleteMultiAction
777: .setConfirmationMessage(Messages
778: .get()
779: .container(
780: Messages.GUI_PROJECTS_LIST_MACTION_DELETE_CONF_0));
781: deleteMultiAction.setIconPath(ICON_MULTI_DELETE);
782: metadata.addMultiAction(deleteMultiAction);
783: }
784: }
|