confused by PRWidget initialisation

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

confused by PRWidget initialisation

Nick
Hi,

I'm writing this as PRWidget initialisation had me confused for a while, and I guess it might confuse other newcomers. I'd also like to check with the list that my understanding is correct.

For example given the code below:

PRDistribution>>childrenWidget
^ childrenWidget ifNil: [childrenWidget := (PRComponent named: 'children')
componentClass: PRChildrenWidget;
write: 2
using: PRChildrenWidget descriptionLevel;
write: true
using: PRChildrenWidget descriptionExpand;
yourself
]
and: 

PRChildrenWidget class>>descriptionExpand
^ MABooleanDescription new
default: self defaultExpand;
parameterName: 'expand';
accessor: #expand;
label: 'Expand';
priority: 310;
yourself

I would have expected an accessor "PRChildWidget>>expand:" to be called with the value: 'true'.  I created my PRWidget derived class based on this assumption. However my equivalent setter was not being called and a closer look showed PRChildWidget to have no setters only getters. The getter reads as:

PRChildWidget>>expand
^ self read: #descriptionExpand


What's actually happening is "PRComponent>>description" is being called, not as I'd imagined: "PRChildWidget>>description".

tracing through the following code:

PRComponent>>write: anObject using: aDescription
(self basicDescription includes: aDescription)
ifTrue: [ super write: anObject using: aDescription ]
ifFalse: [
(anObject notNil and: [ aDescription isDocumentDescription ])
ifTrue: [ anObject owner: self ].
self settings at: aDescription put: anObject ]

reveals the code: "self settings at: aDescription put: anObject" is called, so "true" is placed in a settings Dictionary keyed by: #descriptionExpand

I've just about understood the code so far, and though I haven't traced through PRChildrenWidget instantiation it looks like in WAComponent>>initializeOwner:link: that the settings are copied to the newly created PRChildrenWidget object.

Phew.

I think I can see why there's complexity, but seems a shame that it in WAComponent>>initializeOwner:link: the code couldn't call the accessors of the componentClass assuming that the Magritte descriptions were configured to use an accessor pattern.

Or perhaps I've misunderstood??

Cheers

Nick 

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

Re: confused by PRWidget initialisation

Reza Razavi
Hi Nick,

My understating is the following:
1) For each specific Distribution, PRComponents keep track of the
default attribute values for each Widget (i.e., user preferences for
that Distribution). PRDistribution>>childrenWidget is an example of
such specification.
2) At runtime, when Widgets are instantiated for each Session, these
default values are affected to their respective Widget attribute by
WAComponent >> initializeOwner:link:, itself called by PRComponent >>
componentFor:, in turn called by PRContext >> buildComponent:for:.

PRWidgets overrides #write:using: to keep track of its attribute
values in its properties dictionary (instead of widget specific
accessors). This design decision facilitates the implementation and
maintenance of specific Widgets.

Hoping this helps,
Reza

At 19:56 17/02/2010, Nick Ager wrote:

>Hi,
>
>I'm writing this as PRWidget initialisation had me confused for a
>while, and I guess it might confuse other newcomers. I'd also like
>to check with the list that my understanding is correct.
>
>For example given the code below:
>
>PRDistribution>>childrenWidget
>^ childrenWidget ifNil: [childrenWidget := (PRComponent named: 'children')
>componentClass: PRChildrenWidget;
>write: 2
>using: PRChildrenWidget descriptionLevel;
>write: true
>using: PRChildrenWidget descriptionExpand;
>yourself
>]
>and:
>
>PRChildrenWidget class>>descriptionExpand
>^ MABooleanDescription new
>default: self defaultExpand;
>parameterName: 'expand';
>accessor: #expand;
>label: 'Expand';
>priority: 310;
>yourself
>
>I would have expected an accessor "PRChildWidget>>expand:" to be
>called with the value: 'true'.  I created my PRWidget derived class
>based on this assumption. However my equivalent setter was not being
>called and a closer look showed PRChildWidget to have no setters
>only getters. The getter reads as:
>
>PRChildWidget>>expand
>^ self read: #descriptionExpand
>
>
>What's actually happening is "PRComponent>>description" is being
>called, not as I'd imagined: "PRChildWidget>>description".
>
>tracing through the following code:
>
>PRComponent>>write: anObject using: aDescription
>(self basicDescription includes: aDescription)
>ifTrue: [ super write: anObject using: aDescription ]
>ifFalse: [
>(anObject notNil and: [ aDescription isDocumentDescription ])
>ifTrue: [ anObject owner: self ].
>self settings at: aDescription put: anObject ]
>
>reveals the code: "self settings at: aDescription put: anObject" is
>called, so "true" is placed in a settings Dictionary keyed by:
>#descriptionExpand
>
>I've just about understood the code so far, and though I haven't
>traced through PRChildrenWidget instantiation it looks like in
>WAComponent>>initializeOwner:link: that the settings are copied to
>the newly created PRChildrenWidget object.
>
>Phew.
>
>I think I can see why there's complexity, but seems a shame that it
>in WAComponent>>initializeOwner:link: the code couldn't call the
>accessors of the componentClass assuming that the Magritte
>descriptions were configured to use an accessor pattern.
>
>Or perhaps I've misunderstood??
>
>Cheers
>
>Nick
>_______________________________________________
>Magritte, Pier and Related Tools ...
>https://www.iam.unibe.ch/mailman/listinfo/smallwiki

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

Re: confused by PRWidget initialisation

Lukas Renggli
As Reza writes the components (or widgets) cannot carry their own
configuration, because they are instantiated later on and on a
per-session based. So the configuration happens on a generic model
object (PRComponent) that takes the description of the component and
stores its values in the settings dictionary. Whenever a component is
instantiated it is initialized with the settings from the model, that
can be overridden with the settings given in the link that embeds the
component.

It could well be that the current implementation is not as strait
forward as it could be. Over the time Magritte and Pier both changed
quite heavily and maybe it could be done simpler today?

Lukas

On 17 February 2010 21:07, Reza RAZAVI <[hidden email]> wrote:

> Hi Nick,
>
> My understating is the following:
> 1) For each specific Distribution, PRComponents keep track of the default
> attribute values for each Widget (i.e., user preferences for that
> Distribution). PRDistribution>>childrenWidget is an example of such
> specification.
> 2) At runtime, when Widgets are instantiated for each Session, these default
> values are affected to their respective Widget attribute by WAComponent >>
> initializeOwner:link:, itself called by PRComponent >> componentFor:, in
> turn called by PRContext >> buildComponent:for:.
>
> PRWidgets overrides #write:using: to keep track of its attribute values in
> its properties dictionary (instead of widget specific accessors). This
> design decision facilitates the implementation and maintenance of specific
> Widgets.
>
> Hoping this helps,
> Reza
>
> At 19:56 17/02/2010, Nick Ager wrote:
>>
>> Hi,
>>
>> I'm writing this as PRWidget initialisation had me confused for a while,
>> and I guess it might confuse other newcomers. I'd also like to check with
>> the list that my understanding is correct.
>>
>> For example given the code below:
>>
>> PRDistribution>>childrenWidget
>> ^ childrenWidget ifNil: [childrenWidget := (PRComponent named: 'children')
>> componentClass: PRChildrenWidget;
>> write: 2
>> using: PRChildrenWidget descriptionLevel;
>> write: true
>> using: PRChildrenWidget descriptionExpand;
>> yourself
>> ]
>> and:
>>
>> PRChildrenWidget class>>descriptionExpand
>> ^ MABooleanDescription new
>> default: self defaultExpand;
>> parameterName: 'expand';
>> accessor: #expand;
>> label: 'Expand';
>> priority: 310;
>> yourself
>>
>> I would have expected an accessor "PRChildWidget>>expand:" to be called
>> with the value: 'true'.  I created my PRWidget derived class based on this
>> assumption. However my equivalent setter was not being called and a closer
>> look showed PRChildWidget to have no setters only getters. The getter reads
>> as:
>>
>> PRChildWidget>>expand
>> ^ self read: #descriptionExpand
>>
>>
>> What's actually happening is "PRComponent>>description" is being called,
>> not as I'd imagined: "PRChildWidget>>description".
>>
>> tracing through the following code:
>>
>> PRComponent>>write: anObject using: aDescription
>> (self basicDescription includes: aDescription)
>> ifTrue: [ super write: anObject using: aDescription ]
>> ifFalse: [
>> (anObject notNil and: [ aDescription isDocumentDescription ])
>> ifTrue: [ anObject owner: self ].
>> self settings at: aDescription put: anObject ]
>>
>> reveals the code: "self settings at: aDescription put: anObject" is
>> called, so "true" is placed in a settings Dictionary keyed by:
>> #descriptionExpand
>>
>> I've just about understood the code so far, and though I haven't traced
>> through PRChildrenWidget instantiation it looks like in
>> WAComponent>>initializeOwner:link: that the settings are copied to the newly
>> created PRChildrenWidget object.
>>
>> Phew.
>>
>> I think I can see why there's complexity, but seems a shame that it in
>> WAComponent>>initializeOwner:link: the code couldn't call the accessors of
>> the componentClass assuming that the Magritte descriptions were configured
>> to use an accessor pattern.
>>
>> Or perhaps I've misunderstood??
>>
>> Cheers
>>
>> Nick
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



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

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

Re: confused by PRWidget initialisation

Nick
Thanks for the replies, as ever very helpful.

>> PRWidgets overrides #write:using: to keep track of its attribute values in its properties dictionary (instead of widget
>> specific accessors). This design decision facilitates the implementation and maintenance of specific Widgets.

This helped me understand  the mechanism why PRWidget derived objects store their properties in a directory rather than via an accessor. I experimented by overriding #write:using in my PRWidget derived class, to reinstating the default implementation in Object thus:

write: anObject using: aDescription
aDescription accessor write: anObject to: self

Then magically the setters in my derived class where called as I'd originally anticipated.

I understand that sometimes it's handy to be able to dynamically add fields to an object, which is when it makes sense to use a Dictionary, however to aid my understanding it seems much simpler to store properties in instance variables accessed via accessors. Will I fall into any problems if I use an accessor pattern on my PRWidget derived classes by ensuring that #write:using: reimplements the Object>>write:using: ?

Nick

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

Re: confused by PRWidget initialisation

Reza Razavi
At 02:18 18/02/2010, Nick Ager wrote:
>I understand that sometimes it's handy to be able to dynamically add
>fields to an object, which is when it makes sense to use a
>Dictionary, however to aid my understanding it seems much simpler to
>store properties in instance variables accessed via accessors. Will
>I fall into any problems if I use an accessor pattern on my PRWidget
>derived classes by ensuring that #write:using: reimplements the
>Object>>write:using: ?

Pier provides a general mechanism for handling the issue we
discussed. It could be done differently, like the solution above.
But, in that case you break the logic of your implementation
framework, Pier, which means that you take an additional maintenance
responsibility to keep your logic in synch. with that of Pier (that
may change with time). I'd avoid this, and would keep the Property
Pattern of Pier that works just fine. After all, widgets are
transient objects that provide users a view on your model objects
during a session. I'd therefore recommend to focus on model objects,
and just reuse the solution provided by Pier.

Hoping this helps,
Reza

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

Re: confused by PRWidget initialisation

Reza Razavi
In reply to this post by Lukas Renggli
At 21:40 17/02/2010, Lukas Renggli wrote:
>It could well be that the current implementation is not as strait
>forward as it could be. Over the time Magritte and Pier both changed
>quite heavily and maybe it could be done simpler today?

Hi Lukas,

Most of the complexity is related to the layers of abstraction that
necessarily come into play when implementing such a sophisticated and
flexible system. However, in this specific case roles and
responsibilities could probably be made a little bit more explicit. A
quick fix is suggested attached. It is based on the following ideas:

1) Give a name to the different portions of the logic, and dispatch
their implementation to responsible objects. This helps by making
object collaboration flows more explicit (while providing also
application developers with more hooks to override that specific
portion of code, based on their specific requirements).

2) PRComponents have a structural role, where WAComponents have a
visual role. It could help to make this distinction explicit in the
code naming conventions. For example, PRStructuralComponent instead
of PRComponent, and WAVisualComponent instead of WAComponent.

Regards,
Reza




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

PRWidget-init refactoring.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: confused by PRWidget initialisation

Lukas Renggli
I've integrated your changes in the latest Pier.

Thank you for submitting the patch.

Lukas

On 18 February 2010 07:47, Reza RAZAVI <[hidden email]> wrote:

> At 21:40 17/02/2010, Lukas Renggli wrote:
>>
>> It could well be that the current implementation is not as strait
>> forward as it could be. Over the time Magritte and Pier both changed
>> quite heavily and maybe it could be done simpler today?
>
> Hi Lukas,
>
> Most of the complexity is related to the layers of abstraction that
> necessarily come into play when implementing such a sophisticated and
> flexible system. However, in this specific case roles and responsibilities
> could probably be made a little bit more explicit. A quick fix is suggested
> attached. It is based on the following ideas:
>
> 1) Give a name to the different portions of the logic, and dispatch their
> implementation to responsible objects. This helps by making object
> collaboration flows more explicit (while providing also application
> developers with more hooks to override that specific portion of code, based
> on their specific requirements).
>
> 2) PRComponents have a structural role, where WAComponents have a visual
> role. It could help to make this distinction explicit in the code naming
> conventions. For example, PRStructuralComponent instead of PRComponent, and
> WAVisualComponent instead of WAComponent.
>
> Regards,
> Reza
>
>
>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Widget to Command adaptor

Reza Razavi
At 11:36 18/02/2010, Lukas Renggli wrote:
>I've integrated your changes in the latest Pier.

Thanks for the integration Lukas!

In the same vein of ideas, I'd like to share the attached change set.
It contains:
- A tiny framework that facilitates the *transformation" of Pier
Widgets to Pier Commands through code reuse.
- Its application to transform the following Widgets to Commands:
         PRExportImportWidget
         PRFileSettings
         PUGroupsWidget
         PRKernelSettings
         PRPersistencySettings
         PRSystemWidget
         PUUsersWidget
         PUSecurityWidget

The second file contains a few patches to the Pier code, to get a
'Close' button while remaining fully compatible with the current behavior.

If you find this useful, please don't hesitate to integrate it as you
would find it better fitting into Pier (specifically, I don't like my
patches to get the close button, but this was the most straitforward
way to get it working).

Regards,
Reza



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

Pier Commands-Widget Adaptors.st (7K) Download Attachment
Pier Commands-Widget Adaptors-Pier patches.st (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Widget to Command adaptor

Lukas Renggli
Thank you for the contributions, I will look at these changes tonight.

In the future, it would make merging easier if you submitted
Monticello (mcz) files. You can post them directly to my repository
(it is still publicly writeable contrary to many other repositories
that we had to close do to a proliferation of unrelated changes), any
other public repository, or even send them by mail as you do with the
.st files now.

Lukas

On 18 February 2010 14:13, Reza RAZAVI <[hidden email]> wrote:

> At 11:36 18/02/2010, Lukas Renggli wrote:
>>
>> I've integrated your changes in the latest Pier.
>
> Thanks for the integration Lukas!
>
> In the same vein of ideas, I'd like to share the attached change set. It
> contains:
> - A tiny framework that facilitates the *transformation" of Pier Widgets to
> Pier Commands through code reuse.
> - Its application to transform the following Widgets to Commands:
>        PRExportImportWidget
>        PRFileSettings
>        PUGroupsWidget
>        PRKernelSettings
>        PRPersistencySettings
>        PRSystemWidget
>        PUUsersWidget
>        PUSecurityWidget
>
> The second file contains a few patches to the Pier code, to get a 'Close'
> button while remaining fully compatible with the current behavior.
>
> If you find this useful, please don't hesitate to integrate it as you would
> find it better fitting into Pier (specifically, I don't like my patches to
> get the close button, but this was the most straitforward way to get it
> working).
>
> Regards,
> Reza
>
>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



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

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

Re: Widget to Command adaptor

Reza Razavi
At 15:22 18/02/2010, Lukas Renggli wrote:
>You can post them directly to my repository

Well noted; thanks for the precision!

I just uploaded a Monticello package to your Pier2 repo. It contains
the code for the first .st file sent previously, and some comments on
how to get easily the 'Close' button (code contained in the 2nd .st
file sent previously).

Please don't hesitate to remove it (and the future posts) once you
have looked at it.

BTW, I assume that you automatically get a notification upon each
upload. If this is not the case, please let me know to send then an email.

Regards,
Reza

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

Re: Widget to Command adaptor

Lukas Renggli
> I just uploaded a Monticello package to your Pier2 repo. It contains the
> code for the first .st file sent previously, and some comments on how to get
> easily the 'Close' button (code contained in the 2nd .st file sent
> previously).

I think that makes a good addition to Pier as an extension. I don't
feel like adding it to Pier-Seasde though, as commands are normally
designed to work on a specific structures. The widgets you wrapped do
work on the complete system though. Also your strategy of wrapping the
widgets into commands makes security sort of fragile.

> Please don't hesitate to remove it (and the future posts) once you have
> looked at it.
>
> BTW, I assume that you automatically get a notification upon each upload. If
> this is not the case, please let me know to send then an email.

Sure, there is a public RSS feed on the repository. Maybe better write
a short mail to the list explaining the change, this is more likely to
get noticed. Sometimes there are so many commits that I simply skip
over the individual ones.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Widget to Command adaptor

Reza Razavi
Hi Lukas,

Thanks for your feedback!

At 22:14 18/02/2010, Lukas Renggli wrote:
>I think that makes a good addition to Pier as an extension.

I understand your choice, and I'd basically do the same. However, let
me emphasize that I decided to develop this as an alternative to
http://localhost:8080/pier/system/management, which is proposed as a
default solution in PRDistribution, since I had two issues with that tool page:
1) 'Save' and 'Cancel' buttons in that page have a somehow
non-standard behavior.
2) To close that page, I only found the following two options:
   (a) close the page
   (b) use the back button

I had an issue with (a) since I simply wanted  to keep using my page.
Option (b) undos your modifications, since Seaside backtracks the state.
  This could be tested easily. For example:
- In "Kernel Settings" just rename the Kernel from "Pier" to "Pier2"
- Push the "Save" button. The kernel is modified and the page title
changes from "Pier" to "Pier2"
- Push the back button (actually twice, in this specific example) to
quite the page. Seaside brings back the previous Kernel named "Pier".

This is obviously not what we wanted. Am I missing something here?

>I don't
>feel like adding it to Pier-Seasde though, as commands are normally
>designed to work on a specific structures.

Yes, this mismatch is in fact a concern, although, the WtC adaptor
refers too to a structure (the dummy PRComponent created by
#widgetHolder, which is not the current structure). But, in my case,
the practical benefit justifies a kind of conceptual compromise.

>The widgets you wrapped do
>work on the complete system though.

You are right. To make this difference explicit, I'm actually making
these widget adaptors available in a separate toolbar, that looks like this:

PRDistribution >> admintoolsPage

         admintoolsPage ifNotNil: [^admintoolsPage].

         adminComp := PRComponent named: 'widget'.
         adminComp
                 componentClass: PRCommandsWidget;
                 write: AAsWidgetAdaptorCommand allSubclasses using:
PRCommandsWidget descriptionCommandClasses.

         admintoolsPage:= (PRPage named: 'admintools')
                 addChild: adminComp;
                 contents: 'Admin tools: +widget+';
                 yourself.

         ^admintoolsPage

This assumes that those widget adaptors are additionally excluded
from #commandsPage.

>Also your strategy of wrapping the
>widgets into commands makes security sort of fragile.

This is an important issue. Could you develop this a little more please?

As far as the current widget adaptor commands are concerned, the
security is the same as the management page: the are only available
to admin users. Additionally, Pier allows reenforcing this policy
quite easily, for example, by attaching specific permissions to the
admintoolsPage proposed above. Won't this suffice?

>Maybe better write
>a short mail to the list explaining the change,

Sure; well noted.

Regards,
Reza

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

Re: Widget to Command adaptor

Reza Razavi
In reply to this post by Lukas Renggli
At 22:14 18/02/2010, you wrote:
>I think that makes a good addition to Pier as an extension.

I just wrapped it with Pier-Setup, and uploaded it to Pier2 repo.
For more details, please see the package comments.
If you don't like it, please feel free to delete the package.

Regards,
Reza

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

Re: Widget to Command adaptor

Lukas Renggli
In reply to this post by Reza Razavi
> I had an issue with (a) since I simply wanted  to keep using my page.
> Option (b) undos your modifications, since Seaside backtracks the state.
>  This could be tested easily. For example:
> - In "Kernel Settings" just rename the Kernel from "Pier" to "Pier2"
> - Push the "Save" button. The kernel is modified and the page title changes
> from "Pier" to "Pier2"
> - Push the back button (actually twice, in this specific example) to quite
> the page. Seaside brings back the previous Kernel named "Pier".
>
> This is obviously not what we wanted. Am I missing something here?

I cannot reproduce that. The name of the kernel is certainly not
backtracked by Seaside.

Did you press 'refresh' to see the change? Just hitting the back
button only shows you the page from the browser cache.

>> The widgets you wrapped do
>> work on the complete system though.
>
> You are right. To make this difference explicit, I'm actually making these
> widget adaptors available in a separate toolbar, that looks like this:
>
> PRDistribution >> admintoolsPage
>
>        admintoolsPage ifNotNil: [^admintoolsPage].
>
>        adminComp := PRComponent named: 'widget'.
>        adminComp
>                componentClass: PRCommandsWidget;
>                write: AAsWidgetAdaptorCommand allSubclasses using:
> PRCommandsWidget descriptionCommandClasses.
>
>        admintoolsPage:= (PRPage named: 'admintools')
>                addChild: adminComp;
>                contents: 'Admin tools: +widget+';
>                yourself.
>
>        ^admintoolsPage
>
> This assumes that those widget adaptors are additionally excluded from
> #commandsPage.

I think the wrappers are conceptually wrong in the way Pier-Setup
creates a default distribution. The wrappers violate the principle of
providing functionality at one place and through one mechanism only.
For example, in my setup I don't see I reason why I would want to be
able to edit the name of the kernel from anywhere.

Maybe there are other setups where that might make sense? That's why I
suggested to package the wrappers separately so that people that want
to use it can load it. And other are not forced to have to deal with a
proliferation of unrelated commands.

>> Also your strategy of wrapping the
>> widgets into commands makes security sort of fragile.
>
> This is an important issue. Could you develop this a little more please?

If anywhere -- on potentially thousands of pages (like in the seaside
book) -- you (accidentally) give the permissions to edit the kernel
name, anybody is able to change it. In the current default setup you
just have to make sure that the system page and its children are
protected.

Lukas


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

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

Re: Widget to Command adaptor

Reza Razavi
Hi Lukas,

Thanks again for your time and precisions!

At 12:23 20/02/2010, Lukas Renggli wrote:
>Did you press 'refresh' to see the change?

No.

>Just hitting the back
>button only shows you the page from the browser cache.

Just double checked it, and you are perfectly right. The new value is
maintained. What I observed when using the back button was the value
cached by the browser.

>Maybe there are other setups where that might make sense?

Sure. For example, for practical reasons, I've preferred replacing
the *management* page with a specific *admin toolbar*, which is
actually only accessible to the *root* (and not users with *admin* rights).

>That's why I
>suggested to package the wrappers separately.

There is some progress in that direction, but some extra work is
necessary. The first package that I posted lacks usage examples. The
2nd package addresses this issue, but patches PRDistribution. Now,
I'm going to sub-class PRDistribution. However, before posting the
final package, would you please tell me your preference for one of
the followings:
1) The warper commands and the new distribution class integrated in
Pier-Setup as package.
2) The warper commands and the new distribution class integrated in a
new package.

I'd prefer the first one to avoid an additional package for a piece
of code that addresses basically the same needs than "Pier-Setup".

>If anywhere -- on potentially thousands of pages (like in the seaside
>book)

That's an interesting use case indeed. Would it be possible to
communicate more precisely the number of Pier structures that
contains Seaside book (just curious)?

>  -- you (accidentally) give the permissions to edit the kernel
>name, anybody is able to change it. In the current default setup you
>just have to make sure that the system page and its children are
>protected.

Well noted; thanks for the precision. In my current experimental
distribution, I've addressed this issue as follows:
1) Added a "root" user (called *master*), and
2) Overridden PRCommand class >> #valideIn: for wrapper widgets to
return true only if the current user is master (and not superusers).

Regards,
Reza

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

Re: Widget to Command adaptor

Lukas Renggli
>> Maybe there are other setups where that might make sense?
>
> Sure. For example, for practical reasons, I've preferred replacing the
> *management* page with a specific *admin toolbar*, which is actually only
> accessible to the *root* (and not users with *admin* rights).

That's not how the one-click images are setup, thus I would prefer if
you created your own package.

>> If anywhere -- on potentially thousands of pages (like in the seaside
>> book)
>
> That's an interesting use case indeed. Would it be possible to communicate
> more precisely the number of Pier structures that contains Seaside book
> (just curious)?

Not that many, only 673.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Widget to Command adaptor

Reza Razavi
At 21:14 20/02/2010, you wrote:
>That's not how the one-click images are setup, thus I would prefer if
>you created your own package.

I just uploaded AAS-Pier-Widget Adaptors that:
- Adds a new *system administration* toolbar, which contains the
*widget adaptor commands*, and is only accessible to the *master* user.
- Moves all toolbars to the top of the page (instead of the bottom).
- Patches Pier code to add a Close button to system administration widgets.

May I ask you please to remove from your repository the deprecated
"AAS- Pier Commands-Widget Adaptors".

>673.

Great work; thanks for the information.
Regards,
Reza

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