CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 (Solved) Menu Styling Suddenly Broken

Print topic Send  topic

Author Message
clahti2

Posts: 107
Posted: 01/31/2012, 4:14 PM

Hello all:

I am writing an app in CCS 4.3 and I had a menu in an include page. This worked fine for the past week as I included this in several pages, the menu looked and behaved exactly as expected. Security is implemented with "admin" role and "user" role. Initially only the admin role was allowed to see this menu. I then added another menu along side this, set to the user role for access. Now the menu styling does not seem to work, the menu navigation is there but the font, padding, etc. is broken. I have no idea what happened, so I created a new test project to see if I could replicate the issue. In the test project I created an include page with a sample static menu with no security implemented. I then created a page and included this page. Upon publishing this is broken identically to the original project. If I create a page with a menu defined directly this works and looks as expected. I have compared the code, the resulting html output to the browser, the CSS and JS files, everything looks ok. Any ideas?

View profile  Send private message
datadoit
Posted: 01/31/2012, 5:51 PM

I would recommend putting each menu into it's own includable page, then
dynamically showing/hiding those includes based on your rules.
clahti2

Posts: 107
Posted: 01/31/2012, 6:04 PM

Thanks for your reply, but it seems to be a more fundamental problem. As I stated in my post I created a simple single menu in an include on a completely new project, included this on a sample page and it is broken as well. The only thing that works now is adding a menu directly to a page, but with several hundred pages not using an include would be insane. I suppose I could add a table for the menu items and use this as a work around but the include approach worked just fine until today. I can provide anything needed if a set of eyeballs would help. I am considering installing CCS5 beta but this is a production project I am prototyping to win the contract and I can't lose any development time chasing down beta bugs. By the way I am using an evaluation copy of CCS 4.3, my original license expired some time ago and I was out of the development game for a while. If this project becomes viable then 2 licenses will be purchased in short order.

Any other ideas? As an aside It seems like there has not been a Yes representative posting in the forums for a while now. I would hate to see CCS die from malnutrition and old age, it is a great but probably fairly unknown product. The 20th century look and feel of everything Yes presents to the public via their website and examples does not help one bit unfortunately. Seriously if I did not have previous success with this product several years ago I would never purchase based on what I can see today, but I know the power of the product.

I suppose I will get off my soapbox now LOL :-)
View profile  Send private message
datadoit
Posted: 02/01/2012, 6:51 AM

What happens with menus is that styles are loaded then javascript is
loaded which dynamically adjusts those styles. So with multiple menus
on a page, it gets hairy.

Make certain that your menus have different id's, and that those id's
are loaded correctly. Ex:

//bind_events @1-C8B30F80
function Calendar_Menu_bind_events() {
addEventHandler("Calendar_MenuCalendarMenuContainer", "load",
load_ADxMenu);
addEventHandler("Calendar_MenuMenu1Container", "load", load_ADxMenu);
}
//End bind_events

Also note that with includes, when you add a component that needs to be
bound (such as the above menu samples), then the parent page of that
include also needs to know about the new binding function. So the
parent page example would look like:

//bind_events @1-23AFC82B
function leftcolumn_bind_events() {
if (functionExists("Calendar_Menu_bind_events"))
Calendar_Menu_bind_events();
}

This is where regenerating and publishing the entire project will take
care of this for you, or just simply open the parent page and let the
code regenerate.
clahti2

Posts: 107
Posted: 02/01/2012, 1:01 PM

Yes I verified all the above, the menu id's are unique and the bind events are being called by the parent. I am now working around the problem by creating a single menu which is data driven and adding a groupid filter in the where clause. I will then add a single menu to each page, slightly more tedious but should work. I am in the middle of doing this now and will let you know how this works out. In any case thanks for your help.
View profile  Send private message
datadoit
Posted: 02/01/2012, 1:12 PM

That is generally the best approach - a databased permissions system.

Another alternative is to show/hide individual menu items at runtime,
which requires setting the ItemLink visibility to dynamic. However,
when doing this, everytime the HTML is regenerated it will remove the
ItemLink altogether. It's a known CCS v4 bug. Haven't tested in v5.
clahti2

Posts: 107
Posted: 02/01/2012, 3:02 PM

I fixed this by moving the menu to the database and killing the include. I just copy and past the menu object from a template page onto every page in the system. The only pain is I have to duplicate entries for each role that has common menu items but this is a small irritation. I have this working with menu ordering, filtering by role, etc. and took about an hour to convert everything over. The SQL is something like:

Select * from navmenu where (groupid = {CCGetUserID}) OR (groupid = 0) ORDER BY rootid;

the zero value indicates all roles have access to this menu element. I ultimately have four roles so this seems to work well. Also the rootid value is the zorder of the items, for example given the following records:

menuid,parentid,rootid,title,url,groupid
1,0,1,Top1,,0
2,1,11,Top1 Item 1,top1item1.php,1
2,1,11,Top1 Item 1,top1item1.php,2
2,1,11,Top1 Item 2,top1item1.php,1
5,1,13,Log Out,logout.php,0
6,0,2,Top2,,0
2,1,21,Top2 Item 1,foo.php,1
2,1,21,Top2 Item 1,bar.php,1

roleid ALL will have a Top1 and Top2 menus
roleid 1 will have 2 items under Top1 that roleid 2 does not have
roleid ALL will have Logout under Top1

etc. etc. Let me know if you need more explanation.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.