<?php
// $Id: HTML_installer.php,v 1.13 2003/12/11 02:27:51 eddieajau Exp $
/**
* Installer admin HTML
* @package Mambo Open Source
* @Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1.13 $
**/

class HTML_installer
{
	function showInstalledModules($rows,$option)
	{
		if(count($rows))
		{
			?>
		<table cellpadding="5" cellspacing="0" border="0" width="100%">
		  <tr>
		    <td class="sectionname"><img src="images/mos_gel.png" width="70" height="67" align="middle">Modules</td>
		  </tr>
		</table>
		<table cellpadding="5" cellspacing="0" border="0" width="100%" class="adminlist">
		<form action="index2.php" method="POST" name="adminForm">
		<tr>
			<th width="40%" class="title">Currently Installed</th>
			<th width="60%" class="title">Module File</th>
		</tr>
			<?php
			$rc = 0;
			foreach ($rows as $row)
			{
    		?>
			<tr class="<?php echo "row$rc"; ?>">
			<td><input type="radio" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->id; ?>" onclick="isChecked(this.checked);"><span class="bold"><?php echo $row->title; ?></td>
			<td>modules/<?php echo $row->module; ?>.php</td>
			</tr>
    		<?php
    		$rc = $rc == 0 ? 1 : 0;
			}
		}
		else
		{
		?>
		<td class="small">No custom modules installed</td>
		<?php
		}
		?>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="option" value="module_installer" />
		</form>
		</table>
		<?php
	}

	function showInstalledComponents($rows,$option) {

		if(count($rows))
		{
		?>
		<table cellpadding="5" cellspacing="0" border="0" width="100%">
		  <tr>
		   <td class="sectionname"><img src="images/mos_gel.png" width="70" height="67" align="middle">Components</td>
		  </tr>
		</table>
		<table cellpadding="5" cellspacing="0" border="0" width="100%" class="adminlist">
		<form action="index2.php" method="POST" name="adminForm">
		<tr>
			<th width="30%" class="title">Currently Installed</th>
			<th width="20%" class="title">Component Menu Link</th>
			<th width="10%" align="left">Author</th>
			<th width="5%" align="center">Version</th>
			<th width="5%" align="center">Date</th>
			<th width="15%" align="left">Author Email</th>
			<th width="15%" align="left">Author URL</th>
		</tr>
			<?php
		$rc = 0;
		foreach ($rows as $row)
		{
    		?>
			<tr class="<?php echo "row$rc"; ?>">
			<td><input type="radio" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->id; ?>" onclick="isChecked(this.checked);"><span class="bold"><?php echo $row->name; ?></td>
			<td><?php echo @$row->link != "" ? $row->link : "&nbsp;"; ?></td>
			<td><?php echo @$row->author != "" ? $row->author : "&nbsp;"; ?></td>
			<td><?php echo @$row->version != "" ? $row->version : "&nbsp;"; ?></td>
			<td><?php echo @$row->creationdate != "" ? $row->creationdate : "&nbsp;"; ?></td>
			<td><?php echo @$row->authoremail != "" ? $row->authoremail : "&nbsp;"; ?></td>
			<td><?php echo @$row->authorurl != "" ? "<a href=\"http://$row->authorurl\" target=\"_blank\">$row->authorurl</a>" : "&nbsp;"; ?></td>
			</tr>
    		<?php
    		$rc = 1 - $rc;
		}
		}
		else
		{
		?>
		<td class="small">No custom components installed</td>
		<?php
		}
		?>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="option" value="component_installer" />
		</form>
		</table>
		<?php
	}

	function showInstalledTemplates($rows,$option)
	{
		if(count($rows) >0)
		{
		?>
		<table cellpadding="5" cellspacing="0" border="0" width="100%">
		  <tr>
		   <td class="sectionname"><img src="images/mos_gel.png" width="70" height="67" align="middle">Templates</td>
		  </tr>
		</table>
		<table cellpadding="5" cellspacing="0" border="0" width="100%" class="adminlist">
		<form action="index2.php" method="POST" name="adminForm">
		<tr>
			<th width="55%" class="title">Currently Installed</th>
			<th width="45%" class="title">Columns</th>
		</tr>
			<?php
		$rc = 0;
		foreach ($rows as $row)
		{
    		?>
			<tr class="<?php echo "row$rc"; ?>">
			<td><input type="checkbox" name="cid[]" value="<?php echo $row->id; ?>" onclick="isChecked(this.checked);"><span class="bold"><?php echo $row->cur_template; ?></td>
			<td><?php echo $row->col_main; ?></td>
			</tr>
    		<?php
    		$rc = $rc == 0 ? 1 : 0;
		}
		}
		else
		{
		?>
		<td class="small">No templates installed</td>
		<?php
		}
		?>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		</form>
		</table>
		<?php
	}


	function showInstallForm($title,$option,$p_startdir = "")
	{
	?>
	<script language="javascript" type="text/javascript">
		function submitbutton3(pressbutton) {
			var form = document.adminForm_dir;

			// do field validation
			if (form.userfile.value == ""){
				alert( "Please select a directory" );
			} else {
				form.submit();
			}
		}
	</script>

	<form enctype="multipart/form-data" action="index2.php" method="POST" name="filename">
	<input type="hidden" name="task" value="uploadfile" />
	<input type="hidden" name="option" value="<?php echo $option;?>">
	<table border="0" cellpadding="4" cellspacing="0" width="100%">
	  <tr>
	    <td class="sectionname"><?php echo $title;?></td>
	  </tr>
	</table>
	<table border="0" cellpadding="4" cellspacing="0" width="100%" class="adminform">
	  <tr>
	    <td align="Left">Package File:&nbsp;<input class="inputbox" name="userfile" type="file" />&nbsp;<input class="button" type="submit" value="Upload File" /></td>
	  </tr>
	</table>
	</form>

	<form enctype="multipart/form-data" action="index2.php" method="POST" name="adminForm_dir">
	<input type="hidden" name="task" value="installfromdir" />
	<input type="hidden" name="option" value="<?php echo $option;?>">

	<table border="0" cellpadding="4" cellspacing="0" width="100%">
	  <tr>
	    <td class="sectionname">Install from directory</td>
	  </tr>
	<table border="0" cellpadding="4" cellspacing="0" width="100%" class="adminform">
	  <tr>
	    <td align="Left">
			Install directory:&nbsp;
			<input type="text" name="userfile" class="inputbox" size="50" value="<?php echo $p_startdir; ?>"/>&nbsp;
			<input type="button" class="button" value="Install" onclick="submitbutton3()" />
		</td>
	  </tr>
	</table>
	</form>
	<?php
	}

	function showInstallMessage($message,$title,$option)
	{
		global $PHP_SELF;
		?>
		<table border="0" cellpadding="4" cellspacing="0" width="100%">
		  <tr>
		    <td class="sectionname"><?php echo $title; ?></td>
		  </tr>
		</table>
		<table border="0" cellpadding="4" cellspacing="0" width="100%" class="adminform">
	    	  <tr>
		    <td align="Left"><b><?php echo $message; ?></td>
		  </tr>
		  <tr>
		    <td colspan="2" align="center">[&nbsp;<a href="<?php echo $PHP_SELF;?>?option=<?php echo $option;?>">Back</a>&nbsp;]</td>
		  </tr>
		</table>
		<?php
	}

}
?>
