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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Best place for ACL to change Menus

ptc-953343
1-Visitor

Best place for ACL to change Menus

I'm looking for ideas on where to put the ACL to change menus. Right now I
have my script in the custom/init folder and I get the message that the
Help menu doesn't exist and my menu doesn't appear.I can source the same
ACL file once the window opens and everything works - so the code is
correct it is just a matter of where/when the code executes.

So typically I would associate these changes with the DTD so the menu
would be added when I opened a particular document type. Here are the
related problem:

- I'm working with S1000D so there are a dozen DTDs that I want to work with.

- The vendor that provides the DTDs has created their own scheme for
integrating with Arbortext. They don't provide a way to customize their
installation and the installation has to be on eveery users machine, there
is no central installation. For my own machine I could modify the vendors
setup, but don't really want to.

Any suggestions on how to get my customizations in place? right now I only
want them to appear if the S1000D schemas are launched, I suppose
launching for any DTD would be ok.

..dan
4 REPLIES 4

My suggestion (and I do this because trying to associate menu changes
with the instance.acl file of a doctype sometimes causes the custom menu
to disappear when the menus update after a doc is opened) is to use the
menuloadhook.

add_hook('menuloadhook', 'function')

Then you could put this in the custom\init, the hook gets called every
time the menus load, so the menu items will be persistent.

The "function" you attach to this hook would contain your custom menus.
If possible, you may be able test for document type or root element and
make the loading DTD-specific.

Thanks, that did the trick. Like you say, I can add other tests to trigger
the functionality based upon the DTD.

..dan

> My suggestion (and I do this because trying to associate menu changes
> with the instance.acl file of a doctype sometimes causes the custom menu
> to disappear when the menus update after a doc is opened) is to use the
> menuloadhook.
>
> add_hook('menuloadhook', 'function')
>
> Then you could put this in the custom\init, the hook gets called every
> time the menus load, so the menu items will be persistent.
>
> The "function" you attach to this hook would contain your custom menus.
> If possible, you may be able test for document type or root element and
> make the loading DTD-specific.
>

It seems like you could just change the ACL code a little bit to put something like:

if(!menu_exists(".Help"))
{
Your new menu code here
}

> It seems like you could just change the ACL code a little bit to put
> something like:
>
> if(!menu_exists(".Help"))
> {
> Your new menu code here
> }
>

You hit the nail on the head in that the .Help menu does not exist. I
believe that is becasue the init scripts fire long before the window is
fully created (or created at all). I also beleive these init scripts only
fire on launch of Arbortext (could be wrong on that).

Anyway adding the hook took care of the intial problem. So my code and
scripts are still in the Init folder, but the call back actually triggers
the code when the menus are created.

thanks everyone for the help.

..dan
Announcements

Top Tags