From: Michael S. <sta...@us...> - 2005-10-04 22:59:40
|
Update of /cvsroot/archive-access/archive-access/projects/wera/src/webapps/wera In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23369/wera/src/webapps/wera Added Files: asearch.php asearch_help.html documentDispatcher.php help.php index.php info.php meta.php overview.php result.php top.php Log Message: First time add of wera. Moved here from nwa.nb.no. --- NEW FILE: help.php --- <?php /* * This file is part of The NWA Toolset. * * Copyright (C) 2001-2004 Royal Library in Stockholm, * Royal Library in Copenhagen, * Helsinki University Library of Finland, * National Library of Norway, * National and University Library of Iceland. * * The NWA Toolset 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. * * The NWA Toolset 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 The NWA Toolset; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * File: help.php * * $Id: help.php,v 1.1 2005/10/04 22:59:27 stack-sf Exp $ */ include_once("lib/config.inc"); $locale_array = nls_getlocale(); $language = nls_getlanguage($locale_array[0]); $helpfile = "$conf_rootpath/help/" . $language . "_help.php"; if (!file_exists($helpfile)) { $language = "en"; $helpfile = "$conf_rootpath/help/" . $language . "_help.php"; } ?> <HTML> <HEAD> <link rel="stylesheet" href="<?php print $conf_gui_style;?>" type="text/css"> <TITLE>NwaToolset help</TITLE> </HEAD> <body><center> <?php include ($helpfile); ?> </center></body> </html> --- NEW FILE: asearch.php --- <?php /* * This file is part of The NWA Toolset. * * Copyright (C) 2001-2004 Royal Library in Stockholm, * Royal Library in Copenhagen, * Helsinki University Library of Finland, * National Library of Norway, * National and University Library of Iceland. * * The NWA Toolset 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. * * The NWA Toolset 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 The NWA Toolset; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * File: asearch.php * * $Id: asearch.php,v 1.1 2005/10/04 22:59:27 stack-sf Exp $ */ header("Content-Type: text/html; charset=UTF-8"); //if register_globals is off $query = $_REQUEST['query']; $querytype = $_REQUEST['querytype']; $year_from = $_REQUEST['year_from']; $month_from = $_REQUEST['month_from']; $day_from = $_REQUEST['day_from']; $year_to = $_REQUEST['year_to']; $month_to = $_REQUEST['month_to']; $day_to = $_REQUEST['day_to']; $field = $_REQUEST['field']; $collection = $_REQUEST['collection']; $language = $_REQUEST['language']; $format = $_REQUEST['format']; $start = $_REQUEST['start']; include_once("lib/config.inc"); include($conf_index_file); include($conf_includepath . "/time.inc"); include($conf_includepath . "/url.inc"); //include($conf_includepath . "/asearch_collections.inc"); //include($conf_includepath . "/asearch_sites.inc"); include($conf_includepath . "/asearch_languages.inc"); include_once($conf_result_list); $myself = $_SERVER['PHP_SELF']; /* ------------------------------------------------------------------------------------- */ if ($year_from == "" and $year_to == "") { $query_time = ""; $month_from = ""; $day_from = ""; $month_to = ""; $day_to = ""; } else { $firstyear = "2002"; if ($year_from == "") { $from = ""; $month_from = ""; $day_from = ""; } else { //Has to be exact four digits $from = "000" . $year_from; $from = substr($from, -4); if ($from < $firstyear) { $from = $firstyear; $year_from = $firstyear; } if ($month_from != "") { $month_from = "0" . $month_from; $month_from = substr($month_from, -2); if ($month_from > 12) { $month_from = "12"; } } else { $month_from = "01"; } if ($day_from != "") { $day_from = "0" . $day_from; $day_from = substr($day_from, -2); if ($day_from > 31) { $day_from = "31"; } } else { $day_from = "01"; } $from = $from . $month_from . $day_from . "000000"; } if ($year_to == "") { $to = ""; $month_to = ""; $day_to = ""; } else { //Has to be exact four digits $to = "000" . $year_to; $to = substr($to, -4); $today = getdate(); if ($to < $firstyear) { $to = $firstyear + 1; } elseif ($to > $today['year']) { $to = $today['year'] + 1; $year_to = $to; } if ($month_to != "") { $month_to = "0" . $month_to; $month_to = substr($month_to, -2); if ($month_to > 12) { $month_to = "12"; } } else { $month_to = "01"; } if ($day_to != "") { if ($day_to > 31) { $day_to = "31"; } $day_to = "0" . $day_to; $day_to = substr($day_to, -2); } else { $day_to = "01"; } $to = date("Ymd", mktime(0, 0, 0, $month_to , $day_to, $to)) . "000000"; } if ($year_to != "" and $year_from > $year_to) { $from = ""; $year_from = ""; } $time_search = $from . ";" . $to; $query_time = "archival_time:[$time_search] "; } /* ------------------------------------------------------------------------------------- */ ?> <HTML> <HEAD> <link rel="stylesheet" href="<?php print $conf_gui_style;?>" type="text/css"> <META HTTP-EQUIV="Cache-Control" Content="must-revalidate"> <META Http-Equiv="Pragma" Content="no-cache"> <META Http-Equiv="Expires" Content="0"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <TITLE><?php print(nls("NWA search"));?></TITLE> <script language="javascript"> </script> </HEAD> <body> <center> <table border='0' cellpadding='0' cellspacing='0' width=90%> <tr> <td class="norm" width="1" colspan="5"><img alt='' height='10' src='images/1px.gif' width="1"></td> </tr> <tr> <td class="norm" width="10"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="norm" align="left"><img alt="" src="<?php print $conf_logo;?>"></td> <td class="norm" align="right"> <?php print "<a href=\"$conf_simple_search?query=$query&querytype=$querytype&year_from=$year_from&year_to=$year_to\">"; print nls("Simple search") . "</a>"; ?> </td> <td class="norm" width="10"><img alt='' height='1' src='images/1px.gif' width="1"></td> </tr> </table> <table border='0' cellpadding='0' cellspacing='0' width=90%> <tr> <td class="norm" colspan="5" align="left"><img alt='' height='8' src='images/1px.gif' width='1'></td> </tr> <tr> <td colspan='5' class='border'><img alt='' height='2' src='images/1px.gif' width='1'></td> </tr> <tr> <td colspan='5'><img src='images/1px.gif' width='1' height='5' alt=''></td> </tr> <tr valign="bottom"> <td class="shade" width="10"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" width="5%"><?php print(nls("Match"));?>:</td> <td class="shade"><?php print(nls("Query:"));?></td> <td class="shade" align="right"><a href="<?php print($conf_helplinks['search']['file']);?>"> <?php print(nls($conf_helplinks['search']['name']));?></a></td> <td class="shade" width="10"><img alt='' height='1' src='images/1px.gif' width="1"></td> </tr> <tr> <td class="shade" width="10"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade"><form name='search' action=<? echo $_SERVER['PHP_SELF']; ?> method='get'> <?php $query=trim(stripslashes($query)); if ($querytype=="phrase") { $query = str_replace('"', '', $query); } ?> <select name='querytype'> <option value=all <?php if ($querytype=="all") print "selected"?>><?php print(nls("All words"));?> <option value=any <?php if ($querytype=="any") print "selected"?>><?php print(nls("Any word"));?> <option value=phrase <?php if ($querytype=="phrase") print "selected"?>><?php print(nls("Exact phrase"));?> </select> </td> <td class="shade" colspan="3"> <input type='text' name='query' value='<?php print $query; ?>' size="50"/> <input type='submit' value='<?php print(nls("Search"));?>' onClick="submitForm(0);"/> </td> </tr> <tr valign="bottom"> <td class="shade" width="10" height="20"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" colspan="1"> </td> <td class="shade" colspan="3"><?php print(nls("From - To"))?> (<?php print(nls("YYYY MM DD"))?>):</td> </tr> <tr> <td class="shade" width="10"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" colspan="1"> </td> <td class="shade" colspan="3"> <input name='year_from' size="4" maxlength="4" type='text' value='<?php print $year_from; ?>'> <input name='month_from' maxlength="2" value='<?php print $month_from; ?>' size=2 type="text"> <input name='day_from' maxlength="2" value='<?php print $day_from; ?>' size=2 type="text"> - <input name='year_to' maxlength="4" size=4 type="text" value='<?php print $year_to; ?>'> <input name='month_to' maxlength="2" value='<?php print $month_to; ?>' size=2 type="text"> <input name='day_to' maxlength="2" value='<?php print $day_to; ?>' size=2 type="text"> </td> </tr> <!--- Start adding selections in order to narrow the search ------> <!-- <tr valign="bottom"> <td class="shade" width="10" height="30"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" align="right"><?php print(nls("Field"))?> </td> <td colspan="3"><select name="field"> <option value=all selected <?php if ($field=="all") print "selected"?>><?php echo nls("All");?></option> <?php foreach ($fields as $name => $code) { echo "<option value=\"$code\""; if ($code == $field) { echo " selected "; } echo ">" . nls($name) . "</option>"; } ?> </select> </td> </tr> <tr valign="bottom"> <td class="shade" width="10" height="30"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" align="right"><?php echo nls("Collection");?> </td> <td class="shade" colspan="3"><select name="collection" class="shade"> <option value=all><?php echo nls("All collections")?></option> <?php foreach ($collections as $name => $code) { echo "<option value=\"$code\""; if ($code == $collection) { echo " selected "; } echo ">" . nls($name) . "</option>"; } ?> </select> </td> </tr>--> <tr valign="bottom"> <td class="shade" width="10" height="30"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" align="right"><?php echo nls("Site");?> </td> <td class="shade" colspan="3"> <!--<select name="site" class="shade"> <option value=all><?php echo nls("All sites")?></option>--> <input type='text' name='site' value='<?php print $site; ?>' size="30"/> <?php /* foreach ($sites as $name => $code) { echo "<option value=\"$code\""; if ($code == $site) { echo " selected "; } echo ">" . $name . "</option>"; } */ ?> <!--</select>--> </td> </tr> <!--<tr valign="bottom"> <td class="shade" width="10" height="30"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" align="right"><?php echo nls("Language")?> </td> <td class="shade" colspan="3"><select name="language" class="shade"> <option value="all"><?php echo nls("All languages")?></option>--> <?php /* foreach ($languages as $name => $code) { echo "<option value=\"$code\""; if ($code == $language) { echo " selected "; } echo ">" . nls($name) . "</option>"; }*/ ?> <!-- </select> </td> </tr>--> <tr valign="bottom"> <td class="shade" width="10" height="30"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" align="right"><?php echo nls("File format");?> </td> <td class="shade" colspan="3"> <select name="format" class="shade"> <option value=all <?php if ($format=="all") print "selected"?>><?php echo nls("All file formats");?></option> <option value=text <?php if ($format=="text") print "selected"?>><?php echo nls("Text files");?></option> <option value=pdf <?php if ($format=="pdf") print "selected"?>><?php echo nls("PDF files");?></option> <option value=image <?php if ($format=="image") print "selected"?>><?php echo nls("Images");?></option> <option value=sound <?php if ($format=="sound") print "selected"?>><?php echo nls("Sound and music files");?></option> </select> </td> </tr> </form> <!---------------------------------------------------------> <tr valign="bottom"> <td class="shade" width="10" height="20"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" height="10" colspan="3"><hr></td> <td class="shade" width="10"><img alt='' height='1' src='images/1px.gif' width="1"></td> </tr> <tr> <td class="shade" width="10"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" colspan="4" height="10"><?php print nls("Go directly to a document with this URL");?></td> </tr> <tr> <td class="shade" width="10"><img alt='' height='1' src='images/1px.gif' width="1"></td> <td class="shade" colspan="4"> <?php $time = date("YmdGis"); // Current data and time ?> <form name="loc" method="GET" target="_top" action="result.php"> <input name="url" type="text" size="50" value="<?php print $url; ?>" <input type="hidden" name="time" value="<?php print($time);?>"> <input type='submit' value='<?php print(nls(" Go "));?>'> </form> </td> </tr> <tr><td height="20" colspan="5"></td></tr> </table> <table align="center" class="greyborder" border="0" cellspacing="0" cellpadding="1" width="90%"> <tr> <td> <table align="center" class="resultsborder" border="0" cellspacing="0" cellpadding="10" width="100%"> <tr> <td> <?php $morequery = ""; if ($collection != "" and strcmp($collection,"all")!=0){ $morequery = " collection:\"$collection\""; } if ($site != "" and strcmp($site,"all") != 0){ $morequery = $morequery . " site:$site"; } if ($language != "" and strcmp($language,"all")!=0){ $morequery = $morequery . " language:$language"; } if (strcmp($format,"text")==0){ $morequery = $morequery . " primarytype:text"; } if (strcmp($format,"pdf")==0){ $morequery = $morequery . " subtype:application/pdf"; } if (strcmp($format,"image")==0){ $morequery = $morequery . " primarytype:image"; } if (strcmp($format,"sound")==0){ $morequery = $morequery . " primarytype:audio primarytype:sound"; } if ($query_time != "") { $morequery = $morequery . " " . $query_time; } if ($query == "" and $morequery == "") { include("./info.php"); } elseif ($query!="") { if ($querytype=="phrase") { $query = '"' . $query . '"'; $parsedquery = "$query"; } elseif ($querytype == "any" ) { $parsedquery = "($query)"; } else { $parsedquery = "$query"; } if ($morequery != "") { $querystring = $parsedquery . " " . $morequery; } else { $querystring = $parsedquery; } } if (empty($start)) { $start = 1; } $fields = "url archival_time teaser collection"; if (isset($size)) { $sizeofresultset = $size; } else { $sizeofresultset = 10; } $sortorder = "relevance"; if ( $conf_debug = 1 ) { print "Querystring : " . $querystring; print_r($curtime); } include($conf_includepath . "/searchresult.inc"); //} ?> </td> </tr> </table> </td> </tr> </table> <table border="0" class="resultsborder" width="90%" cellpadding="10"> <tr> <td align="right" class="norm"> Manual : <a href="./manual/manual.html">HTML</a> - <a href="./manual/manual.pdf">pdf</a> | <a href="./RELEASE-NOTES">Release Notes</a> </td> </tr> </table> </center> </body> </html> --- NEW FILE: info.php --- <p><b>Note!</b> <i>Please update the script info.php with the information you want displayed when no query is entered.</i></p> <p> --- NEW FILE: index.php --- <?php /* * This file is part of The NWA Toolset. * * Copyright (C) 2001-2002 Royal Library in Stockholm, * Royal Library in Copenhagen, * Helsinki University Library of Finland, * National Library of Norway, * National and University Library of Iceland. * * The NWA Toolset 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. * * The NWA Toolset 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 The NWA Toolset; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * File: index.php * * $Id: index.php,v 1.1 2005/10/04 22:59:27 stack-sf Exp $ */ header("Content-Type: text/html; charset=UTF-8"); include_once ("lib/config.inc"); include ($conf_index_file); include ($conf_includepath."/time.inc"); include ($conf_includepath."/url.inc"); //if register_globals is off $time_search = $_REQUEST['time_search']; $year_from = $_REQUEST['year_from']; $year_to = $_REQUEST['year_to']; $query = $_REQUEST['query']; $querytype = $_REQUEST['querytype']; $start = $_REQUEST['start']; $debug = $_REQUEST['debug']; ?> <HTML> <HEAD> <link rel="stylesheet" href="<?php print $conf_gui_style;?>" type="text/css"> <META HTTP-EQUIV="Cache-Control" Content="must-revalidate"> <META Http-Equiv="Pragma" Content="no-cache"> <META Http-Equiv="Expires" Content="0"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <TITLE><?php print(nls("NWA search"));?></TITLE> <script language="javascript"> function submitForm(v) { if (v == 2){ document.search.action = "<?php print $conf_advanced_search ?>"; document.search.submit(); }else{ document.search.action = "<?php print $conf_simple_search ?>"; document.search.submit(); } } </script> </HEAD> <body><center> <?php if ($year_from == "" and $year_to == "") { $query_time = ""; } else { $first_year = "2002"; $today = getdate(); $next_year = $today['year'] + 1; if ($year_from == "") { $year_from = $first_year."0101000000"; } if ($year_to == "") { $year_to = $next_year; } if ($year_from < $first_year) { $year_from = $first_year; } if ($year_to < $first_year) { $year_to = $first_year +1; } elseif ($year_to > $next_year) { $year_to = $next_year; } if ($year_from > $year_to) { $year_from = $first_year; } $query_time = "archival_time:[".$year_from."0101000000;".$year_to."0101000000] "; } ?> <table border='0' cellpadding='0' cellspacing='0' width=90%> <tr> <td class="norm" width="1" colspan="5"><img alt='' height='10' src='/images/1px.gif' width="1"></td> </tr> <tr> <td class="norm" width="10"><img alt='' height='1' src='/images/1px.gif' width="1"></td> <td class="norm" align="left"><img alt="" src="<?php print $conf_logo;?>"></td> <td class="norm" align="right"> <?php //print "<a href=\"$conf_advanced_search?query=$query&querytype=$querytype&year_from=$year_from&year_to=$year_to\">"; //print nls("Advanced search") . "</a>"; ?> </td> <td class="norm" width="10"><img alt='' height='1' src='/images/1px.gif' width="1"></td> </tr> </table> <table border='0' cellpadding='0' cellspacing='0' width=90%> <tr> <td class="norm" colspan="5" align="left"><img alt='' height='8' src='/images/1px.gif' width='1'></td> </tr> <tr> <td colspan='5' class='border'><img alt='' height='2' src='/images/1px.gif' width='1'></td> </tr> <tr> <td colspan='5'><img src='/images/1px.gif' width='1' height='5' alt=''></td> </tr> <tr> <td class="shade" width="10"><img alt='' height='1' src='/images/1px.gif' width="1"></td> <td class="shade" width="5%"><?php print(nls("Match"));?>:</td> <td class="shade"><?php print(nls("Query:"));?></td> <td class="shade" align="right"><a href="<?php print($conf_helplinks['search']['file']);?>"> <?php print(nls($conf_helplinks['search']['name']));?></a></td> <td class="shade" width="10"><img alt='' height='1' src='/images/1px.gif' width="1"></td> </tr> <tr> <td class="shade" width="10"><img alt='' height='1' src='/images/1px.gif' width="1"></td> <td class="shade"><form name='search' action=<? echo $_SERVER['PHP_SELF']; ?> method='get'> <?php $query = trim(stripslashes($query)); if ($querytype == "phrase") { $query = str_replace('"', '', $query); } ?> <select name='querytype'> <option value=all <?php if ($querytype=="all") print "selected"?>><?php print(nls("All words"));?> <option value=any <?php if ($querytype=="any") print "selected"?>><?php print(nls("Any word"));?> <option value=phrase <?php if ($querytype=="phrase") print "selected"?>><?php print(nls("Exact phrase"));?> </select> </td> <td colspan="3"> <input type='text' name='query' value='<?php print $query; ?>' class="searchtext" size="50"/> <input type='submit' value='<?php print(nls("Search"));?>' class="searchbutton" onClick="submitForm(0);"/> </td> </tr> <tr> <td class="shade" height="30" colspan="2"> </td> <td colspan="3" class="shade" valign="bottom"><?php print(nls("Year"));?> <?php print(nls("(from - to)"))?></td> </tr> <tr> <td class="shade" height="30" colspan="2"> </td> <td colspan="3"> <input name='year_from' size=4 maxlength="4" type="text" value='<?php print $year_from;?>'/> - <input name='year_to' maxlength="4" value='<?php print $year_to; ?>' size=4 type="text"/> <?php if (isset ($debug)) { print "<input type=\"hidden\" name=\"debug\" value=\"$debug\">"; } ?> </td> </tr> </form> <tr><td height="20" colspan="5"></td></tr> </table> <!-- ************************ Results: ****************************************************** --> <table align="center" class="greyborder" border="0" cellspacing="0" cellpadding="1" width="90%"> <tr> <td> <table align="center" class="resultsborder" border="0" cellspacing="0" cellpadding="10" width="100%"> <tr> <td> <?php $time_str = "Date range"; if ($query == "") { include ("./info.php"); } else { if ($querytype == "phrase") { $query = '"'.$query.'"'; } $parsedquery = $query; if ($query_time != "") { if ($parsedquery == "") { $querystring = trim($query_time); } else { $querystring = $parsedquery." ".trim($query_time); } } else { $querystring = $parsedquery; } if (empty ($start)) { $start = 1; } $fields = "url archival_time teaser dctitle"; if (isset ($size)) { $sizeofresultset = $size; } else { $sizeofresultset = 10; } $sortorder = "relevance"; if ($querystring != "") { $search = new $conf_index_class (); $search->setQuery($querystring); $search->setSortorder("relevance"); $search->setSizeOfResultSet($sizeofresultset); $search->setOffset($start -1); $search->setFieldsInResult("teaser url description"); $search->setSupressDuplicates(); if ($search->doQuery()) { $numhits = $search->getnumhits(); $total = $search->getNumHitsTotal(); $results = $search->getResultSet(); //print "<pre>"; //print_r($results); //print "</pre>"; if ($total > 0) { print (nls("Total number of versions found")." : <b>$total</b>. "); print (nls("Displaying URL's")); print " <b>$start-$numhits"; print "</td></tr>"; print "<tr><td class=\"norm\">"; $hits_in_set = 0; foreach ($results as $key => $value) { $hits_in_set++; print "<b>".$key.". ".$value['teaser']."</b> "; print "(".$value['url'].")<br>"; print "(".$value['description'].")<br>"; $search2 = new $conf_index_class (); $vquery = $query." url:".$value["url"]; $search2->setQuery($vquery); $search2->unsetSupressDuplicates(); $search2->setSortorder("descending"); $search2->setSizeOfResultSet(1); $search2->setOffset(0); $search2->setFieldsInResult(archival_time); $search2->doQuery(); $versions = $search2->getResultSet(); $numversions = $search2->getNumHitsTotal(); $search2->setQuery("url:".$value["url"]); $search2->doQuery(); $totalversions = $search2->getNumHitsTotal(); print nls("Number of versions satisfying query")." / ".nls("total number of versions")." : "; print $numversions."/".$totalversions."<br>"; $linkstring = "<a href=\"result.php?time=".$versions[1]['archival_time']."&url=".index_encode($value["url"])."\">".nls("Timeline")."</a>"; $overview = "<a href=\"overview.php?url=".index_encode($value["url"])."\" >".nls("Overview")."</a>"; print "<b>".$linkstring." | ".$overview."</b>"; print "<br> <br>"; $last_hit = $key; unset($search2); } $next_start = $start + $sizeofresultset; print "<b>Results: "; $url_querypart = "query=".urlencode($query); $url_querypart .= "&querytype=".$querytype; $url_querypart .= "&query=".$query; $url_querypart .= "&year_from=".$year_from; $url_querypart .= "&month_from=".$month_from; $url_querypart .= "&day_from=".$day_from; $url_querypart .= "&year_to=".$year_to; $url_querypart .= "&month_to=".$month_to; $url_querypart .= "&day_to=".$day_to; $url_querypart .= "&site=".$site; $url_querypart .= "&language=".$language; $url_querypart .= "&format".$format; if ($start > 1) { $prev_start = $start - $sizeofresultset; print " <a href=\"".$_SERVER['PHP_SELF']."?".$url_querypart."&start=".$prev_start." \"><< ".nls("Prev")."</a> | "; } for ($i = 1;; $i ++) { $high_lim = $i * $sizeofresultset; $low_lim = $high_lim +1 - $sizeofresultset; if ($high_lim >= $last_hit) { if ($start == $low_lim) { print $low_lim."-".$last_hit." | "; } else { print " <a href=\"".$_SERVER['PHP_SELF']."?".$url_querypart."&start=".$low_lim." \">".$low_lim."-".$last_hit."</a> | "; } break; } else { if ($start == $low_lim) { print $low_lim."-".$high_lim." | "; } else { print " <a href=\"".$_SERVER['PHP_SELF']."?".$url_querypart."&start=".$low_lim." \">".$low_lim."-".$high_lim."</a> | "; } } } if ($hits_in_set == $sizeofresultset) { print " <a href=\"".$_SERVER['PHP_SELF']."?".$url_querypart."&start=".$next_start."\">".nls("Next")." >></a>"; } } else { print "No hits!"; } } if ($conf_debug == 1) { print "Query string : ".$querystring."<br> <br>"; print "Total : ".$total."<br> <br>"; } } } ?> </td> </tr> </table> </td> </tr> </table> <table border="0" class="resultsborder" width="90%" cellpadding="10"> <tr> <td align="left" class="norm"> <a href="http://netpreserve.org"><img alt='' border='0' src='<?php print $conf_http_host;?>/images/iipc.png'></a> </td> <td align="right" class="norm"> Manual : <a href="./manual/manual.html">HTML</a> - <a href="./manual/manual.pdf">pdf</a> | <a href="./RELEASE-NOTES">Release Notes</a> | <a href="http://sourceforge.net/tracker/?group_id=118427&atid=681137">Report bugs</a> </td> </tr> </table> </center> </body> </html> --- NEW FILE: meta.php --- <?php /* * This file is part of The NWA Toolset. * * Copyright (C) 2001-2002 Royal Library in Stockholm, * Royal Library in Copenhagen, * Helsinki University Library of Finland, * National Library of Norway, * National and University Library of Iceland. * * The NWA Toolset 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. * * The NWA Toolset 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 The NWA Toolset; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * File: meta.php * * $Id: meta.php,v 1.1 2005/10/04 22:59:27 stack-sf Exp $ * * meta.php fetches meta information for the document using the document_retriever. */ include_once('lib/config.inc'); include('documentLocator.inc'); include($conf_index_file); $url = $_REQUEST['url']; $time = $_REQUEST['time']; /* echo "url" . $url; echo "time" . $time; */ // Check input parameters if(!isset($url)) { // ERROR: This script needs an url to function exit(1); } $url = index_decode($url); if(!isset($time)) { // ERROR: This script needs a timestamp to function exit(1); } //*------------------------------------------------------------ //Create meta retriever link and redirect $meta_link = document_locator($url, $time, $document_retriever); header("Location: " . $meta_link); //*------------------------------------------------------------ function document_locator($url, $timestamp, $document_retriever) { global $conf_index_class; $mode = 'standalone'; $searchEngine = new $conf_index_class(); $locator = new documentLocator(); $locator->initialize($searchEngine, $url, false, $timestamp, 'NEAR'); $numhits = $locator->findVersions(); if($numhits <= 0) { // ERROR: Did not find any document exit(1); } $result = $locator->getResultSet(); $document = $result[1]; $document['dcformat'] = index_decode($document['dcformat']); $meta = $document_retriever . '?reqtype=getmeta&aid='.urlencode($conf_document_retriever . $document['archiveidentifier']); return $meta; } ?> --- NEW FILE: asearch_help.html --- <HTML> <HEAD> <style type="text/css"> body { background: #F0F1F6; color: #000000; font-family: arial,helvetica,sans-serif; margin-left:30px; margin-right:20px; font-size: 12 } h1 { font-family: arial,helvetica,sans-serif; font-size: 16; font-weight: bold; color: black } h2 { font-family: arial,helvetica,sans-serif; font-size: 14; font-weight: bold; color: black } h3 { font-family: arial,helvetica,sans-serif; font-size: 12; font-weight: bold; color: black } p { font-family: arial,helvetica,sans-serif; font-size: 12 } td { font-family: arial,helvetica,sans-serif; font-size: 12 } ul { font-family: arial,helvetica,sans-serif; font-size: 12 } input { font-family: arial,helvetica,sans-serif; font-size: 12 } textarea { font-family: arial,helvetica,sans-serif; font-size: 12 } strong { font-weight: bold } </style> <TITLE>Help page for NWA advanced search</TITLE> </HEAD> <BODY bgcolor=#F0F1F6> <font face="helvetica,arial,sans-serif"> <table border="0" cellpadding=0 align="center" width="600"> <tr> <td> <table border="0" cellspacing="0" cellpadding="0" border="0"> <tr> <td bgcolor="#aaaaaa"><img src="../images/p.gif" width=1 height=1 alt=""></td> </tr> <tr> <td height="30" valign="middle"> <b><font FACE="Arial" COLOR="66CCCC" size="+2"><</font> <font FACE="Arial" COLOR="666666" size="+2">NWA</font> <font FACE="Arial" COLOR="66CCCC" size="+2">></font></b> </td> </tr> <tr> <td bgcolor="#aaaaaa"><img src="../images/p.gif" width=1 height=1 alt=""></td> </tr> </table> </td> <td align="right"> </td> </tr> </table> <br> <table border="0" cellpadding=0 align="center" width="600"> <tr> Help for advanced search page <ul> <li><b>Query string</b><br> The query string can be a whole word or a truncated one, like <i>air*</i> for <i>airport</i> or <i>airmail</i>. <li><b>Match</b><br> You can write several query strings and require that each document in the result set contains all those words <i>(and)</i>, any of the words <i>(or)</i>, or an exact phrase. <li><b>Search period</b><br> If you want to limit result set by time, define a search period with <i>From</i> and <i>To</i> dates. Both dates can have year, month and day. Also year alone is sufficient, or year and month without day. (But month or day without year doesn't work.) If <i>From</i> or <i>To</i> are left empty, defaults are used for them instead. <li><b>Narrow the search by</b><br> <ul> <li>Field<br> You can require that the search string appears in a certain metadata field. Choices for field are Title, Subject and Links. If Links field is used, the query string could be an URL. In this case you would search for documents which point to the given URL. <li>Collection<br> If the archive consists of several collections, it's possible to make queries into one of them instead of the whole archive. (Requires that metadata has a field for collection name.) <li>Language<br> Look for documents written in a specific language. (Works if metadata contains language information.) <li>File format<br> Search among text/html documents, pictures or sound files. (Querying for pictures and sound files requires that they have been described with metadata.) </ul> <li><b>Search for a document with a given URL</b><br> Write here a whole URL if you only want to view a certain document. </ul> </tr> </table> <br> </body> </html> --- NEW FILE: documentDispatcher.php --- <?php /* * This file is part of The NWA Toolset. * * Copyright (C) 2001-2002 Royal Library in Stockholm, * Royal Library in Copenhagen, * Helsinki University Library of Finland, * National Library of Norway, * National and University Library of Iceland. * * The NWA Toolset 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. * * The NWA Toolset 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 The NWA Toolset; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * Document dispatcher * @version $Id: documentDispatcher.php,v 1.1 2005/10/04 22:59:27 stack-sf Exp $ * @module documentDispatcher * @modulegroup browser * * Purpose is to find reference to document thats the closest match to what * is asked for, and based on the mime-type direct execution to a document- * handler. * * Input parameters: * url - original URL of document to be parsed * time - a timestamp * mime - mime-type (mime-class[/mime-type]) optional * mode - See description for document_locator * * Outputs result to the web client */ include_once('lib/config.inc'); include('documentLocator.inc'); include('httpUtils.inc'); include($conf_index_file); $url = $_REQUEST['url']; $time = $_REQUEST['time']; $mime = $_REQUEST['mime']; $mode = $_REQUEST['mode']; /* echo "url" . $url; echo "time" . $time; echo "mime" . $mime; echo "mode" . $mode; */ // Check input parameters if(!isset($url)) { // ERROR: This script needs an url to function exit(1); } $url = index_decode($url); if(!isset($time)) { // ERROR: This script needs a timestamp to function exit(1); } if(!isset($mode)) { $mode = 'standalone'; } if(!isset($mime)) { $mime = ''; } // Find right version of the document $document = document_locator($url, $time, $mime, $mode); list($handler_url, $handler_has_links) = explode(" ", type_resolver($document, $mime)); $handler_has_links = $handler_has_links == "parselinks" ? true : false; // if ($document['collection'] == "") { // If the indexed data for some reason does not contain a collection $document['collection'] = $conf_location_code; } // Is document located at different site? if($mode != 'external' && $document['collection'] != $conf_location_code) { //if($mode != 'external' && !stristr($conf_location_code, $document['collection'])) { if (!isset($conf_locations[$document['collection']])) { print "<HTML>\n<HEAD>\n<link rel=\"stylesheet\" href=\"$conf_gui_style\" type=\"text/css\">\n</HEAD>\n<BODY>\n<p>"; print 'The variable <b>$conf_locations[' . $document['collection'] . "]</b> is not defined. Please check settings in config.inc"; print "\n</p>\n</BODY>\n</HTML>"; exit(); } $handler_url = $conf_locations[$document['collection']] . "?$QUERY_STRING&mode=external"; if($handler_has_links) { rewrite_document($handler_url, $conf_result_page, $js); } else { if ($fd = @fopen ($handler_url, "r")) { fpassthru($fd); } } exit(); } parse_document($handler_url, $document, $handler_has_links, $js); /** * document_locator * * Tries to find meta information about the document that best matches * the url and timestamp combination. * * @param $url URL for the document as it was when the document was harvested. * @param $timestamp Documents creation time (or harvest time) * @param $mime_hint What mime-type or mime-class to expect * @param $mode One of the following: * inline (e.g. images or frame content) * standalone (e.g. html-page or pdf-document) (default) * * @return array with metadata about document: * [dcdate] = datestamp * [dcformat] = mime-type * [encoding] = charcter encoding * [archiveidentifier] = uri to document in the archive */ function document_locator($url, $timestamp, $mime_hint, $mode = 'standalone') { global $conf_index_class; $searchEngine = new $conf_index_class(); $locator = new documentLocator(); $locator->initialize($searchEngine, $url, false, $timestamp, 'NEAR'); $numhits = $locator->findVersions(); if($numhits <= 0) { // No document found print "<HTML>\n<HEAD>\n<link rel=\"stylesheet\" href=\"$conf_gui_style\" type=\"text/css\">\n</HEAD>\n<BODY>\n<p>"; print nls("Sorry, no documents with the given uri were found"); print "\n</p>\n</BODY>\n</HTML>"; exit(); } $result = $locator->getResultSet(); $document = $result[1]; $document['dcformat'] = index_decode($document['dcformat']); if($document['dcformat'] == '' && $mime_hint != '') { $document['dcformat'] = $mime_hint; } return $document; } /** * type_resolver * * Returns an url to the documentHandler that best handles * the mime-type for the document. * * @param $document * @return $string containing url to document handler */ function type_resolver($document) { global $conf_document_handler; $format = $document['dcformat']; if($conf_document_handler[$format]) { return $conf_document_handler[$format]; } $format = @split($format,'/'); if($conf_document_handler[$format[0]]) { return $conf_document_handler[$format[0]]; } return $conf_document_handler['default']; } /** * parse_document * * Redirects handling of document to the document handler pointed to by * handler_url. The result from the handler is sent to the user's browser. * * @param $handler_url URL to documenthandler * @param $document Array of metadata for document as returned by the documentLocator * @param $handler_has_links Indicates that this document has links that the handler will parse */ function parse_document($handler_url, $document, $handler_has_links, $js) { global $conf_document_retriever, $conf_result_page, $mode; $handler_url .= '?aid='.urlencode($conf_document_retriever . $document['archiveidentifier']).'&time='.$document['archival_time'].'&mime='.$document['dcformat'].'&url='.$document['url']; Header("content-type: " . $document['dcformat'], false); if($handler_has_links && $mode != "external") { rewrite_document($handler_url, $conf_result_page, $js); } else { fetchAndPrintUrl($handler_url); } } /** * rewrite_document * * Rewrites the linkprefix, that the document-handler inserts, into real urls * * @param $handler_url URL to documenthandler. Preformatted with all needed parameters. * @param $result_page The URL that the linkprefix should be rewritten to. */ function rewrite_document($handler_url, $result_page, $js) { $fp = fopen ($handler_url, "r"); if($fp) { while(!feof($fp)) { $content .= fread($fp,1024); } $regex = '/\"##P#R#E#F#I#X##TIME#(\d*)##MODE#(standalone|inline)##URL#([^\"]*)##\"/e'; $replace = "format_url('$result_page', '$3', '$1', '$2')"; $content = preg_replace($regex, $replace, $content); // In case of using the document handler that inserts Javascript (client side link replacement): $content = preg_replace("/##P#R#E#F#I#X##TIME#/", "$result_page?time=", $content); //if ( $js == "off" ){ if (1 == 0) { // disabled this !! /* * $js_regex = "'<script[^>]*?>.*?</script>'si"; * $js_replace = "<script language=\"Javascript\"><!-- NWA HAS BEEN CONFIGURED TO DISABLE THIS JAVASCRIPT SECTION. --></script>"; * $content_nojs = preg_replace($js_regex,$js_replace,$content); * print($js. $content_nojs); */ $js_regex = array("'<script[^>]*?>.*?</script>'si", "'onLoad=\".*?\"'si", "'onAbort=\".*?\"'si", "'onBlur=\".*?\"'si", "'onChange=\".*?\"'si", "'onClick=\".*?\"'si", "'onError=\".*?\"'si", "'onFocus=\".*?\"'si", "'onMouseOver=\".*?\"'si", "'onMouseOut=\".*?\"'si", "'onSelect=\".*?\"'si", "'onSubmit=\".*?\"'si", "'onUnload=\".*?\"'si"); $js_replace = array("<script language=\"Javascript\"><!-- NWA HAS BEEN CONFIGURED TO DISABLE THIS JAVASCRIPT SECTION - FOR THIS PAGE. --></script>", "", "", "", "", "", "", "", "", "", "", "", ""); $content_nojs = preg_replace($js_regex,$js_replace,$content); print($content_nojs); }else { print($content); } fclose($fp); } } function format_url($result_page, $url, $time, $mode) { $res = "\"$result_page?url=" . index_encode($url) . "&time=$time&mode=$mode\""; if($mode == 'standalone') { $res .= ' target="_top"'; } return $res; } ?> --- NEW FILE: top.php --- <?php /* * This file is part of The NWA Toolset. * * Copyright (C) 2001-2002 Royal Library in Stockholm, * Royal Library in Copenhagen, * Helsinki University Library of Finland, * National Library of Norway, * National and University Library of Iceland. * * The NWA Toolset 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. * * The NWA Toolset 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 The NWA Toolset; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * File: top.php * * This file is the top-frame of the NWA browser. This script implements * currents the timeline. * The top.php is only referenced from the result.php script * * $Id: top.php,v 1.1 2005/10/04 22:59:27 stack-sf Exp $ */ header("Content-Type: text/html; charset=UTF-8"); include_once("lib/config.inc"); include($conf_includepath . "/timeline.inc"); include_once($conf_searchenginepath . "/indexUtils.inc"); //if register_globals is off: $level = $_REQUEST['level']; $manlevel = $_REQUEST['manlevel']; $autoresolution = $_REQUEST['autoresolution']; $time = $_REQUEST['time']; $url = $_REQUEST['url']; $debug = $_REQUEST['debug']; // To print out the timeline datas as html comment (view source to see) set the $debug to 1; $encoded_url = $url; $url = index_decode($url); $levels = array(0 => "Seconds", 1 => "Minutes", 2 => "Hours", 3 => "Days", 4 => "Months", 5 => "Years", 6 => "Auto"); function getJavaScriptDefault($defaultvalue){ return $defaultvalue; } ?> <html> <HEAD> <link rel="stylesheet" href="<?php print $conf_gui_style;?>" type="text/css"> <META HTTP-EQUIV="Cache-Control" Content="must-revalidate"> <META Http-Equiv="Pragma" Content="no-cache"> <META Http-Equiv="Expires" Content="0"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <title>NWA Version Browser</title> <script language="javascript"> <!-- // name - name of the cookie // value - value of the cookie // [expires] - expiration date of the cookie (defaults to end of current session) // [path] - path for which the cookie is valid (defaults to path of calling document) // [domain] - domain for which the cookie is valid (defaults to domain of calling document) // [secure] - Boolean value indicating if the cookie transmission requires a secure transmission // * an argument defaults when it is assigned null as a placeholder // * a null placeholder is not required for trailing omitted arguments function setCookie(name, value, expires, path, domain, secure) { var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; } // name - name of the desired cookie // * return string containing value of specified cookie or null if cookie does not exist function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else begin += 2; var end = document.cookie.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); } function minusResolution() { tmp = document.timeline.autolevel.value; if(tmp > 1) { document.timeline.level.value = --tmp; document.timeline.submit() } } function plusResolution() { tmp = document.timeline.autolevel.value; if(tmp < 5) { document.timeline.level.value = ++tmp; document.timeline.submit() } } function autoResolution() { document.timeline.level.value = 6; document.timeline.submit() } function autoResolutionOff() { document.timeline.level.value = document.timeline.autolevel.value; document.timeline.submit() } function js_control() { var imagepath = document.images.js.src; var imagename = imagepath.substring(imagepath.length - 19, imagepath.length) if ( imagename == 'js_selected_new.gif') { alert('Javascript on the archived web pages will not be loaded' ); document.images.js.src = 'images/js_disabled_new.gif'; setCookie("nwabrowser","off"); } else { alert('Javascript on the archived web pages will be loaded with the page'); document.images.js.src = 'images/js_selected_new.gif'; setCookie("nwabrowser","on"); } } function getDefaultJavaScriptConfig(name, defaultvalue) { if (getCookie(name) == null) { setCookie("nwabrowser",defaultvalue); if (defaultvalue == 'on') { document.images.js.src = 'images/js_selected_new.gif'; } else { document.images.js.src = 'images/js_disabled_new.gif'; } } else { if(getCookie(name) == "on"){ document.images.js.src = 'images/js_selected_new.gif'; } else{ document.images.js.src = 'images/js_disabled_new.gif'; } } return true; } --> </script> </head> <body onLoad="getDefaultJavaScriptConfig('nwabrowser','<? echo getJavaScriptDefault($conf_javascript); ?>')"> <table width="100%" border='0' cellpadding='0' cellspacing='0'> <tr> <td colspan='2' class='border'><img alt='' height='2' src='images/1px.gif' width='1'></td> </tr> <tr> <td colspan='2'><img src='images/1px.gif' width='1' height='5' alt=''></td> </tr> <tr> <td width="1"></td> <td> <table cellspacing="0" border="0" cellpadding="0" width="100%"> <tr> <td width="1" class="shade"></td> <td align="left" valign="middle"> <span class="caption">Uri:</span> </td> <form name="loc" method="GET" target="_top" action="result.php"> <td align="left" valign="middle"> <input name="url" type="text" size="70" value="<?php print $url; ?>" class="searchtext"> <input type="hidden" name="level" value="<?php print($level);?>"> <input type="hidden" name="time" value="<?php print($time);?>"> </td> </form> <td align="left" valign="middle"> <input type='button' onClick="document.loc.submit()" value='<?php print nls("Go");?>'/> </td> <td width="50%" nowrap></td> <td align="left" valign="middle"> <span class="caption"><?php print nls("Search");?></span> </td> <form name="search" target="_top" action="<?php print $conf_simple_search ?>"> <td align="left" valign="middle" nowrap> <input type="text" size="30" name="query" value=""> <input type="hidden" name="querytype" value="all"> <input type='submit' value='<?php print(nls("Go"));?>'/> </td> </form> </tr> </table> </td> </tr> <?php $images['first'] = array ( 'name' => "images/first.jpg", 'height' => 20, 'width' => 19 ); $images['prev'] = array ( 'name' => "images/prev.jpg", 'height' => 20, 'width' => 13 ); $images['next'] = array ( 'name' => "images/next.jpg", 'height' => 20, 'width' => 13 ); $images['last'] = array ( 'name' => "images/last.jpg", 'height' => 20, 'width' => 19 ); $images['line'] = array ( 'name' => "images/line.jpg", 'height' => 16, 'width' => 7 ); $images['line_sep'] = array ( 'name' => "images/linemark.jpg", 'height' => 16, 'width' => 1 ); $images['mark_one'] = array ( 'name' => "images/mark_one.jpg", 'height' => 20, 'width' => 7 ); $images['mark_several'] = array ( 'name' => "images/mark_several.jpg", 'height' => 20, 'width' => 7 ); $images['middle'] = array ( 'name' => "images/mark.jpg", 'height' => 6, 'width' => 8 ); if (!($level >= 0 and $level <=5) || (!isset($level) || $level=="")) { $level=6; $resolution = $level; } $result_page = $conf_result_page; print "<!-- hepp level: $level-->"; $timeline = new timeline($level, $time, $url, $conf_index_class); $timeline_data = $timeline->getTimelineData(); if ($level != 6) { $resolution = $timeline->getResolution(); } $number_of_versions = $timeline->getNumberOfVersions(); $next_version = $timeline->getNextVersionTimestamp(); $previous_version = $timeline->getPreviousVersionTimestamp(); $first_version = $timeline->getFirstVersionTimestamp(); $last_version = $timeline->getLastVersionTimestamp(); if ($time == "") { $time = $last_version; } $key_of_version_nearest_before = $timeline->getKeyOfCurrentVersion(); $first_version_display = make_display_time($first_version,-1); $previous_version_display = make_display_time($previous_version,-1); $next_version_display = make_display_time($next_version,-1); $last_version_display = make_display_time($last_version,-1); $current_version_display = make_display_time($time,-1); /* Builds a date based on the resolution * * A resolution of -1 (or any value not corresponding * to a defined resolution type) will give a full date. */ function make_display_time($timestring, $resolution) { $year = substr($timestring, 0, 4); $month = substr($timestring, 4, 2); $day = substr($timestring, 6, 2); $hour = substr($timestring, 8, 2); $minute = substr($timestring, 10, 2); $second = substr($timestring, 12, 2); switch($resolution) { case 0: //Seconds return ($hour . ":" . $minute . ":" . $second); case 1: //Minutes return ($hour . ":" . $minute); case 2: //Hours return (day_format($day) . " " . $hour . ":" . $minute); case 3: //Days return (month_number_to_name($month) . ". " . day_format($day)); case 4: //Months return (month_number_to_name($month) . ". " . $year); case 5: //Years return ($year); } // else full date is return (without seconds) return (month_number_to_name($month) . ". " . day_format($day) . " " . $year . ", " . $hour . ":" . $minute); } function day_format($day) { $temp = $day; $zeroleading = true; while($temp > 10) { $temp = $temp - 10; $zeroleading = false; } if($zeroleading) { $day = substr($day,1,1); } if($temp == 1) { return $day . "st"; } if($temp == 2) { return $day . "nd"; } if($temp == 3) { return $day . "rd"; } return $day . "th"; } function month_number_to_name($month) { switch ($month) { case 1: return "Jan"; case 2: return "Feb"; case 3: return "Mar"; case 4: return "Apr"; case 5: return "May"; case 6: return "Jun"; case 7: return "Jul"; case 8: return "Aug"; case 9: return "Sep"; case 10: return "Okt"; case 11: return "Nov"; case 12: return "Des"; } return ""; } if ($debug == 1) { print "<!--"; print "\nResolution (in) : " . $level; print "\nTime (in) : " . $time; print "\nURL (in) : " . $url; print "\nResolution : " . $timeline->getResolution(); print "\nNumber of versions : " . $number_of_versions; print "\nNext version : " . $next_version; print "\nPrevious version : " . $previous_version; print "\nFirst version : " . $first_version; print "\nLast version : " . $last_version; print "\n" . '$key_of_version_nearest_before ' . $key_of_version_nearest_before; print "\nTimeline array:\n"; print_r($timeline_data); print "\nVersions:\n"; print "-->"; } /* The following is a quick fix way of limiting the size of the timeline based on the resolution. * Ideally this should be done at a lower level where the timeline info is first gathered. * This however makes changes to the interface simpler to implement. * * If there are fewer items in the timeline than $resolution_sizes specifies for that resolution * then the smaller timeline will be displayed without problems. * * The timeline is trimmed equally from both ends. We assume that the number of return variables * is odd and that the selected item is the center item. */ $resolution_sizes = array( 0 => 31, 1 => 31, 2 => 25, 3 => 31, 4 => 25, 5 => 13 ); if($resolution_sizes[$timeline->getResolution()] < count($timeline_data) ) { $first = ((count($timeline_data) - $resolution_sizes[$timeline->getResolution()])/2)+1; $last = ($first-1 + $resolution_sizes[$timeline->getResolution()]); } else { $first = 1; $last = count($timeline_data); } // Create the timeline $i = 1; if (!empty($timeline_data)) { foreach ($timeline_data as $key => $val) { if($i >= $first && $i <= $last){ $link = $result_page . "?url=" . $encoded_url . "&time=" . $timeline_data[$key][linkvalue] . "&level="; if ($i != $first) { $timelinestring .= "<!-- $i --><img border=0 width=" . $images['line_sep']['width'] . " height=" . $images['line_sep']['height'] . " src=" . $images['line_sep']['name'] . ">"; } if ($timeline_data[$key][versions] == 0) { $timelinestring .= "<a target=_top href=" . $link . $resolution . "><img border=0 width=" . $images['line']['width'] . " height=" . $images['line']['height'] . " src=" . $images['line']['name'] . " title=\"" . $timeline_data[$key][resolution_dependent_format] . "\"></a>"; } elseif ($timeline_data[$key][versions] == 1) { $timelinestring .= "<a target=_top href=" . $link . $resolution . "><img border=0 width=" . $images['mark_one']['width']. " height=" . $images['mark_one']['height'] . " src=" . $images['mark_one']['name'] . " title=\"" . make_display_time($timeline_data[$key][linkvalue],-1) . "\"></a>"; } else { if ($resolution == 6) { $tmp_resolution = $resolution; } else { $tmp_resolution = $resolution - 1; } $timelinestring .= "<a target=_top href=" . $link . $tmp_resolution . "><img border=0 width=" . $images['mark_several']['width'] . " height=" . $images['mark_several']['height'] . " src=" . $images['mark_several']['name'] . " title=\"" . $timeline_data[$key][resolution_dependent_format] . " (" . $timeline_data[$key][versions] . " versions)\"></a>"; } if($i == $first) { $firstItem = make_... [truncated message content] |