diff options
Diffstat (limited to 'httemplate/elements/file-upload.html')
-rw-r--r-- | httemplate/elements/file-upload.html | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/httemplate/elements/file-upload.html b/httemplate/elements/file-upload.html index 2859a676f..023bffb1e 100644 --- a/httemplate/elements/file-upload.html +++ b/httemplate/elements/file-upload.html @@ -1,10 +1,13 @@ - -<script type="text/javascript"> +<SCRIPT TYPE="text/javascript"> function doUpload(form, callback) { var name = 'form' + Math.floor(Math.random() * 99999); // perlize? var d = document.createElement('DIV'); - d.innerHTML = '<iframe style="display:none" src="about:blank" id="'+name+'" name="'+name+'" onload="uploadComplete(\''+name+'\')"></iframe>'; + d.innerHTML = '<iframe style="display:none" src="about:blank" ' + + 'id="' + name + '" ' + + 'name="' + name + '" ' + + 'onload="uploadComplete(\'' + name + '\')">' + + '</iframe>'; document.body.appendChild(d); var i = document.getElementById(name); @@ -32,8 +35,8 @@ document.getElementById('r').innerHTML = d.body.innerHTML; if (typeof(i.onComplete) == 'function') { var p; - if (p = d.body.innerHTML.indexOf("Freeside File Upload Successful ") >= 0) { - var v = d.body.innerHTML.substr(p+33) + if (p = d.body.innerHTML.indexOf("File Upload Successful ") >= 0) { + var v = d.body.innerHTML.substr(p+24); var u = document.getElementById('uploaded_files'); v = v.substr(0, v.indexOf(';')); u.value = v; @@ -44,37 +47,28 @@ } } -</script> +</SCRIPT> + +<INPUT TYPE="hidden" NAME="uploaded_files" ID="uploaded_files" VALUE="" /> + +<INPUT TYPE="hidden" NAME="upload_fields" VALUE="<% join(',', @field) %>" /> - <input type="hidden" name="uploaded_files" id="uploaded_files" value="" /> - <input type="hidden" name="upload_fields" value="<% join(',', @field) %>" /> % foreach (@field) { - <tr> - <th><% shift @label %></th> - <td><input type="file" name="<% $_ %>" /></td> - </tr> + <TR> + <TH><% shift @label %></TH> + <TD><INPUT TYPE="file" NAME="<% $_ %>" /></TD> + </TR> % } - <div style="display:<% $debug ? 'visible' : 'none' %>">Debugging: <pre id="r"></pre></div> - -<%init> -my %param = @_; -my $debug = $param{'debug'}; +<DIV STYLE="display:<% $param{debug} ? 'visible' : 'none' %>"> + Debugging: <PRE ID="r"></PRE> +</DIV> -my $callback = $param{'callback'} || "''"; +<%init> -my @label = (); -if ( ref($param{'label'}) ) { - push @label, @{$param{'label'}}; -}else{ - push @label, $param{'label'}; -} +my %param = @_; -my @field = (); -if ( ref($param{'field'}) ) { - push @field, @{$param{'field'}}; -}else{ - push @field, $param{'field'}; -} +my @label = ref($param{'label'}) ? @{$param{'label'}} : ($param{'label'}); +my @field = ref($param{'field'}) ? @{$param{'field'}} : ($param{'field'}); </%init> |