| Current Path : /home/bonneesp/www/administrator/components/com_tabulizer/views/rulesetarchive/tmpl/ |
| Current File : /home/bonneesp/www/administrator/components/com_tabulizer/views/rulesetarchive/tmpl/edit_css.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');
JHTML::_('behavior.tooltip');
$text = $this->css['new'] ? JText::_('COM_TABULIZER_NEW' ) : JText::_('COM_TABULIZER_EDIT' );
JToolBarHelper::title( JText::_('COM_TABULIZER_CSS_FILE' ).' '.$this->css['css_filename'].': <small><small>[ ' . $text.' ]</small></small>','config' );
$return_url = $this->return_urls['archives'];
JToolBarHelper::save('saveCSSFile');
JToolBarHelper::apply('applyCSSFile', JText::_('COM_TABULIZER_APPLY'));
JToolBarHelper::cancel('cancel', JText::_('COM_TABULIZER_CLOSE'));
JToolBarHelper::help( 'all_topics', true );
$lists = array();
$lists['archive_filename'] = $this->css['archive_filename'];
$lists['ruleset_name'] = empty($this->css['ruleset_name'])?JText::_('COM_TABULIZER_NA'):$this->css['ruleset_name'];
$lists['css_contents'] = '<textarea name="css_contents" id="css_contents" style="width:580px; height: 400px">'.$this->css['css_contents'].'</textarea>';
$lists['css_skeleton'] = '<a href="#" onclick="appendCSSskeleton()">'.JText::_('COM_TABULIZER_CSS_SKELETON_APPEND_BTN').'</a>';
$skeleton_css = $this->css['css_skeleton'];
?>
<script type="text/javascript">
function appendCSSskeleton() {
var css_contents = document.getElementById('css_contents');
var skeleton_css = <?php echo $skeleton_css; ?>
css_contents.value = css_contents.value + "\n" + skeleton_css;
}
</script>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<div class="col edit_frm_div">
<fieldset class="adminform">
<legend><?php echo JText::_('COM_TABULIZER_CSS_FILE_DETAILS' ); ?></legend>
<table class="admintable">
<tr>
<td align="right" class="key">
<?php echo JText::_('COM_TABULIZER_CSS_FILE_RULESET_ARCHIVE_FILENAME' ); ?>:
</td>
<td>
<?php echo $lists['archive_filename']; ?>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('COM_TABULIZER_CSS_FILE_RULESET_NAME' ); ?>:
</td>
<td>
<?php echo $lists['ruleset_name']; ?>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('COM_TABULIZER_CSS_FILE_CONTENTS' ); ?>:
</td>
<td>
<?php echo $lists['css_contents']; ?>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('COM_TABULIZER_CSS_SKELETON' ); ?>:
</td>
<td>
<?php echo $lists['css_skeleton']; ?>
</td>
</tr>
</table>
</fieldset>
</div>
<div class="clr"></div>
<input type="hidden" name="css_filename" value="<?php echo $this->css['css_filename']; ?>" />
<input type="hidden" name="archive_filename" value="<?php echo $this->css['archive_filename']; ?>" />
<input type="hidden" name="ruleset_name" value="<?php echo $this->css['ruleset_name']; ?>" />
<input type="hidden" name="option" value="com_tabulizer" />
<input type="hidden" name="task" value="saveCSSFile" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php
TabulizerUserMessage::printHelp(JText::_('COM_TABULIZER_EDIT_CSS_FILE_HELP'));
?>
<br/>
<?php
# preview rulesets
$archive_filename = $this->css['archive_filename'];
$archive_name = $this->css['rulesets']['name'];
$archive_title = empty($this->css['rulesets']['title'])?'':$this->css['rulesets']['title'];
$archive_style = empty($this->css['rulesets']['style'])?'':$this->css['rulesets']['style'];
$title = JText::_('COM_TABULIZER_RULESET_ARCHIVE' );
if (!empty($archive_title)) $title .= ': ' . $archive_title;
else if (!empty($archive_name)) $title .= ': ' . $archive_name;
else $title .= ' ('.$archive_filename.')';
$rules_path = TabulizerPath::getDirPath('rules');
$css_path = TabulizerPath::getDirPath('css');
if (empty($this->css['rulesets']['rulesets'])) {
$msg = JText::_('COM_TABULIZER_NO_RULESET_WERE_FOUND_FOR_PREVIEW');
TabulizerUserMessage::printInfo($msg);
} else {
TabulizerPath::requireLib('tabulizer','common');
$table = new Tabulizer();
echo '<strong><em>'.JText::_('COM_TABULIZER_SAMPLE_TABLES').'</em></strong>' . "<br>\n";
$rows = $this->css['rulesets']['rulesets'];
foreach ($rows as $row) {
$name = $row['name'];
$title = $row['title'];
$description = $row['description'];
$html = '';
$errors = array();
if (!empty($description)) {
$tooltip = JHTML::tooltip($description, $title);
$title = $title . ' ' . $tooltip;
}
if (!empty($row['sample_data'])) {
$ruleset_sample_data_caption = (empty($row['sample_data_caption']))?'':$row['sample_data_caption'];
$ruleset_sample_data_text = $row['sample_data_text'];
$ruleset_sample_data_sep = empty($row['sample_data_sep'])?'cm':$row['sample_data_sep'];
$ruleset_sample_data_enc = empty($row['sample_data_enc'])?'none':$row['sample_data_enc'];
} else {
$ruleset_sample_data_caption = null;
$ruleset_sample_data_text = null;
$ruleset_sample_data_sep = null;
}
$sample_data = array();
$sample_data['meta'] = empty($ruleset_sample_data_caption)?null:array('caption'=>$ruleset_sample_data_caption);
$sample_data['text'] = $ruleset_sample_data_text;
$sample_data['separator'] = $ruleset_sample_data_sep;
$sample_data['enclosure'] = $ruleset_sample_data_enc;
echo "<hr><h3>{$title}</h3>\n";
if ($table->previewRuleset($archive_filename, $name, $sample_data, $html, $errors)) {
echo $html;
} else {
$msg = JText::_('COM_TABULIZER_ERRORS_FOUND'). '<br/><ul>';
foreach ($errors as $error) {
$msg .= '<li>'.$error.'</li>';
}
$msg .= '</ul>';
TabulizerUserMessage::printError($msg);
}
}
}
?>