--- loncom/interface/loncommon.pm 2013/05/03 14:28:35 1.1125 +++ loncom/interface/loncommon.pm 2013/06/05 12:39:34 1.1133 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1125 2013/05/03 14:28:35 raeburn Exp $ +# $Id: loncommon.pm,v 1.1133 2013/06/05 12:39:34 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4932,7 +4932,7 @@ sub designparm { Inputs: $url (usually will be undef). -Returns: Path to Construction Space containing the resource or +Returns: Path to Authoring Space containing the resource or directory being viewed (or for which action is being taken). If $url is provided, and begins /priv// the path will be that portion of the $context argument. @@ -4995,7 +4995,7 @@ Input: (optional) filename from which br is appropriate for use in building the breadcrumb trail. Returns: HTML div with CSTR path and recent box - To be included on Construction Space pages + To be included on Authoring Space pages =cut @@ -5026,7 +5026,7 @@ sub CSTR_pageheader { my $output = '
' .&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it? - .''.&mt('Construction Space:').' ' + .''.&mt('Authoring Space:').' ' .'
' #FIXME lonpubdir: target="_parent" .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv/'.$udom,undef,undef); @@ -5155,16 +5155,14 @@ sub bodytag { my $bodytag = "". &Apache::lontexconvert::init_math_support($args->{'inherit_jsmath'}); - if ($bodyonly) { + &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']); + + if (($bodyonly) || ($no_nav_bar) || ($env{'form.inhibitmenu'} eq 'yes')) { return $bodytag; - } + } - my $name = &plainname($env{'user.name'},$env{'user.domain'}); if ($public) { undef($role); - } else { - $name = &aboutmewrapper($name,$env{'user.name'},$env{'user.domain'}, - undef,'LC_menubuttons_link'); } my $titleinfo = '

'.$title.'

'; @@ -5180,11 +5178,6 @@ sub bodytag { } $role = '('.$role.')' if $role; - &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']); - - if ($no_nav_bar || $env{'form.inhibitmenu'} eq 'yes') { - return $bodytag; - } if ($env{'request.state'} eq 'construct') { $forcereg=1; } @@ -5192,25 +5185,25 @@ sub bodytag { # $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls # } + $bodytag .= Apache::lonhtmlcommon::scripttag( + Apache::lonmenu::utilityfunctions(), 'start'); + my ($left,$right) = Apache::lonmenu::primary_menu(); if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { if ($dc_info) { $dc_info = qq|$dc_info|; } - $bodytag .= qq|
$name $role
+ $bodytag .= qq|
$left $role
$realm $dc_info
|; return $bodytag; } unless ($env{'request.symb'} =~ m/\.page___\d+___/) { - $bodytag .= qq|
$name $role
|; + $bodytag .= qq|
$left $role
|; } - $bodytag .= Apache::lonhtmlcommon::scripttag( - Apache::lonmenu::utilityfunctions(), 'start'); - - $bodytag .= Apache::lonmenu::primary_menu(); + $bodytag .= $right; if ($dc_info) { $dc_info = &dc_courseid_toggle($dc_info); @@ -5410,6 +5403,14 @@ form, .inline { vertical-align:middle; } +.LC_floatleft { + float: left; +} + +.LC_floatright { + float: right; +} + .LC_400Box { width:400px; } @@ -6499,6 +6500,7 @@ div.LC_createcourse { } .LC_dccid { + float: right; margin: 0.2em 0 0 0; padding: 0; font-size: 90%; @@ -6596,7 +6598,6 @@ fieldset > legend { } ol.LC_primary_menu { - float: right; margin: 0; padding: 0; background-color: $pgbg_or_bgcolor; @@ -7818,11 +7819,9 @@ sub LCprogressbar { $LCcurrentid=$$.'_'.$LCidcnt; my $starting=&mt('Starting'); my $content=(<
$starting
-

ENDPROGBAR &r_print($r,$content.&LCprogressbar_script($LCcurrentid)); } @@ -9616,10 +9615,17 @@ sub ask_for_embedded_content { if (ref($args) eq 'HASH') { $url = $args->{'docs_url'}; $title = $args->{'docs_title'}; - $toplevel = "/$url"; + $toplevel = $url; + unless ($toplevel =~ m{^/}) { + $toplevel = "/$url"; + } ($rem) = ($toplevel =~ m{^(.+/)[^/]+$}); - ($path) = - ($toplevel =~ m{^(\Q/uploaded/$cdom/$cnum/\E(?:docs|supplemental)/(?:default|\d+)/\d+)/}); + if ($toplevel =~ m{^(\Q/uploaded/$cdom/$cnum/portfolio/syllabus\E)}) { + $path = $1; + } else { + ($path) = + ($toplevel =~ m{^(\Q/uploaded/$cdom/$cnum/\E(?:docs|supplemental)/(?:default|\d+)/\d+)/}); + } $fileloc = &Apache::lonnet::filelocation('',$toplevel); $fileloc =~ s{^/}{}; ($filename) = ($fileloc =~ m{.+/([^/]+)$}); @@ -9635,7 +9641,13 @@ sub ask_for_embedded_content { $fileloc = &Apache::lonnet::filelocation('',$toplevel).'/'; $fileloc =~ s{^/}{}; } - foreach my $embed_file (keys(%{$allfiles})) { + foreach my $file (keys(%{$allfiles})) { + my $embed_file; + if (($path eq "/uploaded/$cdom/$cnum/portfolio/syllabus") && ($file =~ m{^\Q$path/\E(.+)$})) { + $embed_file = $1; + } else { + $embed_file = $file; + } my $absolutepath; if ($embed_file =~ m{^\w+://}) { $newfiles{$embed_file} = 1; @@ -9799,12 +9811,14 @@ sub ask_for_embedded_content { ($file eq $filename.'.bak') || ($dependencies{$file})) { if ($actionurl eq '/adm/dependencies') { - next if (($rem ne '') && - (($env{"httpref.$rem".$file} ne '') || - (ref($navmap) && - (($navmap->getResourceByUrl($rem.$file) ne '') || - (($file =~ /^(.*\.s?html?)\.bak$/i) && - ($navmap->getResourceByUrl($rem.$1))))))); + unless ($toplevel =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus\E}) { + next if (($rem ne '') && + (($env{"httpref.$rem".$file} ne '') || + (ref($navmap) && + (($navmap->getResourceByUrl($rem.$file) ne '') || + (($file =~ /^(.*\.s?html?)\.bak$/i) && + ($navmap->getResourceByUrl($rem.$1))))))); + } } $unused{$file} = 1; } @@ -10013,7 +10027,7 @@ sub ask_for_embedded_content { $chgcount ++; } } - if ($counter) { + if (($counter) || ($numunused)) { if ($numpathchg) { $output .= ''."\n"; @@ -10197,9 +10211,10 @@ sub upload_embedded { } } } elsif (($context eq 'coursedoc') || ($context eq 'syllabus')) { + my $extendedsubdir = $dirpath.'/'.$subdir; + $extendedsubdir =~ s{/+$}{}; my $result = - &Apache::lonnet::userfileupload('embedded_item_'.$i,$context, - $dirpath.'/'.$subdir); + &Apache::lonnet::userfileupload('embedded_item_'.$i,$context,$extendedsubdir); if ($result !~ m|^/uploaded/|) { $output .= '' .&mt('An error occurred ([_1]) while trying to upload [_2] for embedded element [_3].' @@ -10359,7 +10374,7 @@ sub modify_html_refs { } my (%allfiles,%codebase,$output,$content); my @changes = &get_env_multiple('form.namechange'); - unless (@changes > 0) { + unless ((@changes > 0) || ($context eq 'syllabus')) { if (wantarray) { return ('',0,0); } else { @@ -11812,7 +11827,7 @@ sub get_folder_hierarchy { my @pcs = split(/,/,$pcslist); foreach my $pc (@pcs) { if ($pc == 1) { - push(@pathitems,&mt('Main Course Documents')); + push(@pathitems,&mt('Main Content')); } else { my $res = $navmap->getByMapPc($pc); if (ref($res)) { @@ -11827,7 +11842,7 @@ sub get_folder_hierarchy { } if ($showitem) { if ($mapres->{ID} eq '0.0') { - push(@pathitems,&mt('Main Course Documents')); + push(@pathitems,&mt('Main Content')); } else { my $maptitle = $mapres->compTitle(); $maptitle =~ s/\W+/_/g; @@ -14388,7 +14403,7 @@ sub symb_to_docspath { $path =~ s/^\&//; my $maptitle = $mapresobj->title(); if ($mapurl eq 'default') { - $maptitle = 'Main Course Documents'; + $maptitle = 'Main Content'; } $path .= (($path ne '')? '&' : ''). &Apache::lonhtmlcommon::entity_encode($mapurl).'&'. @@ -14402,14 +14417,14 @@ sub symb_to_docspath { my $maptitle = &Apache::lonnet::gettitle($mapurl); my $ispage = (($type eq 'page')? 1 : ''); if ($mapurl eq 'default') { - $maptitle = 'Main Course Documents'; + $maptitle = 'Main Content'; } $path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'. &Apache::lonhtmlcommon::entity_encode($maptitle).':::::'.$ispage; } unless ($mapurl eq 'default') { $path = 'default&'. - &Apache::lonhtmlcommon::entity_encode('Main Course Documents'). + &Apache::lonhtmlcommon::entity_encode('Main Content'). ':::::&'.$path; } return $path; @@ -14552,7 +14567,7 @@ sub create_recaptcha { return $captcha->get_options_setter({theme => 'white'})."\n". $captcha->get_html($pubkey). &mt('If either word is hard to read, [_1] will replace them.', - 'reCAPTCHA refresh'). + 'reCAPTCHA refresh'). '

'; }