--- loncom/interface/londocs.pm 2009/06/17 17:36:25 1.373 +++ loncom/interface/londocs.pm 2009/09/19 11:01:44 1.386 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.373 2009/06/17 17:36:25 bisitz Exp $ +# $Id: londocs.pm,v 1.386 2009/09/19 11:01:44 tempelho Exp $ # # Copyright Michigan State University Board of Trustees # @@ -35,6 +35,7 @@ use Apache::Constants qw(:common :http); use Apache::imsexport; use Apache::lonnet; use Apache::loncommon; +use Apache::lonhtmlcommon; use LONCAPA::map(); use Apache::lonratedt(); use Apache::lonxml; @@ -119,8 +120,8 @@ sub dumpbutton { my $type = &Apache::loncommon::course_type(); if ($home+$other==0) { return ''; } if ($home) { - return ''. + my $link = "".&mt('Dump '.$type.' DOCS to Construction Space').""; + return $link.' '. &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'
'; } else { return '
'. @@ -262,8 +263,7 @@ sub dumpcourse { sub exportbutton { my $type = &Apache::loncommon::course_type(); - return ''. + return "".&mt('IMS Export')."". &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
'; } @@ -277,8 +277,8 @@ sub exportcourse { my $numdisc = keys(%discussiontime); my $navmap = Apache::lonnavmaps::navmap->new(); if (!defined($navmap)) { - $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'). - '

IMS Export Failed

'. + $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package'). + '

'.&mt('IMS Export Failed').'

'. '
'. &mt('Unable to retrieve information about course contents'). '
'.&mt('Return to Course Editor').''); @@ -298,7 +298,17 @@ sub exportcourse { my @exportitems = &Apache::loncommon::get_env_multiple('form.archive'); my @discussions = &Apache::loncommon::get_env_multiple('form.discussion'); if (@exportitems == 0 && @discussions == 0) { - $outcome = '
As you did not select any content items or discussions for export, an IMS package has not been created. Please go back to select either content items or discussions for export'; + $outcome = + '

' + .&mt('As you did not select any content items or discussions' + .' for export, an IMS package has not been created.') + .'

' + .'

' + .&mt('Please [_1]go back[_2] to select either content items' + .' or discussions for export.' + ,'' + ,'') + .'

'; } else { my $now = time; my %symbs; @@ -321,22 +331,30 @@ sub exportcourse { open(OUTPUT, "zip -r $imszip * 2> /dev/null |"); close(OUTPUT); chdir $cwd; - $outcome .= '

' - .&mt('Download the zip file from [_1]IMS '.lc($type).' archive[_2]' - ,'','') - .'

'; if ($copyresult) { $outcome .= '

' .&mt('The following errors occurred during export - [_1]' ,$copyresult) .'

'; } + $outcome .= '

' + .&mt('[_1]Your IMS package[_2] is ready for download.' + ,'','') + .'

'; } else { - $outcome = '
'.&mt('Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.').'
'; + $outcome = '

' + .&mt('Unfortunately you will not be able to retrieve' + .' an IMS archive of this posts at this time,' + .' because there was a problem creating a' + .' manifest file.') + .'

' + .'

' + .&mt('Go Back') + .'

'; } } - $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package')); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); + $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); $r->print($outcome); $r->print(&Apache::loncommon::end_page()); } else { @@ -489,13 +507,13 @@ function containerCheck(item) { // ]]> |; - $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', + $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package', $scripttag)); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); $r->print($display. '

'. '

'); + &mt('Export').'" />

'); } } @@ -1030,7 +1048,7 @@ sub breadcrumbs { } $plain=~s/\>\;\s*$//; return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', - 'LC_docs_path', undef, 1 ),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); + undef, undef, 1 ),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); } sub log_docs { @@ -1254,10 +1272,11 @@ sub print_paste_buffer { my ($r,$container) = @_; return if (!defined($env{'docs.markedcopy_url'})); - $r->print(<

-ENDPASTE - $r->print(' '); + $r->print('

' + .''.&mt('Clipboard').'' + .'
' + .' ' + ); my $type; if ($env{'docs.markedcopy_url'} =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) { @@ -1271,7 +1290,7 @@ ENDPASTE if ($extension eq 'sequence' && $env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) { $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); - $icon .= '/folder_closed.gif'; + $icon .= '/navmap.folder.closed.gif'; } $icon = ''; $r->print($icon.$type.': '. &parse_supplemental_title(&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}))); @@ -1286,7 +1305,7 @@ ENDPASTE '); } - $r->print('

'); + $r->print('
'); } sub do_paste_from_buffer { @@ -1569,34 +1588,67 @@ sub editor { my $idx=0; my $shown=0; if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) { - $r->print('

'.&mt('Parameters').':

' + .'
' + .'
'); # --------------------------------------------------------- Standard documents my $savefolderpath; my $active = 'style="display: none;"'; if($activeClass == 0){ $active = 'style="display: block;"'; } + if($env{'request.role'}=~/^cc/){ $r->print('
'); my $folder=$env{'form.folder'}; if ($folder eq '' || $folder=~/^supplemental/) { @@ -2974,14 +3053,14 @@ HIDDENFORM my $recoverform=(< - + $lt{'reco'} RFORM my $imspform=(< - + $lt{'imsf'} IMSPFORM @@ -2991,10 +3070,8 @@ IMSPFORM $uploadtag - - + $lt{'navc'} $help{'Navigate_Content'} - NNFORM my $newsmppageform=(< $uploadtag - - $help{'Simple Page'} - + $lt{'sipa'} + $help{'Simple Page'} NSPFORM @@ -3014,10 +3089,8 @@ NSPFORM $uploadtag - - $help{'Simple Problem'} - + $lt{'sipr'} + $help{'Simple Problem'} NSPROBFORM @@ -3027,10 +3100,7 @@ NSPROBFORM $uploadtag - - - + $lt{'drbx'} NDBFORM @@ -3039,11 +3109,8 @@ NDBFORM $uploadtag - - + $lt{'scuf'} $help{'Score_Upload_Form'} - NEXUFORM @@ -3052,11 +3119,8 @@ NEXUFORM $uploadtag - - + $lt{'bull'} $help{'Bulletin Board'} - NBFORM @@ -3066,10 +3130,8 @@ NBFORM $uploadtag - - + $lt{'mypi'} $help{'My Personal Information Page'} - NAMFORM @@ -3078,10 +3140,7 @@ NAMFORM $uploadtag - - - + $lt{'abou'} NASOFORM @@ -3092,44 +3151,42 @@ NASOFORM $uploadtag - - + $lt{'rost'} $help{'Course Roster'} - NROSTFORM my $specialdocumentsform; +my @specialdocumentsforma; my $newfolderform; unless ($env{'form.pagepath'}) { my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); - + my $newpageform=(< - - $help{'Adding_Pages'} - + $lt{'newp'} + $help{'Adding_Pages'} NPFORM - + $newfolderform=(< - - $help{'Adding_Folders'} - + $lt{'newf'}$help{'Adding_Folders'} NFFORM + my @newfolderforma= ( + { pic02 => "$newfolderform" } + ); + + + $newfolderform = create_form_ul(create_list_elements(@newfolderforma)); my $newsylform=(< @@ -3137,10 +3194,9 @@ NFFORM $uploadtag - - + $lt{'syll'} $help{'Syllabus'} - + NSYLFORM @@ -3150,30 +3206,50 @@ NSYLFORM $uploadtag - - + $lt{'grpo'} $help{'Group Portfolio'} - NGFFORM - - $specialdocumentsform="
$newpageform
$newsylform
$newgroupfileform"; + @specialdocumentsforma=( + {pic06=>$newpageform}, + {pic07=>$newsylform}, + {pic08=>$newgroupfileform}, + ); + } - $specialdocumentsform.="
$newnavform
$newsmppageform -
$newsmpproblemform
$newdropboxform -
$newexuploadform
$newbulform -
$newaboutmeform
$newaboutsomeoneform -
$newrosterform"; + push @specialdocumentsforma, ({pic09=>$newnavform}, + {pic10=>$newsmppageform}, + {pic11=>$newsmpproblemform}, + {pic12=>$newdropboxform}, + {pic13=>$newexuploadform}, + {pic14=>$newbulform}, + {pic15=>$newaboutmeform}, + {pic16=>$newaboutsomeoneform}, + {pic17=>$newrosterform},); + + $specialdocumentsform = create_form_ul(create_list_elements(@specialdocumentsforma)); + if($env{'form.pagepath'}) { - $specialdocumentsform="
$newsmpproblemform
$newexuploadform"; + + @specialdocumentsforma=( + {pic32=>$newsmpproblemform}, + {pic33=>$newexuploadform} + ); + $specialdocumentsform= create_form_ul(create_list_elements(@specialdocumentsforma)); } +my @tools = ( + {pic18=>$extresourcesform}, + {pic19=>$imspform}, + {pic20=>$recoverform}, + ); + my %orderhash = ( - 'aa' => ['Upload Document',$fileuploadform.'
'.$newfolderform], - 'bb' => ['Published Documents',$simpleeditdefaultform], + 'aa' => ['Upload Document',$fileuploadform.''.$newfolderform], + 'bb' => ['Published Resources',$simpleeditdefaultform], 'cc' => ['Special Documents',$specialdocumentsform], - 'dd' => ['Tools',$extresourcesform.'
'.$imspform.'
'.$recoverform.'
'.&generate_admin_options($containertag,$uploadtag,\%help,\%env)], - 'zz' => ['Hide all Options'], + 'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options($containertag,$uploadtag,\%help,\%env)], + 'zz' => ['Hide'], ); my $tid='1'; my $varcd = 'Main Course Documents'; @@ -3188,9 +3264,8 @@ $r->print(&generate_edit_table($tid,$var } &changewarning($r,''); - $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc', - &mt('Editing the Table of Contents for your '.$type))); $r->print('
'); + } if ($env{'form.pagepath'}) { } # ----------------------------------------------------- Supplemental documents @@ -3218,8 +3293,11 @@ $r->print('
'); my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); + my @supupdocform = ( + {pic27=>"$lt{'upld'}$help{'Uploading_From_Harddrive'}"}, + ); my $supupdocform=(< +
$fileupload
@@ -3229,30 +3307,25 @@ $r->print('
');

$lt{'comment'}:
- +
- - - $help{'Uploading_From_Harddrive'} - - SUPDOCFORM + $supupdocform .= create_form_ul(create_list_elements(@supupdocform)).""; my $supnewfolderform=(< - - $help{'Adding_Folders'} - + $lt{'newf'} + $help{'Adding_Folders'} SNFFORM + + my @supnewfolderforma = ({pic28=>$supnewfolderform}); + $supnewfolderform = create_form_ul(create_list_elements(@supnewfolderforma)); my $supnewextform=(< - - $help{'Adding_External_Resource'} - + $lt{'extr'} $help{'Adding_External_Resource'} SNEFORM @@ -3274,45 +3343,48 @@ SNEFORM - - + $lt{'syll'} $help{'Syllabus'} - SNSFORM my $supnewaboutmeform=(< +
- - + $lt{'mypi'} $help{'My Personal Information Page'} -
SNAMFORM - +my @specialdocs = ( + {pic29=>$supnewextform}, + {pic30=>$supnewsylform}, + {pic31=>$supnewaboutmeform}, + ); my %suporderhash = ( - 'ee' => ['Upload Document',$supupdocform.'
'.$supnewfolderform], - 'ff' => ['Special Documents',$supnewextform.'
'.$supnewsylform.'
'.$supnewaboutmeform], - 'zz' => ['Hide all Options'], + 'ee' => ['Upload Document',$supupdocform.' '.$supnewfolderform], + 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))], + 'zz' => ['Hide'], ); my $tid='2'; -my $varscd = 'supplCourseDocuments'; +my $varscd = 'Supplemental Course Documents'; $r->print(&generate_edit_table($tid,$varscd,\%suporderhash)); +} + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); if ($error) { $r->print('

'.$error.'

'); - } -$r->print('
'); - } + } $r->print(''); +$r->print(''); + + if ($allowed) { $r->print('
@@ -3348,17 +3420,18 @@ sub generate_admin_options { my %env = %{$env_ref}; my $dumpbut=&dumpbutton(); my $exportbut=&exportbutton(); - return (< - $help{'Verify_Content'}
- $help{'Check_Resource_Versions'}
- $dumpbut - $exportbut - -
- - -ENDOPTIONFORM + my @list = ( + {pic21=>"$lt{'vc'}$help{'Verify_Content'}"}, + {pic22=>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, + ); + if($dumpbut ne ''){ + push @list, {pic23=>$dumpbut}; + } + push @list, ({pic24=>$exportbut}, + {pic25=>"$lt{'ls'}"}, + {pic26=>"$lt{'sl'}"}, + ); + return '
'.create_form_ul(create_list_elements(@list)).'
'; } @@ -3372,23 +3445,23 @@ sub generate_edit_table { if($env{'form.active'} ne ''){ $activetab = $env{'form.active'}; } - $form = '

'.&mt($varcd).'

'; + $form = '
'; $form .= ''; @@ -3400,7 +3473,7 @@ sub generate_edit_table { }elsif($activetab eq $field){ $active = 'style="display:block;"'; } - $form .= '
'.${$orderhash{$field}}[1] .'
'; } @@ -3615,13 +3688,21 @@ function unselectInactive(nav) { currentNav = document.getElementById(nav); currentLis = currentNav.getElementsByTagName('LI'); for (i = 0; i < currentLis.length; i++) { - currentLis[i].className = 'i'; + if(currentLis[i].className == 'right active' || currentLis[i].className == 'right'){ + currentLis[i].className = 'right'; + }else{ + currentLis[i].className = 'i'; + } } } function hideAll(current, nav, data) { unselectInactive(nav); -current.className = 'active'; +if(current.className == 'right'){ + current.className = 'right active' + }else{ + current.className = 'active'; +} currentData = document.getElementById(data); currentDivs = currentData.getElementsByTagName('DIV'); for (i = 0; i < currentDivs.length; i++) { @@ -3631,8 +3712,25 @@ for (i = 0; i < currentDivs.length; i++) } } +function openTabs(pageId) { + tabnav = document.getElementById(pageId).getElementsByTagName('UL'); + if(tabnav.length > 2 ){ + currentNav = document.getElementById(tabnav[0].id); + currentLis = currentNav.getElementsByTagName('LI'); + for(i = 0; i< currentLis.length; i++){ + if(currentLis[i].className == 'active') { + funcString = currentLis[i].onclick.toString(); + tab = funcString.split('"'); + currentData = document.getElementById(tab[1]); + currentData.style.display = 'block'; + } + } + } +} + function showPage(current, pageId, nav, data) { hideAll(current, nav, data); + openTabs(pageId); unselectInactive(nav); current.className = 'active'; currentData = document.getElementById(pageId); @@ -3640,6 +3738,13 @@ function showPage(current, pageId, nav, return false; } +function injectData(current, hiddenField, name, value) { + currentElement = document.getElementById(hiddenField); + currentElement.name = name; + currentElement.value = value; + current.submit(); +} + ENDNEWSCRIPT } 1;