Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 11, 2026

Summary

The Tool Box menu was not visible on submission pages due to two issues:

  1. Missing menuDiv element: JavaScript expected id="menuDiv" for menu initialization
  2. Incompatible rolesAdapter: The struts-menu permissions adapter wasn't working after Spring Security migration

Security Note

Access control is still enforced at the URL level by Spring Security (configured in treebase-security.xml). Removing the menu-level filtering is safe - menus provide navigation while Spring Security blocks unauthorized access.

Original prompt

Logged in users who are submitting data should have access to a 'tool box' that should appear dynamically on, for example, the summary page of a study they are submitting. This tool box should contain buttons that link to actions to updating the citation associated with the study, uploading data, etc.

This menu is no longer visible and I don't know where it went. It is seemingly not being rendered in the JSP. I don't remember if it was being made by JavaScript or JSP. I need a very thorough, comprehensive analysis of what might have happened and how we can bring this back.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

The Tool Box menu in submission pages was not visible because:
1. JavaScript initializeMenus() expects an element with id="menuDiv"
2. The switchMenu() function toggles visibility of "menuDiv"
3. But no element with that id existed in the menu JSP files

Added <div id="menuDiv"> wrapper around the menu:useMenuDisplayer
content in all four affected menu JSP files:
- submissionMenu.jsp
- adminMenu.jsp
- searchMenuRight.jsp
- searchSummaryMenuRight.jsp

Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix rendering issue for dynamic tool box on summary page Fix Tool Box menu not rendering by adding missing menuDiv wrapper Jan 11, 2026
Copilot AI requested a review from rvosa January 11, 2026 14:37
@rvosa
Copy link
Contributor

rvosa commented Jan 11, 2026

@copilot the toggle between the minus and plus gif now works, so renaming the div ID did something - but the menu itself is still empty. This is the HTML that is being rendered in the browser:


<a onclick="switchMenu();" style="cursor: pointer;"><img id="tb" src="../images/minus.gif"/>&nbsp;&nbsp;Tool Box</a>
--
<div id="menuDiv">
<ul class="menuList">
 
 
 
 
 
 
 
 
 
 
 
 
 
</ul>
</div>
<div id="debug"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
initializeMenus();
 
function switchMenu() {
var el = document.getElementById('menuDiv');
var tb = document.getElementById('tb');
if ( el.style.display != "none" ) {
el.style.display = 'none';
tb.src="../images/plus.gif";
}
else {
el.style.display = 'block';
tb.src="../images/minus.gif";
}
}
</script>

<a onclick="switchMenu();" style="cursor: pointer;"><img id="tb" src="[../images/minus.gif](http://localhost:8080/treebase-web/images/minus.gif)"/>&nbsp;&nbsp;Tool Box</a>
<div id="menuDiv">
<ul class="menuList">


	
	
	
	
    
    
    
    
    
         
        
 </ul>
</div>
 <div id="debug"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
    initializeMenus();

    function switchMenu() {
        var el = document.getElementById('menuDiv');
        var tb = document.getElementById('tb');
        if ( el.style.display != "none" ) {
            el.style.display = 'none';
            tb.src="../images/plus.gif";
                    }
        else {
            el.style.display = 'block';
            tb.src="../images/minus.gif";
                   }
    }
</script>

As you can see, the expected menu items aren't there. So there is something going wrong on the server side. I need you to analyze carefully and comprehensively what that might be. It is NOT in the JavaScript.

…sion

The menu items were not rendering because the struts-menu library's
`permissions="rolesAdapter"` attribute was not working after the
migration from Acegi Security to Spring Security 5.8.15.

The RolesPermissionsAdapter in struts-menu relied on Struts integration
which is no longer present. Since Spring Security already handles
URL-level access control (e.g., /user/** requires User,Admin,Associate
Editor roles), the menu-level permission filtering is redundant.

Removed the `permissions="rolesAdapter"` attribute from:
- submissionMenu.jsp
- adminMenu.jsp
- searchMenuRight.jsp
- searchSummaryMenuRight.jsp

Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 11, 2026

@copilot the toggle between the minus and plus gif now works, so renaming the div ID did something - but the menu itself is still empty. This is the HTML that is being rendered in the browser:

...

You're correct - this is related to the Struts/Spring Security upgrades. The permissions="rolesAdapter" attribute in struts-menu was causing menu items to not render because the RolesPermissionsAdapter relied on Struts integration that's no longer present after migrating to Spring Security 5.8.15.

I've removed the permissions="rolesAdapter" attribute from all four menu JSP files in commit 3a8ec30. This is safe because Spring Security already handles access control at the URL level (e.g., /user/** requires User,Admin,Associate Editor roles) - the menus just provide navigation while Spring Security blocks unauthorized access attempts.

@rvosa rvosa marked this pull request as ready for review January 11, 2026 16:50
@rvosa rvosa merged commit a2d2b81 into master Jan 11, 2026
@rvosa rvosa deleted the copilot/debug-tool-box-rendering branch January 11, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants