Betr.: [ic] Menu Editor Exclude On Parameter

J van Dijk 'BV Kunststoffenindustrie Attema' j.vandijk at attema.nl
Wed Apr 7 02:37:38 EDT 2004


<<Sorry, I did not give you all the information:
<<we use a component called 'context_menu' which contains the
following
<<code:
<<(it's not the complete code, but these are the lines needed, if you
<<want, I can mail you the complete component)

<That will be great if you can mail me the code. I will then insert it
in my
<scripts. Also, this would be very useful for other people in the list.
The
<code snip below looks like the code found in the Menu.pm file.

Here's our complete component ('context_menu'):

[comment]
ui_component: context_menu
ui_component_type: vertical
ui_component_group: Navigation
ui_component_label: Context Menu

page_class:
	label: Page class
	widget: select
	options: attema_groep, profiel, werk, installatie, bouw,
sp_products
	help: Defines which set of menu buttons should be displayed

[/comment]

<!-- BEGIN COMPONENT [control component context_menu] -->

[perl tables=faq]
  # Let's see if there are any FAQ's for menu group 'mgroup'
  #
  my $page_class = $CGI->{mgroup} = $Tag->control("page_class");

  my $faqtype = "there_is_a_faq_";
  $faqtype .= $page_class;
  $CGI->{$faqtype} = 0;

  my $db = $Db{faq} or return;

#  my $query = "SELECT code,timed_faq,start_date,finish_date FROM
faq";
#  $query .= " WHERE featured=" . $db->quote($page_class, 'featured');
##  $query .= " LIMIT 1";
#  my $ref = $db->query($query);

  # Process timed Faq's
  #
  my $date = $Tag->time( { body => '%Y%m%d' } );
  my $newquery = "SELECT code FROM faq";
  $newquery   .= " WHERE featured =" . $db->quote($page_class,
'featured'); 
  $newquery   .= " AND lang=" .
$db->quote($Scratch->{mv_locale},'featured'); 
  $newquery   .= " AND (timed_faq<>'1'"; 
  $newquery   .= "         OR ( timed_faq='1'"; 
  $newquery   .= "              AND start_date  <=" . $db->quote($date,
'start_date'); 
  $newquery   .= "              AND finish_date >=" . $db->quote($date,
'finish_date');
  $newquery   .= "  ))";
#  $newquery   .= " LIMIT='1'";

  my $ref = $db->query($newquery);
  $CGI->{$faqtype} = $ref->[0][0] ? 1 : 0;
#return $newquery;
#return $faqtype." : ".$ref->[0][0];



# 15-10-2003: not used anymore
#  for(@$ref) {
#	my $line = $_;
##	my $featured = "there_is_a_faq_";
##	$featured .= $page_class;
#	$CGI->{$faqtype} = 1, last if ! $line->[1];
#	next if $line->[2] gt $date;
#	next if $line->[3] lt $date;
#	$CGI->{$faqtype} = 1;
#	last;
#  }
##  $CGI->{there_is_a_faq} = $ref->[0][0] ? 1 : 0;



  # 15-10-2003: not used anymore
  #
  # Here we check the current locale and 
  # set the cgi variable locale_en_US which
  # we use for excluding certain menu items 
  #
  $CGI->{locale_en_US} = $Scratch->{mv_locale} eq "en_US" ? 1 : 0;
  $CGI->{locale_nl_NL} = $Scratch->{mv_locale} eq "nl_NL" ? 1 : 0;

  return;

[/perl]



<!--
<br>
##CGI mgroup: [cgi mgroup]##<br>
##There is a faq [control page_class]: [cgi
name="there_is_a_faq_[control page_class]"]##<br>
##CGI locale_en_US: [cgi locale_en_US]##<br>
-->

[menu 
        menu-type=simple 
        name=context 
        menu_group=mgroup 
        prefix=menu
        exclude_on=exclude_on
        depends_on=depends_on
        reparse=1
][menu-header][/menu-header]
{PAGE:}
        <b>{NAME?}{NAME}{/NAME?}{NAME:}No name{/NAME:}</b><br>
{/PAGE:}{PAGE?}
<a
        {URL?}target="{URL}"{/URL?}
        href="{HREF}"{DESCRIPTION?}
        title="{DESCRIPTION}"{/DESCRIPTION?}>
{IMG_ICON?}<img name="img{CODE}"
        src="/attema/images/[scratch mv_locale]/{IMG_ICON}"
        onmouseover='this.src="[var IMAGE_DIR 2]/[scratch
mv_locale]/{IMG_DN}"'
        onmouseout='this.src="[var IMAGE_DIR 2]/[scratch
mv_locale]/{IMG_ICON}"'
        {DESCRIPTION?}alt="{DESCRIPTION}" {/DESCRIPTION?}border=0
vspace=5 hspace=2>{/IMG_ICON?}
{IMG_ICON:}{NAME?}{NAME}{/NAME?}{NAME:}No
name{/NAME:}{/IMG_ICON:}</a><br>
{/PAGE?}
[/menu]


[comment]
[calc]push @imgcash, "'[var IMAGE_DIR 2]/[scratch
mv_locale]/{IMG_DN}'";return;[/calc]
[/menu]
        onmouseover="MM_swapImage('img{CODE}','','[var IMAGE_DIR
2]/[scratch mv_locale]/{IMG_DN}',1);"
        onmouseout="MM_swapImgRestore()"

        onmouseover='this.src="[var IMAGE_DIR 2]/[scratch
mv_locale]/{IMG_DN}"'
        onmouseout='this.src="[var IMAGE_DIR 2]/[scratch
mv_locale]/{IMG_ICON}"'

[calc]

my $imgs = join(',', at imgcash);
my $script = <<EOS;
<script language="JavaScript" type="text/JavaScript">
//	MM_preloadImages($imgs);
//ImageCache = "$imgs";
</script>
EOS
return $script;
[/calc]
[/comment]

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


Met vriendelijke groet,

Jan van Dijk
j.vandijk at attema.nl
B.V. Kunststoffenindustrie Attema
tel : 0183-650650 tst 674
fax: 0183-650751
www.attema.nl


More information about the interchange-users mailing list