pageHeader()
->addInlineJavascript('var pastefield; function paste_id(value) { pastefield.value=value; }') // For the 'find indi' link
->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
if (WT_USE_LIGHTBOX) {
$album = new lightbox_WT_Module();
$album->getPreLoadContent();
}
echo '
'. $controller->getPageTitle(). '
';
if ($controller->error_message) {
echo '
', $controller->error_message, '
';
exit;
}
echo '
';
//-- echo the boxes
$curgen = 1;
$xoffset = 0;
$yoffset = 0; // -- used to offset the position of each box as it is generated
$prevxoffset = 0; // -- used to track the horizontal x position of the previous box
$prevyoffset = 0; // -- used to track the vertical y position of the previous box
$maxyoffset = 0;
$lineDrawx = array(); // -- used to position joining lines on
'; //close #pedigree_chart
echo '
'; //close #pedigree-page
// Expand to include the absolutely-positioned elements.
$controller->addInlineJavascript('
content_div = document.getElementById("content");
if (content_div) {
content_div.style.height="'.($maxyoffset+30).'px";
}
// Draw joining lines in
// need to be able to read styles from style.css files
function getStyle(oElm, strCssRule){
var strValue = "";
if(document.defaultView && document.defaultView.getComputedStyle){
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
}
else if(oElm.currentStyle){
strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
return p1.toUpperCase();
});
strValue = oElm.currentStyle[strCssRule];
}
return strValue;
}
// Set variables
var c=document.getElementById("pedigree_canvas");
var ctx=c.getContext("2d");
var textdirection = "'.$TEXT_DIRECTION.'";
var talloffset = '.$talloffset.';
var canvaswidth = '.($canvaswidth).';
var offset_x = 20;
var offset_y = '.$controller->pbheight.'/2+'.$controller->linewidth.';
var lineDrawx = new Array("'. join(array_reverse ($lineDrawx),'","'). '");
var lineDrawy = new Array("'. join(array_reverse ($lineDrawy),'","'). '");
var offset_x2 = '.$controller->pbwidth.'/2+'.$controller->linewidth.';
var offset_y2 = '.$controller->pbheight.'*2;
var lineDrawx2 = new Array("'. join($lineDrawx,'","'). '");
var lineDrawy2 = new Array("'. join($lineDrawy,'","'). '");
var maxjoins = Math.pow(2,'.$PEDIGREE_GENERATIONS.');
//Draw the lines
if (talloffset < 2) { // landscape and portrait styles
for (var i = 0; i <= maxjoins-3; i++) {
if(i%2==0){
if (textdirection == "rtl") {
ctx.moveTo(canvaswidth-lineDrawx[i],lineDrawy[i]-0+offset_y+offset_x/2);
ctx.lineTo(canvaswidth-lineDrawx[i]+offset_x,lineDrawy[i]-0+offset_y+offset_x/2);
ctx.lineTo(canvaswidth-lineDrawx[i+1]+offset_x,lineDrawy[i+1]-0+offset_y-offset_x/2);
ctx.lineTo(canvaswidth-lineDrawx[i+1],lineDrawy[i+1]-0+offset_y-offset_x/2);
} else {
ctx.moveTo(lineDrawx[i],lineDrawy[i]-0+offset_y+offset_x/2);
ctx.lineTo(lineDrawx[i]-offset_x,lineDrawy[i]-0+offset_y+offset_x/2);
ctx.lineTo(lineDrawx[i+1]-offset_x,lineDrawy[i+1]-0+offset_y-offset_x/2);
ctx.lineTo(lineDrawx[i+1],lineDrawy[i+1]-0+offset_y-offset_x/2);
}
}
}
}
if (talloffset == 2) { // oldest at top
for (var i = 0; i <= maxjoins; i++) {
if(i%2!=0){
if (textdirection == "rtl") {
ctx.moveTo(lineDrawx2[i]-0+offset_x2-offset_x,lineDrawy2[i]);
ctx.lineTo(lineDrawx2[i]-0+offset_x2-offset_x,lineDrawy2[i]-0+offset_y2);
ctx.lineTo(lineDrawx2[i+1]-0+offset_x2+offset_x/2,lineDrawy2[i]-0+offset_y2);
ctx.lineTo(lineDrawx2[i+1]-0+offset_x2+offset_x/2,lineDrawy2[i]);
} else {
ctx.moveTo(lineDrawx2[i]-0+offset_x2-offset_x/2,lineDrawy2[i]);
ctx.lineTo(lineDrawx2[i]-0+offset_x2-offset_x/2,lineDrawy2[i]-0+offset_y2);
ctx.lineTo(lineDrawx2[i+1]-0+offset_x2+offset_x/2,lineDrawy2[i]-0+offset_y2);
ctx.lineTo(lineDrawx2[i+1]-0+offset_x2+offset_x/2,lineDrawy2[i]);
}
}
}
}
if (talloffset == 3) { // oldest at bottom
for (var i = 0; i <= maxjoins; i++) {
if(i%2!=0){
ctx.moveTo(lineDrawx2[i]-0+offset_x2-offset_x,lineDrawy2[i]);
ctx.lineTo(lineDrawx2[i]-0+offset_x2-offset_x,lineDrawy2[i]-offset_y2/2);
ctx.lineTo(lineDrawx2[i+1]-0+offset_x2+offset_x/2,lineDrawy2[i]-offset_y2/2);
ctx.lineTo(lineDrawx2[i+1]-0+offset_x2+offset_x/2,lineDrawy2[i]);
}
}
}
// Set line styles
ctx.strokeStyle = getStyle(document.getElementById("pedigree_canvas"), "color");
ctx.lineWidth = '.$controller->linewidth.';
ctx.shadowColor = "'.$controller->shadowcolor.'";
ctx.shadowBlur = '.$controller->shadowblur.';
ctx.shadowOffsetX = '.$controller->shadowoffsetX.';
ctx.shadowOffsetY = '.$controller->shadowoffsetY.';
ctx.stroke();
');