Hi,
Below you find a
patch that fixes bug 6588 in Wizard.java.
Index:
Wizard.java
===================================================================
RCS file: /var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard/Wizard.java,v
retrieving revision 1.134
diff -r1.134 Wizard.java
1008c1008,1010
< Utils.setAttribute(field, "maywrite", Utils.selectSingleNodeText(dataContext, "object/@maywrite", "true"));
---
> String fieldContextXPath = xpath.substring(0, xpath.contains("/") ? xpath.lastIndexOf('/') : 0);
> String mayWriteXPath = "".equals(fieldContextXPath) ? "@maywrite" : fieldContextXPath + "/@maywrite";
> Utils.setAttribute(field, "maywrite", Utils.selectSingleNodeText(dataContext, mayWriteXPath, "true"));
===================================================================
RCS file: /var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard/Wizard.java,v
retrieving revision 1.134
diff -r1.134 Wizard.java
1008c1008,1010
< Utils.setAttribute(field, "maywrite", Utils.selectSingleNodeText(dataContext, "object/@maywrite", "true"));
---
> String fieldContextXPath = xpath.substring(0, xpath.contains("/") ? xpath.lastIndexOf('/') : 0);
> String mayWriteXPath = "".equals(fieldContextXPath) ? "@maywrite" : fieldContextXPath + "/@maywrite";
> Utils.setAttribute(field, "maywrite", Utils.selectSingleNodeText(dataContext, mayWriteXPath, "true"));
A little explanation
is in place here, but most information is already given in the bugnotes for bug
6588. The patch fixes setting incorrect maywrite attribute values on fields
inside edit wizards. This can go wrong in some cases, leading to either
unwriteable fields where they should be writeable and vice versa.
The trick
is correct determination of the location for the maywrite attribute. Before the
patch, this location was fixed to object/@maywrite. However, this fails in a
number of cases.
The location for the
maywrite attribute must always be relative to the location of the field
(variable xpath). E.g., if xpath = "[EMAIL PROTECTED]'title']", the maywrite
attribute is not found at object/@maywrite, but at @maywrite. If xpath
= "object/[EMAIL PROTECTED]'title']", the maywrite attribute is found at object/@maywrite. In case of more elaborate
fdatapath expressions inside your wizard definition, this will also
hold.
In case of
questions, please e-mail me.
Regards,
Ronald
Wildenberg.
-----------------------Disclaimer-------------------------
Dit bericht (met bijlagen) is met grote zorgvuldigheid samengesteld. Voor mogelijke onjuistheid en/of onvolledigheid van de hierin verstrekte informatie kan Kennisnet geen aansprakelijkheid aanvaarden, evenmin kunnen aan de inhoud van dit bericht (met bijlagen) rechten worden ontleend. De inhoud van dit bericht (met bijlagen) kan vertrouwelijke informatie bevatten en is uitsluitend bestemd voor de geadresseerde van dit bericht. Indien u niet de beoogde ontvanger van dit bericht bent, verzoekt Kennisnet u dit bericht te verwijderen, eventuele bijlagen niet te openen en wijst Kennisnet u op de onrechtmatigheid van het gebruiken, kopiëren of verspreiden van de inhoud van dit bericht (met bijlagen).
This message (with attachments) is given in good faith. Kennisnet cannot assume any responsibility for the accuracy or reliability of the information contained in this message (with attachments), nor shall the information be construed as constituting any obligation on the part of Kennisnet. The information contained in this message (with attachments) may be confidential or privileged and is only intended for the use of the named addressee. If you are not the intended recipient, you are requested by Kennisnet to delete this message (with attachments) without opening it and you are notified by Kennisnet that any disclosure, copying or distribution of the information contained in this message (with attachments) is strictly prohibited and unlawful.
----------------------------------------------------------
_______________________________________________ Developers mailing list [email protected] http://lists.mmbase.org/mailman/listinfo/developers
