Your IP : 216.73.217.53


Current Path : /home/bonneesp/www/administrator/components/com_tabulizer/views/datasources/tmpl/
Upload File :
Current File : /home/bonneesp/www/administrator/components/com_tabulizer/views/datasources/tmpl/import.php

<?php
/**
 * @version		6.5.0 tabulizer $
 * @package		tabulizer
 * @copyright	Copyright © 2011 - All rights reserved.
 * @license		GNU/GPL
 * @author		Dimitrios Mourloukos
 * @author mail	info@alterora.gr
 * @website		www.tabulizer.com
 * 
 */


// no direct access
defined('_JEXEC') or die('Restricted access');

$jinput = JFactory::getApplication()->input;
$option = $jinput->getCmd('option');

$return_url = str_replace('&amp;','&',JRoute::_('index.php?option='.$option.'&task=viewDataSources'));

JHTML::_('behavior.tooltip');
$text = JText::_('COM_TABULIZER_IMPORT' );
JToolBarHelper::title(   JText::_('COM_TABULIZER_DATA_SOURCE' ).': <small><small>[ ' . $text.' ]</small></small>','config' );
JToolBarHelper::custom('import', 'import_archive', 'import_archive', JText::_('COM_TABULIZER_IMPORT'), false, false );
JToolBarHelper::cancel( 'cancel', JText::_('COM_TABULIZER_CLOSE') );
JToolBarHelper::help( 'all_topics', true );

$lists = array();		
$lists['filename'] = '<input name="datasource_filename" id="datasource_filename" type="file" />';
$lists['overwrite'] = '<input type="checkbox" name="overwrite_file" id="overwrite_file" value="1" /> ' . JText::_('COM_TABULIZER_DATA_SOURCE_OVERWRITE_VALUE');

?>

<script language="javascript" type="text/javascript">		
	
	function isValidFilename(filename) {				
		regex = /[a-zA-Z0-9\._\-]{2,128}\.xml$/i;
		value = filename;
		if (!regex.test(value)) {
			return false;
		}		
		return true;
	}
	
	function validateAndSubmit() {
		var form = document.adminForm;	
		var value, regex, valid = true, error_msg = "";
		if (form.datasource_filename.value == "") {
			error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_FILE_UPLOAD_ERROR_NO_FILE');?>";
			valid = false;		
		} else if (!isValidFilename(form.datasource_filename.value)) {
			error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_FILENAME_IMPORT');?>";
			valid = false;		
		}				
				
		if (valid) {
			form.submit();
		} else {
			error_msg = "<?php echo JText::_('COM_TABULIZER_JS_ERRORS_FOUND'); ?>" + error_msg;
			alert(error_msg);
		}	
						
	}

<?php if(version_compare(JVERSION,'1.6.0','ge')) { ?>	

	Joomla.submitbutton = function(pressbutton) {											
		if (pressbutton == 'import') {
			validateAndSubmit();
		} else if (pressbutton == 'cancel') {
			window.location = "<?php echo $return_url;?>";			
		}		
	}

<?php } else { ?>
	
	function submitbutton(pressbutton) {											
		if (pressbutton == 'import') {
			validateAndSubmit();
		} else if (pressbutton == 'cancel') {
			window.location = "<?php echo $return_url;?>";			
		}		
	}	
	
<?php } ?>	
	
</script>

<form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
<div class="col edit_frm_div">
	<fieldset class="adminform">
		<legend><?php echo JText::_('COM_TABULIZER_DATA_SOURCE_IMPORT_DETAILS' ); ?></legend>
		<table class="admintable">
		<tr class="row1">
			<td class="key">				
				<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_FILENAME_XML' ); ?>:
			</td>
			<td>
				<?php echo $lists['filename']; ?>
			</td>			
		</tr>
		<tr class="row0">
			<td class="key">												
				<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_OVERWRITE_LABEL' ); ?>:
			</td>
			<td>
				<?php echo $lists['overwrite']; ?>
			</td>			
		</tr>						
	    </table>
	</fieldset>
</div>

<div class="clr"></div>
	<input type="hidden" name="option" value="com_tabulizer" />		
	<input type="hidden" name="task" value="importDataSource" />
	<input type="hidden" name="import_file" value="1" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>

<?php
TabulizerUserMessage::printHelp(JText::_('COM_TABULIZER_FORM_DATA_SOURCE_IMPORT_HELP'));
echo "<br/>\n";
TabulizerUserMessage::printWarning(JText::_('COM_TABULIZER_FORM_DATA_SOURCE_IMPORT_WARNING'));
?>