Started adding the Assistant GUI ;)

This commit is contained in:
2020-01-03 05:36:47 +02:00
parent 46e52db097
commit 185dad4273
24 changed files with 1881 additions and 8 deletions

View File

@@ -0,0 +1,133 @@
<?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');
$this->app->input->set('hidemainmenu', false);
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
?>
<?php if ($this->canDo->get('assistant.access')): ?>
<script type="text/javascript">
Joomla.submitbutton = function(task) {
if (task === 'assistant.back') {
parent.history.back();
return false;
} else {
var form = document.getElementById('adminForm');
form.task.value = task;
form.submit();
}
}
</script>
<?php $urlId = (isset($this->item->id)) ? '&id='. (int) $this->item->id : ''; ?>
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=assistant'.$urlId); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
<script type="text/javascript">
// Add spindle-wheel for importations:
jQuery(document).ready(function($) {
// 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);
});
</script>
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<div id="assistant-form">
<?php echo JHtml::_('bootstrap.startTabSet', 'assistant_tab', array('active' => 'jcb-assistant')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'assistant_tab', 'jcb-assistant', JText::_('COM_COMPONENTBUILDER_PLAN', true)); ?>
<div class="span7">
<ul id="component-plan-builder" class="uk-switcher uk-margin">
<li><?php echo $this->loadTemplate('jcbcomponentplan'); ?></li>
<li><?php echo $this->loadTemplate('jcbviewsplan'); ?></li>
<li><?php echo $this->loadTemplate('jcbplanoverview'); ?></li>
</ul>
<ul class="uk-tab uk-tab-bottom" data-uk-tab="{connect:'#component-plan-builder'}">
<li><a href="#"><?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT'); ?></a></li>
<li><a href="#"><?php echo JText::_('COM_COMPONENTBUILDER_VIEWS'); ?></a></li>
<li><a href="#"><?php echo JText::_('COM_COMPONENTBUILDER_OVERVIEW'); ?></a></li>
</ul>
</div>
<div class="span4">
<div id="plan-details"></div>
<?php echo JLayoutHelper::render('jcbnoticeboardtabs', null); ?>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'assistant_tab', 'plans', JText::_('COM_COMPONENTBUILDER_PLANS', true)); ?>
<h2><?php echo JText::_('COM_COMPONENTBUILDER_WATCH_THIS_SPACE'); ?></h2>
<h4><?php echo JText::_('COM_COMPONENTBUILDER_UNDER_DEVELOPMENT_TO_PROVIDE_PLAN_SHARING_OPTIONS_SIMILAR_TO_THE_JCB_SNIPPETS'); ?></h4>
<?php // echo JLayoutHelper::render('jcbplansgui', null); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
</div>
</div>
<script type="text/javascript">
var all_is_good = '<?php echo JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME'); ?>';
// nice little dot trick :)
jQuery(document).ready( function($) {
var x=0;
setInterval(function() {
var dots = "";
x++;
for (var y=0; y < x%8; y++) {
dots+=".";
}
$(".loading-dots").text(dots);
} , 500);
});
<?php
$app = JFactory::getApplication();
?>
function JRouter(link) {
<?php
if ($app->isClient('site'))
{
echo 'var url = "'.JURI::root().'";';
}
else
{
echo 'var url = "";';
}
?>
return url+link;
}
</script>
<?php else: ?>
<h1><?php echo JText::_('COM_COMPONENTBUILDER_NO_ACCESS_GRANTED'); ?></h1>
<?php endif; ?>

View File

@@ -0,0 +1,34 @@
<?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');
// get the model
$model = ComponentbuilderHelper::getModel('joomla_component', JPATH_ADMINISTRATOR . '/components/com_componentbuilder');
// get the form
$form = $model->getForm(array(), true, array('control' => 'jcbform'));
// get the form
$fields = $model->assistantForm;
?>
<h2><?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_DETAILS'); ?></h2>
<div data-uk-grid-margin="" class="uk-grid">
<?php foreach($fields as $pos => $fields): ?>
<div class="uk-width-medium-1-2">
<div class="uk-panel uk-panel-box">
<?php foreach($fields as $field): ?>
<?php echo $form->renderField($field); ?>
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
</div>

View File

@@ -0,0 +1,21 @@
<?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');
?>
<h2><?php echo JText::_('COM_COMPONENTBUILDER_OVERVIEW'); ?></h2>
<div id="plan-overview-area">
<div class="alert alert-success" role="alert">
<?php echo JText::_('COM_COMPONENTBUILDER_SOON_AS_YOU_HAVE_SITE_VIEWS_SET_THIS_AREA_WILL_UPDATE_TO_SHOW_AN_OVERVIEW'); ?>
</div>
</div>

View File

@@ -0,0 +1,131 @@
<?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');
function buildSubform()
{
// get the subform
$subform = JFormHelper::loadFieldType('subform', true);
// make sure the layout is created
// JLayoutHelper::render('assistantsubformrepeatable', null);
// start building the subform field XML
$subformXML = new SimpleXMLElement('<field/>');
// subform attributes
$subformAttribute = array(
'type' => 'subform',
'name' => 'views',
'label' => 'COM_COMPONENTBUILDER_VIEW_BUILDER',
'layout' => 'assistantsubformrepeatable',
'multiple' => 'true',
'icon' => 'list',
'max' => 5,
'min' => 1
);
// load the subform attributes
ComponentbuilderHelper::xmlAddAttributes($subformXML, $subformAttribute);
// now add the subform child form
$childForm = $subformXML->addChild('form');
// child form attributes
$childFormAttribute = array(
'hidden' => 'true',
'name' => 'list_properties',
'repeat' => 'true');
// load the child form attributes
ComponentbuilderHelper::xmlAddAttributes($childForm, $childFormAttribute);
// view building the name field XML
$nameXML = new SimpleXMLElement('<field/>');
// subform attributes
$nameAttribute = array(
'type' => 'text',
'name' => 'name',
'label' => 'COM_COMPONENTBUILDER_VIEW_NAME',
'size' => '40',
'maxlength' => '150',
'class' => 'text_area',
'hint' => 'COM_COMPONENTBUILDER_VIEW_NAME',
'filter' => 'STRING'
);
// load the subform attributes
ComponentbuilderHelper::xmlAddAttributes($nameXML, $nameAttribute);
// now add the fields to the child form
ComponentbuilderHelper::xmlAppend($childForm, $nameXML);
// view building the list name field XML
$listnameXML = new SimpleXMLElement('<field/>');
// subform attributes
$listnameAttribute = array(
'type' => 'text',
'name' => 'list_name',
'label' => 'COM_COMPONENTBUILDER_LIST_VIEW_NAME',
'size' => '40',
'maxlength' => '150',
'class' => 'text_area',
'hint' => 'COM_COMPONENTBUILDER_LIST_VIEW_NAME',
'filter' => 'STRING'
);
// load the subform attributes
ComponentbuilderHelper::xmlAddAttributes($listnameXML, $listnameAttribute);
// now add the fields to the child form
ComponentbuilderHelper::xmlAppend($childForm, $listnameXML);
// start building the builder area XML
$noteXML = new SimpleXMLElement('<field/>');
// subform attributes
$noteAttribute = array(
'type' => 'note',
'name' => 'builder',
'label' => 'COM_COMPONENTBUILDER_BUILDER',
'description' => '
<div class="uk-button-group uk-width-1-1">
<a class="uk-button uk-button-small uk-width-1-3" href="#jcbuilder" data-uk-modal="{center:true}" onclick="setJCBuilder(this, 1)">' . JText::_('COM_COMPONENTBUILDER_FIELDS') . '</a>
<a class="uk-button uk-button-small uk-width-1-3" href="#jcbuilder" data-uk-modal="{center:true}" onclick="setJCBuilder(this, 2)">' . JText::_('COM_COMPONENTBUILDER_LIST_VIEW') . '</a>
<a class="uk-button uk-button-small uk-width-1-3" href="#jcbuilder" data-uk-modal="{center:true}" onclick="setJCBuilder(this, 3)">' . JText::_('COM_COMPONENTBUILDER_DISPLAY_VIEW') . '</a>
</div><div class="builder"></div><br />',
'heading' => 'h5'
);
// load the subform attributes
ComponentbuilderHelper::xmlAddAttributes($noteXML, $noteAttribute);
// now add the fields to the child form
ComponentbuilderHelper::xmlAppend($childForm, $noteXML);
// setup subform with values
$subform->setup($subformXML, null, 'jcbform');
// return subfrom object
return $subform;
}
// get the subform
$subform = buildSubform();
?>
<div class="control-label">
<?php echo $subform->label; ?>
</div>
<div class="controls">
<?php echo $subform->input; ?>
</div>
<div id="jcbuilder" class="uk-modal">
<div class="uk-modal-dialog uk-modal-dialog-large">
<button class="uk-modal-close uk-close" type="button"></button>
<div class="loading">loading..<span class="loading-dots"></span></div>
<div id="jcbbuilder-display" class="uk-panel">
</div>
</div>
</div>
<script type="text/javascript">
function setJCBuilder(area, target){
console.log(area);
console.log(target);
}
</script>

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>