Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Steve Holmes
On Fri, Apr 18, 2008 at 12:43 PM, bruce <[EMAIL PROTECTED]> wrote:

>
>
> what did a google search on php/ajax progress bar return?
>
> peace
>

Once I know kind of what to search for (thanks for that) I found some very
interesting things. In particular I like:

http://www.bram.us/projects/js_bramus/jsprogressbarhandler/

I know this isn't a pop-up but I can make it work. As long as the user knows
something is happening (and I protect them from their own stupidity :-) I'll
be fine.

Thanks for all the quick help!
Steve


Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Nick Stinemates
On Fri, Apr 18, 2008 at 09:43:07AM -0700, bruce wrote:
> hi..
> 
> if you have an action that the server is performing, and the action is going
> to take some amount of time, then you're going to need to provide some form
> of "progress" bar, that's a function of jscript/ajax on the client side...
> 
> you can't use just php, as php runs on the server, which is where your
> action is also running. the unfortunate situation is that a php 'progress
> bar' wouldn't be invoked until after the action has completed... unless you
> had a periodic timer within the "action" that periodically displayed
> something to the page (which could be possible)
> 
> 
> action
> {
>   loop through the action/task
> do some events
> display "x" //for progress bar
> continue with the event processing
>   end loop
> }
> 
> the other, probably better option would be to have a progress area, that
> was/is a jscript/ajax based, that talked/polled the server to determine the
> overall status of the "action" as it's being performed.
> 
> what did a google search on php/ajax progress bar return?
> 
> peace
> 

Or the name of the file, kind of like a log.


-- 
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] need "pop-up" in progress alert

2008-04-18 Thread bruce
hi..

if you have an action that the server is performing, and the action is going
to take some amount of time, then you're going to need to provide some form
of "progress" bar, that's a function of jscript/ajax on the client side...

you can't use just php, as php runs on the server, which is where your
action is also running. the unfortunate situation is that a php 'progress
bar' wouldn't be invoked until after the action has completed... unless you
had a periodic timer within the "action" that periodically displayed
something to the page (which could be possible)


action
{
  loop through the action/task
do some events
display "x" //for progress bar
continue with the event processing
  end loop
}

the other, probably better option would be to have a progress area, that
was/is a jscript/ajax based, that talked/polled the server to determine the
overall status of the "action" as it's being performed.

what did a google search on php/ajax progress bar return?

peace


-Original Message-
From: Nick Stinemates [mailto:[EMAIL PROTECTED]
Sent: Friday, April 18, 2008 9:35 AM
To: php-general@lists.php.net
Subject: Re: [PHP] need "pop-up" in progress alert


On Fri, Apr 18, 2008 at 10:54:36AM -0400, Jason Pruim wrote:
>
>> So if someone could point me in the right direction I'd really appreciate
>> it.
>
> Hi Steve,
>
> From my understanding of how PHP works and from reading the archives of
> this list, and asking quite a few questions my self.. You can't do a
> progress bar in PHP since by the time it gets to the browser, PHP is done
> doing what it does.

This is actually false, at least on my system(s).

Try this out:




--
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Eric Butera
On Fri, Apr 18, 2008 at 12:34 PM, Nick Stinemates <[EMAIL PROTECTED]> wrote:
> On Fri, Apr 18, 2008 at 10:54:36AM -0400, Jason Pruim wrote:
>  Try this out:
>
>  
>  while (true) {
> print "x";
>  }


Jason,

Call ob_flush() and then this example and see what happens.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Nick Stinemates
On Fri, Apr 18, 2008 at 10:54:36AM -0400, Jason Pruim wrote:
>
>> So if someone could point me in the right direction I'd really appreciate
>> it.
>
> Hi Steve,
>
> From my understanding of how PHP works and from reading the archives of 
> this list, and asking quite a few questions my self.. You can't do a 
> progress bar in PHP since by the time it gets to the browser, PHP is done 
> doing what it does. 

This is actually false, at least on my system(s).

Try this out:




-- 
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Eric Butera
On Fri, Apr 18, 2008 at 11:56 AM, Steve Holmes <[EMAIL PROTECTED]> wrote:
> Thanks for the suggestion, but I'm pretty far along in this project and the
> idea is that the software install happens on demand. What we are trying to
> do is get the student/faculty population (tens of thousands of users) to
> keep their blog/bb/etc. software up to date by giving them a point and click
> method of updating them (wordpress, phpBB, drupal, etc). We can't *force*
> them to update, that's against policy, but they keep getting hacked and
> don't know/care enough to bother doing the update.

The way the cron job would work is that the user requests an install.
This would write out a queue file or flag in a database marking a
specific user wants to do x upgrades.

Then the cron job, which runs every minute or so, will constantly
check for users whom have requested upgrades and proceed from there.
This way your front end script can poll against the queue/db to see
when the upgrade is finished.

Whatever gets the job done correctly is what is important, not really
the way you "skin the cat."  I just know I've had to stop relying on
some of my front end scripts from doing heavy lifting as they flake
out sometimes for any of a million reasons.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Steve Holmes
On Fri, Apr 18, 2008 at 11:39 AM, Eric Butera <[EMAIL PROTECTED]> wrote:

> On Fri, Apr 18, 2008 at 10:42 AM, Steve Holmes <[EMAIL PROTECTED]> wrote:
> > Greetings, I'm relatively new to PHP and I've been lurking for a while
> on
> >  the list, but now I need a pointer or two.
> >  I have an application which has one function that does a lengthy
> process
> >  (installing a piece of software) and I don't want the user to panic
> thinking
> >  nothing is going on. So I want to put up a 'working' box or a progress
> bar.
> >  I have no idea how to do that. I haven't dipped my toes into pear yet.
> I
> >  don't even know how to install or use a pear module. If there is
> something
> >  available that doesn't require pear knowledge so much the better, I
> guess,
> >  but if this is the straw that gets me into pear, so be it.
> >  So if someone could point me in the right direction I'd really
> appreciate
> >  it.
> >
> >  Thanks,
> >  Steve Holmes
> >  Purdue University
> >
>
> It might be a better idea to have this installation happen via some
> other means such as a cron job that isn't influenced by the browser.
> Then just keep refreshing the page or doing an ajax poll until the job
> has returned success.  Internet connections get dropped, people hit
> refresh, or whatever and that shouldn't break what is going on (in an
> ideal world ;)).
>

Thanks for the suggestion, but I'm pretty far along in this project and the
idea is that the software install happens on demand. What we are trying to
do is get the student/faculty population (tens of thousands of users) to
keep their blog/bb/etc. software up to date by giving them a point and click
method of updating them (wordpress, phpBB, drupal, etc). We can't *force*
them to update, that's against policy, but they keep getting hacked and
don't know/care enough to bother doing the update.


> If you can't figure that out at least put in an ignore_user_abort to
> prevent the user from hitting stop and messing up the installation
> process.  Just make sure to create some way of knowing that an
> installation has been started and check a session value/flat file to
> see if the installation is still going in case the user does request
> the page again.  Once everything is done make sure your script unsets
> the session variable/flat file to know you can proceed to the next
> step.
>

Great suggestion. I will have to do this at a minimum.


>
> Good luck!
>


Thanks.Steve.


Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Eric Butera
On Fri, Apr 18, 2008 at 11:31 AM, Steve Holmes <[EMAIL PROTECTED]> wrote:
> If there are any canned ajax solutions, I'd like to hear about them.

http://developer.yahoo.com/yui/connection/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Eric Butera
On Fri, Apr 18, 2008 at 10:42 AM, Steve Holmes <[EMAIL PROTECTED]> wrote:
> Greetings, I'm relatively new to PHP and I've been lurking for a while on
>  the list, but now I need a pointer or two.
>  I have an application which has one function that does a lengthy process
>  (installing a piece of software) and I don't want the user to panic thinking
>  nothing is going on. So I want to put up a 'working' box or a progress bar.
>  I have no idea how to do that. I haven't dipped my toes into pear yet. I
>  don't even know how to install or use a pear module. If there is something
>  available that doesn't require pear knowledge so much the better, I guess,
>  but if this is the straw that gets me into pear, so be it.
>  So if someone could point me in the right direction I'd really appreciate
>  it.
>
>  Thanks,
>  Steve Holmes
>  Purdue University
>

It might be a better idea to have this installation happen via some
other means such as a cron job that isn't influenced by the browser.
Then just keep refreshing the page or doing an ajax poll until the job
has returned success.  Internet connections get dropped, people hit
refresh, or whatever and that shouldn't break what is going on (in an
ideal world ;)).

If you can't figure that out at least put in an ignore_user_abort to
prevent the user from hitting stop and messing up the installation
process.  Just make sure to create some way of knowing that an
installation has been started and check a session value/flat file to
see if the installation is still going in case the user does request
the page again.  Once everything is done make sure your script unsets
the session variable/flat file to know you can proceed to the next
step.

Good luck!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Steve Holmes
Thanks (to both). Ajax is yet another thing I don't know anything about.
:-). Time to do some studyin' up I guess.If there are any canned ajax
solutions, I'd like to hear about them.

Steve.


On Fri, Apr 18, 2008 at 11:04 AM, James Dempster <[EMAIL PROTECTED]> wrote:

> As a suggestion you could store a progress of the function in the session
> and make regular calls via ajax back to the server for the progress.
>
> --
> /James
>
>
> On Fri, Apr 18, 2008 at 3:42 PM, Steve Holmes <[EMAIL PROTECTED]> wrote:
>
> > Greetings, I'm relatively new to PHP and I've been lurking for a while
> > on
> > the list, but now I need a pointer or two.
> > I have an application which has one function that does a lengthy process
> > (installing a piece of software) and I don't want the user to panic
> > thinking
> > nothing is going on. So I want to put up a 'working' box or a progress
> > bar.
> > I have no idea how to do that. I haven't dipped my toes into pear yet. I
> > don't even know how to install or use a pear module. If there is
> > something
> > available that doesn't require pear knowledge so much the better, I
> > guess,
> > but if this is the straw that gets me into pear, so be it.
> > So if someone could point me in the right direction I'd really
> > appreciate
> > it.
> >
> > Thanks,
> > Steve Holmes
> > Purdue University
> >
>
>


-- 
There is no greater gift to an insecure leader that quite matches a vague
enemy who can be used to whip up fear and hatred among the population.
-Paul Rusesabagina, humanitarian (b. 1954)

Human beings are perhaps never more frightening than when they are
convinced beyond doubt that they are right. -Laurens van der Post, explorer
and writer (1906-1996)


Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread James Dempster
As a suggestion you could store a progress of the function in the session
and make regular calls via ajax back to the server for the progress.

--
/James

On Fri, Apr 18, 2008 at 3:42 PM, Steve Holmes <[EMAIL PROTECTED]> wrote:

> Greetings, I'm relatively new to PHP and I've been lurking for a while on
> the list, but now I need a pointer or two.
> I have an application which has one function that does a lengthy process
> (installing a piece of software) and I don't want the user to panic
> thinking
> nothing is going on. So I want to put up a 'working' box or a progress
> bar.
> I have no idea how to do that. I haven't dipped my toes into pear yet. I
> don't even know how to install or use a pear module. If there is something
> available that doesn't require pear knowledge so much the better, I guess,
> but if this is the straw that gets me into pear, so be it.
> So if someone could point me in the right direction I'd really appreciate
> it.
>
> Thanks,
> Steve Holmes
> Purdue University
>


Re: [PHP] need "pop-up" in progress alert

2008-04-18 Thread Jason Pruim


On Apr 18, 2008, at 10:42 AM, Steve Holmes wrote:
Greetings, I'm relatively new to PHP and I've been lurking for a  
while on

the list, but now I need a pointer or two.
I have an application which has one function that does a lengthy  
process
(installing a piece of software) and I don't want the user to panic  
thinking
nothing is going on. So I want to put up a 'working' box or a  
progress bar.
I have no idea how to do that. I haven't dipped my toes into pear  
yet. I
don't even know how to install or use a pear module. If there is  
something
available that doesn't require pear knowledge so much the better, I  
guess,

but if this is the straw that gets me into pear, so be it.
So if someone could point me in the right direction I'd really  
appreciate

it.


Hi Steve,

From my understanding of how PHP works and from reading the archives  
of this list, and asking quite a few questions my self.. You can't do  
a progress bar in PHP since by the time it gets to the browser, PHP is  
done doing what it does. I don't know about pear, but I know lots of  
people have used AJAX progress bars to tell the user what's going on.


Hopefully someone can fill in the blanks for you... Just thought I  
would share my knowledge a little bit :)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] need "pop-up" in progress alert

2008-04-18 Thread Steve Holmes
Greetings, I'm relatively new to PHP and I've been lurking for a while on
the list, but now I need a pointer or two.
I have an application which has one function that does a lengthy process
(installing a piece of software) and I don't want the user to panic thinking
nothing is going on. So I want to put up a 'working' box or a progress bar.
I have no idea how to do that. I haven't dipped my toes into pear yet. I
don't even know how to install or use a pear module. If there is something
available that doesn't require pear knowledge so much the better, I guess,
but if this is the straw that gets me into pear, so be it.
So if someone could point me in the right direction I'd really appreciate
it.

Thanks,
Steve Holmes
Purdue University