From 3744d6aed41518051cd7f258ded5d595331f8aa7 Mon Sep 17 00:00:00 2001 From: aB0t Date: Fri, 28 Jul 2023 17:54:37 +0200 Subject: [PATCH] Stable release of v2.0.5 Adds list of default system tags. Adds linker session manager. Adds option to share sessions. --- CHANGELOG.md | 8 +- README.md | 24 +- admin/README.txt | 24 +- admin/language/en-GB/en-GB.com_getbible.ini | 5 +- admin/models/ajax.php | 2 +- admin/sql/install.mysql.utf8.sql | 65 +++ admin/sql/updates/mysql/2.0.4.sql | 1 + getbible.xml | 6 +- .../VDM.Joomla.GetBible/src/Linker.php | 131 +++++ .../VDM.Joomla.GetBible/src/Note.php | 2 +- .../VDM.Joomla.GetBible/src/Tag.php | 2 +- .../VDM.Joomla.GetBible/src/Tagged.php | 4 +- script.php | 2 +- site/assets/js/app.js | 492 ++++++++++++++---- site/controllers/ajax.json.php | 168 ++++++ site/language/en-GB/en-GB.com_getbible.ini | 45 +- site/layouts/getbiblelinkers.php | 57 ++ site/layouts/modal.php | 8 +- site/models/ajax.php | 84 ++- site/models/app.php | 3 - site/models/tag.php | 3 - site/router.php | 9 +- site/views/app/tmpl/default_getbibleapp.php | 42 +- .../tmpl/default_getbibleappactivesession.php | 222 ++++++++ .../app/tmpl/default_getbibleappbody.php | 2 +- .../tmpl/default_getbibleappbottommenu.php | 6 +- .../app/tmpl/default_getbibleappsettings.php | 153 +----- .../app/tmpl/default_getbibleapptags.php | 9 +- .../app/tmpl/default_getbibleapptopmenu.php | 6 +- ...default_getbiblefavouriteverseselector.php | 143 ++++- .../tmpl/default_getbiblelinkermanager.php | 61 +++ site/views/app/view.html.php | 34 +- update_server.xml | 18 + 33 files changed, 1453 insertions(+), 388 deletions(-) create mode 100644 admin/sql/updates/mysql/2.0.4.sql create mode 100644 site/layouts/getbiblelinkers.php create mode 100644 site/views/app/tmpl/default_getbibleappactivesession.php create mode 100644 site/views/app/tmpl/default_getbiblelinkermanager.php diff --git a/CHANGELOG.md b/CHANGELOG.md index e4cc61e..d61aa56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,4 +22,10 @@ # 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 +- Fixed sharing of a verse, so its auto selected when verse number is clicked. + +# v2.0.5 + +- Adds list of default system tags +- Adds linker session manager +- Adds option to share sessions \ No newline at end of file diff --git a/README.md b/README.md index 8f71999..e18b3b0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (2.0.4) +# Get Bible (2.0.5) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 26th July, 2023 -+ *Version*: 2.0.4 ++ *Last Build*: 28th July, 2023 ++ *Version*: 2.0.5 + *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 -**532 Hours** or **67 Eight Hour Days** (actual time the author saved - +**536 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*: **190561** -+ *File count*: **1664** ++ *Line count*: **191915** ++ *File count*: **1668** + *Folder count*: **161** -**351 Hours** or **43 Eight Hour Days** (the actual time the author spent) +**353 Hours** or **44 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; +> **debugging @134hours** = codingtime / 4; +> **planning @77hours** = codingtime / 7; +> **mapping @54hours** = codingtime / 10; > **office @89hours** = codingtime / 6;) -**883 Hours** or **110 Eight Hour Days** +**889 Hours** or **111 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**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **22 weeks** or **4.6 months** +Project duration: **22.2 weeks** or **4.6 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/README.txt b/admin/README.txt index 8f71999..e18b3b0 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (2.0.4) +# Get Bible (2.0.5) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 26th July, 2023 -+ *Version*: 2.0.4 ++ *Last Build*: 28th July, 2023 ++ *Version*: 2.0.5 + *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 -**532 Hours** or **67 Eight Hour Days** (actual time the author saved - +**536 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*: **190561** -+ *File count*: **1664** ++ *Line count*: **191915** ++ *File count*: **1668** + *Folder count*: **161** -**351 Hours** or **43 Eight Hour Days** (the actual time the author spent) +**353 Hours** or **44 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; +> **debugging @134hours** = codingtime / 4; +> **planning @77hours** = codingtime / 7; +> **mapping @54hours** = codingtime / 10; > **office @89hours** = codingtime / 6;) -**883 Hours** or **110 Eight Hour Days** +**889 Hours** or **111 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**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **22 weeks** or **4.6 months** +Project duration: **22.2 weeks** or **4.6 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/language/en-GB/en-GB.com_getbible.ini b/admin/language/en-GB/en-GB.com_getbible.ini index bdb6bf3..f181f54 100644 --- a/admin/language/en-GB/en-GB.com_getbible.ini +++ b/admin/language/en-GB/en-GB.com_getbible.ini @@ -1,5 +1,6 @@ COM_GETBIBLE="Get Bible" COM_GETBIBLE_ACCESS_ALREADY_EXIST_BUT_COULD_NOT_BE_REACTIVATED="Access already exist, but could not be reactivated." +COM_GETBIBLE_ACCESS_REVOKED="Access revoked." COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter." COM_GETBIBLE_ALL_TRANSLATIONS="All Translations" COM_GETBIBLE_ARCHIVED="Archived" @@ -1566,6 +1567,8 @@ COM_GETBIBLE_TAG_SAVE_WARNING="Alias already existed so a number was added at th COM_GETBIBLE_TAG_STATUS="Status" COM_GETBIBLE_TAG_VERSION_DESC="A count of the number of times this Tag has been revised." COM_GETBIBLE_TAG_VERSION_LABEL="Version" +COM_GETBIBLE_THE_NAME_COULD_NOT_BE_UPDATED="The name could not be updated." +COM_GETBIBLE_THE_NAME_HAS_BEEN_UPDATED="The name has been updated." COM_GETBIBLE_THE_NOTE_WAS_SUCCESSFULLY_CREATED="The note was successfully created." COM_GETBIBLE_THE_NOTE_WAS_SUCCESSFULLY_UPDATED="The note was successfully updated." COM_GETBIBLE_THE_NOTICE_BOARD_IS_LOADING="The notice board is loading" @@ -1851,7 +1854,7 @@ COM_GETBIBLE_VERSE_VERSION_DESC="A count of the number of times this Verse has b COM_GETBIBLE_VERSE_VERSION_LABEL="Version" COM_GETBIBLE_VERSION="Version" COM_GETBIBLE_WEBSITE="Website" -COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION="Without selecting the correct favourite verse, you can't perform the initial action." +COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSEBR_YOU_CANT_PERFORM_THE_INITIAL_ACTION="Without selecting the correct favourite verse,
you can't perform the initial action." COM_GETBIBLE_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS="You are currently viewing the trashed items." COM_GETBIBLE_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT="You are currently viewing the trash area, and you don't have any items in trash at the moment!" COM_GETBIBLE_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA="You can directly download the latest update, or use the Joomla update area." diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 408b7b7..23f4b0b 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -211,7 +211,7 @@ class GetbibleModelAjax extends ListModel Factory::_('Gitea.Repository.Wiki')->load_('https://git.vdm.dev', $token); // get the gitea wiki page im markdown - $wiki = Factory::_('Gitea.Repository.Wiki')->get('getBible', 'joomla-component', $name); + $wiki = Factory::_('Gitea.Repository.Wiki')->get('getBible', 'support', $name); // now render the page in HTML $page = Factory::_('Gitea.Miscellaneous.Markdown')->render($wiki->content, true); diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 95b0986..c890a51 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -443,4 +443,69 @@ CREATE TABLE IF NOT EXISTS `#__getbible_verse` ( KEY `idx_state` (`published`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; +-- +-- Dumping data for table `#__getbible_tag` +-- + +INSERT INTO `#__getbible_tag` (`id`, `access`, `description`, `guid`, `name`, `published`, `created`) VALUES +(1, 1, 'Understanding unfaithfulness in marriage.', 'a1d263b6-3848-4ac1-92e8-df7c2b78c649', 'Adultery', 1, '2015-07-16 17:49:49'), +(2, 1, 'Exploring reasons for believing in the Bible.', 'b5fb8c11-c3df-4925-92e8-df7c2b78c649', 'Authority of the Bible', 1, '2015-07-14 15:35:40'), +(3, 1, '', '8f6d2789-7ecf-4769-87b7-af564b59f7d5', 'Baptism', 1, '2015-07-16 17:41:24'), +(4, 1, 'Understanding the biblical definition of love.', '6493a897-755a-4b6c-8b7e-ff8b12d3e9c0', 'Biblical Love', 1, '2015-07-14 06:11:55'), +(5, 1, 'Exploring the concept of blessings and curses.', '17df4ce3-289a-4920-b96e-65f64932b9c1', 'Blessings & Curses', 1, '2015-07-15 17:20:13'), +(6, 1, 'Guidance on modesty and decency in attire.', '04c7f6b3-17df-4f69-9a1a-bec6913a4b0f', 'Christian Clothing', 1, '2015-07-14 12:15:12'), +(7, 1, 'Roles and positions held within the structure of the church.', '54df67b4-fd6c-4bb3-bc8a-81b4a52c1843', 'Christian Offices', 1, '2015-07-15 18:12:40'), +(8, 1, 'The consideration of the table of the Lord.', '5dfb8c11-6493-4bb3-96c1-f3a6b5c5f9f0', 'Communion', 1, '2015-01-24 03:02:47'), +(9, 1, '', '3dfdc8b8-6549-40d8-a8f1-65fa96329ab2', 'Conditional Security', 1, '2015-07-15 17:52:41'), +(10, 1, 'The correct understanding of relationships and courtship.', '755ae009-f9fa-4f69-8b5b-9c2b46a6cb85', 'Dating', 1, '2015-07-14 13:59:28'), +(11, 1, 'Exploring dietary rules and guidance.', '755ae009-8f6d-4fb6-9b5b-c6a6cb85f9f0', 'Dietary Guidance', 1, '2015-07-14 06:50:49'), +(12, 1, 'Understanding chastening or discipline.', 'e84a2c7a-f234-44c2-87b7-ff8b46d2f6e7', 'Discipline', 1, '2015-07-17 13:54:50'), +(13, 1, 'Exploring homeschooling.', 'f2346bc8-04c7-4f69-9a1a-bec6913a4b0f', 'Education', 1, '2015-07-14 11:53:11'), +(14, 1, '', '5dfb8c11-6493-4769-9a1b-bec6a6c5f7d5', 'Effective Prayer', 1, '2015-07-14 06:04:18'), +(15, 1, 'Exploring family size from a Christian perspective.', 'c3dfb8e7-d234-473b-8af1-f67394c5b1d3', 'Family Planning', 1, '2015-02-01 14:08:35'), +(16, 1, 'Exploring the observance of Sabbath or Sunday worship.', 'd2346fd5-e84a-43c6-94de-af432c2f0ab1', 'First Day', 1, '2015-07-17 13:36:30'), +(17, 1, 'Exploring the implications of insincere praise or flattery.', '39bcf6b7-44df-4077-8af1-81b4a5c63f19', 'Flattery', 1, '2015-07-14 06:01:43'), +(18, 1, 'Exploring the doctrine of free will.', '39bcf6b7-44df-473b-973e-af564b2f0ab1', 'Free Will', 1, '2015-07-14 12:59:51'), +(19, 1, 'Understanding God\'s righteous judgment against sin.', '5dfb8c11-6fd6-473b-973e-af564b2f0ab1', 'God\'s Judgement', 1, '2015-07-16 17:10:24'), +(20, 1, 'The unmerited favour and love given by God.', 'e84a2c7a-467b-46a8-973e-ff8b46d2f6e7', 'Grace', 1, '2015-07-14 05:06:40'), +(21, 1, 'Exploring the concept of church gatherings in homes.', 'c3dfb8e7-4ea8-4925-96c1-f3a621a4b9b0', 'Home Church', 1, '2015-07-17 13:18:40'), +(22, 1, 'Reflecting on God\'s immutability, His unchanging nature.', '44df4ce6-5e9f-4077-8af1-81b4a5c63f19', 'Immutability', 1, '2015-07-14 13:05:39'), +(23, 1, 'Exploring the divine nature of Jesus Christ.', '1a0ad6e8-35fa-4f2c-889f-9ca2b057bbf0', 'Jesus Christ\'s Deity', 1, '2015-01-16 14:23:26'), +(24, 1, 'Exploring the incarnation, Jesus being in the flesh.', 'e84a2c7a-f234-43c6-94de-af432c2f0ab1', 'Jesus Christ’s Humanity', 1, '2015-07-14 16:17:54'), +(25, 1, 'Exploring the biblical view of leadership.', '6493a897-7e2a-4bb3-96c1-f3a6b5c5f9f0', 'Leadership', 1, '2015-07-14 13:51:25'), +(26, 1, 'Hannah says life has no description.', '04c7f6b3-17df-4920-b96e-65f64932b9c1', 'Life', 1, '2015-12-03 23:26:31'), +(27, 1, 'Exploring what gives one a long life.', '17df4ce3-289a-437b-88d1-9c2b057ba1a0', 'Longevity', 1, '2015-07-14 12:32:43'), +(28, 1, 'Exploring the roles and responsibilities of men.', 'c3dfb8e7-d234-46a8-96c5-f3a6a6c5f9f0', 'Man\'s Role', 1, '2015-07-14 10:41:41'), +(29, 1, 'Beliefs and teachings on the sacrament of marriage.', 'b5fb8c11-dfb7-4fb6-aa4b-e982a12d3e9c', 'Marriage', 1, '2015-07-14 10:24:11'), +(30, 1, 'Understanding the destructive and harmful influence of music.', '44df4ce6-5dfb-473b-973e-af564b2f0ab1', 'Music’s Influence', 1, '2015-01-18 12:16:37'), +(31, 1, 'The correct motive to avoid company or fellowship.', '755ae009-8f6d-4769-9a1b-bec6a6c5f7d5', 'No Fellowship', 1, '2015-07-14 06:21:42'), +(32, 1, 'Understanding biblical goodness.', '6493a897-755a-4769-9a1b-bec6a6c5f7d5', 'No One is Good', 1, '2015-07-14 13:34:50'), +(33, 1, 'Exploring the concept of loving your enemy', '289ad6e8-39bc-473b-973e-af564b2f0ab1', 'Nonresistance', 1, '2017-10-09 05:27:08'), +(34, 1, '', '17df4ce3-289a-4077-8af1-81b4a5c63f19', 'Not Under the Law', 1, '2015-12-21 14:39:14'), +(35, 1, 'The importance of obeying God\'s laws.', 'd2346fd5-e84a-46a8-96c5-f3a6a6c5f9f0', 'Obey God\'s Commandments', 1, '2015-07-14 11:13:47'), +(36, 1, 'The duty to follow government laws.', '755ae009-8f6d-4b6c-8b7e-ff8b12d3e9c0', 'Obey Government Laws', 1, '2015-01-24 03:11:06'), +(37, 1, 'Grasping the omnipotence, the all-powerful nature of God.', '289ad6e8-2dfb-437b-88d1-9c2b057ba1a0', 'Omnipotence', 1, '2015-07-14 05:57:02'), +(38, 1, 'Acknowledging that God observes all, nothing is hidden from Him and His presence everywhere.', '17df4ce3-5db0-4f69-9b7e-87d2b5c63b19', 'Omnipresence', 1, '2015-07-14 05:49:52'), +(39, 1, 'Understanding God\'s omniscience, His all-knowing nature.', '04c7f6b3-14d8-44c2-89e4-57f6492a2e1c', 'Omniscience', 1, '2015-07-14 05:35:11'), +(40, 1, 'Understanding God\'s intended structure and order for the home.', '289ad6e8-39bc-4920-b96e-65f64932b9c1', 'Orderly Home', 1, '2015-07-14 12:50:03'), +(41, 1, '', 'a1d263b6-b5fb-473b-8af1-f67394c5b1d3', 'Prince of this World', 1, '2015-07-14 14:06:16'), +(42, 1, 'Exploring the doctrine of divine providence.', 'f2346bc8-1de2-43c6-94de-af432c2f0ab1', 'Providence', 1, '2015-07-14 16:40:53'), +(43, 1, 'The process of adopting a new mindset.', 'a1d263b6-b5fb-4fb6-9b5b-c6a6cb85f9f0', 'Renewing of the Mind', 1, '2015-01-25 09:17:28'), +(44, 1, 'The call for repentance as a key message.', '44df4ce6-5dfb-4bb3-96c1-f3a6b5c5f9f0', 'Repentance', 1, '2015-01-23 16:10:21'), +(45, 1, 'Salvation through belief and trust in Jesus Christ.', '41df4ce6-efd0-4077-85ef-78f3b5c62f19', 'Saved by Faith', 1, '2017-10-09 05:27:31'), +(46, 1, 'Exploring the biblical perspective on homosexuality.', 'd2346fd5-3fe2-473b-8bf4-f67394c5b1d3', 'Sodomy', 1, '2015-02-01 14:25:22'), +(47, 1, 'Exploring the prophecies concerning Jesus.', '289ad6e8-39bc-4077-8af1-81b4a5c63f19', 'Spirit of Prophecy', 1, '2015-07-15 17:33:42'), +(48, 1, 'Spiritual gifts as recognized and utilized in the church.', '6493a897-fefb-4d3b-a4b9-96c5ab5932a3', 'Spiritual Gifts', 1, '2015-07-16 17:35:10'), +(49, 1, 'Exploring judgement and discernment.', '8f6d2789-a1d2-4fb6-9b5b-c6a6cb85f9f0', 'Spiritual Judgement', 1, '2015-01-24 03:35:28'), +(50, 1, 'Exploring the concept of spiritual rebirth.', '8f6d2789-a1d2-4925-92e8-df7c2b78c649', 'Spiritual Rebirth', 1, '2015-01-24 03:20:24'), +(51, 1, 'Understanding temptation and strategies for overcoming it.', '04c7f6b3-17df-437b-88d1-9c2b057ba1a0', 'Temptation', 1, '2015-07-15 17:08:23'), +(52, 1, 'Exploring the use of wine.', '9eb76f94-32c7-4b6c-9a1a-bec6913a4b0f', 'Wine ', 1, '2015-07-14 10:03:17'), +(53, 1, 'Exploring what leads to or fosters wisdom.', 'f2346bc8-04c7-437b-88d1-9c2b057ba1a0', 'Wisdom Cause', 1, '2015-07-14 05:18:55'), +(54, 1, 'Understanding the outcomes or fruits of wisdom.', 'd2346fd5-e84a-44c2-87b7-ff8b46d2f6e7', 'Wisdom Fruit', 1, '2015-07-14 15:59:50'), +(55, 1, 'Exploring the origin and source of wisdom.', 'c3dfb8e7-d234-43c6-94de-af432c2f0ab1', 'Wisdom Origin', 1, '2015-07-14 15:39:01'), +(56, 1, 'Understanding the importance and worth of wisdom.', 'e84a2c7a-f234-4f69-9a1a-bec6913a4b0f', 'Wisdom Value', 1, '2015-07-14 11:45:23'), +(57, 1, 'Exploring the roles and responsibilities of women.', 'b5fb8c11-c3df-473b-8af1-f67394c5b1d3', 'Woman\'s Role', 1, '2015-07-16 18:01:45'), +(58, 1, 'Exploring God\'s spoken word.', '20bcf6b7-48db-4c20-b6cf-49d032f15c41', 'Word of God', 1, '2015-01-16 13:39:05'), +(59, 1, 'Exploring the concept of worldly wisdom.', 'b5fb8c11-c3df-46a8-96c5-f3a6a6c5f9f0', 'Worldly Wisdom', 1, '2015-01-25 10:15:36'); + diff --git a/admin/sql/updates/mysql/2.0.4.sql b/admin/sql/updates/mysql/2.0.4.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/admin/sql/updates/mysql/2.0.4.sql @@ -0,0 +1 @@ + diff --git a/getbible.xml b/getbible.xml index bcb6228..11f4ce6 100644 --- a/getbible.xml +++ b/getbible.xml @@ -1,15 +1,15 @@ COM_GETBIBLE - 26th July, 2023 + 28th July, 2023 Llewellyn van der Merwe joomla@vdm.io 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.4 + 2.0.5 Get Bible (v.2.0.4) +

Get Bible (v.2.0.5)

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/Linker.php b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Linker.php index ec68777..719fdc8 100644 --- a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Linker.php +++ b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Linker.php @@ -149,6 +149,33 @@ final class Linker return null; } + /** + * Get active Linker details + * + * @param bool $setup The setup switch + * + * @return array|null Linker details + * @since 2.0.1 + **/ + public function activeDetails(bool $setup = true): ?array + { + if (($linker = $this->active($setup)) !== null) + { + // check if this is a valid linker (already set) + if (($name = $this->load->value( + ['guid' => $linker, 'published' => 1], + 'name', 'linker' + )) !== null) + { + return ['guid' => $linker, 'name' => $name, 'share' => $this->share()]; + } + + return ['guid' => $linker, 'name' => null, 'share' => null]; + } + + return null; + } + /** * Check if a Linker is valid active linker * @@ -211,6 +238,75 @@ final class Linker return true; } + /** + * Revoke Linker Session + * + * @param string $linker The linker GUID value + * + * @return array|null The success or error details + * @since 2.0.1 + **/ + public function revokeSession(string $linker): ?array + { + // linker not valid GUID + if (!GuidHelper::valid($linker)) + { + // hmm we can log this + return [ + 'error' => Text::_('COM_GETBIBLE_ACCESS_REVOKED') + ]; + } + + if (($access = $this->session->get('getbible_active_linker_guid', null)) === null + || $access !== $linker) + { + // hmm we can log this + return [ + 'success' => Text::_('COM_GETBIBLE_ACCESS_REVOKED') + ]; + } + + $this->session->set('getbible_active_linker_guid', null); + + return [ + 'success' => Text::_('COM_GETBIBLE_ACCESS_REVOKED') + ]; + } + + /** + * Set a linker name + * + * @param string $name The linker name + * + * @return array|null Array on success + * @since 2.0.1 + **/ + public function setName(string $name): ?array + { + // make sure the linker has access + if (($linker = $this->get()) === null) + { + return [ + 'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSEBR_YOU_CANT_PERFORM_THE_INITIAL_ACTION"), + 'access_required' => true + ]; + } + + // set the name of this linker + if (!$this->update->value($name, 'name', $linker, 'guid', 'linker')) + { + return [ + 'error' => Text::_('COM_GETBIBLE_THE_NAME_COULD_NOT_BE_UPDATED') + ]; + } + + return [ + 'guid' => $linker, + 'name' => $name, + 'success' => Text::_('COM_GETBIBLE_THE_NAME_HAS_BEEN_UPDATED') + ]; + } + /** * Set Access * @@ -308,6 +404,41 @@ final class Linker return (array) $_linker; } + /** + * Revoke Access + * + * @param string $linker The linker GUID value + * + * @return array|null The success or error details + * @since 2.0.1 + **/ + public function revoke(string $linker): ?array + { + // linker not valid GUID + if (!GuidHelper::valid($linker)) + { + // hmm we can log this + return [ + 'success' => Text::_('COM_GETBIBLE_ACCESS_REVOKED') + ]; + } + + if (($access = $this->session->get("getbible_active_{$linker}", null)) === null + || $access !== 'valid_access') + { + // hmm we can log this + return [ + 'success' => Text::_('COM_GETBIBLE_ACCESS_REVOKED') + ]; + } + + $this->session->set("getbible_active_{$linker}", null); + + return [ + 'success' => Text::_('COM_GETBIBLE_ACCESS_REVOKED') + ]; + } + /** * Has Access * diff --git a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Note.php b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Note.php index b51a050..c2932dd 100644 --- a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Note.php +++ b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Note.php @@ -103,7 +103,7 @@ final class Note if (($linker = $this->linker->get()) === null) { return [ - 'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION"), + 'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSEBR_YOU_CANT_PERFORM_THE_INITIAL_ACTION"), 'access_required' => true ]; } diff --git a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Tag.php b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Tag.php index b2fb49a..61e343a 100644 --- a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Tag.php +++ b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Tag.php @@ -95,7 +95,7 @@ final class Tag if (($linker = $this->linker->get()) === null) { return [ - 'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION"), + 'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSEBR_YOU_CANT_PERFORM_THE_INITIAL_ACTION"), 'access_required' => true ]; } diff --git a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Tagged.php b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Tagged.php index 41f9deb..64416ea 100644 --- a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Tagged.php +++ b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Tagged.php @@ -131,7 +131,7 @@ final class Tagged if (($linker = $this->linker->get()) === null) { return [ - 'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION"), + 'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSEBR_YOU_CANT_PERFORM_THE_INITIAL_ACTION"), 'access_required' => true ]; } @@ -187,7 +187,7 @@ final class Tagged if (($linker = $this->linker->get()) === null) { return [ - 'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION"), + 'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSEBR_YOU_CANT_PERFORM_THE_INITIAL_ACTION"), 'access_required' => true ]; } diff --git a/script.php b/script.php index 3dc4dc4..731e09f 100644 --- a/script.php +++ b/script.php @@ -1539,7 +1539,7 @@ class com_getbibleInstallerScript echo ' -

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

'; +

Upgrade to Version 2.0.5 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/assets/js/app.js b/site/assets/js/app.js index a925fe7..f9ee252 100644 --- a/site/assets/js/app.js +++ b/site/assets/js/app.js @@ -116,31 +116,285 @@ class ScrollMemory { this.div.addEventListener('scroll', () => this.saveScrollPosition()); } } + +class DatabaseManager { + #dbName; + #storeName; + #fields; + #db; + #uniqueFields; + #isReady = false; + #readyPromise = null; + #data = JSON.parse(localStorage.getItem(this.#storeName)) || []; + constructor(dbName, storeName, fields) { + this.#dbName = dbName; + this.#storeName = storeName; + this.#fields = fields; + this.#uniqueFields = fields.filter((field) => field[1]).map((field) => field[0]); + + if (window.indexedDB) { + this.#readyPromise = this.#openDB().then(() => { + this.#isReady = true; + }); + } else { + this.#isReady = true; + } + } + #openDB = () => { + return new Promise((resolve, reject) => { + const request = window.indexedDB.open(this.#dbName); + request.onerror = (e) => { + console.log('Error opening db', e); + reject('Error'); + }; + request.onsuccess = (e) => { + this.#db = e.target.result; + resolve(); + }; + request.onupgradeneeded = (e) => { + let db = e.target.result; + let store = db.createObjectStore(this.#storeName, { autoIncrement: true, keyPath: 'id' }); + this.#uniqueFields.forEach((field) => { + store.createIndex(field, field, { unique: true }); + }); + }; + }); + } + #waitUntilReady = () => { + return this.#isReady ? Promise.resolve() : this.#readyPromise; + } + #saveToLocalStorage = () => { + localStorage.setItem(this.#storeName, JSON.stringify(this.#data)); + } + async set(data) { + return this.#waitUntilReady().then(() => { + if (!this.#db) { + let existingItem = this.#data.find((item) => this.#uniqueFields.some((field) => item[field] === data[field])); + if (existingItem) { + Object.assign(existingItem, data); + } else { + this.#data.push(data); + } + this.#saveToLocalStorage(); + } else { + const transaction = this.#db.transaction([this.#storeName], 'readwrite'); + const store = transaction.objectStore(this.#storeName); + this.#uniqueFields.forEach((field) => { + const index = store.index(field); + const getRequest = index.get(data[field]); + getRequest.onsuccess = () => { + const existingItem = getRequest.result; + if (existingItem) { + Object.assign(existingItem, data); + store.put(existingItem); + } else { + store.add(data); + } + }; + getRequest.onerror = (error) => { + console.log('Error getting data', error); + }; + }); + } + }); + } + async get(value, key, field = 'guid') { + return this.#waitUntilReady().then(() => { + if (!this.db) { + // If IndexedDB is not available, get value from local storage + const item = this.data.find(item => item[field] === value); + return item ? item[key] : undefined; + } else { + // If IndexedDB is available, get value from the database + return new Promise((resolve, reject) => { + let transaction = this.db.transaction([this.storeName], "readonly"); + let store = transaction.objectStore(this.storeName); + let request = store.index(field).get(value); + request.onsuccess = e => { + const item = e.target.result; + resolve(item ? item[key] : undefined); + }; + request.onerror = e => { + reject("Error", e.target.error); + }; + }); + } + }); + } + async item(value, field = 'guid') { + return this.#waitUntilReady().then(() => { + if (!this.#db) { + return this.#data.find((item) => item[field] === value); + } else { + return new Promise((resolve, reject) => { + const transaction = this.#db.transaction([this.#storeName], 'readonly'); + const store = transaction.objectStore(this.#storeName); + const index = store.index(field); + const getRequest = index.get(value); + getRequest.onsuccess = () => { + resolve(getRequest.result); + }; + getRequest.onerror = (error) => { + reject('Error', error.target.error); + }; + }); + } + }); + } + async all() { + return this.#waitUntilReady().then(() => { + if (!this.#db) { + return this.#data; + } else { + return new Promise((resolve, reject) => { + const transaction = this.#db.transaction([this.#storeName], 'readonly'); + const store = transaction.objectStore(this.#storeName); + const getAllRequest = store.getAll(); + getAllRequest.onsuccess = () => { + resolve(getAllRequest.result); + }; + getAllRequest.onerror = (error) => { + reject('Error', error.target.error); + }; + }); + } + }); + } + async remove(value, field = 'guid') { + return this.#waitUntilReady().then(() => { + if (!this.#db) { + // Handle removal from localStorage + this.#data = this.#data.filter(item => item[field] !== value); + this.#saveToLocalStorage(); + return Promise.resolve(); + } else { + // Handle removal from IndexedDB + return new Promise((resolve, reject) => { + const transaction = this.#db.transaction([this.#storeName], 'readwrite'); + const store = transaction.objectStore(this.#storeName); + let index = store.index(field); + let request = index.openCursor(IDBKeyRange.only(value)); + request.onsuccess = e => { + let cursor = e.target.result; + if (cursor) { + cursor.delete(); // delete the record + resolve(); + } else { + reject("Error: No record found for the provided field and value"); + } + }; + request.onerror = e => { + reject("Error", e.target.error); + }; + }); + } + }); + } +} +/** + * JS to setup the Linker DB + */ +const linkerManager = new DatabaseManager( + 'getBible', + 'linkers', + [['name', false], ['guid', true], ['password', false], ['share', false]] +); +/** + * JS to setup the Settings DB + */ +const settingsManager = new DatabaseManager( + 'getBible', + 'settings', + [['feature', true], ['value', false], ['default', false]] +); /** * JS Function to set Share His Word url */ const setShareHisWordUrl = async (linker, translation, book, chapter) => { // Make a request to your endpoint const response = await fetch(getShareHisWordUrl(linker, translation, book, chapter)); - // Wait for the server to return the response, then parse it as JSON. const data = await response.json(); - if (data.url || data.error) { return data; // return the data object on success } else { throw new Error(data); // throw an error if the request was not successful } }; +/** + * JS Function get the linker ul list display + */ +const getLinkersDisplay = async (linkers) => { + try { + // Convert linkers data to a JSON string + let linkersJson = JSON.stringify(linkers); + // build form + const formData = new FormData(); + // add the form data + formData.set('linkers', linkersJson); + let options = { + method: 'POST', + body: formData + } + // Make a request to your endpoint + const response = await fetch(getLinkersDisplayURL(), options); + // Wait for the server to return the response, then parse it as JSON. + const data = await response.json(); + // Call another function after the response has been received + if (data.display) { + // Show success message + document.getElementById('getbible-sessions-linker-details').innerHTML = data.display; + } else { + // Handle any errors + console.error("Error occurred: ", data); + } + } catch (error) { + // Handle any errors + console.error("Error occurred: ", error); + } +}; /** * JS Function to check if we have a valid linker key */ const checkValidLinker = async (linker, oldLinker) => { // Make a request to your endpoint const response = await fetch(getCheckValidLinkerUrl(linker, oldLinker)); - // Wait for the server to return the response, then parse it as JSON. const data = await response.json(); + if (data.success || data.error) { + return data; // return the data object on success + } else { + throw new Error(data); // throw an error if the request was not successful + } +}; +/** + * JS Function to set the linker session value + */ +const setLinker = async (linker) => { + // Make a request to your endpoint + const response = await fetch(getSetLinkerURL(linker)); + // Wait for the server to return the response, then parse it as JSON. + const data = await response.json(); + if (data.success || data.error) { + return data; // return the data object on success + } else { + throw new Error(data); // throw an error if the request was not successful + } +}; +/** + * JS Function to revoke linker session + */ +const revokeLinkerSession = async (linker) => { + // build form + const formData = new FormData(); + // add the form data + formData.set('linker', linker); + let options = { + method: 'POST', + body: formData + } + const response = await fetch(revokeLinkerSessionURL(), options); + const data = await response.json(); if (data.success || data.error) { return data; // return the data object on success @@ -148,6 +402,114 @@ const checkValidLinker = async (linker, oldLinker) => { throw new Error(data); // throw an error if the request was not successful } }; +/** + * JS Function to set the linker pass value + */ +const setLinkerAccess = async (linker, pass, oldPass = '') => { + // build form + const formData = new FormData(); + // add the form data + formData.set('linker', linker); + formData.set('pass', pass); + formData.set('old', oldPass); + let options = { + method: 'POST', + body: formData + } + const response = await fetch(getSetLinkerAccessURL(), options); + const data = await response.json(); + + if (data.success || data.error) { + return data; // return the data object on success + } else { + throw new Error(data); // throw an error if the request was not successful + } +}; +/** + * JS Function to revoke linker access + */ +const revokeLinkerAccess = async (linker) => { + // build form + const formData = new FormData(); + // add the form data + formData.set('linker', linker); + let options = { + method: 'POST', + body: formData + } + const response = await fetch(revokeLinkerAccessURL(), options); + const data = await response.json(); + + if (data.success || data.error) { + return data; // return the data object on success + } else { + throw new Error(data); // throw an error if the request was not successful + } +}; +/** + * JS Function to set the linker pass value + */ +const setLinkerName = async (name) => { + try { + // build form + const formData = new FormData(); + // add the form data + formData.set('name', name); + let options = { + method: 'POST', + body: formData + } + const response = await fetch(setLinkerNameURL(), options); + // Wait for the server to return the response, then parse it as JSON. + const data = await response.json(); + // Call another function after the response has been received + if (data.success) { + // Show success message + UIkit.notification({ + message: data.success, + status: 'success', + timeout: 5000 + }); + let linker = getLocalMemory('getbible_active_linker_guid', null); + if (linker) { + let fieldName = document.getElementById('get-session-name-' + linker); + if (fieldName) { + fieldName.value = name; + } + } + } else if (data.access_required && data.error) { + setupGetBibleAccess( + null, + data.error, + setLinkerName, + [name] + ); + } else { + // Handle any errors + console.error("Error occurred: ", data); + } + } catch (error) { + // Handle any errors + console.error("Error occurred: ", error); + } +}; +/** + * JS Function to set the active linker on the page + */ +const setActiveLinkerOnPage = async (guid) => { + // Get all elements with the class name 'getbible-linker-guid-value' + let values = document.getElementsByClassName('getbible-linker-guid-value'); + let inputs = document.getElementsByClassName('getbible-linker-guid-input'); + // Update the 'textContent' of each value display + for (let i = 0; i < values.length; i++) { + values[i].textContent = guid; + } + // Update the 'value' of each input area + for (let i = 0; i < inputs.length; i++) { + inputs[i].value = guid; + } +} + /** * JS Function to set the search url */ @@ -198,7 +560,6 @@ const setOpenaiUrl = async (ids, guid, words, verse, chapter, book, translation) console.error("Error occurred: ", error); } }; - /** * JS Function to update the url */ @@ -208,75 +569,6 @@ const updateUrl = (id, url) => { button.href = url; } } - -/** - * JS Function to set the linker session value - */ -const setLinker = async (linker) => { - try { - // Make a request to your endpoint - const response = await fetch(getSetLinkerURL(linker)); - - // Wait for the server to return the response, then parse it as JSON. - const data = await response.json(); - - // Call another function after the response has been received - if (data.success) { - console.log(linker, data.success); - } else { - // Handle any errors - console.error("Error occurred: ", data); - } - } catch (error) { - // Handle any errors - console.error("Error occurred: ", error); - } -}; - -/** - * JS Function to set the linker pass value - */ -const setLinkerAccess = async (linker, pass, oldPass = '') => { - // build form - const formData = new FormData(); - - // add the form data - formData.set('linker', linker); - formData.set('pass', pass); - formData.set('old', oldPass); - - let options = { - method: 'POST', - body: formData - } - - const response = await fetch(getSetLinkerAccessURL(), options); - const data = await response.json(); - - if (data.success || data.error) { - return data; // return the data object on success - } else { - throw new Error(data); // throw an error if the request was not successful - } -}; - -/** - * JS Function to set the active linker on the page - */ -const setActiveLinkerOnPage = async (guid) => { - // Get all elements with the class name 'getbible-linker-guid-value' - let values = document.getElementsByClassName('getbible-linker-guid-value'); - let inputs = document.getElementsByClassName('getbible-linker-guid-input'); - // Update the 'textContent' of each value display - for (let i = 0; i < values.length; i++) { - values[i].textContent = guid; - } - // Update the 'value' of each input area - for (let i = 0; i < inputs.length; i++) { - inputs[i].value = guid; - } -} - /** * JS Function to set a note */ @@ -284,24 +576,19 @@ const setNote = async (book, chapter, verse, note) => { try { // build form const formData = new FormData(); - // add the form data formData.set('book', book); formData.set('chapter', chapter); formData.set('verse', verse); formData.set('note', note); - let options = { method: 'POST', body: formData } - // Make a request to your endpoint const response = await fetch(getSetNoteURL(), options); - // Wait for the server to return the response, then parse it as JSON. const data = await response.json(); - // Call another function after the response has been received if (data.success) { // Show success message @@ -332,7 +619,6 @@ const setNote = async (book, chapter, verse, note) => { console.error("Error occurred: ", error); } }; - /** * JS Function to set a tag */ @@ -340,10 +626,8 @@ const setTag = async (name) => { try { // Make a request to your endpoint const response = await fetch(getSetTagURL(name)); - // Wait for the server to return the response, then parse it as JSON. const data = await response.json(); - // Call another function after the response has been received if (data.success) { // Show success message @@ -375,7 +659,6 @@ const setTag = async (name) => { console.error("Error occurred: ", error); } }; - /** * JS Function to set a tag to a verse */ @@ -383,10 +666,8 @@ const tagVerse = async (translation, book, chapter, verse, tag) => { try { // Make a request to your endpoint const response = await fetch(getTagVerseURL(translation, book, chapter, verse, tag)); - // Wait for the server to return the response, then parse it as JSON. const data = await response.json(); - // Call another function after the response has been received if (data.success) { // So success message @@ -428,10 +709,8 @@ const removeTagFromVerse = async (tag, verse) => { try { // Make a request to your endpoint const response = await fetch(getRemoveTagFromVerseURL(tag)); - // Wait for the server to return the response, then parse it as JSON. const data = await response.json(); - // Call another function after the response has been received if (data.success) { // Show success message @@ -476,31 +755,27 @@ const removeTagFromVerse = async (tag, verse) => { console.error("Error occurred: ", error); } }; - /** * JS Function to set get Bible access */ const setupGetBibleAccess = async (active_modal, error_message, callback, args) => { // close the active modal - UIkit.modal('#' + active_modal).hide(); + if (active_modal !== null) { + UIkit.modal('#' + active_modal).hide(); + } try { - let modal = UIkit.modal('#getbible_favourite_verse_selector'); - modal.show(); - // get linker + // get old linker let linker_old = getLocalMemory('getbible_active_linker_guid'); // Wait for the modal to be closed - await new Promise(resolve => { - // The 'hidden' event is triggered when the modal is closed - UIkit.util.on(modal.$el, 'hidden', function() { - resolve(); - }); - }); - // get linker + await setGetBibleFavouriteVerse(); + // get new linker let linker = getLocalMemory('getbible_active_linker_guid'); - let pass = getLocalMemory(linker); + let pass = getLocalMemory(linker + '-validated'); // check if access was set if (pass) { - UIkit.modal('#' + active_modal).show(); + if (active_modal !== null) { + UIkit.modal('#' + active_modal).show(); + } // we should reload the page if a new linker was set if (linker_old !== linker) { triggerGetBibleReload = true; @@ -515,11 +790,14 @@ const setupGetBibleAccess = async (active_modal, error_message, callback, args) }); } } catch (error) { - // Handle any errors - console.error("Error occurred: ", error); + // Show message + UIkit.notification({ + message: error_message, + status: 'warning', + timeout: 5000 + }); } }; - /** * JS Function to create an tag div item */ @@ -531,19 +809,15 @@ const createGetbileTagDivItem = (id, verse, name, url, tagged = null, ) => { if (tagged !== null) { itemElement.dataset.tagged = tagged; } - let marginDiv = document.createElement('div'); marginDiv.className = 'uk-margin'; - let cardDiv = document.createElement('div'); cardDiv.className = 'uk-card uk-card-default uk-card-body uk-card-small'; - // Create handle span let handleSpan = document.createElement('span'); handleSpan.className = 'uk-sortable-handle uk-margin-small-right uk-text-center'; handleSpan.setAttribute('uk-icon', 'move'); handleSpan.insertAdjacentText('beforeend', name + ' '); - // Create view icon let viewIcon = document.createElement('a'); viewIcon.href = url; @@ -553,17 +827,13 @@ const createGetbileTagDivItem = (id, verse, name, url, tagged = null, ) => { viewIcon.onclick = (event) => { event.stopPropagation(); }; - // Append view icon and name to cardDiv cardDiv.appendChild(handleSpan); cardDiv.appendChild(viewIcon); - marginDiv.appendChild(cardDiv); itemElement.appendChild(marginDiv); - return itemElement; }; - /** * JS Function to clear content from its parent div */ diff --git a/site/controllers/ajax.json.php b/site/controllers/ajax.json.php index f308bfe..de2c5f3 100644 --- a/site/controllers/ajax.json.php +++ b/site/controllers/ajax.json.php @@ -42,11 +42,15 @@ class GetbibleControllerAjax extends BaseController $this->registerTask('getAppUrl', 'ajax'); $this->registerTask('setLinker', 'ajax'); $this->registerTask('setLinkerAccess', 'ajax'); + $this->registerTask('revokeLinkerSession', 'ajax'); + $this->registerTask('revokeLinkerAccess', 'ajax'); + $this->registerTask('setLinkerName', 'ajax'); $this->registerTask('setNote', 'ajax'); $this->registerTask('tagVerse', 'ajax'); $this->registerTask('removeTagFromVerse', 'ajax'); $this->registerTask('setTag', 'ajax'); $this->registerTask('removeTag', 'ajax'); + $this->registerTask('getLinkersDisplay', 'ajax'); $this->registerTask('getSearchUrl', 'ajax'); $this->registerTask('getOpenaiURL', 'ajax'); } @@ -327,6 +331,129 @@ class GetbibleControllerAjax extends BaseController } } break; + case 'revokeLinkerSession': + try + { + $linkerValue = $jinput->get('linker', NULL, 'STRING'); + if($linkerValue) + { + $result = $this->getModel('ajax')->revokeLinkerSession($linkerValue); + } + else + { + $result = false; + } + if($callback) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback) + { + echo $callback."(".json_encode($e).");"; + } + elseif($returnRaw) + { + echo json_encode($e); + } + else + { + echo "(".json_encode($e).");"; + } + } + break; + case 'revokeLinkerAccess': + try + { + $linkerValue = $jinput->get('linker', NULL, 'STRING'); + if($linkerValue) + { + $result = $this->getModel('ajax')->revokeLinkerAccess($linkerValue); + } + else + { + $result = false; + } + if($callback) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback) + { + echo $callback."(".json_encode($e).");"; + } + elseif($returnRaw) + { + echo json_encode($e); + } + else + { + echo "(".json_encode($e).");"; + } + } + break; + case 'setLinkerName': + try + { + $nameValue = $jinput->get('name', NULL, 'STRING'); + if($nameValue) + { + $result = $this->getModel('ajax')->setLinkerName($nameValue); + } + else + { + $result = false; + } + if($callback) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback) + { + echo $callback."(".json_encode($e).");"; + } + elseif($returnRaw) + { + echo json_encode($e); + } + else + { + echo "(".json_encode($e).");"; + } + } + break; case 'setNote': try { @@ -539,6 +666,47 @@ class GetbibleControllerAjax extends BaseController } } break; + case 'getLinkersDisplay': + try + { + $linkersValue = $jinput->get('linkers', NULL, 'STRING'); + if($linkersValue) + { + $result = $this->getModel('ajax')->getLinkersDisplay($linkersValue); + } + else + { + $result = false; + } + if($callback) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback) + { + echo $callback."(".json_encode($e).");"; + } + elseif($returnRaw) + { + echo json_encode($e); + } + else + { + echo "(".json_encode($e).");"; + } + } + break; case 'getSearchUrl': try { diff --git a/site/language/en-GB/en-GB.com_getbible.ini b/site/language/en-GB/en-GB.com_getbible.ini index 12d4163..a073257 100644 --- a/site/language/en-GB/en-GB.com_getbible.ini +++ b/site/language/en-GB/en-GB.com_getbible.ini @@ -2,7 +2,11 @@ COM_CONTENT_FIELD_MODIFIED_DESC="The last date this item was modified." COM_GETBIBLE="Get Bible" COM_GETBIBLE_ABBREVIATION="Abbreviation" COM_GETBIBLE_ACCESS_ALREADY_EXIST_BUT_COULD_NOT_BE_REACTIVATED="Access already exist, but could not be reactivated." +COM_GETBIBLE_ACCESS_REVOKED="Access revoked." COM_GETBIBLE_ACTIVE="Active" +COM_GETBIBLE_ACTIVE_PERSISTENT_SESSION="Active Persistent Session:" +COM_GETBIBLE_ACTIVE_PERSISTENT_SESSION_WAS_NOT_REMOVED="Active persistent session was not removed." +COM_GETBIBLE_ACTIVE_PERSISTENT_SESSION_WAS_REMOVED="Active persistent session was removed." COM_GETBIBLE_ACTIVE_TAG="Active Tag" COM_GETBIBLE_ADD="Add" COM_GETBIBLE_ADD_YOUR_NOTES_HERE="add your notes here..." @@ -33,7 +37,6 @@ COM_GETBIBLE_CHAPTER="Chapter" COM_GETBIBLE_CHAPTERS="Chapters" COM_GETBIBLE_COMPLETION_TOKENS="Completion Tokens" COM_GETBIBLE_COPY="Copy" -COM_GETBIBLE_COPY_SESSION_LINK="Copy Session Link" COM_GETBIBLE_CREATED="Created" COM_GETBIBLE_CREATE_NEW_S="Create New %s" COM_GETBIBLE_DAILY_VERSE="Daily Verse" @@ -46,6 +49,7 @@ COM_GETBIBLE_DRAG_AND_DROP_THE_DESIRED_TAG_FROM_THE_AVAILABLE_ONES_TO_THE_ACTIVE COM_GETBIBLE_EDIT_NOTE="Edit note" COM_GETBIBLE_EDIT_S="Edit %s" COM_GETBIBLE_EMPTY="Empty" +COM_GETBIBLE_ENABLE_EXCLUSIVE_ACCESS_TO_EDIT_YOUR_NOTES_AND_TAGS="Enable exclusive access to edit your notes and tags." COM_GETBIBLE_ENCODING="Encoding" COM_GETBIBLE_EXACT="Exact" COM_GETBIBLE_EXACT_MATCH="Exact Match" @@ -63,9 +67,10 @@ COM_GETBIBLE_FREQUENCY_PENALTY="Frequency Penalty" COM_GETBIBLE_HEADERS="Headers" COM_GETBIBLE_HELLO_S="Hello %s" COM_GETBIBLE_HIDE="Hide" -COM_GETBIBLE_HOWEVER_TO_MODIFY_YOUR_SPAN_CLASSGETBIBLEACTIVITYNOTESANDTAGSNOTES_AND_TAGSSPAN_YOU_NEED_BOTH_THE_SESSION_KEY_AND_YOUR_FAVOURITE_VERSE="However, to modify your notes and tags, you need both the session key and your favourite verse." +COM_GETBIBLE_HOWEVER_TO_MODIFY_YOUR_SPAN_CLASSGETBIBLEACTIVITYNOTESANDTAGSNOTES_AND_TAGSSPAN_YOU_NEED_BOTH_THE_PERSISTENT_SESSION_KEY_AND_YOUR_FAVOURITE_VERSE="However, to modify your notes and tags, you need both the persistent session key and your favourite verse." COM_GETBIBLE_HOW_THIS_ALL_WORKS="How This All Works" COM_GETBIBLE_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BGETBIBLEB_WILL_NOT_FUNCTION_CORRECTLYP="

Curl Not Found!

Please setup curl on your system, or getbible will not function correctly!

" +COM_GETBIBLE_IF_YOU_SWITCH_FROM_YOUR_ACTIVE_SESSION_TO_A_SHARED_ONE_YOUR_ORIGINAL_SESSION_WILL_BE_PRESERVED_HERE_FOR_EASY_ACCESS="If you switch from your active session to a shared one, your original session will be preserved here for easy access." COM_GETBIBLE_INCORRECT_FAVOURITE_VERSE_SELECTED="Incorrect favourite verse selected." COM_GETBIBLE_INSENSITIVE="Insensitive" COM_GETBIBLE_INSTALL="Install" @@ -76,7 +81,9 @@ COM_GETBIBLE_LABEL="Label" COM_GETBIBLE_LAYOUT="Layout" COM_GETBIBLE_LICENSE="License" COM_GETBIBLE_LINK="Link" -COM_GETBIBLE_LOAD_PREVIOUS_SESSION="Load Previous Session" +COM_GETBIBLE_LOAD="Load" +COM_GETBIBLE_LOADING="Loading" +COM_GETBIBLE_LOAD_PREVIOUS_PERSISTENT_SESSION="Load Previous Persistent Session" COM_GETBIBLE_MARKDOWN="Markdown" COM_GETBIBLE_MATCH="Match" COM_GETBIBLE_MAX_TOKENS="Max Tokens" @@ -111,6 +118,7 @@ COM_GETBIBLE_PARTIAL="Partial" COM_GETBIBLE_PARTIAL_MATCH="Partial Match" COM_GETBIBLE_PASSWORD_TO_SHORT_USE_A_LONGER_PASSWORD="Password to short, use a longer password." COM_GETBIBLE_PERFORMING_MULTIPLE_INSTALLATIONS_WILL_NOT_CAUSE_ANY_DUPLICATES_OR_DATA_CLUTTER_THE_SYSTEM_INTELLIGENTLY_RECOGNIZES_ALREADY_INSTALLED_PARTS_AND_MERELY_REFRESHES_THEM_TO_VERIFY_THAT_THEY_ARE_IN_SYNC_WITH_THE_ORIGINAL_SOURCE="Performing multiple installations will not cause any duplicates or data clutter. The system intelligently recognizes already installed parts and merely refreshes them to verify that they are in sync with the original source." +COM_GETBIBLE_PERSISTENT_SESSION_KEY="Persistent Session Key" COM_GETBIBLE_PER_LINE="Per Line" COM_GETBIBLE_PLAIN_TEXT="Plain Text" COM_GETBIBLE_PLEASE_KEEP_YOUR_FAVOURITE_VERSE_PRIVATE="Please Keep Your Favourite Verse Private" @@ -129,6 +137,7 @@ COM_GETBIBLE_REMOVE="Remove" COM_GETBIBLE_RESEARCH_THIS="Research this" COM_GETBIBLE_RESPONSE="Response" COM_GETBIBLE_RESPONSE_DETAILS="Response Details" +COM_GETBIBLE_REVOKE_EXCLUSIVE_ACCESS_TO_EDIT_YOUR_NOTES_AND_TAGS="Revoke exclusive access to edit your notes and tags." COM_GETBIBLE_SAVE="Save" COM_GETBIBLE_SCRIPTURE="Scripture" COM_GETBIBLE_SEARCH="Search" @@ -137,16 +146,21 @@ COM_GETBIBLE_SEARCH_OPTIONS="Search Options" COM_GETBIBLE_SEARCH_RESULTS="Search Results" COM_GETBIBLE_SELECT="Select" COM_GETBIBLE_SENSITIVE="Sensitive" +COM_GETBIBLE_SESSIONS="Sessions" COM_GETBIBLE_SESSION_KEY="Session Key" COM_GETBIBLE_SESSION_KEY_COULD_NOT_BE_STORED="Session key could not be stored." +COM_GETBIBLE_SESSION_NAME="Session Name" COM_GETBIBLE_SETTINGS="Settings" COM_GETBIBLE_SHARE="Share" COM_GETBIBLE_SHARE_LINK="Share Link" COM_GETBIBLE_SHARE_TEXT="Share Text" +COM_GETBIBLE_SHARE_YOUR_SESSION="Share Your Session" COM_GETBIBLE_SHARING_THE_WORD_OF_GOD_WITH_THE_WORLD="Sharing the Word of God with the world." COM_GETBIBLE_SHOULD_YOU_HAVE_BANOTHER_SESSION_KEYB_FROM_A_PREVIOUS_SESSION="Should you have another session key from a previous session." COM_GETBIBLE_SHOW="Show" COM_GETBIBLE_SOURCE="Source" +COM_GETBIBLE_STYLE="Style" +COM_GETBIBLE_STYLE_GO_HERE="Style go here" COM_GETBIBLE_TAB_NAME_PLACEHOLDERS="Tab Name Placeholders" COM_GETBIBLE_TAG="Tag" COM_GETBIBLE_TAGGED_VERSES="Tagged Verses" @@ -164,24 +178,27 @@ COM_GETBIBLE_THERE_WAS_AN_ERROR_PLEASE_RELOAD_YOUR_PAGE_AND_TRY_AGAIN="There was COM_GETBIBLE_THE_ACTIVE_VERSE_SELECTED_TEXT_SHOULD_LOAD_HERE="The active verse selected text should load here." COM_GETBIBLE_THE_CHAPTERS_OF_BOOKS_WAS_SUCCESSFULLY_INSTALLED_FOR_S_TRANSLATION="The chapter:%s of book:%s was successfully installed for %s translation." COM_GETBIBLE_THE_LINK_WAS_COPIED_TO_YOUR_CLIPBOARD="The link was copied to your clipboard!" +COM_GETBIBLE_THE_NAME_COULD_NOT_BE_UPDATED="The name could not be updated." +COM_GETBIBLE_THE_NAME_HAS_BEEN_UPDATED="The name has been updated." COM_GETBIBLE_THE_NOTE_WAS_SUCCESSFULLY_CREATED="The note was successfully created." COM_GETBIBLE_THE_NOTE_WAS_SUCCESSFULLY_UPDATED="The note was successfully updated." +COM_GETBIBLE_THE_PERSISTENT_SESSION_KEY_ALLOWS_VIEWING_WHILE_EDITING_IS_ONLY_POSSIBLE_WHEN_THE_CORRECT_FAVOURITE_VERSE_IS_PROVIDED="The persistent session key allows viewing, while editing is only possible when the correct favourite verse is provided." COM_GETBIBLE_THE_SCRIPTURE_WAS_COPIED_TO_YOUR_CLIPBOARD="The scripture was copied to your clipboard!" COM_GETBIBLE_THE_SEARCH_FEATURE_HAS_NOT_BEEN_ACTIVATED_PLEASE_CONTACT_THE_SYSTEM_ADMINISTRATOR_OF_THIS_WEBSITE_TO_RESOLVE_THIS="The search feature has not been activated. Please contact the system administrator of this website to resolve this." COM_GETBIBLE_THE_SESSION_IS_SET="The session is set." -COM_GETBIBLE_THE_SESSION_KEY_ALLOWS_VIEWING_WHILE_EDITING_IS_ONLY_POSSIBLE_WHEN_THE_CORRECT_FAVOURITE_VERSE_IS_PROVIDED="The session key allows viewing, while editing is only possible when the correct favourite verse is provided." COM_GETBIBLE_THE_TAG_SELECTED_IS_NOT_ACTIVE_PLEASE_SELECT_AN_ACTIVE_TAG="The tag selected is not active, please select an active tag." COM_GETBIBLE_THE_TAG_WAS_SUCCESSFULLY_REMOVED="The tag was successfully removed." COM_GETBIBLE_THE_TAG_WAS_SUCCESSFULLY_REMOVED_FROM_THE_VERSE="The tag was successfully removed from the verse." COM_GETBIBLE_THE_TAG_WAS_SUCCESSFULLY_SET="The tag was successfully set." COM_GETBIBLE_THE_VERSE_WAS_SUCCESSFULLY_TAGGED="The verse was successfully tagged." COM_GETBIBLE_THE_WORDS_OF_ETERNAL_LIFE="The words of eternal life!" +COM_GETBIBLE_THIS_AREA_DISPLAYS_YOUR_RECENTLY_ACCESSED_SESSIONS="This area displays your recently accessed sessions." COM_GETBIBLE_THIS_INSTALLATION_PROCESS_IS_A_ONETIME_OPERATION_FOR_EACH_TRANSLATION_HOWEVER_YOU_ARE_WELCOME_TO_RUN_THE_PROCESS_A_SECOND_TIME_OR_AS_OFTEN_AS_YOUD_LIKE_TO_VALIDATE_AND_ENSURE_THAT_ALL_CONTENT_WAS_PROPERLY_LOADED_AND_IS_UPTODATE="This installation process is a one-time operation for each translation. However, you are welcome to run the process a second time or as often as you'd like to validate and ensure that all content was properly loaded and is up-to-date." COM_GETBIBLE_THIS_IS_A_GLOBAL_TAG_SET_BY_US_AT_BSB_FOR_YOUR_CONVENIENCE_WE_HOLD_THE_PRIVILEGE_TO_MODIFY_THESE_TAGS_IF_YOU_BELIEVE_ITS_SET_IN_ERROR_KINDLY_INFORM_US="This is a global tag, set by us at %s for your convenience. We hold the privilege to modify these tags. If you believe it's set in error, kindly inform us." COM_GETBIBLE_THIS_IS_CURRENTLY_THE_ACTIVE_SESSION_KEY="This is currently the active session key." COM_GETBIBLE_THIS_IS_NOT_A_VALID_SESSION_KEY="This is not a valid session key." -COM_GETBIBLE_THIS_SESSION_IS_ALREADY_ACTIVE="This session is already active." -COM_GETBIBLE_THIS_SESSION_KEY_DOES_NOT_QUALIFY_FOR_SHARING="This session key does not qualify for sharing." +COM_GETBIBLE_THIS_PERSISTENT_SESSION_IS_ALREADY_ACTIVE="This persistent session is already active." +COM_GETBIBLE_THIS_SESSION_KEY_IS_NOT_YET_ELIGIBLE_FOR_SHARING_AS_NO_ACTIONS_HAVE_BEEN_PERFORMED_WITHIN_IT="This session key is not yet eligible for sharing, as no actions have been performed within it." COM_GETBIBLE_THIS_TAG_COULD_NOT_BE_REMOVED="This tag could not be removed." COM_GETBIBLE_THIS_TAG_CURRENTLY_DOESNT_HAVE_ANY_VERSES_LINKED_TO_IT_PLEASE_SELECT_ANOTHER_TAG_OR_ATTACH_SOME_VERSES_TO_THIS_ONE="This tag currently doesn't have any verses linked to it. Please select another tag, or attach some verses to this one." COM_GETBIBLE_THIS_VERSE_IN_COMBINATION_WITH_YOUR_ISESSION_KEYI_WILL_BE_USED_TO_AUTHENTICATE_YOU_IN_THE_FUTURE="This verse in combination with your session key will be used to authenticate you in the future." @@ -190,10 +207,11 @@ COM_GETBIBLE_TOP_P="Top P" COM_GETBIBLE_TOTALTOKENS="TotalTokens" COM_GETBIBLE_TO_PERFORM_THIS_OPEN_THE_GLOBAL_OPTIONS_SECTION_OF_THE_GETBIBLE_BACKEND_LOCATE_THE_GLOBAL_TAB_AND_SWITCH_SHOW_INSTALL_BUTTON_TO_NO_THIS_STEP_ENSURES_THAT_YOUR_SYSTEM_RESOURCES_ARE_NOT_UTILIZED_UNNECESSARILY_ONCE_YOU_HAVE_SUCCESSFULLY_INSTALLED_ALL_YOUR_DESIRED_BIBLE_TRANSLATIONS="To perform this, open the 'Global Options' section of the getBible backend, locate the 'Global' Tab, and switch 'Show Install Button' to [No]. This step ensures that your system resources are not utilized unnecessarily once you have successfully installed all your desired Bible translations." COM_GETBIBLE_TO_UNTAG_A_VERSE_DRAG_AND_DROP_THE_DESIRED_TAG_FROM_ACTIVE_TO_THE_AVAILABLE_TAGS_AREA="To un-tag a verse, drag and drop the desired tag from active to the available tags area." -COM_GETBIBLE_TO_USE_A_DIFFERENT_SESSION_KEY_SIMPLY_ADD_IT_HERE="To use a different session key, simply add it here." +COM_GETBIBLE_TO_USE_A_DIFFERENT_PERSISTENT_SESSION_KEY_SIMPLY_ADD_IT_ABOVE_AND_CLICK_LOAD="To use a different persistent session key, simply add it above, and click load." COM_GETBIBLE_TRANSLATION="Translation" COM_GETBIBLE_TRANSLATIONS="Translations" COM_GETBIBLE_TYPE_YOUR_SEARCH_PHRASE_INTO_THE_SEARCH_BOX_AND_PRESS_ENTER_TO_SEARCH_THE_BSCRIPTURESB_DAILY="Type your search phrase into the search box and press [ENTER] to search the Scriptures daily!" +COM_GETBIBLE_UPDATE_PERSISTENT_SESSION_NAME="Update Persistent Session Name" COM_GETBIBLE_VALIDATION_HASH_OF_THIS_CHAPTER="Validation Hash of this Chapter" COM_GETBIBLE_VERSE="Verse" COM_GETBIBLE_VERSES="Verses" @@ -202,15 +220,18 @@ COM_GETBIBLE_VIEW_ALL_VERSES_TAGGED="View all verses tagged." COM_GETBIBLE_WERE_SORRY_THE_TRANSLATION_YOU_SELECTED_DOES_NOT_INCLUDE_THE_BOOK_YOU_WERE_IN_PREVIOUSLY_HOWEVER_WE_HAVE_LOCATED_BSB_WHICH_MIGHT_BE_OF_INTEREST_TO_YOU="We're sorry, the translation you selected does not include the book you were in previously. However, we have located %s which might be of interest to you." COM_GETBIBLE_WE_CURRENTLY_HAVE_BSB_VERSES_STORED_IN_THE_DATABASE_FOR_THIS_PARTICULAR_TRANSLATION="We currently have %s verses stored in the database for this particular translation." COM_GETBIBLE_WHAT_IS_THIS_HASH_ALL_ABOUT_CLICK_HERE_TO_READ_MORE="What is this Hash all about? Click here to read more..." -COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION="Without selecting the correct favourite verse, you can't perform the initial action." +COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSEBR_YOU_CANT_PERFORM_THE_INITIAL_ACTION="Without selecting the correct favourite verse,
you can't perform the initial action." COM_GETBIBLE_WORDS="Words" -COM_GETBIBLE_YOUR_ACTIVE_SESSION_KEY="Your Active Session Key:" +COM_GETBIBLE_YOUR_ACTIVE_PERSISTENT_SESSION="Your Active Persistent Session:" +COM_GETBIBLE_YOUR_PERSISTENT_SESSION_KEY_AND_FAVOURITE_VERSE_PROVIDE_YOU_EXCLUSIVE_ACCESS_TO_EDIT_YOUR_SPAN_CLASSGETBIBLEACTIVITYNOTESANDTAGSNOTES_AND_TAGSSPAN_THINK_OF_YOUR_PERSISTENT_SESSION_KEY_AS_A_USERNAME_AND_YOUR_FAVOURITE_VERSE_AS_A_PASSWORD_THEREFORE_ENSURE_YOUR_FAVOURITE_VERSE_IS_KEPT_PRIVATE="Your persistent session key and favourite verse provide you exclusive access to edit your notes and tags. Think of your persistent session key as a username and your favourite verse as a password. Therefore, ensure your favourite verse is kept private." +COM_GETBIBLE_YOUR_PERSISTENT_SESSION_KEY_TOGETHER_WITH_YOUR_FAVOURITE_VERSE_AUTHENTICATES_YOU_IT_LINKS_TO_ALL_YOUR_SPAN_CLASSGETBIBLEACTIVITYNOTESANDTAGSNOTES_AND_TAGSSPAN_IN_THE_BIBLE_YOU_CAN_SHARE_IT_WITH_LOVED_ONES_SO_THEY_CAN_SEE_YOUR_SPAN_CLASSGETBIBLEACTIVITYNOTESANDTAGSNOTES_AND_TAGSSPAN="Your persistent session key, together with your favourite verse, authenticates you. It links to all your notes and tags in the Bible. You can share it with loved ones so they can see your notes and tags." COM_GETBIBLE_YOUR_SEARCH_DIDNT_YIELD_ANY_RESULTS_PLEASE_TYPE_A_DIFFERENT_KEYWORD_OR_PHRASE_INTO_THE_SEARCH_BOX_AND_PRESS_ENTER_TO_TRY_AGAIN="Your search didn't yield any results. Please type a different keyword or phrase into the search box and press [ENTER] to try again!" -COM_GETBIBLE_YOUR_SESSION_KEY_AND_FAVOURITE_VERSE_PROVIDE_YOU_EXCLUSIVE_ACCESS_TO_EDIT_YOUR_SPAN_CLASSGETBIBLEACTIVITYNOTESANDTAGSNOTES_AND_TAGSSPAN_THINK_OF_YOUR_SESSION_KEY_AS_A_USERNAME_AND_YOUR_FAVOURITE_VERSE_AS_A_PASSWORD_THEREFORE_ENSURE_YOUR_FAVOURITE_VERSE_IS_KEPT_PRIVATE="Your session key and favourite verse provide you exclusive access to edit your notes and tags. Think of your session key as a username and your favourite verse as a password. Therefore, ensure your favourite verse is kept private." -COM_GETBIBLE_YOUR_SESSION_KEY_TOGETHER_WITH_YOUR_FAVOURITE_VERSE_AUTHENTICATES_YOU_IT_LINKS_TO_ALL_YOUR_SPAN_CLASSGETBIBLEACTIVITYNOTESANDTAGSNOTES_AND_TAGSSPAN_IN_THE_BIBLE_YOU_CAN_SHARE_IT_WITH_LOVED_ONES_SO_THEY_CAN_SEE_YOUR_SPAN_CLASSGETBIBLEACTIVITYNOTESANDTAGSNOTES_AND_TAGSSPAN="Your session key, together with your favourite verse, authenticates you. It links to all your notes and tags in the Bible. You can share it with loved ones so they can see your notes and tags." COM_GETBIBLE_YOU_ARE_ABOUT_TO_INITIATE_THE_INSTALLATION_PROCESS_FOR_THIS_TRANSLATION_PLEASE_NOTE_THIS_PROCEDURE_IS_QUITE_EXTENSIVE_AND_MAY_TAKE_A_SIGNIFICANT_AMOUNT_OF_TIME_TO_COMPLETE_DEPENDING_ON_YOUR_NETWORK_SPEED_IT_COULD_RANGE_FROM_SEVERAL_MINUTES_TO_A_FEW_HOURS_DURING_THIS_PERIOD_IT_IS_ESSENTIAL_THAT_YOU_DO_NOT_NAVIGATE_AWAY_FROM_THIS_PAGE_CLOSE_THE_BROWSER_OR_SHUT_DOWN_YOUR_COMPUTER_AS_THIS_COULD_INTERRUPT_THE_INSTALLATION_PROCESS_PLEASE_ENSURE_YOU_HAVE_A_STABLE_INTERNET_CONNECTION_AND_SUFFICIENT_TIME_BEFORE_PROCEEDING_WE_RECOMMEND_INITIATING_THIS_WHEN_YOU_DO_NOT_REQUIRE_IMMEDIATE_USE_OF_YOUR_DEVICE_ARE_YOU_SURE_YOU_WANT_TO_START_THE_INSTALLATION_NOW="You are about to initiate the installation process for this translation. Please note, this procedure is quite extensive and may take a significant amount of time to complete, depending on your network speed. It could range from several minutes to a few hours. During this period, it is essential that you do not navigate away from this page, close the browser or shut down your computer as this could interrupt the installation process. Please ensure you have a stable internet connection and sufficient time before proceeding. We recommend initiating this when you do not require immediate use of your device. Are you sure you want to start the installation now?" -COM_GETBIBLE_YOU_ARE_ABOUT_TO_LOAD_ANOTHER_SESSION_KEY_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_CONTINUE="You are about to load another session key, are you sure you would like to continue?" +COM_GETBIBLE_YOU_ARE_ABOUT_TO_LOAD_ANOTHER_PERSISTENT_SESSION_KEY_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_CONTINUE="You are about to load another persistent session key, are you sure you would like to continue?" +COM_GETBIBLE_YOU_ARE_ABOUT_TO_REMOVE_THE_ACTIVE_PERSISTENT_SESSION="You are about to remove the active persistent session." COM_GETBIBLE_YOU_CAN_ADD_IT_HERE_TO_LOAD_YOUR_PREVIOUS_SESSION="You can add it here to load your previous session." +COM_GETBIBLE_YOU_CAN_CHANGE_YOUR_SESSION_NAME_TO_SOMETHING_MORE_RECOGNIZABLE="You can change your session name to something more recognizable." +COM_GETBIBLE_YOU_CAN_SHARE_YOUR_SESSION_WITH_LOVED_ONES_SO_THEY_CAN_SEE_YOUR_NOTES_AND_TAGS="You can share your session with loved ones so they can see your notes and tags." COM_GETBIBLE_YOU_HAVE_ENTERED_A_VALID_SESSION_KEY="You have entered a valid session key." COM_GETBIBLE_YOU_SHOULD_SELECT_ONE_OF_BYOUR_FAVOURITEB_VERSES="You should select one of your favourite verses." JGLOBAL_FIELD_ID_DESC="Record number in the database." diff --git a/site/layouts/getbiblelinkers.php b/site/layouts/getbiblelinkers.php new file mode 100644 index 0000000..3c8d42f --- /dev/null +++ b/site/layouts/getbiblelinkers.php @@ -0,0 +1,57 @@ + + @git Get Bible + @github Get Bible + @support Get Bible + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('JPATH_BASE') or die('Restricted access'); + +$load = false; + +if (!empty($displayData)) +{ + foreach ($displayData as $linker) + { + if (!empty($linker->name)) + { + $load = true; + break; + } + } +} + +?> + +
    + + name !== null): ?> +
  • + 'get-session-name-' . $linker->guid, 'label' => JText::_('COM_GETBIBLE_SESSION_NAME'), 'value' => $linker->name, 'readonly' => true]); ?> + 'get-session-key-' . $linker->guid, 'label' => JText::_('COM_GETBIBLE_SESSION_KEY'), 'value' => $linker->guid, 'readonly' => true]); ?> +
    + + + +
    +
  • + + +
+ +
+

+

+
+ diff --git a/site/layouts/modal.php b/site/layouts/modal.php index 690d83e..f5134c8 100644 --- a/site/layouts/modal.php +++ b/site/layouts/modal.php @@ -39,8 +39,7 @@ if ($full) { $modal_class = ' class="uk-modal-full"'; $class_close = ' class="uk-modal-close-full uk-close-large"'; -} - +} ?>
uk-modal> @@ -69,12 +68,13 @@ if ($full) - +
diff --git a/site/models/ajax.php b/site/models/ajax.php index c97dd0a..cb5fb8f 100644 --- a/site/models/ajax.php +++ b/site/models/ajax.php @@ -21,6 +21,7 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\MVC\Model\ListModel; use Joomla\Utilities\ArrayHelper; use VDM\Joomla\GetBible\Factory; +use VDM\Joomla\Utilities\JsonHelper; use VDM\Joomla\Utilities\GuidHelper; /** @@ -56,13 +57,14 @@ class GetbibleModelAjax extends ListModel int $book, int $chapter): ?array { + $linker = trim($linker); // we check if this is a valid linker value if (Factory::_('GetBible.Linker')->valid($linker)) { - return ['url' => trim(trim(JUri::base(), '/') . JRoute::_('index.php?option=com_getbible&view=app&t=' . $translation . '&Itemid=' . $this->app_params->get('app_menu', 0) . '&ref=' . $book . '&c=' . $chapter . '&Share_His_Word=' . $linker))]; + return ['url' => trim(trim(JUri::base(), '/') . JRoute::_('index.php?option=com_getbible&view=app&translation=' . $translation . '&Itemid=' . $this->app_params->get('app_menu', 0) . '&book=' . $book . '&chapter=' . $chapter . '&Share_His_Word=' . $linker))]; } - return ['error' => JText::_('COM_GETBIBLE_THIS_SESSION_KEY_DOES_NOT_QUALIFY_FOR_SHARING')]; + return ['error' => JText::_('COM_GETBIBLE_THIS_SESSION_KEY_IS_NOT_YET_ELIGIBLE_FOR_SHARING_AS_NO_ACTIONS_HAVE_BEEN_PERFORMED_WITHIN_IT')]; } /** @@ -78,6 +80,7 @@ class GetbibleModelAjax extends ListModel string $linker, string $oldLinker): ?array { + $linker = trim($linker); // we check if this is a valid linker value if (Factory::_('GetBible.Linker')->valid($linker) && Factory::_('GetBible.Linker')->set($linker)) @@ -148,7 +151,7 @@ class GetbibleModelAjax extends ListModel **/ public function setLinker(string $linker): array { - if (Factory::_('GetBible.Linker')->set($linker)) + if (Factory::_('GetBible.Linker')->set(trim($linker))) { return ['success' => JText::_('COM_GETBIBLE_THE_SESSION_IS_SET')]; } @@ -156,6 +159,25 @@ class GetbibleModelAjax extends ListModel return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } + /** + * Set the Linker Name + * + * @param string $name The linker name value + * + * @return array + * @since 3.2.0 + **/ + public function setLinkerName(string $name): array + { + $name = trim($name); + if (($result = Factory::_('GetBible.Linker')->setName($name)) !== null) + { + return $result; + } + + return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + } + /** * Set the Linker access * @@ -168,7 +190,7 @@ class GetbibleModelAjax extends ListModel **/ public function setLinkerAccess(string $linker, string $pass, ?string $oldPass): array { - if (($access = Factory::_('GetBible.Linker')->access($linker, $pass, $oldPass)) !== null) + if (($access = Factory::_('GetBible.Linker')->access(trim($linker), $pass, $oldPass)) !== null) { return $access; } @@ -176,6 +198,42 @@ class GetbibleModelAjax extends ListModel return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } + /** + * Revoke the Linker access + * + * @param string $linker The linker GUID value + * + * @return array + * @since 3.2.0 + **/ + public function revokeLinkerAccess(string $linker): array + { + if (($revoked = Factory::_('GetBible.Linker')->revoke(trim($linker))) !== null) + { + return $revoked; + } + + return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + } + + /** + * Revoke the Linker session + * + * @param string $linker The linker GUID value + * + * @return array + * @since 3.2.0 + **/ + public function revokeLinkerSession(string $linker): array + { + if (($revoked = Factory::_('GetBible.Linker')->revokeSession(trim($linker))) !== null) + { + return $revoked; + } + + return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + } + /** * Set a Note * @@ -293,6 +351,24 @@ class GetbibleModelAjax extends ListModel } return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR')]; + } + + /** + * Return the build list of linkers + * + * @param string $linkers The json list of linker values + * + * @return array + * @since 3.2.0 + **/ + public function getLinkersDisplay(string $linkers): array + { + if (JsonHelper::check($linkers)) + { + return ['display' => JLayoutHelper::render('getbiblelinkers', json_decode($linkers))]; + } + + return ['display' => JLayoutHelper::render('getbiblelinkers', null)]; } // Used in search diff --git a/site/models/app.php b/site/models/app.php index 389a70c..79ec1bc 100644 --- a/site/models/app.php +++ b/site/models/app.php @@ -1548,9 +1548,6 @@ class GetbibleModelApp extends ItemModel $query->order('a.book_nr ASC'); $query->order('a.chapter ASC'); $query->order('a.verse ASC'); - $query->group('a.book_nr'); - $query->group('a.chapter'); - $query->group('a.verse'); // Reset the query using our newly populated query object. $db->setQuery($query); diff --git a/site/models/tag.php b/site/models/tag.php index 54338f3..42e7ffd 100644 --- a/site/models/tag.php +++ b/site/models/tag.php @@ -629,9 +629,6 @@ class GetbibleModelTag extends ListModel $query->order('a.book_nr ASC'); $query->order('a.chapter ASC'); $query->order('a.verse ASC'); - $query->group('a.book_nr'); - $query->group('a.chapter'); - $query->group('a.verse'); // Reset the query using our newly populated query object. $db->setQuery($query); diff --git a/site/router.php b/site/router.php index 3f1c443..2729766 100644 --- a/site/router.php +++ b/site/router.php @@ -154,8 +154,13 @@ class GetbibleRouter extends JComponentRouterBase } else { - $segments[0] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? $this->defaultTranslation; - $segments[1] = $query['ref'] ?? $query['b'] ?? $query['book'] ?? ''; + $segments[0] = $query['t'] ?? $query['translation'] ?? $this->defaultTranslation; + $book = $query['ref'] ?? $query['b'] ?? $query['book'] ?? ''; + if (is_numeric($book) && $book > 0) + { + $book = $this->getBookName((int) $book); + } + $segments[1] = $book; $chapter = $query['chapter'] ?? $query['c'] ?? ''; if (strlen($chapter) && is_numeric($chapter)) diff --git a/site/views/app/tmpl/default_getbibleapp.php b/site/views/app/tmpl/default_getbibleapp.php index 838f850..63d1df0 100644 --- a/site/views/app/tmpl/default_getbibleapp.php +++ b/site/views/app/tmpl/default_getbibleapp.php @@ -19,6 +19,15 @@ defined('_JEXEC') or die('Restricted access'); ?> +
@@ -43,38 +52,12 @@ defined('_JEXEC') or die('Restricted access');
loadTemplate('getbiblefavouriteverseselector'); ?> diff --git a/site/views/app/tmpl/default_getbibleappbody.php b/site/views/app/tmpl/default_getbibleappbody.php index c628306..f1da1fa 100644 --- a/site/views/app/tmpl/default_getbibleappbody.php +++ b/site/views/app/tmpl/default_getbibleappbody.php @@ -51,7 +51,7 @@ if ($this->params->get('show_details') == 1)
  • -
    +
    loadTemplate('getbibletranslations'); ?>
  • diff --git a/site/views/app/tmpl/default_getbibleappbottommenu.php b/site/views/app/tmpl/default_getbibleappbottommenu.php index 53486fd..ee87b21 100644 --- a/site/views/app/tmpl/default_getbibleappbottommenu.php +++ b/site/views/app/tmpl/default_getbibleappbottommenu.php @@ -22,15 +22,15 @@ $type = $this->params->get('bottom_menu_type'); if ($type == 2) { - $menu_type = 'class="uk-margin-small uk-flex-center" uk-tab '; + $menu_type = 'class="uk-margin-small uk-flex-center" uk-tab'; } else { - $menu_type = 'class="el-nav uk-margin-small uk-subnav uk-subnav-pill uk-flex-center" '; + $menu_type = 'class="el-nav uk-margin-small uk-subnav uk-subnav-pill uk-flex-center"'; } ?> -
      uk-switcher="connect: #get-bible-app-body; animation: uk-animation-scale-up;"> +
        uk-switcher="connect: #get-bible-app-body; animation: uk-animation-scale-up;"> tab_menu['active_tab'] === 'scripture') { echo ' class="uk-active"'; } ?>> tab_menu['scripture_icon']; ?>tab_menu['scripture']; ?> diff --git a/site/views/app/tmpl/default_getbibleappsettings.php b/site/views/app/tmpl/default_getbibleappsettings.php index 021fc29..66316a2 100644 --- a/site/views/app/tmpl/default_getbibleappsettings.php +++ b/site/views/app/tmpl/default_getbibleappsettings.php @@ -19,141 +19,22 @@ defined('_JEXEC') or die('Restricted access'); ?> -
        -
        -
        -

        - 'getbible-settings-session-linker', 'label' => JText::_('COM_GETBIBLE_SESSION_KEY'), 'class_other' => 'getbible-linker-guid-input uk-text-center', 'value' => $this->linker['guid']]); ?> -

        -

        - - -

        -
        -
        -
        -
        -
        -
        -

        -

        -

        -
        -
        -
        -
        -

        -

        -

        -
        -
        -
        -
        +
        +
          +
        • +
        • + +
        - +
          +
        • + loadTemplate('getbibleappactivesession'); ?> +
        • +
        • +
          ...
          +
        • + + + +
        diff --git a/site/views/app/tmpl/default_getbibleapptags.php b/site/views/app/tmpl/default_getbibleapptags.php index d1ddea8..6ae5879 100644 --- a/site/views/app/tmpl/default_getbibleapptags.php +++ b/site/views/app/tmpl/default_getbibleapptags.php @@ -91,18 +91,19 @@ getbibleTagVerseSlider.noUiSlider.on('update', function(values, handle) { setActiveVerse(value, false); }); // to watch the active list -UIkit.util.on('#getbible-active-tags', 'added', function (event) { +UIkit.util.on('#getbible-active-tags', 'added', async function (event) { // Fires after an element has been added let addedElement = event.detail[1]; // now add this tag to this verse - tagVerse(getbible_active_translation, getbible_book_nr, getbible_chapter_nr, addedElement.dataset.verse, addedElement.dataset.tag); + await tagVerse(getbible_active_translation, getbible_book_nr, getbible_chapter_nr, addedElement.dataset.verse, addedElement.dataset.tag); + setActiveVerse(addedElement.dataset.verse, false); }); -UIkit.util.on('#getbible-active-tags', 'removed', function (event) { +UIkit.util.on('#getbible-active-tags', 'removed', async function (event) { // Fires after an element has been removed let removedElement = event.detail[1]; // now remove the tag from this verse if (removedElement.dataset.tagged) { - removeTagFromVerse(removedElement.dataset.tagged, removedElement.dataset.verse); + await removeTagFromVerse(removedElement.dataset.tagged, removedElement.dataset.verse); } }); diff --git a/site/views/app/tmpl/default_getbibleapptopmenu.php b/site/views/app/tmpl/default_getbibleapptopmenu.php index c6dc5dc..f368dad 100644 --- a/site/views/app/tmpl/default_getbibleapptopmenu.php +++ b/site/views/app/tmpl/default_getbibleapptopmenu.php @@ -22,15 +22,15 @@ $type = $this->params->get('top_menu_type'); if ($type == 2) { - $menu_type = 'class="uk-margin-small uk-flex-center" uk-tab '; + $menu_type = 'class="uk-margin-small uk-flex-center" uk-tab'; } else { - $menu_type = 'class="el-nav uk-margin-small uk-subnav uk-subnav-pill uk-flex-center" '; + $menu_type = 'class="el-nav uk-margin-small uk-subnav uk-subnav-pill uk-flex-center"'; } ?> -
          uk-switcher="connect: #get-bible-app-body; animation: uk-animation-scale-up;"> +
            uk-switcher="connect: #get-bible-app-body; animation: uk-animation-scale-up;"> tab_menu['active_tab'] === 'scripture') { echo ' class="uk-active"'; } ?>> tab_menu['scripture_icon']; ?>tab_menu['scripture']; ?> diff --git a/site/views/app/tmpl/default_getbiblefavouriteverseselector.php b/site/views/app/tmpl/default_getbiblefavouriteverseselector.php index 64685a2..c34fe3f 100644 --- a/site/views/app/tmpl/default_getbiblefavouriteverseselector.php +++ b/site/views/app/tmpl/default_getbiblefavouriteverseselector.php @@ -50,8 +50,8 @@ $content .= '

            ' . JText::_('COM_GETBIBLE_SHOULD_YOU_HAVE // set buttons $buttons = [ - ['name' => JText::_('COM_GETBIBLE_SELECT'), 'onclick' => "activeLinkerAccess();", 'class' => 'uk-button uk-button-default uk-width-2-3'], - ['close' => true, 'name' => JText::_('COM_GETBIBLE_CANCEL'), 'class' => 'uk-button uk-button-danger uk-width-1-3'] + ['id' => 'getbible-select-favourite-verse', 'name' => JText::_('COM_GETBIBLE_SELECT'), 'class' => 'uk-button uk-button-default uk-width-2-3'], + ['id' => 'getbible-cancel-favourite-verse', 'close' => true, 'name' => JText::_('COM_GETBIBLE_CANCEL'), 'class' => 'uk-button uk-button-danger uk-width-1-3'] ]; @@ -74,37 +74,142 @@ const favouriteBook = document.getElementById('getbible_favourite_book'); const favouriteChapter = document.getElementById('getbible_favourite_chapter'); const favouriteVerse = document.getElementById('getbible_favourite_verse'); const favouriteLinker = document.getElementById('getbible_favourite_linker'); - +const favouriteSelection = document.getElementById('getbible-select-favourite-verse'); +const cancelFavouriteSelection = document.getElementById('getbible-cancel-favourite-verse'); +params->get('show_settings') == 1): ?> +const sessionAccessStatusSwitch = document.getElementById('getbible-session-status-switch'); + +// Helper function to update the UI +const updateUIAfterSettingFavourite = (linker, pass) => { + favouriteError.style.display = 'none'; + setActiveLinkerOnPage(linker); + setLocalMemory('getbible_active_linker_guid', linker); + setLocalMemory(linker + '-validated', true);params->get('show_settings') == 1): ?> + setSessionStatusAccess(); + UIkit.modal('#getbible_favourite_verse_selector').hide(); +}; +// Helper function to handle errors +const handleFavouriteError = (errorMessage) => { + favouriteError.style.display = ''; + favouriteErrorMessage.textContent = errorMessage; +}; +// two variables to hold the resolve and reject functions of our Promise +let resolveFavouriteVerseSelection, rejectFavouriteVerseSelection; // function to try and set the linker access -const activeLinkerAccess = async () => { +const setGetBibleFavouriteVerse = () => { + UIkit.modal('#getbible_favourite_verse_selector').show(); + return new Promise((resolve, reject) => { + resolveFavouriteVerse = resolve; + rejectFavouriteVerse = reject; + }); +}; +favouriteSelection.addEventListener('click', async () => { try { - // create the pass key favouriteError.style.display = 'none'; let pass = favouriteBook.value + '_' + favouriteChapter.value + '_' + favouriteVerse.value; let linker = favouriteLinker.value; - // Wait for the server to return the response, then parse it as JSON. const data = await setLinkerAccess(linker, pass); - // Call another function after the response has been received if (data.success) { - // set the linker global - favouriteError.style.display = 'none'; - setActiveLinkerOnPage(linker); - setLocalMemory('getbible_active_linker_guid', linker); - setLocalMemory(linker, pass); + updateUIAfterSettingFavourite(linker, pass); + resolveFavouriteVerse(); UIkit.modal('#getbible_favourite_verse_selector').hide(); } else if (data.error) { - // show the error - favouriteError.style.display = ''; - favouriteErrorMessage.textContent = data.error; + handleFavouriteError(data.error); + rejectFavouriteVerse(data.error); } else { - // Handle any errors - console.error("Error occurred: ", data); + let error = "Unknown error occurred: " + JSON.stringify(data); + console.error(error); + rejectFavouriteVerse(error); } } catch (error) { - // Handle any errors console.error("Error occurred: ", error); + rejectFavouriteVerse(error); } -} +}); +cancelFavouriteSelection.addEventListener('click', () => { + rejectFavouriteVerse('User cancelled the operation'); + UIkit.modal('#getbible_favourite_verse_selector').hide(); +}); +const setFavouriteVerseForBrowser = async () => { + return new Promise(async (resolve, reject) => { + try { + await setGetBibleFavouriteVerse(); + resolve(); + } catch (err) { + reject(err); + } + }); +}; +params->get('show_settings') == 1): ?> +const removeFavouriteVerseFromBrowser = () => { + return new Promise(async (resolve, reject) => { + try { + let linker = getLocalMemory('getbible_active_linker_guid'); + if (linker) { + let revoked = await revokeLinkerAccess(linker); + if (revoked.success) { + setLocalMemory(linker + '-validated', false); + resolve(); + } else if (revoked.error) { + reject(revoked.error); + } else { + reject("Unexpected response"); + } + } else { + reject("Linker is undefined"); + } + } catch (err) { + reject(err); + } + }); +}; +const lockSessionStatusAccess = async () => { + sessionAccessStatusSwitch.setAttribute('uk-icon', 'icon: lock; ratio: 5'); + sessionAccessStatusSwitch.classList.remove('uk-text-success'); + sessionAccessStatusSwitch.setAttribute('uk-tooltip', ''); +}; +const unlockSessionStatusAccess = async () => { + sessionAccessStatusSwitch.setAttribute('uk-icon', 'icon: unlock; ratio: 6'); + sessionAccessStatusSwitch.classList.add('uk-text-success'); + sessionAccessStatusSwitch.setAttribute('uk-tooltip', ''); +}; +const changeSessionStatusSwitch = async () => { + var isLocked = sessionAccessStatusSwitch.getAttribute('uk-icon') === "icon: lock; ratio: 5"; + if(isLocked) { + setFavouriteVerseForBrowser().then(() => { + unlockSessionStatusAccess(); + }).catch((error) => { + console.error("An error occurred:", error); + }); + } else { + removeFavouriteVerseFromBrowser().then(() => { + lockSessionStatusAccess() + }).catch((error) => { + console.error("An error occurred:", error); + }); + } +}; +const setSessionStatusAccess = async () => { + // check if we have an open or closed session + let linker = getLocalMemory('getbible_active_linker_guid'); + if (linker) { + let pass = getLocalMemory(linker + '-validated'); + if (pass) { + unlockSessionStatusAccess(); + } else { + lockSessionStatusAccess(); + } + } else { + lockSessionStatusAccess(); + } +}; +document.addEventListener('DOMContentLoaded', function() { + setSessionStatusAccess(); + sessionAccessStatusSwitch.addEventListener('click', function() { + changeSessionStatusSwitch(); + }); +}); + diff --git a/site/views/app/tmpl/default_getbiblelinkermanager.php b/site/views/app/tmpl/default_getbiblelinkermanager.php new file mode 100644 index 0000000..7c11db2 --- /dev/null +++ b/site/views/app/tmpl/default_getbiblelinkermanager.php @@ -0,0 +1,61 @@ + + @git Get Bible + @github Get Bible + @support Get Bible + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +linker['share'] && !empty($this->linker['guid'])): ?> +setLocalMemory('getbible_active_linker_guid', 'linker['guid']; ?>'); +const getbible_linker_guid = 'linker['guid']; ?>'; +let pass = getLocalMemory(getbible_linker_guid); +if (pass) { + setLinkerAccess(getbible_linker_guid, pass); +} +linkerManager.set(linker); ?>); + +// make sure the linker is set and ready for use +const getbible_linker_guid = getLocalMemory('getbible_active_linker_guid', 'linker['guid'] ?? 'empty'; ?>', true); +// update server if needed +if (getbible_linker_guid !== 'linker['guid'] ?? 'empty'; ?>') { + // check if we have pass + let pass = getLocalMemory(getbible_linker_guid); + if (pass) { + setLinkerAccess(getbible_linker_guid, pass).then((data) => { + if (data.success) { + location.reload(); + } + }); + } else { + setLinker(getbible_linker_guid).then((data) => { + if (data.success) { + location.reload(); + } + }); + } +} else { + linkerManager.set(linker); ?>); +} + +params->get('show_settings') == 1): ?> +linkerManager.all().then((data) => { + if (data) { + getLinkersDisplay(data); + } +}); + + diff --git a/site/views/app/view.html.php b/site/views/app/view.html.php index 85b33d2..42cd231 100644 --- a/site/views/app/view.html.php +++ b/site/views/app/view.html.php @@ -565,10 +565,7 @@ class GetbibleViewApp extends HtmlView */ protected function getLinker(): array { - return [ - 'guid' => Factory::_('GetBible.Linker')->active(), - 'share' => Factory::_('GetBible.Linker')->share() - ]; + return Factory::_('GetBible.Linker')->activeDetails(); } /** @@ -678,7 +675,6 @@ class GetbibleViewApp extends HtmlView // Set the Custom JS script to view $this->document->addScriptDeclaration(" const UrlAjax = '$url_ajax'; - const getShareHisWordUrl = (linker, translation, book, chapter) => { // build share His Word url return UrlAjax + @@ -686,13 +682,11 @@ class GetbibleViewApp extends HtmlView '&linker=' + linker + '&book=' + book + '&chapter=' + chapter; }; - const getCheckValidLinkerUrl = (linker, oldLinker) => { // build share His Word url return UrlAjax + 'checkValidLinker&linker=' + linker + '&old=' + oldLinker; }; - const getSearchURL = (search, translation) => { // build search url return UrlAjax + @@ -701,7 +695,6 @@ class GetbibleViewApp extends HtmlView '&case=$search_case' + '&target=1000' + '&book=' + 0 + '&search=' + search; }; - const getOpenaiURL = (guid, words, verse, chapter, book, translation) => { // build open ai url return UrlAjax + @@ -710,46 +703,55 @@ class GetbibleViewApp extends HtmlView '&chapter=' + chapter + '&verse=' + verse + '&words=' + words; }; - const getSetLinkerURL = (linker) => { // build set linker url return UrlAjax + 'setLinker&linker=' + linker; }; - - const getSetLinkerAccessURL = (linker, pass, oldPass) => { + const revokeLinkerSessionURL = () => { + // build set linker revoke access url + return UrlAjax + 'revokeLinkerSession'; + }; + const getSetLinkerAccessURL = () => { // build set linker access url return UrlAjax + 'setLinkerAccess'; }; - + const revokeLinkerAccessURL = () => { + // build set linker revoke access url + return UrlAjax + 'revokeLinkerAccess'; + }; + const setLinkerNameURL = () => { + // build set linker access url + return UrlAjax + 'setLinkerName'; + }; const getSetNoteURL = () => { // build set note url return UrlAjax + 'setNote'; }; - const getSetTagURL = (name) => { // build create tag url return UrlAjax + 'setTag&name=' + name; }; - const getTagVerseURL = (translation, book, chapter, verse, tag) => { // build set tag url return UrlAjax + 'tagVerse&translation=' + translation + '&book=' + book + '&chapter=' + chapter + '&verse=' + verse + '&tag=' + tag; }; - const getRemoveTagFromVerseURL = (tag) => { // build set tag url return UrlAjax + 'removeTagFromVerse&tag=' + tag; }; - const installBibleChapterURL = (translation, book, chapter) => { // build load Bible url return UrlAjax + 'installBibleChapter&translation=' + translation + '&book=' + book + '&chapter=' + chapter; + }; + const getLinkersDisplayURL = () => { + // build load Bible url + return UrlAjax + 'getLinkersDisplay'; }; "); } diff --git a/update_server.xml b/update_server.xml index be24cd6..11fd49e 100644 --- a/update_server.xml +++ b/update_server.xml @@ -71,4 +71,22 @@ https://getbible.net + + Get Bible + The Bible for Joomla + pkg_getbible + package + site + 2.0.5 + https://getbible.net + + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v2.0.5.zip + + + stable + + Llewellyn van der Merwe + https://getbible.net + + \ No newline at end of file