34
0

first commit - v1.0.0

This commit is contained in:
Llewellyn van der Merwe 2021-12-08 22:41:29 +02:00
commit 5887026b4e
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
14 changed files with 747 additions and 0 deletions

View File

@ -0,0 +1,73 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder-Pro>
* @copyright Copyright (C) 2015 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');
use Joomla\CMS\Form\Form;
use Joomla\CMS\Plugin\CMSPlugin;
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
/**
* Content - Componentbuilder Component Dashboard Headers Tabs plugin.
*
* @package ComponentbuilderComponentDashboardHeadersTabs
* @since 1.0.0
*/
class PlgContentComponentbuilderComponentDashboardHeadersTabs extends CMSPlugin
{
/**
* Affects constructor behavior. If true, language files will be loaded automatically.
*
* @var boolean
* @since 1.0
*/
protected $autoloadLanguage = true;
/**
* Runs on content preparation of form.
*
* @param JForm $form The form
* @param stdClass $data The data
*
* @return boolean
*
* @since 1.0
*/
public function onContentPrepareForm(Form $form, $data)
{
$context = $form->getName();
// When this is componentbuilder admin view
if (strpos($context, 'com_componentbuilder.component_dashboard') === 0)
{
// Add the forms path
Form::addFormPath(__DIR__ . '/forms');
// add the admin view params for privacy integration
$form->loadFile('component_dashboard');
// update all editors to use this components global editor
$global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none');
// set the field editor value (with none as fallback)
$editors = $form->getXml()->xpath('descendant::fields[@name="component_dashboard_headers"]//field[@type="editor"]');
// check if we found any
if (ComponentbuilderHelper::checkArray($editors))
{
foreach ($editors as $editor)
{
// set the editor to the global option
$editor['editor'] = $global_editor . '|none';
}
}
}
return true;
}
}

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="4" group="content" method="upgrade">
<name>PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS</name>
<creationDate>8th December, 2021</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>1.0.0</version>
<description>PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
<scriptfile>script.php</scriptfile>
<!-- Language files -->
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_content_componentbuildercomponentdashboardheaderstabs.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_content_componentbuildercomponentdashboardheaderstabs.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename plugin="componentbuildercomponentdashboardheaderstabs">componentbuildercomponentdashboardheaderstabs.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>fields</folder>
<folder>forms</folder>
<folder>rules</folder>
</files>
</extension>

1
fields/index.html Normal file
View File

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

184
fields/powers.php Normal file
View File

@ -0,0 +1,184 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder-Pro>
* @copyright Copyright (C) 2015 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');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Powers Form Field class for the Componentbuilder component
*/
class JFormFieldPowers extends JFormFieldList
{
/**
* The powers field type.
*
* @var string
*/
public $type = 'powers';
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$set_button = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($set_button === 'true')
{
$button = array();
$script = array();
$button_code_name = $this->getAttribute('name');
// get the input from url
$app = JFactory::getApplication();
$jinput = $app->input;
// get the view name & id
$values = $jinput->getArray(array(
'id' => 'int',
'view' => 'word'
));
// check if new item
$ref = '';
$refJ = '';
if (!is_null($values['id']) && strlen($values['view']))
{
// only load referral if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) JUri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;
$refJ .= '&return=' . $_return;
}
// get button label
$button_label = trim($button_code_name);
$button_label = preg_replace('/_+/', ' ', $button_label);
$button_label = preg_replace('/\s+/', ' ', $button_label);
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
$button_label = ucfirst(strtolower($button_label));
// get user object
$user = JFactory::getUser();
// only add if user allowed to create power
if ($user->authorise('power.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
{
// build Create button
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_componentbuilder&amp;view=power&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit power
if ($user->authorise('power.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "
jQuery(document).ready(function() {
jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) {
e.preventDefault();
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
function ".$button_code_name."Button(value) {
if (value > 0) {
// hide the create button
jQuery('#".$button_code_name."Create').hide();
// show edit button
jQuery('#".$button_code_name."Edit').show();
var url = 'index.php?option=com_componentbuilder&view=powers&task=power.edit&id='+value+'".$refJ."';
jQuery('#".$button_code_name."Edit').attr('href', url);
} else {
// show the create button
jQuery('#".$button_code_name."Create').show();
// hide edit button
jQuery('#".$button_code_name."Edit').hide();
}
}";
}
// check if button was created for power field.
if (is_array($button) && count($button) > 0)
{
// Load the needed script.
$document = JFactory::getDocument();
$document->addScriptDeclaration(implode(' ',$script));
// return the button attached to input field.
return '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get the user object.
$user = JFactory::getUser();
// Get the databse object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.system_name','a.name','a.type','a.power_version'),array('id','power_admin_component_system_name','name','type','version')));
$query->from($db->quoteName('#__componentbuilder_power', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
$query->order('a.system_name ASC');
$query->order('a.type ASC');
// Implement View Level Access (if set in table)
if (!$user->authorise('core.options', 'com_componentbuilder'))
{
$columns = $db->getTableColumns('#__componentbuilder_power');
if(isset($columns['access']))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
}
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
// if none was found, we add this to set an alternative to set custom
if (!$items)
{
$options[] = JHtml::_('select.option', '', JText::_('PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_NONE_FOUND'));
}
if ($items)
{
if ($this->multiple === false)
{
$options[] = JHtml::_('select.option', '', JText::_('PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_SELECT_AN_OPTION'));
}
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->power_admin_component_system_name . ' [' . $item->type . ' ' . $item->name . '] (v' . $item->version . ')');
}
}
return $options;
}
}

View File

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- default paths of component_dashboard form points to componentbuilder -->
<form>
<fields name="params">
<!-- default paths of component_dashboard_headers fieldset points to the plugin -->
<fieldset name="component_dashboard_headers" label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_CLASS_HEADERS"
addrulepath="/plugins/content/componentbuildercomponentdashboardheaderstabs/rules"
addfieldpath="/plugins/content/componentbuildercomponentdashboardheaderstabs/fields"
>
<fields name="component_dashboard_headers">
<!-- Add_dashboard_view Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_dashboard_view"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_VIEW_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_YES</option>
<option value="0">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_NO</option>
</field>
<!-- Dashboard_view Field. Type: Editor. (joomla) -->
<field
type="editor"
name="dashboard_view"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_DESCRIPTION"
width="100%"
height="100px"
cols="15"
rows="10"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
required="false"
validate="code"
showon="add_dashboard_view:1"
/>
<!-- Power_dashboard_view Field. Type: Powers. (custom) -->
<field
type="powers"
name="power_dashboard_view"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_DESCRIPTION"
class="list_class span12"
multiple="true"
default="0"
required="false"
showon="add_dashboard_view:1"
button="true"
/>
<!-- Add_dashboard_view_html Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_dashboard_view_html"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_VIEW_HTML_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_YES</option>
<option value="0">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_NO</option>
</field>
<!-- Dashboard_view_html Field. Type: Editor. (joomla) -->
<field
type="editor"
name="dashboard_view_html"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_HTML_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_HTML_DESCRIPTION"
width="100%"
height="100px"
cols="15"
rows="10"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
required="false"
validate="code"
showon="add_dashboard_view_html:1"
/>
<!-- Power_dashboard_view_html Field. Type: Powers. (custom) -->
<field
type="powers"
name="power_dashboard_view_html"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_HTML_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_HTML_DESCRIPTION"
class="list_class span12"
multiple="true"
default="0"
required="false"
showon="add_dashboard_view_html:1"
button="true"
/>
<!-- Add_dashboard_model Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_dashboard_model"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_MODEL_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_YES</option>
<option value="0">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_NO</option>
</field>
<!-- Dashboard_model Field. Type: Editor. (joomla) -->
<field
type="editor"
name="dashboard_model"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_MODEL_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_MODEL_DESCRIPTION"
width="100%"
height="100px"
cols="15"
rows="10"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
required="false"
validate="code"
showon="add_dashboard_model:1"
/>
<!-- Power_dashboard_model Field. Type: Powers. (custom) -->
<field
type="powers"
name="power_dashboard_model"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_MODEL_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_MODEL_DESCRIPTION"
class="list_class span12"
multiple="true"
default="0"
required="false"
showon="add_dashboard_model:1"
button="true"
/>
<!-- Add_dashboard_controller Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_dashboard_controller"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_CONTROLLER_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_YES</option>
<option value="0">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_NO</option>
</field>
<!-- Dashboard_controller Field. Type: Editor. (joomla) -->
<field
type="editor"
name="dashboard_controller"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_CONTROLLER_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_CONTROLLER_DESCRIPTION"
width="100%"
height="100px"
cols="15"
rows="10"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
required="false"
validate="code"
showon="add_dashboard_controller:1"
/>
<!-- Power_dashboard_controller Field. Type: Powers. (custom) -->
<field
type="powers"
name="power_dashboard_controller"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_CONTROLLER_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_CONTROLLER_DESCRIPTION"
class="list_class span12"
multiple="true"
default="0"
required="false"
showon="add_dashboard_controller:1"
button="true"
/>
<!-- Add_ajax_model Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_ajax_model"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_AJAX_MODEL_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_YES</option>
<option value="0">
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_NO</option>
</field>
<!-- Ajax_model Field. Type: Editor. (joomla) -->
<field
type="editor"
name="ajax_model"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_AJAX_MODEL_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_AJAX_MODEL_DESCRIPTION"
width="100%"
height="100px"
cols="15"
rows="10"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
required="false"
validate="code"
showon="add_ajax_model:1"
/>
<!-- Power_ajax_model Field. Type: Powers. (custom) -->
<field
type="powers"
name="power_ajax_model"
label="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_AJAX_MODEL_LABEL"
description="PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_AJAX_MODEL_DESCRIPTION"
class="list_class span12"
multiple="true"
default="0"
showon="add_ajax_model:1"
button="true"
/>
</fields>
</fieldset>
</fields>
</form>

1
forms/index.html Normal file
View File

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

1
index.html Normal file
View File

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

View File

@ -0,0 +1,41 @@
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS="Content - Componentbuilder Component Dashboard Headers Tabs"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DESCRIPTION="This plugin is used to set component dashboard class custom headers."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Component Dashboard Headers Tabs (v.1.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to set component dashboard class custom headers.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 6th December, 2021</small></p>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_CLASS_HEADERS="Class Headers"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_VIEW_LABEL="Target Dashboard View<br />Default Template Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_YES="Yes"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_NO="No"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_LABEL="View Header<br />
<small>(dashboard.view)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_DESCRIPTION="The file header for dashboard view."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_LABEL="Power Header<br />
<small>(dashboard.view)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_DESCRIPTION="The power header for dashboard view."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_VIEW_HTML_LABEL="Target Dashboard View<br />Class Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_HTML_LABEL="Class Header<br />
<small>(dashboard.view.html)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_HTML_DESCRIPTION="The class header for dashboard view."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_HTML_LABEL="Power Header<br />
<small>(dashboard.view.html)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_HTML_DESCRIPTION="The power header for dashboard view class."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_MODEL_LABEL="Target Dashboard Model<br />Class Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_MODEL_LABEL="Class Header<br />
<small>(dashboard.model)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_MODEL_DESCRIPTION="The class header for dashboard model."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_MODEL_LABEL="Power Header<br />
<small>(dashboard.model)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_MODEL_DESCRIPTION="The power header for dashboard model class."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_CONTROLLER_LABEL="Target Dashboard Cotroller<br />Class Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_CONTROLLER_LABEL="Class Header<br />
<small>(dashboard.controller)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_CONTROLLER_DESCRIPTION="The class header for dashboard controller."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_CONTROLLER_LABEL="Power Header<br />
<small>(dashboard.controller)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_CONTROLLER_DESCRIPTION="The power header for dashboard controller class."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_AJAX_MODEL_LABEL="Target Ajax Model<br />Class Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_AJAX_MODEL_LABEL="Class Header<br />
<small>(ajax.model)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_AJAX_MODEL_DESCRIPTION="The class header for Ajax model."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_AJAX_MODEL_LABEL="Power Header<br />
<small>(ajax.model)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_AJAX_MODEL_DESCRIPTION="The power header for Ajax model."

View File

@ -0,0 +1,41 @@
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS="Content - Componentbuilder Component Dashboard Headers Tabs"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DESCRIPTION="This plugin is used to set component dashboard class custom headers."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_XML_DESCRIPTION="<h1>Content - Componentbuilder Component Dashboard Headers Tabs (v.1.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to set component dashboard class custom headers.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 6th December, 2021</small></p>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_CLASS_HEADERS="Class Headers"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_VIEW_LABEL="Target Dashboard View<br />Default Template Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_YES="Yes"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_NO="No"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_LABEL="View Header<br />
<small>(dashboard.view)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_DESCRIPTION="The file header for dashboard view."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_LABEL="Power Header<br />
<small>(dashboard.view)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_DESCRIPTION="The power header for dashboard view."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_VIEW_HTML_LABEL="Target Dashboard View<br />Class Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_HTML_LABEL="Class Header<br />
<small>(dashboard.view.html)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_VIEW_HTML_DESCRIPTION="The class header for dashboard view."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_HTML_LABEL="Power Header<br />
<small>(dashboard.view.html)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_VIEW_HTML_DESCRIPTION="The power header for dashboard view class."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_MODEL_LABEL="Target Dashboard Model<br />Class Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_MODEL_LABEL="Class Header<br />
<small>(dashboard.model)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_MODEL_DESCRIPTION="The class header for dashboard model."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_MODEL_LABEL="Power Header<br />
<small>(dashboard.model)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_MODEL_DESCRIPTION="The power header for dashboard model class."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_DASHBOARD_CONTROLLER_LABEL="Target Dashboard Cotroller<br />Class Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_CONTROLLER_LABEL="Class Header<br />
<small>(dashboard.controller)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_DASHBOARD_CONTROLLER_DESCRIPTION="The class header for dashboard controller."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_CONTROLLER_LABEL="Power Header<br />
<small>(dashboard.controller)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_DASHBOARD_CONTROLLER_DESCRIPTION="The power header for dashboard controller class."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_ADD_AJAX_MODEL_LABEL="Target Ajax Model<br />Class Header"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_AJAX_MODEL_LABEL="Class Header<br />
<small>(ajax.model)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_AJAX_MODEL_DESCRIPTION="The class header for Ajax model."
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_AJAX_MODEL_LABEL="Power Header<br />
<small>(ajax.model)</small>"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_POWER_AJAX_MODEL_DESCRIPTION="The power header for Ajax model."

View File

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

1
language/index.html Normal file
View File

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

53
rules/code.php Normal file
View File

@ -0,0 +1,53 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder-Pro>
* @copyright Copyright (C) 2015 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('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
/**
* Form Rule (Code) class for the Joomla Platform.
*/
class JFormRuleCode extends FormRule
{
/**
* Method to test the value.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param Form $form The form object for which the field is being tested.
*
* @return boolean True if the value is valid, false otherwise.
*/
public function test(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
{
// This removes all validation (is dangerous) but needed to submit code via JCB
return true;
/**
* My idea is to add some kind of validation to improve JCB code (per/language)
*
* So at this time this code validation is used for JavaScript,CSS,HTML and PHP.
* We can see what language is being worked on with the syntax property in the $element. (in JCB)
* What complicates things is the placeholders, of both custom code, component, and view names.
* Ideally we could strip them and then validate the code to being syntactically correct.
* But since some of the placeholders form part of the class/function names and the more, it seems like we are pressed for a much more advance solution.
* If you have any ideas to how we can go about to do this, then please open an issue on github and lets begin. (this is a nice to have, so don't break a leg...)
*/
}
}

1
rules/index.html Normal file
View File

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

80
script.php Normal file
View File

@ -0,0 +1,80 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder-Pro>
* @copyright Copyright (C) 2015 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');
/**
* Content - Componentbuilder Component Dashboard Headers Tabs script file.
*
* @package PlgContentComponentbuilderComponentDashboardHeadersTabs
*/
class plgContentComponentbuilderComponentDashboardHeadersTabsInstallerScript
{
/**
* Called before any type of action
*
* @param string $route Which action is happening (install|uninstall|discover_install|update)
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, JAdapterInstance $adapter)
{
// get application
$app = JFactory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
return false;
}
if ('install' === $route)
{
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('JCB must first be installed from <a href="https://git.vdm.dev/joomla/Component-Builder-Pro/" target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
// block install
$blockInstall = true;
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3)
{
$blockInstall = false;
}
}
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB-Pro v3.0.0 or higher before installing this plugin.', 'error');
return false;
}
}
return true;
}
}