Need to dynamically change milonic "style" after d

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
bjminihan
Beginner
Beginner
Posts: 4
Joined: Tue Jun 14, 2005 9:06 pm

Need to dynamically change milonic "style" after d

Post by bjminihan »

Hallo,

We're implementing Milonic for our intranet site (thus, no samples, sorry)...and I've gotten pretty far with it...

The problem is that I need to be able to change the "style=" property for a single menu on a page and all of its submenus, after the menu as already been built.

Each menu is being built and rendered on the page by way of "gadgets" in the Plumtree portal environment. All of the menu details are stored in the gadget's database and built when the page loads.

The problem is that the gadget, while building the milonic menu data to put into the page, doesn't know which side of the page it's on. We want to have menus on the right side of the page display in "rtl" mode, while menus on the left side of the page display in regular mode.

Since I don't know where (on the page) I am, and can't detect it via server side code, I have to build every menu in the default openstyle format.

That leaves me with the problem I have - after the menu is build and displayed in the page, I need to change its style and its submenus style properties to something else, so they'll render in "rtl" mode.

Example:

with (milonic=new menuname("ABC Testing Menu")) {
alwaysvisible=1;
position="relative";
menuwidth="100%";
orientation="vertical";
style=menuStyle_mainstyle13;
aI("text=What's New and What's going on in the world;image=http://localhost:8080/custom/icons/mnu_pdf.g

I want to change the above bold line to:
style=menuRTLStyle_mainstyle13;

I already figured out (by reading tons of archive notes) how to change the openstyle property, but I really need to change the subimage source, as well.

Can anyone help?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

Are you using the changeMenuProperty, or changeItemProperty functions to do the change in the openstyle? If you are you should be able to use the same function to change the subimage.

Ruth
bjminihan
Beginner
Beginner
Posts: 4
Joined: Tue Jun 14, 2005 9:06 pm

Post by bjminihan »

I'm using changeMenuProperty, but it didn't seem very pleased when I tried to send in a new milonic menu object for "style"...

Here's my function:

function mm_changeMenuProperty(menuName, propertyRef, newValue) {
var menuNum = getMenuByName(menuName);
_m[menuNum][propertyRef] = newValue;
document.write("new prop = " + _m[menuNum][propertyRef] + "<br>");
BDMenu(menuNum);
}


function setRTLMenu(sMenus) {
var sGID = "<%=GID%>";
if (!_eit_mnu3_isLM2(parseInt(sGID)) && sMenus.length > 0)
{
// render as right-to-left menu
document.write ("this is a right-hand menu - " + sGID + "<br>");

var aMenus = sMenus.split(",");
for (var i=0; i< aMenus.length; i++)
{
mm_changeMenuProperty(aMenus, 11, "rtl");
mm_changeMenuProperty(aMenus, 6, menuRTLStyle);
}
}
}

I tried changing property 6 with "menuRTLStyle" in quotes but neither method worked. I didn't get an error, but I could no longer click the main menu items to view the submenus.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

Style is one of the properties that you cannot change using the function. There is another function that you can use to change item properties, I think you could use that to change the subimage, which isn't a menu propery, so I don't think you can use the changeMenuProperty function for that.

Here is the demo for the changeItemProperty() which has a more indepth explanation, and here is the main one BUT you won't be able to actually use the demo to see it work. There is a little bug in 5.726 which is fixed in 5.727 when it comes out. Anyway, the demo page does have all the info on using the function.

I don't know if you can incorporate this into your 'gadget' like you did the other one. I am not a function person, so I can't really help even though I understand, after reading the explanations, what it's doing, I have no idea how it's doing it :( Other than this, I don't know what to suggest.

If this is a purchased license, you might contact Milonic about the issue. You should have addresses to contact them. I'm sorry I can't be more help.

Ruth
bjminihan
Beginner
Beginner
Posts: 4
Joined: Tue Jun 14, 2005 9:06 pm

Thanks!

Post by bjminihan »

I kind of figured it wasn't going to be possible, without some in-depth knowledge of how style objects are assigned. I'd look into the source code if I had the time...

Oh well...thanks for the tip on contacting support. Hadn't even thought to try that yet =]

If I figure something out I'll try to repost to my note so others can benefit =]
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I take it you can't use the changeItemProperty() to do what you want, but I did have another thought. If you used something other than an arrow it wouldn't matter the openstyle direction. There are a lot of Milonic created images here. The ones that came to mind are here These are a lot of different shapes, squares, circles etc. I have used them on some demos which have an option to click and change the menu from vertical to horizontal. That meant I didn't have to mess with coding the images in the function or uploading twice the number of images.

Ruth
bjminihan
Beginner
Beginner
Posts: 4
Joined: Tue Jun 14, 2005 9:06 pm

Good point...

Post by bjminihan »

...but =]


The menu I'm building is version 3 of an existing system. Milonic is replacing the render portion of the menu, but the admin and user expectations are that the menus will still behave identically to the older versions (with several new features, care of Milonic).

Also, in usability testing these menus, most participants felt the arrow was important for indicating in which direction the menus would open...

Good idea tho =].

My fallback plan is to provide a preference in our menu builder system. If the user puts the "gadget" on the right side of the page, he would say (via preference) "This menu should open to the [left]", and it will then build the menu appropriately. I'd rather do it automatically, but if it really can't be done (somewhat painlessly), guess it'll have to do...
BigWebGuy
Advanced
Advanced
Posts: 15
Joined: Wed Apr 27, 2005 5:05 pm

Post by BigWebGuy »

bjminihan, i had the same issue a while ago.

see thread: http://milonic.com/forum/viewtopic.php? ... highlight=

Andy chimed in and pointed me to this function he wrote to change the style, it works on the demo link provided http://milonic.com/mm_changestyle.php but i havent been able to get it to work properly on my site. unfortunately i havent been able to troubleshoot my implementation very much as i have been pulled off that project for a bit, but let us know if you get it working on your site. hopefully i will get a chance to get mine working too.

it can be done!

cheers.
lee
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

BJ, please see if you can get at least a test page posted so we can get a better look at what's happening.
John
Post Reply