New page in image management tab



  • hello,

    I use fog 0.32, and I added a page to see the date of the backup and which hosts use this backup. I saw that there are many changes in version 0.33, my modification will it still possible?

    below the changes
    [CODE]diff -u includes.old//images.edit.include.php includes//images.edit.include.php
    — includes.old//images.edit.include.php 2012-09-27 15:39:46.336744331 +0200
    +++ includes//images.edit.include.php 2012-09-27 15:39:46.324744331 +0200
    @@ -190,10 +190,51 @@
    echo ( “<p>”._(“Are you sure you would like to remove this image?”)."</p>" );
    echo ( “<p><a href=”?node=" . $_GET[“node”] . “&sub=” . $_GET[“sub”] . “&rmimageid=” . $ar[“imageID”] . “”><img class=“link” src=“images/delete.png”></a></p>" );
    }

    •    // Onglet detail sur le fichier de sauvegarde
      
    •    else if ( $_GET["tab"] == "detail" )
      
    •    {
      
    •        $tmpSD = getStorageRootByGroupID( $conn, $ar["imageNFSGroupID"] );
      
    •                    if ( $tmpSD != null )
      
    •                        $imgfile = $tmpSD . $ar["imagePath"];
      
    •        echo ( "<p>"._("Image file on server : ") . $imgfile . "<br>" );
      
    •        if ( file_exists($imgfile) )
      
    •        {
      
    •            if ( is_dir ($imgfile) )
      
    •                echo ( _("This is a directory, Multiple partitions are backuped.") . "<br>" );
      
    •            echo ( _("Image file size : ") . filesize_n ($imgfile) . " bytes <br>" );
      
    •            echo ( _("Image file date : ") . date ("d F Y - H:i:s", filemtime ($imgfile)) . "<br>" );
      
    •        }
      
    •        else
      
    •            echo ( _("No file on server yet, need to create a upload task.") . "<br>" );
      
    •        echo ( "</p>" );
      
    •    }
      
    •   echo ( "</center>" );
      

      }

    • // Onglet liste des ordinateurs membres de cette image.

    • if ( $_GET[“tab”] == “members” )

    • {

    •    echo ( '<table width="100%" cellpadding="0" cellspacing="0" border="0">' );
      
    •    echo ( '<thead>' );
      
    •    echo ( '<tr class="header">');
      
    •    echo ( '<td>' . _('Image Name'). '</td>' );
      
    •    echo ( '<td width="230">' . _('MAC') . '</td>' );
      
    •    echo ( '</tr>' );
      
    •    echo ( '</thead>' );
      
    •    echo ( '<tbody>' );
      
    •    $sql = "select hostName, hostMAC from hosts where hostImage = '" . mysql_real_escape_string( $_GET["imageid"] ) . "'";
      
    •    $res = mysql_query( $sql, $conn ) or die( mysql_error() );
      
    •    while ( $ar = mysql_fetch_row( $res ) )
      
    •    {
      
    •        echo ( "<tr> <td>" . $ar[0] . "</td>" );
      
    •        echo ( "<td>" . $ar[1] . "</td> </tr>" );
      
    •    }
      
    •    echo ( "</tbody> </table>" );
      
    • }

    @@ -202,4 +243,15 @@

    }

    +// Contourner la limite de 2GB de filesize()
    +function filesize_n($path)
    +{

    •    $size = @filesize($path);
      
    •    if( $size < 0 ){
      
    •        ob_start();
      
    •        system('ls -al "'.$path.'" | awk \'BEGIN {FS=" "}{print $5}\'');
      
    •        $size = ob_get_clean();
      
    •    }
      
    •    return $size;
      

    +}
    diff -u includes.old//submenu.include.php includes//submenu.include.php
    — includes.old//submenu.include.php 2012-09-27 15:39:46.336744331 +0200
    +++ includes//submenu.include.php 2012-09-27 15:39:46.324744331 +0200
    @@ -165,6 +165,8 @@
    // Image Management: Edit
    $FOGSubMenu->addItems(‘images’, array( _(‘General’) => “”,
    _(‘Delete’) => “delete”,

    •                            _('Detail')        => "detail",
      
    •                            _('Members')        => "members",
                        ), 'imageid', 'Image Menu');
      
            // Image Management: Notes
      

    [/CODE]


  • Developer

    [SIZE=6][B]The Ten Minute Guide to diff and patch[/B][/SIZE]

    [url]http://jungels.net/articles/diff-patch-ten-minutes.html[/url]



  • I would like to use this, but I am not clear on which file(s) I need to edit.

    [quote=“Cyril Fleury, post: 8911, member: 2592”]hello,

    I use fog 0.32, and I added a page to see the date of the backup and which hosts use this backup. I saw that there are many changes in version 0.33, my modification will it still possible?

    below the changes
    [CODE]diff -u includes.old//images.edit.include.php includes//images.edit.include.php
    — includes.old//images.edit.include.php 2012-09-27 15:39:46.336744331 +0200
    +++ includes//images.edit.include.php 2012-09-27 15:39:46.324744331 +0200
    @@ -190,10 +190,51 @@
    echo ( “<p>”._(“Are you sure you would like to remove this image?”)."</p>" );
    echo ( “<p><a href=”?node=" . $_GET[“node”] . “&sub=” . $_GET[“sub”] . “&rmimageid=” . $ar[“imageID”] . “”><img class=“link” src=“images/delete.png”></a></p>" );
    }

    •    // Onglet detail sur le fichier de sauvegarde
      
    •    else if ( $_GET["tab"] == "detail" )
      
    •    {
      
    •        $tmpSD = getStorageRootByGroupID( $conn, $ar["imageNFSGroupID"] );
      
    •                    if ( $tmpSD != null )
      
    •                        $imgfile = $tmpSD . $ar["imagePath"];
      
    •        echo ( "<p>"._("Image file on server : ") . $imgfile . "<br>" );
      
    •        if ( file_exists($imgfile) )
      
    •        {
      
    •            if ( is_dir ($imgfile) )
      
    •                echo ( _("This is a directory, Multiple partitions are backuped.") . "<br>" );
      
    •            echo ( _("Image file size : ") . filesize_n ($imgfile) . " bytes <br>" );
      
    •            echo ( _("Image file date : ") . date ("d F Y - H:i:s", filemtime ($imgfile)) . "<br>" );
      
    •        }
      
    •        else
      
    •            echo ( _("No file on server yet, need to create a upload task.") . "<br>" );
      
    •        echo ( "</p>" );
      
    •    }
      
    •   echo ( "</center>" );
      

      }

    • // Onglet liste des ordinateurs membres de cette image.

    • if ( $_GET[“tab”] == “members” )

    • {

    •    echo ( '<table width="100%" cellpadding="0" cellspacing="0" border="0">' );
      
    •    echo ( '<thead>' );
      
    •    echo ( '<tr class="header">');
      
    •    echo ( '<td>' . _('Image Name'). '</td>' );
      
    •    echo ( '<td width="230">' . _('MAC') . '</td>' );
      
    •    echo ( '</tr>' );
      
    •    echo ( '</thead>' );
      
    •    echo ( '<tbody>' );
      
    •    $sql = "select hostName, hostMAC from hosts where hostImage = '" . mysql_real_escape_string( $_GET["imageid"] ) . "'";
      
    •    $res = mysql_query( $sql, $conn ) or die( mysql_error() );
      
    •    while ( $ar = mysql_fetch_row( $res ) )
      
    •    {
      
    •        echo ( "<tr> <td>" . $ar[0] . "</td>" );
      
    •        echo ( "<td>" . $ar[1] . "</td> </tr>" );
      
    •    }
      
    •    echo ( "</tbody> </table>" );
      
    • }

    @@ -202,4 +243,15 @@

    }

    +// Contourner la limite de 2GB de filesize()
    +function filesize_n($path)
    +{

    •    $size = @filesize($path);
      
    •    if( $size < 0 ){
      
    •        ob_start();
      
    •        system('ls -al "'.$path.'" | awk \'BEGIN {FS=" "}{print $5}\'');
      
    •        $size = ob_get_clean();
      
    •    }
      
    •    return $size;
      

    +}
    diff -u includes.old//submenu.include.php includes//submenu.include.php
    — includes.old//submenu.include.php 2012-09-27 15:39:46.336744331 +0200
    +++ includes//submenu.include.php 2012-09-27 15:39:46.324744331 +0200
    @@ -165,6 +165,8 @@
    // Image Management: Edit
    $FOGSubMenu->addItems(‘images’, array( _(‘General’) => “”,
    _(‘Delete’) => “delete”,

    •                            _('Detail')        => "detail",
      
    •                            _('Members')        => "members",
                        ), 'imageid', 'Image Menu');
      
            // Image Management: Notes
      

    [/CODE][/quote]



  • 0.33 is a major rewrite of the underlying code structure (new classes, new objects, etc.), so it is possible that your patch will no longer function. You can test it by pulling down the latest development copy of 0.33, which is mostly completed. I’d highly suggest doing this on a test server or VM.

    [CODE]svn co https://freeghost.svn.sourceforge.net/svnroot/freeghost freeghost[/CODE]


Log in to reply
 

364
Online

39.3k
Users

11.0k
Topics

104.4k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.