Skip to content

Commit

Permalink
Merge pull request #120 from techjoomla/release-1.0.4
Browse files Browse the repository at this point in the history
Merge `Release 1.0.4` into `master`
  • Loading branch information
manojLondhe committed Dec 26, 2018
2 parents 62a93d0 + b10c311 commit a2be385
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 74 deletions.
4 changes: 2 additions & 2 deletions plugins/actionlog/tjreports/tjreports.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="3.9" type="plugin" group="actionlog" method="upgrade">
<name>plg_actionlog_tjreports</name>
<author>Techjoomla</author>
<creationDate>16th Nov 2018</creationDate>
<creationDate>25th Dec 2018</creationDate>
<copyright>Copyright (C) 2016 - 2018 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<version>1.0.3</version>
<version>1.0.4</version>
<description>PLG_ACTIONLOG_TJREPORTS_XML_DESCRIPTION</description>
<files>
<filename plugin="tjreports">tjreports.php</filename>
Expand Down
4 changes: 2 additions & 2 deletions plugins/privacy/tjreports/tjreports.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.4" type="plugin" group="privacy" method="upgrade">
<name>plg_privacy_tjreports</name>
<version>1.0.3</version>
<creationDate>16th Nov 2018</creationDate>
<version>1.0.4</version>
<creationDate>25th Dec 2018</creationDate>
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
Expand Down
116 changes: 59 additions & 57 deletions tjreports/site/views/reports/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -1,60 +1,62 @@
<?php
/**
* @version 1.0.0
* @package com_tjreports
* @copyright Copyright (C) 2014. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author TechJoomla <[email protected]> - http://www.techjoomla.com
*/

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

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

$app = JFactory::getApplication();
$headerLevel = $this->headerLevel;
$this->listOrder = $this->state->get('list.ordering');
$this->listDirn = $this->state->get('list.direction');
$totalCount = 0;

foreach ($this->colToshow as $key=>$data)
{
if (is_array($data))
{
$totalCount = $totalCount + count($data);
}
else
{
$totalCount++;
}
}

$input = JFactory::getApplication()->input;
$displayFilters = $this->userFilters;
$totalHeadRows = count($displayFilters);

if ($app->isSite())
{
$siteUrl = JUri::root();
$message = array();
$message['success'] = JText::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS");
$message['error'] = JText::_("COM_TJREPORTS_EXPORT_FILE_ERROR");
$message['inprogress'] = JText::_("COM_TJREPORTS_EXPORT_FILE_NOTICE");
$message['text'] = JText::_("COM_TJREPORTS_CSV_EXPORT");

JHtml::script(JUri::base() . 'libraries/techjoomla/assets/js/tjexport.js');
$document = JFactory::getDocument();
$csv_url = 'index.php?option=' . $input->get('option') . '&view=' . $input->get('view') . '&format=csv';

$document->addScriptDeclaration("var csv_export_url='{$csv_url}';");
$document->addScriptDeclaration("var csv_export_success='{$message['success']}';");
$document->addScriptDeclaration("var csv_export_error='{$message['error']}';");
$document->addScriptDeclaration("var csv_export_inprogress='{$message['inprogress']}';");
$document->addScriptDeclaration("var tj_csv_site_root='{$siteUrl}';");
}

?>
/**
* @version 1.0.0
* @package com_tjreports
* @copyright Copyright (C) 2014. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author TechJoomla <[email protected]> - http://www.techjoomla.com
*/

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

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

$app = JFactory::getApplication();
$headerLevel = $this->headerLevel;
$this->listOrder = $this->state->get('list.ordering');
$this->listDirn = $this->state->get('list.direction');
$totalCount = 0;

foreach ($this->colToshow as $key=>$data)
{
if (is_array($data))
{
$totalCount = $totalCount + count($data);
}
else
{
$totalCount++;
}
}

$input = JFactory::getApplication()->input;
$displayFilters = $this->userFilters;
$totalHeadRows = count($displayFilters);
$reportId = $app->getUserStateFromRequest('reportId', 'reportId', '');
$user = JFactory::getUser();
$userAuthorisedExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $reportId);

if ($app->isSite())
{
$siteUrl = JUri::root();
$message = array();
$message['success'] = JText::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS");
$message['error'] = JText::_("COM_TJREPORTS_EXPORT_FILE_ERROR");
$message['inprogress'] = JText::_("COM_TJREPORTS_EXPORT_FILE_NOTICE");
$message['text'] = JText::_("COM_TJREPORTS_CSV_EXPORT");

JHtml::script(JUri::base() . 'libraries/techjoomla/assets/js/tjexport.js');
$document = JFactory::getDocument();
$csv_url = 'index.php?option=' . $input->get('option') . '&view=' . $input->get('view') . '&format=csv';

$document->addScriptDeclaration("var csv_export_url='{$csv_url}';");
$document->addScriptDeclaration("var csv_export_success='{$message['success']}';");
$document->addScriptDeclaration("var csv_export_error='{$message['error']}';");
$document->addScriptDeclaration("var csv_export_inprogress='{$message['inprogress']}';");
$document->addScriptDeclaration("var tj_csv_site_root='{$siteUrl}';");
}
?>
<div id="reports-container">
<div class="<?php echo COM_TJLMS_WRAPPER_DIV ?> tjBs3">
<?php
Expand Down Expand Up @@ -222,7 +224,7 @@
</div>
<!--/col-md-2-->
<?php
if (!$app->isAdmin())
if (!$app->isAdmin() && $userAuthorisedExport && $user)
{
?>
<div class="col-sm-5 col-md-8">
Expand Down
43 changes: 40 additions & 3 deletions tjreports/site/views/reports/view.csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.view');
jimport('techjoomla.view.csv');
JLoader::import('components.com_tjreports.helpers.tjreports', JPATH_ADMINISTRATOR);

/**
* CSV class for a list of Tjreports.
Expand All @@ -35,14 +36,50 @@ class TjreportsViewReports extends TjExportCsv
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return Toolbar instance
* @return Object|Boolean in case of success instance and failure - boolean
*
* @since 1.6
*/
public function display($tpl = null)
{
$this->getItems();
parent::display();
$input = JFactory::getApplication()->input;
$user = JFactory::getUser();
$canDo = TjreportsHelper::getActions();
$reportId = $input->post->get('reportId');
$userAuthorisedExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $reportId);

if (!$canDo->get('core.export') || !$user)
{
// Redirect to the list screen.
$redirect = JRoute::_('index.php?option=com_tjreports&view=reports', false);
JFactory::getApplication()->redirect($redirect, JText::_('JERROR_ALERTNOAUTHOR'));

return false;
}
else
{
if ($input->get('task') == 'download')
{
$fileName = $input->get('file_name');
$this->download($fileName);
JFactory::getApplication()->close();
}
else
{
if ($userAuthorisedExport)
{
$this->getItems();

parent::display();
}
else
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');

return false;
}
}
}
}

/**
Expand Down
23 changes: 15 additions & 8 deletions tjreports/site/views/reports/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
$app = JFactory::getApplication();
$bar = JToolBar::getInstance('toolbar');
$app = JFactory::getApplication();
$reportId = $app->getUserStateFromRequest('reportId', 'reportId', '');
$user = JFactory::getUser();
$userAuthorisedExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $reportId);
$bar = JToolBar::getInstance('toolbar');
$canDo = TjreportsHelper::getActions();

if ($app->isAdmin())
{
Expand Down Expand Up @@ -94,12 +98,15 @@ protected function addToolbar()
$this->document->setTitle($title);
}

$message = array();
$message['success'] = JText::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS");
$message['error'] = JText::_("COM_TJREPORTS_EXPORT_FILE_ERROR");
$message['inprogress'] = JText::_("COM_TJREPORTS_EXPORT_FILE_NOTICE");
$message['text'] = JText::_("COM_TJREPORTS_CSV_EXPORT");
$bar->appendButton('CsvExport', $message);
if ($canDo->get('core.export') && $userAuthorisedExport)
{
$message = array();
$message['success'] = JText::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS");
$message['error'] = JText::_("COM_TJREPORTS_EXPORT_FILE_ERROR");
$message['inprogress'] = JText::_("COM_TJREPORTS_EXPORT_FILE_NOTICE");
$message['text'] = JText::_("COM_TJREPORTS_CSV_EXPORT");
$bar->appendButton('CsvExport', $message);
}

$button = '<span id="btn-cancel">
<input type="text" name="queryName" autocomplete="off" placeholder="Title for the Query" id="queryName" />
Expand Down
4 changes: 2 additions & 2 deletions tjreports/tjreports.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<authorUrl>https://techjoomla.com</authorUrl>
<copyright>Copyright (C) 2016 - 2018 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<creationDate>16th Nov 2018</creationDate>
<version>1.0.3</version>
<creationDate>25th Dec 2018</creationDate>
<version>1.0.4</version>
<description>This component is used to access all the report at single place.</description>
<install>
<!-- Runs on install -->
Expand Down

0 comments on commit a2be385

Please sign in to comment.