📄 cmschannelbackoffice.java
字号:
/*
* File : $Source: /usr/local/cvs/opencms/src/com/opencms/defaults/master/CmsChannelBackoffice.java,v $
* Date : $Date: 2002/01/25 08:04:54 $
* Version: $Revision: 1.10 $
*
* 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.master;
import com.opencms.file.*;
import com.opencms.core.*;
import com.opencms.util.*;
import com.opencms.template.*;
import com.opencms.workplace.*;
import com.opencms.defaults.*;
import java.util.*;
import java.io.*;
import java.sql.*;
import java.text.*;
public class CmsChannelBackoffice extends A_CmsBackoffice{
/** 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"};
//CmsChannelContent
private CmsChannelContent cd = null;
//int/Integer id
private String idvalue = "0";
//int/Integer id
private String resid = "-1";
/** UNNKNOWN ID */
private static final int C_UNKNOWN_ID=-1;
public Class getContentDefinitionClass() {
return CmsChannelContent.class;
}
public String getCreateUrl(CmsObject cms, String tagcontent,
A_CmsXmlContent doc, Object userObject) throws Exception{
return "system/workplace/administration/channels/EditBackoffice.html";
}
public String getBackofficeUrl(CmsObject cms, String tagcontent,
A_CmsXmlContent doc, Object userObject) throws Exception {
return "system/workplace/administration/channels/Backoffice.html";
}
public String getEditUrl(CmsObject cms, String tagcontent,
A_CmsXmlContent doc, Object userObject) throws Exception {
return "system/workplace/administration/channels/EditBackoffice.html";
}
public String getPublishUrl(CmsObject cms, String tagcontent,
A_CmsXmlContent doc, Object userObject) throws Exception {
return "system/workplace/administration/channels/Backoffice.html";
}
// removed for testing
public String getSetupUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject) throws Exception {
return "";
}
/**
* Gets the content of a given template file.
* <P>
*
* @param cms A_CmsObject Object for accessing system resources
* @param templateFile Filename of the template file
* @param elementName not used here
* @param parameters get the parameters action for the button activity
* and id for the used content definition instance object
* and the author, title, text content for setting the new/changed data
* @param templateSelector template section that should be processed.
* @return Processed content of the given template file.
* @exception CmsException
*/
public byte[] getContentEdit(CmsObject cms, CmsXmlWpTemplateFile template, String elementName,
Hashtable parameters, String templateSelector) throws CmsException {
//get the Languagedata
CmsXmlLanguageFile lang = new CmsXmlLanguageFile(cms);
//create appropriate class name with underscores for labels
String moduleName = "";
moduleName = (String) getClass().toString(); //get name
moduleName = moduleName.substring(5); //remove 'class' substring at the beginning
moduleName = moduleName.trim();
moduleName = moduleName.replace('.', '_'); //replace dots with underscores
//session
I_CmsSession session = cms.getRequestContext().getSession(true);
//default error
String error="";
//get values of all fields
//gets the parameter action from the hashtable.
String action = (String) parameters.get("action");
if (action == null){
action="";
} else if (action.equals("exit")){
clearSession(session);
templateSelector= "done";
return startProcessing(cms, template, "", parameters, templateSelector);
}
// Get the parameter values
//get value of id
String id = (String) parameters.get("id");
String channelid = (String) parameters.get("channelId");
String resourceid = (String) parameters.get("resourceid");
//get value of parentId
String parentName = (String) parameters.get("parentName");
if(parentName == null || parentName.equals("")){
parentName="/";
}
//channelname
String channelname = (String) parameters.get("channelName");
if(channelname == null){
channelname = "";
}
//plausibility check
if(!action.equals("") && channelname.trim().equals("")){
error = lang.getLanguageValue(moduleName+".error.message2");
}
//title of channel
String title = (String) parameters.get("title");
String owner=(String) parameters.get("owner");
owner=(owner!=null?owner.trim():"");
String group=(String) parameters.get("groupId");
group=(group!=null?group.trim():"");
int accessFlags = this.getAccessValue(parameters);
//new channel
if (id == null || id.equals("")){
id = "new";
}
if(channelid==null || channelid.trim().equals("")){
channelid="-1";
}
if(resourceid==null || resourceid.trim().equals("")){
resourceid="-1";
}
if(id.equals("new")){
if(resourceid.equals("-1")){
cd=null;
}else{
id=resourceid;
}
}
// for the first call check if the id exist, i.e. if the category is to edit
// and it is not created new one then read the information of category
if (action.equals("") && !id.equals("new")) {
try {
Integer.parseInt(id);
} catch (Exception err) {
throw new CmsException(err.getMessage());
}
// gets the already existing ouputchannel's content definition.
cd = new CmsChannelContent(cms,new Integer(id));
parentName=cd.getParentName();
idvalue=cd.getChannelId();
resid=""+cd.getId();
channelname=cd.getChannelName();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -