Location: PHPKode > projects > ZZ/OSS Installer > zic-1.1.0dev1/installer/application_install.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: application_install.php,v 1.5 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';
    
    $is_installed = false;
    $application = $zi_registry->getApplication();
    if(
        isset($application["installed"]) &&
        $application["installed"] == $application["release"]["version"]
        ) {
        $is_installed = true;
    }
    
    if(!isset($_REQUEST['mode']) || $_REQUEST['mode'] != 'dev'){
        if($is_installed){
            $redirect = 'applications.php';
        } else {
            // installing new application in prod mode
            $procedures = array(
                            'settings' => 'on',
                            'profile' => 'on',
                            'plugins_manager' => 'on',
                            'plugins_confirm' => 'on',
                            'plugins_register' => 'hide',
                            'plugins_deps' => 'on',
                            'plugins_fileroles' => 'on',
                            'plugins_build' => 'on',
                            'packages_manager' => 'on',
                            'packages_confirm' => 'on',
                            'packages_register' => 'hide',
                            'packages_deps' => 'on',
                            'packages_fileroles' => 'on',
                            'packages_build' => 'on'
                            );
            $zi_registry->setProcedures($procedures);
            $redirect = 'application_settings.php';
        }
    } else {
        if(!$is_installed){
            $procedures = array(
                            'settings' => 'on',
                            'profile' => 'on',
                            'plugins_manager' => 'on',
                            'plugins_confirm' => 'on',
                            'plugins_register' => 'on',
                            'plugins_deps' => 'on',
                            'plugins_fileroles' => 'on',
                            'plugins_build' => 'on',
                            'packages_manager' => 'on',
                            'packages_confirm' => 'on',
                            'packages_register' => 'on',
                            'packages_deps' => 'on',
                            'packages_fileroles' => 'on',
                            'packages_build' => 'on'
                            );
            $zi_registry->setProcedures($procedures);
            $redirect = 'application_settings.php';
        }
    }
    
    if(isset($redirect)){
        header('Location: '.$redirect.zi_form_querystr());
        exit;
    }        
	
	function zi_process()
	{
        global $zi_registry;
        
        $procedures = array();
        
        if(isset($_REQUEST['ZI_VALUES'])){
            // installation action should be recomposed from
            // already installed packages to make them being
            // installed again, but only if the package manager
            // is not used beforehand.
            if(!isset($_REQUEST['ZI_VALUES']['plugins_manager'])){
                $_REQUEST['ZI_VALUES']['plugins_deps'] = 'installed';
            }
            if(!isset($_REQUEST['ZI_VALUES']['packages_manager'])){
                $_REQUEST['ZI_VALUES']['packages_deps'] = 'installed';
            }
            $procedures = $_REQUEST['ZI_VALUES'];
        }
        
        $zi_registry->setProcedures($procedures, 'quickinstall');
        $zi_registry->setProcedures($procedures);
	}
  
	// assign default values
	function zi_default()
	{
        global $zi_registry;
        
        if($procedures = $zi_registry->getProcedures('quickinstall')){
            $_REQUEST['ZI_VALUES'] = $procedures;
        }
	}
	
	/***************************************************************************   
    * STARTUP                                                             	   *   
    ***************************************************************************/
	
	// installer widget class
	require_once 'ZZOSS_Installer/Widget.php';
	$zi_widget = new ZZOSS_InstallerWidget;
    if(isset($zi_errors)){
        $zi_widget->setErrors($zi_errors);
    }

    /***************************************************************************   
    * PAGE CONTENT                                                             *   
    ***************************************************************************/   
	
  	// we ask for a new installer admin username and password
	include 'themes/'.$GLOBALS['ZI']['theme'].'/header.php';
?>
<h1>Install Application</h1>
<h2><a href="info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=application&distribution=<?php echo $_REQUEST['distribution']; ?>&application=<?php echo $_REQUEST['application']; ?>" onclick="javascript:window.open('info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=application&distribution=<?php echo $_REQUEST['distribution']; ?>&application=<?php echo $_REQUEST['application']; ?>', 'ApplicationInformation', '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" title="<?php echo $application["summary"].' '.$application['release']['version']; ?>"><?php echo $application["summary"].' '.$application['release']['version']; ?></a></h2>

<?php
if(isset($_REQUEST['msg'])){
    $procedures = $zi_registry->getProcedures();
    $procedures_txt = array(
                    'settings' => 'Configured installation paths',
                    'profile' => 'Configured installation profile (full, minimum, custom)',
                    'plugins_manager' => 'Showed plugins manager',
                    'plugins_confirm' => 'Confirmed plugins installation actions',
                    'plugins_register' => 'Refreshed plugins from sources',
                    'plugins_deps' => 'Checked plugins dependencies',
                    'plugins_fileroles' => 'Processed file roles of plugins',
                    'plugins_build' => 'Built plugins; displayed configuration options if available',
                    'packages_manager' => 'Showed packages manager',
                    'packages_confirm' => 'Confirmed packages installation actions',
                    'packages_register' => 'Refreshed packages from sources',
                    'packages_deps' => 'Checked packages dependencies',
                    'packages_fileroles' => 'Processed file roles of packages',
                    'packages_build' => 'Built packages; displayed configuration options if available'
                    );
    $procedures_order = array(
        'settings', 'profile', 'plugins_manager', 'plugins_confirm', 'plugins_register',
        'plugins_deps', 'plugins_fileroles', 'plugins_build', 'packages_manager', 'packages_confirm',
        'packages_register', 'packages_deps', 'packages_fileroles', 'packages_build'
        );
    ?>
    <div class="warning">
    <?
    foreach($procedures_order as $procedure){
        if(isset($procedures[$procedure])){
            echo $procedures_txt[$procedure].'<br/>';
        }
    }
    
    $app_settings = $zi_registry->getApplicationSettings();
    ?>
    </div>
<p><a href="<?php echo $app_settings['application_url']; ?>" target="_blank" title="<?php echo $application['summary'].'-'.$application['release']['version']; ?>"><img src="themes/share/icons/org.kde.icons.crystalsvg/16x16/window_new.gif" border="0" alt="View Application" title="View Application" align="absmiddle"> View Application</a><br/>
Take a look at the installed application.</p>

<p><a href="log.php<?php echo zi_form_querystr(); ?>" onclick="javascript:window.open('log.php<?php echo zi_form_querystr(); ?>', 'LogFile', '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" title="Log File"><img src="themes/share/icons/org.kde.icons.crystalsvg/16x16/log.gif" border="0" alt="Installation Log" title="Installation Log" align="absmiddle"> Log File</a><br/>
Read the installation log for detailed information on the executed tasks.</p>
    <?php
}
?>
<table border="0" cellspacing="0" cellpadding="4">
<?php
	// show widgets
    echo $zi_widget->add('checkbox', 'Installation Paths', 'settings', array('info' => 'Configure the application installation paths.'));
    echo $zi_widget->add('checkbox', 'Installation Profile', 'profile', array('info' => 'Choose the installation profile (full, minimum, custom, demo).'));
    //if($zi_registry->isRegPlugins()){
        echo $zi_widget->add('checkbox', 'Register Plugins', 'plugins_register', array('value' => 'hide', 'info' => 'If you have external sources (e.g. CVS), then the plugins will be freshly registered from these sources.'));
        echo $zi_widget->add('checkbox', 'Plugins Fileroles', 'plugins_fileroles', array('info' => 'Process the contained files according to their role.'));
        echo $zi_widget->add('checkbox', 'Build Plugins', 'plugins_build', array('info' => 'If checked, forms for configuration options will show up again if they are available. If unchecked, the configure options of the previous installation will be used.'));
    //}
    echo $zi_widget->add('checkbox', 'Register Packages', 'packages_register', array('value' => 'hide', 'info' => 'If you have external sources (e.g. CVS), then the packages will be freshly registered from these sources.'));
    echo $zi_widget->add('checkbox', 'Packages Fileroles', 'packages_fileroles', array('info' => 'Process the contained files according to their role.'));
    echo $zi_widget->add('checkbox', 'Build Packages', 'packages_build', array('info' => 'If checked, forms for configuration options will show up again if they are available. If unchecked, the configure options of the previous installation will be used.'));
?>
</table>
<?php
	$zi_buttons['back'] = 'applications.php'.zi_form_querystr();
    $zi_buttons['next'] = 'application_settings.php'.zi_form_querystr();

	include 'themes/'.$GLOBALS['ZI']['theme'].'/footer.php';
?>
Return current item: ZZ/OSS Installer