2017-10-12 23:14:17 +00:00
|
|
|
<?php
|
|
|
|
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
|
|
|
__ __ _ _____ _ _ __ __ _ _ _
|
|
|
|
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
|
|
|
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
|
|
|
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
|
|
|
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
|
|
|
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
|
|
|
| |
|
|
|
|
|_|
|
2017-11-06 14:15:03 +00:00
|
|
|
/-------------------------------------------------------------------------------------------------------------------------------/
|
2017-10-12 23:14:17 +00:00
|
|
|
|
2018-03-21 03:10:34 +00:00
|
|
|
@version 2.7.x
|
2017-11-06 14:04:23 +00:00
|
|
|
@created 30th April, 2015
|
2017-10-12 23:14:17 +00:00
|
|
|
@package Component Builder
|
|
|
|
@subpackage edit.php
|
2017-12-27 03:45:35 +00:00
|
|
|
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
2017-11-06 14:04:23 +00:00
|
|
|
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
2017-10-12 23:14:17 +00:00
|
|
|
@copyright Copyright (C) 2015. All Rights Reserved
|
|
|
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
|
|
|
|
Builds Complex Joomla Components
|
|
|
|
|
|
|
|
/-----------------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
|
|
|
JHtml::_('behavior.tooltip');
|
|
|
|
JHtml::_('behavior.formvalidation');
|
|
|
|
JHtml::_('formbehavior.chosen', 'select');
|
|
|
|
JHtml::_('behavior.keepalive');
|
|
|
|
$componentParams = JComponentHelper::getParams('com_componentbuilder');
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
// waiting spinner
|
|
|
|
var outerDiv = jQuery('body');
|
|
|
|
jQuery('<div id="loading"></div>')
|
|
|
|
.css("background", "rgba(255, 255, 255, .8) url('components/com_componentbuilder/assets/images/import.gif') 50% 15% no-repeat")
|
|
|
|
.css("top", outerDiv.position().top - jQuery(window).scrollTop())
|
|
|
|
.css("left", outerDiv.position().left - jQuery(window).scrollLeft())
|
|
|
|
.css("width", outerDiv.width())
|
|
|
|
.css("height", outerDiv.height())
|
|
|
|
.css("position", "fixed")
|
|
|
|
.css("opacity", "0.80")
|
|
|
|
.css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)")
|
|
|
|
.css("filter", "alpha(opacity = 80)")
|
|
|
|
.css("display", "none")
|
|
|
|
.appendTo(outerDiv);
|
|
|
|
jQuery('#loading').show();
|
|
|
|
// when page is ready remove and show
|
|
|
|
jQuery(window).load(function() {
|
|
|
|
jQuery('#componentbuilder_loader').fadeIn('fast');
|
|
|
|
jQuery('#loading').hide();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<div id="componentbuilder_loader" style="display: none;">
|
|
|
|
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&layout=edit&id='.(int) $this->item->id.$this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
|
|
|
|
|
|
|
<?php echo JLayoutHelper::render('admin_fields.fields_above', $this); ?>
|
|
|
|
<div class="form-horizontal">
|
|
|
|
|
|
|
|
<?php echo JHtml::_('bootstrap.startTabSet', 'admin_fieldsTab', array('active' => 'fields')); ?>
|
|
|
|
|
|
|
|
<?php echo JHtml::_('bootstrap.addTab', 'admin_fieldsTab', 'fields', JText::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELDS', true)); ?>
|
|
|
|
<div class="row-fluid form-horizontal-desktop">
|
|
|
|
</div>
|
|
|
|
<div class="row-fluid form-horizontal-desktop">
|
|
|
|
<div class="span12">
|
|
|
|
<?php echo JLayoutHelper::render('admin_fields.fields_fullwidth', $this); ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
|
|
|
|
2017-10-13 03:45:54 +00:00
|
|
|
<?php if ($this->canDo->get('admin_fields.delete') || $this->canDo->get('admin_fields.edit.created_by') || $this->canDo->get('admin_fields.edit.state') || $this->canDo->get('admin_fields.edit.created')) : ?>
|
2017-10-12 23:14:17 +00:00
|
|
|
<?php echo JHtml::_('bootstrap.addTab', 'admin_fieldsTab', 'publishing', JText::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_PUBLISHING', true)); ?>
|
|
|
|
<div class="row-fluid form-horizontal-desktop">
|
|
|
|
<div class="span6">
|
|
|
|
<?php echo JLayoutHelper::render('admin_fields.publishing', $this); ?>
|
|
|
|
</div>
|
|
|
|
<div class="span6">
|
|
|
|
<?php echo JLayoutHelper::render('admin_fields.publlshing', $this); ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<?php if ($this->canDo->get('core.admin')) : ?>
|
|
|
|
<?php echo JHtml::_('bootstrap.addTab', 'admin_fieldsTab', 'permissions', JText::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_PERMISSION', true)); ?>
|
|
|
|
<div class="row-fluid form-horizontal-desktop">
|
|
|
|
<div class="span12">
|
|
|
|
<fieldset class="adminform">
|
|
|
|
<div class="adminformlist">
|
|
|
|
<?php foreach ($this->form->getFieldset('accesscontrol') as $field): ?>
|
|
|
|
<div>
|
|
|
|
<?php echo $field->label; echo $field->input;?>
|
|
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<input type="hidden" name="task" value="admin_fields.edit" />
|
|
|
|
<?php echo JHtml::_('form.token'); ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2018-04-13 15:24:06 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// little script to check value and give notice
|
|
|
|
function checkAdminBehaviour(field) {
|
|
|
|
// get the ID
|
|
|
|
var id = jQuery(field).attr('id');
|
|
|
|
var target = id.split('__');
|
|
|
|
//set the subID
|
|
|
|
var subID = target[0]+'__'+target[1];
|
|
|
|
// get value
|
|
|
|
var value = jQuery('#'+subID+'__list').val();
|
|
|
|
// set notice and do house cleaning
|
|
|
|
if (2 == value) {
|
|
|
|
// no database
|
|
|
|
if (target[2] == 'list') {
|
|
|
|
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_ONLY_USE_THE_BNONE_DBB_OPTION_IF_YOU_ARE_PLANNING_ON_TARGETING_THIS_FIELD_WITH_JAVASCRIPTCUSTOM_PHP_TO_MOVE_ITS_VALUE_INTO_ANOTHER_FIELD_THAT_DOES_GET_SAVED_TO_THE_DATABASE'), timeout: 10000, status: 'warning', pos: 'top-right'});
|
|
|
|
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_THE_BNONE_DBB_OPTION_WILL_REMOVE_THIS_FIELD_FROM_BEING_SAVED_IN_THE_DATABASE'), timeout: 5000, status: 'primary', pos: 'top-right'});
|
|
|
|
} else {
|
|
|
|
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_NOT_AVAILABLE_TO_THE_FIELD_IF_BNONE_DBB_OPTION_IS_SELECTED'), timeout: 7000, status: 'warning', pos: 'top-right'});
|
|
|
|
}
|
|
|
|
// do some house cleaning
|
|
|
|
jQuery('#'+subID+'__order_list').val(0).trigger('liszt:updated');
|
|
|
|
jQuery('#'+subID+'__title').prop('checked', false).trigger('change');
|
|
|
|
jQuery('#'+subID+'__alias').prop('checked', false).trigger('change');
|
|
|
|
jQuery('#'+subID+'__sort').prop('checked', false).trigger('change');
|
|
|
|
jQuery('#'+subID+'__search').prop('checked', false).trigger('change');
|
|
|
|
jQuery('#'+subID+'__filter').prop('checked', false).trigger('change');
|
|
|
|
jQuery('#'+subID+'__link').prop('checked', false).trigger('change');
|
|
|
|
} else if (1 == value) {
|
|
|
|
// get number of items
|
|
|
|
var numItems = jQuery('.count-the-items1235').length + 10;
|
|
|
|
// show in list view
|
|
|
|
if (target[2] == 'list') {
|
|
|
|
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_THE_BSHOW_IN_LIST_VIEWB_OPTION_WILL_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW'), timeout: 5000, status: 'primary', pos: 'top-right'});
|
|
|
|
}
|
|
|
|
// check if the order list already has a value
|
|
|
|
var orderList = jQuery('#'+subID+'__order_list').val();
|
|
|
|
if (orderList == 0) {
|
|
|
|
// count the already set and get the next number available
|
|
|
|
var listviewNumber = fanAsgfdSffsNumber(subID.replace(/\d+/g, ''), numItems);
|
|
|
|
// update the position
|
|
|
|
jQuery('#'+subID+'__order_list').val(listviewNumber).trigger('liszt:updated');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// do some house cleaning
|
|
|
|
jQuery('#'+subID+'__order_list').val(0).trigger('liszt:updated');
|
|
|
|
jQuery('#'+subID+'__sort').prop('checked', false).trigger('change');
|
|
|
|
jQuery('#'+subID+'__filter').prop('checked', false).trigger('change');
|
|
|
|
jQuery('#'+subID+'__link').prop('checked', false).trigger('change');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// count the already set and get the next number available
|
|
|
|
function fanAsgfdSffsNumber(targetForm, numItems) {
|
|
|
|
var i;
|
|
|
|
// no check all the order values already set so to fill in the caps
|
|
|
|
var numbers = [];
|
|
|
|
for (i = 0; i < numItems; i++) { // for now this is the number of field we should check
|
|
|
|
// build ID
|
|
|
|
var id_check = targetForm+i+'__order_list';
|
|
|
|
// first check if Id is on page
|
|
|
|
if (jQuery("#"+id_check).length) {
|
|
|
|
// get the property value
|
|
|
|
var tmp = jQuery("#"+id_check+" option:selected").val();
|
|
|
|
// now validate
|
|
|
|
if (tmp >= 1) {
|
|
|
|
numbers.push(parseInt(tmp));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// check that there are actually some set
|
|
|
|
if (numbers.length) {
|
|
|
|
// sort the array
|
|
|
|
numbers.sort(fanAsgfdSffsSort);
|
|
|
|
// get the absent values
|
|
|
|
var absent = fanAsgfdSffsAbsent(numbers);
|
|
|
|
// check if an absent value was found
|
|
|
|
if (absent.length) {
|
|
|
|
// sort the array (just to be safe)
|
|
|
|
absent.sort(fanAsgfdSffsSort);
|
|
|
|
// return lowest found value
|
|
|
|
return absent[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// since no absent value was found add to next available option
|
|
|
|
var total = 0;
|
|
|
|
for (i = 0; i < numItems; i++) { // for now this is the number of field we should check
|
|
|
|
// build ID
|
|
|
|
var id_check = targetForm+i+'__list';
|
|
|
|
// first check if Id is on page
|
|
|
|
if (jQuery("#"+id_check).length) {
|
|
|
|
// get the property value
|
|
|
|
var tmp = jQuery("#"+id_check+" option:selected").val();
|
|
|
|
// now validate
|
|
|
|
if (tmp >= 1) {
|
|
|
|
total++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
|
|
|
// simple sort function
|
|
|
|
function fanAsgfdSffsSort(a,b) {
|
|
|
|
return a - b;
|
|
|
|
}
|
|
|
|
|
|
|
|
// simple absent function
|
|
|
|
function fanAsgfdSffsAbsent(arr){
|
|
|
|
var absentArray = [], min= 1, max = arr[arr.length-1];
|
|
|
|
while(min < max){
|
|
|
|
if(jQuery.inArray(min, arr) == -1) {
|
|
|
|
absentArray.push(min);
|
|
|
|
}
|
|
|
|
min++;
|
|
|
|
}
|
|
|
|
return absentArray;
|
|
|
|
}
|
|
|
|
</script>
|