⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmstaskcontentdetail.java

📁 cms是开源的框架
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * File   : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/workplace/CmsTaskContentDetail.java,v $
 * Date   : $Date: 2005/08/31 07:29:39 $
 * Version: $Revision: 1.7 $
 *
 * 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 org.opencms.file.CmsGroup;
import org.opencms.file.CmsObject;
import org.opencms.file.CmsRequestContext;
import org.opencms.file.CmsUser;
import org.opencms.main.CmsException;
import org.opencms.main.CmsLog;
import org.opencms.util.CmsDateUtil;
import org.opencms.workflow.CmsTask;
import org.opencms.workflow.CmsTaskService;

import com.opencms.core.I_CmsSession;
import com.opencms.legacy.CmsLegacyException;
import com.opencms.legacy.CmsXmlTemplateLoader;

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.7 $ $Date: 2005/08/31 07:29:39 $
 * @see com.opencms.workplace.CmsXmlWpTemplateFile
 * 
 * @deprecated Will not be supported past the OpenCms 6 release.
 */

public class CmsTaskContentDetail extends CmsWorkplaceDefault {

    /**
     * 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 (CmsLog.getLog(this).isDebugEnabled() && C_DEBUG) {
            CmsLog.getLog(this).debug("Getting content of element " + ((elementName == null) ? "<root>" : elementName));
            CmsLog.getLog(this).debug("Template file is: " + templateFile);
            CmsLog.getLog(this).debug(
                "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 = CmsXmlTemplateLoader.getSession(cms.getRequestContext(), true);

        CmsTaskService taskService = cms.getTaskService();
        // 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 = taskService.readTask(taskid);
            if ("acceptok".equals(parameters.get("action"))) {

                // accept the task
                CmsTaskAction.accept(cms, taskid);
            } else {
                if ("accept".equals(parameters.get("action"))) {

                    // show dialog
                    templateSelector = "accept";
                } else {
                    if ("take".equals(parameters.get("action"))) {

                        // show dialog
                        templateSelector = "take";
                    } else {
                        if ("takeok".equals(parameters.get("action"))) {

                            // take the task
                            CmsTaskAction.take(cms, taskid);
                        } else {
                            if ("forwardok".equals(parameters.get("action"))) {

                                // forward the task 
                                CmsTaskAction.forward(
                                    cms,
                                    taskid,
                                    (String)parameters.get("USER"),
                                    (String)parameters.get("TEAM"));
                            } else {
                                if ("due".equals(parameters.get("action"))) {

                                    // show dialog
                                    templateSelector = "due";
                                } else {
                                    if ("dueok".equals(parameters.get("action"))) {

                                        // change the due-date of the task
                                        CmsTaskAction.due(cms, taskid, (String)parameters.get("DATE"));
                                    } else {
                                        if ("priorityok".equals(parameters.get("action"))) {

                                            // change the priority of the task
                                            CmsTaskAction.priority(cms, taskid, (String)parameters.get("PRIORITY"));
                                        } else {
                                            if ("reaktok".equals(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(parameters.get("action"))) {

                                                    // ok the task
                                                    CmsTaskAction.end(cms, taskid);
                                                } else {
                                                    if ("ok".equals(parameters.get("action"))) {

                                                        // show dialog
                                                        templateSelector = "ok";
                                                    } else {
                                                        if ("comment".equals(parameters.get("action"))) {

                                                            // add comment
                                                            // String comment = (String)parameters.get("DESCRIPTION");
                                                            // if((comment != null) && (comment.length() != 0)) {
                                                            //     taskService.writeTaskLog(taskid, comment, CmsWorkplaceDefault.C_TASKLOGTYPE_COMMENT);
                                                            // }
                                                            // add message
                                                            CmsTaskAction.comment(
                                                                cms,
                                                                taskid,
                                                                (String)parameters.get("DESCRIPTION"));

                                                        } else {
                                                            if ("messageok".equals(parameters.get("action"))) {

                                                                // add message
                                                                CmsTaskAction.message(
                                                                    cms,
                                                                    taskid,
                                                                    (String)parameters.get("DESCRIPTION"));
                                                            } else {
                                                                if ("queryok".equals(parameters.get("action"))) {

                                                                    // add message
                                                                    CmsTaskAction.query(
                                                                        cms,
                                                                        taskid,
                                                                        (String)parameters.get("DESCRIPTION"));
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            // update the task-data            
            // it maybe had been changed
            task = taskService.readTask(taskid);
        } catch (Exception exc) {
            throw new CmsLegacyException(CmsLegacyException.C_UNKNOWN_EXCEPTION, exc);
        }
        CmsUser owner = null;
        try {
            owner = taskService.readOwner(task);
        } catch (Exception exc) {

            // ignore the exception
        }
        CmsUser editor = null;
        try {
            editor = taskService.readAgent(task);
        } catch (Exception exc) {

            // ignore the exception
        }
        CmsGroup role = null;
        String roleName = "";
        try {
            role = taskService.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();
        cal.setTime(new Date(System.currentTimeMillis()));
        cal.set(Calendar.HOUR, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        GregorianCalendar newcal = new GregorianCalendar(
            cal.get(Calendar.YEAR),
            cal.get(Calendar.MONTH),
            cal.get(Calendar.DAY_OF_MONTH),
            0,
            0,
            0);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -