rejetto forum
May 25, 2012, 09:08:19 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Uploads progress window in custom template  (Read 752 times)
0 Members and 2 Guests are viewing this topic.
exorcist
Occasional poster
*
Offline Offline

Posts: 9


King of the Dust

funkdab funkdab
View Profile WWW
« on: October 29, 2010, 07:57:24 AM »

At first, I'm very oldschool and still using the lastest stable version 2.2f Smiley I made a template that meets my creteria and everything works absolutely great!

I added:
Code:
onClick="window.open('/~progress');"
in the "Upload File" button section code:
Code:
<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:
<script type="text/javascript">
if (%perc% > 98) {
 window.close();
}
</script>
2)
Code:
<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! Smiley

Template file dwk.tpl attached to the post...


* dwk.tpl (6.49 KB - downloaded 96 times.)
« Last Edit: October 29, 2010, 08:00:31 AM by exorcist » Logged

In dust we trust...
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #1 on: November 01, 2010, 07:24:17 AM »

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. Cheesy
i went for this after firefox not refreshing with the 2.2's method.
« Last Edit: November 01, 2010, 07:25:56 AM by rejetto » Logged
exorcist
Occasional poster
*
Offline Offline

Posts: 9


King of the Dust

funkdab funkdab
View Profile WWW
« Reply #2 on: November 11, 2010, 09:01:12 AM »

Closing with javascript works perfectly Smiley 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 Smiley
Logged

In dust we trust...
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #3 on: November 29, 2010, 09:53:24 AM »

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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 19, 2012, 09:28:53 AM