From 6241c876b44edff189fa89ea3e559b59d33aaba4 Mon Sep 17 00:00:00 2001 From: poonam_b Date: Wed, 19 Jun 2019 19:08:45 +0530 Subject: [PATCH 01/50] Task #146075 chore: create MVC for creating notification logs listview --- src/com_tjnotifications/admin/access.xml | 24 ++ src/com_tjnotifications/admin/config.xml | 13 ++ .../admin/controllers/log.php | 19 ++ .../admin/controllers/logs.php | 36 +++ .../language/en-GB.com_tjnotifications.ini | 31 +++ .../admin/models/forms/filter_logs.xml | 25 +++ src/com_tjnotifications/admin/models/log.php | 58 +++++ src/com_tjnotifications/admin/models/logs.php | 197 +++++++++++++++++ .../admin/sql/install.mysql.utf8.sql | 21 ++ .../admin/sql/updates/mysql/1.1.0.sql | 24 ++ src/com_tjnotifications/admin/tables/log.php | 28 +++ .../admin/views/logs/index.html | 1 + .../admin/views/logs/tmpl/default.php | 207 ++++++++++++++++++ .../admin/views/logs/tmpl/default.xml | 8 + .../admin/views/logs/tmpl/index.html | 1 + .../admin/views/logs/view.csv.php | 25 +++ .../admin/views/logs/view.html.php | 88 ++++++++ 17 files changed, 806 insertions(+) create mode 100644 src/com_tjnotifications/admin/access.xml create mode 100644 src/com_tjnotifications/admin/config.xml create mode 100644 src/com_tjnotifications/admin/controllers/log.php create mode 100644 src/com_tjnotifications/admin/controllers/logs.php create mode 100644 src/com_tjnotifications/admin/models/forms/filter_logs.xml create mode 100644 src/com_tjnotifications/admin/models/log.php create mode 100644 src/com_tjnotifications/admin/models/logs.php create mode 100644 src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql create mode 100644 src/com_tjnotifications/admin/tables/log.php create mode 100644 src/com_tjnotifications/admin/views/logs/index.html create mode 100644 src/com_tjnotifications/admin/views/logs/tmpl/default.php create mode 100644 src/com_tjnotifications/admin/views/logs/tmpl/default.xml create mode 100644 src/com_tjnotifications/admin/views/logs/tmpl/index.html create mode 100644 src/com_tjnotifications/admin/views/logs/view.csv.php create mode 100644 src/com_tjnotifications/admin/views/logs/view.html.php diff --git a/src/com_tjnotifications/admin/access.xml b/src/com_tjnotifications/admin/access.xml new file mode 100644 index 00000000..074373f0 --- /dev/null +++ b/src/com_tjnotifications/admin/access.xml @@ -0,0 +1,24 @@ + + +
+ + + + + + + + + + + + +
+ +
+ + + +
+ +
diff --git a/src/com_tjnotifications/admin/config.xml b/src/com_tjnotifications/admin/config.xml new file mode 100644 index 00000000..69ae77e9 --- /dev/null +++ b/src/com_tjnotifications/admin/config.xml @@ -0,0 +1,13 @@ + + +
+ + + + +
+
+ +
+
+ diff --git a/src/com_tjnotifications/admin/controllers/log.php b/src/com_tjnotifications/admin/controllers/log.php new file mode 100644 index 00000000..5d242f5a --- /dev/null +++ b/src/com_tjnotifications/admin/controllers/log.php @@ -0,0 +1,19 @@ + true)) + { + return parent::getModel($name, $prefix, $config); + } + +} diff --git a/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini b/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini index 141f6b92..8cdd43e5 100644 --- a/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini +++ b/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini @@ -93,3 +93,34 @@ COM_TJNOTIFICATIONS_CORE_TEMPLATE_VALUE="No" COM_TJNOTIFICATIONS_TAGS_DESC="Enter the tag given on left in to the editor these tag names will be replaced by description given in notification template" COM_TJNOTIFICATIONS_REPLACEMENT_TAGS="Replacement Tag" COM_TJNOTIFICATIONS_REPLACEMENT_TAGS_DESC="Description" +COM_TJNOTIFICATION="Notifications" +COM_TJNOTIFICATIONS_ALLOW_SAVE_OPTION="Allow to save in table?" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_SUBJECT="Subject" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_KEY="Key" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_PROVIDER="Provider" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_FROM="From" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_TO="To" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_CC="CC" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_BCC="BCC" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_DATE="Date" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_STATE="State" +COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_PARAMS="Params" +COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONS="Notifications" +COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONLOGS="Notification Logs" +COM_TJNOTIFICATIONS_LOGS="Logs" +COM_TJLMS_EXPORT_FILE_SUCCESS="Download complete" +COM_TJNOTIFICATIONS_VIEW_EMAIL_BODY="Email Body" +COM_TJNOTIFICATIONS_VIEW_EMAIL_POPUP_CLOSE="Close" +COM_TJNOTIFICATIONS_VIEW_PARAMS_POPUP="Show Params" + +; permissions +JACTION_VIEWALL="View All" +JACTION_VIEW_OWN="View Own" +JACTION_VIEW_SUBSCRIBE="View Subscribe" +COM_TJREPORTS_ACCESS_VIEWALL_DESC="Allow user to view all reports in this extension" +COM_TJREPORTS_ACCESS_VIEW_OWN_DESC="Allow user to view its own reports in this extension" +COM_TJREPORTS_ACCESS_VIEW_SUBSCRIBE_DESC="Allow user to view only subscribed reports in this extension" +JACTION_VIEW="View" +JACTION_VIEW_COMPONENT_DESC="Allow user to view reports in this extension" +JACTION_EXPORT="Export" +JACTION_EXPORT_COMPONENT_DESC="Allow user to export report data in this extension" diff --git a/src/com_tjnotifications/admin/models/forms/filter_logs.xml b/src/com_tjnotifications/admin/models/forms/filter_logs.xml new file mode 100644 index 00000000..ae303ca7 --- /dev/null +++ b/src/com_tjnotifications/admin/models/forms/filter_logs.xml @@ -0,0 +1,25 @@ + + +
+ + + + + + +
diff --git a/src/com_tjnotifications/admin/models/log.php b/src/com_tjnotifications/admin/models/log.php new file mode 100644 index 00000000..24d99254 --- /dev/null +++ b/src/com_tjnotifications/admin/models/log.php @@ -0,0 +1,58 @@ +loadForm('com_tjnotifications.log', 'log', array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($form)) + { + return false; + } + + return $form; + } + + /** + * Returns a Table object, always creating it. + * + * @param string $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + */ + public function getTable($type = 'Log', $prefix = 'TjnotificationsTable', $config = array()) + { + return Table::getInstance($type, $prefix, $config); + } +} diff --git a/src/com_tjnotifications/admin/models/logs.php b/src/com_tjnotifications/admin/models/logs.php new file mode 100644 index 00000000..7278ba8f --- /dev/null +++ b/src/com_tjnotifications/admin/models/logs.php @@ -0,0 +1,197 @@ +input->get('filter_order', 'id', 'STRING'); + $direction = $app->input->get('filter_order_Dir', 'desc', 'STRING'); + + if (!empty($ordering) && in_array($ordering, $this->filter_fields)) + { + $this->setState('list.ordering', $ordering); + } + + if (!empty($direction)) + { + if (!in_array(strtolower($direction), array('asc', 'desc'))) + { + $direction = 'desc'; + } + + $this->setState('list.direction', $direction); + } + + // Load the filter search + $search = $app->getUserStateFromRequest($this->context . 'filter.search', 'filter_search'); + $this->setState('filter.search', $search); + // Load the filter state + $published = $app->getUserStateFromRequest($this->context . 'filter.state', 'filter_state', '', 'string'); + $this->setState('filter.state', $published); + + parent::populateState($ordering, $direction); + + $mainframe = JFactory::getApplication(); + + // Get pagination request variables + $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); + $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); + + // In case limit has been changed, adjust it + $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); + + $this->setState('list.limit', $limit); + $this->setState('list.start', $limitstart); + } + + /** + * Build an SQL query to load the list data. + * + * @return JDatabaseQuery + * + * @since 1.1.0 + */ + protected function getListQuery() + { + $extension = JFactory::getApplication()->input->get('extension', '', 'word'); + $parts = explode('.', $extension); + + // Extract the component name + $this->setState('filter.component', $parts[0]); + + // Extract the optional section name + $this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null); + + // Initialize variables. + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + + // Create the base select statement. + $query->select('*') + ->from($db->quoteName('#__tjnotification_logs')); + + $search = $this->getState('filter.search'); + + if (!empty($search)) + { + $like = $db->quote('%' . $search . '%'); + $query->where($db->quoteName('client') . ' LIKE ' . $like . ' OR ' . $db->quoteName('key') . ' LIKE ' . $like); + } + + if ($extension) + { + $query->where($db->quoteName('client') . ' = ' . $db->quote($extension)); + } + else + { + // Filter by client + $client = $this->getState('filter.client'); + $key = $this->getState('filter.key'); + + if (!empty($client) && empty($key)) + { + $query->where($db->quoteName('client') . ' = ' . $db->quote($client)); + } + } + + $orderCol = $this->getState('list.ordering'); + $orderDirn = $this->getState('list.direction'); + + if ($orderCol && $orderDirn) + { + $query->order($db->quoteName($orderCol) . ' ' . $db->escape($orderDirn)); + } + + return $query; + } + + /** + * Method to get a store id based on model configuration state. + * + * This is necessary because the model is used by the component and + * different modules that might need different sets of data or different + * ordering requirements. + * + * @param string $id A prefix for the store id. + * + * @return string A store id. + * + * @since 1.1.0 + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.state'); + return parent::getStoreId($id); + } + + + /** + * Method to get a list of articles. + * Overridden to add a check for access levels. + * + * @return mixed An array of data items on success, false on failure. + * + * @since 1.1.0 + */ + public function getItems() + { + $items = parent::getItems(); + return $items; + } +} diff --git a/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql b/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql index b4e5d91e..0f8608e5 100644 --- a/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql +++ b/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql @@ -50,3 +50,24 @@ CREATE TABLE IF NOT EXISTS `#__tj_notification_templates` ( CONSTRAINT `#__tj_notification_user_exclusions_ibfk_1` FOREIGN KEY (`provider`) REFERENCES `#__tj_notification_providers` (`provider`) ) DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__tjnotification_logs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `key` varchar(100) NOT NULL, + `client` varchar(100) NOT NULL, + `provider` varchar(100) NOT NULL, + `subject` varchar(250) NOT NULL, + `body` text NOT NULL, + `from` varchar(100) NOT NULL, + `to` varchar(100) NOT NULL, + `cc` varchar(100) NOT NULL, + `bcc` varchar(100) NOT NULL, + `date` date NOT NULL, + `state` int(11) NOT NULL, + `params` text NOT NULL, + PRIMARY KEY (`id`), + KEY `client` (`client`), + KEY `key` (`key`) +) + DEFAULT CHARSET=utf8 + AUTO_INCREMENT=0 ; diff --git a/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql b/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql new file mode 100644 index 00000000..c50efda6 --- /dev/null +++ b/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql @@ -0,0 +1,24 @@ +-- +-- Notifications Logs Tables : Table structure for table `#__tjnotification_logs` +-- +CREATE TABLE IF NOT EXISTS `#__tjnotification_logs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `key` varchar(100) NOT NULL, + `client` varchar(100) NOT NULL, + `provider` varchar(100) NOT NULL, + `subject` varchar(250) NOT NULL, + `body` text NOT NULL, + `from` varchar(100) NOT NULL, + `to` varchar(100) NOT NULL, + `cc` varchar(100) NOT NULL, + `bcc` varchar(100) NOT NULL, + `date` date NOT NULL, + `state` int(11) NOT NULL, + `params` text NOT NULL, + PRIMARY KEY (`id`), + KEY `client` (`client`), + KEY `key` (`key`) +) + DEFAULT CHARSET=utf8 + AUTO_INCREMENT=0 ; + diff --git a/src/com_tjnotifications/admin/tables/log.php b/src/com_tjnotifications/admin/tables/log.php new file mode 100644 index 00000000..3780a7da --- /dev/null +++ b/src/com_tjnotifications/admin/tables/log.php @@ -0,0 +1,28 @@ + \ No newline at end of file diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.php b/src/com_tjnotifications/admin/views/logs/tmpl/default.php new file mode 100644 index 00000000..403fc566 --- /dev/null +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.php @@ -0,0 +1,207 @@ +escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +?> + +
+ sidebar)):?> +
+ sidebar;?> +
+
+ +
+ + + +";print_r($this);die; + +//echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0)));?> + + +
+ + pagination->getLimitBox(); ?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + items)) : ?> + items as $i => $row) : + $link + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ id); ?> + + + subject; ?> + + + key; ?> + + provider; ?> + + from; ?> + + to; ?> + + cc; ?> + + bcc; ?> + + date; ?> + + state; ?> + + + + +
+ pagination->getListFooter(); ?> + + + + + + + +
+ diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.xml b/src/com_tjnotifications/admin/views/logs/tmpl/default.xml new file mode 100644 index 00000000..0c90915b --- /dev/null +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/index.html b/src/com_tjnotifications/admin/views/logs/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/src/com_tjnotifications/admin/views/logs/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/com_tjnotifications/admin/views/logs/view.csv.php b/src/com_tjnotifications/admin/views/logs/view.csv.php new file mode 100644 index 00000000..ab7061df --- /dev/null +++ b/src/com_tjnotifications/admin/views/logs/view.csv.php @@ -0,0 +1,25 @@ + + * @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved. + * @license GNU General Public License version 2 or later. + */ + +//Import CSV library view +jimport('techjoomla.view.csv'); + + +/** + * View class for a list of notifications logs. + * + * @since 1.1.0 + */ +class TjnotificationsViewLogs extends TjExportCsv +{ + public function display($tpl = null) + { + parent::display(); + } + +} diff --git a/src/com_tjnotifications/admin/views/logs/view.html.php b/src/com_tjnotifications/admin/views/logs/view.html.php new file mode 100644 index 00000000..e060f233 --- /dev/null +++ b/src/com_tjnotifications/admin/views/logs/view.html.php @@ -0,0 +1,88 @@ + + * @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved. + * @license GNU General Public License version 2 or later. + */ + +defined('_JEXEC') or die; +jimport('joomla.application.component.view'); +JLoader::register('TjnotificationsHelper', JPATH_ADMINISTRATOR . '/components/com_tjnotifications/helpers/tjnotifications.php'); +use Joomla\CMS\MVC\View\HtmlView; + +/** + * View class for a list of notifications logs. + * + * @since 1.1.0 + */ +class TjnotificationsViewLogs extends HtmlView +{ + /** + * Display the view + * + * @param string $tpl Template name + * + * @return void + * + * @throws Exception + */ + public function display($tpl = null) + { + $this->canDo = TjnotificationsHelper::getActions(); + + $this->state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); + + TjnotificationsHelper::addSubmenu('logs'); + + // Set the tool-bar and number of found items + $this->addToolBar(); + + $this->sidebar = JHtmlSidebar::render(); + + parent::display($tpl); + } + + /** + * Add the page title and toolbar. + * + * @return void + * + * @since 1.1.0 + */ + protected function addToolBar() + { + $title = JText::_('COM_TJNOTIFICATIONS_LOGS'); + + if ($this->pagination->total) + { + $title .= ""; + } + + JToolBarHelper::title($title, 'log'); + + if ($this->canDo->get('core.export')) + { + // adding techjoomla library for csv Export + jimport('techjoomla.tjtoolbar.button.csvexport'); + + $bar = JToolBar::getInstance('toolbar'); + + $message = array(); + $message['success'] = JText::_("COM_TJLMS_EXPORT_FILE_SUCCESS"); + $message['error'] = JText::_("COM_TJLMS_EXPORT_FILE_ERROR"); + $message['inprogress'] = JText::_("COM_TJLMS_EXPORT_FILE_NOTICE"); + + $bar->appendButton('CsvExport', $message); + } + + if ($this->canDo->get('core.delete')) + { + JToolBarHelper::deleteList('', 'logs.delete'); + } + } +} From ebe0ecb75c700c73dc8eaeb8cb45302ccefe8e5f Mon Sep 17 00:00:00 2001 From: poonam_b Date: Wed, 19 Jun 2019 19:21:20 +0530 Subject: [PATCH 02/50] Task #146075 chore: create MVC for creating notification logs listview --- src/com_tjnotifications/admin/access.xml | 8 ++++---- .../admin/language/en-GB.com_tjnotifications.ini | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/com_tjnotifications/admin/access.xml b/src/com_tjnotifications/admin/access.xml index 074373f0..699cf1ac 100644 --- a/src/com_tjnotifications/admin/access.xml +++ b/src/com_tjnotifications/admin/access.xml @@ -10,13 +10,13 @@ - - - + + +
- +
diff --git a/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini b/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini index 8cdd43e5..8c8bd0ee 100644 --- a/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini +++ b/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini @@ -117,9 +117,9 @@ COM_TJNOTIFICATIONS_VIEW_PARAMS_POPUP="Show Params" JACTION_VIEWALL="View All" JACTION_VIEW_OWN="View Own" JACTION_VIEW_SUBSCRIBE="View Subscribe" -COM_TJREPORTS_ACCESS_VIEWALL_DESC="Allow user to view all reports in this extension" -COM_TJREPORTS_ACCESS_VIEW_OWN_DESC="Allow user to view its own reports in this extension" -COM_TJREPORTS_ACCESS_VIEW_SUBSCRIBE_DESC="Allow user to view only subscribed reports in this extension" +COM_TJNOTIFICATIONS_ACCESS_VIEWALL_DESC="Allow user to view all reports in this extension" +COM_TJNOTIFICATIONS_ACCESS_VIEW_OWN_DESC="Allow user to view its own reports in this extension" +COM_TJNOTIFICATIONS_ACCESS_VIEW_SUBSCRIBE_DESC="Allow user to view only subscribed reports in this extension" JACTION_VIEW="View" JACTION_VIEW_COMPONENT_DESC="Allow user to view reports in this extension" JACTION_EXPORT="Export" From e6013f0f3b396452e51d2d9a08feacdff3586336 Mon Sep 17 00:00:00 2001 From: poonam_b Date: Thu, 20 Jun 2019 18:08:52 +0530 Subject: [PATCH 03/50] Issue #48 chore: Log Email details in DB table - Tj Notification --- src/com_tjnotifications/admin/access.xml | 11 +-- src/com_tjnotifications/admin/config.xml | 2 +- .../admin/helpers/tjnotifications.php | 32 ++++++- .../admin/models/forms/filter_logs.xml | 43 +++++++++ src/com_tjnotifications/admin/models/logs.php | 93 +++++++------------ .../admin/sql/install.mysql.utf8.sql | 1 + .../admin/sql/updates/mysql/1.1.0.sql | 1 + src/com_tjnotifications/admin/tables/log.php | 3 +- .../admin/views/logs/tmpl/default.php | 91 ++++++++++-------- .../admin/views/logs/view.html.php | 11 +-- 10 files changed, 165 insertions(+), 123 deletions(-) diff --git a/src/com_tjnotifications/admin/access.xml b/src/com_tjnotifications/admin/access.xml index 699cf1ac..c2b25c03 100644 --- a/src/com_tjnotifications/admin/access.xml +++ b/src/com_tjnotifications/admin/access.xml @@ -2,23 +2,14 @@
+ - - - - - - -
-
-
-
diff --git a/src/com_tjnotifications/admin/config.xml b/src/com_tjnotifications/admin/config.xml index 69ae77e9..0e598258 100644 --- a/src/com_tjnotifications/admin/config.xml +++ b/src/com_tjnotifications/admin/config.xml @@ -1,7 +1,7 @@
- + diff --git a/src/com_tjnotifications/admin/helpers/tjnotifications.php b/src/com_tjnotifications/admin/helpers/tjnotifications.php index d15d15bd..435506df 100644 --- a/src/com_tjnotifications/admin/helpers/tjnotifications.php +++ b/src/com_tjnotifications/admin/helpers/tjnotifications.php @@ -17,7 +17,7 @@ * @subpackage com_tjnotifications * @since 2.2 */ -class TjnotificationsHelper +class TjnotificationsHelper extends JHelperContent { /** * Configure the Linkbar. @@ -63,5 +63,35 @@ public static function addSubmenu($view = '') } } } + + JHtmlSidebar::addEntry( + JText::_('COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONS'), + 'index.php?option=com_tjnotifications&view=notifications', + $view == 'rounds' + ); + + JHtmlSidebar::addEntry( + JText::_('COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONLOGS'), + 'index.php?option=com_tjnotifications&view=logs', + $view == 'logs' + ); + } + + /** + * Gets a list of the actions that can be performed. + * + * @param string $component The component name. + * @param string $section The access section name. + * @param integer $id The item ID. + * + * @return JObject + * + * @since 3.2 + */ + public static function getActions($component = 'com_tjnotifications', $section = '', $id = 0) + { + $result = parent::getActions($component, $section, $id); + + return $result; } } diff --git a/src/com_tjnotifications/admin/models/forms/filter_logs.xml b/src/com_tjnotifications/admin/models/forms/filter_logs.xml index ae303ca7..ca379fc4 100644 --- a/src/com_tjnotifications/admin/models/forms/filter_logs.xml +++ b/src/com_tjnotifications/admin/models/forms/filter_logs.xml @@ -15,11 +15,54 @@ description="COM_TJNOTIFICATIONS_FIELD_CLIENT_DESC" onchange="this.form.submit();" type="sql" + class="inputbox" query="SELECT DISTINCT(client) FROM `#__tj_notification_templates`" key_field="client" value_field="client" > + + + + + + + + + + + + + + diff --git a/src/com_tjnotifications/admin/models/logs.php b/src/com_tjnotifications/admin/models/logs.php index 7278ba8f..f0c8ccad 100644 --- a/src/com_tjnotifications/admin/models/logs.php +++ b/src/com_tjnotifications/admin/models/logs.php @@ -31,8 +31,11 @@ public function __construct($config = array()) { $config['filter_fields'] = array( 'id', - 'client', + 'to', 'key', + 'from', + 'cc', + 'provider', 'state', 'subject', 'search', @@ -79,9 +82,6 @@ protected function populateState($ordering = 'id', $direction = 'asc') // Load the filter search $search = $app->getUserStateFromRequest($this->context . 'filter.search', 'filter_search'); $this->setState('filter.search', $search); - // Load the filter state - $published = $app->getUserStateFromRequest($this->context . 'filter.state', 'filter_state', '', 'string'); - $this->setState('filter.state', $published); parent::populateState($ordering, $direction); @@ -107,47 +107,54 @@ protected function populateState($ordering = 'id', $direction = 'asc') */ protected function getListQuery() { - $extension = JFactory::getApplication()->input->get('extension', '', 'word'); - $parts = explode('.', $extension); - - // Extract the component name - $this->setState('filter.component', $parts[0]); - - // Extract the optional section name - $this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null); - // Initialize variables. $db = JFactory::getDbo(); $query = $db->getQuery(true); // Create the base select statement. $query->select('*') - ->from($db->quoteName('#__tjnotification_logs')); + ->from($db->quoteName('#__tjnotification_logs', 'cs')); $search = $this->getState('filter.search'); if (!empty($search)) { $like = $db->quote('%' . $search . '%'); - $query->where($db->quoteName('client') . ' LIKE ' . $like . ' OR ' . $db->quoteName('key') . ' LIKE ' . $like); + $query->where($db->quoteName('subject') . ' LIKE ' . $like . ' OR ' . $db->quoteName('from') . ' LIKE ' . $like . ' OR ' . $db->quoteName('to') . ' LIKE ' . $like); } - if ($extension) + // Filter by client + $client = $this->getState('filter.client'); + if ($client) { - $query->where($db->quoteName('client') . ' = ' . $db->quote($extension)); + $client = $db->quote($client); + $query->where('client = ' . $client); } - else + + // Filter by provider + $provider = $this->getState('filter.provider'); + + if ($provider) { - // Filter by client - $client = $this->getState('filter.client'); - $key = $this->getState('filter.key'); + $provider = $db->quote($provider); + $query->where('provider = ' . $provider); + } - if (!empty($client) && empty($key)) - { - $query->where($db->quoteName('client') . ' = ' . $db->quote($client)); - } + // Filter by key + $key = $this->getState('filter.key'); + if ($key) + { + $key = $db->quote($key); + $query->where('cs.key = ' . $key); } + // Filter by client + $state = $this->getState('filter.state'); + + $state = $db->quote($state); + $query->where('cs.state = ' . $state); + + $orderCol = $this->getState('list.ordering'); $orderDirn = $this->getState('list.direction'); @@ -158,40 +165,4 @@ protected function getListQuery() return $query; } - - /** - * Method to get a store id based on model configuration state. - * - * This is necessary because the model is used by the component and - * different modules that might need different sets of data or different - * ordering requirements. - * - * @param string $id A prefix for the store id. - * - * @return string A store id. - * - * @since 1.1.0 - */ - protected function getStoreId($id = '') - { - // Compile the store id. - $id .= ':' . $this->getState('filter.search'); - $id .= ':' . $this->getState('filter.state'); - return parent::getStoreId($id); - } - - - /** - * Method to get a list of articles. - * Overridden to add a check for access levels. - * - * @return mixed An array of data items on success, false on failure. - * - * @since 1.1.0 - */ - public function getItems() - { - $items = parent::getItems(); - return $items; - } } diff --git a/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql b/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql index 0f8608e5..af7a2e16 100644 --- a/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql +++ b/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql @@ -57,6 +57,7 @@ CREATE TABLE IF NOT EXISTS `#__tjnotification_logs` ( `client` varchar(100) NOT NULL, `provider` varchar(100) NOT NULL, `subject` varchar(250) NOT NULL, + `title` varchar(100) NOT NULL, `body` text NOT NULL, `from` varchar(100) NOT NULL, `to` varchar(100) NOT NULL, diff --git a/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql b/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql index c50efda6..8e8f032b 100644 --- a/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql +++ b/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql @@ -7,6 +7,7 @@ CREATE TABLE IF NOT EXISTS `#__tjnotification_logs` ( `client` varchar(100) NOT NULL, `provider` varchar(100) NOT NULL, `subject` varchar(250) NOT NULL, + `title` varchar(100) NOT NULL, `body` text NOT NULL, `from` varchar(100) NOT NULL, `to` varchar(100) NOT NULL, diff --git a/src/com_tjnotifications/admin/tables/log.php b/src/com_tjnotifications/admin/tables/log.php index 3780a7da..f20e4d25 100644 --- a/src/com_tjnotifications/admin/tables/log.php +++ b/src/com_tjnotifications/admin/tables/log.php @@ -8,13 +8,14 @@ // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\Table\Table; /** * table class for notification * * @since 1.6 */ -class TjnotificationsTableLog extends JTable +class TjnotificationsTableLog extends Table { /** * Constructor diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.php b/src/com_tjnotifications/admin/views/logs/tmpl/default.php index 403fc566..7401bf74 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/default.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; use Joomla\CMS\Layout\LayoutHelper; +include 'header.html'; JHtml::_('bootstrap.tooltip'); JHtml::_('behavior.multiselect'); @@ -17,6 +18,12 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> +
sidebar)):?> @@ -30,10 +37,7 @@ ";print_r($this);die; - -//echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0)));?> - +echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0)));?>
pagination->getLimitBox(); ?>
- - +
+
+ - - - - @@ -101,14 +106,15 @@ - - + - - - - + +
+ + - + + - + - + - + - + - + + - + - + id); ?> + title, ENT_COMPAT, 'UTF-8'); + ?> + - subject; ?> + subject, ENT_COMPAT, 'UTF-8');?> - key; ?> + + to, ENT_COMPAT, 'UTF-8'); ?> - provider; ?> + cc, ENT_COMPAT, 'UTF-8'); ?> - from; ?> + bcc, ENT_COMPAT, 'UTF-8'); ?> - to; ?> + date, ENT_COMPAT, 'UTF-8');?> - cc; ?> + state, ENT_COMPAT, 'UTF-8'); ?> - bcc; ?> + key, ENT_COMPAT, 'UTF-8'); + ?> - date; ?> + provider, ENT_COMPAT, 'UTF-8'); ?> - state; ?> + from, ENT_COMPAT, 'UTF-8'); ?> @@ -181,25 +188,27 @@ ?> - -
+
pagination->getListFooter(); ?> - diff --git a/src/com_tjnotifications/admin/views/logs/view.html.php b/src/com_tjnotifications/admin/views/logs/view.html.php index e060f233..c7902f15 100644 --- a/src/com_tjnotifications/admin/views/logs/view.html.php +++ b/src/com_tjnotifications/admin/views/logs/view.html.php @@ -58,11 +58,6 @@ protected function addToolBar() { $title = JText::_('COM_TJNOTIFICATIONS_LOGS'); - if ($this->pagination->total) - { - $title .= ""; - } - JToolBarHelper::title($title, 'log'); if ($this->canDo->get('core.export')) @@ -73,9 +68,9 @@ protected function addToolBar() $bar = JToolBar::getInstance('toolbar'); $message = array(); - $message['success'] = JText::_("COM_TJLMS_EXPORT_FILE_SUCCESS"); - $message['error'] = JText::_("COM_TJLMS_EXPORT_FILE_ERROR"); - $message['inprogress'] = JText::_("COM_TJLMS_EXPORT_FILE_NOTICE"); + $message['success'] = JText::_("COM_TJNOTIFICATIONS_EXPORT_FILE_SUCCESS"); + $message['error'] = JText::_("COM_TJNOTIFICATIONS_EXPORT_FILE_ERROR"); + $message['inprogress'] = JText::_("COM_TJNOTIFICATIONS_EXPORT_FILE_NOTICE"); $bar->appendButton('CsvExport', $message); } From 7cc5a9b27def104f022aad920ec2357cec403943 Mon Sep 17 00:00:00 2001 From: poonam_b Date: Thu, 20 Jun 2019 18:13:31 +0530 Subject: [PATCH 04/50] Issue #48 chore: Log Email details in DB table - Tj Notification --- src/com_tjnotifications/admin/helpers/tjnotifications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com_tjnotifications/admin/helpers/tjnotifications.php b/src/com_tjnotifications/admin/helpers/tjnotifications.php index 435506df..608e0e20 100644 --- a/src/com_tjnotifications/admin/helpers/tjnotifications.php +++ b/src/com_tjnotifications/admin/helpers/tjnotifications.php @@ -17,7 +17,7 @@ * @subpackage com_tjnotifications * @since 2.2 */ -class TjnotificationsHelper extends JHelperContent +class TjnotificationsHelper { /** * Configure the Linkbar. From 16f1a3259dce51a14f6b5b631ccca14322a7f51b Mon Sep 17 00:00:00 2001 From: poonam_b Date: Fri, 21 Jun 2019 15:50:59 +0530 Subject: [PATCH 05/50] Issue #48 chore: Log Email details in DB table - Tj Notification --- src/com_tjnotifications/admin/access.xml | 4 - src/com_tjnotifications/admin/config.xml | 4 +- .../admin/helpers/tjnotifications.php | 20 +---- src/com_tjnotifications/admin/models/logs.php | 76 +++++++------------ .../admin/views/logs/tmpl/default.php | 71 ++++------------- .../admin/views/logs/tmpl/default.xml | 2 +- .../admin/views/logs/tmpl/popup.php | 50 ++++++++++++ .../admin/views/logs/view.html.php | 2 +- 8 files changed, 99 insertions(+), 130 deletions(-) create mode 100644 src/com_tjnotifications/admin/views/logs/tmpl/popup.php diff --git a/src/com_tjnotifications/admin/access.xml b/src/com_tjnotifications/admin/access.xml index c2b25c03..94549485 100644 --- a/src/com_tjnotifications/admin/access.xml +++ b/src/com_tjnotifications/admin/access.xml @@ -8,8 +8,4 @@ -
- - -
diff --git a/src/com_tjnotifications/admin/config.xml b/src/com_tjnotifications/admin/config.xml index 0e598258..e1c0bf80 100644 --- a/src/com_tjnotifications/admin/config.xml +++ b/src/com_tjnotifications/admin/config.xml @@ -2,8 +2,8 @@
- - + +
diff --git a/src/com_tjnotifications/admin/helpers/tjnotifications.php b/src/com_tjnotifications/admin/helpers/tjnotifications.php index 608e0e20..ded1bdc2 100644 --- a/src/com_tjnotifications/admin/helpers/tjnotifications.php +++ b/src/com_tjnotifications/admin/helpers/tjnotifications.php @@ -17,7 +17,7 @@ * @subpackage com_tjnotifications * @since 2.2 */ -class TjnotificationsHelper +class TjnotificationsHelper extends JHelperContent { /** * Configure the Linkbar. @@ -76,22 +76,4 @@ public static function addSubmenu($view = '') $view == 'logs' ); } - - /** - * Gets a list of the actions that can be performed. - * - * @param string $component The component name. - * @param string $section The access section name. - * @param integer $id The item ID. - * - * @return JObject - * - * @since 3.2 - */ - public static function getActions($component = 'com_tjnotifications', $section = '', $id = 0) - { - $result = parent::getActions($component, $section, $id); - - return $result; - } } diff --git a/src/com_tjnotifications/admin/models/logs.php b/src/com_tjnotifications/admin/models/logs.php index f0c8ccad..ee898e19 100644 --- a/src/com_tjnotifications/admin/models/logs.php +++ b/src/com_tjnotifications/admin/models/logs.php @@ -30,15 +30,14 @@ public function __construct($config = array()) if (empty($config['filter_fields'])) { $config['filter_fields'] = array( - 'id', - 'to', - 'key', - 'from', - 'cc', - 'provider', - 'state', - 'subject', - 'search', + 'id', 'tjl.id', + 'to', 'tjl.to', + 'key', 'tjl.key', + 'from', 'tjl.from', + 'cc', 'tjl.cc', + 'state', 'tjl.state', + 'subject', 'tjl.subject', + 'search' ); } @@ -57,27 +56,9 @@ public function __construct($config = array()) * * @since 1.1.0 */ - protected function populateState($ordering = 'id', $direction = 'asc') + protected function populateState($ordering = 'tjl.id', $direction = 'asc') { - $app = JFactory::getApplication('administrator'); - - $ordering = $app->input->get('filter_order', 'id', 'STRING'); - $direction = $app->input->get('filter_order_Dir', 'desc', 'STRING'); - - if (!empty($ordering) && in_array($ordering, $this->filter_fields)) - { - $this->setState('list.ordering', $ordering); - } - - if (!empty($direction)) - { - if (!in_array(strtolower($direction), array('asc', 'desc'))) - { - $direction = 'desc'; - } - - $this->setState('list.direction', $direction); - } + $app = JFactory::getApplication(); // Load the filter search $search = $app->getUserStateFromRequest($this->context . 'filter.search', 'filter_search'); @@ -85,13 +66,11 @@ protected function populateState($ordering = 'id', $direction = 'asc') parent::populateState($ordering, $direction); - $mainframe = JFactory::getApplication(); - // Get pagination request variables - $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); + $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); - // In case limit has been changed, adjust it + //~ // In case limit has been changed, adjust it $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); $this->setState('list.limit', $limit); @@ -113,22 +92,16 @@ protected function getListQuery() // Create the base select statement. $query->select('*') - ->from($db->quoteName('#__tjnotification_logs', 'cs')); + ->from($db->quoteName('#__tjnotification_logs', 'tjl')); $search = $this->getState('filter.search'); - if (!empty($search)) - { - $like = $db->quote('%' . $search . '%'); - $query->where($db->quoteName('subject') . ' LIKE ' . $like . ' OR ' . $db->quoteName('from') . ' LIKE ' . $like . ' OR ' . $db->quoteName('to') . ' LIKE ' . $like); - } - // Filter by client $client = $this->getState('filter.client'); + if ($client) { - $client = $db->quote($client); - $query->where('client = ' . $client); + $query->where($db->quoteName('tjl.client') . ' = ' . $db->quote($client)); } // Filter by provider @@ -136,24 +109,31 @@ protected function getListQuery() if ($provider) { - $provider = $db->quote($provider); - $query->where('provider = ' . $provider); + $query->where($db->quoteName('tjl.provider') . ' = ' . $db->quote($provider)); } // Filter by key $key = $this->getState('filter.key'); + if ($key) { - $key = $db->quote($key); - $query->where('cs.key = ' . $key); + $query->where($db->quoteName('tjl.key') . ' = ' . $db->quote($key)); } + // Filter by client $state = $this->getState('filter.state'); - $state = $db->quote($state); - $query->where('cs.state = ' . $state); + if (is_numeric($state)) + { + $query->where($db->quoteName('tjl.state') . ' = ' . $db->quote($state)); + } + if (!empty($search)) + { + $like = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); + $query->where($db->quoteName('tjl.subject') . ' LIKE ' . $like . ' OR ' . $db->quoteName('tjl.from') . ' LIKE ' . $like . ' OR ' . $db->quoteName('tjl.to') . ' LIKE ' . $like); + } $orderCol = $this->getState('list.ordering'); $orderDirn = $this->getState('list.direction'); diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.php b/src/com_tjnotifications/admin/views/logs/tmpl/default.php index 7401bf74..72fe1d67 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/default.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.php @@ -11,6 +11,9 @@ use Joomla\CMS\Layout\LayoutHelper; include 'header.html'; + + +JHTML::_('behavior.modal', 'a.modal'); JHtml::_('bootstrap.tooltip'); JHtml::_('behavior.multiselect'); JHtml::_('formbehavior.chosen', 'select'); @@ -25,6 +28,16 @@ overflow-x: auto;} + + sidebar)):?>
@@ -111,35 +124,8 @@ ?> - - subject, ENT_COMPAT, 'UTF-8');?> - - - - +
+ \ No newline at end of file From 56d82fca3f8fb78f5f6c8924a15c2554d3d4588e Mon Sep 17 00:00:00 2001 From: poonam_b Date: Mon, 1 Jul 2019 14:36:06 +0530 Subject: [PATCH 40/50] Issue #48 chore: Log Email details in DB table - Tj Notification --- src/com_tjnotifications/admin/access.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/com_tjnotifications/admin/access.xml b/src/com_tjnotifications/admin/access.xml index 94549485..d3ffdf84 100644 --- a/src/com_tjnotifications/admin/access.xml +++ b/src/com_tjnotifications/admin/access.xml @@ -1,11 +1,11 @@ -
- - - - - - -
+
+ + + + + + +
From 578c4eac57f988f15935e54e8a7b38b7241312f0 Mon Sep 17 00:00:00 2001 From: poonam_b Date: Mon, 1 Jul 2019 14:41:29 +0530 Subject: [PATCH 41/50] Issue #48 chore: Log Email details in DB table - Tj Notification --- src/com_tjnotifications/admin/views/logs/tmpl/default.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.php b/src/com_tjnotifications/admin/views/logs/tmpl/default.php index d136777d..adf4768d 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/default.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.php @@ -14,10 +14,13 @@ use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Language\Text; + HTMLHelper::_('behavior.modal', 'a.modal'); HTMLHelper::_('formbehavior.chosen', 'select'); + $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); + $doc = Factory::getDocument(); $doc->addStyleSheet(JUri::root() . 'administrator/components/com_tjnotifications/assets/css/tjnotifcations.css'); ?> @@ -166,4 +169,4 @@ - \ No newline at end of file + From f00612109f1ce80d515d9de19d338893e6ed7f7e Mon Sep 17 00:00:00 2001 From: poonam_b Date: Mon, 1 Jul 2019 14:43:04 +0530 Subject: [PATCH 42/50] Issue #48 chore: Log Email details in DB table - Tj Notification --- src/com_tjnotifications/admin/views/logs/tmpl/default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.php b/src/com_tjnotifications/admin/views/logs/tmpl/default.php index adf4768d..c25fa519 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/default.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.php @@ -143,8 +143,8 @@ params)) { ?> - - + + Date: Mon, 1 Jul 2019 14:58:03 +0530 Subject: [PATCH 43/50] Issue #48 chore: Log Email details in DB table - Tj Notification --- src/com_tjnotifications/admin/models/logs.php | 7 ++++--- .../admin/views/logs/tmpl/body.php | 2 +- .../admin/views/logs/tmpl/param.php | 16 ++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/com_tjnotifications/admin/models/logs.php b/src/com_tjnotifications/admin/models/logs.php index 6c7ff093..6a4ce0ed 100644 --- a/src/com_tjnotifications/admin/models/logs.php +++ b/src/com_tjnotifications/admin/models/logs.php @@ -13,6 +13,7 @@ jimport('joomla.application.component.model'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Model\ListModel; /** @@ -63,7 +64,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = 'tjl.id', $direction = 'desc') { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Load the filter search $search = $app->getUserStateFromRequest($this->context . 'filter.search', 'filter_search'); @@ -73,7 +74,7 @@ protected function populateState($ordering = 'tjl.id', $direction = 'desc') // Get pagination request variables $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int'); - $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); + $limitstart = Factory::getApplication()->input->post->get('limitstart'); // In case limit has been changed, adjust it $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); @@ -92,7 +93,7 @@ protected function populateState($ordering = 'tjl.id', $direction = 'desc') protected function getListQuery() { // Initialize variables. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); // Create the base select statement. diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/body.php b/src/com_tjnotifications/admin/views/logs/tmpl/body.php index 8ae7c535..35108810 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/body.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/body.php @@ -18,7 +18,7 @@ $jinput = Factory::getApplication()->input; $logId = $jinput->get('id', 0, 'INT'); -if($logId) +if ($logId) { Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables'); $logTable = Table::getInstance('Log', 'TjnotificationsTable'); diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/param.php b/src/com_tjnotifications/admin/views/logs/tmpl/param.php index ffbc3256..84e9ac6b 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/param.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/param.php @@ -1,12 +1,12 @@ -* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. -* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL -*/ + * @package TJNotifications + * @subpackage com_tjnotifications + * + * @author Techjoomla + * @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + */ // No direct access defined('_JEXEC') or die; use Joomla\CMS\Factory; @@ -16,7 +16,7 @@ $jinput = Factory::getApplication()->input; $logId = $jinput->get('id', 0, 'INT'); -if($logId) +if ($logId) { Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables'); $logTable = Table::getInstance('Log', 'TjnotificationsTable'); From dd5c0003f75cd897f274fe9792b5952f79170986 Mon Sep 17 00:00:00 2001 From: poonam_b Date: Tue, 2 Jul 2019 11:43:49 +0530 Subject: [PATCH 44/50] Issue #48 chore: Log Email details in DB table --- .../admin/views/logs/tmpl/body.php | 5 +- .../admin/views/logs/tmpl/default.php | 256 +++++++++--------- .../admin/views/logs/tmpl/param.php | 21 +- 3 files changed, 138 insertions(+), 144 deletions(-) diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/body.php b/src/com_tjnotifications/admin/views/logs/tmpl/body.php index 35108810..e3639d92 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/body.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/body.php @@ -18,7 +18,7 @@ $jinput = Factory::getApplication()->input; $logId = $jinput->get('id', 0, 'INT'); -if ($logId) +if($logId) { Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables'); $logTable = Table::getInstance('Log', 'TjnotificationsTable'); @@ -28,8 +28,7 @@
id) : ?>
body; ?> diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.php b/src/com_tjnotifications/admin/views/logs/tmpl/default.php index c25fa519..e097f8be 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/default.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.php @@ -9,6 +9,7 @@ */ // No direct access to this file defined('_JEXEC') or die; + use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Layout\LayoutHelper; @@ -33,140 +34,137 @@ });
- sidebar)) : ?> +sidebar)) : ?>
sidebar; ?>
- -
- - $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0))); - ?> -
- - pagination->getLimitBox(); ?> -
-
- - - - - - - - - - - - - - - - - - - - items)) : ?> - items as $i => $row) : - ?> - - - - + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - -
- id); ?> - - subject, ENT_COMPAT, 'UTF-8'); ?> - - - + +
+ + $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0))); + ?> +
+ + pagination->getLimitBox(); ?> +
+
+ + + + + + + + + + + + + + + + + + + + items)) : ?> + items as $i => $row) : + ?> + + + + - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ id); ?> + + subject, ENT_COMPAT, 'UTF-8'); ?> + + + - - ', $row->to); ?> - - ', $row->cc); ?> - - ', $row->bcc); ?> - - date, ENT_COMPAT, 'UTF-8');?> - - state ==1) ? Text::_('COM_TJNOTIFICATIONS_STATE_SENT') : Text::_('COM_TJNOTIFICATIONS_STATE_FAILED'); - ?> - - key, ENT_COMPAT, 'UTF-8');?> - - provider, ENT_COMPAT, 'UTF-8');?> - - from, ENT_COMPAT, 'UTF-8'); ?> - - params)) - { ?> - - - - - id, ENT_COMPAT, 'UTF-8');?> -
-
- pagination->getListFooter(); ?> - - - - - +
+ ', $row->to); ?> + + ', $row->cc); ?> + + ', $row->bcc); ?> + + date, ENT_COMPAT, 'UTF-8'); ?> + + state === 1) ? Text::_('COM_TJNOTIFICATIONS_STATE_SENT') : Text::_('COM_TJNOTIFICATIONS_STATE_FAILED'); + ?> + + key, ENT_COMPAT, 'UTF-8'); ?> + + provider, ENT_COMPAT, 'UTF-8'); ?> + + from, ENT_COMPAT, 'UTF-8'); ?> + + params)): ?> + + + + + + + + id, ENT_COMPAT, 'UTF-8'); ?> +
+ pagination->getListFooter(); ?> + + + + +
+
diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/param.php b/src/com_tjnotifications/admin/views/logs/tmpl/param.php index 84e9ac6b..894ed8fe 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/param.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/param.php @@ -1,22 +1,20 @@ - * @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - */ +* @package TJNotifications +* @subpackage com_tjnotifications +* +* @author Techjoomla +* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. +* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL +*/ // No direct access defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Table; - $jinput = Factory::getApplication()->input; $logId = $jinput->get('id', 0, 'INT'); - -if ($logId) +if($logId) { Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables'); $logTable = Table::getInstance('Log', 'TjnotificationsTable'); @@ -26,8 +24,7 @@
id) : ?>
params; ?> From 22160db9b471a414418de2bf9d69ab03e742edab Mon Sep 17 00:00:00 2001 From: poonam_b Date: Tue, 2 Jul 2019 11:49:17 +0530 Subject: [PATCH 45/50] Issue #48 chore: Log Email details in DB table --- .../admin/views/logs/tmpl/default.php | 223 +++++++++--------- 1 file changed, 111 insertions(+), 112 deletions(-) diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.php b/src/com_tjnotifications/admin/views/logs/tmpl/default.php index e097f8be..6ce0b621 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/default.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.php @@ -52,119 +52,118 @@ pagination->getLimitBox(); ?>
-
- - - - - - - - - - - - - - - - - - - - items)) : ?> - items as $i => $row) : - ?> - - - - - - - - - - - - - + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - -
- id); ?> - - subject, ENT_COMPAT, 'UTF-8'); ?> - - - - - - ', $row->to); ?> - - ', $row->cc); ?> - - ', $row->bcc); ?> - - date, ENT_COMPAT, 'UTF-8'); ?> - - state === 1) ? Text::_('COM_TJNOTIFICATIONS_STATE_SENT') : Text::_('COM_TJNOTIFICATIONS_STATE_FAILED'); - ?> - - key, ENT_COMPAT, 'UTF-8'); ?> - - provider, ENT_COMPAT, 'UTF-8'); ?> - - from, ENT_COMPAT, 'UTF-8'); ?> - - params)): ?> - - +
+ + + + + + + + + + + + + + + + + + + + items)) : ?> + items as $i => $row) :?> + + + + - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ id); ?> + + subject, ENT_COMPAT, 'UTF-8'); ?> + + + - - - - - id, ENT_COMPAT, 'UTF-8'); ?> -
+
+ ', $row->to); ?> + + ', $row->cc); ?> + + ', $row->bcc); ?> + + date, ENT_COMPAT, 'UTF-8'); ?> + + state === 1) ? Text::_('COM_TJNOTIFICATIONS_STATE_SENT') : Text::_('COM_TJNOTIFICATIONS_STATE_FAILED'); + ?> + + key, ENT_COMPAT, 'UTF-8'); ?> + + provider, ENT_COMPAT, 'UTF-8'); ?> + + from, ENT_COMPAT, 'UTF-8'); ?> + + params)): ?> + + + + + + + + id, ENT_COMPAT, 'UTF-8'); ?> +
+
+ pagination->getListFooter(); ?> + + + + +
- pagination->getListFooter(); ?> - - - - -
-
From 52caa47b6a4022bd4c0714f192c37c2a89959138 Mon Sep 17 00:00:00 2001 From: poonam_b Date: Tue, 2 Jul 2019 11:53:41 +0530 Subject: [PATCH 46/50] Issue #48 chore: Log Email details in DB table --- src/com_tjnotifications/admin/models/logs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com_tjnotifications/admin/models/logs.php b/src/com_tjnotifications/admin/models/logs.php index 6a4ce0ed..e305ffa4 100644 --- a/src/com_tjnotifications/admin/models/logs.php +++ b/src/com_tjnotifications/admin/models/logs.php @@ -73,7 +73,7 @@ protected function populateState($ordering = 'tjl.id', $direction = 'desc') parent::populateState($ordering, $direction); // Get pagination request variables - $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int'); + $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int'); $limitstart = Factory::getApplication()->input->post->get('limitstart'); // In case limit has been changed, adjust it From 48ba815dd0c71b9ef0291fe71cb8a0c6c89ed91f Mon Sep 17 00:00:00 2001 From: poonam_b Date: Tue, 2 Jul 2019 11:55:48 +0530 Subject: [PATCH 47/50] Issue #48 chore: Log Email details in DB table --- src/com_tjnotifications/admin/views/logs/tmpl/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.php b/src/com_tjnotifications/admin/views/logs/tmpl/default.php index 6ce0b621..4b0d8c27 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/default.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.php @@ -82,7 +82,7 @@ - + From 102d3b2cece69327d6362d01b2e07df9c0f5da1b Mon Sep 17 00:00:00 2001 From: poonam_b Date: Tue, 2 Jul 2019 12:05:24 +0530 Subject: [PATCH 48/50] Issue #48 chore: Log Email details in DB table --- src/com_tjnotifications/admin/views/logs/tmpl/param.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/param.php b/src/com_tjnotifications/admin/views/logs/tmpl/param.php index 894ed8fe..a616cb37 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/param.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/param.php @@ -9,12 +9,15 @@ */ // No direct access defined('_JEXEC') or die; + use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Table; + $jinput = Factory::getApplication()->input; $logId = $jinput->get('id', 0, 'INT'); -if($logId) + +if ($logId) { Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables'); $logTable = Table::getInstance('Log', 'TjnotificationsTable'); @@ -24,7 +27,7 @@
id) : ?>
params; ?> From dc8b615def2856a742e52cea0277702ce4b24857 Mon Sep 17 00:00:00 2001 From: poonam_b Date: Tue, 2 Jul 2019 12:14:05 +0530 Subject: [PATCH 49/50] Issue #48 chore: Log Email details in DB table --- src/com_tjnotifications/admin/views/logs/tmpl/body.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/body.php b/src/com_tjnotifications/admin/views/logs/tmpl/body.php index e3639d92..7f2cb50b 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/body.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/body.php @@ -18,7 +18,7 @@ $jinput = Factory::getApplication()->input; $logId = $jinput->get('id', 0, 'INT'); -if($logId) +if ($logId) { Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables'); $logTable = Table::getInstance('Log', 'TjnotificationsTable'); From b634bbfebd7864a238f5cfa34e7754eeab611a02 Mon Sep 17 00:00:00 2001 From: poonam_b Date: Wed, 17 Jul 2019 17:48:37 +0530 Subject: [PATCH 50/50] Issue #48 chore: Log Email details in DB table - Tj Notification --- .../admin/language/en-GB.com_tjnotifications.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini b/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini index a58e545a..1f1c2b26 100644 --- a/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini +++ b/src/com_tjnotifications/admin/language/en-GB.com_tjnotifications.ini @@ -93,6 +93,7 @@ COM_TJNOTIFICATIONS_CORE_TEMPLATE_VALUE="No" COM_TJNOTIFICATIONS_TAGS_DESC="Enter the tag given on left in to the editor these tag names will be replaced by description given in notification template" COM_TJNOTIFICATIONS_REPLACEMENT_TAGS="Replacement Tag" COM_TJNOTIFICATIONS_REPLACEMENT_TAGS_DESC="Description" +; Since v1.1.0 COM_TJNOTIFICATION="Notifications" COM_TJNOTIFICATIONS_ALLOW_SAVE_OPTION="Enable logs?" COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_SUBJECT="Subject" @@ -106,7 +107,6 @@ COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_BCC="BCC" COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_DATE="Date" COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_STATE="State" COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_PARAMS="Params" -; Since v1.1.0 COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONS="Notifications" COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONLOGS="Notifications Logs" COM_TJNOTIFICATIONS_LOGS="Logs"