From: hsur Date: Sun, 6 Jun 2010 11:32:50 +0000 (+0000) Subject: NP_DragAndDropUploader v1.1 X-Git-Url: http://git.osdn.net/view?p=nucleus-jp%2Fnucleus-plugins.git;a=commitdiff_plain;h=1bc84e4d1d84add0414a752fb932ff4f397f3abf NP_DragAndDropUploader v1.1 git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@1061 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- diff --git a/trunk/NP_DragAndDropUploader/NP_DragAndDropUploader.php b/trunk/NP_DragAndDropUploader/NP_DragAndDropUploader.php new file mode 100644 index 0000000..21a353d --- /dev/null +++ b/trunk/NP_DragAndDropUploader/NP_DragAndDropUploader.php @@ -0,0 +1,245 @@ +getDirectory().'language/'.$language.'.php')) + @include_once($this->getDirectory().'language/'.$language.'.php'); + + $this->te =& new cles_Template(dirname(__FILE__).'/draganddropuploader/template'); + } + + // name of plugin + function getName() { + return 'Drag and Drop Uploader'; + } + + // author of plugin + function getAuthor() { + return 'hsur'; + } + + // an URL to the plugin website + // can also be of the form mailto:foo@bar.com + function getURL() { + return 'http://blog.cles.jp/np_cles/category/31/subcatid/25'; + } + + // version of the plugin + function getVersion() { + return '1.1'; + } + + function hasAdminArea() { + return 1; + } + + function getEventList() { + return array('AddItemFormExtras','EditItemFormExtras','AdminPrePageHead','BookmarkletExtraHead'); + } + + function event_AddItemFormExtras(&$data){ + $this->_formExtras(); + } + + function event_EditItemFormExtras(&$data){ + $this->_formExtras(); + } + + function _formExtras(){ + $collections = MEDIA::getCollectionList(); + $collections_html = ''; + + $tplVars = array( + 'collections' => $collections_html, + ); + $index = $this->te->fetch('index', strtolower(__CLASS__)); + echo $this->te->fill($index, $tplVars, false); + } + + function event_BookmarkletExtraHead(&$data){ + $this->_extraHead($data); + } + + function event_AdminPrePageHead(&$data){ + if ( !($data['action'] == 'createitem' || $data['action'] == 'itemedit') ){ + return; + } + $this->_extraHead($data); + } + + function _extraHead(&$data){ + $tplVars = array( + 'plugindirurl' => $this->getAdminURL(), + 'runtimes' => NP_DRAGANDDROPUPLOADER_RUNTIMES, + ); + $header = $this->te->fetch('extrahead', strtolower(__CLASS__)); + $data['extrahead'] .= "\n" . $this->te->fill($header, $tplVars, false); + } + + function install() { + // debug + $this->createOption('debug', 'Debug Mode ?', 'yesno', 'no'); + } + + function unInstall() { + } + + function _info($msg) { + if ($this->getOption('debug') == 'yes') { + ACTIONLOG :: add(INFO, 'DragAndDropUploader: '.$msg); + } + } + + function _warn($msg) { + ACTIONLOG :: add(WARNING, 'DragAndDropUploader: '.$msg); + } + + function getMinNucleusVersion() { return 330; } + function getMinNucleusPatchLevel() { return 0; } + + // a description to be shown on the installed plugins listing + function getDescription() { + return '[$Revision: 1.11 $]
' . NP_DRAGANDDROPUPLOADER_DESCRIPTION; + } + + function supportsFeature($what) { + switch ($what) { + case 'SqlTablePrefix' : + case 'HelpPage': + return 1; + default : + return 0; + } + } + + function doAction($type) { + global $member; + header('Content-type: text/plain; charset=UTF-8'); + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); + header("Cache-Control: no-store, no-cache, must-revalidate"); + header("Cache-Control: post-check=0, pre-check=0", false); + header("Pragma: no-cache"); + + switch ($type) { + case 'image_upload': + // 5 minutes execution time + @set_time_limit(5 * 60); + $this->_image_upload(); + return ''; + break; + + // other actions result in an error + case '': + default: + return 'Unexisting action: ' . $type; + } + } + + function _jsonrpc_error($mes = "", $code = "500"){ + $this->_warn("($code) $mes"); + header("HTTP/1.1 $code $mes"); + echo('{"jsonrpc" : "2.0", "error" : {"code": '.$code.', "message": "'.$mes.'"}, "id" : "id"}'); + exit; + } + + function _jsonrpc_ok(){ + echo('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}'); + exit; + } + + function _image_upload(){ + global $member, $DIR_MEDIA, $CONF; + if( !$member->isLoggedIn() ) return $this->_jsonrpc_error("Not Logged in.", "403"); + $collection = requestVar('collection'); + + $fileName = isset($_REQUEST['name']) ? requestVar('name') : 'no_name'; + if( $CONF['MediaPrefix'] ){ + $exif = @exif_read_data($_FILES['file']['tmp_name']); + if( $exif !== false && $exif["DateTime"] && strtotime($exif["DateTime"]) !== false ) + $fileName = strftime("%Y%m%d-", strtotime($exif["DateTime"])) . $fileName; + else + $fileName = strftime("%Y%m%d-", time()) . $fileName; + } + + if (isset($_SERVER['HTTP_CONTENT_TYPE'])) $contentType = serverVar('HTTP_CONTENT_TYPE'); + if (isset($_SERVER['CONTENT_TYPE'])) $contentType = serverVar('CONTENT_TYPE'); + + if (strpos($contentType, "multipart") !== false) { + if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) { + $err = MEDIA::addMediaObject($collection, $_FILES['file']['tmp_name'], $fileName); + if($err){ + $this->_jsonrpc_error('addMediaObject Error: '. $err, "500"); + } + } else + $this->_jsonrpc_error("Failed to move uploaded file.", "500"); + } else { + // Read binary input stream and append it to temp file + $in = fopen("php://input", "rb"); + if ($in) { + while ($buff = fread($in, 4096)) + $err = MEDIA::addMediaObjectRaw($collection, $fileName, $buff); + if($err){ + $this->_jsonrpc_error('addMediaObjectRaw Error: '. $err, "500"); + } + } else + $this->_jsonrpc_error("Failed to open input stream.", "500"); + } + + $this->_jsonrpc_ok(); + } +} diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/css/plupload.queue.css b/trunk/NP_DragAndDropUploader/draganddropuploader/css/plupload.queue.css new file mode 100644 index 0000000..8581fdd --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/css/plupload.queue.css @@ -0,0 +1,177 @@ +/* + Plupload +------------------------------------------------------------------- */ + +.plupload_button { + display: -moz-inline-box; /* FF < 3*/ + display: inline-block; + font: normal 12px sans-serif; + text-decoration: none; + color: #42454a; + border: 1px solid #bababa; + padding: 2px 8px 3px 20px; + margin-right: 4px; + background: #f3f3f3 url('../img/buttons.png') no-repeat 0 center; + outline: 0; + + /* Optional rounded corners for browsers that support it */ + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.plupload_button:hover { + color: #000; + text-decoration: none; +} + +.plupload_disabled, a.plupload_disabled:hover { + color: #737373; + border-color: #c5c5c5; + background: #ededed url('../img/buttons-disabled.png') no-repeat 0 center; + cursor: default; +} + +.plupload_add { + background-position: -181px center; +} + +.plupload_wrapper { + font: normal 11px Verdana,sans-serif; + width: 100%; +} + +.plupload_container { + padding: 8px; + background: url('../img/transp50.png'); + /*-moz-border-radius: 5px;*/ +} + +.plupload_container input { + border: 1px solid #DDD; + font: normal 11px Verdana,sans-serif; + width: 98%; +} + +.plupload_header {background: #2A2C2E url('../img/backgrounds.gif') repeat-x;} +.plupload_header_content { + background: url('../img/backgrounds.gif') no-repeat 0 -317px; + min-height: 56px; + padding-left: 60px; + color: #FFF; +} +.plupload_header_title { + font: normal 18px sans-serif; + padding: 6px 0 3px; +} +.plupload_header_text { + font: normal 12px sans-serif; +} + +.plupload_filelist { + margin: 0; + padding: 0; + list-style: none; +} + +.plupload_scroll .plupload_filelist { + height: 185px; + background: #F5F5F5; + overflow-y: scroll; +} + +.plupload_filelist li { + padding: 10px 8px; + background: #F5F5F5 url('../img/backgrounds.gif') repeat-x 0 -156px; + border-bottom: 1px solid #DDD; +} + +.plupload_filelist_header, .plupload_filelist_footer { + background: #DFDFDF; + padding: 8px 8px; + color: #42454A; +} +.plupload_filelist_header { + border-top: 1px solid #EEE; + border-bottom: 1px solid #CDCDCD; +} + +.plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;} +.plupload_file_name {float: left; overflow: hidden} +.plupload_file_status {color: #777;} +.plupload_file_status span {color: #42454A;} +.plupload_file_size, .plupload_file_status, .plupload_progress { + float: right; + width: 80px; +} +.plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;} + +.plupload_filelist .plupload_file_name {width: 205px} + +.plupload_file_action { + float: right; + width: 16px; + height: 16px; + margin-left: 15px; +} + +.plupload_file_action * { + display: none; + width: 16px; + height: 16px; +} + +li.plupload_uploading {background: #ECF3DC url('../img/backgrounds.gif') repeat-x 0 -238px;} +li.plupload_done {color:#AAA} + +li.plupload_delete a { + background: url('../img/delete.gif'); +} + +li.plupload_failed a { + background: url('../img/error.gif'); + cursor: default; +} + +li.plupload_done a { + background: url('../img/done.gif'); + cursor: default; +} + +.plupload_progress, .plupload_upload_status { + display: none; +} + +.plupload_progress_container { + margin-top: 3px; + border: 1px solid #CCC; + background: #FFF; + padding: 1px; +} +.plupload_progress_bar { + width: 0px; + height: 7px; + background: #CDEB8B; +} + +.plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action { + margin-right: 17px; +} + +/* Floats */ + +.plupload_clear,.plupload_clearer {clear: both;} +.plupload_clearer, .plupload_progress_bar { + display: block; + font-size: 0; + line-height: 0; +} + +li.plupload_droptext { + background: transparent; + text-align: center; + vertical-align: middle; + border: 0; + line-height: 165px; +} diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/help.html b/trunk/NP_DragAndDropUploader/draganddropuploader/help.html new file mode 100644 index 0000000..46b3439 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/help.html @@ -0,0 +1,15 @@ + +

バージョン履歴

+ + diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/img/backgrounds.gif b/trunk/NP_DragAndDropUploader/draganddropuploader/img/backgrounds.gif new file mode 100644 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 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 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 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 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 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 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 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 index 0000000..910fd8d --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/index.php @@ -0,0 +1,99 @@ +isBlogAdmin($blogid); +} else + $isblogadmin = 0; + +if (!$member->isLoggedIn()) { + $oPluginAdmin = new PluginAdmin('MetaTags'); + $oPluginAdmin->start(); + echo "

ログインが必要です

"; + $oPluginAdmin->end(); + exit; +} + +if (!($member->isAdmin() || $isblogadmin)) { + $oPluginAdmin = new PluginAdmin('MetaTags'); + $oPluginAdmin->start(); + echo "

"._ERROR_DISALLOWED."

"; + $oPluginAdmin->end(); + exit; +} + +if (isset ($_GET['page'])) { + $action = getVar('page'); +} +if (isset ($_POST['page'])) { + $action = getVar('page'); +} + +// create the admin area page +$oPluginAdmin = new PluginAdmin('DragAndDropUploader'); +$oPluginAdmin->start(); +$fb =& new cles_Feedback($oPluginAdmin); + +// menu +echo "

DragAndDropUploader menu

\n"; +echo "\n"; + +//action +switch ($action) { + case 'report' : + $extra = ''; + $fb->printForm($extra); + break; + + default : + break; +} + +echo "
"; + +$oPluginAdmin->end(); diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/gears_init.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/gears_init.js new file mode 100644 index 0000000..5f44f09 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/js/gears_init.js @@ -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 index 0000000..4558695 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/js/jquery.plupload.queue.min.js @@ -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('
'+a("Select files")+'
'+a("Add files to the upload queue and click the start button.")+'
'+a("Filename")+'
 
'+a("Status")+'
'+a("Size")+'
 
    ')}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+=''}l+='';l+='';n++;c("#"+k+"_count").val(n)}m.append('
  • '+o.name+'
    '+o.percent+'%
    '+plupload.formatSize(o.size)+'
     
    '+l+"
  • ");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('
  • '+a("Drag files here.")+"
  • ")}}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('');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('
  • '+a("Drag files here.")+"
  • ")}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 index 0000000..3d8223a --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/js/jquery.plupload.single.min.js @@ -0,0 +1 @@ +(function(b){var c={};function a(e,d){d.html('
    ')}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('')}e.append('')}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 index 0000000..99e2220 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.browserplus.min.js @@ -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;l0){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';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":"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;m0){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;l0?"&":"?")+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;k1048576){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;l0?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;Bn.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=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=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;e0;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(q3){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';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';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;r0){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";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;o0;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";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 index 0000000..4653c66 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.min.js @@ -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;m0){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;l0?"&":"?")+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;k1048576){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;l0?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;Bn.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=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=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 index 0000000..878aa74 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/js/plupload.silverlight.min.js @@ -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;g3){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';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 $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 index 0000000..99d7bf9 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/extrahead_japanese-euc.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + 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 index 0000000..99d7bf9 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/extrahead_japanese-utf8.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + 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 index 0000000..6375653 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/index_japanese-euc.html @@ -0,0 +1,9 @@ +

    Drag And Drop Uploader

    +

    + + {{collections}}
    +

    +

    You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.

    +
    + Reset Uploader +

    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 index 0000000..6375653 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/template/np_draganddropuploader/index_japanese-utf8.html @@ -0,0 +1,9 @@ +

    Drag And Drop Uploader

    +

    + + {{collections}}
    +

    +

    You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.

    +
    + Reset Uploader +

    diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/upload.php b/trunk/NP_DragAndDropUploader/draganddropuploader/upload.php new file mode 100644 index 0000000..b96c44a --- /dev/null +++ b/trunk/NP_DragAndDropUploader/draganddropuploader/upload.php @@ -0,0 +1,48 @@ +plugin->doAction($action); diff --git a/trunk/NP_DragAndDropUploader/sharedlibs/cles/Feedback.php b/trunk/NP_DragAndDropUploader/sharedlibs/cles/Feedback.php new file mode 100644 index 0000000..c251c3c --- /dev/null +++ b/trunk/NP_DragAndDropUploader/sharedlibs/cles/Feedback.php @@ -0,0 +1,178 @@ +oPluginAdmin = $pluginAdmin; + } + + function getMenuStr(){ + return mb_convert_encoding('動作確認/不具合報告', _CHARSET, 'UTF-8'); + } + + function printForm($extra = '') { + ob_start(); + + global $nucleus, $CONF; + + echo "

    動作確認/不具合報告

    "; + echo '

    下記より、作者への動作確認/不具合の報告を行うことができます。

    '; + + // js + echo ''; + + echo "

    収集する情報と公開について

    "; + echo '

    デフォルトで必要最低限の環境情報(赤字のもの)を開発者のサーバへ送信します。
    + 差し支えない範囲で環境情報の提供にご協力ください。

    +

    ※ 収集した情報は統計処理、及びプラグインのBugFixのみに利用されます。また統計処理した結果については公表することがあります。

    '; + echo '

    全て送信する場合はここをクリック

    '; + + echo "

    サイト固有コードについて

    "; + echo '

    動作報告の重複を取り除くため、管理画面のURLのmd5を計算したものを送信しています。この情報から管理画面のURLを復元することはできないようになっています。md5の解説についてはこちらをご覧ください。(e-WordsIT用語辞典)

    '; + + // form + echo '
    ' . "\n"; + + // table + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $res = sql_query("show variables like 'version'"); + $assoc = mysql_fetch_assoc($res); + $mysqlVersion = $assoc['Value']; + + if( function_exists('gd_info') ) + $gdinfo = @gd_info(); + else + $gdinfo['GD Version'] = 'GD is not supported'; + + global $CONF; + + $this->_printtr('siteid', 'サイトの固有コード', md5(trim($CONF['AdminURL']))); + $this->_printtr('plugin_name', 'プラグイン名', $this->oPluginAdmin->plugin->getName()); + $this->_printtr('plugin_version', 'プラグインのバージョン', $this->oPluginAdmin->plugin->getVersion()); + $this->_printtr('plugin_info', '追加情報', $extra, true); + $this->_printtr('nucleus_version', 'Nucleusのバージョン', $nucleus['version'], true); + $this->_printtr('nucleus_charset', 'Nucleusのキャラクタセット', _CHARSET); + $this->_printtr('php_version', 'PHPのバージョン', PHP_VERSION, true); + $this->_printtr('php_sapi', 'PHPの種類', php_sapi_name()); + $this->_printtr('php_os', 'OSの種類', PHP_OS, true); + $this->_printtr('php_safemode', 'セーフモードの有無', ini_get('safe_mode') ? 'on' : 'off'); + $this->_printtr('php_gd_version', 'GDのバージョン', $gdinfo['GD Version'], true); + $this->_printtr('php_gd_support', 'サポートしているイメージタイプ', implode(',', $this->_supportedImageTypes()) ); + $this->_printtr('mysql_version', 'MySQLのバージョン', $mysqlVersion, true); + + echo "\n"; + echo "\n"; + echo '\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo '\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo '\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo '\n"; + echo "\n"; + + echo ''; + echo "
    項目の説明送信される値全てチェック
    このプラグインは機能しましたか?はい
    いいえ'."
    不具合の内容をお寄せください
    必ず回答が必要な質問については、Nucleusサポートフォーラムもしくは作者ページでご質問ください。
    '."
    よろしければサイトのURLを教えてください'."
    リンク集作成の際、リンクをはらせていただけますか?はい
    いいえ'."
    \n"; + echo "
    \n"; + + $contents = ob_get_contents(); + ob_end_clean(); + echo mb_convert_encoding($contents, _CHARSET, 'UTF-8'); + } + + function _printtr($name, $desc, $value, $canDisable = false) { + echo "\n"; + + if ($canDisable) { + echo "".$desc."\n"; + echo "".htmlspecialchars($value)."\n"; + echo ''."\n"; + } else { + echo ''.$desc."\n"; + echo ''.htmlspecialchars($value)."\n"; + echo '必須'."\n"; + } + echo "\n"; + } + + function _supportedImageTypes() { + if( !function_exists('gd_info') ) return ""; + + $aSupportedTypes = array (); + $aPossibleImageTypeBits = array (IMG_GIF => 'GIF', IMG_JPG => 'JPG', IMG_PNG => 'PNG', IMG_WBMP => 'WBMP'); + + foreach ($aPossibleImageTypeBits as $iImageTypeBits => $sImageTypeString) { + if (imagetypes() & $iImageTypeBits) { + $aSupportedTypes[] = $sImageTypeString; + } + } + + return $aSupportedTypes; + } + +} diff --git a/trunk/NP_DragAndDropUploader/sharedlibs/cles/Template.php b/trunk/NP_DragAndDropUploader/sharedlibs/cles/Template.php new file mode 100644 index 0000000..09f3ac3 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/sharedlibs/cles/Template.php @@ -0,0 +1,87 @@ +templateDir = $templateDir; + $this->lang = ereg_replace( '[\\|/]', '', getLanguageName()); + } + + function fetch($name, $dir = null, $suffix = 'html') { + $path = $this->templateDir.'/'.( $dir ? strtolower($dir) . '/' : '' ).strtolower($name).'_'.$this->lang.( $suffix ? '.'.strtolower($suffix) : '' ); + if ( ! file_exists($path) ){ + $path = $this->templateDir.'/'.( $dir ? strtolower($dir) . '/' : '' ).strtolower($name).'_'.$this->defaultLang.( $suffix ? '.'.strtolower($suffix) : '' ); + if ( ! file_exists($path) ) + return ''; + } + + $fsize = filesize($path); + if ($fsize <= 0) return ''; + + $fd = fopen($path, 'r'); + $contents = fread($fd, $fsize); + fclose($fd); + return $contents; + } + + function fill($template, $values, $default = null) { + if( $default ) + return preg_replace($this->defalutPattern, 'isset($values[\'$1\']) ? (\'$2\' ? htmlspecialchars($values[\'$1\'], ENT_QUOTES) : $values[\'$1\']) : $default', $template); + if( $default === null ) + return preg_replace($this->defalutPattern, '(\'$2\') ? htmlspecialchars($values[\'$1\'], ENT_QUOTES) : $values[\'$1\']', $template); + return preg_replace($this->defalutPattern, 'isset($values[\'$1\']) ? (\'$2\' ? htmlspecialchars($values[\'$1\'], ENT_QUOTES) : $values[\'$1\']) : \'{{$1}}\' ', $template); + } + + function fetchAndFill($name, $values, $dir = null, $suffix = 'html', $default = null){ + $tpl = $this->fetch($name, $dir, $suffix); + return $this->fill($tpl, $values, $default); + } +} diff --git a/trunk/NP_DragAndDropUploader/sharedlibs/sharedlibs.php b/trunk/NP_DragAndDropUploader/sharedlibs/sharedlibs.php new file mode 100644 index 0000000..1823854 --- /dev/null +++ b/trunk/NP_DragAndDropUploader/sharedlibs/sharedlibs.php @@ -0,0 +1,51 @@ +