genia.likes.science@gmail.com | c5f82a2 | 2013-05-08 02:44:35 -0700 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>easyXDM</title> |
| 5 | <script type="text/javascript" src="../easyXDM.debug.js"> |
| 6 | </script> |
| 7 | <script type="text/javascript"> |
| 8 | /** |
| 9 | * Request the use of the JSON object |
| 10 | */ |
| 11 | easyXDM.DomHelper.requiresJSON("../json2.js"); |
| 12 | </script> |
| 13 | <script type="text/javascript"> |
| 14 | |
| 15 | // this is just some bootstrapping code in order to provide |
| 16 | // the correct host name depending on where it is being run. |
| 17 | var REMOTE = (function(){ |
| 18 | var remote = location.href; |
| 19 | switch (location.host) { |
| 20 | case "provider.easyxdm.net": |
| 21 | location.href = remote.replace("provider", "consumer"); |
| 22 | break; |
| 23 | case "easyxdm.net": |
| 24 | remote = remote.replace("easyxdm.net", "consumer.easyxdm.net"); |
| 25 | break; |
| 26 | case "consumer.easyxdm.net": |
| 27 | remote = remote.replace("consumer", "provider"); |
| 28 | break; |
| 29 | case "xdm1": |
| 30 | remote = remote.replace("xdm1", "xdm2"); |
| 31 | break; |
| 32 | } |
| 33 | return remote.substring(0, remote.lastIndexOf("/")); |
| 34 | }()); |
| 35 | |
| 36 | |
| 37 | |
| 38 | var btn; |
| 39 | var remote = new easyXDM.Rpc({ |
| 40 | remote: REMOTE + "/upload_rpc.html", |
| 41 | swf: REMOTE + "/../easyxdm.swf", |
| 42 | onReady: function(){ |
| 43 | //display the upload form |
| 44 | var frm = document.getElementById("frmUpload"); |
| 45 | frm.action = REMOTE + "/upload_handler.aspx"; |
| 46 | frm.style.display = "block"; |
| 47 | btn = document.getElementById("btnSubmit"); |
| 48 | |
| 49 | frm.onsubmit = function(){ |
| 50 | btn.disabled = "disabled"; |
| 51 | }; |
| 52 | } |
| 53 | }, { |
| 54 | local: { |
| 55 | returnUploadResponse: function(response){ |
| 56 | // here you should call back into your regular workflow |
| 57 | btn.disabled = null; |
| 58 | alert(response.msg); |
| 59 | } |
| 60 | } |
| 61 | }); |
| 62 | </script> |
| 63 | </head> |
| 64 | <body> |
| 65 | <div style="border:1px solid black;padding:3px;margin:10px;"> |
| 66 | <a href="index.html">Index of examples</a> |
| 67 | | <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a> |
| 68 | | |
| 69 | | <a href="http://easyxdm.net/">easyXDM.net</a> |
| 70 | | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a> |
| 71 | <br/> |
| 72 | The examples are executing slower than the production build due to the extensive tracing. |
| 73 | <br/> |
| 74 | If you are alerted about a popup, then this is only the trace log feature. You can ignore this. |
| 75 | </div> |
| 76 | <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" --> |
| 77 | <div id="log" style="height:100px;border:1px dotted black;overflow:auto"> |
| 78 | </div> |
| 79 | <form id="frmUpload" style="display:none" method="POST" target="upload_target" enctype="multipart/form-data"> |
| 80 | <input type="file" name="upload_file"/><input type="submit" id="btnSubmit" value="Upload file"/> |
| 81 | </form><!-- |
| 82 | tracking code |
| 83 | --> |
| 84 | <script type="text/javascript"> |
| 85 | var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); |
| 86 | document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); |
| 87 | </script> |
| 88 | <script type="text/javascript"> |
| 89 | if (location.host.indexOf("easyxdm.net") !== -1) { |
| 90 | try { |
| 91 | var pageTracker = _gat._getTracker("UA-9535591-3"); |
| 92 | pageTracker._setDomainName(".easyxdm.net"); |
| 93 | pageTracker._trackPageview(); |
| 94 | } |
| 95 | catch (err) { |
| 96 | } |
| 97 | } |
| 98 | </script> |
| 99 | </body> |
| 100 | </html> |