Skip to content

Commit

Permalink
Issue techjoomla#48 chore: Log code review issue
Browse files Browse the repository at this point in the history
  • Loading branch information
punambaravkar committed Jun 28, 2019
1 parent a9242a7 commit ced08e2
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 157 deletions.
2 changes: 1 addition & 1 deletion src/com_tjnotifications/admin/config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset label="COM_TJNOTIFICATION" name="Notifications">
<field name="enable_logs" type="radio" class="btn-group btn-group-yesno" default="No" label="COM_TJNOTIFICATIONS_ALLOW_SAVE_OPTION" description="COM_TJNOTIFICATIONS_APPLICATION_OPTION_DESC">
<field name="enable_logs" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_TJNOTIFICATIONS_ALLOW_SAVE_OPTION" description="COM_TJNOTIFICATIONS_APPLICATION_OPTION_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
Expand Down
10 changes: 7 additions & 3 deletions src/com_tjnotifications/admin/controllers/log.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<?php
/**
* @package Com_Tjnotifications
* @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJNotifications
* @subpackage com_tjnotifications
*
* @author Techjoomla <[email protected]>
* @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\MVC\Controller\FormController;
Expand Down
11 changes: 7 additions & 4 deletions src/com_tjnotifications/admin/controllers/logs.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php
/**
* @package Com_Tjnotification
* @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJNotifications
* @subpackage com_tjnotifications
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access to this file
// No direct access
defined('_JEXEC') or die;

use Joomla\CMS\MVC\Controller\AdminController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ COM_TJNOTIFICATIONS_FIELD_KEY_OPTION="-- Select Key --"
COM_TJNOTIFICATIONS_FIELD_TITLE_OPTION="-- Select Title --"
COM_TJNOTIFICATIONS_FIELD_EMAIL_STATUS_LABEL="Email Status"
COM_TJNOTIFICATIONS_FIELD_EMAIL_SUBJECT_LABEL="Subject"
COM_TJNOTIFICATIONS_FIELD_EMAIL_BODY_LABEL="Notification body"
COM_TJNOTIFICATIONS_FIELD_EMAIL_BODY_LABEL="Email body"
COM_TJNOTIFICATIONS_FIELD_SMS_STATUS_LABEL="SMS Status"
COM_TJNOTIFICATIONS_FIELD_SMS_SUBJECT_LABEL="Subject"
COM_TJNOTIFICATIONS_FIELD_SMS_BODY_LABEL="SMS Body"
Expand Down Expand Up @@ -106,6 +106,7 @@ 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"
Expand Down Expand Up @@ -137,6 +138,8 @@ COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_BODY="Body"
COM_TJNOTIFICATIONS_TITLE_VIEW_CONTENTS="View Content"
COM_TJNOTIFICATIONS_STATE_SENT="Sent"
COM_TJNOTIFICATIONS_STATE_FAILED="Failed"
COM_TJNOTIFICATIONS_FIELD_NOTIFICATION_BODY_LABEL="Notification Body"
COM_TJNOTIFICATIONS_LIST_LOGS_DESC="List all notifiaction logs"
; permissions
JACTION_VIEW="View"
JACTION_VIEW_COMPONENT_DESC="Allow user to view notifications logs"
Expand Down
66 changes: 10 additions & 56 deletions src/com_tjnotifications/admin/models/forms/filter_logs.xml
Original file line number Diff line number Diff line change
@@ -1,66 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>

<form>
<form>
<fields name="filter">
<field
name="search"
type="text"
label="search"
hint="search"
class="js-stools-search-string"
/>
<field
name="client"
label="COM_TJNOTIFICATIONS_FIELD_CLIENT_LABEL"
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"
>
<option value=''>COM_TJNOTIFICATIONS_FIELD_CLIENT_OPTION</option>
</field>
<field
name="provider"
type="list"
class="inputbox"
label="COM_TJNOTIFICATIONS_FIELD_PROVIDER_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_PROVIDER_DESC"
onchange="this.form.submit();"
key_field="provider"
value_field="provider"
>
<option value="">COM_TJNOTIFICATIONS_FIELD_PROVIDER_OPTION</option>
<field name="search" type="text" label="search" hint="search" class="js-stools-search-string" />
<field name="client" label="COM_TJNOTIFICATIONS_FIELD_CLIENT_LABEL" 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">
<option value=''>COM_TJNOTIFICATIONS_FIELD_CLIENT_OPTION</option>
</field>
<field name="provider" type="list" class="inputbox" label="COM_TJNOTIFICATIONS_FIELD_PROVIDER_LABEL" default="email" description="COM_TJNOTIFICATIONS_FIELD_PROVIDER_DESC" onchange="this.form.submit();" key_field="provider" value_field="provider">
<option value="email">COM_TJNOTIFICATIONS_PROVIDER_EMAIL</option>
<option value="sms">COM_TJNOTIFICATIONS_PROVIDER_SMS</option>
<option value="push">COM_TJNOTIFICATIONS_PROVIDER_PUSH</option>
<option value="web">COM_TJNOTIFICATIONS_PROVIDER_WEB</option>
</field>
<field
name="key"
label="COM_TJNOTIFICATIONS_FIELD_KEY_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_KEY_DESC"
onchange="this.form.submit();"
type="sql"
class="inputbox"
query="SELECT DISTINCT(notemp.key)as tmpkey FROM `#__tj_notification_templates` as notemp"
key_field="tmpkey"
value_field="tmpkey"
>
<option value=''>COM_TJNOTIFICATIONS_FIELD_KEY_OPTION</option>
</field>
<field
name="state"
type="list"
class="inputbox"
label="COM_TJNOTIFICATIONS_FIELD_STATE_LABEL"
description="COM_TJNOTIFICATIONS_FIELD_STATE_DESC"
onchange="this.form.submit();"
key_field="provider"
value_field="provider"
>
<field name="key" label="COM_TJNOTIFICATIONS_FIELD_KEY_LABEL" description="COM_TJNOTIFICATIONS_FIELD_KEY_DESC" onchange="this.form.submit();" type="sql" class="inputbox" query="SELECT DISTINCT(notemp.key as tmpkey FROM `#__tj_notification_templates` as notemp" key_field="tmpkey" value_field="tmpkey">
<option value=''>COM_TJNOTIFICATIONS_FIELD_KEY_OPTION</option>
</field>
<field name="state" type="list" class="inputbox" label="COM_TJNOTIFICATIONS_FIELD_STATE_LABEL" description="COM_TJNOTIFICATIONS_FIELD_STATE_DESC" onchange="this.form.submit();" key_field="provider" value_field="provider">
<option value="">COM_TJNOTIFICATIONS_FIELD_STATE_OPTION</option>
<option value="1">COM_TJNOTIFICATIONS_STATE_SENT</option>
<option value="0">COM_TJNOTIFICATIONS_STATE_FAILED</option>
Expand Down
14 changes: 9 additions & 5 deletions src/com_tjnotifications/admin/models/log.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<?php
/**
* @package Com_Tjnotifications
* @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJNotifications
* @subpackage com_tjnotifications
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access to this file
// No direct access
defined('_JEXEC') or die;

jimport('joomla.application.component.model');

use Joomla\CMS\Table\Table;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Table\Table;

/**
* Log model.
Expand Down
13 changes: 9 additions & 4 deletions src/com_tjnotifications/admin/models/logs.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<?php
/**
* @package Com_Tjnotifications
* @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJNotifications
* @subpackage com_tjnotifications
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access to this file
defined('_JEXEC') or die;

jimport('joomla.application.component.model');

use Joomla\CMS\MVC\Model\ListModel;

/**
Expand Down Expand Up @@ -67,7 +72,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 = $app->input->post->get('limitstart', 0, '', 'int');

// In case limit has been changed, adjust it
Expand Down
11 changes: 7 additions & 4 deletions src/com_tjnotifications/admin/tables/log.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

/**
* @package Com_Tjnotification
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @package TJNotifications
* @subpackage com_tjnotifications
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access to this file
defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
Expand Down
13 changes: 8 additions & 5 deletions src/com_tjnotifications/admin/views/logs/tmpl/body.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<?php
/**
* @package Com_Tjnotifications
* @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJNotifications
* @subpackage com_tjnotifications
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access to this file
defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Table;

$jinput = Factory::getApplication()->input;
$logId = $jinput->get('id', 0, 'INT');
Expand All @@ -25,7 +28,7 @@
<div>
<?php if ($logTable->id) : ?>
<h3 class="modal-title">
<?php echo Text::_("COM_TJNOTIFICATIONS_FIELD_EMAIL_BODY_LABEL");
<?php echo Text::_("COM_TJNOTIFICATIONS_FIELD_NOTIFICATION_BODY_LABEL");
?>
</h3>
<div class="col-xs-12">
Expand Down
Loading

0 comments on commit ced08e2

Please sign in to comment.