diff --git a/bibtexbrowser.local.php b/bibtexbrowser.local.php index 1f68dbf..12a6f77 100644 --- a/bibtexbrowser.local.php +++ b/bibtexbrowser.local.php @@ -4,6 +4,18 @@ @define('USEBIBTHUMBNAIL',0); @define('BIBTHUMBNAIL','thumbnail'); +/** does nothing but calls method display() on the content and use javascript if needed. +*/ +class JsWrapper { + function JsWrapper(&$content) { + echo $content->display(); + if (BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) { + javascript(); + } + } +} + + function MGBibliographyStyle(&$bibentry) { $title = $bibentry->getTitle(); $type = $bibentry->getType(); @@ -144,5 +156,6 @@ class BibliographyDisplay { } // end class + ?> diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 2521ed5..a41c621 100644 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -122,6 +122,8 @@ define('BIBTEXBROWSER','v20130206'); @define('METADATA_EPRINTS',false); @define('LAYOUT','table'); // may be table/list/deflist. defines the HTML rendering options (,
    ,
    , resp.). 'list' only works with 'ABBRV_TYPE'='index'. +@define('ICONS','[]'); +@define('Q_ICONS','icons'); // in embedded mode, we still need a URL for displaying bibtex entries alone // this is usually resolved to bibtexbrowser.php @@ -153,6 +155,7 @@ See also zetDB(). function setDB() { list($db, $parsed, $updated, $saved) = _zetDB(@$_GET[Q_FILE]); $_GET[Q_DB] = $db; + $_GET[Q_ICONS] = (array) json_decode(ICONS); return $updated; } @@ -1055,17 +1058,15 @@ class BibEntry { } /** replace [$ext] with an icon whose url is defined in a string - * e.g. getIconOrTxt('pdf') will show the icon defined by @string{icon_pdf=""} or print '[pdf]' - * or getIconOrTxt('pdf','paper') will show the icon defined by @string{icon_pdf=""} or print '[paper]' + * e.g. getIconOrTxt('pdf') will show the icon defined in $_GET[Q_ICONS]['pdf'] or print '[pdf]' + * or getIconOrTxt('pdf','paper') will show the icon defined by $_GET[Q_ICONS]['pdf'] or print '[paper]' * The replacement text is also used if the url does not point to a valid file (using the "alt" property of the "img" html tag) - * Warning: by convention @string are case sensitive */ function getIconOrTxt($ext,$def=NULL) { - // e.g. @STRING{icon_pdf="http://mywebsite/pdf.png"} if ($def==NULL) { $def=$ext; } - $stringkey = strtolower('icon_'.$ext); - if (isset($_GET[Q_DB]->stringdb[$stringkey])){ - $str='['.$def.']'; + $icons = $_GET[Q_ICONS]; + if ( array_key_exists($ext,$icons) ) { + $str='['.$def.']'; } else { $str='['.$def.']'; } @@ -2419,7 +2420,6 @@ class SimpleDisplay { } // end foreach layoutFooterHTML(); - } // end function } // end class