[Proto-Scripty] Re: php in files

2009-06-23 Thread Robaj

Ok, let me put my idea to you and see if there is a way without
reloading the whole page -

I use prototype.js and project.js. project.js is just my entensions
for each project, which I have narrowed down to two functions,  -

function myRequest( text ) {
new Ajax.Request('requests.php',
{
method: 'post',
postBody: text,
onComplete: myResponse
});

}
function myResponse(req) {
$(targetdiv).innerHTML= req.responseText;
}
Where text is supplied from the controls, such as 'page=home'.
request.php is the only php file called directly, it decides which
response is wanted and returns the text for a control or entire body
for 

All of my pages and controls within them are created in php from the
database. This is very easy to maintain and update, so a nice base for
all kinds of applications

All works well if I only respond with html including the ajax side
that recalls requests.php, the only problem is that I intended some of
the pages to be applications, so I want them to have php and can not
see a way to pass it through the preprocessor.

My request.php at the server side is like this -


$Home=$button=$update=$testButton=$menuItem="";
extract($_POST,EXTR_IF_EXISTS);

if($menuItem != "")
{
$retstr = "";

$dbconn = getdbconnection();

//find page associated with this menu item
$query = 'SELECT body FROM menu WHERE name=\''.$menuItem.'\'';
$result = pg_query($dbconn,$query) or die('Query failed: ' .
pg_last_error());
$row = pg_fetch_row($result);
//read in the file
if(file_exists($row[0]))
{
$handle = fopen($row[0],"r");
$retstr = fread($handle,filesize($row[0]));
fclose($handle);
//failed attempt to use include instead
//$retstr = "";
}
else
{
$retstr = "File not created yet";
}
pg_close($dbconn);
echo $retstr;
}

In the end this would leave me with only one main page index.php and
all other pages called up via ajax and created or loaded via php.

I have the feeling now that I have to update the whole page, not a
terrible tragedy, but I just have the feeling that I can somehow put
my fread() file through the php preprocessor.

On Jun 23, 3:09 pm, Richard Quadling  wrote:
> 2009/6/23 Robaj :
>
>
>
>
>
> > I know this isn't strictly speaking a Prototype issue, but this is the
> > only group I am in and a few topics do skirt around the edges of your
> > main topic.
>
> > If I have a file -
> > home.php
> >  > echo "A very interesting home page";
> > ?>
>
> > Then the file is returned to go into  with a
> > plain fread() into a variable which is 'echo'd back to the client.
>
> > 'include'ing this file is fine, but then it passes through php at the
> > same time as everything else.
>
> > But any such file loaded as the action of an Ajax call is not fine. It
> > doesn't get passed via php, or at least I don't think it does -
> > because in 'mainbody' I get part of it such as
>
> > Interesting"; ?>
>
> > Confusing because if it were being passed through php I would expect
> > 'Interesting'. but if it were not, then I would expect the whole file
> > in plain text.
>
> > I knew when I did this with fread I was probably heading for trouble,
> > but which is happening,
> >   partial php parseing,
> >   no php parseing or
> >   . ?
>
> If you use fread(), you are reading a file. Any file. Nothing magic.
> No processing.
> If you use include()/require()/include_once()/require_once(), then PHP
> will process that file if it contains a valid opening tag (
> Uploading a file does NOT process the file. The file is only processed
> when it is requested.
>
> Can you provide any more information about what you are trying to do?
>
> Maybe using the PHP General list would also be a better place for this
> thread? (http://docs.php.net/mailing-lists.php)
>
> Regards,
>
> Richard.
>
> --
> -
> Richard Quadling
> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Periodical Updater detect content change

2009-06-23 Thread Alex McAuley

There is also a Form.observer 
http://www.prototypejs.org/api/timedObserver/form-observer
I used to use this but implemented my own version of it with a cache and 
some hashing, it didnt take long to write and works perfectly

HTH
Alex


- Original Message - 
From: "Aamchi" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, June 23, 2009 11:19 PM
Subject: [Proto-Scripty] Re: Periodical Updater detect content change



Thanks, for your response. I'm not 100% sure if I understand correctly
what you mean. If I get some data and generate a hash and write this
to the JSON header and retrieve this when calling onSuccess, how will
I still have the previous hash? From where will I get this?  Won't the
updated data cause the hash to be overwritten in the JSON header? Or
do I have to send two hashes always and compare them?

On 23 Jun., 22:57, Richard Quadling  wrote:
> 2009/6/23 Aamchi 
>
>
>
>
>
> > Hi,
>
> > I was wondering if Ajax.PeriodicalUpdater can detect if content has
> > changed since the last update and if so trigger an event.
>
> > So for example I have a scoreboard which fetches data every 5 seconds
> > and displays this. I would be cool if there could be some kind of
> > notification if content had changed. I know that the new content is
> > stores in responseText but how can I compare it to the previous
> > content...
>
> > Thanks,
> > Aman
>
> Personally, I would do this server side.
> Assuming you get the data in some sort of structure before either rending
> some HTML and sending it or just sending it JSON'd, then you should be 
> able
> to build a hash of the data.
>
> See [1] for info on Hash Functions.
>
> So. If you sent the hash value in a X-JSON header along with an 
> onSuccess()
> callback, you can extract the hash from the second param to the onSuccess
> and compare this with the previously retrieved hash to indicate you've got
> changed data. See [2] for details about PeriodicalUpdater update
> notification and [3] for the parameters to common callbacks.
>
> Regards,
>
> Richard.
>
> [1]http://en.wikipedia.org/wiki/Hash_function
> [2]http://www.prototypejs.org/api/ajax/periodicalUpdater
> [3]http://www.prototypejs.org/api/ajax/options
> 
>
> --
> -
> Richard Quadling
> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: question re: Element.addMethods

2009-06-23 Thread barunio

Ah thanks, that makes sense.

On Jun 21, 6:08 am, "T.J. Crowder"  wrote:
> Hiya,
>
> > ...wouldn't "element" always refer to a node in
> > the DOM already?  Is there a case where the method could fail if that
> > first line is not included?
>
> The functions in the Element class are available both as class methods
> and as instance methods.  What you're defining is the class method,
> which automagically gets "methodized" and applied to either the
> HTMLElement prototype (on most browsers) or specific elements when
> they're extended (on IE).  More here:http://prototypejs.org/learn/extensions
>
> So answering your second question above, if someone uses the class
> version of the method and passes in an ID, the call to $() is
> necessary.  Silly example:
>
> Element.addMethods({
>     showError:  function(element, err) {
>         element = $(element);
>         element.update('' + err + '');
>     }
>
> });
>
> ...which can be called like this:
>
>     Element.showError('target', 'Something failed.');
>
> ...in which case the $() call is required.  You're quite right that
> it's redundant if they use the methodized version:
>
>     $('target').showError('Something failed');
>
> ...since the element passed into it will already be both looked up and
> extended before it gets called.
>
> So I think it's the class method scenario that's the main reason you
> need it.
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
> On Jun 20, 2:00 am,barunio wrote:
>
> > I'm trying to understand something about this example from the API
> > docs re: Element.addMethods:
>
> > Element.addMethods({
> >   wrap: function(element, tagName) {
> >     element = $(element);
> >     var wrapper = document.createElement('tagName');
> >     element.parentNode.replaceChild(wrapper, element);
> >     wrapper.appendChild(element);
> >     return Element.extend(wrapper);
> >   }
>
> > });
>
> > Why does the "wrap" function include the line "element = $(element);"?
>
> > In general, this line adds extra flexibility to a function.  But in
> > this case the function is defined in the context of
> > Element.addMethods, so wouldn't "element" always refer to a node in
> > the DOM already?  Is there a case where the method could fail if that
> > first line is not included?
>
> > Thanks..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Periodical Updater detect content change

2009-06-23 Thread Aamchi

Thanks, for your response. I'm not 100% sure if I understand correctly
what you mean. If I get some data and generate a hash and write this
to the JSON header and retrieve this when calling onSuccess, how will
I still have the previous hash? From where will I get this?  Won't the
updated data cause the hash to be overwritten in the JSON header? Or
do I have to send two hashes always and compare them?

On 23 Jun., 22:57, Richard Quadling  wrote:
> 2009/6/23 Aamchi 
>
>
>
>
>
> > Hi,
>
> > I was wondering if Ajax.PeriodicalUpdater can detect if content has
> > changed since the last update and if so trigger an event.
>
> > So for example I have a scoreboard which fetches data every 5 seconds
> > and displays this. I would be cool if there could be some kind of
> > notification if content had changed. I know that the new content is
> > stores in responseText but how can I compare it to the previous
> > content...
>
> > Thanks,
> > Aman
>
> Personally, I would do this server side.
> Assuming you get the data in some sort of structure before either rending
> some HTML and sending it or just sending it JSON'd, then you should be able
> to build a hash of the data.
>
> See [1] for info on Hash Functions.
>
> So. If you sent the hash value in a X-JSON header along with an onSuccess()
> callback, you can extract the hash from the second param to the onSuccess
> and compare this with the previously retrieved hash to indicate you've got
> changed data. See [2] for details about PeriodicalUpdater update
> notification and [3] for the parameters to common callbacks.
>
> Regards,
>
> Richard.
>
> [1]http://en.wikipedia.org/wiki/Hash_function
> [2]http://www.prototypejs.org/api/ajax/periodicalUpdater
> [3]http://www.prototypejs.org/api/ajax/options
>  
>
> --
> -
> Richard Quadling
> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Periodical Updater detect content change

2009-06-23 Thread Richard Quadling
2009/6/23 Aamchi 

>
> Hi,
>
> I was wondering if Ajax.PeriodicalUpdater can detect if content has
> changed since the last update and if so trigger an event.
>
> So for example I have a scoreboard which fetches data every 5 seconds
> and displays this. I would be cool if there could be some kind of
> notification if content had changed. I know that the new content is
> stores in responseText but how can I compare it to the previous
> content...
>
> Thanks,
> Aman
>
> >
>
Personally, I would do this server side.
Assuming you get the data in some sort of structure before either rending
some HTML and sending it or just sending it JSON'd, then you should be able
to build a hash of the data.

See [1] for info on Hash Functions.

So. If you sent the hash value in a X-JSON header along with an onSuccess()
callback, you can extract the hash from the second param to the onSuccess
and compare this with the previously retrieved hash to indicate you've got
changed data. See [2] for details about PeriodicalUpdater update
notification and [3] for the parameters to common callbacks.



Regards,

Richard.

[1] http://en.wikipedia.org/wiki/Hash_function
[2] http://www.prototypejs.org/api/ajax/periodicalUpdater
[3]
http://www.prototypejs.org/api/ajax/options
 

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Long running requests disable other navigation links on the page

2009-06-23 Thread franklinhu



On Jun 23, 10:26 am, "T.J. Crowder"  wrote:
> Hi,
>
> Weird, the way things seem to run in themes in the group.  I just
> posted this to another thread[1] here:
>
> * * * *
> Most browsers, and most servers, place a limit on the number of
> simultaneous connections between the same endpoints, and typically
> that limit is two simultaneous connections.  I don't immediately have
> a reference for that, but if you search on "simultaneous HTTP
> connection limit" or "concurrent HTTP connection limit" or some such,
> you'll find info on it.  Note, again, that this is done at the browser
> level and also, sometimes, at the server level, and it varies by
> vendor (and configuration).
> * * * *
>
> [1]http://groups.google.com/group/prototype-scriptaculous/browse_thread/...
>
> > I have been looking for some kind of cancel
> > functionality to quit out of the long running requests when a user
> > clicks on a navigation link, but I have been unable to find anything.
> > Can someone help?
>
> The underlying XmlHttpRequest object may support the (relatively) new
> abort method (which I think is well-supported now).  I don't think
> Prototype has a documented means of aborting requests or of accessing
> the underlying XHR object, but it's a pretty open secret:  The XHR is
> stored as the "transport" property of the Ajax.Request object.  So on
> browsers that support it, you can abort requests:
>
> Creating the request and keeping a reference to it:
>
>     req = new Ajax.Request(...);
>
> ...then using that reference to cancel if supported:
>
>     try {
>         req.transport.abort();
>     } catch (e) {
>         // Handle the failure, if any and if you want to
>     }
>
> (Naturally if you want to you can test first to see if 'transport' is
> there and if 'transport.abort' is there.)
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
> On Jun 23, 6:02 pm, franklinhu  wrote:
>
>
>
> > I have a page which uses prototype.js and it contains several ajax
> > requests that retrieve lists to be displayed to the user. This page
> > also has links which take the user to different parts of the
> > application. I am finding that these links do not take an action until
> > the long running requests are finished. This gives the appearance that
> > the links are broken as the user clicks on them. After the requests
> > are finished, then the page is able to navigate to the link that was
> > clicked, but this can take several seconds for my application.
>
> > I thought that the whole idea behind Ajax was that you could do things
> > in the background, and that you wouldn't have to wait for things to
> > finish. However, what I am encountering is that while the page does
> > display quickly, the user can't use it until it is finished rendering
> > which is almost as annoying as having to wait for the entire page to
> > render without Ajax. I have been looking for some kind of cancel
> > functionality to quit out of the long running requests when a user
> > clicks on a navigation link, but I have been unable to find anything.
> > Can someone help?
>
> > Here is the code I am using to call the requests.
>
> > 
>
> > My main page calls a javascript routine during the onLoad tag.
>
> > function displayDIVData()
> > {
> >         if (bAvailTrips) getAvailableTrips();
>
> > }
>
> > This function calls another function.
>
> > function getAvailableTrips()
> > {
> >         var AvailTripRequest = new Ajax.Updater('TripAvailableDivBody',
> > UniqueURL('GetAvailableTrips.asp'), {asynchronous:true,
> > evalScripts:true, method:'get'});
>
> > }
>
> > -fhuajax- Hide quoted text -
>
> - Show quoted text -

I tried using the transport.abort function and it appears to
immediately clear out the div where the results are supposed to go,
however, it still appears to be processing the URL that was passed to
it and won't navigate until it has returned.

I have found that external links work as expected, so there is some
thread problem on the javascript side. I noticed I had debugging
turned on and this made IIS single threaded. When I turned off
debugging, then I could continue to process requests in another
browser window while the other one was retrieving contents using Ajax.
However, within the same browser, navigation requests are still
suppressed and must wait for the Ajax call to complete.

Based on your response, it sound like this is the way Ajax is supposed
to work. If you have a long running request to the server, you are
unable to do internal navigation until that request has been
satisifed. Is that right? I still find that hard to believe. I was
hoping that I had just called Ajax in the wrong place or used the
wrong parameters.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.c

[Proto-Scripty] Re: Is there a way to "view" event observers?

2009-06-23 Thread emitch

I kinda figured something like that was going on.  Your logging idea
in the createWrapper function worked great and I have all the info I
need now.

Thanks for the help T.J!

On Jun 23, 5:47 am, "T.J. Crowder"  wrote:
> Hi,
>
> The actual handler is referenced from the wrapper via a closure, so
> the handler isn't a property on the wrapper that you could access
> after-the-fact.
>
> I think in your situation the most straight-forward approach would be
> to add some debug logging code to the createWrapper function (in
> Prototype 1.6.0.3, line 3,955) or the _createResponder function (in
> Prototype 1.6.1 RC3, line 4,475).
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
> On Jun 23, 12:46 am, emitch  wrote:
>
> > I have a large unfamiliar site I have started working on that uses
> > prototype and there are a number of tucked away bits of code that add
> > event handlers to the document dom:loaded event (as well as other
> > element events).  Is there a way for me to see, alert, or log etc. all
> > of the actual functions/methods that are queued up to run when the
> > event fires?  This is strictly for debugging and performance tuning,
> > as I currently have no idea how many handlers are being set or what
> > they are doing.
>
> > I tried poking around in the Event.cache and found some reference to
> > function calls, but they all appear to be a wrapper function of
> > prototype and I couldn't find a way to see the actual functions that
> > are being called when an event fires.
>
> > Thanks in advance for any tips or help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Two sets of expand and contract icons?

2009-06-23 Thread TEC

Thanks again.  Looks like I got a few more days anyways before I
really have to get things going on this site.

This is the page I'll be using it on if it helps.  You will see
exactly how I'm using it:  
http://traceyedwardsdev.com/preview/valvoline/services.php

Still using that other script, and it's working well.  I just need to
be able to change the icons on the inner content divs so it's not the
same as the nav on the right.


On Jun 23, 2:05 pm, "Alex McAuley" 
wrote:
> Well, i forgot to code it in !!...
>
> Easiest way without adding script is to "style="display:none;" on the ones
> you want to be closed i.e  class="c-content unCollapsed">
>
> but i will code it in later when i have some time and probably recode the
> whole thing to be honest
>
> HTH
> Alex
>
> - Original Message -
> From: "TEC" 
> To: "Prototype & script.aculo.us" 
> Sent: Tuesday, June 23, 2009 6:15 PM
> Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?
>
> Thank you.
>
> And essentially the quick and dirty way of getting two different sets
> of icons would be duplicate the code and rename functions / classes.
> Not the best way to do it mind you, but the quickest way.  I'll play
> around though to see if I can get it with out duplicating everything.
>
> Does this script allow for you to load the page and have certain divs
> load in the collapsed state?
>
> On Jun 23, 12:23 pm, "Alex McAuley" 
> wrote:
> > Very quick and dirty but you can see that it can be done in not alot of
> > code
> > at all  to be honest i think i can get rid of about another 5 lines at
> > least
>
> >http://www.bazookawally.co.uk/collapse.php
>
> > HTH
>
> > Alex
>
> > - Original Message -
> > From: "TEC" 
> > To: "Prototype & script.aculo.us"
> > 
> > Sent: Tuesday, June 23, 2009 4:11 PM
> > Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?
>
> > Thanks again for the reply.
>
> > Here is a working example of the script I
> > used:http://www.ryanscherf.net/demos/dtd/
> > and the tutorial that goes along with
> > it:http://www.ryanscherf.net/blog/dynamic-effects-via-the-dtd-part-2
>
> > It looks like it is an add on to scriptaculous. Took me a few minutes
> > to find that tutorial I found 2 months ago when I started working on
> > website i will be using it for. That project went on hold and now I'm
> > starting up on it again and this is one of the last remaining pieces
> > on it.
>
> > I don't really wont to trouble you with writing the bones, but if it's
> > something that you can do real quick and I can get a learning
> > experience out of it by all means go ahead, But please don't trouble
> > your self with it=)
>
> > Thanks again
>
> > ~Chris
>
> > On Jun 23, 10:42 am, "Alex McAuley" 
> > wrote:
> > > i dont know what decorators.js is so i cant help you with that, though
> > > it
> > > woudlnt take long to script something to do this toggleing...
>
> > > It would be standards complient too as adding nodes to elements
> > > (collapsable="true" etc etc) is not complient and would fail W3c
> > > validation...
>
> > > I would tackle it with classnames and an array of elements to start as
> > > flat
>
> > > I could write the bones for you to get you started if you like then you
> > > cn
> > > learn a bit aswell !!
>
> > > Let me know
>
> > > HTH
>
> > > ALex
>
> > > - Original Message -
> > > From: "TEC" 
> > > To: "Prototype & script.aculo.us"
> > > 
> > > Sent: Tuesday, June 23, 2009 3:10 PM
> > > Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?
>
> > > Thanks for the reply.
>
> > > I thoguht I was already using scriptaculous, but I could be wrong.
>
> > > The div structure is as following:
>
> > >  > > collapse="true">
> > > header
> > > 
>
> > > 
>
> > > 
> > > 
> > > 
>
> > > and the page includes:
>
> > > 
> > > 
> > > 
> > > 
> > > 
>
> > > The collapse='true' comes from a modification I made to decorators.js
> > > from a tutorial that shows how to start a div in the collapsed state.
> > > There are also a few style sheet entries that tell the icons where to
> > > appear.
>
> > > Is there an easier way of creating collapsible divs with two sets of
> > > icons and some divs starting in the collapsed state then I am
> > > currently using?
>
> > > Thanks
>
> > > On Jun 23, 9:57 am, "Alex McAuley" 
> > > wrote:
> > > > you can do this easily with proto/scriptaculous or vanilla javascript,
> > > > i
> > > > would recommend staying away from pre-made scripts for this easy task
> > > > as
> > > > it
> > > > will inhibit what you can do and what you learn from writing
> > > > applications
>
> > > > Alex
>
> > > > - Original Message -
> > > > From: "TEC" 
> > > > To: "Prototype & script.aculo.us"
> > > > 
> > > > Sent: Tuesday, June 23, 2009 2:47 PM
> > > > Subject: [Proto-Scripty] Two sets of expand and contract icons?
>
> > > > > I'm working on a website where there are two styles of divs that
> > > > > need
> > > > > to expand and collapse. I have made custom ic

[Proto-Scripty] Re: Two sets of expand and contract icons?

2009-06-23 Thread Alex McAuley

Well, i forgot to code it in !!...

Easiest way without adding script is to "style="display:none;" on the ones 
you want to be closed i.e 

but i will code it in later when i have some time and probably recode the 
whole thing to be honest

HTH
Alex

- Original Message - 
From: "TEC" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, June 23, 2009 6:15 PM
Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?



Thank you.

And essentially the quick and dirty way of getting two different sets
of icons would be duplicate the code and rename functions / classes.
Not the best way to do it mind you, but the quickest way.  I'll play
around though to see if I can get it with out duplicating everything.

Does this script allow for you to load the page and have certain divs
load in the collapsed state?

On Jun 23, 12:23 pm, "Alex McAuley" 
wrote:
> Very quick and dirty but you can see that it can be done in not alot of 
> code
> at all  to be honest i think i can get rid of about another 5 lines at
> least
>
> http://www.bazookawally.co.uk/collapse.php
>
> HTH
>
> Alex
>
> - Original Message -
> From: "TEC" 
> To: "Prototype & script.aculo.us" 
> 
> Sent: Tuesday, June 23, 2009 4:11 PM
> Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?
>
> Thanks again for the reply.
>
> Here is a working example of the script I 
> used:http://www.ryanscherf.net/demos/dtd/
> and the tutorial that goes along with 
> it:http://www.ryanscherf.net/blog/dynamic-effects-via-the-dtd-part-2
>
> It looks like it is an add on to scriptaculous. Took me a few minutes
> to find that tutorial I found 2 months ago when I started working on
> website i will be using it for. That project went on hold and now I'm
> starting up on it again and this is one of the last remaining pieces
> on it.
>
> I don't really wont to trouble you with writing the bones, but if it's
> something that you can do real quick and I can get a learning
> experience out of it by all means go ahead, But please don't trouble
> your self with it=)
>
> Thanks again
>
> ~Chris
>
> On Jun 23, 10:42 am, "Alex McAuley" 
> wrote:
> > i dont know what decorators.js is so i cant help you with that, though 
> > it
> > woudlnt take long to script something to do this toggleing...
>
> > It would be standards complient too as adding nodes to elements
> > (collapsable="true" etc etc) is not complient and would fail W3c
> > validation...
>
> > I would tackle it with classnames and an array of elements to start as
> > flat
>
> > I could write the bones for you to get you started if you like then you 
> > cn
> > learn a bit aswell !!
>
> > Let me know
>
> > HTH
>
> > ALex
>
> > - Original Message -
> > From: "TEC" 
> > To: "Prototype & script.aculo.us"
> > 
> > Sent: Tuesday, June 23, 2009 3:10 PM
> > Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?
>
> > Thanks for the reply.
>
> > I thoguht I was already using scriptaculous, but I could be wrong.
>
> > The div structure is as following:
>
> >  > collapse="true">
> > header
> > 
>
> > 
>
> > 
> > 
> > 
>
> > and the page includes:
>
> > 
> > 
> > 
> > 
> > 
>
> > The collapse='true' comes from a modification I made to decorators.js
> > from a tutorial that shows how to start a div in the collapsed state.
> > There are also a few style sheet entries that tell the icons where to
> > appear.
>
> > Is there an easier way of creating collapsible divs with two sets of
> > icons and some divs starting in the collapsed state then I am
> > currently using?
>
> > Thanks
>
> > On Jun 23, 9:57 am, "Alex McAuley" 
> > wrote:
> > > you can do this easily with proto/scriptaculous or vanilla javascript, 
> > > i
> > > would recommend staying away from pre-made scripts for this easy task 
> > > as
> > > it
> > > will inhibit what you can do and what you learn from writing
> > > applications
>
> > > Alex
>
> > > - Original Message -
> > > From: "TEC" 
> > > To: "Prototype & script.aculo.us"
> > > 
> > > Sent: Tuesday, June 23, 2009 2:47 PM
> > > Subject: [Proto-Scripty] Two sets of expand and contract icons?
>
> > > > I'm working on a website where there are two styles of divs that 
> > > > need
> > > > to expand and collapse. I have made custom icons for expand and
> > > > contract for each set of divs.
>
> > > > But from looking at the script, it appears you can only use one set 
> > > > of
> > > > icons. Is there away edit decorators.js so two sets of icons can be
> > > > used?
>
> > > > I have started to play around and modify the file my self but I keep
> > > > breaking the expand and contract and can't seem to get it to work
> > > > right and was hoping someone here could point me in the right
> > > > direction. The vars for the icons are as following.
>
> > > > var expImg = "images/expand.jpg";
> > > > var conImg = "images/contract.jpg";
> > > > var expImg2 = "images/location_down.jpg";
> > > > var conImg2 = "images/location_up.jpg";
>
> > > > Thank you



--~--

[Proto-Scripty] Re: Long running requests disable other navigation links on the page

2009-06-23 Thread T.J. Crowder

Hi,

Weird, the way things seem to run in themes in the group.  I just
posted this to another thread[1] here:

* * * *
Most browsers, and most servers, place a limit on the number of
simultaneous connections between the same endpoints, and typically
that limit is two simultaneous connections.  I don't immediately have
a reference for that, but if you search on "simultaneous HTTP
connection limit" or "concurrent HTTP connection limit" or some such,
you'll find info on it.  Note, again, that this is done at the browser
level and also, sometimes, at the server level, and it varies by
vendor (and configuration).
* * * *

[1] 
http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/919bf83a1a9a88da

> I have been looking for some kind of cancel
> functionality to quit out of the long running requests when a user
> clicks on a navigation link, but I have been unable to find anything.
> Can someone help?

The underlying XmlHttpRequest object may support the (relatively) new
abort method (which I think is well-supported now).  I don't think
Prototype has a documented means of aborting requests or of accessing
the underlying XHR object, but it's a pretty open secret:  The XHR is
stored as the "transport" property of the Ajax.Request object.  So on
browsers that support it, you can abort requests:

Creating the request and keeping a reference to it:

req = new Ajax.Request(...);

...then using that reference to cancel if supported:

try {
req.transport.abort();
} catch (e) {
// Handle the failure, if any and if you want to
}

(Naturally if you want to you can test first to see if 'transport' is
there and if 'transport.abort' is there.)

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jun 23, 6:02 pm, franklinhu  wrote:
> I have a page which uses prototype.js and it contains several ajax
> requests that retrieve lists to be displayed to the user. This page
> also has links which take the user to different parts of the
> application. I am finding that these links do not take an action until
> the long running requests are finished. This gives the appearance that
> the links are broken as the user clicks on them. After the requests
> are finished, then the page is able to navigate to the link that was
> clicked, but this can take several seconds for my application.
>
> I thought that the whole idea behind Ajax was that you could do things
> in the background, and that you wouldn't have to wait for things to
> finish. However, what I am encountering is that while the page does
> display quickly, the user can't use it until it is finished rendering
> which is almost as annoying as having to wait for the entire page to
> render without Ajax. I have been looking for some kind of cancel
> functionality to quit out of the long running requests when a user
> clicks on a navigation link, but I have been unable to find anything.
> Can someone help?
>
> Here is the code I am using to call the requests.
>
> 
>
> My main page calls a javascript routine during the onLoad tag.
>
> function displayDIVData()
> {
>         if (bAvailTrips) getAvailableTrips();
>
> }
>
> This function calls another function.
>
> function getAvailableTrips()
> {
>         var AvailTripRequest = new Ajax.Updater('TripAvailableDivBody',
> UniqueURL('GetAvailableTrips.asp'), {asynchronous:true,
> evalScripts:true, method:'get'});
>
> }
>
> -fhuajax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Long running requests disable other navigation links on the page

2009-06-23 Thread franklinhu

I have a page which uses prototype.js and it contains several ajax
requests that retrieve lists to be displayed to the user. This page
also has links which take the user to different parts of the
application. I am finding that these links do not take an action until
the long running requests are finished. This gives the appearance that
the links are broken as the user clicks on them. After the requests
are finished, then the page is able to navigate to the link that was
clicked, but this can take several seconds for my application.

I thought that the whole idea behind Ajax was that you could do things
in the background, and that you wouldn't have to wait for things to
finish. However, what I am encountering is that while the page does
display quickly, the user can't use it until it is finished rendering
which is almost as annoying as having to wait for the entire page to
render without Ajax. I have been looking for some kind of cancel
functionality to quit out of the long running requests when a user
clicks on a navigation link, but I have been unable to find anything.
Can someone help?

Here is the code I am using to call the requests.



My main page calls a javascript routine during the onLoad tag.

function displayDIVData()
{
if (bAvailTrips) getAvailableTrips();
}

This function calls another function.

function getAvailableTrips()
{
var AvailTripRequest = new Ajax.Updater('TripAvailableDivBody',
UniqueURL('GetAvailableTrips.asp'), {asynchronous:true,
evalScripts:true, method:'get'});
}

-fhuajax

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Two sets of expand and contract icons?

2009-06-23 Thread TEC

Thank you.

And essentially the quick and dirty way of getting two different sets
of icons would be duplicate the code and rename functions / classes.
Not the best way to do it mind you, but the quickest way.  I'll play
around though to see if I can get it with out duplicating everything.

Does this script allow for you to load the page and have certain divs
load in the collapsed state?

On Jun 23, 12:23 pm, "Alex McAuley" 
wrote:
> Very quick and dirty but you can see that it can be done in not alot of code
> at all  to be honest i think i can get rid of about another 5 lines at
> least
>
> http://www.bazookawally.co.uk/collapse.php
>
> HTH
>
> Alex
>
> - Original Message -
> From: "TEC" 
> To: "Prototype & script.aculo.us" 
> Sent: Tuesday, June 23, 2009 4:11 PM
> Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?
>
> Thanks again for the reply.
>
> Here is a working example of the script I 
> used:http://www.ryanscherf.net/demos/dtd/
> and the tutorial that goes along with 
> it:http://www.ryanscherf.net/blog/dynamic-effects-via-the-dtd-part-2
>
> It looks like it is an add on to scriptaculous.  Took me a few minutes
> to find that tutorial I found 2 months ago when I started working on
> website i will be using it for.  That project went on hold and now I'm
> starting up on it again and this is one of the last remaining pieces
> on it.
>
> I don't really wont to trouble you with writing the bones, but if it's
> something that you can do real quick and I can get a learning
> experience out of it by all means go ahead,  But please don't trouble
> your self with it=)
>
> Thanks again
>
> ~Chris
>
> On Jun 23, 10:42 am, "Alex McAuley" 
> wrote:
> > i dont know what decorators.js is so i cant help you with that, though it
> > woudlnt take long to script something to do this toggleing...
>
> > It would be standards complient too as adding nodes to elements
> > (collapsable="true" etc etc) is not complient and would fail W3c
> > validation...
>
> > I would tackle it with classnames and an array of elements to start as
> > flat
>
> > I could write the bones for you to get you started if you like then you cn
> > learn a bit aswell !!
>
> > Let me know
>
> > HTH
>
> > ALex
>
> > - Original Message -
> > From: "TEC" 
> > To: "Prototype & script.aculo.us"
> > 
> > Sent: Tuesday, June 23, 2009 3:10 PM
> > Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?
>
> > Thanks for the reply.
>
> > I thoguht I was already using scriptaculous, but I could be wrong.
>
> > The div structure is as following:
>
> >  > collapse="true">
> > header
> > 
>
> > 
>
> > 
> > 
> > 
>
> > and the page includes:
>
> > 
> > 
> > 
> > 
> > 
>
> > The collapse='true' comes from a modification I made to decorators.js
> > from a tutorial that shows how to start a div in the collapsed state.
> > There are also a few style sheet entries that tell the icons where to
> > appear.
>
> > Is there an easier way of creating collapsible divs with two sets of
> > icons and some divs starting in the collapsed state then I am
> > currently using?
>
> > Thanks
>
> > On Jun 23, 9:57 am, "Alex McAuley" 
> > wrote:
> > > you can do this easily with proto/scriptaculous or vanilla javascript, i
> > > would recommend staying away from pre-made scripts for this easy task as
> > > it
> > > will inhibit what you can do and what you learn from writing
> > > applications
>
> > > Alex
>
> > > - Original Message -
> > > From: "TEC" 
> > > To: "Prototype & script.aculo.us"
> > > 
> > > Sent: Tuesday, June 23, 2009 2:47 PM
> > > Subject: [Proto-Scripty] Two sets of expand and contract icons?
>
> > > > I'm working on a website where there are two styles of divs that need
> > > > to expand and collapse. I have made custom icons for expand and
> > > > contract for each set of divs.
>
> > > > But from looking at the script, it appears you can only use one set of
> > > > icons. Is there away edit decorators.js so two sets of icons can be
> > > > used?
>
> > > > I have started to play around and modify the file my self but I keep
> > > > breaking the expand and contract and can't seem to get it to work
> > > > right and was hoping someone here could point me in the right
> > > > direction. The vars for the icons are as following.
>
> > > > var expImg = "images/expand.jpg";
> > > > var conImg = "images/contract.jpg";
> > > > var expImg2 = "images/location_down.jpg";
> > > > var conImg2 = "images/location_up.jpg";
>
> > > > Thank you
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--

[Proto-Scripty] Re: Two sets of expand and contract icons?

2009-06-23 Thread Alex McAuley

Very quick and dirty but you can see that it can be done in not alot of code 
at all  to be honest i think i can get rid of about another 5 lines at 
least

http://www.bazookawally.co.uk/collapse.php

HTH

Alex
- Original Message - 
From: "TEC" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, June 23, 2009 4:11 PM
Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?



Thanks again for the reply.

Here is a working example of the script I used: 
http://www.ryanscherf.net/demos/dtd/
and the tutorial that goes along with it:
http://www.ryanscherf.net/blog/dynamic-effects-via-the-dtd-part-2

It looks like it is an add on to scriptaculous.  Took me a few minutes
to find that tutorial I found 2 months ago when I started working on
website i will be using it for.  That project went on hold and now I'm
starting up on it again and this is one of the last remaining pieces
on it.

I don't really wont to trouble you with writing the bones, but if it's
something that you can do real quick and I can get a learning
experience out of it by all means go ahead,  But please don't trouble
your self with it=)


Thanks again

~Chris

On Jun 23, 10:42 am, "Alex McAuley" 
wrote:
> i dont know what decorators.js is so i cant help you with that, though it
> woudlnt take long to script something to do this toggleing...
>
> It would be standards complient too as adding nodes to elements
> (collapsable="true" etc etc) is not complient and would fail W3c
> validation...
>
> I would tackle it with classnames and an array of elements to start as 
> flat
>
> I could write the bones for you to get you started if you like then you cn
> learn a bit aswell !!
>
> Let me know
>
> HTH
>
> ALex
>
> - Original Message -
> From: "TEC" 
> To: "Prototype & script.aculo.us" 
> 
> Sent: Tuesday, June 23, 2009 3:10 PM
> Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?
>
> Thanks for the reply.
>
> I thoguht I was already using scriptaculous, but I could be wrong.
>
> The div structure is as following:
>
>  collapse="true">
> header
> 
>
> 
>
> 
> 
> 
>
> and the page includes:
>
> 
> 
> 
> 
> 
>
> The collapse='true' comes from a modification I made to decorators.js
> from a tutorial that shows how to start a div in the collapsed state.
> There are also a few style sheet entries that tell the icons where to
> appear.
>
> Is there an easier way of creating collapsible divs with two sets of
> icons and some divs starting in the collapsed state then I am
> currently using?
>
> Thanks
>
> On Jun 23, 9:57 am, "Alex McAuley" 
> wrote:
> > you can do this easily with proto/scriptaculous or vanilla javascript, i
> > would recommend staying away from pre-made scripts for this easy task as
> > it
> > will inhibit what you can do and what you learn from writing
> > applications
>
> > Alex
>
> > - Original Message -
> > From: "TEC" 
> > To: "Prototype & script.aculo.us"
> > 
> > Sent: Tuesday, June 23, 2009 2:47 PM
> > Subject: [Proto-Scripty] Two sets of expand and contract icons?
>
> > > I'm working on a website where there are two styles of divs that need
> > > to expand and collapse. I have made custom icons for expand and
> > > contract for each set of divs.
>
> > > But from looking at the script, it appears you can only use one set of
> > > icons. Is there away edit decorators.js so two sets of icons can be
> > > used?
>
> > > I have started to play around and modify the file my self but I keep
> > > breaking the expand and contract and can't seem to get it to work
> > > right and was hoping someone here could point me in the right
> > > direction. The vars for the icons are as following.
>
> > > var expImg = "images/expand.jpg";
> > > var conImg = "images/contract.jpg";
> > > var expImg2 = "images/location_down.jpg";
> > > var conImg2 = "images/location_up.jpg";
>
> > > Thank you



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Drag Drop inside .net AJAX - Dispose of items?

2009-06-23 Thread Wyerarch

Hi All,

I'm loving this drag drop library in my application, however i've got
serious memory leaks because I don't know how to destroy the items.

I'm using the .net ScriptManager.RegisterClientScriptBlock method to
register my script, so that all items from the database can be
"Draggables".

However, I can't find a way of using the destroy method on them?

In my register block i'm loading all the Draggables into an array -
e..g var items = document.getElementsByClassName("bla");

Then for each item, new Draggable(items[i].id... etc)

How can I unload/destory them on async postback?

if I look at the variable "items" it references the divs, not the
objects? How can I access the objects to destroy them?

Thanks,

James.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Periodical Updater detect content change

2009-06-23 Thread Aamchi

Hi,

I was wondering if Ajax.PeriodicalUpdater can detect if content has
changed since the last update and if so trigger an event.

So for example I have a scoreboard which fetches data every 5 seconds
and displays this. I would be cool if there could be some kind of
notification if content had changed. I know that the new content is
stores in responseText but how can I compare it to the previous
content...

Thanks,
Aman

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Can options in a selection box be made draggable...

2009-06-23 Thread Rick Waldron
I was nearly tempted to post a link to a w3c spec page but then Alex was
kind enough to explain. If you need an example of what Alex is talking
about:

http://weblog.morosystems.cz/ostatni/dropdown-xhtml-css-javascript-replacement-of-classic-selectbox






On Tue, Jun 23, 2009 at 9:56 AM, Alex McAuley <
webmas...@thecarmarketplace.com> wrote:

>
> Because they are not elements or nodes they are  inside an
> element/
> node ...
>
> If you wanted them to become draggable you could hack some javascript
> together to take all the options from a select box, make them into elements
> which are draggable and sortable and a button or link to re-assemble the
> select box when finished.. this wouldnt be to hard.
>
> HTH
> Alex
> - Original Message -
> From: "Avram" 
> To: "Prototype & script.aculo.us" <
> prototype-scriptaculous@googlegroups.com>
> Sent: Tuesday, June 23, 2009 1:56 PM
> Subject: [Proto-Scripty] Re: Can options in a selection box be made
> draggable...
>
>
>
> This is a "just wondering".  Is there a short answer that will explain
> why the options in a selection box can't be made draggable?
>
> On Jun 22, 5:16 pm, "Alex McAuley" 
> wrote:
> > No !
> >
> >
> >
> > - Original Message -
> > From: "Avram" 
> > To: "Prototype & script.aculo.us"
> > 
> > Sent: Monday, June 22, 2009 4:30 PM
> > Subject: [Proto-Scripty] Can options in a selection box be made
> > draggable...
> >
> > > Can the options in a selection box be made draggable (and dropable)?-
> > > Hide quoted text -
> >
> > - Show quoted text -
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Two sets of expand and contract icons?

2009-06-23 Thread TEC

Thanks again for the reply.

Here is a working example of the script I used: 
http://www.ryanscherf.net/demos/dtd/
and the tutorial that goes along with it:
http://www.ryanscherf.net/blog/dynamic-effects-via-the-dtd-part-2

It looks like it is an add on to scriptaculous.  Took me a few minutes
to find that tutorial I found 2 months ago when I started working on
website i will be using it for.  That project went on hold and now I'm
starting up on it again and this is one of the last remaining pieces
on it.

I don't really wont to trouble you with writing the bones, but if it's
something that you can do real quick and I can get a learning
experience out of it by all means go ahead,  But please don't trouble
your self with it=)


Thanks again

~Chris

On Jun 23, 10:42 am, "Alex McAuley" 
wrote:
> i dont know what decorators.js is so i cant help you with that, though it
> woudlnt take long to script something to do this toggleing...
>
> It would be standards complient too as adding nodes to elements
> (collapsable="true" etc etc) is not complient and would fail W3c
> validation...
>
> I would tackle it with classnames and an array of elements to start as flat
>
> I could write the bones for you to get you started if you like then you cn
> learn a bit aswell !!
>
> Let me know
>
> HTH
>
> ALex
>
> - Original Message -
> From: "TEC" 
> To: "Prototype & script.aculo.us" 
> Sent: Tuesday, June 23, 2009 3:10 PM
> Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?
>
> Thanks for the reply.
>
> I thoguht I was already using scriptaculous, but I could be wrong.
>
> The div structure is as following:
>
>  collapse="true">
> header
>                 
>
>                   
>
>                 
>                 
>               
>
> and the page includes:
>
> 
> 
> 
> 
> 
>
> The collapse='true' comes from a modification I made to decorators.js
> from a tutorial that shows how to start a div in the collapsed state.
> There are also a few style sheet entries that tell the icons where to
> appear.
>
> Is there an easier way of creating collapsible divs with two sets of
> icons and some divs starting in the collapsed state then I am
> currently using?
>
> Thanks
>
> On Jun 23, 9:57 am, "Alex McAuley" 
> wrote:
> > you can do this easily with proto/scriptaculous or vanilla javascript, i
> > would recommend staying away from pre-made scripts for this easy task as
> > it
> > will inhibit what you can do and what you learn from writing
> > applications
>
> > Alex
>
> > - Original Message -
> > From: "TEC" 
> > To: "Prototype & script.aculo.us"
> > 
> > Sent: Tuesday, June 23, 2009 2:47 PM
> > Subject: [Proto-Scripty] Two sets of expand and contract icons?
>
> > > I'm working on a website where there are two styles of divs that need
> > > to expand and collapse. I have made custom icons for expand and
> > > contract for each set of divs.
>
> > > But from looking at the script, it appears you can only use one set of
> > > icons. Is there away edit decorators.js so two sets of icons can be
> > > used?
>
> > > I have started to play around and modify the file my self but I keep
> > > breaking the expand and contract and can't seem to get it to work
> > > right and was hoping someone here could point me in the right
> > > direction. The vars for the icons are as following.
>
> > > var expImg = "images/expand.jpg";
> > > var conImg = "images/contract.jpg";
> > > var expImg2 = "images/location_down.jpg";
> > > var conImg2 = "images/location_up.jpg";
>
> > > Thank you
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Two sets of expand and contract icons?

2009-06-23 Thread Alex McAuley

i dont know what decorators.js is so i cant help you with that, though it 
woudlnt take long to script something to do this toggleing...

It would be standards complient too as adding nodes to elements 
(collapsable="true" etc etc) is not complient and would fail W3c 
validation...

I would tackle it with classnames and an array of elements to start as flat

I could write the bones for you to get you started if you like then you cn 
learn a bit aswell !!

Let me know

HTH

ALex




- Original Message - 
From: "TEC" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, June 23, 2009 3:10 PM
Subject: [Proto-Scripty] Re: Two sets of expand and contract icons?



Thanks for the reply.

I thoguht I was already using scriptaculous, but I could be wrong.

The div structure is as following:


header


  



  


and the page includes:







The collapse='true' comes from a modification I made to decorators.js
from a tutorial that shows how to start a div in the collapsed state.
There are also a few style sheet entries that tell the icons where to
appear.


Is there an easier way of creating collapsible divs with two sets of
icons and some divs starting in the collapsed state then I am
currently using?

Thanks







On Jun 23, 9:57 am, "Alex McAuley" 
wrote:
> you can do this easily with proto/scriptaculous or vanilla javascript, i
> would recommend staying away from pre-made scripts for this easy task as 
> it
> will inhibit what you can do and what you learn from writing
> applications
>
> Alex
>
> - Original Message -
> From: "TEC" 
> To: "Prototype & script.aculo.us" 
> 
> Sent: Tuesday, June 23, 2009 2:47 PM
> Subject: [Proto-Scripty] Two sets of expand and contract icons?
>
> > I'm working on a website where there are two styles of divs that need
> > to expand and collapse. I have made custom icons for expand and
> > contract for each set of divs.
>
> > But from looking at the script, it appears you can only use one set of
> > icons. Is there away edit decorators.js so two sets of icons can be
> > used?
>
> > I have started to play around and modify the file my self but I keep
> > breaking the expand and contract and can't seem to get it to work
> > right and was hoping someone here could point me in the right
> > direction. The vars for the icons are as following.
>
> > var expImg = "images/expand.jpg";
> > var conImg = "images/contract.jpg";
> > var expImg2 = "images/location_down.jpg";
> > var conImg2 = "images/location_up.jpg";
>
> > Thank you



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: php in files

2009-06-23 Thread Richard Quadling

2009/6/23 Robaj :
>
> I know this isn't strictly speaking a Prototype issue, but this is the
> only group I am in and a few topics do skirt around the edges of your
> main topic.
>
> If I have a file -
> home.php
>  echo "A very interesting home page";
> ?>
>
> Then the file is returned to go into  with a
> plain fread() into a variable which is 'echo'd back to the client.
>
> 'include'ing this file is fine, but then it passes through php at the
> same time as everything else.
>
> But any such file loaded as the action of an Ajax call is not fine. It
> doesn't get passed via php, or at least I don't think it does -
> because in 'mainbody' I get part of it such as
>
> Interesting"; ?>
>
> Confusing because if it were being passed through php I would expect
> 'Interesting'. but if it were not, then I would expect the whole file
> in plain text.
>
> I knew when I did this with fread I was probably heading for trouble,
> but which is happening,
>   partial php parseing,
>   no php parseing or
>   . ?
>
>
>
> >
>

If you use fread(), you are reading a file. Any file. Nothing magic.
No processing.
If you use include()/require()/include_once()/require_once(), then PHP
will process that file if it contains a valid opening tag (http://docs.php.net/mailing-lists.php)

Regards,

Richard.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Two sets of expand and contract icons?

2009-06-23 Thread TEC

Thanks for the reply.

I thoguht I was already using scriptaculous, but I could be wrong.

The div structure is as following:


header


  



  


and the page includes:







The collapse='true' comes from a modification I made to decorators.js
from a tutorial that shows how to start a div in the collapsed state.
There are also a few style sheet entries that tell the icons where to
appear.


Is there an easier way of creating collapsible divs with two sets of
icons and some divs starting in the collapsed state then I am
currently using?

Thanks







On Jun 23, 9:57 am, "Alex McAuley" 
wrote:
> you can do this easily with proto/scriptaculous or vanilla javascript, i
> would recommend staying away from pre-made scripts for this easy task as it
> will inhibit what you can do and what you learn from writing
> applications
>
> Alex
>
> - Original Message -
> From: "TEC" 
> To: "Prototype & script.aculo.us" 
> Sent: Tuesday, June 23, 2009 2:47 PM
> Subject: [Proto-Scripty] Two sets of expand and contract icons?
>
> > I'm working on a website where there are two styles of divs that need
> > to expand and  collapse.  I have made custom icons for expand and
> > contract for each set of divs.
>
> > But from looking at the script, it appears you can only use one set of
> > icons.  Is there away edit decorators.js so two sets of icons can be
> > used?
>
> > I have started to play around and modify the file my self but I keep
> > breaking the expand and contract and can't seem to get it to work
> > right and was hoping someone here could point me in the right
> > direction.  The vars for the icons are as following.
>
> > var expImg = "images/expand.jpg";
> > var conImg = "images/contract.jpg";
> > var expImg2 = "images/location_down.jpg";
> > var conImg2 = "images/location_up.jpg";
>
> > Thank you
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: php in files

2009-06-23 Thread Alex McAuley

If you are opening the file with fread instead of using "include()" then it 
wont parse properly ...

from an ajax response anything echoed back from a php script will just 
return html/text/json/xml/javascript/css etc etc back to the responseText

Could you give an example fo your code and the php page and i will try to 
help you

Alex


- Original Message - 
From: "Robaj" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, June 23, 2009 3:01 PM
Subject: [Proto-Scripty] php in files


>
> I know this isn't strictly speaking a Prototype issue, but this is the
> only group I am in and a few topics do skirt around the edges of your
> main topic.
>
> If I have a file -
> home.php
>  echo "A very interesting home page";
> ?>
>
> Then the file is returned to go into  with a
> plain fread() into a variable which is 'echo'd back to the client.
>
> 'include'ing this file is fine, but then it passes through php at the
> same time as everything else.
>
> But any such file loaded as the action of an Ajax call is not fine. It
> doesn't get passed via php, or at least I don't think it does -
> because in 'mainbody' I get part of it such as
>
> Interesting"; ?>
>
> Confusing because if it were being passed through php I would expect
> 'Interesting'. but if it were not, then I would expect the whole file
> in plain text.
>
> I knew when I did this with fread I was probably heading for trouble,
> but which is happening,
>   partial php parseing,
>   no php parseing or
>   . ?
>
>
>
> >
> 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] php in files

2009-06-23 Thread Robaj

I know this isn't strictly speaking a Prototype issue, but this is the
only group I am in and a few topics do skirt around the edges of your
main topic.

If I have a file -
home.php
A very interesting home page";
?>

Then the file is returned to go into  with a
plain fread() into a variable which is 'echo'd back to the client.

'include'ing this file is fine, but then it passes through php at the
same time as everything else.

But any such file loaded as the action of an Ajax call is not fine. It
doesn't get passed via php, or at least I don't think it does -
because in 'mainbody' I get part of it such as

Interesting"; ?>

Confusing because if it were being passed through php I would expect
'Interesting'. but if it were not, then I would expect the whole file
in plain text.

I knew when I did this with fread I was probably heading for trouble,
but which is happening,
   partial php parseing,
   no php parseing or
   . ?



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Two sets of expand and contract icons?

2009-06-23 Thread Alex McAuley

you can do this easily with proto/scriptaculous or vanilla javascript, i 
would recommend staying away from pre-made scripts for this easy task as it 
will inhibit what you can do and what you learn from writing 
applications

Alex
- Original Message - 
From: "TEC" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, June 23, 2009 2:47 PM
Subject: [Proto-Scripty] Two sets of expand and contract icons?


>
> I'm working on a website where there are two styles of divs that need
> to expand and  collapse.  I have made custom icons for expand and
> contract for each set of divs.
>
> But from looking at the script, it appears you can only use one set of
> icons.  Is there away edit decorators.js so two sets of icons can be
> used?
>
> I have started to play around and modify the file my self but I keep
> breaking the expand and contract and can't seem to get it to work
> right and was hoping someone here could point me in the right
> direction.  The vars for the icons are as following.
>
> var expImg = "images/expand.jpg";
> var conImg = "images/contract.jpg";
> var expImg2 = "images/location_down.jpg";
> var conImg2 = "images/location_up.jpg";
>
> Thank you
>
>
> >
> 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Can options in a selection box be made draggable...

2009-06-23 Thread Alex McAuley

Because they are not elements or nodes they are  inside an element/ 
node ...

If you wanted them to become draggable you could hack some javascript 
together to take all the options from a select box, make them into elements 
which are draggable and sortable and a button or link to re-assemble the 
select box when finished.. this wouldnt be to hard.

HTH
Alex
- Original Message - 
From: "Avram" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, June 23, 2009 1:56 PM
Subject: [Proto-Scripty] Re: Can options in a selection box be made 
draggable...



This is a "just wondering".  Is there a short answer that will explain
why the options in a selection box can't be made draggable?

On Jun 22, 5:16 pm, "Alex McAuley" 
wrote:
> No !
>
>
>
> - Original Message -
> From: "Avram" 
> To: "Prototype & script.aculo.us" 
> 
> Sent: Monday, June 22, 2009 4:30 PM
> Subject: [Proto-Scripty] Can options in a selection box be made 
> draggable...
>
> > Can the options in a selection box be made draggable (and dropable)?- 
> > Hide quoted text -
>
> - Show quoted text -



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Two sets of expand and contract icons?

2009-06-23 Thread TEC

I'm working on a website where there are two styles of divs that need
to expand and  collapse.  I have made custom icons for expand and
contract for each set of divs.

But from looking at the script, it appears you can only use one set of
icons.  Is there away edit decorators.js so two sets of icons can be
used?

I have started to play around and modify the file my self but I keep
breaking the expand and contract and can't seem to get it to work
right and was hoping someone here could point me in the right
direction.  The vars for the icons are as following.

var expImg = "images/expand.jpg";
var conImg = "images/contract.jpg";
var expImg2 = "images/location_down.jpg";
var conImg2 = "images/location_up.jpg";

Thank you


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Can options in a selection box be made draggable...

2009-06-23 Thread Avram

This is a "just wondering".  Is there a short answer that will explain
why the options in a selection box can't be made draggable?

On Jun 22, 5:16 pm, "Alex McAuley" 
wrote:
> No !
>
>
>
> - Original Message -
> From: "Avram" 
> To: "Prototype & script.aculo.us" 
> Sent: Monday, June 22, 2009 4:30 PM
> Subject: [Proto-Scripty] Can options in a selection box be made draggable...
>
> > Can the options in a selection box be made draggable (and dropable)?- Hide 
> > quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Last Weekends Adventure

2009-06-23 Thread pedz

On Jun 23, 4:31 am, "T.J. Crowder"  wrote:
> I did an exercise a while back (here[1]) comparing DOM methods vs.
> Prototype's wrappers for DOM methods vs. concatenating a string and
> setting innerHTML.  The last method, innerHTML, wins on every browser
> I tried, hands down, usually by at least one order of magnitude.

Holy @#$%!!!  I played with your page in Firefox, set rows to 1800.
The DOM says it took 16 seconds but really it took longer because
there was another 15 seconds of spinning beach ball before I saw the
page.  The html took 300ms and displayed instantly.

> If you're doing 1,800 rows, even with innerHTML, I really like
> emitch's suggestion of breaking it into chunks and periodically giving
> the browser a chance to display what's been done so far.  You can use
> setTimeout, or Prototype's convenient wrappers for it Function#defer
> [3] and Function#delay[4].

Yes, I had considered that before although I didn't know which
interfaces to use.  Somehow I need to tell the browser to "relax"...
no one is going to view 1800 rows immediately.  I didn't know if doing
it via a timer would achieve that effect or not.  And, I don't know
if / how to do that with Spry.

But, given what I just learned, I think I want to ease away from
Spry.  One problem is it has not changed in 18+ months.  There is a
lot of talk asking "Is it dead?".  Adobe says "No" but I just don't
see how they can keep up with projects like prototype and JQuery that
are open development.  And, more importantly, it is hugh and
complicated and its not "mine".  I feel like prototype is so small and
relatively simple, I can "own" the code (i.e. really understand it and
work with it instead of on top of or in spite of it).

I hope others reply too.  But, thank you very much to T.J. and emitch.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Drag&drop with absolute position

2009-06-23 Thread Fagnain

Hi,

I tried to create 2 sortables in a page with drag & drop from one to
another. There is no problem when I make a test outside of my site.
But when I include the code in the page I want it to be - into one of
the 3 div I have with the CSS property position set to "absolute" - I
can't do my drag and drop. I realized that this drag & drop works fine
when I put a new div without setting the position and drag over.

So my question is : Can we set drag&drop on elements within a div with
an absolute position (and how can we do that of course) ?

Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Safari problem with Ajax.Request and simultaneous upload

2009-06-23 Thread T.J. Crowder

Hi Christian,

Ah, hadn't seen your follow-up before posting my first reply.

How are you doing the upload?  Hidden iframe submission or something?

-- T.J.

On Jun 23, 10:02 am, Christian  wrote:
> Hi Everybody,
>
> I would like to add one more thing:
> If I make the request 'asynchronous: false' the progress querying does
> work,
> however, then the file upload is stalled (with true, only the upload
> works).
>
> Thanks,
>  Christian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Is there a way to "view" event observers?

2009-06-23 Thread T.J. Crowder

Hi,

The actual handler is referenced from the wrapper via a closure, so
the handler isn't a property on the wrapper that you could access
after-the-fact.

I think in your situation the most straight-forward approach would be
to add some debug logging code to the createWrapper function (in
Prototype 1.6.0.3, line 3,955) or the _createResponder function (in
Prototype 1.6.1 RC3, line 4,475).

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jun 23, 12:46 am, emitch  wrote:
> I have a large unfamiliar site I have started working on that uses
> prototype and there are a number of tucked away bits of code that add
> event handlers to the document dom:loaded event (as well as other
> element events).  Is there a way for me to see, alert, or log etc. all
> of the actual functions/methods that are queued up to run when the
> event fires?  This is strictly for debugging and performance tuning,
> as I currently have no idea how many handlers are being set or what
> they are doing.
>
> I tried poking around in the Event.cache and found some reference to
> function calls, but they all appear to be a wrapper function of
> prototype and I couldn't find a way to see the actual functions that
> are being called when an event fires.
>
> Thanks in advance for any tips or help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Safari problem with Ajax.Request and simultaneous upload

2009-06-23 Thread T.J. Crowder

Hi Christian,

Most browsers, and most servers, place a limit on the number of
simultaneous connections between the same endpoints, and typically
that limit is two simultaneous connections.  I don't immediately have
a reference for that, but if you search on "simultaneous HTTP
connection limit" or "concurrent HTTP connection limit" or some such,
you'll find info on it.  Note, again, that this is done at the browser
level and also, sometimes, at the server level, and it varies by
vendor (and configuration).

What you're describing suggests that one end or the other is putting a
one connection limit on things rather that two.  Frankly, I would have
thought it was at the server side (some sort of session thing, where
only one connection can be using a given session at a time), but if IE
and FF work but Safari doesn't, as you say that suggests it's Safari.
I'm surprised by that.  Are you sure there isn't a third open
connection somewhere?

Or, of course, it could be something completely different related to
how Safari handles uploads. :-)

FWIW,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jun 23, 8:47 am, Christian  wrote:
> Hi Everybody,
>
> I have a problem with a simple Ajax.Request on Safari. Namely, I have
> a HTML form for uploading a file and want to query the progess (for a
> progress bar) from the server. For this, I call a Javascript function
> in the form's onSubmit handler, which periodically performs an Ajax
> Request (simple get), which is also initialized and loaded, but does
> not complete (neither success nor failure) until the upload finishes.
> My guess is, that Safari does not like to handle two requests (the
> upload and the progress request) at the same time. Could this be true?
>
> No problems with IE or FF on this.
>
> Thanks.
> Christian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Last Weekends Adventure

2009-06-23 Thread T.J. Crowder

Hi,

I don't know the Spry framework at all, but if it's building the table
rows by creating elements through the DOM API (document.createElement,
HTMLElement#appendChild, etc.) or Prototype's wrappers for those [new
Element(...)], that may be part of the problem.

It may be somewhat counter-intuitive, but creating a TR element,
adding a bunch of TD elements to it, and then appending that to a
TBODY, all using the DOM API, is much, much slower on most browsers
than building a string of tags in memory and then adding them via the
non-standard (but common) innerHTML property.  I figure this is
because parsing HTML strings and turning them into displayed elements
is one of the most speed-critical things that browsers do, and so
their native handling of it is extremely optimized, working directly
with their internals.

I did an exercise a while back (here[1]) comparing DOM methods vs.
Prototype's wrappers for DOM methods vs. concatenating a string and
setting innerHTML.  The last method, innerHTML, wins on every browser
I tried, hands down, usually by at least one order of magnitude.
(Prototype's wrappers aren't very costly, but going through the DOM
methods is, and so they inherit that cost.)  The smallest discrepancy,
IIRC, is on Chrome ("only" about four times faster rathe than 10x or
100x faster) -- but then, Chrome is freakishly fast at nearly
everything. :-)

So when I need to do this sort of thing, I build up a string (perhaps
using Prototype's template stuff) and then apply it via Prototype's
Element#update method[2] (which uses innerHTML under-the-covers but
also handles some edge cases for you).

If you're doing 1,800 rows, even with innerHTML, I really like
emitch's suggestion of breaking it into chunks and periodically giving
the browser a chance to display what's been done so far.  You can use
setTimeout, or Prototype's convenient wrappers for it Function#defer
[3] and Function#delay[4].

[1] http://pastie.org/521342
[2] http://prototypejs.org/api/element/update
[3] http://prototypejs.org/api/function/defer
[4] http://prototypejs.org/api/function/delay

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jun 23, 4:41 am, pedz  wrote:
> I spent last weekend adding Spry to one of my web sites.  I'm using
> Ruby On Rails and prototype with perhaps a bit of script.aculo.us in
> this web site.
>
> What attracted me to Spry is the region and repeat features.  Lets us
> a table as an example.  The basic idea is the page that is sent out
> has only the header and a single row.  You have to put a div around
> the table to define the region.  And the data row in the table has a
> "repeat" attribute in it.  Somewhere you hook a data souce up to the
> region.  In my case, I went back to my Rails server with a json
> request which sprewed out the selected items in a javascript array,
> each element being an item.
>
> The initial row has macros like {name} that get expanded to fields in
> the items.  In my particular case, while a row only has 8 elements
> across, there are a lot of things in each td like hidden drop down
> lists, links, etc.  The work to create a json row is small compared to
> the work to create the equivalent html row.  What I see attractive
> with Spry is it moves the work of creating the html to the browser and
> offloads the server.  There is just no reason for the server to be
> doing that work.
>
> My belief is that ultimately, moving the creation of the html to the
> browser is the way of the future.  The server serves data.  The view
> processing will eventually be done in the browser.  There is no need
> for the server to do hard labor for the view processing.
>
> But I found Spry to be less than stellar.  The main biggest issue is
> when I have a page with 1800 rows, it takes my Firefox about a half a
> minute of dead time to create the page and render it -- during that
> time, my whole laptop is dead pretty much with the dreaded spinning
> beachball.  This half minute is divided into two parts I'm sure.  Part
> of the time is Spry running creating the 1800 rows.  I'll use the term
> "fill out" to refer to that process.  Then there is the time for
> Firefox to actually render the page.
>
> I also found the package to not be very flexible and configurable.  It
> has a sort feature but it has far fewer features than the tablesort.js
> file found on the net.
>
> So, it put me back to "can I do this myself" mode.
>
> A small side trace: I have seen the Rails cast where Ryan creates an
> "endless page".  My issue with that approach is that instead of one
> query, he makes N queries -- one for each page.  That seems like it
> would add load to the server while I'm trying to take load away from
> the server.
>
> It seems like I could leverage prototypes template feature for most of
> the work.  The main thing I would do different is make one request
> (like Spry) but I would only render the first page or two of rows.
> Then as

[Proto-Scripty] Re: Safari problem with Ajax.Request and simultaneous upload

2009-06-23 Thread Christian

Hi Everybody,

I would like to add one more thing:
If I make the request 'asynchronous: false' the progress querying does
work,
however, then the file upload is stalled (with true, only the upload
works).

Thanks,
 Christian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Is there a way to "view" event observers?

2009-06-23 Thread emitch

I have a large unfamiliar site I have started working on that uses
prototype and there are a number of tucked away bits of code that add
event handlers to the document dom:loaded event (as well as other
element events).  Is there a way for me to see, alert, or log etc. all
of the actual functions/methods that are queued up to run when the
event fires?  This is strictly for debugging and performance tuning,
as I currently have no idea how many handlers are being set or what
they are doing.

I tried poking around in the Event.cache and found some reference to
function calls, but they all appear to be a wrapper function of
prototype and I couldn't find a way to see the actual functions that
are being called when an event fires.

Thanks in advance for any tips or help!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Safari problem with Ajax.Request and simultaneous upload

2009-06-23 Thread Christian

Hi Everybody,

I have a problem with a simple Ajax.Request on Safari. Namely, I have
a HTML form for uploading a file and want to query the progess (for a
progress bar) from the server. For this, I call a Javascript function
in the form's onSubmit handler, which periodically performs an Ajax
Request (simple get), which is also initialized and loaded, but does
not complete (neither success nor failure) until the upload finishes.
My guess is, that Safari does not like to handle two requests (the
upload and the progress request) at the same time. Could this be true?

No problems with IE or FF on this.

Thanks.
Christian

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Last Weekends Adventure

2009-06-23 Thread emitch

This may be an overly simplistic first step suggestion, but I've been
in a similar situation where I needed to "render" thousands of table
rows in the browser via a JSON response from the server.  I found that
by calling a render row function/method (somewhat asynchronously on
the client) via a setTimeout per row when processing the data gave
relief to the browser while looping over the data, so that it wasn't
just hanging there waiting to complete the whole table/loop.   That
looping and such can be split into groups for pagination etc. The page
was built row by row and the browser was responsive during the load.
I'm not familiar with Spry or your specific situation, but maybe this
could help if you haven't already tried it.  Hopefully others will
have some suggestions as well.  I'm curious about other solutions as
well.



On Jun 22, 10:41 pm, pedz  wrote:
> I spent last weekend adding Spry to one of my web sites.  I'm using
> Ruby On Rails and prototype with perhaps a bit of script.aculo.us in
> this web site.
>
> What attracted me to Spry is the region and repeat features.  Lets us
> a table as an example.  The basic idea is the page that is sent out
> has only the header and a single row.  You have to put a div around
> the table to define the region.  And the data row in the table has a
> "repeat" attribute in it.  Somewhere you hook a data souce up to the
> region.  In my case, I went back to my Rails server with a json
> request which sprewed out the selected items in a javascript array,
> each element being an item.
>
> The initial row has macros like {name} that get expanded to fields in
> the items.  In my particular case, while a row only has 8 elements
> across, there are a lot of things in each td like hidden drop down
> lists, links, etc.  The work to create a json row is small compared to
> the work to create the equivalent html row.  What I see attractive
> with Spry is it moves the work of creating the html to the browser and
> offloads the server.  There is just no reason for the server to be
> doing that work.
>
> My belief is that ultimately, moving the creation of the html to the
> browser is the way of the future.  The server serves data.  The view
> processing will eventually be done in the browser.  There is no need
> for the server to do hard labor for the view processing.
>
> But I found Spry to be less than stellar.  The main biggest issue is
> when I have a page with 1800 rows, it takes my Firefox about a half a
> minute of dead time to create the page and render it -- during that
> time, my whole laptop is dead pretty much with the dreaded spinning
> beachball.  This half minute is divided into two parts I'm sure.  Part
> of the time is Spry running creating the 1800 rows.  I'll use the term
> "fill out" to refer to that process.  Then there is the time for
> Firefox to actually render the page.
>
> I also found the package to not be very flexible and configurable.  It
> has a sort feature but it has far fewer features than the tablesort.js
> file found on the net.
>
> So, it put me back to "can I do this myself" mode.
>
> A small side trace: I have seen the Rails cast where Ryan creates an
> "endless page".  My issue with that approach is that instead of one
> query, he makes N queries -- one for each page.  That seems like it
> would add load to the server while I'm trying to take load away from
> the server.
>
> It seems like I could leverage prototypes template feature for most of
> the work.  The main thing I would do different is make one request
> (like Spry) but I would only render the first page or two of rows.
> Then as the user scrolled,  more data would be filled out hopefully
> before the user actually got to it.
>
> There are lots of problems to all this.  How do you make the scroll
> bar act "right"?  What do you do when the user does a search within
> the page?  How do you handle a sort?  As you add rows, the width of
> the columns may grow which is not expected.  etc.
>
> But the essential concept is that all the data would be held as a
> javascript object and then the page filled out as it was needed.
>
> So, the question is, has anyone done something like this starting with
> Prototype?  I sure don't want to recreate the wheel here.  Is there
> any suggestion of other work that I can look at and build from?  Is
> there any interest by any of the readers to help out?
>
> Thank you,
> pedz

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---