--- loncom/interface/loncommon.pm 2007/09/04 23:59:03 1.564.2.6 +++ loncom/interface/loncommon.pm 2007/08/23 21:54:40 1.566 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.564.2.6 2007/09/04 23:59:03 albertel Exp $ +# $Id: loncommon.pm,v 1.566 2007/08/23 21:54:40 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1084,6 +1084,67 @@ sub changable_area { =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 for the onload and onresize events. + + +=cut + +sub resize_textarea_js { + return <<"RESIZE"; + +RESIZE + +} + +=pod + =back =head1 Excel and CSV file utility routines @@ -3458,6 +3519,9 @@ sub bodytag { if (!$realm) { $realm=' '; } # Set messages 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); @@ -3575,7 +3639,7 @@ ENDROLE my $imgsrc = $img; if ($img =~ /^\/adm/) { - $imgsrc = &lonhttpdurl($img); + $imgsrc = 'http://'.$ENV{'HTTP_HOST'}.':'.$lonhttpdPort.$img; } my $upperleft=''.$function.''; @@ -5549,7 +5613,7 @@ sub get_secgrprole_info { } sub user_picker { - my ($dom,$srch,$forcenewuser,$caller) = @_; + my ($dom,$srch,$forcenewuser) = @_; my $currdom = $dom; my %curr_selected = ( srchin => 'dom', @@ -5582,15 +5646,6 @@ sub user_picker { 'instd' => 'in institutional directory', 'exact' => 'is', 'contains' => 'contains', - 'begins' => 'begins with', - 'youm' => "You must include some text to search for.", - 'thte' => "The text you are searching for must contain at least two characters when using a 'begins' type search.", - 'thet' => "The text you are searching for must contain at least three characters when using a 'contains' type search.", - 'yomc' => "You must choose a domain when using an institutional directory search.", - 'ymcd' => "You must choose a domain when using a domain search.", - 'whus' => "When using searching by last,first you must include a comma as separator between last name and first name.", - 'whse' => "When searching by last,first you must include at least one character in the first name.", - 'thfo' => "The following need to be corrected before the search can be run:", ); my $domform = &select_dom_form($currdom,'srchdomain',1,1); my $srchinsel = ' \n"; my $srchtypesel = ' &"').'" onclick="javascript:setSearch(\'1\','.$caller.');" />

'; + $new_user_create = '

&"').'" onclick="javascript:setSearch(\'1\');" />

'; $newuserscript = <<"ENDSCRIPT"; -function setSearch(createnew,callingForm) { +function setSearch(createnew) { if (createnew == 1) { - for (var i=0; i -function validateEntry(callingForm) { +function validateEntry() { var checkok = 1; var srchin; - for (var i=0; i{'crstype'}); } else { my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1}); - if ($env{'request.role.domain'} eq $args->{'clonedomain'}) { + if ($env{'request.role.domain'} eq $args->{'form.clonedomain'}) { $can_clone = 1; } else { my %clonehash = &Apache::lonnet::get('environment',['cloners'], @@ -7318,27 +7366,10 @@ sub icon { 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 { my ($url)=@_; - - my $lonhttpd_port = &lonhttpd_port(); - if ($lonhttpd_port == 443) { - return 'https://'.$ENV{'SERVER_NAME'}.$url; - } + my $lonhttpd_port=$Apache::lonnet::perlvar{'lonhttpdPort'}; + if (!defined($lonhttpd_port)) { $lonhttpd_port='8080'; } return 'http://'.$ENV{'SERVER_NAME'}.':'.$lonhttpd_port.$url; }