Fixed the javascript in the new relation area. Fixed gh-294 that hade count not array errors. Added the option to over-ride the column name in the new relation area.
This commit is contained in:
@ -413,6 +413,8 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
'field' => 'setItemNames',
|
||||
'listfield' => 'setItemNames',
|
||||
'joinfields' => 'setItemNames',
|
||||
'area' => 'setAreaName',
|
||||
'set' => 'setCode',
|
||||
'join_type' => 'setJoinType',
|
||||
'list' => 'setAdminBehaviour',
|
||||
'title' => 'setYesNo',
|
||||
@ -994,6 +996,28 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
return JText::_('COM_COMPONENTBUILDER_DETAILS');
|
||||
}
|
||||
|
||||
protected function setAreaName($header, $value)
|
||||
{
|
||||
switch ($value)
|
||||
{
|
||||
case 1:
|
||||
return JText::_('COM_COMPONENTBUILDER_MODEL_BEFORE_MODELLING');
|
||||
break;
|
||||
case 2:
|
||||
return JText::_('COM_COMPONENTBUILDER_VIEW');
|
||||
break;
|
||||
case 3:
|
||||
return JText::_('COM_COMPONENTBUILDER_MODEL_AFTER_MODELLING');
|
||||
break;
|
||||
}
|
||||
return JText::_('COM_COMPONENTBUILDER_NOT_SET');
|
||||
}
|
||||
|
||||
protected function setCode($header, $value)
|
||||
{
|
||||
return nl2br(htmlspecialchars($value));
|
||||
}
|
||||
|
||||
protected function setYesNo($header, $value)
|
||||
{
|
||||
if (1 == $value)
|
||||
@ -2580,7 +2604,7 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
if ($type == 1)
|
||||
{
|
||||
// MODEL
|
||||
if ($area == 1)
|
||||
if ($area == 1 || $area == 3)
|
||||
{
|
||||
return ', ';
|
||||
}
|
||||
|
@ -26,12 +26,19 @@ function getCodeGlueOptions(field) {
|
||||
var type = jQuery('#'+subID+'__join_type').val();
|
||||
// get area value
|
||||
var area = jQuery('#'+subID+'__area').val();
|
||||
// get codeGlueOptions
|
||||
getCodeGlueOptions_server(listfield, joinfields, type, area).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#'+subID+'__set').val(result);
|
||||
}
|
||||
});
|
||||
// check that values are set
|
||||
if (_isSet(listfield) && _isSet(joinfields) && _isSet(type) && _isSet(area)) {
|
||||
// get codeGlueOptions
|
||||
getCodeGlueOptions_server(listfield, joinfields, type, area).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#'+subID+'__set').val(result);
|
||||
} else {
|
||||
jQuery('#'+subID+'__set').val('');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
jQuery('#'+subID+'__set').val('');
|
||||
}
|
||||
}
|
||||
|
||||
function getCodeGlueOptions_server(listfield, joinfields, type, area){
|
||||
@ -48,4 +55,12 @@ function getCodeGlueOptions_server(listfield, joinfields, type, area){
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function _isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -119,6 +119,21 @@
|
||||
onchange="getCodeGlueOptions(this)"
|
||||
button="false"
|
||||
/>
|
||||
<!-- Column_name Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="column_name"
|
||||
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_COLUMN_NAME_LABEL"
|
||||
size="50"
|
||||
maxlength="50"
|
||||
default="Default"
|
||||
class="text_area"
|
||||
required="false"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_COLUMN_NAME_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_COLUMN_NAME_HINT"
|
||||
autocomplete="on"
|
||||
/>
|
||||
<!-- Joinfields Field. Type: Joinfields. (custom) -->
|
||||
<field
|
||||
type="joinfields"
|
||||
|
Reference in New Issue
Block a user