<?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: info_changelog.php,v 1.8 2004/04/04 15:53:41 ordnas Exp $
@copyright Copyright © 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';
include 'inc/info.php';
/***************************************************************************
* PAGE CONTENT *
***************************************************************************/
$zi_buttons['back'] = 'info.php'.zi_form_querystr();
$widget_type = '_popup';
if(isset($_REQUEST['widget_type'])){
if($_REQUEST['widget_type'] == '_self'){
$widget_type = '';
} else {
$widget_type = '_popup';
}
}
include 'themes/'.$GLOBALS['ZI']['theme'].'/header'.$widget_type.'.php';
?>
<h1>Information</h1>
<?php
switch($_REQUEST['type']){
case 'distribution_remote':
$header = 'Distribution';
// load selected distribution
$file = $GLOBALS['ZI']['installer_data_dir'].'installer/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["id"]];
$file = $GLOBALS['ZI']['installer_data_dir'].'installer/remote_distribution.xml';
if(file_exists($file)) {
unlink($file);
}
$items = array('Distribution 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($distribution["filelist"]["descriptor"]["#"], $file);
if(file_exists($file)) {
$distribution_config = new ZZOSS_Config(array('cache' => true, 'numeric' => array('release')));
$distribution_config->setFile($file);
$info = $distribution_config->query('/distribution');
}
break;
case 'application_remote':
$header = 'Application';
// download application.xml
$file = $GLOBALS['ZI']['installer_data_dir'].'installer/remote_applications.xml';
$file_application = $GLOBALS['ZI']['installer_data_dir'].'installer/remote_application.xml';
if(file_exists($file_application)) {
unlink($file_application);
}
$remote_applications_xml = new ZZOSS_Config(array('numeric' => array('application','descriptor')));
$remote_applications_xml->setFile($file);
$remote_applications = $remote_applications_xml->query('/applications/application');
$remote_application = $remote_applications[$_REQUEST["id"]];
$items = array('Application 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 application.xml and packages.xml
if(is_array($remote_application["filelist"]["descriptor"])) {
foreach($remote_application["filelist"]["descriptor"] as $descriptor) {
if($descriptor["@"]["role"] == 'application') {
$download->download($descriptor["#"], $file_application);
}
}
}
if(file_exists($file_application)) {
$application_config = new ZZOSS_Config(array('numeric' => array('release')));
$application_config->setFile($file_application);
$info = $application_config->query('/application');
}
break;
case 'distribution':
$header = 'Distribution';
// load selected package
$distribution = $zi_registry->getDistribution($_REQUEST["distribution"]);
// make those items a numeric array where more than one element with the same name occurs
// on the same level
require_once 'ZZOSS_Config/Config.php';
$info = ZZOSS_Config::prepareNumeric($distribution, array('license', 'maintainer', 'holder','release'));
break;
case 'application':
$header = 'Application';
// load selected package
if(isset($_REQUEST["id"])){
$application = $zi_registry->getApplicationById($_REQUEST["id"]);
} elseif(isset($_REQUEST['distribution']) && isset($_REQUEST['application'])){
$application = $zi_registry->getApplication($_REQUEST['application'], $_REQUEST['distribution']);
} else {
PEAR::raiseError('Cannot identify application');
}
// make those items a numeric array where more than one element with the same name occurs
// on the same level
require_once 'ZZOSS_Config/Config.php';
$info = ZZOSS_Config::prepareNumeric($application, array('release'));
break;
case 'plugin':
case 'package':
$header = 'Package';
$info = $zi_registry->getPackageById($_REQUEST["id"]);
if($info["install"]["type"] == 'remote') {
$zi_registry->unsetPackageRemoteInfo();
$items = array('Package 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'));
$file = $zi_registry->getApplicationPath().'installer'.DIRECTORY_SEPARATOR.'remote_package.xml';
$package = $zi_registry->getPackageById($_REQUEST['id']);
$download->download($package["filelist"]["descriptor"]["#"], $file);
$info = $zi_registry->getPackageRemoteInfo();
}
$info = ZZOSS_Config::prepareNumeric($info, array('release'));
break;
}
$releases = $info['changelog']['release'];
?>
<table class="list">
<tr>
<th colspan="4"><?php
if(isset($_REQUEST['type']) && $_REQUEST['type'] == 'package'){
echo $info['name'].'-'.$info["release"][0]["version"].'<br/>'.$info["summary"];
} else {
echo $info["summary"].' '. $info["release"][0]["version"];
}
?></th>
</tr>
<tr>
<td class="label-top">Older Version</td>
<td class="label-top">State</td>
<td class="label-top">Release Date</td>
<td class="label-top">Notes</td>
</tr>
<?php
// show application information table
foreach($releases as $release){
if(isset($release['version'])){
?>
<tr>
<td><?php echo $release['version']; ?></td>
<td><?php echo $release['state']; ?></td>
<td><?php echo $release['date']; ?></td>
<td><?php echo zi_info_text($release['notes']); ?></td>
</tr>
<?php
}
}
?>
</table>
<div class="contextlink">
<?php
if(is_array($info["changelog"])) {
?>
[ <a href="info.php<?php echo zi_form_querystr(); ?>">General Info</a> ]
<?php
}
?>
</div>
<?php
include 'themes/'.$GLOBALS['ZI']['theme'].'/footer'.$widget_type.'.php';
?>