--- loncom/interface/londocs.pm 2009/01/30 10:02:46 1.331 +++ loncom/interface/londocs.pm 2010/08/14 00:20:06 1.431 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.331 2009/01/30 10:02:46 muellerd Exp $ +# $Id: londocs.pm,v 1.431 2010/08/14 00:20:06 raeburn 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; @@ -72,7 +73,7 @@ sub storemap { &LONCAPA::map::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. $map,1); if ($errtext) { return ($errtext,2); } - + $hadchanges=1; return ($errtext,0); } @@ -116,34 +117,39 @@ sub authorhosts { sub dumpbutton { my ($home,$other,%outhash)=&authorhosts(); - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_type(); if ($home+$other==0) { return ''; } if ($home) { - return ''. - &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs'); - } else { - return '
'. - &mt('Dump '.$type. - ' DOCS to Construction Space: available on other servers'). - '
'; + my $link = + "" + .&mt('Dump '.$crstype.' Documents to Construction Space') + .''; + return + $link.' ' + .&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs') + .'
'; + } else { + return + &mt('Dump '.$crstype.' Documents to Construction Space: available on other servers'); } } sub clean { my ($title)=@_; $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs; - return $title; + return $title; } sub dumpcourse { my ($r) = @_; - my $type = &Apache::loncommon::course_type(); - $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space'). - '
'); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space')); + my $crstype = &Apache::loncommon::course_type(); + $r->print(&Apache::loncommon::start_page('Dump '.$crstype.' Documents to Construction Space'). + ''); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' Documents to Construction Space')); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { return ''; } my $origcrsid=$env{'request.course.id'}; @@ -175,8 +181,8 @@ sub dumpcourse { my $fail=0; for (my $i=0;$i<$#dirs;$i++) { $makepath.='/'.$dirs[$i]; - unless (-e $makepath) { - unless(mkdir($makepath,0777)) { $fail=1; } + unless (-e $makepath) { + unless(mkdir($makepath,0777)) { $fail=1; } } } $r->print('
'.$item.' => '.$newfilename.': '); @@ -254,35 +260,44 @@ sub dumpcourse { $r->print(&Apache::loncommon::end_data_table()); &untiehash(); $r->print( - '

'); + '

'); } } sub exportbutton { - my $type = &Apache::loncommon::course_type(); - return ''. - &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs'); + my $crstype = &Apache::loncommon::course_type(); + return "".&mt('IMS Export')."". + &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
'; } sub exportcourse { my $r=shift; - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_type(); my %discussiontime = &Apache::lonnet::dump('discussiontimes', $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); 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

'. - '
'. - &mt('Unable to retrieve information about course contents'). - '
'.&mt('Return to Course Editor').''); - &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'}); + $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package'). + '

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

'. + '
'); + if ($crstype eq 'Community') { + $r->print(&mt('Unable to retrieve information about community contents')); + } else { + $r->print(&mt('Unable to retrieve information about course contents')); + } + $r->print('
'); + if ($crstype eq 'Community') { + $r->print(&mt('Return to Community Editor')); + } else { + $r->print(&mt('Return to Course Editor')); + } + $r->print(''); + &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); return; } my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); @@ -298,7 +313,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,35 +346,53 @@ sub exportcourse { open(OUTPUT, "zip -r $imszip * 2> /dev/null |"); close(OUTPUT); chdir $cwd; - $outcome .= &mt('Download the zip file from IMS '.lc($type).' archive
',$imszipfile,); + $outcome .= '

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

'; if ($copyresult) { - $outcome .= &mt('The following errors occurred during export - [_1]',$copyresult); + $outcome .= '

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

'; } } 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 your course 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 '.$crstype.' to IMS Package')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); $r->print($outcome); $r->print(&Apache::loncommon::end_page()); } else { - my $display; - $display = '
'."\n"; - $display .= &mt('Choose which items you wish to export from your '.$type.'.

'); - $display .= ''. - ''. - ''. - ''. - '
 Content items'. - ''. + &mt('Choose which items you wish to export from your '.$crstype.'.'). + '

'. + '
'. + ''.&mt('Content items').''. + ''. - '  
  
 Discussion posts'. - ''. - '  
'; + '  '; + if ($numdisc > 0) { + $display .= '
'. + ''.&mt('Discussion posts').''. + ''. + '  '. + '
'; + } + $display .= ''; my $curRes; my $depth = 0; my $count = 0; @@ -358,13 +401,13 @@ sub exportcourse { my %parent = (); my %children = (); my $lastcontainer = $startcount; - my @bgcolors = ('#F6F6F6','#FFFFFF'); - $display .= ''. - ''; if ($numdisc > 0) { - $display.='Export discussion posts?'."\n"; + $display .= ''; } - $display.=' '; + $display .= &Apache::loncommon::end_data_table_header_row(); while ($curRes = $it->next()) { if (ref($curRes)) { $count ++; @@ -385,39 +428,42 @@ sub exportcourse { $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; } } - my $color = $count%2; - $display .=''; + $display .= ' '.$curRes->title().''."\n"; + + # Existing discussion posts? if ($discussiontime{$ressymb} > 0) { $boards ++; - $currelem = $count+$boards+$startcount; - $display .= ''."\n"; - } else { - $display .= ''."\n"; + $display .= ''."\n"; + } elsif ($numdisc > 0) { + $display .= ''."\n"; } + $display .= &Apache::loncommon::end_data_table_row(); } } + $display .= &Apache::loncommon::end_data_table(); my $scripttag = qq| - |; - $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', + $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package', $scripttag)); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); - $r->print($display.'
Export content item?
 '."\n"; + $display .= &Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .''.&mt('Export content item?').''.&mt('Export discussion posts?').'
'."\n". - ''."\n" + .'is_sequence()) || ($curRes->is_page())) { - my $checkitem = $count + $boards + $startcount; - $display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"'; + $lastcontainer = $currelem; + $display .= 'onclick="javascript:propagateCheck('."'$currelem'".')"'; } $display .= ' />'."\n"; for (my $i=0; $i<$depth; $i++) { - $display .= ''."\n"; + $display .= ('' x2)."\n"; } if ($curRes->is_sequence()) { - $display .= ' '."\n"; - $lastcontainer = $count + $startcount + $boards; + $display .= ' '."\n"; } elsif ($curRes->is_page()) { - $display .= ' '."\n"; - $lastcontainer = $count + $startcount + $boards; + $display .= ' '."\n"; } - my $currelem = $count+$boards+$startcount; $children{$parent{$depth}} .= $currelem.':'; - $display .= ' '.$curRes->title().'   ' + .'' + .' 
'. - '

'. + $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); + $r->print($display. + '

'. '

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

'); } } @@ -759,7 +805,7 @@ sub replicate_content { if ($caller eq 'templateupload') { $url = $symb; $url =~ s#//#/#g; - } else { + } else { ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); } my $content; @@ -799,9 +845,9 @@ sub replicate_content { $$message = 'Could not render '.$url.' server message - '.$rtncode."
\n"; } } elsif ($caller eq 'noedit') { -# Need to render the resource without the LON-CAPA Internal header and the Post discussion footer, and then set $content equal to this. +# Need to render the resource without the LON-CAPA Internal header and the Post discussion footer, and then set $content equal to this. $repstatus = 'ok'; - $content = 'Not the owner of this resource'; + $content = 'Not the owner of this resource'; } if ($repstatus eq 'ok') { print $copiedfile $content; @@ -852,14 +898,14 @@ sub extract_media { } } if ($caller eq 'resource') { - my $respath = $Apache::lonnet::perlvar{'lonDocRoot'}.'/res'; - my $embed_path = &Apache::lonnet::filelocation($respath,$embed_url); + my $respath = $Apache::lonnet::perlvar{'lonDocRoot'}.'/res'; + my $embed_path = &Apache::lonnet::filelocation($respath,$embed_url); $embed_content = &Apache::lonnet::getfile($embed_path); unless ($embed_content eq -1) { $repstatus = 'ok'; } } elsif ($caller eq 'uploaded') { - + $repstatus = &Apache::lonnet::getuploaded('GET',$embed_url,$cdom,$cnum,\$embed_content,$rtncode); } if ($repstatus eq 'ok') { @@ -921,10 +967,10 @@ sub group_import { while (@files) { my ($name, $url, $residx) = @{ shift(@files) }; - if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) + if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) && ($caller eq 'londocs') && (!&Apache::lonnet::stat_file($url))) { - + my $errtext = ''; my $fatal = 0; my $newmapstr = ''."\n". @@ -944,7 +990,7 @@ sub group_import { } } if ($url) { - if (!$residx + if (!$residx || defined($LONCAPA::map::zombies[$residx])) { $residx = &LONCAPA::map::getresidx($url,$residx); push(@LONCAPA::map::order, $residx); @@ -953,7 +999,7 @@ sub group_import { if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; } $url = &LONCAPA::map::qtunescape($url); $name = &LONCAPA::map::qtunescape($name); - $LONCAPA::map::resources[$residx] = + $LONCAPA::map::resources[$residx] = join(':', ($name, $url, $ext, 'normal', 'res')); } } @@ -961,7 +1007,7 @@ sub group_import { } sub breadcrumbs { - my ($where,$allowed,$type)=@_; + my ($allowed,$crstype)=@_; &Apache::lonhtmlcommon::clear_breadcrumbs(); my (@folders); if ($env{'form.pagepath'}) { @@ -976,6 +1022,15 @@ sub breadcrumbs { my $isencrypted=0; my $ishidden=0; my $is_random_order=0; + if (!$allowed) { + my $description = $env{'course.'.$env{'request.course.id'}.'.description'}; + &Apache::lonhtmlcommon::add_breadcrumb( + {'href' => '/adm/menu', + 'title'=> 'Go to main menu', + 'text' => $description, + }); + $plain .= $description.' >'; + } while (@folders) { my $folder=shift(@folders); my $foldername=shift(@folders); @@ -984,9 +1039,9 @@ sub breadcrumbs { my $url='/adm/coursedocs?folderpath='. &escape($folderpath); my $name=&unescape($foldername); -# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername +# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//; - if ($1 ne '') { + if ($1 ne '') { $randompick=$1; } else { $randompick=-1; @@ -995,24 +1050,19 @@ sub breadcrumbs { if ($3) { $isencrypted=1; } if ($4 ne '') { $is_random_order = 1; } if ($folder eq 'supplemental') { - if ($allowed) { - $name = &mt('Supplemental '.$type.' Documents'); - } else { - $name = &mt($type.' Documents'); - } + $name = &mt('Supplemental '.$crstype.' Documents'); } &Apache::lonhtmlcommon::add_breadcrumb( {'href'=>$url.$cpinfo, 'title'=>$name, - 'text'=>''. - $name.'', + 'text'=>$name, 'no_mt'=>1, }); $plain.=$name.' > '; } $plain=~s/\>\;\s*$//; return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', - 'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); + undef, undef, 1 ),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); } sub log_docs { @@ -1125,7 +1175,7 @@ sub docs_change_log { foreach my $key (@changes) { $wholeentry.=':'.$docslog{$id}{'logentry'}{$key}; } - if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } + if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } } my $count = 0; my $time = @@ -1176,7 +1226,7 @@ sub docs_change_log { if ($oldname ne '' && $oldname ne $newname) { $r->print(&LONCAPA::map::qtescape($newname)); } - } + } $r->print(' - - - -
-$supupdocform - -$supnewfolderform -
-$supnewextform -
-$supnewsylform -
-$supnewaboutmeform -
-ENDSUPFORM - } + +my @specialdocs = ( + {''.$lt{syll}.'' + =>$supnewsylform}, + {''.$lt{mypi}.'' + =>$supnewaboutmeform}, + ); +my @supimportdoc = ( + {''.$lt{extr}.'' + =>$supnewextform}, + ); +$supupdocform = create_form_ul(create_list_elements(@supimportdoc)) . '
' . $supupdocform; +my %suporderhash = ( + '00' => ['Supnewfolder', $supnewfolderform], + 'ee' => ['Import Documents',$supupdocform], + 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))] + ); + + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); + if ($error) { + $r->print('

'.$error.'

'); + } + my $tid='2'; + $r->print(&generate_edit_table($tid,\%suporderhash)); + } else { + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); + if ($error) { + $r->print('

'.$error.'

'); + } } - $r->print(''); + + +$r->print(''); +$r->print(''); + + if ($allowed) { $r->print('
@@ -3308,7 +3467,6 @@ ENDSUPFORM
'); } - } else { unless ($upload_result eq 'phasetwo') { # -------------------------------------------------------- This is showdoc mode @@ -3321,82 +3479,86 @@ ENDSUPFORM } $r->print(&Apache::loncommon::end_page()); return OK; -} +} sub generate_admin_options { - my ($containertag,$uploadtag,$lt_ref,$help_ref,$env_ref) = @_; - my %lt = %{$lt_ref}; + my ($containertag,$uploadtag,$help_ref,$env_ref) = @_; + my %lt=&Apache::lonlocal::texthash( + 'vc' => 'Verify Content', + 'cv' => 'Check/Set Resource Versions', + 'ls' => 'List Symbs', + 'sl' => 'Show Log', + 'imse' => 'IMS Export', + 'dcd' => 'Dump Course Documents to Construction Space: available on other servers' + ); my %help = %{$help_ref}; my %env = %{$env_ref}; my $dumpbut=&dumpbutton(); my $exportbut=&exportbutton(); - return (< - - - - - $containertag - -
- - $uploadtag -
-
-
    -
  • - $help{'Verify_Content'} -
  • -
  • - $help{'Check_Resource_Versions'} -
  • -
  • - $dumpbut -
  • -
  • - $exportbut -
  • -
  • - -
  • -
  • - - -
  • -
-
-
 
-ENDOPTIONFORM + my @list = ( + {''.$lt{vc}.'' + => "$lt{'vc'}$help{'Verify_Content'}"}, + {''.$lt{cv}.'' + =>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, + ); + if($dumpbut ne ''){ + push @list, {''.$lt{dcd}.''=>$dumpbut}; + } + push @list, ({''.$lt{imse}.'' + =>$exportbut}, + {''.$lt{ls}.'' + =>"$lt{'ls'}"}, + {''.$lt{sl}.'' + =>"$lt{'sl'}"}, + ); + return '
'.create_form_ul(create_list_elements(@list)).'
'; } sub generate_edit_table { - my ($varcd,$namehash_ref,$orderhash_ref) = @_; - #my %optionhash = %{$optionhash_ref}; #id verlinkt mit inhalt - #my %tablehash = %{$tablehash_ref}; - my %namehash = %{$namehash_ref}; #name verlinkt mit id - my %orderhash = %{$orderhash_ref}; #name mit kürzel verlinkt mit name - #my %tablehash = %{$tablehash_ref}; + my ($tid,$orderhash_ref) = @_; + return unless(ref($orderhash_ref) eq 'HASH'); + my %orderhash = %{$orderhash_ref}; my $form; - - #foreach my $id (keys(%tablehash)){ - $form = '

'.&mt('Upload '.$varcd).'

'; - - $form .= '
    '; + my $activetab; + my $active; + if($env{'form.active'} ne ''){ + $activetab = $env{'form.active'}; + } + $form = '
    '; + $form .= ''; + $form .= '
    '; + foreach my $field (keys(%orderhash)){ + if($field ne '00'){ + if($activetab eq '' || $activetab ne $field){ + $active = 'style="display: none;"'; + }elsif($activetab eq $field){ + $active = 'style="display:block;"'; + } + $form .= '
    '.${$orderhash{$field}}[1] + .'
    '; + } } $form .= '
    '; -#} + return $form; } @@ -3409,12 +3571,12 @@ sub editing_js { p_mnp => 'Name of New Page', t_mnp => 'New Page', p_mxu => 'Title for the Uploaded Score', - p_msp => 'Title for the Page', + p_msp => 'Name of Simple Course Page', p_msb => 'Title for the Problem', p_mdb => 'Title for the Drop Box', - p_mbb => 'Title for the Bulletin Board', - p_mab => "Enter user:domain for User's 'About Me' Page", - p_mab2 => "About [_99]", + p_mbb => 'Title for the Discussion Board', + p_mab => "Enter user:domain for User's Personal Information Page", + p_mab2 => 'Personal Information Page of ', p_mab_alrt1 => 'Not a valid user:domain', p_mab_alrt2 => 'Please enter both user and domain in the format user:domain', p_chn => 'New Title', @@ -3462,7 +3624,7 @@ function edittext(targetname,residx,titl function makeexamupload() { var title=prompt('$lt{"p_mxu"}'); - if (title) { + if (title) { this.document.forms.newexamupload.importdetail.value= escape(title)+'=/res/lib/templates/examupload.problem'; this.document.forms.newexamupload.submit(); @@ -3471,7 +3633,7 @@ function makeexamupload() { function makesmppage() { var title=prompt('$lt{"p_msp"}'); - if (title) { + if (title) { this.document.forms.newsmppg.importdetail.value= escape(title)+'=/adm/$udom/$uname/$now/smppg'; this.document.forms.newsmppg.submit(); @@ -3480,7 +3642,7 @@ function makesmppage() { function makesmpproblem() { var title=prompt('$lt{"p_msb"}'); - if (title) { + if (title) { this.document.forms.newsmpproblem.importdetail.value= escape(title)+'=/res/lib/templates/simpleproblem.problem'; this.document.forms.newsmpproblem.submit(); @@ -3489,7 +3651,7 @@ function makesmpproblem() { function makedropbox() { var title=prompt('$lt{"p_mdb"}'); - if (title) { + if (title) { this.document.forms.newdropbox.importdetail.value= escape(title)+'=/res/lib/templates/DropBox.problem'; this.document.forms.newdropbox.submit(); @@ -3514,109 +3676,157 @@ function makeabout() { if ((comp[0]) && (comp[1])) { this.document.forms.newaboutsomeone.importdetail.value= '$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme'; - this.document.forms.newaboutsomeone.submit(); - } else { - alert("$lt{'p_mab_alrt1'}"); - } - } else { - alert("$lt{'p_mab_alrt2'}"); - } + this.document.forms.newaboutsomeone.submit(); + } else { + alert("$lt{'p_mab_alrt1'}"); } +} else { + alert("$lt{'p_mab_alrt2'}"); +} +} } function makeims() { - var caller = document.forms.ims.folder.value; - var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"; - newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes"); - newWindow.location.href = newlocation; +var caller = document.forms.ims.folder.value; +var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"; +newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes"); +newWindow.location.href = newlocation; } function finishpick() { - var title=this.document.forms.extimport.title.value; - var url=this.document.forms.extimport.url.value; - var form=this.document.forms.extimport.useform.value; - var residx=this.document.forms.extimport.residx.value; - eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();'); +var title=this.document.forms.extimport.title.value; +var url=this.document.forms.extimport.url.value; +var form=this.document.forms.extimport.useform.value; +var residx=this.document.forms.extimport.residx.value; +eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();'); } function changename(folderpath,index,oldtitle,container,pagesymb) { - var title=prompt('$lt{"p_chn"}',oldtitle); - if (title) { - this.document.forms.renameform.markcopy.value=-1; - this.document.forms.renameform.title.value=title; - this.document.forms.renameform.cmd.value='rename_'+index; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); - } +var title=prompt('$lt{"p_chn"}',oldtitle); +if (title) { +this.document.forms.renameform.markcopy.value=-1; +this.document.forms.renameform.title.value=title; +this.document.forms.renameform.cmd.value='rename_'+index; +if (container == 'sequence') { + this.document.forms.renameform.folderpath.value=folderpath; +} +if (container == 'page') { + this.document.forms.renameform.pagepath.value=folderpath; + this.document.forms.renameform.pagesymb.value=pagesymb; +} +this.document.forms.renameform.submit(); +} } function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) { - if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) { - this.document.forms.renameform.markcopy.value=-1; - this.document.forms.renameform.cmd.value='del_'+index; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); - } +if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) { +this.document.forms.renameform.markcopy.value=-1; +this.document.forms.renameform.cmd.value='del_'+index; +if (container == 'sequence') { + this.document.forms.renameform.folderpath.value=folderpath; +} +if (container == 'page') { + this.document.forms.renameform.pagepath.value=folderpath; + this.document.forms.renameform.pagesymb.value=pagesymb; +} +this.document.forms.renameform.submit(); +} } function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) { - if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) { - this.document.forms.renameform.cmd.value='cut_'+index; - this.document.forms.renameform.markcopy.value=index; - this.document.forms.renameform.copyfolder.value=folder+'.'+container; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); - } +if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) { +this.document.forms.renameform.cmd.value='cut_'+index; +this.document.forms.renameform.markcopy.value=index; +this.document.forms.renameform.copyfolder.value=folder+'.'+container; +if (container == 'sequence') { + this.document.forms.renameform.folderpath.value=folderpath; +} +if (container == 'page') { + this.document.forms.renameform.pagepath.value=folderpath; + this.document.forms.renameform.pagesymb.value=pagesymb; +} +this.document.forms.renameform.submit(); +} } function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) { - this.document.forms.renameform.markcopy.value=index; - this.document.forms.renameform.copyfolder.value=folder+'.'+container; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); +this.document.forms.renameform.markcopy.value=index; +this.document.forms.renameform.copyfolder.value=folder+'.'+container; +if (container == 'sequence') { +this.document.forms.renameform.folderpath.value=folderpath; +} +if (container == 'page') { +this.document.forms.renameform.pagepath.value=folderpath; +this.document.forms.renameform.pagesymb.value=pagesymb; +} +this.document.forms.renameform.submit(); +} + +function unselectInactive(nav) { +currentNav = document.getElementById(nav); +currentLis = currentNav.getElementsByTagName('LI'); +for (i = 0; i < currentLis.length; 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); +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++) { + if(currentDivs[i].className == 'LC_ContentBox'){ + currentDivs[i].style.display = 'none'; + } +} } -function hideAll() { - currentData = document.getElementById('content'); - currentDivs = currentData.getElementsByTagName('div'); - for (i = 0; i < currentDivs.length; i++) { - currentDivs[i].style.display = 'none'; +function openTabs(pageId) { + tabnav = document.getElementById(pageId).getElementsByTagName('UL'); + if(tabnav.length > 2 ){ + currentNav = document.getElementById(tabnav[1].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('"'); + if(tab.length < 2) { + tab = funcString.split("'"); + } + currentData = document.getElementById(tab[1]); + currentData.style.display = 'block'; + } + } } } -function showPage(current, pageId) { - hideAll(); +function showPage(current, pageId, nav, data) { + hideAll(current, nav, data); + openTabs(pageId); + unselectInactive(nav); current.className = 'active'; currentData = document.getElementById(pageId); currentData.style.display = 'block'; return false; } +function injectData(current, hiddenField, name, value) { + currentElement = document.getElementById(hiddenField); + currentElement.name = name; + currentElement.value = value; + current.submit(); +} + ENDNEWSCRIPT } 1; @@ -3642,7 +3852,7 @@ Available help topics =item mapread() -Mapread read maps into LONCAPA::map:: global arrays +Mapread read maps into LONCAPA::map:: global arrays @order and @resources, determines status sets @order - pointer to resources in right order sets @resources - array with the resources with correct idx