From: Anjo K. <ak...@pr...> - 2002-07-15 14:07:52
|
Hi Patrice + Max, thank you so much for your quick replies! I was pretty tight on time this weekend on other things and couldn't reply sooner. on 13.07.2002 23:40 Uhr, Patrice Gautier at pa...@ma... wrote: > based on your description, it seems that your scheme should work out of t= he > box when using ERD2WModel from ERDirectToWeb. object.roles.name and > sectionKey should have automatically been detected as a significant key f= or > tabSectionsContents. Strangely enough, tabSectionsContents never show up in the model? I see tha= t there is a class ERDTabSectionsContentsAssignment, but it isn't present in the d2w.d2wModel from ERDirectToWeb. =20 > When you fire your app with D2WTraceRuleFiringEnabled, what does it say t= he > significant keys for tabSectionsContents are? Well, it never shows up, but I'm not using a TabInspectPage anyway - I'm using the normal ERD2WInpectPage. Turns out that the tip from Max was right on spot: > Just a quick reply (have to run in a second). The exact problem > that you are running into is the one that prompted the notion of the > DelayedAssignment, more specifically the delayed conditional assignment. > A delayed assignment will be evaluated every time instead of being > cached. For instance let's say that depending on a user's level you want > to display two different yet similar sets of display property keys. Then > you could write this rule (I know RuleEditor just wasn't designed for > such rules ;): >=20 > pageConfiguration =3D 'ListFoos' =3D> displayPropertyKeys =3D > (er.directtoweb.ERDDelayedBooleanAssignment) > { > conditionKey =3D "object.isAdmin"; > trueValue =3D "(firstName, lastName, specialAdminStuff)"; > falseValue =3D "(firstName, lastName)"; > } There is a bug in the DelayedBooleanAssignment decoder that creates a DelayedKeyValueAssignment instead. Once this is fixed it works just as intended! My solution was to wrap the section repetition in a conditional that checks d2wContext.shouldShowSection and have those two rules: *true* =3D> shouldShowSection =3D 1 [0] =20 (pageConfiguration =3D'EditUser' or pageConfiguration =3D'CreateUser') and sectionKey =3D 'Articles' =3D> shouldShowSection =3D (er.directtoweb.ERDDelayedBooleanAssignment) {conditionKey =3D object.isEditor; falseValue =3D 0; trueValue =3D 1; } [80] So now when I edit a user, when he=B4s an editor, the Articles he is responsible for show up, otherwise not. Brilliant! > One last note, be very careful about adding keys like 'object.roles' to > LHS qualifers. This key will be cached as a sig key for whatever rhs key > you are using (in the above example tabSectionsContents), which means > that the rule system will attempt to evaluate that key for *every* > tabSectionsContents, most likely not what you want. Gotta go .... Thank you so much again! You spared me the pain to create dozens of pageConfigurations and the app can be so much more dynamic this way! Cheers, Anjo |