function DisplayHtmlHead() { global $config; echo reference_to_meta_tags($this->object); echo html_include_link('application/rss+xml', 'RSS2.0', 'reference/' . $this->id . '.rss', 'alternate'); // Canonical link echo html_include_link('', '', 'reference/' . $this->id, 'canonical'); echo html_include_css('css/viewer.css'); echo html_include_script('js/fadeup.js'); echo html_include_script('js/prototype.js'); echo html_include_script('js/lazierLoad.js'); // not working for some reason... echo html_include_script('js/viewer.js'); // Google +1 //echo html_include_script('http://apis.google.com/js/plusone.js'); // Recaptcha echo html_include_script('http://api.recaptcha.net/js/recaptcha_ajax.js'); // Tag tree for names $this->taxon_names = bhl_names_in_reference($this->id); if ($this->taxon_names != NULL) { $tags = ''; foreach ($this->taxon_names->names as $name) { $tags .= $name['namestring'] . '|' . $name['NameBankID'] . "\\n"; } echo '<script type="text/javascript">' . "\n"; echo "function make_tag_tree()\n\t\t\t{\n\t\t\tvar success\t= function(t){tagtreeComplete(t);}\n\t\t\tvar failure\t= function(t){tagtreeFailed(t);}\n\t\t\n\t\t\tvar url = '" . $config['web_root'] . "tagtree/tags2tree.php';\n\t\t\tvar pars = 'tags='+ '" . $tags . "';\n//\t\t\tpars += '&url=display_name.php?id%3D'\n\t\t\tpars += '&url=name/'\n\t\t\tvar myAjax = new Ajax.Request(url, {method:'post', postBody:pars, onSuccess:success, onFailure:failure});\n\t\t\t}\n\t\t\t\nfunction tagtreeComplete(t)\n{\n\tvar s = t.responseText;\n\t\n\t\$('taxon_names').innerHTML = s;\n}\n\nfunction tagtreeFailed(t)\n{\n}\t\t\t\n\t\t\t"; echo '</script>' . "\n"; } // Form validation echo '<script type="text/javascript">' . "\n"; echo 'var check_issn = /^[0-9]{4}\\-[0-9]{3}([0-9]|X)$/;' . "\n"; echo 'var check_date = /^([0-9]{4})\\-([0-9]{2})\\-([0-9]{2})$/;' . "\n"; echo 'var check_year = /^[0-9]{4}$/;' . "\n"; echo '</script>' . "\n"; // Form editing echo '<script type="text/javascript">' . "\n"; echo ' function SetSC(id, sc) { // Textarea. var obj = $(id); obj.value += sc; obj.focus(); } function reportErrors(errors) { var msg = "The form contains errors...\\n"; for (var i = 0; i<errors.length; i++) { var numError = i + 1; msg += "\\n" + numError + ". " + errors[i]; } alert(msg); } function store(form_id, page_id) { var form = $(form_id); // validate var issn = form.issn.value; var date = form.date.value; var year = form.year.value; var secondary_title = form.secondary_title.value; var errors = []; if (secondary_title == "") { errors[errors.length] = "Please supply a journal name"; } if ((issn != "") && !check_issn.test(issn)) { errors[errors.length] = "ISSN " + "\\"" + issn + "\\" is not valid"; } if ((date != "") && !check_date.test(date)) { errors[errors.length] = "Date must be in form \\"YYYY-MM-DD\\""; } if ((year != "") && !check_year.test(year)) { errors[errors.length] = "Year \\"" + year + "\\" is not valid"; } if (errors.length > 0) { reportErrors(errors);'; if (user_is_logged_in()) { } else { echo ' Recaptcha.create("' . $config['recaptcha_publickey'] . '", "recaptcha_div", { theme: "clean", callback: Recaptcha.focus_response_field });'; } echo ' return false; } //alert($(form).serialize()); // Update database var success = function(t){updateSuccess(t);} var failure = function(t){updateFailure(t);} var url = "' . $config['web_root'] . 'update.php"; var pars = $(form).serialize() + "&PageID=" + page_id + "&update=true"; //alert (page_id); var myAjax = new Ajax.Request(url, {method:"post", postBody:pars, onSuccess:success, onFailure:failure}); } function updateSuccess (t) { var s = t.responseText.evalJSON(); //alert(t.responseText); //alert("hi"); if (s.is_valid) { // we\'ve updated metadata, so reload page (or do ajax calls, but reload is easier) window.location.reload(true); } else { // User did not pass recaptcha so refresh it Recaptcha.create("' . $config['recaptcha_publickey'] . '", "recaptcha_div", { theme: "clean", callback: Recaptcha.focus_response_field }); //fadeUp($(metadata_form),255,255,153); } } function updateFailure (t) { alert("Failed: " + t); } '; // Based on http://ne0phyte.com/blog/2008/09/02/javascript-keypress-event/ // and http://blog.evandavey.com/2008/02/how-to-capture-return-key-from-field.html // I want to capture enter key press in recaptcha to avoid submitting the form (user must click // on button for that). We listen for keypress and eat it. Note that we attach the listener after // the window has loaded. echo 'function onMyTextKeypress(event) { if (Event.KEY_RETURN == event.keyCode) { // do something usefull //alert(\'Enter key was pressed.\'); Event.stop(event); } return; } Event.observe(window, \'load\', function() { Event.observe(\'recaptcha_response_field\', \'keypress\', onMyTextKeypress); });'; echo '</script>'; // If we have point localities then we need a map if (count($this->localities) != 0) { echo html_include_script('http://maps.google.com/maps?file=api&v=2&key=' . $config['gmap']); echo html_include_script('js/gmap.js'); echo '<script type="text/javascript">' . "\n"; echo ' function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(0, -0), 1); map.addControl(new GSmallMapControl()); map.addControl(new GOverviewMapControl()); map.addControl(new GMapTypeControl()); map.addMapType(G_PHYSICAL_MAP); map.setMapType(G_PHYSICAL_MAP); '; echo '// Bounding box to contain points, from http://www.svennerberg.com/2008/11/bounding-box-in-google-maps/ ' . "\n"; echo '// see especially comment by Aiska http://www.svennerberg.com/2008/11/bounding-box-in-google-maps/#comment-1546 ' . "\n"; echo 'var bounds = new GLatLngBounds();' . "\n"; foreach ($this->localities as $loc) { echo 'var latlng = new GLatLng('; echo $loc->latitude; echo ','; echo $loc->longitude; echo ');' . "\n"; echo 'map.addOverlay(createMarker(latlng), \'\','; if ($loc->name != '') { echo "'" . $loc->name . "'"; } else { echo "'" . format_decimal_latlon($loc->latitude, $loc->longitude) . "'"; } echo ');' . "\n"; echo 'bounds.extend(latlng);' . "\n"; } echo ' }' . "\n"; echo '// Center map in the center of the bounding box' . "\n"; echo '// and calculate the appropriate zoom level' . "\n"; echo 'map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));' . "\n"; echo '}' . "\n"; echo '</script>' . "\n"; } }
INNER JOIN item_locality_joiner USING (guid) INNER JOIN locality ON locality.id = item_locality_joiner.locality_id ' . 'WHERE pubDate > ' . $db->qstr('2009-05-01') . ' GROUP BY latitude, longitude, pubDate' . ' ORDER BY pubDate; '; $result = $db->Execute($sql); if ($result == false) { die("failed [" . __LINE__ . "]: " . $sql); } $items = array(); while (!$result->EOF) { $item = array(); array_push($item, $result->fields['latitude']); array_push($item, $result->fields['longitude']); // Locality name $locality = $result->fields['name']; if ($locality == '') { $locality = format_decimal_latlon($result->fields['latitude'], $result->fields['longitude']); } array_push($item, $locality); // image URL and description switch ($result->fields['kind']) { // paper case 0: if ($result->fields['thumbnail'] != '') { array_push($item, $result->fields['thumbnail']); } else { array_push($item, 'http://bioguid.info/ebio09/www/images/issn/unknown.png'); } // twitter user name array_push($item, ''); array_push($item, trim_text($result->fields['title'])); break;