I'm trying to create a value link that can display a single command inside a document. But I struggled to create a proper link for the command. This seems only possible if you have a pier context and renderer at the same time which is not really the case as long as you are staying inside PRValueLink.
The only solution I could come up with is the following: PRValueLink>>commandIn: aContext <value: 'command' comment: 'Display command as link'> (PRCommand withAllConcreteClasses detect: [ :each | each label = (self parameterAt: 'label' ) ] ifNone: [ ^ nil ]) ifNotNilDo: [ :commandClass | ^ [ :html | html anchor goto: (aContext command: commandClass new); with: commandClass label]]. ^ nil I have the impression there might be a solution without using a block. Any ideas? Or is it ok the way it is? thanks, Norbert _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Actually this is already implemented, for example:
*value:structure|link|command=Remove* Also works with all other value-links that list or return structures, e.g. children, references, parent, previous, random, siblings, find, ... Lukas On 8 October 2010 11:27, Norbert Hartl <[hidden email]> wrote: > I'm trying to create a value link that can display a single command inside a document. But I struggled to create a proper link for the command. This seems only possible if you have a pier context and renderer at the same time which is not really the case as long as you are staying inside PRValueLink. > > The only solution I could come up with is the following: > > PRValueLink>>commandIn: aContext > <value: 'command' comment: 'Display command as link'> > (PRCommand withAllConcreteClasses > detect: [ :each | each label = (self parameterAt: 'label' ) ] > ifNone: [ ^ nil ]) > ifNotNilDo: [ :commandClass | > ^ [ :html | > html anchor > goto: (aContext command: commandClass new); > with: commandClass label]]. > ^ nil > > I have the impression there might be a solution without using a block. Any ideas? Or is it ok the way it is? > > thanks, > > Norbert > > > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
And in fact you don't need to use a value link for triggering a
command, a normal link with the command parameter is enough: */some/page/to/edit|command=Edit* Note that in both cases this goes through the security system. Lukas On 8 October 2010 11:36, Lukas Renggli <[hidden email]> wrote: > Actually this is already implemented, for example: > > *value:structure|link|command=Remove* > > Also works with all other value-links that list or return structures, > e.g. children, references, parent, previous, random, siblings, find, > ... > > Lukas > > On 8 October 2010 11:27, Norbert Hartl <[hidden email]> wrote: >> I'm trying to create a value link that can display a single command inside a document. But I struggled to create a proper link for the command. This seems only possible if you have a pier context and renderer at the same time which is not really the case as long as you are staying inside PRValueLink. >> >> The only solution I could come up with is the following: >> >> PRValueLink>>commandIn: aContext >> <value: 'command' comment: 'Display command as link'> >> (PRCommand withAllConcreteClasses >> detect: [ :each | each label = (self parameterAt: 'label' ) ] >> ifNone: [ ^ nil ]) >> ifNotNilDo: [ :commandClass | >> ^ [ :html | >> html anchor >> goto: (aContext command: commandClass new); >> with: commandClass label]]. >> ^ nil >> >> I have the impression there might be a solution without using a block. Any ideas? Or is it ok the way it is? >> >> thanks, >> >> Norbert >> >> >> _______________________________________________ >> Magritte, Pier and Related Tools ... >> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >> > > > > -- > Lukas Renggli > www.lukas-renggli.ch > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 08.10.2010, at 11:38, Lukas Renggli wrote: Ok, everytime I think I have a useful idea it is already there and better implemented :) It is nice that I can do it either one or the other way. But the link text is always the title of the target structure. I need the link label to be displayed. In the second approach can do it manually with *Label>/some...* (does not work with the first approach *Label>value:...*. Is there a way to display the link label? thanks, norbert
_______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
> label to be displayed. In the second approach can do it manually with
> *Label>/some...* (does not work with the first approach *Label>value:...*. > Is there a way to display the link label? ValueLinks only display the label when they are undefined. Otherwise they display the default string of the target (e.g. the title) or whatever display parameter (this is the name of a description on the object) is set. Lukas -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 08.10.2010, at 13:42, Lukas Renggli wrote: >> label to be displayed. In the second approach can do it manually with >> *Label>/some...* (does not work with the first approach *Label>value:...*. >> Is there a way to display the link label? > > ValueLinks only display the label when they are undefined. Otherwise > they display the default string of the target (e.g. the title) or > whatever display parameter (this is the name of a description on the > object) is set. The first sentence I don't get. I understand the default behaviour (title) and the display attribute the choses a selector. But all of this is happening on the structure. I want to have the label from the command that is being used. Compare it to PRCommandWidget it displays the labels of all available commands. I want to have to same as value link. thanks, Norbert _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 10/8/10 5:22 AM, Norbert Hartl wrote:
> On 08.10.2010, at 13:42, Lukas Renggli wrote: > >>> label to be displayed. In the second approach can do it manually with >>> *Label>/some...* (does not work with the first approach *Label>value:...*. >>> Is there a way to display the link label? >> ValueLinks only display the label when they are undefined. Otherwise >> they display the default string of the target (e.g. the title) or >> whatever display parameter (this is the name of a description on the >> object) is set. > The first sentence I don't get. I understand the default behaviour (title) and the display attribute the choses a selector. But all of this is happening on the structure. I want to have the label from the command that is being used. Compare it to PRCommandWidget it displays the labels of all available commands. I want to have to same as value link. > +value:commands+ displays all the available value links because it displays all selectors of methods that have the proper <pragma> in them. You're talking about displaying the options available for a specific value link and there's no built-in mechanism for that. You'd have to provide it yourself. You could request all parameters for +value:xxx+ that was passed to the >>xxxIn:contents method, but that would only give you the parameters/commands that are specified in the text of the link. If you want to provide a list of all possible options, you'll have to define one yourself: +value:myValueLink|command=displayAll+ and from inside method >>myValueLink:contents, you'd return a list of all the options you defined within >>myValueLink:contents. Lawson _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 08.10.2010, at 14:37, Lawson English wrote:
Wow, I think I didn't understand a single bit of what you trying to say :) Probably it just does not make any sense what I'm saying. Again. I have a custom command that creates a special kind of page for me. The command is displayed in the footer along the other pier commands. What I really want to do: I just want to have an easy way to display this single command anywhere on a page. With displaying I mean creating a link that when pressed executes the command. Norbert _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
With
Name: Pier-Model-lr.390 Author: lr Time: 8 October 2010, 2:51:59 pm UUID: b4990979-0e1b-4e68-97c6-eb316ec0e065 Ancestors: Pier-Model-DamienCassou.389 - return the display string of value links you can do *value:structure|link|command=Remove|display=Remove Me* where the parameter 'display' is the name of a description on the structure (as previously), or an arbitrary string that is returned otherwise (newly added). Ok this is not as nice as it could be, but if I find some more time it might get extended. I imagine something like ... Remove %{title} where title would be a parameter of the structure. Lukas On 8 October 2010 14:50, Norbert Hartl <[hidden email]> wrote: > > On 08.10.2010, at 14:37, Lawson English wrote: > > On 10/8/10 5:22 AM, Norbert Hartl wrote: > > On 08.10.2010, at 13:42, Lukas Renggli wrote: > > label to be displayed. In the second approach can do it manually with > > *Label>/some...* (does not work with the first approach *Label>value:...*. > > Is there a way to display the link label? > > ValueLinks only display the label when they are undefined. Otherwise > > they display the default string of the target (e.g. the title) or > > whatever display parameter (this is the name of a description on the > > object) is set. > > The first sentence I don't get. I understand the default behaviour (title) > and the display attribute the choses a selector. But all of this is > happening on the structure. I want to have the label from the command that > is being used. Compare it to PRCommandWidget it displays the labels of all > available commands. I want to have to same as value link. > > > +value:commands+ displays all the available value links because it displays > all selectors of methods that have the proper <pragma> in them. You're > talking about displaying the options available for a specific value link and > there's no built-in mechanism for that. You'd have to provide it yourself. > You could request all parameters for +value:xxx+ that was passed to the >>>xxxIn:contents method, but that would only give you the > parameters/commands that are specified in the text of the link. If you want > to provide a list of all possible options, you'll have to define one > yourself: > > +value:myValueLink|command=displayAll+ and from inside method >>>myValueLink:contents, you'd return a list of all the options you defined > within >>myValueLink:contents. > > Wow, I think I didn't understand a single bit of what you trying to say :) > Probably it just does not make any sense what I'm saying. > Again. I have a custom command that creates a special kind of page for me. > The command is displayed in the footer along the other pier commands. What I > really want to do: I just want to have an easy way to display this single > command anywhere on a page. With displaying I mean creating a link that when > pressed executes the command. > Norbert > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Name: Pier-Model-lr.391
Author: lr Time: 8 October 2010, 3:19:12 pm UUID: ec6a7b61-a129-4fe1-b7dc-1a195b43da2c Ancestors: Pier-Model-lr.390 - added the possibility to format value links like *value:contents|link|command=Remove|display=Remove '{title}' owned by {owner}* On 8 October 2010 14:54, Lukas Renggli <[hidden email]> wrote: > With > > Name: Pier-Model-lr.390 > Author: lr > Time: 8 October 2010, 2:51:59 pm > UUID: b4990979-0e1b-4e68-97c6-eb316ec0e065 > Ancestors: Pier-Model-DamienCassou.389 > > - return the display string of value links > > you can do > > *value:structure|link|command=Remove|display=Remove Me* > > where the parameter 'display' is the name of a description on the > structure (as previously), or an arbitrary string that is returned > otherwise (newly added). Ok this is not as nice as it could be, but if > I find some more time it might get extended. I imagine something like > ... > > Remove %{title} > > where title would be a parameter of the structure. > > Lukas > > On 8 October 2010 14:50, Norbert Hartl <[hidden email]> wrote: >> >> On 08.10.2010, at 14:37, Lawson English wrote: >> >> On 10/8/10 5:22 AM, Norbert Hartl wrote: >> >> On 08.10.2010, at 13:42, Lukas Renggli wrote: >> >> label to be displayed. In the second approach can do it manually with >> >> *Label>/some...* (does not work with the first approach *Label>value:...*. >> >> Is there a way to display the link label? >> >> ValueLinks only display the label when they are undefined. Otherwise >> >> they display the default string of the target (e.g. the title) or >> >> whatever display parameter (this is the name of a description on the >> >> object) is set. >> >> The first sentence I don't get. I understand the default behaviour (title) >> and the display attribute the choses a selector. But all of this is >> happening on the structure. I want to have the label from the command that >> is being used. Compare it to PRCommandWidget it displays the labels of all >> available commands. I want to have to same as value link. >> >> >> +value:commands+ displays all the available value links because it displays >> all selectors of methods that have the proper <pragma> in them. You're >> talking about displaying the options available for a specific value link and >> there's no built-in mechanism for that. You'd have to provide it yourself. >> You could request all parameters for +value:xxx+ that was passed to the >>>>xxxIn:contents method, but that would only give you the >> parameters/commands that are specified in the text of the link. If you want >> to provide a list of all possible options, you'll have to define one >> yourself: >> >> +value:myValueLink|command=displayAll+ and from inside method >>>>myValueLink:contents, you'd return a list of all the options you defined >> within >>myValueLink:contents. >> >> Wow, I think I didn't understand a single bit of what you trying to say :) >> Probably it just does not make any sense what I'm saying. >> Again. I have a custom command that creates a special kind of page for me. >> The command is displayed in the footer along the other pier commands. What I >> really want to do: I just want to have an easy way to display this single >> command anywhere on a page. With displaying I mean creating a link that when >> pressed executes the command. >> Norbert >> _______________________________________________ >> Magritte, Pier and Related Tools ... >> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >> > > > > -- > Lukas Renggli > www.lukas-renggli.ch > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 08.10.2010, at 15:24, Lukas Renggli wrote: > Name: Pier-Model-lr.391 > Author: lr > Time: 8 October 2010, 3:19:12 pm > UUID: ec6a7b61-a129-4fe1-b7dc-1a195b43da2c > Ancestors: Pier-Model-lr.390 > > - added the possibility to format value links like > *value:contents|link|command=Remove|display=Remove '{title}' owned by > {owner}* > Norbert > On 8 October 2010 14:54, Lukas Renggli <[hidden email]> wrote: >> With >> >> Name: Pier-Model-lr.390 >> Author: lr >> Time: 8 October 2010, 2:51:59 pm >> UUID: b4990979-0e1b-4e68-97c6-eb316ec0e065 >> Ancestors: Pier-Model-DamienCassou.389 >> >> - return the display string of value links >> >> you can do >> >> *value:structure|link|command=Remove|display=Remove Me* >> >> where the parameter 'display' is the name of a description on the >> structure (as previously), or an arbitrary string that is returned >> otherwise (newly added). Ok this is not as nice as it could be, but if >> I find some more time it might get extended. I imagine something like >> ... >> >> Remove %{title} >> >> where title would be a parameter of the structure. >> >> Lukas >> >> On 8 October 2010 14:50, Norbert Hartl <[hidden email]> wrote: >>> >>> On 08.10.2010, at 14:37, Lawson English wrote: >>> >>> On 10/8/10 5:22 AM, Norbert Hartl wrote: >>> >>> On 08.10.2010, at 13:42, Lukas Renggli wrote: >>> >>> label to be displayed. In the second approach can do it manually with >>> >>> *Label>/some...* (does not work with the first approach *Label>value:...*. >>> >>> Is there a way to display the link label? >>> >>> ValueLinks only display the label when they are undefined. Otherwise >>> >>> they display the default string of the target (e.g. the title) or >>> >>> whatever display parameter (this is the name of a description on the >>> >>> object) is set. >>> >>> The first sentence I don't get. I understand the default behaviour (title) >>> and the display attribute the choses a selector. But all of this is >>> happening on the structure. I want to have the label from the command that >>> is being used. Compare it to PRCommandWidget it displays the labels of all >>> available commands. I want to have to same as value link. >>> >>> >>> +value:commands+ displays all the available value links because it displays >>> all selectors of methods that have the proper <pragma> in them. You're >>> talking about displaying the options available for a specific value link and >>> there's no built-in mechanism for that. You'd have to provide it yourself. >>> You could request all parameters for +value:xxx+ that was passed to the >>>>> xxxIn:contents method, but that would only give you the >>> parameters/commands that are specified in the text of the link. If you want >>> to provide a list of all possible options, you'll have to define one >>> yourself: >>> >>> +value:myValueLink|command=displayAll+ and from inside method >>>>> myValueLink:contents, you'd return a list of all the options you defined >>> within >>myValueLink:contents. >>> >>> Wow, I think I didn't understand a single bit of what you trying to say :) >>> Probably it just does not make any sense what I'm saying. >>> Again. I have a custom command that creates a special kind of page for me. >>> The command is displayed in the footer along the other pier commands. What I >>> really want to do: I just want to have an easy way to display this single >>> command anywhere on a page. With displaying I mean creating a link that when >>> pressed executes the command. >>> Norbert >>> _______________________________________________ >>> Magritte, Pier and Related Tools ... >>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki >>> >> >> >> >> -- >> Lukas Renggli >> www.lukas-renggli.ch >> > > > > -- > Lukas Renggli > www.lukas-renggli.ch > > _______________________________________________ > 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 |
In reply to this post by Lukas Renggli
On 10/8/10 6:24 AM, Lukas Renggli wrote:
> Name: Pier-Model-lr.391 > Author: lr > Time: 8 October 2010, 3:19:12 pm > UUID: ec6a7b61-a129-4fe1-b7dc-1a195b43da2c > Ancestors: Pier-Model-lr.390 > > - added the possibility to format value links like > *value:contents|link|command=Remove|display=Remove '{title}' owned by > {owner}* Are these options parsed before the xxxIn: method gets to see the parameter list? Lawson _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Yes, link parameters are parsed at the very beginning and put into a
parameter dictionary of the link. Lukas On 8 October 2010 16:30, Lawson English <[hidden email]> wrote: > On 10/8/10 6:24 AM, Lukas Renggli wrote: >> >> Name: Pier-Model-lr.391 >> Author: lr >> Time: 8 October 2010, 3:19:12 pm >> UUID: ec6a7b61-a129-4fe1-b7dc-1a195b43da2c >> Ancestors: Pier-Model-lr.390 >> >> - added the possibility to format value links like >> *value:contents|link|command=Remove|display=Remove '{title}' owned by >> {owner}* > > Are these options parsed before the xxxIn: method gets to see the parameter > list? > > > Lawson > > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On 10/8/10 7:38 AM, Lukas Renggli wrote:
> Yes, link parameters are parsed at the very beginning and put into a > parameter dictionary of the link. > > Lukas So proper use would be: *value:contents|link|command=Remove|display=Remove '{title}' owned by {owner}|mystuff=stuff|morestuff=otherstuff* Assuming that we extended>>contentsIn: in some way... Is there a difference between using '+' and '*' in the context of value links? > On 8 October 2010 16:30, Lawson English<[hidden email]> wrote: >> On 10/8/10 6:24 AM, Lukas Renggli wrote: >>> Name: Pier-Model-lr.391 >>> Author: lr >>> Time: 8 October 2010, 3:19:12 pm >>> UUID: ec6a7b61-a129-4fe1-b7dc-1a195b43da2c >>> Ancestors: Pier-Model-lr.390 >>> >>> - added the possibility to format value links like >>> *value:contents|link|command=Remove|display=Remove '{title}' owned by >>> {owner}* >> Are these options parsed before the xxxIn: method gets to see the parameter >> list? >> >> >> Lawson >> >> _______________________________________________ >> 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 |
> So proper use would be:
> > *value:contents|link|command=Remove|display=Remove '{title}' owned by > {owner}|mystuff=stuff|morestuff=otherstuff* Yes, look at the senders of #hasParameter:, #parameterAt:, #parameterAt:ifAbsent:, #parameterAt:ifPresent:, etc. > Assuming that we extended>>contentsIn: in some way... > > Is there a difference between using '+' and '*' in the context of value > links? In fact the method can ask #isEmbedded to itself to know. This was currently done using the parameter 'embed', but I changed it in the latest version which makes more sense. Lukas -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |