On Tue, 29 Aug 2006, David Avendasora wrote:

Steve,

Have you tried putting it in the user.d2wmodel file instead of the d2w.d2wmodel file?

Dave

Yeah. Makes no difference. But if I remove the lhs from the rule, I get the desired result (no edit/delete buttons) - of course, I need to be able to turn that on and off.

Is there any way to intercept the rule firing on code? Subclass D2WContext somehow (doesn't look probable)? Seems this rule is evaluated from D2WUtils in a static method. Phooey.

I'd have to do something grotesque like turning off concurrent request handling and munge the rule array on every appendToResponse.

-sq



On Aug 29, 2006, at 6:41 PM, Steve Quirk wrote:


I'm trying to remove the edit/delete buttons from the UI of a D2W app by using the "readOnlyEntityNames" rule. I'd like to make the result of this to be conditional on a Session method "noEdits()".

I put this rule in my d2w.d2wmodel (using RuleEditor):

     {
           author = 50;
           class = "com.webobjects.directtoweb.Rule";
           lhs = {
               class = com.webobjects.eocontrol.EOKeyComparisonQualifier;
               leftKey = "session.noEdits";
               rightKey = 1;
               selectorName = "isEqualTo";
           };
           rhs = {
               class = "com.webobjects.directtoweb.Assignment";
               keyPath = readOnlyEntityNames;
               value = (User, Group);
           };
       }

This is the *only* rule in this file. FYI, the only rule in user.d2wmodel is
       {
           class = com.webobjects.directtoweb.Rule;
           author = 100;
           rhs = {
               class = com.webobjects.directtoweb.Assignment;
               keyPath = look;
               value = "BasicLook";
           };
       }

D2W.factory().newSignificantKey("session.noEdits") has been added to Application.java

The edit/delete buttons always show however. When tracing the rule firing, I only see the default readOnlyEntityNames rule:

  ****** fire : *true* => readOnly=isEntityReadOnly (-1)
****** fire : *true* => readOnlyEntityNames=() (com.webobjects.foundation.NSMutableArray) (-1)

If I rummage through the D2WModel _rules array at runtime, I can find my rule. If I manually call the fire() method on my rule, I get the expected ("User", "Group") array.

Anyone have any ideas on what I'm doing wrong? Suggestions on how to do this easily? (Editing the rules is pretty much out of the question, this is a boiled down version of an existing app whose rule file is 18000+ lines - but "no code", jeez!!).

Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com

This email sent to [EMAIL PROTECTED]



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to