Arbortext Command Language > Functions by Alphabetical Listing > doc_read_only
  
doc_read_only
ret=doc_read_only ([docid[, bool]])
This function returns (and optionally sets) the read-only state specified when opening a document. doc_read_only does not report the file permission setting of a file as defined by the operating system, but the value used to open the document. (Documents can be opened as read-only with Open as read-only checked on the Open dialog box and with the function call open(doc, "r"). Documents can also be set to read-only using the function call doc_read_only(doc,1).)
If no parameters are included, doc_read_only returns a boolean value (1 = read-only, 0 = read/write) for the read-only state of the current document. If the docid parameter is provided, doc_read_only returns the read-only state of the specified docid.
If both a docid parameter and a bool parameter are provided, the function returns the read-only state of the specified docid, and then sets the read-only state of the specified document to the boolean value specified in bool (1 = read-only, 0 = read/write).
Note that a standard opening of a read-only file will not cause doc_read_only(doc) to return 1. This is due to the fact that a read-only file on disk may have references (such as XML inclusions and file entities) to other files that are not-read only. doc_read_only(doc) returns 0 for such a read-only root document because there may be parts of the document that can be edited.
Examples:
ret=doc_read_only()
ret=doc_read_only(docid)
ret=doc_read_only(docid,1)
To determine if a given oid can be modified, refer to oid_protected() and oid_find_valid_insert().