diff --git a/build/bump.php b/build/bump.php index e97c595..be4ac5c 100644 --- a/build/bump.php +++ b/build/bump.php @@ -49,10 +49,10 @@ function usage($command) // This file will vary from component to component $coreXmlFiles = array( '/tjreports/tjreports.xml', - '/plugins/actionlog/tjreports/tjreports.xml', - '/plugins/content/tjreportsfields/tjreportsfields.xml', - '/plugins/privacy/tjreports/tjreports.xml', - '/plugins/user/tjreportsindexer/tjreportsindexer.xml' + '/tjreports/plugins/actionlog/tjreports/tjreports.xml', + '/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml', + '/tjreports/plugins/privacy/tjreports/tjreports.xml', + '/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml' ); $antJobFile = '/build.xml'; diff --git a/tjreports/administrator/models/tjreport.php b/tjreports/administrator/models/tjreport.php index 768706b..ece6446 100644 --- a/tjreports/administrator/models/tjreport.php +++ b/tjreports/administrator/models/tjreport.php @@ -177,6 +177,7 @@ public function getReportPluginData($pluginId, $pluginName = null) $params['filter_order'] = $plgModel->getState('list.ordering'); $params['filter_order_Dir'] = $plgModel->getState('list.direction'); $params['limit'] = $plgModel->getState('list.limit'); + $params['emailColumn'] = $plgModel->getState('emailColumn'); $params['colToshow'] = $plgModel->getState('colToshow'); $params['colToshow'] = array_combine($params['colToshow'], array_fill(0, count($params['colToshow']), true)); $params['showHideColumns'] = $plgModel->showhideCols; diff --git a/plugins/actionlog/tjreports/index.html b/tjreports/plugins/actionlog/tjreports/index.html similarity index 100% rename from plugins/actionlog/tjreports/index.html rename to tjreports/plugins/actionlog/tjreports/index.html diff --git a/plugins/actionlog/tjreports/language/en-GB/en-GB.plg_actionlog_tjreports.ini b/tjreports/plugins/actionlog/tjreports/language/en-GB/en-GB.plg_actionlog_tjreports.ini similarity index 100% rename from plugins/actionlog/tjreports/language/en-GB/en-GB.plg_actionlog_tjreports.ini rename to tjreports/plugins/actionlog/tjreports/language/en-GB/en-GB.plg_actionlog_tjreports.ini diff --git a/plugins/actionlog/tjreports/language/en-GB/en-GB.plg_actionlog_tjreports.sys.ini b/tjreports/plugins/actionlog/tjreports/language/en-GB/en-GB.plg_actionlog_tjreports.sys.ini similarity index 100% rename from plugins/actionlog/tjreports/language/en-GB/en-GB.plg_actionlog_tjreports.sys.ini rename to tjreports/plugins/actionlog/tjreports/language/en-GB/en-GB.plg_actionlog_tjreports.sys.ini diff --git a/plugins/actionlog/tjreports/tjreports.php b/tjreports/plugins/actionlog/tjreports/tjreports.php similarity index 100% rename from plugins/actionlog/tjreports/tjreports.php rename to tjreports/plugins/actionlog/tjreports/tjreports.php diff --git a/plugins/actionlog/tjreports/tjreports.xml b/tjreports/plugins/actionlog/tjreports/tjreports.xml similarity index 95% rename from plugins/actionlog/tjreports/tjreports.xml rename to tjreports/plugins/actionlog/tjreports/tjreports.xml index 7a55939..314baeb 100644 --- a/plugins/actionlog/tjreports/tjreports.xml +++ b/tjreports/plugins/actionlog/tjreports/tjreports.xml @@ -2,12 +2,12 @@ plg_actionlog_tjreports Techjoomla - 24th Jun 2019 + 12th Jul 2019 Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL extensions@techjoomla.com https://techjoomla.com - 1.1.0 + 1.1.1 PLG_ACTIONLOG_TJREPORTS_XML_DESCRIPTION tjreports.php diff --git a/plugins/content/tjreportsfields/index.html b/tjreports/plugins/content/tjreportsfields/index.html similarity index 100% rename from plugins/content/tjreportsfields/index.html rename to tjreports/plugins/content/tjreportsfields/index.html diff --git a/plugins/content/tjreportsfields/language/en-GB/en-GB.plg_content_tjreportsfields.ini b/tjreports/plugins/content/tjreportsfields/language/en-GB/en-GB.plg_content_tjreportsfields.ini similarity index 100% rename from plugins/content/tjreportsfields/language/en-GB/en-GB.plg_content_tjreportsfields.ini rename to tjreports/plugins/content/tjreportsfields/language/en-GB/en-GB.plg_content_tjreportsfields.ini diff --git a/plugins/content/tjreportsfields/language/en-GB/en-GB.plg_content_tjreportsfields.sys.ini b/tjreports/plugins/content/tjreportsfields/language/en-GB/en-GB.plg_content_tjreportsfields.sys.ini similarity index 100% rename from plugins/content/tjreportsfields/language/en-GB/en-GB.plg_content_tjreportsfields.sys.ini rename to tjreports/plugins/content/tjreportsfields/language/en-GB/en-GB.plg_content_tjreportsfields.sys.ini diff --git a/plugins/content/tjreportsfields/tjreportsfields.php b/tjreports/plugins/content/tjreportsfields/tjreportsfields.php similarity index 100% rename from plugins/content/tjreportsfields/tjreportsfields.php rename to tjreports/plugins/content/tjreportsfields/tjreportsfields.php diff --git a/plugins/content/tjreportsfields/tjreportsfields.xml b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml similarity index 81% rename from plugins/content/tjreportsfields/tjreportsfields.xml rename to tjreports/plugins/content/tjreportsfields/tjreportsfields.xml index 9ffc25a..f7f33d5 100644 --- a/plugins/content/tjreportsfields/tjreportsfields.xml +++ b/tjreports/plugins/content/tjreportsfields/tjreportsfields.xml @@ -3,12 +3,12 @@ plg_content_tjreportsfields PLG_CONTENT_TJREPORTSFIELDS_XML_DESCRIPTION Techjoomla - contact@techjoomla.com + extensions@techjoomla.com https://techjoomla.com - 24th May 2019 - Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. + 12th Jul 2019 + Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 1.0.0 + 1.1.1 tjreportsfields.php diff --git a/plugins/privacy/tjreports/index.html b/tjreports/plugins/privacy/tjreports/index.html similarity index 100% rename from plugins/privacy/tjreports/index.html rename to tjreports/plugins/privacy/tjreports/index.html diff --git a/plugins/privacy/tjreports/language/en-GB/en-GB.plg_privacy_tjreports.ini b/tjreports/plugins/privacy/tjreports/language/en-GB/en-GB.plg_privacy_tjreports.ini similarity index 100% rename from plugins/privacy/tjreports/language/en-GB/en-GB.plg_privacy_tjreports.ini rename to tjreports/plugins/privacy/tjreports/language/en-GB/en-GB.plg_privacy_tjreports.ini diff --git a/plugins/privacy/tjreports/language/en-GB/en-GB.plg_privacy_tjreports.sys.ini b/tjreports/plugins/privacy/tjreports/language/en-GB/en-GB.plg_privacy_tjreports.sys.ini similarity index 100% rename from plugins/privacy/tjreports/language/en-GB/en-GB.plg_privacy_tjreports.sys.ini rename to tjreports/plugins/privacy/tjreports/language/en-GB/en-GB.plg_privacy_tjreports.sys.ini diff --git a/plugins/privacy/tjreports/tjreports.php b/tjreports/plugins/privacy/tjreports/tjreports.php similarity index 100% rename from plugins/privacy/tjreports/tjreports.php rename to tjreports/plugins/privacy/tjreports/tjreports.php diff --git a/plugins/privacy/tjreports/tjreports.xml b/tjreports/plugins/privacy/tjreports/tjreports.xml similarity index 92% rename from plugins/privacy/tjreports/tjreports.xml rename to tjreports/plugins/privacy/tjreports/tjreports.xml index 4e15571..45d6501 100644 --- a/plugins/privacy/tjreports/tjreports.xml +++ b/tjreports/plugins/privacy/tjreports/tjreports.xml @@ -1,8 +1,8 @@ plg_privacy_tjreports - 1.1.0 - 24th Jun 2019 + 1.1.1 + 12th Jul 2019 Techjoomla extensions@techjoomla.com https://techjoomla.com diff --git a/plugins/user/tjreportsindexer/index.html b/tjreports/plugins/user/tjreportsindexer/index.html similarity index 100% rename from plugins/user/tjreportsindexer/index.html rename to tjreports/plugins/user/tjreportsindexer/index.html diff --git a/plugins/user/tjreportsindexer/language/en-GB/en-GB.plg_user_tjreportsindexer.ini b/tjreports/plugins/user/tjreportsindexer/language/en-GB/en-GB.plg_user_tjreportsindexer.ini similarity index 100% rename from plugins/user/tjreportsindexer/language/en-GB/en-GB.plg_user_tjreportsindexer.ini rename to tjreports/plugins/user/tjreportsindexer/language/en-GB/en-GB.plg_user_tjreportsindexer.ini diff --git a/plugins/user/tjreportsindexer/language/en-GB/en-GB.plg_user_tjreportsindexer.sys.ini b/tjreports/plugins/user/tjreportsindexer/language/en-GB/en-GB.plg_user_tjreportsindexer.sys.ini similarity index 100% rename from plugins/user/tjreportsindexer/language/en-GB/en-GB.plg_user_tjreportsindexer.sys.ini rename to tjreports/plugins/user/tjreportsindexer/language/en-GB/en-GB.plg_user_tjreportsindexer.sys.ini diff --git a/tjreports/plugins/user/tjreportsindexer/sql/tjreportsindexer.install.sql b/tjreports/plugins/user/tjreportsindexer/sql/tjreportsindexer.install.sql new file mode 100755 index 0000000..4e64539 --- /dev/null +++ b/tjreports/plugins/user/tjreportsindexer/sql/tjreportsindexer.install.sql @@ -0,0 +1,3 @@ +CREATE TABLE IF NOT EXISTS `#__tjreports_com_users_user` ( + `record_id` int(11) NOT NULL +)ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/tjreports/plugins/user/tjreportsindexer/sql/updates/mysql/1.1.1.sql b/tjreports/plugins/user/tjreportsindexer/sql/updates/mysql/1.1.1.sql new file mode 100644 index 0000000..4e64539 --- /dev/null +++ b/tjreports/plugins/user/tjreportsindexer/sql/updates/mysql/1.1.1.sql @@ -0,0 +1,3 @@ +CREATE TABLE IF NOT EXISTS `#__tjreports_com_users_user` ( + `record_id` int(11) NOT NULL +)ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/plugins/user/tjreportsindexer/tjreportsindexer.php b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.php similarity index 100% rename from plugins/user/tjreportsindexer/tjreportsindexer.php rename to tjreports/plugins/user/tjreportsindexer/tjreportsindexer.php diff --git a/plugins/user/tjreportsindexer/tjreportsindexer.xml b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml similarity index 64% rename from plugins/user/tjreportsindexer/tjreportsindexer.xml rename to tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml index d899e0f..568f885 100644 --- a/plugins/user/tjreportsindexer/tjreportsindexer.xml +++ b/tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml @@ -3,16 +3,26 @@ plg_user_tjreportsindexer PLG_USER_TJREPORTSINDEXER_XML_DESCRIPTION Techjoomla - contact@techjoomla.com + extensions@techjoomla.com https://techjoomla.com - 24th May 2019 - Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. + 12th Jul 2019 + Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 1.0.0 - + 1.1.1 + + + sql/tjreportsindexer.install.sql + + + + + sql/updates/mysql + + tjreportsindexer.php index.html + sql diff --git a/tjreports/site/assets/js/tjrContentUI.js b/tjreports/site/assets/js/tjrContentUI.js index 2797b01..5c16ad2 100755 --- a/tjreports/site/assets/js/tjrContentUI.js +++ b/tjreports/site/assets/js/tjrContentUI.js @@ -12,6 +12,7 @@ tjrContentUI.root_url = (typeof root_url == 'undefined') ? '' : root_url; tjrContentUI.base_url = (typeof root_url == 'undefined') ? '' : root_url; tjrContentUI.report = tjrContentUI.report ? tjrContentUI.report : {}; + jQuery.extend(tjrContentUI.report, { searchToggle: true, $form: null, @@ -28,6 +29,7 @@ jQuery.extend(tjrContentUI.report, { } jQuery(".hasPopover").popover('destroy') var promise = tjrContentService.postData(this.url, this.$form.serialize());//, {'datatype':'html'} + promise.fail( function(response) { console.log('Something went wrong.'); @@ -45,6 +47,15 @@ jQuery.extend(tjrContentUI.report, { var responseHTML = jQuery(response['html']).find(containerSel).html(); jQuery(containerSel).html(responseHTML); + // If sendEmail plug is enabled then try to add a column of checkboxes + if ( + typeof tjutilitysendemail != 'undefined' && + jQuery('body').find('.td-sendemail').length > 0 + ) + { + tjutilitysendemail.addColumn('report-table'); + } + // Reinitialze some js like for calandar, tooltip, chosen jQuery(".hasPopover").popover({"html": true,"trigger": "hover focus","container": "body"}); diff --git a/tjreports/site/controllers/reports.php b/tjreports/site/controllers/reports.php index c885f77..5cd560b 100644 --- a/tjreports/site/controllers/reports.php +++ b/tjreports/site/controllers/reports.php @@ -67,8 +67,7 @@ public function csvexport() $columns = $model->columns; $colToshow = $model->getState('colToshow'); - $csvData = null; - $csvData_arr = $colTitleArray = array(); + $colTitleArray = array(); foreach ($colToshow as $index => $detail) { @@ -111,19 +110,23 @@ public function csvexport() } } - $csvData .= implode(',', $colTitleArray); - $csvData .= "\n"; - echo $csvData; - - $csvData = ''; $pluginTitle = $reportData->title; $filename = strtolower($pluginTitle) . "_report_" . date("Y-m-d_H-i", time()); + // Create a file pointer connected to the output stream + $output = fopen('php://output', 'w'); + + // Put CSV headings first + fputcsv($output, $colTitleArray); + // Set CSV headers - header("Content-type: text/csv"); - header("Content-Disposition: attachment; filename=" . $filename . ".csv"); - header("Pragma: no-cache"); - header("Expires: 0"); + header('Pragma: no-cache'); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Content-Description: File Transfer'); + header('Content-Type: text/csv;'); + header('Content-Disposition: attachment; filename=' . $filename . '.csv'); + header('Content-Transfer-Encoding: binary'); // Loop through items foreach ((array) $items as $itemKey => $item) @@ -136,25 +139,19 @@ public function csvexport() { foreach ($key as $subkey => $subVal) { - $final_text_value = $this->filterValue($item[$arrayKey][$subkey]); - - // Add data in the Quotes and asign it in the csv array - $itemCSV[] = '"' . $final_text_value . '"'; + $itemCSV[] = $this->filterValue($item[$arrayKey][$subkey]); } } else { - $final_text_value = $this->filterValue($item[$key]); - - // Add data in the Quotes and asign it in the csv array - $itemCSV[] = '"' . $final_text_value . '"'; + $itemCSV[] = $this->filterValue($item[$key]); } } - // TRIGGER After csv body add extra fields - echo implode(',', $itemCSV) . "\n"; + fputcsv($output, $itemCSV); } + fclose($output); jexit(); } diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index c74b626..5614ff4 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -37,6 +37,9 @@ class TjreportsModelReports extends JModelList // Columns array contain columns data public $columns = array(); + // Columns array contain email columns + private $emailColumn = ''; + // Columns that a user can select to display public $showhideCols = array(); @@ -91,6 +94,9 @@ public function __construct($config = array()) $this->setCustomFieldsColumns(); } + // Get email column + $this->emailColumn = array_search(1, array_map(function ($ar) {return $ar['emailColumn'];}, $this->columns)); + $this->initData(); parent::__construct($config); @@ -366,6 +372,7 @@ private function initData() $this->sortableColumns = array_values($this->sortableColumns); $this->sortableWoQuery = array_values($this->sortableWoQuery); $this->defaultColToShow = array_values($this->defaultColToShow); + } /** @@ -525,6 +532,11 @@ protected function populateState($ordering = '', $direction = 'ASC') $value = $input->get('limitstart', 0, 'uint'); $this->setState('list.start', $value); + if ($this->emailColumn) + { + $this->setState('emailColumn', $this->emailColumn); + } + // Ordering $this->default_order = $input->get('filter_order', $this->default_order, 'STRING'); @@ -1073,7 +1085,7 @@ private function filterReportColumns($queryId, &$selColToshow) // Process if user has saved query is for a plugin if (!empty($parentId)) { - $this->processSavedReportColumns($parentId, $showhideCols, $paramColToshow, $selColToshow); + $this->processSavedReportColumns($parentId, $showhideCols, $paramColToshow, $selColToshow); } // If plugin has save any column assign that otherwise default plugin param will be applied @@ -1095,15 +1107,20 @@ private function filterReportColumns($queryId, &$selColToshow) { $this->showhideCols = $showhideCols; } + + if (!empty($emailColumn)) + { + $this->emailColumn = $emailColumn; + } } /** * Method to Process parent Report columns * - * @param INT $queryId Query Id - * @param ARRAY &$showhideCols Show Hide columns - * @param ARRAY &$colToshow Columns to show - * @param ARRAY &$selColToshow Selected Cols + * @param INT $queryId Query Id + * @param ARRAY &$showhideCols Show Hide columns + * @param ARRAY &$colToshow Columns to show + * @param ARRAY &$selColToshow Selected Cols * * @return Void * @@ -1216,7 +1233,7 @@ public function getReportLink($reportToLink, $filters) /** * Method to get id of the report having default set as 1 * - * @param STRING $pluginName Plugin Name + * @param STRING $reportId Report id * * @return Integer * @@ -1228,7 +1245,7 @@ public function getReportParams($reportId) JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); $reportTable->load($reportId); - + return new JRegistry($reportTable->param); } diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index 8ae974f..b63d2b3 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -12,6 +12,8 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +$emailColmClass = 'td-sendemail'; + $app = JFactory::getApplication(); $headerLevel = $this->headerLevel; $this->listOrder = $this->state->get('list.ordering'); @@ -289,7 +291,7 @@ for($i = $headerLevel; $i > 0 ; $i--) { - echo ''; + echo ''; foreach($this->colToshow as $index=>$detail) { @@ -431,7 +433,8 @@ } else { - echo ''. $item[$key] .''; + $isSendEmailClass = ($key == $this->emailColumn) ? $emailColmClass : ''; + echo "{$item[$key]}"; } } diff --git a/tjreports/site/views/reports/view.base.php b/tjreports/site/views/reports/view.base.php index 06c348f..d8809a9 100644 --- a/tjreports/site/views/reports/view.base.php +++ b/tjreports/site/views/reports/view.base.php @@ -162,6 +162,7 @@ public function processData($type = 'html') $this->columns = $this->model->columns; $this->showHideColumns = $this->model->showhideCols; $this->sortable = $this->model->sortableColumns; + $this->emailColumn = $this->model->getState('emailColumn'); $this->srButton = $this->model->showSearchResetButton; $this->colToshow = $this->model->getState('colToshow'); diff --git a/tjreports/tjreports.xml b/tjreports/tjreports.xml index 001c638..3ddde42 100644 --- a/tjreports/tjreports.xml +++ b/tjreports/tjreports.xml @@ -6,8 +6,8 @@ https://techjoomla.com Copyright (C) 2016 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 24th Jun 2019 - 1.1.0 + 12th Jul 2019 + 1.1.1 This component is used to access all the report at single place.