getSidebarAjaxContent(); break; default: header('HTTP/1.0 404 Not Found'); break; } exit; } // Implement WT_Module_Sidebar public function defaultSidebarOrder() { return 50; } // Implement WT_Module_Sidebar public function hasSidebarContent() { global $SEARCH_SPIDER; return !$SEARCH_SPIDER; } // Implement WT_Module_Sidebar public function getSidebarAjaxContent() { $alpha = WT_Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none $surname = WT_Filter::get('surname'); // All indis with this surname. $search = WT_Filter::get('search'); if ($search) { return $this->search($search); } elseif ($alpha=='@' || $alpha==',' || $surname) { return $this->getSurnameFams($alpha, $surname); } elseif ($alpha) { return $this->getAlphaSurnames($alpha, $surname); } else { return ''; } } // Implement WT_Module_Sidebar public function getSidebarContent() { global $WT_IMAGES, $UNKNOWN_NN, $controller; // Fetch a list of the initial letters of all surnames in the database $initials=WT_Query_Name::surnameAlpha(true, false, WT_GED_ID, false); $controller->addInlineJavascript(' var famloadedNames = new Array(); function fsearchQ() { var query = jQuery("#sb_fam_name").val(); if (query.length>1) { jQuery("#sb_fam_content").load("module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=families&search="+query); } } var famtimerid = null; jQuery("#sb_fam_name").keyup(function(e) { if (famtimerid) window.clearTimeout(famtimerid); famtimerid = window.setTimeout("fsearchQ()", 500); }); jQuery("#sb_content_families").on("click", ".sb_fam_letter", function() { jQuery("#sb_fam_content").load(this.href); return false; }); jQuery("#sb_content_families").on("click", ".sb_fam_surname", function() { var surname = jQuery(this).attr("title"); var alpha = jQuery(this).attr("alt"); if (!famloadedNames[surname]) { jQuery.ajax({ url: "module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=families&alpha="+alpha+"&surname="+surname, cache: false, success: function(html) { jQuery("#sb_fam_"+surname+" div").html(html); jQuery("#sb_fam_"+surname+" div").show(); jQuery("#sb_fam_"+surname).css("list-style-image", "url('.$WT_IMAGES['minus'].')"); famloadedNames[surname]=2; } }); } else if (famloadedNames[surname]==1) { famloadedNames[surname]=2; jQuery("#sb_fam_"+surname+" div").show(); jQuery("#sb_fam_"+surname).css("list-style-image", "url('.$WT_IMAGES['minus'].')"); } else { famloadedNames[surname]=1; jQuery("#sb_fam_"+surname+" div").hide(); jQuery("#sb_fam_"+surname).css("list-style-image", "url('.$WT_IMAGES['plus'].')"); } return false; }); '); $out= '
'; return $out; } public function getAlphaSurnames($alpha, $surname1='') { $surnames = WT_Query_Name::surnames('', $alpha, true, true, WT_GED_ID); $out = '