version 1.137.2.2, 2004/09/09 18:57:21
|
version 1.138, 2004/08/22 18:15:54
|
Line 36 use Apache::lonratedt;
|
Line 36 use Apache::lonratedt;
|
use Apache::lonratsrv; |
use Apache::lonratsrv; |
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::loncreatecourse; |
use Apache::loncreatecourse; |
|
use Apache::lonnavmaps; |
use HTML::Entities; |
use HTML::Entities; |
use GDBM_File; |
use GDBM_File; |
use Apache::lonlocal; |
use Apache::lonlocal; |
Line 236 sub dumpcourse {
|
Line 237 sub dumpcourse {
|
} |
} |
} |
} |
|
|
|
# ------------------------------------------------------ Generate "export" button |
|
|
|
sub exportbutton { |
|
return '</td><td bgcolor="#DDDDCC">'. |
|
'<input type="submit" name="exportcourse" value="'. |
|
&mt('Export Course to IMS').'" />'. |
|
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs'); |
|
} |
|
|
|
sub exportcourse { |
|
my $r=shift; |
|
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(); |
|
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
|
my $curRes; |
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['finishexport']); |
|
if ($ENV{'form.finishexport'}) { |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['archive','discussion']); |
|
|
|
my @exportitems = (); |
|
if (defined($ENV{'form.archive'})) { |
|
if (ref($ENV{'form.archive'}) eq 'ARRAY') { |
|
@exportitems = @{$ENV{'form.archive'}}; |
|
} else { |
|
$exportitems[0] = $ENV{'form.archive'}; |
|
} |
|
} |
|
my @discussions = (); |
|
if (defined($ENV{'form.discussion'})) { |
|
if (ref($ENV{'form.discussion'}) eq 'ARRAY') { |
|
@discussions = $ENV{'form.discussion'}; |
|
} else { |
|
$discussions[0] = $ENV{'form.discussion'}; |
|
} |
|
} |
|
my $curRes; |
|
my $count; |
|
my %symbs; |
|
my $display; |
|
while ($curRes = $it->next()) { |
|
if (ref($curRes)) { |
|
$count ++; |
|
$symbs{$count} = $curRes->symb(); |
|
if (grep/^$count$/,@exportitems) { |
|
$display.= 'Export content item '.$curRes->title()."<br />\n"; |
|
} |
|
if (grep/^$count$/,@discussions) { |
|
$display.= 'Export discussion posts '.$curRes->title()."<br />\n"; |
|
} |
|
} |
|
} |
|
|
|
$r->print('<html><head><title>Export Course</title></head>'. |
|
&Apache::loncommon::bodytag('Export course to IMS or SCORM content package' |
|
)); |
|
|
|
my $exportfile; |
|
$r->print($display); |
|
$r->print('</body></html>'); |
|
} else { |
|
my $display; |
|
$display = '<form name="exportdoc" method="post">'."\n"; |
|
$display .= 'Choose which items you wish to export from your course.<br /><br />'; |
|
$display .= '<table border="0" cellspacing="0" cellpadding="3">'. |
|
'<tr><td><fieldset><legend> <b>Content items</b></legend>'. |
|
'<input type="button" value="check all" '. |
|
'onclick="javascript:checkAll(document.exportdoc.archive)" />'. |
|
' <input type="button" value="uncheck all"'. |
|
' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset></td>'. |
|
'<td> </td><td> </td>'. |
|
'<td align="right"><fieldset><legend> <b>Discussion posts'. |
|
'</b></legend><input type="button" value="check all"'. |
|
' onclick="javascript:checkAll(document.exportdoc.discussion)" />'. |
|
' <input type="button" value="uncheck all"'. |
|
' onclick="javascript:uncheckAll(document.exportdoc.discussion)" /></fieldset></td>'. |
|
'</tr></table>'; |
|
my $curRes; |
|
my $depth = 0; |
|
my $count = 0; |
|
my $boards = 0; |
|
my $startcount = 5; |
|
my %parent = (); |
|
my %children = (); |
|
my $lastcontainer = $startcount; |
|
my @bgcolors = ('#F6F6F6','#FFFFFF'); |
|
$display .= '<table cellspacing="0"><tr>'. |
|
'<td><b>Export content item?<br /></b></td><td> </td><td align="right">'."\n"; |
|
if ($numdisc > 0) { |
|
$display.='<b>Export discussion posts?</b>'."\n"; |
|
} |
|
$display.=' </td></tr>'; |
|
while ($curRes = $it->next()) { |
|
if (ref($curRes)) { |
|
$count ++; |
|
} |
|
if ($curRes == $it->BEGIN_MAP()) { |
|
$depth++; |
|
$parent{$depth} = $lastcontainer; |
|
} |
|
if ($curRes == $it->END_MAP()) { |
|
$depth--; |
|
$lastcontainer = $parent{$depth}; |
|
} |
|
if (ref($curRes)) { |
|
my $symb = $curRes->symb(); |
|
my $color = $count%2; |
|
$display .='<tr bgcolor='.$bgcolors[$color].'><td>'."\n". |
|
'<input type="checkbox" name="archive" value="'.$count.'" '; |
|
if (($curRes->is_sequence()) || ($curRes->is_page())) { |
|
my $checkitem = $count + $boards + $startcount; |
|
$display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"'; |
|
} |
|
$display .= ' />'."\n"; |
|
for (my $i=0; $i<$depth; $i++) { |
|
$display .= '<img src="/adm/lonIcons/whitespace1.gif" width="25" height="1" alt="" border="0" /><img src="/adm/lonIcons/whitespace1.gif" width="25" height="1" alt="" border="0" />'."\n"; |
|
} |
|
if ($curRes->is_sequence()) { |
|
$display .= '<img src="/adm/lonIcons/navmap.folder.open.gif"> '."\n"; |
|
$lastcontainer = $count + $startcount + $boards; |
|
} elsif ($curRes->is_page()) { |
|
$display .= '<img src="/adm/lonIcons/navmap.page.open.gif"> '."\n"; |
|
$lastcontainer = $count + $startcount + $boards; |
|
} |
|
my $currelem = $count+$boards+$startcount; |
|
$children{$parent{$depth}} .= $currelem.':'; |
|
$display .= ' '.$curRes->title().'</td>'; |
|
if ($discussiontime{$symb} > 0) { |
|
$boards ++; |
|
$currelem = $count+$boards+$startcount; |
|
$display .= '<td> </td><td align="right"><input type="checkbox" name="discussion" value="'.$count.'" /> </td>'."\n"; |
|
} else { |
|
$display .= '<td colspan="2"> </td>'."\n"; |
|
} |
|
} |
|
} |
|
my $scripttag = qq| |
|
<script> |
|
|
|
function checkAll(field) { |
|
for (i = 0; i < field.length; i++) |
|
field[i].checked = true ; |
|
} |
|
|
|
function uncheckAll(field) { |
|
for (i = 0; i < field.length; i++) |
|
field[i].checked = false ; |
|
} |
|
|
|
function propagateCheck(item) { |
|
if (document.exportdoc.elements[item].checked == true) { |
|
containerCheck(item) |
|
} |
|
} |
|
|
|
function containerCheck(item) { |
|
document.exportdoc.elements[item].checked = true |
|
var numitems = $count + $boards + $startcount |
|
var parents = new Array(numitems) |
|
for (var i=$startcount; i<numitems; i++) { |
|
parents[i] = new Array |
|
} |
|
|; |
|
|
|
foreach my $container (sort { $a <=> $b } keys %children) { |
|
my @contents = split/:/,$children{$container}; |
|
for (my $i=0; $i<@contents; $i ++) { |
|
$scripttag .= ' parents['.$container.']['.$i.'] = '.$contents[$i]."\n"; |
|
} |
|
} |
|
|
|
$scripttag .= qq| |
|
if (parents[item].length > 0) { |
|
for (var j=0; j<parents[item].length; j++) { |
|
containerCheck(parents[item][j]) |
|
} |
|
} |
|
} |
|
|
|
</script> |
|
|; |
|
$r->print('<html><head><title>Export Course</title>'.$scripttag.'</head>'. |
|
&Apache::loncommon::bodytag('Export course to IMS or SCORM content package' |
|
)); |
|
|
|
$r->print($display.'</table>'. |
|
'<p><input type="hidden" name="finishexport" value="1">'. |
|
'<input type="submit" name="exportcourse" value="'. |
|
&mt('Export Course DOCS').'" /></p></form></body></html>'); |
|
} |
|
} |
|
|
|
|
# Imports the given (name, url) resources into the course |
# Imports the given (name, url) resources into the course |
# coursenum, coursedom, and folder must precede the list |
# coursenum, coursedom, and folder must precede the list |
Line 636 END
|
Line 833 END
|
$line.=(<<ENDPARMS); |
$line.=(<<ENDPARMS); |
<td bgcolor="#BBBBFF"><font size='-2'> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<input type="checkbox" name="hidprs_$orderidx" $hidtext/> $lt{'hd'}</td> |
<input type="checkbox" name="hidprs_$orderidx" $hidtext/> $lt{'hd'}</td> |
<!--<td bgcolor="#BBBBFF"><font size='-2'> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<input type="checkbox" name="encprs_$orderidx" $enctext/> $lt{'ec'}</td>--> |
<input type="checkbox" name="encprs_$orderidx" $enctext/> $lt{'ec'}</td> |
<td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td> |
<td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<input type="submit" value="$lt{'sp'}" /> |
<input type="submit" value="$lt{'sp'}" /> |
Line 1089 sub handler {
|
Line 1286 sub handler {
|
&checkversions($r); |
&checkversions($r); |
} elsif ($ENV{'form.dumpcourse'}) { |
} elsif ($ENV{'form.dumpcourse'}) { |
&dumpcourse($r); |
&dumpcourse($r); |
|
} elsif ($ENV{'form.exportcourse'}) { |
|
&exportcourse($r); |
} else { |
} else { |
# is this a standard course? |
# is this a standard course? |
|
|
Line 1293 ENDNEWSCRIPT
|
Line 1492 ENDNEWSCRIPT
|
# ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
if ($allowed) { |
if ($allowed) { |
my $dumpbut=&dumpbutton(); |
my $dumpbut=&dumpbutton(); |
|
my $exportbut=&exportbutton(); |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'vc' => 'Verify Content', |
'vc' => 'Verify Content', |
'cv' => 'Check/Set Resource Versions', |
'cv' => 'Check/Set Resource Versions', |
Line 1323 ENDNEWSCRIPT
|
Line 1523 ENDNEWSCRIPT
|
</td><td bgcolor="#DDDDCC"> |
</td><td bgcolor="#DDDDCC"> |
<input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'} |
<input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'} |
$dumpbut |
$dumpbut |
|
$exportbut |
</td></tr></table> |
</td></tr></table> |
</form> |
</form> |
ENDCOURSEVERIFY |
ENDCOURSEVERIFY |
Line 1577 ENDSUPFORM
|
Line 1778 ENDSUPFORM
|
$r->print('</table>'); |
$r->print('</table>'); |
} else { |
} else { |
# -------------------------------------------------------- This is showdoc mode |
# -------------------------------------------------------- This is showdoc mode |
$r->print("<h1>".&mt('Uploaded Document').' - '. |
$r->print("<h1>".&mt('Uploaded Document').'</h1><p>'. |
&Apache::lonnet::gettitle($r->uri).'</h1><p>'. |
|
&mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."</p><p><table>". |
&mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."</p><p><table>". |
&entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'</table></p>'); |
&entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'</table></p>'); |
} |
} |