Massimo - you're awesome!  This is much better....

On Sat, Apr 4, 2009 at 1:02 AM, mdipierro <mdipie...@cs.depaul.edu> wrote:

>
> I re-posted a slightly better version.
>
> The new version work in this way:
>
> say you have an action like:
>
> def myform():
>     form=SQLFORM(...)
>     if form.accepts(....):
>          # do something
>          redirect(URL(....));
>     return dict(form=form)
>
> You can turn it into a partial by replacing "redirect" with
> "jDiv.redirect or "jDiv.flash"
>
> def myform():
>     form=SQLFORM(...)
>     if form.accepts(....):
>          # do something
>          jDiv.redirect("done!!!");
>     return dict(form=form)
>
> and create a view that DOES NOT extend the layout and does not have
> HTML and BODY tags. Something like this will do:
>
> {{=form}}
>
> Then create a parent action and in the view embed this partial
>
> {{=jDiv("click me to ajax the partial",URL(r=request,f="myform"))}}
>
> Mind that a partial can be served by another application (within the
> same web2py installation), can be a proxy to a different web-site and
> can contain an IFRAME (not recommended but possible).
>
> @Yarko. I agree that this that this is not yet a complete solution but
> more of a hack. Nevertheless it lets you take forms you have already
> created and turn them into ajax forms. It does not require any
> modification in web2py nor any third party libraries (it only requires
> the new layout and new web2py_ajax.html).
>
> I have been looking but I cannot really find a detailed decsription of
> how those other systems work.


The problem is there _is_ no description of how those other systems work;  I
looked (again - after years) at dotnetnuke code, and it is (in essence) like
webkit in vb.... so I looked at pyjs again tonight  (and will want to
experiment w/ that more fully).    The best description for what I want is
actually NO description of "how" --- but just to work with those systems
(you can get an admin to a test of at least dnn),  and catalog our own
_abstraction_ of what those systems are doing.

I imagine the jsr portlets might be the best documented (but I have not yet
looked at it).

Perhaps a few hours w/ each, using them and intuit-ing, cataloging "what
kinds of things" they are doing, then collating our notes from several....
then we will have a sort of requirements and can start design  / prototyping
from there.

I would VERY MUCH like to have the "write a little web2py app, and assign it
to the screen container"  kind of situation that my.msn  and dotnetnuke
implement....   or at least a python-ic version of the best of that
essence...

another thing that occurs to me is that with this, the app will want to know
something from the container (am I minimized? am I shown?) that is -
register more than one behavior (admin/ auth user/ minimized / small portlet
/ full)...  iPhone and Android give some UI hints to where I'm going with
this ---

An app in the environment of such a container class - could modify behavior
based on something about where it's being displayed... so mobile would be
part.... going the other way,   the "screen full of iconic chicklets"  that
android and iphone have (which then expand into apps) might also be a useful
index page for some applications on the full computer / full screen browser.

Anyway, the right structure will open up some new possibilities I expect.

Kind regards,
Yarko

>
>
> On Apr 3, 11:19 pm, ceej <cjlaz...@googlemail.com> wrote:
> > I'm really liking this idea Massimo, I'm going to be using it in a
> > project I'm about to start and grow on it :)
> >
> > Keeps using ajax very DRY.
> >
> > On Apr 3, 4:08 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> >
> > > There has been a lot of discussion in the past about forms that submit
> > > via ajax and may or may not refresh the entire page. It is also useful
> > > to be able to break html pages into "modules" or "plugins" or
> > > "components" each with its own model, view, controller in such a way
> > > that they communicate both serversize (by sharing session and
> > > database) and clientsize (one boxed component should be able for
> > > example to refresh the entire page or trigger a flash).
> >
> > > I have prototype application that does this.
> >
> > >    http://www.web2py.com/examples/static/web2py.app.events.tar
> >
> > > It uses jquery publisher subscriber mechanism. All the code is in a
> > > new web2py_ajax and a class call jDiv (similar to Rails Partial but
> > > more powerful in my opinion) which I could include in html.py
> >
> > > It allows you to write code like this:
> >
> > > def index():
> > >    return dict(partial1=jDiv('click me for text','mycallback1'),
> > >                partial2=jDiv('click me for flash','mycallback2'),
> > >                partial3=jDiv('click me to redirect','mycallback3'),
> > >                partial4=jDiv('click me for form','mycallback4'))
> >
> > > def mycallback1():
> > >    return 'hello world'
> >
> > > def mycallback2():
> > >    return jDiv.flash('this is a test') # flash on the container page
> >
> > > def mycallback3():
> > >    return jDiv.redirect('http://www.yahoo.com') # redirects entire
> > > page
> >
> > > def mycallback4():
> > >    form=FORM('your name:',
> > >              INPUT(_name='name',requires=IS_NOT_EMPTY()),
> > >              INPUT(_type='submit'))
> > >    if form.accepts(request.vars):
> > >        return jDiv.flash('hello '+form.vars.name)
> > >    return form
> >
> > > Can you figure out what it does?
> > > Not that the page is never reloaded. Only parts (partials, jDivs) of
> > > the reloaded. Each jDiv lives in its own container, has one action,
> > > can have a view, and can talk to each other.
> >
> > > This may require some more thought.
> >
> > > Comments?
> >
> > > Massimo
> >
>

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

Reply via email to