Arbortext Command Language > Callbacks > doc_add_callback > linkuri Callback Type
  
linkuri Callback Type
Function prototype:
function funcname (doc, oid, uri, op)
When linking to a URI, the link command calls linkuri before any link action is taken. This is unlike all other link actions, which call link hooks instead.
Arbortext Editor determines if a link is to a URI when the LinkUriAttr tag is configured in the .dcf file or in a link:href e-i-c characteristic (Link URI/ID in a style panel).
Arguments
doc — Identifier of the current document.
oid — Object identifier representing the current mouse (if link mouse) or caret (if link caret) position.
uri — target URI.
op — Function callback operation. It is called twice in succession:
1. First call: op == 1 confirms the operation is to be attempted. Return arg:
0 — proceed to Execute step
-1 — ignore callback, code should continue as before
2. Second call: (occurs unless the process was stopped in the first step) op == 2 meaning: "go ahead and process request now." Return arg:
0 — code should still handle
-1 — code should skip
The callback function must return -1 if it performs the link action; otherwise it should return 0 to let Arbortext Editor complete its normal processing.
* 
By default, double-clicking the left mouse button is mapped to a function that executes a link command. A link callback function must not interfere with this operation. (That is, if it returns -1, it must perform a link.)
* 
The normal processing for URIs is to check whether or not the URI is an ID contained in the same document, possibly prefixed by the # sign. If it is, Arbortext Editor moves the cursor to that point. No link action occurs in other cases.