<?php
/**
 * Maintenance page
 *
 * @package 	CSVIVirtueMart
 * @subpackage 	Maintenance
 * @todo
 * @author 		Roland Dalmulder
 * @link 		http://www.csvimproved.com
 * @copyright 	Copyright (C) 2006 - 2012 RolandD Cyber Produksi
 * @license 	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * @version 	$Id: default.php 1892 2012-02-11 11:01:09Z RolandD $
 */
 
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );
JHTML::_('behavior.tooltip');
$cb = 0;
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" name="adminForm" enctype="multipart/form-data">
	<fieldset class="adminform">
		<legend><?php echo JText::_('COM_CSVIVIRTUEMART_MAINTENANCE_OPTIONS'); ?></legend>
		<div id="maintenance_page">
			<ul>
				<li><a href="#maintenance_tab"><?php echo JText::_('COM_CSVIVIRTUEMART_MAINTENANCE'); ?></a></li>
				<li><a href="#icecat_tab"><?php echo JText::_('COM_CSVIVIRTUEMART_MAINTENANCE_ICECAT');?></a></li>
				<li><a href="#database_tab"><?php echo JText::_('COM_CSVIVIRTUEMART_MAINTENANCE_DATABASE');?></a></li>
			</ul>
			<div id="maintenance_tab">
				<?php echo $this->loadTemplate('maintenance'); ?>
			</div>
			<div id="icecat_tab">
				<?php echo $this->loadTemplate('icecat'); ?>
			</div>
			<div id="database_tab">
				<?php echo $this->loadTemplate('database'); ?>
			</div>
		</div>
	</fieldset>
	<input type="hidden" name="task" value="maintenance" />
	<input type="hidden" name="view" value="maintenance" />
	<input type="hidden" name="from" value="maintenance" />
	<input type="hidden" name="option" value="com_csvivirtuemart" />
</form>
<style type="text/css">
.ui-tabs .ui-tabs-hide {
     display: none;
}
</style>
<script type="text/javascript">
	jQuery(function() {
		jQuery("#maintenance_page").tabs();
	});
	
	function confirmDelete(el, message, task, newtask) {
		jConfirm(message, task, function(r) {
			if (r) {
				setTask(newtask)
			}
			else {
				jQuery(el).attr('checked', '');
				setTask('maintenance');
			}
		})
	}
	UpdateRowClass('maintenance');
	
	function submitbutton(pressbutton) {
		if (pressbutton == 'cronline') {
			if (document.adminForm.task.value == 'restoretemplates' || document.adminForm.task.value == 'backuptemplates') {
				jAlert('<?php echo JText::_('COM_CSVIVIRTUEMART_OPTION_CRON_NO_SUPPORT'); ?>');
				return false;
			}
			else {
				pressbutton = 'cron';
				document.adminForm.view.value = 'cron';
			}
		}
		else {
			pressbutton = document.adminForm.task.value;
		}
		submitform(pressbutton);
	}
</script>
