Skip to content

Commit

Permalink
Joomla 4 Compatability (#132)
Browse files Browse the repository at this point in the history
* Task #172430 feat: Update JGive code to make Joomla 4 compatible

* Task #172430 feat: Update JGive code to make Joomla 4 compatible

* Task #172430 feat: Update JGive code to make Joomla 4 compatible

* Task #172430 feat: Update JGive code to make Joomla 4 compatible

* Task #139783 chore: Make TJ notification compatible with Joomla 4

* Task #173069 feat: Update infra extensions code used to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used in JGive to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used in JGive to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used in JGive to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used in JGive to make Joomla 4 compatible

* Bug #178705 fix: Frontend >login by 'Super user/Registered user' > selecting 'Create New Campaign' menu > it displays 'The vendor has not yet been approved' ,user not able to create campaign

* Task #173069 feat: Update infra extensions code used in JGive to make Joomla 4 compatible

* Task #173069 feat: Update infra extensions code used in JGive to make Joomla 4 compatible

Co-authored-by: Deepa Gawade <deepa_g@techjoomla.com>
  • Loading branch information
ankush-maherwal and deepa-g authored Jan 25, 2022
1 parent 4e92fa2 commit dfaec70
Show file tree
Hide file tree
Showing 14 changed files with 497 additions and 247 deletions.
2 changes: 1 addition & 1 deletion src/com_tjnotifications/admin/models/fields/backends.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

JFormHelper::loadFieldClass('list');
FormHelper::loadFieldClass('list');

/**
* Supports an HTML select list of backends
Expand Down
2 changes: 1 addition & 1 deletion src/com_tjnotifications/admin/models/fields/clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

JFormHelper::loadFieldClass('list');
FormHelper::loadFieldClass('list');

/**
* Custom field to list all client of tjnotification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Form\FormHelper;

FormHelper::loadFieldClass('groupedlist');

Expand Down
2 changes: 1 addition & 1 deletion src/com_tjnotifications/admin/models/fields/platforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

JFormHelper::loadFieldClass('list');
FormHelper::loadFieldClass('list');

/**
* Supports an HTML select list of platforms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;

JFormHelper::loadFieldClass('list');
FormHelper::loadFieldClass('list');

/**
* Supports an HTML select list of backends
Expand Down
234 changes: 7 additions & 227 deletions src/com_tjnotifications/site/views/preferences/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -1,236 +1,16 @@
<?php
/**
* @package TJNotifications
* @subpackage com_tjnotifications
* @package JGive
* @subpackage com_jgive
*
* @author Techjoomla <extensions@techjoomla.com>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @copyright Copyright (C) 2009 - 2021 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

defined('_JEXEC') or die;
// Do not allow direct access
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Uri\Uri;
use \Joomla\CMS\Factory;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\HTML\HTMLHelper;

$language = Factory::getLanguage();
$language->load('com_tjnotification', JPATH_SITE, 'en-GB', true);
$language->load('com_tjnotification', JPATH_SITE, null, true);

HTMLHelper::_('script', '/jquery.min.js');
Factory::getDocument()->addScriptDeclaration('
const tjnBaseurl = "' . Uri::root() . '";
jQuery.noConflict();
jQuery(".btn-group > .btn").click(function(){
jQuery(this).addClass("active").siblings().removeClass("active");
});
function addPreferance(pId,client,provider,key)
{
if(pId)
{
jQuery.ajaxSetup({
global: false,
type:"post",
url:tjnBaseurl+"index.php?option=com_tjnotifications&task=preferences.save",
dataType:"json",
beforeSend: function () {
jQuery("#ajax-loader"+pId).show();
jQuery("#ajax-loader"+pId).html("<img src=\'' . Uri::root() . 'components/com_tjnotifications/images/ajax-loader.gif\'><style=\'display:block\'>");
},
complete: function () {
jQuery("#ajax-loader"+pId).hide();
jQuery("#tick"+pId).show();
jQuery("#tick"+pId).html("<img src=\'' . Uri::root() . 'components/com_tjnotifications/images/tick.png\'><style=\'display:block\'>");
setTimeout(function() {
jQuery("#tick"+pId).hide();
}, 5000);
}
});
jQuery.ajax({
data:
{
client_name:client,
provider_name:provider,
key:key,
},
success: function (response)
{
jQuery("#display_info").html("Item successfully saved");
}
});
}
else
{
jQuery("#display_info").html("Item not successfully saved");
}
}
function removePreferance(pId,client,provider,key)
{
if(pId)
{
jQuery.ajaxSetup({
global: false,
type:"post",
url:tjnBaseurl+"index.php?option=com_tjnotifications&task=preferences.delete",
beforeSend: function () {
jQuery("#ajax-loader"+pId).show();
jQuery("#ajax-loader"+pId).html("<img src=\'' . Uri::root() . 'components/com_tjnotifications/images/ajax-loader.gif\'><style=\'display:block\'>");
},
complete: function () {
jQuery("#ajax-loader"+pId).hide();
jQuery("#tick"+pId).show();
jQuery("#tick"+pId).html("<img src=\'' . Uri::root() . 'components/com_tjnotifications/images/tick.png\'><style=\'display:block\'>");
setTimeout(function() {
jQuery("#tick"+pId).hide();
}, 5000);
}
});
jQuery.ajax({
dataType:"json",
data:
{
client_name:client,
provider_name:provider,
key:key,
},
success: function (response)
{
jQuery("#display_info").html("Item successfully saved");
}
});
}
else
{
jQuery("#display_info").html("Item not successfully saved");
}
}
');
?>

<form action="index.php?option=com_tjnotifications&view=preferences" method="post" id="adminForm" name="adminForm">
<div class="row-fluid">
<div class="span6">
</div>
</div>

<div id="display_info"></div>
<ul class="nav nav-tabs">
<?php if (!empty($this->clients)) : ?>
<?php foreach ($this->clients as $i => $menu) :?>
<li>
<a data-toggle="tab" aria-controls="<?php echo($menu->client); ?>"
href="<?php echo('#'.$menu->client); ?>">
<?php echo str_replace("com_","",$menu->client); ?>
</a>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>

<div class="tab-content">
<?php foreach ($this->clients as $i => $menu) :?>
<div class="tab-pane" id="<?php echo($menu->client); ?>" >
<table class="table table-striped table-hover">
<thead>
<tr>
<th width="20%">

</th>
<?php if (!empty($this->providers)) : ?>
<?php foreach ($this->providers as $i => $head) :?>
<th width="30%">
<?php echo($head->provider); ?>
</th>
<?php endforeach; ?>
<?php endif; ?>
</tr>
</thead>
<tbody>
<div class="row">
<div class="col-md-3">
<?php foreach($this->keys[$menu->client] as $key=>$values) : ?>
<?php foreach($values as $value ) : ?>
<tr>
<td align="center">
<?php echo $value; ?>
</td>
<?php foreach ($this->providers as $i => $head) :?>
<td>
<?php $temp=0; ?>
<?php foreach ($this->adminPreferences[$head->provider] as $adminKey => $admin) :?>
<?php if($admin->client == $menu->client && $admin->key == $value) : $temp++; ?>

<?php if(empty($this->preferences)) : ?>

<div class="control">
<fieldset class="btn-group btn-group-yesno radio pull-left" >
<input type="radio" id="<?php echo $value.$i; ?>" name="prefer" value="1" onclick="removePreferance('<?php echo $value.$i; ?>','<?php echo($menu->client); ?>','<?php echo($head->provider); ?>','<?php echo $value; ?>')" checked="checked" />
<input type="radio" id="<?php echo $key.$i; ?>" name="prefer1" value="0" onclick="addPreferance('<?php echo $value.$i; ?>','<?php echo($menu->client); ?>','<?php echo($head->provider); ?>','<?php echo $value; ?>')" />
<label class="btn-success" for="<?php echo $value.$i; ?>" ><?php echo Text::_('COM_TJNOTIFICATION_VIEWS_PREFERENCES_FIELD_ENABLE'); ?></label>
<label class="btn" for="<?php echo $key.$i; ?>" ><?php echo Text::_('COM_TJNOTIFICATION_VIEWS_PREFERENCES_FIELD_DISABLE'); ?></label>
</fieldset>
</div>

<div class="pull-right" id="<?php echo 'ajax-loader'.$value.$i; ?>" ></div>
<div class="pull-right" id="<?php echo 'tick'.$value.$i; ?>" ></div>
<?php else: $count=0; ?>

<?php foreach ($this->preferences as $j => $prefer) :?>
<?php if($prefer->client == $menu->client && $prefer->key == $value && $prefer->provider == $head->provider) : ?>
<?php $count++; ?>
<div class="control">
<fieldset class="btn-group btn-group-yesno radio pull-left" >
<input type="radio" id="<?php echo $menu->client.$value.$i; ?>" name="prefer" value="1" onclick="removePreferance('<?php echo $menu->client.$value.$i; ?>','<?php echo($menu->client); ?>','<?php echo($head->provider); ?>','<?php echo $value; ?>')" />
<input type="radio" id="<?php echo $menu->client.$key.$i; ?>" name="prefer1" value="0" onclick="addPreferance('<?php echo $menu->client.$value.$i; ?>','<?php echo($menu->client); ?>','<?php echo($head->provider); ?>','<?php echo $value; ?>')" checked="checked" />
<label class="btn" for="<?php echo $menu->client.$value.$i; ?>" ><?php echo Text::_('COM_TJNOTIFICATION_VIEWS_PREFERENCES_FIELD_ENABLE'); ?></label>
<label class="btn-danger" for="<?php echo $menu->client.$key.$i; ?>" ><?php echo Text::_('COM_TJNOTIFICATION_VIEWS_PREFERENCES_FIELD_DISABLE'); ?></label>
</fieldset>
</div>
<?php endif;?>
<?php endforeach; ?>

<?php if ($count==0): ?>
<div class="control">
<fieldset class="btn-group btn-group-yesno radio pull-left" >
<input type="radio" id="<?php echo $menu->client.$value.$i; ?>" name="prefer" value="1" onclick="removePreferance('<?php echo $menu->client.$value.$i; ?>','<?php echo($menu->client); ?>','<?php echo($head->provider); ?>','<?php echo $value; ?>')" checked="checked" />
<input type="radio" id="<?php echo $menu->client.$key.$i; ?>" name="prefer1" value="0" onclick="addPreferance('<?php echo $menu->client.$value.$i; ?>','<?php echo($menu->client); ?>','<?php echo($head->provider); ?>','<?php echo $value; ?>')" />
<label class="btn-success" for="<?php echo $menu->client.$value.$i; ?>" ><?php echo Text::_('COM_TJNOTIFICATION_VIEWS_PREFERENCES_FIELD_ENABLE'); ?></label>
<label class="btn" for="<?php echo $menu->client.$key.$i; ?>" ><?php echo Text::_('COM_TJNOTIFICATION_VIEWS_PREFERENCES_FIELD_DISABLE'); ?></label>
</fieldset>
</div>
<?php endif; ?>

<?php endif;?>

<?php endif;?>

<?php endforeach; ?>

<?php if ($temp == 0): ?>
<span class="label label-warning"><?php echo Text::_('COM_TJNOTIFICATIONS_VIEW_PREFERENCES_TAB_UNSUBSCRIBED'); ?></span>
<?php endif; ?>
<div class="pull-right" id="<?php echo 'ajax-loader'.$menu->client.$value.$i; ?>" ></div>
<div class="pull-right" id="<?php echo 'tick'.$menu->client.$value.$i; ?>" ></div>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</div>
</div>
</tbody>
</table>
</div>
<?php endforeach;?>
</div>

<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0"/>
<?php echo HTMLHelper::_('form.token'); ?>
</form>
$bsVersion = (JVERSION > '4.0.0') ? 'bs5' : 'bs3';

echo $this->loadTemplate($bsVersion);
Loading

0 comments on commit dfaec70

Please sign in to comment.