[zi-cvs] packages/com.zzoss.zis.phportlet/zzoss_installer_server Add.php,NONE,1.1 ApplicationList.php,NONE,1.1 DistributionAdd.php,NONE,1.1 DistributionList.php,NONE,1.1 Navigation.php,NONE,1.1 PackageList.php,NONE,1.1

[email protected] Wed, 14 Jan 2004 08:43:38 -0800
Newsgroups gmane.comp.php.zzoss.installer.cvs
Message-ID <[email protected]>
Update of /cvsroot/zzossinstaller/packages/com.zzoss.zis.phportlet/zzoss_installer_server
In directory sc8-pr-cvs1:/tmp/cvs-serv9478/zzoss_installer_server

Added Files:
	Add.php ApplicationList.php DistributionAdd.php 
	DistributionList.php Navigation.php PackageList.php 
Log Message:
initial release

--- NEW FILE: Add.php ---
<?php
/*   
 *  PHP Portlet API Implementation - Test Case Portlet #1
 *  Copyright (C) 2003 d-serv OHG Digital Services
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 *  Authors: Joachim Breitsprecher <[email protected]>; |
 *           Your Name <[email protected]>; |
 *
 *  $Id: Add.php,v 1.1 2004/01/14 16:43:36 czonsius Exp $
**/

require_once "DSERV_PHPortlet/PHPortlet.php";
/**
 * This is the a sample "Hello, World!" portlet class
 * It supports only the "view" mode and outputs "Hello, World!" and a parameter "message"
 */
class ZZOSS_PHPortletZzossRepositoriesAdd extends DSERV_PHPortlet {

  /**
   * Render the portlet's output for VIEW mode
   *
   * @param   class     $request    A DSERV_PHPortletRequest object with the request data
   * @param   class     $response   A DSERV_PHPortletResponse object to which the portlet should write it's output
   * @access  public
   */
  function doView($request, $response)
  {
	  /*
	  echo '<pre>';
	  print_r($_REQUEST['item']);
	  echo '</pre>';
	  */
	  
	  // did we submit anything?
	  if(isset($_REQUEST['s01'])){
		  $repository = ZZOSS_Framework::connect($_REQUEST['repository'].'/connector/manipulation');
		  $repository->call( 'addRecord', array( $_REQUEST['item'] ));
	  }
	  
	  // did we import anything?
	  if(isset($_REQUEST['import_submit'])){
		  print_r($_FILE);
		  // set the XSL param with the imported file
		  $xslparams['model_string'] = $_FILE;
	  }

	  // define available repositories
	  $repositories_retrieval = ZZOSS_Framework::connect('zzoss_repositories/connector/manipulation');
	  $repositories = $repositories_retrieval->call('listRecords');
	  unset($repositories['_found']);
		
    $settings =& $request->getSettings();

    $writer =& $response->getWriter();
	
	// toolbar, later a portlet in its own right
	$writer->println('<p><a href="index.php">List</a>&nbsp;|&nbsp;<a href="add.php">Add</a></p>');
	// page header
	$writer->println('<h2>'.$settings["message"].'</h2>');
	
	$writer->println(
		'<form method="GET" action="'.$_SERVER['PHP_SELF'].'">'
		.'<p>Choose repository: <select name="repository">'
		.'<option value=""></option>'
		);
	foreach($repositories as $repository){
		if($repository['name'] != $_REQUEST['repository']){
			$selected = '';
		} else {
			$selected = ' selected';
		}
		$writer->println('<option value="'.$repository['name'].'"'.$selected.'>'.$repository['label'].'</option>');
	}
	$writer->println(
		'</select>'
		.'<input type="submit" value="submit"/>'
		.'</form><br clear="all"/><br/>'
		);

	// if a repository has been selected, display the items form
	if(strlen($_REQUEST['repository'])){
		
		// display the input form
		$xform = ZZOSS_Framework::conf('zzoss_repositories/paths/xforms').$_REQUEST['repository'].'.xml';
		$xforms2xhtml = $_SERVER['ZZOSS_PATH_TRANSLATED'].'utils/xforms2html/xforms2xhtml.xsl';
		
		/* 
	   * Transform the XForms document into XHTML
	   */
	   	$xslparams['form.action'] = $_SERVER['PHP_SELF'].'?repository='.$_REQUEST['repository'];
		$xslproc = xslt_create();
		xslt_set_encoding($xslproc, "iso-8859-1");
		$xhtml = xslt_process($xslproc, $xform, $xforms2xhtml, NULL, array(), $xslparams);
		$writer->println( $xhtml );
		
		// import
		$writer->println(
		'<hr/>'.
		'<form method="GET" action="'.$_SERVER['PHP_SELF'].'">'.
			'File: <input name="import_file" type="file"><br/>'.
			'Type: <select name="import_type">'.
				'<option value=""></option>'.
				'<option value="zzoss_repository">ZZ/OSS Repository XML</option>'.
			'</select><br/>'.
			'<input type="submit" name="import_submit" value="Import">'.
		'</form>'
		);
	}
  }
}
?>

--- NEW FILE: ApplicationList.php ---
<?php
	/*   
	Copyright (C) 2001-2003 ZZOSS GbR, http://www.zzoss.com
	----------------------------------------------------------------------   
	This program is free software; you can redistribute it and/or   
	modify it under the terms of the GNU General Public License   
	as published by the Free Software Foundation; either version 2   
	of the License, or (at your option) any later version.   
	----------------------------------------------------------------------   
	$Id: ApplicationList.php,v 1.1 2004/01/14 16:43:36 czonsius Exp $   
	*/

require_once "DSERV_PHPortlet/PHPortlet.php";
require_once 'ZZOSS_Installer_Server/ApplicationRepository.php';

class ZZOSS_PHPortletZzossInstallerServerApplicationList extends DSERV_PHPortlet {

  /**
   * Render the portlet's output for VIEW mode
   *
   * @param   class     $request    A DSERV_PHPortletRequest object with the request data
   * @param   class     $response   A DSERV_PHPortletResponse object to which the portlet should write it's output
   * @access  public
   */
  function doView($request, $response)
  {
  	// get applications
	$application = new ZZOSS_ApplicationRepository;
	$applications = $application->listApplications();

	// create objects
    $settings =& $request->getSettings();
    $writer =& $response->getWriter();
	
  	// print table
	$writer->println('<table class="list">');
	if(is_array($applications)) {
		$writer->println('<tr>'.
							'<th align="left">Application</th>'.
							'<th align="left" width="80">Version</th>'.
							'<th align="center" width="30"><img src="'.ZZOSS_Framework::conf('zzoss_framework/paths/url').'themes/zzoss/icons/16x16/rebuild.png" border="0" alt="Edit" title="Edit"></th>'.
							'<th align="center" width="30"><img src="'.ZZOSS_Framework::conf('zzoss_framework/paths/url').'themes/zzoss/icons/16x16/trashcan_empty.png" border="0" alt="Remove" title="Remove"></th>'.
						 '</tr>');
		foreach($applications as $key => $item) {
			if(is_integer($key)) {
				// create info link for popup
				$info_link_start = '<a href="info.php?type=application&id='.$item["_id"].'"  onclick="javascript:window.open(\'info.php?type=application&id='.$item["_id"].'\', \'Application Information\', \'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="'.$item["summary"].'-'.$item["version"].'">';
				$info_link_end = '</a>';
				// write table row
				$writer->println('<tr><td valign="middle">'.$info_link_start.$item['summary'].$info_link_end.'</td><td valign="middle">'.$info_link_start.$item['version'].$info_link_end.'</td><td align="center" valign="middle">e</td><td align="center" valign="middle">r</td></tr>');
			}
		}
	}
	$writer->println('</table>');
  }
}
?>

--- NEW FILE: DistributionAdd.php ---
<?php
	/*   
	Copyright (C) 2001-2003 ZZOSS GbR, http://www.zzoss.com
	----------------------------------------------------------------------   
	This program is free software; you can redistribute it and/or   
	modify it under the terms of the GNU General Public License   
	as published by the Free Software Foundation; either version 2   
	of the License, or (at your option) any later version.   
	----------------------------------------------------------------------   
	$Id: DistributionAdd.php,v 1.1 2004/01/14 16:43:36 czonsius Exp $   
	*/

require_once "DSERV_PHPortlet/PHPortlet.php";
require_once 'ZZOSS_Installer_Server/PackageRepository.php';

class ZZOSS_PHPortletZzossInstallerServerDistributionAdd extends DSERV_PHPortlet {

  /**
   * Render the portlet's output for VIEW mode
   *
   * @param   class     $request    A DSERV_PHPortletRequest object with the request data
   * @param   class     $response   A DSERV_PHPortletResponse object to which the portlet should write it's output
   * @access  public
   */
  function doView($request, $response)
  {
	// create objects
    $settings =& $request->getSettings();
    $writer =& $response->getWriter();
	
  	// print table
	$writer->println('<table>');
	$writer->println('<tr><td width="40">&nbsp;</td><td valign="top"><input type="radio" name="zis_form[type]" value="1" checked></td><td><strong>create new distribution</strong><br/><br/>create a new distribution by entering its data<br/><br/></td></tr>');
	$writer->println('<tr><td width="40">&nbsp;</td><td valign="top"><input type="radio" name="zis_form[type]" value="2"></td><td><strong>import distribution (upload)</strong><br/><br/>import a distribution by uploading a distribution.xml file<br/><br/></td></tr>');
	$writer->println('<tr><td width="40">&nbsp;</td><td valign="top"><input type="radio" name="zis_form[type]" value="3"></td><td><strong>import distribution (url)</strong><br/><br/>import a distribution by entering the url of a distribution.xml file<br/><br/></td></tr>');
	$writer->println('</table>');
	
  }

}
?>

--- NEW FILE: DistributionList.php ---
<?php
	/*   
	Copyright (C) 2001-2003 ZZOSS GbR, http://www.zzoss.com
	----------------------------------------------------------------------   
	This program is free software; you can redistribute it and/or   
	modify it under the terms of the GNU General Public License   
	as published by the Free Software Foundation; either version 2   
	of the License, or (at your option) any later version.   
	----------------------------------------------------------------------   
	$Id: DistributionList.php,v 1.1 2004/01/14 16:43:36 czonsius Exp $   
	*/

require_once "DSERV_PHPortlet/PHPortlet.php";
require_once 'ZZOSS_Installer_Server/DistributionRepository.php';

class ZZOSS_PHPortletZzossInstallerServerDistributionList extends DSERV_PHPortlet {

  /**
   * Render the portlet's output for VIEW mode
   *
   * @param   class     $request    A DSERV_PHPortletRequest object with the request data
   * @param   class     $response   A DSERV_PHPortletResponse object to which the portlet should write it's output
   * @access  public
   */
  function doView($request, $response)
  {
  	// get distributions
	$distribution = new ZZOSS_DistributionRepository;
	$distributions = $distribution->listDistributions();

	// create objects
    $settings =& $request->getSettings();
    $writer =& $response->getWriter();
	
  	// print table
	$writer->println('<table class="list">');
	if(is_array($distributions)) {
		$writer->println('<tr>'.
							'<th align="left">Distribution</th>'.
							'<th align="left" width="80">Version</th>'.
							'<th align="center" width="30"><img src="'.ZZOSS_Framework::conf('zzoss_framework/paths/url').'themes/zzoss/icons/16x16/rebuild.png" border="0" alt="Edit" title="Edit"></th>'.
							'<th align="center" width="30"><img src="'.ZZOSS_Framework::conf('zzoss_framework/paths/url').'themes/zzoss/icons/16x16/trashcan_empty.png" border="0" alt="Remove" title="Remove"></th>'.
						 '</tr>');
		foreach($distributions as $key => $item) {
			if(is_integer($key)) {
				// create info link for popup
				$info_link_start = '<a href="info.php?type=distribution&id='.$item["_id"].'"  onclick="javascript:window.open(\'info.php?type=distribution&id='.$item["_id"].'\', \'Distribution Information\', \'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="'.$item["summary"].'-'.$item["version"].'">';
				$info_link_end = '</a>';
				// write table row
				$writer->println('<tr><td valign="middle">'.$info_link_start.$item['summary'].$info_link_end.'</td><td valign="middle">'.$info_link_start.$item['version'].$info_link_end.'</td><td align="center" valign="middle">e</td><td align="center" valign="middle">r</td></tr>');
			}
		}
	}
	$writer->println('</table>');
	
  }
}
?>

--- NEW FILE: Navigation.php ---
<?php
	/*   
	Copyright (C) 2001-2003 ZZOSS GbR, http://www.zzoss.com
	----------------------------------------------------------------------   
	This program is free software; you can redistribute it and/or   
	modify it under the terms of the GNU General Public License   
	as published by the Free Software Foundation; either version 2   
	of the License, or (at your option) any later version.   
	----------------------------------------------------------------------   
	$Id: Navigation.php,v 1.1 2004/01/14 16:43:36 czonsius Exp $   
	*/

require_once "DSERV_PHPortlet/PHPortlet.php";

class ZZOSS_PHPortletZzossInstallerServerNavigation extends DSERV_PHPortlet {

  /**
   * Render the portlet's output for VIEW mode
   *
   * @param   class     $request    A DSERV_PHPortletRequest object with the request data
   * @param   class     $response   A DSERV_PHPortletResponse object to which the portlet should write it's output
   * @access  public
   */
  function doView($request, $response)
  {
    $settings =& $request->getSettings();
    $writer =& $response->getWriter();
	$writer->println('<div align="center"><h1>'.$settings['pagetitle'].'</h1></div>');
	$writer->println('<p align="center">');
	
	switch($settings['section']) {
		case 'distributions' : 		$writer->println('[ <a href="distributions.php">list distributions</a> ] &nbsp; ');
									if($settings['admin']==true) {
										$writer->println('[ <a href="distribution_add.php">add distribution</a> ]');
									}
									break;
									
		case 'applications' : 		$writer->println('[ <a href="applications.php">list applications</a> ] &nbsp; ');
									if($settings['admin']==true) {
										$writer->println('[ <a href="application_add.php">add application</a> ]');
									}
									break;
									
		case 'packages' : 			$writer->println('[ <a href="packages.php">list packages</a> ] &nbsp; ');
									if($settings['admin']==true) {
										$writer->println('[ <a href="package_add.php">add package</a> ]');
									}
									break;
	}
	
	$writer->println('</p>');
  }
}
?>

--- NEW FILE: PackageList.php ---
<?php
	/*   
	Copyright (C) 2001-2003 ZZOSS GbR, http://www.zzoss.com
	----------------------------------------------------------------------   
	This program is free software; you can redistribute it and/or   
	modify it under the terms of the GNU General Public License   
	as published by the Free Software Foundation; either version 2   
	of the License, or (at your option) any later version.   
	----------------------------------------------------------------------   
	$Id: PackageList.php,v 1.1 2004/01/14 16:43:36 czonsius Exp $   
	*/

require_once "DSERV_PHPortlet/PHPortlet.php";
require_once 'ZZOSS_Installer_Server/PackageRepository.php';

class ZZOSS_PHPortletZzossInstallerServerPackageList extends DSERV_PHPortlet {

  /**
   * Render the portlet's output for VIEW mode
   *
   * @param   class     $request    A DSERV_PHPortletRequest object with the request data
   * @param   class     $response   A DSERV_PHPortletResponse object to which the portlet should write it's output
   * @access  public
   */
  function doView($request, $response)
  {
  	// get packages
	$package = new ZZOSS_packageRepository;
	$packages = $package->listpackages();

	// create objects
    $settings =& $request->getSettings();
    $writer =& $response->getWriter();
	
  	// print table
	$writer->println('<table class="list">');
	if(is_array($packages)) {
		$writer->println('<tr>'.
							'<th align="left">Package</th>'.
							'<th align="left" width="80">Version</th>'.
							'<th align="center" width="30"><img src="'.ZZOSS_Framework::conf('zzoss_framework/paths/url').'themes/zzoss/icons/16x16/rebuild.png" border="0" alt="Edit" title="Edit"></th>'.
							'<th align="center" width="30"><img src="'.ZZOSS_Framework::conf('zzoss_framework/paths/url').'themes/zzoss/icons/16x16/trashcan_empty.png" border="0" alt="Remove" title="Remove"></th>'.
						 '</tr>');
		foreach($packages as $key => $item) {
			if(is_integer($key)) {
				// create info link for popup
				$info_link_start = '<a href="info.php?type=package&id='.$item["_id"].'"  onclick="javascript:window.open(\'info.php?type=package&id='.$item["_id"].'\', \'Package Information\', \'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="'.$item["name"].'-'.$item["version"].'">';
				$info_link_end = '</a>';
				// write table row
				$writer->println('<tr><td valign="middle">'.$info_link_start.$item['name'].$info_link_end.'</td><td valign="middle">'.$info_link_start.$item['version'].$info_link_end.'</td><td align="center" valign="middle">e</td><td align="center" valign="middle">r</td></tr>');
			}
		}
	}
	$writer->println('</table>');
	
  }
}
?>




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html