- ';
+ ';
if (exists $item->{'header'}->[0]->{'col1'} ||
exists $item->{'header'}->[0]->{'col2'}) {
$output .= '
@@ -589,7 +580,7 @@ sub print_config_box {
-
+ |
'.&mt($item->{'header'}->[1]->{'col1'}).' | ';
@@ -605,14 +596,14 @@ sub print_config_box {
';
- if (exists $item->{'header'}->[0]->{'col1'} ||
- exists $item->{'header'}->[0]->{'col2'}) {
+ if (exists $item->{'header'}->[2]->{'col1'} ||
+ exists $item->{'header'}->[2]->{'col2'}) {
$output .= '
- '.&mt($item->{'header'}->[0]->{'col1'}).' |
- '.&mt($item->{'header'}->[0]->{'col2'}).' |
+ '.&mt($item->{'header'}->[2]->{'col1'}).' |
+ '.&mt($item->{'header'}->[2]->{'col2'}).' |
';
- }
+ }
}
} else {
$output .= '
@@ -637,7 +628,7 @@ sub print_config_box {
$output .= &print_feedback('bottom',$cdom,$settings,$ordered,$itemtext,\$rowtotal);
} elsif ($action eq 'discussion') {
$output .= &print_discussion($cdom,$settings,$ordered,$itemtext,\$rowtotal);
- } elsif ($action eq 'classlists') {
+ } elsif (($action eq 'classlists') || ($action eq 'viewableroster')) {
$output .= &print_classlists('bottom',$cdom,$settings,$itemtext,\$rowtotal,$crstype);
} elsif ($action eq 'appearance') {
$output .= &print_appearance($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype);
@@ -688,7 +679,7 @@ sub process_changes {
(!$can_toggle_cat));
next if (($entry eq 'categories') &&
(!$can_categorize));
- next if (($entry eq 'loncaparev') ||
+ next if (($entry eq 'loncaparev') ||
($entry eq 'owner'));
push(@ordered,$entry);
}
@@ -1002,6 +993,35 @@ sub process_changes {
}
}
$newvalues{$entry} =~ s/,$//;
+ } elsif ($entry eq 'discussion_post_fonts') {
+ my ($classorder,$classtitles) = &discussion_vote_classes();
+ my $fontchange = 0;
+ foreach my $class (@{$classorder}) {
+ my $ext_entry = $entry.'_'.$class;
+ my $size = $env{'form.'.$ext_entry.'_size'};
+ my $unit = $env{'form.'.$ext_entry.'_unit'};
+ my $weight = $env{'form.'.$ext_entry.'_weight'};
+ my $style = $env{'form.'.$ext_entry.'_style'};
+ my $other = $env{'form.'.$ext_entry.'_other'};
+ $size =~ s/,//g;
+ $unit =~ s/,//g;
+ $weight =~ s/,//g;
+ $style =~ s/,//g;
+ $other =~ s/[^\w;:\s\-\%.]//g;
+ $other =~ s/(^\s+|\s+$)//g;
+ $newvalues{$ext_entry} = join(',',($size.$unit,$weight,$style,$other));
+ my $current = $values->{$ext_entry};
+ if ($values->{$ext_entry} eq '') {
+ $current = ',,,';
+ }
+ if ($newvalues{$ext_entry} ne $current) {
+ $changes->{$ext_entry} = $newvalues{$ext_entry};
+ $fontchange ++;
+ }
+ }
+ if ($fontchange) {
+ $changes->{$entry} = 1;
+ }
} elsif ($entry eq 'nothideprivileged') {
my @curr_nothide;
my @new_nothide;
@@ -1105,7 +1125,7 @@ sub process_changes {
} else {
$newvalues{$entry} = $env{'form.'.$entry};
}
- unless ($entry eq 'co-owners') {
+ unless (($entry eq 'co-owners') || ($entry eq 'discussion_post_fonts')) {
if ($newvalues{$entry} ne $values->{$entry}) {
$changes->{$entry} = $newvalues{$entry};
}
@@ -1232,7 +1252,7 @@ sub store_changes {
my ($displayname,$text);
$text = $prefs->{$item}->{'itemtext'}{$key};
my $displayval;
- unless ($key eq 'co-owners') {
+ unless (($key eq 'co-owners') || ($key eq 'discussion_post_fonts')) {
$displayval = $changes->{$item}{$key};
}
if ($item eq 'feedback') {
@@ -1268,6 +1288,36 @@ sub store_changes {
}
$displayval = join(', ',@longroles);
}
+ } elsif ($key eq 'discussion_post_fonts') {
+ my ($classorder,$classtitles)=&discussion_vote_classes();
+ my ($styleorder,$styleitems)=&discussion_vote_styles();
+ my $count = 1;
+ my $total = scalar(keys(%{$changes->{$item}}));
+ foreach my $class (@{$classorder}) {
+ $count ++;
+ next unless ($changes->{$item}{$key.'_'.$class});
+ my @vals = split(/,/,$changes->{$item}{$key.'_'.$class});
+ my $showval = '';
+ for (my $i=0; $i<@{$styleorder}; $i++) {
+ if ($vals[$i] ne '') {
+ $showval .= 'font-'.$styleorder->[$i].': '.$vals[$i].'; ';
+ }
+ }
+ if ($vals[3] ne '') {
+ $showval .= $vals[3];
+ }
+ if ($showval ne '') {
+ $displayval .= $classtitles->{$class}.':{ '.
+ $showval.'}';
+ $storehash{$key.'_'.$class} = $changes->{$item}{$key.'_'.$class};
+ } else {
+ $displayval .= $classtitles->{$class}.': '.&mt('None');
+ push(@delkeys,$key.'_'.$class);
+ }
+ unless ($count == $total) {
+ $displayval .= (' 'x2);
+ }
+ }
}
$displayname = &mt($text);
}
@@ -1367,7 +1417,9 @@ sub store_changes {
}
}
} else {
- $storehash{$key} = $changes->{$item}{$key};
+ unless ($key eq 'discussion_post_fonts') {
+ $storehash{$key} = $changes->{$item}{$key};
+ }
}
}
if ($key eq 'cloners') {
@@ -1730,6 +1782,7 @@ sub print_courseinfo {
'',
input => 'textbox',
size => '40',
+ advanced => 1
},
'description' => {
text => ''.&mt($itemtext->{'description'}).'',
@@ -1752,13 +1805,14 @@ sub print_courseinfo {
text => ''.&mt($itemtext->{'cloners'}).' '.
&mt('Owner and Coordinators included automatically'),
input => 'textbox',
- size => '40',
+ size => '40'
},
'rolenames' => {
text => ''.&mt($itemtext->{'rolenames'}).' '.
'('.$replace.')',
input => 'textbox',
size => '20',
+ advanced => 1
},
'externalsyllabus' => {
text => ''.&mt($itemtext->{'externalsyllabus'}).' ('.
@@ -1790,7 +1844,11 @@ sub print_courseinfo {
next if (!$can_categorize);
}
$count ++;
- $datatable .= &item_table_row_start($items{$item}{text},$count);
+ if (exists $items{$item}{advanced} && $items{$item}{advanced} == 1) {
+ $datatable .= &item_table_row_start($items{$item}{text},$count,"advanced");
+ } else {
+ $datatable .= &item_table_row_start($items{$item}{text},$count);
+ }
if ($items{$item}{input} eq 'radio') {
$datatable .= &yesno_radio($item,$settings);
} elsif ($item eq 'cloners') {
@@ -2139,7 +2197,7 @@ sub display_loncaparev_constraints {
if ($key =~ /^\Q$start\E(\[useropt\:($match_username\:$match_domain)\]\.)/) {
$middle = $1;
$which = $2;
- $scope = 'user';
+ $scope = 'user';
} elsif ($key =~ /^\Q$start\E(\[(\w+)\]\.)/) {
$middle = $1;
$which = $2;
@@ -2334,7 +2392,7 @@ sub display_loncaparev_constraints {
my $mapres_header = ''.
&mt('Requirements for specific folders or resources').
'';
- if ((keys(%toshow) > 0) || (keys(%byresource) > 0) ||
+ if ((keys(%toshow) > 0) || (keys(%byresource) > 0) ||
(keys(%bysubmission) > 0) || (keys(%byresponsetype))) {
$output .= $mapres_header;
}
@@ -2349,11 +2407,11 @@ sub display_loncaparev_constraints {
&show_contents_view($r,$navmap,$cid,\%toshow,\%bymap,\%byresource,\%bysubmission,
\%byresponsetype,\@scopeorder,\%lt);
}
- $r->print('
');
+ $r->print('
');
} else {
$r->print(''.
&mt('No version requirements from resource content or settings.').
- ' ');
+ '');
}
$r->print(&Apache::loncommon::end_page());
return;
@@ -2362,7 +2420,7 @@ sub display_loncaparev_constraints {
sub show_contents_view {
my ($r,$navmap,$cid,$toshow,$bymap,$byresource,$bysubmission,$byresponsetype,
$scopeorder,$lt) = @_;
- if ((keys(%{$toshow}) > 0) || (keys(%{$byresource}) > 0) ||
+ if ((keys(%{$toshow}) > 0) || (keys(%{$byresource}) > 0) ||
(keys(%{$bysubmission}) > 0) || (keys(%{$byresponsetype}) > 0)) {
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons");
my $whitespace = ' ';
@@ -2806,14 +2864,18 @@ sub print_feedback {
foreach my $item (@{$ordered}) {
$count ++;
- $datatable .= &item_table_row_start($items{$item}{text},$count);
+ if ($position eq 'top') {
+ $datatable .= &item_table_row_start($items{$item}{text},$count);
+ } else {
+ $datatable .= &item_table_row_start($items{$item}{text}." (Custom text)",$count, "advanced");
+ }
if ($position eq 'top') {
my $includeempty = 0;
$datatable .= &user_table($cdom,$item,\@sections,
$settings->{$item},\%lt);
} else {
$datatable .= &Apache::lonhtmlcommon::textbox($item.'.text',
- $settings->{$item.'.text'},$items{$item}{size});
+ $settings->{$item.'.text'},$items{$item}{size});
}
$datatable .= &item_table_row_end();
}
@@ -2975,6 +3037,11 @@ sub print_discussion {
text => ''.&mt($itemtext->{'allow_discussion_post_editing'}).'',
input => 'checkbox',
},
+ 'discussion_post_fonts' => {
+ text => ''.&mt($itemtext->{'discussion_post_fonts'}).'',
+ input => 'textbox',
+ size => '20',
+ },
);
my $datatable;
my $count;
@@ -3014,6 +3081,17 @@ sub print_discussion {
&Apache::loncommon::end_data_table_row().
&role_checkboxes($cdom,$cnum,$item,$settings,1).
&Apache::loncommon::end_data_table();
+ } elsif ($item eq 'discussion_post_fonts') {
+ $datatable .= &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_row().
+ ''.&mt('Sum of likes/dislikes').' | '.
+ ''.&mt('font-size').' | '.
+ ''.&mt('font-weight').' | '.
+ ''.&mt('font-style').' | '.
+ ''.&mt('Other css').' | '.
+ &Apache::loncommon::end_data_table_row().
+ &set_discussion_fonts($cdom,$cnum,$item,$settings).
+ &Apache::loncommon::end_data_table();
}
$datatable .= &item_table_row_end();
}
@@ -3135,6 +3213,75 @@ sub role_checkboxes {
return $output;
}
+sub set_discussion_fonts {
+ my ($cdom,$cnum,$item,$settings) = @_;
+ my ($classorder,$classtitles) = &discussion_vote_classes();
+ my ($styleorder,$styleitems) = &discussion_vote_styles();
+ my $output;
+ if (ref($classorder) eq 'ARRAY') {
+ foreach my $cat (@{$classorder}) {
+ my %curr = ();
+ ($curr{'size'},$curr{'weight'},$curr{'style'},$curr{'other'}) =
+ split(/,/,$settings->{'discussion_post_fonts_'.$cat});
+ $output .= &Apache::loncommon::start_data_table_row().
+ ''.$classtitles->{$cat}.' | ';
+ if (ref($styleorder) eq 'ARRAY') {
+ foreach my $item (@{$styleorder}) {
+ $output .= '';
+ my $selitem = $item;
+ if ($item eq 'size') {
+ my ($currsize,$currunit);
+ if ($curr{'size'} =~ /^(\d+)(px|%)$/) {
+ ($currsize,$currunit) = ($1,$2);
+ $curr{'size'} = $currunit;
+ }
+ $output .= ''.
+ ' ';
+ $selitem = 'unit';
+ }
+ if ((ref($styleitems) eq 'HASH') && (ref($styleitems->{$item}) eq 'ARRAY')) {
+ $output .= ' | | ';
+ }
+ $output .= &Apache::loncommon::end_data_table_row();
+ }
+ return $output;
+}
+
+sub discussion_vote_classes {
+ my $classorder = ['twoplus','oneplus','zero','oneminus','twominus'];
+ my %classtitles = &Apache::lonlocal::texthash(
+ 'twoplus' => 'Two sigma above mean',
+ 'oneplus' => 'One sigma above mean',
+ 'zero' => 'Within one sigma of mean',
+ 'oneminus' => 'One sigma below mean',
+ 'twominus' => 'Two sigma below mean',
+ );
+ return ($classorder,\%classtitles);
+}
+
+sub discussion_vote_styles {
+ my $styleorder = ['size','weight','style'];
+ my $styleitems = {
+ size => ['','px','%','xx-small','x-small','small','medium','large',
+ 'x-large','xx-large','smaller','larger'],
+ weight => ['','normal','bold','bolder','lighter','100','200','300','400',
+ '500','600','700','800','900'],
+ style => ['','normal','italic','oblique'],
+ };
+ return ($styleorder,$styleitems);
+}
+
sub print_classlists {
my ($position,$cdom,$settings,$itemtext,$rowtotal,$crstype) = @_;
my @ordered;
@@ -3263,11 +3410,12 @@ sub print_grading {
input => 'selectbox',
options => {
standard => &mt('Standard: shows points'),
+ categories => &mt('Categories: shows points according to categories'),
external => &mt('External: shows number of completed parts and totals'),
externalnototals => &mt('External: shows only number of completed parts'),
spreadsheet => &mt('Spreadsheet: (with link to detailed scores)'),
},
- order => ['standard','external','externalnototals','spreadsheet'],
+ order => ['standard','categories','external','externalnototals','spreadsheet'],
},
'rndseed' => {
text => ''.&mt($itemtext->{'rndseed'}).''.
@@ -3284,6 +3432,7 @@ sub print_grading {
'64bit5' => '64bit5',
},
order => ['32bit','64bit','64bit2','64bit3','64bit4','64bit5'],
+ advanced => 1
},
'receiptalg' => {
text => ''.&mt($itemtext->{'receiptalg'}).' '.
@@ -3295,6 +3444,7 @@ sub print_grading {
receipt3 => 'receipt3',
},
order => ['receipt','receipt2','receipt3'],
+ advanced => 1
},
'disablesigfigs' => {
text => ''.&mt($itemtext->{'disablesigfigs'}).'',
@@ -3333,7 +3483,7 @@ sub print_printouts {
A6 => &mt('A6').' [105x148 mm]',
},
order => ['Letter','Legal','Tabloid','Executive','A2','A3','A4','A5','A6'],
- nullval => 'None specified',
+ nullval => &mt('None specified'),
},
print_header_format => {
text => ''.&mt($itemtext->{'print_header_format'}).'',
@@ -3351,7 +3501,7 @@ sub print_printouts {
0 => &mt('No'),
},
order => ['1','0'],
- nullval => 'None specified - use domain default',
+ nullval => &mt('None specified - use domain default'),
}
);
return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype);
@@ -3474,7 +3624,8 @@ sub get_other_items {
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) ||
($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/)
|| ($parameter eq 'type') ||
- ($parameter =~ m/^(cc|co|in|ta|ep|ad|st)\.plaintext$/)) {
+ ($parameter =~ m/^(cc|co|in|ta|ep|ad|st)\.plaintext$/)
+ || ($parameter =~ m/^discussion_post_fonts/)) {
push(@ordered,$parameter);
}
}
@@ -3566,7 +3717,11 @@ sub make_item_rows {
my $count = 0;
foreach my $item (@{$ordered}) {
$count ++;
- $datatable .= &item_table_row_start($items->{$item}{text},$count);
+ if (exists $items->{$item}{advanced} && $items->{$item}{advanced} == 1) {
+ $datatable .= &item_table_row_start($items->{$item}{text},$count,"advanced");
+ } else {
+ $datatable .= &item_table_row_start($items->{$item}{text},$count);
+ }
if ($item eq 'nothideprivileged') {
$datatable .= ¬hidepriv_row($cdom,$item,$settings,$crstype);
} elsif ($item eq 'print_header_format') {
| | |