예제 #1
0
    /**
     * @brief 展示插件
     * @param string $name 用户名
     * @param string $pwd  密码
     */
    public function show($name = '', $pwd = '')
    {
        $sessionName = ISafe::name();
        $sessionId = ISafe::id();
        $uploadUrl = IUrl::creatUrl($this->submit);
        $admin_name = $name == '' ? ISafe::get('admin_name') : $name;
        $admin_pwd = $pwd == '' ? ISafe::get('admin_pwd') : $pwd;
        echo <<<OEF
\t\t<script type="text/javascript">
\t\twindow.onload = function()
\t\t{
\t\t\tnew SWFUpload({
\t\t\t\t// Backend Settings
\t\t\t\tupload_url: "{$uploadUrl}",
\t\t\t\tpost_params: {"{$sessionName}": "{$sessionId}","admin_name":"{$admin_name}","admin_pwd":"{$admin_pwd}"},

\t\t\t\t// File Upload Settings
\t\t\t\tfile_types : "*.jpg;*.jpge;*.png;*.gif",

\t\t\t\t// Event Handler Settings - these functions as defined in Handlers.js
\t\t\t\t//  The handlers are not part of SWFUpload but are part of my website and control how
\t\t\t\t//  my website reacts to the SWFUpload events.
\t\t\t\tswfupload_preload_handler : preLoad,
\t\t\t\tswfupload_load_failed_handler : loadFailed,
\t\t\t\tfile_queue_error_handler : fileQueueError,
\t\t\t\tfile_dialog_complete_handler : fileDialogComplete,
\t\t\t\tupload_progress_handler : uploadProgress,
\t\t\t\tupload_error_handler : uploadError,
\t\t\t\tupload_success_handler : uploadSuccess,
\t\t\t\tupload_complete_handler : uploadComplete,

\t\t\t\t// Button Settings
\t\t\t\tbutton_placeholder_id : "uploadButton",
\t\t\t\tbutton_width: 50,
\t\t\t\tbutton_height: 21,
\t\t\t\tbutton_text : '选择...',
\t\t\t\tbutton_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
\t\t\t\tbutton_cursor: SWFUpload.CURSOR.HAND,

\t\t\t\t// Flash Settings
\t\t\t\tflash_url : "{$this->path}swfupload.swf",

\t\t\t\tcustom_settings : {
\t\t\t\t\tupload_target : "divFileProgressContainer"
\t\t\t\t},

\t\t\t\t// Debug Settings
\t\t\t\tdebug: false
\t\t\t});
\t\t};
\t\t</script>
OEF;
    }