I m currently working on some sort of advanced teamroom project. We want to set up document locking.
Now if user A and B open an unlocked document, and then user A edits it (which locks document), when user B clicks edit, he should get a warning message and be unable to edit document.
i tried to use xp:confirm to make sure user B would get a warning message and would be unable to edit document till usera A has unlocked it.
here is my edit button :
<xp:link id=“btnViewEdit” value=“javascript:;”
disableTheme=“true” style=“disabled:true;”>
xp:this.styleClass<![CDATA[#{javascript:
if(docsViewDoc_lockCanEditDoc()){
return "button";
} else {
return "disabledbutton";
}
}]]></xp:this.styleClass>
<xp:label value=“Modifier” />
<xp:eventHandler event=“onclick” submit=“true”
refreshMode=“partial” refreshId=“docsContent”>
xp:this.script<![CDATA[#{javascript:
if(docsViewDoc_lockCanEditDoc()){
action_docsEditDoc(docsViewDoc_getCurrentDocumentId());
}
}]]></xp:this.script>
</xp:executeScript>
xp:this.message<![CDATA[#{javascript:
if(docsViewDoc_lockCanEditDoc()){
return null;
} else {
return “document is locked. you cannot edit it”
}
}]]></xp:this.message>
</xp:confirm>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:link>
i experience the following :
if document is locked, and user opens doc and click edits => it works. i manage to get warning message and to prevent document edition by second user
if user A and user B open document, user A locks, user B clicks edit => it works. user B gets a warning message and is prevented to edit
if user A locks document, user B opens document, user A unlocks document, when user B clicks edit => he still gets a warning message, but if he clicks ok, action is executed, and he is redirected to document edition.
Looks like xp:confirm is triggered sometimes when it should not. Is this a bug? Any hint on how i could manage warning message because document is locked?
Thanks in advance.