Menu

Hiding fields in record.php

Help
Jens
2009-12-10
2013-05-28
  • Jens

    Jens - 2009-12-10

    Hello,

    as we don't need most of the possible fields in the input form, my goal is to hide (most of) the 'otherfields'. Unfortunately I do not have any skills in php, just im html. :-(

    Can someone give me a hint where to put my comments in record.php? First one I don't need is adress, so I could start at line 1275, but what's about the 'command-lines', eg. if, echo?

    Thank you Jens

     
  • Matthias Steffens

    Hi Jens,

    > as we don't need most of the possible fields in the input  form,
    > my goal is to hide (most of) the 'otherfields'. Unfortunately
    > I do not have any skills in php, just im html. :-(

    With a bit of PHP knowledge editing of 'record.php' should be doable. But if you don't feel comfortable editing PHP, then it might be a bit hard to get it right.

    What fields do you want to hide? Or, if the list is shorter: which fields do you'd like to keep?

    I might be able to assist you with the editing task, but this may depend on the amount of customization that you'd like to achieve.

    Btw, slightly related: When browsing records in Details view, the display of the "other" and "user-specific" fields can be hidden by default by setting these variables & values in file ''initialize/ini.inc.php'':

        $showAdditionalFieldsDetailsViewDefault = "no";
        $showUserSpecificFieldsDetailsViewDefault = "no";

    However, these variables don't change the field layout of 'record.php'.

    Matthias

     
  • Jens

    Jens - 2009-12-14

    > But if you don't feel comfortable editing PHP, then it might be a bit hard to get it right.

    As I am not afraid of using nano and just a little bit afraid of using vim, I think is not the main problem. ;-)

    > What fields do you want to hide?

    I want to keep the fields shown in Details view with the 'other' and the user-specific' fields hidden, as I already turned them off in ini.inc.php.

    I think line 1275 is a good point to start…

        $showAdditionalFieldsDetailsViewDefault = "no";
        $showUserSpecificFieldsDetailsViewDefault = "no";

    Got them already! :-)

    Jens

     
  • Jens

    Jens - 2009-12-14

    Is it better to let the code for filling empty dropdown-lists uncommented (e.g. lines 1286 to 1291)?

    Jens

     
  • Matthias Steffens

    Hi Jens,

    > I want to keep the fields shown in Details view with the 'other'
    > and the user-specific' fields hidden

    Ok, that should be doable. Things would get trickier if you'd want to show just some of the "other" or "user-specific" fields, or if you'd like to hide the 'call_number' and 'serial' fields from the edit form.

    > Is it better to let the code for filling empty dropdown-lists
    > uncommented (e.g. lines 1286 to 1291)?

    It should be ok to comment these out as well.

    The following modifications to 'record.php' should hide all of the "other" and "user-specific" fields. If my edit instructions are too hard to follow, let me know, and I'll send you a modified file.

    The given line numbers assume refbase-0.9.5, and that you have completed the previous step.

    Here you go:

    1) Make a backup copy of the original 'record.php', then open 'record.php' in a text editor.

    2) Goto line 1273 and put your cursor at the very end of that line. Select everyting from the following return up to (and including) the next dot character.

    3) Paste the following code block:

        ;
        /*
        echo

    4) Goto line 1398 and put your cursor at the very end of that line. Select everyting from the following return up to (and including) the next dot character.

    5) Paste the following code block:

        ;
        */
        echo

    6) Goto line 1421 and put your cursor at the very end of that line. Select everyting from the following return up to (and including) the next dot character.

    7) Paste the following code block:

        ;
        /*
        echo

    8) Goto line 1494 and put your cursor at the very end of that line. Select everyting from the following return up to (and including) the next dot character.

    9) Paste the following code block:

        ;
        */
        echo

    10) Put your cursor on line 1524 (which is empty) and insert `/*` on that line.

    11) Goto line 1558 and put your cursor at the very end of that line. Select everyting from the following return up to (and including) the next dot character.

    12) Paste the following code block:

        ;
        */
        echo

    Save the file and upload this modified copy of 'record.php' to your webserver (if necessary) and open it in your browser. The "other" and "user-specific" fields should now be hidden from the edit form.

    Let me know if this doesn't work for you.

    Matthias

     
  • Jens

    Jens - 2009-12-15

    This one was nearly too easy. ;-) You even gave me the updated line-numbers. I first tried to change the file backwards to avoid changing line-numbers during the edit…

    Unfortunately I did not  take care of which fields exactly are the 'other' and the user-specific' ones. :-( My own fault!

    I want to have an edit-form showing the fields according to the details view with the preferences

        $showAdditionalFieldsDetailsViewDefault = "no";
        $showUserSpecificFieldsDetailsViewDefault = "no";

    These are: Author, Title, Type, **Year, Publication, Abbreviated Journal, Volume, Issue, Pages, Keywords and Abstract**. To hide Call Number and Serial is not necessary. But following your instructions made me losing the bold ones… It would be great to hide the 'File-Line', too. But I want to keep the URL.

    Gruß & Dank

    Jens

     
  • Matthias Steffens

    Hi Jens,

    I'm not sure why you lost the "bold fields", my modifications did not remove these. Anyways, I've put the modified 'record.php' for download .

    : http://store.extracts.de/record.php_modified.zip

    Does this work better?

    This new version also hides the 'file' field, but does not hide the 'location' field, since I realized that this might cause problems.

    Matthias

     
  • Jens

    Jens - 2009-12-15

    Hmm,

    I gave it another try (just to satisfy my ambition) and this time it worked out. I even moved the leading comment, so the 'file' field is hidden.

    I am looking forward to the next release including templates! ;-)

    Thank you very much!

    Jens

     
  • Matthias Steffens

    Hi Jens,

    glad that it worked for you now.

    But have you also tried the download file given in my previous post?

    In addition to hiding the 'file' field, that version makes sure that the 'location' field is displayed. The latter is currently necessary to ensure proper functionality of refbase. So, if possible, please use that file instead.

    > I am looking forward to the next release including templates! ;-)

    I fear that this will have to wait. Adopting a full-blown template engine would mean a lot of restructuring of the code. Sure, it's possible, but somebody has to take the time to do it. Personally, I'd like to (finally) fix other things first (such as the much-wanted public groups feature).

    Best, Matthias

     
  • Jens

    Jens - 2009-12-16

    > In addition to hiding the 'file' field, that version makes sure that the 'location' field is displayed. The latter is currently necessary to ensure proper functionality of refbase. So, if possible, please use that file instead.

    No problem! I will customize the localization files for our further needs.

    Thanks a lot for your help,
    Jens

     
  • Matthias Guth

    Matthias Guth - 2010-02-11

    Hi there,

    I did various changes on the record.php including a switch between a "simple mode" and an "extended mode. The extended mode correspond to the usual refbase input mask. In simple mode not needed fields are hidden.

    I realised this by a small javascript function added to "javascript/common.js" and extending the <tr> or <td> tag of the table like this:

    <tr style=\"display : none\" class=\"ghost\">
    

    By clicking on the "change mode" switch "display" is set to table-row (respectively  table-cell).

    Maybe this could be an alternative.

    Greetings,
    Matthias

     

Log in to post a comment.