rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: exorcist on October 29, 2010, 12:57:24 PM

Title: Uploads progress window in custom template
Post by: exorcist on October 29, 2010, 12:57:24 PM
At first, I'm very oldschool and still using the lastest stable version 2.2f :) I made a template that meets my creteria and everything works absolutely great!

I added:
Code: [Select]
onClick="window.open('/~progress');"in the "Upload File" button section code:
Code: [Select]
<input name="upbtn" ... >
Now when the user hits the upload button, it also opens a new window with upload progress.
My question is: Can I use some "trigger" to close this window when the upload is complete?

I've tried the following ways with javascript inserted in the beginning of [progress-upload-file] section:
1)
Code: [Select]
<script type="text/javascript">
if (%perc% > 98) {
 window.close();
}
</script>
2)
Code: [Select]
<script type="text/javascript">
var param = (%total-bytes%-%done-bytes%)/1024-2.5*%speed-kb%;
if (param<0) {
 window.close();
}

Both methods depend of the refresh rate setup in [progress] section and don't work stable.
Any hints will be heartily appreciated! :)

Template file dwk.tpl (http://www.rejetto.com/forum/index.php?action=dlattach;topic=9264.0;attach=5784) attached to the post...

Title: Re: Uploads progress window in custom template
Post by: rejetto on November 01, 2010, 12:24:17 PM
i have no experience about creating "new windows" with javascript,
but i guess you can keep track of them by using "names", and then close that named window in the "results" page.

have you every seen the current default template of 2.3 ? it has a box inside the page that's updated regularly. It's a joy for the eye. :D
i went for this after firefox not refreshing with the 2.2's method.
Title: Re: Uploads progress window in custom template
Post by: exorcist on November 11, 2010, 03:01:12 PM
Closing with javascript works perfectly :) I just can't come up with a proper condition (trigger) when actually the upload is complete (when [progress] switches to [progress-nofiles]) to close the progress window :)
Title: Re: Uploads progress window in custom template
Post by: rejetto on November 29, 2010, 03:53:24 PM
sorry for the late reply.
did you try putting the javascript code for closing in the [progress-nofiles] ?
that will work just as a trigger