--- loncom/interface/londocs.pm 2012/11/27 23:34:41 1.510 +++ loncom/interface/londocs.pm 2012/12/02 22:40:09 1.518 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.510 2012/11/27 23:34:41 raeburn Exp $ +# $Id: londocs.pm,v 1.518 2012/12/02 22:40:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2142,7 +2142,7 @@ sub entryline { &Apache::lonnet::declutter($currurl)); } } - my %lt; + my ($renamelink,%lt); if ($allowed) { my $incindex=$index+1; my $selectbox=''; @@ -2239,7 +2239,7 @@ sub entryline { $nocopy=1; } } - my ($copylink,$cutlink,$removelink,$renamelink); + my ($copylink,$cutlink,$removelink); my $skip_confirm = 0; if ( $folder =~ /^supplemental/ || ($url =~ m{( /smppg$ @@ -2279,9 +2279,11 @@ ENDREM $lt{'rm'} ENDREM } - $renamelink=(<$lt{'rn'} ENDREN + } $form_start = ' '; @@ -2313,7 +2315,6 @@ END $removelink -$renamelink $cutlink $copylink @@ -2353,7 +2354,7 @@ END } } - my $editlink; + my ($editlink,$extresform); my $orig_url = $url; $orig_url=~s{http(:|:)//https(:|:)//}{https$2//}; $url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/}; @@ -2434,7 +2435,7 @@ $form_common.' if ($title) { $url .= '&title='.&HTML::Entities::encode($renametitle,'<>&"'); } - if ($orderidx) { + if ($isexternal && $orderidx) { $url .= '&idx='.$orderidx; } } @@ -2451,28 +2452,22 @@ $form_common.' my $fileloc = &Apache::lonnet::declutter(&Apache::lonnet::filelocation('',$orig_url)); if ($isexternal) { - $editlink = + ($editlink,$extresform) = &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem); - } else { + } elsif (!$isfolder && !$ispage) { my ($cfile,$home,$switchserver,$forceedit,$forceview) = &Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url); - my $geteditlink; - if ($supplementalflag) { - if ($orig_url eq "/adm/$env{'user.domain'}/$env{'user.name'}/aboutme") { - $geteditlink = 1; - } - } elsif (($cfile ne '') && ($symb ne '')) { - $geteditlink = 1; - } - if ($geteditlink) { + if (($cfile ne '') && ($symb ne '' || $supplementalflag)) { my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home, $switchserver, $forceedit, - undef,$symb); + undef,$symb, + &escape($env{'form.folderpath'}), + $renametitle); if ($jscall) { - $editlink = ' '.&mt('Edit').''; + $editlink = ''.&mt('Edit').' '."\n"; } } } @@ -2483,7 +2478,7 @@ $form_common.' } else { $reinit = &mt('(re-initialize course to access)'); } - $line.=''; + $line.=''.$editlink.$renamelink; if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { $line.=''; } elsif ($url) { @@ -2492,7 +2487,7 @@ $form_common.' } else { $line.=''; } - $line.=''; + $line.=''; if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { $line.=''.$title.''; } elsif ($url) { @@ -2501,7 +2496,7 @@ $form_common.' } else { $line.=$title.' '.$reinit.''; } - $line.=$editlink.""; + $line.="$extresform"; $rand_pick_text = ' ' if ($rand_pick_text eq ''); $rand_order_text = ' ' if ($rand_order_text eq ''); if (($allowed) && ($folder!~/^supplemental/)) { @@ -3298,7 +3293,7 @@ sub handler { if ($mapurl eq 'default') { $maptitle = 'Main Course Documents'; } - $path .= ($path ne '')? '&' : ''. + $path .= (($path ne '')? '&' : ''). &Apache::lonhtmlcommon::entity_encode($mapurl).'&'. &Apache::lonhtmlcommon::entity_encode($maptitle). ':'.$mapresobj->randompick(). @@ -3602,10 +3597,6 @@ sub handler { 'prev' => 'Preview', 'lnk' => 'Add Link', 'parse' => 'Upload embedded images/multimedia files if HTML file', - 'nd' => 'Upload Document', - 'pm' => 'Published Map', - 'sd' => 'Special Document', - 'mo' => 'More Options', ); # ----------------------------------------------------------------------------- my $fileupload=(< $lt{'imsf'} $help{'Importing_IMS_Course'} - + $lt{'imsf'} $fileupload @@ -3654,7 +3645,7 @@ IMSFORM $lt{'upfi'} $help{'Uploading_From_Harddrive'} - + $lt{'upfi'} $fileupload @@ -3674,17 +3665,17 @@ IMSFORM FUFORM my $importpubform=(< + $lt{'impm'}$help{'Load_Map'} - + $lt{'impm'} $lt{'copm'} - $lt{'selm'} + $lt{'selm'} @@ -3694,7 +3685,7 @@ SEDFFORM { '' => $pathitem."$lt{'srch'}" }, { '' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" }, { '' => "$lt{'lnks'}" }, - { '' => $importpubform } + { '' => $importpubform } ); $importpubform = &create_form_ul(&create_list_elements(@importpubforma)); my $extresourcesform = @@ -3953,7 +3944,7 @@ my %orderhash = ( unless ($env{'form.pagepath'}) { $orderhash{'00'} = ['Newfolder',$newfolderform]; $orderhash{'dd'} = ['Collaboration',$communityform]; - $orderhash{'ee'} = ['Special Documents',$specialdocumentsform]; + $orderhash{'ee'} = ['Special Pages',$specialdocumentsform]; } $hadchanges=0; @@ -3994,7 +3985,7 @@ unless ($env{'form.pagepath'}) { $lt{'upfi'} $help{'Uploading_From_Harddrive'} - + $lt{'upfi'} $fileupload @@ -4057,7 +4048,7 @@ my @specialdocs = ( =>$supnewaboutmeform}, ); my @supimportdoc = ( - {'' + {'' =>$supextform}, {'' =>$supupdocform}, @@ -4067,7 +4058,7 @@ $supupdocform = &create_form_ul(&create my %suporderhash = ( '00' => ['Supnewfolder', $supnewfolderform], 'ee' => ['Import Content',$supupdocform], - 'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))] + 'ff' => ['Special Pages',&create_form_ul(&create_list_elements(@specialdocs))] ); if ($supplementalflag) { my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, @@ -4351,7 +4342,7 @@ sub generate_edit_table { $activetab = $env{'form.active'}; } my $backicon = $iconpath.'clickhere.gif'; - my $backtext = &mt('To Overview'); + my $backtext = &mt('Exit'); $form = ''. ''."\n". ''. @@ -4561,12 +4552,14 @@ function toggleUpload(caller) { return; } -function toggleMap() { +function toggleMap(caller) { var disp = 'none'; if (document.getElementById('importmapform')) { - var curr = document.getElementById('importmapform').style.display; - if (curr == 'none') { - disp='block'; + if (caller == 'map') { + var curr = document.getElementById('importmapform').style.display; + if (curr == 'none') { + disp='block'; + } } document.getElementById('importmapform').style.display=disp; resize_scrollbox('contentscroll','1','1');