From 54b0f9aa41cf0cf75c307adcdbff347fb4db04ef Mon Sep 17 00:00:00 2001 From: aB0t Date: Wed, 26 Jul 2023 22:29:41 +0200 Subject: [PATCH] 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. --- CHANGELOG.md | 7 ++++- README.md | 16 +++++----- admin/README.txt | 16 +++++----- admin/config.xml | 21 +++++++++++-- admin/language/en-GB/en-GB.com_getbible.ini | 2 ++ admin/models/fields/translations.php | 16 ++++++++-- admin/sql/updates/mysql/2.0.3.sql | 1 + admin/views/prompts/view.html.php | 2 +- getbible.xml | 4 +-- .../src/DailyScripture.php | 30 +++++++++++++++++++ script.php | 4 +-- site/models/app.php | 8 +++-- site/models/openai.php | 2 +- site/models/search.php | 2 +- site/models/tag.php | 3 +- site/router.php | 20 ++++++++----- site/views/app/tmpl/default_getbibleapp.php | 1 + .../app/tmpl/default_getbibleappshare.php | 6 ++-- update_server.xml | 18 +++++++++++ 19 files changed, 137 insertions(+), 42 deletions(-) create mode 100644 admin/sql/updates/mysql/2.0.3.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 36dc13a..e4cc61e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. \ No newline at end of file +- 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. \ No newline at end of file diff --git a/README.md b/README.md index 5ed717b..8f71999 100644 --- a/README.md +++ b/README.md @@ -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**, diff --git a/admin/README.txt b/admin/README.txt index 5ed717b..8f71999 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -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**, diff --git a/admin/config.xml b/admin/config.xml index 8f6b731..0815ae9 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -47,6 +47,19 @@ /> + + + + + + COM_GETBIBLE_CONFIG_NO + + COM_GETBIBLE_CONFIG_NO - - + + 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; } } diff --git a/admin/sql/updates/mysql/2.0.3.sql b/admin/sql/updates/mysql/2.0.3.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/admin/sql/updates/mysql/2.0.3.sql @@ -0,0 +1 @@ + diff --git a/admin/views/prompts/view.html.php b/admin/views/prompts/view.html.php index 7b36b74..e05a9fe 100644 --- a/admin/views/prompts/view.html.php +++ b/admin/views/prompts/view.html.php @@ -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'); diff --git a/getbible.xml b/getbible.xml index f74459a..bcb6228 100644 --- a/getbible.xml +++ b/getbible.xml @@ -7,9 +7,9 @@ https://getbible.net Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 2.0.3 + 2.0.4 Get Bible (v.2.0.3) +

Get Bible (v.2.0.4)

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. diff --git a/libraries/jcb_powers/VDM.Joomla.GetBible/src/DailyScripture.php b/libraries/jcb_powers/VDM.Joomla.GetBible/src/DailyScripture.php index 46cf947..95a1b05 100644 --- a/libraries/jcb_powers/VDM.Joomla.GetBible/src/DailyScripture.php +++ b/libraries/jcb_powers/VDM.Joomla.GetBible/src/DailyScripture.php @@ -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 * diff --git a/script.php b/script.php index 603aee2..3dc4dc4 100644 --- a/script.php +++ b/script.php @@ -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 ' -

Upgrade to Version 2.0.3 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 2.0.4 Was Successful! Let us know if anything is not working as expected.

'; // Set db if not set already. if (!isset($db)) diff --git a/site/models/app.php b/site/models/app.php index 79626bc..389a70c 100644 --- a/site/models/app.php +++ b/site/models/app.php @@ -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)) diff --git a/site/models/openai.php b/site/models/openai.php index 5f172be..dad676e 100644 --- a/site/models/openai.php +++ b/site/models/openai.php @@ -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); diff --git a/site/models/search.php b/site/models/search.php index 31db839..8075b39 100644 --- a/site/models/search.php +++ b/site/models/search.php @@ -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)); diff --git a/site/models/tag.php b/site/models/tag.php index a23a38a..54338f3 100644 --- a/site/models/tag.php +++ b/site/models/tag.php @@ -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)) diff --git a/site/router.php b/site/router.php index 92c104d..3f1c443 100644 --- a/site/router.php +++ b/site/router.php @@ -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; } } diff --git a/site/views/app/tmpl/default_getbibleapp.php b/site/views/app/tmpl/default_getbibleapp.php index 917c7c2..838f850 100644 --- a/site/views/app/tmpl/default_getbibleapp.php +++ b/site/views/app/tmpl/default_getbibleapp.php @@ -259,6 +259,7 @@ const getbibleActiveVerse = { setActiveNoteTextarea(this._value); params->get('activate_tags') == 1): ?> // update the tags setActiveTags(this._value); + setSharedValues(this._value, this._value, true); } }; const setActiveVerse = async (number, update = true) => { diff --git a/site/views/app/tmpl/default_getbibleappshare.php b/site/views/app/tmpl/default_getbibleappshare.php index 1b9fe22..3a27d39 100644 --- a/site/views/app/tmpl/default_getbibleappshare.php +++ b/site/views/app/tmpl/default_getbibleappshare.php @@ -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) { diff --git a/update_server.xml b/update_server.xml index 1627c21..be24cd6 100644 --- a/update_server.xml +++ b/update_server.xml @@ -53,4 +53,22 @@ https://getbible.net + + Get Bible + The Bible for Joomla + pkg_getbible + component + site + 2.0.4 + https://getbible.net + + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v2.0.4.zip + + + stable + + Llewellyn van der Merwe + https://getbible.net + + \ No newline at end of file