(literally on my way out the door ... don't know why I looked before
shutting down.. but there's always a reason!)

On Sat, Apr 4, 2009 at 11:50 AM, mdipierro <[email protected]> wrote:

>
> Note to self. Things to be fixed:
>
> 1) the action needs knowledge on whether it is in a container.
> Solution: add a header that says so.


Not only container, but container state (e.g. minimized) --- another way to
describe this:  to be encapsulated by a container object, the action must
... probably be an object, and implement some minimal interface (set of
methods / accessors).  What is the minimal and optional (but standard,
defined) set?


>
>
> 2) the action response needs to be able to reference other containers
> in order to trigger actions  there. Right now each container is
> identified by a unique but random id and there is no way to guess it.
> Solution: have the user specify the "name" of each container.


This could be door to injections...  there may be some insight in the way
android allows applications to "register intents" which then a system finds
to see if there is an appropriate intent, and provides a connection to the
service...

This is a _little_ different, but the concept may be useful... I'll provide
links to slides (they are public on android sites) that show the flow and
how this works when I return in a week...


>
>
> 3) if a container contains a form that selft submit and then redirect
> the content to a another action that also has a form. This second form
> will not work properly. Solution 1: the programmer needs to specify
> the [SQL]FORM(_action=) but this is a problem form legacy code that
> you want to ajaxify. Solution 2: have the jDiv code automatically
> determine the action from context.


this sounds like it might be a little like registering intent, and
connecting with action which fulfills intent....  maybe...


>
>
> 4) right now every container has a link (that triggers the loading of
> the content) and a div with the content. To what extent should this be
> customizable? For example, you may want the container to have a top
> bar with additional buttons. Should this customization be a feature of
> the current container class (jDiv) or should the class be subclassed?
> This opens a big can of worms since the "frame" of the components
> needs to have some standard hooks in order to expose functions like
> "reload the content", "close it", etc. (what else?).


Right - this is the interface definition I was speaking of earlier ---
suggestion:   list everything you can think of at first, collate what kinds
of things those things are later... like writing a book, this will get
bigger first before it gets smaller (the smallest set of useful
generalizations that fit the problem space)....   I think that is natural
process, and "going with the flow" of that is a good thing ;-)


>
>
> can you think of anything else?
>
> Massimo
>
> On Apr 4, 1:02 am, mdipierro <[email protected]> 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.
> >
> > On Apr 3, 11:19 pm, ceej <[email protected]> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to