--- loncom/interface/lonmenu.pm	2010/03/11 16:35:12	1.317
+++ loncom/interface/lonmenu.pm	2010/08/13 13:13:26	1.332
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.317 2010/03/11 16:35:12 droeschl Exp $
+# $Id: lonmenu.pm,v 1.332 2010/08/13 13:13:26 wenzelju Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -109,20 +109,9 @@ Same as primary_menu() but operates on @
 
 =item show_return_link()
 
-=item registerurl()
-
-This gets called in the header section
-
 =item innerregister()
 
-This gets called in order to register a URL, both with the Remote
-and in the body of the document
-
-=item loadevents()
-
-=item unloadevents()
-
-=item get_menu_name()
+This gets called in order to register a URL in the body of the document
 
 =item clear()
 
@@ -166,6 +155,7 @@ use Apache::lonhtmlcommon();
 use Apache::loncommon();
 use Apache::lonenc();
 use Apache::lonlocal;
+use Apache::lonwishlist();
 use LONCAPA qw(:DEFAULT :match);
 use HTML::Entities();
 
@@ -188,7 +178,7 @@ sub prep_menuitem {
     return '<li><a' 
            # highlighting for new messages
            . ( $$menuitem[4] eq 'newmsg' ? ' class="LC_new_message"' : '') 
-           . qq| href="$$menuitem[0]">$link</a></li>|;
+           . qq| href="$$menuitem[0]" target="_top">$link</a></li>|;
 }
 
 # primary_menu() evaluates @primary_menu and returns XHTML for the menu
@@ -200,6 +190,11 @@ sub primary_menu {
     my $menu;
     # each element of @primary contains following array:
     # (link url, icon path, alt text, link text, condition)
+    my $public;
+    if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
+        || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {
+        $public = 1;
+    }
     foreach my $menuitem (@primary_menu) {
         # evaluate conditions 
         next if    ref($menuitem)       ne 'ARRAY';    #
@@ -207,12 +202,12 @@ sub primary_menu {
                 && &Apache::lonmsg::mynewmail();       # whether a new msg 
         next if    $$menuitem[4]        eq 'newmsg'    # arrived or not
                 && !&Apache::lonmsg::mynewmail();      # 
-        next if    $$menuitem[4]        !~ /public/    ##we've a public user, 
-                && $env{'user.name'}    eq 'public'    ##who should not see all 
-                && $env{'user.domain'}  eq 'public';   ##links
+        next if    $$menuitem[4]        !~ /public/    ##we've a public user,
+                && $public;                            ##who should not see all
+                                                       ##links
         next if    $$menuitem[4]        eq 'onlypublic'# hide links which are 
-                && $env{'user.name'}    ne 'public'    # only visible to public
-                && $env{'user.domain'}  ne 'public';   # users
+                && !$public;                           # only visible to public
+                                                       # users
         next if    $$menuitem[4]        eq 'roles'     ##show links depending on
                 && &Apache::loncommon::show_course();  ##term 'Courses' or 
         next if    $$menuitem[4]        eq 'courses'   ##'Roles' wanted
@@ -222,33 +217,65 @@ sub primary_menu {
         if ($$menuitem[3] eq 'Help') { # special treatment for helplink
             $menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';
         } else {
-            my @items = @{$menuitem};
-            $items[0] = 'javascript:'.$menuitem->[0].';';
-            $menu .= &prep_menuitem(\@items);
+            $menu .= prep_menuitem($menuitem);
         }
     }
+    $menu =~ s/\[domain\]/$env{'user.domain'}/g;
+    $menu =~ s/\[user\]/$env{'user.name'}/g;
 
     return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>";
 }
 
+#returns hashref {user=>'',dom=>''} containing:
+#   own name, domain if user is au
+#   name, domain of parent author if user is ca or aa
+#empty return if user is not an author or not on homeserver
+#
+#TODO this should probably be moved somewhere more central
+#since it can be used by different parts of the system
+sub getauthor{
+    return unless $env{'request.role'}=~/^(ca|aa|au)/; #nothing to do if user isn't some kind of author
+
+                        #co- or assistent author?
+    my ($dom, $user) = ($env{'request.role'} =~ /^(?:ca|aa)\.\/($match_domain)\/($match_username)$/)
+                       ? ($1, $2) #domain, username of the parent author
+                       : @env{ ('request.role.domain', 'user.name') }; #own domain, username
+
+    # current server == home server?
+    my $home =  &Apache::lonnet::homeserver($user,$dom);
+    foreach (&Apache::lonnet::current_machine_ids()){
+        return {user => $user, dom => $dom} if $_ eq $home;
+    }
+
+    # if wrong server
+    return;
+}
 
 sub secondary_menu {
     my $menu;
 
     my $crstype = &Apache::loncommon::course_type();
-    my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'});
-    my $canviewgrps = &Apache::lonnet::allowed('vcg', $env{'request.course.id'}
-                   . ($env{'request.course.sec'} ? "/$env{'request.course.sec'}"
-                                                 : '')); 
+    my $crs_sec = $env{'request.course.id'} . ($env{'request.course.sec'} 
+                                               ? "/$env{'request.course.sec'}"
+                                               : '');
+    my $canedit       = &Apache::lonnet::allowed('mdc', $env{'request.course.id'});
+    my $canviewgrps   = &Apache::lonnet::allowed('vcg', $crs_sec); 
+    my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec); 
+    my $canviewwnew   = &Apache::lonnet::allowed('whn', $crs_sec); 
+    my $canmodpara    = &Apache::lonnet::allowed('opa', $crs_sec); 
+    my $author        = getauthor();
+
     my $showlink = &show_return_link();
     my %groups = &Apache::lonnet::get_active_groups(
                      $env{'user.domain'}, $env{'user.name'},
                      $env{'course.' . $env{'request.course.id'} . '.domain'},
                      $env{'course.' . $env{'request.course.id'} . '.num'});
+
     foreach my $menuitem (@secondary_menu) {
         # evaluate conditions 
         next if    ref($menuitem)  ne 'ARRAY';
         next if    $$menuitem[4]   ne 'always'
+                && $$menuitem[4]   ne 'author'
                 && !$env{'request.course.id'};
         next if    $$menuitem[4]   eq 'showreturn'
                 && !$showlink
@@ -259,17 +286,17 @@ sub secondary_menu {
                 && $crstype eq 'Community';
         next if    $$menuitem[4]  eq 'mdcCommunity'
                 && $crstype ne 'Community';
-        next if    $$menuitem[4]  =~ /^remotenav/
-                && $env{'environment.remotenavmap'} ne 'on';
-        next if    $$menuitem[4]  =~ /noremotenav/
-                && $env{'environment.remotenavmap'} eq 'on';
-        next if $$menuitem[4] =~ /^(no|)remotenav$/ 
-                && $crstype eq 'Community';
-        next if $$menuitem[4] =~ /^(no|)remotenavCommunity$/ 
-                && $crstype ne 'Community';
+        next if    $$menuitem[4]   eq 'cst'
+                && !$canmodifyuser;
+        next if    $$menuitem[4]   eq 'whn'
+                && !$canviewwnew;
+        next if    $$menuitem[4]   eq 'opa'
+                && !$canmodpara;
         next if    $$menuitem[4]   =~ /showgroups$/
                 && !$canviewgrps
                 && !%groups;
+        next if    $$menuitem[4]    eq 'author'
+                && !$author;
 
         if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
             # special treatment for role selector
@@ -279,15 +306,6 @@ sub secondary_menu {
 
             $menu .= $roles_selector ? "<li>$roles_selector</li>"
                                      : '';
-        } elsif ($env{'environment.remotenavmap'} eq 'on') {
-            # open link using javascript when remote navmap is activated
-            my @items = @{$menuitem}; 
-            if ($menuitem->[4] eq 'remotenav') {
-                $items[0] = "javascript:gonav('$menuitem->[0]');";
-            } else {
-                $items[0] = "javascript:go('$menuitem->[0]');";
-            }
-            $menu .= &prep_menuitem(\@items);
         } else {
             $menu .= &prep_menuitem(\@$menuitem);
         }
@@ -311,11 +329,18 @@ sub secondary_menu {
         $menu =~ s/\[url\]/$escurl/g;
         $menu =~ s/\[symb\]/$escsymb/g;
     }
+    $menu =~ s/\[uname\]/$$author{user}/g;
+    $menu =~ s/\[udom\]/$$author{dom}/g;
 
     return "<ul id=\"LC_secondary_menu\">$menu</ul>";
 }
 
 sub show_return_link {
+    if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
+        || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
+
+        return if ($env{'form.register'});
+    }
     return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
 	     $env{'request.symb'} eq '')
 	    ||
@@ -324,32 +349,12 @@ sub show_return_link {
 	    (($env{'request.noversionuri'}=~/^\/adm\//) &&
 	     ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
 	     ($env{'request.noversionuri'}!~
-	      m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
-	     ));
-}
-
-
-sub registerurl {
-    my ($forcereg) = @_;
-    my $result = '';
-    if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
-    my $force_title='';
-    if ($env{'request.state'} eq 'construct') {
-	$force_title=&Apache::lonxml::display_title();
-    }
- 	return
-        $result
-       .'<script type="text/javascript">'."\n"
-       .'// <![CDATA['."\n"
-       .'function LONCAPAreg(){;} function LONCAPAstale(){}'."\n"
-       .'// ]]>'."\n"
-       .'</script>'
-       .$force_title;
+	      m{^/adm/.*/(smppg|bulletinboard)($|\?)})
+           ));
 }
 
 sub innerregister {
-    my ($forcereg,$titletable,$bread_crumbs) = @_;
-    my ($uname,$thisdisfn);
+    my ($forcereg,$bread_crumbs) = @_;
     my $const_space = ($env{'request.state'} eq 'construct');
     my $is_const_dir = 0;
 
@@ -366,15 +371,17 @@ sub innerregister {
 
         my $maptitle = &Apache::lonnet::gettitle($mapurl);
         my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
-        my $contentstext;
-        if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Community') {
-            $contentstext = &mt('Community Contents');
-        } else {
-            $contentstext = &mt('Course Contents');
-        }
-        my @crumbs = ({text  => $contentstext, 
-                       href  => "Javascript:gonav('/adm/navmaps')"});
 
+#SD
+#course_type only Course and Community?
+#
+        my @crumbs;
+        unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps')
+                && ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
+            @crumbs = ({text  => Apache::loncommon::course_type() 
+                                . ' Contents', 
+                        href  => "Javascript:gopost('/adm/navmaps','')"});
+        }
         if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { 
             push(@crumbs, {text  => '...',
                            no_mt => 1});
@@ -388,6 +395,11 @@ sub innerregister {
 
         &Apache::lonhtmlcommon::clear_breadcrumbs();
         &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
+    }elsif (! $const_space){
+        #a situation when we're looking at a resource outside of context of a 
+        #course or construction space (e.g. with cumulative rights)
+        &Apache::lonhtmlcommon::clear_breadcrumbs();
+        &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'});
     }
 # =============================================================================
 # ============================ This is for URLs that actually can be registered
@@ -477,6 +489,8 @@ sub innerregister {
             my $cfuname='';
             my $cfudom='';
             my $uploaded;
+            my $switchserver='';
+            my $home;
             if ($env{'request.filename'}) {
                 my $file=&Apache::lonnet::declutter($env{'request.filename'});
                 if (defined($cnum) && defined($cdom)) {
@@ -487,18 +501,20 @@ sub innerregister {
                     # Check that the user has permission to edit this resource
                     ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
                     if (defined($cfudom)) {
-		        my $home=&Apache::lonnet::homeserver($cfuname,$cfudom);
+		        $home=&Apache::lonnet::homeserver($cfuname,$cfudom);
 		        my $allowed=0;
 		        my @ids=&Apache::lonnet::current_machine_ids();
 		        foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
 		        if ($allowed) {
                             $cfile=$file;
+                        } else {
+                            $switchserver=$file;
                         }
                     }
                 }
             }
             # Finally, turn the button on or off
-            if ($cfile && !$const_space) {
+            if (($cfile || $switchserver) && !$const_space) {
                 my $nocrsedit;
                 # Suppress display where CC has switched to student role.
                 if ($env{'request.course.id'}) {
@@ -510,6 +526,12 @@ sub innerregister {
                 if ($nocrsedit) {
                     $editbutton=&clear(6,1);
                 } else {
+                    if ($switchserver) {
+                        if ( $env{'request.symb'} && $env{'request.course.id'} ) {
+                            my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
+                            $cfile = '/adm/switchserver?otherserver='.$home.'&amp;role='.$env{'request.role'}.'&amp;symb='.$env{'request.symb'}.'&amp;origurl='.$resurl;
+                        }
+                    }
                     $editbutton=&switch
                        ('','',6,1,'pcstr.png','edit[_1]','resource[_2]',
                      "go('".$cfile."');","Edit this resource");
@@ -583,8 +605,14 @@ c&6&3
 c&8&1
 c&8&2
 s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
-s&9&1&sbkm.png&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1
 ENDMENUITEMS
+            if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F' && $env{'request.uri'} =~ /^\/res/) {
+                # wishlist is only available for users with access to resource-pool
+                # and links can only be set for resources within the resource-pool
+                $menuitems .= (<<ENDMENUITEMS);
+s&9&1&wishlist-link.png&set[_1]&wishlistlink[_2]&set_wishlistlink()&Set a link for this resource to wishlist&&1
+ENDMENUITEMS
+            }
 
 my $currentURL = &Apache::loncommon::get_symb();
 my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL);
@@ -598,7 +626,7 @@ if(length($annotation) > 0){
 $menuitems.="&anno-[_1]&tations[_1]&annotate()&";
 $menuitems.="Make notes and annotations about this resource&&1\n";
 
-            unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
+            unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
 		if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) {
 		    $menuitems.=(<<ENDREALRES);
 s&6&3&catalog.png&catalog[_2]&info[_1]&catalog_info()&Show Metadata
@@ -614,6 +642,12 @@ ENDREALRES
 	    $menuitems .= (<<ENDMENUITEMS);
 s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
 ENDMENUITEMS
+            if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F') {
+                # wishlist is only available for users with access to resource-pool
+                $menuitems .= (<<ENDMENUITEMS);
+s&9&1&wishlist-link.png&set[_1]&wishlistlink[_2]&set_wishlistlink()&Set a link for this resource to wishlist&&1
+ENDMENUITEMS
+            }
 	}
         my $buttons='';
         foreach (split(/\n/,$menuitems)) {
@@ -656,9 +690,10 @@ ENDMENUITEMS
                      'tools', @inlineremote[63]);
             }
             
-
-            Apache::lonhtmlcommon::add_breadcrumb_tool(
-                'advtools', @inlineremote[61,71,72,73,92]);
+            unless ($env{'request.noversionuri'}=~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {
+                Apache::lonhtmlcommon::add_breadcrumb_tool(
+                    'advtools', @inlineremote[61,71,72,73,92]);
+            }
         }
     }
 
@@ -703,30 +738,8 @@ sub edit_course_upload {
     return $cfile;
 }
 
-sub loadevents() {
-    if ($env{'request.state'} eq 'construct' ||
-	$env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
-    return 'LONCAPAreg();';
-}
-
-sub unloadevents() {
-    if ($env{'request.state'} eq 'construct' ||
-	$env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
-    return 'LONCAPAstale();';
-}
-
-sub get_menu_name {
-    my $hostid = $Apache::lonnet::perlvar{'lonHostID'};
-    $hostid =~ s/\W//g;
-    return 'LCmenu'.$hostid;
-}
-
 # ================================================================== Raw Config
 
-#SD
-#this is called by
-#lonmenu
-#
 sub clear {
     my ($row,$col)=@_;
     $inlineremote[10*$row+$col]='';
@@ -747,8 +760,7 @@ sub switch {
     my $idx=10*$row+$col;
     $category_members{$cat}.=':'.$idx;
 
-# Inline Remote
-#RC    $img=~s/\.gif$/\.png/;
+# Inline Menu
     if ($nobreak==2) { return ''; }
     my $text=$top.' '.$bot;
     $text=~s/\s*\-\s*//gs;
@@ -778,14 +790,9 @@ sub switch {
 	   }
     } else {
 # Inline Menu
-#SD look here
-       if ($env{'environment.icons'} eq 'iconsonly') {
-          $inlineremote[$idx]='<a title="'.$desc.'" href="javascript:'.$act.';">'.$pic.'</a>';
-       } else {
       $inlineremote[$idx]=
        '<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.
        '<span class="LC_menubuttons_inline_text">'.$desc.'</span></a>';
-       }
     }
     return '';
 }
@@ -1045,25 +1052,6 @@ sub check_for_rcrs {
     return $showreqcrs;
 }
 
-# ====================================================================== Footer
-
-sub nav_control_js {
-    my $nav=($env{'environment.remotenavmap'} eq 'on');
-    return (<<NAVCONTROL);
-    var w_loncapanav_flag="$nav";
-
-
-function gonav(url) {
-   if (w_loncapanav_flag != 1) {
-      gopost(url,'');
-   }  else {
-      navwindow=window.open(url,
-                  "loncapanav","height=600,width=400,scrollbars=1"); 
-   }
-}
-NAVCONTROL
-}
-
 sub dc_popup_js {
     my %lt = &Apache::lonlocal::texthash(
                                           more => '(More ...)',
@@ -1098,7 +1086,6 @@ sub utilityfunctions {
     $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));
     
     my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
-    my $nav_control=&nav_control_js();
 
     my $dc_popup_cid;
     if ($env{'user.adv'} && exists($env{'user.role.dc./'.
@@ -1127,13 +1114,55 @@ sub utilityfunctions {
     my $end_page_bookmark = 
         &Apache::loncommon::end_page({'js_ready' => 1});
 
+    my $start_page_wishlistlink = 
+        &Apache::loncommon::start_page('Set link to wishlist',undef,
+				       {'only_body' => 1,
+					'js_ready'  => 1,
+					'bgcolor'   => '#FFFFFF',});
+
+    my $warningLink = &mt('You must insert a title!');
+
+    # HTML-Markup for 'Set a link for this resource to wishlist'
+    # this is written via JavaScript document.write (function set_wishlistlink) 
+    # it is split into 3 parts and the inputfields for title and path are left out
+    # these fields are inserted later to set the values for title and path
+    # automatically via JavaScript (document.title and location.pathname) 
+    my $in_page_wishlistlink1 = '<h1>'.&mt('Set a link to wishlist').'</h1>'.
+                                '<form method="post" name="newlink" action="/adm/wishlist?mode=set" '.
+                                'onsubmit="return newlinksubmit();" >'.
+                                &Apache::lonhtmlcommon::start_pick_box().
+                                &Apache::lonhtmlcommon::row_title(&mt('Link Title'));
+
+    my $in_page_wishlistlink2 = &Apache::lonhtmlcommon::row_closure().
+                                &Apache::lonhtmlcommon::row_title(&mt('Path'));
+
+    my $in_page_wishlistlink3 = &Apache::lonhtmlcommon::row_closure().
+                                &Apache::lonhtmlcommon::row_title(&mt('Note')).
+                                '<textarea name="note" rows="3" cols="35" style="width:100%"></textarea>'.
+                                &Apache::lonhtmlcommon::row_closure(1).
+                                &Apache::lonhtmlcommon::end_pick_box().
+                                '<br/><br/>'.
+                                '<input type="submit" value="'.&mt('Save in').'" />'.
+                                '<select name="folders">'.
+                                &Apache::lonwishlist::getfoldersOption().
+                                '</select>'.
+                                '<input type="button" value="'.&mt('cancel').'" onclick="javascript:window.close();" />'.
+                                '</form>';
+
+    # remove all \n for inserting on javascript document.write
+    $in_page_wishlistlink1 =~ s/\n//g;
+    $in_page_wishlistlink2 =~ s/\n//g;
+    $in_page_wishlistlink3 =~ s/\n//g;
+
+    my $end_page_wishlistlink = 
+        &Apache::loncommon::end_page({'js_ready' => 1});
+
 return (<<ENDUTILITY)
 
     var currentURL="$currenturl";
     var reloadURL="$currenturl";
     var currentSymb="$currentsymb";
 
-$nav_control
 $dc_popup_cid
 
 function go(url) {
@@ -1144,12 +1173,6 @@ function go(url) {
    }
 }
 
-function gotop(url) {
-    if (url!='' && url!= null) {
-        top.location.href = url;
-    }
-}
-
 function gopost(url,postdata) {
    if (url!='') {
       this.document.server.action=url;
@@ -1239,7 +1262,7 @@ function edit_bookmarks() {
    go('');
    w_BookmarkPal_flag=1;
    bookmarkpal=window.open("/adm/bookmarks",
-               "BookmarkPal", "width=400,height=505,scrollbars=0");
+               "BookmarkPal", "width=500,height=505,scrollbars=0");
 }
 
 function annotate() {
@@ -1277,6 +1300,35 @@ function set_bookmark() {
    bmquery.document.close();
 }
 
+function set_wishlistlink(title, path) {
+   if (!title) {
+       title=document.title;
+   }
+   if (!path) {
+       path=location.pathname;
+   }
+   title = title.replace(/^LON-CAPA /,'');
+   wishlistlink=window.open('','wishlistNewLink','width=560,height=350,scrollbars=0');
+   wishlistlink.document.write(
+   '$start_page_wishlistlink'
+   +'<script type="text\/javascript">'
+   +'function newlinksubmit(){'
+   +'var title = document.getElementsByName("title")[0].value;'
+   +'if (!title) {'
+   +'alert("$warningLink");'
+   +'return false;}'
+   +'return true;}'
+   +'<\/scr'+'ipt>'
+   +'$in_page_wishlistlink1'
+   +'<input type="text" name="title" size="45" value="'+title+'"/>'
+   +'$in_page_wishlistlink2'
+   +'<input type="text" name="path" size="45" value="'+path+'" '
+   +'readonly="readonly" style="background-color: #DDDDDD"/>'
+   +'$in_page_wishlistlink3'
+   +'$end_page_wishlistlink' );
+   wishlistlink.document.close();
+}
+
 ENDUTILITY
 }
 
@@ -1309,19 +1361,7 @@ sub constspaceform {
 ENDCONSTSPACEFORM
 }
 
-
-sub get_nav_status {
-    my $navstatus="swmenu.w_loncapanav_flag=";
-    if ($env{'environment.remotenavmap'} eq 'on') {
-	$navstatus.="1";
-    } else {
-	$navstatus.="-1";
-    }
-    return $navstatus;
-}
-
 sub hidden_button_check {
-    my $hidden;
     if ( $env{'request.course.id'} eq ''
          || $env{'request.role.adv'} ) {