亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fileuploadapplet.java

?? cms是開源的框架
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * File   : $Source: /usr/local/cvs/opencms/src-components/org/opencms/applet/upload/FileUploadApplet.java,v $
 * Date   : $Date: 2006/03/27 14:52:27 $
 * Version: $Revision: 1.19 $
 *
 * This library is part of OpenCms -
 * the Open Source Content Mananagement System
 *
 * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
 *
 * 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 Alkacon Software GmbH, please see the
 * company website: http://www.alkacon.com
 *
 * For further information about OpenCms, please see the
 * project 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 org.opencms.applet.upload;

import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import javax.swing.JApplet;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

import org.apache.commons.httpclient.Cookie;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.MultipartPostMethod;

/**
 * File Upload Applet, displays a file selector box to upload multiple resources into OpenCms.<p>
 * 
 * @author Michael Emmerich 
 * 
 * @version $Revision: 1.19 $ 
 * 
 * @since 6.0.0 
 */
public class FileUploadApplet extends JApplet implements Runnable {

    /** Serial version UID required for safe serialization. */
    private static final long serialVersionUID = -3710093915699772778L;

    /** Applet thread. */
    Thread m_runner;

    /** The URL of the OpenCms instance. */
    private String m_opencms = "";

    /** The URL to send the uploaded files to. */
    private String m_targetUrl = "";

    /** The URL to return to after uploading the files. */
    private String m_redirectUrl = "";
    
    /** The Target Frame to return to after uploading the files. */
    private String m_redirectTargetFrame = "";

    /** The URL to return to after an error. */
    private String m_errorUrl = "";

    /** The name of the folder to upload to. */
    private String m_uploadFolder = "";

    /** Maximum file upload size. */
    private long m_maxsize = -1;

    /** Number of resources to upload. */
    private int m_resources;

    /** File extensions, used to find the correct icons for the selectbox. */
    private String m_fileExtensions = "";

    /** Color defintions. */
    private HashMap m_colors = new HashMap();

    /** Output string for action messages. */
    private String m_action = "";

    /** Output string for loggin messages. */
    private String m_message = "";

    /** Output mode selector. */
    private int m_outputMode;

    /** Counter for creating the progress bar. */
    private int m_step;

    /** Definition of the images during upload. */
    private Image m_source;
    private Image m_target;
    private Image m_floater;

    /** Image position for the floater during upload. */
    private int m_floaterPos = 50;

    /** Defintion of output strings.*/
    private String m_actionOutputSelect = "Seleting files for upload....";
    private String m_actionOutputCount = "Counting resources ....";
    private String m_actionOutputCreate = "Creating Zip-File...";
    private String m_actionOutputUpload = "Upload Zip-File";
    private String m_actionOutputError = "Error";
    private String m_messageNoPreview = "no preview available";
    private String m_errorLine1 = "An error has occurred on the server:";
    private String m_messageOutputUpload = "Please wait, uploading data...";
    private String m_messageOutputAdding = "Adding ";
    private String m_messageOutputErrorSize = "Zip file too big:";
    private String m_messageOutputErrorZip = "Error creating Zip-File, see Java Console.";

    /** Definition variables for graphics output. */
    private Font m_font;
    private FontMetrics m_metrics;
    private Image m_offscreen;
    private Graphics m_offgraphics;

    /** The file selector. */
    private JFileChooser m_fileSelector;

    /**
     * @see java.applet.Applet#init()
     */
    public void init() {

        m_opencms = getParameter("opencms");
        m_targetUrl = getParameter("target");
        m_redirectUrl = getParameter("redirect");
        m_redirectTargetFrame = getParameter("targetframe");
        if (m_redirectTargetFrame == null || m_redirectTargetFrame.equals("")) {
            m_redirectTargetFrame = "explorer_files";
        }
        m_errorUrl = getParameter("error");
        m_uploadFolder = getParameter("filelist");
        String tmpSize = getParameter("maxsize");
        if (tmpSize != null && tmpSize.length() > 0) {
            m_maxsize = Long.parseLong(tmpSize);
        }
        m_fileExtensions = getParameter("fileExtensions");
        m_colors = extractColors(getParameter("colors"));

        // setup the applet output
        m_font = new java.awt.Font(null, Font.BOLD, 12);
        m_metrics = getFontMetrics(m_font);
        m_source = getImage(getCodeBase(), "org/opencms/applet/upload/applet_source.png");
        m_target = getImage(getCodeBase(), "org/opencms/applet/upload/applet_target.png");
        m_floater = getImage(getCodeBase(), "org/opencms/applet/upload/floater.gif");

        // get the output massages in the correct language
        if (getParameter("actionOutputSelect") != null) {
            m_actionOutputSelect = getParameter("actionOutputSelect");
        }
        if (getParameter("actionOutputCount") != null) {
            m_actionOutputCount = getParameter("actionOutputCount");
        }
        if (getParameter("actionOutputCreate") != null) {
            m_actionOutputCreate = getParameter("actionOutputCreate");
        }
        if (getParameter("actionOutputUpload") != null) {
            m_actionOutputUpload = getParameter("actionOutputUpload");
        }
        if (getParameter("actionOutputError") != null) {
            m_actionOutputError = getParameter("actionOutputError");
        }
        if (getParameter("messageOutputUpload") != null) {
            m_messageOutputUpload = getParameter("messageOutputUpload");
        }
        if (getParameter("messageOutputAdding") != null) {
            m_messageOutputAdding = getParameter("messageOutputAdding");
        }
        if (getParameter("messageOutputErrorZip") != null) {
            m_messageOutputErrorZip = getParameter("messageOutputErrorZip");
        }
        if (getParameter("messageOutputErrorSize") != null) {
            m_messageOutputErrorSize = getParameter("messageOutputErrorSize");
        }
        if (getParameter("messageNoPreview") != null) {
            m_messageNoPreview = getParameter("messageNoPreview");
        }
        if (getParameter("errorLine1") != null) {
            m_errorLine1 = getParameter("errorLine1");
        }
    }

    /**
     * @see java.applet.Applet#destroy()
     */
    public void destroy() {

        // NOOP
    }

    /**
     * @see java.applet.Applet#start()
     */
    public void start() {

        m_runner = new Thread(this);
        m_runner.start();
    }

    /**
     * @see java.applet.Applet#stop()
     */
    public void stop() {

        m_runner = null;
    }

    /**
     * @see java.lang.Runnable#run()
     */
    public void run() {

        try {
            boolean ok = true;
            while (ok) {
                ok = true;
                
                //System.out.println("Version 1.62");
                                
                m_message = "";
                m_resources = 0;
                m_step = 0;
                // create a new file chooser

                if (m_fileSelector == null) {
                    m_fileSelector = new JFileChooser();
                }

                // file selector can read files and folders
                m_fileSelector.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

                m_fileSelector.setDialogTitle(m_actionOutputSelect);

                // add two custom file filters (office and images) and the default filters
                m_fileSelector.addChoosableFileFilter(new ImageFilter());
                m_fileSelector.addChoosableFileFilter(new OfficeFilter());
                m_fileSelector.setAcceptAllFileFilterUsed(true);
                // enable multi-selection of files
                m_fileSelector.setMultiSelectionEnabled(true);
                // add custom icons for file types.
                m_fileSelector.setFileView(new ImageFileView(m_opencms, m_fileExtensions));
                // add the image preview pane.
                m_fileSelector.setAccessory(new ImagePreview(m_fileSelector, m_messageNoPreview));

                m_action = m_actionOutputSelect;
                repaint();

                // show the file selector dialog
                int returnVal = m_fileSelector.showDialog(this, "OK");

                // process the results.
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    // count all resources
                    m_outputMode = 1;
                    m_action = m_actionOutputCount;
                    repaint();
                    m_resources = countResources(m_fileSelector.getSelectedFiles());
                    // create the zipfile  
                    m_outputMode = 2;
                    File targetFile = createZipFile(m_fileSelector.getSelectedFiles());
                    // check the size of the zip files
                    if (targetFile == null || m_maxsize > 0 && targetFile.length() > m_maxsize) {
                        // show some details in the applet itself
                        m_outputMode = 4;
                        if (targetFile == null) {
                            m_message = m_messageOutputErrorZip;
                        } else {
                            m_message = m_messageOutputErrorSize + " " + targetFile.length() + " > " + m_maxsize;
                        }
                        m_action = m_actionOutputError;
                        repaint();
                        // show an error-alertbog
                        JOptionPane.showMessageDialog(this, m_message, m_action, JOptionPane.ERROR_MESSAGE);
                    } else {
                        m_outputMode = 3;
                        m_message = m_messageOutputUpload + " (" + targetFile.length() / 1024 + " kb)";
                        repaint();
                        // upload the zipfile
                        FileUploadThread uploadThreat = new FileUploadThread();

                        uploadThreat.init(this);
                        uploadThreat.start();

                        uploadZipFile(targetFile);
                        ok = false;
                    }

                } else {
                    //the cancel button was used, so go back to the workplace
                    ok = false;
                    getAppletContext().showDocument(new URL(m_redirectUrl), m_redirectTargetFrame);
                }
            }
        } catch (Exception e) {
            System.err.println(e);
        }
    }

    /**
     * Counts all resources to add to the zip file.<p>
     * 
     * @param files the files to be packed into the zipfile
     * @return number of resources
     */
    private int countResources(File[] files) {

        int count = 0;
        // look through all selected resources
        for (int i = 0; i < files.length; i++) {
            if (files[i].isFile()) {
                // its a file, count it
                count++;
            } else {
                // its a folder, count all resources in it and add the number
                count += countSubresources(files[i]);
            }
        }
        return count;
    }

    /**
     * Counts all resources in a folder.<p>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人精品视频.| 久久久噜噜噜久久人人看| 日韩精品中文字幕一区二区三区| 国产精品看片你懂得 | 欧美喷水一区二区| 国产精品天干天干在线综合| 美女一区二区视频| 在线国产亚洲欧美| 国产精品乱码妇女bbbb| 国产一区二区三区在线看麻豆| 欧美日韩精品专区| 亚洲免费视频中文字幕| 成人午夜伦理影院| 精品国产精品网麻豆系列| 午夜影视日本亚洲欧洲精品| 91麻豆精品视频| 国产欧美1区2区3区| 国内一区二区在线| 欧美成人官网二区| 天天色图综合网| 欧美美女网站色| 亚洲高清免费在线| 在线欧美小视频| 亚洲欧美日韩综合aⅴ视频| 国产91丝袜在线观看| 久久综合狠狠综合久久综合88| 日本aⅴ免费视频一区二区三区| 欧美影视一区二区三区| 亚洲已满18点击进入久久| aaa欧美日韩| 亚洲色欲色欲www在线观看| 成人av在线播放网站| 久久综合九色综合欧美98| 激情五月婷婷综合网| 2020日本不卡一区二区视频| 国产精品综合久久| 欧美国产欧美亚州国产日韩mv天天看完整 | 石原莉奈在线亚洲二区| 777亚洲妇女| 日韩中文字幕亚洲一区二区va在线 | 精品少妇一区二区三区在线播放| 免费观看成人av| 欧美精品一区在线观看| 国产精品系列在线播放| 日本一区二区综合亚洲| 国产成人av一区二区三区在线| 欧美国产精品中文字幕| 91亚洲精品久久久蜜桃网站| 一区二区三区色| 欧美电影在线免费观看| 国产一区二区电影| 国产精品久久午夜夜伦鲁鲁| 91麻豆高清视频| 三级久久三级久久久| 亚洲精品一区二区三区在线观看| 成人黄色一级视频| 亚洲一区二区三区自拍| 欧美妇女性影城| 国产乱码精品一品二品| 亚洲精品国产一区二区精华液| 欧美高清一级片在线| 国产精品18久久久久久vr| 亚洲乱码国产乱码精品精可以看 | 久久精品久久99精品久久| 久久久亚洲午夜电影| 91麻豆精品一区二区三区| 日韩成人伦理电影在线观看| 亚洲国产精品激情在线观看| 欧美日韩国产电影| 丁香婷婷深情五月亚洲| 亚洲第一会所有码转帖| 国产丝袜在线精品| 欧美日韩国产精品成人| av在线播放一区二区三区| 日韩激情视频网站| 亚洲欧美另类久久久精品2019| 制服.丝袜.亚洲.中文.综合| 成熟亚洲日本毛茸茸凸凹| 日韩精品成人一区二区在线| 中文字幕一区二区三区色视频 | 欧美在线观看一区| 国产剧情一区在线| 日本不卡在线视频| 一区二区三区资源| 中文字幕av一区二区三区| 欧美一区二区三区四区久久 | 日韩亚洲欧美在线观看| 99久久精品免费| 国产在线不卡视频| 日韩中文字幕91| 亚洲伊人色欲综合网| 欧美国产一区二区在线观看| 精品国产在天天线2019| 欧美日产国产精品| 欧洲一区在线观看| 色香蕉成人二区免费| 国产乱码精品一区二区三| 麻豆一区二区99久久久久| 午夜欧美视频在线观看| 亚洲一区视频在线| 亚洲欧美一区二区久久| 国产精品久久久久精k8| 国产欧美一区二区三区在线老狼 | 亚洲少妇30p| 国产精品麻豆网站| 中文字幕精品在线不卡| 欧美精品一区二区三区很污很色的| 欧美三级日本三级少妇99| 色婷婷综合久久久久中文一区二区| 懂色av中文字幕一区二区三区| 国产一区二区网址| 国产精品99久久久| 福利电影一区二区三区| 国精产品一区一区三区mba桃花| 久久国产日韩欧美精品| 久草这里只有精品视频| 国产一区视频在线看| 国内精品视频一区二区三区八戒| 国产乱码精品一区二区三区五月婷| 精品亚洲国产成人av制服丝袜| 久久精品国产一区二区| 国精产品一区一区三区mba桃花| 国产老肥熟一区二区三区| 国产91丝袜在线播放0| 972aa.com艺术欧美| 欧美亚洲综合久久| 911精品国产一区二区在线| 欧美一区二区女人| 精品国产乱码久久久久久免费| 久久午夜色播影院免费高清 | 337p日本欧洲亚洲大胆色噜噜| 欧美成人免费网站| 国产偷国产偷精品高清尤物 | 国产女人水真多18毛片18精品视频| 国产性做久久久久久| 最好看的中文字幕久久| 亚洲午夜激情av| 极品美女销魂一区二区三区| 处破女av一区二区| 欧美私人免费视频| 久久视频一区二区| ㊣最新国产の精品bt伙计久久| 亚洲h动漫在线| 国产精品99精品久久免费| 色狠狠一区二区三区香蕉| 制服.丝袜.亚洲.另类.中文| 欧美极品aⅴ影院| 一区二区三区四区视频精品免费| 婷婷激情综合网| 成年人午夜久久久| 4hu四虎永久在线影院成人| 久久久国产精品麻豆| 亚洲伊人伊色伊影伊综合网| 国产在线麻豆精品观看| 色综合久久66| 久久青草欧美一区二区三区| 一区二区三区四区不卡在线 | 欧美日韩二区三区| 久久综合精品国产一区二区三区 | 国产成a人亚洲| 欧美久久久久免费| 自拍偷拍亚洲综合| 狠狠色丁香婷婷综合久久片| 在线观看视频一区二区| 久久综合一区二区| 日韩在线播放一区二区| 91欧美一区二区| 久久精品夜色噜噜亚洲aⅴ| 日韩专区欧美专区| 91成人免费在线视频| 国产情人综合久久777777| 免播放器亚洲一区| 欧美视频一区二区在线观看| 中文字幕成人在线观看| 精品一区中文字幕| 欧美一区二区三区免费在线看 | 欧美日韩国产精选| 亚洲女爱视频在线| 成人蜜臀av电影| 久久久蜜臀国产一区二区| 久久国产婷婷国产香蕉| 欧美一二区视频| 亚洲成a人片在线观看中文| 91蜜桃网址入口| 亚洲欧洲精品天堂一级| 成人黄色软件下载| 国产女主播一区| 成人性生交大片免费看视频在线| 亚洲精品在线一区二区| 蜜桃久久精品一区二区| 欧美一级二级三级蜜桃| 视频在线观看国产精品| 欧美精品久久99久久在免费线| 亚洲一区二区三区四区中文字幕| 日本精品一级二级| 一区二区三区免费| 欧美视频一区二| 亚洲超碰97人人做人人爱| 制服丝袜av成人在线看| 全国精品久久少妇|