version 1.456, 2009/06/08 18:04:45
|
version 1.466, 2009/07/01 17:11:38
|
Line 1269 sub parmmenu {
|
Line 1269 sub parmmenu {
|
} |
} |
|
|
function checkthis(thisvalue, checkName) { |
function checkthis(thisvalue, checkName) { |
checkboxChecked(thisvalue); |
|
|
document.getElementById(thisvalue.concat("_li")).style.display = ""; |
|
|
for (i=0; i<document.forms.parmform.elements.length; i++) { |
for (i=0; i<document.forms.parmform.elements.length; i++) { |
ele = document.forms.parmform.elements[i]; |
ele = document.forms.parmform.elements[i]; |
if (ele.name == checkName) { |
if (ele.name == checkName) { |
Line 1352 ENDSCRIPT
|
Line 1354 ENDSCRIPT
|
$r->print(' style="display:none"'); |
$r->print(' style="display:none"'); |
} |
} |
$r->print('>' |
$r->print('>' |
.($$allparms{$tempkey}=~/\s/ ? $$allparms{$tempkey} : $tempkey) |
.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey) |
.'</li>' |
.'</li>' |
); |
); |
} |
} |
Line 1366 ENDSCRIPT
|
Line 1368 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 parmboxes { |
sub parmboxes { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my $tempkey; |
my $tempkey; |
|
my $tempparameter; |
|
my %categories = &categories; |
|
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)) { |
my ($category, $list) = undef; |
$r->print("\n".'<td><label><input type="checkbox" name="pscat" '); |
while (($category, $list) = each %categoryList) { |
$r->print('value="'.$tempkey.'" '); |
if(@$list == 0) { |
$r->print('onclick="checkboxChecked(\''.$tempkey.'\')"'); |
next; |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
} else { |
$r->print(' checked="checked"'); |
$r->print('<fieldset>' |
} |
.'<legend>' |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
.&mt($categories{$category}) |
: $tempkey) |
.'</legend>'."\n"); |
.'</label></td>'); |
foreach $tempkey (&keysindisplayorderCategory($list,$keyorder)) { |
$cnt++; |
$r->print('<span class="LC_nobreak">' |
if ($cnt==4) { |
.'<label><input type="checkbox" name="pscat" '); |
$r->print("</tr>\n<tr>"); |
$r->print('value="'.$tempkey.'" '); |
$cnt=0; |
$r->print('onclick="checkboxChecked(\''.$tempkey.'\')"'); |
} |
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 1587 sub displaymenu {
|
Line 1698 sub displaymenu {
|
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
my $tree=[]; |
|
my $treeinfo={}; |
|
if (defined($navmap)) { |
|
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
|
my $curRes; |
|
my $depth = 0; |
|
|
|
while ($curRes = $it->next()) { |
|
if ($curRes == $it->BEGIN_MAP()) { |
|
$depth++; |
|
} |
|
if ($curRes == $it->END_MAP()) { |
|
$depth--; |
|
} |
|
if (ref($curRes)) { |
|
if (($curRes->is_sequence()) || ($curRes->is_page())) { |
|
my $type = 'sequence'; |
|
if ($curRes->is_page()) { |
|
$type = 'page'; |
|
} |
|
my $id= $curRes->id(); |
|
my ($mapid,$resid)=split(/\./,$id); |
|
if(!exists($treeinfo->{$mapid})) { |
|
push(@$tree,$mapid); |
|
$treeinfo->{$mapid} = { |
|
depth => $depth, |
|
type => $type, |
|
}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'))); |
$r->print('<select name="pschp">'); |
if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) { |
$r->print('<option value="all">'.&mt('All Maps or Folders').'</option>'); |
my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) { |
$r->print(&Apache::loncommon::start_data_table() |
$r->print('<option value="'.$_.'"'); |
.&Apache::loncommon::start_data_table_row() |
if (($pschp eq $_)) { $r->print(' selected="selected"'); } |
.'<td>'.$icon |
$r->print('>'.$$maptitles{$_}.($$allmaps{$_}!~/^uploaded/?' ['.$$allmaps{$_}.']':'').'</option>'); |
.'<label> ' |
|
.'<input type="radio" name="pschp" checked="checked" value="all" />' |
|
.&mt('All Maps or Folders') |
|
.'</label></td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
my $whitespace = '<img src="' |
|
.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif") |
|
.'" alt="" />'; |
|
foreach my $mapid (@{$tree}) { |
|
# Indentation |
|
my $depth = $treeinfo->{$mapid}->{'depth'}; |
|
my $indent; |
|
for (my $i = 0; $i < $depth; $i++) { |
|
$indent.= $whitespace; |
|
} |
|
$icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
|
if ($treeinfo->{$mapid}->{'type'} eq 'page') { |
|
$icon = '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />'; |
|
} |
|
$r->print(&Apache::loncommon::start_data_table_row() |
|
.'<td>'.$indent.$icon |
|
.'<label> ' |
|
.'<input type ="radio" name="pschp" value="'.$mapid.'"' |
|
); |
|
if ($pschp eq $mapid) { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print('/>' |
|
.$$maptitles{$mapid} |
|
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
|
.'</label>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
} |
} |
$r->print("</select>"); |
|
|
|
} |
} |
|
|
sub levelmenu { |
sub levelmenu { |
Line 1918 sub assessparms {
|
Line 2097 sub assessparms {
|
$uname,$udom,$csec,$cgroup); |
$uname,$udom,$csec,$cgroup); |
} |
} |
# ---------------------------------------------------------------- Done storing |
# ---------------------------------------------------------------- Done storing |
$message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>'; |
$message.='<p class="LC_warning">' |
|
.&mt('Changes can take up to 10 minutes before being active for all students.') |
|
.&Apache::loncommon::help_open_topic('Caching') |
|
.'</p>'; |
} |
} |
#----------------------------------------------- if all selected, fill in array |
#----------------------------------------------- if all selected, fill in array |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
Line 1935 sub assessparms {
|
Line 2117 sub assessparms {
|
'" name="recent_'.$_.'" />'); |
'" name="recent_'.$_.'" />'); |
} |
} |
|
|
|
# ----- Start Parameter Selection |
|
|
|
# Hide parm selection? |
|
$r->print(<<ENDPARMSELSCRIPT); |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function parmsel_show() { |
|
document.getElementById('parmsel').style.display = ""; |
|
document.getElementById('parmsellink').style.display = "none"; |
|
} |
|
// ]]> |
|
</script> |
|
ENDPARMSELSCRIPT |
|
my $parmselhiddenstyle=' style="display:none"'; |
|
if($env{'form.hideparmsel'} eq 'hidden') { |
|
$r->print('<div id="parmsel"'.$parmselhiddenstyle.'>'); |
|
} else { |
|
$r->print('<div id="parmsel">'); |
|
} |
|
|
|
# Display parameter selection boxes |
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 1964 sub assessparms {
|
Line 2167 sub assessparms {
|
$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()); |
|
|
|
# parm selection is shown: display parm update button |
|
$r->print('<p>' |
|
.'<input type="submit" name="dis"' |
|
.' value="'.&mt('Update Parameter Display').'" />' |
|
.'<input type="hidden" name="hideparmsel" value="hidden" />' |
|
.'</p>' |
|
); |
|
|
|
$r->print('</div>'); |
|
# ----- End Parameter Selection |
|
|
|
# Offer link to display parameter selection again |
|
$r->print('<p id="parmsellink"'); |
|
if($env{'form.hideparmsel'} ne 'hidden') { |
|
$r->print($parmselhiddenstyle); |
|
} |
|
$r->print('>' |
|
.'<a href="javascript:parmsel_show()">' |
|
.&mt('Change Parameter Selection') |
|
.'</a>' |
|
.'</p>'); |
|
|
$r->print('<p>'.$message.'</p>'); |
# Display Messages |
|
$r->print('<div>'.$message.'</div>'); |
|
|
$r->print('<br /><input type="submit" name="dis" value="'.&mt("Update Parameter Display").'" />'); |
|
|
|
my @temp_pscat; |
my @temp_pscat; |
map { |
map { |