version 1.477, 2009/11/05 18:10:37
|
version 1.483, 2009/11/14 17:47:18
|
Line 1161 sub extractResourceInformation {
|
Line 1161 sub extractResourceInformation {
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my @allres=$navmap->retrieveResources(undef,undef,1,undef,1); |
my @allres=$navmap->retrieveResources(undef,undef,1,undef,1); |
foreach my $resource (@allres) { |
foreach my $resource (@allres) { |
my $id=$resource->id(); |
my $id=$resource->id(); |
my ($mapid,$resid)=split(/\./,$id); |
my ($mapid,$resid)=split(/\./,$id); |
if ($mapid eq '0') { next; } |
if ($mapid eq '0') { next; } |
$$ids[$#$ids+1]=$id; |
$$ids[$#$ids+1]=$id; |
my $srcf=$resource->src(); |
my $srcf=$resource->src(); |
$srcf=~/\.(\w+)$/; |
$srcf=~/\.(\w+)$/; |
$$typep{$id}=$1; |
$$typep{$id}=$1; |
$$keyp{$id}=''; |
$$keyp{$id}=''; |
$$uris{$id}=$srcf; |
$$uris{$id}=$srcf; |
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
next if ($key!~/^parameter_/); |
next if ($key!~/^parameter_/); |
|
|
# Hidden parameters |
# Hidden parameters |
next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm'); |
next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm'); |
# |
# |
# allparms is a hash of parameter names |
# allparms is a hash of parameter names |
# |
# |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
my ($display,$parmdis); |
my ($display,$parmdis); |
$display = &standard_parameter_names($name); |
$display = &standard_parameter_names($name); |
if ($display eq '') { |
if ($display eq '') { |
$display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
$display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
$parmdis = $display; |
$parmdis = $display; |
$parmdis =~ s/\s*\[Part.*$//g; |
$parmdis =~ s/\s*\[Part.*$//g; |
} else { |
} else { |
$parmdis = &mt($display); |
$parmdis = &mt($display); |
} |
} |
$$allparms{$name}=$parmdis; |
$$allparms{$name}=$parmdis; |
if (ref($defkeytype)) { |
if (ref($defkeytype)) { |
$$defkeytype{$name}= |
$$defkeytype{$name}= |
&Apache::lonnet::metadata($srcf,$key.'.type'); |
&Apache::lonnet::metadata($srcf,$key.'.type'); |
} |
} |
} |
} |
|
|
# |
# |
# allparts is a hash of all parts |
# allparts is a hash of all parts |
# |
# |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
$$allparts{$part} = &mt('Part: [_1]',$part); |
$$allparts{$part} = &mt('Part: [_1]',$part); |
# |
# |
# Remember all keys going with this resource |
# Remember all keys going with this resource |
# |
# |
if ($$keyp{$id}) { |
if ($$keyp{$id}) { |
$$keyp{$id}.=','.$key; |
$$keyp{$id}.=','.$key; |
} else { |
} else { |
$$keyp{$id}=$key; |
$$keyp{$id}=$key; |
} |
} |
# |
# |
# Put in order |
# Put in order |
# |
# |
unless ($$keyorder{$key}) { |
unless ($$keyorder{$key}) { |
$$keyorder{$key}=$keyordercnt; |
$$keyorder{$key}=$keyordercnt; |
$keyordercnt++; |
$keyordercnt++; |
|
} |
} |
} |
} |
|
|
|
|
|
if (!exists($$mapp{$mapid})) { |
if (!exists($$mapp{$mapid})) { |
$$mapp{$id}= |
$$mapp{$id}= |
&Apache::lonnet::declutter($resource->enclosing_map_src()); |
&Apache::lonnet::declutter($resource->enclosing_map_src()); |
$$mapp{$mapid}=$$mapp{$id}; |
$$mapp{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
if ($mapid eq '1') { |
if ($mapid eq '1') { |
$$maptitles{$mapid}=&mt('Main Course Documents'); |
$$maptitles{$mapid}=&mt('Main Course Documents'); |
|
} else { |
|
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
|
} |
|
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
|
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; |
} else { |
} else { |
$$maptitles{$mapid}= |
$$mapp{$id} = $$mapp{$mapid}; |
&Apache::lonnet::gettitle($$mapp{$id}); |
|
} |
} |
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
$$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf); |
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; |
|
} else { |
|
$$mapp{$id} = $$mapp{$mapid}; |
|
} |
|
$$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf); |
|
} |
} |
} |
} |
|
|
Line 1836 sub mapmenu {
|
Line 1835 sub mapmenu {
|
} |
} |
} |
} |
|
|
|
# Build up the select Box to choose if your parameter specification should work for the resource, map/folder or the course level |
|
# The value of default selection in the select box is set by the value that is given by the argument in $parmlev. |
sub levelmenu { |
sub levelmenu { |
my ($r,$alllevs,$parmlev)=@_; |
my ($r,$alllevs,$parmlev)=@_; |
|
|
Line 2197 ENDPARMSELSCRIPT
|
Line 2198 ENDPARMSELSCRIPT
|
|
|
# Display Unit 1 "General Parameters" |
# Display Unit 1 "General Parameters" |
if (!$pssymb) { |
if (!$pssymb) { |
#$r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters'))); |
$r->print(&Apache::lonhtmlcommon::topic_bar(1,&mt('Resource Specification'))); |
$r->print('<div class="LC_Box">'); |
|
$r->print('<h4 class="LC_hcell">'.&mt('Resource Specification').'</h4>'); |
|
$r->print(<<COURSECONTENTSCRIPT); |
$r->print(<<COURSECONTENTSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 2229 COURSECONTENTSCRIPT
|
Line 2228 COURSECONTENTSCRIPT
|
$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>'); |
$r->print('</div>'); |
$r->print('</div>'); |
|
#Display Unit 2 "Select Parameter" |
#Display Unit 2 "Select Parameter" |
#$r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters'))); |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'))); |
$r->print('<div class="LC_Box">'); |
|
$r->print('<h4 class="LC_hcell">'.&mt('Parameter Specification').'</h4>'); |
|
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
|
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'))); |
} else { |
} else { |
|
# parameter screen for a single resource. |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my $title = &Apache::lonnet::gettitle($pssymb); |
my $title = &Apache::lonnet::gettitle($pssymb); |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
|
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('User Specification (optional)'))); |
} |
} |
$r->print('</div>'); |
|
#$r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Selection'))); |
|
$r->print('<div class="LC_Box">'); |
|
$r->print('<h4 class="LC_hcell">'.&mt('User Specification (optional)').'</h4>'); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
$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>'); |
|
|
|
# parm selection is shown: display parm update button |
# parm selection is shown: display parm update button |
$r->print('<p>' |
$r->print('<p>' |
Line 2275 COURSECONTENTSCRIPT
|
Line 2269 COURSECONTENTSCRIPT
|
.'</a>' |
.'</a>' |
.'</p>' |
.'</p>' |
); |
); |
|
|
|
|
# Display Messages |
# Display Messages |
$r->print('<div>'.$message.'</div>'); |
$r->print('<div>'.$message.'</div>'); |
Line 3181 ENDOVER
|
Line 3176 ENDOVER
|
\%keyorder,\%defkeytype); |
\%keyorder,\%defkeytype); |
|
|
if (grep {$_ eq 'all'} (@psprt)) { |
if (grep {$_ eq 'all'} (@psprt)) { |
@psprt = keys(%allparts); |
@psprt = keys(%allparts); |
} |
} |
# Menu to select levels, etc |
# Menu to select levels, etc |
|
|
Line 3193 ENDOVER
|
Line 3188 ENDOVER
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
if ($parmlev ne 'general') { |
if ($parmlev ne 'general') { |
#$r->print('<td class="LC_parm_overview_map_menu">'); |
#$r->print('<td class="LC_parm_overview_map_menu">'); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp); |
#$r->print('</td>'); |
#$r->print('</td>'); |
} |
} |
$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()); |
Line 3214 ENDOVER
|
Line 3209 ENDOVER
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
#$r->print('</td><td class="LC_parm_overview_restrictions">'. |
#$r->print('</td><td class="LC_parm_overview_restrictions">'. |
$r->print('<table>'. |
$r->print('<table>'. |
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
Line 3249 ENDOVER
|
Line 3244 ENDOVER
|
|
|
if (($env{'form.store'}) || ($env{'form.dis'})) { |
if (($env{'form.store'}) || ($env{'form.dis'})) { |
|
|
if ($env{'form.store'}) { &storedata($r,$crs,$dom); } |
if ($env{'form.store'}) { &storedata($r,$crs,$dom); } |
|
|
# Read modified data |
# Read modified data |
|
|
my $resourcedata=&readdata($crs,$dom); |
my $resourcedata=&readdata($crs,$dom); |
|
|
# List data |
# List data |
|
|
&listdata($r,$resourcedata,$listdata,$sortorder); |
&listdata($r,$resourcedata,$listdata,$sortorder); |
} |
} |
$r->print(&tableend(). |
$r->print(&tableend(). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |