#39 Extended field display in host list

Unstable (example)
closed
None
5
2014-05-26
2011-02-28
Nathan Lock
No

This patch is in response to feature request ID: 3024351 Show tag field in host interface.
It will display up to 3 extra fields in the host list. (it also includes the sort fix from 3194461)
If you change nothing it will show the Primary User, Tag 1 and Tag 2
It can also be configured to display any inventory fields you want - read on for details:-

---- Changing the settings -------

If you want to disable this extra behaviour on line 30 set $morefields = 0;

To choose which 3 fields you would like to display
configure $Label1, $Label2, $Label3 from lines 32-34
and $Field1, $Field2, $Field3 from lines 115 to 118

I have used these $ variables so that eventually these could be added as proper FOG VIEW SETTINGS if this code gets adopted.

Discussion

  • Nathan Lock

    Nathan Lock - 2011-02-28

    Extra host fields display patch

     
  • Chad Gray

    Chad Gray - 2011-03-02

    Nice! Is there any chance you could add the additional fields to the display when doing a search too? The search now looks in some of these fields as well, so it'd be useful to show them on screen (e.g. a search for a model type will work, but doesn't show the model on screen which is confusing!)

     
  • Nathan Lock

    Nathan Lock - 2011-03-04

    I have now added the changes to the ajax host search page too in response to request from chadgray.

     
  • Nathan Lock

    Nathan Lock - 2011-03-04

    improved host search file for ajax directory

     
  • Chad Gray

    Chad Gray - 2011-03-08

    Thanks for the update! This is a really great addition to FOG and should be made part of the official release.

    If I may make one suggestion, if you add some new values into the globalSettings table for the descriptions and field ids, this will prevent the need to manually edit the code. These fields will automagically appear on the "FOG Settings" page and can be changed there. The plugins operate in this way.

    Thanks,

    Chad

     
  • Nathan Lock

    Nathan Lock - 2011-03-08

    @Chad, that is exactly why I made the code use variables, so they could become fog settings at a later date, but I could not find any documentation on how to update the fog settings schema, there is a schema updater file, but when does that get run? on install/ on updates?

    post back if you know.

     
  • Chad Gray

    Chad Gray - 2011-03-08

    if you add to globalSettings you don't alter the database schema, you just add some values to a table. I did this for the plugin I wrote, based upon how the capone plugin worked.

    With a plugin I was able to write the new values when it is installed via the web interface.

    With your mods there is no installer, so seeing as they require command line access to install It would probably be as easy to provide a .sql file to do the DB entries, (and optionally a script file to run it if you prefer - you could do it in php and read the sql credentials from the config files so it would be prompt-free). There's a builtin function called "getSetting" which you can then use to read the value associated with your entries in globalsettings.

    Hope this makes sense... with the lack of input from authors/admins or any other design guidelines we're pretty much on our own - but this is certainly how plugins work.

    thanks again for the patches - very useful.

    Chad

     
  • Chad Gray

    Chad Gray - 2011-03-09

    Found a minor issue - if a PC has not been inventoried, the additional fields show the data of the previous record which returned data. This can be fixed by adding:

    else
    {
    $Field1="n/a";
    $Field2="n/a";
    $Field3="n/a";
    }

    after line 120 in hosts.list.include.php, catching the condition where no records are returned.

    Similar code inserted after line 169 in host.search.php will fix the same condition whilst searching.

    Cheers!

     
  • mastacontrola

    mastacontrola - 2014-05-26

    With the use of Hooks in 1.x.x, this is completely possible with a few additions where required. Closing this as it's no longer needed as a change to the core files. Those wanting this on past versions can still find and use this however.

    Thank you,

     
  • mastacontrola

    mastacontrola - 2014-05-26
    • status: open --> closed
    • assigned_to: mastacontrola
    • Group: --> Unstable (example)
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks