📄 a_cmsbackoffice.java
字号:
session.removeValue("idedit");
session.removeValue("idnew");
session.removeValue("idlock");
session.removeValue("idundelete");
session.removeValue("idpublish");
session.removeValue("idhistory");
session.removeValue("idpermissions");
session.removeValue("idcopy");
}
if (idundelete != null) {
id = idundelete;
session.putValue("idundelete", idundelete);
session.removeValue("idedit");
session.removeValue("idnew");
session.removeValue("idlock");
session.removeValue("iddelete");
session.removeValue("idpublish");
session.removeValue("idhistory");
session.removeValue("idpermissions");
session.removeValue("idcopy");
}
if (idpublish != null) {
id = idpublish;
session.putValue("idpublish", idpublish);
session.removeValue("idedit");
session.removeValue("idnew");
session.removeValue("idlock");
session.removeValue("iddelete");
session.removeValue("idundelete");
session.removeValue("idhistory");
session.removeValue("idpermissions");
session.removeValue("idcopy");
}
if (idhistory != null) {
id = idhistory;
session.putValue("idhistory", idhistory);
session.removeValue("idedit");
session.removeValue("idnew");
session.removeValue("idlock");
session.removeValue("iddelete");
session.removeValue("idundelete");
session.removeValue("idpublish");
session.removeValue("idpermissions");
session.removeValue("idcopy");
}
if (idpermissions != null) {
id = idpermissions;
session.putValue("idpermissions", idpermissions);
session.removeValue("idedit");
session.removeValue("idnew");
session.removeValue("idlock");
session.removeValue("iddelete");
session.removeValue("idundelete");
session.removeValue("idpublish");
session.removeValue("idhistory");
session.removeValue("idcopy");
}
if (idcopy != null) {
id = idcopy;
session.putValue("idcopy", idcopy);
session.removeValue("idedit");
session.removeValue("idnew");
session.removeValue("idlock");
session.removeValue("iddelete");
session.removeValue("idundelete");
session.removeValue("idpublish");
session.removeValue("idhistory");
session.removeValue("idpermissions");
}
if ((id != null) && (id.equals("new"))) {
session.putValue("idnew", id);
session.removeValue("idedit");
session.removeValue("iddelete");
session.removeValue("idlock");
session.removeValue("idundelete");
session.removeValue("idpublish");
session.removeValue("idhistory");
session.removeValue("idpermissions");
session.removeValue("idcopy");
}
//get marker id from session
String idsave = (String) session.getValue("idsave");
if (ok == null) {
idsave = null;
}
if(parentId != null) {
session.putValue("parentId", parentId);
}
//get marker for accessing the new dialog
String idnewsave = (String) session.getValue("idnew");
// --- This is the part when getContentNew is called ---
//access to new dialog
if ((id != null) && (id.equals("new")) || ((idsave != null) && (idsave.equals("new")))) {
if (idsave != null) {
parameters.put("id", idsave);
}
if (id != null) {
parameters.put("id", id);
session.putValue("idsave", id);
}
return getContentNewInternal(cms,id,cd,session,template,elementName,parameters,templateSelector);
// --- This was the part when getContentNew is called ---
}
//go to the appropriate getContent methods
if ((id == null) && (idsave == null) && (action == null) && (idlock==null) && (iddelete == null) && (idedit == null)
&& (idundelete == null) && (idpublish == null) && (idhistory == null) && (idpermissions == null) && (idcopy == null)) {
//process the head frame containing the filter
returnProcess = getContentHead(cms, template, elementName, parameters, templateSelector);
//finally return processed data
return returnProcess;
} else {
//process the body frame containing the table
if(action == null) {
action = "";
}
if (action.equalsIgnoreCase("list")){
//process the list output
// clear "idsave" here in case user verification of data failed and input has to be shown again ...
session.removeValue("idsave");
if(isExtendedList()){
returnProcess = getContentExtendedList(cms, template, elementName, parameters, templateSelector);
} else {
returnProcess = getContentList(cms, template, elementName, parameters, templateSelector);
}
//finally return processed data
return returnProcess;
} else {
// --- This is the part where getContentEdit is called ---
//get marker for accessing the edit dialog
String ideditsave = (String) session.getValue("idedit");
//go to the edit dialog
if ((idedit != null) || (ideditsave != null)) {
if (idsave != null) {
parameters.put("id", idsave);
}
if (id != null) {
parameters.put("id", id);
session.putValue("idsave", id);
}
return getContentEditInternal(cms,id,cd,session,template,elementName,parameters,templateSelector);
// --- This was the part where getContentEdit is called ---
} else {
//store id parameters for delete and lock
if (idsave != null) {
parameters.put("id", idsave);
session.removeValue("idsave");
} else {
parameters.put("id", id);
session.putValue("idsave", id);
}
//check if the cd should be undeleted
if(idundelete != null){
returnProcess = getContentUndelete(cms, template, elementName, parameters, templateSelector);
return returnProcess;
}
//get marker for accessing the publish dialog
//check if the cd should be published
String idpublishsave = (String) session.getValue("idpublish");
if(idpublish != null || idpublishsave != null){
returnProcess = getContentDirectPublish(cms, template, elementName, parameters, templateSelector);
return returnProcess;
}
//get marker for accessing the history dialog
//check if the history of cd should be dispayed
String idhistorysave = (String) session.getValue("idhistory");
if(idhistory != null || idhistorysave != null){
returnProcess = getContentHistory(cms, template, elementName, parameters, templateSelector);
return returnProcess;
}
//get marker for accessing the change permissions dialog
//check if the permissions of cd should be dispayed
String idpermissionssave = (String) session.getValue("idpermissions");
if(idpermissions != null || idpermissionssave != null){
returnProcess = getContentPermissions(cms, template, elementName, parameters, templateSelector);
return returnProcess;
}
//get marker for accessing the copy dialog
//check if the permissions of cd should be dispayed
String idcopysave = (String) session.getValue("idcopy");
if(idcopy != null || idcopysave != null){
returnProcess = getContentCopy(cms, template, elementName, parameters, templateSelector);
return returnProcess;
}
//get marker for accessing the delete dialog
String iddeletesave = (String) session.getValue("iddelete");
//access delete dialog
if (((iddelete != null) || (iddeletesave != null)) && (idlock == null)) {
returnProcess = getContentDelete(cms, template, elementName, parameters, templateSelector);
return returnProcess;
}else {
//access lock dialog
returnProcess = getContentLock(cms, template, elementName, parameters, templateSelector);
//finally return processed data
return returnProcess;
}
}
}
}
}
/**
* Gets the content definition class
* @returns class content definition class
* Must be implemented in the extending backoffice class!
*/
public abstract Class getContentDefinitionClass() ;
/**
* Gets the content definition class method constructor
* @returns content definition object
*/
protected Object getContentDefinition(CmsObject cms, Class cdClass, Integer id) {
Object o = null;
try {
Constructor c = cdClass.getConstructor(new Class[] {CmsObject.class, Integer.class});
o = c.newInstance(new Object[] {cms, id});
} catch (InvocationTargetException ite) {
if (I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, getClassName() + ": Backoffice contentDefinitionConstructor: Invocation target exception!");
}
} catch (NoSuchMethodException nsm) {
if (I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, getClassName() + ": Backoffice contentDefinitionConstructor: Requested method was not found!");
}
} catch (InstantiationException ie) {
if (I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, getClassName() + ": Backoffice contentDefinitionConstructor: the reflected class is abstract!");
}
} catch (Exception e) {
if (I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, getClassName() + ": Backoffice contentDefinitionConstructor: Other exception! "+e);
}
if(I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, e.getMessage() );
}
}
return o;
}
/**
* Gets the content definition class method constructor
* @returns content definition object
*/
protected Object getContentDefinition(CmsObject cms, Class cdClass) {
Object o = null;
try {
Constructor c = cdClass.getConstructor(new Class[] {CmsObject.class});
o = c.newInstance(new Object[] {cms});
} catch (InvocationTargetException ite) {
if (I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, getClassName() + ": Backoffice contentDefinitionConstructor: Invocation target exception!");
}
} catch (NoSuchMethodException nsm) {
if (I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, getClassName() + ": Backoffice contentDefinitionConstructor: Requested method was not found!");
}
} catch (InstantiationException ie) {
if (I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, getClassName() + ": Backoffice contentDefinitionConstructor: the reflected class is abstract!");
}
} catch (Exception e) {
if (I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, getClassName() + ": Backoffice contentDefinitionConstructor: Other exception! "+e);
}
if(I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() ) {
A_OpenCms.log(C_OPENCMS_INFO, e.getMessage() );
}
}
return o;
}
/**
* Gets the content definition class method constructor
* @returns content definition object
*/
protected Object getContentDefinition(CmsObject cms, Class cdClass, String id) {
Object o = null;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -