Refactored the compiler list view body builder, in preparation of the relation fields. Added more options to the relation admin fields. gh-287

This commit is contained in:
2018-05-24 15:56:56 +02:00
parent 84b683182a
commit fef3460772
56 changed files with 1004 additions and 908 deletions

View File

@ -11,10 +11,33 @@
function getFieldSelectOptions_server(fieldId){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json";
if(token.length > 0 && fieldId > 0){
var request = 'token='+token+'&id='+fieldId;
// little script to set the value
function getCodeGlueOptions(field) {
// get the ID
var id = jQuery(field).attr('id');
var target = id.split('__');
//set the subID
var subID = target[0]+'__'+target[1];
// get listfield value
var listfield = jQuery('#'+subID+'__listfield').val();
// get joinfields values
var joinfields = jQuery('#'+subID+'__joinfields').val();
// get type value
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);
}
});
}
function getCodeGlueOptions_server(listfield, joinfields, type, area){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getCodeGlueOptions&format=json";
if(token.length > 0 && listfield > 0 && joinfields.length >= 1 && type > 0 && area > 0) {
var request = 'token='+token+'&listfield='+listfield+'&type='+type+'&area='+area+'&joinfields='+joinfields;
}
return jQuery.ajax({
type: 'GET',
@ -25,20 +48,4 @@ function getFieldSelectOptions_server(fieldId){
});
}
function getFieldSelectOptions(fieldKey){
// first check if the field is set
if(jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field").length) {
var fieldId = jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field option:selected").val();
getFieldSelectOptions_server(fieldId).done(function(result) {
if(result){
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__match_options').val(result);
}
else
{
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__match_options').val('');
}
});
}
}

View File

@ -116,6 +116,7 @@
class="fieldMedium"
multiple="false"
required="false"
onchange="getCodeGlueOptions(this)"
button="false"
/>
<!-- Joinfields Field. Type: Joinfields. (custom) -->
@ -127,8 +128,26 @@
class="fieldMedium"
multiple="true"
required="false"
onchange="getCodeGlueOptions(this)"
button="false"
/>
<!-- Area Field. Type: List. (joomla) -->
<field
type="list"
name="area"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_AREA_LABEL"
class="list_class"
multiple="false"
required="false"
validate="int"
default="1"
onchange="getCodeGlueOptions(this)">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_MODEL</option>
<option value="2">
COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_VIEW</option>
</field>
<!-- Join_type Field. Type: List. (joomla) -->
<field
type="list"
@ -138,26 +157,26 @@
multiple="false"
required="false"
validate="int"
default="1">
default="1"
onchange="getCodeGlueOptions(this)">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_CONCATENATE</option>
COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_CONCATENATE_RAQUO_GLUE</option>
<option value="2">
COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_CUSTOM_CODE</option>
COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_CUSTOM_RAQUO_CODE</option>
</field>
<!-- Set Field. Type: Text. (joomla) -->
<!-- Set Field. Type: Textarea. (joomla) -->
<field
type="text"
type="textarea"
name="set"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_SET_LABEL"
size="150"
maxlength="150"
rows="4"
cols="5"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_SET_DESCRIPTION"
class="text_area"
required="false"
filter="RAW"
class="text_area codefield"
filter="raw"
hint="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_SET_HINT"
autocomplete="on"
required="false"
/>
</form>
</field>