version 1.2, 2004/03/09 16:44:01
|
version 1.13, 2004/12/23 18:38:45
|
Line 1
|
Line 1
|
|
# Copyright Michigan State University Board of Trustees |
|
# |
|
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
|
# |
|
# LON-CAPA is free software; you can redistribute it and/or modify |
|
# it under the terms of the GNU General Public License as published by |
|
# the Free Software Foundation; either version 2 of the License, or |
|
# (at your option) any later version. |
|
# |
|
# LON-CAPA is distributed in the hope that it will be useful, |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
# GNU General Public License for more details. |
|
# |
|
# You should have received a copy of the GNU General Public License |
|
# along with LON-CAPA; if not, write to the Free Software |
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
# |
|
# /home/httpd/html/adm/gpl.txt |
|
# |
|
# http://www.lon-capa.org/ |
|
# |
|
|
package Apache::imsprocessor; |
package Apache::imsprocessor; |
|
|
use Apache::lonnet; |
use Apache::lonnet; |
use LONCAPA::Configuration; |
use LONCAPA::Configuration; |
use strict; |
use strict; |
|
|
|
sub ims_config { |
|
my ($areas,$cmsmap,$areaname) = @_; |
|
@{$areas} = ("doc","extlink","announce","staff","board","quiz","survey","pool","users"); |
|
%{$$cmsmap{bb5}} = ( |
|
announce => 'resource/x-bb-announcement', |
|
board => 'resource/x-bb-discussionboard', |
|
doc => 'resource/x-bb-document', |
|
extlink => 'resource/x-bb-externallink', |
|
pool => 'assessment/x-bb-pool', |
|
quiz => 'assessment/x-bb-quiz', |
|
staff => 'resource/x-bb-staffinfo', |
|
survey => 'assessment/x-bb-survey', |
|
users => 'course/x-bb-user', |
|
); |
|
%{$$cmsmap{bb6}} = %{$$cmsmap{bb5}}; |
|
$$cmsmap{bb6}{conference} = 'resource/x-bb-conference'; |
|
%{$$cmsmap{angel}} = ( |
|
board => 'BOARD', |
|
extlink => 'LINK', |
|
msg => 'MESSAGE', |
|
quiz => 'QUIZ', |
|
survey => 'FORM', |
|
); |
|
@{$$cmsmap{angel}{doc}} = ('FILE','PAGE'); |
|
%{$areaname} = ( |
|
announce => 'Announcements', |
|
board => 'Discussion Boards', |
|
doc => 'Documents, pages, and folders', |
|
extlink => 'Links to external sites', |
|
pool => 'Question pools', |
|
quiz => 'Quizzes', |
|
staff => 'Staff information', |
|
survey => 'Surveys', |
|
users => 'Enrollment', |
|
); |
|
} |
|
|
sub create_tempdir { |
sub create_tempdir { |
my ($caller,$pathinfo,$timenow) = @_; |
my ($context,$pathinfo,$timenow) = @_; |
my $configvars = &LONCAPA::Configuration::read_conf('loncapa.conf'); |
my $configvars = &LONCAPA::Configuration::read_conf('loncapa.conf'); |
my $tempdir; |
my $tempdir; |
if ($caller eq 'DOCS') { |
if ($context eq 'DOCS') { |
$tempdir = $$configvars{'lonDaemons'}.'/tmp/'.$pathinfo; |
$tempdir = $$configvars{'lonDaemons'}.'/tmp/'.$pathinfo; |
if (!-e "$tempdir") { |
if (!-e "$tempdir") { |
mkdir("$tempdir",0770); |
mkdir("$tempdir",0770); |
Line 17 sub create_tempdir {
|
Line 77 sub create_tempdir {
|
if (!-e "$tempdir") { |
if (!-e "$tempdir") { |
mkdir("$tempdir",0770); |
mkdir("$tempdir",0770); |
} |
} |
} elsif ($caller eq "CSTR") { |
} elsif ($context eq "CSTR") { |
if (!-e "$pathinfo/temp") { |
if (!-e "$pathinfo/temp") { |
mkdir("$pathinfo/temp",0770); |
mkdir("$pathinfo/temp",0770); |
} |
} |
Line 26 sub create_tempdir {
|
Line 86 sub create_tempdir {
|
return $tempdir; |
return $tempdir; |
} |
} |
|
|
|
sub uploadzip { |
|
my ($context,$tempdir,$source) = @_; |
|
my $fname; |
|
if ($context eq 'DOCS') { |
|
$fname=$ENV{'form.uploadname.filename'}; |
|
# Replace Windows backslashes by forward slashes |
|
$fname=~s/\\/\//g; |
|
# Get rid of everything but the actual filename |
|
$fname=~s/^.*\/([^\/]+)$/$1/; |
|
# Replace spaces by underscores |
|
$fname=~s/\s+/\_/g; |
|
# Replace all other weird characters by nothing |
|
$fname=~s/[^\w\.\-]//g; |
|
# See if there is anything left |
|
unless ($fname) { return 'error: no uploaded file'; } |
|
# Save the file |
|
chomp($ENV{'form.uploadname'}); |
|
open(my $fh,'>'.$tempdir.'/'.$fname); |
|
print $fh $ENV{'form.uploadname'}; |
|
close($fh); |
|
} elsif ($context eq 'CSTR') { |
|
if ($source =~ m/\/([^\/]+)$/) { |
|
$fname = $1; |
|
my $destination = $tempdir.'/'.$fname; |
|
rename($source,$destination); |
|
} |
|
} |
|
return $fname; |
|
} |
|
|
sub expand_zip { |
sub expand_zip { |
my ($tempdir,$filename) = @_; |
my ($tempdir,$filename) = @_; |
my $zipfile = "$tempdir/$filename"; |
my $zipfile = "$tempdir/$filename"; |
|
if (!-e "$zipfile") { |
|
return 'no zip'; |
|
} |
if ($filename =~ m|\.zip$|i) { |
if ($filename =~ m|\.zip$|i) { |
|
# unzip can cause an sh launch which can pass along all of %ENV |
|
# which can be too large for /bin/sh to handle |
|
my %oldENV=%ENV; |
|
undef(%ENV); |
open(OUTPUT, "unzip -o $zipfile -d $tempdir 2> /dev/null |"); |
open(OUTPUT, "unzip -o $zipfile -d $tempdir 2> /dev/null |"); |
while (<OUTPUT>) { |
|
print "$_<br />"; |
|
} |
|
close(OUTPUT); |
close(OUTPUT); |
|
%ENV=%oldENV; |
|
undef(%oldENV); |
} else { |
} else { |
return 'nozip'; |
return 'nozip'; |
} |
} |
Line 47 sub expand_zip {
|
Line 143 sub expand_zip {
|
sub process_manifest { |
sub process_manifest { |
my ($cms,$tempdir,$resources,$items,$hrefs,$resinfo) = @_; |
my ($cms,$tempdir,$resources,$items,$hrefs,$resinfo) = @_; |
my %toc = ( |
my %toc = ( |
|
bb6 => 'organization', |
bb5 => 'tableofcontents', |
bb5 => 'tableofcontents', |
angel => 'organization', |
angel => 'organization', |
); |
); |
Line 60 sub process_manifest {
|
Line 157 sub process_manifest {
|
contentscount => 0, |
contentscount => 0, |
resnum => 'toplevel', |
resnum => 'toplevel', |
); |
); |
%{$$resources{'toplevel'}} = (); |
%{$$resources{'toplevel'}} = ( |
|
revitm => 'Top' |
|
); |
|
|
if ($cms eq 'angel') { |
if ($cms eq 'angel') { |
$$resources{'toplevel'}{type} = "FOLDER"; |
$$resources{'toplevel'}{type} = "FOLDER"; |
} elsif ($cms eq 'bb5') { |
} elsif ($cms eq 'bb5' || $cms eq 'bb6') { |
$$resources{'toplevel'}{type} = 'resource/x-bb-document'; |
$$resources{'toplevel'}{type} = 'resource/x-bb-document'; |
} |
} |
|
|
|
|
unless (-e "$tempdir/imsmanifest.xml") { |
unless (-e "$tempdir/imsmanifest.xml") { |
return 'nomanifest'; |
return 'nomanifest'; |
} |
} |
Line 97 sub process_manifest {
|
Line 195 sub process_manifest {
|
$itm = $attr->{identifier}; |
$itm = $attr->{identifier}; |
%{$$items{$itm}} = (); |
%{$$items{$itm}} = (); |
$$items{$itm}{contentscount} = 0; |
$$items{$itm}{contentscount} = 0; |
if ($cms eq 'bb5') { |
if ($cms eq 'bb5' || $cms eq 'bb6') { |
$$items{$itm}{resnum} = $attr->{identifierref}; |
$$items{$itm}{resnum} = $attr->{identifierref}; |
$$items{$itm}{title} = $attr->{title}; |
if ($cms eq 'bb5') { |
|
$$items{$itm}{title} = $attr->{title}; |
|
} |
} elsif ($cms eq 'angel') { |
} elsif ($cms eq 'angel') { |
if ($attr->{identifierref} =~ m/^res(.+)$/) { |
if ($attr->{identifierref} =~ m/^res(.+)$/) { |
$$items{$itm}{resnum} = $1; |
$$items{$itm}{resnum} = $1; |
Line 139 sub process_manifest {
|
Line 239 sub process_manifest {
|
$path = $seq[0]; |
$path = $seq[0]; |
} |
} |
$$items{$itm}{filepath} = $path; |
$$items{$itm}{filepath} = $path; |
if ($cms eq 'bb5') { |
if ($cms eq 'bb5' || $cms eq 'bb6') { |
if ($$items{$itm}{filepath} eq 'Top') { |
if ($$items{$itm}{filepath} eq 'Top') { |
$$items{$itm}{resnum} = $itm; |
$$items{$itm}{resnum} = $itm; |
$$resources{$$items{$itm}{resnum}}{type} = 'resource/x-bb-document'; |
$$resources{$$items{$itm}{resnum}}{type} = 'resource/x-bb-document'; |
Line 152 sub process_manifest {
|
Line 252 sub process_manifest {
|
} |
} |
} elsif ("@state" eq "manifest resources resource" ) { |
} elsif ("@state" eq "manifest resources resource" ) { |
$identifier = $attr->{identifier}; |
$identifier = $attr->{identifier}; |
if ($cms eq 'bb5') { |
if ($cms eq 'bb5' || $cms eq 'bb6') { |
$$resources{$identifier}{file} = $attr->{file}; |
$$resources{$identifier}{file} = $attr->{file}; |
$$resources{$identifier}{type} = $attr->{type}; |
$$resources{$identifier}{type} = $attr->{type}; |
} elsif ($cms eq 'angel') { |
} elsif ($cms eq 'angel') { |
$identifier = substr($identifier,3); |
$identifier = substr($identifier,3); |
if ($attr->{href} =~ m-^_assoc/$identifier/(.+)$-) { |
if ($attr->{href} =~ m-^_assoc/$identifier/(.+)$-) { |
$$resources{$identifier}{file} = $1; |
$$resources{$identifier}{file} = $1; |
} |
} |
} |
} |
@{$$hrefs{$identifier}} = (); |
@{$$hrefs{$identifier}} = (); |
} elsif ("@state" eq "manifest resources resource file") { |
} elsif ("@state" eq "manifest resources resource file") { |
if ($cms eq 'bb5') { |
if ($cms eq 'bb5' || $cms eq 'bb6') { |
push @{$$hrefs{$identifier}},$attr->{href}; |
push @{$$hrefs{$identifier}},$attr->{href}; |
} elsif ($cms eq 'angel') { |
} elsif ($cms eq 'angel') { |
if ($attr->{href} =~ m/^_assoc\\$identifier\\(.+)$/) { |
if ($attr->{href} =~ m/^_assoc\\$identifier\\(.+)$/) { |
push @{$$hrefs{$identifier}},$1; |
push @{$$hrefs{$identifier}},$1; |
} elsif ($attr->{href} =~ m/^Icons\\icon(\w+)\.gif/) { |
} elsif ($attr->{href} =~ m/^Icons\\icon(\w+)\.gif/) { |
$$resources{$identifier}{type} = $1; |
$$resources{$identifier}{type} = $1; |
} |
} |
} |
} |
} |
} |
}, "tagname, attr"], |
}, "tagname, attr"], |
text_h => |
text_h => |
[sub { |
[sub { |
my ($text) = @_; |
my ($text) = @_; |
|
if ($state[0] eq "manifest" && $state[1] eq "organizations" && $state[2] eq $toc{$cms} && $state[-1] eq "title") { |
|
if ($cms eq 'angel' || $cms eq 'bb6') { |
|
$$items{$itm}{title} = $text; |
|
} |
|
} |
}, "dtext"], |
}, "dtext"], |
end_h => |
end_h => |
[sub { |
[sub { |
Line 212 sub copy_resources {
|
Line 317 sub copy_resources {
|
foreach my $file (@{$$hrefs{$key}}) { |
foreach my $file (@{$$hrefs{$key}}) { |
my $source = $tempdir.'/'.$key.'/'.$file; |
my $source = $tempdir.'/'.$key.'/'.$file; |
my $filename = ''; |
my $filename = ''; |
my $fpath = $timenow.'/resfiles/'.$key.'/'; |
my $fpath = $timenow.'/resfiles/'.$key.'/'; |
if ($cms eq 'bb5') { |
if ($cms eq 'angel') { |
if ($file =~ m-/-) { |
if ($file eq 'pg'.$key.'.htm') { |
my @items = split/\//,$file; |
next; |
$filename = pop @items; |
|
$fpath .= join('/',@items); |
|
$fpath .= '/'; |
|
} else { |
|
$filename = $file; |
|
} |
|
&Apache::lonnet::userfileupload(undef,'1',$filename,$fpath,$source); |
|
} elsif ($cms eq 'angel') { |
|
$file =~ s-\\-/-g; |
|
unless ($file eq 'pg'.$key.'.htm') { |
|
if ($file =~ m-/-) { |
|
my @items = split/\//,$file; |
|
$filename = pop @items; |
|
$fpath = join('/',@items); |
|
$fpath .= '/'; |
|
} else { |
|
$filename = $file; |
|
} |
|
&Apache::lonnet::userfileupload(undef,'1',$filename,$fpath,$source); |
|
} |
} |
} |
} |
|
$file =~ s-\\-/-g; |
|
$file = $fpath.$file; |
|
my $fileresult = &Apache::lonnet::process_coursefile('copy',$crs,$cdom,$chome,$file,$source); |
} |
} |
} |
} |
} |
} |
Line 247 sub copy_resources {
|
Line 336 sub copy_resources {
|
foreach my $key (sort keys %{$hrefs}) { |
foreach my $key (sort keys %{$hrefs}) { |
foreach my $file (@{$$hrefs{$key}}) { |
foreach my $file (@{$$hrefs{$key}}) { |
$file =~ s-\\-/-g; |
$file =~ s-\\-/-g; |
if ( ($cms eq 'angel' && $file ne 'pg'.$key.'.htm') || ($cms eq 'bb5') ) { |
if ( ($cms eq 'angel' && $file ne 'pg'.$key.'.htm') || ($cms eq 'bb5') || ($cms eq 'bb6') ) { |
if (!-e "$destdir/resfiles/$key") { |
if (!-e "$destdir/resfiles/$key") { |
mkdir("$destdir/resfiles/$key",0770); |
mkdir("$destdir/resfiles/$key",0770); |
} |
} |
Line 265 sub copy_resources {
|
Line 354 sub copy_resources {
|
} |
} |
if ($cms eq 'angel') { |
if ($cms eq 'angel') { |
rename("$tempdir/_assoc/$key/$file","$destdir/resfiles/$key/$file"); |
rename("$tempdir/_assoc/$key/$file","$destdir/resfiles/$key/$file"); |
} elsif ($cms eq 'bb5') { |
} elsif ($cms eq 'bb5' || $cms eq 'bb6') { |
rename("$tempdir/$key/$file","$destdir/resfiles/$key/$file"); |
rename("$tempdir/$key/$file","$destdir/resfiles/$key/$file"); |
} |
} |
} |
} |
Line 274 sub copy_resources {
|
Line 363 sub copy_resources {
|
} |
} |
} |
} |
|
|
|
sub process_coursefile { |
|
my ($crs,$cdom,$chome,$file,$source)=@_; |
|
my $fetchresult = ''; |
|
my $fpath = ''; |
|
my $fname = $file; |
|
($fpath,$fname) = ($file =~ m/^(.*)\/([^\/])$/); |
|
$fpath=$cdom.'/'.$crs.'/'.$fpath; |
|
my $filepath=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles'; |
|
unless ($fpath eq '') { |
|
my @parts=split(/\//,$fpath); |
|
foreach my $part (@parts) { |
|
$filepath.= '/'.$part; |
|
if ((-e $filepath)!=1) { |
|
mkdir($filepath,0777); |
|
} |
|
} |
|
} |
|
if ($source eq '') { |
|
$fetchresult eq 'no source file provided'; |
|
} else { |
|
my $destination = $filepath.'/'.$fname; |
|
rename($source,$destination); |
|
$fetchresult= &Apache::lonnet::reply('fetchuserfile:'.$cdom.'/'.$crs.'/'.$file,$chome); |
|
unless ($fetchresult eq 'ok') { |
|
&Apache::lonnet::logthis('Failed to transfer '.$cdom.'/'.$crs.'/'.$fname.' to host '.$chome.': '.$fetchresult); |
|
} |
|
} |
|
return $fetchresult; |
|
} |
|
|
sub process_resinfo { |
sub process_resinfo { |
my ($cms,$docroot,$destdir,$items,$resources,$boards,$announcements,$quizzes,$surveys,$groups,$messages,$timestamp,$boardnum,$resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,$total,$dirname,$seqstem,$resrcfiles) = @_; |
my ($cms,$context,$docroot,$destdir,$items,$resources,$boards,$announcements,$quizzes,$surveys,$groups,$messages,$timestamp,$boardnum,$resinfo,$udom,$uname,$cdom,$crs,$db_handling,$user_handling,$total,$dirname,$seqstem,$resrcfiles,$packages,$hrefs,$pagesfiles,$sequencesfiles) = @_; |
my $board_id = time; |
my $board_id = time; |
my $board_count = 0; |
my $board_count = 0; |
my $announce_handling = 'include'; |
my $announce_handling = 'include'; |
Line 301 sub process_resinfo {
|
Line 420 sub process_resinfo {
|
&angel_content($key,$docroot,$destdir,\%{$$resinfo{$key}},$udom,$uname,$$resources{$key}{type},$$items{$$resources{$key}{revitm}}{title},$resrcfiles); |
&angel_content($key,$docroot,$destdir,\%{$$resinfo{$key}},$udom,$uname,$$resources{$key}{type},$$items{$$resources{$key}{revitm}}{title},$resrcfiles); |
} elsif ($$resources{$key}{type} eq "QUIZ") { |
} elsif ($$resources{$key}{type} eq "QUIZ") { |
%{$$resinfo{$key}} = (); |
%{$$resinfo{$key}} = (); |
|
push @{$quizzes}, $key; |
# &angel_assessment($key,$docroot,$dirname,$destdir,\%{$$resinfo{$key}},$resrcfiles); |
# &angel_assessment($key,$docroot,$dirname,$destdir,\%{$$resinfo{$key}},$resrcfiles); |
} elsif ($$resources{$key}{type} eq "FORM") { |
} elsif ($$resources{$key}{type} eq "FORM") { |
%{$$resinfo{$key}} = (); |
%{$$resinfo{$key}} = (); |
|
push @{$surveys}, $key; |
# &angel_assessment($key,$docroot,$dirname,$destdir,\%{$$resinfo{$key}},$resrcfiles); |
# &angel_assessment($key,$docroot,$dirname,$destdir,\%{$$resinfo{$key}},$resrcfiles); |
} elsif ($$resources{$key}{type} eq "DROPBOX") { |
} elsif ($$resources{$key}{type} eq "DROPBOX") { |
%{$$resinfo{$key}} = (); |
%{$$resinfo{$key}} = (); |
} |
} |
} |
} |
} elsif ($cms eq 'bb5') { |
} elsif ($cms eq 'bb5' || $cms eq 'bb6') { |
foreach my $key (sort keys %{$resources}) { |
foreach my $key (sort keys %{$resources}) { |
if ($$resources{$key}{type} eq "resource/x-bb-document") { |
if ($$resources{$key}{type} eq "resource/x-bb-document") { |
%{$$resinfo{$key}} = (); |
|
unless ($$items{$$resources{$key}{revitm}}{filepath} eq 'Top') { |
unless ($$items{$$resources{$key}{revitm}}{filepath} eq 'Top') { |
&process_content($key,$docroot,$destdir,\%{$$resinfo{$key}},$udom,$uname,$resrcfiles); |
%{$$resinfo{$key}} = (); |
|
&process_content($cms,$key,$context,$docroot,$destdir,\%{$$resinfo{$key}},$udom,$uname,$resrcfiles,$packages,$hrefs); |
} |
} |
} elsif ($$resources{$key}{type} eq "resource/x-bb-staffinfo") { |
} elsif ($$resources{$key}{type} eq "resource/x-bb-staffinfo") { |
%{$$resinfo{$key}} = (); |
%{$$resinfo{$key}} = (); |
Line 333 sub process_resinfo {
|
Line 454 sub process_resinfo {
|
} |
} |
} elsif ($$resources{$key}{type} eq "assessment/x-bb-pool") { |
} elsif ($$resources{$key}{type} eq "assessment/x-bb-pool") { |
%{$$resinfo{$key}} = (); |
%{$$resinfo{$key}} = (); |
&process_assessment($key,$docroot,'pool',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname); |
&process_assessment($context,$key,$docroot,'pool',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles); |
} elsif ($$resources{$key}{type} eq "assessment/x-bb-quiz") { |
} elsif ($$resources{$key}{type} eq "assessment/x-bb-quiz") { |
%{$$resinfo{$key}} = (); |
%{$$resinfo{$key}} = (); |
&process_assessment($key,$docroot,'quiz',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname); |
&process_assessment($context,$key,$docroot,'quiz',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles); |
push @{$quizzes}, $key; |
push @{$quizzes}, $key; |
} elsif ($$resources{$key}{type} eq "assessment/x-bb-survey") { |
} elsif ($$resources{$key}{type} eq "assessment/x-bb-survey") { |
%{$$resinfo{$key}} = (); |
%{$$resinfo{$key}} = (); |
&process_assessment($key,$docroot,'survey',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname); |
&process_assessment($context,$key,$docroot,'survey',$dirname,$destdir,\%{$$resinfo{$key}},$total,$udom,$uname,$pagesfiles,$sequencesfiles); |
push @{$surveys}, $key; |
push @{$surveys}, $key; |
} elsif ($$resources{$key}{type} eq "assessment/x-bb-group") { |
} elsif ($$resources{$key}{type} eq "assessment/x-bb-group") { |
%{$$resinfo{$key}} = (); |
%{$$resinfo{$key}} = (); |
Line 355 sub process_resinfo {
|
Line 476 sub process_resinfo {
|
unless ($announce_handling eq 'ignore') { |
unless ($announce_handling eq 'ignore') { |
push @{$announcements}, $key; |
push @{$announcements}, $key; |
%{$$resinfo{$key}} = (); |
%{$$resinfo{$key}} = (); |
&process_announce($key,$docroot,$destdir,\%{$$resinfo{$key}},$items,$resinfo,$seqstem,$resrcfiles); |
&process_announce($key,$docroot,$destdir,\%{$$resinfo{$key}},$resinfo,$seqstem,$resrcfiles); |
} |
} |
} |
} |
} |
} |
|
if (@{$announcements}) { |
|
$$items{'Top'}{'contentscount'} ++; |
|
} |
|
if (@{$boards}) { |
|
$$items{'Top'}{'contentscount'} ++; |
|
} |
|
if (@{$quizzes}) { |
|
$$items{'Top'}{'contentscount'} ++; |
|
} |
|
if (@{$surveys}) { |
|
$$items{'Top'}{'contentscount'} ++; |
|
} |
} |
} |
$$total{'board'} = $board_count; |
|
|
|
if (@{$announcements}) { |
$$total{'board'} = $board_count; |
$$items{'Top'}{'contentscount'} ++; |
$$total{'quiz'} = @{$quizzes}; |
} |
$$total{'surv'} = @{$surveys}; |
if (@{$boards}) { |
|
$$items{'Top'}{'contentscount'} ++; |
|
} |
|
if (@{$quizzes}) { |
|
$$items{'Top'}{'contentscount'} ++; |
|
$$total{'quiz'} = @{$quizzes}; |
|
} |
|
if (@{$surveys}) { |
|
$$items{'Top'}{'contentscount'} ++; |
|
$$total{'surv'} = @{$surveys}; |
|
} |
|
} |
} |
|
|
sub build_structure { |
sub build_structure { |
my ($cms,$context,$destdir,$resinfo,$items,$resources,$hrefs,$udom,$uname,$newdir,$timenow,$cdom,$crs,$timestamp,$total,$boards,$announcements,$quizzes,$surveys,$boardnum,$pagesfiles,$seqfiles,$topurls,$topnames) = @_; |
my ($cms,$context,$destdir,$items,$resinfo,$resources,$hrefs,$udom,$uname,$newdir,$timenow,$cdom,$crs,$timestamp,$total,$boards,$announcements,$quizzes,$surveys,$boardnum,$pagesfiles,$seqfiles,$topurls,$topnames,$packages) = @_; |
|
|
my %flag = (); |
my %flag = (); |
my %count = (); |
my %count = (); |
my %pagecontents = (); |
my %pagecontents = (); |
Line 437 sub build_structure {
|
Line 557 sub build_structure {
|
my $curr_id = 1; |
my $curr_id = 1; |
my $resnum = $$items{$key}{resnum}; |
my $resnum = $$items{$key}{resnum}; |
my $type = $$resources{$resnum}{type}; |
my $type = $$resources{$resnum}{type}; |
if (($cms eq 'angel' && $type eq "FOLDER") || ($cms eq 'bb5' && $$resinfo{$resnum}{'isfolder'} eq "true") && (($type eq "resource/x-bb-document") || ($type eq "resource/x-bb-staffinfo") || ($type eq "resource/x-bb-externallink")) ) { |
if (($cms eq 'angel' && $type eq "FOLDER") || (($cms eq 'bb5' || $cms eq 'bb6') && $$resinfo{$resnum}{'isfolder'} eq "true") && (($type eq "resource/x-bb-document") || ($type eq "resource/x-bb-staffinfo") || ($type eq "resource/x-bb-externallink")) ) { |
unless ($cms eq 'bb5' && $key eq 'Top') { |
unless (($cms eq 'bb5') && $key eq 'Top') { |
$seqtext{$key} = "<map>\n"; |
$seqtext{$key} = "<map>\n"; |
} |
} |
if ($$items{$key}{contentscount} == 0) { |
if ($$items{$key}{contentscount} == 0) { |
Line 451 sub build_structure {
|
Line 571 sub build_structure {
|
my $res = $$items{$contitem}{resnum}; |
my $res = $$items{$contitem}{resnum}; |
my $type = $$resources{$res}{type}; |
my $type = $$resources{$res}{type}; |
my $title = $$items{$contitem}{title}; |
my $title = $$items{$contitem}{title}; |
$src = &make_structure($cms,$key,$srcstem,\%flag,\%count,$timestamp,$boardnum,$hrefs,\%pagecontents,$res,$type,$resinfo,$contitem,$uname,$cdom); |
my $packageflag = 0; |
|
if (grep/^$res$/,@{$packages}) { |
|
$packageflag = 1; |
|
} |
|
$src = &make_structure($cms,$key,$srcstem,\%flag,\%count,$timestamp,$boardnum,$hrefs,\%pagecontents,$res,$type,$resinfo,$contitem,$uname,$cdom,$contcount,$packageflag); |
unless ($flag{$key}{page} == 1) { |
unless ($flag{$key}{page} == 1) { |
$seqtext{$key} .= qq|<resource id="$curr_id" src="$src" title="$title"|; |
$seqtext{$key} .= qq|<resource id="$curr_id" src="$src" title="$title" type="start"|; |
unless ($cms eq 'bb5' && $key eq 'Top' && @{$announcements}) { |
|
$seqtext{$key} .= qq| type="start"|; |
|
} |
|
unless ($flag{$key}{seq} || $flag{$key}{board} || $flag{$key}{file}) { |
unless ($flag{$key}{seq} || $flag{$key}{board} || $flag{$key}{file}) { |
$flag{$key}{page} = 1; |
$flag{$key}{page} = 1; |
} |
} |
Line 475 sub build_structure {
|
Line 596 sub build_structure {
|
my $contitem = $$items{$key}{contents}[$i]; |
my $contitem = $$items{$key}{contents}[$i]; |
my $res = $$items{$contitem}{resnum}; |
my $res = $$items{$contitem}{resnum}; |
my $type = $$resources{$res}{type}; |
my $type = $$resources{$res}{type}; |
my $title = $$items{$contitem}{title}; |
my $title = $$items{$contitem}{title}; |
$src = &make_structure($cms,$key,$srcstem,\%flag,\%count,$timestamp,$boardnum,$hrefs,\%pagecontents,$res,$type,$resinfo,$contitem,$uname,$cdom); |
my $packageflag = 0; |
|
if (grep/^$res$/,@{$packages}) { |
|
$packageflag = 1; |
|
} |
|
$src = &make_structure($cms,$key,$srcstem,\%flag,\%count,$timestamp,$boardnum,$hrefs,\%pagecontents,$res,$type,$resinfo,$contitem,$uname,$cdom,$contcount,$packageflag); |
unless ($flag{$key}{page} == 1) { |
unless ($flag{$key}{page} == 1) { |
$seqtext{$key} .= qq|></resource> |
$seqtext{$key} .= qq|></resource> |
<link from="$curr_id" to="$next_id" index="$curr_id"></link> |
<link from="$curr_id" to="$next_id" index="$curr_id"></link> |
Line 497 sub build_structure {
|
Line 622 sub build_structure {
|
my $res = $$items{$contitem}{resnum}; |
my $res = $$items{$contitem}{resnum}; |
my $type = $$resources{$res}{type}; |
my $type = $$resources{$res}{type}; |
my $title = $$items{$contitem}{title}; |
my $title = $$items{$contitem}{title}; |
|
my $packageflag = 0; |
$src = &make_structure($cms,$key,$srcstem,\%flag,\%count,$timestamp,$boardnum,$hrefs,\%pagecontents,$res,$type,$resinfo,$contitem,$uname,$cdom); |
if (grep/^$res$/,@{$packages}) { |
|
$packageflag = 1; |
|
} |
|
$src = &make_structure($cms,$key,$srcstem,\%flag,\%count,$timestamp,$boardnum,$hrefs,\%pagecontents,$res,$type,$resinfo,$contitem,$uname,$cdom,$contcount,$packageflag); |
if ($flag{$key}{page}) { |
if ($flag{$key}{page}) { |
if ($count{$key}{seq} + $count{$key}{page} + $count{$key}{board} + $count{$key}{file} +1 == 1) { |
if ($count{$key}{seq} + $count{$key}{page} + $count{$key}{board} + $count{$key}{file} +1 == 1) { |
$seqtext{$key} .= qq|></resource> |
$seqtext{$key} .= qq|></resource> |
Line 520 sub build_structure {
|
Line 648 sub build_structure {
|
$curr_id ++; |
$curr_id ++; |
$next_id ++; |
$next_id ++; |
$seqtext{$key} .= qq|></resource> |
$seqtext{$key} .= qq|></resource> |
<link from="$curr_id" to="$next_id index="$curr_id"></link>\n|; |
<link from="$curr_id" to="$next_id" index="$curr_id"></link>\n|; |
} |
} |
} |
} |
} |
} |
unless ($cms eq 'bb5' && $key eq 'Top') { |
unless (($cms eq 'bb5') && $key eq 'Top') { |
$seqtext{$key} .= "</map>\n"; |
$seqtext{$key} .= "</map>\n"; |
open(LOCFILE,">$destdir/sequences/$key.sequence"); |
open(LOCFILE,">$destdir/sequences/$key.sequence"); |
print LOCFILE $seqtext{$key}; |
print LOCFILE $seqtext{$key}; |
Line 538 sub build_structure {
|
Line 666 sub build_structure {
|
} |
} |
$topnum += ($count{'Top'}{page} + $count{'Top'}{seq}); |
$topnum += ($count{'Top'}{page} + $count{'Top'}{seq}); |
|
|
if ($cms eq 'bb5') { |
if ($cms eq 'bb5' || $cms eq 'bb6') { |
if (@{$announcements} > 0) { |
if (@{$announcements} > 0) { |
&process_specials($context,'announcements',$announcements,\$topnum,$$items{'Top'}{contentscount},$destdir,$udom,$uname,$cdom,$crs,$timenow,$newdir,$timestamp,$resinfo,\$seqtext{'Top'},$pagesfiles,$seqfiles,$topurls,$topnames); |
&process_specials($context,'announcements',$announcements,\$topnum,$$items{'Top'}{contentscount},$destdir,$udom,$uname,$cdom,$crs,$timenow,$newdir,$timestamp,$resinfo,\$seqtext{'Top'},$pagesfiles,$seqfiles,$topurls,$topnames); |
} |
} |
Line 551 sub build_structure {
|
Line 679 sub build_structure {
|
if (@{$surveys} > 0) { |
if (@{$surveys} > 0) { |
&process_specials($context,'surveys',$surveys,\$topnum,$$items{'Top'}{contentscount},$destdir,$udom,$uname,$cdom,$crs,$timenow,$newdir,$timestamp,$resinfo,\$seqtext{'Top'},$pagesfiles,$seqfiles,$topurls,$topnames); |
&process_specials($context,'surveys',$surveys,\$topnum,$$items{'Top'}{contentscount},$destdir,$udom,$uname,$cdom,$crs,$timenow,$newdir,$timestamp,$resinfo,\$seqtext{'Top'},$pagesfiles,$seqfiles,$topurls,$topnames); |
} |
} |
|
|
$seqtext{'Top'} .= "</map>\n"; |
$seqtext{'Top'} .= "</map>\n"; |
open(TOPFILE,">$destdir/sequences/Top.sequence"); |
open(TOPFILE,">$destdir/sequences/Top.sequence"); |
print TOPFILE $seqtext{'Top'}; |
print TOPFILE $seqtext{'Top'}; |
Line 561 sub build_structure {
|
Line 688 sub build_structure {
|
|
|
my $filestem; |
my $filestem; |
if ($context eq 'DOCS') { |
if ($context eq 'DOCS') { |
$filestem = "/uploaded/$cdom/$crs"; |
$filestem = "/uploaded/$cdom/$crs/$timenow"; |
} elsif ($context eq 'CSTR') { |
} elsif ($context eq 'CSTR') { |
$filestem = "/res/$udom/$uname/$newdir"; |
$filestem = "/res/$udom/$uname/$newdir"; |
} |
} |
Line 569 sub build_structure {
|
Line 696 sub build_structure {
|
foreach my $key (sort keys %pagecontents) { |
foreach my $key (sort keys %pagecontents) { |
for (my $i=0; $i<@{$pagecontents{$key}}; $i++) { |
for (my $i=0; $i<@{$pagecontents{$key}}; $i++) { |
my $filename = $destdir.'/pages/'.$key.'_'.$i.'.page'; |
my $filename = $destdir.'/pages/'.$key.'_'.$i.'.page'; |
|
my $resource = "$filestem/resfiles/$$items{$pagecontents{$key}[$i][0]}{resnum}.html"; |
|
my $res = $$items{$pagecontents{$key}[$i][0]}{resnum}; |
|
my $resource = $filestem.'/resfiles/'.$res.'.html'; |
|
if (grep/^$res$/,@{$packages}) { |
|
$resource = $filestem.'/resfiles/'.$res.'./index.html'; # should be entry_point |
|
} |
open(PAGEFILE,">$filename"); |
open(PAGEFILE,">$filename"); |
print PAGEFILE qq|<map> |
print PAGEFILE qq|<map> |
<resource src="$filestem/resfiles/$$items{$pagecontents{$key}[$i][0]}{resnum}/$$items{$pagecontents{$key}[$i][0]}{resnum}.html" id="1" type="start" title="$$items{$pagecontents{$key}[$i][0]}{title}"></resource> |
<resource src="$resource" id="1" type="start" title="$$items{$pagecontents{$key}[$i][0]}{title}"></resource> |
<link to="2" index="1" from="1">\n|; |
<link to="2" index="1" from="1">\n|; |
if (@{$pagecontents{$key}[$i]} == 1) { |
if (@{$pagecontents{$key}[$i]} == 1) { |
print PAGEFILE qq|<resource src="" id="2" type="finish"></resource>|; |
print PAGEFILE qq|<resource src="" id="2" type="finish"></resource>\n|; |
} elsif (@{$pagecontents{$key}[$i]} == 2) { |
} elsif (@{$pagecontents{$key}[$i]} == 2) { |
print PAGEFILE qq|<resource src="$filestem/resfiles/$$items{$pagecontents{$key}[$i][1]}{resnum}.html" id="2" type="finish" title="$$items{$pagecontents{$key}[$i][1]}{title}"></resource>|; |
my $res = $$items{$pagecontents{$key}[$i][1]}{resnum}; |
|
my $resource = $filestem.'/resfiles/'.$res.'.html'; |
|
if (grep/^$res$/,@{$packages}) { |
|
$resource = $filestem.'/resfiles/'.$res.'./index.html'; # should be entry_point |
|
} |
|
print PAGEFILE qq|<resource src="$resource" id="2" type="finish" title="$$items{$pagecontents{$key}[$i][1]}{title}"></resource>\n|; |
} else { |
} else { |
for (my $j=1; $j<@{$pagecontents{$key}[$i]}-1; $j++) { |
for (my $j=1; $j<@{$pagecontents{$key}[$i]}-1; $j++) { |
my $curr_id = $j+1; |
my $curr_id = $j+1; |
my $next_id = $j+2; |
my $next_id = $j+2; |
my $resource = $filestem.'/resfiles/'.$$items{$pagecontents{$key}[$i][$j]}{resnum}.'.html'; |
my $res = $$items{$pagecontents{$key}[$i][$j]}{resnum}; |
|
my $resource = $filestem.'/resfiles/'.$res.'.html'; |
|
if (grep/^$res$/,@{$packages}) { |
|
$resource = $filestem.'/resfiles/'.$res.'./index.html'; # entry_point |
|
} |
print PAGEFILE qq|<resource src="$resource" id="$curr_id" title="$$items{$pagecontents{$key}[$i][$j]}{title}"></resource> |
print PAGEFILE qq|<resource src="$resource" id="$curr_id" title="$$items{$pagecontents{$key}[$i][$j]}{title}"></resource> |
<link to="$next_id" index="$curr_id" from="$curr_id">\n|; |
<link to="$next_id" index="$curr_id" from="$curr_id">\n|; |
} |
} |
my $final_id = @{$pagecontents{$key}[$i]}; |
my $final_id = @{$pagecontents{$key}[$i]}; |
print PAGEFILE qq|<resource src="$filestem/resfiles/$$items{$pagecontents{$key}[$i][-1]}{resnum}/$$items{$pagecontents{$key}[$i][-1]}{resnum}.html" id="$final_id" type="finish" title="$$items{$pagecontents{$key}[$i][-1]}{title}"></resource>\n|; |
my $res = $$items{$pagecontents{$key}[$i][-1]}{resnum}; |
|
my $resource = $filestem.'/resfiles/'.$res.'.html'; |
|
if (grep/^$res$/,@{$packages}) { |
|
$resource = $filestem.'/resfiles/'.$res.'./index.html'; # entry_point |
|
} |
|
print PAGEFILE qq|<resource src="$resource" id="$final_id" type="finish" title="$$items{$pagecontents{$key}[$i][-1]}{title}"></resource>\n|; |
} |
} |
print PAGEFILE "</map>"; |
print PAGEFILE "</map>"; |
close(PAGEFILE); |
close(PAGEFILE); |
Line 596 sub build_structure {
|
Line 743 sub build_structure {
|
} |
} |
|
|
sub make_structure { |
sub make_structure { |
my ($cms,$key,$srcstem,$flag,$count,$timestamp,$boardnum,$hrefs,$pagecontents,$res,$type,$resinfo,$contitem,$uname,$cdom) = @_; |
my ($cms,$key,$srcstem,$flag,$count,$timestamp,$boardnum,$hrefs,$pagecontents,$res,$type,$resinfo,$contitem,$uname,$cdom,$contcount,$packageflag) = @_; |
my $src =''; |
my $src =''; |
if (($cms eq 'angel' && $type eq 'FOLDER') || ($cms eq 'bb5' && ($$resinfo{$res}{'isfolder'} eq 'true') || ($key eq 'Top')) ) { |
if (($cms eq 'angel' && $type eq 'FOLDER') || (($cms eq 'bb5' || $cms eq 'bb6') && ($$resinfo{$res}{'isfolder'} eq 'true') || ($key eq 'Top')) ) { |
$src = $srcstem.'/sequences/'.$contitem.'.sequence'; |
$src = $srcstem.'/sequences/'.$contitem.'.sequence'; |
$$flag{$key}{page} = 0; |
$$flag{$key}{page} = 0; |
$$flag{$key}{seq} = 1; |
$$flag{$key}{seq} = 1; |
Line 618 sub make_structure {
|
Line 765 sub make_structure {
|
$$flag{$key}{file} = 1; |
$$flag{$key}{file} = 1; |
} elsif ($cms eq 'angel' && (($type eq "PAGE") || ($type eq "LINK")) ) { |
} elsif ($cms eq 'angel' && (($type eq "PAGE") || ($type eq "LINK")) ) { |
if ($$flag{$key}{page}) { |
if ($$flag{$key}{page}) { |
if ($$count{key}{page} == -1) { |
if ($$count{$key}{page} == -1) { |
print STDERR "Array index is -1, we shouldnt be here\n"; |
print STDERR "Array index is -1, we shouldnt be here, key is $key, type is $type\n"; |
} else { |
} else { |
push @{$$pagecontents{$key}[$$count{$key}{page}]},$contitem; |
push @{$$pagecontents{$key}[$$count{$key}{page}]},$contitem; |
} |
} |
Line 629 sub make_structure {
|
Line 776 sub make_structure {
|
@{$$pagecontents{$key}[$$count{$key}{page}]} = ("$contitem"); |
@{$$pagecontents{$key}[$$count{$key}{page}]} = ("$contitem"); |
$$flag{$key}{seq} = 0; |
$$flag{$key}{seq} = 0; |
} |
} |
} elsif ($cms eq 'bb5') { |
} elsif ($cms eq 'bb5' || $cms eq 'bb6') { |
if ($$flag{$key}{page}) { |
if ($$flag{$key}{page}) { |
push @{$$pagecontents{$key}[$$count{$key}{page}]},$contitem; |
push @{$$pagecontents{$key}[$$count{$key}{page}]},$contitem; |
} else { |
} else { |
$$count{$key}{page} ++; |
if ($contcount == 1) { |
$src = $srcstem.'/pages/'.$key.'_'.$$count{$key}{page}.'.page'; |
if ($packageflag) { |
@{$$pagecontents{$key}[$$count{$key}{page}]} = ("$contitem"); |
$src = $srcstem.'/resfiles/'.$res.'/index.html'; # Needs to be entry point |
|
} else { |
|
$src = $srcstem.'/resfiles/'.$res.'.html'; |
|
} |
|
} else { |
|
$$count{$key}{page} ++; |
|
$src = $srcstem.'/pages/'.$key.'_'.$$count{$key}{page}.'.page'; |
|
@{$$pagecontents{$key}[$$count{$key}{page}]} = ("$contitem"); |
|
} |
$$flag{$key}{seq} = 0; |
$$flag{$key}{seq} = 0; |
} |
} |
} |
} |
Line 651 sub process_specials {
|
Line 806 sub process_specials {
|
my $nextnum = 0; |
my $nextnum = 0; |
my $seqstem = ''; |
my $seqstem = ''; |
if ($context eq 'CSTR') { |
if ($context eq 'CSTR') { |
$seqstem = '/res/'.$udom.'/'.$uname.'/'.$newdir; |
$seqstem = "/res/$udom/$uname/$newdir"; |
} elsif ($context eq 'DOCS') { |
} elsif ($context eq 'DOCS') { |
$seqstem = '/uploaded/'.$cdom.'/'.$crs.'/'.$timenow; |
$seqstem = '/uploaded/'.$cdom.'/'.$crs.'/'.$timenow; |
} |
} |
Line 756 sub process_user {
|
Line 911 sub process_user {
|
[sub { |
[sub { |
my ($tagname, $attr) = @_; |
my ($tagname, $attr) = @_; |
push @state, $tagname; |
push @state, $tagname; |
if (@state eq "USERS USER") { |
if ("@state" eq "USERS USER") { |
$userid = $attr->{value}; |
$userid = $attr->{value}; |
%{$$settings{$userid}} = (); |
%{$$settings{$userid}} = (); |
@{$$settings{$userid}{links}} = (); |
@{$$settings{$userid}{links}} = (); |
} elsif (@state eq "USERS USER LOGINID") { |
} elsif ("@state" eq "USERS USER LOGINID") { |
$$settings{$userid}{loginid} = $attr->{value}; |
$$settings{$userid}{loginid} = $attr->{value}; |
} elsif (@state eq "USERS USER PASSPHRASE") { |
} elsif ("@state" eq "USERS USER PASSPHRASE") { |
$$settings{$userid}{passphrase} = $attr->{value}; |
$$settings{$userid}{passphrase} = $attr->{value}; |
} elsif ("@state" eq "USERS USER STUDENTID" ) { |
} elsif ("@state" eq "USERS USER STUDENTID" ) { |
$$settings{$userid}{studentid} = $attr->{value}; |
$$settings{$userid}{studentid} = $attr->{value}; |
Line 800 sub process_user {
|
Line 955 sub process_user {
|
end_h => |
end_h => |
[sub { |
[sub { |
my ($tagname) = @_; |
my ($tagname) = @_; |
if (@state eq "USERS USER") { |
if ("@state" eq "USERS USER") { |
$linknum = 0; |
$linknum = 0; |
} |
} |
pop @state; |
pop @state; |
Line 837 sub process_group {
|
Line 992 sub process_group {
|
[sub { |
[sub { |
my ($tagname, $attr) = @_; |
my ($tagname, $attr) = @_; |
push @state, $tagname; |
push @state, $tagname; |
if (@state eq "GROUPS GROUP") { |
if ("@state" eq "GROUPS GROUP") { |
$grp = $attr->{id}; |
$grp = $attr->{id}; |
} |
} |
if (@state eq "GROUPS GROUP TITLE") { |
if ("@state" eq "GROUPS GROUP TITLE") { |
$$settings{$grp}{title} = $attr->{value}; |
$$settings{$grp}{title} = $attr->{value}; |
} elsif (@state eq "GROUPS GROUP FLAGS ISAVAILABLE") { |
} elsif ("@state" eq "GROUPS GROUP FLAGS ISAVAILABLE") { |
$$settings{$grp}{isavailable} = $attr->{value}; |
$$settings{$grp}{isavailable} = $attr->{value}; |
} elsif (@state eq "GROUPS GROUP FLAGS HASCHATROOM") { |
} elsif ("@state" eq "GROUPS GROUP FLAGS HASCHATROOM") { |
$$settings{$grp}{chat} = $attr->{value}; |
$$settings{$grp}{chat} = $attr->{value}; |
} elsif ("@state" eq "GROUPS GROUP FLAGS HASDISCUSSIONBOARD") { |
} elsif ("@state" eq "GROUPS GROUP FLAGS HASDISCUSSIONBOARD") { |
$$settings{$grp}{discussion} = $attr->{value}; |
$$settings{$grp}{discussion} = $attr->{value}; |
Line 889 sub process_staff {
|
Line 1044 sub process_staff {
|
[sub { |
[sub { |
my ($tagname, $attr) = @_; |
my ($tagname, $attr) = @_; |
push @state, $tagname; |
push @state, $tagname; |
if (@state eq "STAFFINFO TITLE") { |
if ("@state" eq "STAFFINFO TITLE") { |
$$settings{title} = $attr->{value}; |
$$settings{title} = $attr->{value}; |
} elsif (@state eq "STAFFINFO BIOGRAPHY TEXTCOLOR") { |
} elsif ("@state" eq "STAFFINFO BIOGRAPHY TEXTCOLOR") { |
$$settings{textcolor} = $attr->{value}; |
$$settings{textcolor} = $attr->{value}; |
} elsif (@state eq "STAFFINFO BIOGRAPHY FLAGS ISHTML") { |
} elsif ("@state" eq "STAFFINFO BIOGRAPHY FLAGS ISHTML") { |
$$settings{ishtml} = $attr->{value}; |
$$settings{ishtml} = $attr->{value}; |
} elsif ("@state" eq "STAFFINFO FLAGS ISAVAILABLE" ) { |
} elsif ("@state" eq "STAFFINFO FLAGS ISAVAILABLE" ) { |
$$settings{isavailable} = $attr->{value}; |
$$settings{isavailable} = $attr->{value}; |
Line 1066 sub process_link {
|
Line 1221 sub process_link {
|
[sub { |
[sub { |
my ($tagname, $attr) = @_; |
my ($tagname, $attr) = @_; |
push @state, $tagname; |
push @state, $tagname; |
if (@state eq "EXTERNALLINK TITLE") { |
if ("@state" eq "EXTERNALLINK TITLE") { |
$$settings{title} = $attr->{value}; |
$$settings{title} = $attr->{value}; |
} elsif (@state eq "EXTERNALLINK TEXTCOLOR") { |
} elsif ("@state" eq "EXTERNALLINK TEXTCOLOR") { |
$$settings{textcolor} = $attr->{value}; |
$$settings{textcolor} = $attr->{value}; |
} elsif (@state eq "EXTERNALLINK DESCRIPTION FLAGS ISHTML") { |
} elsif ("@state" eq "EXTERNALLINK DESCRIPTION FLAGS ISHTML") { |
$$settings{ishtml} = $attr->{value}; |
$$settings{ishtml} = $attr->{value}; |
} elsif ("@state" eq "EXTERNALLINK FLAGS ISAVAILABLE" ) { |
} elsif ("@state" eq "EXTERNALLINK FLAGS ISAVAILABLE" ) { |
$$settings{isavailable} = $attr->{value}; |
$$settings{isavailable} = $attr->{value}; |
Line 1081 sub process_link {
|
Line 1236 sub process_link {
|
} elsif ("@state" eq "EXTERNALLINK POSITION" ) { |
} elsif ("@state" eq "EXTERNALLINK POSITION" ) { |
$$settings{position} = $attr->{value}; |
$$settings{position} = $attr->{value}; |
} elsif ("@state" eq "EXTERNALLINK URL" ) { |
} elsif ("@state" eq "EXTERNALLINK URL" ) { |
$$settings{url} = $attr->{value}; |
$$settings{url} = $attr->{value}; |
} |
} |
}, "tagname, attr"], |
}, "tagname, attr"], |
text_h => |
text_h => |
Line 1347 sub addposting {
|
Line 1502 sub addposting {
|
} |
} |
# ---------------------------------------------------------------- Process Blackboard Assessments - pools, quizzes, surveys |
# ---------------------------------------------------------------- Process Blackboard Assessments - pools, quizzes, surveys |
sub process_assessment { |
sub process_assessment { |
my ($res,$docroot,$container,$dirname,$destdir,$settings,$total,$udom,$uname) = @_; |
my ($context,$res,$docroot,$container,$dirname,$destdir,$settings,$total,$udom,$uname,$pagesfiles,$sequencesfiles) = @_; |
my $xmlfile = $docroot.'/'.$res.".dat"; |
my $xmlfile = $docroot.'/'.$res.".dat"; |
# print "XML file is $xmlfile\n"; |
# print "XML file is $xmlfile\n"; |
my @state = (); |
my @state = (); |
Line 1403 sub process_assessment {
|
Line 1558 sub process_assessment {
|
} |
} |
if ("@state" eq "$toptag{$container} QUESTIONLIST QUESTION") { |
if ("@state" eq "$toptag{$container} QUESTIONLIST QUESTION") { |
$id = $attr->{id}; |
$id = $attr->{id}; |
unless ($container eq 'pool') { |
push @allids, $id; |
push @allids, $id; |
|
} |
|
%{$$settings{$id}} = (); |
%{$$settings{$id}} = (); |
@{$allanswers{$id}} = (); |
@{$allanswers{$id}} = (); |
$$settings{$id}{class} = $attr->{class}; |
$$settings{$id}{class} = $attr->{class}; |
Line 1505 sub process_assessment {
|
Line 1658 sub process_assessment {
|
my $dirtitle = $$settings{'title'}; |
my $dirtitle = $$settings{'title'}; |
$dirtitle =~ s/\W//g; |
$dirtitle =~ s/\W//g; |
$dirtitle .= '_'.$res; |
$dirtitle .= '_'.$res; |
|
if (!-e "$destdir/problems") { |
|
mkdir("$destdir/problems",0755); |
|
} |
if (!-e "$destdir/problems/$dirtitle") { |
if (!-e "$destdir/problems/$dirtitle") { |
mkdir("$destdir/problems/$dirtitle",0755); |
mkdir("$destdir/problems/$dirtitle",0755); |
} |
} |
my $newdir = "$destdir/problems/$dirtitle"; |
my $newdir = "$destdir/problems/$dirtitle"; |
|
my $seqdir = "$destdir/sequences"; |
my $pagedir = "$destdir/pages"; |
my $pagedir = "$destdir/pages"; |
my $curr_id = 0; |
my $curr_id = 0; |
my $next_id = 1; |
my $next_id = 1; |
unless ($container eq 'pool') { |
my $fh; |
open(PAGEFILE,">$pagedir/$res.page"); |
my $containerdir; |
print PAGEFILE qq|<map> |
if ($container eq 'pool') { |
|; |
$containerdir = $seqdir.'/'.$res.'.sequence'; |
$$total{page} ++; |
if (!-e "$seqdir") { |
print PAGEFILE qq|<resource id="1" src="/res/$udom/$uname/$resdir/problems/$dirtitle/$allids[0].problem" type="start"></resource>|; |
mkdir("$seqdir",0770); |
if (@allids == 1) { |
} |
print PAGEFILE qq| |
open($fh,">$containerdir"); |
|
$$total{seq} ++; |
|
push @{$sequencesfiles},$res.'.sequence'; |
|
} else { |
|
$containerdir = $pagedir.'/'.$res.'.page'; |
|
if (!-e "$destdir/pages") { |
|
mkdir("$destdir/pages",0770); |
|
} |
|
open($fh,">$containerdir"); |
|
$$total{page} ++; |
|
push @{$pagesfiles},$res.'.page'; |
|
} |
|
print $fh qq|<map> |
|
|; |
|
my $probsrc = "/res/lib/templates/simpleproblem.problem"; |
|
my ($cid,$cdom,$cnum); |
|
if ($context eq 'DOCS') { |
|
$cid = $ENV{'request.course.id'}; |
|
($cdom,$cnum) = split/_/,$cid; |
|
} |
|
if ($context eq 'CSTR') { |
|
$probsrc="/res/$udom/$uname/$resdir/problems/$dirtitle/$allids[0].problem"; |
|
} |
|
print $fh qq|<resource id="1" src="$probsrc" type="start" title="question_0001"></resource>|; |
|
if (@allids == 1) { |
|
print $fh qq| |
<link from="1" to="2" index="1"></link> |
<link from="1" to="2" index="1"></link> |
<resource id="2" src="" type="finish">\n|; |
<resource id="2" src="" type="finish">\n|; |
} else { |
} else { |
for (my $j=1; $j<@allids; $j++) { |
for (my $j=1; $j<@allids; $j++) { |
$curr_id = $j; |
my $qntitle = $j; |
$next_id = $curr_id + 1; |
while (length($qntitle) <4) { |
print PAGEFILE qq| |
$qntitle = '0'.$qntitle; |
|
} |
|
$curr_id = $j; |
|
$next_id = $curr_id + 1; |
|
if ($context eq 'CSTR') { |
|
$probsrc = "/res/$udom/$uname/$resdir/problems/$dirtitle/$allids[$j].problem"; |
|
} |
|
print $fh qq| |
<link from="$curr_id" to="$next_id" index="$curr_id"></link> |
<link from="$curr_id" to="$next_id" index="$curr_id"></link> |
<resource id="$next_id" src="/res/$udom/$uname/$resdir/problems/$dirtitle/$allids[$j].problem"|; |
<resource id="$next_id" src="$probsrc" title="question_$qntitle"|; |
if ($next_id == @allids) { |
if ($next_id == @allids) { |
print PAGEFILE qq| type="finish"></resource>\n|; |
print $fh qq| type="finish"></resource>\n|; |
} else { |
} else { |
print PAGEFILE qq|></resource>|; |
print $fh qq|></resource>|; |
} |
|
} |
} |
} |
} |
print PAGEFILE qq|</map>|; |
|
close(PAGEFILE); |
|
} |
} |
|
print $fh qq|</map>|; |
|
close($fh); |
|
my $qnum = 0; |
foreach my $id (@allids) { |
foreach my $id (@allids) { |
my $output = qq|<problem> |
$qnum ++; |
|
my $output; |
|
my $permcontainer = $containerdir; |
|
$permcontainer =~ s#/home/httpd/html/userfiles#uploaded#; |
|
my $symb = $cid.'.'.$permcontainer.'___'.$qnum.'___lib/templates/simpleproblem.problem.0.'; |
|
my %resourcedata = (); |
|
for (my $i=0; $i<10; $i++) { |
|
my $iter = $i+1; |
|
$resourcedata{$symb.'text'.$iter} = ""; |
|
$resourcedata{$symb.'value'.$iter} = "unused"; |
|
$resourcedata{$symb.'position'.$iter} = "random"; |
|
} |
|
$resourcedata{$symb.'randomize'} = 'yes'; |
|
$resourcedata{$symb.'maxfoils'} = 10; |
|
if ($context eq 'CSTR') { |
|
$output = qq|<problem> |
|; |
|; |
$$total{problem} ++; |
} |
|
$$total{prob} ++; |
if ($$settings{$id}{class} eq "QUESTION_ESSAY") { |
if ($$settings{$id}{class} eq "QUESTION_ESSAY") { |
$output .= qq|<startouttext />$$settings{$id}{text}<endouttext /> |
if ($context eq 'CSTR') { |
|
$output .= qq|<startouttext />$$settings{$id}{text}<endouttext /> |
<essayresponse> |
<essayresponse> |
<textfield></textfield> |
<textfield></textfield> |
</essayresponse> |
</essayresponse> |
Line 1552 sub process_assessment {
|
Line 1758 sub process_assessment {
|
$$settings{$id}{feedbackcorr} |
$$settings{$id}{feedbackcorr} |
</postanswerdate> |
</postanswerdate> |
|; |
|; |
|
} else { |
|
$resourcedata{$symb.'questiontext'} = $$settings{$id}{text}; |
|
$resourcedata{$symb.'hiddenparts'} = '!essay'; |
|
$resourcedata{$symb.'questiontype'} = 'essay'; |
|
} |
} else { |
} else { |
$output .= qq|<startouttext />$$settings{$id}{text}\n|; |
if ($context eq 'CSTR') { |
if ( defined($$settings{$id}{image}) ) { |
$output .= qq|<startouttext />$$settings{$id}{text}\n|; |
|
} else { |
|
$resourcedata{$symb.'questiontext'} = $$settings{$id}{text}; |
|
} |
|
my ($image,$imglink,$url); |
|
if ( defined($$settings{$id}{image}) ) { |
if ( $$settings{$id}{style} eq 'embed' ) { |
if ( $$settings{$id}{style} eq 'embed' ) { |
$output .= qq|<br /><img src="$dirname/resfiles/$res/$$settings{$id}{image}" /><br />|; |
$image = qq|<br /><img src="$dirname/resfiles/$res/$$settings{$id}{image}" /><br />|; |
} else { |
} else { |
$output .= qq|<br /><a href="$dirname/resfiles/$res/$$settings{$id}{image}">Link to file</a><br />|; |
$imglink = qq|<br /><a href="$dirname/resfiles/$res/$$settings{$id}{image}">Link to file</a><br />|; |
} |
} |
} |
} |
if ( defined($$settings{$id}{url}) ) { |
if ( defined($$settings{$id}{url}) ) { |
$output .= qq|<br /><a href="$$settings{$id}{url}">$$settings{$id}{name}</a><br />|; |
$url = qq|<br /><a href="$$settings{$id}{url}">$$settings{$id}{name}</a><br />|; |
|
} |
|
if ($context eq 'CSTR') { |
|
$output .= $image.$imglink.$url.' |
|
<endouttext />'; |
|
} else { |
|
$resourcedata{$symb.'questiontext'} .= $image.$imglink.$url; |
} |
} |
$output .= qq| |
|
<endouttext />|; |
|
if ($$settings{$id}{class} eq 'QUESTION_MULTIPLECHOICE') { |
if ($$settings{$id}{class} eq 'QUESTION_MULTIPLECHOICE') { |
my $numfoils = @{$allanswers{$id}}; |
my $numfoils = @{$allanswers{$id}}; |
$output .= qq| |
if ($context eq 'CSTR') { |
|
$output .= qq| |
<radiobuttonresponse max="$numfoils" randomize="yes"> |
<radiobuttonresponse max="$numfoils" randomize="yes"> |
<foilgroup> |
<foilgroup> |
|; |
|; |
|
} else { |
|
$resourcedata{$symb.'hiddenparts'} = '!radio'; |
|
$resourcedata{$symb.'questiontype'} = 'radio'; |
|
$resourcedata{$symb.'maxfoils'} = $numfoils; |
|
} |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
|
my $iter = $k+1; |
$output .= " <foil name=\"foil".$k."\" value=\""; |
$output .= " <foil name=\"foil".$k."\" value=\""; |
if (grep/^$allanswers{$id}[$k]$/,@{$$settings{$id}{correctanswer}}) { |
if (grep/^$allanswers{$id}[$k]$/,@{$$settings{$id}{correctanswer}}) { |
$output .= "true\" location=\""; |
$output .= "true\" location=\""; |
|
$resourcedata{$symb.'value'.$iter} = "true"; |
} else { |
} else { |
$output .= "false\" location=\""; |
$output .= "false\" location=\""; |
|
$resourcedata{$symb.'value'.$iter} = "false"; |
} |
} |
if (lc ($allanswers{$id}[$k]) =~ m/^\s?([Aa]ll)|([Nn]one)\sof\sthe\sabove\.?/) { |
if (lc ($allanswers{$id}[$k]) =~ m/^\s?([Aa]ll)|([Nn]one)\sof\sthe\sabove\.?/) { |
$output .= "bottom\""; |
$output .= "bottom\""; |
|
$resourcedata{$symb.'position'.$iter} = "bottom"; |
} else { |
} else { |
$output .= "random\""; |
$output .= "random\""; |
} |
} |
$output .= "\><startouttext />".$$settings{$id}{$allanswers{$id}[$k]}{text}; |
$output .= "\><startouttext />".$$settings{$id}{$allanswers{$id}[$k]}{text}; |
|
$resourcedata{$symb.'text'.$iter} = $$settings{$id}{$allanswers{$id}[$k]}{text}; |
|
my ($ans_image,$ans_link); |
if ( defined($$settings{$id}{$allanswers{$id}[$k]}{image}) ) { |
if ( defined($$settings{$id}{$allanswers{$id}[$k]}{image}) ) { |
if ( $$settings{$id}{$allanswers{$id}[$k]}{style} eq 'embed' ) { |
if ( $$settings{$id}{$allanswers{$id}[$k]}{style} eq 'embed' ) { |
$output .= qq|<br /><img src="$dirname/resfiles/$res/$$settings{$id}{$allanswers{$id}[$k]}{image}" /><br />|; |
$ans_image .= qq|<br /><img src="$dirname/resfiles/$res/$$settings{$id}{$allanswers{$id}[$k]}{image}" /><br />|; |
} else { |
} else { |
$output .= qq|<br /><a href="$dirname/resfiles/$res/$$settings{$id}{$allanswers{$id}[$k]}{image}" />Link to file</a><br/>|; |
$ans_link .= qq|<br /><a href="$dirname/resfiles/$res/$$settings{$id}{$allanswers{$id}[$k]}{image}" />Link to file</a><br/>|; |
} |
} |
} |
} |
$output .= qq|<endouttext /></foil>\n|; |
$output .= $ans_image.$ans_link.'<endouttext /></foil>'."\n"; |
|
$resourcedata{$symb.'text'.$iter} .= $ans_image.$ans_link; |
} |
} |
chomp($output); |
if ($context eq 'CSTR') { |
$output .= qq| |
chomp($output); |
|
$output .= qq| |
</foilgroup> |
</foilgroup> |
</radiobuttonresponse> |
</radiobuttonresponse> |
|; |
|; |
|
} |
} elsif ($$settings{$id}{class} eq 'QUESTION_TRUEFALSE') { |
} elsif ($$settings{$id}{class} eq 'QUESTION_TRUEFALSE') { |
my $numfoils = @{$allanswers{$id}}; |
my $numfoils = @{$allanswers{$id}}; |
$output .= qq| |
if ($context eq 'CSTR') { |
|
$output .= qq| |
<radiobuttonresponse max="$numfoils" randomize="yes"> |
<radiobuttonresponse max="$numfoils" randomize="yes"> |
<foilgroup> |
<foilgroup> |
|; |
|; |
|
} else { |
|
$resourcedata{$symb.'maxfoils'} = $numfoils; |
|
$resourcedata{$symb.'hiddenparts'} = '!radio'; |
|
$resourcedata{$symb.'questiontype'} = 'radio'; |
|
} |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
|
my $iter = $k+1; |
$output .= " <foil name=\"foil".$k."\" value=\""; |
$output .= " <foil name=\"foil".$k."\" value=\""; |
if (grep/^$allanswers{$id}[$k]$/,@{$$settings{$id}{correctanswer}}) { |
if (grep/^$allanswers{$id}[$k]$/,@{$$settings{$id}{correctanswer}}) { |
$output .= "true\" location=\"random\""; |
$output .= "true\" location=\"random\""; |
|
$resourcedata{$symb.'value'.$iter} = "true"; |
} else { |
} else { |
$output .= "false\" location=\"random\""; |
$output .= "false\" location=\"random\""; |
|
$resourcedata{$symb.'value'.$iter} = "false"; |
} |
} |
$output .= "\><startouttext />".$$settings{$id}{$allanswers{$id}[$k]}{text}."<endouttext /></foil>\n"; |
$output .= "\><startouttext />".$$settings{$id}{$allanswers{$id}[$k]}{text}."<endouttext /></foil>\n"; |
|
$resourcedata{$symb.'text'.$iter} = $$settings{$id}{$allanswers{$id}[$k]}{text}; |
} |
} |
chomp($output); |
if ($context eq 'CSTR') { |
$output .= qq| |
chomp($output); |
|
$output .= qq| |
</foilgroup> |
</foilgroup> |
</radiobuttonresponse> |
</radiobuttonresponse> |
|; |
|; |
|
} |
} elsif ($$settings{$id}{class} eq 'QUESTION_MULTIPLEANSWER') { |
} elsif ($$settings{$id}{class} eq 'QUESTION_MULTIPLEANSWER') { |
my $numfoils = @{$allanswers{$id}}; |
my $numfoils = @{$allanswers{$id}}; |
$output .= qq| |
if ($context eq 'CSTR') { |
|
$output .= qq| |
<optionresponse max="$numfoils" randomize="yes"> |
<optionresponse max="$numfoils" randomize="yes"> |
<foilgroup options="('True','False')"> |
<foilgroup options="('True','False')"> |
|; |
|; |
|
} else { |
|
$resourcedata{$symb.'newopt'} = ''; |
|
$resourcedata{$symb.'delopt'} = ''; |
|
$resourcedata{$symb.'options'} = "('True','False')"; |
|
$resourcedata{$symb.'hiddenparts'} = '!option'; |
|
$resourcedata{$symb.'questiontype'} = 'option'; |
|
$resourcedata{$symb.'maxfoils'} = $numfoils; |
|
} |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
|
my $iter = $k+1; |
$output .= " <foil name=\"foil".$k."\" value=\""; |
$output .= " <foil name=\"foil".$k."\" value=\""; |
if (grep/^$allanswers{$id}[$k]$/,@{$$settings{$id}{correctanswer}}) { |
if (grep/^$allanswers{$id}[$k]$/,@{$$settings{$id}{correctanswer}}) { |
$output .= "True\""; |
$output .= "True\""; |
|
$resourcedata{$symb.'value'.$iter} = "True"; |
} else { |
} else { |
$output .= "False\""; |
$output .= "False\""; |
|
$resourcedata{$symb.'value'.$iter} = "False"; |
} |
} |
$output .= "\><startouttext />".$$settings{$id}{$allanswers{$id}[$k]}{text}."<endouttext /></foil>\n"; |
$output .= "\><startouttext />".$$settings{$id}{$allanswers{$id}[$k]}{text}."<endouttext /></foil>\n"; |
|
$resourcedata{$symb.'text'.$iter} = $$settings{$id}{$allanswers{$id}[$k]}{text}; |
} |
} |
chomp($output); |
if ($context eq 'CSTR') { |
$output .= qq| |
chomp($output); |
|
$output .= qq| |
</foilgroup> |
</foilgroup> |
</optionresponse> |
</optionresponse> |
|; |
|; |
|
} |
} elsif ($$settings{$id}{class} eq 'QUESTION_ORDER') { |
} elsif ($$settings{$id}{class} eq 'QUESTION_ORDER') { |
my $numfoils = @{$allanswers{$id}}; |
my $numfoils = @{$allanswers{$id}}; |
$output .= qq| |
my @allorder = (); |
|
if ($context eq 'CSTR') { |
|
$output .= qq| |
<rankresponse max="$numfoils" randomize="yes"> |
<rankresponse max="$numfoils" randomize="yes"> |
<foilgroup> |
<foilgroup> |
|; |
|; |
|
} else { |
|
$resourcedata{$symb.'newopt'} = ''; |
|
$resourcedata{$symb.'delopt'} = ''; |
|
$resourcedata{$symb.'hiddenparts'} = '!option'; |
|
$resourcedata{$symb.'questiontype'} = 'option'; |
|
$resourcedata{$symb.'maxfoils'} = $numfoils; |
|
} |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
$output .= " <foil location=\"random\" name=\"foil".$k."\" value=\"".$$settings{$id}{$allanswers{$id}[$k]}{order}."\"><startouttext />".$$settings{$id}{$allanswers{$id}[$k]}{text}."<endouttext /></foil>\n"; |
if ($context eq 'CSTR') { |
|
$output .= " <foil location=\"random\" name=\"foil".$k."\" value=\"".$$settings{$id}{$allanswers{$id}[$k]}{order}."\"><startouttext />".$$settings{$id}{$allanswers{$id}[$k]}{text}."<endouttext /></foil>\n"; |
|
} else { |
|
my $iter = $k+1; |
|
$resourcedata{$symb.'text'.$iter} = $$settings{$id}{$allanswers{$id}[$k]}{text}; |
|
if (!grep/^$$settings{$id}{$allanswers{$id}[$k]}{order}$/,@allorder) { |
|
push @allorder, $$settings{$id}{$allanswers{$id}[$k]}{order}; |
|
} |
|
} |
} |
} |
chomp($output); |
if ($context eq 'CSTR') { |
$output .= qq| |
chomp($output); |
|
$output .= qq| |
</foilgroup> |
</foilgroup> |
</rankresponse> |
</rankresponse> |
|; |
|; |
|
} else { |
|
@allorder = sort {$a <=> $b} @allorder; |
|
$resourcedata{$symb.'options'} = "('".join("','",@allorder)."')"; |
|
} |
} elsif ($$settings{$id}{class} eq 'QUESTION_FILLINBLANK') { |
} elsif ($$settings{$id}{class} eq 'QUESTION_FILLINBLANK') { |
my $numerical = 1; |
my $numerical = 1; |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
if ($context eq 'DOCS') { |
if ($$settings{$id}{$allanswers{$id}[$k]}{text} =~ m/([^\d\.]|\.\.)/) { |
$numerical = 0; |
$numerical = 0; |
} else { |
|
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
|
if ($$settings{$id}{$allanswers{$id}[$k]}{text} =~ m/([^\d\.]|\.\.)/) { |
|
$numerical = 0; |
|
} |
} |
} |
} |
} |
if ($numerical) { |
if ($numerical) { |
Line 1680 sub process_assessment {
|
Line 1968 sub process_assessment {
|
$numans = ($max + $min)/2; |
$numans = ($max + $min)/2; |
$tol = 100*($max - $min)/($numans*2); |
$tol = 100*($max - $min)/($numans*2); |
} |
} |
$output .= qq| |
if ($context eq 'CSTR') { |
|
$output .= qq| |
<numericalresponse answer="$numans"> |
<numericalresponse answer="$numans"> |
<responseparam type="tolerance" default="$tol%" name="tol" description="Numerical Tolerance" /> |
<responseparam type="tolerance" default="$tol%" name="tol" description="Numerical Tolerance" /> |
<responseparam name="sig" type="int_range,0-16" default="0,15" description="Significant Figures" |
<responseparam name="sig" type="int_range,0-16" default="0,15" description="Significant Figures" |
Line 1688 sub process_assessment {
|
Line 1977 sub process_assessment {
|
<textline /> |
<textline /> |
</numericalresponse> |
</numericalresponse> |
|; |
|; |
|
} |
} else { |
} else { |
if (@{$allanswers{$id}} == 1) { |
if ($context eq 'DOCS') { |
$output .= qq| |
$resourcedata{$symb.'hiddenparts'} = '!string'; |
|
$resourcedata{$symb.'questiontype'} = 'string'; |
|
$resourcedata{$symb.'maxfoils'} = @{$allanswers{$id}}; |
|
$resourcedata{$symb.'hiddenparts'} = '!string'; |
|
$resourcedata{$symb.'stringtype'} = 'ci'; |
|
$resourcedata{$symb.'stringanswer'} = $$settings{$id}{$allanswers{$id}[0]}{text}; |
|
} else { |
|
if (@{$allanswers{$id}} == 1) { |
|
$output .= qq| |
<stringresponse answer="$$settings{$id}{$allanswers{$id}[0]}{text}" type="ci"> |
<stringresponse answer="$$settings{$id}{$allanswers{$id}[0]}{text}" type="ci"> |
<textline> |
<textline> |
</textline> |
</textline> |
</stringresponse> |
</stringresponse> |
|; |
|; |
} else { |
} else { |
my @answertext = (); |
my @answertext = (); |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
$$settings{$id}{$allanswers{$id}[$k]}{text} =~ s/\|/\|/g; |
$$settings{$id}{$allanswers{$id}[$k]}{text} =~ s/\|/\|/g; |
push @answertext, $$settings{$id}{$allanswers{$id}[$k]}{text}; |
push @answertext, $$settings{$id}{$allanswers{$id}[$k]}{text}; |
} |
} |
my $regexpans = join('|',@answertext); |
my $regexpans = join('|',@answertext); |
$regexpans = '/^('.$regexpans.')\b/'; |
$regexpans = '/^('.$regexpans.')\b/'; |
$output .= qq| |
$output .= qq| |
<stringresponse answer="$regexpans" type="re"> |
<stringresponse answer="$regexpans" type="re"> |
<textline> |
<textline> |
</textline> |
</textline> |
</stringresponse> |
</stringresponse> |
|; |
|; |
} |
} |
|
} |
} |
} |
} elsif ($$settings{$id}{class} eq "QUESTION_MATCH") { |
} elsif ($$settings{$id}{class} eq "QUESTION_MATCH") { |
$output .= qq| |
my @allmatchers = (); |
|
my %matchtext = (); |
|
if ($context eq 'CSTR') { |
|
$output .= qq| |
<matchresponse max="10" randomize="yes"> |
<matchresponse max="10" randomize="yes"> |
<foilgroup> |
<foilgroup> |
<itemgroup> |
<itemgroup> |
|; |
|; |
|
} else { |
|
$resourcedata{$symb.'newopt'} = ''; |
|
$resourcedata{$symb.'delopt'} = ''; |
|
$resourcedata{$symb.'hiddenparts'} = '!option'; |
|
$resourcedata{$symb.'questiontype'} = 'option'; |
|
$resourcedata{$symb.'maxfoils'} = @{$allanswers{$id}}; |
|
} |
for (my $k=0; $k<@{$allchoices{$id}}; $k++) { |
for (my $k=0; $k<@{$allchoices{$id}}; $k++) { |
$output .= qq| |
if ($context eq 'CSTR') { |
|
$output .= qq| |
<item name="$allchoices{$id}[$k]"> |
<item name="$allchoices{$id}[$k]"> |
<startouttext />$$settings{$id}{$allchoices{$id}[$k]}{text}<endouttext /> |
<startouttext />$$settings{$id}{$allchoices{$id}[$k]}{text}<endouttext /> |
</item> |
</item> |
|; |
|; |
|
} else { |
|
if (!grep/^$$settings{$id}{$allchoices{$id}[$k]}{text}$/,@allmatchers) { |
|
push @allmatchers, $$settings{$id}{$allchoices{$id}[$k]}{text}; |
|
$matchtext{$allchoices{$id}[$k]} = $$settings{$id}{$allchoices{$id}[$k]}{text}; |
|
} |
|
} |
} |
} |
$output .= qq| |
if ($context eq 'CSTR') { |
|
$output .= qq| |
</itemgroup> |
</itemgroup> |
|; |
|; |
|
} |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
for (my $k=0; $k<@{$allanswers{$id}}; $k++) { |
$output .= qq| |
if ($context eq 'CSTR') { |
|
$output .= qq| |
<foil location="random" value="$$settings{$id}{$allanswers{$id}[$k]}{choice_id}" name="$allanswers{$id}[$k]"> |
<foil location="random" value="$$settings{$id}{$allanswers{$id}[$k]}{choice_id}" name="$allanswers{$id}[$k]"> |
<startouttext />$$settings{$id}{$allanswers{$id}[$k]}{text}<endouttext /> |
<startouttext />$$settings{$id}{$allanswers{$id}[$k]}{text}<endouttext /> |
</foil> |
</foil> |
|; |
|; |
|
} else { |
|
my $iter = $k+1; |
|
$resourcedata{$symb.'value'.$iter} = $matchtext{$$settings{$id}{$allanswers{$id}[$k]}{choice_id}}; |
|
$resourcedata{$symb.'text'.$iter} = $$settings{$id}{$allanswers{$id}[$k]}{text}; |
|
} |
} |
} |
$output .= qq| |
if ($context eq 'CSTR') { |
|
$output .= qq| |
</foilgroup> |
</foilgroup> |
</matchresponse> |
</matchresponse> |
|; |
|; |
|
} else { |
|
$resourcedata{$symb.'options'} = "('".join("','",@allmatchers)."')"; |
|
} |
} |
} |
} |
} |
$output .= qq|</problem> |
if ($context eq 'CSTR') { |
|
$output .= qq|</problem> |
|; |
|; |
open(PROB,">$newdir/$id.problem"); |
open(PROB,">$newdir/$id.problem"); |
print PROB $output; |
print PROB $output; |
close PROB; |
close PROB; |
|
} else { |
|
# put %resourcedata; |
|
my $reply=&Apache::lonnet::cput |
|
('resourcedata',\%resourcedata,$cdom,$cnum); |
|
} |
} |
} |
} |
} |
|
|
# ---------------------------------------------------------------- Process Blackboard Announcements |
# ---------------------------------------------------------------- Process Blackboard Announcements |
sub process_announce { |
sub process_announce { |
my ($res,$docroot,$destdir,$settings,$items,$globalresref,$seqstem,$resrcfiles) = @_; |
my ($res,$docroot,$destdir,$settings,$globalresref,$seqstem,$resrcfiles) = @_; |
my $xmlfile = $docroot.'/'.$res.".dat"; |
my $xmlfile = $docroot.'/'.$res.".dat"; |
my @state = (); |
my @state = (); |
my @assess = (); |
my @assess = (); |
Line 1766 sub process_announce {
|
Line 2100 sub process_announce {
|
if ("@state" eq "ANNOUNCEMENT TITLE") { |
if ("@state" eq "ANNOUNCEMENT TITLE") { |
$$settings{title} = $attr->{value}; |
$$settings{title} = $attr->{value}; |
$$settings{startassessment} = (); |
$$settings{startassessment} = (); |
} elsif (@state eq "ANNOUNCEMENT DESCRIPTION FLAGS ISHTML") { |
} elsif ("@state" eq "ANNOUNCEMENT DESCRIPTION FLAGS ISHTML") { |
$$settings{ishtml} = $attr->{value}; |
$$settings{ishtml} = $attr->{value}; |
} elsif ("@state" eq "ANNOUNCEMENT DESCRIPTION FLAGS ISNEWLINELITERAL" ) { |
} elsif ("@state" eq "ANNOUNCEMENT DESCRIPTION FLAGS ISNEWLINELITERAL" ) { |
$$settings{isnewline} = $attr->{value}; |
$$settings{isnewline} = $attr->{value}; |
Line 1812 sub process_announce {
|
Line 2146 sub process_announce {
|
|
|
if (@assess > 0) { |
if (@assess > 0) { |
foreach my $id (@assess) { |
foreach my $id (@assess) { |
$$settings{text} = "A $$settings{startassessment}{$id}{assessment_type}, entitled $$globalresref{$$settings{startassessment}{$id}{assessment_id}}{title} is available. Click <a href='$seqstem/$$items{$$settings{startassessment}{$id}{assessment_id}}{revitm}.sequence'>here</a> to enter the folder the contains the problems in this assessment."; |
$$settings{text} = "A $$settings{startassessment}{$id}{assessment_type}, entitled $$globalresref{$$settings{startassessment}{$id}{assessment_id}}{title} is available. Click <a href='$seqstem/pages/$$settings{startassessment}{$id}{assessment_id}.page' target='quizpage'>here</a> to enter the page that contains the problems in this assessment."; |
} |
} |
} |
} |
|
|
Line 1825 sub process_announce {
|
Line 2159 sub process_announce {
|
<body bgcolor='#ffffff'> |
<body bgcolor='#ffffff'> |
<table> |
<table> |
<tr> |
<tr> |
<td bgcolor='#CCCCFF'>$$settings{title} - announcement date: $$settings{date}</td> |
<td bgcolor='#CCCCFF'>$$settings{title} - announcement date: $$settings{dates}</td> |
</tr> |
</tr> |
</table> |
</table> |
<br/> |
<br/> |
Line 1839 $$settings{text}
|
Line 2173 $$settings{text}
|
|
|
# ---------------------------------------------------------------- Process Blackboard Content |
# ---------------------------------------------------------------- Process Blackboard Content |
sub process_content { |
sub process_content { |
my ($res,$docroot,$destdir,$settings,$dom,$user,$resrcfiles) = @_; |
my ($cms,$res,$context,$docroot,$destdir,$settings,$dom,$user,$resrcfiles,$packages,$hrefs) = @_; |
my $xmlfile = $docroot.'/'.$res.".dat"; |
my $xmlfile = $docroot.'/'.$res.".dat"; |
my $destresdir = $destdir; |
my $destresdir = $destdir; |
$destresdir =~ s|/home/$user/public_html/|/res/$dom/$user/|; |
if ($context eq 'CSTR') { |
|
$destresdir =~ s|/home/$user/public_html/|/res/$dom/$user/|; |
|
} elsif ($context eq 'DOCS') { |
|
$destresdir =~ s|^/home/httpd/html/userfiles|/uploaded|; |
|
} |
|
my $filetag = ''; |
|
if ($cms eq 'bb5') { |
|
$filetag = 'FILEREF'; |
|
} elsif ($cms eq 'bb6') { |
|
$filetag = 'FILE'; |
|
} |
my $filecount = 0; |
my $filecount = 0; |
my @allrelfiles = (); |
my @allrelfiles = (); |
my @state; |
my @state; |
Line 1854 sub process_content {
|
Line 2198 sub process_content {
|
[sub { |
[sub { |
my ($tagname, $attr) = @_; |
my ($tagname, $attr) = @_; |
push @state, $tagname; |
push @state, $tagname; |
if (@state eq "CONTENT MAINDATA") { |
if ("@state" eq "CONTENT ") { |
%{$$settings{maindata}} = (); |
%{$$settings{maindata}} = (); |
} elsif (@state eq "CONTENT MAINDATA TEXTCOLOR") { |
} elsif ("@state" eq "CONTENT TITLECOLOR") { |
|
$$settings{titlecolor} = $attr->{value}; |
|
} elsif ("@state" eq "CONTENT MAINDATA TEXTCOLOR") { |
$$settings{maindata}{color} = $attr->{value}; |
$$settings{maindata}{color} = $attr->{value}; |
} elsif (@state eq "CONTENT MAINDATA FLAGS ISHTML") { |
} elsif ("@state" eq "CONTENT MAINDATA FLAGS ISHTML") { |
$$settings{maindata}{ishtml} = $attr->{value}; |
$$settings{maindata}{ishtml} = $attr->{value}; |
} elsif (@state eq "CONTENT MAINDATA FLAGS ISNEWLINELITERAL") { |
} elsif ("@state" eq "CONTENT MAINDATA FLAGS ISNEWLINELITERAL") { |
$$settings{maindata}{isnewline} = $attr->{value}; |
$$settings{maindata}{isnewline} = $attr->{value}; |
|
} elsif ("@state" eq "CONTENT BODY TYPE") { |
|
$$settings{maindata}{bodytype} = $attr->{value}; |
} elsif ("@state" eq "CONTENT FLAGS ISAVAILABLE" ) { |
} elsif ("@state" eq "CONTENT FLAGS ISAVAILABLE" ) { |
$$settings{isavailable} = $attr->{value}; |
$$settings{isavailable} = $attr->{value}; |
} elsif ("@state" eq "CONTENT FLAGS ISFOLDER" ) { |
} elsif ("@state" eq "CONTENT FLAGS ISFOLDER" ) { |
$$settings{isfolder} = $attr->{value}; |
$$settings{isfolder} = $attr->{value}; |
} elsif ("@state" eq "CONTENT FLAGS LAUNCHINNEWWINDOW" ) { |
} elsif ("@state" eq "CONTENT FLAGS LAUNCHINNEWWINDOW" ) { |
$$settings{newwindow} = $attr->{value}; |
$$settings{newwindow} = $attr->{value}; |
} elsif ("@state" eq "CONTENT FILES FILEREF") { |
} elsif ("@state" eq "CONTENT FILES $filetag") { |
%{$$settings{files}[$filecount]} = (); |
%{$$settings{files}[$filecount]} = (); |
%{$$settings{files}[$filecount]{registry}} = (); |
%{$$settings{files}[$filecount]{registry}} = (); |
} elsif ("@state" eq "CONTENT FILES FILEREF RELFILE" ) { |
} elsif ("@state" eq "CONTENT FILES FILEREF RELFILE" ) { |
$$settings{files}[$filecount]{'relfile'} = $attr->{value}; |
$$settings{files}[$filecount]{'relfile'} = $attr->{value}; |
push @allrelfiles, $attr->{value}; |
push @allrelfiles, $attr->{value}; |
} elsif ("@state" eq "CONTENT FILES FILEREF MIMETYPE") { |
} elsif ("@state" eq "CONTENT FILES $filetag MIMETYPE") { |
$$settings{files}[$filecount]{mimetype} = $attr->{value}; |
$$settings{files}[$filecount]{mimetype} = $attr->{value}; |
} elsif ("@state" eq "CONTENT FILES FILEREF CONTENTTYPE") { |
} elsif ("@state" eq "CONTENT FILES $filetag CONTENTTYPE") { |
$$settings{files}[$filecount]{contenttype} = $attr->{value}; |
$$settings{files}[$filecount]{contenttype} = $attr->{value}; |
} elsif ("@state" eq "CONTENT FILES FILEREF FILEACTION") { |
} elsif ("@state" eq "CONTENT FILES $filetag FILEACTION") { |
$$settings{files}[$filecount]{fileaction} = $attr->{value}; |
$$settings{files}[$filecount]{fileaction} = $attr->{value}; |
} elsif ("@state" eq "CONTENT FILES FILEREF PACKAGEPARENT") { |
} elsif ("@state" eq "CONTENT FILES $filetag PACKAGEPARENT") { |
$$settings{files}[$filecount]{packageparent} = $attr->{value}; |
$$settings{files}[$filecount]{packageparent} = $attr->{value}; |
} elsif ("@state" eq "CONTENT FILES FILEREF LINKNAME") { |
} elsif ("@state" eq "CONTENT FILES $filetag LINKNAME") { |
$$settings{files}[$filecount]{linkname} = $attr->{value}; |
$$settings{files}[$filecount]{linkname} = $attr->{value}; |
} elsif ("@state" eq "CONTENT FILES FILEREF REGISTRY REGISTRYENTRY") { |
} elsif ("@state" eq "CONTENT FILES $filetag REGISTRY REGISTRYENTRY") { |
my $key = $attr->{key}; |
my $key = $attr->{key}; |
$$settings{files}[$filecount]{registry}{$key} = $attr->{value}; |
$$settings{files}[$filecount]{registry}{$key} = $attr->{value}; |
} |
} |
Line 1894 sub process_content {
|
Line 2242 sub process_content {
|
my ($text) = @_; |
my ($text) = @_; |
if ("@state" eq "CONTENT TITLE") { |
if ("@state" eq "CONTENT TITLE") { |
$$settings{title} = $text; |
$$settings{title} = $text; |
} elsif ("@state" eq "CONTENT MAINDATA TEXT") { |
} elsif ( ("@state" eq "CONTENT MAINDATA TEXT") || ("@state" eq "CONTENT BODY TEXT") ) { |
$$settings{maindata}{text} = $text; |
$$settings{maindata}{text} = $text; |
} elsif ("@state" eq "CONTENT FILES FILEREF REFTEXT") { |
} elsif ("@state" eq "CONTENT FILES $filetag REFTEXT") { |
$$settings{files}[$filecount]{reftext} = $text; |
$$settings{files}[$filecount]{reftext} = $text; |
|
} elsif ("@state" eq "CONTENT FILES FILE NAME" ) { |
|
$$settings{files}[$filecount]{'relfile'} = $text; |
|
push @allrelfiles, $text; |
} |
} |
}, "dtext"], |
}, "dtext"], |
end_h => |
end_h => |
[sub { |
[sub { |
my ($tagname) = @_; |
my ($tagname) = @_; |
if ("@state" eq "CONTENT FILES FILEREF") { |
if ("@state" eq "CONTENT FILES $filetag") { |
$filecount ++; |
$filecount ++; |
} |
} |
pop @state; |
pop @state; |
Line 1949 sub process_content {
|
Line 2300 sub process_content {
|
} |
} |
} else { |
} else { |
my $filename=$$settings{files}[$filecount]{'relfile'}; |
my $filename=$$settings{files}[$filecount]{'relfile'}; |
# print "File is $filename\n"; |
|
my $newfilename="$destresdir/resfiles/$res/$$settings{files}[$filecount]{relfile}"; |
my $newfilename="$destresdir/resfiles/$res/$$settings{files}[$filecount]{relfile}"; |
# print "New filename is $newfilename\n"; |
$$settings{maindata}{text} =~ s#(src|SRC|value)=("|")$filename("|")#$1="$newfilename"#g; |
$$settings{maindata}{text} =~ s#(src|SRC|value)="$filename"#$1="$newfilename"#g; |
|
} |
} |
} elsif ($$settings{files}[$filecount]{fileaction} eq 'link') { |
} elsif ($$settings{files}[$filecount]{fileaction} eq 'link') { |
unless (($$settings{files}[$filecount]{packageparent} ne '') && (grep/^$$settings{files}[$filecount]{packageparent}$/,@{$$settings{files}}) ) { |
unless (($$settings{files}[$filecount]{packageparent} ne '') && (grep/^$$settings{files}[$filecount]{packageparent}$/,@{$$settings{files}}) ) { |
Line 1965 sub process_content {
|
Line 2314 sub process_content {
|
} |
} |
$linktag .= qq|>$$settings{files}[$filecount]{linkname}</a><br/>\n|; |
$linktag .= qq|>$$settings{files}[$filecount]{linkname}</a><br/>\n|; |
} |
} |
} elsif ($$settings{files}[$filecount]{fileaction} eq 'package') { |
} elsif ( ($$settings{files}[$filecount]{fileaction} eq 'PACKAGE') || ($$settings{files}[$filecount]{fileaction} eq 'package') ) { |
# print "Found a package\n"; |
my $open_package = ''; |
|
if ($$settings{files}[$filecount]{'relfile'} =~ m|\.zip$|i) { |
|
$open_package = &expand_zip("$docroot/$res",$$settings{files}[$filecount]{'relfile'}); |
|
} |
|
if ($open_package eq 'ok') { |
|
opendir(DIR,"$docroot/$res"); |
|
my @dircontents = grep(!/^\./,readdir(DIR)); |
|
closedir(DIR); |
|
push @{$resrcfiles}, @dircontents; |
|
@{$$hrefs{$res}} = @dircontents; |
|
push @{$packages}, $res; |
|
} |
|
} elsif ( ($$settings{files}[$filecount]{fileaction} eq 'BROKEN_IMAGE') && ($cms eq 'bb6') ) { |
|
my $filename=$$settings{files}[$filecount]{'relfile'}; |
|
my $newfilename="$destresdir/resfiles/$res/$$settings{files}[$filecount]{relfile}"; |
|
$$settings{maindata}{text} =~ s#(src|SRC|value)=("|")$filename("|")#$1="$newfilename"#g; |
|
} elsif ( ($$settings{files}[$filecount]{fileaction} eq 'LINK') && ($cms eq 'bb6') ) { |
|
my $filename=$$settings{files}[$filecount]{'relfile'}; |
|
my $newfilename="$destresdir/resfiles/$res/$$settings{files}[$filecount]{relfile}"; |
|
my $filetitle = $$settings{files}[$filecount]{'linkname'}; |
|
$$settings{maindata}{text} = '<a href="'.$newfilename.'">'.$filetitle.'</a><br /><br />'. $$settings{maindata}{text}; |
} |
} |
} |
} |
} |
} |
Line 1974 sub process_content {
|
Line 2343 sub process_content {
|
$fontcol = qq|<font color="$$settings{maindata}{textcolor}">|; |
$fontcol = qq|<font color="$$settings{maindata}{textcolor}">|; |
} |
} |
if (defined($$settings{maindata}{text})) { |
if (defined($$settings{maindata}{text})) { |
|
if ($$settings{maindata}{bodytype} eq "S") { |
|
$$settings{maindata}{text} =~ s#\n#<br/>#g; |
|
} |
if ($$settings{maindata}{ishtml} eq "false") { |
if ($$settings{maindata}{ishtml} eq "false") { |
if ($$settings{maindata}{isnewline} eq "true") { |
if ($$settings{maindata}{isnewline} eq "true") { |
$$settings{maindata}{text} =~ s#\n#<br/>#g; |
$$settings{maindata}{text} =~ s#\n#<br/>#g; |
} |
} |
} else { |
} else { |
$$settings{maindata}{text} = &HTML::Entities::decode($$settings{maindata}{text}); |
# $$settings{maindata}{text} = &HTML::Entities::decode($$settings{maindata}{text}); |
} |
} |
} |
} |
|
|
open(FILE,">$destdir/resfiles/$res.html"); |
open(FILE,">$destdir/resfiles/$res.html"); |
push @{$resrcfiles}, "$res.html"; |
push @{$resrcfiles}, "$res.html"; |
print FILE qq|<html> |
my $htmldoc = 0; |
|
# if ($$settings{maindata}{text} =~ m-<(html|HTML)>.+<\\(html|HTML)-) { |
|
if ($$settings{maindata}{text} =~ m-<(html|HTML)>-) { |
|
$htmldoc = 1; |
|
} |
|
unless ($htmldoc) { |
|
print FILE qq|<html> |
<head> |
<head> |
<title>$$settings{title}</title> |
<title>$$settings{title}</title> |
</head> |
</head> |
<body bgcolor='#ffffff'> |
<body bgcolor='#ffffff'> |
$fontcol |
$fontcol |
|; |
|; |
|
} |
unless ($$settings{title} eq '') { |
unless ($$settings{title} eq '') { |
print FILE qq|$$settings{title}<br/><br/>\n|; |
print FILE qq|$$settings{title}<br/><br/>\n|; |
} |
} |
print FILE qq| |
print FILE qq| |
$$settings{maindata}{text} |
$$settings{maindata}{text} |
$linktag|; |
$linktag|; |
if (defined($$settings{maindata}{textcolor})) { |
unless ($htmldoc) { |
print FILE qq|</font>|; |
if (defined($$settings{maindata}{textcolor})) { |
} |
print FILE qq|</font>|; |
print FILE qq| |
} |
|
print FILE qq| |
</body> |
</body> |
</html>|; |
</html>|; |
|
} |
close(FILE); |
close(FILE); |
} |
} |
|
|
Line 2049 sub process_angelboards {
|
Line 2430 sub process_angelboards {
|
my $msgcount = 0; |
my $msgcount = 0; |
|
|
my $putresult = &Apache::lonnet::put($boardname,\%boardinfo,$cdom,$crs); |
my $putresult = &Apache::lonnet::put($boardname,\%boardinfo,$cdom,$crs); |
# print STDERR "putresult is $putresult for $boardname $cdom $crs\n"; |
|
if ($db_handling eq 'importall') { |
if ($db_handling eq 'importall') { |
foreach my $msg_id (@{$$messages{$$boards[$i]}}) { |
foreach my $msg_id (@{$$messages{$$boards[$i]}}) { |
$msgcount ++; |
$msgcount ++; |