Component-Builder/admin/views/assistant/tmpl/default_jcbviewsplan.php

95 lines
3.9 KiB
PHP
Raw Normal View History

2020-01-03 03:36:47 +00:00
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
2020-01-03 03:36:47 +00:00
?>
<div class="control-label">
<?php echo $this->viewsSubform->label; ?>
2020-01-03 03:36:47 +00:00
</div>
<div class="controls">
<?php echo $this->viewsSubform->input; ?>
2020-01-03 03:36:47 +00:00
</div>
<script type="text/javascript">
var active_view = 'view0';
function setJCBuilder(area, view, target){
// set the active view
active_view = view;
console.log(active_view);
console.log(jQuery(area).attr('id'));
2020-01-03 03:36:47 +00:00
console.log(target);
}
function setFieldTypeOptions(obj){
// get type id
var type_id = jQuery(obj).attr('id');
// setup help ID
var help_id = 'help_' + type_id;
// clear past help messages
jQuery('#' + help_id).remove();
// get the type value
var type_value = jQuery('#' + type_id).val();
var type_text = jQuery('#' + type_id + ' option:selected').text();
// show what is available
if (typeof fieldtype_properties[type_value] === "undefined"){
var help_note = '<div id="' + help_id + '">' + Joomla.JText._('COM_COMPONENTBUILDER_ERROR_FIELD_TYPE_DOES_NOT_EXIST') + '</div>';
} else {
var help_note = '<div id="' + help_id + '" data-uk-check-display>' + type_text + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_HAS_THESE_AVAILABLE_PROPERTIES') + ':<ul class="uk-list">';
for (var key in fieldtype_properties[type_value]) {
if (fieldtype_properties[type_value].hasOwnProperty(key)) {
if (fieldtype_properties[type_value][key].mandatory){
var mandatory = '<span style="color:red" data-uk-tooltip title="' + Joomla.JText._('COM_COMPONENTBUILDER_PROPERTY_VALUE_IS_MANDATORY') + '"><i class="uk-icon-asterisk"></i></span>&nbsp;';
} else {
var mandatory = '<i class="uk-icon-angle-right"></i>&nbsp;&nbsp;&nbsp;';
}
if (fieldtype_properties[type_value][key].translatable){
var translatable = '&nbsp;&nbsp;<span data-uk-tooltip title="' + Joomla.JText._('COM_COMPONENTBUILDER_PROPERTY_VALUE_IS_TRANSLATABLE') + '"><i class="uk-icon-language uk-icon-small"></i></span>';
} else {
var translatable = '';
}
help_note += '<li>' + mandatory + '<span data-uk-tooltip title="' + fieldtype_properties[type_value][key].description + '">' + fieldtype_properties[type_value][key].name + '</span>' + translatable + '</li>';
}
}
help_note += '</ul></div>';
}
// add help note
jQuery(help_note).insertAfter(jQuery('#' + type_id).closest('.control-group'));
}
function setPropertyDefaultValue(obj){
// get property id
var property_id = jQuery(obj).attr('id');
// get the property value
var property_value = jQuery('#' + property_id).val();
// get base line
var base = property_id.split('__properties__properties');
// get the type id
var type_id = base[0] + '__type';
// get the type value
var type_value = jQuery('#' + type_id).val();
var type_text = jQuery('#' + type_id + ' option:selected').text();
// get property value id
var value_id = jQuery.string_replace('__property', '__value', property_id);
// get the example/default value
if (typeof fieldtype_properties[type_value] === "undefined" ||
typeof fieldtype_properties[type_value][property_value] === "undefined"){
var value = Joomla.JText._('COM_COMPONENTBUILDER_NOT_AVAILABLE');
var readonly = true;
} else {
var value = fieldtype_properties[type_value][property_value].example;
var readonly = false;
}
// set the property default value
jQuery('#' + value_id).val(value);
// make read only or not as needed
document.getElementById(value_id).readOnly = readonly;
}
2020-01-03 03:36:47 +00:00
</script>