From 6a06000c4376ae5eac225295af31a9000e259496 Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Sun, 2 Oct 2011 16:02:01 +0200 Subject: [PATCH] improved bibtex entry URL creation (can now be parametrized using BIBTEXBROWSER_URL_BUILDER) --- bibtexbrowser.php | 20 ++++++++--- .../4c4c65636d50fa083859c4101a3f88dc.html | 36 +++++++++---------- .../7927fcd8654efc9521cae97590ac1e7b.html | 10 +++--- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/bibtexbrowser.php b/bibtexbrowser.php index c66a4fe..47bef2b 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -963,8 +963,20 @@ class BibEntry { /** Tries to build a good URL for this entry */ function getURL() { - if ($this->hasField('url')) return $this->getField('url'); - else return "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/'.BIBTEXBROWSER_URL.'?'.createQueryString(array('key'=>$this->getKey())); + if (defined('BIBTEXBROWSER_URL_BUILDER')) { + $f = BIBTEXBROWSER_URL_BUILDER; + return $f($this); + } + return BIBTEXBROWSER_URL.'?'.createQueryString(array('key'=>$this->getKey())); + } + + /** Tries to build a good absolute URL for this entry */ + function getAbsoluteURL() { + if (defined('BIBTEXBROWSER_URL_BUILDER')) { + $f = BIBTEXBROWSER_URL_BUILDER; + return $f($this); + } + return "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/'.$this->getURL(); } /** returns a "[pdf]" link if relevant */ @@ -1229,7 +1241,7 @@ class BibEntry { echo ''; echo bib2html($this); - $href = 'href="'.BIBTEXBROWSER_URL.'?'.createQueryString(array(Q_KEY => $this->getKey())).'"'; + $href = 'href="'.$this->getURL().'"'; // we add biburl and title to be able to retrieve this important information // using Xpath expressions on the XHTML source @@ -2713,7 +2725,7 @@ class RSSDisplay { ?> <?php echo $this->text2rss($bibentry->getTitle());?> - getURL());?> + getAbsoluteURL();?> Computing Model Complexity - http://www.ilogix.com/whitepapers/whitepapers.cfm + http://localhost./bibtexbrowser.php?key=Douglass2004&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Bruce Powel Douglass, "Computing Model Complexity", 2004. @@ -350,7 +350,7 @@ Dynamic Metrics for Java - http://www.sable.mcgill.ca/publications/papers/2003-5/sable-paper-2003-5.pdf + http://localhost./bibtexbrowser.php?key=dufour03&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Bruno Dufour, Karel Driesen, Laurie Hendren, Clark Verbrugge, "Dynamic Metrics for Java", In Proceedings of the ACM SIGPLAN 2003 Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'03), ACM Press, pp. 149-168, 2003. @@ -449,7 +449,7 @@ Defining and Validating Metrics for UML Statechart Diagrams - http://alarcos.inf-cr.uclm.es/qaoose2002/docs/QAOOSE-Gen-Mir-Pia.pdf + http://localhost./bibtexbrowser.php?key=Genero2002&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib M. Genero, D. Miranda, M. Piattini, "Defining and Validating Metrics for UML Statechart Diagrams", In Proceedings of QAOOSE'2002, 2002. @@ -539,7 +539,7 @@ Characterizing the Evolution of Class Hierarchies - http://www.iam.unibe.ch/~scg/Archive/Papers/Girb05aHierarchiesEvolution.pdf + http://localhost./bibtexbrowser.php?key=girba05a&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Tudor Gîrba, Michele Lanza, Stéphane Ducasse, "Characterizing the Evolution of Class Hierarchies", In Proceedings of the 9th European Conference on Software Maintenance and Reengineering (CSMR'05), IEEE Computer Society, pp. 2-11, 2005. @@ -665,7 +665,7 @@ Software Metrics as Class Graph Properties - http://www.cs.utwente.nl/~kastenbe/public/Master_Thesis.pdf + http://localhost./bibtexbrowser.php?key=Kastenberg2004&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Harmen Kastenberg, "Software Metrics as Class Graph Properties", Master's thesis, University of Twente, 2004. @@ -683,7 +683,7 @@ Developing Software Metrics Applicable to UML Models - http://alarcos.inf-cr.uclm.es/qaoose2002/docs/QAOOSE-Kim-Bol.pdf + http://localhost./bibtexbrowser.php?key=Kim2002&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Hyoseob Kim, Cornelia Boldyreff, "Developing Software Metrics Applicable to UML Models", In Proceedings of QAOOSE'2002, 2002. @@ -737,7 +737,7 @@ Beyond Language Independent Object-Oriented Metrics: Model Independent Metrics - http://www.iam.unibe.ch/~scg/Archive/Papers/Lanz02bModelIndependentMetrics.pdf + http://localhost./bibtexbrowser.php?key=Lanza2002&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Michele Lanza, Stéphane Ducasse, "Beyond Language Independent Object-Oriented Metrics: Model Independent Metrics", In Proceedings of the 6th International Workshop on Quantitative Approaches in Object-Oriented Software Engineering, pp. 77-84, 2002. @@ -755,7 +755,7 @@ Automated Measurement of UML Models: an open toolset approach - http://www.jot.fm/issues/issue_2005_05/article2 + http://localhost./bibtexbrowser.php?key=Lavazza2005&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Luigi Lavazza, Alberto Agostini, "Automated Measurement of UML Models: an open toolset approach", In Journal of Object Technology, vol. 4, no. 4, pp. 115-134, 2005. @@ -800,7 +800,7 @@ Measuring the Requirements Management Key Process Area - http://www.cs.umu.se/~jubo/Projects/QMSE/ESCOM2001.pdf + http://localhost./bibtexbrowser.php?key=Loconsole2001&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Annabella Loconsole, "Measuring the Requirements Management Key Process Area", In Proceedings of the 12th European Software Control and Metrics Conference (ESCOM'2001), 2001. @@ -935,7 +935,7 @@ Metrology - in short - http://www.euromet.org/docs/pubs/docs/Metrology_in_short_2nd_edition_may_2004.pdf + http://localhost./bibtexbrowser.php?key=Metrotrade2003&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Metrotrade Project, Regmet Project, "Metrology - in short", European Association of National Metrology Institutes, 2003. @@ -980,7 +980,7 @@ La mesure des modèles par les modèles : une approche générative - http://www.monperrus.net/martin/la-mesure-des-modeles-par-les-modeles-une-approche-generative.pdf + http://localhost./bibtexbrowser.php?key=monperrus08phd&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, "La mesure des modèles par les modèles : une approche générative", PhD thesis, Université de Rennes, 2008. (Advisor: JM. Jézéquel; Examiners: H. Sahraoui, S. Ducasse) @@ -989,7 +989,7 @@ Counts Count - http://www.monperrus.net/martin/Counts_Count.pdf + http://localhost./bibtexbrowser.php?key=monperrus07&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, Joël Champeau, Brigitte Hoeltzener, "Counts Count", In Proceedings of the 2nd Workshop on Model Size Metrics (MSM'07) co-located with MODELS'2007, 2007. @@ -998,7 +998,7 @@ Measuring Models - http://www.monperrus.net/martin/Measuring-models-in-Model-Driven-Software-Development-Integrating-Quality-Assurance.pdf + http://localhost./bibtexbrowser.php?key=monperrus08b&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, Jean-Marc Jézéquel, Joël Champeau, Brigitte Hoeltzener, "Measuring Models", Chapter in Model-Driven Software Development: Integrating Quality Assurance, IDEA Group, 2008. @@ -1007,7 +1007,7 @@ Model-Driven Engineering (MDE) is an approach to software development that uses Model-driven Engineering Metrics for Real Time Systems - http://www.monperrus.net/martin/Model-driven_Engineering_Metrics_for_Real_Time_Systems.pdf + http://localhost./bibtexbrowser.php?key=monperrus08a&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, Jean-Marc Jézéquel, Joël Champeau, Brigitte Hoeltzener, "Model-driven Engineering Metrics for Real Time Systems", In Proceedings of the 4th European Congress on Embedded Real Time Software (ERTS'2008), 2008. @@ -1016,7 +1016,7 @@ Model-Driven Engineering (MDE) is an approach to software development that uses A Model-driven Measurement Approach - http://www.monperrus.net/martin/A-Model-Driven-Measurement-Approach.pdf + http://localhost./bibtexbrowser.php?key=monperrus08d&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, Jean-Marc Jézéquel, Joël Champeau, Brigitte Hoeltzener, "A Model-driven Measurement Approach", In Proceedings of the ACM/IEEE 11th International Conference on Model Driven Engineering Languages and Systems (MODELS'2008), 2008. (acceptance rate: 58/274) @@ -1115,7 +1115,7 @@ Model-Driven Engineering (MDE) is an approach to software development that uses Measuring OCL expressions: a "tracing"-based approach - http://www-ctp.di.fct.unl.pt/QUASAR/QAOOSE2003/papers/OCLM-QAOOSE03.pdf + http://localhost./bibtexbrowser.php?key=Reynoso2003&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Luis Reynoso, Marcela Genero, Mario Piattini, "Measuring OCL expressions: a "tracing"-based approach", In Proceedings of QAOOSE'2003, 2003. @@ -1124,7 +1124,7 @@ Model-Driven Engineering (MDE) is an approach to software development that uses Embedding Metrics into Information Systems Development Methods: An Application of Method Engineering Technique - http://link.springer.de/link/service/series/0558/bibs/2681/26810374.htm + http://localhost./bibtexbrowser.php?key=Saeki2003&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Motoshi Saeki, "Embedding Metrics into Information Systems Development Methods: An Application of Method Engineering Technique", In CAiSE, pp. 374-389, 2003. @@ -1169,7 +1169,7 @@ Model-Driven Engineering (MDE) is an approach to software development that uses The Software Design Metrics tool for the UML (http://www.sdmetrics.com/) - http://www.sdmetrics.com/ + http://localhost./bibtexbrowser.php?key=sdmetrics&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib SDMetrics, "The Software Design Metrics tool for the UML (http://www.sdmetrics.com/)", 2006. diff --git a/test/output/7927fcd8654efc9521cae97590ac1e7b.html b/test/output/7927fcd8654efc9521cae97590ac1e7b.html index f9f737b..e66895a 100755 --- a/test/output/7927fcd8654efc9521cae97590ac1e7b.html +++ b/test/output/7927fcd8654efc9521cae97590ac1e7b.html @@ -8,7 +8,7 @@ La mesure des modèles par les modèles : une approche générative - http://www.monperrus.net/martin/la-mesure-des-modeles-par-les-modeles-une-approche-generative.pdf + http://localhost./bibtexbrowser.php?key=monperrus08phd&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, "La mesure des modèles par les modèles : une approche générative", PhD thesis, Université de Rennes, 2008. (Advisor: JM. Jézéquel; Examiners: H. Sahraoui, S. Ducasse) @@ -17,7 +17,7 @@ A Model-driven Measurement Approach - http://www.monperrus.net/martin/A-Model-Driven-Measurement-Approach.pdf + http://localhost./bibtexbrowser.php?key=monperrus08d&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, Jean-Marc Jézéquel, Joël Champeau, Brigitte Hoeltzener, "A Model-driven Measurement Approach", In Proceedings of the ACM/IEEE 11th International Conference on Model Driven Engineering Languages and Systems (MODELS'2008), 2008. (acceptance rate: 58/274) @@ -26,7 +26,7 @@ Measuring Models - http://www.monperrus.net/martin/Measuring-models-in-Model-Driven-Software-Development-Integrating-Quality-Assurance.pdf + http://localhost./bibtexbrowser.php?key=monperrus08b&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, Jean-Marc Jézéquel, Joël Champeau, Brigitte Hoeltzener, "Measuring Models", Chapter in Model-Driven Software Development: Integrating Quality Assurance, IDEA Group, 2008. @@ -35,7 +35,7 @@ Model-Driven Engineering (MDE) is an approach to software development that uses Model-driven Engineering Metrics for Real Time Systems - http://www.monperrus.net/martin/Model-driven_Engineering_Metrics_for_Real_Time_Systems.pdf + http://localhost./bibtexbrowser.php?key=monperrus08a&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, Jean-Marc Jézéquel, Joël Champeau, Brigitte Hoeltzener, "Model-driven Engineering Metrics for Real Time Systems", In Proceedings of the 4th European Congress on Embedded Real Time Software (ERTS'2008), 2008. @@ -44,7 +44,7 @@ Model-Driven Engineering (MDE) is an approach to software development that uses Counts Count - http://www.monperrus.net/martin/Counts_Count.pdf + http://localhost./bibtexbrowser.php?key=monperrus07&amp;bib=%252Fvar%252Fwww%252Fbibtexbrowser%252Ftest%252Finput%252Fmetrics.bib Martin Monperrus, Joël Champeau, Brigitte Hoeltzener, "Counts Count", In Proceedings of the 2nd Workshop on Model Size Metrics (MSM'07) co-located with MODELS'2007, 2007.