r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!Cheyenne] Discussions about the Cheyenne Web Server

Henrik
16-Oct-2008
[3155]
Graham, possibly, but I use this method in about 20 other rsp pages 
without problems.
Graham
16-Oct-2008
[3156]
version ?
Dockimbel
16-Oct-2008
[3157]
From v0.9.19, using 'do would by default bind your loaded code to 
the webapp context (and not to the global context). Btw, if you're 
using an external INCLUDE function, it may clash with RSP's global 
INCLUDE function.
Graham
16-Oct-2008
[3158]
I get an empty page ... 
well

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title></title></head><body></body></html>
Henrik
16-Oct-2008
[3159x2]
Looks like 0.9.17 here
Graham, ok. It's a local cache problem then.
Graham
16-Oct-2008
[3161]
Caching an old version of the web page?
Henrik
16-Oct-2008
[3162]
I don't know what it was, but it looked rather bizarre.
Graham
16-Oct-2008
[3163x2]
Heh.
I need a way to properly indent all my rsp code ... editing in a 
textarea ...leads to ugly formatting as I can't use tabs! :(
Dockimbel
16-Oct-2008
[3165]
/posted: thanks for the reminder, that's right, it can be binary! 
or string!. It looks like the file upload support could be cleaner 
and easier to use from RSP. Will give it some thoughts.
Graham
16-Oct-2008
[3166x2]
Maybe I should use the plugin to provide an editor?
/posted caught me ... i keep getting image errors when writing the 
/posted to a file and then trying to view it with img src!
Dockimbel
16-Oct-2008
[3168]
Maybe you can catch TAB keypress event with javascript and inject 
spaces in textarea ?
Graham
16-Oct-2008
[3169x5]
I tried that ... and got some error.
<script type="text/javascript" >
function tab_to_tab(e,el) {

    //A function to capture a tab keypress in a textarea and insert 4 
    spaces and NOT change focus.

    //9 is the tab key, except maybe it's 25 in Safari? oh well for them 
    ...
    if(e.keyCode==9){

        var oldscroll = el.scrollTop; //So the scroll won't move after a 
        tabbing

        e.returnValue=false;  //This doesn't seem to help anything, maybe 
        it helps for IE
        //Check if we're in a firefox deal
      	if (el.setSelectionRange) {
      	    var pos_to_leave_caret=el.selectionStart+4;
      	    //Put in the tab

          el.value = el.value.substring(0,el.selectionStart) + '    ' + el.value.substring(el.selectionEnd,el.value.length);

            //There's no easy way to have the focus stay in the textarea, below 
            seems to work though

            setTimeout("var t=document.getElementById('code1'); t.focus(); t.setSelectionRange(" 
            + pos_to_leave_caret + ", " + pos_to_leave_caret + ");", 0);
      	}
      	//Handle IE
      	else {
      		// IE code, pretty simple really
      		document.selection.createRange().text='    ';
      	}
        el.scrollTop = oldscroll; //put back the scroll
    }
}
</script>
I'll have to check it again some time.
<textarea id="code1" onkeydown="tab_to_tab(event,document.getElementById('code1')) 
name="source" rows="40" cols="140"> source
</textarea>
my cut and paste javascript function!
Dockimbel
16-Oct-2008
[3174]
Maybe some JS expert here can help you with that issue ?
Graham
16-Oct-2008
[3175]
I get this 

syntax error ! 
Invalid tag --
Dockimbel
16-Oct-2008
[3176]
Did you tried with Firebug step by step JS debugger ?
Graham
16-Oct-2008
[3177x4]
ahhh....
unmatched quotes in my textarea :(
Gee .. it's working now!!
<textarea id="code1" onkeydown="tab_to_tab(event,document.getElementById('code1'))" 
name="source" rows="40" cols="140"> source
</textarea>
Dockimbel
16-Oct-2008
[3181]
:-)
Henrik
16-Oct-2008
[3182]
ah, got my page working now. always a joy to build a page in a few 
minutes with REBOL.
Graham
16-Oct-2008
[3183x2]
How about returning a file! type instead of a string! value?
not important though ...
Graham
17-Oct-2008
[3185x7]
doc, is there any documentation on how modules work?
As I understand it, modules implemented the task-master API.  But 
now you have mods instead of modules, and instead of install-module, 
you have install-HTTPd-extension
So, how does a particular mod get invoked for an incoming url?  
How do I get the mod-rest.r to process the urls?
So, mods are able to process the various phases as described in cheyennes 
processing pipeliine. Each module can decide whether to process a 
phase, do nothing, and /or prevent another mod from processing that 
phase.
So, I guess if the mod-rest is not seeing the url-translate phase, 
one of the other standard modules has already processed it.
mod-static has this

	order: [
		method-support	last
		url-translate	first
		url-to-filename	last
		access-check	last
		set-mime-type	last
		make-response	last
		filter-output	last
		reform-headers	last
		logging			last
	]
So, I guess mod-static is processing url-translate first ... and 
I need to change this to 

url-translate normal
Dockimbel
17-Oct-2008
[3192]
You shouldn't do that. If you want take priority other an existing 
module already declaring it's callback as 'first, you have to put 
your module after the other module in config file (modules section).
Graham
17-Oct-2008
[3193]
Oh .. so order is important there.
Dockimbel
17-Oct-2008
[3194x2]
You can trace modules activity launching Cheyenne with -vvv option. 
You'll be able to see which module executes a given callback.
Order matters in modules [...] section.
Graham
17-Oct-2008
[3196x2]
I've already got mod-rest as first there.
I'll try the -www
Dockimbel
17-Oct-2008
[3198]
The last one in the list will be the last loaded, so will be able 
to take the FIRST or LAST place even if other previously loaded mods 
did the same.
Graham
17-Oct-2008
[3199]
so, it has to be last then?
Dockimbel
17-Oct-2008
[3200]
Your mod should be *after* mod-static.
Graham
17-Oct-2008
[3201x3]
ok.
18/10-08:16:29.195-[HTTPd] Trying phase url-translate ( mod-rest 
)

18/10-08:16:29.201-[HTTPd] Trying phase url-translate ( mod-static 
)
18/10-08:16:29.210-[uniserve] Calling >on-received< with {^M
url-translate is returning 'true in mod-rest, but mod-static is still 
being called
Dockimbel
17-Oct-2008
[3204]
That's odd.