Stable release of v2.0.4

Added the option to set the default Translation. Fixed sharing of a verse, so its auto selected when verse number is clicked.
This commit is contained in:
Robot 2023-07-26 22:29:41 +02:00
parent 64cb76436b
commit 54b0f9aa41
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
19 changed files with 137 additions and 42 deletions

View File

@ -17,4 +17,9 @@
# v2.0.3
- Fixed getBible/support#2 so that the view value does not result into Undefined.
- Fixed getBible/support#3 so that empty translations and translations without the selected books better manage the mismatching query.
- Fixed getBible/support#3 so that empty translations and translations without the selected books better manage the mismatching query.
# v2.0.4
- Added the option to set the default Translation.
- Fixed sharing of a verse, so its auto selected when verse number is clicked.

View File

@ -1,4 +1,4 @@
# Get Bible (2.0.3)
# Get Bible (2.0.4)
![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible")
@ -19,31 +19,31 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is
+ *Name*: [Get Bible](https://getbible.net)
+ *First Build*: 3rd December, 2015
+ *Last Build*: 26th July, 2023
+ *Version*: 2.0.3
+ *Version*: 2.0.4
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time
**530 Hours** or **66 Eight Hour Days** (actual time the author saved -
**532 Hours** or **67 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **189942**
+ *File count*: **1663**
+ *Line count*: **190561**
+ *File count*: **1664**
+ *Folder count*: **161**
**350 Hours** or **44 Eight Hour Days** (the actual time the author spent)
**351 Hours** or **43 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @133hours** = codingtime / 4;
> **planning @76hours** = codingtime / 7;
> **mapping @53hours** = codingtime / 10;
> **office @88hours** = codingtime / 6;)
> **office @89hours** = codingtime / 6;)
**880 Hours** or **110 Eight Hour Days**
**883 Hours** or **110 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,

View File

@ -1,4 +1,4 @@
# Get Bible (2.0.3)
# Get Bible (2.0.4)
![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible")
@ -19,31 +19,31 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is
+ *Name*: [Get Bible](https://getbible.net)
+ *First Build*: 3rd December, 2015
+ *Last Build*: 26th July, 2023
+ *Version*: 2.0.3
+ *Version*: 2.0.4
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time
**530 Hours** or **66 Eight Hour Days** (actual time the author saved -
**532 Hours** or **67 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **189942**
+ *File count*: **1663**
+ *Line count*: **190561**
+ *File count*: **1664**
+ *Folder count*: **161**
**350 Hours** or **44 Eight Hour Days** (the actual time the author spent)
**351 Hours** or **43 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @133hours** = codingtime / 4;
> **planning @76hours** = codingtime / 7;
> **mapping @53hours** = codingtime / 10;
> **office @88hours** = codingtime / 6;)
> **office @89hours** = codingtime / 6;)
**880 Hours** or **110 Eight Hour Days**
**883 Hours** or **110 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,

View File

@ -47,6 +47,19 @@
/>
<field type="spacer" name="spacerHistory" hr="true" />
<!-- Default_translation Field. Type: Translations. (custom) -->
<field
type="translations"
name="default_translation"
label="COM_GETBIBLE_CONFIG_DEFAULT_TRANSLATION_LABEL"
description="COM_GETBIBLE_CONFIG_DEFAULT_TRANSLATION_DESCRIPTION"
class="list_class"
multiple="false"
default="kjv"
required="true"
/>
<!-- Spacer_hr_1 Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_1" hr="true" class="spacer_hr_1" />
<!-- Gitea_token Field. Type: Password. (joomla) -->
<field
type="password"
@ -63,6 +76,8 @@
hint="COM_GETBIBLE_CONFIG_GITEA_TOKEN_HINT"
autocomplete="off"
/>
<!-- Spacer_hr_2 Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_2" hr="true" class="spacer_hr_2" />
<!-- Show_install_button Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -77,6 +92,8 @@
<option value="0">
COM_GETBIBLE_CONFIG_NO</option>
</field>
<!-- Spacer_hr_3 Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_3" hr="true" class="spacer_hr_3" />
<!-- Show_getbible_logo Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -133,8 +150,8 @@
<option value="0">
COM_GETBIBLE_CONFIG_NO</option>
</field>
<!-- Spacer_hr Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr" hr="true" class="spacer_hr" />
<!-- Spacer_hr_4 Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_4" hr="true" class="spacer_hr_4" />
<field name="autorTitle"
type="spacer"
label="COM_GETBIBLE_CONFIG_AUTHOR"

View File

@ -245,6 +245,8 @@ COM_GETBIBLE_CONFIG_DEBUG_DESCRIPTION="Show Debugging Information"
COM_GETBIBLE_CONFIG_DEBUG_LABEL="Debugging"
COM_GETBIBLE_CONFIG_DEFAULT="default"
COM_GETBIBLE_CONFIG_DEFAULT_FORMAT_SHARE_LABEL="Default Format Share"
COM_GETBIBLE_CONFIG_DEFAULT_TRANSLATION_DESCRIPTION="Select the Default Bible Translation"
COM_GETBIBLE_CONFIG_DEFAULT_TRANSLATION_LABEL="System Default Translation"
COM_GETBIBLE_CONFIG_DETAILS_CARD_STYLE_LABEL="Details Card Style"
COM_GETBIBLE_CONFIG_DETAILS_ICON_DESCRIPTION="Set the details custom icon"
COM_GETBIBLE_CONFIG_DETAILS_ICON_HINT="info"

View File

@ -62,8 +62,8 @@ class JFormFieldTranslations extends JFormFieldList
}
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
$options = [];
if (!empty($items))
{
if ($this->multiple === false)
{
@ -74,6 +74,18 @@ class JFormFieldTranslations extends JFormFieldList
$options[] = JHtml::_('select.option', $item->abbreviation, $item->abbreviation_translation.' (' .$item->abbreviation.')');
}
}
// if none was found we load the KJV as the default
if (empty($options))
{
$options = [];
if ($this->multiple === false)
{
$options[] = JHtml::_('select.option', '', JText::_('COM_GETBIBLE_SELECT_AN_OPTION'));
}
$options[] = JHtml::_('select.option', 'kjv', 'King James Version (kjv)'); // this is the default at all times.
}
return $options;
}
}

View File

@ -0,0 +1 @@

View File

@ -90,7 +90,7 @@ class GetbibleViewPrompts extends HtmlView
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_GETBIBLE_PROMPTS'), 'featured');
JToolBarHelper::title(JText::_('COM_GETBIBLE_PROMPTS'), 'puzzle');
JHtmlSidebar::setAction('index.php?option=com_getbible&view=prompts');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');

View File

@ -7,9 +7,9 @@
<authorUrl>https://getbible.net</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>2.0.3</version>
<version>2.0.4</version>
<description><![CDATA[
<h1>Get Bible (v.2.0.3)</h1>
<h1>Get Bible (v.2.0.4)</h1>
<div style="clear: both;"></div>
<p>Welcome to the next level of scripture engagement - The Bible for Joomla! Our purpose is to bring the Word of God to every person, in their native language, entirely free. This isn't just a typical extension; it's a groundbreaking tool developed to span language divides and deliver a rich, customizable Bible study experience to users worldwide.

View File

@ -107,6 +107,36 @@ final class DailyScripture
return (strcasecmp($this->active, $this->reference) == 0);
}
/**
* Set Current active verse
*
* @return int|null Book number
* @return int|null Chapter number
* @return string|null Verses
*
* @since 2.0.1
*/
public function setActive(?int $book, ?int $chapter, ?string $verses): void
{
$active = '';
if ($book !== null)
{
$active = $book;
if ($chapter !== null)
{
$this->book = (int) $book;
$this->chapter = (int) $chapter;
$active .= ' ' . $chapter;
if ($verses !== null)
{
$active .= ':' . $verses;
$this->verses = $verses;
}
$this->active = $active;
}
}
}
/**
* An option to load another reference
*

View File

@ -1108,7 +1108,7 @@ class com_getbibleInstallerScript
$query = $db->getQuery(true);
// Field to update.
$fields = array(
$db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","show_install_button":"0","show_getbible_logo":"1","show_getbible_link":"1","show_hash_validation":"1","show_api_link":"1","activate_search":"0","search_found_color":"#4747ff","table_selection_color":"#dfdfdf","search_words":"1","search_match":"1","search_case":"1","activate_notes":"0","activate_tags":"0","allow_untagging":"0","activate_sharing":"1","verse_layout_share":"1","verse_number_share":"1","local_link_share":"1","text_reference_share":"3","type_translation_share":"2","default_format_share":"1","verse_selected_color":"#4747ff","show_header":"1","verse_per_line":"1","show_top_menu":"1","top_menu_type":"1","show_bottom_menu":"0","bottom_menu_type":"1","previous_next_navigation":"1","set_custom_tabs":"0","custom_tabs":"div","set_default_tab_names":"0","custom_icons":"0","show_scripture_tab_text":"1","show_scripture_icon":"1","show_scripture_card":"1","scripture_card_style":"default","show_translations_tab_text":"1","show_translations_icon":"1","show_translations_card":"1","translations_card_style":"default","show_books_tab_text":"1","show_books_icon":"1","show_books_card":"1","books_card_style":"default","show_chapters_tab_text":"1","show_chapters_icon":"1","show_chapters_card":"1","chapters_card_style":"default","show_settings":"0","show_settings_tab_text":"1","show_settings_icon":"1","show_settings_card":"1","settings_card_style":"default","show_details":"1","show_details_tab_text":"1","show_details_icon":"1","show_details_card":"1","details_card_style":"default","debug":"0","enable_open_ai":"0","openai_model":"gpt-4","openai_token":"secret","enable_open_ai_org":"0","openai_org_token":"secret","openai_max_tokens":"300","openai_temperature":"1","openai_top_p":"1","openai_n":"1","openai_presence_penalty":"0","openai_frequency_penalty":"0","check_in":"-1 day","save_history":"1","history_limit":"10","add_jquery_framework":"1","uikit_load":"1","uikit_min":""}'),
$db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","default_translation":"kjv","show_install_button":"0","show_getbible_logo":"1","show_getbible_link":"1","show_hash_validation":"1","show_api_link":"1","activate_search":"0","search_found_color":"#4747ff","table_selection_color":"#dfdfdf","search_words":"1","search_match":"1","search_case":"1","activate_notes":"0","activate_tags":"0","allow_untagging":"0","activate_sharing":"1","verse_layout_share":"1","verse_number_share":"1","local_link_share":"1","text_reference_share":"3","type_translation_share":"2","default_format_share":"1","verse_selected_color":"#4747ff","show_header":"1","verse_per_line":"1","show_top_menu":"1","top_menu_type":"1","show_bottom_menu":"0","bottom_menu_type":"1","previous_next_navigation":"1","set_custom_tabs":"0","custom_tabs":"div","set_default_tab_names":"0","custom_icons":"0","show_scripture_tab_text":"1","show_scripture_icon":"1","show_scripture_card":"1","scripture_card_style":"default","show_translations_tab_text":"1","show_translations_icon":"1","show_translations_card":"1","translations_card_style":"default","show_books_tab_text":"1","show_books_icon":"1","show_books_card":"1","books_card_style":"default","show_chapters_tab_text":"1","show_chapters_icon":"1","show_chapters_card":"1","chapters_card_style":"default","show_settings":"0","show_settings_tab_text":"1","show_settings_icon":"1","show_settings_card":"1","settings_card_style":"default","show_details":"1","show_details_tab_text":"1","show_details_icon":"1","show_details_card":"1","details_card_style":"default","debug":"0","enable_open_ai":"0","openai_model":"gpt-4","openai_token":"secret","enable_open_ai_org":"0","openai_org_token":"secret","openai_max_tokens":"300","openai_temperature":"1","openai_top_p":"1","openai_n":"1","openai_presence_penalty":"0","openai_frequency_penalty":"0","check_in":"-1 day","save_history":"1","history_limit":"10","add_jquery_framework":"1","uikit_load":"1","uikit_min":""}'),
);
// Condition.
$conditions = array(
@ -1539,7 +1539,7 @@ class com_getbibleInstallerScript
echo '<a target="_blank" href="https://getbible.net" title="Get Bible">
<img src="components/com_getbible/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 2.0.3 Was Successful! Let us know if anything is not working as expected.</h3>';
<h3>Upgrade to Version 2.0.4 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already.
if (!isset($db))

View File

@ -104,17 +104,21 @@ class GetbibleModelApp extends ItemModel
}
// we get all the Scripture Details
$this->translation = $this->input->getString('translation') ?? $this->input->getString('t', 'kjv');
$this->translation = $this->input->getString('translation') ?? $this->input->getString('t', Helper::getParams('com_getbible')->get('default_translation', 'kjv'));
$this->book = $this->input->getInt('book') ?? $this->input->getInt('b');
$this->chapter = $this->input->getInt('chapter') ?? $this->input->getInt('c', 1);
$this->verses = $this->input->getString('verses') ?? $this->input->getString('verse') ?? $this->input->getString('v');
$pk = 0;
// try the ref string
// set daily verse (STUFF)
if (empty($this->book) && ($ref = $this->input->getString('ref')) !== null)
{
Factory::_('DailyScripture')->load($ref);
}
else
{
Factory::_('DailyScripture')->setActive($this->book, $this->chapter, $this->verses);
}
// load Daily Scripture if no book value was found
if (empty($this->book))

View File

@ -97,7 +97,7 @@ class GetbibleModelOpenai extends ItemModel
$pk = (!empty($pk)) ? $pk : (int) $this->getState('openai.id');
$this->translation = $this->input->getString('t') ?? $this->input->getString('version') ?? $this->input->getString('translation', 'kjv');
$this->translation = $this->input->getString('t') ?? $this->input->getString('translation', Helper::getParams('com_getbible')->get('default_translation', 'kjv'));
$this->guid = $pk = $this->input->getString('guid');
$this->book = $this->input->getInt('book', 0);
$this->chapter = $this->input->getInt('chapter', 0);

View File

@ -370,7 +370,7 @@ class GetbibleModelSearch extends ListModel
// Get the global params
$globalParams = JComponentHelper::getParams('com_getbible', true);
$this->translation = $this->input->getString('t') ?? $this->input->getString('version') ?? $this->input->getString('translation', 'kjv');
$this->translation = $this->input->getString('t') ?? $this->input->getString('translation', $globalParams->get('default_translation', 'kjv'));
$this->words = $this->input->getInt('words', $globalParams->get('search_words', 1));
$this->match = $this->input->getInt('match', $globalParams->get('search_match', 1));
$this->case = $this->input->getInt('case', $globalParams->get('search_case', 1));

View File

@ -20,6 +20,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\Component\Helper;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\GetBible\Factory;
@ -166,7 +167,7 @@ class GetbibleModelTag extends ListModel
$this->input ??= JFactory::getApplication()->input;
$this->translation = $this->input->getString('t') ?? $this->input->getString('version') ?? $this->input->getString('translation', 'kjv') ;
$this->translation = $this->input->getString('t') ?? $this->input->getString('translation', Helper::getParams('com_getbible')->get('default_translation', 'kjv')) ;
$this->tag = $this->input->getString('guid') ?? '';
if (!GuidHelper::valid($this->tag))

View File

@ -35,15 +35,17 @@ class GetbibleRouter extends JComponentRouterBase
* @since 3.3
*/
protected ?string $defaultTranslation = null;
public function build(&$query)
{
$segments = [];
$view = $query['view'] ?? 'app';
$this->defaultTranslation ??= JComponentHelper::getParams('com_getbible')->get('default_translation', 'kjv');
if ($view === 'search')
{
$segments[0] = 'search';
$segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv';
$segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? $this->defaultTranslation;
$criteria = $query['criteria'] ?? null;
if ($criteria === null)
@ -117,7 +119,7 @@ class GetbibleRouter extends JComponentRouterBase
{
$segments[0] = 'openai';
$segments[1] = $query['guid'] ?? '';
$segments[2] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? '';
$segments[2] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? $this->defaultTranslation;
$segments[3] = $query['book'] ?? '';
$segments[4] = $query['chapter'] ?? '';
$segments[5] = $query['verse'] ?? '';
@ -136,13 +138,13 @@ class GetbibleRouter extends JComponentRouterBase
elseif ($view === 'api')
{
$segments[0] = 'api';
$segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv';
$segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? $this->defaultTranslation;
$segments[2] = $query['get'] ?? '';
}
elseif ($view === 'tag')
{
$segments[0] = 'tag';
$segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv';
$segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? $this->defaultTranslation;
$segments[2] = $query['guid'] ?? '';
if (!empty($query['guid']) && ($tag_name = $this->getVar('tag', $query['guid'], 'guid', 'name')) !== null)
{
@ -152,7 +154,7 @@ class GetbibleRouter extends JComponentRouterBase
}
else
{
$segments[0] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv';
$segments[0] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? $this->defaultTranslation;
$segments[1] = $query['ref'] ?? $query['b'] ?? $query['book'] ?? '';
$chapter = $query['chapter'] ?? $query['c'] ?? '';
@ -205,6 +207,8 @@ class GetbibleRouter extends JComponentRouterBase
$vars = [];
$vars['view'] = 'app';
$this->defaultTranslation ??= JComponentHelper::getParams('com_getbible')->get('default_translation', 'kjv');
$key = 0;
$vars['t'] = $segments[$key] ?? '';
@ -268,7 +272,7 @@ class GetbibleRouter extends JComponentRouterBase
// if the first tag is none of the above, we are probably on the app page
else
{
$vars['t'] = 'kjv';
$vars['t'] = $this->defaultTranslation;
$this->setAppVars($vars, $key, $segments);
}
@ -483,7 +487,7 @@ class GetbibleRouter extends JComponentRouterBase
*/
private function setTranslation(array &$vars, int &$key, array $segments): void
{
$vars['t'] = $segments[$key] ?? 'kjv';
$vars['t'] = $segments[$key] ?? $this->defaultTranslation;
if ($this->validTranslation($vars['t']))
{
@ -491,7 +495,7 @@ class GetbibleRouter extends JComponentRouterBase
}
else
{
$vars['t'] = 'kjv';
$vars['t'] = $this->defaultTranslation;
}
}

View File

@ -259,6 +259,7 @@ const getbibleActiveVerse = {
setActiveNoteTextarea(this._value);<?php endif; ?>
<?php if ($this->params->get('activate_tags') == 1): ?> // update the tags
setActiveTags(this._value);<?php endif; ?>
setSharedValues(this._value, this._value, true);
}
};
const setActiveVerse = async (number, update = true) => {

View File

@ -393,9 +393,9 @@ function setSharedValues(start, end, update = true) {
if (update) {
getbibleShareVerseSlider.noUiSlider.set([start, end]);
} else {
let function_call = 'setSharedValues(' + start + ',' + end + ')';
let functionCall = document.getElementById('getbible-main-sharing-button');
functionCall.setAttribute('onclick', function_call);
//let function_call = 'setSharedValues(' + start + ',' + end + ')';
//let functionCall = document.getElementById('getbible-main-sharing-button');
//functionCall.setAttribute('onclick', function_call);
}
}
getbibleShareVerseSlider.noUiSlider.on('update', function(values, handle) {

View File

@ -53,4 +53,22 @@
<maintainerurl>https://getbible.net</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
<update>
<name>Get Bible</name>
<description>The Bible for Joomla</description>
<element>pkg_getbible</element>
<type>component</type>
<client>site</client>
<version>2.0.4</version>
<infourl title="Get Bible!">https://getbible.net</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v2.0.4.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://getbible.net</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
</updates>