From a2e4972feb0e003f90254b9e0c61c052aef4dba1 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 2 Jun 2016 08:45:56 +0100 Subject: [PATCH] Next update. --- README.md | 4 +- admin/assets/css/admin.css | 2 +- admin/assets/css/dashboard.css | 2 +- admin/assets/css/help_document.css | 2 +- admin/assets/css/help_documents.css | 2 +- admin/assets/css/look.css | 2 +- admin/assets/css/looks.css | 2 +- admin/controller.php | 2 +- admin/controllers/demo.php | 2 +- admin/controllers/help.php | 2 +- admin/controllers/help_document.php | 2 +- admin/controllers/help_documents.php | 2 +- admin/controllers/import.php | 2 +- admin/controllers/look.php | 2 +- admin/controllers/looks.php | 2 +- admin/demo.php | 2 +- .../PHPExcel/Reader/ChunkReadFilter.php | 49 +++++ admin/helpers/demo.php | 45 ++-- admin/helpers/html/batch_.php | 2 +- admin/language/en-GB/en-GB.com_demo.ini | 4 + admin/layouts/batchselection.php | 2 +- admin/layouts/help_document/details_above.php | 2 +- .../help_document/details_fullwidth.php | 2 +- admin/layouts/help_document/details_left.php | 2 +- admin/layouts/help_document/details_right.php | 2 +- admin/layouts/help_document/details_under.php | 2 +- admin/layouts/help_document/metadata.php | 2 +- admin/layouts/help_document/publishing.php | 2 +- admin/layouts/look/details_above.php | 2 +- admin/layouts/look/details_left.php | 2 +- admin/layouts/look/details_right.php | 2 +- admin/layouts/look/details_under.php | 2 +- admin/layouts/look/metadata.php | 2 +- admin/layouts/look/publishing.php | 2 +- admin/layouts/look/repetable_numbers_left.php | 2 +- .../layouts/look/repetable_numbers_right.php | 2 +- admin/models/demo.php | 2 +- admin/models/fields/articles.php | 100 +++++++-- admin/models/forms/help_document.js | 2 +- admin/models/forms/help_document.xml | 7 +- admin/models/forms/look.js | 2 +- admin/models/forms/look.xml | 7 +- admin/models/help_document.php | 2 +- admin/models/help_documents.php | 2 +- admin/models/import.php | 4 +- admin/models/look.php | 2 +- admin/models/looks.php | 2 +- admin/sql/install.mysql.utf8.sql | 6 + admin/tables/help_document.php | 2 +- admin/tables/look.php | 2 +- admin/views/demo/tmpl/default.php | 2 +- admin/views/demo/tmpl/default_main.php | 26 ++- admin/views/demo/tmpl/default_vdm.php | 2 +- admin/views/demo/view.html.php | 2 +- admin/views/help_document/submitbutton.js | 2 +- admin/views/help_document/tmpl/edit.php | 29 ++- admin/views/help_document/view.html.php | 2 +- admin/views/help_documents/tmpl/default.php | 2 +- .../tmpl/default_batch_body.php | 2 +- .../tmpl/default_batch_footer.php | 2 +- .../help_documents/tmpl/default_body.php | 2 +- .../help_documents/tmpl/default_foot.php | 2 +- .../help_documents/tmpl/default_head.php | 2 +- .../help_documents/tmpl/default_toolbar.php | 2 +- admin/views/help_documents/view.html.php | 2 +- admin/views/import/tmpl/default.php | 205 +++++++++--------- admin/views/import/view.html.php | 2 +- admin/views/look/submitbutton.js | 2 +- admin/views/look/tmpl/edit.php | 7 +- admin/views/look/view.html.php | 2 +- admin/views/looks/tmpl/default.php | 2 +- admin/views/looks/tmpl/default_batch_body.php | 2 +- .../views/looks/tmpl/default_batch_footer.php | 2 +- admin/views/looks/tmpl/default_body.php | 2 +- admin/views/looks/tmpl/default_foot.php | 2 +- admin/views/looks/tmpl/default_head.php | 2 +- admin/views/looks/tmpl/default_toolbar.php | 2 +- admin/views/looks/view.html.php | 2 +- demo.xml | 2 +- script.php | 2 +- site/assets/css/site.css | 2 +- site/controller.php | 2 +- site/controllers/help.php | 2 +- site/demo.php | 2 +- site/helpers/demo.php | 45 ++-- site/helpers/headercheck.php | 2 +- site/helpers/route.php | 2 +- site/language/en-GB/en-GB.com_demo.ini | 3 + site/router.php | 2 +- 89 files changed, 429 insertions(+), 260 deletions(-) create mode 100644 admin/helpers/PHPExcel/Reader/ChunkReadFilter.php diff --git a/README.md b/README.md index e52c6c6..5411597 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Just a basic demo of the most basic implementations of the [Joomla] (http://www. + *Author*: [Llewellyn van der Merwe] (mailto:info@vdm.io) + *Name*: [Demo] (https://www.vdm.io/) + *First Build*: 5th August, 2015 -+ *Last Build*: 2nd May, 2016 ++ *Last Build*: 2nd June, 2016 + *Version*: 1.0.5 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -23,7 +23,7 @@ due to [Automated Component Builder] (https://www.vdm.io/joomla-component-builde > (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*: **16713** ++ *Line count*: **16832** + *File count*: **152** + *Folder count*: **50** diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index d97b4db..dc9987b 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage admin.css diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 66a5ad2..abfea2a 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage dashboard.css diff --git a/admin/assets/css/help_document.css b/admin/assets/css/help_document.css index 3b3fa29..c45a8a2 100644 --- a/admin/assets/css/help_document.css +++ b/admin/assets/css/help_document.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage help_document.css diff --git a/admin/assets/css/help_documents.css b/admin/assets/css/help_documents.css index ba403d3..9b3f1f6 100644 --- a/admin/assets/css/help_documents.css +++ b/admin/assets/css/help_documents.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage help_documents.css diff --git a/admin/assets/css/look.css b/admin/assets/css/look.css index 59e7c83..b8b5ade 100644 --- a/admin/assets/css/look.css +++ b/admin/assets/css/look.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage look.css diff --git a/admin/assets/css/looks.css b/admin/assets/css/looks.css index 08800ce..c02f139 100644 --- a/admin/assets/css/looks.css +++ b/admin/assets/css/looks.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage looks.css diff --git a/admin/controller.php b/admin/controller.php index 96313ac..ca127ed 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage controller.php diff --git a/admin/controllers/demo.php b/admin/controllers/demo.php index 06aa3af..a8be6d0 100644 --- a/admin/controllers/demo.php +++ b/admin/controllers/demo.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage demo.php diff --git a/admin/controllers/help.php b/admin/controllers/help.php index eaf3a3e..c3ef0ad 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage help.php diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index f958ba4..2902ae1 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage help_document.php diff --git a/admin/controllers/help_documents.php b/admin/controllers/help_documents.php index 3d5b05a..a83d0d5 100644 --- a/admin/controllers/help_documents.php +++ b/admin/controllers/help_documents.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage help_documents.php diff --git a/admin/controllers/import.php b/admin/controllers/import.php index c65b1fc..52e8dc0 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage import.php diff --git a/admin/controllers/look.php b/admin/controllers/look.php index 4c10c72..2780b9f 100644 --- a/admin/controllers/look.php +++ b/admin/controllers/look.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage look.php diff --git a/admin/controllers/looks.php b/admin/controllers/looks.php index 9785b22..9223d3e 100644 --- a/admin/controllers/looks.php +++ b/admin/controllers/looks.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage looks.php diff --git a/admin/demo.php b/admin/demo.php index 28bd053..d6b8e01 100644 --- a/admin/demo.php +++ b/admin/demo.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage demo.php diff --git a/admin/helpers/PHPExcel/Reader/ChunkReadFilter.php b/admin/helpers/PHPExcel/Reader/ChunkReadFilter.php new file mode 100644 index 0000000..204ae05 --- /dev/null +++ b/admin/helpers/PHPExcel/Reader/ChunkReadFilter.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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/** PHPExcel root directory */ +if (!defined('PHPEXCEL_ROOT')) { + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); + require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); +} + +class PHPExcel_Reader_chunkReadFilter implements PHPExcel_Reader_IReadFilter +{ + private $_startRow = 0; + private $_endRow = 0; + + /** Set the list of rows that we want to read */ + public function setRows($startRow, $chunkSize) + { + $this->_startRow = $startRow; + $this->_endRow = $startRow + $chunkSize; + } + + public function readCell($column, $row, $worksheetName = '') + { + // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow + if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/admin/helpers/demo.php b/admin/helpers/demo.php index 674c563..1ddc356 100644 --- a/admin/helpers/demo.php +++ b/admin/helpers/demo.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage demo.php @@ -296,18 +296,27 @@ abstract class DemoHelper */ public static function getFileHeaders($dataType) { - // make sure the file is loaded + // make sure these files are loaded JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers'); + JLoader::import('ChunkReadFilter', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/PHPExcel/Reader'); // get session object - $session = JFactory::getSession(); + $session = JFactory::getSession(); $package = $session->get('package', null); $package = json_decode($package, true); // set the headers if(isset($package['dir'])) { + $chunkFilter = new PHPExcel_Reader_chunkReadFilter(); + // only load first three rows + $chunkFilter->setRows(2,1); + // identify the file type $inputFileType = PHPExcel_IOFactory::identify($package['dir']); + // create the reader for this file type $excelReader = PHPExcel_IOFactory::createReader($inputFileType); + // load the limiting filter + $excelReader->setReadFilter($chunkFilter); $excelReader->setReadDataOnly(true); + // load the rows (only first three) $excelObj = $excelReader->load($package['dir']); $headers = array(); foreach ($excelObj->getActiveSheet()->getRowIterator() as $row) @@ -403,31 +412,33 @@ abstract class DemoHelper return false; } - public static function jsonToString($value, $sperator = ", ") + public static function jsonToString($value, $sperator = ", ", $table = null) { // check if string is JSON $result = json_decode($value, true); - if (json_last_error() === JSON_ERROR_NONE) { - // is JSON + if (json_last_error() === JSON_ERROR_NONE) + { + // is JSON if (self::checkArray($result)) { - $value = ''; - $counter = 0; - foreach ($result as $string) + if (self::checkString($table)) { - if ($counter) + $names = array(); + foreach ($result as $val) { - $value .= $sperator.$string; + if ($name = self::getVar($table, $val, 'id', 'name')) + { + $names[] = $name; + } } - else + if (self::checkArray($names)) { - $value .= $string; - } - $counter++; + return (string) implode($sperator,$names); + } } - return $value; + return (string) implode($sperator,$result); } - return json_decode($value); + return (string) json_decode($value); } return $value; } diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index 36cec6f..4ada539 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage batch_.php diff --git a/admin/language/en-GB/en-GB.com_demo.ini b/admin/language/en-GB/en-GB.com_demo.ini index 9976528..1e257a2 100644 --- a/admin/language/en-GB/en-GB.com_demo.ini +++ b/admin/language/en-GB/en-GB.com_demo.ini @@ -18,6 +18,7 @@ COM_DEMO_CONFIG_GLOBAL_DESC="The Global Parameters" COM_DEMO_CONFIG_GLOBAL_LABEL="Global" COM_DEMO_CONTRIBUTOR="Contributor" COM_DEMO_CONTRIBUTORS="Contributors" +COM_DEMO_CREATE_NEW_S="Create New %s" COM_DEMO_DASH="Dashboard" COM_DEMO_DASHBOARD="Demo Dashboard" COM_DEMO_DASHBOARD_HELP_DOCUMENTS="Help Documents

" @@ -28,6 +29,7 @@ COM_DEMO_EDIT_CREATED_BY="Edit Created By" COM_DEMO_EDIT_CREATED_BY_DESC=" Allows users in this group to edit created by." COM_DEMO_EDIT_CREATED_DATE="Edit Created Date" COM_DEMO_EDIT_CREATED_DATE_DESC=" Allows users in this group to edit created date." +COM_DEMO_EDIT_S="Edit %s" COM_DEMO_EDIT_VERSIONS="Edit Version" COM_DEMO_EDIT_VERSIONS_DESC=" Allows users in this group to edit versions." COM_DEMO_EXPORT_DATA="Export Data" @@ -84,6 +86,7 @@ COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION="Select the view being targeted" COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_LABEL="Admin Views" COM_DEMO_HELP_DOCUMENT_ALIAS="Alias" COM_DEMO_HELP_DOCUMENT_ALIAS_HINT="Auto-generated from name" +COM_DEMO_HELP_DOCUMENT_ALIAS_LABEL="Alias" COM_DEMO_HELP_DOCUMENT_ALL="All" COM_DEMO_HELP_DOCUMENT_ARTICLE="Article" COM_DEMO_HELP_DOCUMENT_ARTICLE_LABEL="Article" @@ -242,6 +245,7 @@ COM_DEMO_LOOK_ADD_LABEL="Add Custom Stuff" COM_DEMO_LOOK_AGE_LABEL="Age Group" COM_DEMO_LOOK_ALIAS="Alias" COM_DEMO_LOOK_ALIAS_HINT="Auto-generated from name" +COM_DEMO_LOOK_ALIAS_LABEL="Alias" COM_DEMO_LOOK_CREATED_BY_DESC="The user that created the Look." COM_DEMO_LOOK_CREATED_BY_LABEL="Created by" COM_DEMO_LOOK_CREATED_DATE_DESC="The date Look was created." diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 9d6009d..a5aba4c 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage batchselection.php diff --git a/admin/layouts/help_document/details_above.php b/admin/layouts/help_document/details_above.php index b0992ce..0048674 100644 --- a/admin/layouts/help_document/details_above.php +++ b/admin/layouts/help_document/details_above.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage details_above.php diff --git a/admin/layouts/help_document/details_fullwidth.php b/admin/layouts/help_document/details_fullwidth.php index 519b60b..2e4050f 100644 --- a/admin/layouts/help_document/details_fullwidth.php +++ b/admin/layouts/help_document/details_fullwidth.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage details_fullwidth.php diff --git a/admin/layouts/help_document/details_left.php b/admin/layouts/help_document/details_left.php index 94f6373..3fde33a 100644 --- a/admin/layouts/help_document/details_left.php +++ b/admin/layouts/help_document/details_left.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage details_left.php diff --git a/admin/layouts/help_document/details_right.php b/admin/layouts/help_document/details_right.php index 445542f..438ef63 100644 --- a/admin/layouts/help_document/details_right.php +++ b/admin/layouts/help_document/details_right.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage details_right.php diff --git a/admin/layouts/help_document/details_under.php b/admin/layouts/help_document/details_under.php index 74f43dd..11bcf83 100644 --- a/admin/layouts/help_document/details_under.php +++ b/admin/layouts/help_document/details_under.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage details_under.php diff --git a/admin/layouts/help_document/metadata.php b/admin/layouts/help_document/metadata.php index ee6ec55..8b4ddc1 100644 --- a/admin/layouts/help_document/metadata.php +++ b/admin/layouts/help_document/metadata.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage metadata.php diff --git a/admin/layouts/help_document/publishing.php b/admin/layouts/help_document/publishing.php index 81cda70..88ae46f 100644 --- a/admin/layouts/help_document/publishing.php +++ b/admin/layouts/help_document/publishing.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage publishing.php diff --git a/admin/layouts/look/details_above.php b/admin/layouts/look/details_above.php index 32eea5e..8aa7ebc 100644 --- a/admin/layouts/look/details_above.php +++ b/admin/layouts/look/details_above.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage details_above.php diff --git a/admin/layouts/look/details_left.php b/admin/layouts/look/details_left.php index 1937742..716437f 100644 --- a/admin/layouts/look/details_left.php +++ b/admin/layouts/look/details_left.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage details_left.php diff --git a/admin/layouts/look/details_right.php b/admin/layouts/look/details_right.php index 5354185..db2b1b9 100644 --- a/admin/layouts/look/details_right.php +++ b/admin/layouts/look/details_right.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage details_right.php diff --git a/admin/layouts/look/details_under.php b/admin/layouts/look/details_under.php index 74f43dd..11bcf83 100644 --- a/admin/layouts/look/details_under.php +++ b/admin/layouts/look/details_under.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage details_under.php diff --git a/admin/layouts/look/metadata.php b/admin/layouts/look/metadata.php index ee6ec55..8b4ddc1 100644 --- a/admin/layouts/look/metadata.php +++ b/admin/layouts/look/metadata.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage metadata.php diff --git a/admin/layouts/look/publishing.php b/admin/layouts/look/publishing.php index 81cda70..88ae46f 100644 --- a/admin/layouts/look/publishing.php +++ b/admin/layouts/look/publishing.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage publishing.php diff --git a/admin/layouts/look/repetable_numbers_left.php b/admin/layouts/look/repetable_numbers_left.php index a7ae3d5..f94cc43 100644 --- a/admin/layouts/look/repetable_numbers_left.php +++ b/admin/layouts/look/repetable_numbers_left.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage repetable_numbers_left.php diff --git a/admin/layouts/look/repetable_numbers_right.php b/admin/layouts/look/repetable_numbers_right.php index 9bb022c..fc505d9 100644 --- a/admin/layouts/look/repetable_numbers_right.php +++ b/admin/layouts/look/repetable_numbers_right.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage repetable_numbers_right.php diff --git a/admin/models/demo.php b/admin/models/demo.php index d9d7e04..84046dd 100644 --- a/admin/models/demo.php +++ b/admin/models/demo.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage demo.php diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php index 2166e85..9a2032c 100644 --- a/admin/models/fields/articles.php +++ b/admin/models/fields/articles.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage articles.php @@ -52,30 +52,90 @@ class JFormFieldArticles extends JFormFieldList // 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 article if ($user->authorise('core.create', 'com_demo')) { - // 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 = ''; - if (!is_null($values['id']) && strlen($values['view'])) - { - // only load referal if not new item. - $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; - } - // build the button - $button = ' - ' . JText::_('COM_DEMO_NEW') . ''; - // return the button attached to input field - return $html . $button; + '; + } + // only add if user allowed to edit article + if (($buttonName == 'article' || $buttonName == 'articles') && $user->authorise('core.edit', 'com_demo')) + { + // 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_demo&view=articles&task=article.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 article field. + if (is_array($button) && count($button) > 0) + { + // Add some final script + $script[] = " + jQuery(document).ready(function() { + jQuery('#jform_".$buttonName."').closest('.control-group').addClass('input-append'); + });"; + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return $html . implode('',$button); } } return $html; diff --git a/admin/models/forms/help_document.js b/admin/models/forms/help_document.js index 8bff83a..2f84a3c 100644 --- a/admin/models/forms/help_document.js +++ b/admin/models/forms/help_document.js @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage help_document.js diff --git a/admin/models/forms/help_document.xml b/admin/models/forms/help_document.xml index 1ca544a..0a83c90 100644 --- a/admin/models/forms/help_document.xml +++ b/admin/models/forms/help_document.xml @@ -19,6 +19,7 @@ label="COM_DEMO_HELP_DOCUMENT_CREATED_DATE_LABEL" description="COM_DEMO_HELP_DOCUMENT_CREATED_DATE_DESC" size="22" + format="%Y-%m-%d %H:%M:%S" filter="user_utc" /> @@ -27,11 +28,13 @@ name="created_by" type="user" label="COM_DEMO_HELP_DOCUMENT_CREATED_BY_LABEL" + description="COM_DEMO_HELP_DOCUMENT_CREATED_BY_DESC" /> @@ -59,6 +62,7 @@ label="JFIELD_ACCESS_LABEL" description="JFIELD_ACCESS_DESC" default="1" + required="false" /> @@ -70,6 +74,7 @@ description="" default="0" size="6" + required="false" /> @@ -209,7 +214,7 @@ @@ -27,11 +28,13 @@ name="created_by" type="user" label="COM_DEMO_LOOK_CREATED_BY_LABEL" + description="COM_DEMO_LOOK_CREATED_BY_DESC" /> @@ -59,6 +62,7 @@ label="JFIELD_ACCESS_LABEL" description="JFIELD_ACCESS_DESC" default="1" + required="false" /> @@ -70,6 +74,7 @@ description="" default="0" size="6" + required="false" /> @@ -276,7 +281,7 @@ -icons['main'])) :?> +icons['main']) && is_array($this->icons['main'])) :?> icons['main'] as $icon): ?> - - -
+ + +
+ +

\ No newline at end of file diff --git a/admin/views/demo/tmpl/default_vdm.php b/admin/views/demo/tmpl/default_vdm.php index af669c5..79e3d2d 100644 --- a/admin/views/demo/tmpl/default_vdm.php +++ b/admin/views/demo/tmpl/default_vdm.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage default_vdm.php diff --git a/admin/views/demo/view.html.php b/admin/views/demo/view.html.php index dd8c799..589ede1 100644 --- a/admin/views/demo/view.html.php +++ b/admin/views/demo/view.html.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage view.html.php diff --git a/admin/views/help_document/submitbutton.js b/admin/views/help_document/submitbutton.js index e9535f3..81675c7 100644 --- a/admin/views/help_document/submitbutton.js +++ b/admin/views/help_document/submitbutton.js @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage submitbutton.js diff --git a/admin/views/help_document/tmpl/edit.php b/admin/views/help_document/tmpl/edit.php index e68fee1..f5b9df6 100644 --- a/admin/views/help_document/tmpl/edit.php +++ b/admin/views/help_document/tmpl/edit.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage edit.php @@ -28,7 +28,29 @@ JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = JComponentHelper::getParams('com_demo'); ?> - + + \ No newline at end of file diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php index 17cc4b7..4afd86e 100644 --- a/admin/views/import/view.html.php +++ b/admin/views/import/view.html.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage view.html.php diff --git a/admin/views/look/submitbutton.js b/admin/views/look/submitbutton.js index cfe7226..4e6aa52 100644 --- a/admin/views/look/submitbutton.js +++ b/admin/views/look/submitbutton.js @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage submitbutton.js diff --git a/admin/views/look/tmpl/edit.php b/admin/views/look/tmpl/edit.php index 04f489b..8bd496f 100644 --- a/admin/views/look/tmpl/edit.php +++ b/admin/views/look/tmpl/edit.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.5 - @build 2nd May, 2016 + @build 2nd June, 2016 @created 5th August, 2015 @package Demo @subpackage edit.php @@ -28,7 +28,7 @@ JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = JComponentHelper::getParams('com_demo'); ?> - +
@@ -99,7 +99,8 @@ $componentParams = JComponentHelper::getParams('com_demo');
- + +