summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2013-10-05 20:49:25 +0100
committerGreg Roach <fisharebest@gmail.com>2013-10-05 20:49:25 +0100
commit1daf13e46df1fd903ab9a808585db166ec8e9fa6 (patch)
tree7c5113fe26ce75e8bd005ec87ed0b50cfab49b84 /includes
parentc3415972b7e001c67f34a4df4c792cd7b93c1d48 (diff)
downloadwebtrees-1daf13e46df1fd903ab9a808585db166ec8e9fa6.tar.gz
webtrees-1daf13e46df1fd903ab9a808585db166ec8e9fa6.tar.bz2
webtrees-1daf13e46df1fd903ab9a808585db166ec8e9fa6.zip
HTML validation
Diffstat (limited to 'includes')
-rw-r--r--includes/functions/functions_edit.php37
1 files changed, 6 insertions, 31 deletions
diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php
index 6089be2f58..5e901e2e90 100644
--- a/includes/functions/functions_edit.php
+++ b/includes/functions/functions_edit.php
@@ -83,7 +83,12 @@ function select_edit_control($name, $values, $empty, $selected, $extra='') {
$html.='<option value="'.WT_Filter::escapeHtml($key).'" dir="auto">'.WT_Filter::escapeHtml($value).'</option>';
}
}
- return '<select id="'.$name.'" name="'.$name.'" '.$extra.'>'.$html.'</select>';
+ if (substr($name, -2)=='[]') {
+ // id attribute is not used for arrays
+ return '<select name="'.$name.'" '.$extra.'>'.$html.'</select>';
+ } else {
+ return '<select id="'.$name.'" name="'.$name.'" '.$extra.'>'.$html.'</select>';
+ }
}
// An inline-editing version of select_edit_control()
@@ -349,36 +354,6 @@ function add_simple_tag($tag, $upperlevel='', $label='', $extra=null) {
global $xref, $bdm, $action, $CensDate;
global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $PREFER_LEVEL2_SOURCES;
- if (substr($tag, 0, strpos($tag, "PLAC"))) {
- ?>
- <script>
- function valid_lati_long(field, pos, neg) {
- // valid LATI or LONG according to Gedcom standard
- // pos (+) : N or E
- // neg (-) : S or W
- txt=field.value.toUpperCase();
- txt=txt.replace(/(^\s*)|(\s*$)/g, ''); // trim
- txt=txt.replace(/ /g, ':'); // N12 34 ==> N12.34
- txt=txt.replace(/\+/g, ''); // +17.1234 ==> 17.1234
- txt=txt.replace(/-/g, neg); // -0.5698 ==> W0.5698
- txt=txt.replace(/,/g, '.'); // 0,5698 ==> 0.5698
- // 0�34'11 ==> 0:34:11
- txt=txt.replace(/\uB0/g, ':'); // �
- txt=txt.replace(/\u27/g, ':'); // '
- // 0:34:11.2W ==> W0.5698
- txt=txt.replace(/^([0-9]+):([0-9]+):([0-9.]+)(.*)/g, function($0, $1, $2, $3, $4) { var n=parseFloat($1); n+=($2/60); n+=($3/3600); n=Math.round(n*1E4)/1E4; return $4+n; });
- // 0:34W ==> W0.5667
- txt=txt.replace(/^([0-9]+):([0-9]+)(.*)/g, function($0, $1, $2, $3) { var n=parseFloat($1); n+=($2/60); n=Math.round(n*1E4)/1E4; return $3+n; });
- // 0.5698W ==> W0.5698
- txt=txt.replace(/(.*)([N|S|E|W]+)$/g, '$2$1');
- // 17.1234 ==> N17.1234
- if (txt!='' && txt.charAt(0)!=neg && txt.charAt(0)!=pos) txt=pos+txt;
- field.value = txt;
- }
- </script>
- <?php
- }
-
$subnamefacts = array("NPFX", "GIVN", "SPFX", "SURN", "NSFX", "_MARNM_SURN");
preg_match('/^(?:(\d+) ('.WT_REGEX_TAG.') ?(.*))/', $tag, $match);
list(, $level, $fact, $value) = $match;