--- loncom/interface/londocs.pm 2011/05/27 19:39:25 1.434.2.4 +++ loncom/interface/londocs.pm 2010/12/04 16:17:27 1.441 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.434.2.4 2011/05/27 19:39:25 raeburn Exp $ +# $Id: londocs.pm,v 1.441 2010/12/04 16:17:27 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1660,7 +1660,7 @@ sub editor { .''.&mt('Actions').'' .''.&mt('Document').''); if ($folder !~ /^supplemental/) { - $r->print(''.&mt('Settings').''); + $->print(''.&mt('Settings').''); } $r->print(&Apache::loncommon::end_data_table_header_row()); } @@ -1721,7 +1721,7 @@ sub process_file_upload { $destination .= $newidx; my $url=&Apache::lonnet::userfileupload('uploaddoc','coursedoc',$destination, $parseaction,$allfiles, - $codebase,undef,undef,undef,undef, + $codebase,undef,undef,undef,undef, undef,undef,\$mimetype); if ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E.*/([^/]+)$}) { my $stored = $1; @@ -1729,7 +1729,7 @@ sub process_file_upload { $stored.'').'

'; } else { my ($filename) = ($env{'form.uploaddoc.filename'} =~ m{([^/]+)$}); - + $$upload_output = '

'.&mt('Unable to save file [_1].',''.$filename.'').'

'; return; } @@ -1758,14 +1758,14 @@ sub process_file_upload { if ($total_embedded > 0) { my $uploadphase = 'upload_embedded'; my $primaryurl = &HTML::Entities::encode($url,'<>&"'); - my $state = &embedded_form_elems($uploadphase,$primaryurl,$newidx); - my ($embedded,$num) = + my $state = &embedded_form_elems($uploadphase,$primaryurl,$newidx); + my ($embedded,$num) = &Apache::loncommon::ask_for_embedded_content( '/adm/coursedocs',$state,$allfiles,$codebase,{'docs_url' => $url}); if ($embedded) { if ($num) { $$upload_output .= - '

'.&mt('This file contains embedded multimedia objects, which need to be uploaded.').'

'.$embedded; + '

'.&mt('This file contains embedded multimedia objects, which need to be uploaded.').'

'.$embedded; $nextphase = $uploadphase; } else { $$upload_output .= $embedded; @@ -2610,7 +2610,24 @@ sub init_breadcrumbs { bug=>'Instructor Interface'}); } +# subroutine to list form elements +sub create_list_elements { + my @formarr = @_; + my $list = ''; + for my $button (@formarr){ + for my $picture(keys %$button) { + $list .= &Apache::lonhtmlcommon::htmltag('li', $picture.' '.$button->{$picture}, {class => 'LC_menubuttons_inline_text'}); + } + } + return $list; +} +# subroutine to create ul from list elements +sub create_form_ul { + my $list = shift; + my $ul = &Apache::lonhtmlcommon::htmltag('ul',$list, {class => 'LC_ListStyleNormal'}); + return $ul; +} sub handler { @@ -2749,26 +2766,6 @@ sub handler { } } -# subroutine to list form elements -sub create_list_elements { - my @formarr = @_; - my $list = ''; - for my $button (@formarr){ - for my $picture(keys %$button) { - #my $link = Apache::lonhtmlcommon::htmltag('a' ,$button->{$picture}, {href => "test"}); - $list .= Apache::lonhtmlcommon::htmltag('li', $picture.' '.$button->{$picture}, {class => 'LC_menubuttons_inline_text'}); - } - } - return $list; -} - -# subroutine to create ul from list elements -sub create_form_ul { - my $list = shift; - my $ul = Apache::lonhtmlcommon::htmltag('ul',$list, {class => 'LC_ListStyleNormal'}); - return $ul; -} - # get course data my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'}; my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'}; @@ -2825,9 +2822,9 @@ sub create_form_ul { if ($allowed) { if (($env{'form.uploaddoc.filename'}) && ($env{'form.cmd'}=~/^upload_(\w+)/)) { - my $context = $1; + my $context = $1; # Process file upload - phase one - upload and parse primary file. - undef($hadchanges); + undef($hadchanges); $uploadphase = &process_file_upload(\$upload_output,$coursenum,$coursedom, \%allfiles,\%codebase,$context); if ($hadchanges) { @@ -2835,9 +2832,9 @@ sub create_form_ul { } $r->print($upload_output); } elsif ($env{'form.phase'} eq 'upload_embedded') { - # Process file upload - phase two - upload embedded objects + # Process file upload - phase two - upload embedded objects $uploadphase = 'check_embedded'; - my $primaryurl = &HTML::Entities::encode($env{'form.primaryurl'},'<>&"'); + my $primaryurl = &HTML::Entities::encode($env{'form.primaryurl'},'<>&"'); my $state = &embedded_form_elems($uploadphase,$primaryurl, $env{'form.newidx'}); my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; @@ -2845,7 +2842,7 @@ sub create_form_ul { my ($destination,$dir_root) = &embedded_destination(); my $url_root = '/uploaded/'.$docudom.'/'.$docuname; my $actionurl = '/adm/coursedocs'; - my ($result,$flag) = + my ($result,$flag) = &Apache::loncommon::upload_embedded('coursedoc',$destination, $docuname,$docudom,$dir_root,$url_root,undef,undef,undef,$state, $actionurl); @@ -2863,7 +2860,7 @@ sub create_form_ul { } } - unless ($showdoc || $uploadphase) { + unless ($showdoc || $uploadphase) { # ----------------------------------------------------------------------------- my %lt=&Apache::lonlocal::texthash( 'uplm' => 'Upload a new main '.lc($crstype).' document', @@ -2873,7 +2870,7 @@ sub create_form_ul { 'upld' => 'Import Document', 'srch' => 'Search', 'impo' => 'Import', - 'book' => 'Import Bookmarks', + 'wish' => 'Import from Wishlist', 'selm' => 'Select Map', 'load' => 'Load Map', 'reco' => 'Recover Deleted Documents', @@ -2946,7 +2943,7 @@ SEDFFORM my @simpleeditdefaultforma = ( { ''.$lt{srch}.'' => "$uploadtag$lt{'srch'}" }, { ''.$lt{impo}.'' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" }, - { ''.$lt{book}.'' => "$lt{'book'}" }, + { ''.$lt{wish}.'' => "$lt{'wish'}" }, ); $simpleeditdefaultform .= create_form_ul(create_list_elements(@simpleeditdefaultforma)); $simpleeditdefaultform .=(< - $lt{'reco'} + $lt{'reco'} RFORM @@ -3261,7 +3258,7 @@ if($env{'form.pagepath'}) { my @tools = ( # {''.$lt{extr}.''=>$extresourcesform}, # {''.$lt{imsf}.''=>$imspform}, - {''.$lt{reco}.''=>$recoverform}, + {''.$lt{reco}.''=>$recoverform}, ); my %orderhash = ( @@ -3464,7 +3461,7 @@ sub embedded_destination { sub return_to_editor { my $actionurl = '/adm/coursedocs'; - return '

'."\n". + return '

'."\n". '

'."\n". ''.&mt('Return to Editor'). '

';