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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

customizing "Modify Attributes" with a file-open dialog box

jsulak
1-Newbie

customizing "Modify Attributes" with a file-open dialog box

Hello (again) Adepters,



Another question: We have a few elements with @href attributes. I'd
like users to be able modify them with a "File Open" dialog box instead
of having to type in a file name. The behavior I'm looking for is
similar to what's in the DITA application, where there's a little "..."
button next to the @href blank in the Modify Attributes dialog. I don't
need the resource manager; the usual file_selector() dialog box is fine.




I dug around in the DITA application ACL and saw some promising stuff,
but before I go too deep I wanted to ask if anyone knows a simpler way
to do it.



Thanks,



-James



2 REPLIES 2

Clay recently contributed this to the list:


Hi Dave--



This sounds like a job for the insert_tag_after doc callback. You could put something like this in your instance.acl file:



# code written off the cuff, debugging left as an exercise



function getFileName(doc,tagname,op) {

if ((tagname == "file") && (op == 1)) {

# prompt user for filename

local fname = file_selector(".","xml","SGML Files|*.sgm|XML

Files|*.xml");

if (fname != ") {

modify_attr("href",fname,doc);

}

}

}



doc_add_callback(current_doc(),"insert_tag_after","getFileName")



That should do what you are after. HTH.



--Clay




jsulak
1-Newbie
(To:jsulak)

Thanks, David. I didn't see this; obviously my archive-searching skills need some work. This is close to what I want. The element has attributes other than @href, so I'd like to keep the original modify attributes dialog as well. From what I can tell, the DITA application uses the modify_tag callback to alter the existing XUI "Modify Attributes" dialog on the fly. I'll look into that and post to the list if I get that to work.

Thanks,

-James
Top Tags