Andy,
I have tried to get this to work:
--- BEGIN OF FILE ---
(in-package #:openair)
(defvar *web-app*) (defparameter *server* nil)
(defun ht-monitor-page (path resource-class) (lambda (request) (start-session) (let ((root (or (session-value 'root) (mk-web-app (:prefix path :request (c-in request)) (make-instance resource-class :fm-parent *parent*))))) (setf *web-app* root) (setf (session-value 'root) root) (setf (request root) request) (handler root))))
(defmd ht-monitor (page) name ip-address term
:title ":: HUNCHENTOOT MONITOR ::" :style "/css/ht-monitor.css"
:name (c? (server-name *server*)) :ip-address (c_? (server-address *server*)) :term (c-in "")
:kids (c? (the-kids (mk-div () (mk-text (c? (conc$ "Name: " (name (u^ ht-monitor))))) (mk-div () (mk-text (c? (conc$ "IP Address: " (ip-address (u^ ht- monitor))))))) (mk-form (:action "get") (mk-label (:for "i") (mk-text "Input: ")) (mk-input (:name "i" :id "i" :-type "text" :value (c? (reverse (term (u^ ht- monitor))))))) (mk-div () (mk-text (c? (conc$ "Reversed: " (reverse (term (u^ ht-monitor))))))) )))
(defun start-ht-monitor () (cells-reset) (reset-sessions) (setf *catch-errors-p* nil) (setf *print-circle* nil) (setf *dispatch-table* (list (ht-monitor-page "/ht-monitor" 'ht-monitor) (create-static-file-dispatcher-and-handler "/index.html" "/Users/frgo/projects/gt/app/ht-monitor/index.html") (create-folder-dispatcher-and-handler "/css/" "/Users/frgo/projects/gt/app/ht-monitor/css/") (create-folder-dispatcher-and-handler "/js/" "/opt/common-lisp/openair/js/"))) (when *server* (hunchentoot:stop-server *server*)) (setq *server* (hunchentoot:start-server :name "frgo's HT MONITOR" :port 4242 :dispatch-table *dispatch-table* )))
(export! start-ht-monitor)
--- END OF FILE ---
Symptoms:
1. No updates received from Web browser 2. When trying to update a slot on a page model I do not get any update of the Web page ...
Is the git repo somehow in an "intermediate state" ? - I seem to remember you saying so in some email. Appreciate your feedback.
Best, Frank
On Fri, Apr 11, 2008 at 2:51 PM, Frank Goenninger frgo@mac.com wrote:
Andy,
Symptoms:
- No updates received from Web browser
- When trying to update a slot on a page model I do not get any update of
the Web page ...
Is the git repo somehow in an "intermediate state" ? - I seem to remember you saying so in some email. Appreciate your feedback.
I thought that what I pushed last night would have worked but Kenny seems to be having problems too. What's your platform? Do you have firebug running? Maybe there's some javascript errors that could give us a clue.
I'll load your example up and take a closer look when I get home this evening.
In the meantime, can you post the output of "git show"
Cheers, Andy
Andy,
thanks for quick feedback. Details you requested see below.
Am 11.04.2008 um 17:11 schrieb Andy Chambers:
On Fri, Apr 11, 2008 at 2:51 PM, Frank Goenninger frgo@mac.com wrote:
Andy,
Symptoms:
- No updates received from Web browser
- When trying to update a slot on a page model I do not get any
update of the Web page ...
Is the git repo somehow in an "intermediate state" ? - I seem to remember you saying so in some email. Appreciate your feedback.
I thought that what I pushed last night would have worked but Kenny seems to be having problems too. What's your platform?
Mac OS X 10.5.2
Do you have firebug running? Maybe there's some javascript errors that could give us a clue.
Firebug is running. Does not show javascript errors.
I'll load your example up and take a closer look when I get home this evening.
Thanks!
In the meantime, can you post the output of "git show"
Sure:
1.) Did a git fetch again to make sure I have latest sources. 2.) Git show produces:
commit 4a0795cb335d226c51c61e82edc342d01e26e14d Author: Andy Chambers <Andy Chambers achambers.home@gmail.com> Date: Tue Apr 8 22:59:09 2008 +0100
added high-level macro to help making checkboxes
diff --git a/example.lisp b/example.lisp index 2f6b2d9..030f7d3 100755 --- a/example.lisp +++ b/example.lisp @@ -57,17 +57,28 @@ See the Lisp Lesser GNU Public License for more details. (progn (declaim (optimize (debug 3) (speed 0) (safety 1) (compilation- speed 0))))
+(defmd web-checkbox (page) + (status (c? (param? "STATUS"))) + (kids (c? (the-kids + (mk-div () + (mk-form (:action "get") + (mk-checkbox "Status: " status) + (mk-div () + (mk-text (status (u^ web-checkbox)))))))))) + (defmd web-apropos (page) (term (c? (param? "term"))) (pkg (c? (param? "pkg"))) - (exports-onlyp (c? (param? "exports-onlyp"))) + (exported-only-p (c? (let ((rslt (param? "EXPORTED-ONLY-P"))) + (trc "exported" rslt) + rslt))) (filter (c? (param? "filter"))) (result (c? (progn - (trc "calculating result" (^term) (^pkg) (^exports- onlyp) (^filter)) + (trc "calculating result" (^term) (^pkg) (^exported- only-p) (^filter) ) (bwhen (search (^term)) (apropos-list search (^pkg) - (^exports-onlyp)))))) + (^exported-only-p)))))) (title "Lisp Apropos") (style "style.css") (kids (c? (the-kids @@ -79,6 +90,10 @@ See the Lisp Lesser GNU Public License for more details. :-type "text" :value (c? (term (u^ web-apropos)))))
+ (mk-checkbox "Exported: " exported-only-p) + + (mk-text (c? (exported-only-p (u^ web-apropos)))) + (mk-div (:id :result) (mk-ul () (list @@ -244,6 +259,7 @@ See the Lisp Lesser GNU Public License for more details. (setf *catch-errors-p* nil *dispatch-table* (list + (test-page "/check-test" 'web-checkbox) (test-page "/apropos" 'web-apropos) (create-folder-dispatcher-and-handler "/js/" "/home/andy/asdf/ hunchncells/js/")))) diff --git a/forms.lisp b/forms.lisp index 4f64383..5b73012 100755 --- a/forms.lisp +++ b/forms.lisp @@ -21,6 +21,8 @@ See the Lisp Lesser GNU Public License for more details. (progn (declaim (optimize (debug 3) (speed 0) (safety 1) (compilation- speed 0))))
+;;; Vanilla HTML + (defhtml form () () (:attrs form @@ -63,3 +65,18 @@ See the Lisp Lesser GNU Public License for more details. (:attrs button :name :value (:-type :type) :disabled :tabindex :accesskey :onfocus :onblur)) + + +;;; Higher Level Widgets + +(defmacro mk-checkbox (label attribute &key top-args label-args input- args) + `(mk-div (,@top-args) + (mk-label (,@label-args :for ,(symbol-name attribute)) + ,label) + (mk-input (,@input-args + :name ,(symbol-name attribute) :id ,(symbol-name attribute) + :-type "checkbox" + :checked (c? (,attribute (u^ page))) ; parameterize? + :value (c? (if (,attribute (u^ page)) + "on" + "off")))))) diff --git a/js/openair.js b/js/openair.js index d753879..c2e5c7f 100644 --- a/js/openair.js +++ b/js/openair.js @@ -6,7 +6,16 @@ function recv (data) { } }
-function send (obj, e) { +function send_checkbox (obj, e) { + var request = {}; + var msg = obj.checked ? "on": "off"; + request[obj.id] = msg; + $.get(location.href + "/" + obj.id, + request, + recv); +} + +function send_text (obj, e) { var request = {}; switch(e.type) { case "keyup": @@ -29,8 +38,11 @@ $(document).ready(function(){ // $(":input").keyup(function(e) { // send(this, e); // }); - $(":input").change(function(e) { - send(this, e); + $(":input[type='text'").change(function(e) { + send_text(this, e); + }); + $(":input[type='checkbox']").change(function(e) { + send_checkbox(this, e); }); });
Oh - now I see the potential problem: These "//" ... I will test...
Best, Frank
Cheers, Andy _______________________________________________ cells-devel site list cells-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cells-devel
Found something:
Am 11.04.2008 um 17:53 schrieb Frank Goenninger:
+function send_text (obj, e) { var request = {}; switch(e.type) { case "keyup": @@ -29,8 +38,11 @@ $(document).ready(function(){ // $(":input").keyup(function(e) { // send(this, e); // });
- $(":input").change(function(e) {
send(this, e);
- $(":input[type='text'").change(function(e) {
send_text(this, e);
});
- $(":input[type='checkbox']").change(function(e) {
});send_checkbox(this, e);
});
Oh - now I see the potential problem: These "//" ... I will test...
And right there it is:
$(document).ready(function(){ // $(":input").keyup(function(e) { // send(this, e); // }); $(":input[type='text']").keyup(function(e) { send_text(this, e); }); $(":input[type='checkbox']").change(function(e) { send_checkbox(this, e); }); });
Two things:
1.) I had to change the line
$(":input[type='text']").keyup(function(e) {
the "]" was missing after 'text' ...
2.) I had to change the event type to "keyup" for the text input in order to really get every key stroke sent over to the server. That's the behaviour I am used to from using Celtk and Cello...
Now I am back in the game again.
Cheers, Frank
Frank Goenninger wrote:
Found something:
Am 11.04.2008 um 17:53 schrieb Frank Goenninger:
+function send_text (obj, e) { var request = {}; switch(e.type) { case "keyup": @@ -29,8 +38,11 @@ $(document).ready(function(){ // $(":input").keyup(function(e) { // send(this, e); // });
- $(":input").change(function(e) {
send(this, e);
- $(":input[type='text'").change(function(e) {
send_text(this, e);
});
- $(":input[type='checkbox']").change(function(e) {
});send_checkbox(this, e);
});
Oh - now I see the potential problem: These "//" ... I will test...
And right there it is:
Woo-hoo!
$(document).ready(function(){ // $(":input").keyup(function(e) { // send(this, e); // }); $(":input[type='text']").keyup(function(e) { send_text(this, e); }); $(":input[type='checkbox']").change(function(e) { send_checkbox(this, e); }); });
Two things:
1.) I had to change the line
$(":input[type='text']").keyup(function(e) {
the "]" was missing after 'text' ...
2.) I had to change the event type to "keyup" for the text input in order to really get every key stroke sent over to the server. That's the behaviour I am used to from using Celtk and Cello...
Oh, cool, I'll try that, makes for great demo! But the behavior you observed might derive from the spec I gave Andy, shown atop the example.lisp file. The salient part:
";; Oh, and the input field is also a pop-up of the query history (which ;; would not make sense if each keystroke was treated as a new query."
ie, it would be a pretty big pop-up if each keystroke was a new query. (I am just guessing at Franz's rationale.)
kt
Am 11.04.2008 um 18:28 schrieb Ken Tilton:
Oh, cool, I'll try that, makes for great demo! But the behavior you observed might derive from the spec I gave Andy, shown atop the example.lisp file. The salient part:
";; Oh, and the input field is also a pop-up of the query history (which ;; would not make sense if each keystroke was treated as a new query."
ie, it would be a pretty big pop-up if each keystroke was a new query. (I am just guessing at Franz's rationale.)
Which brings up a very good point:
Do we try to mimic Celtk and Cello really just as a RIA ? Or not? If not then what actually is the goal beyond having fun with some new technology - which is good in itself, no question about that...
Just that I know what we will aim at ...
Cheers -
Frank
Frank Goenninger wrote:
Am 11.04.2008 um 18:28 schrieb Ken Tilton:
Oh, cool, I'll try that, makes for great demo! But the behavior you observed might derive from the spec I gave Andy, shown atop the example.lisp file. The salient part:
";; Oh, and the input field is also a pop-up of the query history (which ;; would not make sense if each keystroke was treated as a new query."
ie, it would be a pretty big pop-up if each keystroke was a new query. (I am just guessing at Franz's rationale.)
Which brings up a very good point:
Do we try to mimic Celtk and Cello really just as a RIA ? Or not? If not then what actually is the goal beyond having fun with some new technology - which is good in itself, no question about that...
Just that I know what we will aim at ...
I am not clear on the choices/distinctions you see, and I do not mean that in the funny way academics use it to say "Nonsense!", I mean that I really am not sure about what you mean.
Let me just clarify and expand on what I said to move the ball along -- I thought of another reason keystroke-by-keystroke on the apropos field would not work after I made your change and was about to type "m" and (had it worked and with the exported-only option off) was braced to see, what? a third of the symbols in my Lisp environment? :) Actually, we could do that if we did a scrolling list of, oh, twenty items and was lazy about generating the html, a definite future direction.
But! I was just talking about this one design decision, not saying every text input field should work this way. Clearly we want a field by field choice. We can go OO and create a class of input field (er, can we?) and have an eager field or a lazier field, or maybe we can add an attribute such as eager or lazy and extend openair.js to look for that, or maybe there is some even more powerful way that would not require forver extending openair.js, such as optionally providing on-<your event-here> handlers for any event for any widget. I am thinking coding rules on the Lisp side that get Parenscripted into JS and sent over witht he widget.
Note that I am making this all up, I do not know what is possible, but in answer to the general question I am hearing,...
... no. No compromises in functionality. Whatever Ajax/browsers can handle we should be able to provide to the web author with the kind of fine-grained control I hand-waved about above.
cheers, kenny
Frank Goenninger wrote:
Found something:
Am 11.04.2008 um 17:53 schrieb Frank Goenninger:
+function send_text (obj, e) { var request = {}; switch(e.type) { case "keyup": @@ -29,8 +38,11 @@ $(document).ready(function(){ // $(":input").keyup(function(e) { // send(this, e); // });
- $(":input").change(function(e) {
send(this, e);
- $(":input[type='text'").change(function(e) {
send_text(this, e);
});
- $(":input[type='checkbox']").change(function(e) {
});send_checkbox(this, e);
});
Oh - now I see the potential problem: These "//" ... I will test...
And right there it is:
$(document).ready(function(){ // $(":input").keyup(function(e) { // send(this, e); // }); $(":input[type='text']").keyup(function(e) { send_text(this, e); }); $(":input[type='checkbox']").change(function(e) { send_checkbox(this, e); }); });
Two things:
1.) I had to change the line
$(":input[type='text']").keyup(function(e) {
the "]" was missing after 'text' ...
Hunh, did you have the latest openair.js? Mine looks OK in that regard.
2.) I had to change the event type to "keyup" for the text input in order to really get every key stroke sent over to the server.
I tried with no luck:
$(document).ready(function(){ // $(":input").keyup(function(e) { // send(this, e); // }); $(":input[type='text']").keyup(function(e) { // kt: keyup was change send_text(this, e); }); $(":input[type='checkbox']").change(function(e) { send_checkbox(this, e); }); $("select").change(function(e) { send_select(this,e); }); });
I did a reload from the browser as well, I am just not sure that means the browser thinks to get a new openair.js as well. Or did I miss something else? I will be bouncing things over here trying to get my browser's attention....
kt
Frank Goenninger wrote:
Andy,
thanks for quick feedback. Details you requested see below.
Am 11.04.2008 um 17:11 schrieb Andy Chambers:
On Fri, Apr 11, 2008 at 2:51 PM, Frank Goenninger frgo@mac.com wrote:
Andy,
Symptoms:
- No updates received from Web browser
- When trying to update a slot on a page model I do not get any
update of the Web page ...
Is the git repo somehow in an "intermediate state" ? - I seem to remember you saying so in some email. Appreciate your feedback.
I thought that what I pushed last night would have worked but Kenny seems to be having problems too.
[Typo fixed and Frank CCed]
"I had to /move/ the js directory to the toplevel of my drive and rename the jsquery.what.ever.js as you suggested because of the symlink issue."
FG probably does not have the symlink issue. How about a toplevel /js?
kt
ps. damn, andy, you have to hire a support team already. :) kt
Am 11.04.2008 um 18:19 schrieb Ken Tilton:
"I had to /move/ the js directory to the toplevel of my drive and rename the jsquery.what.ever.js as you suggested because of the symlink issue."
FG probably does not have the symlink issue. How about a toplevel /js?
No, I don't have the issue (I am using a mature OS here ;-). Please don't introduce a toplevel /js - this "pollutes" the directory structure... I am installing apps under "/opt/app-name/" - so OpenAIR lives in /opt/common-lisp/openair and the JS directory is /opt/common- lisp/openair/js - works really well.
Best, Frank
Frank Goenninger wrote:
Am 11.04.2008 um 18:19 schrieb Ken Tilton:
"I had to /move/ the js directory to the toplevel of my drive and rename the jsquery.what.ever.js as you suggested because of the symlink issue."
FG probably does not have the symlink issue. How about a toplevel /js?
No, I don't have the issue (I am using a mature OS here ;-). Please don't introduce a toplevel /js - this "pollutes" the directory structure... I am installing apps under "/opt/app-name/" - so OpenAIR lives in /opt/common-lisp/openair and the JS directory is /opt/common- lisp/openair/js - works really well.
Hey, I am in monkey-mode over here, I saw the browser asking for "/js/openair.js" and I made it happen, I am just dying to see (+ cells ajax). Left for another day was whether I could have changed one of a dozen parameters incomprehensible to my monkey mind in order to get the browser to ask for a different file.
How /are/ your browser/js skills, btw? I will start CCing you on questions that arise in that area in case you are on-line sooner than Andy and can throw me a banana.
kt
Am 11.04.2008 um 21:45 schrieb Ken Tilton:
Frank Goenninger wrote:
Am 11.04.2008 um 18:19 schrieb Ken Tilton:
"I had to /move/ the js directory to the toplevel of my drive and rename the jsquery.what.ever.js as you suggested because of the symlink issue."
FG probably does not have the symlink issue. How about a toplevel / js?
No, I don't have the issue (I am using a mature OS here ;-). Please don't introduce a toplevel /js - this "pollutes" the directory structure... I am installing apps under "/opt/app-name/"
- so OpenAIR lives in /opt/common-lisp/openair and the JS
directory is /opt/common- lisp/openair/js - works really well.
Hey, I am in monkey-mode over here, I saw the browser asking for "/ js/openair.js" and I made it happen, I am just dying to see (+ cells ajax). Left for another day was whether I could have changed one of a dozen parameters incomprehensible to my monkey mind in order to get the browser to ask for a different file.
Real easy in hunchentoot. Eddi did it again, you know. ;-)
How /are/ your browser/js skills, btw? I will start CCing you on questions that arise in that area in case you are on-line sooner than Andy and can throw me a banana.
Shoot! - Those skills are getting better every hour ... I have done tabs in jQuery now in monkey style and digesting a ton of JS code today...
I /am/ a beginner, though. So, you are warned - there will not be an answer for each of your questions... But hey, never too old to have some fun ! ;-)
Frank
Andy Chambers wrote:
On Fri, Apr 11, 2008 at 2:51 PM, Frank Goenninger frgo@mac.com wrote:
Andy,
Symptoms:
- No updates received from Web browser
- When trying to update a slot on a page model I do not get any update of
the Web page ...
Is the git repo somehow in an "intermediate state" ? - I seem to remember you saying so in some email. Appreciate your feedback.
I thought that what I pushed last night would have worked but Kenny seems to be having problems too.
!!!!!!!!!!! Woo-hoo !!!!!!!!!!!!!!!
(it's working. more soon.)
(I had to mode the js directory to the toplevel of my drive and rename the jsquery...js as you suggested.
kt
What's your platform? Do you have
firebug running? Maybe there's some javascript errors that could give us a clue.
I'll load your example up and take a closer look when I get home this evening.
In the meantime, can you post the output of "git show"
Cheers, Andy _______________________________________________ cells-devel site list cells-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cells-devel