Also apply the __toString fix to UserInfo
[cacert-mgr.git] / external / ZendFramework-1.9.5 / externals / dojo / demos / mojo / src / download.js
1 dojo.provide("demos.mojo.src.download");
2 // the code for the "live download" link, adapted from http://dojotoolkit.org/~dante/downloadDojo.html
3 dojo.require("dojo.io.iframe");
4 (function(){
5
6 var dojo_ver = "1.3.1";
7
8 var node = null;
9 var _downloadDialog = {
10
11 node: null,
12 closeNode: null,
13
14 show: function(e){
15 if(!this.node){ this.create(); }
16 var anim1 = dojo.animateProperty({
17 node: dojo.query("img",this.node)[0],
18 duration:1500,
19 properties: {
20 width: { end: 310, start:1, unit:"px" },
21 height: { end: 310, start:1, unit:"px" },
22 top: { end:0, start:155, unit:"px" },
23 left: { end:0, start:155, unit:"px" }//,
24 //paddingTop: { end:1, start:155, unit:"px" }//,
25 //opacity: { end: 1, start: 0 }
26 },
27 easing: dojo.fx.easing.elasticOut
28 });
29 var anim2 = dojo.fx.slideTo({
30 node:this.node,
31 top: e.pageY - 55,
32 left: e.pageX - 155,
33 duration:900,
34 easing: dojo.fx.easing.elasticOut
35 })
36 dojo.fx.combine([anim1,anim2]).play();
37 dojo.byId("gravity").disabled = true;
38 },
39
40 hide: function(e){
41 dojo.byId("gravity").disabled = false;
42 e.preventDefault();
43 dojo.fx.slideTo({ node:this.node, duration:375, left:-310, top:-50,
44 easing:dojo.fx.easing.backIn
45 }).play();
46 },
47
48 init: function(e){
49 // init the download sequence based on the selected parameters.
50 var includeUtils = dojo.byId("build").checked;
51 var includeSource = dojo.byId("sourceR").checked;
52 var ext = (dojo.byId("tgz").checked ? "tar.gz" : "zip");
53 var ver = dojo_ver;
54
55 // make the url:
56 var host = "http://download.dojotoolkit.org/";
57 var url = host + "release-" + (ver) + "/dojo-release-" + (ver) + (includeSource ? "-src." : ".") + (ext);
58
59 // trigger the save as ... dialog
60 dojo.io.iframe.send({
61 url: url,
62 timeout: 5000
63 });
64
65 if(includeUtils){
66 // and another one if they selected build utils. FIXME: ie7 throws popup warning?
67 var utilUrl = host + "release-" + (ver) + "/dojo-release-"+(ver)+"-shrinksafe."+(ext);
68 setTimeout(function(){
69 dojo.io.iframe.send({
70 url: utilUrl,
71 timeout:5000
72 });
73 },3000);
74 }
75
76 },
77
78 create: function(e){
79 // dynamically create the dialog box:
80
81 var img = dojo.query("img.clone")[0];
82 this.node = dojo.body().appendChild(dojo.doc.createElement('div'));
83 var nimg = this.node.appendChild(dojo.clone(img));
84 dojo.style(nimg,"position","absolute");
85
86 var h = this.node.appendChild(dojo.doc.createElement('h1'));
87 dojo.addClass(h,"handle");
88
89 this.node.id = "downloadDiv";
90 h.innerHTML = "download?";
91
92 var form = this.node.appendChild(dojo.byId("downloadForm"));
93 dojo.style(form,"visibility","visible");
94 dojo.style(this.node,"zIndex","100");
95 new dojo.dnd.Moveable(this.node,{ handle: h });
96
97 this.closeNode = dojo.byId("closeNode");
98 dojo.connect(this.closeNode,"onclick",this,"hide");
99 this.submitNode = dojo.byId("submitNode");
100 dojo.connect(this.submitNode,"onclick",this,"init");
101
102 }
103 };
104
105 var button = null;
106 dojo.addOnLoad(function(){
107 button = dojo.byId("downloadButton");
108 dojo.connect(button,"onclick",_downloadDialog,"show")
109 });
110
111 })();