#280 list image ID in new web interface

open
nobody
5
2011-09-20
2011-09-20
starks325
No

When using the new interface version 0.3x it is not possible to view the image ID as one of the fields when Listing All Images

Discussion

  • schmalenegger
    schmalenegger
    2012-09-06

    Hi,

    here is a patch for showing the ID in the image listing:

    --- image.search.php_old 2011-06-11 08:52:05.000000000 +0200
    +++ image.search.php 2012-09-06 14:53:47.000000000 +0200
    @@ -74,7 +74,7 @@
    foreach ($data AS $item)
    {
    print '<tr class="' . (++$i % 2 ? 'alt1' : 'alt2') . '">
    - <td><a href="' . "?node=$node&sub=edit&imageid=$item[id]" . '" title="Edit">' . $item['name'] . '</a></td>
    + <td><a href="' . "?node=$node&sub=edit&imageid=$item[id]" . '" title="Edit">' . $item['name'] . ' (' . $item[id] . ')</a></td>
    <td>' . substr($item['description'], 0, 35) . '</td>
    <td align="center">' . $item['storagegroup'] . '</td>
    <td align="center"><a href="' . "?node=$node&sub=edit&imageid=$item[id]" . '"><span class="icon icon-edit" title="Edit: ' . $item['name'] . '"></span></a></td>

    Best regards,
    schmalenegger

     
  • SocialFish
    SocialFish
    2012-09-06

    Hi schmalenegger,

    Thanks for this. I'm not very experienced applying patches but when I spliced this back together guessing where the line breaks were supposed to be I'm getting:

    user@hostname:/var/www/fog/management/ajax$ sudo patch image.search.php image.search.php.patch
    patching file image.search.php
    Hunk #1 FAILED at 74.
    1 out of 1 hunk FAILED -- saving rejects to file image.search.php.rej

    Am I using the patch command incorrectly?
    Thanks!

     
  • SocialFish
    SocialFish
    2012-09-06

    Maybe I had some trailing white space or something but I never did get the patch to work. So I simply added the:
    (' . $item[id] . ')

    to line # 76 in /var/www/fog/management/ajax/image.search.php and it worked fine.

    I wasn't thrilled with the layout so added a new column instead:
    <td align="center">' . $item[id] . '</td>

    Removed the alphabetical sorting commands from the sql line:
    ORDER BY imageName

    and added the header for the column in ../includes/images.list.include.php:
    <td><?php print _('ID#'); ?></td>

    I'm sure the code above won't print correctly here but they're just one line each.