Upgrade to the environment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Upgrade to the environment

keith1y
Hello all,

I have had a tweak of the way that the environment works, and I am
pretty pleased with the result and I hope that Lukas will consider
making use of this code.

If you would like to have a look then check out
http://create.seasidehosting.st

The environment as was has been moved to /environment/layout and children.
It is itself an editable page - just the place for some power user
documentation
It now has sub pages for stylesheet and javascript scripts
PRLibrary is still used if loaded, but it is redundant in this version.
If you remove the environment page a new clean one is instanciated in
its place.

Ideas for the near future:
It should be trivial to add a selector picker to pick a
layout/stylesheet from a selection.
These selectors are currently hardwired in PRStructure (see senders of
#pierconfig)
Inheritance is currently unchanged, all of the environment page and
contents is inherited or nothing. It shouldn't be too difficult to
inherit on a per environment/element basis. I think a generic "lookup in
parents" function would be useful for this.

enjoy

best regards

Keith

               
___________________________________________________________
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to the environment

keith1y
Not having much luck with seasidehosting,
so if you would like to sneak a look try
http://art.hobby-site.com/seaside/art

I'll attach a changeset too

best regards

Keith


'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 9 June 2006 at 12:16:10 pm'!

!PRPierFrame methodsFor: 'accessing-dynamic' stamp: 'kph 6/9/2006 12:11'!
layout

self flag: #todo.

        ^ self environment childrenDecoration at: self layoutSelector ifAbsent:  [ nil ]! !

!PRPierFrame methodsFor: 'accessing-dynamic' stamp: 'kph 6/9/2006 07:48'!
layoutSelector

self flag: #pierconfig.

^ 'layout'

! !

!PRPierFrame methodsFor: 'accessing-dynamic' stamp: 'kph 6/9/2006 09:43'!
scriptPage

        | stylePage |
        self flag: #todo. "inheritance?"
        stylePage := self environment childrenDecoration at: self scriptPageSelector ifAbsent:  [ ^'' ].

^ stylePage contents ! !

!PRPierFrame methodsFor: 'accessing-dynamic' stamp: 'kph 6/9/2006 09:42'!
scriptPageSelector

self flag: #pierconfig.

^ 'javascript'! !

!PRPierFrame methodsFor: 'accessing-dynamic' stamp: 'kph 6/9/2006 10:04'!
stylePage

        | stylePage |
self flag: #todo.  "inheritance?"
        stylePage := self environment childrenDecoration at: self stylePageSelector ifAbsent:  [ '' ].


^ stylePage contents ! !

!PRPierFrame methodsFor: 'accessing-dynamic' stamp: 'kph 6/9/2006 09:35'!
stylePageSelector

self flag: #pierconfig.

^ 'stylesheet'! !

!PRPierFrame methodsFor: 'private' stamp: 'kph 6/9/2006 10:17'!
updateRoot: aHtmlRoot
        super updateRoot: aHtmlRoot.
        self scriptPage ifNotNilDo: [:script | aHtmlRoot addScript: script].
        self stylePage ifNotNilDo: [:style | aHtmlRoot addStyle: style].
       
        aHtmlRoot docType: '<?xml version="1.0" encoding="UTF-8"?><!!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
        aHtmlRoot htmlAttributes at: 'xmlns' put: 'http://www.w3.org/1999/xhtml'.
        aHtmlRoot addHeadElement: ((WAHtmlElement named: 'meta')
                attributeAt: 'name' put: 'generator';
                attributeAt: 'content' put: PRDistribution versionString;
                yourself)! !

!PRPierFrame methodsFor: 'rendering' stamp: 'kph 6/9/2006 08:00'!
renderContentOn: html
        html div
                class: 'frame';
                with: [
                        self context renderer
                                start: self layout
                                in: self on: html ]! !


!PRPierLibrary methodsFor: 'accessing' stamp: 'kph 6/9/2006 11:38'!
style
        self flag: #pierconfig.
        "this will work but it is not needed"
        ^ '@import "http://www.lukas-renggli.ch/smalltalk/pier/style/84/style.css";'! !


!PRStructure methodsFor: '*pier-seaside-configuration' stamp: 'kph 6/9/2006 11:50'!
environmentStructure

| environment layout stylesheet |
        self flag: #pierconfig.

"structure then contents"
environment := (PRPage named: 'environment')
                addDecoration: PRHider new;
                addChild:
                        (layout := (PRPage named: 'layout')
                        addChild: ((PRComponent named: 'header')
                                componentClass: PRHeaderWidget;
                                yourself);
                        addChild: ((PRComponent named: 'views')
                                componentClass: PRViewsWidget;
                                yourself);
                        addChild: ((PRComponent named: 'commands')
                                componentClass: PRCommandsWidget;
                                yourself);
                        addChild: ((PRComponent named: 'tree')
                                componentClass: PRTreeWidget;
                                yourself);
                        addChild: ((PRComponent named: 'main')
                                componentClass: PRContentsWidget;
                                yourself);
                        yourself);
                addChild:
                        (stylesheet := (PRPage named: 'stylesheet')
                                yourself);
        yourself.
environment contents: '-*layout*
-*layout/header*
-*layout/views*
-*layout/commands*
-*layout/tree*
-*layout/main*
-*stylesheet*
-*javascript*'.

layout contents: '+header+
<table class="body"><tr><td class="boxes">+views+<br />+commands+<br />+tree+</td><td class="spacer"></td><td class="main">+main+</td></tr></table>'.

stylesheet contents: ' @import "http://www.lukas-renggli.ch/smalltalk/pier/style/84/style.css";'.

^environment! !

PRPierFrame removeSelector: #style!


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to the environment

Damien Cassou-3
In reply to this post by keith1y
> http://create.seasidehosting.st

I get a gateway problem when I try to access this page:


Bad Gateway

The proxy server received an invalid response from an upstream server.


It's not the case with other seasidehosting websites.

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to the environment

Lukas Renggli-2
In reply to this post by keith1y
> !PRStructure methodsFor: '*pier-seaside-configuration' stamp: 'kph  
> 6/9/2006 11:50'!
> environmentStructure
>
> | environment layout stylesheet |
> self flag: #pierconfig.
>
> "structure then contents"
> environment := (PRPage named: 'environment')
> addDecoration: PRHider new;
> addChild:
> (layout := (PRPage named: 'layout')
> addChild: ((PRComponent named: 'header')
> [...]


If you log-in (latest version, I suggest to always use this one) or  
if you directly type the path to the environment (older versions) you  
are able to simply edit those things from within your Web browser.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to the environment

keith1y

environmentStructure

| environment layout stylesheet |
	self flag: #pierconfig.

"structure then contents"
environment := (PRPage named: 'environment')
		addDecoration: PRHider new;
		addChild:
			(layout := (PRPage named: 'layout')
			addChild: ((PRComponent named: 'header')
[...]	
    


If you log-in (latest version, I suggest to always use this one) or  
  
what do you mean? I have not seen any access to the environment offered when I log in. It took me three days to even find that the environment existed! Now I am actually using the latest version, though it took me more than a week to learn how to load and run this.
if you directly type the path to the environment (older versions) you  
are able to simply edit those things from within your Web browser.

Lukas
  
I do understand that you are able to do this. Thats what I did in order to reverse engineer the code to put into environmentStructure. Although pier is very tightly and cleanly architected, I think that am at a different stage in the process. I feel that my contribution is part of the process of making things more usable for the uninitiated. I have the benefit of not knowing anything about pier and having to learn it all from scratch.

So I am taking a look at the raw features that pier has and putting them into a context for the new users, specifically power users, who need meta-tools. The old environment is simply a tool for editing one thing, the layout. My implementation of environment has/will become a development space for new layouts, styles and everything else which I dont think really had a place before. You are correct you can directly edit a sub-component by entering the direct url. But I ask the question, how do you learn how to do this if no one has told you, it has to be really obvious. I also think that it is best to get things to a point where the out of the box experience as easy to learn as possible, but we dont want to clutter up the main user wiki content with this stuff, which is what wiki's always used to do.

You may not see the need to mark the hard wired things. But for me they are a useful hook for learning things, particularly if you want to tweak things, which is where learning things often starts for me.

On reflection it looks like the direction this is leading to is to refactor all of the environment stuff, and some of the pierconfig stuff out of PRStructure into a separate extension module. For want of a better name "PREnvironment" and sons.

This would allow Environments (i.e. the out of the box style and configuration) to be selected in the seaside configuration panel, and offer a creative outlet for users to produce a range of pre-configured environments. This becomes the natural starting point for new 'power' users to begin creating bespoke environments, while allowing the core of pier to remain lean and fit.

best regards

Keith




_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to the environment

Lukas Renggli-2
>>> environmentStructure | environment layout stylesheet | self flag:  
>>> #pierconfig. "structure then contents" environment := (PRPage  
>>> named: 'environment') addDecoration: PRHider new; addChild:  
>>> (layout := (PRPage named: 'layout') addChild: ((PRComponent  
>>> named: 'header') [...]
>>
>> If you log-in (latest version, I suggest to always use this one) or
>
> what do you mean? I have not seen any access to the environment  
> offered when I log in. It took me three days to even find that the  
> environment existed! Now I am actually using the latest version,  
> though it took me more than a week to learn how to load and run this.

I don't know if this functionality also works with ACL Security,  
probably not. In the Unix Security you need to log-in as a super-user  
and then the environment (that is hidden trough a hider-decoration)  
magically appears. The code doing this is the following:

     PRContext>>setUser: aUser
         self propertyAt: #user put: aUser.
         self enumerator hidden: (aUser notNil
             and: [ aUser isSuperuser ])

The enumerator in the context is a default visitor that knows how to  
traverse Pier. If you set #hidden: to true it also visits hidden  
structures, else they are simply ignored. Menus are rendered using  
this default enumerator.

>> if you directly type the path to the environment (older versions)  
>> you   are able to simply edit those things from within your Web  
>> browser. Lukas
>
> I do understand that you are able to do this. Thats what I did in  
> order to reverse engineer the code to put into  
> environmentStructure. Although pier is very tightly and cleanly  
> architected, I think that am at a different stage in the process. I  
> feel that my contribution is part of the process of making things  
> more usable for the uninitiated. I have the benefit of not knowing  
> anything about pier and having to learn it all from scratch.

Even though you can't see the environment, everybody is able to see  
the environment by directly typing the URL. Of course this can also  
be prevented using one of the security frameworks. As an example and  
to prove that this works, try to go to the environment of my homepage  
by browsing to <http://www.lukas-renggli.ch/environment>.

> So I am taking a look at the raw features that pier has and putting  
> them into a context for the new users, specifically power users,  
> who need meta-tools. The old environment is simply a tool for  
> editing one thing, the layout. My implementation of environment has/
> will become a development space for new layouts, styles and  
> everything else which I dont think really had a place before. You  
> are correct you can directly edit a sub-component by entering the  
> direct url. But I ask the question, how do you learn how to do this  
> if no one has told you, it has to be really obvious. I also think  
> that it is best to get things to a point where the out of the box  
> experience as easy to learn as possible, but we dont want to  
> clutter up the main user wiki content with this stuff, which is  
> what wiki's always used to do.

Yes, I completely agree. That's why I tried to make hidden structures  
visible for super-users, I don't know why it didn't work in your  
case. Maybe the default Pier setup should include a better  
introduction and a how-to for the most common functionalities. Right  
now a non-programmer is simply lost.

> You may not see the need to mark the hard wired things. But for me  
> they are a useful hook for learning things, particularly if you  
> want to tweak things, which is where learning things often starts  
> for me.

Sure, the problem is I don't like flags in the code ;-)

Some of things you labelled as hard wired are not hard wired, these  
are just default values that can be changed trough the web-interface.

Something totally unrelated, just to write it down: it would be cool  
to have sort of a tagging system in Smalltalk, so that one could  
associate tags with classes, methods, instance variables, etc. Then  
we could get rid of the categories and all the flags and one could  
simply open a browser on all entities tagged as "hard wired", or on  
all classes tagged as "document" and "visitor" displaying the  
PRDocumentVisitor class ...

> On reflection it looks like the direction this is leading to is to  
> refactor all of the environment stuff, and some of the pierconfig  
> stuff out of PRStructure into a separate extension module. For want  
> of a better name "PREnvironment" and sons.
>
> This would allow Environments (i.e. the out of the box style and  
> configuration) to be selected in the seaside configuration panel,  
> and offer a creative outlet for users to produce a range of pre-
> configured environments. This becomes the natural starting point  
> for new 'power' users to begin creating bespoke environments, while  
> allowing the core of pier to remain lean and fit.

For #icon and #label this would be a good idea, else I don't really  
see the point. The environment is instantiated once when you set up  
the server, after that it doesn't need that code anymore. This is  
just a template to get users started from.

To have the choice between different ready-made templates I created a  
small command with less than 30 lines of code. See Pier-Environment-
lr.1 in the Pier repository. It has 3 slightly different templates  
defined on the class-side, that can be applied from the web-interface  
anywhere inside Pier. Does this help? Do you think that should go  
into the core?

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to the environment

keith1y
Lukas,

Ooh, it does work after all. Not knowing this I had taken the law into
my own hands and removed the hider manually which explains why it didnt
work for me!

Keith

> I don't know if this functionality also works with ACL Security,  
> probably not. In the Unix Security you need to log-in as a super-user  
> and then the environment (that is hidden trough a hider-decoration)  
> magically appears. The code doing this is the following:
>
>      PRContext>>setUser: aUser
>          self propertyAt: #user put: aUser.
>          self enumerator hidden: (aUser notNil
>              and: [ aUser isSuperuser ])
>
> The enumerator in the context is a default visitor that knows how to  
> traverse Pier. If you set #hidden: to true it also visits hidden  
> structures, else they are simply ignored. Menus are rendered using  
> this default enumerator.
>  
 

       
       
               
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to the environment

keith1y
In reply to this post by Lukas Renggli-2

> Sure, the problem is I don't like flags in the code ;-)
>  
I see!

> Some of things you labelled as hard wired are not hard wired, these  
> are just default values that can be changed trough the web-interface.
>
>  
> Something totally unrelated, just to write it down: it would be cool  
> to have sort of a tagging system in Smalltalk, so that one could  
> associate tags with classes, methods, instance variables, etc. Then  
> we could get rid of the categories and all the flags and one could  
> simply open a browser on all entities tagged as "hard wired", or on  
> all classes tagged as "document" and "visitor" displaying the  
> PRDocumentVisitor class ...
>
>  
I am not sure if I remember rightly, but wasn't this what the developer
of starbrowser had in mind too?

>> On reflection it looks like the direction this is leading to is to  
>> refactor all of the environment stuff, and some of the pierconfig  
>> stuff out of PRStructure into a separate extension module. For want  
>> of a better name "PREnvironment" and sons.
>>
>> This would allow Environments (i.e. the out of the box style and  
>> configuration) to be selected in the seaside configuration panel,  
>> and offer a creative outlet for users to produce a range of pre-
>> configured environments. This becomes the natural starting point  
>> for new 'power' users to begin creating bespoke environments, while  
>> allowing the core of pier to remain lean and fit.
>>    
>
> For #icon and #label this would be a good idea, else I don't really  
> see the point. The environment is instantiated once when you set up  
>  
I see your point... but I am leaning in the direction of doing a whole
lot more with the environement concept so I guess I just have to try it
out and see.
> To have the choice between different ready-made templates I created a  
> small command with less than 30 lines of code. See Pier-Environment-
> lr.1 in the Pier repository. It has 3 slightly different templates  
> defined on the class-side, that can be applied from the web-interface  
> anywhere inside Pier. Does this help? Do you think that should go  
> into the core?
>  
Its certainly nice to have around as an example, and I think that having
a Pier-Environment space on the server for such things is a great idea.

do you open your source server for contibutions?

Keith


       
       
               
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to the environment

Lukas Renggli-2
> Its certainly nice to have around as an example, and I think that  
> having
> a Pier-Environment space on the server for such things is a great  
> idea.
>
> do you open your source server for contibutions?

Yes sure, the projects Pier and Magritte are now repositories  
writeable by everybody. Everybody feel free to commit changes,  
enhancements, fixes, etc.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki