[zi-cvs] packages/com.zzoss.portlet.package.lib Package.php,NONE,1.1 package.xml,NONE,1.1

[email protected] Thu, 12 Feb 2004 02:28:20 -0800
Newsgroups gmane.comp.php.zzoss.installer.cvs
Message-ID <[email protected]>
Update of /cvsroot/zzossinstaller/packages/com.zzoss.portlet.package.lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23287

Added Files:
	Package.php package.xml 
Log Message:
initial commit

--- NEW FILE: Package.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: Package.php,v 1.1 2004/02/12 10:28:18 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
    */

    require_once 'ZZOSS_Installer/Utils.php';
    
/**
* Methods for installer plugins
*/
class ZZOSS_PortletPackage
{
    var $registry;
    var $has_actions = false;
    var $has_downloads = false;
    
    function setRegistry($registry)
    {
        $this->registry = $registry;
    }
    
	function showActions()
    {
        $packages_display =  $this->registry->getPackagesActions();
		$packages_resolve = $this->registry->getPackagesResolve();
        $packages = $this->registry->getPackages();
        
		if(is_array($packages_display) && count($packages_display)) {
            $output = '';
            
			foreach($packages_display as $pkg_id => $action) {
				$name = $packages_resolve[$pkg_id];
				$package = $packages[$name];
                if(
                    $action == 'I' || $action == 'R' || $action == 'U'
                    ){
                    $this->has_actions = true;
                    $package_name_full = $package['name'];
                    if(strlen($package_name_full) > 72){
                        $package_name_short = substr($package_name_full, 0, 69).'...';
                    } else {
                        $package_name_short = $package_name_full;
                    }
                    
                    ob_start();
                    ?>
                    <tr>
                        <td>
                        <a title="<?php echo $package_name_full; ?>" href="info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=package&id=<?php echo $pkg_id; ?>&application=<?php echo $_REQUEST['application']; ?>&distribution=<?php echo $_REQUEST['distribution']; ?>" onclick="javascript:window.open('info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=package&id=<?php echo $pkg_id; ?>&application=<?php echo $_REQUEST['application']; ?>&distribution=<?php echo $_REQUEST['distribution']; ?>', 'PackageInformation', '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 $package_name_short;
                            ?></a><br/><?php echo $package['summary']; ?>
                        </td>
                        <td align="center"><?php echo $package["release"]["version"]; ?></td>
                        <td align="center"><?php
                        switch($action){
                            case 'I':
                                ?><img src="themes/share/icons/org.kde.icons.crystalsvg/16x16/run.png" border="0" alt="Install" title="Install"><?php
                                break;
                            case 'U':
                                ?><img src="themes/share/icons/org.kde.icons.crystalsvg/16x16/rebuild.png" border="0" alt="Update" title="Update"><?php
                                break;
                            case 'R':
                                ?><img src="themes/share/icons/org.kde.icons.crystalsvg/16x16/trashcan_empty.png" border="0" alt="Remove" title="Remove"><?php
                                break;
                        }
                        if($package["install"]["type"] == 'remote'){
                            $this->has_downloads = true;
                            ?>&nbsp;<img src="themes/share/icons/org.kde.icons.crystalsvg/16x16/network.png" border="0" alt="Download" title="Download"><?php
                        }
                        ?></td>
                    </tr>
                    <?php
                    $output .= ob_get_contents();
                    ob_end_clean();
                }
			}
		}
        if($this->has_actions){
            ?>
            <table class="list">
            <tr>
                <th align="left">Package</th>
                <th align="center">Version</th>
                <th align="center">Action(s)</th>
            </tr>
            <?php echo $output; ?>
            </table>
            <?php
        } else {
            ?>
            <div class="warning">No package action selected.</div>
            <?php
        }
        return $this->has_actions;
	}
    
    function hasActions()
    {
        return $this->has_actions;
    }
    
    function hasDownloads()
    {
        return $this->has_downloads;
    }
}
?>
--- NEW FILE: package.xml ---
<?xml version="1.0" encoding="ISO-8859-1" ?>
<package version="1.0"
	xmlns="http://www.zzoss.com/NS/installer/package/">
    <name>com.zzoss.portlet.package.lib</name>
    <summary>Widgets for display of package information.</summary>
    <description>Showing e.g. lists of package installation actions.</description>
    <maintainers>
        <maintainer>
            <user>czonsius</user>
            <name>Christian Zonsius</name>
            <email>[email protected]</email>
            <role>developer</role>
        </maintainer>
        <maintainer>
            <user>ordnas</user>
            <name>Sandro Zic</name>
            <email>[email protected]</email>
            <role>lead</role>
        </maintainer>
    </maintainers>
    <release>
        <version>0.1</version>
        <date>{zi_release_date}</date>
        <license url="http://www.gnu.org/licenses/lgpl.txt" version="2.1">LGPL</license>
        <state>stable</state>
        <notes>Initial release.</notes>
        <copyright>
            <holder year="{zi_copyright_year}" url="http://www.zzoss.com">ZZ/OSS</holder>
        </copyright>
        <filelist>
            <file role="php" baseinstalldir="ZZOSS_Portlet" name="Package.php"/>
        </filelist>
        <deps>
            <dep type="pkg" rel="ge" version="1.0.1">com.zzoss.installer.lib</dep>
        </deps>
    </release>
</package>



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click