version 1.484.2.93.2.11, 2023/03/12 02:22:09
|
version 1.484.2.93.2.12, 2023/07/06 02:04:21
|
Line 50 use GDBM_File;
|
Line 50 use GDBM_File;
|
use File::MMagic; |
use File::MMagic; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Cwd; |
use Cwd; |
|
use UUID::Tiny ':std'; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
my $iconpath; |
my $iconpath; |
Line 714 sub group_import {
|
Line 715 sub group_import {
|
$url = $1; |
$url = $1; |
my $marker = $2; |
my $marker = $2; |
my $info = $3; |
my $info = $3; |
my ($toolid,%toolhash,%toolsettings); |
my ($toolid,$toolprefix,$tooltype,%toolhash,%toolsettings); |
my @extras = ('linktext','explanation','crslabel','crstitle','crsappend'); |
my @extras = ('linktext','explanation','crslabel','crstitle','crsappend'); |
my @toolinfo = split(/:/,$info); |
my @toolinfo = split(/:/,$info); |
if ($residx) { |
if ($residx) { |
Line 723 sub group_import {
|
Line 724 sub group_import {
|
} else { |
} else { |
$toolid = shift(@toolinfo); |
$toolid = shift(@toolinfo); |
} |
} |
|
if ($toolid =~ /^c/) { |
|
$tooltype = 'crs'; |
|
$toolprefix = 'c'; |
|
} else { |
|
$tooltype = 'dom'; |
|
} |
$toolid =~ s/\D//g; |
$toolid =~ s/\D//g; |
($toolhash{'target'},$toolhash{'width'},$toolhash{'height'}, |
($toolhash{'target'},$toolhash{'width'},$toolhash{'height'}, |
$toolhash{'linktext'},$toolhash{'explanation'}, |
$toolhash{'linktext'},$toolhash{'explanation'},$toolhash{'crslabel'}, |
$toolhash{'crslabel'},$toolhash{'crstitle'},$toolhash{'crsappend'}) = @toolinfo; |
$toolhash{'crstitle'},$toolhash{'crsappend'},$toolhash{'gradable'}) = @toolinfo; |
foreach my $item (@extras) { |
foreach my $item (@extras) { |
$toolhash{$item} = &unescape($toolhash{$item}); |
$toolhash{$item} = &unescape($toolhash{$item}); |
} |
} |
|
if ($folder =~ /^supplemental/) { |
|
delete($toolhash{'gradable'}); |
|
} else { |
|
$toolhash{'gradable'} =~ s/\D+//g; |
|
} |
if (ref($ltitoolsref) eq 'HASH') { |
if (ref($ltitoolsref) eq 'HASH') { |
my @deleted; |
if (ref($ltitoolsref->{$tooltype}) eq 'HASH') { |
if (ref($ltitoolsref->{$toolid}) eq 'HASH') { |
if (ref($ltitoolsref->{$tooltype}->{$toolid}) eq 'HASH') { |
$toolhash{'id'} = $toolid; |
my %tools = %{$ltitoolsref->{$tooltype}->{$toolid}}; |
if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'tab') || |
my @deleted; |
($toolhash{'target'} eq 'window')) { |
$toolhash{'id'} = $toolprefix.$toolid; |
if ($toolhash{'target'} eq 'window') { |
if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'tab') || |
foreach my $item ('width','height') { |
($toolhash{'target'} eq 'window')) { |
$toolhash{$item} =~ s/^\s+//; |
if ($toolhash{'target'} eq 'window') { |
$toolhash{$item} =~ s/\s+$//; |
foreach my $item ('width','height') { |
if ($toolhash{$item} =~ /\D/) { |
$toolhash{$item} =~ s/^\s+//; |
delete($toolhash{$item}); |
$toolhash{$item} =~ s/\s+$//; |
if ($residx) { |
if ($toolhash{$item} =~ /\D/) { |
if ($toolsettings{$item}) { |
delete($toolhash{$item}); |
push(@deleted,$item); |
if ($residx) { |
|
if ($toolsettings{$item}) { |
|
push(@deleted,$item); |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} elsif ($residx) { |
} elsif ($residx) { |
$toolhash{'target'} = $toolsettings{'target'}; |
$toolhash{'target'} = $toolsettings{'target'}; |
if ($toolhash{'target'} eq 'window') { |
if ($toolhash{'target'} eq 'window') { |
foreach my $item ('width','height') { |
foreach my $item ('width','height') { |
$toolhash{$item} = $toolsettings{$item}; |
$toolhash{$item} = $toolsettings{$item}; |
} |
|
} |
|
} elsif (ref($tools{'display'}) eq 'HASH') { |
|
$toolhash{'target'} = $tools{'display'}{'target'}; |
|
if ($toolhash{'target'} eq 'window') { |
|
$toolhash{'width'} = $tools{'display'}{'width'}; |
|
$toolhash{'height'} = $tools{'display'}{'height'}; |
} |
} |
} |
} |
} elsif (ref($ltitoolsref->{$toolid}->{'display'}) eq 'HASH') { |
if ($toolhash{'target'} eq 'iframe') { |
$toolhash{'target'} = $ltitoolsref->{$toolid}->{'display'}->{'target'}; |
foreach my $item ('width','height','linktext','explanation') { |
if ($toolhash{'target'} eq 'window') { |
delete($toolhash{$item}); |
$toolhash{'width'} = $ltitoolsref->{$toolid}->{'display'}->{'width'}; |
if ($residx) { |
$toolhash{'height'} = $ltitoolsref->{$toolid}->{'display'}->{'height'}; |
if ($toolsettings{$item}) { |
} |
push(@deleted,$item); |
} |
} |
if ($toolhash{'target'} eq 'iframe') { |
|
foreach my $item ('width','height','linktext','explanation') { |
|
delete($toolhash{$item}); |
|
if ($residx) { |
|
if ($toolsettings{$item}) { |
|
push(@deleted,$item); |
|
} |
} |
} |
} |
} |
} elsif ($toolhash{'target'} eq 'tab') { |
} elsif ($toolhash{'target'} eq 'tab') { |
foreach my $item ('width','height') { |
foreach my $item ('width','height') { |
delete($toolhash{$item}); |
delete($toolhash{$item}); |
if ($residx) { |
if ($residx) { |
if ($toolsettings{$item}) { |
if ($toolsettings{$item}) { |
push(@deleted,$item); |
push(@deleted,$item); |
} |
} |
} |
} |
} |
} |
} |
} |
if (ref($tools{'crsconf'}) eq 'HASH') { |
if (ref($ltitoolsref->{$toolid}->{'crsconf'}) eq 'HASH') { |
foreach my $item ('label','title','linktext','explanation') { |
foreach my $item ('label','title','linktext','explanation') { |
my $crsitem; |
my $crsitem; |
if (($item eq 'label') || ($item eq 'title')) { |
if (($item eq 'label') || ($item eq 'title')) { |
$crsitem = 'crs'.$item; |
$crsitem = 'crs'.$item; |
} else { |
} else { |
$crsitem = $item; |
$crsitem = $item; |
} |
} |
if ($tools{'crsconf'}{$item}) { |
if ($ltitoolsref->{$toolid}->{'crsconf'}->{$item}) { |
$toolhash{$crsitem} =~ s/^\s+//; |
$toolhash{$crsitem} =~ s/^\s+//; |
$toolhash{$crsitem} =~ s/\s+$//; |
$toolhash{$crsitem} =~ s/\s+$//; |
if ($toolhash{$crsitem} eq '') { |
if ($toolhash{$crsitem} eq '') { |
delete($toolhash{$crsitem}); |
|
} |
|
} else { |
delete($toolhash{$crsitem}); |
delete($toolhash{$crsitem}); |
} |
} |
} else { |
if (($residx) && (exists($toolsettings{$crsitem}))) { |
delete($toolhash{$crsitem}); |
unless (exists($toolhash{$crsitem})) { |
|
push(@deleted,$crsitem); |
|
} |
|
} |
} |
} |
if (($residx) && (exists($toolsettings{$crsitem}))) { |
} |
unless (exists($toolhash{$crsitem})) { |
if ($toolhash{'passback'}) { |
push(@deleted,$crsitem); |
my $gradesecret = UUID::Tiny::create_uuid_as_string(UUID_V4); |
|
$toolhash{'gradesecret'} = $gradesecret; |
|
$toolhash{'gradesecretdate'} = time; |
|
} |
|
if ($toolhash{'roster'}) { |
|
my $rostersecret = UUID::Tiny::create_uuid_as_string(UUID_V4); |
|
$toolhash{'rostersecret'} = $rostersecret; |
|
$toolhash{'rostersecretdate'} = time; |
|
} |
|
my $changegradable; |
|
if (($residx) && ($folder =~ /^default/)) { |
|
if ($toolsettings{'gradable'}) { |
|
unless (($toolhash{'gradable'}) || (defined($LONCAPA::map::zombies[$residx]))) { |
|
push(@deleted,'gradable'); |
|
$changegradable = 1; |
|
} |
|
} elsif ($toolhash{'gradable'}) { |
|
$changegradable = 1; |
|
} |
|
if (($caller eq 'londocs') && (defined($LONCAPA::map::zombies[$residx]))) { |
|
$changegradable = 1; |
|
if ($toolsettings{'gradable'}) { |
|
$toolhash{'gradable'} = 1; |
} |
} |
} |
} |
} |
} |
} |
my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum); |
my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum); |
if ($putres eq 'ok') { |
if ($putres eq 'ok') { |
if (@deleted) { |
if (@deleted) { |
&Apache::lonnet::del('exttool_'.$marker,\@deleted,$coursedom,$coursenum); |
&Apache::lonnet::del('exttool_'.$marker,\@deleted,$coursedom,$coursenum); |
} |
|
if (($changegradable) && ($folder =~ /^default/)) { |
|
my $val; |
|
if ($toolhash{'gradable'}) { |
|
$val = 'yes'; |
|
} else { |
|
$val = 'no'; |
|
} |
|
&LONCAPA::map::storeparameter($residx,'parameter_0_gradable',$val, |
|
'string_yesno'); |
|
&remember_parms($residx,'gradable','set',$val); |
|
} |
|
} else { |
|
return (&mt('Failed to save update to external tool.'),1); |
} |
} |
} else { |
|
return (&mt('Failed to save update to external tool.'),1); |
|
} |
} |
} |
} |
} |
} |
Line 1002 sub docs_change_log {
|
Line 1055 sub docs_change_log {
|
'// <![CDATA['."\n". |
'// <![CDATA['."\n". |
&Apache::loncommon::display_filter_js('docslog')."\n". |
&Apache::loncommon::display_filter_js('docslog')."\n". |
&editing_js($env{'user.domain'},$env{'user.name'},$supplementalflag, |
&editing_js($env{'user.domain'},$env{'user.name'},$supplementalflag, |
$coursedom,$coursenum,'',$canedit,'',\$navmap)."\n". |
$coursedom,$coursenum,'','',$canedit,'',\$navmap)."\n". |
&history_tab_js()."\n". |
&history_tab_js()."\n". |
&Apache::lonratedt::editscript('simple')."\n". |
&Apache::lonratedt::editscript('simple')."\n". |
'// ]]>'."\n". |
'// ]]>'."\n". |
Line 1052 sub docs_change_log {
|
Line 1105 sub docs_change_log {
|
'encrypturl' => 'URL hidden', |
'encrypturl' => 'URL hidden', |
'randompick' => 'Randomly pick', |
'randompick' => 'Randomly pick', |
'randomorder' => 'Randomly ordered', |
'randomorder' => 'Randomly ordered', |
|
'gradable' => 'Grade can be assigned to External Tool', |
'set' => 'set to', |
'set' => 'set to', |
'del' => 'deleted'); |
'del' => 'deleted'); |
my $filter = &Apache::loncommon::display_filter('docslog')."\n". |
my $filter = &Apache::loncommon::display_filter('docslog')."\n". |
Line 1165 sub docs_change_log {
|
Line 1219 sub docs_change_log {
|
$title = &Apache::loncommon::parse_supplemental_title($title); |
$title = &Apache::loncommon::parse_supplemental_title($title); |
} |
} |
$r->print(&LONCAPA::map::qtescape($title).':<ul>'); |
$r->print(&LONCAPA::map::qtescape($title).':<ul>'); |
foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder') { |
foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder','gradable') { |
if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) { |
if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) { |
# FIXME: internationalization seems wrong here |
# FIXME: internationalization seems wrong here |
$r->print('<li>'. |
$r->print('<li>'. |
Line 1748 sub do_paste_from_buffer {
|
Line 1802 sub do_paste_from_buffer {
|
} |
} |
$srcdom{$suffix} = $srcd; |
$srcdom{$suffix} = $srcd; |
$srcnum{$suffix} = $srcn; |
$srcnum{$suffix} = $srcn; |
} elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$}) { |
} elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) || |
|
($url =~ m{^/adm/$match_domain/$match_username/\d+/(bulletinboard|smppg)$}) || |
|
($url =~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$})) { |
my ($srcd,$srcn) = split(/_/,$cid); |
my ($srcd,$srcn) = split(/_/,$cid); |
# When paste buffer was populated using an active role in a different course |
# When paste buffer was populated using an active role in a different course |
# check for mdc privilege in the course from which the resource was pasted |
# check for mdc privilege in the course from which the resource was pasted |
Line 1760 sub do_paste_from_buffer {
|
Line 1816 sub do_paste_from_buffer {
|
} |
} |
# When buffer was populated using an active role in a different course |
# When buffer was populated using an active role in a different course |
# disallow pasting of External Tool if course is in a different domain. |
# disallow pasting of External Tool if course is in a different domain. |
if ($srcd ne $coursedom) { |
if (($url =~ m{/ext\.tool$}) && ($srcd ne $coursedom)) { |
$notindom{$suffix} = 1; |
$notindom{$suffix} = 1; |
next; |
next; |
} |
} |
$srcdom{$suffix} = $srcd; |
$srcdom{$suffix} = $srcd; |
$srcnum{$suffix} = $srcn; |
$srcnum{$suffix} = $srcn; |
} elsif (($url =~ m{^/res/lib/templates/\w+\.problem$}) || |
|
($url =~ m{^/adm/$match_domain/$match_username/\d+/(bulletinboard|smppg)$})) { |
|
my ($srcd,$srcn) = split(/_/,$cid); |
|
# When paste buffer was populated using an active role in a different course |
|
# check for mdc privilege in the course from which the resource was pasted |
|
if (($srcd ne $coursedom) || ($srcn ne $coursenum)) { |
|
unless ($env{"user.priv.cm./$srcd/$srcn"} =~ /\Q:mdc&F\E/) { |
|
$notincrs{$suffix} = 1; |
|
next; |
|
} |
|
} |
|
$srcdom{$suffix} = $srcd; |
|
$srcnum{$suffix} = $srcn; |
|
} |
} |
$srcmapidx{$suffix} = $mapidx; |
$srcmapidx{$suffix} = $mapidx; |
push(@dopaste,$suffix); |
push(@dopaste,$suffix); |
if ($url=~/\.(page|sequence)$/) { |
if ($url=~/\.(page|sequence)$/) { |
$is_map{$suffix} = 1; |
$is_map{$suffix} = 1; |
} |
} |
|
|
if ($url =~ m{^/uploaded/$match_domain/$match_courseid/([^/]+)}) { |
if ($url =~ m{^/uploaded/$match_domain/$match_courseid/([^/]+)}) { |
my $oldprefix = $1; |
my $oldprefix = $1; |
# When pasting content from Main Content to Supplemental Content and vice versa |
# When pasting content from Main Content to Supplemental Content and vice versa |
Line 1830 sub do_paste_from_buffer {
|
Line 1872 sub do_paste_from_buffer {
|
%msgs = &Apache::lonlocal::texthash ( |
%msgs = &Apache::lonlocal::texthash ( |
notinsupp => 'Paste failed: content type is not supported within Supplemental Content', |
notinsupp => 'Paste failed: content type is not supported within Supplemental Content', |
notincrs => 'Paste failed: Item is from a different course which you do not have rights to edit.', |
notincrs => 'Paste failed: Item is from a different course which you do not have rights to edit.', |
notindom => 'Paste failed: Item is an external tool from a course in a different donain.', |
notindom => 'Paste failed: Item is an external tool from a course in a different domain.', |
duplicate => 'Paste failed: only one instance of a particular published sequence or page is allowed within each course.', |
duplicate => 'Paste failed: only one instance of a particular published sequence or page is allowed within each course.', |
); |
); |
|
|
Line 1948 sub do_paste_from_buffer {
|
Line 1990 sub do_paste_from_buffer {
|
cdom => $coursedom, |
cdom => $coursedom, |
cnum => $coursenum, |
cnum => $coursenum, |
); |
); |
|
if ($prefix eq 'ext.tool') { |
|
if ($prefixchg{$suffix} eq 'docstosupp') { |
|
$info{'delgradable'} = 1; |
|
} |
|
} |
if (($srcdom{$suffix} =~ /^$match_domain$/) && ($srcnum{$suffix} =~ /^$match_courseid$/)) { |
if (($srcdom{$suffix} =~ /^$match_domain$/) && ($srcnum{$suffix} =~ /^$match_courseid$/)) { |
unless (($srcdom{$suffix} eq $coursedom) && ($srcnum{$suffix} eq $coursenum)) { |
unless (($srcdom{$suffix} eq $coursedom) && ($srcnum{$suffix} eq $coursenum)) { |
$fromothercrs = 1; |
$fromothercrs = 1; |
Line 2039 sub do_paste_from_buffer {
|
Line 2086 sub do_paste_from_buffer {
|
©_templated_files($url,$srcdom{$suffix},$srcnum{$suffix},$srcmapidx{$suffix}, |
©_templated_files($url,$srcdom{$suffix},$srcnum{$suffix},$srcmapidx{$suffix}, |
$coursedom,$coursenum,$template,$newidx,"$folder.$container"); |
$coursedom,$coursenum,$template,$newidx,"$folder.$container"); |
} |
} |
|
} elsif ($url =~ /ext\.tool$/) { |
|
if (($newidx) && ($folder=~/^default/)) { |
|
my $marker = (split(m{/},$url))[4]; |
|
my %toolsettings = &Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum); |
|
my $val = 'no'; |
|
if ($toolsettings{'gradable'}) { |
|
$val = 'yes'; |
|
} |
|
&LONCAPA::map::storeparameter($newidx,'parameter_0_gradable',$val, |
|
'string_yesno'); |
|
&remember_parms($newidx,'gradable','set',$val); |
|
} |
} |
} |
$LONCAPA::map::resources[$newidx]=$title.':'.&LONCAPA::map::qtunescape($url). |
$LONCAPA::map::resources[$newidx]=$title.':'.&LONCAPA::map::qtunescape($url). |
':'.$ext.':normal:res'; |
':'.$ext.':normal:res'; |
Line 2287 sub dbcopy {
|
Line 2346 sub dbcopy {
|
} |
} |
} |
} |
$db_name =~ s{_\d*$ }{_$suffix}x; |
$db_name =~ s{_\d*$ }{_$suffix}x; |
|
if (($prefix eq 'exttool') && ($dbref->{'delgradable'}) && ($contents{'gradable'})) { |
|
delete($contents{'gradable'}); |
|
} |
$result=&Apache::lonnet::put($db_name,\%contents, |
$result=&Apache::lonnet::put($db_name,\%contents, |
$coursedom,$coursenum); |
$coursedom,$coursenum); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
Line 2445 sub contained_map_check {
|
Line 2507 sub contained_map_check {
|
if ($token->[1] eq 'resource') { |
if ($token->[1] eq 'resource') { |
next if ($token->[2]->{'type'} eq 'zombie'); |
next if ($token->[2]->{'type'} eq 'zombie'); |
my $ressrc = $token->[2]->{'src'}; |
my $ressrc = $token->[2]->{'src'}; |
if ($folder =~ /^supplemental/) { |
if ($ressrc =~ m{^/adm/($match_domain)/$match_courseid/\d+/ext\.tool$}) { |
|
my $srcdom = $1; |
|
unless ($srcdom eq $coursedom) { |
|
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
|
next; |
|
} |
|
} elsif ($folder =~ /^supplemental/) { |
unless (&supp_pasteable($ressrc)) { |
unless (&supp_pasteable($ressrc)) { |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
next; |
next; |
Line 2568 sub url_paste_fixups {
|
Line 2636 sub url_paste_fixups {
|
$changed = 1; |
$changed = 1; |
} |
} |
} |
} |
} elsif ($ressrc =~ m{^/adm/($match_domain)/($match_courseid)/.+$}) { |
} elsif ($ressrc =~ m{^/adm/($match_domain)/($match_courseid)/(.+)$}) { |
next if ($skip); |
next if ($skip); |
my $srcdom = $1; |
my $srcdom = $1; |
my $srcnum = $2; |
my $srcnum = $2; |
|
my $rem = $3; |
|
my ($is_exttool,$exttoolchg); |
|
if ($rem =~ m{\d+/ext\.tool$}) { |
|
$is_exttool = 1; |
|
} |
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) { |
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) { |
$rewrites->{$oldurl}{$id} = $ressrc; |
$rewrites->{$oldurl}{$id} = $ressrc; |
$dbcopies->{$oldurl}{$id}{'src'} = $ressrc; |
$dbcopies->{$oldurl}{$id}{'src'} = $ressrc; |
$dbcopies->{$oldurl}{$id}{'cdom'} = $srcdom; |
$dbcopies->{$oldurl}{$id}{'cdom'} = $srcdom; |
$dbcopies->{$oldurl}{$id}{'cnum'} = $srcnum; |
$dbcopies->{$oldurl}{$id}{'cnum'} = $srcnum; |
$changed = 1; |
$changed = 1; |
|
if ($is_exttool) { |
|
$exttoolchg = 1; |
|
} |
|
} elsif (($is_exttool) && |
|
($env{'form.docs.markedcopy_options'} ne 'move')) { |
|
$dbcopies->{$oldurl}{$id}{'src'} = $ressrc; |
|
$dbcopies->{$oldurl}{$id}{'cdom'} = $srcdom; |
|
$dbcopies->{$oldurl}{$id}{'cnum'} = $srcnum; |
|
$changed = 1; |
|
$exttoolchg = 1; |
|
} |
|
if (($is_exttool) && ($prefixchg)) { |
|
if ($oldurl =~ m{^/uploaded/$match_domain/$match_courseid/default}) { |
|
if ($exttoolchg) { |
|
$dbcopies->{$oldurl}{$id}{'delgradable'} = 1; |
|
} |
|
} |
} |
} |
} elsif ($ressrc =~ m{^/adm/$match_domain/$match_username/\d+/(smppg|bulletinboard)$}) { |
} elsif ($ressrc =~ m{^/adm/$match_domain/$match_username/\d+/(smppg|bulletinboard)$}) { |
if (($fromcdom ne $cdom) || ($fromcnum ne $cnum) || |
if (($fromcdom ne $cdom) || ($fromcnum ne $cnum) || |
Line 3116 sub update_parameter {
|
Line 3206 sub update_parameter {
|
|
|
sub handle_edit_cmd { |
sub handle_edit_cmd { |
my ($coursenum,$coursedom) =@_; |
my ($coursenum,$coursedom) =@_; |
|
my $haschanges = 0; |
if ($env{'form.cmd'} eq '') { |
if ($env{'form.cmd'} eq '') { |
return 0; |
return $haschanges; |
} |
} |
my ($cmd,$idx)=split('_',$env{'form.cmd'}); |
my ($cmd,$idx)=split('_',$env{'form.cmd'}); |
|
|
Line 3132 sub handle_edit_cmd {
|
Line 3223 sub handle_edit_cmd {
|
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
} |
} |
splice(@LONCAPA::map::order, $idx, 1); |
splice(@LONCAPA::map::order, $idx, 1); |
|
$haschanges = 1; |
} elsif ($cmd eq 'cut') { |
} elsif ($cmd eq 'cut') { |
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
splice(@LONCAPA::map::order, $idx, 1); |
splice(@LONCAPA::map::order, $idx, 1); |
|
$haschanges = 1; |
} elsif ($cmd eq 'up' |
} elsif ($cmd eq 'up' |
&& ($idx) && (defined($LONCAPA::map::order[$idx-1]))) { |
&& ($idx) && (defined($LONCAPA::map::order[$idx-1]))) { |
@LONCAPA::map::order[$idx-1,$idx] = @LONCAPA::map::order[$idx,$idx-1]; |
@LONCAPA::map::order[$idx-1,$idx] = @LONCAPA::map::order[$idx,$idx-1]; |
|
$haschanges = 1; |
} elsif ($cmd eq 'down' |
} elsif ($cmd eq 'down' |
&& defined($LONCAPA::map::order[$idx+1])) { |
&& defined($LONCAPA::map::order[$idx+1])) { |
@LONCAPA::map::order[$idx+1,$idx] = @LONCAPA::map::order[$idx,$idx+1]; |
@LONCAPA::map::order[$idx+1,$idx] = @LONCAPA::map::order[$idx,$idx+1]; |
|
$haschanges = 1; |
} elsif ($cmd eq 'rename') { |
} elsif ($cmd eq 'rename') { |
my $comment = &LONCAPA::map::qtunescape($env{'form.title'}); |
my $comment = &LONCAPA::map::qtunescape($env{'form.title'}); |
if ($comment=~/\S/) { |
if ($comment=~/\S/) { |
Line 3154 sub handle_edit_cmd {
|
Line 3245 sub handle_edit_cmd {
|
# Devalidate title cache |
# Devalidate title cache |
my $renamed_url=&LONCAPA::map::qtescape($url); |
my $renamed_url=&LONCAPA::map::qtescape($url); |
&Apache::lonnet::devalidate_title_cache($renamed_url); |
&Apache::lonnet::devalidate_title_cache($renamed_url); |
|
$haschanges = 1; |
} else { |
|
return 0; |
|
} |
} |
return 1; |
return $haschanges; |
} |
} |
|
|
sub editor { |
sub editor { |
Line 3647 sub multiple_check_form {
|
Line 3736 sub multiple_check_form {
|
return unless (ref($listsref) eq 'HASH'); |
return unless (ref($listsref) eq 'HASH'); |
my $disabled; |
my $disabled; |
unless ($canedit) { |
unless ($canedit) { |
$disabled = 'disabled="disabled"'; |
$disabled = ' disabled="disabled"'; |
} |
} |
my $output = |
my $output = |
'<form action="/adm/coursedocs" method="post" name="togglemult'.$caller.'">'. |
'<form action="/adm/coursedocs" method="post" name="togglemult'.$caller.'">'. |
Line 5291 sub changewarning {
|
Line 5380 sub changewarning {
|
if (!defined($message)) { |
if (!defined($message)) { |
$message='Changes will become active for your current session after [_1], or the next time you log in.'; |
$message='Changes will become active for your current session after [_1], or the next time you log in.'; |
} |
} |
|
my $windowname = 'loncapaclient'; |
|
if ($env{'request.lti.login'}) { |
|
$windowname .= 'lti'; |
|
} |
$r->print("\n\n". |
$r->print("\n\n". |
'<script type="text/javascript">'."\n". |
'<script type="text/javascript">'."\n". |
'// <![CDATA['."\n". |
'// <![CDATA['."\n". |
'function reinit(tf) { tf.submit();'.$postexec.' }'."\n". |
'function reinit(tf) { tf.submit();'.$postexec.' }'."\n". |
'// ]]>'."\n". |
'// ]]>'."\n". |
'</script>'."\n". |
'</script>'."\n". |
'<form name="reinitform" method="post" action="/adm/roles" target="loncapaclient">'. |
'<form name="reinitform" method="post" action="/adm/roles" target="'.$windowname.'">'. |
'<input type="hidden" name="orgurl" value="'.$url. |
'<input type="hidden" name="orgurl" value="'.$url. |
'" /><input type="hidden" name="selectrole" value="1" /><p class="LC_warning">'. |
'" /><input type="hidden" name="selectrole" value="1" /><p class="LC_warning">'. |
&mt($message,' <input type="hidden" name="'. |
&mt($message,' <input type="hidden" name="'. |
Line 5545 sub handler {
|
Line 5638 sub handler {
|
my $containertag; |
my $containertag; |
my $pathitem; |
my $pathitem; |
my %ltitools; |
my %ltitools; |
|
my $posslti; |
my $hiddentop; |
my $hiddentop; |
my $navmap; |
my $navmap; |
my $filterFunc = sub { my $res = shift; return (!$res->randomout() && !$res->is_map()) }; |
my $filterFunc = sub { my $res = shift; return (!$res->randomout() && !$res->is_map()) }; |
Line 5778 sub handler {
|
Line 5872 sub handler {
|
} |
} |
} |
} |
my $tabidstr = join("','",@tabids); |
my $tabidstr = join("','",@tabids); |
%ltitools = &Apache::lonnet::get_domain_lti($coursedom,'consumer'); |
my (%domtools,%crstools); |
my $posslti = keys(%ltitools); |
my %tooltypes = &Apache::loncommon::usable_exttools(); |
|
if ($tooltypes{'dom'}) { |
|
%domtools = &Apache::lonnet::get_domain_lti($coursedom,'consumer'); |
|
} |
|
if ($tooltypes{'crs'}) { |
|
%crstools = &Apache::lonnet::get_course_lti($coursenum,$coursedom,'consumer'); |
|
} |
|
%ltitools = ( |
|
dom => \%domtools, |
|
crs => \%crstools, |
|
); |
|
$posslti = scalar(keys(%domtools)) + scalar(keys(%crstools)); |
my $hostname = $r->hostname(); |
my $hostname = $r->hostname(); |
$script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti, |
$script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti, |
$canedit,$hostname,\$navmap). |
$canedit,$hostname,\$navmap). |
Line 6181 HIDDENFORM
|
Line 6286 HIDDENFORM
|
} |
} |
my $postexec=''; |
my $postexec=''; |
if ($folder eq 'default') { |
if ($folder eq 'default') { |
|
my $windowname = 'loncapaclient'; |
|
if ($env{'request.lti.login'}) { |
|
$windowname .= 'lti'; |
|
} |
$r->print('<script type="text/javascript">'."\n" |
$r->print('<script type="text/javascript">'."\n" |
.'// <![CDATA['."\n" |
.'// <![CDATA['."\n" |
.'this.window.name="loncapaclient";'."\n" |
.'this.window.name="$windowname";'."\n" |
.'// ]]>'."\n" |
.'// ]]>'."\n" |
.'</script>'."\n" |
.'</script>'."\n" |
); |
); |
Line 6379 NGFFORM
|
Line 6488 NGFFORM
|
my @importdoc = ( |
my @importdoc = ( |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform} |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform} |
); |
); |
if (keys(%ltitools)) { |
if ($posslti) { |
push(@importdoc, |
push(@importdoc, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/exttool.png" alt="'.$lt{extt}.'" onclick="toggleUpload(\'tool\');" />'=>$exttoolform}, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/exttool.png" alt="'.$lt{extt}.'" onclick="toggleUpload(\'tool\');" />'=>$exttoolform}, |
); |
); |