📄 a_cmsbackoffice.java
字号:
/*
* File : $Source: /usr/local/cvs/opencms/src/com/opencms/defaults/A_CmsBackoffice.java,v $
* Date : $Date: 2002/04/09 12:35:30 $
* Version: $Revision: 1.43 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* Copyright (C) 2001 The OpenCms Group
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about OpenCms, please see the
* OpenCms Website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.opencms.defaults;
import com.opencms.template.*;
import com.opencms.workplace.*;
import com.opencms.defaults.*;
import com.opencms.file.*;
import com.opencms.core.*;
import com.opencms.core.exceptions.*;
import com.opencms.util.*;
import java.util.*;
import java.lang.reflect.*;
/**
* Abstract class for generic backoffice display. It automatically
* generates the <ul><li>head section with filters and buttons,</li>
* <li>body section with the table data,</li>
* <li>lock states of the entries. if there are any,</li>
* <li>delete dialog,</li>
* <li>lock dialog.</li></ul>
* calls the <ul><li>edit dialog of the calling backoffice class</li>
* <li>new dialog of the calling backoffice class</li></ul>
* using the content definition class defined by the getContentDefinition method.
* The methods and data provided by the content definition class
* is accessed by reflection. This way it is possible to re-use
* this class for any content definition class, that just has
* to extend the A_CmsContentDefinition class!
* Creation date: (27.10.00 10:04:42)
* author: Michael Knoll
* author: Michael Emmerich
* version 2.0
*/
public abstract class A_CmsBackoffice extends CmsWorkplaceDefault implements I_CmsConstants{
private static int C_NOT_LOCKED = -1;
private static int C_NO_ACCESS = -2;
private static String C_DEFAULT_SELECTOR="(default)";
private static String C_DONE_SELECTOR="done";
private static String C_CHECKBOX_PREV="checkbox_";
/** The style for unchanged files or folders */
private final static String C_STYLE_UNCHANGED = "dateingeandert";
/** The style for files or folders not in project*/
private final static String C_STYLE_NOTINPROJECT = "dateintprojekt";
/** The style for new files or folders */
private final static String C_STYLE_NEW = "dateineu";
/** The style for deleted files or folders */
private final static String C_STYLE_DELETED = "dateigeloescht";
/** The style for changed files or folders */
private final static String C_STYLE_CHANGED = "dateigeaendert";
/** Default value of permission*/
protected final static int C_DEFAULT_PERMISSIONS=383;
// possible accessflags
protected final static String[] C_ACCESS_FLAGS = {"1","2","4","8","16","32","64","128","256"};
/**
* Gets the backoffice url of the module.
* @returns A string with the backoffice url
*/
abstract public String getBackofficeUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc,
Object userObject) throws Exception ;
/**
* Gets the create url of the module.
* @returns a string with the create url
*/
abstract public String getCreateUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc,
Object userObject) throws Exception ;
/**
* Gets the edit url of the module.
* @returns A string with the edit url
*/
abstract public String getEditUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc,
Object userObject) throws Exception ;
/**
* Gets the edit url of the module.
* @returns A string with the edit url
*/
public String getDeleteUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc,
Object userObject) throws Exception {
return getBackofficeUrl(cms, tagcontent,doc,userObject);
}
/**
* Gets the undelete url of the module.
* @returns A string with the undelete url
*/
public String getUndeleteUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc,
Object userObject) throws Exception {
return getBackofficeUrl(cms, tagcontent,doc,userObject);
}
/**
* Gets the publish url of the module.
* @returns A string with the publish url
*/
public String getPublishUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc,
Object userObject) throws Exception {
return getBackofficeUrl(cms, tagcontent,doc,userObject);
}
/**
* Gets the history url of the module.
* @returns A string with the history url
*/
public String getHistoryUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc,
Object userObject) throws Exception {
return getBackofficeUrl(cms, tagcontent,doc,userObject);
}
/**
* Gets the redirect url of the module. This URL is called, when an entry of the file list is selected
* @returns A string with the url.
*/
public String getUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject) throws Exception {
return "";
}
/**
* Gets the setup url of the module. This is the url of the setup page for this module.
* @returns A string with the setup url.
*/
public String getSetupUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject) throws Exception {
return "";
}
/**
* Gets the preview url of the module. This is the url of the preview page for this module.
* @returns A string with the setup url.
*/
public String getPreviewUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject) throws Exception {
return "";
}
/**
* Gets the content of a given template file.
* This method displays any content provided by a content definition
* class on the template. The used backoffice class does not need to use a
* special getContent method. It just has to extend the methods of this class!
* Using reflection, this method creates the table headline and table content
* with the layout provided by the template automatically!
* @param cms A_CmsObject Object for accessing system resources
* @param templateFile Filename of the template file
* @param elementName <em>not used here</em>.
* @param parameters <em>not used here</em>.
* @param templateSelector template section that should be processed.
* @return Processed content of the given template file.
* @exception CmsException
*/
public byte[] getContent(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector) throws CmsException {
//return var
byte[] returnProcess = null;
String error="";
// the CD to be used
A_CmsContentDefinition cd=null;
// session will be created or fetched
I_CmsSession session = (CmsSession) cms.getRequestContext().getSession(true);
//create new workplace templatefile object
CmsXmlWpTemplateFile template = new CmsXmlWpTemplateFile(cms, templateFile);
//get parameters
String selectBox = (String) parameters.get("selectbox");
String filterParam = (String) parameters.get("filterparameter");
String id = (String) parameters.get("id");
String idlock = (String) parameters.get("idlock");
String iddelete = (String) parameters.get("iddelete");
String idedit = (String) parameters.get("idedit");
String idview = (String) parameters.get("idview");
String action = (String) parameters.get("action");
String parentId = (String) parameters.get("parentId");
String ok = (String) parameters.get("ok");
String setaction = (String) parameters.get("setaction");
String idundelete = (String)parameters.get("idundelete");
String idpublish = (String)parameters.get("idpublish");
String idhistory = (String)parameters.get("idhistory");
String idpermissions = (String)parameters.get("idpermissions");
String idcopy = (String)parameters.get("idcopy");
// debug-code
/*
System.err.println("### "+this.getContentDefinitionClass().getName());
System.err.println("### PARAMETERS");
Enumeration enu=parameters.keys();
while (enu.hasMoreElements()) {
String a=(String)enu.nextElement();
String b=parameters.get(a).toString();
System.err.println("## "+a+" -> "+b);
}
System.err.println("");
System.err.println("+++ SESSION");
String[] ses=session.getValueNames();
for (int i=0;i<ses.length;i++) {
String a=ses[i];
String b=session.getValue(a).toString();
System.err.println("++ "+a+" -> "+b);
}
System.err.println("");
System.err.println("-------------------------------------------------");
*/
String hasFilterParam = (String) session.getValue("filterparameter");
template.setData("filternumber","0");
//change filter
if ((hasFilterParam == null) && (filterParam == null) && (setaction == null)) {
if (selectBox != null) {
session.putValue("filter", selectBox);
template.setData("filternumber",selectBox);
}
} else {
template.setData("filternumber", (String)session.getValue("filter"));
}
//move id values to id, remove old markers
if (idlock != null) {
id = idlock;
session.putValue("idlock", idlock);
session.removeValue("idedit");
session.removeValue("idnew");
session.removeValue("iddelete");
session.removeValue("idundelete");
session.removeValue("idpublish");
session.removeValue("idhistory");
session.removeValue("idpermissions");
session.removeValue("idcopy");
}
if (idedit != null) {
id = idedit;
session.putValue("idedit", idedit);
session.removeValue("idlock");
session.removeValue("idnew");
session.removeValue("iddelete");
session.removeValue("idundelete");
session.removeValue("idpublish");
session.removeValue("idhistory");
session.removeValue("idpermissions");
session.removeValue("idcopy");
}
if (iddelete != null) {
id = iddelete;
session.putValue("iddelete", iddelete);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -