first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

View File

@@ -0,0 +1,240 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Button\PublishedButton;
JHtml::_('bootstrap.popover');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
if (!defined('nrJ4'))
{
JFactory::getDocument()->addScriptDeclaration('
jQuery(function($) {
Joomla.submitbutton = function(task) {
if (task == "form.add") {
jQuery("#cfSelectTemplate").modal("show");
} else {
Joomla.submitform(task, document.getElementById("adminForm"));
}
}
});
');
}
$user = JFactory::getUser();
?>
<form action="<?php echo JRoute::_('index.php?option=com_convertforms&view=forms'); ?>" class="clearfix" method="post" name="adminForm" id="adminForm">
<?php if (!defined('nrJ4')) { ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<?php } ?>
<div id="j-main-container">
<?php
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<table class="adminlist nrTable table">
<thead>
<tr>
<th class="text-center" width="2%"><?php echo JHtml::_('grid.checkall'); ?></th>
<th width="3%" class="nowrap hidden-phone" align="center">
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
</th>
<th>
<?php echo JHtml::_('searchtools.sort', 'NR_NAME', 'a.name', $listDirn, $listOrder); ?>
</th>
<th width="13%" class="text-center">
<?php echo JText::_('COM_CONVERTFORMS_CAMPAIGN') ?>
</th>
<th width="13%" class="text-center">
<?php echo JText::_('COM_CONVERTFORMS_SAVE_DATA') ?>
</th>
<th width="13%" class="text-center">
<?php echo JHtml::_('searchtools.sort', 'COM_CONVERTFORMS_SUBMISSIONS', 'leads', $listDirn, $listOrder); ?>
</th>
<th width="20%" class="text-center"><?php echo JText::_("COM_CONVERTFORMS_ACTIONS"); ?></th>
<th width="5%" class="nowrap text-center hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tbody>
<?php if (count($this->items)) { ?>
<?php foreach($this->items as $i => $item): ?>
<?php
$leads = \ConvertForms\Form::getSubmissionsTotal($item->id);
$canChange = $user->authorise('core.edit.state', 'com_convertforms.form.' . $item->id);
$leadsURL = JURI::base() . 'index.php?option=com_convertforms&view=conversions&filter.period&filter.form_id='. $item->id;
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="text-center"><?php echo JHtml::_('grid.id', $i, $item->id); ?></td>
<td class="text-center">
<?php if (defined('nrJ4')) { ?>
<?php
$options = [
'task_prefix' => 'forms.',
'disabled' => !$canChange,
'id' => 'state-' . $item->id
];
echo (new PublishedButton)->render((int) $item->state, $i, $options);
?>
<?php } else { ?>
<div class="btn-group">
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'forms.', $canChange); ?>
<?php
if ($canChange && !defined('nrJ4'))
{
JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'forms');
JHtml::_('actionsdropdown.' . 'duplicate', 'cb' . $i, 'forms');
echo JHtml::_('actionsdropdown.render', $this->escape($item->name));
}
?>
</div>
<?php } ?>
</td>
<td>
<a href="<?php echo JRoute::_('index.php?option=com_convertforms&task=form.edit&id='.$item->id); ?>" title="<?php echo JText::_('JACTION_EDIT'); ?>"><?php echo $this->escape($item->name); ?>
</a>
</td>
<td class="text-center">
<?php
if (isset($item->campaign))
{
echo ConvertForms\Helper::getCampaign($item->campaign)->name;
}
?>
</td>
<td class="text-center">
<?php
$saveToDb = isset($item->save_data_to_db) ? $item->save_data_to_db : true;
?>
<span title="<?php echo JText::_('COM_CONVERTFORMS_SAVE_DATA_' . (int) $saveToDb) ?> ">
<?php echo JText::_($saveToDb ? 'JYES' : 'JNO'); ?>
</span>
</td>
<td class="text-center">
<?php
$total = number_format($leads);
?>
<a href="<?php echo $leadsURL ?>">
<span class="badge badge-info bg-info hasPopover" data-placement="top" data-content="<?php echo JText::sprintf("COM_CONVERTFORMS_FORM_LEADS", $total) ?>">
<?php echo $total; ?>
</span>
</a>
</td>
<td class="text-center">
<ul class="item-icons">
<li>
<a class="hasPopover <?php echo ($leads == 0) ? "disabled" : "" ?>"
data-placement="top"
data-content="<?php echo JText::_("COM_CONVERTFORMS_VIEW_LEADS") ?>"
href="<?php echo JURI::base() ?>index.php?option=com_convertforms&view=conversions&filter.form_id=<?php echo $item->id ?>&filter.state"><span class="icon icon-users"></span>
</a>
</li>
<li>
<a class="hasPopover"
data-placement="top"
data-content="<?php echo JText::_("COM_CONVERTFORMS_FORM_CREATE_MODULE") ?>"
href="<?php echo JURI::base() ?>index.php?option=com_modules&task=module.add&eid=<?php echo $this->moduleID ?>">
<span class="icon icon-cube"></span>
</a>
</li>
<li>
<a class="hasPopover copyToClipboard"
data-clipboard="{convertforms <?php echo $item->id ?>}"
data-placement="top"
data-content="<?php echo JText::sprintf("COM_CONVERTFORMS_FORM_CLIPBOARD_SHORTCODE", "{convertforms ".$item->id."}") ?>"
href='#'>
<span class="icon icon-link disable-click"></span>
</a>
</li>
</ul>
</td>
<td class="text-center"><?php echo $item->id ?></td>
</tr>
<?php endforeach; ?>
<?php } else { ?>
<tr>
<td align="center" colspan="9">
<div align="center">
<?php echo ConvertForms\Helper::noItemsFound("forms"); ?>
-
<a href="javascript://" onclick="Joomla.submitbutton('form.add')"><?php echo JText::_("COM_CONVERTFORMS_CREATE_NEW") ?></a>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php echo $this->pagination->getListFooter(); ?>
<div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>
<?php include_once(JPATH_COMPONENT_ADMINISTRATOR . '/layouts/footer.php'); ?>
<script>
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("click", function(e) {
if (!e.target.classList.contains("copyToClipboard")) {
return;
}
e.preventDefault();
var data = e.target.dataset.clipboard;
copyTextToClipboard(data, function(success) {
if (success) {
Joomla.renderMessages({"success": ["Shortcode " + data + " copied to clipboard"]});
}
});
});
function copyTextToClipboard(text, callback) {
var textArea = document.createElement("textarea");
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
textArea.style.width = '2em';
textArea.style.height = '2em';
textArea.style.background = 'transparent';
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
var success = document.execCommand('copy');
callback(success);
} catch (err) {
callback(false);
}
document.body.removeChild(textArea);
}
})
</script>

View File

@@ -0,0 +1,67 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die;
?>
<form onsubmit="return submitform();" action="<?php echo JRoute::_('index.php?option=com_convertforms&view=forms'); ?>" method="post" enctype="multipart/form-data" name="import-form" id="import-form">
<fieldset class="form-horizontal">
<legend><?php echo JText::_('NR_IMPORT_ITEMS'); ?></legend>
<div class="control-group">
<label for="file" class="control-label"><?php echo JText::_('COM_CONVERTFORMS_CHOOSE_FILE'); ?></label>
<div class="controls">
<input class="input_box" id="file" name="file" type="file" size="57" />
</div>
</div>
<div class="control-group">
<label for="publish_all" class="control-label"><?php echo JText::_('NR_PUBLISH_ITEMS'); ?></label>
<div class="controls">
<fieldset id="publish_all" class="radio btn-group">
<input type="radio" name="publish_all" id="publish_all0" value="0" />
<label for="publish_all0" class="btn"><?php echo JText::_('JNO'); ?></label>
<input type="radio" name="publish_all" id="publish_all1" value="1" />
<label for="publish_all1" class="btn"><?php echo JText::_('JYES'); ?></label>
<input type="radio" name="publish_all" id="publish_all2" value="2" checked="checked" />
<label for="publish_all2" class="btn"><?php echo JText::_('NR_AS_EXPORTED'); ?></label>
</fieldset>
</div>
</div>
<div class="form-actions">
<input class="btn btn-primary" type="submit" value="<?php echo JText::_('NR_IMPORT'); ?>" />
</div>
</fieldset>
<input type="hidden" name="task" value="forms.import" />
<?php echo JHtml::_('form.token'); ?>
</form>
<script language="javascript" type="text/javascript">
/**
* Submit the admin form
*
* small hack: let task decides where it comes
*/
function submitform() {
var file = jQuery('#file').val();
if (file) {
var dot = file.lastIndexOf(".");
if (dot != -1) {
var ext = file.substr(dot, file.length);
if (ext == '.cnvf') {
return true;
}
}
}
alert('<?php echo JText::_('NR_PLEASE_CHOOSE_A_VALID_FILE'); ?>');
return false;
}
</script>

View File

@@ -0,0 +1,194 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Forms View Class
*/
class ConvertFormsViewForms extends JViewLegacy
{
/**
* Items view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = null)
{
// Access check.
ConvertForms\Helper::authorise('convertforms.forms.manage', true);
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->config = JComponentHelper::getParams('com_convertforms');
ConvertForms\Helper::addSubmenu('forms');
$this->sidebar = JHtmlSidebar::render();
$this->moduleID = NRFramework\Extension::getID('mod_convertforms', 'module');
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
JFactory::getApplication()->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Set the toolbar
$this->addToolBar();
ConvertForms\Helper::renderSelectTemplateModal();
// Display the template
parent::display($tpl);
}
/**
* Add Toolbar to layout
*/
protected function addToolBar()
{
$canDo = ConvertForms\Helper::getActions();
$state = $this->get('State');
$viewLayout = JFactory::getApplication()->input->get('layout', 'default');
// Joomla J4
if (defined('nrJ4'))
{
$toolbar = Toolbar::getInstance('toolbar');
if ($viewLayout == 'import')
{
$title = JText::_('COM_CONVERTFORMS') . ': ' . JText::_('NR_IMPORT_ITEMS');
JFactory::getDocument()->setTitle($title);
JToolbarHelper::title($title);
JToolbarHelper::back();
}
else
{
ToolbarHelper::title(JText::_('COM_CONVERTFORMS') . ": " . JText::_('COM_CONVERTFORMS_FORMS'));
if ($canDo->get('core.create'))
{
$newGroup = $toolbar->dropdownButton('new-group');
$newGroup->configure(
function (Toolbar $childBar)
{
$childBar->popupButton('new')->text('New')->selector('cfSelectTemplate')->icon('icon-new')->buttonClass('btn btn-success');
$childBar->addNew('form.add')->text('COM_CONVERTFORMS_TEMPLATES_BLANK');
$childBar->standardButton('import')->text('NR_IMPORT')->task('forms.import')->icon('icon-upload');
}
);
}
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('fas fa-ellipsis-h')
->buttonClass('btn btn-action')
->listCheck(true);
$childBar = $dropdown->getChildToolbar();
if ($canDo->get('core.edit.state'))
{
$childBar->publish('forms.publish')->listCheck(true);
$childBar->unpublish('forms.unpublish')->listCheck(true);
$childBar->standardButton('copy')->text('JTOOLBAR_DUPLICATE')->task('forms.duplicate')->listCheck(true);
$childBar->standardButton('export')->text('NR_EXPORT')->task('forms.export')->icon('icon-download')->listCheck(true);
$childBar->trash('forms.trash')->listCheck(true);
}
if ($this->state->get('filter.state') == -2)
{
$toolbar->delete('forms.delete')
->text('JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
if ($canDo->get('core.admin'))
{
$toolbar->preferences('com_convertforms');
}
$toolbar->help('JHELP', false, "http://www.tassos.gr/joomla-extensions/responsive-scroll-triggered-box-for-joomla/docs");
}
return;
}
if ($viewLayout == 'import')
{
JFactory::getDocument()->setTitle(JText::_('COM_CONVERTFORMS') . ': ' . JText::_('NR_IMPORT_ITEMS'));
JToolbarHelper::title(JText::_('COM_CONVERTFORMS') . ': ' . JText::_('NR_IMPORT_ITEMS'));
JToolbarHelper::back();
}
else
{
JToolBarHelper::title(JText::_('COM_CONVERTFORMS') . ": " . JText::_('COM_CONVERTFORMS_FORMS'));
if ($canDo->get('core.create'))
{
JToolbarHelper::addNew('form.add');
}
if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('form.edit');
}
if ($canDo->get('core.create'))
{
JToolbarHelper::custom('forms.duplicate', 'copy', 'copy', 'JTOOLBAR_DUPLICATE', true);
}
if ($canDo->get('core.edit.state') && $state->get('filter.state') != 2)
{
JToolbarHelper::publish('forms.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('forms.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
if ($canDo->get('core.delete') && $state->get('filter.state') == -2)
{
JToolbarHelper::deleteList('', 'forms.delete', 'JTOOLBAR_EMPTY_TRASH');
}
else if ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('forms.trash');
}
if ($canDo->get('core.create'))
{
JToolbarHelper::custom('forms.export', 'box-add', 'box-add', 'NR_EXPORT');
JToolbarHelper::custom('forms.import', 'box-remove', 'box-remove', 'NR_IMPORT', false);
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_convertforms');
}
}
JToolbarHelper::help("Help", false, "http://www.tassos.gr/joomla-extensions/convert-forms/docs");
}
}