1. For those helping on intrigue...

The name has been changed to webclay, something a bit more meaningful for a web application stack. The SVN repo has changed as well to reflect the new name. I am working on a web app, so it will be changing rapidly as general needs arise. For those that do not know of intrigue/weblay, it started it's life as a generic web platform extracted from the forum here. Since then, it has become very easy to use and powerful. One day, the forum will be updated/rewritten to make use of all the new features of webclay.

Webclay in short:

  • Handles URL to Euphoria routine dispatching
  • Query string/forum to function parameter mapping
  • Type translation (say you have a field that asks for Age, it will go to your function as an Integer, or a birth date, will go to your function as a date value, not a string)
  • Input validation (say name is required, date of birth has to be greater than the year 1900, etc...). Validation will take place and upon failure the form will be reissued w/proper error messages
  • Template system included (based off of Kanarie, but modified a bit for more usability)
  • Far easier to use than a CGI application
  • Front end is written in such a way that server to application connections will be handled directly by webclay, thus allowing your application w/o change to support CGI, FastCGI and SCGI depending on your deployment requirements
  • Standard server URL rewriting allows for an easy translation of http://myserver.com/account/login.html or http://myserver.com/forum/view.html to webclay requests

If anyone wishes to use webclay or help in it's development, please let me know. It's sources can be found on my SVN server: http://jeremy.cowgar.com/svn/webclay ... A short example of how webclay works is included in the sources: http://jeremy.cowgar.com/svn/webclay/trunk/htdocs

Jeremy

new topic     » topic index » view message » categorize

2. Re: For those helping on intrigue...

jeremy said...
  • Handles URL to Euphoria routine dispatching
  • Query string/forum to function parameter mapping

Could you provide examples of what you mean by the above?

jeremy said...
  • Far easier to use than a CGI application

What's the paradigm? For example, with BBCMF, you create "blocks" on a page, then fill those blocks with content (whether static, from a file, from a database, etc.). The content can be variable, depending on the URL, etc...

jeremy said...

If anyone wishes to use webclay or help in it's development, please let me know.

I'd be interested in using and helping. How easy is it to set up on a server? Does it work with Apache? Do you have any install/usage docs?

new topic     » goto parent     » topic index » view message » categorize

3. Re: For those helping on intrigue...

euphoric said...
jeremy said...
  • Handles URL to Euphoria routine dispatching
  • Query string/forum to function parameter mapping

Could you provide examples of what you mean by the above?

Sure. Let's say the request is:

http://myserver.com/apiary/find.html?name=Primary&city=Small%20Town 

Webclay works on modules and actions. In the above, the module is "apiary" and the action is "find". This can be translated in any way (or not at all) by your web server. Now, in your actual code, you have things such as:

include webclay/webclay.e as webclay 
 
function apiary_index(integer template) 
    webclay:set_value(template, "title", "Apiary Listing") 
    return { TEMPLATE, "apiary_index.html" } 
end function 
w:add_handler(routine_id("apiary_index"), "apiary", "index") 
 
function apiary_find(integer template, sequence name, sequence city, sequence state, sequence zip) 
    -- do query 
    -- set values 
    return { TEMPLATE, "apiary_find" } 
end function 
w:add_handler(routine_id("apiary_find"), "apiary", "find") 
 
w:handle_request() 

The above is actually a fully working web application. Webclay takes care of mapping a URL (/apiary/find.html) to a Euphoria function (function apiary_find), via it's registered handlers. When you register a handler, you can do more things such as provide a type mapping definition or an input validation function. You can look at the hello world example in the source svn to see how to use those as well.

But with the above, it mapped the URL to the right Euphoria function, it also took the data coming in via a QUERY_STRING or via the POST data and sent it to the registered function. Notice how the user has to do nothing w/getting CGI values, reading POST data, etc... It's just an easy to use Euphoria app smile

euphoric said...
jeremy said...
  • Far easier to use than a CGI application

What's the paradigm? For example, with BBCMF, you create "blocks" on a page, then fill those blocks with content (whether static, from a file, from a database, etc.). The content can be variable, depending on the URL, etc...

Webclay is not a CMF. It's a lower level tool than that. BBCMF would be a CMF that is built using Webclay. Webclay by itself does nothing of value, it does not come with pre-defined modules such as user management, news, etc... You can think of webclay as a much more robust replacement for:

include cgi.e 

... i.e. It only enables you to write web applications, it is in no way a web application itself as in BBCMF.

euphoric said...
jeremy said...

If anyone wishes to use webclay or help in it's development, please let me know.

I'd be interested in using and helping. How easy is it to set up on a server? Does it work with Apache? Do you have any install/usage docs?

It's cake to setup a server. If you have CGI working, then webclay will work. Yes, it works with many web servers. I use Abyss web server on Windows, Apache on Linux and Lighttpd on OS X. I have tested with a few other web servers as well w/o issue.

Install/usage docs? Let's start with the install docs:

Now, let's finish with usage docs:

  • See webclay/htdocs/hello.ex, webclay/htdocs/form.html, webclay/htdocs/greet.html for documented examples

Sorry there is not more docs than that, but that's it. The greeter example actually does everything that webclay currently offers and is very easy to understand. As with any project just getting on it's feet, docs are, um, non-existant getlost

Jeremy

new topic     » goto parent     » topic index » view message » categorize

4. Re: For those helping on intrigue...

euphoric said...
jeremy said...
  • Query string/forum to function parameter mapping

Could you provide examples of what you mean by the above?

Hm, that should have been Query string/Post data to function parameter mapping. Not "forum". That's where you have:

Name: <input type="text" name="name" value="John Doe" /> 
Quantity: <input type="text" name="quantity" value="20" /> 
Dob: <input type="text" name="dob" value="10/20/1989" /> 

coming into a Euphoria function as an actual Integer value:

function place_order(integer template, sequence name, datetime dob, integer quantity) 

If there is a data conversion error, then the form is presented again w/previous data filled in and the error message displayed on the correct field stating the error. For instance, say for Quantity they enter "apple". Webclay will reissue the form with an error "Quantity must be a numeric value, i.e. 1-100" (you can also specify the error message of course).

i.e. none of this garbage:

function place_order() 
    object name = cgi:get(query_string, "name") 
    object dob = cgi:get(query_string, "dob") 
    object quantity = cgi:get(query_string, "quantity") 
 
    quantity = value(quantity) 
    if age[1] = GET_SUCCESS then 
        quantity = quantity[2] 
    else 
        -- try to handle the problem youself by redirecting back to the form 
        -- populating the form w/data that is saved in a session value 
        -- adding error information about what the problem was 
        -- ...etc... 
    end if 
 
    dob = dt:parse(dob) 
    if atom(dob) then 
        -- couldn't parse the date of birth, throw an error, the same as above 
    end if 
 
    -- 
    -- now we can actually use name, dob and quantity 
    -- 
 
    if quantity > 100 then 
        discount = 0.05 -- they are  a big buyer, give them a break 
    end if 
 
    if dt:subtract(now(), dob) < 18 then 
        -- person is a minor, we must get parents permission to charge a  
        -- credit card 
    end if 
 
    -- 
    -- etc... 
    -- 
 
    db:execute("INSERT INTO order VALUES (?,?,?)", { name, dob, quantity }) 
 
    return { TEMPLATE, "success.html" } 
end function 

With webclay, the function place_order would have never been called if the data didn't validate. Now, not only does it simply do validation on conversion types, but you can control the validation 100% if you wish by providing an optional argument giving the validation function, such as:

--** 
-- Validate the information sent by the greeter form to the greet action 
-- 
-- Web Validation: 
--     * Name must not be empty 
--     * Greeting must not be empty 
--     * Greeting must not be Goodbye 
 
function validate_greet_form(integer data, sequence name, sequence greeting) 
	sequence errors = wc:new_errors("greeter", "form") 
 
	if not valid:not_empty(name) then 
		errors = wc:add_error(errors, "name", "Name is empty!") 
	end if 
 
	if not valid:not_empty(greeting) then 
		errors = wc:add_error(errors, "greeting", "Greeting is empty!") 
	end if 
 
	if equal(greeting, "Goodbye") then 
		errors = wc:add_error(errors, "greeting",  
			"We are not going anywhere, do not say goodbye!") 
	end if 
 
	return errors 
end function 

Jeremy

new topic     » goto parent     » topic index » view message » categorize

5. Re: For those helping on intrigue...

This is exciting news. I plan to use it for the next version of EuWikiEngine. Also, I want to make a photo gallery engine. Good work, Jeremy! smile

new topic     » goto parent     » topic index » view message » categorize

6. Re: For those helping on intrigue...

jeremy said...

It's cake to setup a server. If you have CGI working, then webclay will work.

I don't eat a lot of cake. smile

First, I had to add this line:

#!c:\euphoria\bin\eui.exe 

as the very first line of hello.ex. Did you mean to leave it out? I think Apache requires it. Maybe other servers don't. I'd still put it in as default. Euphoria ignores it.

Second, I'm getting this error:

C:\htdocs\webclay\htdocs\..\webclay/webclay.e:225 
'copy' takes only 1 argument 
	m:copy(cgi:post, cgi_vars) 
	               ^ 

Help!

new topic     » goto parent     » topic index » view message » categorize

7. Re: For those helping on intrigue...

euphoric said...

First, I had to add this line:

#!c:\euphoria\bin\eui.exe 

as the very first line of hello.ex. Did you mean to leave it out? I think Apache requires it. Maybe other servers don't. I'd still put it in as default. Euphoria ignores it.

Yes, that would be helpful. w/my dev box, .ex is associated with eui.exe and it just works, but your line should be there. However, it will not work like that on unix. I wish #!/usr/bin/env eui worked everywhere smile

euphoric said...

Second, I'm getting this error:

C:\htdocs\webclay\htdocs\..\webclay/webclay.e:225 
'copy' takes only 1 argument 
	m:copy(cgi:post, cgi_vars) 
	               ^ 

Help!

You're running an old version of Euphoria. I added copy to map's only very, very recently (SVN 2178)

Jeremy

new topic     » goto parent     » topic index » view message » categorize

8. Re: For those helping on intrigue...

HI, I have been a previous user of Euphoria. I am interested in trying Webclay. I clicked on the link and got a page with some files and a subversion. How do I get the webClay files?? Thanks for any help Jim my email is sixs@ida.net

http://jeremy.cowgar.com/svn/webclay/ Revision 603: /webclay .. branches/ tags/ trunk/


Powered by Subversion version 1.4.2 (r22196).

new topic     » goto parent     » topic index » view message » categorize

9. Re: For those helping on intrigue...

jvandal said...

HI, I have been a previous user of Euphoria. I am interested in trying Webclay. I clicked on the link and got a page with some files and a subversion. How do I get the webClay files?? Thanks for any help Jim my email is sixs@ida.net

http://jeremy.cowgar.com/svn/webclay/ Revision 603: /webclay .. branches/ tags/ trunk/


Powered by Subversion version 1.4.2 (r22196).

Hello jvandal. You need a Subversion (SVN) client to download the files. Or, use the graphical SVN, TortoiseSVN.

new topic     » goto parent     » topic index » view message » categorize

10. Re: For those helping on intrigue...

jvandal said...

HI, I have been a previous user of Euphoria. I am interested in trying Webclay. I clicked on the link and got a page with some files and a subversion. How do I get the webClay files?? Thanks for any help Jim my email is sixs@ida.net

http://jeremy.cowgar.com/svn/webclay/ Revision 603: /webclay .. branches/ tags/ trunk/


Powered by Subversion version 1.4.2 (r22196).

Jim,

ry is right, you need a SVN client. WebClay is still in a state of minor flux. I do have a big change coming up in regards to registering actions. Since it is still pretty new, has almost no documentation and is in a state of flux, it has not had a release for general use. You can still use it, however, it's for the brave right now. A bit after 4.0 release, I'll dedicate some real time to closing all the loose ends.

Jeremy

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu