version 1.606, 2022/03/24 15:57:36
|
version 1.610, 2022/04/30 19:29:43
|
Line 2074 sub parm_control_group {
|
Line 2074 sub parm_control_group {
|
# @param {hash reference} $uris - hash resource/map id -> resource src |
# @param {hash reference} $uris - hash resource/map id -> resource src |
# @param {hash reference} $keyorder - hash parameter key -> appearance rank for this parameter when looking through every resource and every parameter, starting at 100 (integer) |
# @param {hash reference} $keyorder - hash parameter key -> appearance rank for this parameter when looking through every resource and every parameter, starting at 100 (integer) |
# @param {hash reference} $defkeytype - hash parameter name -> parameter type |
# @param {hash reference} $defkeytype - hash parameter name -> parameter type |
|
# @param {string} $pssymb - resource symb (when a single resource is selected) |
sub extractResourceInformation { |
sub extractResourceInformation { |
my $ids = shift; |
my $ids = shift; |
my $typep = shift; |
my $typep = shift; |
Line 2742 sub displaymenu {
|
Line 2743 sub displaymenu {
|
# @param {string} $pschp - selected map pc, or 'all' |
# @param {string} $pschp - selected map pc, or 'all' |
# @param {hash reference} $maptitles - hash map id or src -> map title |
# @param {hash reference} $maptitles - hash map id or src -> map title |
# @param {hash reference} $symbp - hash map pc or resource/map id -> map src.'___(all)' or resource symb |
# @param {hash reference} $symbp - hash map pc or resource/map id -> map src.'___(all)' or resource symb |
|
# @param {string} $parmlev - parameter level (Resource:'full', Map:'map', Course:'general') |
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles,$symbp)=@_; |
my ($r,$allmaps,$pschp,$maptitles,$symbp,$parmlev)=@_; |
my %allmaps_inverted = reverse %$allmaps; |
my %allmaps_inverted = reverse %$allmaps; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $tree=[]; |
my $tree=[]; |
Line 2791 sub mapmenu {
|
Line 2793 sub mapmenu {
|
} |
} |
} |
} |
# Show it ... |
# Show it ... |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',' id="mapmenu"')); |
my $rowattr = ' id="mapmenu"'; |
|
if ($parmlev eq 'general') { |
|
$rowattr .= ' style="display:none"'; |
|
} |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',$rowattr)); |
if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) { |
if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) { |
my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
my $whitespace = |
my $whitespace = |
Line 3033 sub keysindisplayorder {
|
Line 3039 sub keysindisplayorder {
|
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {string} $sortorder - realmstudent|studentrealm |
# @param {string} $sortorder - realmstudent|studentrealm |
|
# @param {string} $context - newoverview|overview |
sub sortmenu { |
sub sortmenu { |
my ($r,$sortorder)=@_; |
my ($r,$sortorder,$context)=@_; |
$r->print('<br /><label><input type="radio" name="sortorder" value="realmstudent"'); |
my %text; |
if ($sortorder eq 'realmstudent') { |
if ($context eq 'newoverview') { |
$r->print(' checked="checked"'); |
%text = &Apache::lonlocal::texthash ( |
|
realmstudent => 'Sort by location in course first, then student (group/section)', |
|
studentrealm => 'Sort by student (group/section) first, then location in course', |
|
); |
|
} else { |
|
%text = &Apache::lonlocal::texthash ( |
|
realmstudent => 'Sort by realm first, then student (group/section)', |
|
studentrealm => 'Sort by student (group/section) first, then realm', |
|
); |
} |
} |
$r->print(' />'.&mt('Sort by realm first, then student (group/section)')); |
my %sortchecked = ( |
$r->print('</label><br /><label><input type="radio" name="sortorder" value="studentrealm"'); |
realmstudent => ' checked="checked"', |
|
studentrealm => '', |
|
); |
if ($sortorder eq 'studentrealm') { |
if ($sortorder eq 'studentrealm') { |
$r->print(' checked="checked"'); |
$sortchecked{'studentrealm'} = $sortchecked{'realmstudent'}; |
|
$sortchecked{'realmstudent'} = ''; |
|
} |
|
foreach my $sorttype ('realmstudent','studentrealm') { |
|
$r->print('<br /><label><input type="radio" name="sortorder" value="'.$sorttype.'"'.$sortchecked{$sorttype}.' />'. |
|
$text{$sorttype}.'</label>'); |
} |
} |
$r->print(' />'.&mt('Sort by student (group/section) first, then realm'). |
|
'</label>'); |
|
} |
} |
|
|
# Returns a hash parameter key -> order (integer) giving the order for some parameters. |
# Returns a hash parameter key -> order (integer) giving the order for some parameters. |
Line 3635 ENDPARMSELSCRIPT
|
Line 3655 ENDPARMSELSCRIPT
|
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
Line 3932 ENDTABLEHEADFOUR
|
Line 3952 ENDTABLEHEADFOUR
|
|
|
#-------------------------------------------- for each map, gather information |
#-------------------------------------------- for each map, gather information |
my $mapid; |
my $mapid; |
foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys(%maplist)) { |
foreach $mapid (sort { $a <=> $b } keys(%maplist)) { |
my $maptitle = $maplist{$mapid}; |
my $maptitle = $maplist{$mapid}; |
|
|
#----------------------- loop through ids and get all parameter types for map |
#----------------------- loop through ids and get all parameter types for map |
Line 4687 sub parse_listdata_key {
|
Line 4707 sub parse_listdata_key {
|
# @param {string} $caller - name of the calling sub (overview|newoverview) |
# @param {string} $caller - name of the calling sub (overview|newoverview) |
# @param {hash reference} $classlist - from loncoursedata::get_classlist |
# @param {hash reference} $classlist - from loncoursedata::get_classlist |
# @param {boolean} $readonly - true if editing not allowed |
# @param {boolean} $readonly - true if editing not allowed |
|
# @param {string} $parmlev - full|map |
|
# @param {hash reference} $hash_for_realm - keys: realm, values: numeric order |
|
# @param {string} $pschp - selected map pc, or 'all' |
# @returns{integer} - number of $listdata parameters processed |
# @returns{integer} - number of $listdata parameters processed |
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_; |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly,$parmlev,$hash_for_realm,$pschp)=@_; |
|
|
# Start list output |
# Start list output |
|
|
Line 4715 sub listdata {
|
Line 4738 sub listdata {
|
foreach my $key (sort { |
foreach my $key (sort { |
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
|
my ($aid,$bid); |
|
if ($caller eq 'newoverview') { |
|
if (ref($hash_for_realm) eq 'HASH') { |
|
if (($parmlev eq 'map') && ($pschp eq 'all')) { |
|
my ($aurl) = ($ares =~ /^(.+\.(?:sequence|page))___\(all\)$/); |
|
my ($burl) = ($bres =~ /^(.+\.(?:sequence|page))___\(all\)$/); |
|
$aid = $hash_for_realm->{$aurl}; |
|
$bid = $hash_for_realm->{$burl}; |
|
} elsif ($parmlev eq 'full') { |
|
$aid = $hash_for_realm->{$ares}; |
|
$bid = $hash_for_realm->{$bres}; |
|
} |
|
} |
|
} |
|
|
# get the numerical order for the param |
# get the numerical order for the param |
$aparm=$keyorder{'parameter_0_'.$aparm}; |
$aparm=$keyorder{'parameter_0_'.$aparm}; |
Line 4724 sub listdata {
|
Line 4761 sub listdata {
|
|
|
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
if ($ares ne $bres ) { |
if ($ares ne $bres ) { |
$result = ($ares cmp $bres); |
if ($caller eq 'newoverview') { |
|
if (ref($hash_for_realm) eq 'HASH') { |
|
if (($parmlev eq 'map') && ($pschp eq 'all')) { |
|
$result = ($aid <=> $bid); |
|
} elsif ($parmlev eq 'full') { |
|
$result = ($aid <=> $bid); |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
} elsif ($astudent ne $bstudent) { |
} elsif ($astudent ne $bstudent) { |
$result = ($astudent cmp $bstudent); |
$result = ($astudent cmp $bstudent); |
} elsif ($apart ne $bpart ) { |
} elsif ($apart ne $bpart ) { |
Line 4734 sub listdata {
|
Line 4785 sub listdata {
|
if ($astudent ne $bstudent) { |
if ($astudent ne $bstudent) { |
$result = ($astudent cmp $bstudent); |
$result = ($astudent cmp $bstudent); |
} elsif ($ares ne $bres ) { |
} elsif ($ares ne $bres ) { |
$result = ($ares cmp $bres); |
if ($caller eq 'newoverview') { |
|
if (ref($hash_for_realm) eq 'HASH') { |
|
if (($parmlev eq 'map') && ($pschp eq 'all')) { |
|
$result = ($aid <=> $bid); |
|
} elsif ($parmlev eq 'full') { |
|
$result = ($aid <=> $bid); |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
} elsif ($apart ne $bpart ) { |
} elsif ($apart ne $bpart ) { |
$result = ($apart cmp $bpart); |
$result = ($apart cmp $bpart); |
} |
} |
Line 4814 sub listdata {
|
Line 4879 sub listdata {
|
} |
} |
if ($is_map) { |
if ($is_map) { |
my $leveltitle = &mt('Folder/Map'); |
my $leveltitle = &mt('Folder/Map'); |
|
my $title = &Apache::lonnet::gettitle($1); |
|
if (ref($hash_for_realm) eq 'HASH') { |
|
if ($hash_for_realm->{$mapurl} eq '1') { |
|
$title = &mt('Main Content'); |
|
} |
|
} |
unless (($name eq 'hiddenresource') || ($name eq 'encrypturl')) { |
unless (($name eq 'hiddenresource') || ($name eq 'encrypturl')) { |
if ($caller eq 'newoverview') { |
if ($caller eq 'newoverview') { |
my $altkey = $thiskey; |
my $altkey = $thiskey; |
Line 4830 sub listdata {
|
Line 4901 sub listdata {
|
$is_recursive = 1; |
$is_recursive = 1; |
} |
} |
} |
} |
$realm='<span class="LC_parm_scope_folder">'.$leveltitle.': '.&Apache::lonnet::gettitle($mapurl).' <br /><span class="LC_parm_folder">('.$mapurl.')</span></span>'; |
$realm='<span class="LC_parm_scope_folder">'.$leveltitle.': '.$title.' <br /><span class="LC_parm_folder">('.$mapurl.')</span></span>'; |
} elsif ($middle) { |
} elsif ($middle) { |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
|
next if (($url =~ /\.(page|sequence)$/) && ($parmlev eq 'full') && ($caller eq 'newoverview')); |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource'). |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource'). |
': '.&Apache::lonnet::gettitle($middle). |
': '.&Apache::lonnet::gettitle($middle). |
' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '. |
' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '. |
Line 5938 ENDOVER
|
Line 6010 ENDOVER
|
$r->print('<div>'); |
$r->print('<div>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
if ($parmlev ne 'general') { |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp); |
|
} |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
$r->print('</div></div>'); |
Line 5979 ENDOVER
|
Line 6049 ENDOVER
|
$r->print('<div>'); |
$r->print('<div>'); |
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
unless ($sortorder) { $sortorder='realmstudent'; } |
unless ($sortorder) { $sortorder='realmstudent'; } |
&sortmenu($r,$sortorder); |
&sortmenu($r,$sortorder,'newoverview')); |
$r->print('</div></div>'); |
$r->print('</div></div>'); |
|
|
$r->print('<p><input type="submit" name="dis" value="'.&mt('Display').'" /></p>'); |
$r->print('<p><input type="submit" name="dis" value="'.&mt('Display').'" /></p>'); |
Line 6004 ENDOVER
|
Line 6074 ENDOVER
|
|
|
# List data |
# List data |
|
|
&listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly); |
my $hash_for_realm; |
|
if (($parmlev eq 'map') && (keys(%allmaps))) { |
|
%{$hash_for_realm} = reverse(%allmaps); |
|
} elsif (($parmlev eq 'full') && (keys(%symbp))) { |
|
for (my $i=0; $i<@ids; $i++) { |
|
$hash_for_realm->{$symbp{$ids[$i]}} = $i; |
|
} |
|
} |
|
&listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly,$parmlev,$hash_for_realm,$pschp); |
} |
} |
$r->print(&tableend()); |
$r->print(&tableend()); |
unless ($readonly) { |
unless ($readonly) { |
Line 6111 sub overview {
|
Line 6189 sub overview {
|
|
|
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
unless ($sortorder) { $sortorder='realmstudent'; } |
unless ($sortorder) { $sortorder='realmstudent'; } |
&sortmenu($r,$sortorder); |
&sortmenu($r,$sortorder,'overview'); |
|
|
my $submitbutton = '<input type="submit" value="'.&mt('Save').'" />'; |
my $submitbutton = '<input type="submit" value="'.&mt('Save').'" />'; |
|
|