You could maybe even simplify things a bit...
<table jwcid="@contrib:Table" source="ognl:id, ..." columns="..."
row="ognl:currentRow"/>
<span jwcid="[EMAIL PROTECTED]">
<!-- you could substitute If for base:If if you're using 3.0.x, or
for Conditional i 3.0.x or tp4 -->
<span jwcid="@If" condition="ognl:canDelete(visit.user,currentRow)"
element="ognl:null">
<!-- direct link -->
</span>
<span jwcid="@Else" element="ognl:null">
<!-- plain text -->
</span>
</span>
.java:
public boolean canDelete(User user, MyObject currentRow) {
boolean canDelete=false;
... //custom logic for determining stuff...
return canDelete;
}
Or whatever. The authentication doesn't have to be in the
page/component class, either... you could just as easily do something like:
<span jwcid="@If" condition="ognl:currentRow.userCanDelete(visit.user)"/>
HTH.
Robert
Darío Vasconcelos wrote:
> Oh I see. Maybe you can do this
>
> public boolean getDocOwner() {
> Table table = (Table)
> getRequestCycle().getPage().getNestedComponent("table");
> MyObject obj = (MyObject) table.getTableRow();
> int id = obj.getId();
> // .. determine whether or not this is the doc owner
> // ...
> return docOwner;
> }
>
> don't know if using "table" inside getNestedComponent would be enough,
> though...
>
>
> Dario
>
>
> On 8/19/05, Chris Chiappone <[EMAIL PROTECTED]> wrote:
>
>>I am aware of that but the problem is I need a conditional to either
>>show the link or not depending on the user. Which I can't seem to
>>figure out.
>>
>>On 8/19/05, Darío Vasconcelos <[EMAIL PROTECTED]> wrote:
>>
>>>If the objects in each row aren't too big, you can use
>>>
>>> ognl:components.table.tableRow
>>>
>>>as a parameter for your link, providing that you're using
>>>[EMAIL PROTECTED]:Table as the name of your table.
>>>
>>>I'm pasting this directly from the contrib:Table component reference:
>>>
>>><a jwcid="@DirectLink" listener="ognl:listeners.selectLocale"
>>>parameters="ognl:components.table.tableRow">select</a>
>>>
>>>Since tableRow returns your row object, you can extract the id or any
>>>other fields from there.
>>>
>>>
>>>Hope it helps,
>>>
>>>Dario
>>>
>>>On 8/19/05, Chris Chiappone <[EMAIL PROTECTED]> wrote:
>>>
>>>>I am having difficulty understanding how to show rows differently
>>>>using contrib table.
>>>>
>>>>Lets see if I can describe what I am trying to do. I basically have a
>>>>table with 5 rows. One of the rows is a link to delete the row. The
>>>>thing is only the owner of the document can delete the row. my table
>>>>is set up like this:
>>>>
>>>><table jwcid="[EMAIL PROTECTED]:Table" source="ognl:page.docList"
>>>>columns="type", "title", "desc", "file", "id">
>>>> <span jwcid="@base:If" condition="ognl:docOwner">
>>>> <span jwcid="[EMAIL PROTECTED]'>
>>>> <span jwcid="deleteLink"/>
>>>> </span>
>>>> </span>
>>>></table>
>>>>
>>>>The issues is that docOwner needs to know the value of of the current
>>>>rows 'id' in order to validate its this users document. How would I
>>>>go about doing that?
>>>>
>>>>Thanks.
>>>>
>>>>--
>>>>~chris
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>>
>>>--
>>>I have enough money to last me the rest of my life, unless I buy something.
>>> Jackie Mason
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>>--
>>~chris
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]