[ic] Usertag breaks after Apply Changes

Interchange User interchange at framework.cx
Tue Nov 4 11:59:09 EST 2003


Greetings,

	I have a usertag (in catalog.cfg) that does a lot of display work, 
including a header and making a dynamic navbar on each page of a site.  
On both my live site (RedHat) and my development server (OS X), when I 
hit Apply Changes in the admin UI, this usertag no longer works, and I 
have to restart Interchange to get it back.  It happens on IC 4.9.8 and 
4.9.9.  Other custom usertags continue to work just fine.  The code is 
rather long, but I'm including it in case anyone cares to take a look.

Thanks,

Peter


Usertag fmridc_nav Order section page
#UserTag fmridc_nav PosNumber 0
UserTag fmridc_nav Interpolate
UserTag fmridc_nav Routine <<ENDFMRIDCNAV
sub {
     my @SubmissionsPages = (
         { Name => "submitdata",             Link => "<a href=\"[area 
submissions/index]",                Text => "Submit Data"             , 
Width => 140, Height => 15 },
         { Name => "instructions",           Link => "<a href=\"[area 
submissions/instructions]",         Text => "Instructions"            , 
Width => 140, Height => 15 },
         { Name => "submissionguidelines",   Link => "<a href=\"[area 
submissions/submissionguidelines]", Text => "Submissions Guidelines"  , 
Width => 140, Height => 15 },
         { Name => "privacyguidelines",      Link => "<a href=\"[area 
submissions/privacyguidelines]",    Text => "Privacy Guidelines"      , 
Width => 140, Height => 15 },
         { Name => "requestaccessionnumber", Link => "<a href=\"[area 
submissions/accession]",            Text => "Request Accession Number", 
Width => 140, Height => 15 },
         { Name => "submissionslogin",       Link => "<a 
href=\"http://voxel.fmridc.org/cgi-bin/datainput.py",      Text => 
"Submissions Login",      , Width => 140, Height => 15 },
     );

     my @ResourcesPages = (
         { Name => "braindatabases",         Link => "<a href=\"[area 
resources/braindatabases]",          Text => "Brain Databases"         
, Width => 140, Height => 15 },
         { Name => "usefulwebsites",         Link => "<a href=\"[area 
resources/websites]",               Text => "Useful Websites"         , 
Width => 140, Height => 15 },
         );

     my @HelpPages = (
         { Name => "gettingstarted",         Link => "<a href=\"[area 
help/gettingstarted]",              Text => "Getting Started"         , 
Width => 140, Height => 15 },
         { Name => "faq",                    Link => "<a href=\"[area 
help/faq]",                         Text => 'FAQ'                     , 
Width => 140, Height => 15 },
         { Name => "infoforauthors",         Link => "<a href=\"[area 
help/infoforauthors]",              Text => "Information for Authors"   
      , Width => 140, Height => 15 },
#        { Name => "infoforresearchers",     Link => "<a href=\"[area 
help/infoforresearchers]",          Text => "Information for 
Researchers"    , Width => 140, Height => 15 },
     );

     my @AboutusPages = (
         { Name => "generalinfo",            Link => "<a href=\"[area 
aboutus/generalinfo]",              Text => "General Information"       
      , Width => 140, Height => 15 },
         { Name => "news",                   Link => "<a href=\"[area 
aboutus/news]",                     Text => "News & Announcments"     , 
Width => 140, Height => 15 },
         { Name => "staff",                  Link => "<a href=\"[area 
aboutus/staff]",                    Text => "Staff"                   , 
Width => 140, Height => 15 },
         { Name => "funding",                Link => "<a href=\"[area 
aboutus/funding]",                  Text => "Funding"                 , 
Width => 140, Height => 15 },
         { Name => "facilities",             Link => "<a href=\"[area 
aboutus/facilities]",               Text => "Facilities"              , 
Width => 140, Height => 15 },
         { Name => "mediacoverage",          Link => "<a href=\"[area 
aboutus/mediacoverage]",            Text => "Publication References"  , 
Width => 140, Height => 15 },
     );

     my @DatabasePages = (
         { Name => "search",            		Link => "<a href=\"[area 
database/index]",              	  Text => "Database Search"             
     , Width => 140, Height => 15 },
         { Name => "availabledatasets",      Link => "<a href=\"[area 
database/availabledatasets]",        Text => "Available Datasets"     , 
Width => 140, Height => 15 },
     );

     my @DMTPages = (
         { Name => "dmt_whatisitfor",    	Link => "<a href=\"[area 
dmt/about]",                   	  Text => "DMT - What is it for?"     , 
	Width => 140, Height => 15 },
         { Name => "dmt_documentation",  	Link => "<a href=\"[area 
dmt/documentation]",    			  Text => "DMT - Documentation"         , 
Width => 140, Height => 15 },
         { Name => "dmt_downloads",      	Link => "<a href=\"[area 
dmt/downloads]",                     Text => "DMT - Downloads"     , 
		Width => 140, Height => 15 },
         { Name => "dmt_futurefeatures", 	Link => "<a href=\"[area 
dmt/futurefeatures]",                Text => "DMT - Future Features"    
  ,   Width => 140, Height => 15 },
         { Name => "dmt_plugins",      		Link => "<a href=\"[area 
dmt/plugins]",        	              Text => "DMT - Plugins"     , 
			Width => 140, Height => 15 },
         { Name => "dmt_technologies",   	Link => "<a href=\"[area 
dmt/technologies]",                  Text => "DMT - Technologies"     , 
		Width => 140, Height => 15 },
         { Name => "dmt_semanticdbmodel",	Link => "<a href=\"[area 
dmt/sdm]",               Text => "DMT - Semantic DB Model"     , Width 
=> 140, Height => 15 },
     );

     my @Sections = (
         { Name => "home",        Link => "<a href=\"[area href=index]", 
        Text => "Welcome to the fMRI Data Center",                       
                         	   Width => 150, Height => 30 },
         { Name => "database",    Link => "<a href=\"[area 
database/index]",    Text => "Database Search", 		Subnav => 
\@DatabasePages        , Width => 140, Height => 30 },
         { Name => "submissions", Link => "<a href=\"[area 
submissions/index]", Text => "Submissions",     		Subnav => 
\@SubmissionsPages     , Width => 140, Height => 30 },
         { Name => "resources",   Link => "<a href=\"[area 
resources/index]",   Text => "Resources",       		Subnav => 
\@ResourcesPages       , Width => 140, Height => 30 },
         { Name => "dmt",         Link => "<a href=\"[area dmt/index]",  
        Text => "Data Management Tool", 	Subnav => \@DMTPages         	 
, Width => 140, Height => 30 },
         { Name => "help",        Link => "<a href=\"[area help/index]", 
        Text => "Help",            		Subnav => \@HelpPages            , 
Width => 140, Height => 30 },
         { Name => "aboutus",     Link => "<a href=\"[area 
aboutus/index]",     Text => "About Us",        		Subnav => 
\@AboutusPages         , Width => 140, Height => 30 },
     );

     my $html;
     my $status = "_off";;
     my ($section, $page) = @_;
     my $mouseover;

     my $current_section;

     for(@Sections) {
     	next unless $_->{Name} eq $section;
     	$current_section = $_;
	last;
     }

     $current_section ||= { Name => 'unknown', Text => 'The fMRI Data 
Center', };
     my $page_title;
     if(my $ref = $current_section->{Subnav}) {
     	for(@$ref) {
		next unless $page eq $_->{Name};
		$page_title = $_->{Text};
		last;
	}
     }

     $page_title ||= $current_section->{Text};

     my $user = $Session->{username};
     my $name_from_db2 = $Tag->data('userdb', 'fname', $user);	# Get 
user's name from the DB.
     my $x2 = $Tag->nitems();

     #	Start by building the page header
     $html .= '			
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

   <head>
     <meta http-equiv="content-type" 
content="text/html;charset=ISO-8859-1">
     <title>fMRIDC - ';

     $html .= $page_title;

     $html .= '</title>
     <link href="/style.css" type="text/css" rel="stylesheet">
   </head>

   <body bgcolor="#ffffff">

     <script language="JavaScript" src="/header.js"></script>

     <!-- begin utility container -->';

   $html .= '
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr>
         <td height="20" align="right">

           <table border="0" cellspacing="0" cellpadding="0">
             <tr>';

   if ($user) {
	  $html .= '
	          <td>';
  	  if ($name_from_db2) {
                 $html .= 'Welcome, ' . $name_from_db2 . 
':&#160;&#160;&#160;&#160;';
	  }
	  $html .= '
               </td>
               <td>
                 [page logout]<img src="icon_logout.gif" height="26" 
width="29" border="0" alt="Logout"></a></td>
               <td class="cart-text">
                 [page logout]Logout</a>&#160;&#160;&#160;&#160;</td>';
   }

   $html .= '
               <td>
                 [page customerservice]<img src="icon_account.gif" 
height="26" width="29" border="0" alt="My Account"></a></td>
               <td class="cart-text">
                 [page customerservice]My 
Account</a>&#160;&#160;&#160;&#160;</td>
               <td>
                 [page ord/basket]<img src="icon_cart.gif" height="26" 
width="29" border="0" alt="Request List"></a></td>
               <td class="cart-text">
                 [page ord/basket]Request List</a> (';
	
   if ($x2 == 1) {
	  $html .= "$x2 dataset";
   }
	elsif ($x2 == 0) {
	  $html .= "Empty";
   }
   elsif ($x2 >1) {
	  $html .= "$x2 datasets";
   }

   $html .= ')</td>
             </tr>
           </table>

         </td>
       </tr>
     </table>';


     $html .= '
     <!-- end utility container -->
     <!-- begin horzontal navigation -->

     <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr>
         <td align="left" valign="bottom" width="20">
           [page index]
             <img src="nav/logo.gif" alt="" width="170" height="36" 
border="0"></a></td>
         <td valign="bottom">
<!-- begin searchwell -->
           <table border="0" cellspacing="0" cellpadding="0">
             <tr>
               <td width="10" height="10"></td>
               <td valign="top" bgcolor="#336699" width="10" height="10">
                 <img src="nav/search_lefttop.gif" alt="" height="10" 
width="10" border="0"></td>
               <td rowspan="3" bgcolor="#336699">

                 <table width="196" border="0" cellspacing="0" 
cellpadding="0">
                   <tr>
                     <td height="5"></td>
                   </tr>
                   <tr>
                     <td>
						<form action="[area search]" method="post">
                     </td>
                     <td valign="middle">
                       <img src="nav/search.gif" alt="" height="7" 
width="47" border="0"></td>
                     <td>
                       <select name="db">
                         <option selected value="fMRIDC Database">fMRIDC 
Database</option>
                         <option value="fMRIDC Website">fMRIDC 
Website</option>
                         <option value="PubMed">PubMed</option>
                       </select></td>
                     <td valign="middle">
                       <img src="nav/for.gif" alt="" height="7" 
width="31" border="0"></td>
                     <td>
					  [set searchspecs]
						su=yes
						fi=nc_redarticle
						sf=accessionNumber
						sf=title
						sf=abstract
					  [/set]
					  <input type="hidden" name="mv_profile" value="searchspecs">
					  <input type="text" name="mv_searchspec" size="20" value="" 
style="width: 150px">
                     <td valign="middle">
                       <input type="image" name="submit" value="Submit" 
src="nav/submit.gif" border="0"></td>
                     <td>
                       </form>
                     </td>
                   </tr>
                 </table>

               </td>
               <td align="left" valign="top" bgcolor="#336699" 
height="10">
                 <img src="nav/search_righttop.gif" alt="" height="10" 
width="10" border="0"></td>
               <td height="10">
               	
               </td>
             </tr>
             <tr>
               <td width="10"></td>
               <td bgcolor="#336699" width="10">
                 <img src="spacer.gif" alt="" height="1" width="1" 
border="0"></td>
               <td bgcolor="#336699">
                 <img src="spacer.gif" alt="" height="1" width="1" 
border="0"></td>
               <td></td>
             </tr>
             <tr>
               <td valign="bottom" width="10" height="10">
                 <img src="nav/search_leftbottom.gif" alt="" height="10" 
width="10" border="0"></td>
               <td bgcolor="#336699" width="10" height="10">
                 <img src="spacer.gif" alt="" height="1" width="1" 
border="0"></td>
               <td bgcolor="#336699" height="10">
                 <img src="spacer.gif" alt="" height="1" width="1" 
border="0"></td>
               <td align="left" valign="bottom" height="10">
                 <img src="nav/search_rightbottom.gif" alt="" 
height="10" width="10" border="0"></td>
             </tr>
           </table>

         </td>
         <td width="90%" align="right" valign="right"></td>
       </tr>
       <tr>
         <td width="20" height="6" bgcolor="#336699" 
background="nav/bg_search.gif">
           <img src="spacer.gif" alt="" width="1" height="1" 
border="0"></td>
         <td align="center" valign="top" height="6" bgcolor="#336699" 
background="nav/bg_search.gif">
           <img src="nav/search_shadow.gif" alt="" width="400" 
height="6" border="0"></td>
         <td width="90%" height="6" bgcolor="#336699" 
background="nav/bg_search.gif">
           <img src="spacer.gif" alt="" width="1" height="1" 
border="0"></td>
       </tr>
     </table>

     <!-- end horzontal navigation -->
     <!-- begin page grid table-->

     <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr>
         <td valign="top" width="155">
';			# End the page header


     foreach my $Section (@Sections) {

     	$status = "_on" if ($section eq $Section->{Name});		# Button state 
is "on" if we're on the "active" section in the navbar.
		$mouseover = (($section eq $Section->{Name}) ? 1 : 0);
         $html .= &loadbutton ($Section->{Name}, $Section->{Text}, 
$Section->{Link}, $status, $Section->{Width}, $Section->{Height}, 
$mouseover);

         if ($status eq "_on") {	# If the $Section is active...
         	$status = "_off";	# then the $Page is not necessarily active...
         	
		  my @subnav = @{$Section->{Subnav}}
		  if defined @{$Section->{Subnav}}; # Weird referential array stuff 
going on.
		    foreach my $Page (@subnav) {
		      $status = "_on" if ($page eq $Page->{Name});			# $Page is 
active.
			  $mouseover = (($page eq $Page->{Name}) ? 1 : 0);
			  if (defined $Page->{Name}) {
			    $html .=  &loadbutton ($Page->{Name}, $Page->{Text}, 
$Page->{Link}, $status, $Page->{Width}, $Page->{Height}, $mouseover )
			  }
			  $status = "_off";										# All further buttons are in an "off" 
state.
			}
			if (@subnav) {
			  $html .= "<img src=\"nav/submenu_bottom.gif\" alt=\"\" 
height=\"11\" width=\"140\" border=\"0\"></a><br>";
			}
           }

		$status = "_off";										# All further buttons are in an "off" 
state.
     }

     $html .= "<img src=\"nav/menu_bottom.gif\" alt=\"\" height=\"11\" 
width=\"140\" border=\"0\"></a><br>";  # footer

     $html .= "<p class=text-global>";
	
	$html .= '
	  <table cellpadding="0" cellspacing="10" border="0">
	    <tr>
	      <td>
	        [page sitemap]Sitemap</a></td>
	    </tr>
	    <tr>
	      <td>
	        [page contact]Contact Us</a></td>
	    </tr>
	  </table>';

		
		$html .=
'		</td>
         <td width="98%" valign="top">
           <!-- begin content container -->
           <table width="100%" border="0" cellspacing="0" 
cellpadding="0">
             <tr>
               <td height="15">
				</td>
             </tr>
             <tr>
               <td class="text-standard">
';
     return $html;


	sub loadbutton {
		my $html;					# HTML code to be returned.
		my $extension = ".gif";		# We use GIFs for navbar elements.
		my ($Image, $Alt, $Link, $Status, $Width, $Height, $MouseOver) = @_;
			
		$html .= $Link . "\">";
		if ($MouseOver){
			$html .= "<img src=\"nav/" . $Image . $Status . $extension . "\" 
name=\"$Image\" width=\"$Width\" height=\"$Height\" 
border=\"0\"><br>\n";
		} else {	
			$html .= "<img src=\"nav/" . $Image . $Status . $extension . "\" 
name=\"$Image\" width=\"$Width\" height=\"$Height\" border=\"0\"" .
		" onMouseOver=\"NavRoll('" . $Image . "', true)\" 
onMouseOut=\"NavRoll('" . $Image . "',false)\">" . "<br>\n";
		}
		return $html;
	}
}
ENDFMRIDCNAV



More information about the interchange-users mailing list