diff --git a/README.md b/README.md index 7628886d5..3da9b4583 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ TODO + *Version*: 2.9.18 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **206359** ++ *Line count*: **206374** + *Field count*: **1136** + *File count*: **1344** + *Folder count*: **209** diff --git a/admin/README.txt b/admin/README.txt index 7628886d5..3da9b4583 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -150,7 +150,7 @@ TODO + *Version*: 2.9.18 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **206359** ++ *Line count*: **206374** + *Field count*: **1136** + *File count*: **1344** + *Folder count*: **209** diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 5e90575d7..50adbd094 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access'); */ class Get { - + /** * The hash placeholder * diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 6c09e19d2..77128b307 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -315,6 +315,7 @@ class ComponentbuilderModelAjax extends JModelList 'component_config' => 'components_config', 'component_dashboard' => 'components_dashboard', 'component_files_folders' => 'components_files_folders', + 'custom_code' => 'custom_codes', 'language' => true); public function getButton($type, $size) @@ -341,11 +342,16 @@ class ComponentbuilderModelAjax extends JModelList $ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'] . '&return=' . urlencode(base64_encode($return_url)); } // build url (A tag) - $startAtag = ''; - // build the smaller button - if (2 == $size) + $startAtag = 'onclick="UIkit2.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&view=' . $type . '&layout=edit' . $ref . '\' })" href="javascript:void(0)" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', ComponentbuilderHelper::safeString($type, 'W')).'">'; + // build the smallest button + if (3 == $size) { - $button = $startAtag.' ' . JText::_('COM_COMPONENTBUILDER_CREATE') . ''; + $button = ''; + } + // build the smaller button + elseif (2 == $size) + { + $button = ' ' . JText::_('COM_COMPONENTBUILDER_CREATE') . ''; } else // build the big button @@ -354,7 +360,7 @@ class ComponentbuilderModelAjax extends JModelList
-
'.$startAtag.' +
' . JText::_('COM_COMPONENTBUILDER_NEW') . ' @@ -1934,6 +1940,23 @@ class ComponentbuilderModelAjax extends JModelList // only continue if this is a legitimate call if (isset($view['a_id']) && $view['a_id'] == $id && isset($view['a_view']) && ($target = $this->getCodeSearchKeys($view['a_view'], 'query_')) !== false) { + // reset the buttons bucket + $buttons = array(); + // some helper for some fields + $helper = array('xml' => 'note_select_field_type'); + // get input + $jinput = JFactory::getApplication()->input; + $return_here = $jinput->get('return_here', null, 'base64'); + // set the return here value if not found + if (ComponentbuilderHelper::checkString($return_here)) + { + $return_here = '&return=' . $return_here; + } + else + { + $return_here = '&ref=' . $view['a_view'] . '&refid=' . (int) $id; + } + // start db query $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName($target['select'])) @@ -1944,8 +1967,6 @@ class ComponentbuilderModelAjax extends JModelList if ($db->loadRowList()) { $data = $db->loadAssoc(); - // some helper for some fields - $helper = array('xml' => 'note_select_field_type'); // reset the bucket $bucket = array(); foreach ($data as $key => $value) @@ -1973,25 +1994,20 @@ class ComponentbuilderModelAjax extends JModelList // get all custom codes in value $bucket[$key] = ComponentbuilderHelper::getAllBetween($value, '[CUSTOMC' . 'ODE=', ']'); } + // check if field has string length + if (ComponentbuilderHelper::checkString($value)) + { + $buttons[$key] = array(); + if (($button = $this->getButton('custom_code', 3)) && ComponentbuilderHelper::checkString($button)) + { + $buttons[$key]['_create'] = $button; + } + } } } // check if any values found if (ComponentbuilderHelper::checkArray($bucket)) { - // get input - $jinput = JFactory::getApplication()->input; - $return_here = $jinput->get('return_here', null, 'base64'); - // set the return here value if not found - if (ComponentbuilderHelper::checkString($return_here)) - { - $return_here = '&return=' . $return_here; - } - else - { - $return_here = '&ref=' . $view['a_view'] . '&refid=' . (int) $id; - } - // reset the buttons bucket - $buttons = array(); foreach ($bucket as $field => $customcodes) { $edit_icon = ' '; @@ -2000,7 +2016,6 @@ class ComponentbuilderModelAjax extends JModelList { $field = $helper[$field]; } - $buttons[$field] = array(); foreach ($customcodes as $customcode) { $key = (array) explode('+', $customcode); @@ -2012,13 +2027,13 @@ class ComponentbuilderModelAjax extends JModelList } } } - // only continue if we have buttons in array - if (ComponentbuilderHelper::checkArray($buttons, true)) - { - return $buttons; - } } } + // only continue if we have buttons in array + if (ComponentbuilderHelper::checkArray($buttons, true)) + { + return $buttons; + } } return false; } diff --git a/admin/models/forms/admin_fields_relations.js b/admin/models/forms/admin_fields_relations.js index 2e5e265c6..dd027678a 100644 --- a/admin/models/forms/admin_fields_relations.js +++ b/admin/models/forms/admin_fields_relations.js @@ -93,7 +93,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/admin_view.js b/admin/models/forms/admin_view.js index e08365bb0..8e894c1c6 100644 --- a/admin/models/forms/admin_view.js +++ b/admin/models/forms/admin_view.js @@ -1507,7 +1507,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/component_dashboard.js b/admin/models/forms/component_dashboard.js index ed2e6521b..70dd5c103 100644 --- a/admin/models/forms/component_dashboard.js +++ b/admin/models/forms/component_dashboard.js @@ -37,7 +37,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/custom_admin_view.js b/admin/models/forms/custom_admin_view.js index 664b3240a..9f7e4b7ec 100644 --- a/admin/models/forms/custom_admin_view.js +++ b/admin/models/forms/custom_admin_view.js @@ -686,7 +686,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/custom_code.js b/admin/models/forms/custom_code.js index 3de69a3a7..d2e0dfb44 100644 --- a/admin/models/forms/custom_code.js +++ b/admin/models/forms/custom_code.js @@ -377,7 +377,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/dynamic_get.js b/admin/models/forms/dynamic_get.js index 33da3c9f4..70cf89b22 100644 --- a/admin/models/forms/dynamic_get.js +++ b/admin/models/forms/dynamic_get.js @@ -1744,7 +1744,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/field.js b/admin/models/forms/field.js index 03abec751..01ea9b93b 100644 --- a/admin/models/forms/field.js +++ b/admin/models/forms/field.js @@ -873,7 +873,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/fieldtype.js b/admin/models/forms/fieldtype.js index 927afbd1a..317cf5c28 100644 --- a/admin/models/forms/fieldtype.js +++ b/admin/models/forms/fieldtype.js @@ -829,7 +829,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/joomla_component.js b/admin/models/forms/joomla_component.js index e0b813187..b8537ce62 100644 --- a/admin/models/forms/joomla_component.js +++ b/admin/models/forms/joomla_component.js @@ -1184,7 +1184,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/layout.js b/admin/models/forms/layout.js index 2a0fbe32d..96f1224c5 100644 --- a/admin/models/forms/layout.js +++ b/admin/models/forms/layout.js @@ -113,7 +113,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/library.js b/admin/models/forms/library.js index 148612aed..c4bd265e8 100644 --- a/admin/models/forms/library.js +++ b/admin/models/forms/library.js @@ -491,7 +491,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/site_view.js b/admin/models/forms/site_view.js index 9d7b8b3f7..927686d42 100644 --- a/admin/models/forms/site_view.js +++ b/admin/models/forms/site_view.js @@ -727,7 +727,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/template.js b/admin/models/forms/template.js index dad4fdef6..595af1b84 100644 --- a/admin/models/forms/template.js +++ b/admin/models/forms/template.js @@ -113,7 +113,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); }); diff --git a/admin/models/forms/validation_rule.js b/admin/models/forms/validation_rule.js index 8e28efbc4..992c3fdc9 100644 --- a/admin/models/forms/validation_rule.js +++ b/admin/models/forms/validation_rule.js @@ -117,7 +117,7 @@ function getEditCustomCodeButtons(){ getEditCustomCodeButtons_server(id).done(function(result) { if(isObject(result)){ jQuery.each(result, function( field, buttons ) { - jQuery('
').insertBefore(".control-wrapper-"+ field); + jQuery('
').insertBefore(".control-wrapper-"+ field); jQuery.each(buttons, function( name, button ) { jQuery(".control-customcode-buttons-"+field).append(button); });