I'm trying to customize the fields displayed on a individual record pages (ie the page that gives you all what is know about a record, from title to ISSN and call number, etc). I would like to NOT display some fields, for example to remove corporate authors, address, medium, approved, call number, etc.
I have been trying to modify the search.php files, but I'm lost. Is there a way to define which fields we want to display and which fields we don't want to display. Then I'm thinking that it would be great to have the option to do that dynamically: just display non-empty fields? Has someone been able to implement that?
Thanks to everyone. I'm installing refbase for a lab database, first time I discover it...
we plan to make the display of full record details ("details view") more flexible in the future, e.g. by introducing small triangle widgets which could be clicked to toggle the display of particular groups of fields.
There's currently no easy way of defining which fields will be displayed in details view (like a prefs setting or the like). See below for some guidance for hacking the code. But, first off, I'd like to explain the reasoning behind the current layout of the refbase details view:
While showing only those fields which contain content might make sense (and is used by other bibliographic software), I don't think that this would be a good decision from an interface design point of view -- and I must admit that I wouldn't really like this myself. The main reason is that the refbase details view currently employs a two-dimensional layout of fields. Most (if not all) other web-based bibliographic tools I'm aware of simply print all fields below each other (i.e. they employ a one-dimensional layout), and they often print only fields that have content. While this latter approach reduces the number of displayed fields for a given record, this causes fields to switch position (when viewing different records), and the user has to always search for a particular field visually. In addition, it makes the comparison of similar records displayed in different windows/tabs pretty difficult (if not impossible).
These issues don't exist with the current refbase layout which always shows all fields at a fixed position. While this may overwhelm users initially, my experience is that users quickly familiarize with the the layout of the details view (and the add/edit form). This is since the refbase layout allows users to memorize the location of a particular field visually, i.e., after some time working with refbase, users don't need to visually search for a particular field, but instead remember that it's located, say, on the lower-right hand side of the page. It's the same how menus work on all current GUI systems, users often don't recall the exact name of a menu entry, but they surely remember the approximate position of the menu entry on the screen. It would be a user-interface nightmare if main menu entries would completely disappear based on context, instead non-applicable entries are usually grayed out.
All that being said, if you prefer to reduce the number of fields in details view, you currently need to hack at least(*) 'search.php'. The number (and order) of fields displayed in details view is determined by the list of columns given in the SELECT clause of the SQL query that's included in the "show details" link. This link is defined in the 'printLinks()' function. Editing this link is currently kinda ugly since the link is written as a raw URL-encoded string (we'll improve this in a future version). In refbase-0.9.0, the "show details" link is generated in 'search.php' between lines 5446 and 5460 (you could also search for "show details" to find the relevant code section).
[(*) Note that there are more places within the refbase code where SQL commands are generated to display records in details view. Currently, all these SQL commands would need to be adjusted.]
The 'address' field spans a single line on the refbase "details view", so it's rather easy to remove it: just remove the string "%2C%20address" from lines 5446 and 5449. This should remove the field from details view.
In case of the other fields you mentioned ('corporate_author', 'medium', 'approved', 'call_number'), the situation is more tricky. This is since the 'displayDetails()' function applies logic based on whether fields occur at the right or left hand side of the current layout. I.e., if you don't remove entire lines but only part of the fields displayed on one line, then this will destroy the integrity of the current "details view" layout. To see what I mean, try removing the string "%2C%20corporate_author" from lines 5446 and 5449, reload the refbase column view (i.e. the search results list) and click again on a details link. You'll see that the 'thesis' field is now printed off position.
So, if possible, it's currently best to remove entire lines from the layout. Otherwise you'd also need to hack function 'displayDetails()' in 'search.php'. Let me know if you want to do this. Note that even if you've managed to remove all fields successfully, the add/edit mask will still display these fields, so there'd be more work do be done...
I'm still not sure if what you're trying to do is actually worth the trouble, and if the interface would really benefit from it. If you have just started to use refbase, I'd encourage you to try it first in its default design and see how it goes. If your users keep complaining about the refbase page layout, you can still change the layout then.
Anyways, we should probably try to increase the flexibility of the layout so that users could adopt the number of displayed fields more easily.
Thanks Matthias for the quick and detailled reply !! I have edited the show details command in the search.php file, and it seems to work. Great! Could you please tell me where should I adjust other SQL commands?
You should adopt at least the SQL commands on the lines below (given line numbers are for refbase-0.9.0):
'receipt.php', lines 106 and 109
'search.php', line 4923
'show.php', line 480 (note that this will also affect export of records which may not be desirable)
I could have overlooked something, so there might be more locations.
Changes like this will only get easier when we have properly separated SQL queries from PHP code (which is desirable but tricky), and when refbase supports some kind of template/skin mechanism.
I would like to hide some fields in Details View, too. As I have 0.9.5 installed I cannot get it work with the information above. Can you tell me where I have to change the SQL query?
Thank you very much.
what fields exactly do you wish to hide from Details view?
the following field would be nice to be hidden:
address, corporate author, editor, original title, series editor, series title, abbr. series title, series volum, series issue.
Thank you for your support.
the layout of the Details view is currently not as flexible as we'd like. While it's rather easy to omit entire blocks or rows of fields in Details view, it's much trickier to omit just a few single fields (instead of whole rows). This is since function 'displayDetails()' in file 'search.php' makes fixed assumptions about the width and position of fields (right, left or middle column).
In other words, it's possible to leave out just a few fields but you'd need to edit function 'displayDetails()' as well. I could help you with that if you want.
That said, I think it would be better if you'd first try to find full rows that you want/can omit, and see if you could live with that as well.
As an example, you've listed series editor, series title and abbreviated series title. These fields are all within one row. To hide this row, find function 'buildSELECTclause()' in file 'includes/include.inc.php' and remove the string ", series_editor, series_title, abbrev_series_title" from the value of variable '$querySELECTclause' at line 1470 (for refbase-0.9.5). You'll need to logout (and maybe even quit & restart your browser) to see the effect.
Things would be even easier if you could live with just the "grey" fields plus the keywords & abstract fields. In that case, you could just set variable '$showAdditionalFieldsDetailsViewDefault' in file 'initialize/ini.inc.php' to "no" and consider it done.
it would be OK for me to remove whole rows. So I removed ", series_editor, series_title, abbrev_series_title" from $querySELECTclause in line 1470. But nothing happended. Even after logout and restarting the browser. So I undoed the changes.
Then after a few minutes only the keywords and the abstract were displayed between pages and call number. So I copied the original include.inc.php into /include. But nothing changes in Details view.
Do you have an idea how to fix this?
Maybe I have to say that in ini.inc.php $showAdditionalFieldsDetailsViewDefault = "yes"
I tried it once again in the same way. Now it works, but I do not know why.
So, you helped me very good. Thank you very much.
I hope that it will work stable now.
the issues with your changes not being in effect immediately may have to do with the fact that refbase - for the time of your current session - remembers the last SELECT clause from a previous Details view query and tries to reapply it for the next Details view query (same is true for the other views). Therefore it's usually necessary to logout & restart your browser in order to see your changes. I'm not sure but session handling might also differ between browsers…
Anyways, I'm glad to hear it's working for you now!