Exemple #1
0
 function DisplayHtmlHead()
 {
     // My original coauthor widget
     //echo html_include_script('js/coauthors.js');
     // Exhibit
     echo html_include_link('application/json', '', 'exhibit_author.php?id=' . $this->id, 'exhibit/data');
     //		echo html_include_script('http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js');
     // From email from Ted Benson Ted Benson <*****@*****.**>
     echo html_include_script('http://trunk.simile-widgets.org/ajax/api/simile-ajax-api.js');
     echo html_include_script('http://trunk.simile-widgets.org/exhibit/api/exhibit-api.js?log=true');
 }
    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&amp;v=2&amp;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";
        }
    }
Exemple #3
0
 *
 * Home page
 *
 */
require_once '../config.inc.php';
require_once '../db.php';
require_once dirname(__FILE__) . '/html.php';
require_once dirname(__FILE__) . '/sparklines.php';
global $config;
header("Content-type: text/html; charset=utf-8\n\n");
echo html_html_open();
echo html_head_open();
echo '<meta name="google-site-verification" content="G0IJlAyehsKTOUGWSc-1V2RMtYQLnqXs440NUSxbYgA" />' . "\n";
echo '<META name="y_key" content="77957dfab6d01a40" />' . "\n";
//echo html_include_link('application/rdf+xml', 'RSS 1.0', 'rss.php?format=rss1', 'alternate');
echo html_include_link('application/atom+xml', 'ATOM', 'rss.php?format=atom', 'alternate');
echo html_title($config['site_name']);
echo html_include_script('js/prototype.js');
?>
<script type="text/javascript">

function treemap_mouse_over(id) 
{
	var e = document.getElementById(id);
//    	e.style.opacity= "1.0";
//	    e.style.filter = "alpha(opacity=100)";
	e.style.opacity=0.6;
   e.style.filter = "alpha(opacity=60)";

}