📄 cmstaskcontentdetail.java
字号:
/*
* File : $Source: /usr/local/cvs/opencms/src/com/opencms/workplace/CmsTaskContentDetail.java,v $
* Date : $Date: 2003/02/15 11:14:53 $
* Version: $Revision: 1.29 $
*
* 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.workplace;
import com.opencms.boot.I_CmsLogChannels;
import com.opencms.core.A_OpenCms;
import com.opencms.core.CmsException;
import com.opencms.core.I_CmsConstants;
import com.opencms.core.I_CmsSession;
import com.opencms.file.CmsGroup;
import com.opencms.file.CmsObject;
import com.opencms.file.CmsRequestContext;
import com.opencms.file.CmsTask;
import com.opencms.file.CmsUser;
import com.opencms.util.Utils;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Hashtable;
/**
* Template class for displaying OpenCms workplace task content detail screens.
* <P>
*
* @author Andreas Schouten
* @author Mario Stanke
* @version $Revision: 1.29 $ $Date: 2003/02/15 11:14:53 $
* @see com.opencms.workplace.CmsXmlWpTemplateFile
*/
public class CmsTaskContentDetail extends CmsWorkplaceDefault implements I_CmsConstants,I_CmsWpConstants {
/**
* This private helper method generates a string-representation of a button.
* @param xmlTemplateDocument The xml-document in which the buttons are defined.
* @param name The name of the button to generate.
* @param enabled True, if the button is enabled, else false.
* @return the string-representation of the button.
* @throws Throws CmsException, if something goes wrong.
*/
private String getButton(CmsXmlWpTemplateFile xmlTemplateDocument, String name, boolean enabled) throws CmsException {
if(enabled) {
// the button is enabled
xmlTemplateDocument.setData("disabled", "");
}
else {
// the button is disabled
xmlTemplateDocument.setData("disabled", "disabled");
}
// return the generated button
return xmlTemplateDocument.getProcessedDataValue(name, this);
}
/**
* Gets the content of a defined section in a given template file and its subtemplates
* with the given parameters.
*
* @see #getContent(CmsObject, String, String, Hashtable, String)
* @param cms CmsObject Object for accessing system resources.
* @param templateFile Filename of the template file.
* @param elementName Element name of this template in our parent template.
* @param parameters Hashtable with all template class parameters.
* @param templateSelector template section that should be processed.
*/
public byte[] getContent(CmsObject cms, String templateFile, String elementName, Hashtable parameters,
String templateSelector) throws CmsException {
if(I_CmsLogChannels.C_PREPROCESSOR_IS_LOGGING && A_OpenCms.isLogging() && C_DEBUG) {
A_OpenCms.log(C_OPENCMS_DEBUG, this.getClassName() + "getting content of element "
+ ((elementName == null) ? "<root>" : elementName));
A_OpenCms.log(C_OPENCMS_DEBUG, this.getClassName() + "template file is: " + templateFile);
A_OpenCms.log(C_OPENCMS_DEBUG, this.getClassName() + "selected template section is: "
+ ((templateSelector == null) ? "<default>" : templateSelector));
}
CmsRequestContext context = cms.getRequestContext();
CmsXmlWpTemplateFile xmlTemplateDocument = (CmsXmlWpTemplateFile)getOwnTemplateFile(cms, templateFile,
elementName, parameters, templateSelector);
CmsTask task;
int taskid = -1;
I_CmsSession session = cms.getRequestContext().getSession(true);
// getting the URL to which we need to return when we're done
String lastUrl;
String lastRelUrl = (String)parameters.get("lastrelurl");
if(lastRelUrl != null) {
// have a URL relative to the workplace action path (when clicking on the task name)
lastUrl = getConfigFile(cms).getWorkplaceActionPath() + lastRelUrl;
session.putValue("lasturl", lastUrl);
}
else {
// have the complete path (when using the context menu)
lastUrl = this.getLastUrl(cms, parameters);
}
try {
Integer sessionTaskid = (Integer)session.getValue("taskid");
if(sessionTaskid != null) {
taskid = sessionTaskid.intValue();
}
try {
taskid = Integer.parseInt((String)parameters.get("taskid"));
}
catch(Exception exc) {
// no new taskid use the one from session
}
session.putValue("taskid", new Integer(taskid));
parameters.put("taskid", taskid + "");
task = cms.readTask(taskid);
if("acceptok".equals((String)parameters.get("action"))) {
// accept the task
CmsTaskAction.accept(cms, taskid);
}
else {
if("accept".equals((String)parameters.get("action"))) {
// show dialog
templateSelector = "accept";
}
else {
if("take".equals((String)parameters.get("action"))) {
// show dialog
templateSelector = "take";
}
else {
if("takeok".equals((String)parameters.get("action"))) {
// take the task
CmsTaskAction.take(cms, taskid);
}
else {
if("forwardok".equals((String)parameters.get("action"))) {
// forward the task
CmsTaskAction.forward(cms, taskid, (String)parameters.get("USER"), (String)parameters.get("TEAM"));
}
else {
if("due".equals((String)parameters.get("action"))) {
// show dialog
templateSelector = "due";
}
else {
if("dueok".equals((String)parameters.get("action"))) {
// change the due-date of the task
CmsTaskAction.due(cms, taskid, (String)parameters.get("DATE"));
}
else {
if("priorityok".equals((String)parameters.get("action"))) {
// change the priority of the task
CmsTaskAction.priority(cms, taskid, (String)parameters.get("PRIORITY"));
}
else {
if("reaktok".equals((String)parameters.get("action"))) {
// reaktivate the task
CmsTaskAction.reakt(cms, taskid, (String)parameters.get("USER"),
(String)parameters.get("TEAM"), (String)parameters.get("TASK"),
(String)parameters.get("DESCRIPTION"), (String)parameters.get("DATE"),
(String)parameters.get("PRIORITY"), (String)parameters.get("MSG_ACCEPTATION"),
(String)parameters.get("MSG_ALL"), (String)parameters.get("MSG_COMPLETION"),
(String)parameters.get("MSG_DELIVERY"));
}
else {
if("okok".equals((String)parameters.get("action"))) {
// ok the task
CmsTaskAction.end(cms, taskid);
}
else {
if("ok".equals((String)parameters.get("action"))) {
// show dialog
templateSelector = "ok";
}
else {
if("comment".equals((String)parameters.get("action"))) {
// add comment
String comment = (String)parameters.get("DESCRIPTION");
if((comment != null) && (comment.length() != 0)) {
cms.writeTaskLog(taskid, comment, C_TASKLOGTYPE_COMMENT);
}
}
else {
if("messageok".equals((String)parameters.get("action"))) {
// add message
CmsTaskAction.message(cms, taskid, (String)parameters.get("DESCRIPTION"));
}
else {
if("queryok".equals((String)parameters.get("action"))) {
// add message
CmsTaskAction.query(cms, taskid, (String)parameters.get("DESCRIPTION"));
}
}
}
}
}
}
}
}
}
}
}
}
}
}
// update the task-data
// it maybe had been changed
task = cms.readTask(taskid);
}
catch(Exception exc) {
throw new CmsException(CmsException.C_UNKNOWN_EXCEPTION, exc);
}
CmsUser owner = null;
try {
owner = cms.readOwner(task);
}
catch(Exception exc) {
// ignore the exception
}
CmsUser editor = null;
try {
editor = cms.readAgent(task);
}
catch(Exception exc) {
// ignore the exception
}
CmsGroup role = null;
String roleName = "";
try {
role = cms.readGroup(task);
roleName = role.getName();
}
catch(Exception exc) {
// ignore the exception
}
String priority;
String projectname = "?";
String style;
String button1;
String button2;
String button3;
String button4;
String button5;
String button6;
long startTime;
long timeout;
GregorianCalendar cal = new GregorianCalendar();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -