Skip to content

Commit

Permalink
This fixes the problem with adding in missing SortFields. #829
Browse files Browse the repository at this point in the history
  • Loading branch information
bcordis committed Feb 24, 2021
1 parent 49a47fc commit cfcbaed
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 11 deletions.
15 changes: 14 additions & 1 deletion admin/language/en-GB/en-GB.com_biblestudy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ JBS_CMN_LANDING_SHOW_DESC="Choose whether to hide this item on the Landing Page,
JBS_CMN_LEGACY_PLAYER="Internal Audio Player"
JBS_CMN_LOCATION="Location"
JBS_CMN_LOCATIONS="Locations"
JBS_CMN_LOCATIONS_ASC="Locations Ascending"
JBS_CMN_LOCATIONS_DESC="Locations Descending"
JBS_CMN_LOCATIONS_ORDERING="Locations Ordering"
JBS_CMN_MEDIA="Media"
JBS_CMN_MEDIA_AUTOSTART="Autostart"
Expand All @@ -133,6 +135,8 @@ JBS_CMN_MEDIA_CREATE_DATE="Media Create Date"
JBS_CMN_MEDIA_FILES="Media Files"
JBS_CMN_MESSAGES_LIST="Messages List"
JBS_CMN_MESSAGETYPE="Message Type"
JBS_CMN_MESSAGETYPE_ASC="Message Type Ascending"
JBS_CMN_MESSAGETYPE_DESC="Message Type Descending"
JBS_CMN_MESSAGETYPES="Message Types"
JBS_CMN_MESSAGETYPE_ORDERING="Message Type Ordering"
JBS_CMN_MESSAGE_TITLE="Message"
Expand Down Expand Up @@ -166,7 +170,6 @@ JBS_CMN_POPUP="Popup"
JBS_CMN_POPUP_NEW_WINDOW="Popup/New Window"
JBS_CMN_PRINT="Print"
JBS_CMN_PUBLISHED="Published"
JBS_CMN_PUBLISHED_DESC="Choose whether this item should be visible or not"
JBS_CMN_PUBLISHING_OPTIONS="Publishing Options"
JBS_CMN_READ_MORE="Read More"
JBS_CMN_RESET_SUCCESSFUL="Reset successful. No error messages generated."
Expand Down Expand Up @@ -197,6 +200,8 @@ JBS_CMN_SELECT_TOPIC="- Select a Topic -"
JBS_CMN_SELECT_YEAR="- Select a Year -"
JBS_CMN_SELECT_DIRECTION="- Select a Direction -"
JBS_CMN_SERIES="Series"
JBS_CMN_SERIES_ASC="Series Ascending"
JBS_CMN_SERIES_DESC="Series Descending"
JBS_CMN_SERIES_DESCRIPTION="Series Description"
JBS_CMN_SERIES_NOT_FOUND="Series not found"
JBS_CMN_SERIES_ORDERING="Series Ordering"
Expand All @@ -216,6 +221,8 @@ JBS_CMN_STUDY="Study"
JBS_CMN_STUDYNUMBER="Study Number"
JBS_CMN_STUDY_CHANGE="Change"
JBS_CMN_STUDY_DATE="Study Date"
JBS_CMN_STUDY_DATE_ASC="Study Date Ascending"
JBS_CMN_STUDY_DATE_DESC="Study Date Descending"
JBS_CMN_STUDY_INTRO="Study Introduction"
JBS_CMN_STUDY_NOT_FOUND="Study not found"
JBS_CMN_STUDY_SELECT="Select a Study"
Expand All @@ -224,6 +231,8 @@ JBS_CMN_STYLES="CSS Styles"
JBS_CMN_SUBMIT="Submit"
JBS_CMN_SUBMITTED_BY="Submitted by"
JBS_CMN_TEACHER="Teacher"
JBS_CMN_TEACHERS_ASC="Teacher Ascending"
JBS_CMN_TEACHERS_DESC="Teacher Descending"
JBS_CMN_TEACHERS="Teachers"
JBS_CMN_TEACHERS_ORDERING="Teachers Ordering"
JBS_CMN_TEACHER_IMAGE="Teacher Image"
Expand All @@ -237,6 +246,8 @@ JBS_CMN_TERMS="Text for Download Popup"
JBS_CMN_TERMS_DESC="Use any text or html"
JBS_CMN_THUMBNAIL="Thumbnail"
JBS_CMN_TITLE="Title"
JBS_CMN_TITLE_ASC="Title Ascending"
JBS_CMN_TITLE_DESC="Title Descending"
JBS_CMN_TOP="Top"
JBS_CMN_TOPIC="Topic"
JBS_CMN_TOPICS="Topics"
Expand Down Expand Up @@ -274,6 +285,8 @@ JBS_CMN_LISTEN="Listen"
JBS_CMN_CANT_ADDON_CLASS_NAME="Cannont find addon class neme %s"
JBS_CMN_CANT_ADDON_LOAD_CLASS_NAME="Cannot load addon class name %s"
JBS_CMN_COULD_NOT_LOAD_ADDON_CONFIGURATION="Could not load addon configuration"
JBS_CMN_PUBLISHED_ASC="Published Ascending"
JBS_CMN_PUBLISHED_DESC="Published Descending"

;; Grid Sort filter
JBSM_GRID_SORT_BY="Sort By"
Expand Down
33 changes: 33 additions & 0 deletions admin/models/forms/filter_messages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,39 @@
</fields>
</fieldset>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="stody.studydate DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="study.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="study.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="study.studytitle ASC">JBS_CMN_TITLE_ASC</option>
<option value="study.studytitle DESC">JBS_CMN_TITLE_DESC</option>
<option value="study.studydate ASC">JBS_CMN_STUDY_DATE_ASC</option>
<option value="study.studydate DESC">JBS_CMN_STUDY_DATE_DESC</option>
<option value="teacher.teachername ASC">JBS_CMN_TEACHERS_ASC</option>
<option value="teacher.teachername DESC">JBS_CMN_TEACHERS_DESC</option>
<option value="series.series_text ASC">JBS_CMN_SERIES_ASC</option>
<option value="series.series_text DESC">JBS_CMN_SERIES_DESC</option>
<option value="study.published ASC">JBS_CMN_PUBLISHED_ASC</option>
<option value="study.published DESC">JBS_CMN_PUBLISHED_DESC</option>
<option value="study.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="study.id DESC">JGRID_HEADING_ID_DESC</option>
<option value="access_level ASC">JGRID_HEADING_ACCESS_ASC</option>
<option value="access_level DESC">JGRID_HEADING_ACCESS_DESC</option>
<option value="language ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="language DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="locations.location_text ASC">JBS_CMN_LOCATIONS_ASC</option>
<option value="locations.location_text DESC">JBS_CMN_LOCATIONS_DESC</option>
<option value="messageType.message_type ASC">JBS_CMN_MESSAGETYPE_ASC</option>
<option value="messageType.message_type DESC">JBS_CMN_MESSAGETYPE_DESC</option>
</field>
<field
name="limit"
type="limitbox"
Expand Down
31 changes: 27 additions & 4 deletions admin/models/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function getStoreId($id = '')
$id .= ':' . $this->getState('filter.series');
$id .= ':' . $this->getState('filter.messagetype');
$id .= ':' . $this->getState('filter.location');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . serialize($this->getState('filter.access'));
$id .= ':' . $this->getState('filter.language');
$id .= ':' . $this->getState('filter.search');

Expand All @@ -94,7 +94,7 @@ protected function getStoreId($id = '')
* @since 7.1.0
* @throws Exception
*/
protected function populateState($ordering = null, $direction = null)
protected function populateState($ordering = 'study.studydate', $direction = 'desc')
{
$app = JFactory::getApplication('administrator');

Expand Down Expand Up @@ -145,7 +145,30 @@ protected function populateState($ordering = null, $direction = null)
$location = $this->getUserStateFromRequest($this->context . 'filter.location', 'filter_location');
$this->setState('filter.location', $location);

parent::populateState('study.studydate', 'desc');
$formSubmited = $app->input->post->get('form_submited');

$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access');
$authorId = $this->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id');
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
$tag = $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', '');

if ($formSubmited)
{
$access = $app->input->post->get('access');
$this->setState('filter.access', $access);

$authorId = $app->input->post->get('author_id');
$this->setState('filter.author_id', $authorId);

$categoryId = $app->input->post->get('category_id');
$this->setState('filter.category_id', $categoryId);

$tag = $app->input->post->get('tag');
$this->setState('filter.tag', $tag);
}

// List state information.
parent::populateState($ordering, $direction);

if (!empty($forcedLanguage))
{
Expand Down Expand Up @@ -287,7 +310,7 @@ protected function getListQuery()
// Add the list ordering clause
$orderCol = $this->state->get('list.ordering', 'study.studydate');
$orderDirn = $this->state->get('list.direction', 'DESC');
$query->order($db->escape($orderCol . ' ' . $orderDirn));
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));

return $query;
}
Expand Down
24 changes: 21 additions & 3 deletions admin/views/messages/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@
$saveOrder = $listOrder == 'study.ordering';
$columns = 12;

if (strpos($listOrder, 'publish_up') !== false)
{
$orderingColumn = 'publish_up';
}
elseif (strpos($listOrder, 'publish_down') !== false)
{
$orderingColumn = 'publish_down';
}
elseif (strpos($listOrder, 'modified') !== false)
{
$orderingColumn = 'modified';
}
else
{
$orderingColumn = 'created';
}

if ($saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_biblestudy&task=message.saveOrderAjax&tmpl=component';
Expand All @@ -45,7 +62,6 @@
<div id="j-main-container">
<?php endif; ?>
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
<div class="clearfix"></div>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items">
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
Expand All @@ -55,7 +71,7 @@
<thead>
<tr>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('searchtools.sort', '', 'study.ordering', $listDirn, $listOrder, null, 'desc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
<?php echo JHtml::_('searchtools.sort', '', 'study.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th>
<th width="1%">
<?php echo JHtml::_('grid.checkall'); ?>
Expand Down Expand Up @@ -92,7 +108,6 @@
<tfoot>
<tr>
<td colspan="<?php echo $columns; ?>">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
Expand Down Expand Up @@ -211,6 +226,9 @@
); ?>
<?php endif; ?>
<?php endif; ?>

<?php echo $this->pagination->getListFooter(); ?>

<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0"/>
<?php echo JHtml::_('form.token'); ?>
Expand Down
7 changes: 4 additions & 3 deletions admin/views/messages/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ protected function setDocument()
protected function getSortFields()
{
return array(
'study.studydate' => JText::_('JBS_CMN_YEARS'),
'teachers.teachername' => JText::_('JBS_CMN_TEACHERS'),
'series.seriestext' => JText::_('JBS_CMN_SERIES'),
'study.studydate' => JText::_('JBS_CMN_STUDYDATE'),
'study.studytitle' => JText::_('JBS_CMN_TITLE'),
'teacher.teachername' => JText::_('JBS_CMN_TEACHERS'),
'series.series_text' => JText::_('JBS_CMN_SERIES'),
'study.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'study.published' => JText::_('JPUBLISHED'),
'study.id' => JText::_('JGRID_HEADING_ID'),
Expand Down

0 comments on commit cfcbaed

Please sign in to comment.