version 1.564.2.5, 2007/09/04 23:58:06
|
version 1.570, 2007/08/26 21:09:43
|
Line 1084 sub changable_area {
|
Line 1084 sub changable_area {
|
|
|
=pod |
=pod |
|
|
|
=item * resize_textarea_js |
|
|
|
emits the needed javascript to resize a textarea to be as big as possible |
|
|
|
creates a function resize_textrea that takes two IDs first should be |
|
the id of the element to resize, second should be the id of a div that |
|
surrounds everything that comes after the textarea, this routine needs |
|
to be attached to the <body> for the onload and onresize events. |
|
|
|
|
|
=cut |
|
|
|
sub resize_textarea_js { |
|
return <<"RESIZE"; |
|
<script type="text/javascript"> |
|
var Geometry = {}; |
|
function init_geometry() { |
|
if (Geometry.init) { return }; |
|
Geometry.init=1; |
|
if (window.innerHeight) { |
|
Geometry.getViewportHeight = function() { return window.innerHeight; }; |
|
} |
|
else if (document.documentElement && document.documentElement.clientHeight) { |
|
Geometry.getViewportHeight = |
|
function() { return document.documentElement.clientHeight; }; |
|
} |
|
else if (document.body.clientHeight) { |
|
Geometry.getViewportHeight = |
|
function() { return document.body.clientHeight; }; |
|
} |
|
} |
|
|
|
function resize_textarea(textarea_id,bottom_id) { |
|
init_geometry(); |
|
var textarea = document.getElementById(textarea_id); |
|
//alert(textarea); |
|
|
|
var textarea_top = textarea.offsetTop; |
|
var textarea_height = textarea.offsetHeight; |
|
var bottom = document.getElementById(bottom_id); |
|
var bottom_top = bottom.offsetTop; |
|
var bottom_height = bottom.offsetHeight; |
|
var window_height = Geometry.getViewportHeight(); |
|
var fudge = 23; |
|
var new_height = window_height-fudge-textarea_top-bottom_height; |
|
if (new_height < 300) { |
|
new_height = 300; |
|
} |
|
textarea.style.height=new_height+'px'; |
|
} |
|
</script> |
|
RESIZE |
|
|
|
} |
|
|
|
=pod |
|
|
=back |
=back |
|
|
=head1 Excel and CSV file utility routines |
=head1 Excel and CSV file utility routines |
Line 3458 sub bodytag {
|
Line 3515 sub bodytag {
|
if (!$realm) { $realm=' '; } |
if (!$realm) { $realm=' '; } |
# Set messages |
# Set messages |
my $messages=&domainlogo($domain); |
my $messages=&domainlogo($domain); |
|
# Port for miniserver |
|
my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'}; |
|
if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; } |
|
|
my $extra_body_attr = &make_attr_string($forcereg,\%design); |
my $extra_body_attr = &make_attr_string($forcereg,\%design); |
|
|
Line 3575 ENDROLE
|
Line 3635 ENDROLE
|
|
|
my $imgsrc = $img; |
my $imgsrc = $img; |
if ($img =~ /^\/adm/) { |
if ($img =~ /^\/adm/) { |
$imgsrc = &lonhttpdurl($img); |
$imgsrc = 'http://'.$ENV{'HTTP_HOST'}.':'.$lonhttpdPort.$img; |
} |
} |
my $upperleft='<img src="'.$imgsrc.'" alt="'.$function.'" />'; |
my $upperleft='<img src="'.$imgsrc.'" alt="'.$function.'" />'; |
|
|
Line 5549 sub get_secgrprole_info {
|
Line 5609 sub get_secgrprole_info {
|
} |
} |
|
|
sub user_picker { |
sub user_picker { |
my ($dom,$srch,$forcenewuser) = @_; |
my ($dom,$srch,$forcenewuser,$caller) = @_; |
my $currdom = $dom; |
my $currdom = $dom; |
my %curr_selected = ( |
my %curr_selected = ( |
srchin => 'dom', |
srchin => 'dom', |
Line 5632 sub user_picker {
|
Line 5692 sub user_picker {
|
my ($newuserscript,$new_user_create); |
my ($newuserscript,$new_user_create); |
|
|
if ($forcenewuser) { |
if ($forcenewuser) { |
$new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\');" /> </p>'; |
$new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" /> </p>'; |
$newuserscript = <<"ENDSCRIPT"; |
$newuserscript = <<"ENDSCRIPT"; |
|
|
function setSearch(createnew) { |
function setSearch(createnew,callingForm) { |
if (createnew == 1) { |
if (createnew == 1) { |
for (var i=0; i<document.crtuser.srchby.length; i++) { |
for (var i=0; i<callingForm.srchby.length; i++) { |
if (document.crtuser.srchby.options[i].value == 'uname') { |
if (callingForm.srchby.options[i].value == 'uname') { |
document.crtuser.srchby.selectedIndex = i; |
callingForm.srchby.selectedIndex = i; |
} |
} |
} |
} |
for (var i=0; i<document.crtuser.srchin.length; i++) { |
for (var i=0; i<callingForm.srchin.length; i++) { |
if ( document.crtuser.srchin.options[i].value == 'dom') { |
if ( callingForm.srchin.options[i].value == 'dom') { |
document.crtuser.srchin.selectedIndex = i; |
callingForm.srchin.selectedIndex = i; |
} |
} |
} |
} |
for (var i=0; i<document.crtuser.srchtype.length; i++) { |
for (var i=0; i<callingForm.srchtype.length; i++) { |
if (document.crtuser.srchtype.options[i].value == 'exact') { |
if (callingForm.srchtype.options[i].value == 'exact') { |
document.crtuser.srchtype.selectedIndex = i; |
callingForm.srchtype.selectedIndex = i; |
} |
} |
} |
} |
for (var i=0; i<document.crtuser.srchdomain.length; i++) { |
for (var i=0; i<callingForm.srchdomain.length; i++) { |
if (document.crtuser.srchdomain.options[i].value == '$env{'request.role.domain'}') { |
if (callingForm.srchdomain.options[i].value == '$env{'request.role.domain'}') { |
document.crtuser.srchdomain.selectedIndex = i; |
callingForm.srchdomain.selectedIndex = i; |
} |
} |
} |
} |
} |
} |
Line 5665 ENDSCRIPT
|
Line 5725 ENDSCRIPT
|
|
|
my $output = <<"END_BLOCK"; |
my $output = <<"END_BLOCK"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
function validateEntry() { |
function validateEntry(callingForm) { |
|
|
var checkok = 1; |
var checkok = 1; |
var srchin; |
var srchin; |
for (var i=0; i<document.crtuser.srchin.length; i++) { |
for (var i=0; i<callingForm.srchin.length; i++) { |
if ( document.crtuser.srchin[i].checked ) { |
if ( callingForm.srchin[i].checked ) { |
srchin = document.crtuser.srchin[i].value; |
srchin = callingForm.srchin[i].value; |
} |
} |
} |
} |
|
|
var srchtype = document.crtuser.srchtype.options[document.crtuser.srchtype.selectedIndex].value; |
var srchtype = callingForm.srchtype.options[callingForm.srchtype.selectedIndex].value; |
var srchby = document.crtuser.srchby.options[document.crtuser.srchby.selectedIndex].value; |
var srchby = callingForm.srchby.options[callingForm.srchby.selectedIndex].value; |
var srchdomain = document.crtuser.srchdomain.options[document.crtuser.srchdomain.selectedIndex].value; |
var srchdomain = callingForm.srchdomain.options[callingForm.srchdomain.selectedIndex].value; |
var srchterm = document.crtuser.srchterm.value; |
var srchterm = callingForm.srchterm.value; |
var srchin = document.crtuser.srchin.options[document.crtuser.srchin.selectedIndex].value; |
var srchin = callingForm.srchin.options[callingForm.srchin.selectedIndex].value; |
var msg = ""; |
var msg = ""; |
|
|
if (srchterm == "") { |
if (srchterm == "") { |
Line 5727 function validateEntry() {
|
Line 5787 function validateEntry() {
|
return; |
return; |
} |
} |
if (checkok == 1) { |
if (checkok == 1) { |
document.crtuser.submit(); |
callingForm.submit(); |
} |
} |
} |
} |
|
|
Line 7310 sub icon {
|
Line 7370 sub icon {
|
return &lonhttpdurl($iconname); |
return &lonhttpdurl($iconname); |
} |
} |
|
|
sub lonhttpd_port { |
|
my $lonhttpd_port=$Apache::lonnet::perlvar{'lonhttpdPort'}; |
|
if (!defined($lonhttpd_port)) { $lonhttpd_port='8080'; } |
|
# IE doesn't like a secure page getting images from a non-secure |
|
# port (when logging we haven't parsed the browser type so default |
|
# back to secure |
|
if ((!exists($env{'browser.type'}) || $env{'browser.type'} eq 'explorer') |
|
&& $ENV{'SERVER_PORT'} == 443) { |
|
return 443; |
|
} |
|
return $lonhttpd_port; |
|
|
|
} |
|
|
|
sub lonhttpdurl { |
sub lonhttpdurl { |
my ($url)=@_; |
my ($url)=@_; |
|
my $lonhttpd_port=$Apache::lonnet::perlvar{'lonhttpdPort'}; |
my $lonhttpd_port = &lonhttpd_port(); |
if (!defined($lonhttpd_port)) { $lonhttpd_port='8080'; } |
if ($lonhttpd_port == 443) { |
|
return 'https://'.$ENV{'SERVER_NAME'}.$url; |
|
} |
|
return 'http://'.$ENV{'SERVER_NAME'}.':'.$lonhttpd_port.$url; |
return 'http://'.$ENV{'SERVER_NAME'}.':'.$lonhttpd_port.$url; |
} |
} |
|
|