"show all" default query

Help
2010-01-26
2013-05-28
  • matteoireneo
    matteoireneo
    2010-01-26

    Dear Matthias,

    I need to add the "Type" column to the "show all" link resulting page for not logged users.

    I've noticed that if I change the url in my browser from
    refbase/search.php?sqlQuery=SELECT%20author%2C%20title%2C%20year%2C%20publication%2C%20volume%2C%20pages%20FROM%20refs%20WHERE%20serial%20RLIKE%20%22.%2B%22%20ORDER%20BY%20author%2C%20year%20DESC%2C%20publication&client=&formType=sqlSearch&submit=List&viewType=&showQuery=0&showLinks=1&showRows=5&rowOffset=&wrapResults=1&citeOrder=&citeStyle=RBCS&exportFormat=RIS&exportType=html&exportStylesheet=&citeType=html&headerMsg=

    to

    refbase/search.php?sqlQuery=SELECT%20type%2Cauthor%2C%20title%2C%20year%2C%20publication%2C%20volume%2C%20pages%20FROM%20refs%20WHERE%20serial%20RLIKE%20%22.%2B%22%20ORDER%20BY%20author%2C%20year%20DESC%2C%20publication&client=&formType=sqlSearch&submit=List&viewType=&showQuery=0&showLinks=1&showRows=5&rowOffset=&wrapResults=1&citeOrder=&citeStyle=RBCS&exportFormat=RIS&exportType=html&exportStylesheet=&citeType=html&headerMsg=

    it works, but I need to make this the default behavior.

    I've searched a lot both in the code and in the Database, but I can't find where is located this query.

    Any help will be really reallyreally  appreciated.

    Matteo

     
  • Hi Matteo,

    I need to add the "Type" column to the "show all" link resulting page for not logged users.

    If it would be ok for you to always display the 'type' field in List view by default, then there's a very easy solution:

    Open file 'initialize/ini.inc.php' and add the 'type' field to one of these variables:

    $defaultFieldsListViewMajor
    $defaultFieldsListViewMinor

    See the comments above these variables for more info.

    If you only want to add the 'type' field when a user clicks the "Show All" link, then you'll need to modify its URL in file 'includes/header.inc.php' (on line 166 in case of refbase-0.9.5). As link URL, you could use a raw 'search.php' query similar to the one you've given.

    And if you want to display the 'type' field only for anonymous users (i.e. users who aren't logged in), then you'd need to make two variants of "Show All" links and wrap them like this:

    if (isset($_SESSION['loginEmail']))
    {
        <a href="show.php?records=all" ...
    }
    else
    {
        <a href="search.php?sqlQuery=SELECT%20type%2C ...
    }
    

    Let me know if you need help with this.

    HTH, Matthias

     
  • Aargh, SourceForge really has a problem with their forum message editor… :-( Sorry for the garbled code. Here it is again, in plain text:

    if (isset($_SESSION))
    {
        <a href="show.php?records=all" …
    }
    else
    {
        <a href="search.php?sqlQuery=SELECT%20type%2C …
    }

    M.

     
  • matteoireneo
    matteoireneo
    2010-01-28

    thank you it works perfectly, you've been really helpful.

    best regards
    Matteo