[ic] Need help with ic tags, creating dynamic javascript menus

Jason Balicki interchange-users@interchange.redhat.com
Sun Dec 16 18:30:00 2001


Hi all,

I'm attempting to modify the foundation catalog, specificaly the
"category_vertical" component to display menus containing product
categories when you click on the product area.

Aside from it not working in IE (any tips would be helpful...)
I'm having a little trouble understanding what IC tags I need to
use to get the output I want.

I'm using Gary Smiths' menu.js
(available from
developer.netscape.com/viewsource/smith_menu2/smith_menu2.html)
library to create the menus.  I need to call the function:

myMenu2.addMenuItem("category", "location='http://path/to/IC data'");

which I'm doing with the following code:

myMenu[box-exec bar_link]sel[/box-exec].addMenuItem("[box-exec
bar_link]cat[/box-exec]", "location='[cat-exec]name[/cat-exec]'");

Which is inside of a [LOOP] in category_vertical.  Of course, you're
looking at that and saying "That's wrong".  You're correct. :)

How can I get the category name into the first paramater, and the
url (without the a href= tags) into the second?  Which tag should
I be using here?  And is what I'm trying to do somehow inherently
dumb?

Please be gentle, I'm a network engineer, not a web developer. :)

Thanks in advance,

--J(K)

Here's the code I've currently got for category_vertical:
(menu.js is included in the page in the LEFTRIGHT_TOP template)

[comment]
ui_component: category_vertical
ui_component_type: vertical
ui_component_group: Navigation
ui_component_label: Vertical category list

page_class:
        label: Page class
        widget: select
        lookup: which_page
        db: area
        help: Defines which sets of items should be displayed
        advanced: 1

set_selector:
        label: Page area selector
        widget: select
        db: area
        lookup: sel
        help: Defines which sets of items should be displayed
        advanced: 1

timed:

        label: Use timed build
        widget: select
        help: Makes more efficient for large/busy catalogs
        options: 0=No, 5=5 minutes, 10=10 minutes, 20=20 minutes, 60=60
minutes, 1440=Daily
        advanced: 1
[/comment]

<tr><td align="left" class="categorybar">
  <br>
  <table width="90%" align="center">

<!-- BEGIN COMPONENT [control component category_vertical] -->
[timed-build auto=1 if="[control timed 0]" minutes="[control timed 0]"]
[set found_cat][/set]

[loop
        prefix=box
        search="
                fi=area
                st=db
                tf=sort
                ac=0
                ac=0
                co=yes

                sf=sel
                op=eq
                se=[control set_selector left]

                sf=which_page
                op=rm
                se=[control page_class all|@@MV_PAGE@@]
"]
<SCRIPT  LANGUAGE = "JavaScript1.2">
<!--
   var myMenu[box-exec bar_link]sel[/box-exec] = new Menu();
[set found_cat]1[/set]
[loop prefix=cat
        search="
                fi=cat
                st=db
                tf=sort
                tf=name
                rf=code,name
                sf=sel
                se=[box-code]
        "
        ]
<!-- This is where I'm stumped.... -->
    myMenu[box-exec bar_link]sel[/box-exec].addMenuItem("[item-field
category]", "location='[cat-exec]name[/cat-exec]'");[/loop]

    myMenu[box-exec bar_link]sel[/box-exec].fontSize = 18;
    myMenu[box-exec bar_link]sel[/box-exec].fontWeight = "Bold";
    myMenu[box-exec bar_link]sel[/box-exec].fontColor = "white";
    myMenu[box-exec bar_link]sel[/box-exec].bgColor = "#191CA6";
    myMenu[box-exec bar_link]sel[/box-exec].menuItemBgColor = "#191CA6";
    myMenu[box-exec bar_link]sel[/box-exec].menuHiliteBgColor =
"#000084";
    myMenu[box-exec bar_link]sel[/box-exec].menuItemHeight = 25;

    myMenu[box-exec bar_link]sel[/box-exec].writeMenus();
//-->
</SCRIPT>

  <tr>
    <td valign="top" class="categorybar">
<b>
<a href=
"javascript:window.showMenu(window.myMenu[box-exec
bar_link]sel[/box-exec]);" CLASS="barlink">
[box-exec bar_link]area[/box-exec]</a></b>
    </td>
  </tr>
[/loop]
[if !scratch found_cat]
        <tr>
                <td class="categorybar">
[loop
    search="
        ra=yes
        tf=description
    "
    ]
      &nbsp;&nbsp;[page [loop-code]][loop-field description][/page]<BR>
[/loop]
          </td>
        </tr>
[/if]
[/timed-build]

  </table>
  <br>
</td></tr>

<!-- END COMPONENT [control component category_vertical] -->