' . 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);
});