Location: PHPKode > projects > ZZ/OSS Installer > zic-1.1.0dev1/installer/distribution_download.php
<?php   
    /*
    Copyright (C) 2001-2004 ZZOSS GbR, http://www.zzoss.com

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */
    
    /**
    @version $Id: distribution_download.php,v 1.7 2004/04/06 19:51:09 ordnas Exp $
    @copyright Copyright &copy; 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
    @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
    */
	  
	// execute init file
	require_once 'inc/init.php';

    /***************************************************************************   
    * INSTALLER FRAMEWORK FUNCTIONS                                            *   
    ***************************************************************************/   

	function zi_process() {
        
		// download distribution.xml
		$file = $GLOBALS['ZI']['installer_data_dir'].'installer'.DIRECTORY_SEPARATOR.'remote_distributions.xml';
		$distributions_xml = new ZZOSS_Config(array('numeric' => array('distribution')));
		$distributions_xml->setFile($file);
		$distributions = $distributions_xml->query('/distributions/distribution');
		$distribution = $distributions[$_REQUEST["ZI_VALUES"]["distribution"]];
		$file = $GLOBALS['ZI']['installer_data_dir'].'installer'.DIRECTORY_SEPARATOR.'remote_distribution.xml';
		if(file_exists($file)) {
			unlink($file);
		}
		if(is_array($distribution["filelist"]["descriptor"])) {
            include_once 'ZZOSS_File/Download.php';
            $download = new ZZOSS_FileDownload();
            $download->download($distribution["filelist"]["descriptor"]["#"], $file);
		} else {
            PEAR::raiseError('No XML descriptor available for distribution.');
        }
	}

    /***************************************************************************   
    * PAGE CONTENT                                                             *   
    ***************************************************************************/   

	include 'themes/'.$GLOBALS['ZI']['theme'].'/header.php';
	?>
	<h1>Select Distribution</h1>
	<?php
	$file = $GLOBALS['ZI']['installer_data_dir'].'installer'.DIRECTORY_SEPARATOR.'remote_distributions.xml';
    
    $items = array('Distributions XML');
    $label = 'Downloading';
    
    require_once 'ZZOSS_Html/Progress.php';
    $bar = new ZZOSS_HtmlProgress();
    $bar->prepareListHorizontal($items, 'Downloading');
    
    require_once 'ZZOSS_File/Download.php';
    $download = new ZZOSS_FileDownload();
    $download->setCallback(array(&$bar, '_downloadCallback'));
    
    $download->download($GLOBALS['ZI']['distributions_url'], $file);
    ?>
    <br clear="all"/>
    <?php
    if(!file_exists($file)) {
        // error, since file does not exist
        $screen = 'error';
        break;
    } else {
        $distributions_xml = new ZZOSS_Config(array('numeric' => array('distribution')));
        $distributions_xml->setFile($file);
        $distributions = $distributions_xml->query('/distributions/distribution');
    }

	if(is_array($distributions) && count($distributions)) {
		?>
        <table class="list">
            <tr>
                <th align="center" width="30"><img src="themes/share/icons/org.kde.icons.crystalsvg/16x16/run.gif" border="0" alt="Install" title="Install"></th>
                <th align="left">Distribution</th>
                <th align="center">Version</th>
                <th align="center">State</th>
                <th align="center">Release Date</th>
            </tr>
            <?php

		// per default select first
		$checked = ' checked';
		foreach($distributions as $key => $distribution) {
			?>
			<tr>
				<td valign="top">
					<input type="radio" name="ZI_VALUES[distribution]" value="<?php echo $key; ?>"<?php echo $checked; ?>>
				</td>
				<td>
					<a href="info.php?type=distribution_remote&id=<?php echo $key; ?>" onclick="javascript:window.open('info.php?type=distribution_remote&id=<?php echo $key; ?>', 'DistributionInformation', 'width=500,height=500,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0,dependent=0');void(0);javascript:return(false);" target="_blank"><?php echo htmlspecialchars($distribution["summary"]); ?></a><br/>
				</td>
                <td align="center"><?php echo $distribution["release"]["version"]; ?></td>
                <td align="center"><?php echo $distribution["release"]["state"]; ?></td>
                <td align="center"><?php echo $distribution["release"]["date"]; ?></td>
			</tr>
			<?php
			$checked = '';
		}
		// activate next button
		$zi_buttons['next'] = "applications_download.php";
		?>
		</table>
		<?php
	} else {
		?>
		Currently no distributions available.
		<?php
	}
	?>
	<br clear="all"/>
	<?php
	//$zi_buttons['back'] = "applications.php";
		include 'themes/'.$GLOBALS['ZI']['theme'].'/footer.php';
?>
Return current item: ZZ/OSS Installer