Arbortext Command Language > Functions by Alphabetical Listing > oid_entity_lock
  
oid_entity_lock
oid_entity_lock (oid[, resultcode[, showerror[, pos]]])
This function locks a file entity or XML inclusion for editing and calls entitylockhook or includelockhook if appropriate. The function only operates if the given oid at cursor position pos is in a file entity or XML inclusion, and if the entity or inclusion is not stored in a Document Management System (DMS). DMS objects must be checked out according to the user's system administration practices before they can be edited.
If the oid is in an entity or inclusion (or is an entity or inclusion referencing itself) and the entity or inclusion is not stored in a DMS, then the entity or inclusion will be locked for editing. If an entitylockhook is defined it will be called first and the entity or inclusion will be locked only if the hook returns a value of 0. oid_entity_lock returns 0 only if it tries to lock an entity or inclusion and fails. In all other cases this function will return 1.
resultcode, if supplied, must be a variable set to a code indicating the status of the lock operation. The possible values are:
0 — Locked and not refreshed.
1 — The entity or inclusion was locked, but had been modified on disk since it was opened and was reloaded.
2 — The entity or inclusion could not be locked because someone else has it locked.
3 — The entity or inclusion could not be locked because the file it is in is read only.
4 — The entity or inclusion could not be locked for some other reason.
If showError is supplied and non-zero, an error message will be displayed for any failure to lock the include or entity.
pos can be any of the following values:
0 — (The default.) pos is immediately after the start tag identified by oid.
-1pos is immediately before the end tag of the element identified by oid.
-2pos is immediately before the start tag.
-3 — If oid is a start tag, pos is immediately after the end tag. Otherwise, pos is at the end of the object.
Related Topics
entitylockhook
includelockhook