VuFind
  1. VuFind
  2. VUFIND-318

Add more configurable settings to Book Previews

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.4
    • Component/s: Record, Search
    • Labels:
      None
    • Environment:
      All

      Description

      Some additional configurable options include:
      - Allow libraries in the United States to include the "pdus" (public domain united states) rights code for the Hathi Trust. It is currently limited to "world" and "pd"
      - Allow configuration of Limited View only or Full View only or Both for Open Library and Google Book Search

      These things are easy to do in the JS functions, but the difficulty is in passing the options specified in config.ini into scripts.js. Some suggestions from Demian:
      1.) Modify the UInterface class and layout.tpl to make some additional global Javascript assignments (maybe even a JS "configArray" variable containing a handful of relevant settings). Main disadvantage: overhead on every single page for something used in only a few places.

      2.) Create an .htaccess file that allows PHP processing of .js files, and inject the settings directly into scripts.js. Main disadvantage: more PHP processing.

      3.) Add new parameters to the relevant functions; pass in the relevant values. Main disadvantage: more complicated function calls in the templates.

      4.) Add some kind of AJAX handler to obtain the settings. Main disadvantage: extra AJAX calls - this is really overkill.
      1. config-previews 09-05-12.patch
        22 kB
        Ronan McHugh
      2. config-previews 15-05-12.patch
        36 kB
        Ronan McHugh
      3. config previews 16-05-12.patch
        46 kB
        Demian Katz
      4. config-previews 29-03-12.patch
        17 kB
        Ronan McHugh
      5. config-previews 30-03-12.patch
        22 kB
        Ronan McHugh
      6. IndexOf.patch
        1 kB
        Ronan McHugh

        Activity

        Hide
        Ronan McHugh (Inactive) added a comment -
        Uploaded patch config-previews 29-03-12.

        Summary:

        This patch modifies the various preview functions to enable an administrator to modify the preview parameters without altering the code. The reason for this is that different institutions may have different access rights to documents in Hathi Trust (for geographic or other reasons) or simply have different requirements in terms of what type of previews ought to be displayed. In both cases, the relevant settings are altered in config.ini. If no settings are found, the scripts will default to their current behaviour.

        Hathi Trust:

        Hathi Trust provide a large number of details about access rights for books. At present, the preview function is hard-coded to only accept books which are in the public domain (pd) or available to the whole world (world). American institutions may have the right to access books which are classified as umall. In addition, all libraries should have the right to access books which are classified as creative commons (several variants of cc). This fix allows the user to set the rights codes that will be accepted/rejected before displaying previews.

        The permissible rights codes are set in config.ini. These are accessed in results.php and passed to list.tpl. list.tpl calls a js function which sets the value of the HathiRights codes accepted. These are then called in the Hathi trust callback function which checks results against them before displaying.

        Google Books / Open Library:

        Google Books and Open Library offer three types of "previews". These are full, partial and noview, where noview represents an index page with some additional content, including reviews and ratings. At present, the JS code is hardcoded to only accept full or partial previews. Some institutions may prefer to accept all three types, only full previews etc. This fix enables the administrator to specify which types of previews will be displayed.

        The permissible rights codes are set in config.ini. These are accessed in results.php and passed to list.tpl. list.tpl calls a js function which sets the value of the view types accepted. These are then called in the GoogleBooks / OLcallback function which checks results against them before displaying.
        Show
        Ronan McHugh (Inactive) added a comment - Uploaded patch config-previews 29-03-12. Summary: This patch modifies the various preview functions to enable an administrator to modify the preview parameters without altering the code. The reason for this is that different institutions may have different access rights to documents in Hathi Trust (for geographic or other reasons) or simply have different requirements in terms of what type of previews ought to be displayed. In both cases, the relevant settings are altered in config.ini. If no settings are found, the scripts will default to their current behaviour. Hathi Trust: Hathi Trust provide a large number of details about access rights for books. At present, the preview function is hard-coded to only accept books which are in the public domain (pd) or available to the whole world (world). American institutions may have the right to access books which are classified as umall. In addition, all libraries should have the right to access books which are classified as creative commons (several variants of cc). This fix allows the user to set the rights codes that will be accepted/rejected before displaying previews. The permissible rights codes are set in config.ini. These are accessed in results.php and passed to list.tpl. list.tpl calls a js function which sets the value of the HathiRights codes accepted. These are then called in the Hathi trust callback function which checks results against them before displaying. Google Books / Open Library: Google Books and Open Library offer three types of "previews". These are full, partial and noview, where noview represents an index page with some additional content, including reviews and ratings. At present, the JS code is hardcoded to only accept full or partial previews. Some institutions may prefer to accept all three types, only full previews etc. This fix enables the administrator to specify which types of previews will be displayed. The permissible rights codes are set in config.ini. These are accessed in results.php and passed to list.tpl. list.tpl calls a js function which sets the value of the view types accepted. These are then called in the GoogleBooks / OLcallback function which checks results against them before displaying.
        Hide
        Ronan McHugh (Inactive) added a comment -
        Note that this patch caused an error in displaying previews on individual record pages. A fix for this has been made and will be uploaded once tested.
        Show
        Ronan McHugh (Inactive) added a comment - Note that this patch caused an error in displaying previews on individual record pages. A fix for this has been made and will be uploaded once tested.
        Hide
        Ronan McHugh (Inactive) added a comment -
        New patch uploaded which fixes bug in previous patch - previews now show correctly on individual record pages.
        Show
        Ronan McHugh (Inactive) added a comment - New patch uploaded which fixes bug in previous patch - previews now show correctly on individual record pages.
        Hide
        Ronan McHugh (Inactive) added a comment -
        New patch uploaded. This allows users to set different settings for Google and Open Library and corrects some errors from the previous patch.
        Show
        Ronan McHugh (Inactive) added a comment - New patch uploaded. This allows users to set different settings for Google and Open Library and corrects some errors from the previous patch.
        Hide
        Ronan McHugh (Inactive) added a comment -
        One more time with feeling: some refactoring and improvements.

        1) redundant variables removed.
        2) If / else statements replaced with ternary operator (*shudder*)
        3) Blueprint tpls and js methods updated to make them more jqeryish
        4) Config settings checked for whitespace before passing to functions.
        5) Duplicate code replaced with single method in Interface.php.
        Show
        Ronan McHugh (Inactive) added a comment - One more time with feeling: some refactoring and improvements. 1) redundant variables removed. 2) If / else statements replaced with ternary operator (*shudder*) 3) Blueprint tpls and js methods updated to make them more jqeryish 4) Config settings checked for whitespace before passing to functions. 5) Duplicate code replaced with single method in Interface.php.
        Hide
        Demian Katz added a comment - - edited
        Committed as r5641 with some minor adjustments (style fixes, reduced duplicate "<script>...</script>" tags, fixed incorrectly-named HathiTrust parameter in config.ini, finished incomplete mobile implementation). I've uploaded an updated patch reflecting the committed version of the code.
        Show
        Demian Katz added a comment - - edited Committed as r5641 with some minor adjustments (style fixes, reduced duplicate "<script>...</script>" tags, fixed incorrectly-named HathiTrust parameter in config.ini, finished incomplete mobile implementation). I've uploaded an updated patch reflecting the committed version of the code.
        Hide
        Ronan McHugh (Inactive) added a comment -
        I introduced an error in this code - Internet Explorer doesn't support Array.indexOf() meaning that previews break in IE for blueprint. I have attached a patch which defines the function for non-compatible browsers which should fix this. Apologies for the error.

        See: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf for more details.
        Show
        Ronan McHugh (Inactive) added a comment - I introduced an error in this code - Internet Explorer doesn't support Array.indexOf() meaning that previews break in IE for blueprint. I have attached a patch which defines the function for non-compatible browsers which should fix this. Apologies for the error. See: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf for more details.
        Hide
        Demian Katz added a comment -
        Fix committed as r5970 -- thanks!
        Show
        Demian Katz added a comment - Fix committed as r5970 -- thanks!

          People

          • Assignee:
            Demian Katz
            Reporter:
            Eoghan Ó Carragáin
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: