Skip to content

Commit

Permalink
Few more corrections to the category filter, and field integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Llewellynvdm committed Jun 9, 2019
1 parent 37d3f14 commit c966720
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -146,7 +146,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 7th June, 2019
+ *Last Build*: 9th June, 2019
+ *Version*: 2.9.18
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
Expand Down
2 changes: 1 addition & 1 deletion admin/README.txt
Expand Up @@ -146,7 +146,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 7th June, 2019
+ *Last Build*: 9th June, 2019
+ *Version*: 2.9.18
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
Expand Down
2 changes: 1 addition & 1 deletion admin/helpers/compiler/b_Structure.php
Expand Up @@ -774,7 +774,7 @@ private function setStatic()
{
if (ComponentbuilderHelper::checkObject($this->joomlaVersionData->move->static))
{
$codeName = ComponentbuilderHelper::safeString($this->componentData->name_code);
$codeName = $this->componentCodeName;
// TODO needs more looking at this must be dynamic actualy
$this->notNew[] = 'PHPExcel.php';
$this->notNew[] = 'LICENSE.txt';
Expand Down
5 changes: 5 additions & 0 deletions admin/helpers/compiler/c_Fields.php
Expand Up @@ -2702,6 +2702,11 @@ public function setBuilders($langLabel, $langView, $view_name_single, $view_name
}
// get the xml extension name
$_extension = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'extension="', '"'), $this->placeholders);
// if they left out the extention for some reason
if (!ComponentbuilderHelper::checkString($_extension))
{
$_extension = 'com_' . $this->componentCodeName . '.' . $otherView;
}
// load the category builder
$this->categoryBuilder[$view_name_list] = array('code' => $name, 'name' => $listLangName, 'extension' => $_extension);
// also set code name for title alias fix
Expand Down
58 changes: 36 additions & 22 deletions admin/helpers/compiler/e_Interpretation.php
Expand Up @@ -7501,11 +7501,11 @@ public function setEditBody(&$view)
$header = '';
$mainwidth = 12;
$sidewidth = 0;
// sort the tabs based on key order
ksort($this->tabCounter[$viewName_single]);
// start tab builinging loop
foreach ($this->tabCounter[$viewName_single] as $tabNr => $tabName)
{
// check if we must load a custom tab

$tabWidth = 12;
$lrCounter = 0;
// set tab lang
Expand All @@ -7530,6 +7530,7 @@ public function setEditBody(&$view)
$buildLayout = false;
}
}
// build layout since just fields
if ($buildLayout)
{
// sort to make sure it loads left first
Expand All @@ -7542,7 +7543,9 @@ public function setEditBody(&$view)
// reset each time
$items = '';
$itemCounter = 0;
// sort the names based on order of keys
ksort($names);
// build the items array for this alignment
foreach ($names as $nr => $name)
{
if ($itemCounter == 0)
Expand All @@ -7555,6 +7558,7 @@ public function setEditBody(&$view)
}
$itemCounter++;
}
// based on alignment build the layout
switch ($alignment)
{
case 1: // left
Expand Down Expand Up @@ -10651,7 +10655,7 @@ public function setFilterFunctions($viewName_single, $viewName_list)
{
$function = array();
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
foreach ($this->filterBuilder[$viewName_list] as $filter)
{
if ($filter['type'] != 'category' && ComponentbuilderHelper::checkArray($filter['custom']) && $filter['custom']['extends'] === 'user')
Expand Down Expand Up @@ -10985,8 +10989,18 @@ public function setRouterCategoryViews($viewName_single, $viewName_list)
{
if (isset($this->categoryBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list]))
{
// get the actual extention
$_extension = $this->categoryBuilder[$viewName_list]['extension'];
$_extension = explode('.', $_extension);
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
if (ComponentbuilderHelper::checkArray($_extension))
{
$component = str_replace('com_', '', $_extension[0]);
}
else
{
$component = $this->componentCodeName;
}
// check if category has another name
if (isset($this->catOtherName[$viewName_list]) && ComponentbuilderHelper::checkArray($this->catOtherName[$viewName_list]))
{
Expand All @@ -11012,10 +11026,10 @@ public function setRouterCategoryViews($viewName_single, $viewName_list)
// set script to global helper file
$includeHelper = array();
$includeHelper[] = "\n//" . $this->setLine(__LINE__) . "Insure this view category file is loaded.";
$includeHelper[] = "\$classname = '" . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . ucfirst($viewName_list) . "Categories';";
$includeHelper[] = "\$classname = '" . ucfirst( $component ) . ucfirst($viewName_list) . "Categories';";
$includeHelper[] = "if (!class_exists(\$classname))";
$includeHelper[] = "{";
$includeHelper[] = $this->_t(1) . "\$path = JPATH_SITE . '/components/com_" . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . "/helpers/category" . $viewName_list . ".php';";
$includeHelper[] = $this->_t(1) . "\$path = JPATH_SITE . '/components/com_" . $component . "/helpers/category" . $viewName_list . ".php';";
$includeHelper[] = $this->_t(1) . "if (is_file(\$path))";
$includeHelper[] = $this->_t(1) . "{";
$includeHelper[] = $this->_t(2) . "include_once \$path;";
Expand All @@ -11026,11 +11040,11 @@ public function setRouterCategoryViews($viewName_single, $viewName_list)
// return category view string
if (isset($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh]) && ComponentbuilderHelper::checkString($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh]))
{
return "," . PHP_EOL . $this->_t(3) . '"com_' . $component . '.' . $otherViews . '" => "' . $otherView . '"';
return "," . PHP_EOL . $this->_t(3) . '"' . $this->categoryBuilder[$viewName_list]['extension'] . '" => "' . $otherView . '"';
}
else
{
return PHP_EOL . $this->_t(3) . '"com_' . $component . '.' . $otherViews . '" => "' . $otherView . '"';
return PHP_EOL . $this->_t(3) . '"' . $this->categoryBuilder[$viewName_list]['extension'] . '" => "' . $otherView . '"';
}
}
return '';
Expand All @@ -11040,7 +11054,7 @@ public function setJcontrollerAllowAdd($viewName_single, $viewName_list)
{
$allow = array();
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
// prepare custom permission script
$customAllow = $this->getCustomScriptBuilder('php_allowadd', $viewName_single, '', null, true);
// setup correct core target
Expand Down Expand Up @@ -11142,7 +11156,7 @@ public function setJcontrollerAllowEdit($viewName_single, $viewName_list)
{
$allow = array();
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
// prepare custom permission script
$customAllow = $this->getCustomScriptBuilder('php_allowedit', $viewName_single, '', null, true);
// setup correct core target
Expand Down Expand Up @@ -11352,7 +11366,7 @@ public function setJcontrollerAllowEdit($viewName_single, $viewName_list)
public function setJmodelAdminGetForm($viewName_single, $viewName_list)
{
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
// allways load these
$allow = array();
$allow[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the form.";
Expand Down Expand Up @@ -11655,7 +11669,7 @@ public function setJmodelAdminAllowEdit($viewName_single, $viewName_list)
{
$allow = array();
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
// prepare custom permission script
$customAllow = $this->getCustomScriptBuilder('php_allowedit', $viewName_single, $this->_t(2) . "\$recordId = (int) isset(\$data[\$key]) ? \$data[\$key] : 0;" . PHP_EOL);
// setup correct core target
Expand Down Expand Up @@ -11693,7 +11707,7 @@ public function setJmodelAdminCanDelete($viewName_single, $viewName_list)
{
$allow = array();
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
// setup correct core target
$coreLoad = false;
if (isset($this->permissionCore[$viewName_single]))
Expand Down Expand Up @@ -11777,7 +11791,7 @@ public function setJmodelAdminCanEditState($viewName_single, $viewName_list)
{
$allow = array();
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
// setup correct core target
$coreLoad = false;
if (isset($this->permissionCore[$viewName_single]))
Expand Down Expand Up @@ -11878,7 +11892,7 @@ public function setJviewListCanDo($viewName_single, $viewName_list)
{
$allow = array();
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
// setup correct core target
$coreLoad = false;
if (isset($this->permissionCore[$viewName_single]))
Expand Down Expand Up @@ -11941,7 +11955,7 @@ public function setFieldSetAccessControl(&$view)
if ($view != 'component')
{
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
// set label
$label = 'Permissions in relation to this ' . $view;
// set the access fieldset
Expand Down Expand Up @@ -13428,7 +13442,7 @@ public function setSubMenus()
// main lang prefix
$lang = $this->langPrefix . '_SUBMENU';
// set the code name
$codeName = ComponentbuilderHelper::safeString($this->componentData->name_code);
$codeName = $this->componentCodeName;
// set default dashboard
if (!ComponentbuilderHelper::checkString($this->dynamicDashboard))
{
Expand Down Expand Up @@ -13672,7 +13686,7 @@ public function setMainMenus()
// main lang prefix
$lang = $this->langPrefix . '_MENU';
// set the code name
$codeName = ComponentbuilderHelper::safeString($this->componentData->name_code);
$codeName = $this->componentCodeName;
// default prefix is none
$prefix = '';
// check if local is set
Expand Down Expand Up @@ -13844,17 +13858,17 @@ public function setConfigFieldsets($timer = 0)
// set the custom fields
if (isset($this->componentData->config) && ComponentbuilderHelper::checkArray($this->componentData->config))
{
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;
$viewName = 'config';
$listViewName = 'configs';
// set place holders
$placeholders = array();
$placeholders[$this->hhh . 'component' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentData->name_code);
$placeholders[$this->hhh . 'component' . $this->hhh] = $this->componentCodeName;
$placeholders[$this->hhh . 'Component' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'F');
$placeholders[$this->hhh . 'COMPONENT' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U');
$placeholders[$this->hhh . 'view' . $this->hhh] = $viewName;
$placeholders[$this->hhh . 'views' . $this->hhh] = $listViewName;
$placeholders[$this->bbb . 'component' . $this->ddd] = $placeholders[$this->hhh . 'component' . $this->hhh];
$placeholders[$this->bbb . 'component' . $this->ddd] = $this->componentCodeName;
$placeholders[$this->bbb . 'Component' . $this->ddd] = $placeholders[$this->hhh . 'Component' . $this->hhh];
$placeholders[$this->bbb . 'COMPONENT' . $this->ddd] = $placeholders[$this->hhh . 'COMPONENT' . $this->hhh];
$placeholders[$this->bbb . 'view' . $this->ddd] = $viewName;
Expand Down Expand Up @@ -14136,7 +14150,7 @@ public function setGroupControlConfigFieldsets($lang)
public function setGlobalConfigFieldsets($lang, $autorName, $autorEmail)
{
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$component = $this->componentCodeName;

// start building field set for config
$this->configFieldSets[] = '<fieldset';
Expand Down
2 changes: 1 addition & 1 deletion componentbuilder.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>7th June, 2019</creationDate>
<creationDate>9th June, 2019</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
Expand Down
4 changes: 2 additions & 2 deletions site/helpers/category.php
Expand Up @@ -17,7 +17,7 @@
*/

//Insure this view category file is loaded.
$classname = 'componentbuilderFieldsCategories';
$classname = 'ComponentbuilderFieldsCategories';
if (!class_exists($classname))
{
$path = JPATH_SITE . '/components/com_componentbuilder/helpers/categoryfields.php';
Expand All @@ -27,7 +27,7 @@
}
}
//Insure this view category file is loaded.
$classname = 'componentbuilderFieldtypesCategories';
$classname = 'ComponentbuilderFieldtypesCategories';
if (!class_exists($classname))
{
$path = JPATH_SITE . '/components/com_componentbuilder/helpers/categoryfieldtypes.php';
Expand Down

0 comments on commit c966720

Please sign in to comment.