[Question] Learning Pier .... working with the wiki model

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

[Question] Learning Pier .... working with the wiki model

hhs@lexdb.net
Dear all

I am learning Pier and I have two (hopefully) simple questions.


I have looked into the example

   PRPierFrame class>>exampleBasic

which is displayed in the examples browser

    http://localhost:8080/seaside/examples/examplebrowser


I then tried to come up with my own (very simple) wiki model


In a workspace I did


MyPierModel := PRPage new
            title: 'The title of the page';
            contents: '
            The text of my note page.
            More text .....
           
           
            Link to *AnotherPage*
            ';
            yourself


And I have changed the example above

to

PRPierFrame class>>exampleBasicHH1

exampleBasicHH1
    "To see this example browse to /seaside/examples/examplebrowser and select the receiver class."

^ self on: (PRContext kernel: (PRKernel new
        name: 'MyPier';
        root: MyPierModel))




The question:

1) What are the proper ways to construct a pier model:  MyPierModel

2) In the Morphic world menu there is an entry 'Pier Browser' which opens an OmniBrowser variant to browse and edit Pier models. When I open it it shows a model called 'Pier' which is the model of the pier application under

http://localhost:8080/seaside/pier

What do I need to do if I want to browse the above mentioned model
  MyPierModel?

And a question related to this: How can I replace the 'Pier' model under http://localhost:8080/seaside/pier with MyPierModel?

Thank you for the answers in advance.


Kind regards

Hannes Hirzel

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Question] Learning Pier .... working with the wiki model

Lukas Renggli
> 1) What are the proper ways to construct a pier model:  MyPierModel

Normally you just do that from the web, not from a workspace. There
are only very few things (probably none of which you care at the
beginning) that are not accessible from the web browser.

> 2) In the Morphic world menu there is an entry 'Pier Browser' which opens an
> OmniBrowser variant to browse and edit Pier models. When I open it it shows
> a model called 'Pier' which is the model of the pier application under
>
> http://localhost:8080/seaside/pier
>
> What do I need to do if I want to browse the above mentioned model
>   MyPierModel?

The morphic 'Pier Browser' shows all the registered kernels from

    PRKernel instances

See the protocol on the class side of PRKernel on how to manage these.

> And a question related to this: How can I replace the 'Pier' model under
> http://localhost:8080/seaside/pier with MyPierModel?
>
> Thank you for the answers in advance.

The Seaside Configuration interface has a drop-down box that lists all
the registered kernels.

Moreover you can assign any kernel to a Seaside entry point by
evaluating something like:

    PRPierFrame registerAsApplication: 'foo' kernel: MyPierModel

Cheers,
Lukas

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

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Question] Learning Pier .... working with the wiki model

Tudor Girba-3
For a detailed example of setting up a Pier instance, take a look at  
PRDistribution from the Pier-Setup package. This class is the one that  
creates the Pier that comes with the distribution.

To create the Pier distribution you should call:
PRDistribution new register.

Cheers,
Doru


On Oct 4, 2008, at 3:39 PM, Lukas Renggli wrote:

>> 1) What are the proper ways to construct a pier model:  MyPierModel
>
> Normally you just do that from the web, not from a workspace. There
> are only very few things (probably none of which you care at the
> beginning) that are not accessible from the web browser.
>
>> 2) In the Morphic world menu there is an entry 'Pier Browser' which  
>> opens an
>> OmniBrowser variant to browse and edit Pier models. When I open it  
>> it shows
>> a model called 'Pier' which is the model of the pier application  
>> under
>>
>> http://localhost:8080/seaside/pier
>>
>> What do I need to do if I want to browse the above mentioned model
>>  MyPierModel?
>
> The morphic 'Pier Browser' shows all the registered kernels from
>
>    PRKernel instances
>
> See the protocol on the class side of PRKernel on how to manage these.
>
>> And a question related to this: How can I replace the 'Pier' model  
>> under
>> http://localhost:8080/seaside/pier with MyPierModel?
>>
>> Thank you for the answers in advance.
>
> The Seaside Configuration interface has a drop-down box that lists all
> the registered kernels.
>
> Moreover you can assign any kernel to a Seaside entry point by
> evaluating something like:
>
>    PRPierFrame registerAsApplication: 'foo' kernel: MyPierModel
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Question] Learning Pier .... working with the wiki model

hhs@lexdb.net
Thank you Lukas and Tudor
for your helpful answers. First I used the current version of Pier in Squeak 3.10.2 from the Universe but now I use the Pier 1.0.17 download from http://www.piercms.com/.

My interest is to construct a Pier kernel with code through a model transformation (visit another model and construct a pier model).

I could construct a
   MyPierModel2    "code see below"
and register it as an application to be accessed as
  http://localhost:8080/seaside/mypier2

I works nicely. Do you have any further suggestions/hints how to construct these wiki models?
How are the name of a PRPage and the title related? Should a PRDocument object which is hold by the PRPage object be without a title, because the title is in the PRPage object? I assume that only the name of the PRPage object is used as the reference for links and the title text might differ.

Kind regards
Hannes Hirzel

"---------------------------------------------------------------------------------------"

| p2 |
p2 := PRPage named: 'anotherPage'.  "This just creates a default page, which serves as a link target"


MyPierModel2 := 

(PRPage named: 'ThePageNameOfTheFirstPageOfMyWiki')
addChild: p2;
document: (

PRDocument new
            add: (PRParagraph new
                add: (PRText content: 'some text');
                yourself);
            add: ((PRHeader new)
                        level: 2;
                    add: (PRText content: 'The heading level 2');
                    yourself);
            add: (PRUnorderedList new
                    add: (PRListItem new add: (PRText content: 'aaa'));
                    add: (PRListItem new add: (PRText content: 'bbb'));
                    add: (PRListItem new add: (PRText content: 'ccc'));
                    yourself);
            add: (PRPreformatted new
                add: (PRText content: '   A line with 3 spaces');
                add: (PRText content: '    A line with a tab');
                yourself);   
            add: (PRInternalLink reference: 'anotherPage')       
        yourself
).


PRPierFrame registerAsApplication: 'mypier2' kernel: (
    (PRKernel named: 'mypierkernel2'
    root: MyPierModel2)
)


"Access the application with:"
http://localhost:8080/seaside/mypier2


   
(I put a somewhat simple example at http://wiki.squeak.org/squeak/6084)

"---------------------------------------------------------------------------------------"


Tudor Girba <[hidden email]> hat am 4. Oktober 2008 um 17:40 geschrieben:

> For a detailed example of setting up a Pier instance, take a look at 
> PRDistribution from the Pier-Setup package. This class is the one that 
> creates the Pier that comes with the distribution.
>
> To create the Pier distribution you should call:
> PRDistribution new register.
>
> Cheers,
> Doru


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Question] Learning Pier .... working with the wiki model

Lukas Renggli
>  How are the name of a PRPage and the title related?

The name is a unique identifier within its namespace. Think of the
Pier structure as a file-system where everything is a folder. A page
is a folder too, so it can have children. The name would be then the
folder-name.

In the Seaside view the name is used to build the path. Other views
might not need that. The title is something that is displayed in the
user interface. Normally the Seaside view displays the title before
the contents of a page.

> Should a PRDocument
> object which is hold by the PRPage object be without a title, because the
> title is in the PRPage object?

Normally yes.

> I assume that only the name of the PRPage
> object is used as the reference for links and the title text might differ.

Exactly, if you don't specify a title the name is taken as title of the page.

It is also possible to refer to the title (instead of the name) in
links, but the name is given priority. The title is only used for
convenance. In fact, in the end these strings don't matter, because
Pier stores links as object references.

>  document: (
>  PRDocument new
>              add: (PRParagraph new
>                  add: (PRText content: 'some text');
>                  yourself);
>              add: ((PRHeader new)
>                          level: 2;
>                      add: (PRText content: 'The heading level 2');
>                      yourself);
>              add: (PRUnorderedList new
>                      add: (PRListItem new add: (PRText content: 'aaa'));
>                      add: (PRListItem new add: (PRText content: 'bbb'));
>                      add: (PRListItem new add: (PRText content: 'ccc'));
>                      yourself);
>              add: (PRPreformatted new
>                  add: (PRText content: '   A line with 3 spaces');
>                  add: (PRText content: '    A line with a tab');
>                  yourself);
>              add: (PRInternalLink reference: 'anotherPage')
>          yourself
>  ).

Instead of manually building these documents you could directly pass a string:

contents: 'some text
!!The heading level 2
-aaa
-bbb
-ccc
=  A line with 3 spaces
=    A line with a tab
*anotherPage'


Cheers,
Lukas

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

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki