diff --git a/README.md b/README.md index d65d56e4..1eb8c694 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Sermon Distributor (1.3.8) +# Sermon Distributor (1.4.0) ![Sermon Distributor image](https://raw.githubusercontent.com/SermonDistributor/Joomla-3-Component/master/admin/assets/images/component-300.jpg "The Sermon Distributor") @@ -23,38 +23,38 @@ The best way to see all your options is to install this component on you Joomla + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@vdm.io) + *Name*: [Sermon Distributor](https://www.vdm.io/) + *First Build*: 22nd October, 2015 -+ *Last Build*: 2nd November, 2016 -+ *Version*: 1.3.8 ++ *Last Build*: 27th November, 2016 ++ *Version*: 1.4.0 + *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 :hourglass: -**140 Hours** or **18 Eight Hour Days** (actual time the author saved - +**178 Hours** or **22 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder)) > (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*: **50067** -+ *File count*: **365** -+ *Folder count*: **80** ++ *Line count*: **63763** ++ *File count*: **436** ++ *Folder count*: **90** -**92 Hours** or **11 Eight Hour Days** (the actual time the author spent) +**117 Hours** or **15 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @35hours** = codingtime / 4; -> **planning @20hours** = codingtime / 7; -> **mapping @14hours** = codingtime / 10; -> **office @23hours** = codingtime / 6;) +> **debugging @44hours** = codingtime / 4; +> **planning @25hours** = codingtime / 7; +> **mapping @18hours** = codingtime / 10; +> **office @30hours** = codingtime / 6;) -**232 Hours** or **29 Eight Hour Days** +**295 Hours** or **37 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: **5.8 weeks** or **1.2 months** +Project duration: **7.4 weeks** or **1.5 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/README.txt b/admin/README.txt index d65d56e4..1eb8c694 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Sermon Distributor (1.3.8) +# Sermon Distributor (1.4.0) ![Sermon Distributor image](https://raw.githubusercontent.com/SermonDistributor/Joomla-3-Component/master/admin/assets/images/component-300.jpg "The Sermon Distributor") @@ -23,38 +23,38 @@ The best way to see all your options is to install this component on you Joomla + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@vdm.io) + *Name*: [Sermon Distributor](https://www.vdm.io/) + *First Build*: 22nd October, 2015 -+ *Last Build*: 2nd November, 2016 -+ *Version*: 1.3.8 ++ *Last Build*: 27th November, 2016 ++ *Version*: 1.4.0 + *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 :hourglass: -**140 Hours** or **18 Eight Hour Days** (actual time the author saved - +**178 Hours** or **22 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder)) > (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*: **50067** -+ *File count*: **365** -+ *Folder count*: **80** ++ *Line count*: **63763** ++ *File count*: **436** ++ *Folder count*: **90** -**92 Hours** or **11 Eight Hour Days** (the actual time the author spent) +**117 Hours** or **15 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @35hours** = codingtime / 4; -> **planning @20hours** = codingtime / 7; -> **mapping @14hours** = codingtime / 10; -> **office @23hours** = codingtime / 6;) +> **debugging @44hours** = codingtime / 4; +> **planning @25hours** = codingtime / 7; +> **mapping @18hours** = codingtime / 10; +> **office @30hours** = codingtime / 6;) -**232 Hours** or **29 Eight Hour Days** +**295 Hours** or **37 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: **5.8 weeks** or **1.2 months** +Project duration: **7.4 weeks** or **1.5 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/access.xml b/admin/access.xml index 58942c86..f14168b8 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -17,6 +17,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -29,6 +55,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -138,6 +188,45 @@ +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 6c829b58..95bd3f04 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage admin.css diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 5ca8ac5b..e2013df6 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage dashboard.css diff --git a/admin/assets/css/external_source.css b/admin/assets/css/external_source.css new file mode 100644 index 00000000..f91b64d7 --- /dev/null +++ b/admin/assets/css/external_source.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.4.0 + @build 27th November, 2016 + @created 22nd October, 2015 + @package Sermon Distributor + @subpackage external_source.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/external_sources.css b/admin/assets/css/external_sources.css new file mode 100644 index 00000000..aa51d2d0 --- /dev/null +++ b/admin/assets/css/external_sources.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.4.0 + @build 27th November, 2016 + @created 22nd October, 2015 + @package Sermon Distributor + @subpackage external_sources.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/help_document.css b/admin/assets/css/help_document.css index 30351ffb..cd472390 100644 --- a/admin/assets/css/help_document.css +++ b/admin/assets/css/help_document.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage help_document.css diff --git a/admin/assets/css/help_documents.css b/admin/assets/css/help_documents.css index 551c728e..686a60b3 100644 --- a/admin/assets/css/help_documents.css +++ b/admin/assets/css/help_documents.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage help_documents.css diff --git a/admin/assets/css/local_listing.css b/admin/assets/css/local_listing.css new file mode 100644 index 00000000..df5fb7e6 --- /dev/null +++ b/admin/assets/css/local_listing.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.4.0 + @build 27th November, 2016 + @created 22nd October, 2015 + @package Sermon Distributor + @subpackage local_listing.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/local_listings.css b/admin/assets/css/local_listings.css new file mode 100644 index 00000000..9dc73123 --- /dev/null +++ b/admin/assets/css/local_listings.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.4.0 + @build 27th November, 2016 + @created 22nd October, 2015 + @package Sermon Distributor + @subpackage local_listings.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/manual_updater.css b/admin/assets/css/manual_updater.css new file mode 100644 index 00000000..bff37266 --- /dev/null +++ b/admin/assets/css/manual_updater.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.4.0 + @build 27th November, 2016 + @created 22nd October, 2015 + @package Sermon Distributor + @subpackage manual_updater.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/preacher.css b/admin/assets/css/preacher.css index ef807976..bcd7da75 100644 --- a/admin/assets/css/preacher.css +++ b/admin/assets/css/preacher.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.css diff --git a/admin/assets/css/preachers.css b/admin/assets/css/preachers.css index 33af9046..87fadc06 100644 --- a/admin/assets/css/preachers.css +++ b/admin/assets/css/preachers.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.css diff --git a/admin/assets/css/series.css b/admin/assets/css/series.css index 23ffbfc3..90e7da93 100644 --- a/admin/assets/css/series.css +++ b/admin/assets/css/series.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage series.css diff --git a/admin/assets/css/series_list.css b/admin/assets/css/series_list.css index 266ac1bc..955258ad 100644 --- a/admin/assets/css/series_list.css +++ b/admin/assets/css/series_list.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage series_list.css diff --git a/admin/assets/css/sermon.css b/admin/assets/css/sermon.css index 7d5f36f7..10e271a2 100644 --- a/admin/assets/css/sermon.css +++ b/admin/assets/css/sermon.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.css diff --git a/admin/assets/css/sermons.css b/admin/assets/css/sermons.css index bc2897b2..2170b905 100644 --- a/admin/assets/css/sermons.css +++ b/admin/assets/css/sermons.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons.css diff --git a/admin/assets/css/statistic.css b/admin/assets/css/statistic.css index 6663c4a9..3855a2fe 100644 --- a/admin/assets/css/statistic.css +++ b/admin/assets/css/statistic.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage statistic.css diff --git a/admin/assets/css/statistics.css b/admin/assets/css/statistics.css index 9c70edd2..cd991f11 100644 --- a/admin/assets/css/statistics.css +++ b/admin/assets/css/statistics.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage statistics.css diff --git a/admin/assets/images/icons/external_source_add.png b/admin/assets/images/icons/external_source_add.png new file mode 100644 index 00000000..5651c6a2 Binary files /dev/null and b/admin/assets/images/icons/external_source_add.png differ diff --git a/admin/assets/images/icons/external_sources.png b/admin/assets/images/icons/external_sources.png new file mode 100644 index 00000000..550bd3e2 Binary files /dev/null and b/admin/assets/images/icons/external_sources.png differ diff --git a/admin/assets/images/icons/local_listings.png b/admin/assets/images/icons/local_listings.png new file mode 100644 index 00000000..e70d0d55 Binary files /dev/null and b/admin/assets/images/icons/local_listings.png differ diff --git a/admin/assets/images/icons/manual_updater.png b/admin/assets/images/icons/manual_updater.png new file mode 100644 index 00000000..db130da4 Binary files /dev/null and b/admin/assets/images/icons/manual_updater.png differ diff --git a/admin/config.xml b/admin/config.xml index 9786ee28..dccf5af1 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -46,72 +46,6 @@ default="10" /> - - - - - - - - - - - - - - - - - " +
+ + +
@@ -419,17 +366,75 @@
+ name="sermon_custom_config" + label="COM_SERMONDISTRIBUTOR_CONFIG_SERMON"> - - - + + + + + + + + + + + + + + + + + + + + @@ -438,333 +443,151 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - + - + COM_SERMONDISTRIBUTOR_CONFIG_YES + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - + COM_SERMONDISTRIBUTOR_CONFIG_YES - - + COM_SERMONDISTRIBUTOR_CONFIG_NO - - - - - - - - - - - - - - - - - + - + COM_SERMONDISTRIBUTOR_CONFIG_YES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + COM_SERMONDISTRIBUTOR_CONFIG_NO - - + + + + COM_SERMONDISTRIBUTOR_CONFIG_NO - - + + + + COM_SERMONDISTRIBUTOR_CONFIG_NO - - + + COM_SERMONDISTRIBUTOR_CONFIG_NO -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'sermons', 'series' => 'series_list', 'statistic' => 'statistics', + 'external_source' => 'external_sources', + 'local_listing' => 'local_listings', 'help_document' => 'help_documents' ); // check if this is a list view diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 9926b191..7b712eb5 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage ajax.json.php @@ -42,11 +42,11 @@ class SermondistributorControllerAjax extends JControllerLegacy JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"'); JResponse::setHeader("Access-Control-Allow-Origin", "*"); // load the tasks - $this->registerTask('checkDropboxListing', 'ajax'); - $this->registerTask('updateDropboxListing', 'ajax'); - $this->registerTask('getUpdateProgress', 'ajax'); + $this->registerTask('autoUpdateLocalListingExternal', 'ajax'); + $this->registerTask('updateLocalListingExternal', 'ajax'); $this->registerTask('isNew', 'ajax'); - $this->registerTask('isRead', 'ajax'); + $this->registerTask('isRead', 'ajax'); + $this->registerTask('getBuildTable', 'ajax'); } public function ajax() @@ -61,14 +61,16 @@ class SermondistributorControllerAjax extends JControllerLegacy $task = $this->getTask(); switch($task) { - case 'checkDropboxListing': + case 'autoUpdateLocalListingExternal': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); - $fromviewValue = $jinput->get('fromview', NULL, 'INT'); - if($fromviewValue && $user->id != 0) + $idValue = $jinput->get('id', NULL, 'INT'); + $targetValue = $jinput->get('target', NULL, 'INT'); + $typeValue = $jinput->get('type', NULL, 'INT'); + if($idValue && $targetValue && $typeValue) { - $result = $this->getModel('ajax')->dropbox($fromviewValue); + $result = $this->getModel('ajax')->autoUpdateLocalListingExternal($idValue, $targetValue, $typeValue); } else { @@ -99,52 +101,17 @@ class SermondistributorControllerAjax extends JControllerLegacy } } break; - case 'updateDropboxListing': + case 'updateLocalListingExternal': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $idValue = $jinput->get('id', NULL, 'INT'); + $targetValue = $jinput->get('target', NULL, 'INT'); $typeValue = $jinput->get('type', NULL, 'INT'); - if($typeValue && $user->id != 0) + $sleutelValue = $jinput->get('sleutel', NULL, 'CMD'); + if($idValue && $targetValue && $typeValue && $sleutelValue && $user->id != 0) { - $result = $this->getModel('ajax')->updateDropbox($typeValue); - } - else - { - $result = false; - } - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback . "(".json_encode($result).");"; - } - elseif($returnRaw) - { - echo json_encode($result); - } - else - { - echo "(".json_encode($result).");"; - } - } - catch(Exception $e) - { - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback."(".json_encode($e).");"; - } - else - { - echo "(".json_encode($e).");"; - } - } - break; - case 'getUpdateProgress': - try - { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); - $typeValue = $jinput->get('type', NULL, 'INT'); - if($typeValue && $user->id != 0) - { - $result = $this->getModel('ajax')->updateProgress($typeValue); + $result = $this->getModel('ajax')->updateLocalListingExternal($idValue, $targetValue, $typeValue, $sleutelValue); } else { @@ -250,6 +217,45 @@ class SermondistributorControllerAjax extends JControllerLegacy echo "(".json_encode($e).");"; } } + break; + case 'getBuildTable': + try + { + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $idNameValue = $jinput->get('idName', NULL, 'WORD'); + $ojectValue = $jinput->get('oject', NULL, 'STRING'); + if($idNameValue && $ojectValue && $user->id != 0) + { + $result = $this->getModel('ajax')->getBuildTable($idNameValue, $ojectValue); + } + else + { + $result = false; + } + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback."(".json_encode($e).");"; + } + else + { + echo "(".json_encode($e).");"; + } + } break; } } diff --git a/admin/controllers/external_source.php b/admin/controllers/external_source.php new file mode 100644 index 00000000..07113995 --- /dev/null +++ b/admin/controllers/external_source.php @@ -0,0 +1,326 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controllerform library +jimport('joomla.application.component.controllerform'); + +/** + * External_source Controller + */ +class SermondistributorControllerExternal_source extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + public function __construct($config = array()) + { + $this->view_list = 'External_sources'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Access check. + $access = JFactory::getUser()->authorise('external_source.access', 'com_sermondistributor'); + if (!$access) + { + return false; + } + // In the absense of better information, revert to the component permissions. + return JFactory::getUser()->authorise('external_source.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('external_source.access', 'com_sermondistributor.external_source.' . (int) $recordId) && $user->authorise('external_source.access', 'com_sermondistributor')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('external_source.edit', 'com_sermondistributor.external_source.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + if ($user->authorise('external_source.edit.own', 'com_sermondistributor.external_source.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('external_source.edit.own', 'com_sermondistributor')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('external_source.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 12.2 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + $tmpl = $this->input->get('tmpl'); + $layout = $this->input->get('layout', 'edit', 'string'); + + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // Setup redirect info. + + $append = ''; + + if ($refid) + { + $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + } + elseif ($ref) + { + $append .= '&ref='.(string)$ref; + } + + if ($tmpl) + { + $append .= '&tmpl=' . $tmpl; + } + + if ($layout) + { + $append .= '&layout=' . $layout; + } + + if ($recordId) + { + $append .= '&' . $urlVar . '=' . $recordId; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('External_source', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=external_sources' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + $cancel = parent::cancel($key); + + if ($cancel) + { + if ($this->refid) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + } + else + { + // Redirect to the items screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + if ($this->refid && $saved) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref && $saved) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/external_sources.php b/admin/controllers/external_sources.php new file mode 100644 index 00000000..06460162 --- /dev/null +++ b/admin/controllers/external_sources.php @@ -0,0 +1,111 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controlleradmin library +jimport('joomla.application.component.controlleradmin'); + +/** + * External_sources Controller + */ +class SermondistributorControllerExternal_sources extends JControllerAdmin +{ + protected $text_prefix = 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES'; + /** + * Proxy for getModel. + * @since 2.5 + */ + public function getModel($name = 'External_source', $prefix = 'SermondistributorModel', $config = array()) + { + $model = parent::getModel($name, $prefix, array('ignore_request' => true)); + + return $model; + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('external_source.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + JArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('External_sources'); + // get the data to export + $data = $model->getExportData($pks); + if (SermondistributorHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + SermondistributorHelper::xls($data,'External_sources_'.$date->format('jS_F_Y'),'External sources exported ('.$date->format('jS F, Y').')','external sources'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=external_sources', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('external_source.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) + { + // Get the import model + $model = $this->getModel('External_sources'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (SermondistributorHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('external_source_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'external_sources'); + $session->set('dataType_VDM_IMPORTINTO', 'external_source'); + // Redirect to import view. + $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_EXTERNAL_SOURCES'); + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=external_sources', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/help.php b/admin/controllers/help.php index bfa6e84c..ff0e5de8 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage help.php diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index 3a6f3c00..69077898 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage help_document.php diff --git a/admin/controllers/help_documents.php b/admin/controllers/help_documents.php index 7e22dfd0..87c507ef 100644 --- a/admin/controllers/help_documents.php +++ b/admin/controllers/help_documents.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage help_documents.php diff --git a/admin/controllers/import.php b/admin/controllers/import.php index 81ac106b..ce29edc9 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage import.php diff --git a/admin/controllers/local_listing.php b/admin/controllers/local_listing.php new file mode 100644 index 00000000..e9534753 --- /dev/null +++ b/admin/controllers/local_listing.php @@ -0,0 +1,326 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controllerform library +jimport('joomla.application.component.controllerform'); + +/** + * Local_listing Controller + */ +class SermondistributorControllerLocal_listing extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + public function __construct($config = array()) + { + $this->view_list = 'Local_listings'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Access check. + $access = JFactory::getUser()->authorise('local_listing.access', 'com_sermondistributor'); + if (!$access) + { + return false; + } + // In the absense of better information, revert to the component permissions. + return JFactory::getUser()->authorise('local_listing.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('local_listing.access', 'com_sermondistributor.local_listing.' . (int) $recordId) && $user->authorise('local_listing.access', 'com_sermondistributor')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('local_listing.edit', 'com_sermondistributor.local_listing.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + if ($user->authorise('local_listing.edit.own', 'com_sermondistributor.local_listing.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('local_listing.edit.own', 'com_sermondistributor')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('local_listing.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 12.2 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + $tmpl = $this->input->get('tmpl'); + $layout = $this->input->get('layout', 'edit', 'string'); + + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // Setup redirect info. + + $append = ''; + + if ($refid) + { + $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + } + elseif ($ref) + { + $append .= '&ref='.(string)$ref; + } + + if ($tmpl) + { + $append .= '&tmpl=' . $tmpl; + } + + if ($layout) + { + $append .= '&layout=' . $layout; + } + + if ($recordId) + { + $append .= '&' . $urlVar . '=' . $recordId; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Local_listing', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=local_listings' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + $cancel = parent::cancel($key); + + if ($cancel) + { + if ($this->refid) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + } + else + { + // Redirect to the items screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + if ($this->refid && $saved) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref && $saved) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/local_listings.php b/admin/controllers/local_listings.php new file mode 100644 index 00000000..77aa7a5e --- /dev/null +++ b/admin/controllers/local_listings.php @@ -0,0 +1,111 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controlleradmin library +jimport('joomla.application.component.controlleradmin'); + +/** + * Local_listings Controller + */ +class SermondistributorControllerLocal_listings extends JControllerAdmin +{ + protected $text_prefix = 'COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS'; + /** + * Proxy for getModel. + * @since 2.5 + */ + public function getModel($name = 'Local_listing', $prefix = 'SermondistributorModel', $config = array()) + { + $model = parent::getModel($name, $prefix, array('ignore_request' => true)); + + return $model; + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('local_listing.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + JArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Local_listings'); + // get the data to export + $data = $model->getExportData($pks); + if (SermondistributorHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + SermondistributorHelper::xls($data,'Local_listings_'.$date->format('jS_F_Y'),'Local listings exported ('.$date->format('jS F, Y').')','local listings'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=local_listings', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('local_listing.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) + { + // Get the import model + $model = $this->getModel('Local_listings'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (SermondistributorHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('local_listing_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'local_listings'); + $session->set('dataType_VDM_IMPORTINTO', 'local_listing'); + // Redirect to import view. + $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_LOCAL_LISTINGS'); + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=local_listings', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/manual_updater.php b/admin/controllers/manual_updater.php new file mode 100644 index 00000000..7efae2fc --- /dev/null +++ b/admin/controllers/manual_updater.php @@ -0,0 +1,61 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controlleradmin library +jimport('joomla.application.component.controlleradmin'); + +/** + * Manual_updater Controller + */ +class SermondistributorControllerManual_updater extends JControllerAdmin +{ + protected $text_prefix = 'COM_SERMONDISTRIBUTOR_MANUAL_UPDATER'; + /** + * Proxy for getModel. + * @since 2.5 + */ + public function getModel($name = 'Manual_updater', $prefix = 'SermondistributorModel', $config = array()) + { + $model = parent::getModel($name, $prefix, array('ignore_request' => true)); + + return $model; + } + + public function dashboard() + { + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor', false)); + return; + } + + public function gotoExternalSources() + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=external_sources', false)); + return; + } +} diff --git a/admin/controllers/preacher.php b/admin/controllers/preacher.php index b78bf31c..9a8f5a58 100644 --- a/admin/controllers/preacher.php +++ b/admin/controllers/preacher.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.php diff --git a/admin/controllers/preachers.php b/admin/controllers/preachers.php index f6ad643f..6926bcbf 100644 --- a/admin/controllers/preachers.php +++ b/admin/controllers/preachers.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.php diff --git a/admin/controllers/series.php b/admin/controllers/series.php index 66ba7128..8c50ff92 100644 --- a/admin/controllers/series.php +++ b/admin/controllers/series.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage series.php diff --git a/admin/controllers/series_list.php b/admin/controllers/series_list.php index 00e43b67..cc869788 100644 --- a/admin/controllers/series_list.php +++ b/admin/controllers/series_list.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage series_list.php diff --git a/admin/controllers/sermon.php b/admin/controllers/sermon.php index 924274c5..12a16bb7 100644 --- a/admin/controllers/sermon.php +++ b/admin/controllers/sermon.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.php diff --git a/admin/controllers/sermondistributor.php b/admin/controllers/sermondistributor.php index abda218d..4b1c231c 100644 --- a/admin/controllers/sermondistributor.php +++ b/admin/controllers/sermondistributor.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php diff --git a/admin/controllers/sermons.php b/admin/controllers/sermons.php index 0293f41f..1987adfd 100644 --- a/admin/controllers/sermons.php +++ b/admin/controllers/sermons.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons.php diff --git a/admin/controllers/statistic.php b/admin/controllers/statistic.php index 470c27fe..c1b13013 100644 --- a/admin/controllers/statistic.php +++ b/admin/controllers/statistic.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage statistic.php diff --git a/admin/controllers/statistics.php b/admin/controllers/statistics.php index bd87c607..05b14b07 100644 --- a/admin/controllers/statistics.php +++ b/admin/controllers/statistics.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage statistics.php diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index d7cbfab7..e5f5e2a5 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage batch_.php diff --git a/admin/helpers/sermondistributor.php b/admin/helpers/sermondistributor.php index c99b7f31..e362f942 100644 --- a/admin/helpers/sermondistributor.php +++ b/admin/helpers/sermondistributor.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php @@ -37,23 +37,26 @@ abstract class SermondistributorHelper **/ public static function globalEvent($document) { - self::loadDropboxAjax($document); + self::loadExternalUpdateAjax($document); } /** - * Load the Dropbox Ajax to page + * Load the External Update Ajax to page **/ - public static function loadDropboxAjax($document) + public static function loadExternalUpdateAjax($document) { - $document->addScriptDeclaration(" + $updates = self::getExternalListingUpdateKeys(); // id, target, type + if (self::checkArray($updates)) + { + $document->addScriptDeclaration(" jQuery(window).load(function() { - checkDropboxListing(3); + checkExternalListing(".implode('); checkExternalListing(', $updates)."); }); - function checkDropboxListing(fromview){ - var getUrl = '".JURI::root()."administrator/index.php?option=com_sermondistributor&task=ajax.checkDropboxListing&format=json'; - if(fromview > 0){ - var request = 'token=".JSession::getFormToken()."&fromview='+fromview; + function checkExternalListing(id, target, type) { + var getUrl = '".JURI::root()."administrator/index.php?option=com_sermondistributor&task=ajax.autoUpdateLocalListingExternal&format=json'; + if(target > 0 && type > 0 && id > 0){ + var request = 'token=".JSession::getFormToken()."&target='+target+'&id='+id+'&type='+type; } return jQuery.ajax({ type: 'GET', @@ -62,39 +65,29 @@ abstract class SermondistributorHelper data: request, jsonp: 'callback' }); - } - "); - } - + }"); + } + } + /** - * The dropbox links auto + * The external source links auto **/ - protected static $links_dropbox_auto; + protected static $links_externalsource_auto; /** - * The dropbox links manual + * The external source links manual **/ - protected static $links_dropbox_manual; + protected static $links_externalsource_manual; /** - * The dropbox info File Name + * The external source selection auto **/ - protected static $autoprogress = false; - + protected static $select_externalsource_auto; + /** - * The dropbox info File Name + * The external source selection manual **/ - protected static $manualprogress = false; - - /** - * The dropbox info File Name - **/ - protected static $autolisting = false; - - /** - * The dropbox info File Name - **/ - protected static $manuallisting = false; + protected static $select_externalsource_manual; /** * The user notice info File Name @@ -102,7 +95,42 @@ abstract class SermondistributorHelper protected static $usernotice = false; /** - * check Dropbox Local Listing + * The update error info File Name + **/ + protected static $updateerror = false; + + /** + * The update errors + **/ + protected static $updateErrors = array(); + + /** + * prepare base64 string for url + **/ + public static function base64_urlencode($string, $encode = false) + { + if ($encode) + { + $string = base64_encode($string); + } + return str_replace(array('+', '/'), array('-', '_'), $string); + } + + /** + * prepare base64 string form url + **/ + public static function base64_urldecode($string, $decode = false) + { + $string = str_replace(array('-', '_'), array('+', '/'), $string); + if ($decode) + { + $string = base64_decode($string); + } + return $string; + } + + /** + * get Download links of a sermon **/ public static function getDownloadLinks(&$sermon) { @@ -122,12 +150,13 @@ abstract class SermondistributorHelper { $keyCounter->series = $sermon->series; } - $keyCounter = base64_encode($safe->encryptString(json_encode($keyCounter))); + $keyCounterRAW = $safe->encryptString(json_encode($keyCounter)); + $keyCounter = self::base64_urlencode($keyCounterRAW); $token = JSession::getFormToken(); $downloadURL = JURI::root().'index.php?option=com_sermondistributor&task=download.file&key='.$keyCounter.'&token='.$token; // check if local .htaccess should be set $setHtaccess = false; - $onclick = ' onclick="sermonCounter(\''.$keyCounter.'\',\'FILENAME\');"'; + $onclick = ' onclick="sermonCounter(\''.$keyCounterRAW.'\',\'FILENAME\');"'; // check what source of our link switch ($sermon->source) { @@ -155,8 +184,8 @@ abstract class SermondistributorHelper { // get the file name use the same method as the auto $filename = self::getDownloadFileName($sermon,$key,'local'); - $lockedFolderPath = base64_encode($safe->encryptString($localFolder.$key)); - $sermon->download_links[$filename] = $downloadURL.'&link='.$lockedFolderPath.'&filename='.$filename; + $lockedFolderPath = $safe->encryptString($localFolder.$key); + $sermon->download_links[$filename] = $downloadURL.'&link='.self::base64_urlencode($lockedFolderPath).'&filename='.$filename; $sermon->onclick[$filename] = ''; } elseif (2 == $sermon->link_type && $allowDirect) @@ -171,7 +200,7 @@ abstract class SermondistributorHelper break; case 2: // Dropbox get global dropbox switch - $dropboxButton = JComponentHelper::getParams('com_sermondistributor')->get('add_to_dropbox', 1); + $addToButton = JComponentHelper::getParams('com_sermondistributor')->get('add_to_button', 0); if (1 == $sermon->build) { if (self::checkArray($sermon->manual_files)) @@ -180,24 +209,43 @@ abstract class SermondistributorHelper foreach($sermon->manual_files as $key) { // get the link - $dropURL = self::getDropboxLink('manual',1,$key); + $dropURL = self::getExternalSourceLink('manual',1,$key); if (1 == $sermon->link_type && $dropURL) { // get the file name use the same method as the auto $filename = self::getDownloadFileName($sermon,$key,'dropbox_manual'); - $sermon->download_links[$filename] = $downloadURL.'&link='.$dropURL.'&filename='.$filename; + // should we encrypt string this string + if ('localKey34fdWEkl' == $localkey || (base64_encode(base64_decode($dropURL, true)) !== $dropURL)) // hmmm no global key has been set + { + $dropURL = $safe->encryptString($dropURL); + } + $sermon->download_links[$filename] = $downloadURL.'&link='.self::base64_urlencode($dropURL).'&filename='.$filename; $sermon->onclick[$filename] = ''; } elseif (2 == $sermon->link_type && $dropURL) { $filename = str_replace('VDM_pLeK_h0uEr/', '', $key); - $sermon->download_links[$filename] = rtrim($safe->decryptString(base64_decode($dropURL))); + if ('localKey34fdWEkl' == $localkey) // hmmm no global key has been set (so don't decrypt) + { + $sermon->download_links[$filename] = $dropURL; + } + else + { + $sermon->download_links[$filename] = rtrim($safe->decryptString($dropURL), "\0"); + } $sermon->onclick[$filename] = str_replace('FILENAME', $filename, $onclick); } // build dropbox switch if needed - if (1 == $dropboxButton && $dropURL) + if (1 == $addToButton && $dropURL) { - $sermon->dropbox_buttons[$filename] = str_replace('?dl=1', '?dl=0', rtrim($safe->decryptString(base64_decode($dropURL)))); + if ('localKey34fdWEkl' == $localkey) // hmmm no global key has been set (so don't decrypt) + { + $sermon->dropbox_buttons[$filename] = str_replace('?dl=1', '?dl=0', $dropURL); + } + else + { + $sermon->dropbox_buttons[$filename] = str_replace('?dl=1', '?dl=0', rtrim($safe->decryptString($dropURL), "\0")); + } $sermon->onclick_drobox[$filename] = str_replace('FILENAME', $filename, $onclick); } } @@ -211,22 +259,41 @@ abstract class SermondistributorHelper foreach($sermon->auto_sermons as $filename => $key) { // get the link - $dropURL = self::getDropboxLink('auto',1,$key); + $dropURL = self::getExternalSourceLink('auto',1,$key); if (1 == $sermon->link_type && $dropURL) { + // should we encrypt string this string + if ('localKey34fdWEkl' == $localkey || (base64_encode(base64_decode($dropURL, true)) !== $dropURL)) // hmmm no global key has been set + { + $dropURL = $safe->encryptString($dropURL); + } // get the file name (use the same method as the auto - $sermon->download_links[$filename] = $downloadURL.'&link='.$dropURL.'&filename='.$filename; + $sermon->download_links[$filename] = $downloadURL.'&link='.self::base64_urlencode($dropURL).'&filename='.$filename; $sermon->onclick[$filename] = ''; } elseif (2 == $sermon->link_type && $dropURL) { - $sermon->download_links[$filename] = rtrim($safe->decryptString(base64_decode($dropURL))); + if ('localKey34fdWEkl' == $localkey) // hmmm no global key has been set (so don't decrypt) + { + $sermon->download_links[$filename] = $dropURL; + } + else + { + $sermon->download_links[$filename] = rtrim($safe->decryptString($dropURL), "\0"); + } $sermon->onclick[$filename] = str_replace('FILENAME', $filename, $onclick); } // build dropbox switch if needed - if (1 == $dropboxButton && $dropURL) + if (1 == $addToButton && $dropURL) { - $sermon->dropbox_buttons[$filename] = str_replace('?dl=1', '?dl=0', rtrim($safe->decryptString(base64_decode($dropURL)))); + if ('localKey34fdWEkl' == $localkey) // hmmm no global key has been set (so don't decrypt) + { + $sermon->dropbox_buttons[$filename] = str_replace('?dl=1', '?dl=0', $dropURL); + } + else + { + $sermon->dropbox_buttons[$filename] = str_replace('?dl=1', '?dl=0', rtrim($safe->decryptString($dropURL), "\0")); + } $sermon->onclick_drobox[$filename] = str_replace('FILENAME', $filename, $onclick); } } @@ -238,8 +305,8 @@ abstract class SermondistributorHelper $filename = self::getDownloadFileName($sermon,$sermon->url,'url'); if (1 == $sermon->link_type) { - $lockedURL = base64_encode($safe->encryptString($sermon->url)); - $sermon->download_links[$filename] = $downloadURL.'&link='.$lockedURL.'&filename='.$filename; + $lockedURL = $safe->encryptString($sermon->url); + $sermon->download_links[$filename] = $downloadURL.'&link='.self::base64_urlencode($lockedURL).'&filename='.$filename; $sermon->onclick[$filename] = ''; } elseif (2 == $sermon->link_type) @@ -261,25 +328,104 @@ abstract class SermondistributorHelper } return true; } + + public static function getExternalListingUpdateKeys($id = null, $updateMethod = 2, $returnType = 1) + { + // first check if this file already has statistics + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('id','sharedurl','folder','permissiontype','dropboxoptions','build'))); + $query->from($db->quoteName('#__sermondistributor_external_source')); + $query->where($db->quoteName('update_method') . ' = '. (int) $updateMethod); + if ($id && is_numeric($id)) + { + $query->where($db->quoteName('id') . ' = '. (int) $id); + } + elseif ($id && self::checkArray($id)) + { + $ids = implode(',', array_map( 'intval', $id)); + $query->where($db->quoteName('id') . ' IN (' . $ids . ')'); + } + $query->where($db->quoteName('published') . ' = 1'); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $results = $db->loadObjectList(); + $updates = array(); + foreach ($results as $result) + { + if ('full' == $result->permissiontype) + { + // load folder or urls + switch ($result->dropboxoptions) + { + case 1: // sharedurl + if (self::checkJson($result->sharedurl)) + { + $targets = json_decode($result->sharedurl)->tsharedurl; + } + break; + case 2: // folders + if (self::checkJson($result->folder)) + { + $targets = json_decode($result->folder)->tfolder; + } + break; + } + if (self::checkArray($targets)) + { + foreach ($targets as $key => $value) + { + $nr = $key + 1; + // id, target, type + if (1 == $returnType) + { + $updates[] = $result->id . ', '. $nr . ', ' . $result->build; + } + else // only return the targets + { + $updates[] = $nr; + } + } + } + } + else + { + // id, target, type + if (1 == $returnType) + { + $updates[] = $result->id . ', 1, '. $result->build; + } + else // only return the targets + { + $updates[] = 1; + } + } + } + return $updates; + } + return false; + } - public static function getDropboxLink($type, $return = false, $target = false) + public static function getExternalSourceLink($type, $return = 7, $get = false, $target = 'links') { // make sure all defaults are set - $found = self::checkDropboxLocalListing($type); + $found = self::checkExternalSourceLocalListing($type, $target); if ($found) { switch($return) { case 1: // return a link - if (isset(self::${'links_dropbox_'.$type}[$target])) + if (isset(self::${$target.'_externalsource_'.$type}[$get])) { - return self::${'links_dropbox_'.$type}[$target]; + return self::${$target.'_externalsource_'.$type}[$get]; } break; case 2: // return all links - return self::${'links_dropbox_'.$type}; + return self::${$target.'_externalsource_'.$type}; break; default : // just confirm that it is set @@ -295,7 +441,7 @@ abstract class SermondistributorHelper // Get local key $localkey = self::getLocalKey(); $opener = new FOFEncryptAes($localkey, 128); - $counter = json_decode(rtrim($opener->decryptString(base64_decode($counter)))); + $counter = json_decode(rtrim($opener->decryptString($counter), "\0")); if (self::checkObject($counter)) { $counter->filename = $filename; @@ -390,27 +536,37 @@ abstract class SermondistributorHelper } /** - * check Dropbox Local Listing (do we have the files) + * check External Source Local Listing (do we have the files) **/ - public static function checkDropboxLocalListing($type) + public static function checkExternalSourceLocalListing($type, $get = 'links') { - $filePath = self::getFilePath($type); // get the local links - if (self::checkArray(self::${'links_dropbox_'.$type})) + if (isset(self::${$get.'_externalsource_'.$type}) && self::checkArray(self::${$get.'_externalsource_'.$type})) { // return true we have links loaded return true; } - elseif (($jsonlinks = @file_get_contents($filePath)) !== FALSE) - { - if (self::checkString($jsonlinks)) + else + { + $target = array('links' => 'url', 'select' => 'name'); + $build = array( 'auto' => 2, 'manual' => 1); + if (isset($build[$type])) { - // get saved links - $storeage = json_decode($jsonlinks,true); - if (self::checkArray($storeage)) + // load the links from the database + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array('key', $target[$get]))); + $query->from($db->quoteName('#__sermondistributor_local_listing')); + $query->where($db->quoteName('build') . ' = '. (int) $build[$type]); + $query->where($db->quoteName('published') . ' = 1'); // TODO we can now limit the links to access groups + // Reset the query using our newly populated query object. + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) { - // load the saved links - self::${'links_dropbox_'.$type} = $storeage; + self::${$get.'_externalsource_'.$type} = $db->loadAssocList('key', $target[$get]); + // return true we have links loaded return true; } } @@ -436,53 +592,81 @@ abstract class SermondistributorHelper /** * get the localkey **/ - protected static $localkey = false; + protected static $localkey = array(); - public static function getLocalKey() + public static function getLocalKey($type = 'basic_key') { - if (!self::$localkey) + if (!isset(self::$localkey[$type])) { // get the main key - self::$localkey = md5(JComponentHelper::getParams('com_sermondistributor')->get('link_encryption', 'localKey34fdWEkl')); + self::$localkey[$type] = JComponentHelper::getParams('com_sermondistributor')->get($type, 'localKey34fdWEkl'); } - return self::$localkey; + return self::$localkey[$type]; } - public static function updateDropbox($type = false, $force = false) + public static function updateExternalSource($id, $target = 0, $type = false, $force = false, $sleutel = null) { - // load the file - JLoader::import('dropboxupdater', JPATH_COMPONENT_SITE.'/helpers'); - // update types - $types = array('manual','auto'); - // okay now update this type - if (self::checkString($type) && in_array($type,$types)) + $source = self::getVar('external_source', (int) $id, 'id', 'externalsources'); + if (1 == $source) // Dropbox is the source { - $dropbox = new Dropboxupdater(); - return $dropbox->update($type,$force); + // load the file + JLoader::import('dropboxupdater', JPATH_COMPONENT_SITE.'/helpers'); + // update types + $types = array('manual','auto'); + // okay now update this type + if (self::checkString($type) && in_array($type,$types)) + { + $dropbox = new Dropboxupdater(); + if ($dropbox->update($id, $target, $type, $force, $sleutel)) + { + return true; + } + self::setUpdateError($id, $dropbox->getErrors()); + return false; + } } + self::setUpdateError($id, array(JText::_('COM_SERMONDISTRIBUTOR_THE_EXTERNAL_SOURCE_COULD_NOT_BE_FOUND'))); return false; } - public static function getUpdateProgress($type) + public static function getUpdateError($id, $fileKey = null) { - $filePath = self::getFilePath($type,'progress'); - // get the set progress - if (($progress = @file_get_contents($filePath)) !== FALSE) - { - if (self::checkString($progress)) + // get update error from file + if ($fileKey) + { + $file_path = self::getFilePath('update', 'error', $fileKey, '.txt', JPATH_COMPONENT_ADMINISTRATOR); + // check if it is set + if (($text = @file_get_contents($file_path)) !== FALSE) { - // get set progress - $progress = json_decode($progress,true); - if (self::checkArray($progress)) + // no error on success + if ('success' != $text) { - // return te progress - return $progress['report']; + return $text; } } + return false; + } + if (isset(self::$updateErrors[$id]) && self::checkArray(self::$updateErrors[$id])) + { + return '
  • '.implode('
  • ', self::$updateErrors[$id]).'
    • '; + } + return JText::_('COM_SERMONDISTRIBUTOR_UNKNOWN_ERROR_HAS_OCCURRED'); + } + + protected static function setUpdateError($id, $errorArray) + { + if (self::checkArray($errorArray) && $id > 0) + { + foreach ($errorArray as $error) + { + if (!isset(self::$updateErrors[$id])) + { + self::$updateErrors[$id] = array(); + } + self::$updateErrors[$id][] = $error; + } } - return 0; } - /** * Load the Component xml manifest. **/ @@ -628,6 +812,19 @@ abstract class SermondistributorHelper { JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_STATISTICS'), 'index.php?option=com_sermondistributor&view=statistics', $submenu == 'statistics'); } + if ($user->authorise('external_source.access', 'com_sermondistributor') && $user->authorise('external_source.submenu', 'com_sermondistributor')) + { + JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_EXTERNAL_SOURCES'), 'index.php?option=com_sermondistributor&view=external_sources', $submenu == 'external_sources'); + } + // Access control (manual_updater.access && manual_updater.submenu). + if ($user->authorise('manual_updater.access', 'com_sermondistributor') && $user->authorise('manual_updater.submenu', 'com_sermondistributor')) + { + JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_MANUAL_UPDATER'), 'index.php?option=com_sermondistributor&view=manual_updater', $submenu == 'manual_updater'); + } + if ($user->authorise('local_listing.access', 'com_sermondistributor') && $user->authorise('local_listing.submenu', 'com_sermondistributor')) + { + JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_LOCAL_LISTINGS'), 'index.php?option=com_sermondistributor&view=local_listings', $submenu == 'local_listings'); + } if ($user->authorise('help_document.access', 'com_sermondistributor') && $user->authorise('help_document.submenu', 'com_sermondistributor')) { JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_sermondistributor&view=help_documents', $submenu == 'help_documents'); @@ -1696,5 +1893,20 @@ abstract class SermondistributorHelper $key[] = $bag[$get]; } return implode($key); + } + + public static function getCryptKey($type, $default = null) + { + if ('basic' == $type) + { + // Get the global params + $params = JComponentHelper::getParams('com_sermondistributor', true); + $basic_key = $params->get('basic_key', $default); + if ($basic_key) + { + return $basic_key; + } + } + return false; } } diff --git a/admin/language/en-GB/en-GB.com_sermondistributor.ini b/admin/language/en-GB/en-GB.com_sermondistributor.ini index 6a53ce48..0e042333 100644 --- a/admin/language/en-GB/en-GB.com_sermondistributor.ini +++ b/admin/language/en-GB/en-GB.com_sermondistributor.ini @@ -1,44 +1,32 @@ COM_SERMONDISTRIBUTOR="Sermon Distributor" +COM_SERMONDISTRIBUTOR_ADD_THE_STRONGAPP_GENERATED_ACCESS_TOKENSTRONG_HERE="Add the App Generated access token here." +COM_SERMONDISTRIBUTOR_ADD_TOKEN_HERE="ADD TOKEN HERE!" COM_SERMONDISTRIBUTOR_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter." -COM_SERMONDISTRIBUTOR_ALWAYS_BETTER_TO_ADD_THE_FILES_TO_DROPBOX_AND_LET_THE_SYSTEM_CREATE_THE_SERMON_FOR_YOU_PLEASE_READ_INSTRUCTIONS_BELOW_CAREFULLY="Always better to add the files to Dropbox and let the system create the sermon for you. Please read instructions below carefully." +COM_SERMONDISTRIBUTOR_ALWAYS_BETTER_TO_ADD_THE_FILES_TO_EXTERNAL_SOURCE_AND_LET_THE_SYSTEM_CREATE_THE_SERMON_FOR_YOU_PLEASE_READ_INSTRUCTIONS_BELOW_CAREFULLY="Always better to add the files to External Source and let the system create the sermon for you. Please read instructions below carefully." COM_SERMONDISTRIBUTOR_AUTHOR="Author" COM_SERMONDISTRIBUTOR_A_FEW_CLOSED_ISSUES_FROM_GITHUB_IS_LOADING="A few closed issues from Github is loading" COM_SERMONDISTRIBUTOR_A_FEW_OPEN_ISSUES_FROM_GITHUB_IS_LOADING="A few open issues from Github is loading" COM_SERMONDISTRIBUTOR_BACK="Back" +COM_SERMONDISTRIBUTOR_BCOULD_NOT_USE_THE_GIVEN_TOKEN_OR_THE_GIVEN_BUILD_OPTION_DOES_NOT_EXISTB="Could not use the given token, or the given build option does not exist." +COM_SERMONDISTRIBUTOR_BTHERE_WAS_AN_ERRORB="There was an error!" +COM_SERMONDISTRIBUTOR_BY_USING_AN_ACCESS_TOKEN_YOU_WILL_BE_ABLE_TO_MAKE_API_CALLS_FOR_YOUR_OWN_ACCOUNT_WITHOUT_GOING_THROUGH_THE_AUTHORIZATION_FLOW_DURING_THIS_MANUAL_UPDATE_OF_THE_LOCAL_LISTINGBR_THE_TOKEN_WILL_NOT_BE_STORED_AND_FOR_SAFETY_THE_TOKEN_WILL_BE_REVOKED_ONCE_THE_UPDATE_IS_COMPLETED_SUCCESSFULLYBR_BTHIS_WILL_MEAN_IT_CAN_ONLY_BE_USED_THIS_ONCEB_YOU_WOULD_NEED_A_NEW_TOKEN_EACH_TIME_YOU_RUN_THIS_UPDATE_MANUALLY_BR_SMALLMAKE_SURE_TO_HAVE_SSL_INPLACE_ON_THIS_PAGE_WHEN_DOING_THIS_UPDATE_AS_AN_EXTRA_SECURITY_MEASURESMALL="By using an access token, you will be able to make API calls for your own account without going through the authorization flow during this manual update of the local listing.
      The token will not be stored and for safety the token will be revoked once the update is completed successfully.
      This will mean it can only be used this once, you would need a new token each time you run this update manually.
      Make sure to have SSL in-place on this page when doing this update, as an extra security measure." COM_SERMONDISTRIBUTOR_CATEGORIES_ACCESS_SITE="Categories (Site) Access" COM_SERMONDISTRIBUTOR_CATEGORIES_ACCESS_SITE_DESC=" Allows the users in this group to access site categories." COM_SERMONDISTRIBUTOR_CATEGORY_ACCESS_SITE="Category (Site) Access" COM_SERMONDISTRIBUTOR_CATEGORY_ACCESS_SITE_DESC=" Allows the users in this group to access site category." -COM_SERMONDISTRIBUTOR_CONFIG_ADD_TO_DROPBOX_DESCRIPTION="Allow add to Dropbox button to show, this will expose the Dropbox links." -COM_SERMONDISTRIBUTOR_CONFIG_ADD_TO_DROPBOX_LABEL="Dropbox Button" +COM_SERMONDISTRIBUTOR_CONFIG_ADD_TO_BUTTON_DESCRIPTION="Allow add to external source button to show, this will expose the external source links." +COM_SERMONDISTRIBUTOR_CONFIG_ADD_TO_BUTTON_LABEL="External Source Button" COM_SERMONDISTRIBUTOR_CONFIG_ALMOST_FLAT_LOAD="Almost Flat" -COM_SERMONDISTRIBUTOR_CONFIG_ARCHIVED="Archived" COM_SERMONDISTRIBUTOR_CONFIG_AUTHOR="Author Info" COM_SERMONDISTRIBUTOR_CONFIG_AUTHOR_EMAIL_DESC="The email address of the author of this component." COM_SERMONDISTRIBUTOR_CONFIG_AUTHOR_EMAIL_LABEL="Author Email" COM_SERMONDISTRIBUTOR_CONFIG_AUTHOR_NAME_DESC="The name of the author of this component." COM_SERMONDISTRIBUTOR_CONFIG_AUTHOR_NAME_LABEL="Author Name" -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXFOUR_DESCRIPTION="Enter the url of the main Dropbox folder to target, this will link the files." -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXFOUR_HINT="https://www.dropbox.com/shared-link-from-dropbox-to-main-folder?dl=0" -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXFOUR_LABEL="Dropbox Auto (Folder 4)" -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXONE_DESCRIPTION="Enter the url of the main Dropbox folder to target, this will link the files." -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXONE_HINT="https://www.dropbox.com/shared-link-from-dropbox-to-main-folder?dl=0" -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXONE_LABEL="Dropbox Auto (Folder 1)" -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXTHREE_DESCRIPTION="Enter the url of the main Dropbox folder to target, this will link the files." -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXTHREE_HINT="https://www.dropbox.com/shared-link-from-dropbox-to-main-folder?dl=0" -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXTHREE_LABEL="Dropbox Auto (Folder 3)" -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXTWO_DESCRIPTION="Enter the url of the main Dropbox folder to target, this will link the files." -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXTWO_HINT="https://www.dropbox.com/shared-link-from-dropbox-to-main-folder?dl=0" -COM_SERMONDISTRIBUTOR_CONFIG_AUTODROPBOXTWO_LABEL="Dropbox Auto (Folder 2)" -COM_SERMONDISTRIBUTOR_CONFIG_AUTOMATIC="Automatic" -COM_SERMONDISTRIBUTOR_CONFIG_AUTO_DROPBOX_TIMER_DESCRIPTION="Set the timer in minutes for updating the Dropbox auto local listing of file links." -COM_SERMONDISTRIBUTOR_CONFIG_AUTO_DROPBOX_TIMER_LABEL="Auto Dropbox Timer" -COM_SERMONDISTRIBUTOR_CONFIG_AUTO_LINK_TYPE_DESCRIPTION="Set the method used to build download links. Used for the initial build of the sermons." -COM_SERMONDISTRIBUTOR_CONFIG_AUTO_LINK_TYPE_LABEL="Auto Download Link Option" -COM_SERMONDISTRIBUTOR_CONFIG_AUTO_LINK_UPDATE_METHOD_DESCRIPTION="Select the method we should use when updating the auto links." -COM_SERMONDISTRIBUTOR_CONFIG_AUTO_LINK_UPDATE_METHOD_LABEL="Auto Link Update Method" COM_SERMONDISTRIBUTOR_CONFIG_AUTO_LOAD="Auto" -COM_SERMONDISTRIBUTOR_CONFIG_AVI=".avi" +COM_SERMONDISTRIBUTOR_CONFIG_BASIC_KEY_DESC="Set the basic local key here." +COM_SERMONDISTRIBUTOR_CONFIG_BASIC_KEY_LABEL="Basic Key (basic encryption)" +COM_SERMONDISTRIBUTOR_CONFIG_BASIC_KEY_NOTE_DESC="When using the basic encryption please use a 32 character passphrase.
      Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!" +COM_SERMONDISTRIBUTOR_CONFIG_BASIC_KEY_NOTE_LABEL="Basic Encryption" COM_SERMONDISTRIBUTOR_CONFIG_BIG="Big" COM_SERMONDISTRIBUTOR_CONFIG_BLUE="Blue" COM_SERMONDISTRIBUTOR_CONFIG_BOX="Box" @@ -133,30 +121,19 @@ COM_SERMONDISTRIBUTOR_CONFIG_CONTRIBUTOR_USE_NONE="None" COM_SERMONDISTRIBUTOR_CONFIG_CONTRIBUTOR_USE_WWW="Website" COM_SERMONDISTRIBUTOR_CONFIG_CUSTOM="Custom" COM_SERMONDISTRIBUTOR_CONFIG_DARK_BLUE="Dark Blue" -COM_SERMONDISTRIBUTOR_CONFIG_DIRECT="Direct" -COM_SERMONDISTRIBUTOR_CONFIG_DOC=".doc" -COM_SERMONDISTRIBUTOR_CONFIG_DOCX=".docx" COM_SERMONDISTRIBUTOR_CONFIG_DONT_LOAD="Not" -COM_SERMONDISTRIBUTOR_CONFIG_DROPBOX="Dropbox" -COM_SERMONDISTRIBUTOR_CONFIG_DROPBOX_FILETYPES_DESCRIPTION="Select the file types you would like to use from Dropbox." -COM_SERMONDISTRIBUTOR_CONFIG_DROPBOX_FILETYPES_LABEL="Dropbox File Types" -COM_SERMONDISTRIBUTOR_CONFIG_ENCRYPTED="Encrypted" +COM_SERMONDISTRIBUTOR_CONFIG_ENCRYPTION_DESC="The encription key for the field encryption is set here." +COM_SERMONDISTRIBUTOR_CONFIG_ENCRYPTION_LABEL="Encryption Settings" COM_SERMONDISTRIBUTOR_CONFIG_FLAT_LOAD="Flat" COM_SERMONDISTRIBUTOR_CONFIG_FORCE_LOAD="Force" -COM_SERMONDISTRIBUTOR_CONFIG_GIF=".gif" COM_SERMONDISTRIBUTOR_CONFIG_GLOBAL_DESC="The Global Parameters" COM_SERMONDISTRIBUTOR_CONFIG_GLOBAL_LABEL="Global" COM_SERMONDISTRIBUTOR_CONFIG_GRADIANT_LOAD="Gradient" COM_SERMONDISTRIBUTOR_CONFIG_GREEN="Green" COM_SERMONDISTRIBUTOR_CONFIG_GRID="Grid" -COM_SERMONDISTRIBUTOR_CONFIG_JPEG=".jpeg" -COM_SERMONDISTRIBUTOR_CONFIG_JPG=".jpg" COM_SERMONDISTRIBUTOR_CONFIG_JPLAYER="jPlayer" COM_SERMONDISTRIBUTOR_CONFIG_LEGACY="Legacy" COM_SERMONDISTRIBUTOR_CONFIG_LINES="Lines" -COM_SERMONDISTRIBUTOR_CONFIG_LINK_ENCRYPTION_DESCRIPTION="Add the key to use when download link option is set to encrypted." -COM_SERMONDISTRIBUTOR_CONFIG_LINK_ENCRYPTION_HINT="DBwAHPAqoFWZfDWZo6sd)E3cv2oMTG^r" -COM_SERMONDISTRIBUTOR_CONFIG_LINK_ENCRYPTION_LABEL="Download Link Encryption Key" COM_SERMONDISTRIBUTOR_CONFIG_LIST="List" COM_SERMONDISTRIBUTOR_CONFIG_LIST_SERIES_DESC_DESCRIPTION="Set if description should be shown." COM_SERMONDISTRIBUTOR_CONFIG_LIST_SERIES_DESC_LABEL="Show Description" @@ -175,332 +152,14 @@ COM_SERMONDISTRIBUTOR_CONFIG_LIST_SERIES_TABLE_COLOR_LABEL="Table Color" COM_SERMONDISTRIBUTOR_CONFIG_LOCALFOLDER_DESCRIPTION="Enter the full path to the local folder where your files are found." COM_SERMONDISTRIBUTOR_CONFIG_LOCALFOLDER_HINT="/home/username/localfolder/" COM_SERMONDISTRIBUTOR_CONFIG_LOCALFOLDER_LABEL="Local Folder Path (File Source)" -COM_SERMONDISTRIBUTOR_CONFIG_MANUAL="Manual" -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXFOUR_DESCRIPTION="Enter the url of the main manual Dropbox folder to target, this will link the files." -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXFOUR_HINT="https://www.dropbox.com/shared-link-from-dropbox-to-main-folder?dl=0" -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXFOUR_LABEL="Dropbox Manual (Folder 4)" -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXONE_DESCRIPTION="Enter the url of the main manual Dropbox folder to target, this will link the files." -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXONE_HINT="https://www.dropbox.com/shared-link-from-dropbox-to-main-folder?dl=0" -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXONE_LABEL="Dropbox Manual (Folder 1)" -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXTHREE_DESCRIPTION="Enter the url of the main manual Dropbox folder to target, this will link the files." -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXTHREE_HINT="https://www.dropbox.com/shared-link-from-dropbox-to-main-folder?dl=0" -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXTHREE_LABEL="Dropbox Manual (Folder 3)" -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXTWO_DESCRIPTION="Enter the url of the main manual Dropbox folder to target, this will link the files." -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXTWO_HINT="https://www.dropbox.com/shared-link-from-dropbox-to-main-folder?dl=0" -COM_SERMONDISTRIBUTOR_CONFIG_MANUALDROPBOXTWO_LABEL="Dropbox Manual (Folder 2)" -COM_SERMONDISTRIBUTOR_CONFIG_MANUAL_DROPBOX_TIMER_DESCRIPTION="Set the timer in minutes for updating the Dropbox manual local listing of file links." -COM_SERMONDISTRIBUTOR_CONFIG_MANUAL_DROPBOX_TIMER_LABEL="Manual Dropbox Timer" -COM_SERMONDISTRIBUTOR_CONFIG_MANUAL_LINK_UPDATE_METHOD_DESCRIPTION="Select the method we should use when updating the manual links" -COM_SERMONDISTRIBUTOR_CONFIG_MANUAL_LINK_UPDATE_METHOD_LABEL="Manual Link Update Method" -COM_SERMONDISTRIBUTOR_CONFIG_MFOURA=".m4a" -COM_SERMONDISTRIBUTOR_CONFIG_MFOURV=".m4v" -COM_SERMONDISTRIBUTOR_CONFIG_MOV=".mov" -COM_SERMONDISTRIBUTOR_CONFIG_MPFOUR=".mp4" -COM_SERMONDISTRIBUTOR_CONFIG_MPG=".mpg" -COM_SERMONDISTRIBUTOR_CONFIG_MPTHREE=".mp3" COM_SERMONDISTRIBUTOR_CONFIG_NO="No" COM_SERMONDISTRIBUTOR_CONFIG_NONE="None" -COM_SERMONDISTRIBUTOR_CONFIG_NOTE_AUTO_DROPBOX_DESCRIPTION="
        -
      • Create main/first auto folder in Dropbox. This will be where you create the folders with the preacher's name. Using the preacher's alias from the system as the folder name will insure no mismatch, if the preacher already exist on the system.
      • -
      • You can add files directly to the preacher folder if it is not linked to a series.
      • -
      • If you would like the sermon linked to a series, you simply create a folder inside the preacher's folder with the series' name, and place the sermon file inside that series' folder. Using the series' alias from the system as the folder name will insure no mismatch, if the series already exist on the system.
      • -
      • Adding other preachers to the same series will only require creating a folder inside that preacher's folder with the same series' name and placing his sermons inside that new folder. Using the series' alias from the system as the folder name will insure no mismatch, if the series already exist on the system.
      • -
      • The file name will be used as the sermon name.
      • -
      • To ensure that all downloads work well, we need to hold to the following file naming convention: -
          -
        • No spaces in the file name!!
        • -
        • No strange characters in the file name only A-z 0-9 underscore and hyphen.
        • -
        -
      • -
      • We use naming conventions to add tags, categories, a short description and combine files under one sermon, these conventions are as follow: -
          -
        • To combine files -
            -
          • Use a KEY name with TWO underscores before the actual name, example (34key521__the_file_name.mp3 & 34key521__another_file_of_the_same_sermon.pdf)
          • -
          • The KEY may only have alpha numeric characters (A-z 0-9).
          • -
          • You can combine as many files as you like under each sermon with the unique KEY.
          • -
          • There are two ways to set the sermon name with combined files: -
              -
            • All Uppercase. example (34key521__THE_FILE_NAME.mp3 & 34key521__another_file_of_the_same_sermon.pdf).
            • -
            • Longest file name if no all-uppercase file name is found. If two file names are the same length the first one is used.
            • -
            -
          • -
          • Uppercase option is the most trusted method since this will insure you get what you expected.
          • -
          -
        • -
        • To tag files -
            -
          • Directly after the file name add THREE underscores and then set the tags, example (the_file_name___tag1_tag-with2_tag-three.mp3)
          • -
          • You can add as many tags to a file as you like separated by one underscore and hyphen for spaces in a tag.
          • -
          • Combined files only need to have the tags added to one of the files. If one of the files has a tag that was not already found it will also be added to the sermon as a whole since the combined files are treated as one sermon.
          • -
          -
        • -
        • To add sermons to categories -
            -
          • Directly after the file name add FOUR underscores and then set the category name, example (the_file_name____Salvation_Messages.mp3)
          • -
          • You can add only one category per sermon. Combined files only need to have the category name added to one of the files.
          • -
          -
        • -
        • To add a short description -
            -
          • Directly after the file name add FIVE underscores and then set the description, example (the_file_name_____The_short_description_can_only_be_one_sentence.mp3)
          • -
          • You can not use any strange characters, only (A-z 0-9) and underscore for spacing.
          • -
          • You can add only one short description per sermon. Combined files only need to have the short description added to one of the files.
          • -
          -
        • -
        -
      • -
      • When you use all the naming conventions together they should follow the following order: -
          -
        • KEY before the file name with TWO underscores.
        • -
        • TAGS must be first after the file name with THREE underscores.
        • -
        • CATEGORY must be first after TAGS with FOUR underscores. IF no tags were set then it must be first after the FILE NAME with FOUR underscores.
        • -
        • SHORT DESCRIPTION must be first after CATEGORY with FIVE underscores. IF no category was set then it must be first after the TAGS with FIVE underscores. IF no tags were set then it must be first after the FILE NAME with FIVE underscores.
        • -
        -
      • -
      • Adding folders and sermons will automatically load them to your sermon distributor on your website, or update the already existing sermons with the new files.
      • -
      -
    The links that are required below should be the direct Dropbox shared links to the auto folder. They should not be the same folder, and not be inside one another. Always totally separate folders! Leave blank to deactivate." -COM_SERMONDISTRIBUTOR_CONFIG_NOTE_AUTO_DROPBOX_LABEL="Want to use Dropbox Auto links with your system, then you need to do the following:" -COM_SERMONDISTRIBUTOR_CONFIG_NOTE_DROPBOX_LABEL="Dropbox Integration Made Easy!" -COM_SERMONDISTRIBUTOR_CONFIG_NOTE_MANUAL_DROPBOX_DESCRIPTION="
      -
    • Create main/first manual folder in Dropbox. This will be where all files are placed. No sub folders, just one huge folder with all the files!
    • -
    • You will place the file on Dropbox in that main folder first.
    • -
    • Then the next step will be to come to Sermon Distributor and create the preacher and series if they do not already exist.
    • -
    • Please allow enough time (as set above +) for the local listing of files to update.
    • -
    • Then you should create the sermon the file belongs to and select 'Dropbox' as the source of your file.
    • -
    • Next select 'Manual' as the build option. This will load a drop-down with the file names in the Manual Folder on Dropbox. Should the new file not be seen give it a little more time to update the local listing of files.
    • -
    • If the List is very long, you can in the select box type the name of the file and it will shorten the list. Then select your file and continue with the setup of the sermon as usual.
    • -
    • To ensure that all downloads work well, we need to hold to the following file naming convention: -
        -
      • No spaces in the file name!!
      • -
      • No strange characters in the file name only A-z 0-9 underscore and hyphen.
      • -
      -
    • -
    The links that are required below should be the direct Dropbox shared links to the main manual folder. They should not be the same folder, and not be inside one another. Always totally separate folders! Leave blank to deactivate." -COM_SERMONDISTRIBUTOR_CONFIG_NOTE_MANUAL_DROPBOX_LABEL="Want to use Dropbox Manual links with your system, then you need to do the following:" -COM_SERMONDISTRIBUTOR_CONFIG_NOTE_UPDATE_AUTO_BUTTON_DROPBOX_DESCRIPTION="
    Manual Update Method
    Update Listing Now! (auto listing)
    " -COM_SERMONDISTRIBUTOR_CONFIG_NOTE_UPDATE_MANUAL_BUTTON_DROPBOX_DESCRIPTION="
    Manual Update Method
    Update Listing Now! (manual listing)
    -" -COM_SERMONDISTRIBUTOR_CONFIG_ODT=".odt" -COM_SERMONDISTRIBUTOR_CONFIG_OGG=".ogg" -COM_SERMONDISTRIBUTOR_CONFIG_OGV=".ogv" COM_SERMONDISTRIBUTOR_CONFIG_ONLY_EXTRA="Only Extra" COM_SERMONDISTRIBUTOR_CONFIG_PANEL="Panel" -COM_SERMONDISTRIBUTOR_CONFIG_PDF=".pdf" COM_SERMONDISTRIBUTOR_CONFIG_PLAIN="Plain" COM_SERMONDISTRIBUTOR_CONFIG_PLAYER="Player" COM_SERMONDISTRIBUTOR_CONFIG_PLAYER_DESCRIPTION="Select the player you would like to use on your site." COM_SERMONDISTRIBUTOR_CONFIG_PLAYER_LABEL="Players" -COM_SERMONDISTRIBUTOR_CONFIG_PNG=".png" -COM_SERMONDISTRIBUTOR_CONFIG_PPS=".pps" -COM_SERMONDISTRIBUTOR_CONFIG_PPSX=".ppsx" -COM_SERMONDISTRIBUTOR_CONFIG_PPT=".ppt" -COM_SERMONDISTRIBUTOR_CONFIG_PPTX=".pptx" COM_SERMONDISTRIBUTOR_CONFIG_PREACHER="Preacher" COM_SERMONDISTRIBUTOR_CONFIG_PREACHERS="Preachers" COM_SERMONDISTRIBUTOR_CONFIG_PREACHERS_DESC_DESCRIPTION="Set if description should be shown." @@ -565,11 +224,8 @@ COM_SERMONDISTRIBUTOR_CONFIG_PREACHER_SERMONS_TABLE_COLOR_DESCRIPTION="Select th COM_SERMONDISTRIBUTOR_CONFIG_PREACHER_SERMONS_TABLE_COLOR_LABEL="Sermons Table Color" COM_SERMONDISTRIBUTOR_CONFIG_PREACHER_SERMON_COUNT_DESCRIPTION="Set if sermon count should be shown." COM_SERMONDISTRIBUTOR_CONFIG_PREACHER_SERMON_COUNT_LABEL="Show Sermon Count" -COM_SERMONDISTRIBUTOR_CONFIG_PREACHER_STATE_DESCRIPTION="Set the state in which preacher so be loaded at initial build." -COM_SERMONDISTRIBUTOR_CONFIG_PREACHER_STATE_LABEL="Auto Preacher State" COM_SERMONDISTRIBUTOR_CONFIG_PREACHER_WEBSITE_DESCRIPTION="Set if the website link should be shown." COM_SERMONDISTRIBUTOR_CONFIG_PREACHER_WEBSITE_LABEL="Show Website" -COM_SERMONDISTRIBUTOR_CONFIG_PUBLISHED="Published" COM_SERMONDISTRIBUTOR_CONFIG_PURPLE="Purple" COM_SERMONDISTRIBUTOR_CONFIG_RED="Red" COM_SERMONDISTRIBUTOR_CONFIG_SELECT_AN_OPTION="select an option" @@ -617,8 +273,6 @@ COM_SERMONDISTRIBUTOR_CONFIG_SERIES_SERMONS_TABLE_COLOR_DESCRIPTION="Select the COM_SERMONDISTRIBUTOR_CONFIG_SERIES_SERMONS_TABLE_COLOR_LABEL="Sermons Table Color" COM_SERMONDISTRIBUTOR_CONFIG_SERIES_SERMON_COUNT_DESCRIPTION="Set if sermon count should be shown." COM_SERMONDISTRIBUTOR_CONFIG_SERIES_SERMON_COUNT_LABEL="Show Sermon Count" -COM_SERMONDISTRIBUTOR_CONFIG_SERIES_STATE_DESCRIPTION="Set the state in which series so be loaded at initial build." -COM_SERMONDISTRIBUTOR_CONFIG_SERIES_STATE_LABEL="Auto Series State" COM_SERMONDISTRIBUTOR_CONFIG_SERMON="Sermon" COM_SERMONDISTRIBUTOR_CONFIG_SERMON_BOX_CONTRAST_DESCRIPTION="Set if text should be contrast in box display option." COM_SERMONDISTRIBUTOR_CONFIG_SERMON_BOX_CONTRAST_LABEL="Show Contrast Text" @@ -646,16 +300,11 @@ COM_SERMONDISTRIBUTOR_CONFIG_SERMON_PREACHER_DESCRIPTION="Set if the preacher li COM_SERMONDISTRIBUTOR_CONFIG_SERMON_PREACHER_LABEL="Show Sermon Preacher" COM_SERMONDISTRIBUTOR_CONFIG_SERMON_SERIES_DESCRIPTION="Set if the series link should be shown." COM_SERMONDISTRIBUTOR_CONFIG_SERMON_SERIES_LABEL="Show Sermon Series" -COM_SERMONDISTRIBUTOR_CONFIG_SERMON_STATE_DESCRIPTION="Set the state in which sermons so be loaded at initial build." -COM_SERMONDISTRIBUTOR_CONFIG_SERMON_STATE_LABEL="Auto Sermons State" COM_SERMONDISTRIBUTOR_CONFIG_SMALL="Small" COM_SERMONDISTRIBUTOR_CONFIG_SOUNDMANAGER="Soundmanager" COM_SERMONDISTRIBUTOR_CONFIG_SPACED="Spaced" COM_SERMONDISTRIBUTOR_CONFIG_STRIPED="Striped" COM_SERMONDISTRIBUTOR_CONFIG_TABLE="Table" -COM_SERMONDISTRIBUTOR_CONFIG_THREEGP=".3gp" -COM_SERMONDISTRIBUTOR_CONFIG_THREEGTWO=".3g2" -COM_SERMONDISTRIBUTOR_CONFIG_TRASHED="Trashed" COM_SERMONDISTRIBUTOR_CONFIG_UIKIT="Uikit" COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_DESC="The Parameters for the uikit are set here.
    Uikit is a lightweight and modular front-end framework for developing fast and powerful web interfaces. For more info visit http://getuikit.com/" @@ -666,19 +315,17 @@ COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_MIN_DESC="Should the minified version of uiki COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_MIN_LABEL="Load Minified" COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_STYLE_DESC="Set the css style that should be used." COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_STYLE_LABEL="css Style" -COM_SERMONDISTRIBUTOR_CONFIG_UNPUBLISHED="Unpublished" -COM_SERMONDISTRIBUTOR_CONFIG_WAV=".wav" -COM_SERMONDISTRIBUTOR_CONFIG_WMV=".wmv" -COM_SERMONDISTRIBUTOR_CONFIG_XLS=".xls" -COM_SERMONDISTRIBUTOR_CONFIG_XLSX=".xlsx" COM_SERMONDISTRIBUTOR_CONFIG_YES="Yes" -COM_SERMONDISTRIBUTOR_CONFIG_ZIP=".zip" COM_SERMONDISTRIBUTOR_CONTRIBUTOR="Contributor" COM_SERMONDISTRIBUTOR_CONTRIBUTORS="Contributors" COM_SERMONDISTRIBUTOR_CREATE_NEW_S="Create New %s" COM_SERMONDISTRIBUTOR_DASH="Dashboard" COM_SERMONDISTRIBUTOR_DASHBOARD="Sermon Distributor Dashboard" +COM_SERMONDISTRIBUTOR_DASHBOARD_EXTERNAL_SOURCES="External Sources

    " +COM_SERMONDISTRIBUTOR_DASHBOARD_EXTERNAL_SOURCE_ADD="Add External Source

    " COM_SERMONDISTRIBUTOR_DASHBOARD_HELP_DOCUMENTS="Help Documents

    " +COM_SERMONDISTRIBUTOR_DASHBOARD_LOCAL_LISTINGS="Local Listings

    " +COM_SERMONDISTRIBUTOR_DASHBOARD_MANUAL_UPDATER="Manual Updater

    " COM_SERMONDISTRIBUTOR_DASHBOARD_PREACHERS="Preachers

    " COM_SERMONDISTRIBUTOR_DASHBOARD_PREACHER_ADD="Add Preacher

    " COM_SERMONDISTRIBUTOR_DASHBOARD_SERIES_ADD="Add Series

    " @@ -689,7 +336,6 @@ COM_SERMONDISTRIBUTOR_DASHBOARD_SERMON_ADD="Add Sermon

    " COM_SERMONDISTRIBUTOR_DASHBOARD_STATISTICS="Statistics

    " COM_SERMONDISTRIBUTOR_DATE="Date" COM_SERMONDISTRIBUTOR_DOWNLOAD_NAME="Download Name" -COM_SERMONDISTRIBUTOR_DROPBOX_RELATION="Dropbox Relation" COM_SERMONDISTRIBUTOR_EDIT_CREATED_BY="Edit Created By" COM_SERMONDISTRIBUTOR_EDIT_CREATED_BY_DESC=" Allows users in this group to edit created by." COM_SERMONDISTRIBUTOR_EDIT_CREATED_DATE="Edit Created Date" @@ -700,6 +346,266 @@ COM_SERMONDISTRIBUTOR_EDIT_VERSIONS_DESC=" Allows users in this group to edit ve COM_SERMONDISTRIBUTOR_EXPORT_DATA="Export Data" COM_SERMONDISTRIBUTOR_EXPORT_DATA_DESC=" Allows users in this group to export data." COM_SERMONDISTRIBUTOR_EXPORT_FAILED="Export Failed" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE="External Source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES="External Sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_ACCESS="External Sources Access" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_ACCESS_DESC="Allows the users in this group to access access external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_OPTIONS="Batch process the selected External Sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_TIP="All changes will be applied to all selected External Sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_USE="External Sources Batch Use" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_CREATE="External Sources Create" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_CREATE_DESC="Allows the users in this group to create create external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_DASHBOARD_ADD="External Sources Dashboard Add" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_DASHBOARD_LIST="External Sources Dashboard List" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_DELETE="External Sources Delete" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_DELETE_DESC="Allows the users in this group to delete delete external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT="External Sources Edit" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_BUILD="External Sources Edit Build" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_BUILD_DESC="Allows the users in this group to update the edit build of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_CREATED_BY="External Sources Edit Created By" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_CREATED_DATE="External Sources Edit Created Date" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_DESC="Allows the users in this group to edit the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_DESCRIPTION="External Sources Edit Description" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_DESCRIPTION_DESC="Allows the users in this group to update the edit description of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_DROPBOXOPTIONS="External Sources Edit Dropboxoptions" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_DROPBOXOPTIONS_DESC="Allows the users in this group to update the edit dropboxoptions of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_EXTERNALSOURCES="External Sources Edit Externalsources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_EXTERNALSOURCES_DESC="Allows the users in this group to update the edit externalsources of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_FILETYPES="External Sources Edit Filetypes" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_FILETYPES_DESC="Allows the users in this group to update the edit filetypes of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_FOLDER="External Sources Edit Folder" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_FOLDER_DESC="Allows the users in this group to update the edit folder of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_OAUTHTOKEN="External Sources Edit Oauthtoken" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_OAUTHTOKEN_DESC="Allows the users in this group to update the edit oauthtoken of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_OWN="External Sources Edit Own" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_OWN_DESC="Allows the users in this group to edit edit own external sources created by them" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_PERMISSIONTYPE="External Sources Edit Permissiontype" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_PERMISSIONTYPE_DESC="Allows the users in this group to update the edit permissiontype of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_SHAREDURL="External Sources Edit Sharedurl" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_SHAREDURL_DESC="Allows the users in this group to update the edit sharedurl of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_STATE="External Sources Edit State" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_STATE_DESC="Allows the users in this group to update the state of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_UPDATE_METHOD="External Sources Edit Update Method" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_UPDATE_METHOD_DESC="Allows the users in this group to update the edit update method of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_UPDATE_TIMER="External Sources Edit Update Timer" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_UPDATE_TIMER_DESC="Allows the users in this group to update the edit update timer of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_VERSION="External Sources Edit Version" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EXPORT="External Sources Export" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EXPORT_DESC="Allows the users in this group to export export external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_IMPORT="External Sources Import" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_IMPORT_DESC="Allows the users in this group to import import external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_ARCHIVED="%s External Sources archived." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_ARCHIVED_1="%s External Source archived." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_CHECKED_IN_0="No External Source successfully checked in." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_CHECKED_IN_1="%d External Source successfully checked in." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_CHECKED_IN_MORE="%d External Sources successfully checked in." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_DELETED="%s External Sources deleted." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_DELETED_1="%s External Source deleted." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_FEATURED="%s External Sources featured." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_FEATURED_1="%s External Source featured." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_PUBLISHED="%s External Sources published." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_PUBLISHED_1="%s External Source published." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_TRASHED="%s External Sources trashed." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_TRASHED_1="%s External Source trashed." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_UNFEATURED="%s External Sources unfeatured." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_UNFEATURED_1="%s External Source unfeatured." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_UNPUBLISHED="%s External Sources unpublished." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_UNPUBLISHED_1="%s External Source unpublished." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_SUBMENU="External Sources Submenu" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_SUBMENU_DESC="Allows the users in this group to update the submenu of the external source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_APP_FOLDER="App folder" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_APP_LIMITATION_NOTE_DESCRIPTION="Please Note: There is a limitation of 2000 files app/folder" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_AUTOMATIC="Automatic" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_AVI=".avi" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD="Build" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_DESCRIPTION="Set the method used to add files." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL="Build Option" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_CREATED_BY_DESC="The user that created this External Source." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_CREATED_BY_LABEL="Created By" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_CREATED_DATE_DESC="The date this External Source was created." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_CREATED_DATE_LABEL="Created Date" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION="Description" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_DESCRIPTION="Enter some description" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_HINT="Description Here" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_LABEL="Description" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DETAILS="Details" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DOC=".doc" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DOCX=".docx" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DROPBOX="Dropbox" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DROPBOXOPTIONS="Dropboxoptions" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DROPBOXOPTIONS_DESCRIPTION="Select the option you would like to use in targeting the Dropbox API." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DROPBOXOPTIONS_LABEL="Options" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DYNAMIC_AUTOMATIC_BUILD="Dynamic Automatic Build" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EDIT="Editing the External Source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ERROR_UNIQUE_ALIAS="Another External Source has the same alias." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES="Externalsources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_DESCRIPTION="Only one option at this time" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL="External Sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FILETYPES="Filetypes" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FILETYPES_DESCRIPTION="Select the file types you would like to use from this external sources." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FILETYPES_LABEL="File Types" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FOLDER="Folder" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FOLDER_DESCRIPTION="Enter the folders to target. The folders must be in the account where you generated the access token." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FOLDER_LABEL="Target Folders
    Please note: limitation of 2000 files per/folder" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FOLDER_PATH="Folder Path" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FOLDER_SELECT="Add/Remove" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FULL_DROPBOX="Full Dropbox" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_GENERATED_ACCESS_TOKEN_NOTE_DESCRIPTION="The manual option you selected will not require you to store the access token on this server. But you will need it during the manual updating process." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_GENERATED_ACCESS_TOKEN_NOTE_LABEL="Generated access token" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_GIF=".gif" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ID="Id" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_JPEG=".jpeg" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_JPG=".jpg" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MANUAL="Manual" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MANUAL_LOCAL_SELECTION="Manual Local Selection" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MFOURA=".m4a" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MFOURV=".m4v" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MODIFIED_BY_DESC="The last user that modified this External Source." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MODIFIED_BY_LABEL="Modified By" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MODIFIED_DATE_DESC="The date this External Source was modified." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MODIFIED_DATE_LABEL="Modified Date" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MOV=".mov" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MPFOUR=".mp4" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MPG=".mpg" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MPTHREE=".mp3" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NEW="A New External Source" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NOTE_AUTO_DROPBOX_DESCRIPTION="
      +
    • Create main/first auto folder in Dropbox. This will be where you create the folders with the preacher's name. Using the preacher's alias from the system as the folder name will insure no mismatch, if the preacher already exist on the system.
    • +
    • You can add files directly to the preacher folder if it is not linked to a series.
    • +
    • If you would like the sermon linked to a series, you simply create a folder inside the preacher's folder with the series' name, and place the sermon file inside that series' folder. Using the series' alias from the system as the folder name will insure no mismatch, if the series already exist on the system.
    • +
    • Adding other preachers to the same series will only require creating a folder inside that preacher's folder with the same series' name and placing his sermons inside that new folder. Using the series' alias from the system as the folder name will insure no mismatch, if the series already exist on the system.
    • +
    • The file name will be used as the sermon name.
    • +
    • To ensure that all downloads work well, we need to hold to the following file naming convention: +
        +
      • No spaces in the file name!!
      • +
      • No strange characters in the file name only A-z 0-9 underscore and hyphen.
      • +
      +
    • +
    • We use naming conventions to add tags, categories, a short description and combine files under one sermon, these conventions are as follow: +
        +
      • To combine files +
          +
        • Use a KEY name with TWO underscores before the actual name, example (34key521__the_file_name.mp3 & 34key521__another_file_of_the_same_sermon.pdf)
        • +
        • The KEY may only have alpha numeric characters (A-z 0-9).
        • +
        • You can combine as many files as you like under each sermon with the unique KEY.
        • +
        • There are two ways to set the sermon name with combined files: +
            +
          • All Uppercase. example (34key521__THE_FILE_NAME.mp3 & 34key521__another_file_of_the_same_sermon.pdf).
          • +
          • Longest file name if no all-uppercase file name is found. If two file names are the same length the first one is used.
          • +
          +
        • +
        • Uppercase option is the most trusted method since this will insure you get what you expected.
        • +
        +
      • +
      • To tag files +
          +
        • Directly after the file name add THREE underscores and then set the tags, example (the_file_name___tag1_tag-with2_tag-three.mp3)
        • +
        • You can add as many tags to a file as you like separated by one underscore and hyphen for spaces in a tag.
        • +
        • Combined files only need to have the tags added to one of the files. If one of the files has a tag that was not already found it will also be added to the sermon as a whole since the combined files are treated as one sermon.
        • +
        +
      • +
      • To add sermons to categories +
          +
        • Directly after the file name add FOUR underscores and then set the category name, example (the_file_name____Salvation_Messages.mp3)
        • +
        • You can add only one category per sermon. Combined files only need to have the category name added to one of the files.
        • +
        +
      • +
      • To add a short description +
          +
        • Directly after the file name add FIVE underscores and then set the description, example (the_file_name_____The_short_description_can_only_be_one_sentence.mp3)
        • +
        • You can not use any strange characters, only (A-z 0-9) and underscore for spacing.
        • +
        • You can add only one short description per sermon. Combined files only need to have the short description added to one of the files.
        • +
        +
      • +
      +
    • +
    • When you use all the naming conventions together they should follow the following order: +
        +
      • KEY before the file name with TWO underscores.
      • +
      • TAGS must be first after the file name with THREE underscores.
      • +
      • CATEGORY must be first after TAGS with FOUR underscores. IF no tags were set then it must be first after the FILE NAME with FOUR underscores.
      • +
      • SHORT DESCRIPTION must be first after CATEGORY with FIVE underscores. IF no category was set then it must be first after the TAGS with FIVE underscores. IF no tags were set then it must be first after the FILE NAME with FIVE underscores.
      • +
      +
    • +
    • Adding folders and sermons will automatically load them to your sermon distributor on your website, or update the already existing sermons with the new files.
    • +
    +
The links that are required below should be the direct Dropbox shared links to the auto folder. They should not be the same folder, and not be inside one another. Always totally separate folders! Leave blank to deactivate." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NOTE_AUTO_DROPBOX_LABEL="Want to use Dropbox Auto links with your system, then you need to do the following:" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NOTE_MANUAL_DROPBOX_DESCRIPTION="
    +
  • Create main/first manual folder in Dropbox. This will be where all files are placed. No sub folders, just one huge folder with all the files!
  • +
  • You will place the file on Dropbox in that main folder first.
  • +
  • Then the next step will be to come to Sermon Distributor and create the preacher and series if they do not already exist.
  • +
  • Please allow enough time (as set above +) for the local listing of files to update.
  • +
  • Then you should create the sermon the file belongs to and select 'Dropbox' as the source of your file.
  • +
  • Next select 'Manual' as the build option. This will load a drop-down with the file names in the Manual Folder on Dropbox. Should the new file not be seen give it a little more time to update the local listing of files.
  • +
  • If the List is very long, you can in the select box type the name of the file and it will shorten the list. Then select your file and continue with the setup of the sermon as usual.
  • +
  • To ensure that all downloads work well, we need to hold to the following file naming convention: +
      +
    • No spaces in the file name!!
    • +
    • No strange characters in the file name only A-z 0-9 underscore and hyphen.
    • +
    +
  • +
The links that are required below should be the direct Dropbox shared links to the main manual folder. They should not be the same folder, and not be inside one another. Always totally separate folders! Leave blank to deactivate." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NOTE_MANUAL_DROPBOX_LABEL="Want to use Dropbox Manual links with your system, then you need to do the following:" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NOT_REQUIRED="Not Required" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_OAUTHTOKEN="Oauthtoken" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_OAUTHTOKEN_DESCRIPTION="By using an access token, the system will be able to make automatic API calls to your app without going through the authorization flow.
This field is being kept encrypted in the database.
Yet Joomla back-end must be access with SSL in-place when saving this page. This will help avoid a man in the middle attach on your access token." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_OAUTHTOKEN_HINT="oauthtoken here" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_OAUTHTOKEN_LABEL="App Generated access token
(Encrypted Field)" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ODT=".odt" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_OGG=".ogg" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_OGV=".ogv" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ORDERING_LABEL="Ordering" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PDF=".pdf" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PERMISSION="Permissions" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PERMISSIONTYPE="Permissiontype" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PERMISSIONTYPE_DESCRIPTION="What kind of permission type is your app." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PERMISSIONTYPE_LABEL="App Permission Type" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PNG=".png" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PPS=".pps" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PPSX=".ppsx" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PPT=".ppt" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PPTX=".pptx" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PUBLISHING="Publishing" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_RELATION="External Source Relation" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the External Source to customise the alias." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_SELECT_AN_OPTION="Select an option" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_SHAREDURL="Sharedurl" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_SHAREDURL_DESCRIPTION="Enter the shared-urls of the main folders to target. The shared-urls must be from the account where you generated the access token." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_SHAREDURL_LABEL="Target Shared-urls
Please note: limitation of 2000 files per/shared-url" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_SHAREDURL_SELECT="Add/Remove" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_SHARED_URL="Shared URL" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_STATUS="Status" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_TFOLDER_DESCRIPTION="Enter the folder to target. The folder must be in the account where you generated the access token." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_TFOLDER_HINT="any/folder/in/your/Dropbox" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_TFOLDER_LABEL="Folder" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_THREEGP=".3gp" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_THREEGTWO=".3g2" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_TSHAREDURL_DESCRIPTION="Enter the shared-url of the main folder to target. The shared-url must be from the account where you generated the access token." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_TSHAREDURL_HINT="https://www.dropbox.com/shared-link-from-dropbox-to-main-folder?dl=0" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_TSHAREDURL_LABEL="Shared-url" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD="Update Method" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_DESCRIPTION="Select the method we should use when updating the links." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL="Update Method" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_TIMER="Update Timer" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_TIMER_DESCRIPTION="Set the timer in minutes for updating the external source local listing of file links." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_TIMER_LABEL="Update Timer" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_VERSION_DESC="A count of the number of times this External Source has been revised." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_VERSION_LABEL="Revision" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WAV=".wav" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WIKI="Wiki" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WIKI_CHECK_NOTE_DESCRIPTION="It will give instructions on how to setup the external source in relation to the Build Option you have chosen." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WIKI_CHECK_NOTE_LABEL="Please check the Wiki tab above." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WMV=".wmv" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLS=".xls" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLSX=".xlsx" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ZIP=".zip" COM_SERMONDISTRIBUTOR_HELP_DOCUMENT="Help Document" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS="Help Documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS="Help Documents Access" @@ -835,7 +741,9 @@ COM_SERMONDISTRIBUTOR_IMPORT_NO_IMPORT_TYPE_FOUND="Import type not found." COM_SERMONDISTRIBUTOR_IMPORT_PLEASE_SELECT_COLUMN="-- Please Select Column --" COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE="Select File" COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_DIRECTORY="Set the path to file" +COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_EXTERNAL_SOURCES="Select the file to import data to external_sources." COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS="Select the file to import data to help_documents." +COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_LOCAL_LISTINGS="Select the file to import data to local_listings." COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_PREACHERS="Select the file to import data to preachers." COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERIES_LIST="Select the file to import data to series_list." COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERMONS="Select the file to import data to sermons." @@ -851,11 +759,128 @@ COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS="- Keep Original Access -" COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_CATEGORY="- Keep Original Category -" COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE="- Keep Original State -" COM_SERMONDISTRIBUTOR_LICENSE="License" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING="Local Listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS="Local Listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_ACCESS="Local Listings Access" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_ACCESS_DESC="Allows the users in this group to access access local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_OPTIONS="Batch process the selected Local Listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_TIP="All changes will be applied to all selected Local Listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_USE="Local Listings Batch Use" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_CREATE="Local Listings Create" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_CREATE_DESC="Allows the users in this group to create create local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_DASHBOARD_LIST="Local Listings Dashboard List" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_DELETE="Local Listings Delete" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_DELETE_DESC="Allows the users in this group to delete delete local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT="Local Listings Edit" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_BUILD="Local Listings Edit Build" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_BUILD_DESC="Allows the users in this group to update the edit build of the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_CREATED_BY="Local Listings Edit Created By" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_CREATED_DATE="Local Listings Edit Created Date" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_DESC="Allows the users in this group to edit the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_EXTERNAL_SOURCE="Local Listings Edit External Source" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_EXTERNAL_SOURCE_DESC="Allows the users in this group to update the edit external source of the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_KEY="Local Listings Edit Key" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_KEY_DESC="Allows the users in this group to update the edit key of the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_NAME="Local Listings Edit Name" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_NAME_DESC="Allows the users in this group to update the edit name of the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_OWN="Local Listings Edit Own" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_OWN_DESC="Allows the users in this group to edit edit own local listings created by them" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_SIZE="Local Listings Edit Size" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_SIZE_DESC="Allows the users in this group to update the edit size of the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_STATE="Local Listings Edit State" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_STATE_DESC="Allows the users in this group to update the state of the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_URL="Local Listings Edit Url" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_URL_DESC="Allows the users in this group to update the edit url of the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_VERSION="Local Listings Edit Version" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EXPORT="Local Listings Export" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EXPORT_DESC="Allows the users in this group to export export local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_IMPORT="Local Listings Import" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_IMPORT_DESC="Allows the users in this group to import import local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_ARCHIVED="%s Local Listings archived." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_ARCHIVED_1="%s Local Listing archived." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_CHECKED_IN_0="No Local Listing successfully checked in." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_CHECKED_IN_1="%d Local Listing successfully checked in." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_CHECKED_IN_MORE="%d Local Listings successfully checked in." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_DELETED="%s Local Listings deleted." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_DELETED_1="%s Local Listing deleted." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_FEATURED="%s Local Listings featured." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_FEATURED_1="%s Local Listing featured." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_PUBLISHED="%s Local Listings published." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_PUBLISHED_1="%s Local Listing published." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_TRASHED="%s Local Listings trashed." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_TRASHED_1="%s Local Listing trashed." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_UNFEATURED="%s Local Listings unfeatured." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_UNFEATURED_1="%s Local Listing unfeatured." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_UNPUBLISHED="%s Local Listings unpublished." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_UNPUBLISHED_1="%s Local Listing unpublished." +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_SUBMENU="Local Listings Submenu" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_SUBMENU_DESC="Allows the users in this group to update the submenu of the local listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD="Build" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_DESCRIPTION="Set the method used to add files." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL="Build Option" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_CREATED_BY_DESC="The user that created this Local Listing." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_CREATED_BY_LABEL="Created By" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_CREATED_DATE_DESC="The date this Local Listing was created." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_CREATED_DATE_LABEL="Created Date" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_DETAILS="Details" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_DYNAMIC_AUTOMATIC_BUILD="Dynamic Automatic Build" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EDIT="Editing the Local Listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ERROR_UNIQUE_ALIAS="Another Local Listing has the same alias." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE="External Source" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_DESCRIPTION="The external source of this listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL="External Source" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ID="Id" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_KEY="Key" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_KEY_DESCRIPTION="This key will be used for this local listing." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_KEY_HINT="Listing Key" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_KEY_LABEL="Listing Key" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_MANUAL_LOCAL_SELECTION="Manual Local Selection" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_MODIFIED_BY_DESC="The last user that modified this Local Listing." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_MODIFIED_BY_LABEL="Modified By" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_MODIFIED_DATE_DESC="The date this Local Listing was modified." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_MODIFIED_DATE_LABEL="Modified Date" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME="Name" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_DESCRIPTION="This is the file name." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_HINT="file name" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_LABEL="File Name" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NEW="A New Local Listing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ORDERING_LABEL="Ordering" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_PERMISSION="Permissions" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_PUBLISHING="Publishing" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Local Listing to customise the alias." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SELECT_AN_OPTION="Select an option" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SIZE="Size" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SIZE_DESCRIPTION="This is the file size." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SIZE_HINT="file size" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SIZE_LABEL="File Size" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_STATUS="Status" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_URL="Url" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_URL_DESCRIPTION="This is the shared URL." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_URL_HINT="shared URL" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_URL_LABEL="Shared-URL" +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_VERSION_DESC="A count of the number of times this Local Listing has been revised." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_VERSION_LABEL="Revision" +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER="Manual Updater" +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER_ACCESS="Manual Updater Access" +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER_ACCESS_DESC="Allows the users in this group to access Manual Updater" +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER_DASHBOARD_LIST="Manual Updater Dashboard List" +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the Manual Updater" +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER_DESC="Manual Updater" +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER_EXTERNAL_SOURCES_BUTTON_ACCESS="Manual Updater External Sources Button Access" +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER_EXTERNAL_SOURCES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the external sources button." +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER_SUBMENU="Manual Updater Submenu" +COM_SERMONDISTRIBUTOR_MANUAL_UPDATER_SUBMENU_DESC="Allows the users in this group to update the submenu of the Manual Updater" COM_SERMONDISTRIBUTOR_NEW="New" COM_SERMONDISTRIBUTOR_NEW_ISSUE="New Issue" COM_SERMONDISTRIBUTOR_NOT_FOUND_OR_ACCESS_DENIED="Not found, or access denied." COM_SERMONDISTRIBUTOR_NO_ACCESS_GRANTED="No Access Granted!" COM_SERMONDISTRIBUTOR_NO_FILES_LINKED_YET="No Files Linked Yet" +COM_SERMONDISTRIBUTOR_NO_MANUAL_UPDATES_AVAILABLE="No Manual Updates Available" COM_SERMONDISTRIBUTOR_OPENED_BY="opened by" COM_SERMONDISTRIBUTOR_PLEASE_CHECK_AGAIN_LATTER="Please check again latter." COM_SERMONDISTRIBUTOR_PREACHER="Preacher" @@ -1106,10 +1131,9 @@ COM_SERMONDISTRIBUTOR_SERMON_ACCESS_SITE_DESC=" Allows the users in this group t COM_SERMONDISTRIBUTOR_SERMON_ALIAS="Alias" COM_SERMONDISTRIBUTOR_SERMON_ALIAS_HINT="Auto-generated from name" COM_SERMONDISTRIBUTOR_SERMON_ALIAS_LABEL="Alias" -COM_SERMONDISTRIBUTOR_SERMON_AUTOMATIC="Automatic" COM_SERMONDISTRIBUTOR_SERMON_AUTO_SERMONS="Auto Sermons" COM_SERMONDISTRIBUTOR_SERMON_BUILD="Build" -COM_SERMONDISTRIBUTOR_SERMON_BUILD_DESCRIPTION="Set the method used to add files to this sermon." +COM_SERMONDISTRIBUTOR_SERMON_BUILD_DESCRIPTION="Set the method used to add files." COM_SERMONDISTRIBUTOR_SERMON_BUILD_LABEL="Build Option" COM_SERMONDISTRIBUTOR_SERMON_CATID_DESCRIPTION="select one of the following categories" COM_SERMONDISTRIBUTOR_SERMON_CATID_LABEL="Category" @@ -1121,10 +1145,11 @@ COM_SERMONDISTRIBUTOR_SERMON_DESCRIPTION="Description" COM_SERMONDISTRIBUTOR_SERMON_DESCRIPTION_LABEL="Description" COM_SERMONDISTRIBUTOR_SERMON_DETAILS="Details" COM_SERMONDISTRIBUTOR_SERMON_DIRECT="Direct" -COM_SERMONDISTRIBUTOR_SERMON_DROPBOX="Dropbox" +COM_SERMONDISTRIBUTOR_SERMON_DYNAMIC_AUTOMATIC_BUILD="Dynamic Automatic Build" COM_SERMONDISTRIBUTOR_SERMON_EDIT="Editing the Sermon" COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED="Encrypted" COM_SERMONDISTRIBUTOR_SERMON_ERROR_UNIQUE_ALIAS="Another Sermon has the same alias." +COM_SERMONDISTRIBUTOR_SERMON_EXTERNAL_SOURCE="External Source" COM_SERMONDISTRIBUTOR_SERMON_FILES="Files" COM_SERMONDISTRIBUTOR_SERMON_ICON="Icon" COM_SERMONDISTRIBUTOR_SERMON_ICON_DESCRIPTION="Must be 358px x 358px" @@ -1137,10 +1162,10 @@ COM_SERMONDISTRIBUTOR_SERMON_LOCAL_FILES="Local Files" COM_SERMONDISTRIBUTOR_SERMON_LOCAL_FILES_DESCRIPTION="Select the files you would like to add to this sermon." COM_SERMONDISTRIBUTOR_SERMON_LOCAL_FILES_LABEL="Files" COM_SERMONDISTRIBUTOR_SERMON_LOCAL_FOLDER="Local Folder" -COM_SERMONDISTRIBUTOR_SERMON_MANUAL="Manual" COM_SERMONDISTRIBUTOR_SERMON_MANUAL_FILES="Manual Files" COM_SERMONDISTRIBUTOR_SERMON_MANUAL_FILES_DESCRIPTION="Select the files you would like to add to this sermon." COM_SERMONDISTRIBUTOR_SERMON_MANUAL_FILES_LABEL="Files" +COM_SERMONDISTRIBUTOR_SERMON_MANUAL_LOCAL_SELECTION="Manual Local Selection" COM_SERMONDISTRIBUTOR_SERMON_MODIFIED_BY_DESC="The last user that modified this Sermon." COM_SERMONDISTRIBUTOR_SERMON_MODIFIED_BY_LABEL="Modified By" COM_SERMONDISTRIBUTOR_SERMON_MODIFIED_DATE_DESC="The date this Sermon was modified." @@ -1150,8 +1175,8 @@ COM_SERMONDISTRIBUTOR_SERMON_NAME_DESCRIPTION="Enter Name Here" COM_SERMONDISTRIBUTOR_SERMON_NAME_HINT="Name Here" COM_SERMONDISTRIBUTOR_SERMON_NAME_LABEL="Name" COM_SERMONDISTRIBUTOR_SERMON_NEW="A New Sermon" -COM_SERMONDISTRIBUTOR_SERMON_NOTE_AUTO_DROPBOX_DESCRIPTION="To integrate auto Dropbox with your system you need to do the following:
    -
  • Create main/first auto folder in Dropbox. This will be where you create the folders with the preacher's name. Using the preacher's alias from the system as the folder name will insure no mismatch, if the preacher already exist on the system.
  • +COM_SERMONDISTRIBUTOR_SERMON_NOTE_AUTO_EXTERNALSOURCE_DESCRIPTION="To integrate auto External Source with your system you need to do the following:
      +
    • Create main/first auto folder in External Source. This will be where you create the folders with the preacher's name. Using the preacher's alias from the system as the folder name will insure no mismatch, if the preacher already exist on the system.
    • You can add files directly to the preacher folder if it is not linked to a series.
    • If you would like the sermon linked to a series, you simply create a folder inside the preacher's folder with the series' name, and place the sermon file inside that series' folder. Using the series' alias from the system as the folder name will insure no mismatch, if the series already exist on the system.
    • Adding other preachers to the same series will only require creating a folder inside that preacher's folder with the same series' name and placing his sermons inside that new folder. Using the series' alias from the system as the folder name will insure no mismatch, if the series already exist on the system.
    • @@ -1210,20 +1235,20 @@ COM_SERMONDISTRIBUTOR_SERMON_NOTE_AUTO_DROPBOX_DESCRIPTION="To integrate auto
    • Adding folders and sermons will automatically load them to your sermon distributor on your website, or update the already existing sermons with the new files.
    -
Make sure you have at least one auto folder in Dropbox and have added the shared link in the Sermon Distributor " -COM_SERMONDISTRIBUTOR_SERMON_NOTE_AUTO_DROPBOX_LABEL="Dropbox Integration" +Make sure you have at least one auto folder in External Source and have added the information in the Sermon Distributors " +COM_SERMONDISTRIBUTOR_SERMON_NOTE_AUTO_EXTERNALSOURCE_LABEL="External Source Integration" COM_SERMONDISTRIBUTOR_SERMON_NOTE_LINK_DIRECTED_DESCRIPTION="This link option does not allow counting of the downloads of this file, and does not secures the download location of this file. Other can reuse it by adding it to their own websites, this action is called hotlinking, leeching, piggy-backing." COM_SERMONDISTRIBUTOR_SERMON_NOTE_LINK_DIRECTED_LABEL="The Direct Link Option" COM_SERMONDISTRIBUTOR_SERMON_NOTE_LINK_ENCRYPTED_DESCRIPTION="This link option allows for counting of all downloads of this file, and secures the download location of this file. The download link also prevents other from reusing the link outside of your website if they are not in the same session." COM_SERMONDISTRIBUTOR_SERMON_NOTE_LINK_ENCRYPTED_LABEL="The Encrypted Link Option" -COM_SERMONDISTRIBUTOR_SERMON_NOTE_MANUAL_DROPBOX_DESCRIPTION="To integrate manual Dropbox option with your system you need to do the following: +COM_SERMONDISTRIBUTOR_SERMON_NOTE_MANUAL_EXTERNALSOURCE_DESCRIPTION="To integrate manual External Source option with your system you need to do the following:
    -
  • Create main/first manual folder in Dropbox. This will be where all files are placed. No sub folders, just one huge folder with all the files!
  • -
  • You will place the file on Dropbox in that main folder first.
  • +
  • Create main/first manual folder in External Source. This will be where all files are placed. No sub folders, just one huge folder with all the files!
  • +
  • You will place the file on External Source in that main folder first.
  • Then the next step will be to come to Sermon Distributor and create the preacher and series if they do not already exist.
  • Please allow enough time (as set in Sermon Distributor Options) for the local listing of files to update.
  • -
  • Then you should create the sermon the file belongs to and select 'Dropbox' as the source of your file.
  • -
  • Next select 'Manual' as the build option. This will load a drop-down with the file names in the Manual Folder on Dropbox. Should the new file not be seen give it a little more time to update the local listing of files.
  • +
  • Then you should create the sermon the file belongs to and select 'External Source' as the source of your file.
  • +
  • Next select 'Manual' as the build option. This will load a drop-down with the file names in the Manual Folder on External Source. Should the new file not be seen give it a little more time to update the local listing of files.
  • If the List is very long, you can in the select box type the name of the file and it will shorten the list. Then select your file and continue with the setup of the sermon as usual.
  • To ensure that all downloads work well, we need to hold to the following file naming convention:
      @@ -1232,8 +1257,8 @@ COM_SERMONDISTRIBUTOR_SERMON_NOTE_MANUAL_DROPBOX_DESCRIPTION="To integrate ma
-Make sure you have at least one manual folder in Dropbox and have added the shared link in the Sermon Distributor " -COM_SERMONDISTRIBUTOR_SERMON_NOTE_MANUAL_DROPBOX_LABEL="Dropbox Integration" +Make sure you have at least one manual folder in External Source and have added the shared link in the Sermon Distributor " +COM_SERMONDISTRIBUTOR_SERMON_NOTE_MANUAL_EXTERNALSOURCE_LABEL="External Source Integration" COM_SERMONDISTRIBUTOR_SERMON_NOT_REQUIRED="Not Required" COM_SERMONDISTRIBUTOR_SERMON_ORDERING_LABEL="Ordering" COM_SERMONDISTRIBUTOR_SERMON_PERMISSION="Permissions" @@ -1246,6 +1271,7 @@ COM_SERMONDISTRIBUTOR_SERMON_SCRIPTURE="Scripture" COM_SERMONDISTRIBUTOR_SERMON_SCRIPTURE_DESCRIPTION="Add scripture reference to this sermon, use comma separation for multiply references." COM_SERMONDISTRIBUTOR_SERMON_SCRIPTURE_HINT="1 John 3:16, Psalm 1, James 1:1-5" COM_SERMONDISTRIBUTOR_SERMON_SCRIPTURE_LABEL="Scripture" +COM_SERMONDISTRIBUTOR_SERMON_SELECT_AN_OPTION="Select an option" COM_SERMONDISTRIBUTOR_SERMON_SELECT_SOURCE="Select Source" COM_SERMONDISTRIBUTOR_SERMON_SERIES="Series" COM_SERMONDISTRIBUTOR_SERMON_SERIES_DESCRIPTION="Select the series this sermon belongs to." @@ -1269,6 +1295,7 @@ COM_SERMONDISTRIBUTOR_SERMON_URL_HINT="http://www.domain.com/direct-link-to-down COM_SERMONDISTRIBUTOR_SERMON_URL_LABEL="File URL" COM_SERMONDISTRIBUTOR_SERMON_VERSION_DESC="A count of the number of times this Sermon has been revised." COM_SERMONDISTRIBUTOR_SERMON_VERSION_LABEL="Revision" +COM_SERMONDISTRIBUTOR_SHAREDURL="Shared-url" COM_SERMONDISTRIBUTOR_STATISTIC="Statistic" COM_SERMONDISTRIBUTOR_STATISTICS="Statistics" COM_SERMONDISTRIBUTOR_STATISTICS_ACCESS="Statistics Access" @@ -1356,17 +1383,28 @@ COM_SERMONDISTRIBUTOR_STATISTIC_STATUS="Status" COM_SERMONDISTRIBUTOR_STATISTIC_VERSION_DESC="A count of the number of times this Statistic has been revised." COM_SERMONDISTRIBUTOR_STATISTIC_VERSION_LABEL="Revision" COM_SERMONDISTRIBUTOR_SUBMENU_DASHBOARD="Dashboard" +COM_SERMONDISTRIBUTOR_SUBMENU_EXTERNAL_SOURCES="External Sources" COM_SERMONDISTRIBUTOR_SUBMENU_HELP_DOCUMENTS="Help Documents" +COM_SERMONDISTRIBUTOR_SUBMENU_LOCAL_LISTINGS="Local Listings" +COM_SERMONDISTRIBUTOR_SUBMENU_MANUAL_UPDATER="Manual Updater" COM_SERMONDISTRIBUTOR_SUBMENU_PREACHERS="Preachers" COM_SERMONDISTRIBUTOR_SUBMENU_SERIES_LIST="Series List" COM_SERMONDISTRIBUTOR_SUBMENU_SERMONS="Sermons" COM_SERMONDISTRIBUTOR_SUBMENU_STATISTICS="Statistics" -COM_SERMONDISTRIBUTOR_THE_FILES_LINKED_FROM_DROPBOX="The Files Linked from Dropbox" +COM_SERMONDISTRIBUTOR_TARGETED_FOLDER="Targeted Folder" +COM_SERMONDISTRIBUTOR_THERE_HAS_NO_TARGETS_BEEN_SET_PLEASE_MAKE_SURE_TO_ADD_TARGETS_TO_THIS_EXTERNAL_SOURCE="There has no targets been set, please make sure to add targets to this external source" +COM_SERMONDISTRIBUTOR_THERE_WAS_AN_ERROR_DURING_THE_LAST_UPDATE_ATTEMPT="There was an error during the last update attempt." +COM_SERMONDISTRIBUTOR_THE_EXTERNAL_SOURCE_COULD_NOT_BE_FOUND="The external source could not be found." +COM_SERMONDISTRIBUTOR_THE_FILES_LINKED_FROM_EXTERNAL_SOURCE="The Files Linked from External Source" COM_SERMONDISTRIBUTOR_THE_NOTICE_BOARD_IS_LOADING="The notice board is loading" COM_SERMONDISTRIBUTOR_THE_README_IS_LOADING="The readme is loading" +COM_SERMONDISTRIBUTOR_THE_UPDATE_IS_RUNNING="The update is running." COM_SERMONDISTRIBUTOR_THE_WIKI_IS_LOADING="The wiki is loading" +COM_SERMONDISTRIBUTOR_UNKNOWN_ERROR_HAS_OCCURRED="Unknown error has occurred." +COM_SERMONDISTRIBUTOR_UPDATE_LOCAL_LINKS_OF_TARGET_S_EXTERNAL_SOURCE="Update Local Links of (target %s) External Source" COM_SERMONDISTRIBUTOR_USE_BATCH="Use Batch" COM_SERMONDISTRIBUTOR_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method." COM_SERMONDISTRIBUTOR_VERSION="Version" +COM_SERMONDISTRIBUTOR_VIEW_ERROR="View Error!" COM_SERMONDISTRIBUTOR_VIEW_MORE_ISSUES_ON_GITHUB="View more issues on Github" COM_SERMONDISTRIBUTOR_WEBSITE="Website" diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 1ce6a8bd..a079129a 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage batchselection.php diff --git a/admin/layouts/external_source/details_above.php b/admin/layouts/external_source/details_above.php new file mode 100644 index 00000000..9bd502eb --- /dev/null +++ b/admin/layouts/external_source/details_above.php @@ -0,0 +1,42 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'description', + 'externalsources' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/external_source/details_fullwidth.php b/admin/layouts/external_source/details_fullwidth.php new file mode 100644 index 00000000..d83f7f03 --- /dev/null +++ b/admin/layouts/external_source/details_fullwidth.php @@ -0,0 +1,49 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'sharedurl', + 'folder' +); + +?> +
+ +
+
+ getLabel($field); ?> +
+
+ getInput($field); ?> +
+
+ +
diff --git a/admin/layouts/external_source/details_left.php b/admin/layouts/external_source/details_left.php new file mode 100644 index 00000000..1eefa3f0 --- /dev/null +++ b/admin/layouts/external_source/details_left.php @@ -0,0 +1,58 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'oauthtoken', + 'generated_access_token_note', + 'permissiontype', + 'app_limitation_note', + 'dropboxoptions' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/external_source/details_right.php b/admin/layouts/external_source/details_right.php new file mode 100644 index 00000000..aa9fa285 --- /dev/null +++ b/admin/layouts/external_source/details_right.php @@ -0,0 +1,58 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'build', + 'wiki_check_note', + 'update_method', + 'update_timer', + 'filetypes' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/external_source/details_under.php b/admin/layouts/external_source/details_under.php new file mode 100644 index 00000000..7190834b --- /dev/null +++ b/admin/layouts/external_source/details_under.php @@ -0,0 +1,41 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'not_required' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/external_source/index.html b/admin/layouts/external_source/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/layouts/external_source/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/external_source/publishing.php b/admin/layouts/external_source/publishing.php new file mode 100644 index 00000000..5ddd979a --- /dev/null +++ b/admin/layouts/external_source/publishing.php @@ -0,0 +1,58 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$app = JFactory::getApplication(); +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/external_source/publlshing.php b/admin/layouts/external_source/publlshing.php new file mode 100644 index 00000000..eaa0f3a6 --- /dev/null +++ b/admin/layouts/external_source/publlshing.php @@ -0,0 +1,59 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$app = JFactory::getApplication(); +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'published', + 'ordering', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/external_source/wiki_fullwidth.php b/admin/layouts/external_source/wiki_fullwidth.php new file mode 100644 index 00000000..9f3451e3 --- /dev/null +++ b/admin/layouts/external_source/wiki_fullwidth.php @@ -0,0 +1,49 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'note_manual_dropbox', + 'note_auto_dropbox' +); + +?> +
+ +
+
+ getLabel($field); ?> +
+
+ getInput($field); ?> +
+
+ +
diff --git a/admin/layouts/help_document/details_above.php b/admin/layouts/help_document/details_above.php index b36f1a5d..e3c0527b 100644 --- a/admin/layouts/help_document/details_above.php +++ b/admin/layouts/help_document/details_above.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php diff --git a/admin/layouts/help_document/details_fullwidth.php b/admin/layouts/help_document/details_fullwidth.php index 0a2ba024..74c1c486 100644 --- a/admin/layouts/help_document/details_fullwidth.php +++ b/admin/layouts/help_document/details_fullwidth.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php diff --git a/admin/layouts/help_document/details_left.php b/admin/layouts/help_document/details_left.php index e8f02213..8ab7ed43 100644 --- a/admin/layouts/help_document/details_left.php +++ b/admin/layouts/help_document/details_left.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php diff --git a/admin/layouts/help_document/details_right.php b/admin/layouts/help_document/details_right.php index f06f5505..ff62d54b 100644 --- a/admin/layouts/help_document/details_right.php +++ b/admin/layouts/help_document/details_right.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php diff --git a/admin/layouts/help_document/details_under.php b/admin/layouts/help_document/details_under.php index 8919e453..7190834b 100644 --- a/admin/layouts/help_document/details_under.php +++ b/admin/layouts/help_document/details_under.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_under.php diff --git a/admin/layouts/help_document/metadata.php b/admin/layouts/help_document/metadata.php index e307a8a6..dbfdb0f3 100644 --- a/admin/layouts/help_document/metadata.php +++ b/admin/layouts/help_document/metadata.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php diff --git a/admin/layouts/help_document/publishing.php b/admin/layouts/help_document/publishing.php index ef657d46..69b281e2 100644 --- a/admin/layouts/help_document/publishing.php +++ b/admin/layouts/help_document/publishing.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage publishing.php diff --git a/admin/layouts/local_listing/details_above.php b/admin/layouts/local_listing/details_above.php new file mode 100644 index 00000000..01843f43 --- /dev/null +++ b/admin/layouts/local_listing/details_above.php @@ -0,0 +1,42 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'name', + 'size' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/local_listing/details_fullwidth.php b/admin/layouts/local_listing/details_fullwidth.php new file mode 100644 index 00000000..8a90f45d --- /dev/null +++ b/admin/layouts/local_listing/details_fullwidth.php @@ -0,0 +1,49 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'key', + 'url' +); + +?> +
+ +
+
+ getLabel($field); ?> +
+
+ getInput($field); ?> +
+
+ +
diff --git a/admin/layouts/local_listing/details_left.php b/admin/layouts/local_listing/details_left.php new file mode 100644 index 00000000..6148e5a3 --- /dev/null +++ b/admin/layouts/local_listing/details_left.php @@ -0,0 +1,54 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'external_source' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/local_listing/details_right.php b/admin/layouts/local_listing/details_right.php new file mode 100644 index 00000000..ed4e56bc --- /dev/null +++ b/admin/layouts/local_listing/details_right.php @@ -0,0 +1,54 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'build' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/local_listing/index.html b/admin/layouts/local_listing/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/layouts/local_listing/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/local_listing/publishing.php b/admin/layouts/local_listing/publishing.php new file mode 100644 index 00000000..5ddd979a --- /dev/null +++ b/admin/layouts/local_listing/publishing.php @@ -0,0 +1,58 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$app = JFactory::getApplication(); +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/local_listing/publlshing.php b/admin/layouts/local_listing/publlshing.php new file mode 100644 index 00000000..eaa0f3a6 --- /dev/null +++ b/admin/layouts/local_listing/publlshing.php @@ -0,0 +1,59 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$app = JFactory::getApplication(); +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'published', + 'ordering', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/preacher/details_above.php b/admin/layouts/preacher/details_above.php index f9cd170a..0e5022dd 100644 --- a/admin/layouts/preacher/details_above.php +++ b/admin/layouts/preacher/details_above.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php diff --git a/admin/layouts/preacher/details_fullwidth.php b/admin/layouts/preacher/details_fullwidth.php index ec29be5e..1761f30f 100644 --- a/admin/layouts/preacher/details_fullwidth.php +++ b/admin/layouts/preacher/details_fullwidth.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php diff --git a/admin/layouts/preacher/details_left.php b/admin/layouts/preacher/details_left.php index e71917a0..7cb8ec55 100644 --- a/admin/layouts/preacher/details_left.php +++ b/admin/layouts/preacher/details_left.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php diff --git a/admin/layouts/preacher/details_right.php b/admin/layouts/preacher/details_right.php index a0ddf9ad..f9bdd2f0 100644 --- a/admin/layouts/preacher/details_right.php +++ b/admin/layouts/preacher/details_right.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php diff --git a/admin/layouts/preacher/metadata.php b/admin/layouts/preacher/metadata.php index e307a8a6..dbfdb0f3 100644 --- a/admin/layouts/preacher/metadata.php +++ b/admin/layouts/preacher/metadata.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php diff --git a/admin/layouts/preacher/publishing.php b/admin/layouts/preacher/publishing.php index ef657d46..69b281e2 100644 --- a/admin/layouts/preacher/publishing.php +++ b/admin/layouts/preacher/publishing.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage publishing.php diff --git a/admin/layouts/preacher/sermons_fullwidth.php b/admin/layouts/preacher/sermons_fullwidth.php index 98989bdb..198e1ab6 100644 --- a/admin/layouts/preacher/sermons_fullwidth.php +++ b/admin/layouts/preacher/sermons_fullwidth.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons_fullwidth.php diff --git a/admin/layouts/series/details_above.php b/admin/layouts/series/details_above.php index f9cd170a..0e5022dd 100644 --- a/admin/layouts/series/details_above.php +++ b/admin/layouts/series/details_above.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php diff --git a/admin/layouts/series/details_fullwidth.php b/admin/layouts/series/details_fullwidth.php index ec29be5e..1761f30f 100644 --- a/admin/layouts/series/details_fullwidth.php +++ b/admin/layouts/series/details_fullwidth.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php diff --git a/admin/layouts/series/details_left.php b/admin/layouts/series/details_left.php index e71917a0..7cb8ec55 100644 --- a/admin/layouts/series/details_left.php +++ b/admin/layouts/series/details_left.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php diff --git a/admin/layouts/series/details_right.php b/admin/layouts/series/details_right.php index ed4f9a49..b60b6af7 100644 --- a/admin/layouts/series/details_right.php +++ b/admin/layouts/series/details_right.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php diff --git a/admin/layouts/series/metadata.php b/admin/layouts/series/metadata.php index e307a8a6..dbfdb0f3 100644 --- a/admin/layouts/series/metadata.php +++ b/admin/layouts/series/metadata.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php diff --git a/admin/layouts/series/publishing.php b/admin/layouts/series/publishing.php index ef657d46..69b281e2 100644 --- a/admin/layouts/series/publishing.php +++ b/admin/layouts/series/publishing.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage publishing.php diff --git a/admin/layouts/series/sermons_fullwidth.php b/admin/layouts/series/sermons_fullwidth.php index b997ed82..ffdc8bdd 100644 --- a/admin/layouts/series/sermons_fullwidth.php +++ b/admin/layouts/series/sermons_fullwidth.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons_fullwidth.php diff --git a/admin/layouts/sermon/details_above.php b/admin/layouts/sermon/details_above.php index 9f4cc1cf..df1e026a 100644 --- a/admin/layouts/sermon/details_above.php +++ b/admin/layouts/sermon/details_above.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php diff --git a/admin/layouts/sermon/details_fullwidth.php b/admin/layouts/sermon/details_fullwidth.php index ec29be5e..1761f30f 100644 --- a/admin/layouts/sermon/details_fullwidth.php +++ b/admin/layouts/sermon/details_fullwidth.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php diff --git a/admin/layouts/sermon/details_left.php b/admin/layouts/sermon/details_left.php index 9f75eb9e..33d2ad24 100644 --- a/admin/layouts/sermon/details_left.php +++ b/admin/layouts/sermon/details_left.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php diff --git a/admin/layouts/sermon/details_right.php b/admin/layouts/sermon/details_right.php index 40d83a32..2a604336 100644 --- a/admin/layouts/sermon/details_right.php +++ b/admin/layouts/sermon/details_right.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php diff --git a/admin/layouts/sermon/details_under.php b/admin/layouts/sermon/details_under.php index 039661a3..1f861227 100644 --- a/admin/layouts/sermon/details_under.php +++ b/admin/layouts/sermon/details_under.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_under.php diff --git a/admin/layouts/sermon/files_fullwidth.php b/admin/layouts/sermon/files_fullwidth.php index a24728a5..e53562df 100644 --- a/admin/layouts/sermon/files_fullwidth.php +++ b/admin/layouts/sermon/files_fullwidth.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage files_fullwidth.php @@ -35,8 +35,8 @@ $fields = $displayData->get('fields') ?: array( 'note_link_encrypted', 'source', 'build', - 'note_manual_dropbox', - 'note_auto_dropbox', + 'note_manual_externalsource', + 'note_auto_externalsource', 'manual_files', 'local_files', 'url' diff --git a/admin/layouts/sermon/metadata.php b/admin/layouts/sermon/metadata.php index e307a8a6..dbfdb0f3 100644 --- a/admin/layouts/sermon/metadata.php +++ b/admin/layouts/sermon/metadata.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php diff --git a/admin/layouts/sermon/publishing.php b/admin/layouts/sermon/publishing.php index ef657d46..69b281e2 100644 --- a/admin/layouts/sermon/publishing.php +++ b/admin/layouts/sermon/publishing.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage publishing.php diff --git a/admin/layouts/sermon/stastics_fullwidth.php b/admin/layouts/sermon/stastics_fullwidth.php index d0f49a2f..e474ee17 100644 --- a/admin/layouts/sermon/stastics_fullwidth.php +++ b/admin/layouts/sermon/stastics_fullwidth.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage stastics_fullwidth.php diff --git a/admin/layouts/statistic/details_above.php b/admin/layouts/statistic/details_above.php index 8ca651e7..5a44c8c5 100644 --- a/admin/layouts/statistic/details_above.php +++ b/admin/layouts/statistic/details_above.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php diff --git a/admin/layouts/statistic/details_left.php b/admin/layouts/statistic/details_left.php index 64cca705..6b5d325c 100644 --- a/admin/layouts/statistic/details_left.php +++ b/admin/layouts/statistic/details_left.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php diff --git a/admin/layouts/statistic/details_right.php b/admin/layouts/statistic/details_right.php index 08bc236d..53a77dab 100644 --- a/admin/layouts/statistic/details_right.php +++ b/admin/layouts/statistic/details_right.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php diff --git a/admin/layouts/statistic/metadata.php b/admin/layouts/statistic/metadata.php index e307a8a6..dbfdb0f3 100644 --- a/admin/layouts/statistic/metadata.php +++ b/admin/layouts/statistic/metadata.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php diff --git a/admin/layouts/statistic/publishing.php b/admin/layouts/statistic/publishing.php index ef657d46..69b281e2 100644 --- a/admin/layouts/statistic/publishing.php +++ b/admin/layouts/statistic/publishing.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage publishing.php diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 123cab7c..b38fbc10 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage ajax.php @@ -44,35 +44,13 @@ class SermondistributorModelAjax extends JModelList } // Used in sermon - /** - * Check and Set Dropbox local listing - **/ - public function dropbox($view) - { - // we update both if posible - $types = array('manual','auto'); - foreach ($types as $type) - { - // run the update - if (SermondistributorHelper::updateDropbox($type)) - { - // now update the system if needed - if ('auto' == $type) - { - $this->updateSystemWithDropbox(); - } - } - } - return true; - } - /** * Check and if a vdm notice is new (per/user) **/ public function isNew($notice) { // first get the file path - $path_filename = SermondistributorHelper::getFilePath('user', 'notice', JFactory::getUser()->username, $fileType = '.md', JPATH_COMPONENT_ADMINISTRATOR); + $path_filename = SermondistributorHelper::getFilePath('user', 'notice', JFactory::getUser()->username, '.md', JPATH_COMPONENT_ADMINISTRATOR); // check if the file is set if (($content = @file_get_contents($path_filename)) !== FALSE) { @@ -90,7 +68,7 @@ class SermondistributorModelAjax extends JModelList public function isRead($notice) { // first get the file path - $path_filename = SermondistributorHelper::getFilePath('user', 'notice', JFactory::getUser()->username, $fileType = '.md', JPATH_COMPONENT_ADMINISTRATOR); + $path_filename = SermondistributorHelper::getFilePath('user', 'notice', JFactory::getUser()->username, '.md', JPATH_COMPONENT_ADMINISTRATOR); // set as read if not already set if (($content = @file_get_contents($path_filename)) !== FALSE) { @@ -115,68 +93,89 @@ class SermondistributorModelAjax extends JModelList } /** - * Update Dropbox local listing + * Auto Update Local Listing External **/ - public function updateDropbox($type) - { - if (1 == $type) + public function autoUpdateLocalListingExternal($id, $target, $typeID) + { + if (1 == $typeID) { $type = 'manual'; } - elseif (2 == $type) + elseif (2 == $typeID) { $type = 'auto'; } - // the types allowed - $types = array('manual','auto'); + // first get the file path + $path_filename = SermondistributorHelper::getFilePath('update', 'error', $id.$target.$typeID, '.txt', JPATH_COMPONENT_ADMINISTRATOR); // check the type - if (SermondistributorHelper::checkString($type) && in_array($type,$types)) + if (isset($type) && SermondistributorHelper::checkString($type)) { - // run the update - if (SermondistributorHelper::updateDropbox($type,true)) + // run the updatetype + if (SermondistributorHelper::updateExternalSource($id, $target, $type)) { // now update the system if needed if ('auto' == $type) { - $this->updateSystemWithDropbox(); + $this->updateSystemWithExternalSource($id); } + $this->saveFile('success',$path_filename); return true; } + $this->saveFile(SermondistributorHelper::getUpdateError($id),$path_filename); + return false; } + $this->saveFile(JText::_('COM_SERMONDISTRIBUTOR_BTHERE_WAS_AN_ERRORB'),$path_filename); return false; } /** - * Status of update progress of the local listing + * Update Local Listing of External Source (manually) **/ - public function updateProgress($type) + public function updateLocalListingExternal($id, $target, $typeID, $sleutel) { - if (1 == $type) + if (1 == $typeID) { $type = 'manual'; } - elseif (2 == $type) + elseif (2 == $typeID) { $type = 'auto'; } - // the types allowed - $types = array('manual','auto'); - // check the type - if (SermondistributorHelper::checkString($type) && in_array($type,$types)) + // first get the file path + $path_filename = SermondistributorHelper::getFilePath('update', 'error', $id.$target.$typeID, '.txt', JPATH_COMPONENT_ADMINISTRATOR); + // check "die sleutel" and the type + if (isset($type) && SermondistributorHelper::checkString($sleutel)) { - // return the update progress - return SermondistributorHelper::getUpdateProgress($type); + // run the update + if (SermondistributorHelper::updateExternalSource($id, $target, $type, true, $sleutel)) + { + // now update the system if needed + if ('auto' == $type) + { + $this->updateSystemWithExternalSource($id); + } + $this->saveFile('success',$path_filename); + return array('success' => true); + } + // store the error + $error = SermondistributorHelper::getUpdateError($id); + $this->saveFile($error,$path_filename); + // return the error + return array('error' => $error); } - return false; + // store the error + $error = JText::_('COM_SERMONDISTRIBUTOR_BCOULD_NOT_USE_THE_GIVEN_TOKEN_OR_THE_GIVEN_BUILD_OPTION_DOES_NOT_EXISTB'); + $this->saveFile($error,$path_filename); + return array('error' => $error); } /** - * Update the System with Dropbox local listing + * Update the System with External Source local listing **/ - protected function updateSystemWithDropbox() + protected function updateSystemWithExternalSource($id) { // check if we should update with auto listing - $links_dropbox_auto = SermondistributorHelper::getDropboxLink('auto', 2); + $links_dropbox_auto = SermondistributorHelper::getExternalSourceLink('auto', 2); if (SermondistributorHelper::checkArray($links_dropbox_auto)) { $bucket = array(); @@ -224,7 +223,7 @@ class SermondistributorModelAjax extends JModelList } return false; } - + protected function setSermons($db) { // check if we have values @@ -287,7 +286,7 @@ class SermondistributorModelAjax extends JModelList } return $this->allSermonsCheckStatus($db); } - + protected function allSermonsCheckStatus($db) { $query = $db->getQuery(true); @@ -317,7 +316,6 @@ class SermondistributorModelAjax extends JModelList return $db->execute(); } - protected function loadSermonData($preacher,$preacherName,$series,$seriesName,$sermon,$placeholder,$db) { // 34key521__the_file_name___tag1_tag-with2_tag-three____Salvation_Messages_____The_short_description_can_only_be_one_sentence.mp3 @@ -526,12 +524,12 @@ class SermondistributorModelAjax extends JModelList // set the date object $date = JFactory::getDate(); // build the object - $object->name = $name; + $object->name = $name; $object->alias = $alias; $object->published = $this->app_params->get($type.'_state', 1); $object->created = $date->toSql(); $object->version = 1; - $object->access = 1; // TODO must use a global setting here + $object->access = 1; // TODO must use a global setting here // Insert the object into the table. $done = $db->insertObject('#__sermondistributor_'.$type, $object); // if done return last used id @@ -656,5 +654,130 @@ class SermondistributorModelAjax extends JModelList $this->uniqeValueArray['sermon']['alias'][$alias] = $alias; } } + } + + // Used in external_source + protected $functionArray = array(); + + protected $languageArray = array(); + + protected function setLanguage($key,$lang) + { + $this->languageArray[$key] = $lang; + } + + public function getLanguage() + { + // return the language string that were set + return $this->languageArray; + } + + protected function setAutoLangZero() + { + // set the headers + $headers = array( + 'tsharedurl' => JText::_('COM_SERMONDISTRIBUTOR_SHAREDURL'), + 'tfolder' => JText::_('COM_SERMONDISTRIBUTOR_TARGETED_FOLDER') + ); + // loop the array + foreach ($headers as $key => $lang) + { + $this->setLanguage($key,$lang); + } + } + + protected function autoLoader() + { + $functions = range(0,10); + foreach ($functions as $function) + { + $function = 'setAutoLang'.SermondistributorHelper::safeString($function, 'f'); + if (method_exists($this, $function)) + { + $this->{$function}(); + } + } + foreach ($functions as $function) + { + $function = 'setAutoFunc'.SermondistributorHelper::safeString($function, 'f'); + if (method_exists($this, $function)) + { + $this->{$function}(); + } + } + } + + public function getBuildTable($idName,$oject) + { + if (SermondistributorHelper::checkJson($oject) && SermondistributorHelper::checkString($idName)) + { + $array = json_decode($oject, true); + if (SermondistributorHelper::checkArray($array)) + { + // make sure we run the autoloader to insure all is set + $this->autoLoader(); + // set the target headers + $targetHeaders = $this->getLanguage(); + // start table build + $table = ''; + $rows = array(); + foreach ($array as $header => $values) + { + if (SermondistributorHelper::checkArray($values)) + { + $targetHeader = (isset($targetHeaders[$header])) ? $targetHeaders[$header] : SermondistributorHelper::safeString($header, 'W'); + $table .= ''; + foreach ($values as $nr => $value) + { + // set the value for the row + $this->setRows($nr, $this->setValue($header, $value), $rows); + } + } + } + // close header start body + $table .= ''; + // add rows to table + if (SermondistributorHelper::checkArray($rows)) + { + foreach ($rows as $row) + { + $table .= ''.$row.''; + } + } + + // close the body and table + $table .= '
'.$targetHeader.'
'; + // return the table + return $table; + } + } + return false; + } + + protected function setValue($header,$value) + { + if (array_key_exists($header, $this->functionArray) && method_exists($this, $this->functionArray[$header])) + { + $value = $this->{$this->functionArray[$header]}($header,$value); + } + // if no value are set + if (!SermondistributorHelper::checkString($value)) + { + $value = '-'; + } + return $value; + } + + protected function setRows($nr, $value, &$rows) + { + // build rows + if (!isset($rows[$nr])) + { + $rows[$nr] = ''.$value.''; + } + else + { + $rows[$nr] .= ''.$value.''; + } } } diff --git a/admin/models/external_source.php b/admin/models/external_source.php new file mode 100644 index 00000000..3381a84d --- /dev/null +++ b/admin/models/external_source.php @@ -0,0 +1,1122 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla modelform library +jimport('joomla.application.component.modeladmin'); + +/** + * Sermondistributor External_source Model + */ +class SermondistributorModelExternal_source extends JModelAdmin +{ + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_SERMONDISTRIBUTOR'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_sermondistributor.external_source'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'external_source', $prefix = 'SermondistributorTable', $config = array()) + { + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->filetypes)) + { + // JSON Decode filetypes. + $item->filetypes = json_decode($item->filetypes); + } + + // Get the basic encription. + $basickey = SermondistributorHelper::getCryptKey('basic'); + // Get the encription object. + $basic = new FOFEncryptAes($basickey, 128); + + if (!empty($item->oauthtoken) && $basickey && !is_numeric($item->oauthtoken) && $item->oauthtoken === base64_encode(base64_decode($item->oauthtoken, true))) + { + // basic decript data oauthtoken. + $item->oauthtoken = rtrim($basic->decryptString($item->oauthtoken), "\0"); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_sermondistributor.external_source'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true) + { + // Get the form. + $form = $this->loadForm('com_sermondistributor.external_source', 'external_source', array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.state', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.state', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.created_by', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.created_by', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.created', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.created', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.description', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.description', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Modify the form based on Edit Externalsources access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.externalsources', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.externalsources', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('externalsources', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('externalsources', 'readonly', 'true'); + if (!$form->getValue('externalsources')) + { + // Disable fields while saving. + $form->setFieldAttribute('externalsources', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('externalsources', 'required', 'false'); + } + } + // Modify the form based on Edit Update Method access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.update_method', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.update_method', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('update_method', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('update_method', 'readonly', 'true'); + // Disable radio button for display. + $class = $form->getFieldAttribute('update_method', 'class', ''); + $form->setFieldAttribute('update_method', 'class', $class.' disabled no-click'); + if (!$form->getValue('update_method')) + { + // Disable fields while saving. + $form->setFieldAttribute('update_method', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('update_method', 'required', 'false'); + } + } + // Modify the form based on Edit Filetypes access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.filetypes', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.filetypes', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('filetypes', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('filetypes', 'readonly', 'true'); + if (!$form->getValue('filetypes')) + { + // Disable fields while saving. + $form->setFieldAttribute('filetypes', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('filetypes', 'required', 'false'); + } + } + // Modify the form based on Edit Build access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.build', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.build', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('build', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('build', 'readonly', 'true'); + if (!$form->getValue('build')) + { + // Disable fields while saving. + $form->setFieldAttribute('build', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('build', 'required', 'false'); + } + } + // Modify the form based on Edit Permissiontype access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.permissiontype', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.permissiontype', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('permissiontype', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('permissiontype', 'readonly', 'true'); + // Disable radio button for display. + $class = $form->getFieldAttribute('permissiontype', 'class', ''); + $form->setFieldAttribute('permissiontype', 'class', $class.' disabled no-click'); + if (!$form->getValue('permissiontype')) + { + // Disable fields while saving. + $form->setFieldAttribute('permissiontype', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('permissiontype', 'required', 'false'); + } + } + // Modify the form based on Edit Update Timer access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.update_timer', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.update_timer', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('update_timer', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('update_timer', 'readonly', 'true'); + if (!$form->getValue('update_timer')) + { + // Disable fields while saving. + $form->setFieldAttribute('update_timer', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('update_timer', 'required', 'false'); + } + } + // Modify the form based on Edit Dropboxoptions access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.dropboxoptions', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.dropboxoptions', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('dropboxoptions', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('dropboxoptions', 'readonly', 'true'); + // Disable radio button for display. + $class = $form->getFieldAttribute('dropboxoptions', 'class', ''); + $form->setFieldAttribute('dropboxoptions', 'class', $class.' disabled no-click'); + if (!$form->getValue('dropboxoptions')) + { + // Disable fields while saving. + $form->setFieldAttribute('dropboxoptions', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('dropboxoptions', 'required', 'false'); + } + } + // Modify the form based on Edit Folder access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.folder', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.folder', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('folder', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('folder', 'readonly', 'true'); + // Disable radio button for display. + $class = $form->getFieldAttribute('folder', 'class', ''); + $form->setFieldAttribute('folder', 'class', $class.' disabled no-click'); + if (!$form->getValue('folder')) + { + // Disable fields while saving. + $form->setFieldAttribute('folder', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('folder', 'required', 'false'); + } + } + // Modify the form based on Edit Sharedurl access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.sharedurl', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.sharedurl', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('sharedurl', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('sharedurl', 'readonly', 'true'); + // Disable radio button for display. + $class = $form->getFieldAttribute('sharedurl', 'class', ''); + $form->setFieldAttribute('sharedurl', 'class', $class.' disabled no-click'); + if (!$form->getValue('sharedurl')) + { + // Disable fields while saving. + $form->setFieldAttribute('sharedurl', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('sharedurl', 'required', 'false'); + } + } + // Modify the form based on Edit Oauthtoken access controls. + if ($id != 0 && (!$user->authorise('external_source.edit.oauthtoken', 'com_sermondistributor.external_source.' . (int) $id)) + || ($id == 0 && !$user->authorise('external_source.edit.oauthtoken', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('oauthtoken', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('oauthtoken', 'readonly', 'true'); + if (!$form->getValue('oauthtoken')) + { + // Disable fields while saving. + $form->setFieldAttribute('oauthtoken', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('oauthtoken', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected field name + $redirectedField = $jinput->get('ref', null, 'STRING'); + // Set redirected field value + $redirectedValue = $jinput->get('refid', 0, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_sermondistributor/models/forms/external_source.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('external_source.delete', 'com_sermondistributor.external_source.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('external_source.edit.state', 'com_sermondistributor.external_source.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('external_source.edit.state', 'com_sermondistributor'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('external_source.edit', 'com_sermondistributor.external_source.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('external_source.edit', 'com_sermondistributor'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__sermondistributor_external_source')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_sermondistributor.edit.external_source.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to validate the form data. + * + * @param JForm $form The form to validate against. + * @param array $data The data to validate. + * @param string $group The name of the field group to validate. + * + * @return mixed Array of filtered data if valid, false otherwise. + * + * @see JFormRule + * @see JFilterInput + * @since 12.2 + */ + public function validate($form, $data, $group = null) + { + // check if the not_required field is set + if (SermondistributorHelper::checkString($data['not_required'])) + { + $requiredFields = (array) explode(',',(string) $data['not_required']); + $requiredFields = array_unique($requiredFields); + // now change the required field attributes value + foreach ($requiredFields as $requiredField) + { + // make sure there is a string value + if (SermondistributorHelper::checkString($requiredField)) + { + // change to false + $form->setFieldAttribute($requiredField, 'required', 'false'); + // also clear the data set + $data[$requiredField] = ''; + } + } + } + return parent::validate($form, $data, $group); + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('external_source'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('external_source'); + } + + if (!$this->canDo->get('external_source.create') && !$this->canDo->get('external_source.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('external_source.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + + if (!$this->user->authorise('external_source.edit', $contexts[$pk])) + + { + + // Not fatal error + + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + + continue; + + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + $this->table->description = $this->generateUniqe('description',$this->table->description); + + // insert all set values + if (SermondistributorHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (SermondistributorHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('external_source'); + } + + if (!$this->canDo->get('external_source.edit') && !$this->canDo->get('external_source.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('external_source.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('external_source.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (SermondistributorHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' == $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the filetypes string to JSON string. + if (isset($data['filetypes'])) + { + $data['filetypes'] = (string) json_encode($data['filetypes']); + } + + // Get the basic encription key. + $basickey = SermondistributorHelper::getCryptKey('basic'); + // Get the encription object + $basic = new FOFEncryptAes($basickey, 128); + + // Encript data oauthtoken. + if (isset($data['oauthtoken']) && $basickey) + { + $data['oauthtoken'] = $basic->encryptString($data['oauthtoken']); + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') == 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (SermondistributorHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title & alias. + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/external_sources.php b/admin/models/external_sources.php new file mode 100644 index 00000000..d43586b1 --- /dev/null +++ b/admin/models/external_sources.php @@ -0,0 +1,515 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the Joomla modellist library +jimport('joomla.application.component.modellist'); + +/** + * External_sources Model + */ +class SermondistributorModelExternal_sources extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.description','description', + 'a.externalsources','externalsources', + 'a.update_method','update_method', + 'a.build','build' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + $this->setState('filter.description', $description); + + $externalsources = $this->getUserStateFromRequest($this->context . '.filter.externalsources', 'filter_externalsources'); + $this->setState('filter.externalsources', $externalsources); + + $update_method = $this->getUserStateFromRequest($this->context . '.filter.update_method', 'filter_update_method'); + $this->setState('filter.update_method', $update_method); + + $build = $this->getUserStateFromRequest($this->context . '.filter.build', 'filter_build'); + $this->setState('filter.build', $build); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (SermondistributorHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('external_source.access', 'com_sermondistributor.external_source.' . (int) $item->id) && $user->authorise('external_source.access', 'com_sermondistributor')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + // convert filetypes + $filetypesArray = json_decode($item->filetypes, true); + if (SermondistributorHelper::checkArray($filetypesArray)) + { + $filetypesNames = ''; + $counter = 0; + foreach ($filetypesArray as $filetypes) + { + if ($counter == 0) + { + $filetypesNames .= JText::_($this->selectionTranslation($filetypes, 'filetypes')); + } + else + { + $filetypesNames .= ', '.JText::_($this->selectionTranslation($filetypes, 'filetypes')); + } + $counter++; + } + $item->filetypes = $filetypesNames; + } + } + } + + // set selection value to a translatable value + if (SermondistributorHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert externalsources + $item->externalsources = $this->selectionTranslation($item->externalsources, 'externalsources'); + // convert update_method + $item->update_method = $this->selectionTranslation($item->update_method, 'update_method'); + // convert filetypes + $item->filetypes = $this->selectionTranslation($item->filetypes, 'filetypes'); + // convert build + $item->build = $this->selectionTranslation($item->build, 'build'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of externalsources language strings + if ($name == 'externalsources') + { + $externalsourcesArray = array( + 0 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_SELECT_AN_OPTION', + 1 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DROPBOX' + ); + // Now check if value is found in this array + if (isset($externalsourcesArray[$value]) && SermondistributorHelper::checkString($externalsourcesArray[$value])) + { + return $externalsourcesArray[$value]; + } + } + // Array of update_method language strings + if ($name == 'update_method') + { + $update_methodArray = array( + 1 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MANUAL', + 2 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_AUTOMATIC' + ); + // Now check if value is found in this array + if (isset($update_methodArray[$value]) && SermondistributorHelper::checkString($update_methodArray[$value])) + { + return $update_methodArray[$value]; + } + } + // Array of filetypes language strings + if ($name == 'filetypes') + { + $filetypesArray = array( + '.mp3' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MPTHREE', + '.m4a' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MFOURA', + '.ogg' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_OGG', + '.wav' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WAV', + '.mp4' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MPFOUR', + '.m4v' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MFOURV', + '.mov' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MOV', + '.wmv' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WMV', + '.avi' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_AVI', + '.mpg' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MPG', + '.ogv' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_OGV', + '.3gp' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_THREEGP', + '.3g2' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_THREEGTWO', + '.pdf' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PDF', + '.doc' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DOC', + '.docx' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DOCX', + '.ppt' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PPT', + '.pptx' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PPTX', + '.pps' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PPS', + '.ppsx' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PPSX', + '.odt' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ODT', + '.xls' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLS', + '.xlsx' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLSX', + '.zip' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ZIP', + '.jpg' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_JPG', + '.jpeg' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_JPEG', + '.png' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PNG', + '.gif' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_GIF' + ); + // Now check if value is found in this array + if (isset($filetypesArray[$value]) && SermondistributorHelper::checkString($filetypesArray[$value])) + { + return $filetypesArray[$value]; + } + } + // Array of build language strings + if ($name == 'build') + { + $buildArray = array( + 0 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_SELECT_AN_OPTION', + 1 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_MANUAL_LOCAL_SELECTION', + 2 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DYNAMIC_AUTOMATIC_BUILD' + ); + // Now check if value is found in this array + if (isset($buildArray[$value]) && SermondistributorHelper::checkString($buildArray[$value])) + { + return $buildArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the sermondistributor_item table + $query->from($db->quoteName('#__sermondistributor_external_source', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.description LIKE '.$search.' OR a.externalsources LIKE '.$search.' OR a.update_method LIKE '.$search.')'); + } + } + + // Filter by Externalsources. + if ($externalsources = $this->getState('filter.externalsources')) + { + $query->where('a.externalsources = ' . $db->quote($db->escape($externalsources))); + } + // Filter by Update_method. + if ($update_method = $this->getState('filter.update_method')) + { + $query->where('a.update_method = ' . $db->quote($db->escape($update_method))); + } + // Filter by Build. + if ($build = $this->getState('filter.build')) + { + $query->where('a.build = ' . $db->quote($db->escape($build))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks) + { + // setup the query + if (SermondistributorHelper::checkArray($pks)) + { + // Set a value to know this is exporting method. + $_export = true; + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the sermondistributor_external_source table + $query->from($db->quoteName('#__sermondistributor_external_source', 'a')); + $query->where('a.id IN (' . implode(',',$pks) . ')'); + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Get the basic encription key. + $basickey = SermondistributorHelper::getCryptKey('basic'); + // Get the encription object. + $basic = new FOFEncryptAes($basickey, 128); + + // set values to display correctly. + if (SermondistributorHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('external_source.access', 'com_sermondistributor.external_source.' . (int) $item->id) && $user->authorise('external_source.access', 'com_sermondistributor')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + if ($basickey && !is_numeric($item->oauthtoken) && $item->oauthtoken === base64_encode(base64_decode($item->oauthtoken, true))) + { + // decrypt oauthtoken + $item->oauthtoken = $basic->decryptString($item->oauthtoken); + } + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (SermondistributorHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__sermondistributor_external_source"); + if (SermondistributorHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.description'); + $id .= ':' . $this->getState('filter.externalsources'); + $id .= ':' . $this->getState('filter.update_method'); + $id .= ':' . $this->getState('filter.build'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__sermondistributor_external_source')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__sermondistributor_external_source'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/fields/adminviewfolderlist.php b/admin/models/fields/adminviewfolderlist.php index d8ff5df1..565cecd4 100644 --- a/admin/models/fields/adminviewfolderlist.php +++ b/admin/models/fields/adminviewfolderlist.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage adminviewfolderlist.php diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php index 66947cd0..fe6a2ae7 100644 --- a/admin/models/fields/articles.php +++ b/admin/models/fields/articles.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage articles.php diff --git a/admin/models/fields/externalsource.php b/admin/models/fields/externalsource.php new file mode 100644 index 00000000..7ed1cb5e --- /dev/null +++ b/admin/models/fields/externalsource.php @@ -0,0 +1,171 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Externalsource Form Field class for the Sermondistributor component + */ +class JFormFieldExternalsource extends JFormFieldList +{ + /** + * The externalsource field type. + * + * @var string + */ + public $type = 'externalsource'; + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $setButton = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($setButton === 'true') + { + $button = array(); + $script = array(); + $buttonName = $this->getAttribute('name'); + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referal if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + } + $user = JFactory::getUser(); + // only add if user allowed to create external_source + if ($user->authorise('external_source.create', 'com_sermondistributor')) + { + // build Create button + $buttonNamee = trim($buttonName); + $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee); + $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee); + $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee); + $buttonNamee = ucfirst(strtolower($buttonNamee)); + $button[] = ' + '; + } + // only add if user allowed to edit external_source + if (($buttonName == 'external_source' || $buttonName == 'external_sources') && $user->authorise('external_source.edit', 'com_sermondistributor')) + { + // build edit button + $buttonNamee = trim($buttonName); + $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee); + $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee); + $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee); + $buttonNamee = ucfirst(strtolower($buttonNamee)); + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) { + e.preventDefault(); + var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val(); + ".$buttonName."Button(".$buttonName."Value); + }); + var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val(); + ".$buttonName."Button(".$buttonName."Value); + }); + function ".$buttonName."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$buttonName."Create').hide(); + // show edit button + jQuery('#".$buttonName."Edit').show(); + var url = 'index.php?option=com_sermondistributor&view=external_sources&task=external_source.edit&id='+value+'".$refJ."'; + jQuery('#".$buttonName."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$buttonName."Create').show(); + // hide edit button + jQuery('#".$buttonName."Edit').hide(); + } + }"; + } + // check if button was created for external_source field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + public function getOptions() + { + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.description','a.externalsources','a.update_method'),array('id','external_source_description','externalsources','update_method'))); + $query->from($db->quoteName('#__sermondistributor_external_source', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.description ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $model = SermondistributorHelper::getModel('external_sources'); + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->external_source_description. ' (' . JText::_($model->selectionTranslation($item->externalsources,'externalsources')). ' ' . JText::_($model->selectionTranslation($item->update_method,'update_method')). ')'); + } + } + return $options; + } +} diff --git a/admin/models/fields/dropboxfiles.php b/admin/models/fields/externalsourcefiles.php similarity index 90% rename from admin/models/fields/dropboxfiles.php rename to admin/models/fields/externalsourcefiles.php index 83006a43..1c4e3369 100644 --- a/admin/models/fields/dropboxfiles.php +++ b/admin/models/fields/externalsourcefiles.php @@ -10,11 +10,11 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor - @subpackage dropboxfiles.php + @subpackage externalsourcefiles.php @author Llewellyn van der Merwe @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -31,16 +31,16 @@ jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); /** - * Dropboxfiles Form Field class for the Sermondistributor component + * Externalsourcefiles Form Field class for the Sermondistributor component */ -class JFormFieldDropboxfiles extends JFormFieldList +class JFormFieldExternalsourcefiles extends JFormFieldList { /** - * The dropboxfiles field type. + * The externalsourcefiles field type. * * @var string */ - public $type = 'dropboxfiles'; + public $type = 'externalsourcefiles'; /** * Override to add new button * @@ -149,15 +149,14 @@ class JFormFieldDropboxfiles extends JFormFieldList public function getOptions() { // set the default - $options[] = JHtml::_('select.option', '', JText::_('The local listing of the Manual Dropbox folder is empty.')); - $links = SermondistributorHelper::getDropboxLink('manual',2); - if (SermondistributorHelper::checkArray($links)) + $options[] = JHtml::_('select.option', '', JText::_('The local listing of the Manual External Source folder/s is empty.')); + $selection = SermondistributorHelper::getExternalSourceLink('manual', 2, false, 'select'); + if (SermondistributorHelper::checkArray($selection)) { $options = array(); - foreach ($links as $file => $link) + foreach ($selection as $key => $name) { - $name = substr($file, strrpos($file, '/') + 1); - $options[] = JHtml::_('select.option', $file, $name); + $options[] = JHtml::_('select.option', $key, $name); } } return $options; diff --git a/admin/models/fields/localfiles.php b/admin/models/fields/localfiles.php index dbe89bda..9747df78 100644 --- a/admin/models/fields/localfiles.php +++ b/admin/models/fields/localfiles.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage localfiles.php diff --git a/admin/models/fields/preachers.php b/admin/models/fields/preachers.php index d007eb34..ffd48fdc 100644 --- a/admin/models/fields/preachers.php +++ b/admin/models/fields/preachers.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.php diff --git a/admin/models/fields/series.php b/admin/models/fields/series.php index d2dcb5a7..d8729d86 100644 --- a/admin/models/fields/series.php +++ b/admin/models/fields/series.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage series.php diff --git a/admin/models/fields/sermon.php b/admin/models/fields/sermon.php index 059662d0..7a5b9edd 100644 --- a/admin/models/fields/sermon.php +++ b/admin/models/fields/sermon.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.php diff --git a/admin/models/fields/siteviewfolderlist.php b/admin/models/fields/siteviewfolderlist.php index 28d5bef7..4ca1a268 100644 --- a/admin/models/fields/siteviewfolderlist.php +++ b/admin/models/fields/siteviewfolderlist.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage siteviewfolderlist.php diff --git a/admin/models/forms/external_source.js b/admin/models/forms/external_source.js new file mode 100644 index 00000000..86cf2092 --- /dev/null +++ b/admin/models/forms/external_source.js @@ -0,0 +1,1097 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.4.0 + @build 27th November, 2016 + @created 22nd October, 2015 + @package Sermon Distributor + @subpackage external_source.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// Some Global Values +jform_vvvvvwmvwd_required = false; + +// Initial Script +jQuery(document).ready(function() +{ + var externalsources_vvvvvwe = jQuery("#jform_externalsources").val(); + var permissiontype_vvvvvwe = jQuery("#jform_permissiontype input[type='radio']:checked").val(); + vvvvvwe(externalsources_vvvvvwe,permissiontype_vvvvvwe); + + var externalsources_vvvvvwg = jQuery("#jform_externalsources").val(); + var permissiontype_vvvvvwg = jQuery("#jform_permissiontype input[type='radio']:checked").val(); + vvvvvwg(externalsources_vvvvvwg,permissiontype_vvvvvwg); + + var externalsources_vvvvvwi = jQuery("#jform_externalsources").val(); + vvvvvwi(externalsources_vvvvvwi); + + var update_method_vvvvvwj = jQuery("#jform_update_method input[type='radio']:checked").val(); + vvvvvwj(update_method_vvvvvwj); + + var build_vvvvvwk = jQuery("#jform_build").val(); + vvvvvwk(build_vvvvvwk); + + var build_vvvvvwl = jQuery("#jform_build").val(); + vvvvvwl(build_vvvvvwl); + + var externalsources_vvvvvwm = jQuery("#jform_externalsources").val(); + var update_method_vvvvvwm = jQuery("#jform_update_method input[type='radio']:checked").val(); + vvvvvwm(externalsources_vvvvvwm,update_method_vvvvvwm); + + var externalsources_vvvvvwo = jQuery("#jform_externalsources").val(); + var update_method_vvvvvwo = jQuery("#jform_update_method input[type='radio']:checked").val(); + vvvvvwo(externalsources_vvvvvwo,update_method_vvvvvwo); + + var externalsources_vvvvvwq = jQuery("#jform_externalsources").val(); + var dropboxoptions_vvvvvwq = jQuery("#jform_dropboxoptions input[type='radio']:checked").val(); + var permissiontype_vvvvvwq = jQuery("#jform_permissiontype input[type='radio']:checked").val(); + vvvvvwq(externalsources_vvvvvwq,dropboxoptions_vvvvvwq,permissiontype_vvvvvwq); + + var dropboxoptions_vvvvvwr = jQuery("#jform_dropboxoptions input[type='radio']:checked").val(); + var externalsources_vvvvvwr = jQuery("#jform_externalsources").val(); + var permissiontype_vvvvvwr = jQuery("#jform_permissiontype input[type='radio']:checked").val(); + vvvvvwr(dropboxoptions_vvvvvwr,externalsources_vvvvvwr,permissiontype_vvvvvwr); + + var permissiontype_vvvvvws = jQuery("#jform_permissiontype input[type='radio']:checked").val(); + var externalsources_vvvvvws = jQuery("#jform_externalsources").val(); + var dropboxoptions_vvvvvws = jQuery("#jform_dropboxoptions input[type='radio']:checked").val(); + vvvvvws(permissiontype_vvvvvws,externalsources_vvvvvws,dropboxoptions_vvvvvws); + + var externalsources_vvvvvwt = jQuery("#jform_externalsources").val(); + var dropboxoptions_vvvvvwt = jQuery("#jform_dropboxoptions input[type='radio']:checked").val(); + var permissiontype_vvvvvwt = jQuery("#jform_permissiontype input[type='radio']:checked").val(); + vvvvvwt(externalsources_vvvvvwt,dropboxoptions_vvvvvwt,permissiontype_vvvvvwt); + + var dropboxoptions_vvvvvwu = jQuery("#jform_dropboxoptions input[type='radio']:checked").val(); + var externalsources_vvvvvwu = jQuery("#jform_externalsources").val(); + var permissiontype_vvvvvwu = jQuery("#jform_permissiontype input[type='radio']:checked").val(); + vvvvvwu(dropboxoptions_vvvvvwu,externalsources_vvvvvwu,permissiontype_vvvvvwu); + + var permissiontype_vvvvvwv = jQuery("#jform_permissiontype input[type='radio']:checked").val(); + var externalsources_vvvvvwv = jQuery("#jform_externalsources").val(); + var dropboxoptions_vvvvvwv = jQuery("#jform_dropboxoptions input[type='radio']:checked").val(); + vvvvvwv(permissiontype_vvvvvwv,externalsources_vvvvvwv,dropboxoptions_vvvvvwv); + + var build_vvvvvww = jQuery("#jform_build").val(); + vvvvvww(build_vvvvvww); +}); + +// the vvvvvwe function +function vvvvvwe(externalsources_vvvvvwe,permissiontype_vvvvvwe) +{ + if (isSet(externalsources_vvvvvwe) && externalsources_vvvvvwe.constructor !== Array) + { + var temp_vvvvvwe = externalsources_vvvvvwe; + var externalsources_vvvvvwe = []; + externalsources_vvvvvwe.push(temp_vvvvvwe); + } + else if (!isSet(externalsources_vvvvvwe)) + { + var externalsources_vvvvvwe = []; + } + var externalsources = externalsources_vvvvvwe.some(externalsources_vvvvvwe_SomeFunc); + + if (isSet(permissiontype_vvvvvwe) && permissiontype_vvvvvwe.constructor !== Array) + { + var temp_vvvvvwe = permissiontype_vvvvvwe; + var permissiontype_vvvvvwe = []; + permissiontype_vvvvvwe.push(temp_vvvvvwe); + } + else if (!isSet(permissiontype_vvvvvwe)) + { + var permissiontype_vvvvvwe = []; + } + var permissiontype = permissiontype_vvvvvwe.some(permissiontype_vvvvvwe_SomeFunc); + + + // set this function logic + if (externalsources && permissiontype) + { + jQuery('#jform_dropboxoptions').closest('.control-group').show(); + } + else + { + jQuery('#jform_dropboxoptions').closest('.control-group').hide(); + } +} + +// the vvvvvwe Some function +function externalsources_vvvvvwe_SomeFunc(externalsources_vvvvvwe) +{ + // set the function logic + if (externalsources_vvvvvwe == 1) + { + return true; + } + return false; +} + +// the vvvvvwe Some function +function permissiontype_vvvvvwe_SomeFunc(permissiontype_vvvvvwe) +{ + // set the function logic + if (permissiontype_vvvvvwe == 'full') + { + return true; + } + return false; +} + +// the vvvvvwg function +function vvvvvwg(externalsources_vvvvvwg,permissiontype_vvvvvwg) +{ + if (isSet(externalsources_vvvvvwg) && externalsources_vvvvvwg.constructor !== Array) + { + var temp_vvvvvwg = externalsources_vvvvvwg; + var externalsources_vvvvvwg = []; + externalsources_vvvvvwg.push(temp_vvvvvwg); + } + else if (!isSet(externalsources_vvvvvwg)) + { + var externalsources_vvvvvwg = []; + } + var externalsources = externalsources_vvvvvwg.some(externalsources_vvvvvwg_SomeFunc); + + if (isSet(permissiontype_vvvvvwg) && permissiontype_vvvvvwg.constructor !== Array) + { + var temp_vvvvvwg = permissiontype_vvvvvwg; + var permissiontype_vvvvvwg = []; + permissiontype_vvvvvwg.push(temp_vvvvvwg); + } + else if (!isSet(permissiontype_vvvvvwg)) + { + var permissiontype_vvvvvwg = []; + } + var permissiontype = permissiontype_vvvvvwg.some(permissiontype_vvvvvwg_SomeFunc); + + + // set this function logic + if (externalsources && permissiontype) + { + jQuery('.app_limitation_note').closest('.control-group').show(); + } + else + { + jQuery('.app_limitation_note').closest('.control-group').hide(); + } +} + +// the vvvvvwg Some function +function externalsources_vvvvvwg_SomeFunc(externalsources_vvvvvwg) +{ + // set the function logic + if (externalsources_vvvvvwg == 1) + { + return true; + } + return false; +} + +// the vvvvvwg Some function +function permissiontype_vvvvvwg_SomeFunc(permissiontype_vvvvvwg) +{ + // set the function logic + if (permissiontype_vvvvvwg == 'app') + { + return true; + } + return false; +} + +// the vvvvvwi function +function vvvvvwi(externalsources_vvvvvwi) +{ + if (isSet(externalsources_vvvvvwi) && externalsources_vvvvvwi.constructor !== Array) + { + var temp_vvvvvwi = externalsources_vvvvvwi; + var externalsources_vvvvvwi = []; + externalsources_vvvvvwi.push(temp_vvvvvwi); + } + else if (!isSet(externalsources_vvvvvwi)) + { + var externalsources_vvvvvwi = []; + } + var externalsources = externalsources_vvvvvwi.some(externalsources_vvvvvwi_SomeFunc); + + + // set this function logic + if (externalsources) + { + jQuery('#jform_permissiontype').closest('.control-group').show(); + } + else + { + jQuery('#jform_permissiontype').closest('.control-group').hide(); + } +} + +// the vvvvvwi Some function +function externalsources_vvvvvwi_SomeFunc(externalsources_vvvvvwi) +{ + // set the function logic + if (externalsources_vvvvvwi == 1) + { + return true; + } + return false; +} + +// the vvvvvwj function +function vvvvvwj(update_method_vvvvvwj) +{ + // set the function logic + if (update_method_vvvvvwj == 2) + { + jQuery('#jform_update_timer').closest('.control-group').show(); + } + else + { + jQuery('#jform_update_timer').closest('.control-group').hide(); + } +} + +// the vvvvvwk function +function vvvvvwk(build_vvvvvwk) +{ + if (isSet(build_vvvvvwk) && build_vvvvvwk.constructor !== Array) + { + var temp_vvvvvwk = build_vvvvvwk; + var build_vvvvvwk = []; + build_vvvvvwk.push(temp_vvvvvwk); + } + else if (!isSet(build_vvvvvwk)) + { + var build_vvvvvwk = []; + } + var build = build_vvvvvwk.some(build_vvvvvwk_SomeFunc); + + + // set this function logic + if (build) + { + jQuery('.note_auto_dropbox').closest('.control-group').show(); + } + else + { + jQuery('.note_auto_dropbox').closest('.control-group').hide(); + } +} + +// the vvvvvwk Some function +function build_vvvvvwk_SomeFunc(build_vvvvvwk) +{ + // set the function logic + if (build_vvvvvwk == 2) + { + return true; + } + return false; +} + +// the vvvvvwl function +function vvvvvwl(build_vvvvvwl) +{ + if (isSet(build_vvvvvwl) && build_vvvvvwl.constructor !== Array) + { + var temp_vvvvvwl = build_vvvvvwl; + var build_vvvvvwl = []; + build_vvvvvwl.push(temp_vvvvvwl); + } + else if (!isSet(build_vvvvvwl)) + { + var build_vvvvvwl = []; + } + var build = build_vvvvvwl.some(build_vvvvvwl_SomeFunc); + + + // set this function logic + if (build) + { + jQuery('.note_manual_dropbox').closest('.control-group').show(); + } + else + { + jQuery('.note_manual_dropbox').closest('.control-group').hide(); + } +} + +// the vvvvvwl Some function +function build_vvvvvwl_SomeFunc(build_vvvvvwl) +{ + // set the function logic + if (build_vvvvvwl == 1) + { + return true; + } + return false; +} + +// the vvvvvwm function +function vvvvvwm(externalsources_vvvvvwm,update_method_vvvvvwm) +{ + if (isSet(externalsources_vvvvvwm) && externalsources_vvvvvwm.constructor !== Array) + { + var temp_vvvvvwm = externalsources_vvvvvwm; + var externalsources_vvvvvwm = []; + externalsources_vvvvvwm.push(temp_vvvvvwm); + } + else if (!isSet(externalsources_vvvvvwm)) + { + var externalsources_vvvvvwm = []; + } + var externalsources = externalsources_vvvvvwm.some(externalsources_vvvvvwm_SomeFunc); + + if (isSet(update_method_vvvvvwm) && update_method_vvvvvwm.constructor !== Array) + { + var temp_vvvvvwm = update_method_vvvvvwm; + var update_method_vvvvvwm = []; + update_method_vvvvvwm.push(temp_vvvvvwm); + } + else if (!isSet(update_method_vvvvvwm)) + { + var update_method_vvvvvwm = []; + } + var update_method = update_method_vvvvvwm.some(update_method_vvvvvwm_SomeFunc); + + + // set this function logic + if (externalsources && update_method) + { + jQuery('#jform_oauthtoken').closest('.control-group').show(); + if (jform_vvvvvwmvwd_required) + { + updateFieldRequired('oauthtoken',0); + jQuery('#jform_oauthtoken').prop('required','required'); + jQuery('#jform_oauthtoken').attr('aria-required',true); + jQuery('#jform_oauthtoken').addClass('required'); + jform_vvvvvwmvwd_required = false; + } + + } + else + { + jQuery('#jform_oauthtoken').closest('.control-group').hide(); + if (!jform_vvvvvwmvwd_required) + { + updateFieldRequired('oauthtoken',1); + jQuery('#jform_oauthtoken').removeAttr('required'); + jQuery('#jform_oauthtoken').removeAttr('aria-required'); + jQuery('#jform_oauthtoken').removeClass('required'); + jform_vvvvvwmvwd_required = true; + } + } +} + +// the vvvvvwm Some function +function externalsources_vvvvvwm_SomeFunc(externalsources_vvvvvwm) +{ + // set the function logic + if (externalsources_vvvvvwm == 1) + { + return true; + } + return false; +} + +// the vvvvvwm Some function +function update_method_vvvvvwm_SomeFunc(update_method_vvvvvwm) +{ + // set the function logic + if (update_method_vvvvvwm == 2) + { + return true; + } + return false; +} + +// the vvvvvwo function +function vvvvvwo(externalsources_vvvvvwo,update_method_vvvvvwo) +{ + if (isSet(externalsources_vvvvvwo) && externalsources_vvvvvwo.constructor !== Array) + { + var temp_vvvvvwo = externalsources_vvvvvwo; + var externalsources_vvvvvwo = []; + externalsources_vvvvvwo.push(temp_vvvvvwo); + } + else if (!isSet(externalsources_vvvvvwo)) + { + var externalsources_vvvvvwo = []; + } + var externalsources = externalsources_vvvvvwo.some(externalsources_vvvvvwo_SomeFunc); + + if (isSet(update_method_vvvvvwo) && update_method_vvvvvwo.constructor !== Array) + { + var temp_vvvvvwo = update_method_vvvvvwo; + var update_method_vvvvvwo = []; + update_method_vvvvvwo.push(temp_vvvvvwo); + } + else if (!isSet(update_method_vvvvvwo)) + { + var update_method_vvvvvwo = []; + } + var update_method = update_method_vvvvvwo.some(update_method_vvvvvwo_SomeFunc); + + + // set this function logic + if (externalsources && update_method) + { + jQuery('.generated_access_token_note').closest('.control-group').show(); + } + else + { + jQuery('.generated_access_token_note').closest('.control-group').hide(); + } +} + +// the vvvvvwo Some function +function externalsources_vvvvvwo_SomeFunc(externalsources_vvvvvwo) +{ + // set the function logic + if (externalsources_vvvvvwo == 1) + { + return true; + } + return false; +} + +// the vvvvvwo Some function +function update_method_vvvvvwo_SomeFunc(update_method_vvvvvwo) +{ + // set the function logic + if (update_method_vvvvvwo == 1) + { + return true; + } + return false; +} + +// the vvvvvwq function +function vvvvvwq(externalsources_vvvvvwq,dropboxoptions_vvvvvwq,permissiontype_vvvvvwq) +{ + if (isSet(externalsources_vvvvvwq) && externalsources_vvvvvwq.constructor !== Array) + { + var temp_vvvvvwq = externalsources_vvvvvwq; + var externalsources_vvvvvwq = []; + externalsources_vvvvvwq.push(temp_vvvvvwq); + } + else if (!isSet(externalsources_vvvvvwq)) + { + var externalsources_vvvvvwq = []; + } + var externalsources = externalsources_vvvvvwq.some(externalsources_vvvvvwq_SomeFunc); + + if (isSet(dropboxoptions_vvvvvwq) && dropboxoptions_vvvvvwq.constructor !== Array) + { + var temp_vvvvvwq = dropboxoptions_vvvvvwq; + var dropboxoptions_vvvvvwq = []; + dropboxoptions_vvvvvwq.push(temp_vvvvvwq); + } + else if (!isSet(dropboxoptions_vvvvvwq)) + { + var dropboxoptions_vvvvvwq = []; + } + var dropboxoptions = dropboxoptions_vvvvvwq.some(dropboxoptions_vvvvvwq_SomeFunc); + + if (isSet(permissiontype_vvvvvwq) && permissiontype_vvvvvwq.constructor !== Array) + { + var temp_vvvvvwq = permissiontype_vvvvvwq; + var permissiontype_vvvvvwq = []; + permissiontype_vvvvvwq.push(temp_vvvvvwq); + } + else if (!isSet(permissiontype_vvvvvwq)) + { + var permissiontype_vvvvvwq = []; + } + var permissiontype = permissiontype_vvvvvwq.some(permissiontype_vvvvvwq_SomeFunc); + + + // set this function logic + if (externalsources && dropboxoptions && permissiontype) + { + jQuery('#jform_sharedurl').closest('.control-group').show(); + } + else + { + jQuery('#jform_sharedurl').closest('.control-group').hide(); + } +} + +// the vvvvvwq Some function +function externalsources_vvvvvwq_SomeFunc(externalsources_vvvvvwq) +{ + // set the function logic + if (externalsources_vvvvvwq == 1) + { + return true; + } + return false; +} + +// the vvvvvwq Some function +function dropboxoptions_vvvvvwq_SomeFunc(dropboxoptions_vvvvvwq) +{ + // set the function logic + if (dropboxoptions_vvvvvwq == 1) + { + return true; + } + return false; +} + +// the vvvvvwq Some function +function permissiontype_vvvvvwq_SomeFunc(permissiontype_vvvvvwq) +{ + // set the function logic + if (permissiontype_vvvvvwq == 'full') + { + return true; + } + return false; +} + +// the vvvvvwr function +function vvvvvwr(dropboxoptions_vvvvvwr,externalsources_vvvvvwr,permissiontype_vvvvvwr) +{ + if (isSet(dropboxoptions_vvvvvwr) && dropboxoptions_vvvvvwr.constructor !== Array) + { + var temp_vvvvvwr = dropboxoptions_vvvvvwr; + var dropboxoptions_vvvvvwr = []; + dropboxoptions_vvvvvwr.push(temp_vvvvvwr); + } + else if (!isSet(dropboxoptions_vvvvvwr)) + { + var dropboxoptions_vvvvvwr = []; + } + var dropboxoptions = dropboxoptions_vvvvvwr.some(dropboxoptions_vvvvvwr_SomeFunc); + + if (isSet(externalsources_vvvvvwr) && externalsources_vvvvvwr.constructor !== Array) + { + var temp_vvvvvwr = externalsources_vvvvvwr; + var externalsources_vvvvvwr = []; + externalsources_vvvvvwr.push(temp_vvvvvwr); + } + else if (!isSet(externalsources_vvvvvwr)) + { + var externalsources_vvvvvwr = []; + } + var externalsources = externalsources_vvvvvwr.some(externalsources_vvvvvwr_SomeFunc); + + if (isSet(permissiontype_vvvvvwr) && permissiontype_vvvvvwr.constructor !== Array) + { + var temp_vvvvvwr = permissiontype_vvvvvwr; + var permissiontype_vvvvvwr = []; + permissiontype_vvvvvwr.push(temp_vvvvvwr); + } + else if (!isSet(permissiontype_vvvvvwr)) + { + var permissiontype_vvvvvwr = []; + } + var permissiontype = permissiontype_vvvvvwr.some(permissiontype_vvvvvwr_SomeFunc); + + + // set this function logic + if (dropboxoptions && externalsources && permissiontype) + { + jQuery('#jform_sharedurl').closest('.control-group').show(); + } + else + { + jQuery('#jform_sharedurl').closest('.control-group').hide(); + } +} + +// the vvvvvwr Some function +function dropboxoptions_vvvvvwr_SomeFunc(dropboxoptions_vvvvvwr) +{ + // set the function logic + if (dropboxoptions_vvvvvwr == 1) + { + return true; + } + return false; +} + +// the vvvvvwr Some function +function externalsources_vvvvvwr_SomeFunc(externalsources_vvvvvwr) +{ + // set the function logic + if (externalsources_vvvvvwr == 1) + { + return true; + } + return false; +} + +// the vvvvvwr Some function +function permissiontype_vvvvvwr_SomeFunc(permissiontype_vvvvvwr) +{ + // set the function logic + if (permissiontype_vvvvvwr == 'full') + { + return true; + } + return false; +} + +// the vvvvvws function +function vvvvvws(permissiontype_vvvvvws,externalsources_vvvvvws,dropboxoptions_vvvvvws) +{ + if (isSet(permissiontype_vvvvvws) && permissiontype_vvvvvws.constructor !== Array) + { + var temp_vvvvvws = permissiontype_vvvvvws; + var permissiontype_vvvvvws = []; + permissiontype_vvvvvws.push(temp_vvvvvws); + } + else if (!isSet(permissiontype_vvvvvws)) + { + var permissiontype_vvvvvws = []; + } + var permissiontype = permissiontype_vvvvvws.some(permissiontype_vvvvvws_SomeFunc); + + if (isSet(externalsources_vvvvvws) && externalsources_vvvvvws.constructor !== Array) + { + var temp_vvvvvws = externalsources_vvvvvws; + var externalsources_vvvvvws = []; + externalsources_vvvvvws.push(temp_vvvvvws); + } + else if (!isSet(externalsources_vvvvvws)) + { + var externalsources_vvvvvws = []; + } + var externalsources = externalsources_vvvvvws.some(externalsources_vvvvvws_SomeFunc); + + if (isSet(dropboxoptions_vvvvvws) && dropboxoptions_vvvvvws.constructor !== Array) + { + var temp_vvvvvws = dropboxoptions_vvvvvws; + var dropboxoptions_vvvvvws = []; + dropboxoptions_vvvvvws.push(temp_vvvvvws); + } + else if (!isSet(dropboxoptions_vvvvvws)) + { + var dropboxoptions_vvvvvws = []; + } + var dropboxoptions = dropboxoptions_vvvvvws.some(dropboxoptions_vvvvvws_SomeFunc); + + + // set this function logic + if (permissiontype && externalsources && dropboxoptions) + { + jQuery('#jform_sharedurl').closest('.control-group').show(); + } + else + { + jQuery('#jform_sharedurl').closest('.control-group').hide(); + } +} + +// the vvvvvws Some function +function permissiontype_vvvvvws_SomeFunc(permissiontype_vvvvvws) +{ + // set the function logic + if (permissiontype_vvvvvws == 'full') + { + return true; + } + return false; +} + +// the vvvvvws Some function +function externalsources_vvvvvws_SomeFunc(externalsources_vvvvvws) +{ + // set the function logic + if (externalsources_vvvvvws == 1) + { + return true; + } + return false; +} + +// the vvvvvws Some function +function dropboxoptions_vvvvvws_SomeFunc(dropboxoptions_vvvvvws) +{ + // set the function logic + if (dropboxoptions_vvvvvws == 1) + { + return true; + } + return false; +} + +// the vvvvvwt function +function vvvvvwt(externalsources_vvvvvwt,dropboxoptions_vvvvvwt,permissiontype_vvvvvwt) +{ + if (isSet(externalsources_vvvvvwt) && externalsources_vvvvvwt.constructor !== Array) + { + var temp_vvvvvwt = externalsources_vvvvvwt; + var externalsources_vvvvvwt = []; + externalsources_vvvvvwt.push(temp_vvvvvwt); + } + else if (!isSet(externalsources_vvvvvwt)) + { + var externalsources_vvvvvwt = []; + } + var externalsources = externalsources_vvvvvwt.some(externalsources_vvvvvwt_SomeFunc); + + if (isSet(dropboxoptions_vvvvvwt) && dropboxoptions_vvvvvwt.constructor !== Array) + { + var temp_vvvvvwt = dropboxoptions_vvvvvwt; + var dropboxoptions_vvvvvwt = []; + dropboxoptions_vvvvvwt.push(temp_vvvvvwt); + } + else if (!isSet(dropboxoptions_vvvvvwt)) + { + var dropboxoptions_vvvvvwt = []; + } + var dropboxoptions = dropboxoptions_vvvvvwt.some(dropboxoptions_vvvvvwt_SomeFunc); + + if (isSet(permissiontype_vvvvvwt) && permissiontype_vvvvvwt.constructor !== Array) + { + var temp_vvvvvwt = permissiontype_vvvvvwt; + var permissiontype_vvvvvwt = []; + permissiontype_vvvvvwt.push(temp_vvvvvwt); + } + else if (!isSet(permissiontype_vvvvvwt)) + { + var permissiontype_vvvvvwt = []; + } + var permissiontype = permissiontype_vvvvvwt.some(permissiontype_vvvvvwt_SomeFunc); + + + // set this function logic + if (externalsources && dropboxoptions && permissiontype) + { + jQuery('#jform_folder').closest('.control-group').show(); + } + else + { + jQuery('#jform_folder').closest('.control-group').hide(); + } +} + +// the vvvvvwt Some function +function externalsources_vvvvvwt_SomeFunc(externalsources_vvvvvwt) +{ + // set the function logic + if (externalsources_vvvvvwt == 1) + { + return true; + } + return false; +} + +// the vvvvvwt Some function +function dropboxoptions_vvvvvwt_SomeFunc(dropboxoptions_vvvvvwt) +{ + // set the function logic + if (dropboxoptions_vvvvvwt == 2) + { + return true; + } + return false; +} + +// the vvvvvwt Some function +function permissiontype_vvvvvwt_SomeFunc(permissiontype_vvvvvwt) +{ + // set the function logic + if (permissiontype_vvvvvwt == 'full') + { + return true; + } + return false; +} + +// the vvvvvwu function +function vvvvvwu(dropboxoptions_vvvvvwu,externalsources_vvvvvwu,permissiontype_vvvvvwu) +{ + if (isSet(dropboxoptions_vvvvvwu) && dropboxoptions_vvvvvwu.constructor !== Array) + { + var temp_vvvvvwu = dropboxoptions_vvvvvwu; + var dropboxoptions_vvvvvwu = []; + dropboxoptions_vvvvvwu.push(temp_vvvvvwu); + } + else if (!isSet(dropboxoptions_vvvvvwu)) + { + var dropboxoptions_vvvvvwu = []; + } + var dropboxoptions = dropboxoptions_vvvvvwu.some(dropboxoptions_vvvvvwu_SomeFunc); + + if (isSet(externalsources_vvvvvwu) && externalsources_vvvvvwu.constructor !== Array) + { + var temp_vvvvvwu = externalsources_vvvvvwu; + var externalsources_vvvvvwu = []; + externalsources_vvvvvwu.push(temp_vvvvvwu); + } + else if (!isSet(externalsources_vvvvvwu)) + { + var externalsources_vvvvvwu = []; + } + var externalsources = externalsources_vvvvvwu.some(externalsources_vvvvvwu_SomeFunc); + + if (isSet(permissiontype_vvvvvwu) && permissiontype_vvvvvwu.constructor !== Array) + { + var temp_vvvvvwu = permissiontype_vvvvvwu; + var permissiontype_vvvvvwu = []; + permissiontype_vvvvvwu.push(temp_vvvvvwu); + } + else if (!isSet(permissiontype_vvvvvwu)) + { + var permissiontype_vvvvvwu = []; + } + var permissiontype = permissiontype_vvvvvwu.some(permissiontype_vvvvvwu_SomeFunc); + + + // set this function logic + if (dropboxoptions && externalsources && permissiontype) + { + jQuery('#jform_folder').closest('.control-group').show(); + } + else + { + jQuery('#jform_folder').closest('.control-group').hide(); + } +} + +// the vvvvvwu Some function +function dropboxoptions_vvvvvwu_SomeFunc(dropboxoptions_vvvvvwu) +{ + // set the function logic + if (dropboxoptions_vvvvvwu == 2) + { + return true; + } + return false; +} + +// the vvvvvwu Some function +function externalsources_vvvvvwu_SomeFunc(externalsources_vvvvvwu) +{ + // set the function logic + if (externalsources_vvvvvwu == 1) + { + return true; + } + return false; +} + +// the vvvvvwu Some function +function permissiontype_vvvvvwu_SomeFunc(permissiontype_vvvvvwu) +{ + // set the function logic + if (permissiontype_vvvvvwu == 'full') + { + return true; + } + return false; +} + +// the vvvvvwv function +function vvvvvwv(permissiontype_vvvvvwv,externalsources_vvvvvwv,dropboxoptions_vvvvvwv) +{ + if (isSet(permissiontype_vvvvvwv) && permissiontype_vvvvvwv.constructor !== Array) + { + var temp_vvvvvwv = permissiontype_vvvvvwv; + var permissiontype_vvvvvwv = []; + permissiontype_vvvvvwv.push(temp_vvvvvwv); + } + else if (!isSet(permissiontype_vvvvvwv)) + { + var permissiontype_vvvvvwv = []; + } + var permissiontype = permissiontype_vvvvvwv.some(permissiontype_vvvvvwv_SomeFunc); + + if (isSet(externalsources_vvvvvwv) && externalsources_vvvvvwv.constructor !== Array) + { + var temp_vvvvvwv = externalsources_vvvvvwv; + var externalsources_vvvvvwv = []; + externalsources_vvvvvwv.push(temp_vvvvvwv); + } + else if (!isSet(externalsources_vvvvvwv)) + { + var externalsources_vvvvvwv = []; + } + var externalsources = externalsources_vvvvvwv.some(externalsources_vvvvvwv_SomeFunc); + + if (isSet(dropboxoptions_vvvvvwv) && dropboxoptions_vvvvvwv.constructor !== Array) + { + var temp_vvvvvwv = dropboxoptions_vvvvvwv; + var dropboxoptions_vvvvvwv = []; + dropboxoptions_vvvvvwv.push(temp_vvvvvwv); + } + else if (!isSet(dropboxoptions_vvvvvwv)) + { + var dropboxoptions_vvvvvwv = []; + } + var dropboxoptions = dropboxoptions_vvvvvwv.some(dropboxoptions_vvvvvwv_SomeFunc); + + + // set this function logic + if (permissiontype && externalsources && dropboxoptions) + { + jQuery('#jform_folder').closest('.control-group').show(); + } + else + { + jQuery('#jform_folder').closest('.control-group').hide(); + } +} + +// the vvvvvwv Some function +function permissiontype_vvvvvwv_SomeFunc(permissiontype_vvvvvwv) +{ + // set the function logic + if (permissiontype_vvvvvwv == 'full') + { + return true; + } + return false; +} + +// the vvvvvwv Some function +function externalsources_vvvvvwv_SomeFunc(externalsources_vvvvvwv) +{ + // set the function logic + if (externalsources_vvvvvwv == 1) + { + return true; + } + return false; +} + +// the vvvvvwv Some function +function dropboxoptions_vvvvvwv_SomeFunc(dropboxoptions_vvvvvwv) +{ + // set the function logic + if (dropboxoptions_vvvvvwv == 2) + { + return true; + } + return false; +} + +// the vvvvvww function +function vvvvvww(build_vvvvvww) +{ + if (isSet(build_vvvvvww) && build_vvvvvww.constructor !== Array) + { + var temp_vvvvvww = build_vvvvvww; + var build_vvvvvww = []; + build_vvvvvww.push(temp_vvvvvww); + } + else if (!isSet(build_vvvvvww)) + { + var build_vvvvvww = []; + } + var build = build_vvvvvww.some(build_vvvvvww_SomeFunc); + + + // set this function logic + if (build) + { + jQuery('.wiki_check_note').closest('.control-group').show(); + } + else + { + jQuery('.wiki_check_note').closest('.control-group').hide(); + } +} + +// the vvvvvww Some function +function build_vvvvvww_SomeFunc(build_vvvvvww) +{ + // set the function logic + if (build_vvvvvww != '') + { + return true; + } + return false; +} + +// update required fields +function updateFieldRequired(name,status) +{ + var not_required = jQuery('#jform_not_required').val(); + + if(status == 1) + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required+','+name; + } + else + { + not_required = ','+name; + } + } + else + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required.replace(','+name,''); + } + } + + jQuery('#jform_not_required').val(not_required); +} + +// the isSet function +function isSet(val) +{ + if ((val != undefined) && (val != null) && 0 !== val.length){ + return true; + } + return false; +} + +jQuery(document).ready(function() +{ + var sharedurls = jQuery('#jform_sharedurl').val(); + if (sharedurls) { + getBuildTable(sharedurls,'jform_sharedurl'); + } + var folders = jQuery('#jform_folder').val(); + if (folders) { + getBuildTable(folders,'jform_folder'); + } + jQuery('.save-modal-data').text('Done'); +}); +function getBuildTable_server(string,idName){ + var getUrl = "index.php?option=com_sermondistributor&task=ajax.getBuildTable&format=json"; + if(token.length > 0 && string.length > 0 && idName.length > 0){ + var request = 'token='+token+'&idName='+idName+'&oject='+string; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'jsonp', + data: request, + jsonp: 'callback' + }); +} +function getBuildTable(string,idName){ + getBuildTable_server(string,idName).done(function(result) { + if(result){ + buildTable(result,idName); + } else { + jQuery('#table_'+idName).remove(); + } + }) +} +function buildTable(result,idName){ + jQuery('#table_'+idName).remove(); + jQuery('#'+idName).closest('.control-group').append(result); +} diff --git a/admin/models/forms/external_source.xml b/admin/models/forms/external_source.xml new file mode 100644 index 00000000..99069063 --- /dev/null +++ b/admin/models/forms/external_source.xml @@ -0,0 +1,372 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/help_document.js b/admin/models/forms/help_document.js index fa745aa6..f0f428d1 100644 --- a/admin/models/forms/help_document.js +++ b/admin/models/forms/help_document.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage help_document.js @@ -23,289 +23,289 @@ /-----------------------------------------------------------------------------------------------------------------------------*/ // Some Global Values -jform_vvvvvwevwd_required = false; -jform_vvvvvwfvwe_required = false; -jform_vvvvvwgvwf_required = false; -jform_vvvvvwhvwg_required = false; -jform_vvvvvwivwh_required = false; -jform_vvvvvwjvwi_required = false; +jform_vvvvvxavwe_required = false; +jform_vvvvvxbvwf_required = false; +jform_vvvvvxcvwg_required = false; +jform_vvvvvxdvwh_required = false; +jform_vvvvvxevwi_required = false; +jform_vvvvvxfvwj_required = false; // Initial Script jQuery(document).ready(function() { - var location_vvvvvwe = jQuery("#jform_location input[type='radio']:checked").val(); - vvvvvwe(location_vvvvvwe); + var location_vvvvvxa = jQuery("#jform_location input[type='radio']:checked").val(); + vvvvvxa(location_vvvvvxa); - var location_vvvvvwf = jQuery("#jform_location input[type='radio']:checked").val(); - vvvvvwf(location_vvvvvwf); + var location_vvvvvxb = jQuery("#jform_location input[type='radio']:checked").val(); + vvvvvxb(location_vvvvvxb); - var type_vvvvvwg = jQuery("#jform_type").val(); - vvvvvwg(type_vvvvvwg); + var type_vvvvvxc = jQuery("#jform_type").val(); + vvvvvxc(type_vvvvvxc); - var type_vvvvvwh = jQuery("#jform_type").val(); - vvvvvwh(type_vvvvvwh); + var type_vvvvvxd = jQuery("#jform_type").val(); + vvvvvxd(type_vvvvvxd); - var type_vvvvvwi = jQuery("#jform_type").val(); - vvvvvwi(type_vvvvvwi); + var type_vvvvvxe = jQuery("#jform_type").val(); + vvvvvxe(type_vvvvvxe); - var target_vvvvvwj = jQuery("#jform_target input[type='radio']:checked").val(); - vvvvvwj(target_vvvvvwj); + var target_vvvvvxf = jQuery("#jform_target input[type='radio']:checked").val(); + vvvvvxf(target_vvvvvxf); }); -// the vvvvvwe function -function vvvvvwe(location_vvvvvwe) +// the vvvvvxa function +function vvvvvxa(location_vvvvvxa) { // set the function logic - if (location_vvvvvwe == 1) + if (location_vvvvvxa == 1) { jQuery('#jform_admin_view').closest('.control-group').show(); - if (jform_vvvvvwevwd_required) + if (jform_vvvvvxavwe_required) { updateFieldRequired('admin_view',0); jQuery('#jform_admin_view').prop('required','required'); jQuery('#jform_admin_view').attr('aria-required',true); jQuery('#jform_admin_view').addClass('required'); - jform_vvvvvwevwd_required = false; + jform_vvvvvxavwe_required = false; } } else { jQuery('#jform_admin_view').closest('.control-group').hide(); - if (!jform_vvvvvwevwd_required) + if (!jform_vvvvvxavwe_required) { updateFieldRequired('admin_view',1); jQuery('#jform_admin_view').removeAttr('required'); jQuery('#jform_admin_view').removeAttr('aria-required'); jQuery('#jform_admin_view').removeClass('required'); - jform_vvvvvwevwd_required = true; + jform_vvvvvxavwe_required = true; } } } -// the vvvvvwf function -function vvvvvwf(location_vvvvvwf) +// the vvvvvxb function +function vvvvvxb(location_vvvvvxb) { // set the function logic - if (location_vvvvvwf == 2) + if (location_vvvvvxb == 2) { jQuery('#jform_site_view').closest('.control-group').show(); - if (jform_vvvvvwfvwe_required) + if (jform_vvvvvxbvwf_required) { updateFieldRequired('site_view',0); jQuery('#jform_site_view').prop('required','required'); jQuery('#jform_site_view').attr('aria-required',true); jQuery('#jform_site_view').addClass('required'); - jform_vvvvvwfvwe_required = false; + jform_vvvvvxbvwf_required = false; } } else { jQuery('#jform_site_view').closest('.control-group').hide(); - if (!jform_vvvvvwfvwe_required) + if (!jform_vvvvvxbvwf_required) { updateFieldRequired('site_view',1); jQuery('#jform_site_view').removeAttr('required'); jQuery('#jform_site_view').removeAttr('aria-required'); jQuery('#jform_site_view').removeClass('required'); - jform_vvvvvwfvwe_required = true; + jform_vvvvvxbvwf_required = true; } } } -// the vvvvvwg function -function vvvvvwg(type_vvvvvwg) +// the vvvvvxc function +function vvvvvxc(type_vvvvvxc) { - if (isSet(type_vvvvvwg) && type_vvvvvwg.constructor !== Array) + if (isSet(type_vvvvvxc) && type_vvvvvxc.constructor !== Array) { - var temp_vvvvvwg = type_vvvvvwg; - var type_vvvvvwg = []; - type_vvvvvwg.push(temp_vvvvvwg); + var temp_vvvvvxc = type_vvvvvxc; + var type_vvvvvxc = []; + type_vvvvvxc.push(temp_vvvvvxc); } - else if (!isSet(type_vvvvvwg)) + else if (!isSet(type_vvvvvxc)) { - var type_vvvvvwg = []; + var type_vvvvvxc = []; } - var type = type_vvvvvwg.some(type_vvvvvwg_SomeFunc); + var type = type_vvvvvxc.some(type_vvvvvxc_SomeFunc); // set this function logic if (type) { jQuery('#jform_url').closest('.control-group').show(); - if (jform_vvvvvwgvwf_required) + if (jform_vvvvvxcvwg_required) { updateFieldRequired('url',0); jQuery('#jform_url').prop('required','required'); jQuery('#jform_url').attr('aria-required',true); jQuery('#jform_url').addClass('required'); - jform_vvvvvwgvwf_required = false; + jform_vvvvvxcvwg_required = false; } } else { jQuery('#jform_url').closest('.control-group').hide(); - if (!jform_vvvvvwgvwf_required) + if (!jform_vvvvvxcvwg_required) { updateFieldRequired('url',1); jQuery('#jform_url').removeAttr('required'); jQuery('#jform_url').removeAttr('aria-required'); jQuery('#jform_url').removeClass('required'); - jform_vvvvvwgvwf_required = true; + jform_vvvvvxcvwg_required = true; } } } -// the vvvvvwg Some function -function type_vvvvvwg_SomeFunc(type_vvvvvwg) +// the vvvvvxc Some function +function type_vvvvvxc_SomeFunc(type_vvvvvxc) { // set the function logic - if (type_vvvvvwg == 3) + if (type_vvvvvxc == 3) { return true; } return false; } -// the vvvvvwh function -function vvvvvwh(type_vvvvvwh) +// the vvvvvxd function +function vvvvvxd(type_vvvvvxd) { - if (isSet(type_vvvvvwh) && type_vvvvvwh.constructor !== Array) + if (isSet(type_vvvvvxd) && type_vvvvvxd.constructor !== Array) { - var temp_vvvvvwh = type_vvvvvwh; - var type_vvvvvwh = []; - type_vvvvvwh.push(temp_vvvvvwh); + var temp_vvvvvxd = type_vvvvvxd; + var type_vvvvvxd = []; + type_vvvvvxd.push(temp_vvvvvxd); } - else if (!isSet(type_vvvvvwh)) + else if (!isSet(type_vvvvvxd)) { - var type_vvvvvwh = []; + var type_vvvvvxd = []; } - var type = type_vvvvvwh.some(type_vvvvvwh_SomeFunc); + var type = type_vvvvvxd.some(type_vvvvvxd_SomeFunc); // set this function logic if (type) { jQuery('#jform_article').closest('.control-group').show(); - if (jform_vvvvvwhvwg_required) + if (jform_vvvvvxdvwh_required) { updateFieldRequired('article',0); jQuery('#jform_article').prop('required','required'); jQuery('#jform_article').attr('aria-required',true); jQuery('#jform_article').addClass('required'); - jform_vvvvvwhvwg_required = false; + jform_vvvvvxdvwh_required = false; } } else { jQuery('#jform_article').closest('.control-group').hide(); - if (!jform_vvvvvwhvwg_required) + if (!jform_vvvvvxdvwh_required) { updateFieldRequired('article',1); jQuery('#jform_article').removeAttr('required'); jQuery('#jform_article').removeAttr('aria-required'); jQuery('#jform_article').removeClass('required'); - jform_vvvvvwhvwg_required = true; + jform_vvvvvxdvwh_required = true; } } } -// the vvvvvwh Some function -function type_vvvvvwh_SomeFunc(type_vvvvvwh) +// the vvvvvxd Some function +function type_vvvvvxd_SomeFunc(type_vvvvvxd) { // set the function logic - if (type_vvvvvwh == 1) + if (type_vvvvvxd == 1) { return true; } return false; } -// the vvvvvwi function -function vvvvvwi(type_vvvvvwi) +// the vvvvvxe function +function vvvvvxe(type_vvvvvxe) { - if (isSet(type_vvvvvwi) && type_vvvvvwi.constructor !== Array) + if (isSet(type_vvvvvxe) && type_vvvvvxe.constructor !== Array) { - var temp_vvvvvwi = type_vvvvvwi; - var type_vvvvvwi = []; - type_vvvvvwi.push(temp_vvvvvwi); + var temp_vvvvvxe = type_vvvvvxe; + var type_vvvvvxe = []; + type_vvvvvxe.push(temp_vvvvvxe); } - else if (!isSet(type_vvvvvwi)) + else if (!isSet(type_vvvvvxe)) { - var type_vvvvvwi = []; + var type_vvvvvxe = []; } - var type = type_vvvvvwi.some(type_vvvvvwi_SomeFunc); + var type = type_vvvvvxe.some(type_vvvvvxe_SomeFunc); // set this function logic if (type) { jQuery('#jform_content-lbl').closest('.control-group').show(); - if (jform_vvvvvwivwh_required) + if (jform_vvvvvxevwi_required) { updateFieldRequired('content',0); jQuery('#jform_content').prop('required','required'); jQuery('#jform_content').attr('aria-required',true); jQuery('#jform_content').addClass('required'); - jform_vvvvvwivwh_required = false; + jform_vvvvvxevwi_required = false; } } else { jQuery('#jform_content-lbl').closest('.control-group').hide(); - if (!jform_vvvvvwivwh_required) + if (!jform_vvvvvxevwi_required) { updateFieldRequired('content',1); jQuery('#jform_content').removeAttr('required'); jQuery('#jform_content').removeAttr('aria-required'); jQuery('#jform_content').removeClass('required'); - jform_vvvvvwivwh_required = true; + jform_vvvvvxevwi_required = true; } } } -// the vvvvvwi Some function -function type_vvvvvwi_SomeFunc(type_vvvvvwi) +// the vvvvvxe Some function +function type_vvvvvxe_SomeFunc(type_vvvvvxe) { // set the function logic - if (type_vvvvvwi == 2) + if (type_vvvvvxe == 2) { return true; } return false; } -// the vvvvvwj function -function vvvvvwj(target_vvvvvwj) +// the vvvvvxf function +function vvvvvxf(target_vvvvvxf) { // set the function logic - if (target_vvvvvwj == 1) + if (target_vvvvvxf == 1) { jQuery('#jform_groups').closest('.control-group').show(); - if (jform_vvvvvwjvwi_required) + if (jform_vvvvvxfvwj_required) { updateFieldRequired('groups',0); jQuery('#jform_groups').prop('required','required'); jQuery('#jform_groups').attr('aria-required',true); jQuery('#jform_groups').addClass('required'); - jform_vvvvvwjvwi_required = false; + jform_vvvvvxfvwj_required = false; } } else { jQuery('#jform_groups').closest('.control-group').hide(); - if (!jform_vvvvvwjvwi_required) + if (!jform_vvvvvxfvwj_required) { updateFieldRequired('groups',1); jQuery('#jform_groups').removeAttr('required'); jQuery('#jform_groups').removeAttr('aria-required'); jQuery('#jform_groups').removeClass('required'); - jform_vvvvvwjvwi_required = true; + jform_vvvvvxfvwj_required = true; } } } diff --git a/admin/models/forms/local_listing.js b/admin/models/forms/local_listing.js new file mode 100644 index 00000000..c973ce70 --- /dev/null +++ b/admin/models/forms/local_listing.js @@ -0,0 +1,192 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.4.0 + @build 27th November, 2016 + @created 22nd October, 2015 + @package Sermon Distributor + @subpackage local_listing.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// Initial Script +jQuery(document).ready(function() +{ + var build_vvvvvwx = jQuery("#jform_build").val(); + vvvvvwx(build_vvvvvwx); + + var build_vvvvvwy = jQuery("#jform_build").val(); + vvvvvwy(build_vvvvvwy); + + var build_vvvvvwz = jQuery("#jform_build").val(); + vvvvvwz(build_vvvvvwz); +}); + +// the vvvvvwx function +function vvvvvwx(build_vvvvvwx) +{ + if (isSet(build_vvvvvwx) && build_vvvvvwx.constructor !== Array) + { + var temp_vvvvvwx = build_vvvvvwx; + var build_vvvvvwx = []; + build_vvvvvwx.push(temp_vvvvvwx); + } + else if (!isSet(build_vvvvvwx)) + { + var build_vvvvvwx = []; + } + var build = build_vvvvvwx.some(build_vvvvvwx_SomeFunc); + + + // set this function logic + if (build) + { + } + else + { + } +} + +// the vvvvvwx Some function +function build_vvvvvwx_SomeFunc(build_vvvvvwx) +{ + // set the function logic + if (build_vvvvvwx == 2) + { + return true; + } + return false; +} + +// the vvvvvwy function +function vvvvvwy(build_vvvvvwy) +{ + if (isSet(build_vvvvvwy) && build_vvvvvwy.constructor !== Array) + { + var temp_vvvvvwy = build_vvvvvwy; + var build_vvvvvwy = []; + build_vvvvvwy.push(temp_vvvvvwy); + } + else if (!isSet(build_vvvvvwy)) + { + var build_vvvvvwy = []; + } + var build = build_vvvvvwy.some(build_vvvvvwy_SomeFunc); + + + // set this function logic + if (build) + { + } + else + { + } +} + +// the vvvvvwy Some function +function build_vvvvvwy_SomeFunc(build_vvvvvwy) +{ + // set the function logic + if (build_vvvvvwy == 1) + { + return true; + } + return false; +} + +// the vvvvvwz function +function vvvvvwz(build_vvvvvwz) +{ + if (isSet(build_vvvvvwz) && build_vvvvvwz.constructor !== Array) + { + var temp_vvvvvwz = build_vvvvvwz; + var build_vvvvvwz = []; + build_vvvvvwz.push(temp_vvvvvwz); + } + else if (!isSet(build_vvvvvwz)) + { + var build_vvvvvwz = []; + } + var build = build_vvvvvwz.some(build_vvvvvwz_SomeFunc); + + + // set this function logic + if (build) + { + } + else + { + } +} + +// the vvvvvwz Some function +function build_vvvvvwz_SomeFunc(build_vvvvvwz) +{ + // set the function logic + if (build_vvvvvwz != '') + { + return true; + } + return false; +} + +// the isSet function +function isSet(val) +{ + if ((val != undefined) && (val != null) && 0 !== val.length){ + return true; + } + return false; +} + +jQuery(document).ready(function() +{ + var sharedurls = jQuery('#jform_sharedurl').val(); + if (sharedurls) { + getBuildTable(sharedurls,'jform_sharedurl'); + } + var folders = jQuery('#jform_folder').val(); + if (folders) { + getBuildTable(folders,'jform_folder'); + } + jQuery('.save-modal-data').text('Done'); +}); +function getBuildTable_server(string,idName){ + var getUrl = "index.php?option=com_sermondistributor&task=ajax.getBuildTable&format=json"; + if(token.length > 0 && string.length > 0 && idName.length > 0){ + var request = 'token='+token+'&idName='+idName+'&oject='+string; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'jsonp', + data: request, + jsonp: 'callback' + }); +} +function getBuildTable(string,idName){ + getBuildTable_server(string,idName).done(function(result) { + if(result){ + buildTable(result,idName); + } else { + jQuery('#table_'+idName).remove(); + } + }) +} +function buildTable(result,idName){ + jQuery('#table_'+idName).remove(); + jQuery('#'+idName).closest('.control-group').append(result); +} diff --git a/admin/models/forms/local_listing.xml b/admin/models/forms/local_listing.xml new file mode 100644 index 00000000..ee2fd1a7 --- /dev/null +++ b/admin/models/forms/local_listing.xml @@ -0,0 +1,193 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/preacher.js b/admin/models/forms/preacher.js index 52479ee1..ad4c715c 100644 --- a/admin/models/forms/preacher.js +++ b/admin/models/forms/preacher.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.js diff --git a/admin/models/forms/series.js b/admin/models/forms/series.js index 7c81f8d9..1b734849 100644 --- a/admin/models/forms/series.js +++ b/admin/models/forms/series.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage series.js diff --git a/admin/models/forms/sermon.js b/admin/models/forms/sermon.js index f7c6666d..a22a73b8 100644 --- a/admin/models/forms/sermon.js +++ b/admin/models/forms/sermon.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.js @@ -36,14 +36,14 @@ jQuery(document).ready(function() vvvvvvv(source_vvvvvvv); var source_vvvvvvw = jQuery("#jform_source").val(); - var build_vvvvvvw = jQuery("#jform_build input[type='radio']:checked").val(); + var build_vvvvvvw = jQuery("#jform_build").val(); vvvvvvw(source_vvvvvvw,build_vvvvvvw); var source_vvvvvvy = jQuery("#jform_source").val(); - var build_vvvvvvy = jQuery("#jform_build input[type='radio']:checked").val(); + var build_vvvvvvy = jQuery("#jform_build").val(); vvvvvvy(source_vvvvvvy,build_vvvvvvy); - var build_vvvvvvz = jQuery("#jform_build input[type='radio']:checked").val(); + var build_vvvvvvz = jQuery("#jform_build").val(); var source_vvvvvvz = jQuery("#jform_source").val(); vvvvvvz(build_vvvvvvz,source_vvvvvvz); @@ -146,11 +146,11 @@ function vvvvvvw(source_vvvvvvw,build_vvvvvvw) // set this function logic if (source && build) { - jQuery('.note_auto_dropbox').closest('.control-group').show(); + jQuery('.note_auto_externalsource').closest('.control-group').show(); } else { - jQuery('.note_auto_dropbox').closest('.control-group').hide(); + jQuery('.note_auto_externalsource').closest('.control-group').hide(); } } @@ -217,7 +217,7 @@ function vvvvvvy(source_vvvvvvy,build_vvvvvvy) jform_vvvvvvyvvx_required = false; } - jQuery('.note_manual_dropbox').closest('.control-group').show(); + jQuery('.note_manual_externalsource').closest('.control-group').show(); } else { @@ -230,7 +230,7 @@ function vvvvvvy(source_vvvvvvy,build_vvvvvvy) jQuery('#jform_manual_files').removeClass('required'); jform_vvvvvvyvvx_required = true; } - jQuery('.note_manual_dropbox').closest('.control-group').hide(); + jQuery('.note_manual_externalsource').closest('.control-group').hide(); } } @@ -297,7 +297,7 @@ function vvvvvvz(build_vvvvvvz,source_vvvvvvz) jform_vvvvvvzvvy_required = false; } - jQuery('.note_manual_dropbox').closest('.control-group').show(); + jQuery('.note_manual_externalsource').closest('.control-group').show(); } else { @@ -310,7 +310,7 @@ function vvvvvvz(build_vvvvvvz,source_vvvvvvz) jQuery('#jform_manual_files').removeClass('required'); jform_vvvvvvzvvy_required = true; } - jQuery('.note_manual_dropbox').closest('.control-group').hide(); + jQuery('.note_manual_externalsource').closest('.control-group').hide(); } } diff --git a/admin/models/forms/sermon.xml b/admin/models/forms/sermon.xml index 63eb6d7e..f0a97983 100644 --- a/admin/models/forms/sermon.xml +++ b/admin/models/forms/sermon.xml @@ -201,7 +201,7 @@ + COM_SERMONDISTRIBUTOR_SERMON_EXTERNAL_SOURCE @@ -248,8 +248,8 @@ buttons="false" filter="safehtml" /> - - + + - - + + - + - + + + COM_SERMONDISTRIBUTOR_SERMON_MANUAL_LOCAL_SELECTION + COM_SERMONDISTRIBUTOR_SERMON_DYNAMIC_AUTOMATIC_BUILD loadForm('com_sermondistributor.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) diff --git a/admin/models/help_documents.php b/admin/models/help_documents.php index 09882a24..b315aba9 100644 --- a/admin/models/help_documents.php +++ b/admin/models/help_documents.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage help_documents.php diff --git a/admin/models/import.php b/admin/models/import.php index bbb343c4..f00d7d00 100644 --- a/admin/models/import.php +++ b/admin/models/import.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage import.php diff --git a/admin/models/local_listing.php b/admin/models/local_listing.php new file mode 100644 index 00000000..2487dbdd --- /dev/null +++ b/admin/models/local_listing.php @@ -0,0 +1,1011 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla modelform library +jimport('joomla.application.component.modeladmin'); + +/** + * Sermondistributor Local_listing Model + */ +class SermondistributorModelLocal_listing extends JModelAdmin +{ + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_SERMONDISTRIBUTOR'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_sermondistributor.local_listing'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'local_listing', $prefix = 'SermondistributorTable', $config = array()) + { + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get id of item if found. + * + * @param array $value The value to search for. + * @param array $key The key to search in. + * + * @return int True on success. + */ + public function searchForId($value, $key = 'key') + { + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.id'); + + // From the sermondistributor_item table + $query->from($db->quoteName('#__sermondistributor_local_listing', 'a')); + + // where the key value is found + $query->where('a.'.$key.' = ' . $db->quote($value)); + + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + return $db->loadResult(); + } + return false; + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + // Get the basic encription. + $basickey = SermondistributorHelper::getCryptKey('basic'); + // Get the encription object. + $basic = new FOFEncryptAes($basickey, 128); + + if (!empty($item->url) && $basickey && !is_numeric($item->url) && $item->url === base64_encode(base64_decode($item->url, true))) + { + // basic decript data url. + $item->url = rtrim($basic->decryptString($item->url), "\0"); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_sermondistributor.local_listing'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true) + { + // Get the form. + $form = $this->loadForm('com_sermondistributor.local_listing', 'local_listing', array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('local_listing.edit.state', 'com_sermondistributor.local_listing.' . (int) $id)) + || ($id == 0 && !$user->authorise('local_listing.edit.state', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('local_listing.edit.created_by', 'com_sermondistributor.local_listing.' . (int) $id)) + || ($id == 0 && !$user->authorise('local_listing.edit.created_by', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('local_listing.edit.created', 'com_sermondistributor.local_listing.' . (int) $id)) + || ($id == 0 && !$user->authorise('local_listing.edit.created', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('local_listing.edit.name', 'com_sermondistributor.local_listing.' . (int) $id)) + || ($id == 0 && !$user->authorise('local_listing.edit.name', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Build access controls. + if ($id != 0 && (!$user->authorise('local_listing.edit.build', 'com_sermondistributor.local_listing.' . (int) $id)) + || ($id == 0 && !$user->authorise('local_listing.edit.build', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('build', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('build', 'readonly', 'true'); + if (!$form->getValue('build')) + { + // Disable fields while saving. + $form->setFieldAttribute('build', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('build', 'required', 'false'); + } + } + // Modify the form based on Edit Size access controls. + if ($id != 0 && (!$user->authorise('local_listing.edit.size', 'com_sermondistributor.local_listing.' . (int) $id)) + || ($id == 0 && !$user->authorise('local_listing.edit.size', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('size', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('size', 'readonly', 'true'); + if (!$form->getValue('size')) + { + // Disable fields while saving. + $form->setFieldAttribute('size', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('size', 'required', 'false'); + } + } + // Modify the form based on Edit External Source access controls. + if ($id != 0 && (!$user->authorise('local_listing.edit.external_source', 'com_sermondistributor.local_listing.' . (int) $id)) + || ($id == 0 && !$user->authorise('local_listing.edit.external_source', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('external_source', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('external_source', 'readonly', 'true'); + if (!$form->getValue('external_source')) + { + // Disable fields while saving. + $form->setFieldAttribute('external_source', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('external_source', 'required', 'false'); + } + } + // Modify the form based on Edit Key access controls. + if ($id != 0 && (!$user->authorise('local_listing.edit.key', 'com_sermondistributor.local_listing.' . (int) $id)) + || ($id == 0 && !$user->authorise('local_listing.edit.key', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('key', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('key', 'readonly', 'true'); + if (!$form->getValue('key')) + { + // Disable fields while saving. + $form->setFieldAttribute('key', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('key', 'required', 'false'); + } + } + // Modify the form based on Edit Url access controls. + if ($id != 0 && (!$user->authorise('local_listing.edit.url', 'com_sermondistributor.local_listing.' . (int) $id)) + || ($id == 0 && !$user->authorise('local_listing.edit.url', 'com_sermondistributor'))) + { + // Disable fields for display. + $form->setFieldAttribute('url', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('url', 'readonly', 'true'); + if (!$form->getValue('url')) + { + // Disable fields while saving. + $form->setFieldAttribute('url', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('url', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected field name + $redirectedField = $jinput->get('ref', null, 'STRING'); + // Set redirected field value + $redirectedValue = $jinput->get('refid', 0, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_sermondistributor/models/forms/local_listing.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('local_listing.delete', 'com_sermondistributor.local_listing.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('local_listing.edit.state', 'com_sermondistributor.local_listing.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('local_listing.edit.state', 'com_sermondistributor'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('local_listing.edit', 'com_sermondistributor.local_listing.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('local_listing.edit', 'com_sermondistributor'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__sermondistributor_local_listing')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_sermondistributor.edit.local_listing.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('local_listing'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('local_listing'); + } + + if (!$this->canDo->get('local_listing.create') && !$this->canDo->get('local_listing.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('local_listing.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + + if (!$this->user->authorise('local_listing.edit', $contexts[$pk])) + + { + + // Not fatal error + + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + + continue; + + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + $this->table->name = $this->generateUniqe('name',$this->table->name); + + // insert all set values + if (SermondistributorHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (SermondistributorHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('local_listing'); + } + + if (!$this->canDo->get('local_listing.edit') && !$this->canDo->get('local_listing.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('local_listing.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('local_listing.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (SermondistributorHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' == $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Get the basic encription key. + $basickey = SermondistributorHelper::getCryptKey('basic'); + // Get the encription object + $basic = new FOFEncryptAes($basickey, 128); + + // Encript data url. + if (isset($data['url']) && $basickey) + { + $data['url'] = $basic->encryptString($data['url']); + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') == 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (SermondistributorHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title & alias. + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/local_listings.php b/admin/models/local_listings.php new file mode 100644 index 00000000..0d499c67 --- /dev/null +++ b/admin/models/local_listings.php @@ -0,0 +1,428 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the Joomla modellist library +jimport('joomla.application.component.modellist'); + +/** + * Local_listings Model + */ +class SermondistributorModelLocal_listings extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.build','build', + 'a.size','size', + 'a.external_source','external_source', + 'a.key','key' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + $this->setState('filter.name', $name); + + $build = $this->getUserStateFromRequest($this->context . '.filter.build', 'filter_build'); + $this->setState('filter.build', $build); + + $size = $this->getUserStateFromRequest($this->context . '.filter.size', 'filter_size'); + $this->setState('filter.size', $size); + + $external_source = $this->getUserStateFromRequest($this->context . '.filter.external_source', 'filter_external_source'); + $this->setState('filter.external_source', $external_source); + + $key = $this->getUserStateFromRequest($this->context . '.filter.key', 'filter_key'); + $this->setState('filter.key', $key); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (SermondistributorHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('local_listing.access', 'com_sermondistributor.local_listing.' . (int) $item->id) && $user->authorise('local_listing.access', 'com_sermondistributor')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // set selection value to a translatable value + if (SermondistributorHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert build + $item->build = $this->selectionTranslation($item->build, 'build'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of build language strings + if ($name == 'build') + { + $buildArray = array( + 0 => 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SELECT_AN_OPTION', + 1 => 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_MANUAL_LOCAL_SELECTION', + 2 => 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_DYNAMIC_AUTOMATIC_BUILD' + ); + // Now check if value is found in this array + if (isset($buildArray[$value]) && SermondistributorHelper::checkString($buildArray[$value])) + { + return $buildArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the sermondistributor_item table + $query->from($db->quoteName('#__sermondistributor_local_listing', 'a')); + + // From the sermondistributor_external_source table. + $query->select($db->quoteName('g.description','external_source_description')); + $query->join('LEFT', $db->quoteName('#__sermondistributor_external_source', 'g') . ' ON (' . $db->quoteName('a.external_source') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.build LIKE '.$search.' OR a.key LIKE '.$search.')'); + } + } + + // Filter by Build. + if ($build = $this->getState('filter.build')) + { + $query->where('a.build = ' . $db->quote($db->escape($build))); + } + // Filter by external_source. + if ($external_source = $this->getState('filter.external_source')) + { + $query->where('a.external_source = ' . $db->quote($db->escape($external_source))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks) + { + // setup the query + if (SermondistributorHelper::checkArray($pks)) + { + // Set a value to know this is exporting method. + $_export = true; + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the sermondistributor_local_listing table + $query->from($db->quoteName('#__sermondistributor_local_listing', 'a')); + $query->where('a.id IN (' . implode(',',$pks) . ')'); + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Get the basic encription key. + $basickey = SermondistributorHelper::getCryptKey('basic'); + // Get the encription object. + $basic = new FOFEncryptAes($basickey, 128); + + // set values to display correctly. + if (SermondistributorHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('local_listing.access', 'com_sermondistributor.local_listing.' . (int) $item->id) && $user->authorise('local_listing.access', 'com_sermondistributor')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + if ($basickey && !is_numeric($item->url) && $item->url === base64_encode(base64_decode($item->url, true))) + { + // decrypt url + $item->url = $basic->decryptString($item->url); + } + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (SermondistributorHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__sermondistributor_local_listing"); + if (SermondistributorHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.build'); + $id .= ':' . $this->getState('filter.size'); + $id .= ':' . $this->getState('filter.external_source'); + $id .= ':' . $this->getState('filter.key'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__sermondistributor_local_listing')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__sermondistributor_local_listing'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/manual_updater.php b/admin/models/manual_updater.php new file mode 100644 index 00000000..262dd0f2 --- /dev/null +++ b/admin/models/manual_updater.php @@ -0,0 +1,153 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the Joomla modellist library +jimport('joomla.application.component.modellist'); + +/** + * Sermondistributor Model for Manual_updater + */ +class SermondistributorModelManual_updater extends JModelList +{ + /** + * Model user data. + * + * @var strings + */ + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; + protected $app; + protected $input; + protected $uikitComp; + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the current user for authorisation checks + $this->user = JFactory::getUser(); + $this->userId = $this->user->get('id'); + $this->guest = $this->user->get('guest'); + $this->groups = $this->user->get('groups'); + $this->authorisedGroups = $this->user->getAuthorisedGroups(); + $this->levels = $this->user->getAuthorisedViewLevels(); + $this->app = JFactory::getApplication(); + $this->input = $this->app->input; + $this->initSet = true; + // Make sure all records load, since no pagination allowed. + $this->setState('list.limit', 0); + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Get from #__sermondistributor_external_source as a + $query->select($db->quoteName( + array('a.id','a.description','a.externalsources','a.build','a.update_method','a.update_timer','a.filetypes','a.oauthtoken','a.permissiontype','a.dropboxoptions','a.sharedurl','a.folder'), + array('id','description','externalsources','build','update_method','update_timer','filetypes','oauthtoken','permissiontype','dropboxoptions','sharedurl','folder'))); + $query->from($db->quoteName('#__sermondistributor_external_source', 'a')); + $query->where('a.update_method = 1'); + $query->where('a.published = 1'); + $query->order('a.description ASC'); + + // return the query object + return $query; + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + $user = JFactory::getUser(); + // check if this user has permission to access items + if (!$user->authorise('manual_updater.access', 'com_sermondistributor')) + { + $app = JFactory::getApplication(); + $app->enqueueMessage(JText::_('Not authorised!'), 'error'); + // redirect away if not a correct (TODO for now we go to default view) + $app->redirect('index.php?option=com_sermondistributor'); + return false; + } + // load parent items + $items = parent::getItems(); + + // Get the global params + $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + + // Get the basic encription. + $basickey = SermondistributorHelper::getCryptKey('basic'); + // Get the encription object. + $basic = new FOFEncryptAes($basickey, 128); + + // Convert the parameter fields into objects. + foreach ($items as $nr => &$item) + { + // Always create a slug for sef URL's + $item->slug = (isset($item->alias)) ? $item->id.':'.$item->alias : $item->id; + if (SermondistributorHelper::checkString($item->filetypes)) + { + // Decode filetypes + $item->filetypes = json_decode($item->filetypes, true); + } + if (!empty($item->oauthtoken) && $basickey && !is_numeric($item->oauthtoken) && $item->oauthtoken === base64_encode(base64_decode($item->oauthtoken, true))) + { + // Decode oauthtoken + $item->oauthtoken = rtrim($basic->decryptString($item->oauthtoken), "\0"); + } + } + + // return items + return $items; + } + + + /** + * Get the uikit needed components + * + * @return mixed An array of objects on success. + * + */ + public function getUikitComp() + { + if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + { + return $this->uikitComp; + } + return false; + } +} diff --git a/admin/models/preacher.php b/admin/models/preacher.php index eb790fe2..b677cc84 100644 --- a/admin/models/preacher.php +++ b/admin/models/preacher.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.php @@ -236,7 +236,7 @@ class SermondistributorModelPreacher extends JModelAdmin $sourceArray = array( 0 => 'COM_SERMONDISTRIBUTOR_SERMON_SELECT_SOURCE', 1 => 'COM_SERMONDISTRIBUTOR_SERMON_LOCAL_FOLDER', - 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX', + 2 => 'COM_SERMONDISTRIBUTOR_SERMON_EXTERNAL_SOURCE', 3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL' ); // Now check if value is found in this array @@ -259,7 +259,8 @@ class SermondistributorModelPreacher extends JModelAdmin * @since 1.6 */ public function getForm($data = array(), $loadData = true) - { // Get the form. + { + // Get the form. $form = $this->loadForm('com_sermondistributor.preacher', 'preacher', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) diff --git a/admin/models/preachers.php b/admin/models/preachers.php index 673961c7..e87f4a90 100644 --- a/admin/models/preachers.php +++ b/admin/models/preachers.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.php diff --git a/admin/models/series.php b/admin/models/series.php index 5d9ec4f9..26442d01 100644 --- a/admin/models/series.php +++ b/admin/models/series.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage series.php @@ -236,7 +236,7 @@ class SermondistributorModelSeries extends JModelAdmin $sourceArray = array( 0 => 'COM_SERMONDISTRIBUTOR_SERMON_SELECT_SOURCE', 1 => 'COM_SERMONDISTRIBUTOR_SERMON_LOCAL_FOLDER', - 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX', + 2 => 'COM_SERMONDISTRIBUTOR_SERMON_EXTERNAL_SOURCE', 3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL' ); // Now check if value is found in this array @@ -259,7 +259,8 @@ class SermondistributorModelSeries extends JModelAdmin * @since 1.6 */ public function getForm($data = array(), $loadData = true) - { // Get the form. + { + // Get the form. $form = $this->loadForm('com_sermondistributor.series', 'series', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) diff --git a/admin/models/series_list.php b/admin/models/series_list.php index cc81675e..1e6cd915 100644 --- a/admin/models/series_list.php +++ b/admin/models/series_list.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage series_list.php diff --git a/admin/models/sermon.php b/admin/models/sermon.php index cdd37857..07ba98f0 100644 --- a/admin/models/sermon.php +++ b/admin/models/sermon.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.php @@ -222,7 +222,8 @@ class SermondistributorModelSermon extends JModelAdmin * @since 1.6 */ public function getForm($data = array(), $loadData = true) - { // Get the form. + { + // Get the form. $form = $this->loadForm('com_sermondistributor.sermon', 'sermon', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) diff --git a/admin/models/sermondistributor.php b/admin/models/sermondistributor.php index 8e8bb9a0..e1cf39a9 100644 --- a/admin/models/sermondistributor.php +++ b/admin/models/sermondistributor.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php @@ -43,10 +43,13 @@ class SermondistributorModelSermondistributor extends JModelList $icons = array(); // view groups array $viewGroups = array( - 'main' => array('png.preacher.add', 'png.preachers', 'png.sermon.add', 'png.sermons', 'png.sermons.catid', 'png.series.add', 'png.series_list', 'png.statistics', 'png.help_documents') + 'main' => array('png.preacher.add', 'png.preachers', 'png.sermon.add', 'png.sermons', 'png.sermons.catid', 'png.series.add', 'png.series_list', 'png.statistics', 'png.external_source.add', 'png.external_sources', 'png.manual_updater', 'png.local_listings', 'png.help_documents') ); // view access array $viewAccess = array( + 'manual_updater.access' => 'manual_updater.access', + 'manual_updater.submenu' => 'manual_updater.submenu', + 'manual_updater.dashboard_list' => 'manual_updater.dashboard_list', 'preacher.create' => 'preacher.create', 'preachers.access' => 'preacher.access', 'preacher.access' => 'preacher.access', @@ -70,6 +73,17 @@ class SermondistributorModelSermondistributor extends JModelList 'statistic.access' => 'statistic.access', 'statistics.submenu' => 'statistic.submenu', 'statistics.dashboard_list' => 'statistic.dashboard_list', + 'external_source.create' => 'external_source.create', + 'external_sources.access' => 'external_source.access', + 'external_source.access' => 'external_source.access', + 'external_sources.submenu' => 'external_source.submenu', + 'external_sources.dashboard_list' => 'external_source.dashboard_list', + 'external_source.dashboard_add' => 'external_source.dashboard_add', + 'local_listing.create' => 'local_listing.create', + 'local_listings.access' => 'local_listing.access', + 'local_listing.access' => 'local_listing.access', + 'local_listings.submenu' => 'local_listing.submenu', + 'local_listings.dashboard_list' => 'local_listing.dashboard_list', 'help_document.create' => 'help_document.create', 'help_documents.access' => 'help_document.access', 'help_document.access' => 'help_document.access', diff --git a/admin/models/sermons.php b/admin/models/sermons.php index a1a55c84..682f3e65 100644 --- a/admin/models/sermons.php +++ b/admin/models/sermons.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons.php @@ -195,7 +195,7 @@ class SermondistributorModelSermons extends JModelList $sourceArray = array( 0 => 'COM_SERMONDISTRIBUTOR_SERMON_SELECT_SOURCE', 1 => 'COM_SERMONDISTRIBUTOR_SERMON_LOCAL_FOLDER', - 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX', + 2 => 'COM_SERMONDISTRIBUTOR_SERMON_EXTERNAL_SOURCE', 3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL' ); // Now check if value is found in this array diff --git a/admin/models/statistic.php b/admin/models/statistic.php index 89392527..1d1d2c96 100644 --- a/admin/models/statistic.php +++ b/admin/models/statistic.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage statistic.php @@ -116,7 +116,8 @@ class SermondistributorModelStatistic extends JModelAdmin * @since 1.6 */ public function getForm($data = array(), $loadData = true) - { // Get the form. + { + // Get the form. $form = $this->loadForm('com_sermondistributor.statistic', 'statistic', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) diff --git a/admin/models/statistics.php b/admin/models/statistics.php index 02bdd837..0726695d 100644 --- a/admin/models/statistics.php +++ b/admin/models/statistics.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage statistics.php diff --git a/admin/sermondistributor.php b/admin/sermondistributor.php index 9e86078e..21760869 100644 --- a/admin/sermondistributor.php +++ b/admin/sermondistributor.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index ba13f5fa..b15885f9 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -37,7 +37,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_sermon` ( `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', `alias` CHAR(64) NOT NULL DEFAULT '', `auto_sermons` TEXT NOT NULL, - `build` TINYINT(1) NOT NULL DEFAULT '1', + `build` TINYINT(1) NOT NULL DEFAULT '0', `catid` INT(11) NOT NULL DEFAULT '0', `description` TEXT NOT NULL, `icon` CHAR(64) NOT NULL DEFAULT '', @@ -150,6 +150,75 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_statistic` ( KEY `idx_series` (`series`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; +CREATE TABLE IF NOT EXISTS `#__sermondistributor_external_source` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', + `build` TINYINT(1) NOT NULL DEFAULT '0', + `description` VARCHAR(255) NOT NULL DEFAULT '', + `dropboxoptions` TINYINT(1) NOT NULL DEFAULT '1', + `externalsources` INT(11) NOT NULL DEFAULT '0', + `filetypes` TEXT NOT NULL, + `folder` TEXT NOT NULL, + `not_required` INT(1) NOT NULL DEFAULT '0', + `oauthtoken` TEXT NOT NULL, + `permissiontype` VARCHAR(64) NOT NULL DEFAULT '', + `sharedurl` TEXT NOT NULL, + `update_method` TINYINT NOT NULL DEFAULT '0', + `update_timer` INT(1) NOT NULL DEFAULT '0', + `params` TEXT NOT NULL, + `published` tinyint(1) NOT NULL DEFAULT '1', + `created_by` int(11) NOT NULL DEFAULT '0', + `modified_by` int(11) NOT NULL DEFAULT '0', + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) NOT NULL, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` int(11) NOT NULL DEFAULT '1', + `hits` int(11) NOT NULL DEFAULT '0', + `ordering` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_description` (`description`), + KEY `idx_externalsources` (`externalsources`), + KEY `idx_update_method` (`update_method`), + KEY `idx_build` (`build`), + KEY `idx_permissiontype` (`permissiontype`), + KEY `idx_dropboxoptions` (`dropboxoptions`) +) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__sermondistributor_local_listing` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', + `build` TINYINT(1) NOT NULL DEFAULT '0', + `external_source` INT(11) NOT NULL DEFAULT '0', + `key` VARCHAR(255) NOT NULL DEFAULT '', + `name` VARCHAR(255) NOT NULL DEFAULT '', + `size` INT(50) NOT NULL DEFAULT '0', + `url` TEXT NOT NULL, + `params` TEXT NOT NULL, + `published` tinyint(1) NOT NULL DEFAULT '1', + `created_by` int(11) NOT NULL DEFAULT '0', + `modified_by` int(11) NOT NULL DEFAULT '0', + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) NOT NULL, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` int(11) NOT NULL DEFAULT '1', + `hits` int(11) NOT NULL DEFAULT '0', + `ordering` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_build` (`build`), + KEY `idx_key` (`key`) +) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + CREATE TABLE IF NOT EXISTS `#__sermondistributor_help_document` ( `id` int(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index 3be116c3..80615850 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -2,4 +2,6 @@ DROP TABLE IF EXISTS `#__sermondistributor_preacher`; DROP TABLE IF EXISTS `#__sermondistributor_sermon`; DROP TABLE IF EXISTS `#__sermondistributor_series`; DROP TABLE IF EXISTS `#__sermondistributor_statistic`; +DROP TABLE IF EXISTS `#__sermondistributor_external_source`; +DROP TABLE IF EXISTS `#__sermondistributor_local_listing`; DROP TABLE IF EXISTS `#__sermondistributor_help_document`; diff --git a/admin/sql/updates/mysql/1.3.8.sql b/admin/sql/updates/mysql/1.3.8.sql new file mode 100644 index 00000000..12931b31 --- /dev/null +++ b/admin/sql/updates/mysql/1.3.8.sql @@ -0,0 +1,68 @@ +CREATE TABLE IF NOT EXISTS `#__sermondistributor_external_source` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', + `build` TINYINT(1) NOT NULL DEFAULT '0', + `description` VARCHAR(255) NOT NULL DEFAULT '', + `dropboxoptions` TINYINT(1) NOT NULL DEFAULT '1', + `externalsources` INT(11) NOT NULL DEFAULT '0', + `filetypes` TEXT NOT NULL, + `folder` TEXT NOT NULL, + `not_required` INT(1) NOT NULL DEFAULT '0', + `oauthtoken` TEXT NOT NULL, + `permissiontype` VARCHAR(64) NOT NULL DEFAULT '', + `sharedurl` TEXT NOT NULL, + `update_method` TINYINT NOT NULL DEFAULT '0', + `update_timer` INT(1) NOT NULL DEFAULT '0', + `params` TEXT NOT NULL, + `published` tinyint(1) NOT NULL DEFAULT '1', + `created_by` int(11) NOT NULL DEFAULT '0', + `modified_by` int(11) NOT NULL DEFAULT '0', + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) NOT NULL, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` int(11) NOT NULL DEFAULT '1', + `hits` int(11) NOT NULL DEFAULT '0', + `ordering` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_description` (`description`), + KEY `idx_externalsources` (`externalsources`), + KEY `idx_update_method` (`update_method`), + KEY `idx_build` (`build`), + KEY `idx_dropboxoptions` (`dropboxoptions`), + KEY `idx_permissiontype` (`permissiontype`) +) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__sermondistributor_local_listing` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', + `build` TINYINT(1) NOT NULL DEFAULT '0', + `external_source` int(11) NOT NULL DEFAULT '0', + `key` VARCHAR(255) NOT NULL DEFAULT '', + `name` VARCHAR(255) NOT NULL DEFAULT '', + `size` INT(50) NOT NULL DEFAULT '0', + `url` TEXT NOT NULL, + `params` TEXT NOT NULL, + `published` tinyint(1) NOT NULL DEFAULT '1', + `created_by` int(11) NOT NULL DEFAULT '0', + `modified_by` int(11) NOT NULL DEFAULT '0', + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) NOT NULL, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` int(11) NOT NULL DEFAULT '1', + `hits` int(11) NOT NULL DEFAULT '0', + `ordering` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_build` (`build`), + KEY `idx_key` (`key`) +) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; diff --git a/admin/tables/external_source.php b/admin/tables/external_source.php new file mode 100644 index 00000000..2ce9c424 --- /dev/null +++ b/admin/tables/external_source.php @@ -0,0 +1,351 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla table library +jimport('joomla.database.table'); + +/** + * External_sources Table class + */ +class SermondistributorTableExternal_source extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__sermondistributor_external_source', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.external_source')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the External_source table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New external_source. A external_source created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('external_source', 'SermondistributorTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('external_source', 'sermondistributorTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_sermondistributor.external_source.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count($_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_sermondistributor.external_source.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_sermondistributor'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); + } + + return $this->alias; + } + +} diff --git a/admin/tables/help_document.php b/admin/tables/help_document.php index f1e78c74..4b1ad1d8 100644 --- a/admin/tables/help_document.php +++ b/admin/tables/help_document.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage help_document.php diff --git a/admin/tables/local_listing.php b/admin/tables/local_listing.php new file mode 100644 index 00000000..ddb504b4 --- /dev/null +++ b/admin/tables/local_listing.php @@ -0,0 +1,351 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla table library +jimport('joomla.database.table'); + +/** + * Local_listings Table class + */ +class SermondistributorTableLocal_listing extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__sermondistributor_local_listing', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.local_listing')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Local_listing table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New local_listing. A local_listing created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('local_listing', 'SermondistributorTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('local_listing', 'sermondistributorTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_sermondistributor.local_listing.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count($_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_sermondistributor.local_listing.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_sermondistributor'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); + } + + return $this->alias; + } + +} diff --git a/admin/tables/preacher.php b/admin/tables/preacher.php index 241f26b7..b41f10da 100644 --- a/admin/tables/preacher.php +++ b/admin/tables/preacher.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.php diff --git a/admin/tables/series.php b/admin/tables/series.php index c9552316..5f3db2fa 100644 --- a/admin/tables/series.php +++ b/admin/tables/series.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage series.php diff --git a/admin/tables/sermon.php b/admin/tables/sermon.php index 676eba1c..733350a8 100644 --- a/admin/tables/sermon.php +++ b/admin/tables/sermon.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.php diff --git a/admin/tables/statistic.php b/admin/tables/statistic.php index 2fc3fee6..10c9f233 100644 --- a/admin/tables/statistic.php +++ b/admin/tables/statistic.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage statistic.php diff --git a/admin/views/external_source/submitbutton.js b/admin/views/external_source/submitbutton.js new file mode 100644 index 00000000..c27f2ee7 --- /dev/null +++ b/admin/views/external_source/submitbutton.js @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.4.0 + @build 27th November, 2016 + @created 22nd October, 2015 + @package Sermon Distributor + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var isValid=true; + var action = task.split('.'); + if (action[1] != 'cancel' && action[1] != 'close'){ + var forms = $$('form.form-validate'); + for (var i=0;i + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = JComponentHelper::getParams('com_sermondistributor'); +?> + + + + diff --git a/admin/views/external_source/tmpl/index.html b/admin/views/external_source/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/views/external_source/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/external_source/view.html.php b/admin/views/external_source/view.html.php new file mode 100644 index 00000000..891fab37 --- /dev/null +++ b/admin/views/external_source/view.html.php @@ -0,0 +1,206 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * External_source View class + */ +class SermondistributorViewExternal_source extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = SermondistributorHelper::getActions('external_source',$this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $this->referral = ''; + if ($this->refid) + { + // return to the item that refered to this item + $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that refered to this item + $this->referral = '&ref='.(string)$this->ref; + } + + // Set the toolbar + $this->addToolBar(); + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NEW' : 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if ($this->refid || $this->ref) + { + if ($this->canDo->get('external_source.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('external_source.edit')) + { + // We can save the record. + JToolBarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('external_source.create')) + { + JToolBarHelper::apply('external_source.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('external_source.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('external_source.edit')) + { + // We can save the new record + JToolBarHelper::apply('external_source.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('external_source.create')) + { + JToolBarHelper::custom('external_source.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('external_source.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('external_source.edit') && $canVersion) + { + JToolbarHelper::versions('com_sermondistributor.external_source', $this->item->id); + } + if ($this->canDo->get('external_source.create')) + { + JToolBarHelper::custom('external_source.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = SermondistributorHelper::getHelpUrl('external_source'); + if (SermondistributorHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return SermondistributorHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return SermondistributorHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + $document = JFactory::getDocument(); + $document->setTitle(JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NEW' : 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EDIT')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/external_source.css"); + // Add Ajax Token + $document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + $document->addScript(JURI::root() . $this->script); + $document->addScript(JURI::root() . "administrator/components/com_sermondistributor/views/external_source/submitbutton.js"); + // add JavaScripts + $document->addScript( JURI::root(true) .'/media/com_sermondistributor/uikit/js/uikit.min.js' ); + // add the style sheets + $document->addStyleSheet( JURI::root(true) .'/media/com_sermondistributor/uikit/css/uikit.gradient.min.css' ); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/external_sources/index.html b/admin/views/external_sources/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/views/external_sources/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default.php b/admin/views/external_sources/tmpl/default.php new file mode 100644 index 00000000..714825f7 --- /dev/null +++ b/admin/views/external_sources/tmpl/default.php @@ -0,0 +1,99 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=external_sources.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'external_sourceList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +items)): ?> + loadTemplate('toolbar');?> +
+ +
+ + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
+ + + + \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default_batch_body.php b/admin/views/external_sources/tmpl/default_batch_body.php new file mode 100644 index 00000000..3473b5ee --- /dev/null +++ b/admin/views/external_sources/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default_batch_footer.php b/admin/views/external_sources/tmpl/default_batch_footer.php new file mode 100644 index 00000000..72bdbc73 --- /dev/null +++ b/admin/views/external_sources/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default_body.php b/admin/views/external_sources/tmpl/default_body.php new file mode 100644 index 00000000..19a741f0 --- /dev/null +++ b/admin/views/external_sources/tmpl/default_body.php @@ -0,0 +1,129 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_sermondistributor&view=external_sources&task=external_source.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = SermondistributorHelper::getActions('external_source',$item,'external_sources'); + ?> + + + get('external_source.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('external_source.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + + get('external_source.edit')): ?> +
+ escape($item->description); ?> + checked_out): ?> + name, $item->checked_out_time, 'external_sources.', $canCheckin); ?> + +
+ +
escape($item->description); ?>
+ + + + externalsources); ?> + + + get('external_source.edit')): ?> +
+ update_method); ?> + checked_out): ?> + name, $item->checked_out_time, 'external_sources.', $canCheckin); ?> + +
+ +
update_method); ?>
+ + + + filetypes); ?> + + + build); ?> + + + get('external_source.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'external_sources.', true, 'cb'); ?> + + published, $i, 'external_sources.', false, 'cb'); ?> + + + published, $i, 'external_sources.', true, 'cb'); ?> + + + published, $i, 'external_sources.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default_foot.php b/admin/views/external_sources/tmpl/default_foot.php new file mode 100644 index 00000000..209c8c55 --- /dev/null +++ b/admin/views/external_sources/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default_head.php b/admin/views/external_sources/tmpl/default_head.php new file mode 100644 index 00000000..8b2065b4 --- /dev/null +++ b/admin/views/external_sources/tmpl/default_head.php @@ -0,0 +1,73 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default_toolbar.php b/admin/views/external_sources/tmpl/default_toolbar.php new file mode 100644 index 00000000..117708aa --- /dev/null +++ b/admin/views/external_sources/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/external_sources/tmpl/index.html b/admin/views/external_sources/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/views/external_sources/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/external_sources/view.html.php b/admin/views/external_sources/view.html.php new file mode 100644 index 00000000..2910e86d --- /dev/null +++ b/admin/views/external_sources/view.html.php @@ -0,0 +1,427 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Sermondistributor View class for the External_sources + */ +class SermondistributorViewExternal_sources extends JViewLegacy +{ + /** + * External_sources view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + SermondistributorHelper::addSubmenu('external_sources'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // get global action permissions + $this->canDo = SermondistributorHelper::getActions('external_source'); + $this->canEdit = $this->canDo->get('external_source.edit'); + $this->canState = $this->canDo->get('external_source.edit.state'); + $this->canCreate = $this->canDo->get('external_source.create'); + $this->canDelete = $this->canDo->get('external_source.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES'), 'puzzle'); + JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=external_sources'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('external_source.add'); + } + + // Only load if there are items + if (SermondistributorHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('external_source.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('external_sources.publish'); + JToolBarHelper::unpublishList('external_sources.unpublish'); + JToolBarHelper::archiveList('external_sources.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('external_sources.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'external_sources.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('external_sources.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('external_source.export')) + { + JToolBarHelper::custom('external_sources.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('external_source.import')) + { + JToolBarHelper::custom('external_sources.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = SermondistributorHelper::getHelpUrl('external_sources'); + if (SermondistributorHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_sermondistributor'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Externalsources Selection + $this->externalsourcesOptions = $this->getTheExternalsourcesSelections(); + if ($this->externalsourcesOptions) + { + // Externalsources Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL').' -', + 'filter_externalsources', + JHtml::_('select.options', $this->externalsourcesOptions, 'value', 'text', $this->state->get('filter.externalsources')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Externalsources Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL').' -', + 'batch[externalsources]', + JHtml::_('select.options', $this->externalsourcesOptions, 'value', 'text') + ); + } + } + + // Set Update Method Selection + $this->update_methodOptions = $this->getTheUpdate_methodSelections(); + if ($this->update_methodOptions) + { + // Update Method Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL').' -', + 'filter_update_method', + JHtml::_('select.options', $this->update_methodOptions, 'value', 'text', $this->state->get('filter.update_method')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Update Method Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL').' -', + 'batch[update_method]', + JHtml::_('select.options', $this->update_methodOptions, 'value', 'text') + ); + } + } + + // Set Build Selection + $this->buildOptions = $this->getTheBuildSelections(); + if ($this->buildOptions) + { + // Build Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL').' -', + 'filter_build', + JHtml::_('select.options', $this->buildOptions, 'value', 'text', $this->state->get('filter.build')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Build Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL').' -', + 'batch[build]', + JHtml::_('select.options', $this->buildOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $document = JFactory::getDocument(); + $document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/external_sources.css"); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return SermondistributorHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return SermondistributorHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.description' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_LABEL'), + 'a.externalsources' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL'), + 'a.update_method' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL'), + 'a.build' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } + + protected function getTheExternalsourcesSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('externalsources')); + $query->from($db->quoteName('#__sermondistributor_external_source')); + $query->order($db->quoteName('externalsources') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $filter = array(); + foreach ($results as $externalsources) + { + // Translate the externalsources selection + $text = $model->selectionTranslation($externalsources,'externalsources'); + // Now add the externalsources and its text to the options array + $filter[] = JHtml::_('select.option', $externalsources, JText::_($text)); + } + return $filter; + } + return false; + } + + protected function getTheUpdate_methodSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('update_method')); + $query->from($db->quoteName('#__sermondistributor_external_source')); + $query->order($db->quoteName('update_method') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $filter = array(); + foreach ($results as $update_method) + { + // Translate the update_method selection + $text = $model->selectionTranslation($update_method,'update_method'); + // Now add the update_method and its text to the options array + $filter[] = JHtml::_('select.option', $update_method, JText::_($text)); + } + return $filter; + } + return false; + } + + protected function getTheBuildSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('build')); + $query->from($db->quoteName('#__sermondistributor_external_source')); + $query->order($db->quoteName('build') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $filter = array(); + foreach ($results as $build) + { + // Translate the build selection + $text = $model->selectionTranslation($build,'build'); + // Now add the build and its text to the options array + $filter[] = JHtml::_('select.option', $build, JText::_($text)); + } + return $filter; + } + return false; + } +} diff --git a/admin/views/help_document/submitbutton.js b/admin/views/help_document/submitbutton.js index 276212d2..77f458f1 100644 --- a/admin/views/help_document/submitbutton.js +++ b/admin/views/help_document/submitbutton.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js diff --git a/admin/views/help_document/tmpl/edit.php b/admin/views/help_document/tmpl/edit.php index 2e072ebf..2940995c 100644 --- a/admin/views/help_document/tmpl/edit.php +++ b/admin/views/help_document/tmpl/edit.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage edit.php @@ -125,93 +125,93 @@ $componentParams = JComponentHelper::getParams('com_sermondistributor'); + + + diff --git a/admin/views/local_listing/tmpl/index.html b/admin/views/local_listing/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/views/local_listing/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/local_listing/view.html.php b/admin/views/local_listing/view.html.php new file mode 100644 index 00000000..489f2543 --- /dev/null +++ b/admin/views/local_listing/view.html.php @@ -0,0 +1,206 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Local_listing View class + */ +class SermondistributorViewLocal_listing extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = SermondistributorHelper::getActions('local_listing',$this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $this->referral = ''; + if ($this->refid) + { + // return to the item that refered to this item + $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that refered to this item + $this->referral = '&ref='.(string)$this->ref; + } + + // Set the toolbar + $this->addToolBar(); + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NEW' : 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if ($this->refid || $this->ref) + { + if ($this->canDo->get('local_listing.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('local_listing.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('local_listing.edit')) + { + // We can save the record. + JToolBarHelper::save('local_listing.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('local_listing.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('local_listing.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('local_listing.create')) + { + JToolBarHelper::apply('local_listing.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('local_listing.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('local_listing.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('local_listing.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('local_listing.edit')) + { + // We can save the new record + JToolBarHelper::apply('local_listing.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('local_listing.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('local_listing.create')) + { + JToolBarHelper::custom('local_listing.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('local_listing.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('local_listing.edit') && $canVersion) + { + JToolbarHelper::versions('com_sermondistributor.local_listing', $this->item->id); + } + if ($this->canDo->get('local_listing.create')) + { + JToolBarHelper::custom('local_listing.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('local_listing.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = SermondistributorHelper::getHelpUrl('local_listing'); + if (SermondistributorHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return SermondistributorHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return SermondistributorHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + $document = JFactory::getDocument(); + $document->setTitle(JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NEW' : 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EDIT')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/local_listing.css"); + // Add Ajax Token + $document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + $document->addScript(JURI::root() . $this->script); + $document->addScript(JURI::root() . "administrator/components/com_sermondistributor/views/local_listing/submitbutton.js"); + // add JavaScripts + $document->addScript( JURI::root(true) .'/media/com_sermondistributor/uikit/js/uikit.min.js' ); + // add the style sheets + $document->addStyleSheet( JURI::root(true) .'/media/com_sermondistributor/uikit/css/uikit.gradient.min.css' ); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/local_listings/index.html b/admin/views/local_listings/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/views/local_listings/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/local_listings/tmpl/default.php b/admin/views/local_listings/tmpl/default.php new file mode 100644 index 00000000..31276566 --- /dev/null +++ b/admin/views/local_listings/tmpl/default.php @@ -0,0 +1,99 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=local_listings.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'local_listingList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +items)): ?> + loadTemplate('toolbar');?> +
+ +
+ + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
+ + + + \ No newline at end of file diff --git a/admin/views/local_listings/tmpl/default_batch_body.php b/admin/views/local_listings/tmpl/default_batch_body.php new file mode 100644 index 00000000..1304bee7 --- /dev/null +++ b/admin/views/local_listings/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/local_listings/tmpl/default_batch_footer.php b/admin/views/local_listings/tmpl/default_batch_footer.php new file mode 100644 index 00000000..8847abfd --- /dev/null +++ b/admin/views/local_listings/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/local_listings/tmpl/default_body.php b/admin/views/local_listings/tmpl/default_body.php new file mode 100644 index 00000000..ba684f95 --- /dev/null +++ b/admin/views/local_listings/tmpl/default_body.php @@ -0,0 +1,120 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_sermondistributor&view=local_listings&task=local_listing.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = SermondistributorHelper::getActions('local_listing',$item,'local_listings'); + ?> + + + get('local_listing.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('local_listing.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + + get('local_listing.edit')): ?> +
+ escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'local_listings.', $canCheckin); ?> + +
+ +
escape($item->name); ?>
+ + + + build); ?> + + + escape($item->size); ?> + + + escape($item->external_source_description); ?> + + + escape($item->key); ?> + + + get('local_listing.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'local_listings.', true, 'cb'); ?> + + published, $i, 'local_listings.', false, 'cb'); ?> + + + published, $i, 'local_listings.', true, 'cb'); ?> + + + published, $i, 'local_listings.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/local_listings/tmpl/default_foot.php b/admin/views/local_listings/tmpl/default_foot.php new file mode 100644 index 00000000..209c8c55 --- /dev/null +++ b/admin/views/local_listings/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/local_listings/tmpl/default_head.php b/admin/views/local_listings/tmpl/default_head.php new file mode 100644 index 00000000..b9e36b91 --- /dev/null +++ b/admin/views/local_listings/tmpl/default_head.php @@ -0,0 +1,73 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/local_listings/tmpl/default_toolbar.php b/admin/views/local_listings/tmpl/default_toolbar.php new file mode 100644 index 00000000..4373cecb --- /dev/null +++ b/admin/views/local_listings/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/local_listings/tmpl/index.html b/admin/views/local_listings/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/views/local_listings/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/local_listings/view.html.php b/admin/views/local_listings/view.html.php new file mode 100644 index 00000000..4dc73b3e --- /dev/null +++ b/admin/views/local_listings/view.html.php @@ -0,0 +1,334 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Sermondistributor View class for the Local_listings + */ +class SermondistributorViewLocal_listings extends JViewLegacy +{ + /** + * Local_listings view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + SermondistributorHelper::addSubmenu('local_listings'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // get global action permissions + $this->canDo = SermondistributorHelper::getActions('local_listing'); + $this->canEdit = $this->canDo->get('local_listing.edit'); + $this->canState = $this->canDo->get('local_listing.edit.state'); + $this->canCreate = $this->canDo->get('local_listing.create'); + $this->canDelete = $this->canDo->get('local_listing.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS'), 'link'); + JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=local_listings'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('local_listing.add'); + } + + // Only load if there are items + if (SermondistributorHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('local_listing.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('local_listings.publish'); + JToolBarHelper::unpublishList('local_listings.unpublish'); + JToolBarHelper::archiveList('local_listings.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('local_listings.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'local_listings.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('local_listings.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('local_listing.export')) + { + JToolBarHelper::custom('local_listings.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('local_listing.import')) + { + JToolBarHelper::custom('local_listings.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = SermondistributorHelper::getHelpUrl('local_listings'); + if (SermondistributorHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_sermondistributor'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Build Selection + $this->buildOptions = $this->getTheBuildSelections(); + if ($this->buildOptions) + { + // Build Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL').' -', + 'filter_build', + JHtml::_('select.options', $this->buildOptions, 'value', 'text', $this->state->get('filter.build')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Build Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL').' -', + 'batch[build]', + JHtml::_('select.options', $this->buildOptions, 'value', 'text') + ); + } + } + + // Set External Source Description Selection + $this->external_sourceDescriptionOptions = JFormHelper::loadFieldType('Externalsource')->getOptions(); + if ($this->external_sourceDescriptionOptions) + { + // External Source Description Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL').' -', + 'filter_external_source', + JHtml::_('select.options', $this->external_sourceDescriptionOptions, 'value', 'text', $this->state->get('filter.external_source')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // External Source Description Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL').' -', + 'batch[external_source]', + JHtml::_('select.options', $this->external_sourceDescriptionOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $document = JFactory::getDocument(); + $document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/local_listings.css"); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return SermondistributorHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return SermondistributorHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_LABEL'), + 'a.build' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL'), + 'a.size' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SIZE_LABEL'), + 'g.description' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL'), + 'a.key' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_KEY_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } + + protected function getTheBuildSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('build')); + $query->from($db->quoteName('#__sermondistributor_local_listing')); + $query->order($db->quoteName('build') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $filter = array(); + foreach ($results as $build) + { + // Translate the build selection + $text = $model->selectionTranslation($build,'build'); + // Now add the build and its text to the options array + $filter[] = JHtml::_('select.option', $build, JText::_($text)); + } + return $filter; + } + return false; + } +} diff --git a/admin/views/manual_updater/index.html b/admin/views/manual_updater/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/views/manual_updater/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/manual_updater/tmpl/default.php b/admin/views/manual_updater/tmpl/default.php new file mode 100644 index 00000000..bf6f5a59 --- /dev/null +++ b/admin/views/manual_updater/tmpl/default.php @@ -0,0 +1,192 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// get the needed module for translation +$model = SermondistributorHelper::getModel('external_sources'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +?> +canDo->get('manual_updater.access')): ?> + +
+ + +
+items) && SermondistributorHelper::checkArray($this->items)): ?> + +
+ + items as $item): ?> + description).$item->id; ?> + '. $item->description . ' (' . JText::_($model->selectionTranslation($item->build, 'build')) . ')
'; ?> + +
+ + +
+
+

+
+ id, 1, 2); ?> + + + id, $item->id.$target.$item->build)): ?> + id.$target.$item->build); ?> + + JText::_('COM_SERMONDISTRIBUTOR_THERE_WAS_AN_ERROR_DURING_THE_LAST_UPDATE_ATTEMPT')), $error); ?> + + + + + + + + + +
+ + + +
+

+
+ + +

+ diff --git a/admin/views/manual_updater/tmpl/index.html b/admin/views/manual_updater/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/admin/views/manual_updater/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/manual_updater/view.html.php b/admin/views/manual_updater/view.html.php new file mode 100644 index 00000000..70f8cf84 --- /dev/null +++ b/admin/views/manual_updater/view.html.php @@ -0,0 +1,184 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Sermondistributor View class for the Manual_updater + */ +class SermondistributorViewManual_updater extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get component params + $this->params = JComponentHelper::getParams('com_sermondistributor'); + // get the application + $this->app = JFactory::getApplication(); + // get the user object + $this->user = JFactory::getUser(); + // get global action permissions + $this->canDo = SermondistributorHelper::getActions('manual_updater'); + // Initialise variables. + $this->items = $this->get('Items'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + // add the tool bar + $this->addToolBar(); + } + + // set the document + $this->setDocument(); + + parent::display($tpl); + } + + /** + * Prepares the document + */ + protected function setDocument() + { + + // always make sure jquery is loaded. + JHtml::_('jquery.framework'); + // Load the header checker class. + require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' ); + // Initialize the header checker. + $HeaderCheck = new HeaderCheck; + + // Load uikit options. + $uikit = $this->params->get('uikit_load'); + // Set script size. + $size = $this->params->get('uikit_min'); + // Set css style. + $style = $this->params->get('uikit_style'); + + // The uikit css. + if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) + { + $this->document->addStyleSheet(JURI::root(true) .'/media/com_sermondistributor/uikit/css/uikit'.$style.$size.'.css'); + } + // The uikit js. + if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) + { + $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit/js/uikit'.$size.'.js'); + } + + // Load the script to find all uikit components needed. + if ($uikit != 2) + { + // Set the default uikit components in this view. + $uikitComp = array(); + $uikitComp[] = 'uk-form'; + } + + // Load the needed uikit components in this view. + if ($uikit != 2 && isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + { + // load just in case. + jimport('joomla.filesystem.file'); + // loading... + foreach ($uikitComp as $class) + { + foreach (SermondistributorHelper::$uk_components[$class] as $name) + { + // check if the CSS file exists. + if (JFile::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit/css/components/'.$name.$style.$size.'.css')) + { + // load the css. + $this->document->addStyleSheet(JURI::root(true) .'/media/com_sermondistributor/uikit/css/components/'.$name.$style.$size.'.css'); + } + // check if the JavaScript file exists. + if (JFile::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit/js/components/'.$name.$size.'.js')) + { + // load the js. + $this->document->addScript(JURI::root(true) .'/media/com_sermondistributor/uikit/js/components/'.$name.$size.'.js'); + } + } + } + } + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_sermondistributor/assets/css/manual_updater.css'); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + // hide the main menu + $this->app->input->set('hidemainmenu', true); + // add title to the page + JToolbarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_MANUAL_UPDATER'),'cogs'); + // add the back button + // JToolBarHelper::custom('manual_updater.back', 'undo-2', '', 'COM_SERMONDISTRIBUTOR_BACK', false); + // add cpanel button + JToolBarHelper::custom('manual_updater.dashboard', 'grid-2', '', 'COM_SERMONDISTRIBUTOR_DASH', false); + if ($this->canDo->get('manual_updater.external_sources')) + { + // add External Sources button. + JToolBarHelper::custom('manual_updater.gotoExternalSources', 'puzzle', '', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES', false); + } + + // set help url for this view if found + $help_url = SermondistributorHelper::getHelpUrl('manual_updater'); + if (SermondistributorHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_sermondistributor'); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + // use the helper htmlEscape method instead. + return SermondistributorHelper::htmlEscape($var, $this->_charset); + } +} diff --git a/admin/views/preacher/submitbutton.js b/admin/views/preacher/submitbutton.js index ff06e610..4f970f49 100644 --- a/admin/views/preacher/submitbutton.js +++ b/admin/views/preacher/submitbutton.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js diff --git a/admin/views/preacher/tmpl/edit.php b/admin/views/preacher/tmpl/edit.php index 2bb7ac6d..19c98960 100644 --- a/admin/views/preacher/tmpl/edit.php +++ b/admin/views/preacher/tmpl/edit.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 1.3.8 - @build 2nd November, 2016 + @version 1.4.0 + @build 27th November, 2016 @created 22nd October, 2015 @package Sermon Distributor @subpackage edit.php @@ -33,7 +33,29 @@ JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = JComponentHelper::getParams('com_sermondistributor'); ?> -
+ +