Aloha Dan:

Though iFrame may not be supported, perhaps there is something useful here... since you were surprised that the browser did not refresh, when we called for a new month in that little archive selector.

Point: as you said on the phone.. its very simple, delivery of modularized pieces that do not require a full page refresh... at least in the scenario we are already there... no client side java is required at all for this little one...of course I'm very naive about all this, but it works in a tiny little way just as you described. Since I don't know JAVA I have to resort to this, probably very unorthodox, xTalks methods...

the web page (see side bar with archive selector -- www.gurudeva.org/ taka/) has

1) SSI call to the CGI when loaded ... the call is a GET request in initial page load 2) small SSI chunk with a submit button to the same CGI which the CGI handles as a POST request.

3) doing the latter delivers back just the HTML chunk needed to update the frame... it was live... at least in Firefox, there is no refresh of the entire page, we are getting data back into just that "object" on the page (an iFrame albeit not widely supported, but the model is the same, isn't it? ...modular delivery) Could not this be scaled way up? With just xTalk? Of course, there are issues I don't see... but other may find it interesting.

The original page has this which is part of the side bar (no tables in this world, thanks to your book!)


<ul>
                <li>
<iframe name="archiveIndex" border="0" width="130" height="140" src="/cgi-bin/buildTakaIndex.cgi">
                    </iframe>
                    <br />
                </li>
                <li>
You may select another month and year below, then click "Show"
                    <br />
                    <br />
<!--#include virtual="/taka/ssi/archive-selector.html" --> ## which pulls in this:

<form method="post" action="/cgi-bin/ buildTakaIndex.cgi" target="archiveIndex">
                            <select name="month">
<option selected="SELECTED" value="">Month</option> <option value="January">January</ option><option value="February">February</option><option value="March">March</option><option value="April">April</ option><option value="May">May</option><option value="June">June</ option><option value="July">July</option><option value="August">August</option><option value="September">September</ option><option value="October">October</option><option value="November">November</option><option value="December">December</ option>
                            </select>
                            <select name="year">
<option selected="SELECTED" value="">Year</option> <option value="2005">2005</ option><option value="2004">2004</option><option value="2003">2003</ option><option value="2002">2002</option><option value="2001">2001</ option><option value="2000">2000</option><option value="1999">1999</ option><option value="1998">1998</option>
                            </select>
                            <input type=submit value="Show">
                        </form>

                </li>
            </ul>

in inial load, it calls the CGI immediately (see below) as part of the page's initial GET request the CGI is:

#!/usr/local/bin/revolution
on startup
global tYear, tMonth

put $HTTP_REFERER into tCallingPage

if $REQUEST_METHOD is "POST" then

## user has made selections from the option pull downs and submitted
## we take that build a new month chunk and send it back
## note, the browser does not refresh the whole page.

put "" into PostIn
     repeat until length(PostIn) >= $CONTENT_LENGTH
          read from stdin until ""
              put it after PostIn
       end repeat
     put  urlDecode (PostIn)  into tDataIn

# create small array:

split tDataIn by "&" and "="

#extract elements

put tDataIn["year"] into tYear
put tDataIn["month"] into tMonth

else
## this is a GET request from the page on first load
## just  parse today's date:
## and insert the current month's links

put word 1 of item 2 of the long date into tMonth
put item 3 of the long date into tYear

#we have to wipe leading space
delete char 1 of tYear

end if

#  create a path now to the past
# and get directory list of days for the month

put "../html/taka/past/" & tYear& "/" &tMonth &"/" into tArchiveMonth
set the defaultFolder to tArchiveMonth
put the folders into tMonthList
sort tMonthList


#  We have our list of days now just have to
#  build html response
#
#  #put format ("<body onload=\"resizeTo(200,200)\"") into tIndex
#  # this "onload" directive re-sizes the main window
#  # meanwhile the iFrame remains at 1 pixel in width
# # and output from this CGI is not visible
#  # so I took it out and put simply:

#  Check to see if this request is coming from a past TAKA page
## if so, then pull in style sheet match the side links
## note: this will break on a future design change...

if tCallingPage contains "/past/" then
put format ("<html><body class=\"iframe\">") after tIndex
put format ("<style type=\"text/css\" title=\"currentStyle\"> @import \"/taka/css/taka_04_10_15.css\"; </style>") after tIndex


else

put format ("<html><body style=\"font: 14px/17px;\" >") after tIndex
end if

put cr & "<h4>" & tMonth & ", " & tYear & "</h4>" after tIndex
# create the links chunk

repeat for each line x in tMonthList
  if x contains tMonth then #skips dot files
  put tagIt(x,tYear,tMonth) & "&nbsp;" after tIndex
  end if
end repeat
put cr & "</body></html>" after tIndex

## We're done, just send it to stdout,  minimal http headers first:

put "Content-Type: text/html" & cr
put "Content-Length:" && the length of tIndex & cr & cr
put tIndex

end startUp

function tagIt tDay,tYear,tMonth
  set the itemdel to "_"
put format (cr & "<a href=\"/taka/past/")& tYear & "/" &tMonth &"/" & tDay & format ("/\" & target=\"_top\">") & item 2 of tDay & "</a>" into tDayLink
  return tDayLink
end tagit


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to