Urgent fix to the fields area to address the extra field options, and fields with 0 being removed. Added the option to add a field and not add it to the database, so it will show in the edit view but will not be stored to the database. This is to use javascript/php to use that field value, and then drop it.

This commit is contained in:
2018-04-13 17:24:06 +02:00
parent 51d13b75f0
commit 694612aff9
31 changed files with 515 additions and 300 deletions

View File

@ -118,28 +118,36 @@
required="false"
button="false"
/>
<!-- List Field. Type: Checkbox. (joomla) -->
<!-- List Field. Type: List. (joomla) -->
<field
type="checkbox"
type="list"
name="list"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_LIST_LABEL"
value="1"
required="false"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_LIST_DESCRIPTION"
class="inputbox"
/>
class="fieldMedium count-the-items1235"
multiple="false"
required="false"
onchange="checkAdminBehaviour(this)">
<!-- Option Set. -->
<option value="">
COM_COMPONENTBUILDER_ADMIN_FIELDS_DEFAULT</option>
<option value="1">
COM_COMPONENTBUILDER_ADMIN_FIELDS_SHOW_IN_LIST_VIEW</option>
<option value="2">
COM_COMPONENTBUILDER_ADMIN_FIELDS_NONE_DB</option>
</field>
<!-- Order_list Field. Type: Integer. (joomla) -->
<field
type="integer"
name="order_list"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_ORDER_LIST_LABEL"
default="0"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_ORDER_LIST_DESCRIPTION"
class="fieldSmall"
required="false"
first="0"
last="20"
step="1"
onchange="checkAdminBehaviour(this)"
/>
<!-- Title Field. Type: Checkbox. (joomla) -->
<field
@ -259,10 +267,9 @@
name="permission"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_PERMISSION_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_PERMISSION_DESCRIPTION"
class="fieldMedium"
class="fieldMid"
multiple="false"
required="false"
default="0">
required="false">
<!-- Option Set. -->
<option value="0">
COM_COMPONENTBUILDER_ADMIN_FIELDS_NONE</option>

View File

@ -598,7 +598,9 @@ function getFieldOptions(fieldtype){
jQuery('.prop_removal').remove();
// hide notice
jQuery('.note_select_field_type').closest('.control-group').remove();
// append to the closed to xml (hidden field)
// append to note_filter_information class
jQuery('.note_filter_information').closest('.control-group').prepend(result.extra);
// append to note_filter_information class
jQuery('.note_filter_information').closest('.control-group').prepend(result.subform);
// add the watcher
rowWatcher();
@ -613,7 +615,7 @@ function getFieldOptions(fieldtype){
})
}
function getFieldPropertyDesc(field){
function getFieldPropertyDesc(field, targetForm){
// get the ID
var id = jQuery(field).attr('id');
// build the target array
@ -621,7 +623,7 @@ function getFieldPropertyDesc(field){
// get property value
var property = jQuery(field).val();
// first check that there isn't any of this property type already set
if (propertyIsSet(property, id)) {
if (propertyIsSet(property, id, targetForm)) {
// reset the selection
jQuery('#'+id).val('');
jQuery('#'+id).trigger("liszt:updated");
@ -634,9 +636,13 @@ function getFieldPropertyDesc(field){
// do a dynamic update
propertyDynamicSet();
// get type value
var fieldtype = jQuery("#jform_fieldtype option:selected").val();
if (targetForm === 'properties') {
var fieldtype = jQuery("#jform_fieldtype option:selected").val();
} else {
var fieldtype = 'extra';
}
getFieldPropertyDesc_server(fieldtype, property).done(function(result) {
if(result.desc && result.value){
if(result.desc || result.value){
// update the values
jQuery('#'+target[0]+'__desc').val(result.desc);
jQuery('#'+target[0]+'__value').val(result.value);
@ -704,11 +710,11 @@ function rowWatcher() {
});
}
function propertyIsSet(prop, id) {
function propertyIsSet(prop, id, targetForm) {
var i;
for (i = 0; i < 70; i++) { // for now this is the number of field we should check
// build ID
var id_check = rowIdKey+'_'+rowIdKey+i+'__name';
var id_check = targetForm+'_'+targetForm+i+'__name';
// first check if Id is on page as that not the same as the one currently calling
if (jQuery("#"+id_check).length && id_check != id) {
// get the property value
@ -724,7 +730,7 @@ function propertyIsSet(prop, id) {
function getFieldPropertyDesc_server(fieldtype, property){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getFieldPropertyDesc&format=json&vdm="+vastDevMod;
if(token.length > 0 && fieldtype > 0 && property.length > 0){
if(token.length > 0 && (fieldtype > 0 || fieldtype.length > 0)&& property.length > 0){
var request = 'token='+token+'&fieldtype='+fieldtype+'&property='+property;
}
return jQuery.ajax({

View File

@ -183,98 +183,6 @@
<option value="NOT NULL">
COM_COMPONENTBUILDER_FIELD_NOT_NULL</option>
</field>
<!-- Javascript_view_footer Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="javascript_view_footer"
label="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_HINT"
required="true"
/>
<!-- Css_views Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="css_views"
label="COM_COMPONENTBUILDER_FIELD_CSS_VIEWS_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_FIELD_CSS_VIEWS_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_FIELD_CSS_VIEWS_HINT"
required="true"
/>
<!-- Add_javascript_view_footer Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_javascript_view_footer"
label="COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_FIELD_YES</option>
<option value="0">
COM_COMPONENTBUILDER_FIELD_NO</option>
</field>
<!-- Css_view Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="css_view"
label="COM_COMPONENTBUILDER_FIELD_CSS_VIEW_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_FIELD_CSS_VIEW_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_FIELD_CSS_VIEW_HINT"
required="true"
/>
<!-- Add_css_views Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_css_views"
label="COM_COMPONENTBUILDER_FIELD_ADD_CSS_VIEWS_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_FIELD_YES</option>
<option value="0">
COM_COMPONENTBUILDER_FIELD_NO</option>
</field>
<!-- Catid Field. Type: Category. (joomla) -->
<field
type="category"
name="catid"
label="COM_COMPONENTBUILDER_FIELD_CATID_LABEL"
extension="com_componentbuilder.fields"
description="COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION"
class="inputbox"
/>
<!-- Add_css_view Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_css_view"
label="COM_COMPONENTBUILDER_FIELD_ADD_CSS_VIEW_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_FIELD_YES</option>
<option value="0">
COM_COMPONENTBUILDER_FIELD_NO</option>
</field>
<!-- Note_filter_information Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_filter_information" description="COM_COMPONENTBUILDER_FIELD_NOTE_FILTER_INFORMATION_DESCRIPTION" class="note_filter_information" />
<!-- Store Field. Type: List. (joomla) -->
<field
type="list"
@ -300,6 +208,98 @@
<option value="4">
COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION</option>
</field>
<!-- Catid Field. Type: Category. (joomla) -->
<field
type="category"
name="catid"
label="COM_COMPONENTBUILDER_FIELD_CATID_LABEL"
extension="com_componentbuilder.fields"
description="COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION"
class="inputbox"
/>
<!-- Javascript_view_footer Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="javascript_view_footer"
label="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_HINT"
required="true"
/>
<!-- Add_javascript_view_footer Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_javascript_view_footer"
label="COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_FIELD_YES</option>
<option value="0">
COM_COMPONENTBUILDER_FIELD_NO</option>
</field>
<!-- Css_views Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="css_views"
label="COM_COMPONENTBUILDER_FIELD_CSS_VIEWS_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_FIELD_CSS_VIEWS_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_FIELD_CSS_VIEWS_HINT"
required="true"
/>
<!-- Add_css_views Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_css_views"
label="COM_COMPONENTBUILDER_FIELD_ADD_CSS_VIEWS_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_FIELD_YES</option>
<option value="0">
COM_COMPONENTBUILDER_FIELD_NO</option>
</field>
<!-- Css_view Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="css_view"
label="COM_COMPONENTBUILDER_FIELD_CSS_VIEW_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_FIELD_CSS_VIEW_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_FIELD_CSS_VIEW_HINT"
required="true"
/>
<!-- Add_css_view Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_css_view"
label="COM_COMPONENTBUILDER_FIELD_ADD_CSS_VIEW_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_FIELD_YES</option>
<option value="0">
COM_COMPONENTBUILDER_FIELD_NO</option>
</field>
<!-- Note_filter_information Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_filter_information" description="COM_COMPONENTBUILDER_FIELD_NOTE_FILTER_INFORMATION_DESCRIPTION" class="note_filter_information" />
<!-- Datadefault_other Field. Type: Text. (joomla) -->
<field
type="text"

View File

@ -141,7 +141,6 @@
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_LANGUAGE_LABEL"
class="list_class"
multiple="false"
default="0"
required="false"
button="false"
/>