pageHeader()
->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
->addInlineJavascript('autocomplete();');
?>
getPageTitle(); ?>
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('
var WT_PEDIGREE_CHART = (function() {
jQuery("html").css("overflow","visible"); // workaround for chrome v37 canvas bugs
jQuery("#content").css("height", "' . ($maxyoffset+30) . '");
jQuery("#childarrow").on("click", "a", function(e) {
e.preventDefault();
jQuery("#childbox").toggle();
});
// Draw joining lines in
// Set variables
var textdirection = "'.$TEXT_DIRECTION.'",
talloffset = '.$talloffset.',
canvaswidth = '.($canvaswidth).',
offset_x = 20,
offset_y = '.$controller->pbheight.'/2+'.$controller->linewidth.',
lineDrawx = new Array("'. join(array_reverse ($lineDrawx),'","'). '"),
lineDrawy = new Array("'. join(array_reverse ($lineDrawy),'","'). '"),
offset_x2 = '.$controller->pbwidth.'/2+'.$controller->linewidth.',
offset_y2 = '.$controller->pbheight.'*2,
lineDrawx2 = new Array("'. join($lineDrawx,'","'). '"),
lineDrawy2 = new Array("'. join($lineDrawy,'","'). '"),
maxjoins = Math.pow(2,'.$PEDIGREE_GENERATIONS.'),
ctx = jQuery("#pedigree_canvas")[0].getContext("2d");
// Set line styles
ctx.strokeStyle = jQuery("#pedigree_canvas").css("color");
ctx.lineWidth = '.$controller->linewidth.';
ctx.shadowColor = "'.$controller->shadowcolor.'";
ctx.shadowBlur = '.$controller->shadowblur.';
ctx.shadowOffsetX = '.$controller->shadowoffsetX.';
ctx.shadowOffsetY = '.$controller->shadowoffsetY.';
//Draw the lines
switch (talloffset) {
case 0: // portrait
// drop through
case 1: // landscape
for (var i = 0; i <= maxjoins-3; i+=2) {
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);
}
}
break;
case 2: // oldest at top
for (var i = 1; i <= maxjoins; i+=2) {
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]);
}
}
break;
case 3: // oldest at bottom
// drop through
default: // anything else
for (var i = 1; i <= maxjoins; i+=2) {
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]);
}
}
ctx.stroke();
return "' . strip_tags($controller->root->getFullName()) . '";
})();
');