[Q] CMS/Swiki development

goran.hultgren at bluefish.se goran.hultgren at bluefish.se
Wed Mar 5 08:19:36 UTC 2003


Hi Chris!

Just my 2 cents below. :-)

Chris Burkert <christian.burkert at s2000.tu-chemnitz.de> wrote:
> Hi
> 
> I plan to develop a kind of Swiki that is more what I want (nothing 
> against swiki, but it's not really the thing I want :-) I think the best 
> is with commanche.
> 
> 1) What would you say is the best starting point (It should be faster 
> than swiki)?
> - start from scratch
> - change the existing swiki
> - build with seaside

Do not try to change the existing ComSwiki. We have done a lot of
extensions to ComSwiki (sessions, better searching, smarter recent
changes that marks unread pages as bold yadda yadda) but the
architecture is a pain to work with. The authors tried to create a very
dynamic malleable system but I think it got a bit out of hand. But it
was probably explorative programming trying to see how stuff turned out
so they are excused! :-) Just don't go there.

Don't go "from scratch". Comanche is a very nice bottom layer and it is
"just a HTTP server" so you can't possibly go wrong with it, no point in
not using it. And you can always (as we have done on many occasions) put
Apache in front of it to get https, virtual hosts etc.

Seaside is cool - I haven't used it yet, but Avi/Julian are bright guys
and Seaside can do amazing stuff. You should look at it - at least to
learn some new interesting ways to build web apps.

If you are leaning towards some form of "embed code in HTML
templates"-solution then there are/have been a bunch of those, I would
guess a few are on SqueakMap. Personally I don't like those solutions.

And then of course we have my own little pet - HttpView. Think of it as
a much simpler (and thus also less fancy) Seaside. It isn't well
documented but on the other hand I have plenty of sample code and it is
very small.

Some of the cool aspects of HttpView is that it is *all Squeak* (no file
templates at all), urls map very easily and simply onto methods and web
pages are built using an HtmlBuilder. It also does very cool things with
Forms. (Seaside has similar mechanisms but IIRC doesn't have "nice
simple bookmarkable urls". But that is a consequence of having other
nice things.)

Compared to Seaside I think HttpView is:
- Much simpler (and thus less capable of the advanced stuff, on the
other hand HttpView doesn't tie your hands so that you can't do things
"your own way" when you want to.)
- Much smaller (let me count - 22 classes of which you only need to
learn 3. The other 19 are "internal")

If HttpView sounds interesting I can dig up some sample code for you.
NOTE: The HttpView on SM is not up to date. I need to scramble together
my latest into a release.

> 2) What do you say about regular expressions. Is the plugin build in in 
> the default VM or does the admin has to compile a new VM? Then I had to 
> use Streams.
> 
> Here's what I want.
> - (Commanche) sessions

Ease pie. I think Diego's cookie support is included in the current
Comanche on SM so sessions are easy. I have build 4 different webapps
using HttpView with sessions in all of them.

> - pages sit in a tree (swiki has a graph structure)

Ok. Fair enough.

> - userlogin

Simple. I just use a normal Form together with cookies. You can get
basic auth to work too - Jonas added that for our internal ComSwiki, but
who cares.

> - permissions (from user to admin)
> - permissions are bound to a user/page combination and are
>    inherited down the tree.
> - Squeakcode in <squeak> ^'Hello World!' </squeak>

Personally I would instead use some form of HtmlBuilder (like in
HttpView or Seaside). Cleaner. And yeah, btw - I do have a Swiki syntax
single class that transforms the Swiki syntax (a bit extended) into
HTML. It is a very simple to use reimplementation of the syntax in
ComSwiki - I use it in another project called "Homepage Builder". You
don't want to try to extract that code from ComSwiki...

So in short - go with Comance + Seaside/HttpView and build it from
there. The Swiki syntax class you can get from me or Avi (he may have
improved it). I also have lots of other code around like an "upload
documents" facility etc.

Btw, just to give you a little taste of HttpView, here is a little
"hello world" I just typed into one of my running webapps (I did
*nothing more* than to add the method seen below), you can see it in
action at:

http://hb.bluefish.se/hello

WBServerView>>hello
	"WBServerView inherits from HVHttpView. To get a new 'page' in your app
	simply add a method - that is it. Here we added #hello which means
	an url like http://localhost/myappbase/hello would suddenly work.

	Note that the method returns the builder which Comanche later will
	send a message to in order to get some HTML. That is when the actual
	rendering takes place. The builder creates standard XHTML."

	| b name age |
	b _ self builder.							"Inherited, get ourselves a builder object"
	b start; h1: 'My little app'.				"Start the page and add a heading"
	b p: 'Hello brave new world!'.			"And a paragraph"
	b postForm. 								"Start a form, the action url will by default go to
this page"
	
	"Add a text field, hold the field widget in a local var, give the field
a default value"
	name _ b html: 'Name: ', inputTextValue: 'Joe Schmoe'. 

	"Add a drop down select box of objects. If they respond to name, show
that - otherwise printString.
	Tell the select box to add nil first and to show that as Will not
tell."
	age _ b br; html: 'Older than :';
		selectObjectsNilFirst: #(10 20 30 40 50 60 70 80 90)
asOrderedCollection
		nilLabel: 'WIll not tell'.

	"Add a break, a submit button with text Go, and end the form"	
	b br; submit: 'Go'; endForm.

	"Check if this was a post, in that case look at the values in the
widgets and add some stuff to the page.
	Note that the value of age is not an id or string - it is the selected
object in the collection."
	b ifPost: [
		b p: 'Hi ', name value, '!'.
		age value
			ifNil: [b p: 'You are a chicken, confess!']
			ifNotNil: [age value > 30
						ifTrue: [b p: 'You are older than me!']
						ifFalse: [p p: 'You are younger than me!']]].

	"Close the page and return the builder"
	b end.
	^b


regards, Göran



More information about the Squeak-dev mailing list