version 1.464, 2009/06/30 14:59:17
|
version 1.468, 2009/07/31 16:09:03
|
Line 1244 sub isdateparm {
|
Line 1244 sub isdateparm {
|
return (($type=~/^date/) && (!($type eq 'date_interval'))); |
return (($type=~/^date/) && (!($type eq 'date_interval'))); |
} |
} |
|
|
|
# |
|
# This function prints a list of parameters, which were selected. It also display a link from which you can |
|
# hide or show the complete parameter list, from which you can choose your parameters. |
|
# |
sub parmmenu { |
sub parmmenu { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my $tempkey; |
my $tempkey; |
Line 1330 sub parmmenu {
|
Line 1334 sub parmmenu {
|
function checkboxChecked(id) { |
function checkboxChecked(id) { |
var li = "_li"; |
var li = "_li"; |
var id_li = id.concat(li); |
var id_li = id.concat(li); |
|
|
if (document.getElementById(id_li).style.display == "none") { |
if (document.getElementById(id_li).style.display == "none") { |
document.getElementById(id_li).style.display = ""; |
document.getElementById(id_li).style.display = ""; |
} |
} |
Line 1368 ENDSCRIPT
|
Line 1371 ENDSCRIPT
|
|
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
} |
} |
|
# return a hash |
|
sub categories { |
|
return ('time_settings' => 'Time Settings', |
|
'grading' => 'Grading', |
|
'tries' => 'Tries', |
|
'problem_appearance' => 'Problem Appearance', |
|
'behaviour_of_input_fields' => 'Behaviour of Input Fields', |
|
'hiding' => 'Hiding', |
|
'high_level_randomization' => 'High Level Randomization', |
|
'slots' => 'Slots', |
|
'file_submission' => 'File Submission', |
|
'misc' => 'Miscellaneous' ); |
|
} |
|
|
|
# return a hash. Like a look-up table |
|
sub lookUpTableParameter { |
|
|
|
return ( |
|
'opendate' => 'time_settings', |
|
'duedate' => 'time_settings', |
|
'answerdate' => 'time_settings', |
|
'interval' => 'time_settings', |
|
'contentopen' => 'time_settings', |
|
'contentclose' => 'time_settings', |
|
'discussend' => 'time_settings', |
|
'weight' => 'grading', |
|
'handgrade' => 'grading', |
|
'maxtries' => 'tries', |
|
'hinttries' => 'tries', |
|
'type' => 'problem_appearance', |
|
'problemstatus' => 'problem_appearance', |
|
'display' => 'problem_appearance', |
|
'ordered' => 'problem_appearance', |
|
'numbubbles' => 'problem_appearance', |
|
'tol' => 'behaviour_of_input_fields', |
|
'sig' => 'behaviour_of_input_fields', |
|
'turnoffunit' => 'behaviour_of_input_fields', |
|
'hiddenresource' => 'hiding', |
|
'hiddenparts' => 'hiding', |
|
'discusshide' => 'hiding', |
|
'buttonshide' => 'hiding', |
|
'turnoffeditor' => 'hiding', |
|
'encrypturl' => 'hiding', |
|
'randomorder' => 'high_level_randomization', |
|
'randompick' => 'high_level_randomization', |
|
'available' => 'slots', |
|
'useslots' => 'slots', |
|
'availablestudent' => 'slots', |
|
'uploadedfiletypes' => 'file_submission', |
|
'maxfilesize' => 'file_submission', |
|
'cssfile' => 'misc', |
|
'mapalias' => 'misc', |
|
'acc' => 'misc', |
|
'maxcollaborators' => 'misc', |
|
'scoreformat' => 'misc', |
|
|
|
); |
|
} |
|
|
|
sub whatIsMyCategory { |
|
my $name = shift; |
|
my $catList = shift; |
|
my @list; |
|
my %lookUpList = &lookUpTableParameter; #Initilize the lookupList |
|
my $cat = $lookUpList{$name}; |
|
if (defined($cat)) { |
|
if (!defined($$catList{$cat})){ |
|
push @list, ($name); |
|
$$catList{$cat} = \@list; |
|
} else { |
|
push @{${$catList}{$cat}}, ($name); |
|
} |
|
} else { |
|
if (!defined($$catList{'misc'})){ |
|
push @list, ($name); |
|
$$catList{'misc'} = \@list; |
|
} else { |
|
push @{${$catList}{'misc'}}, ($name); |
|
} |
|
} |
|
} |
|
|
|
sub keysindisplayorderCategory { |
|
my ($name,$keyorder)=@_; |
|
return sort { |
|
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; |
|
} ( @{$name}); |
|
} |
|
|
|
sub category_order { |
|
return ( |
|
'time_settings' => 1, |
|
'grading' => 2, |
|
'tries' => 3, |
|
'problem_appearance' => 4, |
|
'hiding' => 5, |
|
'behaviour_of_input_fields' => 6, |
|
'high_level_randomization' => 7, |
|
'slots' => 8, |
|
'file_submission' => 9, |
|
'misc' => 10 |
|
); |
|
|
|
} |
|
|
sub parmboxes { |
sub parmboxes { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my $tempkey; |
my $tempkey; |
|
my $tempparameter; |
|
my %categories = &categories; |
|
my %category_order = &category_order(); |
|
my %categoryList = ( |
|
'time_settings' => [], |
|
'grading' => [], |
|
'tries' => [], |
|
'problem_appearance' => [], |
|
'behaviour_of_input_fields' => [], |
|
'hiding' => [], |
|
'high_level_randomization' => [], |
|
'slots' => [], |
|
'file_submission' => [], |
|
'misc' => [], |
|
); |
|
foreach $tempparameter (keys %$allparms) { |
|
&whatIsMyCategory($tempparameter, \%categoryList); |
|
} |
#part to print the parm-list |
#part to print the parm-list |
$r->print('<fieldset id="LC_parm_overview_parm_menu" style="display:none">' |
$r->print('<fieldset id="LC_parm_overview_parm_menu" style="display:none">' |
.'<legend>'.&mt('Parameter').'</legend>' |
.'<legend>'.&mt('Parameter').'</legend>'."\n" |
."\n" |
|
.'<table>' |
|
); |
); |
my $cnt=0; |
|
|
|
$r->print('<tr>'); |
#Print parameters |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { |
$r->print("\n".'<td><label><input type="checkbox" name="pscat" '); |
if(@{$categoryList{$key}} == 0) { |
$r->print('value="'.$tempkey.'" '); |
next; |
$r->print('onclick="checkboxChecked(\''.$tempkey.'\')"'); |
} else { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print('<fieldset>' |
$r->print(' checked="checked"'); |
.'<legend>' |
} |
.&mt($categories{$key}) |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
.'</legend>'."\n"); |
: $tempkey) |
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
.'</label></td>'); |
$r->print('<span class="LC_nobreak">' |
$cnt++; |
.'<label><input type="checkbox" name="pscat" '); |
if ($cnt==4) { |
$r->print('value="'.$tempkey.'" '); |
$r->print("</tr>\n<tr>"); |
$r->print('onclick="checkboxChecked(\''.$tempkey.'\')"'); |
$cnt=0; |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
} |
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
|
: $tempkey) |
|
.'</label></span> '); |
|
} |
|
$r->print('</fieldset>'); |
|
} |
} |
} |
$r->print('</tr>' |
$r->print('<hr />' |
.'</table>' |
|
.'<hr />' |
|
.'<a href="javascript:hideParms()">' |
.'<a href="javascript:hideParms()">' |
.&mt('Hide') |
.&mt('Hide') |
.'</a>' |
.'</a>' |
Line 1409 sub parmboxes {
|
Line 1535 sub parmboxes {
|
#&shortCuts($r,$allparms,$pscat,$keyorder); |
#&shortCuts($r,$allparms,$pscat,$keyorder); |
$r->print('</fieldset>'); |
$r->print('</fieldset>'); |
} |
} |
|
# |
|
# This function offers some links on the parameter section to get with one click a group a parameters |
|
# |
sub shortCuts { |
sub shortCuts { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
|
|
Line 1573 function group_or_section(caller) {
|
Line 1702 function group_or_section(caller) {
|
,$chooseopt)); |
,$chooseopt)); |
} |
} |
|
|
|
# |
|
# This function shows on table Mode the available Parameters for the selected Resources |
|
# |
sub displaymenu { |
sub displaymenu { |
my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; |
my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; |
$r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters'))); |
$r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters'))); |
Line 1588 sub displaymenu {
|
Line 1720 sub displaymenu {
|
} |
} |
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
my ($r,$allmaps,$pschp,$maptitles, $symbp)=@_; |
|
my %allmaps_inverted = reverse %$allmaps; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $tree=[]; |
my $tree=[]; |
my $treeinfo={}; |
my $treeinfo={}; |
Line 1596 sub mapmenu {
|
Line 1729 sub mapmenu {
|
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
my $curRes; |
my $curRes; |
my $depth = 0; |
my $depth = 0; |
|
my %parent = (); |
|
my $startcount = 5; |
|
my $lastcontainer = $startcount; |
|
# preparing what is to show ... |
while ($curRes = $it->next()) { |
while ($curRes = $it->next()) { |
if ($curRes == $it->BEGIN_MAP()) { |
if ($curRes == $it->BEGIN_MAP()) { |
$depth++; |
$depth++; |
|
$parent{$depth}= $lastcontainer; |
} |
} |
if ($curRes == $it->END_MAP()) { |
if ($curRes == $it->END_MAP()) { |
$depth--; |
$depth--; |
|
$lastcontainer = $parent{$depth}; |
} |
} |
if (ref($curRes)) { |
if (ref($curRes)) { |
|
my $symb = $curRes->symb(); |
|
my $ressymb = $symb; |
if (($curRes->is_sequence()) || ($curRes->is_page())) { |
if (($curRes->is_sequence()) || ($curRes->is_page())) { |
my $type = 'sequence'; |
my $type = 'sequence'; |
if ($curRes->is_page()) { |
if ($curRes->is_page()) { |
$type = 'page'; |
$type = 'page'; |
} |
} |
my $id= $curRes->id(); |
my $id= $curRes->id(); |
my ($mapid,$resid)=split(/\./,$id); |
my $srcf = $curRes->src(); |
if(!exists($treeinfo->{$mapid})) { |
my $resource_name = &Apache::lonnet::gettitle($srcf); |
push(@$tree,$mapid); |
if(!exists($treeinfo->{$id})) { |
$treeinfo->{$mapid} = { |
push(@$tree,$id); |
|
my $enclosing_map_folder = &Apache::lonnet::declutter($curRes->enclosing_map_src()); |
|
$treeinfo->{$id} = { |
depth => $depth, |
depth => $depth, |
type => $type, |
type => $type, |
|
name => $resource_name, |
|
enclosing_map_folder => $enclosing_map_folder, |
}; |
}; |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
|
# Show it ... |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'))); |
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="" />'; |
Line 1639 sub mapmenu {
|
Line 1783 sub mapmenu {
|
my $whitespace = '<img src="' |
my $whitespace = '<img src="' |
.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif") |
.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif") |
.'" alt="" />'; |
.'" alt="" />'; |
foreach my $mapid (@{$tree}) { |
if (exists($$allmaps{1})) { |
|
$r->print(&Apache::loncommon::start_data_table_row() |
|
.'<td>'.$icon |
|
.'<label> ' |
|
.'<input type="radio" name="pschp" value="1"' |
|
); |
|
if ($pschp eq 1) { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print('/>' |
|
.$$maptitles{1} |
|
.($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'') |
|
.'</label>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
} |
|
foreach my $id (@{$tree}) { |
|
my ($mapid,$resid)=split(/\./,$id); |
# Indentation |
# Indentation |
my $depth = $treeinfo->{$mapid}->{'depth'}; |
my $depth = $treeinfo->{$id}->{'depth'}; |
my $indent; |
my $indent; |
for (my $i = 0; $i < $depth; $i++) { |
for (my $i = 0; $i < $depth; $i++) { |
$indent.= $whitespace; |
$indent.= $whitespace; |
} |
} |
$icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
$icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
if ($treeinfo->{$mapid}->{'type'} eq 'page') { |
if ($treeinfo->{$id}->{'type'} eq 'page') { |
$icon = '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />'; |
$icon = '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />'; |
} |
} |
|
my $symb_name = $$symbp{$id}; |
|
my ($front, $tail) = split (/___${resid}___/, $symb_name); |
|
$symb_name = $tail; |
$r->print(&Apache::loncommon::start_data_table_row() |
$r->print(&Apache::loncommon::start_data_table_row() |
.'<td>'.$indent.$icon |
.'<td>'.$indent.$icon |
.'<label> ' |
.'<label> ' |
.'<input type ="radio" name="pschp" value="'.$mapid.'"' |
.'<input type ="radio" name="pschp" value="'.$allmaps_inverted{$symb_name}.'"' |
); |
); |
if ($pschp eq $mapid) { |
if ($pschp eq $allmaps_inverted{$symb_name}) { |
$r->print(' checked="checked"'); |
$r->print(' checked="checked"'); |
} |
} |
$r->print('/>' |
$r->print('/>' |
.$$maptitles{$mapid} |
.$treeinfo->{$id}->{name} |
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
.'</label>' |
.'</label>' |
.'</td>' |
.'</td>' |
Line 1847 sub assessparms {
|
Line 2012 sub assessparms {
|
} else { |
} else { |
$udom=$r->dir_config('lonDefDomain'); |
$udom=$r->dir_config('lonDefDomain'); |
} |
} |
|
|
|
|
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my $pschp=$env{'form.pschp'}; |
my $pschp=$env{'form.pschp'}; |
Line 2028 ENDPARMSELSCRIPT
|
Line 2194 ENDPARMSELSCRIPT
|
$r->print('<div id="parmsel">'); |
$r->print('<div id="parmsel">'); |
} |
} |
|
|
# Display parameter selection boxes |
# 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('General Parameters'))); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
Line 2037 ENDPARMSELSCRIPT
|
Line 2203 ENDPARMSELSCRIPT
|
|
|
if ($parmlev ne 'general') { |
if ($parmlev ne 'general') { |
$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(&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()); |
|
#Display Unit 2 "Select Parameter" |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
} else { |
} else { |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |