| Current Path : /home/bonneesp/www/administrator/components/com_tabulizer/views/ruleset/tmpl/ |
| Current File : /home/bonneesp/www/administrator/components/com_tabulizer/views/ruleset/tmpl/form.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');
$used_ruleset_name = $this->lists['used_ruleset_names'];
$used_ruleset_title = $this->lists['used_ruleset_titles'];
$archives_return_url = '&archives_return_url='.urlencode($this->return_urls['archives']);
$archive_return_url = '&archive_return_url='.urlencode($this->return_urls['archive']);
$return_url = $this->return_urls['archive'].$archives_return_url;
JHTML::_('behavior.tooltip');
$edit = $this->lists['edit'];
$text = !$edit ? JText::_('COM_TABULIZER_NEW' ) : JText::_('COM_TABULIZER_EDIT' );
JToolBarHelper::title( JText::_('COM_TABULIZER_RULESET' ).': <small><small>[ ' . $text.' ]</small></small>','config' );
JToolBarHelper::save();
if (!$edit) {
JToolBarHelper::cancel();
} else {
JToolBarHelper::custom( 'saveCopy', 'save-copy', 'save-copy', JText::_('COM_TABULIZER_SAVE_AS_COPY'), false, false );
// for existing items the button is renamed `close`
JToolBarHelper::cancel( 'cancel', JText::_('COM_TABULIZER_CLOSE') );
}
JToolBarHelper::help( 'all_topics', true );
TabulizerUtils::opentipInit();
?>
<script language="javascript" type="text/javascript">
function isUsedName(name) {
var used_names = [<?php echo $used_ruleset_name; ?>];
if (used_names.indexOf(name) >=0) return true;
else return false;
}
function isUsedTitle(title) {
var used_titles = [<?php echo $used_ruleset_title; ?>];
if (used_titles.indexOf(title) >=0) return true;
else return false;
}
function updateSampleData(btn) {
var span = document.getElementById('sample_data_span');
if (btn.checked) {
span.className = '';
} else {
span.className = 'hidden_span';
}
}
function validateSampleData() {
var flag = document.getElementById('sample_data_check').checked;
var text = document.getElementById('sample_data_text').value;
if ((flag) && (text=="")) return false; else return true;
}
function validateAndSubmit() {
var form = document.adminForm;
var value, regex, valid = true, error_msg = "";
regex = /^.{2,128}$/;
value = form.ruleset_title.value;
if (!regex.test(value)) {
error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_RULESET_TITLE');?>";
valid = false;
} else if (isUsedTitle(value)) {
error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_RULESET_TITLE_ALREADY_IN_USE');?>";
valid = false;
}
regex = /^[a-zA-Z0-9\._\-]{2,128}$/;
value = form.ruleset_name.value;
if (!regex.test(value)) {
error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_RULESET_NAME');?>";
valid = false;
} else if (isUsedName(value)) {
error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_RULESET_NAME_ALREADY_IN_USE');?>";
valid = false;
}
regex = /^[a-zA-Z0-9_\-]{2,128}$/;
value = form.ruleset_suffix.value;
if (!regex.test(value)) {
error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_RULESET_SUFFIX');?>";
valid = false;
}
regex = /^([a-zA-Z0-9\._\-]{2,128}\.css)+(;[a-zA-Z0-9\._\-]{2,128}\.css)*$/i;
value = form.ruleset_style.value;
if (value != '') {
if (!regex.test(value)) {
error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_RULESET_STYLE');?>";
valid = false;
}
}
if (!validateSampleData()) {
error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_RULESET_SAMPLE_DATA');?>";
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 == 'save') {
validateAndSubmit();
} else if (pressbutton == 'saveCopy') {
document.getElementById('addcopy').value = '1';
validateAndSubmit();
} else if (pressbutton == 'cancel') {
window.location = "<?php echo $return_url;?>";
}
}
<?php } else { ?>
function submitbutton(pressbutton) {
if (pressbutton == 'save') {
validateAndSubmit();
} else if (pressbutton == 'saveCopy') {
document.getElementById('addcopy').value = '1';
validateAndSubmit();
} else if (pressbutton == 'cancel') {
window.location = "<?php echo $return_url;?>";
}
}
<?php } ?>
</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_RULESET_DETAILS' ); ?></legend>
<table class="admintable">
<tr class="row1">
<td valign="top" class="key">
<?php echo JText::_('COM_TABULIZER_RULESET_TITLE' ). TabulizerUtils::labelTooltip(JText::_('COM_TABULIZER_RULESET_TITLE_HELP')); ?>:
</td>
<td>
<?php echo $this->lists['title']; ?>
</td>
</tr>
<tr class="row0">
<td valign="top" class="key">
<?php echo JText::_('COM_TABULIZER_RULESET_DESCRIPTION' ). TabulizerUtils::labelTooltip(JText::_('COM_TABULIZER_RULESET_DESCRIPTION_HELP')); ?>:
</td>
<td>
<?php echo $this->lists['description']; ?>
</td>
</tr>
<tr class="row1">
<td valign="top" class="key">
<?php echo JText::_('COM_TABULIZER_RULESET_NAME' ). TabulizerUtils::labelTooltip(JText::_('COM_TABULIZER_RULESET_NAME_HELP')); ?>:
</td>
<td>
<?php echo $this->lists['name']; ?>
</td>
</tr>
<tr class="row0">
<td valign="top" class="key">
<?php echo JText::_('COM_TABULIZER_RULESET_SUFFIX' ). TabulizerUtils::labelTooltip(JText::_('COM_TABULIZER_RULESET_SUFFIX_HELP')); ?>:
</td>
<td>
<?php echo $this->lists['suffix']; ?>
</td>
</tr>
<tr class="row1">
<td valign="top" class="key">
<?php echo JText::_('COM_TABULIZER_RULESET_STYLE' ). TabulizerUtils::labelTooltip(JText::_('COM_TABULIZER_RULESET_STYLE_HELP')); ?>:
</td>
<td>
<?php echo $this->lists['style']; ?>
</td>
</tr>
<tr class="row0">
<td valign="top" class="key">
<?php echo JText::_('COM_TABULIZER_SAMPLE_DATA_LABEL' ). TabulizerUtils::labelTooltip(JText::_('COM_TABULIZER_SAMPLE_DATA_LABEL_HELP')); ?>:
</td>
<td>
<?php echo $this->lists['sample_data']; ?>
</td>
</tr>
</table>
</fieldset>
</div>
<div class="clr"></div>
<input type="hidden" name="option" value="com_tabulizer" />
<input type="hidden" name="task" value="saveRuleset" />
<input type="hidden" name="addcopy" id="addcopy" value="0" />
<?php echo JHTML::_( 'form.token' ); ?>
<?php echo $this->lists['filename']; ?>
</form>
<?php
TabulizerUserMessage::printHelp(JText::_('COM_TABULIZER_FORM_RULESET_HELP'));
?>