summaryrefslogtreecommitdiff
path: root/js/dojo-1.6/dojox/form/uploader/plugins/IFrame.js
diff options
context:
space:
mode:
authorTristan Zur <tzur@web.web.ccwn.org>2014-03-27 22:27:47 +0100
committerTristan Zur <tzur@web.web.ccwn.org>2014-03-27 22:27:47 +0100
commitb62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch)
tree86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /js/dojo-1.6/dojox/form/uploader/plugins/IFrame.js
Initial commit of intern.ccwn.org contentsHEADmaster
Diffstat (limited to 'js/dojo-1.6/dojox/form/uploader/plugins/IFrame.js')
-rw-r--r--js/dojo-1.6/dojox/form/uploader/plugins/IFrame.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/form/uploader/plugins/IFrame.js b/js/dojo-1.6/dojox/form/uploader/plugins/IFrame.js
new file mode 100644
index 0000000..98a69a4
--- /dev/null
+++ b/js/dojo-1.6/dojox/form/uploader/plugins/IFrame.js
@@ -0,0 +1,71 @@
+/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.form.uploader.plugins.IFrame"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.form.uploader.plugins.IFrame"] = true;
+dojo.provide("dojox.form.uploader.plugins.IFrame");
+
+dojo.require("dojox.form.uploader.plugins.HTML5");
+dojo.require("dojo.io.iframe");
+
+dojo.declare("dojox.form.uploader.plugins.IFrame", [], {
+ //
+ // Version: 1.6
+ //
+ // summary:
+ // A plugin for dojox.form.Uploader that adds Ajax upload capabilities.
+ //
+ // description:
+ // Only supported by IE, due to the specifc iFrame hack used. The
+ // dojox.form.uploader.plugins.HTML5 plugin should be used along with this to add HTML5
+ // capabilities to browsers that support them. Progress events are not supported.
+ // Inherits all properties from dojox.form.Uploader and dojox.form.uploader.plugins.HTML5.
+ //
+
+ force:"",
+
+ postMixInProperties: function(){
+ this.inherited(arguments);
+ if(!this.supports("multiple")){
+ this.uploadType = "iframe";
+ }
+ },
+
+ upload: function(/*Object ? */data){
+ // summary:
+ // See: dojox.form.Uploader.upload
+ //
+ if(!this.supports("multiple") || this.force =="iframe"){
+ this.uploadIFrame(data);
+ dojo.stopEvent(data);
+ return;
+ }
+ },
+
+ uploadIFrame: function(){
+ // summary:
+ // Internal. You could use this, but you should use upload() or submit();
+ // which can also handle the post data.
+ //
+ var url = this.getUrl();
+ var dfd = dojo.io.iframe.send({
+ url: this.getUrl(),
+ form: this.form,
+ handleAs: "json",
+ error: dojo.hitch(this, function(err){
+ console.error("HTML Upload Error:" + err.message);
+ }),
+ load: dojo.hitch(this, function(data, ioArgs, widgetRef){
+ this.onComplete(data);
+ })
+ });
+ }
+});
+
+dojox.form.addUploaderPlugin(dojox.form.uploader.plugins.IFrame);
+
+}