version 1.312, 2012/05/04 19:03:18
|
version 1.313, 2012/05/09 19:46:30
|
Line 1874 returns: nothing
|
Line 1874 returns: nothing
|
my @row_count; |
my @row_count; |
|
|
sub start_pick_box { |
sub start_pick_box { |
my ($css_class) = @_; |
my ($css_class,$id) = @_; |
if (defined($css_class)) { |
if (defined($css_class)) { |
$css_class = 'class="'.$css_class.'"'; |
$css_class = 'class="'.$css_class.'"'; |
} else { |
} else { |
$css_class= 'class="LC_pick_box"'; |
$css_class= 'class="LC_pick_box"'; |
} |
} |
|
my $table_id; |
|
if (defined($id)) { |
|
$table_id = ' id="'.$id.'"'; |
|
} |
unshift(@row_count,0); |
unshift(@row_count,0); |
my $output = <<"END"; |
my $output = <<"END"; |
<table $css_class> |
<table $css_class $table_id> |
END |
END |
return $output; |
return $output; |
} |
} |
Line 2214 sub resource_info_box {
|
Line 2218 sub resource_info_box {
|
# 1. number to display. |
# 1. number to display. |
# If input for number is empty only the title will be displayed. |
# If input for number is empty only the title will be displayed. |
# 2. title text to display. |
# 2. title text to display. |
|
# 3. optional id for the <div> |
# Outputs - a scalar containing html mark-up for the div. |
# Outputs - a scalar containing html mark-up for the div. |
|
|
sub topic_bar { |
sub topic_bar { |
my ($num,$title) = @_; |
my ($num,$title,$id) = @_; |
my $number = ''; |
my $number = ''; |
if ($num ne '') { |
if ($num ne '') { |
$number = '<span>'.$num.'</span>'; |
$number = '<span>'.$num.'</span>'; |
} |
} |
return '<div class="LC_topic_bar">'.$number.$title.'</div>'; |
if ($id ne '') { |
|
$id = 'id="'.$id.'"'; |
|
} |
|
return '<div class="LC_topic_bar" '.$id.'>'.$number.$title.'</div>'; |
} |
} |
|
|
############################################## |
############################################## |
Line 2685 ENDSCRIPT
|
Line 2693 ENDSCRIPT
|
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
|
sub resize_scrollbox_js { |
|
my ($context,$tabidstr) = @_; |
|
my (%names,$paddingwfrac,$offsetwfrac,$offsetv,$minw,$minv); |
|
if ($context eq 'docs') { |
|
%names = ( |
|
boxw => 'contenteditor', |
|
item => 'contentlist', |
|
header => 'uploadfileresult', |
|
scroll => 'contentscroll', |
|
boxh => 'contenteditor', |
|
); |
|
$paddingwfrac = 0.09; |
|
$offsetwfrac = 0.015; |
|
$offsetv = 20; |
|
$minw = 250; |
|
$minv = 200; |
|
} elsif ($context eq 'params') { |
|
%names = ( |
|
boxw => 'parameditor', |
|
item => 'mapmenuinner', |
|
header => 'parmstep1', |
|
scroll => 'mapmenuscroll', |
|
boxh => 'parmlevel', |
|
); |
|
$paddingwfrac = 0.2; |
|
$offsetwfrac = 0.015; |
|
$offsetv = 80; |
|
$minw = 100; |
|
$minv = 100; |
|
} |
|
my $viewport_js = &Apache::loncommon::viewport_geometry_js(); |
|
my $output = ' |
|
|
|
window.onresize=callResize; |
|
|
|
'; |
|
if ($context eq 'docs') { |
|
$output .= ' |
|
var activeTab; |
|
'; |
|
} |
|
$output .= <<"FIRST"; |
|
|
|
$viewport_js |
|
|
|
function resize_scrollbox(scrollboxname,chkw,chkh) { |
|
var scrollboxid = 'div_'+scrollboxname; |
|
var scrolltableid = 'table_'+scrollboxname; |
|
var scrollbox; |
|
var scrolltable; |
|
|
|
if (document.getElementById("$names{'boxw'}") == null) { |
|
return; |
|
} |
|
|
|
if (document.getElementById(scrollboxid) == null) { |
|
return; |
|
} else { |
|
scrollbox = document.getElementById(scrollboxid); |
|
} |
|
|
|
|
|
if (document.getElementById(scrolltableid) == null) { |
|
return; |
|
} else { |
|
scrolltable = document.getElementById(scrolltableid); |
|
} |
|
|
|
init_geometry(); |
|
var vph = Geometry.getViewportHeight(); |
|
var vpw = Geometry.getViewportWidth(); |
|
|
|
FIRST |
|
if ($context eq 'docs') { |
|
$output .= " |
|
var alltabs = ['$tabidstr']; |
|
"; |
|
} elsif ($context eq 'params') { |
|
$output .= " |
|
if (document.getElementById('$names{'boxh'}') == null) { |
|
return; |
|
} |
|
"; |
|
} |
|
$output .= <<"SECOND"; |
|
var listwchange; |
|
if (chkw == 1) { |
|
var boxw = document.getElementById("$names{'boxw'}").offsetWidth; |
|
var itemw; |
|
var itemid = document.getElementById("$names{'item'}"); |
|
if (itemid != null) { |
|
itemw = itemid.offsetWidth; |
|
} |
|
var itemwstart = itemw; |
|
|
|
var scrollboxw = scrollbox.offsetWidth; |
|
var scrollboxscrollw = scrollbox.scrollWidth; |
|
|
|
var offsetw = parseInt(vpw * $offsetwfrac); |
|
var paddingw = parseInt(vpw * $paddingwfrac); |
|
|
|
var minscrollboxw = $minw; |
|
var maxcolw = 0; |
|
SECOND |
|
if ($context eq 'docs') { |
|
$output .= <<"DOCSONE"; |
|
var actabw = 0; |
|
for (var i=0; i<alltabs.length; i++) { |
|
if (activeTab == alltabs[i]) { |
|
actabw = document.getElementById(alltabs[i]).offsetWidth; |
|
if (actabw > maxcolw) { |
|
maxcolw = actabw; |
|
} |
|
} else { |
|
if (document.getElementById(alltabs[i]) != null) { |
|
var thistab = document.getElementById(alltabs[i]); |
|
thistab.style.visibility = 'hidden'; |
|
thistab.style.display = 'block'; |
|
var tabw = document.getElementById(alltabs[i]).offsetWidth; |
|
thistab.style.display = 'none'; |
|
thistab.style.visibility = ''; |
|
if (tabw > maxcolw) { |
|
maxcolw = tabw; |
|
} |
|
} |
|
} |
|
} |
|
DOCSONE |
|
} elsif ($context eq 'params') { |
|
$output .= <<"PARAMSONE"; |
|
var parmlevelrows = new Array(); |
|
var mapmenucells = new Array(); |
|
parmlevelrows = document.getElementById("$names{'boxh'}").rows; |
|
var numrows = parmlevelrows.length; |
|
if (numrows > 1) { |
|
mapmenucells = parmlevelrows[2].getElementsByTagName('td'); |
|
} |
|
maxcolw = mapmenucells[0].offsetWidth; |
|
PARAMSONE |
|
} |
|
$output .= <<"THIRD"; |
|
if (maxcolw > 0) { |
|
var newscrollboxw; |
|
if (maxcolw+paddingw+scrollboxscrollw<boxw) { |
|
newscrollboxw = boxw-paddingw-maxcolw; |
|
if (newscrollboxw < minscrollboxw) { |
|
newscrollboxw = minscrollboxw; |
|
} |
|
scrollbox.style.width = newscrollboxw+"px"; |
|
if (newscrollboxw != scrollboxw) { |
|
var newitemw = newscrollboxw-offsetw; |
|
itemid.style.width = newitemw+"px"; |
|
} |
|
} else { |
|
newscrollboxw = boxw-paddingw-maxcolw; |
|
if (newscrollboxw < minscrollboxw) { |
|
newscrollboxw = minscrollboxw; |
|
} |
|
scrollbox.style.width = newscrollboxw+"px"; |
|
if (newscrollboxw != scrollboxw) { |
|
var newitemw = newscrollboxw-offsetw; |
|
itemid.style.width = newitemw+"px"; |
|
} |
|
} |
|
|
|
if (newscrollboxw != scrollboxw) { |
|
var newscrolltablew = newscrollboxw+offsetw; |
|
scrolltable.style.width = newscrolltablew+"px"; |
|
} |
|
} |
|
|
|
if (itemid.offsetWidth != itemwstart) { |
|
listwchange = 1; |
|
} |
|
THIRD |
|
if ($context eq 'docs') { |
|
$output .= <<"DOCSTWO"; |
|
if (activeTab == 'cc1') { |
|
if (document.getElementById('cc_hrule') != null) { |
|
document.getElementById('cc_hrule').style.width=actabw+"px"; |
|
} |
|
} else { |
|
if (activeTab == 'bb1') { |
|
if (document.getElementById('bb_hrule') != null) { |
|
document.getElementById('bb_hrule').style.width=actabw+"px"; |
|
} |
|
} else { |
|
if (activeTab == 'ee2') { |
|
if (document.getElementById('ee_hrule') != null) { |
|
document.getElementById('ee_hrule').style.width=actabw+"px"; |
|
} |
|
} |
|
} |
|
} |
|
DOCSTWO |
|
} |
|
$output .= <<"FOURTH"; |
|
} |
|
if ((chkh == 1) || (listwchange)) { |
|
var primaryheight = document.getElementById('LC_nav_bar').offsetHeight; |
|
var secondaryheight = document.getElementById('LC_secondary_menu').offsetHeight; |
|
var crumbsheight = document.getElementById('LC_breadcrumbs').offsetHeight; |
|
var dccidheight = 0; |
|
if (document.getElementById('dccid') != null) { |
|
dccidheight = document.getElementById('dccid').offsetHeight; |
|
} |
|
var headerheight = 0; |
|
if (document.getElementById("$names{'header'}") != null) { |
|
headerheight = document.getElementById("$names{'header'}").offsetHeight; |
|
} |
|
var tabbedheight = document.getElementById("tabbededitor").offsetHeight; |
|
var boxheight = document.getElementById("$names{'boxh'}").offsetHeight; |
|
var freevspace = vph-(primaryheight+secondaryheight+crumbsheight+dccidheight+headerheight+tabbedheight+boxheight); |
|
|
|
var scrollboxheight = scrollbox.offsetHeight; |
|
var scrollboxscrollheight = scrollbox.scrollHeight; |
|
|
|
var minvscrollbox = $minv; |
|
var offsetv = $offsetv; |
|
var newscrollboxheight; |
|
if (freevspace < 0) { |
|
newscrollboxheight = scrollboxheight+freevspace-offsetv; |
|
if (newscrollboxheight < minvscrollbox) { |
|
newscrollboxheight = minvscrollbox; |
|
} |
|
scrollbox.style.height = newscrollboxheight + "px"; |
|
} else { |
|
if (scrollboxscrollheight > scrollboxheight) { |
|
if (freevspace > offsetv) { |
|
newscrollboxheight = scrollboxheight+freevspace-offsetv; |
|
if (newscrollboxheight < minvscrollbox) { |
|
newscrollboxheight = minvscrollbox; |
|
} |
|
scrollbox.style.height = newscrollboxheight+"px"; |
|
} |
|
} |
|
} |
|
scrollboxheight = scrollbox.offsetHeight; |
|
var itemh = document.getElementById("$names{'item'}").offsetHeight; |
|
|
|
if (scrollboxscrollheight <= scrollboxheight) { |
|
if ((itemh+offsetv)<scrollboxheight) { |
|
newscrollheight = itemh+offsetv; |
|
scrollbox.style.height = newscrollheight+"px"; |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function callResize() { |
|
var timer; |
|
clearTimeout(timer); |
|
timer=setTimeout('resize_scrollbox("$names{'scroll'}","1","1")',500); |
|
} |
|
|
|
FOURTH |
|
return $output; |
|
} |
|
|
|
|
|
############################################## |
|
############################################## |
|
|
# javascript_valid_email |
# javascript_valid_email |
# |
# |