cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

oid_read_only() and traversal flags

unknown1
1-Newbie

oid_read_only() and traversal flags

Brown,

If you know how to get the OID of the element that you want
to make read-only, you can protect it using the function
oid_read_only(). There is something missing in the documentation
of this, however: you must also set the children of the element
read-only as well, INCLUDING THE TEXT FRAGMENTS. This requires
a special kind of traversal, using "traversal flags," on the
oid functions.

Here is an example of a function which traverses the contents
of an element and sets all children (and text fragments) to the
read-only status:

# if bool is 1, contents are made read-only; if 0, they're made writable
# if include is 1, node_oid is handled as well as its contents
function subtree_oid_read_only(node_oid, bool=1, include=1) {
local flag = 0x4 | 0x8 | 0x10 | 0x20 | 0x80 | 0x100 | 0x200 | 0x400
# TAG PI CMT ATI ENT TEXT GENTXT ENDTAG
if (include) {
oid_read_only(node_oid,bool)
}
local oid=oid_child(node_oid, 1, flag)
while (oid_valid(oid, flag)) {
if (length(oid_name(oid)) && oid_level(node_oid, oid) <= 0) {
break
}
oid_read_only(oid, bool)
oid = oid_forward(oid, flag)
}
}

Most oid_xxx() functions accept another argument other than those
documented (try it and see). This argument is the traversal flag.

For some detail on the traversal flags, you can peek at some global
variable assignments in the package [epic]/packages/main/_dms.acl.

The oid_modified() function is like oid_read_only(), in that it is
only useful if you use it with text fragment oids, which requires
the use of the traversal flags.

Paul

0 REPLIES 0
Announcements