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 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'); // Recaptcha echo html_include_script('http://api.recaptcha.net/js/recaptcha_ajax.js'); }
function display_bhl_result_html($referent, $hits) { global $config; header("Content-type: text/html; charset=utf-8\n\n"); echo html_html_open(); echo html_head_open(); echo html_title('Reference Finder - ' . $config['site_name']); echo html_include_css('css/main.css'); echo html_include_css('css/lightbox.css'); echo html_include_script('js/fadeup.js'); echo html_include_script('js/prototype.js'); echo html_include_script('js/scriptaculous.js?load=effects,builder'); echo html_include_script('js/lightbox.js'); // Handle user accepting a hit echo '<script type="text/javascript">'; echo 'function store(form_id, page_id) { var form = $(form_id); //alert($(form).serialize()); // Update database var success = function(t){updateSuccess(t);} var failure = function(t){updateFailure(t);} var url = "update.php"; var pars = $(form).serialize() + "&PageID=" + 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); if (s.is_valid) { // we\'ve stored reference, so reload page, which will redirect us to page for reference 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($(recaptcha_div),255,255,153); } } function updateFailure (t) { var s = t.responseText.evalJSON(); alert("Badness happened:\\n" + t.responseText); }'; // 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>'; echo html_head_close(); echo html_body_open(); echo html_page_header(false); echo '<h1>Reference Finder results</h1>'; if (count($hits) != 0) { echo '<form id="metadata_form" action=\'#\'>'; // referent metadata (hidden). By populating form we can pass metadata to // update.php via Ajax call echo reference_hidden_form($referent); echo '<table border="0" cellpadding="10">'; foreach ($hits as $hit) { echo '<tr>'; // Thumbnail of page echo '<td valign="top">'; echo '<a href="bhl_image.php?PageID=' . $hit->PageID . '" rel="lightbox">'; echo '<img style="border:1px solid rgb(128,128,128);" src="bhl_image.php?PageID=' . $hit->PageID . '&thumbnail" alt="page thumbnail"/>'; echo '</a>'; echo '</td>'; // Details of match echo '<td valign="top">'; echo '<div style="margin-bottom:4px;">' . $hit->snippet . '</div>'; echo "<div><span>Title match score = " . $hit->score . "</span></div>"; echo '<div><span>BHL PageID </span><a href="http://www.biodiversitylibrary.org/page/' . $hit->PageID . '">' . $hit->PageID . '</a></div>'; // Action echo '<br/><span style="padding:2px;cursor:pointer;background-color:#2D7BB2;color:white;font-size:18px;font-family:Arial;text-align:center" onclick="store(\'metadata_form\', \'' . $hit->PageID . '\');"> Click here to accept this match </span>'; echo '</td>'; echo '</tr>'; } echo '</table>'; // Recaptcha $recaptcha = !user_is_logged_in(); if ($recaptcha) { echo '<script type="text/javascript">'; echo 'var RecaptchaOptions = '; echo '{'; echo 'theme: \'white\','; echo 'tabindex: 2'; echo '};'; echo '</script>'; echo '<div id="recaptcha_div">'; // echo '<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=' . $config['recaptcha_publickey'] . '"></script>'; // https://groups.google.com/forum/?fromgroups#!topic/recaptcha/V7qswqBnA1o echo '<script type="text/javascript" src="https://www.google.com/recaptcha/api/challenge?k=' . $config['recaptcha_publickey'] . '"></script>'; echo '</div>'; } echo '</form>'; } else { echo '<p>No matching article found</p>'; echo '<ul>'; echo '<li><a href="openurl.php">Return to Reference Finder</a></li>'; echo '<li><a href="http://biodiversitylibrary.org/openurl?' . $_SERVER['QUERY_STRING'] . '" target= "_new">Try to find using BHL OpenURL resolver</a></li>'; echo '<li><a href="http://bioguid.info/openurl.php?' . $_SERVER['QUERY_STRING'] . '" target= "_new">Try to find using bioGUID OpenURL resolver</a></li>'; echo '</ul>'; } echo html_body_close(); echo html_html_close(); }
function main($uri) { global $config; // Triple store global $store_config; global $store; $uri = urldecode($uri); $ntriples = get_canonical_uri($uri); //echo $ntriples; exit(); if ($ntriples == 0) { // Fetch URI echo '<html>'; echo '<body>'; echo 'Sorry, don\'t have this URI <b>' . $uri . '</b>, trying to fetch it...'; $uri_to_fetch = $uri; if (preg_match('/^urn:lsid:/', $uri_to_fetch)) { $uri_to_fetch = 'http://bioguid.info/' . $uri_to_fetch; } echo $uri_to_fetch; // can we get it, if so redirect... $query = "LOAD <" . $uri_to_fetch . ">"; $r = $store->query($query); /*echo $query; echo '<pre>'; print_r($r); echo '</pre>'; exit(); */ if ($r['result']['t_count'] > 0) { // Got it, redirect to web page for this URI echo '<script type="text/javascript">'; echo 'document.location="' . $config['web_root'] . 'uri/' . $uri . '";'; echo '</script>'; } else { // Bugger... echo "Badness happened"; } echo '</body>'; echo '</html>'; } else { // Display info about this object (having issues with CONSTRUCT not returning language codes!?) $sparql = "\nCONSTRUCT\n{\n\t<{$uri}> ?o ?p\n}\n\nWHERE \n{ \n\t<{$uri}> ?o ?p\n}\n"; $sparql = "DESCRIBE <{$uri}>"; //echo $sparql . "\n"; // get object $r = $store->query($sparql); $index = $r['result']; $parser = ARC2::getRDFParser(); $rdfxml_doc = $parser->toRDFXML($index); //echo $rdfxml_doc; // What type if this? $dom = new DOMDocument(); $dom->loadXML($rdfxml_doc); $xpath = new DOMXPath($dom); $xpath->registerNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); $xpath->registerNamespace("dcterms", "http://purl.org/dc/terms/"); $type = array(); $xsl_filename = ''; $html = ''; $topic_title = ''; //------------------------------------------------------------------------------------------ // Get type(s) of objects $name = ''; $nodeCollection = $xpath->query('//rdf:type/@rdf:resource'); foreach ($nodeCollection as $node) { $type[] = $node->firstChild->nodeValue; } //------------------------------------------------------------------------------------------ // Post process objects... // Publication add sequences... // possibe relations are isReferencedBy (stated in GenBank record) and references // which is stated in publication if we have links via PubMed. if (in_array('http://purl.org/ontology/bibo/Article', $type)) { $topic_title = get_title($uri); // Sequences $xml = query_sequences_from_publication($uri); append_xml($dom, $xml); // Taxa // Geography $xml = query_localities_from_publication($uri); append_xml($dom, $xml); } // Journal if (in_array('http://purl.org/ontology/bibo/Journal', $type)) { $topic_title = get_title($uri); $xml = query_articles_from_journal($uri); append_xml($dom, $xml); } // Collection if (in_array('http://rs.tdwg.org/ontology/voc/Collection#Collection', $type)) { $topic_title = get_title($uri); $xml = query_specimens_from_collection($uri); append_xml($dom, $xml); } // GenBank: Add specimen if we have it... if (in_array('http://purl.uniprot.org/core/Molecule', $type)) { $topic_title = get_title($uri); $specimen_uri = ''; $nodeCollection = $xpath->query('//dcterms:relation/@rdf:resource'); foreach ($nodeCollection as $node) { $specimen_uri = $node->firstChild->nodeValue; } if ($specimen_uri != '') { // Fetch RDF $r = describe($specimen_uri); $index = $r['result']; $extraXml = $parser->toRDFXML($index); // Load into current DOM $extraDom = new DOMDocument(); $extraDom->loadXML($extraXml); $n = $dom->importNode($extraDom->documentElement, true); // Append to root node $dom->documentElement->appendChild($n); } } // Specimen if (in_array('http://rs.tdwg.org/ontology/voc/TaxonOccurrence#TaxonOccurrence', $type)) { // Get sequences from this specimen $xml = query_sequences_from_specimen($uri); append_xml($dom, $xml); $xml = query_publications_from_specimen($uri); append_xml($dom, $xml); } // NCBI taxon if (in_array('http://rs.tdwg.org/ontology/voc/TaxonConcept#TaxonConcept', $type)) { $topic_title = get_title($uri, '<http://rs.tdwg.org/ontology/voc/TaxonConcept#nameString>'); // Get sequences from this specimen $xml = query_sequences_from_taxon($uri); append_xml($dom, $xml); $xml = query_localities_from_taxon($uri); append_xml($dom, $xml); $xml = query_publications_from_taxon($uri); append_xml($dom, $xml); } // Dbpedia if (in_array('http://www.opengis.net/gml/_Feature', $type)) { $topic_title = get_title($uri, 'rdfs:label', 'en'); } if (in_array('http://www.w3.org/2002/07/owl#Thing', $type)) { $topic_title = get_title($uri, 'rdfs:label', 'en'); } //print_r($type); //------------------------------------------------------------------------------------------ // Display // Article if (in_array('http://purl.org/ontology/bibo/Article', $type)) { $xsl_filename = 'xsl/article.xsl'; } // Journal if (in_array('http://purl.org/ontology/bibo/Journal', $type)) { $xsl_filename = 'xsl/journal.xsl'; } // Dbpedia thing if (in_array('http://www.w3.org/2002/07/owl#Thing', $type)) { $xsl_filename = 'xsl/dbpedia.xsl'; } // Dbpedia feature if (in_array('http://www.opengis.net/gml/_Feature', $type)) { $xsl_filename = 'xsl/dbpedia.xsl'; } // genbank sequence if (in_array('http://purl.uniprot.org/core/Molecule', $type)) { $xsl_filename = 'xsl/genbank.xsl'; } // taxon concept if (in_array('http://rs.tdwg.org/ontology/voc/TaxonConcept#TaxonConcept', $type)) { $xsl_filename = 'xsl/taxonomy.xsl'; } // Collection if (in_array('http://rs.tdwg.org/ontology/voc/Collection#Collection', $type)) { $xsl_filename = 'xsl/collection.xsl'; } // Specimen (by itself) if (in_array('http://rs.tdwg.org/ontology/voc/TaxonOccurrence#TaxonOccurrence', $type) && !in_array('http://purl.uniprot.org/core/Molecule', $type)) { $xsl_filename = 'xsl/occurrence.xsl'; } //------------------------------------------------------------------------------------------ if ($xsl_filename != '') { $xp = new XsltProcessor(); $xsl = new DomDocument(); $xsl->load($xsl_filename); $xp->importStylesheet($xsl); $html = $xp->transformToXML($dom); } else { $html .= '<p/>'; $html .= '<div style="padding:10px;background:white;-webkit-border-radius:10px;">'; $html .= '<pre class="brush:xml">' . htmlentities($dom->saveXML(), ENT_COMPAT, 'UTF-8') . '</pre>'; $html .= '</div>'; } // Display... header("Content-type: text/html; charset=utf-8\n\n"); echo html_html_open(); echo html_head_open(); echo html_title($topic_title); echo html_include_css('css/main.css'); echo html_include_script('js/prototype.js'); echo html_include_script('js/lookahead.js'); echo html_include_script('js/browse.js'); // RDF display echo html_include_script('js/shCore.js'); echo html_include_script('js/shBrushXml.js'); echo html_include_css('css/shCore.css'); echo html_include_css('css/shThemeDefault.css'); echo html_head_close(); echo html_body_open(); //echo html_page_header(true, $uri); echo '<div id="container">' . "\n"; echo ' <div id="banner">' . "\n"; echo html_page_header(true, $uri); echo ' </div>' . "\n"; /*echo '<div id="nav">'; echo ' </div>' . "\n"; echo '<div id="content">'; echo 'xxxxxx'; echo ' </div>' . "\n"; */ /* echo '<div class="main">'; echo '<div class="maincontent">'; echo '<div class="maincontent_border">'; */ if (1) { echo $html; } else { ?> <div id="nav"> <div> <b>On the Web</b> <br> <ul type="square"> <li> <a href="http://dx.doi.org/10.1073/pnas.0907926106" target="_new">doi:10.1073/pnas.0907926106</a> </li> </ul> <b>Post to:</b> <br> <ul type="square"> <li>Citeulike</li> <li>Connotea</li> <li>Mendeley</li> </ul> </div> </div> <div id="content"> <h1>[Article] Bacterial gut symbionts are tightly linked with the evolution of herbivory in ants.</h1> <h2>Jacob A Russell, Corrie S Moreau, Benjamin Goldman-Huertas, Mikiko Fujiwara, David J Lohman, Naomi E Pierce</h2> <div><span class="internal_link" onclick="lookahead('http://bioguid.info/issn:0027-8424')">Proceedings of the National Academy of Sciences of the United States of America</span> 106: 21236 (2009) doi:10.1073/pnas.0907926106</div> <div class="abstract">Ants are a dominant feature of terrestrial ecosystems, yet we know little about the forces that drive their evolution. Recent findings illustrate that their diets range from herbivorous to predaceous, with &quot;herbivores&quot; feeding primarily on exudates from plants and sap-feeding insects. Persistence on these nitrogen-poor food sources raises the question of how ants obtain sufficient nutrition. To investigate the potential role of symbiotic microbes, we have surveyed 283 species from 18 of the 21 ant subfamilies using molecular techniques. Our findings uncovered a wealth of bacteria from across the ants. Notable among the surveyed hosts were herbivorous &quot;turtle ants&quot; from the related genera Cephalotes and Procryptocerus (tribe Cephalotini). These commonly harbored bacteria from ant-specific clades within the Burkholderiales, Pseudomonadales, Rhizobiales, Verrucomicrobiales, and Xanthomonadales, and studies of lab-reared Cephalotes varians characterized these microbes as symbiotic residents of ant guts. Although most of these symbionts were confined to turtle ants, bacteria from an ant-specific clade of Rhizobiales were more broadly distributed. Statistical analyses revealed a strong relationship between herbivory and the prevalence of Rhizobiales gut symbionts within ant genera. Furthermore, a consideration of the ant phylogeny identified at least five independent origins of symbioses between herbivorous ants and related Rhizobiales. Combined with previous findings and the potential for symbiotic nitrogen fixation, our results strongly support the hypothesis that bacteria have facilitated convergent evolution of herbivory across the ants, further implicating symbiosis as a major force in ant evolution.</div> <div> <ul type="square"> <li><span class="internal_link" onclick="lookahead('http://bioguid.info/genbank:AF465438')">AF465438</span></li> </ul> </div> </div> <?php } echo ' <div id="footer">' . "\n"; echo ' <p>About:</p>' . "\n"; echo ' </div>' . "\n"; echo '</div>' . "\n"; // container echo ' <div id="horizon"> <div id="progress" style="display:none"> <p>Hello</p> </div> </div>'; echo ' <script type="text/javascript"> SyntaxHighlighter.all() </script>'; // footer echo html_body_close(); echo html_html_close(); } }
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"; } }
function display_outlet($outlet) { global $couch; global $config; // clean $outlet = stripcslashes($outlet); echo html_html_open(); echo html_head_open(); echo html_title($outlet . ' - ' . $config['site_name']); echo html_include_css('css/main.css'); echo html_include_script('js/jquery-1.4.4.min.js'); echo html_head_close(); echo html_body_open(); echo '<div style="padding:10px;">'; //---------------------------------------------------------------------------------------------- // Home echo '<span><a href="' . $config['web_root'] . '">' . $config['site_name'] . '</a></span>'; echo html_search_box(); //---------------------------------------------------------------------------------------------- // Outlet echo '<h1>' . $outlet . '</h1>'; //http://localhost:5984/afd/_design/publication/_view/outlet_year_volume?startkey=[%22Annals%20And%20Magazine%20of%20Natural%20History%22]&endkey=[%22Annals%20And%20Magazine%20of%20Natural%20History\ufff0%22] $startkey = array($outlet); $endkey = array($outlet . '\\ufff0'); $resp = $couch->send("GET", "/" . $config['couchdb'] . "/_design/publication/_view/outlet_year_volume?startkey=" . urlencode(json_encode($startkey)) . "&endkey=" . urlencode(json_encode($endkey))); $articles = json_decode($resp); //print_r($articles); $num_articles = count($articles->rows); if (count($articles) == 0) { } else { echo '<h2>Articles in this publication (' . $num_articles . ')</h2>'; if ($num_articles < 20) { // list view echo '<ul>'; foreach ($articles->rows as $row) { $resp = $couch->send("GET", "/" . $config['couchdb'] . "/" . $row->value); $publication = json_decode($resp); if (isset($publication->error)) { // We don't have this reference } else { echo '<li style="list-style-type:none;">' . display_one_publication($publication) . '</li>'; } } echo '</ul>'; } else { // treemap view (should do this with a CouchDB index...) $years = array(); foreach ($articles->rows as $row) { $resp = $couch->send("GET", "/" . $config['couchdb'] . "/" . $row->value); $publication = json_decode($resp); if (isset($publication->error)) { // We don't have this reference } else { $year = 'YYYY'; if (isset($publication->year)) { $year = $publication->year; } if (!isset($years[$publication->year])) { $years[$publication->year] = array(); } $years[$publication->year][] = $row->value; } } // Get sizes of categories $size = array(); foreach ($years as $p) { $sizes[] = count($p); } // Get size of rectangle we want to draw this in $r = new Rectangle(0, 0, 400, 500); // Construct quantum treemap $qt = new QuantumTreemap($sizes, 1.0, $r); $qt->quantumLayout(); $json = $qt->export2json(); $obj = json_decode($json); // Add category labels and list of object ids to each cell in treemap $i = 0; foreach ($years as $k => $v) { $obj->rects[$i]->label = $k; $obj->rects[$i]->ids = array(); foreach ($v as $id) { $obj->rects[$i]->ids[] = $id; } $i++; } // Treemap echo "\n"; echo '<div style="position:relative">'; draw($obj); echo '</div>' . "\n"; } } echo '<div>'; echo html_body_close(false); echo html_html_close(); }
* */ 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)"; } function treemap_mouse_out(id) {