OSDN Git Service

NP_DragAndDropUploader v1.1
authorhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 6 Jun 2010 11:32:50 +0000 (11:32 +0000)
committerhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 6 Jun 2010 11:32:50 +0000 (11:32 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@1061 1ca29b6e-896d-4ea0-84a5-967f57386b96

37 files changed:
trunk/NP_DragAndDropUploader/NP_DragAndDropUploader.php [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/css/plupload.queue.css [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/help.html [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/img/backgrounds.gif [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/img/buttons-disabled.png [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/img/buttons.png [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/img/delete.gif [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/img/done.gif [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/img/error.gif [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/img/throbber.gif [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/img/transp50.png [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/index.php [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/gears_init.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/jquery.plupload.queue.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/jquery.plupload.single.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.browserplus.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.flash.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.flash.swf [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.full.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.gears.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.html4.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.html5.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.silverlight.min.js [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.silverlight.xap [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/language/english.php [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/language/japanese-euc.php [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/language/japanese-utf8.php [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/mkeuc.sh [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/extrahead_japanese-euc.html [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/extrahead_japanese-utf8.html [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/index_japanese-euc.html [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/index_japanese-utf8.html [new file with mode: 0644]
trunk/NP_DragAndDropUploader/draganddropuploader/upload.php [new file with mode: 0644]
trunk/NP_DragAndDropUploader/sharedlibs/cles/Feedback.php [new file with mode: 0644]
trunk/NP_DragAndDropUploader/sharedlibs/cles/Template.php [new file with mode: 0644]
trunk/NP_DragAndDropUploader/sharedlibs/sharedlibs.php [new file with mode: 0644]

diff --git a/trunk/NP_DragAndDropUploader/NP_DragAndDropUploader.php b/trunk/NP_DragAndDropUploader/NP_DragAndDropUploader.php
new file mode 100644 (file)
index 0000000..21a353d
--- /dev/null
@@ -0,0 +1,245 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * NP_DragAndDropUploader ($Revision: 1.11 $)\r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * \r
+  * Based on upload.php (http://www.plupload.com)\r
+  * \r
+  * $Id: NP_DragAndDropUploader.php,v 1.11 2010/05/08 23:26:28 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+define('NP_DRAGANDDROPUPLOADER_RUNTIMES', 'html5,gears,flash,silverlight,browserplus');                \r
+\r
+// load class\r
+require_once(dirname(__FILE__).'/sharedlibs/sharedlibs.php');\r
+require_once('cles/Template.php');\r
+\r
+class NP_DragAndDropUploader extends NucleusPlugin {\r
+       function init(){\r
+               global $DIR_LIBS;\r
+               require_once($DIR_LIBS . 'MEDIA.php');          \r
+               \r
+               // include language file for this plugin \r
+               $language = ereg_replace( '[\\|/]', '', getLanguageName()); \r
+               if (file_exists($this->getDirectory().'language/'.$language.'.php')) \r
+                       @include_once($this->getDirectory().'language/'.$language.'.php');\r
+               \r
+               $this->te =& new cles_Template(dirname(__FILE__).'/draganddropuploader/template');\r
+       }\r
+       \r
+       // name of plugin\r
+       function getName() {\r
+               return 'Drag and Drop Uploader';\r
+       }\r
+\r
+       // author of plugin\r
+       function getAuthor() {\r
+               return 'hsur';\r
+       }\r
+\r
+       // an URL to the plugin website\r
+       // can also be of the form mailto:foo@bar.com\r
+       function getURL() {\r
+               return 'http://blog.cles.jp/np_cles/category/31/subcatid/25';\r
+       }\r
+\r
+       // version of the plugin\r
+       function getVersion() {\r
+               return '1.1';\r
+       }\r
+       \r
+       function hasAdminArea() {\r
+               return 1;\r
+       }\r
+       \r
+       function getEventList() {\r
+               return array('AddItemFormExtras','EditItemFormExtras','AdminPrePageHead','BookmarkletExtraHead');\r
+       }\r
+       \r
+    function event_AddItemFormExtras(&$data){\r
+               $this->_formExtras();\r
+       }\r
+\r
+    function event_EditItemFormExtras(&$data){\r
+               $this->_formExtras();\r
+       }\r
+       \r
+       function _formExtras(){\r
+               $collections = MEDIA::getCollectionList();\r
+               $collections_html = '<select id="plugin_draganddropuploader">';\r
+               foreach($collections as $k => $v){\r
+                       $collections_html .= '<option value="'.$k.'">'.$v.'</option>';\r
+               }\r
+               $collections_html .= '</select>';\r
+               \r
+               $tplVars = array(\r
+                       'collections' => $collections_html,\r
+               );\r
+               $index = $this->te->fetch('index', strtolower(__CLASS__));\r
+               echo $this->te->fill($index, $tplVars, false);\r
+       }\r
+       \r
+  function event_BookmarkletExtraHead(&$data){\r
+               $this->_extraHead($data);\r
+  }\r
+\r
+       function event_AdminPrePageHead(&$data){\r
+               if ( !($data['action'] == 'createitem' || $data['action'] == 'itemedit') ){\r
+                       return;\r
+               }\r
+               $this->_extraHead($data);\r
+       }\r
+\r
+       function _extraHead(&$data){\r
+               $tplVars = array(\r
+                       'plugindirurl' => $this->getAdminURL(),\r
+                       'runtimes' => NP_DRAGANDDROPUPLOADER_RUNTIMES,\r
+               );\r
+               $header = $this->te->fetch('extrahead', strtolower(__CLASS__));\r
+               $data['extrahead'] .= "\n" . $this->te->fill($header, $tplVars, false);\r
+    }\r
+       \r
+       function install() {\r
+               // debug\r
+               $this->createOption('debug', 'Debug Mode ?', 'yesno', 'no');\r
+       }\r
+       \r
+       function unInstall() {\r
+       }\r
+       \r
+       function _info($msg) {\r
+               if ($this->getOption('debug') == 'yes') {\r
+                       ACTIONLOG :: add(INFO, 'DragAndDropUploader: '.$msg);\r
+               }\r
+       }\r
+\r
+       function _warn($msg) {\r
+               ACTIONLOG :: add(WARNING, 'DragAndDropUploader: '.$msg);\r
+       }\r
+       \r
+       function getMinNucleusVersion() { return 330; }\r
+       function getMinNucleusPatchLevel() { return 0; }\r
+\r
+       // a description to be shown on the installed plugins listing\r
+       function getDescription() {\r
+               return '[$Revision: 1.11 $]<br />' . NP_DRAGANDDROPUPLOADER_DESCRIPTION;\r
+       }\r
+\r
+       function supportsFeature($what) {\r
+               switch ($what) {\r
+                       case 'SqlTablePrefix' :\r
+                       case 'HelpPage':\r
+                               return 1;\r
+                       default :\r
+                               return 0;\r
+               }\r
+       }\r
+                       \r
+       function doAction($type) {\r
+               global $member;\r
+               header('Content-type: text/plain; charset=UTF-8');\r
+               header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");\r
+               header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");\r
+               header("Cache-Control: no-store, no-cache, must-revalidate");\r
+               header("Cache-Control: post-check=0, pre-check=0", false);\r
+               header("Pragma: no-cache");\r
+                               \r
+               switch ($type) {\r
+                       case 'image_upload':\r
+                               // 5 minutes execution time\r
+                               @set_time_limit(5 * 60);\r
+                               $this->_image_upload();\r
+                               return '';\r
+                               break;\r
+\r
+                       // other actions result in an error\r
+                       case '':\r
+                       default:\r
+                               return 'Unexisting action: ' . $type;\r
+               }\r
+       }\r
+       \r
+       function _jsonrpc_error($mes = "", $code = "500"){\r
+               $this->_warn("($code) $mes");\r
+               header("HTTP/1.1 $code $mes");\r
+               echo('{"jsonrpc" : "2.0", "error" : {"code": '.$code.', "message": "'.$mes.'"}, "id" : "id"}');\r
+               exit;\r
+       }\r
+       \r
+       function _jsonrpc_ok(){\r
+               echo('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');\r
+               exit;\r
+       }\r
+       \r
+       function _image_upload(){               \r
+               global $member, $DIR_MEDIA, $CONF;\r
+               if( !$member->isLoggedIn() ) return $this->_jsonrpc_error("Not Logged in.", "403");\r
+               $collection = requestVar('collection');\r
+               \r
+               $fileName = isset($_REQUEST['name']) ? requestVar('name') : 'no_name';\r
+               if( $CONF['MediaPrefix'] ){\r
+                       $exif = @exif_read_data($_FILES['file']['tmp_name']);\r
+                       if( $exif !== false && $exif["DateTime"] && strtotime($exif["DateTime"]) !== false )\r
+                               $fileName = strftime("%Y%m%d-", strtotime($exif["DateTime"])) . $fileName;\r
+                       else\r
+                               $fileName = strftime("%Y%m%d-", time()) . $fileName;\r
+               }\r
+                               \r
+               if (isset($_SERVER['HTTP_CONTENT_TYPE'])) $contentType = serverVar('HTTP_CONTENT_TYPE');\r
+               if (isset($_SERVER['CONTENT_TYPE'])) $contentType = serverVar('CONTENT_TYPE');\r
+               \r
+               if (strpos($contentType, "multipart") !== false) {\r
+                       if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {\r
+                               $err = MEDIA::addMediaObject($collection, $_FILES['file']['tmp_name'], $fileName);\r
+                               if($err){\r
+                                       $this->_jsonrpc_error('addMediaObject Error: '. $err, "500");\r
+                               }\r
+                       } else\r
+                       $this->_jsonrpc_error("Failed to move uploaded file.", "500");\r
+               } else {\r
+                       // Read binary input stream and append it to temp file\r
+                       $in = fopen("php://input", "rb");\r
+                       if ($in) {\r
+                               while ($buff = fread($in, 4096))\r
+                               $err = MEDIA::addMediaObjectRaw($collection, $fileName, $buff);\r
+                               if($err){\r
+                                       $this->_jsonrpc_error('addMediaObjectRaw Error: '. $err, "500");\r
+                               }\r
+                       } else\r
+                       $this->_jsonrpc_error("Failed to open input stream.", "500");\r
+               }\r
+               \r
+               $this->_jsonrpc_ok();\r
+       }\r
+}\r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/css/plupload.queue.css b/trunk/NP_DragAndDropUploader/draganddropuploader/css/plupload.queue.css
new file mode 100644 (file)
index 0000000..8581fdd
--- /dev/null
@@ -0,0 +1,177 @@
+/* \r
+   Plupload\r
+------------------------------------------------------------------- */\r
+\r
+.plupload_button {\r
+       display: -moz-inline-box; /* FF < 3*/\r
+       display: inline-block;\r
+       font: normal 12px sans-serif;\r
+       text-decoration: none;\r
+    color: #42454a;\r
+    border: 1px solid #bababa;\r
+    padding: 2px 8px 3px 20px;\r
+       margin-right: 4px;\r
+    background: #f3f3f3 url('../img/buttons.png') no-repeat 0 center;\r
+       outline: 0;\r
+\r
+    /* Optional rounded corners for browsers that support it */\r
+    -moz-border-radius: 3px;\r
+    -khtml-border-radius: 3px;\r
+    -webkit-border-radius: 3px;\r
+    border-radius: 3px;\r
+}\r
+\r
+.plupload_button:hover {\r
+       color: #000;\r
+       text-decoration: none;\r
+}\r
+\r
+.plupload_disabled, a.plupload_disabled:hover {\r
+    color: #737373;\r
+    border-color: #c5c5c5;\r
+    background: #ededed url('../img/buttons-disabled.png') no-repeat 0 center;\r
+       cursor: default;\r
+}\r
+\r
+.plupload_add {\r
+       background-position: -181px center;\r
+}\r
+\r
+.plupload_wrapper {\r
+       font: normal 11px Verdana,sans-serif;\r
+       width: 100%;\r
+}\r
+\r
+.plupload_container {\r
+       padding: 8px;\r
+       background: url('../img/transp50.png');\r
+       /*-moz-border-radius: 5px;*/\r
+}\r
+\r
+.plupload_container input {\r
+       border: 1px solid #DDD;\r
+       font: normal 11px Verdana,sans-serif;\r
+       width: 98%;\r
+}\r
+\r
+.plupload_header {background: #2A2C2E url('../img/backgrounds.gif') repeat-x;}\r
+.plupload_header_content {\r
+       background: url('../img/backgrounds.gif') no-repeat 0 -317px;\r
+       min-height: 56px;\r
+       padding-left: 60px;\r
+       color: #FFF;\r
+}\r
+.plupload_header_title {\r
+       font: normal 18px sans-serif;\r
+       padding: 6px 0 3px;\r
+}\r
+.plupload_header_text {\r
+       font: normal 12px sans-serif;\r
+}\r
+\r
+.plupload_filelist {\r
+       margin: 0;\r
+       padding: 0;\r
+       list-style: none;\r
+}\r
+\r
+.plupload_scroll .plupload_filelist {\r
+       height: 185px;\r
+       background: #F5F5F5;\r
+       overflow-y: scroll;\r
+}\r
+\r
+.plupload_filelist li {\r
+       padding: 10px 8px;\r
+       background: #F5F5F5 url('../img/backgrounds.gif') repeat-x 0 -156px;\r
+       border-bottom: 1px solid #DDD;\r
+}\r
+\r
+.plupload_filelist_header, .plupload_filelist_footer {\r
+       background: #DFDFDF;\r
+       padding: 8px 8px;\r
+       color: #42454A;\r
+}\r
+.plupload_filelist_header {    \r
+       border-top: 1px solid #EEE;\r
+       border-bottom: 1px solid #CDCDCD;\r
+}\r
+\r
+.plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;}\r
+.plupload_file_name {float: left; overflow: hidden}\r
+.plupload_file_status {color: #777;}\r
+.plupload_file_status span {color: #42454A;}\r
+.plupload_file_size, .plupload_file_status, .plupload_progress {\r
+       float: right;\r
+       width: 80px;\r
+}\r
+.plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;}\r
+\r
+.plupload_filelist .plupload_file_name {width: 205px}\r
+\r
+.plupload_file_action {\r
+       float: right;\r
+       width: 16px;\r
+       height: 16px;\r
+       margin-left: 15px;\r
+}\r
+\r
+.plupload_file_action * {\r
+       display: none;\r
+       width: 16px;\r
+       height: 16px;\r
+}\r
+\r
+li.plupload_uploading {background: #ECF3DC url('../img/backgrounds.gif') repeat-x 0 -238px;}\r
+li.plupload_done {color:#AAA}\r
+\r
+li.plupload_delete a {\r
+       background: url('../img/delete.gif');\r
+}\r
+\r
+li.plupload_failed a {\r
+       background: url('../img/error.gif');\r
+       cursor: default;\r
+}\r
+\r
+li.plupload_done a {\r
+       background: url('../img/done.gif');\r
+       cursor: default;\r
+}\r
+\r
+.plupload_progress, .plupload_upload_status {\r
+       display: none;\r
+}\r
+\r
+.plupload_progress_container {\r
+       margin-top: 3px;\r
+       border: 1px solid #CCC;\r
+       background: #FFF;\r
+       padding: 1px;\r
+}\r
+.plupload_progress_bar {\r
+       width: 0px;\r
+       height: 7px;\r
+       background: #CDEB8B;\r
+}\r
+\r
+.plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action {\r
+       margin-right: 17px;\r
+}\r
+\r
+/* Floats */\r
+\r
+.plupload_clear,.plupload_clearer {clear: both;}\r
+.plupload_clearer, .plupload_progress_bar {\r
+       display: block;\r
+       font-size: 0;\r
+       line-height: 0; \r
+}\r
+\r
+li.plupload_droptext {\r
+       background: transparent;\r
+       text-align: center;\r
+       vertical-align: middle;\r
+       border: 0;\r
+       line-height: 165px;\r
+}\r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/help.html b/trunk/NP_DragAndDropUploader/draganddropuploader/help.html
new file mode 100644 (file)
index 0000000..46b3439
--- /dev/null
@@ -0,0 +1,15 @@
+<!-- $Id: help.html,v 1.5 2010/05/08 23:31:51 hsur Exp $ -->\r
+<h3>バージョン履歴</h3>\r
+\r
+<ul>\r
+       <li>Version 1.0b: (2010/04/25)</li>\r
+       <li> [New] 初版公開</li>\r
+    <li> [Fixed] Nucleus v3.41でファイルがアップロード出来ないバグを修正 (Thanks 桜枝さん, 1.0.1b)</a>\r
+    <li> [Fixed] ファイルがアップロード出来ていないのに成功しているように見える現象を修正 (1.0.1b)</a>\r
+       \r
+       <li>Version 1.1: (2010/05/09)</li>\r
+       <li> [Fixed] register_globals,allow_url_fopen,allow_url_includeがonの場合にリモートコードインジェクションが発生する問題に対応しました (Thanks Katsumiさん)</li>\r
+       <li> [Changed] エントリの編集部分に機能を統合しました</li>\r
+       <li> [Added] アップロード先のコレクションを選択可能にしました</li>\r
+       <li> [Added] リセット機能を実装しました</li>\r
+</ul>\r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/img/backgrounds.gif b/trunk/NP_DragAndDropUploader/draganddropuploader/img/backgrounds.gif
new file mode 100644 (file)
index 0000000..39e33eb
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/img/backgrounds.gif differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/img/buttons-disabled.png b/trunk/NP_DragAndDropUploader/draganddropuploader/img/buttons-disabled.png
new file mode 100644 (file)
index 0000000..afa11af
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/img/buttons-disabled.png differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/img/buttons.png b/trunk/NP_DragAndDropUploader/draganddropuploader/img/buttons.png
new file mode 100644 (file)
index 0000000..153e738
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/img/buttons.png differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/img/delete.gif b/trunk/NP_DragAndDropUploader/draganddropuploader/img/delete.gif
new file mode 100644 (file)
index 0000000..78ca8b3
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/img/delete.gif differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/img/done.gif b/trunk/NP_DragAndDropUploader/draganddropuploader/img/done.gif
new file mode 100644 (file)
index 0000000..29f3ed7
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/img/done.gif differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/img/error.gif b/trunk/NP_DragAndDropUploader/draganddropuploader/img/error.gif
new file mode 100644 (file)
index 0000000..4682b63
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/img/error.gif differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/img/throbber.gif b/trunk/NP_DragAndDropUploader/draganddropuploader/img/throbber.gif
new file mode 100644 (file)
index 0000000..4ae8b16
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/img/throbber.gif differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/img/transp50.png b/trunk/NP_DragAndDropUploader/draganddropuploader/img/transp50.png
new file mode 100644 (file)
index 0000000..eb0efe1
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/img/transp50.png differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/index.php b/trunk/NP_DragAndDropUploader/draganddropuploader/index.php
new file mode 100644 (file)
index 0000000..910fd8d
--- /dev/null
@@ -0,0 +1,99 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * index.php ($Revision: 1.3 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: index.php,v 1.3 2010/05/08 20:49:28 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2010 cles. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+$strRel = '../../../';\r
+include ($strRel.'config.php');\r
+include ($DIR_LIBS.'PLUGINADMIN.php');\r
+\r
+require_once($DIR_PLUGINS . 'sharedlibs/sharedlibs.php');\r
+require_once('cles/Feedback.php');\r
+\r
+if ($blogid) {\r
+       $isblogadmin = $member->isBlogAdmin($blogid);\r
+} else\r
+       $isblogadmin = 0;\r
+\r
+if (!$member->isLoggedIn()) {\r
+       $oPluginAdmin = new PluginAdmin('MetaTags');\r
+       $oPluginAdmin->start();\r
+       echo "<p>ログインが必要です</p>";\r
+       $oPluginAdmin->end();\r
+       exit;\r
+}\r
+\r
+if (!($member->isAdmin() || $isblogadmin)) {\r
+       $oPluginAdmin = new PluginAdmin('MetaTags');\r
+       $oPluginAdmin->start();\r
+       echo "<p>"._ERROR_DISALLOWED."</p>";\r
+       $oPluginAdmin->end();\r
+       exit;\r
+}\r
+\r
+if (isset ($_GET['page'])) {\r
+       $action = getVar('page');\r
+}\r
+if (isset ($_POST['page'])) {\r
+       $action = getVar('page');\r
+}\r
+\r
+// create the admin area page\r
+$oPluginAdmin = new PluginAdmin('DragAndDropUploader');\r
+$oPluginAdmin->start();\r
+$fb =& new cles_Feedback($oPluginAdmin);\r
+\r
+// menu\r
+echo "<h2>DragAndDropUploader menu</h2>\n";\r
+echo "<ul>\n";\r
+echo "<li><a href=\"".serverVar('PHP_SELF')."?page=report\"><span style=\"font-weight:bold; color:red\">" . $fb->getMenuStr() . "</span></a></li>\n";\r
+echo "</ul>\n";\r
+\r
+//action\r
+switch ($action) {\r
+       case 'report' :\r
+               $extra = '';\r
+               $fb->printForm($extra);\r
+               break;\r
+\r
+       default :\r
+               break;\r
+}\r
+\r
+echo "<br />";\r
+\r
+$oPluginAdmin->end();\r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/gears_init.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/gears_init.js
new file mode 100644 (file)
index 0000000..5f44f09
--- /dev/null
@@ -0,0 +1,86 @@
+// Copyright 2007, Google Inc.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+//  1. Redistributions of source code must retain the above copyright notice,
+//     this list of conditions and the following disclaimer.
+//  2. Redistributions in binary form must reproduce the above copyright notice,
+//     this list of conditions and the following disclaimer in the documentation
+//     and/or other materials provided with the distribution.
+//  3. Neither the name of Google Inc. nor the names of its contributors may be
+//     used to endorse or promote products derived from this software without
+//     specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Sets up google.gears.*, which is *the only* supported way to access Gears.
+//
+// Circumvent this file at your own risk!
+//
+// In the future, Gears may automatically define google.gears.* without this
+// file. Gears may use these objects to transparently fix bugs and compatibility
+// issues. Applications that use the code below will continue to work seamlessly
+// when that happens.
+
+(function() {
+  // We are already defined. Hooray!
+  if (window.google && google.gears) {
+    return;
+  }
+
+  var factory = null;
+
+  // Firefox
+  if (typeof GearsFactory != 'undefined') {
+    factory = new GearsFactory();
+  } else {
+    // IE
+    try {
+      factory = new ActiveXObject('Gears.Factory');
+      // privateSetGlobalObject is only required and supported on WinCE.
+      if (factory.getBuildInfo().indexOf('ie_mobile') != -1) {
+        factory.privateSetGlobalObject(this);
+      }
+    } catch (e) {
+      // Safari
+      if ((typeof navigator.mimeTypes != 'undefined')
+           && navigator.mimeTypes["application/x-googlegears"]) {
+        factory = document.createElement("object");
+        factory.style.display = "none";
+        factory.width = 0;
+        factory.height = 0;
+        factory.type = "application/x-googlegears";
+        document.documentElement.appendChild(factory);
+      }
+    }
+  }
+
+  // *Do not* define any objects if Gears is not installed. This mimics the
+  // behavior of Gears defining the objects in the future.
+  if (!factory) {
+    return;
+  }
+
+  // Now set up the objects, being careful not to overwrite anything.
+  //
+  // Note: In Internet Explorer for Windows Mobile, you can't add properties to
+  // the window object. However, global objects are automatically added as
+  // properties of the window object in all browsers.
+  if (!window.google) {
+    google = {};
+  }
+
+  if (!google.gears) {
+    google.gears = {factory: factory};
+  }
+})();
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/jquery.plupload.queue.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/jquery.plupload.queue.min.js
new file mode 100644 (file)
index 0000000..4558695
--- /dev/null
@@ -0,0 +1 @@
+(function(c){var d={};function a(e){return plupload.translate(e)||e}function b(f,e){e.contents().each(function(g,h){h=c(h);if(!h.is(".plupload")){h.remove()}});e.prepend('<div class="plupload_wrapper plupload_scroll"><div id="'+f+'_container" class="plupload_container"><div class="plupload"><div class="plupload_header"><div class="plupload_header_content"><div class="plupload_header_title">'+a("Select files")+'</div><div class="plupload_header_text">'+a("Add files to the upload queue and click the start button.")+'</div></div></div><div class="plupload_content"><div class="plupload_filelist_header"><div class="plupload_file_name">'+a("Filename")+'</div><div class="plupload_file_action">&nbsp;</div><div class="plupload_file_status"><span>'+a("Status")+'</span></div><div class="plupload_file_size">'+a("Size")+'</div><div class="plupload_clearer">&nbsp;</div></div><ul id="'+f+'_filelist" class="plupload_filelist"></ul><div class="plupload_filelist_footer"><div class="plupload_file_name"><div class="plupload_buttons"><a href="#" class="plupload_button plupload_add">'+a("Add files")+'</a><a href="#" class="plupload_button plupload_start">'+a("Start upload")+'</a></div><span class="plupload_upload_status"></span></div><div class="plupload_file_action"></div><div class="plupload_file_status"><span class="plupload_total_status">0%</span></div><div class="plupload_file_size"><span class="plupload_total_file_size">0 b</span></div><div class="plupload_progress"><div class="plupload_progress_container"><div class="plupload_progress_bar"></div></div></div><div class="plupload_clearer">&nbsp;</div></div></div></div></div><input type="hidden" id="'+f+'_count" name="'+f+'_count" value="0" /></div>')}c.fn.pluploadQueue=function(e){if(e){this.each(function(){var j,i,k;i=c(this);k=i.attr("id");if(!k){k=plupload.guid();i.attr("id",k)}j=new plupload.Uploader(c.extend({dragdrop:true,container:k},e));if(e.preinit){e.preinit(j)}d[k]=j;function h(l){var m;if(l.status==plupload.DONE){m="plupload_done"}if(l.status==plupload.FAILED){m="plupload_failed"}if(l.status==plupload.QUEUED){m="plupload_delete"}if(l.status==plupload.UPLOADING){m="plupload_uploading"}c("#"+l.id).attr("class",m).find("a").css("display","block")}function f(){c("span.plupload_total_status",i).html(j.total.percent+"%");c("div.plupload_progress_bar",i).css("width",j.total.percent+"%");c("span.plupload_upload_status",i).text("Uploaded "+j.total.uploaded+"/"+j.files.length+" files");if(j.total.uploaded==j.files.length){j.stop()}}function g(){var m=c("ul.plupload_filelist",i).html(""),n=0,l;c.each(j.files,function(p,o){l="";if(o.status==plupload.DONE){if(o.target_name){l+='<input type="hidden" name="'+k+"_"+n+'_tmpname" value="'+plupload.xmlEncode(o.target_name)+'" />'}l+='<input type="hidden" name="'+k+"_"+n+'_name" value="'+plupload.xmlEncode(o.name)+'" />';l+='<input type="hidden" name="'+k+"_"+n+'_status" value="'+(o.status==plupload.DONE?"done":"failed")+'" />';n++;c("#"+k+"_count").val(n)}m.append('<li id="'+o.id+'"><div class="plupload_file_name"><span>'+o.name+'</span></div><div class="plupload_file_action"><a href="#"></a></div><div class="plupload_file_status">'+o.percent+'%</div><div class="plupload_file_size">'+plupload.formatSize(o.size)+'</div><div class="plupload_clearer">&nbsp;</div>'+l+"</li>");h(o);c("#"+o.id+".plupload_delete a").click(function(q){c("#"+o.id).remove();j.removeFile(o);q.preventDefault()})});c("span.plupload_total_file_size",i).html(plupload.formatSize(j.total.size));if(j.total.queued===0){c("span.plupload_add_text",i).text(a("Add files."))}else{c("span.plupload_add_text",i).text(j.total.queued+" files queued.")}c("a.plupload_start",i).toggleClass("plupload_disabled",j.files.length===0);m[0].scrollTop=m[0].scrollHeight;f();if(!j.files.length&&j.features.dragdrop&&j.settings.dragdrop){c("#"+k+"_filelist").append('<li class="plupload_droptext">'+a("Drag files here.")+"</li>")}}j.bind("UploadFile",function(l,m){c("#"+m.id).addClass("plupload_current_file")});j.bind("Init",function(l,m){b(k,i);if(!e.unique_names&&e.rename){c("#"+k+"_filelist div.plupload_file_name span",i).live("click",function(s){var q=c(s.target),o,r,n,p="";o=l.getFile(q.parents("li")[0].id);n=o.name;r=/^(.+)(\.[^.]+)$/.exec(n);if(r){n=r[1];p=r[2]}q.hide().after('<input type="text" />');q.next().val(n).focus().blur(function(){q.show().next().remove()}).keydown(function(u){var t=c(this);if(u.keyCode==13){u.preventDefault();o.name=t.val()+p;q.text(o.name);t.blur()}})})}c("a.plupload_add",i).attr("id",k+"_browse");l.settings.browse_button=k+"_browse";if(l.features.dragdrop&&l.settings.dragdrop){l.settings.drop_element=k+"_filelist";c("#"+k+"_filelist").append('<li class="plupload_droptext">'+a("Drag files here.")+"</li>")}c("#"+k+"_container").attr("title","Using runtime: "+m.runtime);c("a.plupload_start",i).click(function(n){if(!c(this).hasClass("plupload_disabled")){j.start()}n.preventDefault()});c("a.plupload_stop",i).click(function(n){j.stop();n.preventDefault()});c("a.plupload_start",i).addClass("plupload_disabled")});j.init();if(e.setup){e.setup(j)}j.bind("Error",function(l,o){var m=o.file,n;if(m){n=o.message;if(o.details){n+=" ("+o.details+")"}c("#"+m.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",n)}});j.bind("StateChanged",function(){if(j.state===plupload.STARTED){c("li.plupload_delete a,div.plupload_buttons",i).hide();c("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",i).css("display","block");c("span.plupload_upload_status",i).text("Uploaded 0/"+j.files.length+" files")}else{c("a.plupload_stop,div.plupload_progress",i).hide();c("a.plupload_delete",i).css("display","block")}});j.bind("QueueChanged",g);j.bind("StateChanged",function(l){if(l.state==plupload.STOPPED){g()}});j.bind("FileUploaded",function(l,m){h(m)});j.bind("UploadProgress",function(l,m){c("#"+m.id+" div.plupload_file_status",i).html(m.percent+"%");h(m);f()})});return this}else{return d[c(this[0]).attr("id")]}}})(jQuery);
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/jquery.plupload.single.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/jquery.plupload.single.min.js
new file mode 100644 (file)
index 0000000..3d8223a
--- /dev/null
@@ -0,0 +1 @@
+(function(b){var c={};function a(e,d){d.html('<div class="plupload_single" id="'+e+'_browse"><div class="plupload_container"><input type="text" class="plupload_file_name" value="" /><input type="button" class="plupload_browse" value="Browse&hellip;" /><span class="plupload_status"></span></div></div>')}b.fn.pluploadSingle=function(d){if(d){this.each(function(){var f,e,g;f=new plupload.Uploader(d);e=b(this);g=e.attr("id");if(!g){g=plupload.guid();e.attr("id",g)}f.settings.browse_button=g+"_browse";f.settings.multi_selection=false;c[g]=f;f.bind("PreInit",function(){a(g,e);b(".plupload_file_name,.plupload_browse",e).click(function(h){f.browse();h.preventDefault()});if(f.settings.unique_names){f.bind("UploadFile",function(h,i){i.target_name=(f.settings.salt||"")+i.id+".tmp"})}f.bind("QueueChanged",function(h){var i;if(h.files.length){i=h.files[h.files.length-1];b(".plupload_file_name",e).val(i.name).attr("disabled","disabled");b(".plupload_status",e).html("Size: "+plupload.formatSize(i.size));b(".plupload_browse",e).attr("disabled","disabled");h.start()}});f.bind("UploadProgress",function(h,i){if(i.status==plupload.DONE){b(".plupload_status",e).html("File uploaded.")}else{b(".plupload_status",e).html("Uploading: "+i.percent+"%")}});f.bind("FileUploaded",function(h,i){if(i.status==plupload.DONE){if(i.target_name){e.append('<input type="hidden" name="'+g+'_tmpname" value="'+plupload.xmlEncode(i.target_name)+'" />')}e.append('<input type="hidden" name="'+g+'_name" value="'+plupload.xmlEncode(i.name)+'" />')}else{b(".plupload_file_name,.plupload_browse",e).attr("disabled","")}})});f.init()});return this}else{return c[b(this[0]).attr("id")]}}})(jQuery);
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.browserplus.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.browserplus.min.js
new file mode 100644 (file)
index 0000000..99e2220
--- /dev/null
@@ -0,0 +1 @@
+(function(a){a.runtimes.BrowserPlus=a.addRuntime("browserplus",{init:function(g,i){var e=window.BrowserPlus,h={},d=g.settings,c=d.resize;function f(n){var m,l,j=[],k,o;for(l=0;l<n.length;l++){k=n[l];o=a.guid();h[o]=k;j.push(new a.File(o,k.name,k.size))}if(l){g.trigger("FilesAdded",j)}}function b(){g.bind("PostInit",function(){var m,k=d.drop_element,o=g.id+"_droptarget",j=document.getElementById(k),l;function p(r,q){e.DragAndDrop.AddDropTarget({id:r},function(s){e.DragAndDrop.AttachCallbacks({id:r,hover:function(t){if(!t&&q){q()}},drop:function(t){if(q){q()}f(t)}},function(){})})}function n(){document.getElementById(o).style.top="-1000px"}if(j){if(document.attachEvent&&(/MSIE/gi).test(navigator.userAgent)){m=document.createElement("div");m.setAttribute("id",o);a.extend(m.style,{position:"absolute",top:"-1000px",background:"red",filter:"alpha(opacity=0)",opacity:0});document.body.appendChild(m);a.addEvent(j,"dragenter",function(r){var q,s;q=document.getElementById(k);s=a.getPos(q);a.extend(document.getElementById(o).style,{top:s.y+"px",left:s.x+"px",width:q.offsetWidth+"px",height:q.offsetHeight+"px"})});p(o,n)}else{p(k)}}a.addEvent(document.getElementById(d.browse_button),"click",function(v){var t=[],r,q,u=d.filters,s;v.preventDefault();for(r=0;r<u.length;r++){s=u[r].extensions.split(",");for(q=0;q<s.length;q++){t.push(a.mimeTypes[s[q]])}}e.FileBrowse.OpenBrowseDialog({mimeTypes:t},function(w){if(w.success){f(w.value)}})});j=m=null});g.bind("UploadFile",function(n,k){var m=h[k.id],j={},l=n.settings.chunk_size,o,p=[];function r(s,u){var t;if(k.status==a.FAILED){return}j.name=k.target_name||k.name;if(l){j.chunk=s;j.chunks=u}t=p.shift();e.Uploader.upload({url:a.buildUrl(n.settings.url,j),files:{file:t},cookies:document.cookies,postvars:n.settings.multipart_params,progressCallback:function(x){var w,v=0;o[s]=parseInt(x.filePercent*t.size/100,10);for(w=0;w<o.length;w++){v+=o[w]}k.loaded=v;n.trigger("UploadProgress",k)}},function(w){var v,x;if(w.success){v=w.value.statusCode;if(l){n.trigger("ChunkUploaded",k,{chunk:s,chunks:u,response:w.value.body,status:v})}if(p.length>0){r(++s,u)}else{k.status=a.DONE;n.trigger("FileUploaded",k,{response:w.value.body,status:v});if(v>=400){n.trigger("Error",{code:a.HTTP_ERROR,message:"HTTP Error.",file:k,status:v})}}}else{n.trigger("Error",{code:a.GENERIC_ERROR,message:"Generic Error.",file:k,details:w.error})}})}function q(s){k.size=s.size;if(l){e.FileAccess.chunk({file:s,chunkSize:l},function(v){if(v.success){var w=v.value,t=w.length;o=Array(t);for(var u=0;u<t;u++){o[u]=0;p.push(w[u])}r(0,t)}})}else{o=Array(1);p.push(s);r(0,1)}}if(c&&/\.(png|jpg|jpeg)$/i.test(k.name)){BrowserPlus.ImageAlter.transform({file:m,quality:c.quality||90,actions:[{scale:{maxwidth:c.width,maxheight:c.height}}]},function(s){if(s.success){q(s.value.file)}})}else{q(m)}});g.features={dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true};i({success:true})}if(e){e.init(function(k){var j=[{service:"Uploader",version:"3"},{service:"DragAndDrop",version:"1"},{service:"FileBrowse",version:"1"},{service:"FileAccess",version:"2"}];if(c){j.push({service:"ImageAlter",version:"4"})}if(k.success){e.require({services:j},function(l){if(l.success){b()}else{i()}})}else{i()}})}else{i()}}})})(plupload);
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.flash.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.flash.min.js
new file mode 100644 (file)
index 0000000..583dae0
--- /dev/null
@@ -0,0 +1 @@
+(function(c){var a={};function b(){var d;try{d=navigator.plugins["Shockwave Flash"];d=d.description}catch(f){try{d=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(e){d="0.0"}}d=d.match(/\d+/g);return parseFloat(d[0]+"."+d[1])}c.flash={trigger:function(f,d,e){setTimeout(function(){var j=a[f],h,g;if(j){j.trigger("Flash:"+d,e)}},0)}};c.runtimes.Flash=c.addRuntime("flash",{init:function(g,l){var k,f,h,e,m=0,d=document.body;if(b()<10){l({success:false});return}a[g.id]=g;k=document.getElementById(g.settings.browse_button);f=document.createElement("div");f.id=g.id+"_flash_container";c.extend(f.style,{position:"absolute",top:"0px",background:g.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100%",height:"100%"});f.className="plupload flash";if(g.settings.container){d=document.getElementById(g.settings.container);d.style.position="relative"}d.appendChild(f);h="id="+escape(g.id);f.innerHTML='<object id="'+g.id+'_flash" width="100%" height="100%" style="outline:0" type="application/x-shockwave-flash" data="'+g.settings.flash_swf_url+'"><param name="movie" value="'+g.settings.flash_swf_url+'" /><param name="flashvars" value="'+h+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>';function j(){return document.getElementById(g.id+"_flash")}function i(){if(m++>5000){l({success:false});return}if(!e){setTimeout(i,1)}}i();k=f=null;g.bind("Flash:Init",function(){var p={},o,n=g.settings.resize||{};e=true;j().setFileFilters(g.settings.filters,g.settings.multi_selection);g.bind("UploadFile",function(q,r){var s=q.settings;j().uploadFile(p[r.id],c.buildUrl(s.url,{name:r.target_name||r.name}),{chunk_size:s.chunk_size,width:n.width,height:n.height,quality:n.quality||90,multipart:s.multipart,multipart_params:s.multipart_params,file_data_name:s.file_data_name,format:/\.(jpg|jpeg)$/i.test(r.name)?"jpg":"png",headers:s.headers})});g.bind("Flash:UploadProcess",function(r,q){var s=r.getFile(p[q.id]);if(s.status!=c.FAILED){s.loaded=q.loaded;s.size=q.size;r.trigger("UploadProgress",s)}});g.bind("Flash:UploadChunkComplete",function(q,s){var t,r=q.getFile(p[s.id]);t={chunk:s.chunk,chunks:s.chunks,response:s.text};q.trigger("ChunkUploaded",r,t);if(r.status!=c.FAILED){j().uploadNextChunk()}if(s.chunk==s.chunks-1){r.status=c.DONE;q.trigger("FileUploaded",r,{response:s.text})}});g.bind("Flash:SelectFiles",function(q,t){var s,r,u=[],v;for(r=0;r<t.length;r++){s=t[r];v=c.guid();p[v]=s.id;p[s.id]=v;u.push(new c.File(v,s.name,s.size))}if(u.length){g.trigger("FilesAdded",u)}});g.bind("Flash:SecurityError",function(q,r){g.trigger("Error",{code:c.SECURITY_ERROR,message:"Security error.",details:r.message,file:g.getFile(p[r.id])})});g.bind("Flash:GenericError",function(q,r){g.trigger("Error",{code:c.GENERIC_ERROR,message:"Generic error.",details:r.message,file:g.getFile(p[r.id])})});g.bind("Flash:IOError",function(q,r){g.trigger("Error",{code:c.IO_ERROR,message:"IO error.",details:r.message,file:g.getFile(p[r.id])})});g.bind("QueueChanged",function(q){g.refresh()});g.bind("FilesRemoved",function(q,s){var r;for(r=0;r<s.length;r++){j().removeFile(p[s[r].id])}});g.bind("StateChanged",function(q){g.refresh()});g.bind("Refresh",function(q){var r,s,t;j().setFileFilters(g.settings.filters,g.settings.multi_selection);r=document.getElementById(q.settings.browse_button);s=c.getPos(r,document.getElementById(q.settings.container));t=c.getSize(r);c.extend(document.getElementById(q.id+"_flash_container").style,{top:s.y+"px",left:s.x+"px",width:t.w+"px",height:t.h+"px"})});g.features={jpgresize:true,pngresize:true,chunks:true,progress:true};l({success:true})})}})})(plupload);
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.flash.swf b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.flash.swf
new file mode 100644 (file)
index 0000000..c50ce6c
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.flash.swf differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.full.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.full.min.js
new file mode 100644 (file)
index 0000000..3086d73
--- /dev/null
@@ -0,0 +1 @@
+(function(){var c=0,h=[],j={},f={},a={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g,b;function e(){this.returnValue=false}function g(){this.cancelBubble=true}(function(k){var l=k.split(/,/),m,o,n;for(m=0;m<l.length;m+=2){n=l[m+1].split(/ /);for(o=0;o<n.length;o++){f[n[o]]=l[m]}}})("application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats,docx pptx xlsx,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,image/bmp,bmp,image/gif,gif,image/jpeg,jpeg jpg jpe,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/html,htm html xhtml,text/rtf,rtf,video/mpeg,mpeg mpg mpe,video/quicktime,qt mov,video/x-flv,flv,video/vnd.rn-realvideo,rv,text/plain,asc txt text diff log,application/octet-stream,exe");var d={STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-700,mimeTypes:f,extend:function(k){d.each(arguments,function(l,m){if(m>0){d.each(l,function(o,n){k[n]=o})}});return k},cleanName:function(k){var l,m;m=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(l=0;l<m.length;l+=2){k=k.replace(m[l],m[l+1])}k=k.replace(/\s+/g,"_");k=k.replace(/[^a-z0-9_\-\.]+/gi,"");return k},addRuntime:function(k,l){l.name=k;h[k]=l;h.push(l);return l},guid:function(){var k=new Date().getTime().toString(32),l;for(l=0;l<5;l++){k+=Math.floor(Math.random()*65535).toString(32)}return(d.guidPrefix||"p")+k+(c++).toString(32)},buildUrl:function(l,k){var m="";d.each(k,function(o,n){m+=(m?"&":"")+encodeURIComponent(n)+"="+encodeURIComponent(o)});if(m){l+=(l.indexOf("?")>0?"&":"?")+m}return l},each:function(n,o){var m,l,k;if(n){m=n.length;if(m===b){for(l in n){if(n.hasOwnProperty(l)){if(o(n[l],l)===false){return}}}}else{for(k=0;k<m;k++){if(o(n[k],k)===false){return}}}}},formatSize:function(k){if(k===b){return d.translate("N/A")}if(k>1048576){return Math.round(k/1048576,1)+" MB"}if(k>1024){return Math.round(k/1024,1)+" KB"}return k+" b"},getPos:function(l,p){var q=0,o=0,s,r=document,m,n;l=l;p=p||r.body;function k(w){var u,v,t=0,z=0;if(w){v=w.getBoundingClientRect();u=r.compatMode==="CSS1Compat"?r.documentElement:r.body;t=v.left+u.scrollLeft;z=v.top+u.scrollTop}return{x:t,y:z}}if(l.getBoundingClientRect&&(navigator.userAgent.indexOf("MSIE")>0&&r.documentMode!==8)){m=k(l);n=k(p);return{x:m.x-n.x,y:m.y-n.y}}s=l;while(s&&s!=p&&s.nodeType){q+=s.offsetLeft||0;o+=s.offsetTop||0;s=s.offsetParent}s=l.parentNode;while(s&&s!=p&&s.nodeType){q-=s.scrollLeft||0;o-=s.scrollTop||0;s=s.parentNode}return{x:q,y:o}},getSize:function(k){return{w:k.clientWidth||k.offsetWidth,h:k.clientHeight||k.offsetHeight}},parseSize:function(k){var l;if(typeof(k)=="string"){k=/^([0-9]+)([mgk]+)$/.exec(k.toLowerCase().replace(/[^0-9mkg]/g,""));l=k[2];k=+k[1];if(l=="g"){k*=1073741824}if(l=="m"){k*=1048576}if(l=="k"){k*=1024}}return k},xmlEncode:function(k){return k?(""+k).replace(i,function(l){return a[l]?"&"+a[l]+";":l}):k},toArray:function(m){var l,k=[];for(l=0;l<m.length;l++){k[l]=m[l]}return k},addI18n:function(k){return d.extend(j,k)},translate:function(k){return j[k]||k},addEvent:function(l,k,m){if(l.attachEvent){l.attachEvent("on"+k,function(){var n=window.event;if(!n.target){n.target=n.srcElement}n.preventDefault=e;n.stopPropagation=g;m(n)})}else{if(l.addEventListener){l.addEventListener(k,m,false)}}}};d.Uploader=function(n){var l={},q,p=[],r,m;q=new d.QueueProgress();n=d.extend({chunk_size:0,max_file_size:"1gb",multi_selection:true,file_data_name:"file",filters:[]},n);function o(){var s;if(this.state==d.STARTED&&r<p.length){s=p[r++];if(s.status==d.QUEUED){this.trigger("UploadFile",s)}else{o.call(this)}}else{this.stop()}}function k(){var t,s;q.reset();for(t=0;t<p.length;t++){s=p[t];if(s.size!==b){q.size+=s.size;q.loaded+=s.loaded}else{q.size=b}if(s.status==d.DONE){q.uploaded++}else{if(s.status==d.FAILED){q.failed++}else{q.queued++}}}if(q.size===b){q.percent=p.length>0?Math.ceil(q.uploaded/p.length*100):0}else{q.bytesPerSec=Math.ceil(q.loaded/((+new Date()-m||1)/1000));q.percent=q.size>0?Math.ceil(q.loaded/q.size*100):0}}d.extend(this,{state:d.STOPPED,features:{},files:p,settings:n,total:q,id:d.guid(),init:function(){var x=this,y,u,t,w=0,v;n.page_url=n.page_url||document.location.pathname.replace(/\/[^\/]+$/g,"/");if(!/^(\w+:\/\/|\/)/.test(n.url)){n.url=n.page_url+n.url}n.chunk_size=d.parseSize(n.chunk_size);n.max_file_size=d.parseSize(n.max_file_size);x.bind("FilesAdded",function(z,C){var B,A,F=0,E,D=n.filters;if(D&&D.length){E={};d.each(D,function(G){d.each(G.extensions.split(/,/),function(H){E[H.toLowerCase()]=true})})}for(B=0;B<C.length;B++){A=C[B];A.loaded=0;A.percent=0;A.status=d.QUEUED;if(E&&!E[A.name.toLowerCase().split(".").slice(-1)]){z.trigger("Error",{code:d.FILE_EXTENSION_ERROR,message:"File extension error.",file:A});continue}if(A.size!==b&&A.size>n.max_file_size){z.trigger("Error",{code:d.FILE_SIZE_ERROR,message:"File size error.",file:A});continue}p.push(A);F++}if(F){x.trigger("QueueChanged");x.refresh()}});if(n.unique_names){x.bind("UploadFile",function(z,A){A.target_name=A.id+".tmp"})}x.bind("UploadProgress",function(z,A){if(A.status==d.QUEUED){A.status=d.UPLOADING}A.percent=A.size>0?Math.ceil(A.loaded/A.size*100):100;k()});x.bind("StateChanged",function(z){if(z.state==d.STARTED){m=(+new Date())}});x.bind("QueueChanged",k);x.bind("Error",function(z,A){if(A.file){A.file.status=d.FAILED;k();window.setTimeout(function(){o.call(x)})}});x.bind("FileUploaded",function(z,A){A.status=d.DONE;z.trigger("UploadProgress",A);o.call(x)});if(n.runtimes){u=[];v=n.runtimes.split(/\s?,\s?/);for(y=0;y<v.length;y++){if(h[v[y]]){u.push(h[v[y]])}}}else{u=h}function s(){var z=u[w++];if(z){z.init(x,function(C){var A,B;if(C&&C.success){A=x.settings.required_features;if(A){A=A.split(",");for(B=0;B<A.length;B++){if(!x.features[A[B]]){s();return}}}x.trigger("Init",{runtime:z.name});x.trigger("PostInit");x.refresh()}else{s()}})}else{x.trigger("Error",{code:d.INIT_ERROR,message:"Init error."})}}s()},refresh:function(){this.trigger("Refresh")},start:function(){if(this.state!=d.STARTED){r=0;this.state=d.STARTED;this.trigger("StateChanged");o.call(this)}},stop:function(){if(this.state!=d.STOPPED){this.state=d.STOPPED;this.trigger("StateChanged")}},getFile:function(t){var s;for(s=p.length-1;s>=0;s--){if(p[s].id===t){return p[s]}}},removeFile:function(t){var s;for(s=p.length-1;s>=0;s--){if(p[s].id===t.id){return this.splice(s,1)[0]}}},splice:function(u,s){var t;t=p.splice(u,s);this.trigger("FilesRemoved",t);this.trigger("QueueChanged");return t},trigger:function(t){var v=l[t.toLowerCase()],u,s;if(v){s=Array.prototype.slice.call(arguments);s[0]=this;for(u=0;u<v.length;u++){if(v[u].func.apply(v[u].scope,s)===false){return false}}}return true},bind:function(s,u,t){var v;s=s.toLowerCase();v=l[s]||[];v.push({func:u,scope:t||this});l[s]=v},unbind:function(s,u){var v=l[s.toLowerCase()],t;if(v){for(t=v.length-1;t>=0;t--){if(v[t].func===u){v.splice(t,1)}}}}})};d.File=function(n,l,m){var k=this;k.id=n;k.name=l;k.size=m;k.loaded=0;k.percent=0;k.status=0};d.Runtime=function(){this.init=function(k,l){}};d.QueueProgress=function(){var k=this;k.size=0;k.loaded=0;k.uploaded=0;k.failed=0;k.queued=0;k.percent=0;k.bytesPerSec=0;k.reset=function(){k.size=k.loaded=k.uploaded=k.failed=k.queued=k.percent=k.bytesPerSec=0}};d.runtimes={};window.plupload=d})();(function(b){var c={};function a(i,e,k,j,d){var l,g,f,h;g=google.gears.factory.create("beta.canvas");g.decode(i);h=Math.min(e/g.width,k/g.height);if(h<1){e=Math.round(g.width*h);k=Math.round(g.height*h)}else{e=g.width;k=g.height}g.resize(e,k);return g.encode(d,{quality:j/100})}b.runtimes.Gears=b.addRuntime("gears",{init:function(g,i){var h;if(!window.google||!google.gears){return i({success:false})}try{h=google.gears.factory.create("beta.desktop")}catch(f){return i({success:false})}function d(k){var j,e,l=[],m;for(e=0;e<k.length;e++){j=k[e];m=b.guid();c[m]=j.blob;l.push(new b.File(m,j.name,j.blob.length))}g.trigger("FilesAdded",l)}g.bind("PostInit",function(){var j=g.settings,e=document.getElementById(j.drop_element);if(e){b.addEvent(e,"dragover",function(k){h.setDropEffect(k,"copy");k.preventDefault()});b.addEvent(e,"drop",function(l){var k=h.getDragData(l,"application/x-gears-files");if(k){d(k.files)}l.preventDefault()});e=0}b.addEvent(document.getElementById(j.browse_button),"click",function(o){var n=[],l,k,m;o.preventDefault();for(l=0;l<j.filters.length;l++){m=j.filters[l].extensions.split(",");for(k=0;k<m.length;k++){n.push("."+m[k])}}h.openFiles(d,{singleFile:!j.multi_selection,filter:n})})});g.bind("UploadFile",function(o,l){var q=0,p,m,n=0,k=o.settings.resize,e;m=o.settings.chunk_size;e=m>0;p=Math.ceil(l.size/m);if(!e){m=l.size;p=1}if(k&&/\.(png|jpg|jpeg)$/i.test(l.name)){c[l.id]=a(c[l.id],k.width,k.height,k.quality||90,/\.png$/i.test(l.name)?"image/png":"image/jpeg")}l.size=c[l.id].length;function j(){var u,w,s=o.settings.multipart,r=0,v={name:l.target_name||l.name};function t(y){var x,C="----pluploadboundary"+b.guid(),A="--",B="\r\n",z;if(s){u.setRequestHeader("Content-Type","multipart/form-data; boundary="+C);x=google.gears.factory.create("beta.blobbuilder");b.each(o.settings.multipart_params,function(E,D){x.append(A+C+B+'Content-Disposition: form-data; name="'+D+'"'+B+B);x.append(E+B)});x.append(A+C+B+'Content-Disposition: form-data; name="'+o.settings.file_data_name+'"; filename="'+l.name+'"'+B+"Content-Type: application/octet-stream"+B+B);x.append(y);x.append(B+A+C+A+B);z=x.getAsBlob();r=z.length-y.length;y=z}u.send(y)}if(l.status==b.DONE||l.status==b.FAILED||o.state==b.STOPPED){return}if(e){v.chunk=q;v.chunks=p}w=Math.min(m,l.size-(q*m));u=google.gears.factory.create("beta.httprequest");u.open("POST",b.buildUrl(o.settings.url,v));if(!s){u.setRequestHeader("Content-Disposition",'attachment; filename="'+l.name+'"');u.setRequestHeader("Content-Type","application/octet-stream")}b.each(o.settings.headers,function(y,x){u.setRequestHeader(x,y)});u.upload.onprogress=function(x){l.loaded=n+x.loaded-r;o.trigger("UploadProgress",l)};u.onreadystatechange=function(){var x;if(u.readyState==4){if(u.status==200){x={chunk:q,chunks:p,response:u.responseText,status:u.status};o.trigger("ChunkUploaded",l,x);if(x.cancelled){l.status=b.FAILED;return}n+=w;if(++q>=p){l.status=b.DONE;o.trigger("FileUploaded",l,{response:u.responseText,status:u.status})}else{j()}}else{o.trigger("Error",{code:b.HTTP_ERROR,message:"HTTP Error.",file:l,chunk:q,chunks:p,status:u.status})}}};if(q<p){t(c[l.id].slice(q*m,w))}}j()});g.features={dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true};i({success:true})}})})(plupload);(function(c){var a={};function b(l){var k,j=typeof l,h,e,g,f;if(j==="string"){k="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+l.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(n,m){var i=k.indexOf(m);if(i+1){return"\\"+k.charAt(i+1)}n=m.charCodeAt().toString(16);return"\\u"+"0000".substring(n.length)+n})+'"'}if(j=="object"){e=l.length!==h;k="";if(e){for(g=0;g<l.length;g++){if(k){k+=","}k+=b(l[g])}k="["+k+"]"}else{for(f in l){if(l.hasOwnProperty(f)){if(k){k+=","}k+=b(f)+":"+b(l[f])}}k="{"+k+"}"}return k}if(l===h){return"null"}return""+l}function d(o){var r=false,f=null,k=null,g,h,i,q,j,m=0;try{try{k=new ActiveXObject("AgControl.AgControl");if(k.IsVersionSupported(o)){r=true}k=null}catch(n){var l=navigator.plugins["Silverlight Plug-In"];if(l){g=l.description;if(g==="1.0.30226.2"){g="2.0.30226.2"}h=g.split(".");while(h.length>3){h.pop()}while(h.length<4){h.push(0)}i=o.split(".");while(i.length>4){i.pop()}do{q=parseInt(i[m],10);j=parseInt(h[m],10);m++}while(m<i.length&&q===j);if(q<=j&&!isNaN(q)){r=true}}}}catch(p){r=false}return r}c.silverlight={trigger:function(j,f){var h=a[j],g,e;if(h){e=c.toArray(arguments).slice(1);e[0]="Silverlight:"+f;setTimeout(function(){h.trigger.apply(h,e)},0)}}};c.runtimes.Silverlight=c.addRuntime("silverlight",{init:function(l,m){var k,h="",j=l.settings.filters,g,f=document.body;if(!d("2.0.31005.0")||(window.opera&&window.opera.buildNumber)){m({success:false});return}a[l.id]=l;k=document.createElement("div");k.id=l.id+"_silverlight_container";c.extend(k.style,{position:"absolute",top:"0px",background:l.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100px",height:"100px",overflow:"hidden",opacity:l.settings.shim_bgcolor?"":0.01});k.className="plupload silverlight";if(l.settings.container){f=document.getElementById(l.settings.container);f.style.position="relative"}f.appendChild(k);for(g=0;g<j.length;g++){h+=(h!=""?"|":"")+j[g].title+" | *."+j[g].extensions.replace(/,/g,";*.")}k.innerHTML='<object id="'+l.id+'_silverlight" data="data:application/x-silverlight," type="application/x-silverlight-2" style="outline:none;" width="1024" height="1024"><param name="source" value="'+l.settings.silverlight_xap_url+'"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="initParams" value="id='+l.id+",filter="+h+'"/></object>';function e(){return document.getElementById(l.id+"_silverlight").content.Upload}l.bind("Silverlight:Init",function(){var i,n={};l.bind("Silverlight:StartSelectFiles",function(o){i=[]});l.bind("Silverlight:SelectFile",function(o,r,p,q){var s;s=c.guid();n[s]=r;n[r]=s;i.push(new c.File(s,p,q))});l.bind("Silverlight:SelectSuccessful",function(){if(i.length){l.trigger("FilesAdded",i)}});l.bind("Silverlight:UploadChunkError",function(o,r,p,s,q){l.trigger("Error",{code:c.IO_ERROR,message:"IO Error.",details:q,file:o.getFile(n[r])})});l.bind("Silverlight:UploadFileProgress",function(o,s,p,r){var q=o.getFile(n[s]);if(q.status!=c.FAILED){q.size=r;q.loaded=p;o.trigger("UploadProgress",q)}});l.bind("Refresh",function(o){var p,q,r;p=document.getElementById(o.settings.browse_button);q=c.getPos(p,document.getElementById(o.settings.container));r=c.getSize(p);c.extend(document.getElementById(o.id+"_silverlight_container").style,{top:q.y+"px",left:q.x+"px",width:r.w+"px",height:r.h+"px"})});l.bind("Silverlight:UploadChunkSuccessful",function(o,r,p,u,t){var s,q=o.getFile(n[r]);s={chunk:p,chunks:u,response:t};o.trigger("ChunkUploaded",q,s);if(q.status!=c.FAILED){e().UploadNextChunk()}if(p==u-1){q.status=c.DONE;o.trigger("FileUploaded",q,{response:t})}});l.bind("Silverlight:UploadSuccessful",function(o,r,p){var q=o.getFile(n[r]);q.status=c.DONE;o.trigger("FileUploaded",q,{response:p})});l.bind("FilesRemoved",function(o,q){var p;for(p=0;p<q.length;p++){e().RemoveFile(n[q[p].id])}});l.bind("UploadFile",function(o,q){var r=o.settings,p=r.resize||{};e().UploadFile(n[q.id],c.buildUrl(o.settings.url,{name:q.target_name||q.name}),b({chunk_size:r.chunk_size,image_width:p.width,image_height:p.height,image_quality:p.quality||90,multipart:!!r.multipart,multipart_params:r.multipart_params||{},headers:r.headers}))});l.features={jpgresize:true,pngresize:true,chunks:true,progress:true};m({success:true})})}})})(plupload);(function(c){var a={};function b(){var d;try{d=navigator.plugins["Shockwave Flash"];d=d.description}catch(f){try{d=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(e){d="0.0"}}d=d.match(/\d+/g);return parseFloat(d[0]+"."+d[1])}c.flash={trigger:function(f,d,e){setTimeout(function(){var j=a[f],h,g;if(j){j.trigger("Flash:"+d,e)}},0)}};c.runtimes.Flash=c.addRuntime("flash",{init:function(g,l){var k,f,h,e,m=0,d=document.body;if(b()<10){l({success:false});return}a[g.id]=g;k=document.getElementById(g.settings.browse_button);f=document.createElement("div");f.id=g.id+"_flash_container";c.extend(f.style,{position:"absolute",top:"0px",background:g.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100%",height:"100%"});f.className="plupload flash";if(g.settings.container){d=document.getElementById(g.settings.container);d.style.position="relative"}d.appendChild(f);h="id="+escape(g.id);f.innerHTML='<object id="'+g.id+'_flash" width="100%" height="100%" style="outline:0" type="application/x-shockwave-flash" data="'+g.settings.flash_swf_url+'"><param name="movie" value="'+g.settings.flash_swf_url+'" /><param name="flashvars" value="'+h+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>';function j(){return document.getElementById(g.id+"_flash")}function i(){if(m++>5000){l({success:false});return}if(!e){setTimeout(i,1)}}i();k=f=null;g.bind("Flash:Init",function(){var p={},o,n=g.settings.resize||{};e=true;j().setFileFilters(g.settings.filters,g.settings.multi_selection);g.bind("UploadFile",function(q,r){var s=q.settings;j().uploadFile(p[r.id],c.buildUrl(s.url,{name:r.target_name||r.name}),{chunk_size:s.chunk_size,width:n.width,height:n.height,quality:n.quality||90,multipart:s.multipart,multipart_params:s.multipart_params,file_data_name:s.file_data_name,format:/\.(jpg|jpeg)$/i.test(r.name)?"jpg":"png",headers:s.headers})});g.bind("Flash:UploadProcess",function(r,q){var s=r.getFile(p[q.id]);if(s.status!=c.FAILED){s.loaded=q.loaded;s.size=q.size;r.trigger("UploadProgress",s)}});g.bind("Flash:UploadChunkComplete",function(q,s){var t,r=q.getFile(p[s.id]);t={chunk:s.chunk,chunks:s.chunks,response:s.text};q.trigger("ChunkUploaded",r,t);if(r.status!=c.FAILED){j().uploadNextChunk()}if(s.chunk==s.chunks-1){r.status=c.DONE;q.trigger("FileUploaded",r,{response:s.text})}});g.bind("Flash:SelectFiles",function(q,t){var s,r,u=[],v;for(r=0;r<t.length;r++){s=t[r];v=c.guid();p[v]=s.id;p[s.id]=v;u.push(new c.File(v,s.name,s.size))}if(u.length){g.trigger("FilesAdded",u)}});g.bind("Flash:SecurityError",function(q,r){g.trigger("Error",{code:c.SECURITY_ERROR,message:"Security error.",details:r.message,file:g.getFile(p[r.id])})});g.bind("Flash:GenericError",function(q,r){g.trigger("Error",{code:c.GENERIC_ERROR,message:"Generic error.",details:r.message,file:g.getFile(p[r.id])})});g.bind("Flash:IOError",function(q,r){g.trigger("Error",{code:c.IO_ERROR,message:"IO error.",details:r.message,file:g.getFile(p[r.id])})});g.bind("QueueChanged",function(q){g.refresh()});g.bind("FilesRemoved",function(q,s){var r;for(r=0;r<s.length;r++){j().removeFile(p[s[r].id])}});g.bind("StateChanged",function(q){g.refresh()});g.bind("Refresh",function(q){var r,s,t;j().setFileFilters(g.settings.filters,g.settings.multi_selection);r=document.getElementById(q.settings.browse_button);s=c.getPos(r,document.getElementById(q.settings.container));t=c.getSize(r);c.extend(document.getElementById(q.id+"_flash_container").style,{top:s.y+"px",left:s.x+"px",width:t.w+"px",height:t.h+"px"})});g.features={jpgresize:true,pngresize:true,chunks:true,progress:true};l({success:true})})}})})(plupload);(function(a){a.runtimes.BrowserPlus=a.addRuntime("browserplus",{init:function(g,i){var e=window.BrowserPlus,h={},d=g.settings,c=d.resize;function f(n){var m,l,j=[],k,o;for(l=0;l<n.length;l++){k=n[l];o=a.guid();h[o]=k;j.push(new a.File(o,k.name,k.size))}if(l){g.trigger("FilesAdded",j)}}function b(){g.bind("PostInit",function(){var m,k=d.drop_element,o=g.id+"_droptarget",j=document.getElementById(k),l;function p(r,q){e.DragAndDrop.AddDropTarget({id:r},function(s){e.DragAndDrop.AttachCallbacks({id:r,hover:function(t){if(!t&&q){q()}},drop:function(t){if(q){q()}f(t)}},function(){})})}function n(){document.getElementById(o).style.top="-1000px"}if(j){if(document.attachEvent&&(/MSIE/gi).test(navigator.userAgent)){m=document.createElement("div");m.setAttribute("id",o);a.extend(m.style,{position:"absolute",top:"-1000px",background:"red",filter:"alpha(opacity=0)",opacity:0});document.body.appendChild(m);a.addEvent(j,"dragenter",function(r){var q,s;q=document.getElementById(k);s=a.getPos(q);a.extend(document.getElementById(o).style,{top:s.y+"px",left:s.x+"px",width:q.offsetWidth+"px",height:q.offsetHeight+"px"})});p(o,n)}else{p(k)}}a.addEvent(document.getElementById(d.browse_button),"click",function(v){var t=[],r,q,u=d.filters,s;v.preventDefault();for(r=0;r<u.length;r++){s=u[r].extensions.split(",");for(q=0;q<s.length;q++){t.push(a.mimeTypes[s[q]])}}e.FileBrowse.OpenBrowseDialog({mimeTypes:t},function(w){if(w.success){f(w.value)}})});j=m=null});g.bind("UploadFile",function(n,k){var m=h[k.id],j={},l=n.settings.chunk_size,o,p=[];function r(s,u){var t;if(k.status==a.FAILED){return}j.name=k.target_name||k.name;if(l){j.chunk=s;j.chunks=u}t=p.shift();e.Uploader.upload({url:a.buildUrl(n.settings.url,j),files:{file:t},cookies:document.cookies,postvars:n.settings.multipart_params,progressCallback:function(x){var w,v=0;o[s]=parseInt(x.filePercent*t.size/100,10);for(w=0;w<o.length;w++){v+=o[w]}k.loaded=v;n.trigger("UploadProgress",k)}},function(w){var v,x;if(w.success){v=w.value.statusCode;if(l){n.trigger("ChunkUploaded",k,{chunk:s,chunks:u,response:w.value.body,status:v})}if(p.length>0){r(++s,u)}else{k.status=a.DONE;n.trigger("FileUploaded",k,{response:w.value.body,status:v});if(v>=400){n.trigger("Error",{code:a.HTTP_ERROR,message:"HTTP Error.",file:k,status:v})}}}else{n.trigger("Error",{code:a.GENERIC_ERROR,message:"Generic Error.",file:k,details:w.error})}})}function q(s){k.size=s.size;if(l){e.FileAccess.chunk({file:s,chunkSize:l},function(v){if(v.success){var w=v.value,t=w.length;o=Array(t);for(var u=0;u<t;u++){o[u]=0;p.push(w[u])}r(0,t)}})}else{o=Array(1);p.push(s);r(0,1)}}if(c&&/\.(png|jpg|jpeg)$/i.test(k.name)){BrowserPlus.ImageAlter.transform({file:m,quality:c.quality||90,actions:[{scale:{maxwidth:c.width,maxheight:c.height}}]},function(s){if(s.success){q(s.value.file)}})}else{q(m)}});g.features={dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true};i({success:true})}if(e){e.init(function(k){var j=[{service:"Uploader",version:"3"},{service:"DragAndDrop",version:"1"},{service:"FileBrowse",version:"1"},{service:"FileAccess",version:"2"}];if(c){j.push({service:"ImageAlter",version:"4"})}if(k.success){e.require({services:j},function(l){if(l.success){b()}else{i()}})}else{i()}})}else{i()}}})})(plupload);(function(b){function a(i,l,j,c,k){var e,d,h,g,f;e=document.createElement("canvas");e.style.display="none";document.body.appendChild(e);d=e.getContext("2d");h=new Image();h.onload=function(){var o,m,n;f=Math.min(l/h.width,j/h.height);if(f<1){o=Math.round(h.width*f);m=Math.round(h.height*f)}else{o=h.width;m=h.height}e.width=o;e.height=m;d.drawImage(h,0,0,o,m);g=e.toDataURL(c);g=g.substring(g.indexOf("base64,")+7);g=atob(g);e.parentNode.removeChild(e);k({success:true,data:g})};h.src=i}b.runtimes.Html5=b.addRuntime("html5",{init:function(g,i){var c={},d,h;function f(m){var k,j,l=[],n;for(j=0;j<m.length;j++){k=m[j];n=b.guid();c[n]=k;l.push(new b.File(n,k.fileName,k.fileSize))}if(l.length){g.trigger("FilesAdded",l)}}function e(){var j;if(window.XMLHttpRequest){j=new XMLHttpRequest();h=!!j.upload;return !!(j.sendAsBinary||j.upload)}return false}if(!e()){i({success:false});return}g.bind("Init",function(n){var r,p=[],m,q,k=n.settings.filters,l,o,j=document.body;r=document.createElement("div");r.id=n.id+"_html5_container";for(m=0;m<k.length;m++){l=k[m].extensions.split(/,/);for(q=0;q<l.length;q++){o=b.mimeTypes[l[q]];if(o){p.push(o)}}}b.extend(r.style,{position:"absolute",background:g.settings.shim_bgcolor||"transparent",width:"100px",height:"100px",overflow:"hidden",zIndex:99999,opacity:g.settings.shim_bgcolor?"":0});r.className="plupload html5";if(g.settings.container){j=document.getElementById(g.settings.container);j.style.position="relative"}j.appendChild(r);r.innerHTML='<input id="'+g.id+'_html5" style="width:100%;" type="file" accept="'+p.join(",")+'" '+(g.settings.multi_selection?'multiple="multiple"':"")+" />";document.getElementById(g.id+"_html5").onchange=function(){f(this.files);this.value=""}});g.bind("PostInit",function(){var j=document.getElementById(g.settings.drop_element);if(j){b.addEvent(j,"dragover",function(k){k.preventDefault()});b.addEvent(j,"drop",function(l){var k=l.dataTransfer;if(k&&k.files){f(k.files)}l.preventDefault()})}});g.bind("Refresh",function(j){var k,l,m;k=document.getElementById(g.settings.browse_button);l=b.getPos(k,document.getElementById(j.settings.container));m=b.getSize(k);b.extend(document.getElementById(g.id+"_html5_container").style,{top:l.y+"px",left:l.x+"px",width:m.w+"px",height:m.h+"px"})});g.bind("UploadFile",function(j,m){var q=new XMLHttpRequest(),l=q.upload,k=j.settings.resize,p,o=0;function n(r){var v="----pluploadboundary"+b.guid(),t="--",u="\r\n",s="";if(j.settings.multipart){q.setRequestHeader("Content-Type","multipart/form-data; boundary="+v);b.each(j.settings.multipart_params,function(x,w){s+=t+v+u+'Content-Disposition: form-data; name="'+w+'"'+u+u;s+=x+u});s+=t+v+u+'Content-Disposition: form-data; name="'+j.settings.file_data_name+'"; filename="'+m.name+'"'+u+"Content-Type: application/octet-stream"+u+u+r+u+t+v+t+u;o=s.length-r.length;r=s}q.sendAsBinary(r)}if(m.status==b.DONE||m.status==b.FAILED||j.state==b.STOPPED){return}if(l){l.onprogress=function(r){m.loaded=r.loaded-o;j.trigger("UploadProgress",m)}}q.onreadystatechange=function(){var r;if(q.readyState==4){try{r=q.status}catch(s){r=0}m.status=b.DONE;m.loaded=m.size;j.trigger("UploadProgress",m);j.trigger("FileUploaded",m,{response:q.responseText,status:r});if(r>=400){j.trigger("Error",{code:b.HTTP_ERROR,message:"HTTP Error.",file:m,status:r})}}};q.open("post",b.buildUrl(j.settings.url,{name:m.target_name||m.name}),true);q.setRequestHeader("Content-Type","application/octet-stream");b.each(j.settings.headers,function(s,r){q.setRequestHeader(r,s)});p=c[m.id];if(q.sendAsBinary){if(k&&/\.(png|jpg|jpeg)$/i.test(m.name)){a(p.getAsDataURL(),k.width,k.height,/\.png$/i.test(m.name)?"image/png":"image/jpeg",function(r){if(r.success){m.size=r.data.length;n(r.data)}else{n(p.getAsBinary())}})}else{n(p.getAsBinary())}}else{q.send(p)}});d=!!(File&&File.prototype.getAsDataURL);g.features={dragdrop:window.mozInnerScreenX!==undefined,jpgresize:d,pngresize:d,progress:h};i({success:true})}})})(plupload);(function(a){a.runtimes.Html4=a.addRuntime("html4",{init:function(f,g){var d={},c,b;function e(l){var k,j,m=[],n,h;h=l.value.replace(/\\/g,"/");h=h.substring(h.length,h.lastIndexOf("/")+1);n=a.guid();k=new a.File(n,h);d[n]=k;k.input=l;m.push(k);if(m.length){f.trigger("FilesAdded",m)}}f.bind("Init",function(p){var h,x,v,t=[],o,u,m=p.settings.filters,l,s,r=/MSIE/.test(navigator.userAgent),k="javascript",w,j=document.body,n;if(f.settings.container){j=document.getElementById(f.settings.container);j.style.position="relative"}c=(typeof p.settings.form=="string")?document.getElementById(p.settings.form):p.settings.form;if(!c){n=document.getElementById(f.settings.browse_button);for(;n;n=n.parentNode){if(n.nodeName=="FORM"){c=n}}}if(!c){c=document.createElement("form");c.style.display="inline";n=document.getElementById(f.settings.container);n.parentNode.insertBefore(c,n);c.appendChild(n)}c.setAttribute("method","post");c.setAttribute("enctype","multipart/form-data");a.each(p.settings.multipart_params,function(z,y){var i=document.createElement("input");a.extend(i,{type:"hidden",name:y,value:z});c.appendChild(i)});b=document.createElement("iframe");b.setAttribute("src",k+':""');b.setAttribute("name",p.id+"_iframe");b.setAttribute("id",p.id+"_iframe");b.style.display="none";a.addEvent(b,"load",function(B){var C=B.target,z=f.currentfile,A;try{A=C.contentWindow.document||C.contentDocument||window.frames[C.id].document}catch(y){p.trigger("Error",{code:a.SECURITY_ERROR,message:"Security error.",file:z});return}if(A.location.href=="about:blank"||!z){return}var i=A.documentElement.innerText||A.documentElement.textContent;if(i!=""){z.status=a.DONE;z.loaded=1025;z.percent=100;if(z.input){z.input.removeAttribute("name")}p.trigger("UploadProgress",z);p.trigger("FileUploaded",z,{response:i});if(c.tmpAction){c.setAttribute("action",c.tmpAction)}if(c.tmpTarget){c.setAttribute("target",c.tmpTarget)}}});c.appendChild(b);if(r){window.frames[b.id].name=b.name}x=document.createElement("div");x.id=p.id+"_iframe_container";for(o=0;o<m.length;o++){l=m[o].extensions.split(/,/);for(u=0;u<l.length;u++){s=a.mimeTypes[l[u]];if(s){t.push(s)}}}a.extend(x.style,{position:"absolute",background:"transparent",width:"100px",height:"100px",overflow:"hidden",zIndex:99999,opacity:0});w=f.settings.shim_bgcolor;if(w){a.extend(x.style,{background:w,opacity:1})}x.className="plupload_iframe";j.appendChild(x);function q(){v=document.createElement("input");v.setAttribute("type","file");v.setAttribute("accept",t.join(","));v.setAttribute("size",1);a.extend(v.style,{width:"100%",height:"100%",opacity:0});if(r){a.extend(v.style,{filter:"alpha(opacity=0)"})}a.addEvent(v,"change",function(i){var y=i.target;if(y.value){q();y.style.display="none";e(y)}});x.appendChild(v);return true}q()});f.bind("Refresh",function(h){var i,j,k;i=document.getElementById(f.settings.browse_button);j=a.getPos(i,document.getElementById(h.settings.container));k=a.getSize(i);a.extend(document.getElementById(f.id+"_iframe_container").style,{top:j.y+"px",left:j.x+"px",width:k.w+"px",height:k.h+"px"})});f.bind("UploadFile",function(h,i){if(i.status==a.DONE||i.status==a.FAILED||h.state==a.STOPPED){return}if(!i.input){i.status=a.ERROR;return}i.input.setAttribute("name",h.settings.file_data_name);c.tmpAction=c.getAttribute("action");c.setAttribute("action",a.buildUrl(h.settings.url,{name:i.target_name||i.name}));c.tmpTarget=c.getAttribute("target");c.setAttribute("target",b.name);this.currentfile=i;c.submit()});f.bind("FilesRemoved",function(h,k){var j,l;for(j=0;j<k.length;j++){l=k[j].input;if(l){l.parentNode.removeChild(l)}}});f.features={};g({success:true})}})})(plupload);
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.gears.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.gears.min.js
new file mode 100644 (file)
index 0000000..3cf5ed6
--- /dev/null
@@ -0,0 +1 @@
+(function(b){var c={};function a(i,e,k,j,d){var l,g,f,h;g=google.gears.factory.create("beta.canvas");g.decode(i);h=Math.min(e/g.width,k/g.height);if(h<1){e=Math.round(g.width*h);k=Math.round(g.height*h)}else{e=g.width;k=g.height}g.resize(e,k);return g.encode(d,{quality:j/100})}b.runtimes.Gears=b.addRuntime("gears",{init:function(g,i){var h;if(!window.google||!google.gears){return i({success:false})}try{h=google.gears.factory.create("beta.desktop")}catch(f){return i({success:false})}function d(k){var j,e,l=[],m;for(e=0;e<k.length;e++){j=k[e];m=b.guid();c[m]=j.blob;l.push(new b.File(m,j.name,j.blob.length))}g.trigger("FilesAdded",l)}g.bind("PostInit",function(){var j=g.settings,e=document.getElementById(j.drop_element);if(e){b.addEvent(e,"dragover",function(k){h.setDropEffect(k,"copy");k.preventDefault()});b.addEvent(e,"drop",function(l){var k=h.getDragData(l,"application/x-gears-files");if(k){d(k.files)}l.preventDefault()});e=0}b.addEvent(document.getElementById(j.browse_button),"click",function(o){var n=[],l,k,m;o.preventDefault();for(l=0;l<j.filters.length;l++){m=j.filters[l].extensions.split(",");for(k=0;k<m.length;k++){n.push("."+m[k])}}h.openFiles(d,{singleFile:!j.multi_selection,filter:n})})});g.bind("UploadFile",function(o,l){var q=0,p,m,n=0,k=o.settings.resize,e;m=o.settings.chunk_size;e=m>0;p=Math.ceil(l.size/m);if(!e){m=l.size;p=1}if(k&&/\.(png|jpg|jpeg)$/i.test(l.name)){c[l.id]=a(c[l.id],k.width,k.height,k.quality||90,/\.png$/i.test(l.name)?"image/png":"image/jpeg")}l.size=c[l.id].length;function j(){var u,w,s=o.settings.multipart,r=0,v={name:l.target_name||l.name};function t(y){var x,C="----pluploadboundary"+b.guid(),A="--",B="\r\n",z;if(s){u.setRequestHeader("Content-Type","multipart/form-data; boundary="+C);x=google.gears.factory.create("beta.blobbuilder");b.each(o.settings.multipart_params,function(E,D){x.append(A+C+B+'Content-Disposition: form-data; name="'+D+'"'+B+B);x.append(E+B)});x.append(A+C+B+'Content-Disposition: form-data; name="'+o.settings.file_data_name+'"; filename="'+l.name+'"'+B+"Content-Type: application/octet-stream"+B+B);x.append(y);x.append(B+A+C+A+B);z=x.getAsBlob();r=z.length-y.length;y=z}u.send(y)}if(l.status==b.DONE||l.status==b.FAILED||o.state==b.STOPPED){return}if(e){v.chunk=q;v.chunks=p}w=Math.min(m,l.size-(q*m));u=google.gears.factory.create("beta.httprequest");u.open("POST",b.buildUrl(o.settings.url,v));if(!s){u.setRequestHeader("Content-Disposition",'attachment; filename="'+l.name+'"');u.setRequestHeader("Content-Type","application/octet-stream")}b.each(o.settings.headers,function(y,x){u.setRequestHeader(x,y)});u.upload.onprogress=function(x){l.loaded=n+x.loaded-r;o.trigger("UploadProgress",l)};u.onreadystatechange=function(){var x;if(u.readyState==4){if(u.status==200){x={chunk:q,chunks:p,response:u.responseText,status:u.status};o.trigger("ChunkUploaded",l,x);if(x.cancelled){l.status=b.FAILED;return}n+=w;if(++q>=p){l.status=b.DONE;o.trigger("FileUploaded",l,{response:u.responseText,status:u.status})}else{j()}}else{o.trigger("Error",{code:b.HTTP_ERROR,message:"HTTP Error.",file:l,chunk:q,chunks:p,status:u.status})}}};if(q<p){t(c[l.id].slice(q*m,w))}}j()});g.features={dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true};i({success:true})}})})(plupload);
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.html4.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.html4.min.js
new file mode 100644 (file)
index 0000000..ab2bfdc
--- /dev/null
@@ -0,0 +1 @@
+(function(a){a.runtimes.Html4=a.addRuntime("html4",{init:function(f,g){var d={},c,b;function e(l){var k,j,m=[],n,h;h=l.value.replace(/\\/g,"/");h=h.substring(h.length,h.lastIndexOf("/")+1);n=a.guid();k=new a.File(n,h);d[n]=k;k.input=l;m.push(k);if(m.length){f.trigger("FilesAdded",m)}}f.bind("Init",function(p){var h,x,v,t=[],o,u,m=p.settings.filters,l,s,r=/MSIE/.test(navigator.userAgent),k="javascript",w,j=document.body,n;if(f.settings.container){j=document.getElementById(f.settings.container);j.style.position="relative"}c=(typeof p.settings.form=="string")?document.getElementById(p.settings.form):p.settings.form;if(!c){n=document.getElementById(f.settings.browse_button);for(;n;n=n.parentNode){if(n.nodeName=="FORM"){c=n}}}if(!c){c=document.createElement("form");c.style.display="inline";n=document.getElementById(f.settings.container);n.parentNode.insertBefore(c,n);c.appendChild(n)}c.setAttribute("method","post");c.setAttribute("enctype","multipart/form-data");a.each(p.settings.multipart_params,function(z,y){var i=document.createElement("input");a.extend(i,{type:"hidden",name:y,value:z});c.appendChild(i)});b=document.createElement("iframe");b.setAttribute("src",k+':""');b.setAttribute("name",p.id+"_iframe");b.setAttribute("id",p.id+"_iframe");b.style.display="none";a.addEvent(b,"load",function(B){var C=B.target,z=f.currentfile,A;try{A=C.contentWindow.document||C.contentDocument||window.frames[C.id].document}catch(y){p.trigger("Error",{code:a.SECURITY_ERROR,message:"Security error.",file:z});return}if(A.location.href=="about:blank"||!z){return}var i=A.documentElement.innerText||A.documentElement.textContent;if(i!=""){z.status=a.DONE;z.loaded=1025;z.percent=100;if(z.input){z.input.removeAttribute("name")}p.trigger("UploadProgress",z);p.trigger("FileUploaded",z,{response:i});if(c.tmpAction){c.setAttribute("action",c.tmpAction)}if(c.tmpTarget){c.setAttribute("target",c.tmpTarget)}}});c.appendChild(b);if(r){window.frames[b.id].name=b.name}x=document.createElement("div");x.id=p.id+"_iframe_container";for(o=0;o<m.length;o++){l=m[o].extensions.split(/,/);for(u=0;u<l.length;u++){s=a.mimeTypes[l[u]];if(s){t.push(s)}}}a.extend(x.style,{position:"absolute",background:"transparent",width:"100px",height:"100px",overflow:"hidden",zIndex:99999,opacity:0});w=f.settings.shim_bgcolor;if(w){a.extend(x.style,{background:w,opacity:1})}x.className="plupload_iframe";j.appendChild(x);function q(){v=document.createElement("input");v.setAttribute("type","file");v.setAttribute("accept",t.join(","));v.setAttribute("size",1);a.extend(v.style,{width:"100%",height:"100%",opacity:0});if(r){a.extend(v.style,{filter:"alpha(opacity=0)"})}a.addEvent(v,"change",function(i){var y=i.target;if(y.value){q();y.style.display="none";e(y)}});x.appendChild(v);return true}q()});f.bind("Refresh",function(h){var i,j,k;i=document.getElementById(f.settings.browse_button);j=a.getPos(i,document.getElementById(h.settings.container));k=a.getSize(i);a.extend(document.getElementById(f.id+"_iframe_container").style,{top:j.y+"px",left:j.x+"px",width:k.w+"px",height:k.h+"px"})});f.bind("UploadFile",function(h,i){if(i.status==a.DONE||i.status==a.FAILED||h.state==a.STOPPED){return}if(!i.input){i.status=a.ERROR;return}i.input.setAttribute("name",h.settings.file_data_name);c.tmpAction=c.getAttribute("action");c.setAttribute("action",a.buildUrl(h.settings.url,{name:i.target_name||i.name}));c.tmpTarget=c.getAttribute("target");c.setAttribute("target",b.name);this.currentfile=i;c.submit()});f.bind("FilesRemoved",function(h,k){var j,l;for(j=0;j<k.length;j++){l=k[j].input;if(l){l.parentNode.removeChild(l)}}});f.features={};g({success:true})}})})(plupload);
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.html5.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.html5.min.js
new file mode 100644 (file)
index 0000000..8e55ad5
--- /dev/null
@@ -0,0 +1 @@
+(function(b){function a(i,l,j,c,k){var e,d,h,g,f;e=document.createElement("canvas");e.style.display="none";document.body.appendChild(e);d=e.getContext("2d");h=new Image();h.onload=function(){var o,m,n;f=Math.min(l/h.width,j/h.height);if(f<1){o=Math.round(h.width*f);m=Math.round(h.height*f)}else{o=h.width;m=h.height}e.width=o;e.height=m;d.drawImage(h,0,0,o,m);g=e.toDataURL(c);g=g.substring(g.indexOf("base64,")+7);g=atob(g);e.parentNode.removeChild(e);k({success:true,data:g})};h.src=i}b.runtimes.Html5=b.addRuntime("html5",{init:function(g,i){var c={},d,h;function f(m){var k,j,l=[],n;for(j=0;j<m.length;j++){k=m[j];n=b.guid();c[n]=k;l.push(new b.File(n,k.fileName,k.fileSize))}if(l.length){g.trigger("FilesAdded",l)}}function e(){var j;if(window.XMLHttpRequest){j=new XMLHttpRequest();h=!!j.upload;return !!(j.sendAsBinary||j.upload)}return false}if(!e()){i({success:false});return}g.bind("Init",function(n){var r,p=[],m,q,k=n.settings.filters,l,o,j=document.body;r=document.createElement("div");r.id=n.id+"_html5_container";for(m=0;m<k.length;m++){l=k[m].extensions.split(/,/);for(q=0;q<l.length;q++){o=b.mimeTypes[l[q]];if(o){p.push(o)}}}b.extend(r.style,{position:"absolute",background:g.settings.shim_bgcolor||"transparent",width:"100px",height:"100px",overflow:"hidden",zIndex:99999,opacity:g.settings.shim_bgcolor?"":0});r.className="plupload html5";if(g.settings.container){j=document.getElementById(g.settings.container);j.style.position="relative"}j.appendChild(r);r.innerHTML='<input id="'+g.id+'_html5" style="width:100%;" type="file" accept="'+p.join(",")+'" '+(g.settings.multi_selection?'multiple="multiple"':"")+" />";document.getElementById(g.id+"_html5").onchange=function(){f(this.files);this.value=""}});g.bind("PostInit",function(){var j=document.getElementById(g.settings.drop_element);if(j){b.addEvent(j,"dragover",function(k){k.preventDefault()});b.addEvent(j,"drop",function(l){var k=l.dataTransfer;if(k&&k.files){f(k.files)}l.preventDefault()})}});g.bind("Refresh",function(j){var k,l,m;k=document.getElementById(g.settings.browse_button);l=b.getPos(k,document.getElementById(j.settings.container));m=b.getSize(k);b.extend(document.getElementById(g.id+"_html5_container").style,{top:l.y+"px",left:l.x+"px",width:m.w+"px",height:m.h+"px"})});g.bind("UploadFile",function(j,m){var q=new XMLHttpRequest(),l=q.upload,k=j.settings.resize,p,o=0;function n(r){var v="----pluploadboundary"+b.guid(),t="--",u="\r\n",s="";if(j.settings.multipart){q.setRequestHeader("Content-Type","multipart/form-data; boundary="+v);b.each(j.settings.multipart_params,function(x,w){s+=t+v+u+'Content-Disposition: form-data; name="'+w+'"'+u+u;s+=x+u});s+=t+v+u+'Content-Disposition: form-data; name="'+j.settings.file_data_name+'"; filename="'+m.name+'"'+u+"Content-Type: application/octet-stream"+u+u+r+u+t+v+t+u;o=s.length-r.length;r=s}q.sendAsBinary(r)}if(m.status==b.DONE||m.status==b.FAILED||j.state==b.STOPPED){return}if(l){l.onprogress=function(r){m.loaded=r.loaded-o;j.trigger("UploadProgress",m)}}q.onreadystatechange=function(){var r;if(q.readyState==4){try{r=q.status}catch(s){r=0}m.status=b.DONE;m.loaded=m.size;j.trigger("UploadProgress",m);j.trigger("FileUploaded",m,{response:q.responseText,status:r});if(r>=400){j.trigger("Error",{code:b.HTTP_ERROR,message:"HTTP Error.",file:m,status:r})}}};q.open("post",b.buildUrl(j.settings.url,{name:m.target_name||m.name}),true);q.setRequestHeader("Content-Type","application/octet-stream");b.each(j.settings.headers,function(s,r){q.setRequestHeader(r,s)});p=c[m.id];if(q.sendAsBinary){if(k&&/\.(png|jpg|jpeg)$/i.test(m.name)){a(p.getAsDataURL(),k.width,k.height,/\.png$/i.test(m.name)?"image/png":"image/jpeg",function(r){if(r.success){m.size=r.data.length;n(r.data)}else{n(p.getAsBinary())}})}else{n(p.getAsBinary())}}else{q.send(p)}});d=!!(File&&File.prototype.getAsDataURL);g.features={dragdrop:window.mozInnerScreenX!==undefined,jpgresize:d,pngresize:d,progress:h};i({success:true})}})})(plupload);
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.min.js
new file mode 100644 (file)
index 0000000..4653c66
--- /dev/null
@@ -0,0 +1 @@
+(function(){var c=0,h=[],j={},f={},a={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g,b;function e(){this.returnValue=false}function g(){this.cancelBubble=true}(function(k){var l=k.split(/,/),m,o,n;for(m=0;m<l.length;m+=2){n=l[m+1].split(/ /);for(o=0;o<n.length;o++){f[n[o]]=l[m]}}})("application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats,docx pptx xlsx,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,image/bmp,bmp,image/gif,gif,image/jpeg,jpeg jpg jpe,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/html,htm html xhtml,text/rtf,rtf,video/mpeg,mpeg mpg mpe,video/quicktime,qt mov,video/x-flv,flv,video/vnd.rn-realvideo,rv,text/plain,asc txt text diff log,application/octet-stream,exe");var d={STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-700,mimeTypes:f,extend:function(k){d.each(arguments,function(l,m){if(m>0){d.each(l,function(o,n){k[n]=o})}});return k},cleanName:function(k){var l,m;m=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(l=0;l<m.length;l+=2){k=k.replace(m[l],m[l+1])}k=k.replace(/\s+/g,"_");k=k.replace(/[^a-z0-9_\-\.]+/gi,"");return k},addRuntime:function(k,l){l.name=k;h[k]=l;h.push(l);return l},guid:function(){var k=new Date().getTime().toString(32),l;for(l=0;l<5;l++){k+=Math.floor(Math.random()*65535).toString(32)}return(d.guidPrefix||"p")+k+(c++).toString(32)},buildUrl:function(l,k){var m="";d.each(k,function(o,n){m+=(m?"&":"")+encodeURIComponent(n)+"="+encodeURIComponent(o)});if(m){l+=(l.indexOf("?")>0?"&":"?")+m}return l},each:function(n,o){var m,l,k;if(n){m=n.length;if(m===b){for(l in n){if(n.hasOwnProperty(l)){if(o(n[l],l)===false){return}}}}else{for(k=0;k<m;k++){if(o(n[k],k)===false){return}}}}},formatSize:function(k){if(k===b){return d.translate("N/A")}if(k>1048576){return Math.round(k/1048576,1)+" MB"}if(k>1024){return Math.round(k/1024,1)+" KB"}return k+" b"},getPos:function(l,p){var q=0,o=0,s,r=document,m,n;l=l;p=p||r.body;function k(w){var u,v,t=0,z=0;if(w){v=w.getBoundingClientRect();u=r.compatMode==="CSS1Compat"?r.documentElement:r.body;t=v.left+u.scrollLeft;z=v.top+u.scrollTop}return{x:t,y:z}}if(l.getBoundingClientRect&&(navigator.userAgent.indexOf("MSIE")>0&&r.documentMode!==8)){m=k(l);n=k(p);return{x:m.x-n.x,y:m.y-n.y}}s=l;while(s&&s!=p&&s.nodeType){q+=s.offsetLeft||0;o+=s.offsetTop||0;s=s.offsetParent}s=l.parentNode;while(s&&s!=p&&s.nodeType){q-=s.scrollLeft||0;o-=s.scrollTop||0;s=s.parentNode}return{x:q,y:o}},getSize:function(k){return{w:k.clientWidth||k.offsetWidth,h:k.clientHeight||k.offsetHeight}},parseSize:function(k){var l;if(typeof(k)=="string"){k=/^([0-9]+)([mgk]+)$/.exec(k.toLowerCase().replace(/[^0-9mkg]/g,""));l=k[2];k=+k[1];if(l=="g"){k*=1073741824}if(l=="m"){k*=1048576}if(l=="k"){k*=1024}}return k},xmlEncode:function(k){return k?(""+k).replace(i,function(l){return a[l]?"&"+a[l]+";":l}):k},toArray:function(m){var l,k=[];for(l=0;l<m.length;l++){k[l]=m[l]}return k},addI18n:function(k){return d.extend(j,k)},translate:function(k){return j[k]||k},addEvent:function(l,k,m){if(l.attachEvent){l.attachEvent("on"+k,function(){var n=window.event;if(!n.target){n.target=n.srcElement}n.preventDefault=e;n.stopPropagation=g;m(n)})}else{if(l.addEventListener){l.addEventListener(k,m,false)}}}};d.Uploader=function(n){var l={},q,p=[],r,m;q=new d.QueueProgress();n=d.extend({chunk_size:0,max_file_size:"1gb",multi_selection:true,file_data_name:"file",filters:[]},n);function o(){var s;if(this.state==d.STARTED&&r<p.length){s=p[r++];if(s.status==d.QUEUED){this.trigger("UploadFile",s)}else{o.call(this)}}else{this.stop()}}function k(){var t,s;q.reset();for(t=0;t<p.length;t++){s=p[t];if(s.size!==b){q.size+=s.size;q.loaded+=s.loaded}else{q.size=b}if(s.status==d.DONE){q.uploaded++}else{if(s.status==d.FAILED){q.failed++}else{q.queued++}}}if(q.size===b){q.percent=p.length>0?Math.ceil(q.uploaded/p.length*100):0}else{q.bytesPerSec=Math.ceil(q.loaded/((+new Date()-m||1)/1000));q.percent=q.size>0?Math.ceil(q.loaded/q.size*100):0}}d.extend(this,{state:d.STOPPED,features:{},files:p,settings:n,total:q,id:d.guid(),init:function(){var x=this,y,u,t,w=0,v;n.page_url=n.page_url||document.location.pathname.replace(/\/[^\/]+$/g,"/");if(!/^(\w+:\/\/|\/)/.test(n.url)){n.url=n.page_url+n.url}n.chunk_size=d.parseSize(n.chunk_size);n.max_file_size=d.parseSize(n.max_file_size);x.bind("FilesAdded",function(z,C){var B,A,F=0,E,D=n.filters;if(D&&D.length){E={};d.each(D,function(G){d.each(G.extensions.split(/,/),function(H){E[H.toLowerCase()]=true})})}for(B=0;B<C.length;B++){A=C[B];A.loaded=0;A.percent=0;A.status=d.QUEUED;if(E&&!E[A.name.toLowerCase().split(".").slice(-1)]){z.trigger("Error",{code:d.FILE_EXTENSION_ERROR,message:"File extension error.",file:A});continue}if(A.size!==b&&A.size>n.max_file_size){z.trigger("Error",{code:d.FILE_SIZE_ERROR,message:"File size error.",file:A});continue}p.push(A);F++}if(F){x.trigger("QueueChanged");x.refresh()}});if(n.unique_names){x.bind("UploadFile",function(z,A){A.target_name=A.id+".tmp"})}x.bind("UploadProgress",function(z,A){if(A.status==d.QUEUED){A.status=d.UPLOADING}A.percent=A.size>0?Math.ceil(A.loaded/A.size*100):100;k()});x.bind("StateChanged",function(z){if(z.state==d.STARTED){m=(+new Date())}});x.bind("QueueChanged",k);x.bind("Error",function(z,A){if(A.file){A.file.status=d.FAILED;k();window.setTimeout(function(){o.call(x)})}});x.bind("FileUploaded",function(z,A){A.status=d.DONE;z.trigger("UploadProgress",A);o.call(x)});if(n.runtimes){u=[];v=n.runtimes.split(/\s?,\s?/);for(y=0;y<v.length;y++){if(h[v[y]]){u.push(h[v[y]])}}}else{u=h}function s(){var z=u[w++];if(z){z.init(x,function(C){var A,B;if(C&&C.success){A=x.settings.required_features;if(A){A=A.split(",");for(B=0;B<A.length;B++){if(!x.features[A[B]]){s();return}}}x.trigger("Init",{runtime:z.name});x.trigger("PostInit");x.refresh()}else{s()}})}else{x.trigger("Error",{code:d.INIT_ERROR,message:"Init error."})}}s()},refresh:function(){this.trigger("Refresh")},start:function(){if(this.state!=d.STARTED){r=0;this.state=d.STARTED;this.trigger("StateChanged");o.call(this)}},stop:function(){if(this.state!=d.STOPPED){this.state=d.STOPPED;this.trigger("StateChanged")}},getFile:function(t){var s;for(s=p.length-1;s>=0;s--){if(p[s].id===t){return p[s]}}},removeFile:function(t){var s;for(s=p.length-1;s>=0;s--){if(p[s].id===t.id){return this.splice(s,1)[0]}}},splice:function(u,s){var t;t=p.splice(u,s);this.trigger("FilesRemoved",t);this.trigger("QueueChanged");return t},trigger:function(t){var v=l[t.toLowerCase()],u,s;if(v){s=Array.prototype.slice.call(arguments);s[0]=this;for(u=0;u<v.length;u++){if(v[u].func.apply(v[u].scope,s)===false){return false}}}return true},bind:function(s,u,t){var v;s=s.toLowerCase();v=l[s]||[];v.push({func:u,scope:t||this});l[s]=v},unbind:function(s,u){var v=l[s.toLowerCase()],t;if(v){for(t=v.length-1;t>=0;t--){if(v[t].func===u){v.splice(t,1)}}}}})};d.File=function(n,l,m){var k=this;k.id=n;k.name=l;k.size=m;k.loaded=0;k.percent=0;k.status=0};d.Runtime=function(){this.init=function(k,l){}};d.QueueProgress=function(){var k=this;k.size=0;k.loaded=0;k.uploaded=0;k.failed=0;k.queued=0;k.percent=0;k.bytesPerSec=0;k.reset=function(){k.size=k.loaded=k.uploaded=k.failed=k.queued=k.percent=k.bytesPerSec=0}};d.runtimes={};window.plupload=d})();
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.silverlight.min.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.silverlight.min.js
new file mode 100644 (file)
index 0000000..878aa74
--- /dev/null
@@ -0,0 +1 @@
+(function(c){var a={};function b(l){var k,j=typeof l,h,e,g,f;if(j==="string"){k="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+l.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(n,m){var i=k.indexOf(m);if(i+1){return"\\"+k.charAt(i+1)}n=m.charCodeAt().toString(16);return"\\u"+"0000".substring(n.length)+n})+'"'}if(j=="object"){e=l.length!==h;k="";if(e){for(g=0;g<l.length;g++){if(k){k+=","}k+=b(l[g])}k="["+k+"]"}else{for(f in l){if(l.hasOwnProperty(f)){if(k){k+=","}k+=b(f)+":"+b(l[f])}}k="{"+k+"}"}return k}if(l===h){return"null"}return""+l}function d(o){var r=false,f=null,k=null,g,h,i,q,j,m=0;try{try{k=new ActiveXObject("AgControl.AgControl");if(k.IsVersionSupported(o)){r=true}k=null}catch(n){var l=navigator.plugins["Silverlight Plug-In"];if(l){g=l.description;if(g==="1.0.30226.2"){g="2.0.30226.2"}h=g.split(".");while(h.length>3){h.pop()}while(h.length<4){h.push(0)}i=o.split(".");while(i.length>4){i.pop()}do{q=parseInt(i[m],10);j=parseInt(h[m],10);m++}while(m<i.length&&q===j);if(q<=j&&!isNaN(q)){r=true}}}}catch(p){r=false}return r}c.silverlight={trigger:function(j,f){var h=a[j],g,e;if(h){e=c.toArray(arguments).slice(1);e[0]="Silverlight:"+f;setTimeout(function(){h.trigger.apply(h,e)},0)}}};c.runtimes.Silverlight=c.addRuntime("silverlight",{init:function(l,m){var k,h="",j=l.settings.filters,g,f=document.body;if(!d("2.0.31005.0")||(window.opera&&window.opera.buildNumber)){m({success:false});return}a[l.id]=l;k=document.createElement("div");k.id=l.id+"_silverlight_container";c.extend(k.style,{position:"absolute",top:"0px",background:l.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100px",height:"100px",overflow:"hidden",opacity:l.settings.shim_bgcolor?"":0.01});k.className="plupload silverlight";if(l.settings.container){f=document.getElementById(l.settings.container);f.style.position="relative"}f.appendChild(k);for(g=0;g<j.length;g++){h+=(h!=""?"|":"")+j[g].title+" | *."+j[g].extensions.replace(/,/g,";*.")}k.innerHTML='<object id="'+l.id+'_silverlight" data="data:application/x-silverlight," type="application/x-silverlight-2" style="outline:none;" width="1024" height="1024"><param name="source" value="'+l.settings.silverlight_xap_url+'"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="initParams" value="id='+l.id+",filter="+h+'"/></object>';function e(){return document.getElementById(l.id+"_silverlight").content.Upload}l.bind("Silverlight:Init",function(){var i,n={};l.bind("Silverlight:StartSelectFiles",function(o){i=[]});l.bind("Silverlight:SelectFile",function(o,r,p,q){var s;s=c.guid();n[s]=r;n[r]=s;i.push(new c.File(s,p,q))});l.bind("Silverlight:SelectSuccessful",function(){if(i.length){l.trigger("FilesAdded",i)}});l.bind("Silverlight:UploadChunkError",function(o,r,p,s,q){l.trigger("Error",{code:c.IO_ERROR,message:"IO Error.",details:q,file:o.getFile(n[r])})});l.bind("Silverlight:UploadFileProgress",function(o,s,p,r){var q=o.getFile(n[s]);if(q.status!=c.FAILED){q.size=r;q.loaded=p;o.trigger("UploadProgress",q)}});l.bind("Refresh",function(o){var p,q,r;p=document.getElementById(o.settings.browse_button);q=c.getPos(p,document.getElementById(o.settings.container));r=c.getSize(p);c.extend(document.getElementById(o.id+"_silverlight_container").style,{top:q.y+"px",left:q.x+"px",width:r.w+"px",height:r.h+"px"})});l.bind("Silverlight:UploadChunkSuccessful",function(o,r,p,u,t){var s,q=o.getFile(n[r]);s={chunk:p,chunks:u,response:t};o.trigger("ChunkUploaded",q,s);if(q.status!=c.FAILED){e().UploadNextChunk()}if(p==u-1){q.status=c.DONE;o.trigger("FileUploaded",q,{response:t})}});l.bind("Silverlight:UploadSuccessful",function(o,r,p){var q=o.getFile(n[r]);q.status=c.DONE;o.trigger("FileUploaded",q,{response:p})});l.bind("FilesRemoved",function(o,q){var p;for(p=0;p<q.length;p++){e().RemoveFile(n[q[p].id])}});l.bind("UploadFile",function(o,q){var r=o.settings,p=r.resize||{};e().UploadFile(n[q.id],c.buildUrl(o.settings.url,{name:q.target_name||q.name}),b({chunk_size:r.chunk_size,image_width:p.width,image_height:p.height,image_quality:p.quality||90,multipart:!!r.multipart,multipart_params:r.multipart_params||{},headers:r.headers}))});l.features={jpgresize:true,pngresize:true,chunks:true,progress:true};m({success:true})})}})})(plupload);
\ No newline at end of file
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.silverlight.xap b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.silverlight.xap
new file mode 100644 (file)
index 0000000..afe2700
Binary files /dev/null and b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.silverlight.xap differ
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/language/english.php b/trunk/NP_DragAndDropUploader/draganddropuploader/language/english.php
new file mode 100644 (file)
index 0000000..02d2651
--- /dev/null
@@ -0,0 +1,2 @@
+<?php\r
+       define('NP_DRAGANDDROPUPLOADER_DESCRIPTION', 'This plugin can upload multiple files using Google Gears, Silverlight, Flash, BrowserPlus or HTML5');\r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/language/japanese-euc.php b/trunk/NP_DragAndDropUploader/draganddropuploader/language/japanese-euc.php
new file mode 100644 (file)
index 0000000..64dfe45
--- /dev/null
@@ -0,0 +1,2 @@
+<?php \r
+       define('NP_DRAGANDDROPUPLOADER_DESCRIPTION', '¤³¤Î¥×¥é¥°¥¤¥ó¤ÏGoogle Gears, Silverlight, Flash, BrowserPlus, HTML5Åù¤ò»È¤Ã¤ÆÊ£¿ô¤Î¥Õ¥¡¥¤¥ë¤ò°ìÅ٤˥¢¥Ã¥×¥í¡¼¥É¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£');           \r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/language/japanese-utf8.php b/trunk/NP_DragAndDropUploader/draganddropuploader/language/japanese-utf8.php
new file mode 100644 (file)
index 0000000..fb5eeab
--- /dev/null
@@ -0,0 +1,2 @@
+<?php \r
+       define('NP_DRAGANDDROPUPLOADER_DESCRIPTION', 'このプラグインはGoogle Gears, Silverlight, Flash, BrowserPlus, HTML5等を使って複数のファイルを一度にアップロードすることができます。');           \r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/mkeuc.sh b/trunk/NP_DragAndDropUploader/draganddropuploader/mkeuc.sh
new file mode 100644 (file)
index 0000000..5f684ef
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash -x
+
+FILES=`find . -name '*japanese-utf8*'`
+
+for utf8file in $FILES
+do
+       eucfile=`echo $utf8file | sed 's/japanese-utf8/japanese-euc/'`
+       nkf -e -W -d < $utf8file > $eucfile
+done
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/extrahead_japanese-euc.html b/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/extrahead_japanese-euc.html
new file mode 100644 (file)
index 0000000..99d7bf9
--- /dev/null
@@ -0,0 +1,51 @@
+<script type="text/javascript" src="http://www.google.com/jsapi"></script>\r
+<script type="text/javascript">\r
+       google.load("jquery", "1.4");\r
+</script>\r
+\r
+<!-- Load the queue CSS -->\r
+<style type="text/css">@import url({{plugindirurl}}css/plupload.queue.css);</style>\r
+\r
+<!-- Thirdparty intialization scripts, needed for the Google Gears and BrowserPlus runtimes -->\r
+<script type="text/javascript" src="{{plugindirurl}}js/gears_init.js"></script>\r
+<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>\r
+\r
+<!-- Load plupload core and all of it's runtimes and finally the jQuery queue widget -->\r
+<script type="text/javascript" src="{{plugindirurl}}js/plupload.full.min.js"></script>\r
+<script type="text/javascript" src="{{plugindirurl}}js/jquery.plupload.queue.min.js"></script>\r
+\r
+<script>\r
+$(function() {\r
+       function getUploaderSettings(){\r
+               return {\r
+                       // General settings\r
+                       runtimes: '{{runtimes|}}',\r
+                       url: '{{plugindirurl}}upload.php?action=image_upload' + '&collection=' + $('#plugin_draganddropuploader').val(),\r
+                       multipart: true,\r
+\r
+                       flash_swf_url: '{{plugindirurl}}js/plupload.flash.swf',\r
+                       silverlight_xap_url: '{{plugindirurl}}js/plupload.silverlight.xap',\r
+\r
+                               // Specify what files to browse for\r
+                       filters :[\r
+                               {title : "Image files", extensions : "jpg,gif,png"},\r
+                       ]\r
+               };\r
+       }\r
+\r
+       function setup(){\r
+               $("#uploader").pluploadQueue(getUploaderSettings());\r
+       }\r
+\r
+       setup();\r
+\r
+       $("#plugin_draganddropuploader").change(function () {\r
+               setup();\r
+       });\r
+\r
+       $("#uploader_reset").click(function(e) {\r
+               setup();\r
+               e.preventDefault();\r
+       });\r
+});\r
+</script>\r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/extrahead_japanese-utf8.html b/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/extrahead_japanese-utf8.html
new file mode 100644 (file)
index 0000000..99d7bf9
--- /dev/null
@@ -0,0 +1,51 @@
+<script type="text/javascript" src="http://www.google.com/jsapi"></script>\r
+<script type="text/javascript">\r
+       google.load("jquery", "1.4");\r
+</script>\r
+\r
+<!-- Load the queue CSS -->\r
+<style type="text/css">@import url({{plugindirurl}}css/plupload.queue.css);</style>\r
+\r
+<!-- Thirdparty intialization scripts, needed for the Google Gears and BrowserPlus runtimes -->\r
+<script type="text/javascript" src="{{plugindirurl}}js/gears_init.js"></script>\r
+<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>\r
+\r
+<!-- Load plupload core and all of it's runtimes and finally the jQuery queue widget -->\r
+<script type="text/javascript" src="{{plugindirurl}}js/plupload.full.min.js"></script>\r
+<script type="text/javascript" src="{{plugindirurl}}js/jquery.plupload.queue.min.js"></script>\r
+\r
+<script>\r
+$(function() {\r
+       function getUploaderSettings(){\r
+               return {\r
+                       // General settings\r
+                       runtimes: '{{runtimes|}}',\r
+                       url: '{{plugindirurl}}upload.php?action=image_upload' + '&collection=' + $('#plugin_draganddropuploader').val(),\r
+                       multipart: true,\r
+\r
+                       flash_swf_url: '{{plugindirurl}}js/plupload.flash.swf',\r
+                       silverlight_xap_url: '{{plugindirurl}}js/plupload.silverlight.xap',\r
+\r
+                               // Specify what files to browse for\r
+                       filters :[\r
+                               {title : "Image files", extensions : "jpg,gif,png"},\r
+                       ]\r
+               };\r
+       }\r
+\r
+       function setup(){\r
+               $("#uploader").pluploadQueue(getUploaderSettings());\r
+       }\r
+\r
+       setup();\r
+\r
+       $("#plugin_draganddropuploader").change(function () {\r
+               setup();\r
+       });\r
+\r
+       $("#uploader_reset").click(function(e) {\r
+               setup();\r
+               e.preventDefault();\r
+       });\r
+});\r
+</script>\r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/index_japanese-euc.html b/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/index_japanese-euc.html
new file mode 100644 (file)
index 0000000..6375653
--- /dev/null
@@ -0,0 +1,9 @@
+<h3>Drag And Drop Uploader</h3>\r
+<p>\r
+       <label for="plug_ping_check">Collection:</label>\r
+       {{collections}}<br />\r
+       <div id="uploader">\r
+               <p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>\r
+       </div>\r
+       <a id="uploader_reset" href="#">Reset Uploader</a>\r
+</p>\r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/index_japanese-utf8.html b/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/index_japanese-utf8.html
new file mode 100644 (file)
index 0000000..6375653
--- /dev/null
@@ -0,0 +1,9 @@
+<h3>Drag And Drop Uploader</h3>\r
+<p>\r
+       <label for="plug_ping_check">Collection:</label>\r
+       {{collections}}<br />\r
+       <div id="uploader">\r
+               <p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>\r
+       </div>\r
+       <a id="uploader_reset" href="#">Reset Uploader</a>\r
+</p>\r
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/upload.php b/trunk/NP_DragAndDropUploader/draganddropuploader/upload.php
new file mode 100644 (file)
index 0000000..b96c44a
--- /dev/null
@@ -0,0 +1,48 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * rd.php ($Revision: 1.1 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: upload.php,v 1.1 2010/04/24 19:15:52 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+$strRel = '../../../';\r
+require($strRel.'config.php');\r
+require($DIR_LIBS.'PLUGINADMIN.php');\r
+\r
+// create the admin area page\r
+$oPluginAdmin = new PluginAdmin('DragAndDropUploader');\r
+$action = requestVar('action');\r
+if( !$action ) $action = '';\r
+$oPluginAdmin->plugin->doAction($action);\r
diff --git a/trunk/NP_DragAndDropUploader/sharedlibs/cles/Feedback.php b/trunk/NP_DragAndDropUploader/sharedlibs/cles/Feedback.php
new file mode 100644 (file)
index 0000000..c251c3c
--- /dev/null
@@ -0,0 +1,178 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Feedback.php ($Revision: 1.30 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Feedback.php,v 1.30 2008/05/18 07:01:25 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2006 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+class cles_Feedback {\r
+       var $oPluginAdmin;\r
+       function CLES_Feedback(&$pluginAdmin){\r
+               $this->oPluginAdmin = $pluginAdmin;\r
+       }\r
+       \r
+       function getMenuStr(){\r
+               return mb_convert_encoding('動作確認/不具合報告', _CHARSET, 'UTF-8');\r
+       }\r
+       \r
+       function printForm($extra = '') {\r
+               ob_start();\r
+               \r
+               global $nucleus, $CONF;\r
+               \r
+               echo "<h2>動作確認/不具合報告</h2>";\r
+               echo '<p>下記より、作者への動作確認/不具合の報告を行うことができます。</p>';\r
+\r
+               // js\r
+               echo '<script langage="JavaScript">\r
+//<![CDATA[\r
+function selectall(){\r
+       var elements = document.getElementsByTagName(\'input\');\r
+       for( var i=0; i < elements.length; i++){\r
+               var e = elements[i];\r
+               if( e.type == \'checkbox\' ){\r
+                       e.checked = true;\r
+               }\r
+       }\r
+       return false;\r
+}\r
+//]]>\r
+</script>';\r
+               \r
+               echo "<h3>収集する情報と公開について</h3>";\r
+               echo '<p>デフォルトで必要最低限の環境情報(赤字のもの)を開発者のサーバへ送信します。<br />\r
+                                                       <span style="font-weight:bold; color:red">差し支えない範囲で環境情報の提供にご協力ください。</span></p>\r
+                                                       <p>※ 収集した情報は統計処理、及びプラグインのBugFixのみに利用されます。また統計処理した結果については公表することがあります。</p>';\r
+               echo '<p><a href="#" onclick="javascript:selectall();return false;">全て送信する場合はここをクリック</a></p>';\r
+               \r
+               echo "<h3>サイト固有コードについて</h3>";\r
+               echo '<p>動作報告の重複を取り除くため、管理画面のURLのmd5を計算したものを送信しています。この情報から管理画面のURLを復元することはできないようになっています。<a href="http://e-words.jp/w/MD5.html" target="_blank">md5の解説についてはこちらをご覧ください。(e-WordsIT用語辞典)</a></p>';\r
+               \r
+               // form \r
+               echo '<form method="post" action="http://blog.cles.jp/support/report.php">' . "\n";\r
+\r
+               // table\r
+               echo "<table>\n";\r
+               echo "<tr>\n";\r
+               echo "<th>項目の説明</th>\n";\r
+               echo "<th>送信される値</th>\n";\r
+               echo "<th><a href=\"#\" onclick=\"javascript:selectall();return false;\">全てチェック</a></th>\n";\r
+               echo "</tr>\n";\r
+\r
+               $res = sql_query("show variables like 'version'");\r
+               $assoc = mysql_fetch_assoc($res);\r
+               $mysqlVersion = $assoc['Value'];\r
+               \r
+               if( function_exists('gd_info') )\r
+                       $gdinfo = @gd_info();\r
+               else\r
+                       $gdinfo['GD Version'] = 'GD is not supported';\r
+\r
+               global $CONF;\r
+\r
+               $this->_printtr('siteid', 'サイトの固有コード', md5(trim($CONF['AdminURL'])));\r
+               $this->_printtr('plugin_name', 'プラグイン名', $this->oPluginAdmin->plugin->getName());\r
+               $this->_printtr('plugin_version', 'プラグインのバージョン', $this->oPluginAdmin->plugin->getVersion());\r
+               $this->_printtr('plugin_info', '追加情報', $extra, true);\r
+               $this->_printtr('nucleus_version', 'Nucleusのバージョン', $nucleus['version'], true);\r
+               $this->_printtr('nucleus_charset', 'Nucleusのキャラクタセット', _CHARSET);\r
+               $this->_printtr('php_version', 'PHPのバージョン', PHP_VERSION, true);\r
+               $this->_printtr('php_sapi', 'PHPの種類', php_sapi_name());\r
+               $this->_printtr('php_os', 'OSの種類', PHP_OS, true);\r
+               $this->_printtr('php_safemode', 'セーフモードの有無', ini_get('safe_mode') ? 'on' : 'off');\r
+               $this->_printtr('php_gd_version', 'GDのバージョン', $gdinfo['GD Version'], true);\r
+               $this->_printtr('php_gd_support', 'サポートしているイメージタイプ', implode(',', $this->_supportedImageTypes()) );\r
+               $this->_printtr('mysql_version', 'MySQLのバージョン', $mysqlVersion, true);\r
+\r
+               echo "<tr>\n";\r
+               echo "<td colspan=\"2\">このプラグインは機能しましたか?</td>\n";\r
+               echo '<td><input type="radio" name="user_intention" value="ok" />はい <br/> <input type="radio" name="intention" value="ng" />いいえ'."</td>\n";\r
+               echo "</tr>\n";\r
+\r
+               echo "<tr>\n";\r
+               echo "<td>不具合の内容をお寄せください<br /><em>必ず回答が必要な質問については、<a href=\"http://japan.nucleuscms.org/bb/\">Nucleusサポートフォーラム</a>もしくは<a href=\"http://blog.cles.jp/np_cles/\">作者ページ</a>でご質問ください。</em></td>\n";\r
+               echo '<td colspan="2"><textarea name="user_freetext" rows="10" cols="70"></textarea>'."</td>\n";\r
+               echo "</tr>\n";\r
+\r
+               echo "<tr>\n";\r
+               echo "<td>よろしければサイトのURLを教えてください</td>\n";\r
+               echo '<td colspan="2"><textarea name="user_url" rows="1" cols="70"></textarea>'."</td>\n";\r
+               echo "</tr>\n";\r
+               \r
+               echo "<tr>\n";\r
+               echo "<td colspan=\"2\">リンク集作成の際、リンクをはらせていただけますか?</td>\n";\r
+               echo '<td><input type="radio" name="user_disclose" value="yes" />はい <br/> <input type="radio" name="intention" value="no" />いいえ'."</td>\n";\r
+               echo "</tr>\n";\r
+\r
+               echo '<tr><td colspan="3"><div align="right"><a href="#" onclick="javascript:selectall();return false;">全てチェック</a> <input type="submit" name="submit" value="動作確認を送信する" /></div></td></tr>';\r
+               echo "</table>\n";\r
+               echo "</form>\n";\r
+               \r
+               $contents = ob_get_contents();\r
+               ob_end_clean();\r
+               echo mb_convert_encoding($contents, _CHARSET, 'UTF-8');\r
+       }\r
+       \r
+       function _printtr($name, $desc, $value, $canDisable = false) {\r
+               echo "<tr>\n";\r
+       \r
+               if ($canDisable) {\r
+                       echo "<td>".$desc."</td>\n";\r
+                       echo "<td>".htmlspecialchars($value)."</td>\n";\r
+                       echo '<td><input type="checkbox" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" /></td>'."\n";\r
+               } else {\r
+                       echo '<td><span style="font-weight:bold; color:red">'.$desc."</span></td>\n";\r
+                       echo '<td><span style="font-weight:bold; color:red">'.htmlspecialchars($value)."</span></td>\n";\r
+                       echo '<td>必須<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" readonly="readonly" checked="checked"/></td>'."\n";\r
+               }\r
+               echo "</tr>\n";\r
+       }\r
+       \r
+       function _supportedImageTypes() {\r
+               if( !function_exists('gd_info') ) return "";\r
+               \r
+               $aSupportedTypes = array ();\r
+               $aPossibleImageTypeBits = array (IMG_GIF => 'GIF', IMG_JPG => 'JPG', IMG_PNG => 'PNG', IMG_WBMP => 'WBMP');\r
+       \r
+               foreach ($aPossibleImageTypeBits as $iImageTypeBits => $sImageTypeString) {\r
+                       if (imagetypes() & $iImageTypeBits) {\r
+                               $aSupportedTypes[] = $sImageTypeString;\r
+                       }\r
+               }\r
+       \r
+               return $aSupportedTypes;\r
+       }\r
+\r
+}\r
diff --git a/trunk/NP_DragAndDropUploader/sharedlibs/cles/Template.php b/trunk/NP_DragAndDropUploader/sharedlibs/cles/Template.php
new file mode 100644 (file)
index 0000000..09f3ac3
--- /dev/null
@@ -0,0 +1,87 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Template.php ($Revision: 1.11 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Template.php,v 1.11 2008/08/15 21:17:02 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2006-2008 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+if (!function_exists('getLanguageName')){\r
+       function getLanguageName(){\r
+               return 'japanese-utf8';\r
+       }\r
+}\r
+\r
+class cles_Template {\r
+       var $defaultLang = 'japanese-utf8';\r
+       var $defalutPattern = '#{{(.*?)(\|)?}}#ie';\r
+       var $lang;\r
+       var $templateDir;\r
+\r
+       function cles_Template($templateDir) {\r
+               global $CONF;\r
+               $this->templateDir = $templateDir;\r
+               $this->lang = ereg_replace( '[\\|/]', '', getLanguageName());\r
+       }\r
+\r
+       function fetch($name, $dir = null, $suffix = 'html') {\r
+               $path = $this->templateDir.'/'.( $dir ? strtolower($dir) . '/' : '' ).strtolower($name).'_'.$this->lang.( $suffix ? '.'.strtolower($suffix) : '' );\r
+               if ( ! file_exists($path) ){\r
+                       $path = $this->templateDir.'/'.( $dir ? strtolower($dir) . '/' : '' ).strtolower($name).'_'.$this->defaultLang.( $suffix ? '.'.strtolower($suffix) : '' );\r
+                       if ( ! file_exists($path) )\r
+                               return '';\r
+               }\r
+               \r
+               $fsize = filesize($path);\r
+               if ($fsize <= 0) return '';\r
+               \r
+               $fd = fopen($path, 'r');\r
+               $contents = fread($fd, $fsize);\r
+               fclose($fd);\r
+               return $contents;\r
+       }\r
+       \r
+       function fill($template, $values, $default = null) {\r
+               if( $default )\r
+                       return preg_replace($this->defalutPattern, 'isset($values[\'$1\']) ? (\'$2\' ? htmlspecialchars($values[\'$1\'], ENT_QUOTES) : $values[\'$1\']) : $default', $template);\r
+               if( $default === null )\r
+                       return preg_replace($this->defalutPattern, '(\'$2\') ? htmlspecialchars($values[\'$1\'], ENT_QUOTES) : $values[\'$1\']', $template);\r
+               return preg_replace($this->defalutPattern, 'isset($values[\'$1\']) ? (\'$2\' ? htmlspecialchars($values[\'$1\'], ENT_QUOTES) : $values[\'$1\']) : \'{{$1}}\' ', $template);\r
+       }\r
+       \r
+       function fetchAndFill($name, $values, $dir = null, $suffix = 'html', $default = null){\r
+               $tpl = $this->fetch($name, $dir, $suffix);\r
+               return $this->fill($tpl, $values, $default);\r
+       }\r
+}\r
diff --git a/trunk/NP_DragAndDropUploader/sharedlibs/sharedlibs.php b/trunk/NP_DragAndDropUploader/sharedlibs/sharedlibs.php
new file mode 100644 (file)
index 0000000..1823854
--- /dev/null
@@ -0,0 +1,51 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * sharedlibs.php ($Revision: 1.8 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: sharedlibs.php,v 1.8 2006/12/12 16:51:05 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2006 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+if (!defined('NP_SHAREDLIBS_LOADED')) {\r
+       if (!defined('PATH_SEPARATOR')) {\r
+               if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {\r
+                       define('PATH_SEPARATOR', ';');\r
+               } else {\r
+                       define('PATH_SEPARATOR', ':');\r
+               }\r
+       }\r
+       ini_set('include_path', dirname(__FILE__).PATH_SEPARATOR.ini_get('include_path'));\r
+\r
+       define('NP_SHAREDLIBS_LOADED', true);\r
+}\r