freeberry 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/freeberry/controllers/helper_utils.rb +1 -1
- data/lib/freeberry/model_filter.rb +1 -1
- data/lib/freeberry/version.rb +2 -2
- data/lib/generators/freeberry/base/templates/javascripts/jquery.fancybox-1.3.4.pack.js +46 -0
- data/lib/generators/freeberry/base/templates/javascripts/jquery.tmpl.min.js +10 -0
- data/lib/generators/freeberry/base/templates/javascripts/manage.js +26 -0
- data/lib/generators/freeberry/base/templates/javascripts/swfupload/fileprogress.js +114 -0
- data/lib/generators/freeberry/base/templates/javascripts/swfupload/handlers.js +164 -0
- data/lib/generators/freeberry/base/templates/javascripts/swfupload/swfupload.js +1134 -0
- data/lib/generators/freeberry/base/templates/javascripts/swfupload/swfupload.queue.js +98 -0
- data/lib/generators/freeberry/base/templates/javascripts/swfupload/swfupload.swf +0 -0
- data/lib/generators/freeberry/base/templates/stylesheets/fancybox/{jquery.fancybox-1.3.2.css → jquery.fancybox-1.3.4.css} +6 -6
- data/lib/generators/freeberry/base/templates/views/layouts/manage.html.erb +3 -2
- data/lib/generators/freeberry/base/templates/views/manage/assets/_collection.html.erb +9 -26
- data/lib/generators/freeberry/base/templates/views/manage/assets/_picture.html.erb +1 -1
- data/lib/generators/freeberry/base/templates/views/manage/assets/_swfscript.html.erb +7 -15
- metadata +13 -7
- data/lib/generators/freeberry/base/templates/javascripts/jquery.fancybox-1.3.2.pack.js +0 -46
@@ -26,7 +26,7 @@ module Freeberry
|
|
26
26
|
where = options.delete(:conditions)
|
27
27
|
|
28
28
|
{
|
29
|
-
:order => (self.order_by || order || "id DESC"),
|
29
|
+
:order => (self.order_by || order || "#{@klass.quoted_table_name}.id DESC"),
|
30
30
|
:conditions => (self.conditions || where)
|
31
31
|
}.merge(options)
|
32
32
|
end
|
data/lib/freeberry/version.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
/*
|
2
|
+
* FancyBox - jQuery Plugin
|
3
|
+
* Simple and fancy lightbox alternative
|
4
|
+
*
|
5
|
+
* Examples and documentation at: http://fancybox.net
|
6
|
+
*
|
7
|
+
* Copyright (c) 2008 - 2010 Janis Skarnelis
|
8
|
+
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
|
9
|
+
*
|
10
|
+
* Version: 1.3.4 (11/11/2010)
|
11
|
+
* Requires: jQuery v1.3+
|
12
|
+
*
|
13
|
+
* Dual licensed under the MIT and GPL licenses:
|
14
|
+
* http://www.opensource.org/licenses/mit-license.php
|
15
|
+
* http://www.gnu.org/licenses/gpl.html
|
16
|
+
*/
|
17
|
+
|
18
|
+
;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
|
19
|
+
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
|
20
|
+
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
|
21
|
+
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
|
22
|
+
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
|
23
|
+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
|
24
|
+
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
|
25
|
+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
|
26
|
+
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
|
27
|
+
d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
|
28
|
+
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
|
29
|
+
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
|
30
|
+
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
|
31
|
+
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
|
32
|
+
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
|
33
|
+
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
|
34
|
+
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
|
35
|
+
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
|
36
|
+
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
|
37
|
+
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
|
38
|
+
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
|
39
|
+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
|
40
|
+
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
|
41
|
+
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
|
42
|
+
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
|
43
|
+
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
|
44
|
+
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
|
45
|
+
b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
|
46
|
+
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Templates Plugin 1.0.0pre
|
3
|
+
* http://github.com/jquery/jquery-tmpl
|
4
|
+
* Requires jQuery 1.4.2
|
5
|
+
*
|
6
|
+
* Copyright Software Freedom Conservancy, Inc.
|
7
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
8
|
+
* http://jquery.org/license
|
9
|
+
*/
|
10
|
+
(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h<m;h++){c=h;k=(h>0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i<j&&!(f=a.data(h[i++],"tmplItem")));if(f&&c)g[2]=function(b){a.tmpl.afterManip(this,b,k)};r.apply(this,g)}else r.apply(this,arguments);c=0;!e&&a.tmpl.complete(b);return this}});a.extend({tmpl:function(d,h,e,c){var i,k=!c;if(k){c=p;d=a.template[d]||a.template(null,d);f={}}else if(!d){d=c.tmpl;b[c.key]=c;c.nodes=[];c.wrapped&&n(c,c.wrapped);return a(j(c,null,c.tmpl(a,c)))}if(!d)return[];if(typeof h==="function")h=h.call(c||{});e&&e.wrapped&&n(e,e.wrapped);i=a.isArray(h)?a.map(h,function(a){return a?g(e,c,d,a):null}):[g(e,c,d,h)];return k?a(j(c,null,i)):i},tmplItem:function(b){var c;if(b instanceof a)b=b[0];while(b&&b.nodeType===1&&!(c=a.data(b,"tmplItem"))&&(b=b.parentNode));return c||p},template:function(c,b){if(b){if(typeof b==="string")b=o(b);else if(b instanceof a)b=b[0]||{};if(b.nodeType)b=a.data(b,"tmpl")||a.data(b,"tmpl",o(b.innerHTML));return typeof c==="string"?(a.template[c]=b):b}return c?typeof c!=="string"?a.template(null,c):a.template[c]||a.template(null,q.test(c)?c:a(c)):null},encode:function(a){return(""+a).split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e<p;e++){if((k=o[e]).nodeType!==1)continue;j=k.getElementsByTagName("*");for(h=j.length-1;h>=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery);
|
@@ -84,6 +84,32 @@ var Manage = {
|
|
84
84
|
Manage.append_node(sibling, element);
|
85
85
|
}});
|
86
86
|
}
|
87
|
+
},
|
88
|
+
|
89
|
+
init_assets: function(query, url)
|
90
|
+
{
|
91
|
+
$(query + " a.fancybox").fancybox({
|
92
|
+
'titleShow' : false,
|
93
|
+
'transitionIn' : 'none',
|
94
|
+
'transitionOut' : 'none'
|
95
|
+
});
|
96
|
+
|
97
|
+
$(query + ' a.del').bind("ajax:complete", function(){
|
98
|
+
$(this).parents('div.asset').remove();
|
99
|
+
});
|
100
|
+
|
101
|
+
$(query).sortable({
|
102
|
+
revert: true,
|
103
|
+
update: function(event, ui){
|
104
|
+
var data = $(query).sortable('serialize');
|
105
|
+
$.ajax({
|
106
|
+
url: url,
|
107
|
+
data: data,
|
108
|
+
dataType: 'script',
|
109
|
+
type: 'POST'
|
110
|
+
});
|
111
|
+
}
|
112
|
+
});
|
87
113
|
}
|
88
114
|
};
|
89
115
|
|
@@ -0,0 +1,114 @@
|
|
1
|
+
/* ******************************************
|
2
|
+
* FileProgress Object
|
3
|
+
* Control object for displaying file info
|
4
|
+
* ****************************************** */
|
5
|
+
|
6
|
+
function FileProgress(file, targetID) {
|
7
|
+
this.fileProgressID = "divFileProgress";
|
8
|
+
|
9
|
+
this.fileProgressWrapper = document.getElementById(this.fileProgressID);
|
10
|
+
if (!this.fileProgressWrapper) {
|
11
|
+
this.fileProgressWrapper = document.createElement("div");
|
12
|
+
this.fileProgressWrapper.className = "progress-container";
|
13
|
+
this.fileProgressWrapper.id = this.fileProgressID;
|
14
|
+
|
15
|
+
var progressStatus = document.createElement("div");
|
16
|
+
progressStatus.className = "status-message";
|
17
|
+
progressStatus.innerHTML = " ";
|
18
|
+
|
19
|
+
this.fileProgressElement = document.createElement("div");
|
20
|
+
this.fileProgressElement.className = "progress-bar";
|
21
|
+
|
22
|
+
var progressBar = document.createElement("div");
|
23
|
+
progressBar.className = "progress";
|
24
|
+
|
25
|
+
this.fileProgressElement.appendChild(progressBar);
|
26
|
+
|
27
|
+
this.fileProgressWrapper.appendChild(progressStatus);
|
28
|
+
this.fileProgressWrapper.appendChild(this.fileProgressElement);
|
29
|
+
|
30
|
+
document.getElementById(targetID).appendChild(this.fileProgressWrapper);
|
31
|
+
|
32
|
+
} else {
|
33
|
+
this.fileProgressElement = this.fileProgressWrapper.childNodes[1];
|
34
|
+
//this.fileProgressElement.childNodes[1].firstChild.nodeValue = file.name;
|
35
|
+
}
|
36
|
+
|
37
|
+
this.height = this.fileProgressWrapper.offsetHeight;
|
38
|
+
}
|
39
|
+
FileProgress.prototype.setProgress = function(percentage) {
|
40
|
+
var value = parseInt((400 * percentage / 100));
|
41
|
+
this.fileProgressElement.childNodes[0].style.width = value + "px";
|
42
|
+
};
|
43
|
+
FileProgress.prototype.setComplete = function() {
|
44
|
+
/*this.fileProgressElement.className = "progressContainer blue";
|
45
|
+
this.fileProgressElement.childNodes[3].className = "progressBarComplete";
|
46
|
+
this.fileProgressElement.childNodes[3].style.width = "";*/
|
47
|
+
|
48
|
+
};
|
49
|
+
FileProgress.prototype.setError = function() {
|
50
|
+
/*this.fileProgressElement.className = "progressContainer red";
|
51
|
+
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
52
|
+
this.fileProgressElement.childNodes[3].style.width = "";*/
|
53
|
+
|
54
|
+
};
|
55
|
+
FileProgress.prototype.setCancelled = function() {
|
56
|
+
/*this.fileProgressElement.className = "progressContainer";
|
57
|
+
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
58
|
+
this.fileProgressElement.childNodes[3].style.width = "";*/
|
59
|
+
|
60
|
+
};
|
61
|
+
FileProgress.prototype.setStatus = function(status) {
|
62
|
+
this.fileProgressWrapper.childNodes[0].innerHTML = status;
|
63
|
+
};
|
64
|
+
FileProgress.prototype.parseXML = function(xml){
|
65
|
+
var xmlDoc = null;
|
66
|
+
|
67
|
+
if (window.ActiveXObject)
|
68
|
+
{
|
69
|
+
xmlDoc = Ajax.getTransport();
|
70
|
+
xmlDoc.async = false;
|
71
|
+
xmlDoc.loadXML(xml);
|
72
|
+
}
|
73
|
+
else
|
74
|
+
{
|
75
|
+
var parser = new DOMParser();
|
76
|
+
xmlDoc = parser.parseFromString(xml,"text/xml");
|
77
|
+
}
|
78
|
+
|
79
|
+
return xmlDoc;
|
80
|
+
};
|
81
|
+
FileProgress.prototype.setThumbnail = function(serverData, collection_id) {
|
82
|
+
var xml = this.parseXML(serverData);
|
83
|
+
var thumbnail = xml.getElementsByTagName('asset');
|
84
|
+
var collection = document.getElementById(collection_id);
|
85
|
+
|
86
|
+
thumbnail = (thumbnail[0] == null ? xml : thumbnail[0])
|
87
|
+
|
88
|
+
if (thumbnail != null)
|
89
|
+
{
|
90
|
+
var id_node = thumbnail.getElementsByTagName('id')[0];
|
91
|
+
var filename_node = thumbnail.getElementsByTagName('filename')[0];
|
92
|
+
var styles_node = thumbnail.getElementsByTagName('styles')[0];
|
93
|
+
var thumb_node = styles_node ? styles_node.getElementsByTagName('thumb')[0] : thumbnail.getElementsByTagName('thumb')[0];
|
94
|
+
|
95
|
+
var id = id_node.childNodes[0].nodeValue;
|
96
|
+
var filename = filename_node.childNodes[0].nodeValue;
|
97
|
+
var thumb = thumb_node.childNodes[0].nodeValue;
|
98
|
+
|
99
|
+
var picture = { id: id, link_path: thumb, image_path: thumb, image_title: filename };
|
100
|
+
|
101
|
+
$("#asset_tmpl").tmpl(picture).appendTo( collection );
|
102
|
+
}
|
103
|
+
};
|
104
|
+
|
105
|
+
FileProgress.prototype.toggleCancel = function (show, swfuploadInstance) {
|
106
|
+
/*this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
|
107
|
+
if (swfuploadInstance) {
|
108
|
+
var fileID = this.fileProgressID;
|
109
|
+
this.fileProgressElement.childNodes[0].onclick = function () {
|
110
|
+
swfuploadInstance.cancelUpload(fileID);
|
111
|
+
return false;
|
112
|
+
};
|
113
|
+
}*/
|
114
|
+
};
|
@@ -0,0 +1,164 @@
|
|
1
|
+
function uploadStart(file) {
|
2
|
+
try {
|
3
|
+
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
4
|
+
progress.setStatus("Загрузка...");
|
5
|
+
progress.setProgress(0);
|
6
|
+
progress.toggleCancel(true, this);
|
7
|
+
}
|
8
|
+
catch (ex) {}
|
9
|
+
|
10
|
+
return true;
|
11
|
+
}
|
12
|
+
|
13
|
+
function fileQueued(file) {
|
14
|
+
try {
|
15
|
+
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
16
|
+
progress.setStatus("Подготовка...");
|
17
|
+
progress.setProgress(0);
|
18
|
+
progress.toggleCancel(true, this);
|
19
|
+
} catch (ex) {
|
20
|
+
this.debug(ex);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
function fileQueueError(file, errorCode, message) {
|
25
|
+
try {
|
26
|
+
if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
|
27
|
+
alert("You have attempted to queue too many files.\n" + (message === 0 ? "You have reached the upload limit." : "You may select " + (message > 1 ? "up to " + message + " files." : "one file.")));
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
32
|
+
progress.setError();
|
33
|
+
progress.toggleCancel(false);
|
34
|
+
|
35
|
+
switch (errorCode) {
|
36
|
+
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
|
37
|
+
progress.setStatus("File is too big.");
|
38
|
+
this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
39
|
+
break;
|
40
|
+
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
|
41
|
+
progress.setStatus("Cannot upload Zero Byte files.");
|
42
|
+
this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
43
|
+
break;
|
44
|
+
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
|
45
|
+
progress.setStatus("Invalid File Type.");
|
46
|
+
this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
47
|
+
break;
|
48
|
+
default:
|
49
|
+
if (file !== null) {
|
50
|
+
progress.setStatus("Unhandled Error");
|
51
|
+
}
|
52
|
+
this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
53
|
+
break;
|
54
|
+
}
|
55
|
+
} catch (ex) {
|
56
|
+
this.debug(ex);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
function fileDialogComplete(numFilesSelected, numFilesQueued) {
|
61
|
+
try {
|
62
|
+
if (numFilesSelected > 0) {
|
63
|
+
//document.getElementById(this.customSettings.cancelButtonId).disabled = false;
|
64
|
+
$(this.customSettings.progressTarget).show();
|
65
|
+
}
|
66
|
+
|
67
|
+
this.startUpload();
|
68
|
+
} catch (ex) {
|
69
|
+
this.debug(ex);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
function uploadProgress(file, bytesLoaded) {
|
74
|
+
try {
|
75
|
+
var percent = Math.ceil((bytesLoaded / file.size) * 100);
|
76
|
+
|
77
|
+
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
78
|
+
progress.setProgress(percent);
|
79
|
+
if (percent === 100) {
|
80
|
+
progress.setStatus("Создание thumbnail...");
|
81
|
+
progress.toggleCancel(false, this);
|
82
|
+
} else {
|
83
|
+
progress.setStatus("Загрузка...");
|
84
|
+
progress.toggleCancel(true, this);
|
85
|
+
}
|
86
|
+
} catch (ex) {
|
87
|
+
this.debug(ex);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
function uploadSuccess(file, serverData) {
|
92
|
+
try {
|
93
|
+
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
94
|
+
progress.setComplete();
|
95
|
+
progress.setStatus("Завершено.");
|
96
|
+
progress.toggleCancel(false);
|
97
|
+
|
98
|
+
progress.setThumbnail(serverData, this.customSettings.collectionTarget);
|
99
|
+
|
100
|
+
} catch (ex) {
|
101
|
+
this.debug(ex);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
function uploadComplete(file) {
|
106
|
+
try {
|
107
|
+
/* I want the next upload to continue automatically so I'll call startUpload here */
|
108
|
+
if (this.getStats().files_queued > 0) {
|
109
|
+
//this.startUpload();
|
110
|
+
} else {
|
111
|
+
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
112
|
+
progress.setComplete();
|
113
|
+
progress.setStatus("Все картинки успешно обработано.");
|
114
|
+
progress.toggleCancel(false);
|
115
|
+
}
|
116
|
+
} catch (ex) {
|
117
|
+
this.debug(ex);
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
function uploadError(file, errorCode, message) {
|
122
|
+
var progress;
|
123
|
+
try {
|
124
|
+
switch (errorCode) {
|
125
|
+
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
|
126
|
+
try {
|
127
|
+
progress = new FileProgress(file, this.customSettings.progressTarget);
|
128
|
+
progress.setCancelled();
|
129
|
+
progress.setStatus("Отменено");
|
130
|
+
progress.toggleCancel(false);
|
131
|
+
}
|
132
|
+
catch (ex1) {
|
133
|
+
this.debug(ex1);
|
134
|
+
}
|
135
|
+
break;
|
136
|
+
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
|
137
|
+
try {
|
138
|
+
progress = new FileProgress(file, this.customSettings.progressTarget);
|
139
|
+
progress.setCancelled();
|
140
|
+
progress.setStatus("Остановлено");
|
141
|
+
progress.toggleCancel(true);
|
142
|
+
}
|
143
|
+
catch (ex2) {
|
144
|
+
this.debug(ex2);
|
145
|
+
}
|
146
|
+
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
|
147
|
+
break;
|
148
|
+
default:
|
149
|
+
alert(message);
|
150
|
+
break;
|
151
|
+
}
|
152
|
+
} catch (ex3) {
|
153
|
+
this.debug(ex3);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
// This event comes from the Queue Plugin
|
158
|
+
function queueComplete(numFilesUploaded) {
|
159
|
+
var progress_bar = document.getElementById(this.customSettings.progressTarget);
|
160
|
+
progress_bar.style.display = 'none';
|
161
|
+
|
162
|
+
/*var status = document.getElementById("divStatus");
|
163
|
+
status.innerHTML = numFilesUploaded + " file" + (numFilesUploaded === 1 ? "" : "s") + " uploaded.";*/
|
164
|
+
}
|
@@ -0,0 +1,1134 @@
|
|
1
|
+
/**
|
2
|
+
* SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
|
3
|
+
*
|
4
|
+
* mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/
|
5
|
+
*
|
6
|
+
* SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz�n and Mammon Media and is released under the MIT License:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
*
|
9
|
+
* SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
|
10
|
+
* http://www.opensource.org/licenses/mit-license.php
|
11
|
+
*
|
12
|
+
* SWFObject v2.2 <http://code.google.com/p/swfobject/>
|
13
|
+
* is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
14
|
+
*/
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
/* ******************* */
|
19
|
+
/* Constructor & Init */
|
20
|
+
/* ******************* */
|
21
|
+
var SWFUpload;
|
22
|
+
var swfobject;
|
23
|
+
|
24
|
+
if (SWFUpload == undefined) {
|
25
|
+
SWFUpload = function (settings) {
|
26
|
+
this.initSWFUpload(settings);
|
27
|
+
};
|
28
|
+
}
|
29
|
+
|
30
|
+
SWFUpload.prototype.initSWFUpload = function (userSettings) {
|
31
|
+
try {
|
32
|
+
this.customSettings = {}; // A container where developers can place their own settings associated with this instance.
|
33
|
+
this.settings = {};
|
34
|
+
this.eventQueue = [];
|
35
|
+
this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
|
36
|
+
this.movieElement = null;
|
37
|
+
|
38
|
+
|
39
|
+
// Setup global control tracking
|
40
|
+
SWFUpload.instances[this.movieName] = this;
|
41
|
+
|
42
|
+
// Load the settings. Load the Flash movie.
|
43
|
+
this.initSettings(userSettings);
|
44
|
+
this.loadSupport();
|
45
|
+
if (this.swfuploadPreload()) {
|
46
|
+
this.loadFlash();
|
47
|
+
}
|
48
|
+
|
49
|
+
this.displayDebugInfo();
|
50
|
+
} catch (ex) {
|
51
|
+
delete SWFUpload.instances[this.movieName];
|
52
|
+
throw ex;
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
/* *************** */
|
57
|
+
/* Static Members */
|
58
|
+
/* *************** */
|
59
|
+
SWFUpload.instances = {};
|
60
|
+
SWFUpload.movieCount = 0;
|
61
|
+
SWFUpload.version = "2.5.0 2010-01-15 Beta 2";
|
62
|
+
SWFUpload.QUEUE_ERROR = {
|
63
|
+
QUEUE_LIMIT_EXCEEDED : -100,
|
64
|
+
FILE_EXCEEDS_SIZE_LIMIT : -110,
|
65
|
+
ZERO_BYTE_FILE : -120,
|
66
|
+
INVALID_FILETYPE : -130
|
67
|
+
};
|
68
|
+
SWFUpload.UPLOAD_ERROR = {
|
69
|
+
HTTP_ERROR : -200,
|
70
|
+
MISSING_UPLOAD_URL : -210,
|
71
|
+
IO_ERROR : -220,
|
72
|
+
SECURITY_ERROR : -230,
|
73
|
+
UPLOAD_LIMIT_EXCEEDED : -240,
|
74
|
+
UPLOAD_FAILED : -250,
|
75
|
+
SPECIFIED_FILE_ID_NOT_FOUND : -260,
|
76
|
+
FILE_VALIDATION_FAILED : -270,
|
77
|
+
FILE_CANCELLED : -280,
|
78
|
+
UPLOAD_STOPPED : -290,
|
79
|
+
RESIZE : -300
|
80
|
+
};
|
81
|
+
SWFUpload.FILE_STATUS = {
|
82
|
+
QUEUED : -1,
|
83
|
+
IN_PROGRESS : -2,
|
84
|
+
ERROR : -3,
|
85
|
+
COMPLETE : -4,
|
86
|
+
CANCELLED : -5
|
87
|
+
};
|
88
|
+
SWFUpload.UPLOAD_TYPE = {
|
89
|
+
NORMAL : -1,
|
90
|
+
RESIZED : -2
|
91
|
+
};
|
92
|
+
|
93
|
+
SWFUpload.BUTTON_ACTION = {
|
94
|
+
SELECT_FILE : -100,
|
95
|
+
SELECT_FILES : -110,
|
96
|
+
START_UPLOAD : -120,
|
97
|
+
JAVASCRIPT : -130, // DEPRECATED
|
98
|
+
NONE : -130
|
99
|
+
};
|
100
|
+
SWFUpload.CURSOR = {
|
101
|
+
ARROW : -1,
|
102
|
+
HAND : -2
|
103
|
+
};
|
104
|
+
SWFUpload.WINDOW_MODE = {
|
105
|
+
WINDOW : "window",
|
106
|
+
TRANSPARENT : "transparent",
|
107
|
+
OPAQUE : "opaque"
|
108
|
+
};
|
109
|
+
|
110
|
+
SWFUpload.RESIZE_ENCODING = {
|
111
|
+
JPEG : -1,
|
112
|
+
PNG : -2
|
113
|
+
};
|
114
|
+
|
115
|
+
// Private: takes a URL, determines if it is relative and converts to an absolute URL
|
116
|
+
// using the current site. Only processes the URL if it can, otherwise returns the URL untouched
|
117
|
+
SWFUpload.completeURL = function (url) {
|
118
|
+
try {
|
119
|
+
var path = "", indexSlash = -1;
|
120
|
+
if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//) || url === "") {
|
121
|
+
return url;
|
122
|
+
}
|
123
|
+
|
124
|
+
indexSlash = window.location.pathname.lastIndexOf("/");
|
125
|
+
if (indexSlash <= 0) {
|
126
|
+
path = "/";
|
127
|
+
} else {
|
128
|
+
path = window.location.pathname.substr(0, indexSlash) + "/";
|
129
|
+
}
|
130
|
+
|
131
|
+
return path + url;
|
132
|
+
} catch (ex) {
|
133
|
+
return url;
|
134
|
+
}
|
135
|
+
};
|
136
|
+
|
137
|
+
// Public: assign a new function to onload to use swfobject's domLoad functionality
|
138
|
+
SWFUpload.onload = function () {};
|
139
|
+
|
140
|
+
|
141
|
+
/* ******************** */
|
142
|
+
/* Instance Members */
|
143
|
+
/* ******************** */
|
144
|
+
|
145
|
+
// Private: initSettings ensures that all the
|
146
|
+
// settings are set, getting a default value if one was not assigned.
|
147
|
+
SWFUpload.prototype.initSettings = function (userSettings) {
|
148
|
+
this.user_settings = userSettings;
|
149
|
+
|
150
|
+
this.ensureDefault = function (settingName, defaultValue) {
|
151
|
+
var setting = this.user_settings[settingName];
|
152
|
+
if (setting != undefined) {
|
153
|
+
this.settings[settingName] = setting;
|
154
|
+
} else {
|
155
|
+
this.settings[settingName] = defaultValue;
|
156
|
+
}
|
157
|
+
};
|
158
|
+
|
159
|
+
// Upload backend settings
|
160
|
+
this.ensureDefault("upload_url", "");
|
161
|
+
this.ensureDefault("preserve_relative_urls", false);
|
162
|
+
this.ensureDefault("file_post_name", "Filedata");
|
163
|
+
this.ensureDefault("post_params", {});
|
164
|
+
this.ensureDefault("use_query_string", false);
|
165
|
+
this.ensureDefault("requeue_on_error", false);
|
166
|
+
this.ensureDefault("http_success", []);
|
167
|
+
this.ensureDefault("assume_success_timeout", 0);
|
168
|
+
|
169
|
+
// File Settings
|
170
|
+
this.ensureDefault("file_types", "*.*");
|
171
|
+
this.ensureDefault("file_types_description", "All Files");
|
172
|
+
this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited"
|
173
|
+
this.ensureDefault("file_upload_limit", 0);
|
174
|
+
this.ensureDefault("file_queue_limit", 0);
|
175
|
+
|
176
|
+
// Flash Settings
|
177
|
+
this.ensureDefault("flash_url", "swfupload.swf");
|
178
|
+
this.ensureDefault("flash9_url", "swfupload_fp9.swf");
|
179
|
+
this.ensureDefault("prevent_swf_caching", true);
|
180
|
+
|
181
|
+
// Button Settings
|
182
|
+
this.ensureDefault("button_image_url", "");
|
183
|
+
this.ensureDefault("button_width", 1);
|
184
|
+
this.ensureDefault("button_height", 1);
|
185
|
+
this.ensureDefault("button_text", "");
|
186
|
+
this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
|
187
|
+
this.ensureDefault("button_text_top_padding", 0);
|
188
|
+
this.ensureDefault("button_text_left_padding", 0);
|
189
|
+
this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
|
190
|
+
this.ensureDefault("button_disabled", false);
|
191
|
+
this.ensureDefault("button_placeholder_id", "");
|
192
|
+
this.ensureDefault("button_placeholder", null);
|
193
|
+
this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
|
194
|
+
this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
|
195
|
+
|
196
|
+
// Debug Settings
|
197
|
+
this.ensureDefault("debug", false);
|
198
|
+
this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API
|
199
|
+
|
200
|
+
// Event Handlers
|
201
|
+
this.settings.return_upload_start_handler = this.returnUploadStart;
|
202
|
+
this.ensureDefault("swfupload_preload_handler", null);
|
203
|
+
this.ensureDefault("swfupload_load_failed_handler", null);
|
204
|
+
this.ensureDefault("swfupload_loaded_handler", null);
|
205
|
+
this.ensureDefault("file_dialog_start_handler", null);
|
206
|
+
this.ensureDefault("file_queued_handler", null);
|
207
|
+
this.ensureDefault("file_queue_error_handler", null);
|
208
|
+
this.ensureDefault("file_dialog_complete_handler", null);
|
209
|
+
|
210
|
+
this.ensureDefault("upload_resize_start_handler", null);
|
211
|
+
this.ensureDefault("upload_start_handler", null);
|
212
|
+
this.ensureDefault("upload_progress_handler", null);
|
213
|
+
this.ensureDefault("upload_error_handler", null);
|
214
|
+
this.ensureDefault("upload_success_handler", null);
|
215
|
+
this.ensureDefault("upload_complete_handler", null);
|
216
|
+
|
217
|
+
this.ensureDefault("mouse_click_handler", null);
|
218
|
+
this.ensureDefault("mouse_out_handler", null);
|
219
|
+
this.ensureDefault("mouse_over_handler", null);
|
220
|
+
|
221
|
+
this.ensureDefault("debug_handler", this.debugMessage);
|
222
|
+
|
223
|
+
this.ensureDefault("custom_settings", {});
|
224
|
+
|
225
|
+
// Other settings
|
226
|
+
this.customSettings = this.settings.custom_settings;
|
227
|
+
|
228
|
+
// Update the flash url if needed
|
229
|
+
if (!!this.settings.prevent_swf_caching) {
|
230
|
+
this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
|
231
|
+
this.settings.flash9_url = this.settings.flash9_url + (this.settings.flash9_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
|
232
|
+
}
|
233
|
+
|
234
|
+
if (!this.settings.preserve_relative_urls) {
|
235
|
+
this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
|
236
|
+
this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
|
237
|
+
}
|
238
|
+
|
239
|
+
delete this.ensureDefault;
|
240
|
+
};
|
241
|
+
|
242
|
+
// Initializes the supported functionality based the Flash Player version, state, and event that occur during initialization
|
243
|
+
SWFUpload.prototype.loadSupport = function () {
|
244
|
+
this.support = {
|
245
|
+
loading : swfobject.hasFlashPlayerVersion("9.0.28"),
|
246
|
+
imageResize : swfobject.hasFlashPlayerVersion("10.0.0")
|
247
|
+
};
|
248
|
+
|
249
|
+
};
|
250
|
+
|
251
|
+
// Private: loadFlash replaces the button_placeholder element with the flash movie.
|
252
|
+
SWFUpload.prototype.loadFlash = function () {
|
253
|
+
var targetElement, tempParent, wrapperType, flashHTML, els;
|
254
|
+
|
255
|
+
if (!this.support.loading) {
|
256
|
+
this.queueEvent("swfupload_load_failed_handler", ["Flash Player doesn't support SWFUpload"]);
|
257
|
+
return;
|
258
|
+
}
|
259
|
+
|
260
|
+
// Make sure an element with the ID we are going to use doesn't already exist
|
261
|
+
if (document.getElementById(this.movieName) !== null) {
|
262
|
+
this.support.loading = false;
|
263
|
+
this.queueEvent("swfupload_load_failed_handler", ["Element ID already in use"]);
|
264
|
+
return;
|
265
|
+
}
|
266
|
+
|
267
|
+
// Get the element where we will be placing the flash movie
|
268
|
+
targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
|
269
|
+
|
270
|
+
if (targetElement == undefined) {
|
271
|
+
this.support.loading = false;
|
272
|
+
this.queueEvent("swfupload_load_failed_handler", ["button place holder not found"]);
|
273
|
+
return;
|
274
|
+
}
|
275
|
+
|
276
|
+
wrapperType = (targetElement.currentStyle && targetElement.currentStyle["display"] || window.getComputedStyle && document.defaultView.getComputedStyle(targetElement, null).getPropertyValue("display")) !== "block" ? "span" : "div";
|
277
|
+
|
278
|
+
// Append the container and load the flash
|
279
|
+
tempParent = document.createElement(wrapperType);
|
280
|
+
|
281
|
+
flashHTML = this.getFlashHTML();
|
282
|
+
|
283
|
+
try {
|
284
|
+
tempParent.innerHTML = flashHTML; // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
|
285
|
+
} catch (ex) {
|
286
|
+
this.support.loading = false;
|
287
|
+
this.queueEvent("swfupload_load_failed_handler", ["Exception loading Flash HTML into placeholder"]);
|
288
|
+
return;
|
289
|
+
}
|
290
|
+
|
291
|
+
// Try to get the movie element immediately
|
292
|
+
els = tempParent.getElementsByTagName("object");
|
293
|
+
if (!els || els.length > 1 || els.length === 0) {
|
294
|
+
this.support.loading = false;
|
295
|
+
this.queueEvent("swfupload_load_failed_handler", ["Unable to find movie after adding to DOM"]);
|
296
|
+
return;
|
297
|
+
} else if (els.length === 1) {
|
298
|
+
this.movieElement = els[0];
|
299
|
+
}
|
300
|
+
|
301
|
+
targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
|
302
|
+
|
303
|
+
// Fix IE Flash/Form bug
|
304
|
+
if (window[this.movieName] == undefined) {
|
305
|
+
window[this.movieName] = this.getMovieElement();
|
306
|
+
}
|
307
|
+
};
|
308
|
+
|
309
|
+
// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
|
310
|
+
SWFUpload.prototype.getFlashHTML = function (flashVersion) {
|
311
|
+
// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
|
312
|
+
return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', (this.support.imageResize ? this.settings.flash_url : this.settings.flash9_url), '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
|
313
|
+
'<param name="wmode" value="', this.settings.button_window_mode, '" />',
|
314
|
+
'<param name="movie" value="', (this.support.imageResize ? this.settings.flash_url : this.settings.flash9_url), '" />',
|
315
|
+
'<param name="quality" value="high" />',
|
316
|
+
'<param name="allowScriptAccess" value="always" />',
|
317
|
+
'<param name="flashvars" value="' + this.getFlashVars() + '" />',
|
318
|
+
'</object>'].join("");
|
319
|
+
};
|
320
|
+
|
321
|
+
// Private: getFlashVars builds the parameter string that will be passed
|
322
|
+
// to flash in the flashvars param.
|
323
|
+
SWFUpload.prototype.getFlashVars = function () {
|
324
|
+
// Build a string from the post param object
|
325
|
+
var httpSuccessString, paramString;
|
326
|
+
|
327
|
+
paramString = this.buildParamString();
|
328
|
+
httpSuccessString = this.settings.http_success.join(",");
|
329
|
+
|
330
|
+
// Build the parameter string
|
331
|
+
return ["movieName=", encodeURIComponent(this.movieName),
|
332
|
+
"&uploadURL=", encodeURIComponent(this.settings.upload_url),
|
333
|
+
"&useQueryString=", encodeURIComponent(this.settings.use_query_string),
|
334
|
+
"&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
|
335
|
+
"&httpSuccess=", encodeURIComponent(httpSuccessString),
|
336
|
+
"&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
|
337
|
+
"&params=", encodeURIComponent(paramString),
|
338
|
+
"&filePostName=", encodeURIComponent(this.settings.file_post_name),
|
339
|
+
"&fileTypes=", encodeURIComponent(this.settings.file_types),
|
340
|
+
"&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
|
341
|
+
"&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
|
342
|
+
"&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
|
343
|
+
"&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
|
344
|
+
"&debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
|
345
|
+
"&buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
|
346
|
+
"&buttonWidth=", encodeURIComponent(this.settings.button_width),
|
347
|
+
"&buttonHeight=", encodeURIComponent(this.settings.button_height),
|
348
|
+
"&buttonText=", encodeURIComponent(this.settings.button_text),
|
349
|
+
"&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
|
350
|
+
"&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
|
351
|
+
"&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
|
352
|
+
"&buttonAction=", encodeURIComponent(this.settings.button_action),
|
353
|
+
"&buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
|
354
|
+
"&buttonCursor=", encodeURIComponent(this.settings.button_cursor)
|
355
|
+
].join("");
|
356
|
+
};
|
357
|
+
|
358
|
+
// Public: get retrieves the DOM reference to the Flash element added by SWFUpload
|
359
|
+
// The element is cached after the first lookup
|
360
|
+
SWFUpload.prototype.getMovieElement = function () {
|
361
|
+
if (this.movieElement == undefined) {
|
362
|
+
this.movieElement = document.getElementById(this.movieName);
|
363
|
+
}
|
364
|
+
|
365
|
+
if (this.movieElement === null) {
|
366
|
+
throw "Could not find Flash element";
|
367
|
+
}
|
368
|
+
|
369
|
+
return this.movieElement;
|
370
|
+
};
|
371
|
+
|
372
|
+
// Private: buildParamString takes the name/value pairs in the post_params setting object
|
373
|
+
// and joins them up in to a string formatted "name=value&name=value"
|
374
|
+
SWFUpload.prototype.buildParamString = function () {
|
375
|
+
var name, postParams, paramStringPairs = [];
|
376
|
+
|
377
|
+
postParams = this.settings.post_params;
|
378
|
+
|
379
|
+
if (typeof(postParams) === "object") {
|
380
|
+
for (name in postParams) {
|
381
|
+
if (postParams.hasOwnProperty(name)) {
|
382
|
+
paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
|
383
|
+
}
|
384
|
+
}
|
385
|
+
}
|
386
|
+
|
387
|
+
return paramStringPairs.join("&");
|
388
|
+
};
|
389
|
+
|
390
|
+
// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
|
391
|
+
// all references to the SWF, and other objects so memory is properly freed.
|
392
|
+
// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
|
393
|
+
// Credits: Major improvements provided by steffen
|
394
|
+
SWFUpload.prototype.destroy = function () {
|
395
|
+
var movieElement;
|
396
|
+
|
397
|
+
try {
|
398
|
+
// Make sure Flash is done before we try to remove it
|
399
|
+
this.cancelUpload(null, false);
|
400
|
+
|
401
|
+
movieElement = this.cleanUp();
|
402
|
+
|
403
|
+
// Remove the SWFUpload DOM nodes
|
404
|
+
if (movieElement) {
|
405
|
+
// Remove the Movie Element from the page
|
406
|
+
try {
|
407
|
+
movieElement.parentNode.removeChild(movieElement);
|
408
|
+
} catch (ex) {}
|
409
|
+
}
|
410
|
+
|
411
|
+
// Remove IE form fix reference
|
412
|
+
window[this.movieName] = null;
|
413
|
+
|
414
|
+
// Destroy other references
|
415
|
+
SWFUpload.instances[this.movieName] = null;
|
416
|
+
delete SWFUpload.instances[this.movieName];
|
417
|
+
|
418
|
+
this.movieElement = null;
|
419
|
+
this.settings = null;
|
420
|
+
this.customSettings = null;
|
421
|
+
this.eventQueue = null;
|
422
|
+
this.movieName = null;
|
423
|
+
|
424
|
+
|
425
|
+
return true;
|
426
|
+
} catch (ex2) {
|
427
|
+
return false;
|
428
|
+
}
|
429
|
+
};
|
430
|
+
|
431
|
+
|
432
|
+
// Public: displayDebugInfo prints out settings and configuration
|
433
|
+
// information about this SWFUpload instance.
|
434
|
+
// This function (and any references to it) can be deleted when placing
|
435
|
+
// SWFUpload in production.
|
436
|
+
SWFUpload.prototype.displayDebugInfo = function () {
|
437
|
+
this.debug(
|
438
|
+
[
|
439
|
+
"---SWFUpload Instance Info---\n",
|
440
|
+
"Version: ", SWFUpload.version, "\n",
|
441
|
+
"Movie Name: ", this.movieName, "\n",
|
442
|
+
"Settings:\n",
|
443
|
+
"\t", "upload_url: ", this.settings.upload_url, "\n",
|
444
|
+
"\t", "flash_url: ", this.settings.flash_url, "\n",
|
445
|
+
"\t", "flash9_url: ", this.settings.flash9_url, "\n",
|
446
|
+
"\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n",
|
447
|
+
"\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n",
|
448
|
+
"\t", "http_success: ", this.settings.http_success.join(", "), "\n",
|
449
|
+
"\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n",
|
450
|
+
"\t", "file_post_name: ", this.settings.file_post_name, "\n",
|
451
|
+
"\t", "post_params: ", this.settings.post_params.toString(), "\n",
|
452
|
+
"\t", "file_types: ", this.settings.file_types, "\n",
|
453
|
+
"\t", "file_types_description: ", this.settings.file_types_description, "\n",
|
454
|
+
"\t", "file_size_limit: ", this.settings.file_size_limit, "\n",
|
455
|
+
"\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n",
|
456
|
+
"\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n",
|
457
|
+
"\t", "debug: ", this.settings.debug.toString(), "\n",
|
458
|
+
|
459
|
+
"\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n",
|
460
|
+
|
461
|
+
"\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n",
|
462
|
+
"\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
|
463
|
+
"\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n",
|
464
|
+
"\t", "button_width: ", this.settings.button_width.toString(), "\n",
|
465
|
+
"\t", "button_height: ", this.settings.button_height.toString(), "\n",
|
466
|
+
"\t", "button_text: ", this.settings.button_text.toString(), "\n",
|
467
|
+
"\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n",
|
468
|
+
"\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n",
|
469
|
+
"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
|
470
|
+
"\t", "button_action: ", this.settings.button_action.toString(), "\n",
|
471
|
+
"\t", "button_cursor: ", this.settings.button_cursor.toString(), "\n",
|
472
|
+
"\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n",
|
473
|
+
|
474
|
+
"\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n",
|
475
|
+
"Event Handlers:\n",
|
476
|
+
"\t", "swfupload_preload_handler assigned: ", (typeof this.settings.swfupload_preload_handler === "function").toString(), "\n",
|
477
|
+
"\t", "swfupload_load_failed_handler assigned: ", (typeof this.settings.swfupload_load_failed_handler === "function").toString(), "\n",
|
478
|
+
"\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
|
479
|
+
"\t", "mouse_click_handler assigned: ", (typeof this.settings.mouse_click_handler === "function").toString(), "\n",
|
480
|
+
"\t", "mouse_over_handler assigned: ", (typeof this.settings.mouse_over_handler === "function").toString(), "\n",
|
481
|
+
"\t", "mouse_out_handler assigned: ", (typeof this.settings.mouse_out_handler === "function").toString(), "\n",
|
482
|
+
"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
|
483
|
+
"\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
|
484
|
+
"\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
|
485
|
+
"\t", "upload_resize_start_handler assigned: ", (typeof this.settings.upload_resize_start_handler === "function").toString(), "\n",
|
486
|
+
"\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
|
487
|
+
"\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
|
488
|
+
"\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
|
489
|
+
"\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
|
490
|
+
"\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
|
491
|
+
"\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n",
|
492
|
+
|
493
|
+
"Support:\n",
|
494
|
+
"\t", "Load: ", (this.support.loading ? "Yes" : "No"), "\n",
|
495
|
+
"\t", "Image Resize: ", (this.support.imageResize ? "Yes" : "No"), "\n"
|
496
|
+
|
497
|
+
].join("")
|
498
|
+
);
|
499
|
+
};
|
500
|
+
|
501
|
+
/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
|
502
|
+
the maintain v2 API compatibility
|
503
|
+
*/
|
504
|
+
// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
|
505
|
+
SWFUpload.prototype.addSetting = function (name, value, default_value) {
|
506
|
+
if (value == undefined) {
|
507
|
+
return (this.settings[name] = default_value);
|
508
|
+
} else {
|
509
|
+
return (this.settings[name] = value);
|
510
|
+
}
|
511
|
+
};
|
512
|
+
|
513
|
+
// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
|
514
|
+
SWFUpload.prototype.getSetting = function (name) {
|
515
|
+
if (this.settings[name] != undefined) {
|
516
|
+
return this.settings[name];
|
517
|
+
}
|
518
|
+
|
519
|
+
return "";
|
520
|
+
};
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
// Private: callFlash handles function calls made to the Flash element.
|
525
|
+
// Calls are made with a setTimeout for some functions to work around
|
526
|
+
// bugs in the ExternalInterface library.
|
527
|
+
SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
|
528
|
+
var movieElement, returnValue, returnString;
|
529
|
+
|
530
|
+
argumentArray = argumentArray || [];
|
531
|
+
movieElement = this.getMovieElement();
|
532
|
+
|
533
|
+
// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
|
534
|
+
try {
|
535
|
+
if (movieElement != undefined) {
|
536
|
+
returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
|
537
|
+
returnValue = eval(returnString);
|
538
|
+
} else {
|
539
|
+
this.debug("Can't call flash because the movie wasn't found.");
|
540
|
+
}
|
541
|
+
} catch (ex) {
|
542
|
+
this.debug("Exception calling flash function '" + functionName + "': " + ex.message);
|
543
|
+
}
|
544
|
+
|
545
|
+
// Unescape file post param values
|
546
|
+
if (returnValue != undefined && typeof returnValue.post === "object") {
|
547
|
+
returnValue = this.unescapeFilePostParams(returnValue);
|
548
|
+
}
|
549
|
+
|
550
|
+
return returnValue;
|
551
|
+
};
|
552
|
+
|
553
|
+
/* *****************************
|
554
|
+
-- Flash control methods --
|
555
|
+
Your UI should use these
|
556
|
+
to operate SWFUpload
|
557
|
+
***************************** */
|
558
|
+
|
559
|
+
// WARNING: this function does not work in Flash Player 10
|
560
|
+
// Public: selectFile causes a File Selection Dialog window to appear. This
|
561
|
+
// dialog only allows 1 file to be selected.
|
562
|
+
SWFUpload.prototype.selectFile = function () {
|
563
|
+
this.callFlash("SelectFile");
|
564
|
+
};
|
565
|
+
|
566
|
+
// WARNING: this function does not work in Flash Player 10
|
567
|
+
// Public: selectFiles causes a File Selection Dialog window to appear/ This
|
568
|
+
// dialog allows the user to select any number of files
|
569
|
+
// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
|
570
|
+
// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around
|
571
|
+
// for this bug.
|
572
|
+
SWFUpload.prototype.selectFiles = function () {
|
573
|
+
this.callFlash("SelectFiles");
|
574
|
+
};
|
575
|
+
|
576
|
+
|
577
|
+
// Public: startUpload starts uploading the first file in the queue unless
|
578
|
+
// the optional parameter 'fileID' specifies the ID
|
579
|
+
SWFUpload.prototype.startUpload = function (fileID) {
|
580
|
+
this.callFlash("StartUpload", [fileID]);
|
581
|
+
};
|
582
|
+
|
583
|
+
// Public: startUpload starts uploading the first file in the queue unless
|
584
|
+
// the optional parameter 'fileID' specifies the ID
|
585
|
+
SWFUpload.prototype.startResizedUpload = function (fileID, width, height, encoding, quality, allowEnlarging) {
|
586
|
+
this.callFlash("StartUpload", [fileID, { "width": width, "height" : height, "encoding" : encoding, "quality" : quality, "allowEnlarging" : allowEnlarging }]);
|
587
|
+
};
|
588
|
+
|
589
|
+
// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index.
|
590
|
+
// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
|
591
|
+
// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
|
592
|
+
SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
|
593
|
+
if (triggerErrorEvent !== false) {
|
594
|
+
triggerErrorEvent = true;
|
595
|
+
}
|
596
|
+
this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
|
597
|
+
};
|
598
|
+
|
599
|
+
// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
|
600
|
+
// If nothing is currently uploading then nothing happens.
|
601
|
+
SWFUpload.prototype.stopUpload = function () {
|
602
|
+
this.callFlash("StopUpload");
|
603
|
+
};
|
604
|
+
|
605
|
+
|
606
|
+
// Public: requeueUpload requeues any file. If the file is requeued or already queued true is returned.
|
607
|
+
// If the file is not found or is currently uploading false is returned. Requeuing a file bypasses the
|
608
|
+
// file size, queue size, upload limit and other queue checks. Certain files can't be requeued (e.g, invalid or zero bytes files).
|
609
|
+
SWFUpload.prototype.requeueUpload = function (indexOrFileID) {
|
610
|
+
return this.callFlash("RequeueUpload", [indexOrFileID]);
|
611
|
+
};
|
612
|
+
|
613
|
+
|
614
|
+
/* ************************
|
615
|
+
* Settings methods
|
616
|
+
* These methods change the SWFUpload settings.
|
617
|
+
* SWFUpload settings should not be changed directly on the settings object
|
618
|
+
* since many of the settings need to be passed to Flash in order to take
|
619
|
+
* effect.
|
620
|
+
* *********************** */
|
621
|
+
|
622
|
+
// Public: getStats gets the file statistics object.
|
623
|
+
SWFUpload.prototype.getStats = function () {
|
624
|
+
return this.callFlash("GetStats");
|
625
|
+
};
|
626
|
+
|
627
|
+
// Public: setStats changes the SWFUpload statistics. You shouldn't need to
|
628
|
+
// change the statistics but you can. Changing the statistics does not
|
629
|
+
// affect SWFUpload accept for the successful_uploads count which is used
|
630
|
+
// by the upload_limit setting to determine how many files the user may upload.
|
631
|
+
SWFUpload.prototype.setStats = function (statsObject) {
|
632
|
+
this.callFlash("SetStats", [statsObject]);
|
633
|
+
};
|
634
|
+
|
635
|
+
// Public: getFile retrieves a File object by ID or Index. If the file is
|
636
|
+
// not found then 'null' is returned.
|
637
|
+
SWFUpload.prototype.getFile = function (fileID) {
|
638
|
+
if (typeof(fileID) === "number") {
|
639
|
+
return this.callFlash("GetFileByIndex", [fileID]);
|
640
|
+
} else {
|
641
|
+
return this.callFlash("GetFile", [fileID]);
|
642
|
+
}
|
643
|
+
};
|
644
|
+
|
645
|
+
// Public: getFileFromQueue retrieves a File object by ID or Index. If the file is
|
646
|
+
// not found then 'null' is returned.
|
647
|
+
SWFUpload.prototype.getQueueFile = function (fileID) {
|
648
|
+
if (typeof(fileID) === "number") {
|
649
|
+
return this.callFlash("GetFileByQueueIndex", [fileID]);
|
650
|
+
} else {
|
651
|
+
return this.callFlash("GetFile", [fileID]);
|
652
|
+
}
|
653
|
+
};
|
654
|
+
|
655
|
+
|
656
|
+
// Public: addFileParam sets a name/value pair that will be posted with the
|
657
|
+
// file specified by the Files ID. If the name already exists then the
|
658
|
+
// exiting value will be overwritten.
|
659
|
+
SWFUpload.prototype.addFileParam = function (fileID, name, value) {
|
660
|
+
return this.callFlash("AddFileParam", [fileID, name, value]);
|
661
|
+
};
|
662
|
+
|
663
|
+
// Public: removeFileParam removes a previously set (by addFileParam) name/value
|
664
|
+
// pair from the specified file.
|
665
|
+
SWFUpload.prototype.removeFileParam = function (fileID, name) {
|
666
|
+
this.callFlash("RemoveFileParam", [fileID, name]);
|
667
|
+
};
|
668
|
+
|
669
|
+
// Public: setUploadUrl changes the upload_url setting.
|
670
|
+
SWFUpload.prototype.setUploadURL = function (url) {
|
671
|
+
this.settings.upload_url = url.toString();
|
672
|
+
this.callFlash("SetUploadURL", [url]);
|
673
|
+
};
|
674
|
+
|
675
|
+
// Public: setPostParams changes the post_params setting
|
676
|
+
SWFUpload.prototype.setPostParams = function (paramsObject) {
|
677
|
+
this.settings.post_params = paramsObject;
|
678
|
+
this.callFlash("SetPostParams", [paramsObject]);
|
679
|
+
};
|
680
|
+
|
681
|
+
// Public: addPostParam adds post name/value pair. Each name can have only one value.
|
682
|
+
SWFUpload.prototype.addPostParam = function (name, value) {
|
683
|
+
this.settings.post_params[name] = value;
|
684
|
+
this.callFlash("SetPostParams", [this.settings.post_params]);
|
685
|
+
};
|
686
|
+
|
687
|
+
// Public: removePostParam deletes post name/value pair.
|
688
|
+
SWFUpload.prototype.removePostParam = function (name) {
|
689
|
+
delete this.settings.post_params[name];
|
690
|
+
this.callFlash("SetPostParams", [this.settings.post_params]);
|
691
|
+
};
|
692
|
+
|
693
|
+
// Public: setFileTypes changes the file_types setting and the file_types_description setting
|
694
|
+
SWFUpload.prototype.setFileTypes = function (types, description) {
|
695
|
+
this.settings.file_types = types;
|
696
|
+
this.settings.file_types_description = description;
|
697
|
+
this.callFlash("SetFileTypes", [types, description]);
|
698
|
+
};
|
699
|
+
|
700
|
+
// Public: setFileSizeLimit changes the file_size_limit setting
|
701
|
+
SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
|
702
|
+
this.settings.file_size_limit = fileSizeLimit;
|
703
|
+
this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
|
704
|
+
};
|
705
|
+
|
706
|
+
// Public: setFileUploadLimit changes the file_upload_limit setting
|
707
|
+
SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
|
708
|
+
this.settings.file_upload_limit = fileUploadLimit;
|
709
|
+
this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
|
710
|
+
};
|
711
|
+
|
712
|
+
// Public: setFileQueueLimit changes the file_queue_limit setting
|
713
|
+
SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
|
714
|
+
this.settings.file_queue_limit = fileQueueLimit;
|
715
|
+
this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
|
716
|
+
};
|
717
|
+
|
718
|
+
// Public: setFilePostName changes the file_post_name setting
|
719
|
+
SWFUpload.prototype.setFilePostName = function (filePostName) {
|
720
|
+
this.settings.file_post_name = filePostName;
|
721
|
+
this.callFlash("SetFilePostName", [filePostName]);
|
722
|
+
};
|
723
|
+
|
724
|
+
// Public: setUseQueryString changes the use_query_string setting
|
725
|
+
SWFUpload.prototype.setUseQueryString = function (useQueryString) {
|
726
|
+
this.settings.use_query_string = useQueryString;
|
727
|
+
this.callFlash("SetUseQueryString", [useQueryString]);
|
728
|
+
};
|
729
|
+
|
730
|
+
// Public: setRequeueOnError changes the requeue_on_error setting
|
731
|
+
SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
|
732
|
+
this.settings.requeue_on_error = requeueOnError;
|
733
|
+
this.callFlash("SetRequeueOnError", [requeueOnError]);
|
734
|
+
};
|
735
|
+
|
736
|
+
// Public: setHTTPSuccess changes the http_success setting
|
737
|
+
SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
|
738
|
+
if (typeof http_status_codes === "string") {
|
739
|
+
http_status_codes = http_status_codes.replace(" ", "").split(",");
|
740
|
+
}
|
741
|
+
|
742
|
+
this.settings.http_success = http_status_codes;
|
743
|
+
this.callFlash("SetHTTPSuccess", [http_status_codes]);
|
744
|
+
};
|
745
|
+
|
746
|
+
// Public: setHTTPSuccess changes the http_success setting
|
747
|
+
SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
|
748
|
+
this.settings.assume_success_timeout = timeout_seconds;
|
749
|
+
this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
|
750
|
+
};
|
751
|
+
|
752
|
+
// Public: setDebugEnabled changes the debug_enabled setting
|
753
|
+
SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
|
754
|
+
this.settings.debug_enabled = debugEnabled;
|
755
|
+
this.callFlash("SetDebugEnabled", [debugEnabled]);
|
756
|
+
};
|
757
|
+
|
758
|
+
// Public: setButtonImageURL loads a button image sprite
|
759
|
+
SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
|
760
|
+
if (buttonImageURL == undefined) {
|
761
|
+
buttonImageURL = "";
|
762
|
+
}
|
763
|
+
|
764
|
+
this.settings.button_image_url = buttonImageURL;
|
765
|
+
this.callFlash("SetButtonImageURL", [buttonImageURL]);
|
766
|
+
};
|
767
|
+
|
768
|
+
// Public: setButtonDimensions resizes the Flash Movie and button
|
769
|
+
SWFUpload.prototype.setButtonDimensions = function (width, height) {
|
770
|
+
this.settings.button_width = width;
|
771
|
+
this.settings.button_height = height;
|
772
|
+
|
773
|
+
var movie = this.getMovieElement();
|
774
|
+
if (movie != undefined) {
|
775
|
+
movie.style.width = width + "px";
|
776
|
+
movie.style.height = height + "px";
|
777
|
+
}
|
778
|
+
|
779
|
+
this.callFlash("SetButtonDimensions", [width, height]);
|
780
|
+
};
|
781
|
+
// Public: setButtonText Changes the text overlaid on the button
|
782
|
+
SWFUpload.prototype.setButtonText = function (html) {
|
783
|
+
this.settings.button_text = html;
|
784
|
+
this.callFlash("SetButtonText", [html]);
|
785
|
+
};
|
786
|
+
// Public: setButtonTextPadding changes the top and left padding of the text overlay
|
787
|
+
SWFUpload.prototype.setButtonTextPadding = function (left, top) {
|
788
|
+
this.settings.button_text_top_padding = top;
|
789
|
+
this.settings.button_text_left_padding = left;
|
790
|
+
this.callFlash("SetButtonTextPadding", [left, top]);
|
791
|
+
};
|
792
|
+
|
793
|
+
// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
|
794
|
+
SWFUpload.prototype.setButtonTextStyle = function (css) {
|
795
|
+
this.settings.button_text_style = css;
|
796
|
+
this.callFlash("SetButtonTextStyle", [css]);
|
797
|
+
};
|
798
|
+
// Public: setButtonDisabled disables/enables the button
|
799
|
+
SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
|
800
|
+
this.settings.button_disabled = isDisabled;
|
801
|
+
this.callFlash("SetButtonDisabled", [isDisabled]);
|
802
|
+
};
|
803
|
+
// Public: setButtonAction sets the action that occurs when the button is clicked
|
804
|
+
SWFUpload.prototype.setButtonAction = function (buttonAction) {
|
805
|
+
this.settings.button_action = buttonAction;
|
806
|
+
this.callFlash("SetButtonAction", [buttonAction]);
|
807
|
+
};
|
808
|
+
|
809
|
+
// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
|
810
|
+
SWFUpload.prototype.setButtonCursor = function (cursor) {
|
811
|
+
this.settings.button_cursor = cursor;
|
812
|
+
this.callFlash("SetButtonCursor", [cursor]);
|
813
|
+
};
|
814
|
+
|
815
|
+
/* *******************************
|
816
|
+
Flash Event Interfaces
|
817
|
+
These functions are used by Flash to trigger the various
|
818
|
+
events.
|
819
|
+
|
820
|
+
All these functions a Private.
|
821
|
+
|
822
|
+
Because the ExternalInterface library is buggy the event calls
|
823
|
+
are added to a queue and the queue then executed by a setTimeout.
|
824
|
+
This ensures that events are executed in a determinate order and that
|
825
|
+
the ExternalInterface bugs are avoided.
|
826
|
+
******************************* */
|
827
|
+
|
828
|
+
SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
|
829
|
+
// Warning: Don't call this.debug inside here or you'll create an infinite loop
|
830
|
+
var self = this;
|
831
|
+
|
832
|
+
if (argumentArray == undefined) {
|
833
|
+
argumentArray = [];
|
834
|
+
} else if (!(argumentArray instanceof Array)) {
|
835
|
+
argumentArray = [argumentArray];
|
836
|
+
}
|
837
|
+
|
838
|
+
if (typeof this.settings[handlerName] === "function") {
|
839
|
+
// Queue the event
|
840
|
+
this.eventQueue.push(function () {
|
841
|
+
this.settings[handlerName].apply(this, argumentArray);
|
842
|
+
});
|
843
|
+
|
844
|
+
// Execute the next queued event
|
845
|
+
setTimeout(function () {
|
846
|
+
self.executeNextEvent();
|
847
|
+
}, 0);
|
848
|
+
|
849
|
+
} else if (this.settings[handlerName] !== null) {
|
850
|
+
throw "Event handler " + handlerName + " is unknown or is not a function";
|
851
|
+
}
|
852
|
+
};
|
853
|
+
|
854
|
+
// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout
|
855
|
+
// we must queue them in order to garentee that they are executed in order.
|
856
|
+
SWFUpload.prototype.executeNextEvent = function () {
|
857
|
+
// Warning: Don't call this.debug inside here or you'll create an infinite loop
|
858
|
+
|
859
|
+
var f = this.eventQueue ? this.eventQueue.shift() : null;
|
860
|
+
if (typeof(f) === "function") {
|
861
|
+
f.apply(this);
|
862
|
+
}
|
863
|
+
};
|
864
|
+
|
865
|
+
// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
|
866
|
+
// properties that contain characters that are not valid for JavaScript identifiers. To work around this
|
867
|
+
// the Flash Component escapes the parameter names and we must unescape again before passing them along.
|
868
|
+
SWFUpload.prototype.unescapeFilePostParams = function (file) {
|
869
|
+
var reg = /[$]([0-9a-f]{4})/i, unescapedPost = {}, uk, k, match;
|
870
|
+
|
871
|
+
if (file != undefined) {
|
872
|
+
for (k in file.post) {
|
873
|
+
if (file.post.hasOwnProperty(k)) {
|
874
|
+
uk = k;
|
875
|
+
while ((match = reg.exec(uk)) !== null) {
|
876
|
+
uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
|
877
|
+
}
|
878
|
+
unescapedPost[uk] = file.post[k];
|
879
|
+
}
|
880
|
+
}
|
881
|
+
|
882
|
+
file.post = unescapedPost;
|
883
|
+
}
|
884
|
+
|
885
|
+
return file;
|
886
|
+
};
|
887
|
+
|
888
|
+
// Private: This event is called by SWFUpload Init after we've determined what the user's Flash Player supports.
|
889
|
+
// Use the swfupload_preload_handler event setting to execute custom code when SWFUpload has loaded.
|
890
|
+
// Return false to prevent SWFUpload from loading and allow your script to do something else if your required feature is
|
891
|
+
// not supported
|
892
|
+
SWFUpload.prototype.swfuploadPreload = function () {
|
893
|
+
var returnValue;
|
894
|
+
if (typeof this.settings.swfupload_preload_handler === "function") {
|
895
|
+
returnValue = this.settings.swfupload_preload_handler.call(this);
|
896
|
+
} else if (this.settings.swfupload_preload_handler != undefined) {
|
897
|
+
throw "upload_start_handler must be a function";
|
898
|
+
}
|
899
|
+
|
900
|
+
// Convert undefined to true so if nothing is returned from the upload_start_handler it is
|
901
|
+
// interpretted as 'true'.
|
902
|
+
if (returnValue === undefined) {
|
903
|
+
returnValue = true;
|
904
|
+
}
|
905
|
+
|
906
|
+
return !!returnValue;
|
907
|
+
}
|
908
|
+
|
909
|
+
// Private: This event is called by Flash when it has finished loading. Don't modify this.
|
910
|
+
// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
|
911
|
+
SWFUpload.prototype.flashReady = function () {
|
912
|
+
// Check that the movie element is loaded correctly with its ExternalInterface methods defined
|
913
|
+
var movieElement = this.cleanUp();
|
914
|
+
|
915
|
+
if (!movieElement) {
|
916
|
+
this.debug("Flash called back ready but the flash movie can't be found.");
|
917
|
+
return;
|
918
|
+
}
|
919
|
+
|
920
|
+
this.queueEvent("swfupload_loaded_handler");
|
921
|
+
};
|
922
|
+
|
923
|
+
// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
|
924
|
+
// This function is called by Flash each time the ExternalInterface functions are created.
|
925
|
+
SWFUpload.prototype.cleanUp = function () {
|
926
|
+
var key, movieElement = this.getMovieElement();
|
927
|
+
|
928
|
+
// Pro-actively unhook all the Flash functions
|
929
|
+
try {
|
930
|
+
if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
|
931
|
+
this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
|
932
|
+
for (key in movieElement) {
|
933
|
+
try {
|
934
|
+
if (typeof(movieElement[key]) === "function") {
|
935
|
+
movieElement[key] = null;
|
936
|
+
}
|
937
|
+
} catch (ex) {
|
938
|
+
}
|
939
|
+
}
|
940
|
+
}
|
941
|
+
} catch (ex1) {
|
942
|
+
|
943
|
+
}
|
944
|
+
|
945
|
+
// Fix Flashes own cleanup code so if the SWF Movie was removed from the page
|
946
|
+
// it doesn't display errors.
|
947
|
+
window["__flash__removeCallback"] = function (instance, name) {
|
948
|
+
try {
|
949
|
+
if (instance) {
|
950
|
+
instance[name] = null;
|
951
|
+
}
|
952
|
+
} catch (flashEx) {
|
953
|
+
|
954
|
+
}
|
955
|
+
};
|
956
|
+
|
957
|
+
return movieElement;
|
958
|
+
};
|
959
|
+
|
960
|
+
/* When the button_action is set to None this event gets fired and executes the mouse_click_handler */
|
961
|
+
SWFUpload.prototype.mouseClick = function () {
|
962
|
+
this.queueEvent("mouse_click_handler");
|
963
|
+
};
|
964
|
+
SWFUpload.prototype.mouseOver = function () {
|
965
|
+
this.queueEvent("mouse_over_handler");
|
966
|
+
};
|
967
|
+
SWFUpload.prototype.mouseOut = function () {
|
968
|
+
this.queueEvent("mouse_out_handler");
|
969
|
+
};
|
970
|
+
|
971
|
+
/* This is a chance to do something before the browse window opens */
|
972
|
+
SWFUpload.prototype.fileDialogStart = function () {
|
973
|
+
this.queueEvent("file_dialog_start_handler");
|
974
|
+
};
|
975
|
+
|
976
|
+
|
977
|
+
/* Called when a file is successfully added to the queue. */
|
978
|
+
SWFUpload.prototype.fileQueued = function (file) {
|
979
|
+
file = this.unescapeFilePostParams(file);
|
980
|
+
this.queueEvent("file_queued_handler", file);
|
981
|
+
};
|
982
|
+
|
983
|
+
|
984
|
+
/* Handle errors that occur when an attempt to queue a file fails. */
|
985
|
+
SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
|
986
|
+
file = this.unescapeFilePostParams(file);
|
987
|
+
this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
|
988
|
+
};
|
989
|
+
|
990
|
+
/* Called after the file dialog has closed and the selected files have been queued.
|
991
|
+
You could call startUpload here if you want the queued files to begin uploading immediately. */
|
992
|
+
SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
|
993
|
+
this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
|
994
|
+
};
|
995
|
+
|
996
|
+
SWFUpload.prototype.uploadResizeStart = function (file, resizeSettings) {
|
997
|
+
file = this.unescapeFilePostParams(file);
|
998
|
+
this.queueEvent("upload_resize_start_handler", [file, resizeSettings.width, resizeSettings.height, resizeSettings.encoding, resizeSettings.quality]);
|
999
|
+
};
|
1000
|
+
|
1001
|
+
SWFUpload.prototype.uploadStart = function (file) {
|
1002
|
+
file = this.unescapeFilePostParams(file);
|
1003
|
+
this.queueEvent("return_upload_start_handler", file);
|
1004
|
+
};
|
1005
|
+
|
1006
|
+
SWFUpload.prototype.returnUploadStart = function (file) {
|
1007
|
+
var returnValue;
|
1008
|
+
if (typeof this.settings.upload_start_handler === "function") {
|
1009
|
+
file = this.unescapeFilePostParams(file);
|
1010
|
+
returnValue = this.settings.upload_start_handler.call(this, file);
|
1011
|
+
} else if (this.settings.upload_start_handler != undefined) {
|
1012
|
+
throw "upload_start_handler must be a function";
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
// Convert undefined to true so if nothing is returned from the upload_start_handler it is
|
1016
|
+
// interpretted as 'true'.
|
1017
|
+
if (returnValue === undefined) {
|
1018
|
+
returnValue = true;
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
returnValue = !!returnValue;
|
1022
|
+
|
1023
|
+
this.callFlash("ReturnUploadStart", [returnValue]);
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
|
1027
|
+
|
1028
|
+
SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
|
1029
|
+
file = this.unescapeFilePostParams(file);
|
1030
|
+
this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
|
1031
|
+
};
|
1032
|
+
|
1033
|
+
SWFUpload.prototype.uploadError = function (file, errorCode, message) {
|
1034
|
+
file = this.unescapeFilePostParams(file);
|
1035
|
+
this.queueEvent("upload_error_handler", [file, errorCode, message]);
|
1036
|
+
};
|
1037
|
+
|
1038
|
+
SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
|
1039
|
+
file = this.unescapeFilePostParams(file);
|
1040
|
+
this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
|
1041
|
+
};
|
1042
|
+
|
1043
|
+
SWFUpload.prototype.uploadComplete = function (file) {
|
1044
|
+
file = this.unescapeFilePostParams(file);
|
1045
|
+
this.queueEvent("upload_complete_handler", file);
|
1046
|
+
};
|
1047
|
+
|
1048
|
+
/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
|
1049
|
+
internal debug console. You can override this event and have messages written where you want. */
|
1050
|
+
SWFUpload.prototype.debug = function (message) {
|
1051
|
+
this.queueEvent("debug_handler", message);
|
1052
|
+
};
|
1053
|
+
|
1054
|
+
|
1055
|
+
/* **********************************
|
1056
|
+
Debug Console
|
1057
|
+
The debug console is a self contained, in page location
|
1058
|
+
for debug message to be sent. The Debug Console adds
|
1059
|
+
itself to the body if necessary.
|
1060
|
+
|
1061
|
+
The console is automatically scrolled as messages appear.
|
1062
|
+
|
1063
|
+
If you are using your own debug handler or when you deploy to production and
|
1064
|
+
have debug disabled you can remove these functions to reduce the file size
|
1065
|
+
and complexity.
|
1066
|
+
********************************** */
|
1067
|
+
|
1068
|
+
// Private: debugMessage is the default debug_handler. If you want to print debug messages
|
1069
|
+
// call the debug() function. When overriding the function your own function should
|
1070
|
+
// check to see if the debug setting is true before outputting debug information.
|
1071
|
+
SWFUpload.prototype.debugMessage = function (message) {
|
1072
|
+
var exceptionMessage, exceptionValues, key;
|
1073
|
+
|
1074
|
+
if (this.settings.debug) {
|
1075
|
+
exceptionValues = [];
|
1076
|
+
|
1077
|
+
// Check for an exception object and print it nicely
|
1078
|
+
if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
|
1079
|
+
for (key in message) {
|
1080
|
+
if (message.hasOwnProperty(key)) {
|
1081
|
+
exceptionValues.push(key + ": " + message[key]);
|
1082
|
+
}
|
1083
|
+
}
|
1084
|
+
exceptionMessage = exceptionValues.join("\n") || "";
|
1085
|
+
exceptionValues = exceptionMessage.split("\n");
|
1086
|
+
exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
|
1087
|
+
SWFUpload.Console.writeLine(exceptionMessage);
|
1088
|
+
} else {
|
1089
|
+
SWFUpload.Console.writeLine(message);
|
1090
|
+
}
|
1091
|
+
}
|
1092
|
+
};
|
1093
|
+
|
1094
|
+
SWFUpload.Console = {};
|
1095
|
+
SWFUpload.Console.writeLine = function (message) {
|
1096
|
+
var console, documentForm;
|
1097
|
+
|
1098
|
+
try {
|
1099
|
+
console = document.getElementById("SWFUpload_Console");
|
1100
|
+
|
1101
|
+
if (!console) {
|
1102
|
+
documentForm = document.createElement("form");
|
1103
|
+
document.getElementsByTagName("body")[0].appendChild(documentForm);
|
1104
|
+
|
1105
|
+
console = document.createElement("textarea");
|
1106
|
+
console.id = "SWFUpload_Console";
|
1107
|
+
console.style.fontFamily = "monospace";
|
1108
|
+
console.setAttribute("wrap", "off");
|
1109
|
+
console.wrap = "off";
|
1110
|
+
console.style.overflow = "auto";
|
1111
|
+
console.style.width = "700px";
|
1112
|
+
console.style.height = "350px";
|
1113
|
+
console.style.margin = "5px";
|
1114
|
+
documentForm.appendChild(console);
|
1115
|
+
}
|
1116
|
+
|
1117
|
+
console.value += message + "\n";
|
1118
|
+
|
1119
|
+
console.scrollTop = console.scrollHeight - console.clientHeight;
|
1120
|
+
} catch (ex) {
|
1121
|
+
alert("Exception: " + ex.name + " Message: " + ex.message);
|
1122
|
+
}
|
1123
|
+
};
|
1124
|
+
|
1125
|
+
|
1126
|
+
/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
|
1127
|
+
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
1128
|
+
*/
|
1129
|
+
swfobject = function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
|
1130
|
+
swfobject.addDomLoadEvent(function () {
|
1131
|
+
if (typeof(SWFUpload.onload) === "function") {
|
1132
|
+
SWFUpload.onload.call(window);
|
1133
|
+
}
|
1134
|
+
});
|