summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2014-06-17 16:40:03 +0100
committerGreg Roach <fisharebest@gmail.com>2014-06-17 16:40:03 +0100
commit278af5d1ace7346bd49339ef4461d324f2339967 (patch)
tree6e0f8e45d58bc502bb6363e57ebec7bf5b2ec1ee
parent41529aefb463adb31b0fc88fcd97b9badb04013c (diff)
downloadwebtrees-278af5d1ace7346bd49339ef4461d324f2339967.tar.gz
webtrees-278af5d1ace7346bd49339ef4461d324f2339967.tar.bz2
webtrees-278af5d1ace7346bd49339ef4461d324f2339967.zip
Autocomplete doesn't work on pages with data from multiple trees
-rw-r--r--addmedia.php5
-rw-r--r--admin_site_merge.php14
-rw-r--r--admin_trees_config.php9
-rw-r--r--admin_users.php10
-rw-r--r--ancestry.php5
-rw-r--r--autocomplete.php37
-rw-r--r--branches.php5
-rw-r--r--compact.php5
-rw-r--r--descendancy.php5
-rw-r--r--edit_interface.php11
-rw-r--r--edituser.php5
-rw-r--r--familybook.php5
-rw-r--r--fanchart.php5
-rw-r--r--hourglass.php5
-rw-r--r--includes/functions/functions_edit.php40
-rw-r--r--includes/functions/functions_print.php4
-rw-r--r--inverselink.php5
-rw-r--r--js/autocomplete.js107
-rw-r--r--js/webtrees-1.5.4.js36
-rw-r--r--lifespan.php7
-rw-r--r--modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php6
-rw-r--r--modules_v3/charts/module.php6
-rw-r--r--modules_v3/clippings/module.php15
-rw-r--r--modules_v3/gedcom_favorites/module.php5
-rw-r--r--modules_v3/googlemap/module.php5
-rw-r--r--modules_v3/stories/module.php5
-rw-r--r--pedigree.php5
-rw-r--r--relationship.php7
-rw-r--r--reportengine.php35
-rw-r--r--search.php9
-rw-r--r--search_advanced.php5
-rw-r--r--statistics.php8
-rw-r--r--timeline.php5
33 files changed, 232 insertions, 209 deletions
diff --git a/addmedia.php b/addmedia.php
index 05d612644a..ba4d2e7dbc 100644
--- a/addmedia.php
+++ b/addmedia.php
@@ -41,7 +41,8 @@ $update_CHAN = !WT_Filter::postBool('preserve_last_changed');
$controller = new WT_Controller_Simple();
$controller
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js')
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();')
->restrictAccess(\WT\Auth::isMember());
$disp = true;
@@ -412,7 +413,7 @@ echo '</td></tr>';
if (!$linktoid && $action == 'create') {
echo '<tr><td class="descriptionbox wrap width25">';
echo WT_I18N::translate('Enter an individual, family, or source ID');
- echo '</td><td class="optionbox wrap"><input type="text" name="linktoid" id="linktoid" size="6" value="">';
+ echo '</td><td class="optionbox wrap"><input type="text" data-autocomplete-type="IFS" name="linktoid" id="linktoid" size="6" value="">';
echo ' ', print_findindi_link('linktoid');
echo ' ', print_findfamily_link('linktoid');
echo ' ', print_findsource_link('linktoid');
diff --git a/admin_site_merge.php b/admin_site_merge.php
index d7bc13f379..7743eedc2d 100644
--- a/admin_site_merge.php
+++ b/admin_site_merge.php
@@ -30,6 +30,8 @@ $controller=new WT_Controller_Page;
$controller
->restrictAccess(\WT\Auth::isManager())
->setPageTitle(WT_I18N::translate('Merge records'))
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();')
->pageHeader();
require_once WT_ROOT.'includes/functions/functions_edit.php';
@@ -44,10 +46,6 @@ $ged2 = WT_Filter::post('ged2', null, $ged);
$keep1 = WT_Filter::postArray('keep1');
$keep2 = WT_Filter::postArray('keep2');
-if (count(WT_Tree::getAll())==1) { //Removed becasue it doesn't work here for multiple GEDCOMs. Can be reinstated when fixed (https://bugs.launchpad.net/webtrees/+bug/613235)
- $controller->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
-}
-
if ($action!='choose') {
if ($gid1==$gid2 && $ged1==$ged2) {
$action='choose';
@@ -247,8 +245,7 @@ if ($action=='choose') {
<td>',
WT_I18N::translate('Merge to ID:'),
'</td><td>
- <input type="text" name="gid1" id="gid1" value="', $gid1, '" size="10" tabindex="1" autofocus="autofocus">
- <select name="ged" tabindex="4"';
+ <select name="ged" tabindex="4" onchange="jQuery(\'#gid1\').data(\'autocomplete-ged\', jQuery(this).val());"';
if (count(WT_Tree::getAll())==1) {
echo 'style="width:1px;visibility:hidden;"';
}
@@ -262,14 +259,14 @@ if ($action=='choose') {
}
echo
'</select>
+ <input data-autocomplete-type="INDI" type="text" name="gid1" id="gid1" value="', $gid1, '" size="10" tabindex="1" autofocus="autofocus">
<a href="#" onclick="iopen_find(document.merge.gid1, document.merge.ged);" tabindex="6" class="icon-button_indi" title="'.WT_I18N::translate('Find an individual').'"></a>
<a href="#" onclick="fopen_find(document.merge.gid1, document.merge.ged);" tabindex="8" class="icon-button_family" title="'.WT_I18N::translate('Find a family').'"></a>
<a href="#" onclick="sopen_find(document.merge.gid1, document.merge.ged);" tabindex="10" class="icon-button_source" title="'.WT_I18N::translate('Find a source').'"></a>
</td></tr><tr><td>',
WT_I18N::translate('Merge from ID:'),
'</td><td>
- <input type="text" name="gid2" id="gid2" value="', $gid2, '" size="10" tabindex="2">&nbsp;',
- '<select name="ged2" tabindex="5"';
+ <select name="ged2" tabindex="5" onchange="jQuery(\'#gid2\').data(\'autocomplete-ged\', jQuery(this).val());"';
if (count(WT_Tree::getAll())==1) {
echo 'style="width:1px;visibility:hidden;"';
}
@@ -283,6 +280,7 @@ if ($action=='choose') {
}
echo
'</select>
+ <input data-autocomplete-type="INDI" type="text" name="gid2" id="gid2" value="', $gid2, '" size="10" tabindex="2">
<a href="#" onclick="iopen_find(document.merge.gid2, document.merge.ged2);" tabindex="7" class="icon-button_indi" title="'.WT_I18N::translate('Find an individual').'"></a>
<a href="#" onclick="fopen_find(document.merge.gid2, document.merge.ged2);" tabindex="9" class="icon-button_family" title="'.WT_I18N::translate('Find a family').'"></a>
<a href="#" onclick="sopen_find(document.merge.gid2, document.merge.ged2);" tabindex="11" class="icon-button_source" title="'.WT_I18N::translate('Find a source').'"></a>
diff --git a/admin_trees_config.php b/admin_trees_config.php
index 85d7a87ba6..c0144f9d6d 100644
--- a/admin_trees_config.php
+++ b/admin_trees_config.php
@@ -199,11 +199,10 @@ case 'update':
$controller
->pageHeader()
- ->addInlineJavascript('jQuery("#tabs").tabs(); jQuery("#tabs").css("display", "inline");');
+ ->addInlineJavascript('jQuery("#tabs").tabs(); jQuery("#tabs").css("display", "inline");')
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
-if (count(WT_Tree::getAll())==1) { //Removed because it doesn't work here for multiple GEDCOMs. Can be reinstated when fixed (https://bugs.launchpad.net/webtrees/+bug/613235)
- $controller->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
-}
?>
<form enctype="multipart/form-data" method="post" id="configform" name="configform" action="<?php echo WT_SCRIPT_NAME; ?>">
@@ -240,7 +239,7 @@ if (count(WT_Tree::getAll())==1) { //Removed because it doesn't work here for mu
<?php echo WT_I18N::translate('Default individual'), help_link('default_individual'); ?>
</td>
<td class="wrap">
- <input type="text" name="NEW_PEDIGREE_ROOT_ID" id="NEW_PEDIGREE_ROOT_ID" value="<?php echo get_gedcom_setting(WT_GED_ID, 'PEDIGREE_ROOT_ID'); ?>" size="5" maxlength="20">
+ <input data-autocomplete-type="INDI" type="text" name="NEW_PEDIGREE_ROOT_ID" id="NEW_PEDIGREE_ROOT_ID" value="<?php echo get_gedcom_setting(WT_GED_ID, 'PEDIGREE_ROOT_ID'); ?>" size="5" maxlength="20">
<?php
echo print_findindi_link('NEW_PEDIGREE_ROOT_ID');
$person=WT_Individual::getInstance(get_gedcom_setting(WT_GED_ID, 'PEDIGREE_ROOT_ID'));
diff --git a/admin_users.php b/admin_users.php
index 753435dd99..65b5648337 100644
--- a/admin_users.php
+++ b/admin_users.php
@@ -302,9 +302,9 @@ $controller->pageHeader();
switch ($action) {
case 'createform':
- if (count(WT_Tree::getAll())==1) { //Removed becasue it doesn't work here for multiple GEDCOMs. Can be reinstated when fixed (https://bugs.launchpad.net/webtrees/+bug/613235)
- $controller->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
- }
+ $controller
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
init_calendar_popup();
$controller->addInlineJavascript('
@@ -440,12 +440,12 @@ case 'createform':
//Pedigree root person
'<td>';
$varname='rootid'.$tree->tree_id;
- echo '<input type="text" size="12" name="', $varname, '" id="', $varname, '" value="', WT_Filter::escapeHtml(WT_Filter::post('rootid'.$tree->tree_id, WT_REGEX_XREF)), '"> ', print_findindi_link($varname),
+ echo '<input data-autocomplete-type="INDI" data-autocomplete-ged="' . $tree->tree_name_html . '" type="text" size="12" name="', $varname, '" id="', $varname, '" value="', WT_Filter::escapeHtml(WT_Filter::post('rootid'.$tree->tree_id, WT_REGEX_XREF)), '"> ', print_findindi_link($varname, '', $tree->tree_name),
'</td>',
// GEDCOM INDI Record ID
'<td>';
$varname='gedcomid'.$tree->tree_id;
- echo '<input type="text" size="12" name="',$varname, '" id="',$varname, '" value="', WT_Filter::escapeHtml(WT_Filter::post('gedcomid'.$tree->tree_id, WT_REGEX_XREF)), '"> ', print_findindi_link($varname),
+ echo '<input data-autocomplete-type="INDI" data-autocomplete-ged="' . $tree->tree_name_html . '" type="text" size="12" name="',$varname, '" id="',$varname, '" value="', WT_Filter::escapeHtml(WT_Filter::post('gedcomid'.$tree->tree_id, WT_REGEX_XREF)), '"> ', print_findindi_link($varname, '', $tree->tree_name),
'</td>',
'<td>';
$varname='canedit'.$tree->tree_id;
diff --git a/ancestry.php b/ancestry.php
index 60ef46c972..27c05dee7d 100644
--- a/ancestry.php
+++ b/ancestry.php
@@ -30,7 +30,8 @@ require_once WT_ROOT.'includes/functions/functions_print_lists.php';
$controller=new WT_Controller_Ancestry();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<div id="ancestry-page">
@@ -45,7 +46,7 @@ $controller
<?php echo WT_I18N::translate('Individual'); ?>
</td>
<td class="optionbox">
- <input class="pedigree_form" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->rootid; ?>">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->rootid; ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td class="descriptionbox">
diff --git a/autocomplete.php b/autocomplete.php
index 2135949fc1..b61a22c343 100644
--- a/autocomplete.php
+++ b/autocomplete.php
@@ -474,6 +474,43 @@ case 'IFSRO':
}
echo json_encode($data);
exit;
+
+case 'IFS':
+ $data=array();
+ // Fetch all data, regardless of privacy
+ $rows=get_INDI_rows($term);
+ // Filter for privacy
+ foreach ($rows as $row) {
+ $person=WT_Individual::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
+ if ($person->canShowName()) {
+ $data[]=array('value'=>$person->getXref(), 'label'=>str_replace(array('@N.N.', '@P.N.'), array($UNKNOWN_NN, $UNKNOWN_PN), $row->n_full).', <i>'.$person->getLifeSpan().'</i>');
+ }
+ }
+ // Fetch all data, regardless of privacy
+ $rows=get_SOUR_rows($term);
+ // Filter for privacy
+ foreach ($rows as $row) {
+ $source=WT_Source::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
+ if ($source->canShowName()) {
+ $data[]=array('value'=>$source->getXref(), 'label'=>$source->getFullName());
+ }
+ }
+ // Fetch all data, regardless of privacy
+ $rows=get_FAM_rows($term);
+ // Filter for privacy
+ foreach ($rows as $row) {
+ $family=WT_Family::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
+ if ($family->canShowName()) {
+ $marriage_year=$family->getMarriageYear();
+ if ($marriage_year) {
+ $data[]=array('value'=>$family->getXref(), 'label'=>$family->getFullName().', <i>'.$marriage_year.'</i>');
+ } else {
+ $data[]=array('value'=>$family->getXref(), 'label'=>$family->getFullName());
+ }
+ }
+ }
+ echo json_encode($data);
+ exit;
}
function get_FAM_rows($term) {
diff --git a/branches.php b/branches.php
index 3574582454..052ea74fb0 100644
--- a/branches.php
+++ b/branches.php
@@ -28,7 +28,8 @@ require './includes/session.php';
$controller=new WT_Controller_Branches();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<div id="branches-page">
@@ -40,7 +41,7 @@ $controller
<?php echo WT_Gedcom_Tag::getLabel('SURN'); ?>
</td>
<td class="optionbox">
- <input type="text" name="surname" id="SURN" value="<?php echo WT_Filter::escapeHtml($controller->getSurname()); ?>" dir="auto">
+ <input data-autocomplete-type="SURN" type="text" name="surname" id="SURN" value="<?php echo WT_Filter::escapeHtml($controller->getSurname()); ?>" dir="auto">
<input type="hidden" name="ged" id="ged" value="<?php echo WT_Filter::escapeHtml(WT_GEDCOM); ?>">
<input type="submit" value="<?php echo WT_I18N::translate('View'); ?>">
<p>
diff --git a/compact.php b/compact.php
index 623b012169..2c0dada908 100644
--- a/compact.php
+++ b/compact.php
@@ -27,7 +27,8 @@ require './includes/session.php';
$controller=new WT_Controller_Compact();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<div id="compact-page">
@@ -40,7 +41,7 @@ $controller
<?php echo WT_I18N::translate('Individual'); ?>
</td>
<td class="optionbox vmiddle">
- <input class="pedigree_form" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->rootid; ?>">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->rootid; ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td <?php echo $SHOW_HIGHLIGHT_IMAGES ? 'rowspan="2"' : ''; ?> class="facts_label03">
diff --git a/descendancy.php b/descendancy.php
index 4dbe52d6b0..89bd917679 100644
--- a/descendancy.php
+++ b/descendancy.php
@@ -29,7 +29,8 @@ require_once WT_ROOT.'includes/functions/functions_print_lists.php';
$controller=new WT_Controller_Descendancy();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<div id="descendancy-page"><h2><?php echo $controller->getPageTitle(); ?></h2>
@@ -42,7 +43,7 @@ $controller
<?php echo WT_I18N::translate('Individual'); ?>
</td>
<td class="optionbox">
- <input class="pedigree_form" type="text" id="rootid" name="rootid" size="3" value="<?php echo $controller->rootid; ?>">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" id="rootid" name="rootid" size="3" value="<?php echo $controller->rootid; ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td class="descriptionbox">
diff --git a/edit_interface.php b/edit_interface.php
index 2e2ea623a6..ae139514b1 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -30,7 +30,8 @@ $action = WT_Filter::post('action', null, WT_Filter::get('action'));
$controller=new WT_Controller_Simple();
$controller
->restrictAccess(\WT\Auth::isEditor())
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js')
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();')
->addInlineJavascript('
var locale_date_format="' . preg_replace('/[^DMY]/', '', str_replace(array('J', 'F'), array('D', 'M'), strtoupper($DATE_FORMAT))). '";
');
@@ -965,7 +966,7 @@ case 'addfamlink':
<?php echo WT_I18N::translate('Family'); ?>
</td>
<td class="facts_value">
- <input type="text" id="famid" name="famid" size="8">
+ <input data-autocomplete-type="FAM" type="text" id="famid" name="famid" size="8">
<?php echo print_findfamily_link('famid'); ?>
</td>
</tr>
@@ -1072,7 +1073,7 @@ case 'linkspouse':
<?php echo $label; ?>
</td>
<td class="facts_value">
- <input id="spouseid" type="text" name="spid" size="8">
+ <input data-autocomplete-type="INDI" id="spouseid" type="text" name="spid" size="8">
<?php echo print_findindi_link('spouseid');?>
</td>
</tr>
@@ -1182,7 +1183,7 @@ case 'addnewsource':
<?php echo WT_Filter::getCsrf(); ?>
<table class="facts_table">
<tr><td class="descriptionbox wrap width25"><?php echo WT_Gedcom_Tag::getLabel('TITL'); ?></td>
- <td class="optionbox wrap"><input type="text" name="TITL" id="TITL" value="" size="60"> <?php echo print_specialchar_link('TITL'); ?></td></tr>
+ <td class="optionbox wrap"><input type="text" data-autocomplete-type="SOUR_TITL" name="TITL" id="TITL" value="" size="60"> <?php echo print_specialchar_link('TITL'); ?></td></tr>
<tr><td class="descriptionbox wrap width25"><?php echo WT_Gedcom_Tag::getLabel('ABBR'); ?></td>
<td class="optionbox wrap"><input type="text" name="ABBR" id="ABBR" value="" size="40" maxlength="255"> <?php echo print_specialchar_link('ABBR'); ?></td></tr>
<?php if (strstr($ADVANCED_NAME_FACTS, "_HEB")!==false) { ?>
@@ -1198,7 +1199,7 @@ case 'addnewsource':
<tr><td class="descriptionbox wrap width25"><?php echo WT_Gedcom_Tag::getLabel('PUBL'); ?></td>
<td class="optionbox wrap"><textarea name="PUBL" id="PUBL" rows="5" cols="60"></textarea><br><?php echo print_specialchar_link('PUBL'); ?></td></tr>
<tr><td class="descriptionbox wrap width25"><?php echo WT_Gedcom_Tag::getLabel('REPO'); ?></td>
- <td class="optionbox wrap"><input type="text" name="REPO" id="REPO" value="" size="10"> <?php echo print_findrepository_link('REPO'), ' ', print_addnewrepository_link('REPO'); ?></td></tr>
+ <td class="optionbox wrap"><input type="text" data-autocomplete-type="REPO" name="REPO" id="REPO" value="" size="10"> <?php echo print_findrepository_link('REPO'), ' ', print_addnewrepository_link('REPO'); ?></td></tr>
<tr><td class="descriptionbox wrap width25"><?php echo WT_Gedcom_Tag::getLabel('CALN'); ?></td>
<td class="optionbox wrap"><input type="text" name="CALN" id="CALN" value=""></td></tr>
<?php echo keep_chan(); ?>
diff --git a/edituser.php b/edituser.php
index 0c35009117..f057090cf3 100644
--- a/edituser.php
+++ b/edituser.php
@@ -90,7 +90,8 @@ $controller=new WT_Controller_Page();
$controller
->setPageTitle(WT_I18N::translate('User administration'))
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
// Form validation
?>
@@ -139,7 +140,7 @@ echo '<div id="edituser-page">
}
$person = WT_Individual::getInstance(WT_USER_ROOT_ID);
echo '<div class="label">', WT_I18N::translate('Default individual'), help_link('default_individual'), '</div>
- <div class="value"><input type="text" name="form_rootid" id="rootid" value="', WT_USER_ROOT_ID, '">';
+ <div class="value"><input data-autocomplete-type="INDI" type="text" name="form_rootid" id="rootid" value="', WT_USER_ROOT_ID, '">';
echo print_findindi_link('rootid'), '<br>';
if ($person) {
echo $person->format_list('span');
diff --git a/familybook.php b/familybook.php
index a69ba5041c..22de0f2e6e 100644
--- a/familybook.php
+++ b/familybook.php
@@ -27,7 +27,8 @@ require './includes/session.php';
$controller=new WT_Controller_Familybook();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<div id="familybook-page">
@@ -40,7 +41,7 @@ $controller
<?php echo WT_I18N::translate('Individual'); ?>
</td>
<td class="optionbox">
- <input class="pedigree_form" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->rootid; ?>">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->rootid; ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td class="descriptionbox">
diff --git a/fanchart.php b/fanchart.php
index a7760051e3..344497f8c2 100644
--- a/fanchart.php
+++ b/fanchart.php
@@ -35,7 +35,8 @@ if (WT_Filter::getBool('img')) {
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<div id="page-fan">
@@ -48,7 +49,7 @@ $controller
<?php echo WT_I18N::translate('Individual'); ?>
</td>
<td class="optionbox">
- <input class="pedigree_form" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->rootid; ?>">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->rootid; ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td class="descriptionbox">
diff --git a/hourglass.php b/hourglass.php
index 6f4ea6851c..8a755627ff 100644
--- a/hourglass.php
+++ b/hourglass.php
@@ -30,7 +30,8 @@ require_once WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Hourglass();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js')
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();')
->setupJavascript()
->addInlineJavascript('sizeLines();');
@@ -48,7 +49,7 @@ $gencount=0;
<?php echo WT_I18N::translate('Individual'); ?>
</td>
<td class="optionbox">
- <input class="pedigree_form" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->pid; ?>">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->pid; ?>">
<?php echo print_findindi_link('pid'); ?>
</td>
<td class="descriptionbox">
diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php
index f44db9e99e..5b7c5b9efc 100644
--- a/includes/functions/functions_edit.php
+++ b/includes/functions/functions_edit.php
@@ -592,17 +592,41 @@ function add_simple_tag(
if (in_array($fact, $subnamefacts)) {
echo " onblur=\"updatewholename();\" onkeyup=\"updatewholename();\"";
}
- if ($fact=='GIVN') {
- echo ' autofocus';
- }
- if ($fact=="DATE") {
+
+ // Extra markup for specific fact types
+ switch ($fact) {
+ case 'DATE':
echo " onblur=\"valid_date(this);\" onmouseout=\"valid_date(this);\"";
- }
- if ($fact=="LATI") {
+ break;
+ case 'GIVN':
+ echo ' autofocus data-autocomplete-type="GIVN"';
+ break;
+ case 'LATI':
echo " onblur=\"valid_lati_long(this, 'N', 'S');\" onmouseout=\"valid_lati_long(this, 'N', 'S');\"";
- }
- if ($fact=="LONG") {
+ break;
+ case 'LONG':
echo " onblur=\"valid_lati_long(this, 'E', 'W');\" onmouseout=\"valid_lati_long(this, 'E', 'W');\"";
+ break;
+ case 'NOTE':
+ // Shared notes. Inline notes are handled elsewhere.
+ echo ' data-autocomplete-type="NOTE"';
+ break;
+ case 'OBJE':
+ echo ' data-autocomplete-type="OBJE"';
+ break;
+ case 'PLAC':
+ echo ' data-autocomplete-type="PLAC"';
+ break;
+ case 'REPO':
+ echo ' data-autocomplete-type="REPO"';
+ break;
+ case 'SOUR':
+ echo ' data-autocomplete-type="SOUR"';
+ break;
+ case 'SURN':
+ case '_MARNM_SURN':
+ echo ' data-autocomplete-type="SURN"';
+ break;
}
echo '>';
}
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php
index e726ae380f..601bf9b206 100644
--- a/includes/functions/functions_print.php
+++ b/includes/functions/functions_print.php
@@ -1007,8 +1007,8 @@ function init_calendar_popup() {
');
}
-function print_findindi_link($element_id, $indiname='') {
- return '<a href="#" onclick="findIndi(document.getElementById(\''.$element_id.'\'), document.getElementById(\''.$indiname.'\'), \''.WT_GEDURL.'\'); return false;" class="icon-button_indi" title="'.WT_I18N::translate('Find an individual').'"></a>';
+function print_findindi_link($element_id, $indiname='', $ged=WT_GEDCOM) {
+ return '<a href="#" onclick="findIndi(document.getElementById(\''.$element_id.'\'), document.getElementById(\''.$indiname.'\'), \'' . WT_Filter::escapeHtml($ged) . '\'); return false;" class="icon-button_indi" title="'.WT_I18N::translate('Find an individual').'"></a>';
}
function print_findplace_link($element_id) {
diff --git a/inverselink.php b/inverselink.php
index dfb4c2b440..e1c7bc43d7 100644
--- a/inverselink.php
+++ b/inverselink.php
@@ -31,7 +31,8 @@ $controller=new WT_Controller_Simple();
$controller
->restrictAccess(\WT\Auth::isEditor())
->setPageTitle(WT_I18N::translate('Link to an existing media object'))
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js')
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();')
->pageHeader();
//-- page parameters and checking
@@ -77,7 +78,7 @@ if ($linkto=='manage' && array_key_exists('GEDFact_assistant', WT_Module::getAct
echo '<b>', $mediaid, '</b>';
}
} else {
- echo '<input type="text" name="mediaid" id="mediaid" size="5">';
+ echo '<input data-autocomplete-type="OBJE" type="text" name="mediaid" id="mediaid" size="5">';
echo ' ', print_findmedia_link('mediaid', '1media');
echo "</td></tr>";
}
diff --git a/js/autocomplete.js b/js/autocomplete.js
index 9b9e37b945..aa9e3765fe 100644
--- a/js/autocomplete.js
+++ b/js/autocomplete.js
@@ -37,109 +37,4 @@ return $( "<li></li>" )
}
});
-})( jQuery );
-
-/*
-webtrees: Web based Family History software
-Copyright (C) 2014 webtrees development team.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-// INDI
-jQuery("#spouseid, input[id*=pid], input[id*=PID], input[id^=gedcomid], input[id^=rootid], input[id$=ROOT_ID], input[name^=FATHER], input[name^=MOTHER], input[name^=CHIL]").autocomplete({
- source: "autocomplete.php?field=INDI",
- html: true
-});
-
-// ASSO
-jQuery(".ASSO, ._ASSO").autocomplete({
- source: function(request, response) {jQuery.getJSON("autocomplete.php?field=ASSO", {term:request.term, pid:jQuery("input[name=pid]").val(), event_date:jQuery("input[id*=_DATE]").val()}, response);},
- html: true
-});
-
-// FAM
-jQuery(".FAM, input[id*=famid], input[id*=FAMC], #famid").autocomplete({
- source: "autocomplete.php?field=FAM",
- html: true
-});
-
-// NOTE
-jQuery(".NOTE, .SHARED_NOTE").autocomplete({
- source: "autocomplete.php?field=NOTE",
- html: true
-});
-
-// SOUR
-jQuery(".SOUR, input[id*=sid]").autocomplete({
- source: "autocomplete.php?field=SOUR"
-});
-
-// SOUR:PAGE
-jQuery(".PAGE").autocomplete({
- source: function(request, response) {jQuery.getJSON("autocomplete.php?field=SOUR_PAGE", {term:request.term, sid:jQuery("input[class^=SOUR]").val()}, response);}
-});
-
-// SOUR:TITL
-jQuery("#TITL").autocomplete({
- source: "autocomplete.php?field=SOUR_TITL"
-});
-
-// REPO
-jQuery(".REPO, #REPO").autocomplete({
- source: "autocomplete.php?field=REPO"
-});
-
-// REPO:NAME
-jQuery("#REPO_NAME").autocomplete({
- source: "autocomplete.php?field=REPO_NAME"
-});
-
-// OBJE
-jQuery(".OBJE, #OBJE, #mediaid, #filter").autocomplete({
- source: "autocomplete.php?field=OBJE",
- html: true
-});
-
-// INDI or FAM or SOUR or REPO or NOTE or OBJE
-jQuery("input[id$=xref], input[name^=gid], #cart_item_id").autocomplete({
- source: "autocomplete.php?field=IFSRO",
- html: true
-});
-
-// PLAC : with hierarchy
-jQuery(".PLAC, #place, input[name=place], input[id=place], input[name*=PLACS], input[name*=PLAC3], input[name^=PLAC], input[name$=PLAC]").autocomplete({
- source: "autocomplete.php?field=PLAC"
-});
-
-// PLAC : without hierarchy
-jQuery("input[name=place2], input[id=birthplace], input[id=marrplace], input[id=deathplace], input[id=bdmplace]").autocomplete({
- source: "autocomplete.php?field=PLAC2"
-});
-
-// INDI:BURI:CEME
-jQuery("input[id*=_CEME]").autocomplete({
- source: "autocomplete.php?field=CEME"
-});
-
-// GIVN
-jQuery("#GIVN, input[name*=GIVN], input[name*=firstname]").autocomplete({
- source: "autocomplete.php?field=GIVN"
-});
-
-// SURN
-jQuery("#SURN, input[name*=SURN], input[name*=lastname], #NAME, input[id=name]").autocomplete({
- source: "autocomplete.php?field=SURN"
-});
+})( jQuery ); \ No newline at end of file
diff --git a/js/webtrees-1.5.4.js b/js/webtrees-1.5.4.js
index 64c2f17a3a..157952f239 100644
--- a/js/webtrees-1.5.4.js
+++ b/js/webtrees-1.5.4.js
@@ -1531,7 +1531,6 @@ function valid_lati_long(field, pos, neg) {
field.value = txt;
}
-
// This is the default way for webtrees to show image galleries.
// Custom themes may use a different viewer.
function activate_colorbox(config) {
@@ -1588,6 +1587,41 @@ function activate_colorbox(config) {
});
}
+
+// Initialize autocomplete elements.
+function autocomplete(selector) {
+ if (typeof(selector) === "undefined") {
+ selector = "input[data-autocomplete-type]";
+ }
+
+ jQuery(selector).each(function() {
+ var type = $(this).data("autocomplete-type"); // What type of field
+ var ged = $(this).data("autocomplete-ged"); // Which family tree
+
+ if (typeof(type) === "undefined") {
+ alert("Missing data-autocomplete-type attribute");
+ }
+
+ // Default to the current tree
+ if (typeof(ged) === "undefined") {
+ jQuery(this).data("autocomplete-ged", WT_GEDCOM);
+ }
+
+ var self=jQuery(this);
+ self.autocomplete({
+ // Cannot use a simple URL, as the data-autocomplete-xxxx parameters may change.
+ source: function(request, response) {
+ jQuery.getJSON("autocomplete.php", {
+ field: self.data("autocomplete-type"),
+ ged: self.data("autocomplete-ged"),
+ term: request.term
+ }, response);
+ },
+ html: true
+ });
+ });
+}
+
// Add LTR/RTL support for jQueryUI Accordions
jQuery.extend($.ui.accordion.prototype.options, {
icons: {
diff --git a/lifespan.php b/lifespan.php
index 58a9401f86..9183c8c728 100644
--- a/lifespan.php
+++ b/lifespan.php
@@ -29,7 +29,8 @@ require './includes/session.php';
$controller=new WT_Controller_Lifespan();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js')
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();')
->addInlineJavascript('
var timer;
var offSetNum = 20; // amount timeline moves with each mouse click
@@ -144,7 +145,7 @@ $people = count($controller->people);
<td class="person0" style="padding: 5px;" valign="top">
<?php echo WT_I18N::translate('Add another individual to the chart'); ?>
<br>
- <input class="pedigree_form" type="text" size="5" id="newpid" name="newpid">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" size="5" id="newpid" name="newpid">
<?php print_findindi_link('newpid'); ?>
<br>
<div style="text-align: center;">
@@ -185,7 +186,7 @@ $people = count($controller->people);
<input type="text" name="endYear" size="5" value="<?php echo $controller->endYear==0 ? '' : $controller->endYear; ?>">
</td>
<td>
- <input type="text" name="place" size="15" value="<?php echo WT_Filter::escapeHtml($controller->place); ?>">
+ <input data-autocomplete-type="PLAC" type="text" name="place" size="15" value="<?php echo WT_Filter::escapeHtml($controller->place); ?>">
</td>
<td>
<input type="submit" name="search" value="<?php echo WT_I18N::translate('Search'); ?>">
diff --git a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
index 2a79a1d793..2765c2e47f 100644
--- a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
+++ b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
@@ -31,7 +31,9 @@ $exist_links = WT_Filter::get('exist_links');
$gid = WT_Filter::get('gid', WT_REGEX_XREF);
$update_CHAN = WT_Filter::get('preserve_last_changed');
-$controller->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+$controller
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
$paramok = true;
if (!empty($linktoid)) $paramok = WT_GedcomRecord::getInstance($linktoid)->canShow();
@@ -162,7 +164,7 @@ if ($action == 'choose' && $paramok) {
echo '<b>', $record->getFullName(), '</b>';
}
echo '<table><tr><td>';
- echo "<input type=\"text\" name=\"gid\" id=\"gid\" size=\"6\" value=\"\">";
+ echo '<input type="text" data-autocomplete-type="IFS" name="gid" id="gid" size="6" value="">';
// echo ' Enter Name or ID &nbsp; &nbsp; &nbsp; <b>OR</b> &nbsp; &nbsp; &nbsp;Search for ID ';
echo '</td><td style="padding-bottom: 2px; vertical-align: middle;">';
echo '&nbsp;';
diff --git a/modules_v3/charts/module.php b/modules_v3/charts/module.php
index b10311196e..6108ef34d3 100644
--- a/modules_v3/charts/module.php
+++ b/modules_v3/charts/module.php
@@ -195,7 +195,9 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block {
$type =get_block_setting($block_id, 'type', 'pedigree');
$pid =get_block_setting($block_id, 'pid', WT_USER_ID ? (WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID) : $PEDIGREE_ROOT_ID);
- $controller->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ $controller
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<tr><td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Chart type'); ?></td>
<td class="optionbox">
@@ -218,7 +220,7 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block {
<tr>
<td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Individual'); ?></td>
<td class="optionbox">
- <input type="text" name="pid" id="pid" value="<?php echo $pid; ?>" size="5">
+ <input data-autocomplete-type="INDI" type="text" name="pid" id="pid" value="<?php echo $pid; ?>" size="5">
<?php
echo print_findindi_link('pid');
$root=WT_Individual::getInstance($pid);
diff --git a/modules_v3/clippings/module.php b/modules_v3/clippings/module.php
index 63d69c023a..48013a1a2e 100644
--- a/modules_v3/clippings/module.php
+++ b/modules_v3/clippings/module.php
@@ -63,7 +63,8 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
$controller
->setPageTitle($this->getTitle())
->PageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
echo '<script>';
echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
@@ -147,18 +148,18 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
<table>
<tr>
<td colspan="2" class="topbottombar" style="text-align:center; ">
- <?php echo WT_I18N::translate('Add Individual By ID'), help_link('add_by_id', $this->getName()); ?>
+ <?php echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName()); ?>
</td>
</tr>
<tr>
<td class="optionbox">
<input type="hidden" name="action" value="add">
- <input type="text" name="id" id="cart_item_id" size="5">
+ <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
</td>
<td class="optionbox">
<?php echo print_findindi_link('cart_item_id'); ?>
- <?php print_findfamily_link('cart_item_id', ''); ?>
- <?php print_findsource_link('cart_item_id', ''); ?>
+ <?php echo print_findfamily_link('cart_item_id', ''); ?>
+ <?php echo print_findsource_link('cart_item_id', ''); ?>
<input type="submit" value="<?php echo WT_I18N::translate('Add'); ?>">
</td>
@@ -230,13 +231,13 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
<table>
<tr>
<td colspan="2" class="topbottombar" style="text-align:center; ">
- <?php echo WT_I18N::translate('Add Individual By ID'), help_link('add_by_id', $this->getName()); ?>
+ <?php echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName()); ?>
</td>
</tr>
<tr>
<td class="optionbox">
<input type="hidden" name="action" value="add">
- <input type="text" name="id" id="cart_item_id" size="8">
+ <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
</td>
<td class="optionbox">
<?php echo print_findindi_link('cart_item_id'); ?>
diff --git a/modules_v3/gedcom_favorites/module.php b/modules_v3/gedcom_favorites/module.php
index 0d20df65b5..c2dab7ec89 100644
--- a/modules_v3/gedcom_favorites/module.php
+++ b/modules_v3/gedcom_favorites/module.php
@@ -112,7 +112,8 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
if (WT_USER_ID) {
$controller
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
}
$content = '';
@@ -175,7 +176,7 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
$content .= '<div class="add_fav_ref">';
$content .= '<input type="radio" name="fav_category" value="record" checked="checked" onclick="jQuery(\'#gid'.$uniqueID.'\').removeAttr(\'disabled\'); jQuery(\'#url, #favtitle\').attr(\'disabled\',\'disabled\').val(\'\');">';
$content .= '<label for="gid'.$uniqueID.'">'.WT_I18N::translate('Enter an individual, family, or source ID').'</label>';
- $content .= '<input class="pedigree_form" type="text" name="gid" id="gid'.$uniqueID.'" size="5" value="">';
+ $content .= '<input class="pedigree_form" data-autocomplete-type="IFSRO" type="text" name="gid" id="gid'.$uniqueID.'" size="5" value="">';
$content .= ' '.print_findindi_link('gid'.$uniqueID);
$content .= ' '.print_findfamily_link('gid'.$uniqueID);
$content .= ' '.print_findsource_link('gid'.$uniqueID);
diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php
index 728dbd4101..d3a6877cda 100644
--- a/modules_v3/googlemap/module.php
+++ b/modules_v3/googlemap/module.php
@@ -693,7 +693,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$controller
->setPageTitle(/* I18N: %s is an individual’s name */ WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()))
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet">';
echo '<div id="pedigreemap-page">
@@ -722,7 +723,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
</tr>
<tr>
<td class="optionbox">
- <input class="pedigree_form" type="text" id="rootid" name="rootid" size="3" value="<?php echo $controller->root->getXref(); ?>">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" id="rootid" name="rootid" size="3" value="<?php echo $controller->root->getXref(); ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td class="optionbox">
diff --git a/modules_v3/stories/module.php b/modules_v3/stories/module.php
index 2b090c3ec7..dfbd0a8f9b 100644
--- a/modules_v3/stories/module.php
+++ b/modules_v3/stories/module.php
@@ -219,7 +219,8 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_
}
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
ckeditor_WT_Module::enableEditor($controller);
}
@@ -245,7 +246,7 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_
echo '</tr>';
echo '<tr>';
echo '<td class="optionbox">';
- echo '<input type="text" name="xref" id="pid" size="4" value="'.$xref.'">';
+ echo '<input data-autocomplete-type="INDI" type="text" name="xref" id="pid" size="4" value="'.$xref.'">';
echo print_findindi_link('pid');
if ($xref) {
$person=WT_Individual::getInstance($xref);
diff --git a/pedigree.php b/pedigree.php
index 8fe7c4d466..f40f33133e 100644
--- a/pedigree.php
+++ b/pedigree.php
@@ -28,7 +28,8 @@ require WT_ROOT.'includes/functions/functions_edit.php';
$controller=new WT_Controller_Pedigree();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<div id="pedigree-page">
@@ -56,7 +57,7 @@ $controller
</tr>
<tr>
<td class="optionbox">
- <input class="pedigree_form" type="text" id="rootid" name="rootid" size="3" value="<?php echo $controller->rootid; ?>">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" id="rootid" name="rootid" size="3" value="<?php echo $controller->rootid; ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td class="optionbox center">
diff --git a/relationship.php b/relationship.php
index db357c25c0..c835beb6ae 100644
--- a/relationship.php
+++ b/relationship.php
@@ -52,7 +52,8 @@ $person1=WT_Individual::getInstance($pid1);
$person2=WT_Individual::getInstance($pid2);
$controller
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
if ($person1 && $person1->canShowName() && $person2 && $person2->canShowName()) {
$controller
@@ -93,7 +94,7 @@ if ($person1 && $person1->canShowName() && $person2 && $person2->canShowName())
<?php echo WT_I18N::translate('Individual 1'); ?>
</td>
<td class="optionbox vmiddle">
- <input tabindex="1" class="pedigree_form" type="text" name="pid1" id="pid1" size="3" value="<?php echo $pid1; ?>">
+ <input tabindex="1" class="pedigree_form" data-autocomplete-type="INDI" type="text" name="pid1" id="pid1" size="3" value="<?php echo $pid1; ?>">
<?php echo print_findindi_link('pid1'); ?>
</td>
<td class="descriptionbox">
@@ -108,7 +109,7 @@ if ($person1 && $person1->canShowName() && $person2 && $person2->canShowName())
<?php echo WT_I18N::translate('Individual 2'); ?>
</td>
<td class="optionbox vmiddle">
- <input tabindex="2" class="pedigree_form" type="text" name="pid2" id="pid2" size="3" value="<?php echo $pid2; ?>">
+ <input tabindex="2" class="pedigree_form" data-autocomplete-type="INDI" type="text" name="pid2" id="pid2" size="3" value="<?php echo $pid2; ?>">
<?php echo print_findindi_link('pid2'); ?>
</td>
<td class="descriptionbox">
diff --git a/reportengine.php b/reportengine.php
index eb1831d5aa..6a42759ad9 100644
--- a/reportengine.php
+++ b/reportengine.php
@@ -169,7 +169,8 @@ elseif ($action=='setup') {
$controller
->setPageTitle($report_array['title'])
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
init_calendar_popup();
echo '<div id="reportengine-page">
@@ -193,34 +194,44 @@ elseif ($action=='setup') {
if (!isset($input['default'])) {
$input['default'] = '';
}
- if (isset($input['lookup'])) {
- if ($input['lookup']=='INDI') {
+ if (!isset($input['lookup'])) {
+ $input['lookup'] = '';
+ }
+
+ if ($input['type']=='text') {
+ echo '<input';
+
+ switch ($input['lookup']) {
+ case 'INDI':
+ echo ' data-autocomplete-type="INDI"';
if (!empty($pid)) {
$input['default'] = $pid;
} else {
$input['default'] = $controller->getSignificantIndividual()->getXref();
}
- }
- if ($input['lookup']=='FAM') {
+ break;
+ case 'FAM':
+ echo ' data-autocomplete-type="FAM"';
if (!empty($famid)) {
$input['default'] = $famid;
} else {
$input['default'] = $controller->getSignificantFamily()->getXref();
}
- }
- if ($input['lookup']=='SOUR') {
+ break;
+ case 'SOUR':
+ echo ' data-autocomplete-type="SOUR"';
if (!empty($sid)) {
$input['default'] = $sid;
}
- }
- if ($input['lookup']=='DATE') {
+ break;
+ case 'DATE':
if (isset($input['default'])) {
$input['default'] = strtoupper($input['default']);
}
+ break;
}
- }
- if ($input['type']=='text') {
- echo '<input type="text" name="vars[', WT_Filter::escapeHtml($input['name']), ']" id="', WT_Filter::escapeHtml($input['name']), '" value="', WT_Filter::escapeHtml($input['default']), '" style="direction: ltr;">';
+
+ echo ' type="text" name="vars[', WT_Filter::escapeHtml($input['name']), ']" id="', WT_Filter::escapeHtml($input['name']), '" value="', WT_Filter::escapeHtml($input['default']), '" style="direction: ltr;">';
}
if ($input['type']=='checkbox') {
echo '<input type="checkbox" name="vars[', WT_Filter::escapeHtml($input['name']), ']" id="', WT_Filter::escapeHtml($input['name']), '" value="1"';
diff --git a/search.php b/search.php
index b21e7b8a75..93fe1ae61e 100644
--- a/search.php
+++ b/search.php
@@ -28,7 +28,8 @@ require_once WT_ROOT.'includes/functions/functions_print_lists.php';
$controller=new WT_Controller_Search();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<script>
@@ -155,11 +156,11 @@ echo '<div id="search-page">
//========== Phonetic search Form //==========
if ($controller->action == "soundex") {
echo '<div class="label">' , WT_I18N::translate('Given name'), '</div>
- <div class="value"><input tabindex="3" type="text" name="firstname" value="' , WT_Filter::escapeHtml($controller->firstname), '" autofocus></div>
+ <div class="value"><input tabindex="3" type="text" data-autocomplete-type="GIVN" name="firstname" value="' , WT_Filter::escapeHtml($controller->firstname), '" autofocus></div>
<div class="label">' , WT_I18N::translate('Last name'), '</div>
- <div class="value"><input tabindex="4" type="text" name="lastname" value="' , WT_Filter::escapeHtml($controller->lastname), '"></div>
+ <div class="value"><input tabindex="4" type="text" data-autocomplete-type="SURN" name="lastname" value="' , WT_Filter::escapeHtml($controller->lastname), '"></div>
<div class="label">' , WT_I18N::translate('Place'), '</div>
- <div class="value"><input tabindex="5" type="text" name="place" value="' , WT_Filter::escapeHtml($controller->place), '"></div>
+ <div class="value"><input tabindex="5" type="text" data-autocomplete-type="PLAC2" name="place" value="' , WT_Filter::escapeHtml($controller->place), '"></div>
<div class="label">' , WT_I18N::translate('Year'), '</div>
<div class="value"><input tabindex="6" type="text" name="year" value="' , WT_Filter::escapeHtml($controller->year), '"></div>';
diff --git a/search_advanced.php b/search_advanced.php
index b262a4aefc..b6e8bc3fd1 100644
--- a/search_advanced.php
+++ b/search_advanced.php
@@ -27,7 +27,8 @@ require_once WT_ROOT.'includes/functions/functions_print_lists.php';
$controller=new WT_Controller_AdvancedSearch();
$controller
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js')
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();')
->pageHeader();
echo '<script>';
@@ -150,7 +151,7 @@ echo '</script>';
$currentFieldSearch = $controller->getField($i); // Get this field’s name and the search criterion
$currentField = substr($currentFieldSearch, 0, strrpos($currentFieldSearch, ':')); // Get the actual field name
?>
- <input tabindex="<?php echo $i+1; ?>" type="text" id="value<?php echo $i; ?>" name="values[<?php echo $i; ?>]" value="<?php echo WT_Filter::escapeHtml($controller->getValue($i)); ?>"<?php echo (substr($controller->getField($i),-4)=='PLAC') ? 'class="PLAC"' : ''; ?>>
+ <input tabindex="<?php echo $i+1; ?>" type="text" id="value<?php echo $i; ?>" name="values[<?php echo $i; ?>]" value="<?php echo WT_Filter::escapeHtml($controller->getValue($i)); ?>"<?php echo (substr($controller->getField($i),-4)=='PLAC') ? 'data-autocomplete-type="PLAC"' : ''; ?>>
<?php if (preg_match("/^NAME:/", $currentFieldSearch)>0) { ?>
<select name="fields[<?php echo $i; ?>]">
<option value="<?php echo $currentField; ?>:EXACT"<?php if (preg_match("/:EXACT$/", $currentFieldSearch)>0) echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Exact'); ?></option>
diff --git a/statistics.php b/statistics.php
index 54706c316e..477b91d272 100644
--- a/statistics.php
+++ b/statistics.php
@@ -34,7 +34,7 @@ $ajax = WT_Filter::getBool('ajax');
if (!$ajax) {
$controller=new WT_Controller_Page();
$controller->setPageTitle(WT_I18N::translate('Statistics'))
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js')
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
->addInlineJavascript('
jQuery("#statistics_chart").css("visibility", "visible");
jQuery("#statistics_chart").tabs({
@@ -73,10 +73,10 @@ if (!$ajax) {
'</div>', // statistics-page
'<br><br>';
} else {
- $controller=new WT_Controller_Ajax();
+ $controller = new WT_Controller_Ajax();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();')
->addInlineJavascript('jQuery("#loading-indicator").removeClass("loading-image");');
$stats = new WT_Stats($GEDCOM);
if ($tab==0) {
@@ -629,7 +629,7 @@ if (!$ajax) {
<br>
</div>
<div id="surname_opt" style="display:none;">';
- echo WT_Gedcom_Tag::getLabel('SURN'), help_link('google_chart_surname'), '<br><input type="text" name="SURN" size="20">';
+ echo WT_Gedcom_Tag::getLabel('SURN'), help_link('google_chart_surname'), '<br><input data-autocomplete-type="SURN" type="text" name="SURN" size="20">';
echo '<br>
</div>';
echo WT_I18N::translate('Geographical area');
diff --git a/timeline.php b/timeline.php
index 9fd77db587..7ed3a7c767 100644
--- a/timeline.php
+++ b/timeline.php
@@ -29,7 +29,8 @@ require './includes/session.php';
$controller=new WT_Controller_Timeline();
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
+ ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addInlineJavascript('autocomplete();');
?>
<script>
@@ -310,7 +311,7 @@ $controller->checkPrivacy();
?>
<td class="person<?php echo $col; ?>" style="padding: 5px;" valign="top">
<?php echo WT_I18N::translate('Add another individual to the chart'), '<br>'; ?>
- <input class="pedigree_form" type="text" size="5" id="newpid" name="newpid">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" size="5" id="newpid" name="newpid">
<?php echo print_findindi_link('newpid'); ?>
<br>
<br>