[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm loncommon.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 05 Apr 2007 21:36:17 -0000
This is a MIME encoded message
--raeburn1175808978
Content-Type: text/plain
raeburn Thu Apr 5 17:36:18 2007 EDT
Modified files:
/loncom/interface loncommon.pm domainprefs.pm
Log:
- loncommon.pm
- Fix perldoc
- Delay preepnding lonhttpdurl prefix to domlogo design until creation of the img tag.
- Add a nobreak span to LC CSS to replace <nobr></nobr>
- domainprefs.pm
- Add <label></label>
- Replace <nobr></nobr>
- Remove surplus tags identified by XHTML validation
--raeburn1175808978
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20070405173618.txt"
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.518 loncom/interface/loncommon.pm:1.519
--- loncom/interface/loncommon.pm:1.518 Tue Apr 3 20:10:01 2007
+++ loncom/interface/loncommon.pm Thu Apr 5 17:36:15 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.518 2007/04/04 00:10:01 albertel Exp $
+# $Id: loncommon.pm,v 1.519 2007/04/05 21:36:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1272,6 +1272,12 @@
=pod
+=head1 Routines for form select boxes
+
+=over 4
+
+=cut
+
=item * multiple_select_form($name,$value,$size,$hash,$order)
Returns a string containing a <select> element int multiple mode
@@ -1461,8 +1467,6 @@
=pod
-=back
-
=cut
###############################################################
@@ -3218,8 +3222,7 @@
}
}
if (-e '/home/httpd/html/adm/lonDomLogos/'.$udom.'.gif') {
- $designhash{$udom.'.login.domlogo'} =
- &lonhttpdurl("/adm/lonDomLogos/$udom.gif");
+ $designhash{$udom.'.login.domlogo'} = "/adm/lonDomLogos/$udom.gif";
}
}
&Apache::lonnet::do_cache_new('domainconfig',$udom,\%designhash,
@@ -3244,8 +3247,11 @@
my %designhash = &get_domainconf($domain);
# See if there is a logo
if ($designhash{$domain.'.login.domlogo'} ne '') {
- return '<img src="'.$designhash{$domain.'.login.domlogo'}.
- '" alt="'.$domain.'" />';
+ my $imgsrc = $designhash{$domain.'.login.domlogo'};
+ if ($imgsrc =~ /^\/adm/) {
+ $imgsrc = &lonhttpdurl($imgsrc);
+ }
+ return '<img src="'.$imgsrc.'" alt="'.$domain.'" />';
} elsif (defined(&Apache::lonnet::domain($domain,'description'))) {
return &Apache::lonnet::domain($domain,'description');
} else {
@@ -4275,6 +4281,10 @@
white-space: pre;
}
+span.LC_nobreak {
+ white-space: nowrap;
+}
+
END
}
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.7 loncom/interface/domainprefs.pm:1.8
--- loncom/interface/domainprefs.pm:1.7 Tue Apr 3 20:10:01 2007
+++ loncom/interface/domainprefs.pm Thu Apr 5 17:36:15 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.7 2007/04/04 00:10:01 albertel Exp $
+# $Id: domainprefs.pm,v 1.8 2007/04/05 21:36:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -139,10 +139,6 @@
$item,$domconfig{$item->{'action'}});
}
$r->print('
- </table>
- </td>
- </tr>
- </table>
</td>
</tr>
</table>');
@@ -277,7 +273,7 @@
$js));
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Domain Settings'));
$r->print('
-<form name="parmform">
+<form name="parmform" action="">
<input type="hidden" name="pres_marker" />
<input type="hidden" name="pres_type" />
<input type="hidden" name="pres_value" />
@@ -360,23 +356,16 @@
}
}
} else {
- $designs{'domlogo'} = '';
- if (-e '/home/httpd/html/adm/lonDomLogos/'.$dom.'.gif') {
- $designs{'domlogo'} = '/home/httpd/html/adm/lonDomLogos/'.$dom.'.gif';
- $is_custom{'domlogo'} = 1;
- }
- if ($designhash{$dom.'.login.img'} ne '') {
- $designs{'img'} = $designhash{$dom.'.login.img'};
- $is_custom{'img'} = 1;
- }
- if ($designhash{$dom.'.login.logo'} ne '') {
- $designs{'logo'} = $designhash{$dom.'.login.logo'};
- $is_custom{'logo'} = 1;
- }
if ($designhash{$dom.'.login.font'} ne '') {
$designs{'font'} = $designhash{$dom.'.login.font'};
$is_custom{'font'} = 1;
}
+ foreach my $item (@images) {
+ if ($designhash{$dom.'.login.'.$item} ne '') {
+ $designs{$item} = $designhash{$dom.'.login.'.$item};
+ $is_custom{$item} = 1;
+ }
+ }
foreach my $item (@bgs) {
if ($designhash{$dom.'.login.'.$item} ne '') {
$designs{'bgs'}{$item} = $designhash{$dom.'.login.'.$item};
@@ -398,20 +387,20 @@
my $datatable =
'<tr'.$css_class.'><td colspan="2">'.$choices{'coursecatalog'}.
'</td><td>'.
- '<nobr><input type="radio" name="coursecatalog"'.
- $catalogon.' value="1" />'.&mt('Yes').' '.
- '<input type="radio" name="coursecatalog"'.
- $catalogoff.'value="0" />'.&mt('No').'</nobr></td>'.
+ '<span class="LC_nobreak"><label><input type="radio" name="coursecatalog"'.
+ $catalogon.' value="1" />'.&mt('Yes').'</label> '.
+ '<label><input type="radio" name="coursecatalog"'.
+ $catalogoff.'value="0" />'.&mt('No').'</label></span></td>'.
'</tr>';
$itemcount ++;
$css_class = $itemcount%2?' class="LC_odd_row"':'';
$datatable .= '<tr'.$css_class.'>'.
'<td colspan="2">'.$choices{'adminmail'}.'</td>'.
- '<td><nobr>'.
- '<input type="radio" name="adminmail"'.
- $adminmailon.' value="1" />'.&mt('Yes').' '.
- '<input type="radio" name="adminmail"'.
- $adminmailoff.'value="0" />'.&mt('No').'</nobr></td>';
+ '<td><span class="LC_nobreak">'.
+ '<label><input type="radio" name="adminmail"'.
+ $adminmailon.' value="1" />'.&mt('Yes').'</label> '.
+ '<label><input type="radio" name="adminmail"'.
+ $adminmailoff.'value="0" />'.&mt('No').'</label></span></td></tr>';
$itemcount ++;
$datatable .= &display_color_options($dom,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text);
$datatable .= '</tr></table></td></tr>';
@@ -506,7 +495,7 @@
}
}
my $itemcount = 1;
- my $datatable = display_color_options($dom,$phase,$role,$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text);
+ my $datatable = &display_color_options($dom,$phase,$role,$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text);
$datatable .= '</tr></table></td></tr>';
return $datatable;
}
@@ -524,14 +513,14 @@
$datatable .= '<td> </td>';
}
my $fontlink = &color_pick($phase,$role,'font',$choices->{'font'},$designs->{'font'});
- $datatable .= '<td><nobr>'.
+ $datatable .= '<td><span class="LC_nobreak">'.
'<input type="text" size="10" name="'.$role.'_font"'.
- ' value="'.$designs->{'font'}.'" /> '.$fontlink.
- '</nobr></td></tr>';
+ ' value="'.$designs->{'font'}.'" /> '.$fontlink.
+ '</span></td></tr>';
foreach my $img (@{$images}) {
$itemcount ++;
$css_class = $itemcount%2?' class="LC_odd_row"':'';
- $datatable .= '</tr><tr'.$css_class.'>'.
+ $datatable .= '<tr'.$css_class.'>'.
'<td>'.$choices->{$img}.'</td>';
my $imgfile;
if ($designs->{$img} ne '') {
@@ -578,8 +567,9 @@
$datatable.= '<img src="'.$showfile.'" alt="'.
$alt_text->{$img}.'" /></td>';
if ($is_custom->{$img}) {
- $datatable.='<td><nobr><input type="checkbox" name="'.$role.'_del_'.$img.'" value="1">'.
- &mt('Delete?').' '.&mt('Replace:').'</nobr><br />';
+ $datatable.='<td><span class="LC_nobreak"><label><input type="checkbox" name="'.
+ $role.'_del_'.$img.'" value="1" />'.&mt('Delete?').
+ '</label> '.&mt('Replace:').'</span><br />';
} else {
$datatable.='<td valign="bottom">'.&mt('Upload:').'<br />';
}
@@ -591,7 +581,7 @@
$datatable .= '<td colspan="2" class="LC_right_item"><br />'.
&mt('Upload:');
}
- $datatable .= ' <input type="file" name="'.$role.'_'.$img.'" /></nobr></td></tr>';
+ $datatable .= ' <input type="file" name="'.$role.'_'.$img.'" /></td></tr>';
}
$itemcount ++;
$css_class = $itemcount%2?' class="LC_odd_row"':'';
@@ -604,7 +594,7 @@
}
}
if ($bgs_def) {
- $datatable .= '<td>'.&mt('Default(s) in use').'<br /><table border="0"><tr>'.$bgs_def.'</tr></table></td>';
+ $datatable .= '<td>'.&mt('Default(s) in use:').'<br /><table border="0"><tr>'.$bgs_def.'</tr></table></td>';
} else {
$datatable .= '<td> </td>';
}
@@ -631,7 +621,7 @@
}
}
if ($links_def) {
- $datatable .= '<td>'.&mt('Default(s) in use').'<br /><table border="0"><tr>'.$links_def.'</tr></table></td>';
+ $datatable .= '<td>'.&mt('Default(s) in use:').'<br /><table border="0"><tr>'.$links_def.'</tr></table></td>';
} else {
$datatable .= '<td> </td>';
}
@@ -710,10 +700,10 @@
$css_class = $typecount%2?' class="LC_odd_row"':'';
$datatable .= '<tr'.$css_class.'>'.
'<td>'.$usertypes->{$type}.'</td>'.
- '<td class="LC_right_item"><nobr>'.
+ '<td class="LC_right_item"><span class="LC_nobreak">'.
'<input type="text" name="quota_'.$type.
'" value="'.$settings->{$type}.
- '" size="5" /> Mb</nobr></td></tr>';
+ '" size="5" /> Mb</span></td></tr>';
}
}
$othertitle = "Other users";
@@ -728,9 +718,9 @@
$css_class = $typecount%2?' class="LC_odd_row"':'';
$datatable .= '<tr'.$css_class.'>'.
'<td>'.&mt($othertitle).'</td>'.
- '<td class="LC_right_item"><nobr>'.
+ '<td class="LC_right_item"><span class="LC_nobreak">'.
'<input type="text" name="default" value="'.
- $defaultquota.'" size="5" /> Mb</nobr></td></tr>';
+ $defaultquota.'" size="5" /> Mb</span></td></tr>';
return $datatable;
}
@@ -764,19 +754,19 @@
my $domform = &Apache::loncommon::select_dom_form($defdom,'sender_domain',1);
my $datatable='<tr class="LC_odd_row">'.
'<td>'.&mt('Auto-enrollment active?').'</td>'.
- '<td class="LC_right_item"><nobr>'.
+ '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
'<input type="radio" name="autoenroll_run"'.
- $runon.' value="1" />'.&mt('Yes').' '.
- '<input type="radio" name="autoenroll_run"'.
- $runoff.'value="0" />'.&mt('No').'</nobr></td>'.
+ $runon.' value="1" />'.&mt('Yes').'</label> '.
+ '<label><input type="radio" name="autoenroll_run"'.
+ $runoff.'value="0" />'.&mt('No').'</label></span></td>'.
'</tr><tr>'.
'<td>'.&mt('Notification messages - sender').
- '</td><td class="LC_right_item"><nobr>'.
+ '</td><td class="LC_right_item"><span class="LC_nobreak">'.
&mt('username').': '.
'<input type="text" name="sender_uname" value="'.
$settings->{'sender_uname'}.
'" size="10" /> '.&mt('domain').
- ': '.$domform.'</nobr></td></tr>';
+ ': '.$domform.'</span></td></tr>';
return $datatable;
}
@@ -804,18 +794,18 @@
);
$datatable = '<tr class="LC_odd_row">'.
'<td>'.&mt($title{'run'}).'</td>'.
- '<td class="LC_right_item"><nobr>'.
- '<input type="radio" name="autoupdate_run"'.
- $updateon.' value="1" />'.&mt('Yes').' '.
+ '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
'<input type="radio" name="autoupdate_run"'.
- $updateoff.'value="0" />'.&mt('No').'</nobr></td>'.
+ $updateon.' value="1" />'.&mt('Yes').'</label> '.
+ '<label><input type="radio" name="autoupdate_run"'.
+ $updateoff.'value="0" />'.&mt('No').'</label></span></td>'.
'</tr><tr>'.
'<td>'.&mt($title{'classlists'}).'</td>'.
- '<td class="LC_right_item"><nobr>'.
- '<input type="radio" name="classlists"'.
- $classlistson.' value="1" />'.&mt('Yes').' '.
- '<input type="radio" name="classlists"'.
- $classlistsoff.'value="0" />'.&mt('No').'</nobr></td>'.
+ '<td class="LC_right_item"><span class="LC_nobreak">'.
+ '<label><input type="radio" name="classlists"'.
+ $classlistson.' value="1" />'.&mt('Yes').'</label> '.
+ '<label><input type="radio" name="classlists"'.
+ $classlistsoff.'value="0" />'.&mt('No').'</label></span></td>'.
'</tr>';
} else {
my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($dom);
@@ -892,10 +882,10 @@
} else {
$datatable .= '<td>';
}
- $datatable .= '<nobr><input type="checkbox" name="updateable_'.
- $type.'_'.$fields->[$i].'" '.
- '" value="1"'.$check.'/>'.
- $fieldtitles->{$fields->[$i]}.'</nobr></td>';
+ $datatable .= '<span class="LC_nobreak"><label>'.
+ '<input type="checkbox" name="updateable_'.$type.
+ '_'.$fields->[$i].'" value="1"'.$check.'/>'.
+ $fieldtitles->{$fields->[$i]}.'</label></span></td>';
}
$datatable .= '</tr></table></td></tr>';
}
@@ -1017,7 +1007,7 @@
foreach my $item (@bgs,@links) {
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item};
}
- foreach my $img (@images) {
+ foreach my $img (@images) {
if ($env{'form.'.$role.'_'.$img.'.filename'} ne '') {
my $configuserok;
if (&Apache::lonnet::homeserver($configuname,$dom) eq 'no_host') {
@@ -1043,8 +1033,12 @@
}
} else {
my $error = &mt("Upload of image [_1] for $role page(s) failed because a Domain Configuation user ([_2]) could not be created in domain: [_3]. Error was: [_4].",$img,$configuname,$dom,$configuserok);
- &Apache::lonnet::logthis($error);
- $errors .= '<li>'.$error.'</li>';
+ &Apache::lonnet::logthis($error);
+ $errors .= '<li>'.$error.'</li>';
+ }
+ } elsif ($domconfig->{$role}{$img} ne '') {
+ if ($domconfig->{$role}{$img} !~ m|^/uploaded/\Q$dom\E/\Q$dom\E\-domainconfig/portfolio/\$img/.+|) {
+ #FIXME copy file to target directory
}
}
}
--raeburn1175808978--