Added language strings to the ajax table headers of subforms. Adapted the export of JCB packages to also include the new tables.

This commit is contained in:
2017-10-28 05:25:33 +02:00
parent 9f7ee83646
commit 2bab5e2721
322 changed files with 600 additions and 446 deletions

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 234 of this MVC
@build 26th October, 2017
@version @update number 243 of this MVC
@build 27th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_view.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 234 of this MVC
@build 26th October, 2017
@version @update number 243 of this MVC
@build 27th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_views.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage ajax.php
@ -375,6 +375,66 @@ class ComponentbuilderModelAjax extends JModelList
'adminview' => 'setItemNames',
'siteview' => 'setItemNames',
'before' => 'setItemNames');
protected function getLanguage($key)
{
$language = array(
// Admin View (fields)
'field' => JText::_('COM_COMPONENTBUILDER_FIELD'),
'list' => JText::_('COM_COMPONENTBUILDER_ADMIN_LIST'),
'order_list' => JText::_('COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS'),
'title' => JText::_('COM_COMPONENTBUILDER_TITLE'),
'alias' => JText::_('COM_COMPONENTBUILDER_ALIAS'),
'sort' => JText::_('COM_COMPONENTBUILDER_SORTABLE'),
'search' => JText::_('COM_COMPONENTBUILDER_SEARCHABLE'),
'filter' => JText::_('COM_COMPONENTBUILDER_FILTER'),
'link' => JText::_('COM_COMPONENTBUILDER_LINK'),
'permission' => JText::_('COM_COMPONENTBUILDER_PERMISSIONS'),
'tab' => JText::_('COM_COMPONENTBUILDER_TAB'),
'alignment' => JText::_('COM_COMPONENTBUILDER_ALIGNMENT'),
'order_edit' => JText::_('COM_COMPONENTBUILDER_ORDER_IN_EDIT'),
// Admin View (conditions)
'target_field' => JText::_('COM_COMPONENTBUILDER_TARGET_FIELDS'),
'target_behavior' => JText::_('COM_COMPONENTBUILDER_TARGET_BEHAVIOR'),
'target_relation' => JText::_('COM_COMPONENTBUILDER_TARGET_RELATION'),
'match_field' => JText::_('COM_COMPONENTBUILDER_MATCH_FIELD'),
'match_behavior' => JText::_('COM_COMPONENTBUILDER_MATCH_BEHAVIOR'),
'match_options' => JText::_('COM_COMPONENTBUILDER_MATCH_OPTIONS'),
// Joomla Component
'menu' => JText::_('COM_COMPONENTBUILDER_ADD_MENU'),
'metadata' => JText::_('COM_COMPONENTBUILDER_HAS_METADATA'),
'default_view' => JText::_('COM_COMPONENTBUILDER_DEFAULT_VIEW'),
'access' => JText::_('COM_COMPONENTBUILDER_ADD_ACCESS'),
'component_site_views|=VDM=|access' => JText::_('COM_COMPONENTBUILDER_PUBLIC_ACCESS'),
'mainmenu' => JText::_('COM_COMPONENTBUILDER_MAIN_MENU'),
'dashboard_list' => JText::_('COM_COMPONENTBUILDER_DASHBOARD_LIST_OF_RECORDS'),
'dashboard_add' => JText::_('COM_COMPONENTBUILDER_DASHBOARD_ADD_RECORD'),
'submenu' => JText::_('COM_COMPONENTBUILDER_SUBMENU'),
'checkin' => JText::_('COM_COMPONENTBUILDER_AUTO_CHECKIN'),
'history' => JText::_('COM_COMPONENTBUILDER_KEEP_HISTORY'),
'port' => JText::_('COM_COMPONENTBUILDER_EXPORTIMPORT_DATA'),
'edit_create_site_view' => JText::_('COM_COMPONENTBUILDER_EDITCREATE_SITE_VIEW'),
'icomoon' => JText::_('COM_COMPONENTBUILDER_ICON'),
'customadminview' => JText::_('COM_COMPONENTBUILDER_VIEW'),
'adminviews' => JText::_('COM_COMPONENTBUILDER_VIEWS'),
'adminview' => JText::_('COM_COMPONENTBUILDER_VIEW'),
'siteview' => JText::_('COM_COMPONENTBUILDER_VIEW'),
'before' => JText::_('COM_COMPONENTBUILDER_ORDER_BEFORE')
);
// check if a unique value is available
if (isset($language[$key]))
{
return $language[$key];
}
// check a shared value is available
$keys = explode('|=VDM=|', $key);
if (isset($language[$keys[1]]))
{
return $language[$keys[1]];
}
return ComponentbuilderHelper::safeString($keys[1], 'Ww');
}
protected function getSubformTable($idName, $data)
{
@ -392,7 +452,10 @@ class ComponentbuilderModelAjax extends JModelList
{
foreach ($headers as $header => $value)
{
$head[$header] = '<th>' . ComponentbuilderHelper::safeString($header, 'Ww');
if (!isset($head[$header]))
{
$head[$header] = $this->getLanguage($idName . '|=VDM=|' . $header);
}
}
}
// build the rows
@ -401,16 +464,16 @@ class ComponentbuilderModelAjax extends JModelList
{
foreach ($data as $nr => $values)
{
foreach ($head as $key => $t)
foreach ($head as $key => $_header)
{
// set the value for the row
if (isset($values[$key]))
{
$this->setSubformRows($nr, $this->setSubformValue($key, $values[$key]), $rows);
$this->setSubformRows($nr, $this->setSubformValue($key, $values[$key]), $rows, $_header);
}
else
{
$this->setSubformRows($nr, $this->setSubformValue($key, ''), $rows);
$this->setSubformRows($nr, $this->setSubformValue($key, ''), $rows, $_header);
}
}
}
@ -435,7 +498,7 @@ class ComponentbuilderModelAjax extends JModelList
$table[] = "\t\t\t<table class=\"adminlist table table-striped table-bordered\">";
$table[] = "\t\t\t\t<thead>";
$table[] = "\t\t\t\t\t<tr>";
$table[] = "\t\t\t\t\t\t". implode("", $head);
$table[] = "\t\t\t\t\t\t<th>" . implode("</th><th>", $head) . "</th>";
$table[] = "\t\t\t\t\t</tr>";
$table[] = "\t\t\t\t</thead>";
$table[] = "\t\t\t\t<tbody>";
@ -468,16 +531,16 @@ class ComponentbuilderModelAjax extends JModelList
return $value;
}
protected function setSubformRows($nr, $value, &$rows)
protected function setSubformRows($nr, $value, &$rows, $_header)
{
// build rows
if (!isset($rows[$nr]))
{
$rows[$nr] = '<td>'.$value.'</td>';
$rows[$nr] = '<td data-column=" '.$_header.' ">'.$value.'</td>';
}
else
{
$rows[$nr] .= '<td>'.$value.'</td>';
$rows[$nr] .= '<td data-column=" '.$_header.' ">'.$value.'</td>';
}
}
@ -743,7 +806,7 @@ class ComponentbuilderModelAjax extends JModelList
{
return '<span style="color: #46A546;" class="icon-ok"></span>';
}
return '<span style="color: #de9494;" class="icon-delete"></span>';
return '<span style="color: #e6e6e6;" class="icon-delete"></span>';
}
protected function setTargetBehavior($header, $value)
@ -1520,8 +1583,8 @@ class ComponentbuilderModelAjax extends JModelList
$query['a']['select'] = array('id', 'system_name', 'php_preflight_install','php_postflight_install',
'php_preflight_update','php_postflight_update','php_method_uninstall',
'php_helper_admin','php_admin_event','php_helper_both','php_helper_site',
'php_site_event','php_dashboard_methods','dashboard_tab','javascript');
$query['a']['not_base64'] = array('dashboard_tab' => 'json');
'php_site_event','javascript');
$query['a']['not_base64'] = array();
$query['a']['name'] = 'system_name';
// #__componentbuilder_admin_view as b
@ -1588,6 +1651,15 @@ class ComponentbuilderModelAjax extends JModelList
$query['h']['not_base64'] = array();
$query['h']['name'] = 'name';
$query = array();
// #__componentbuilder_component_dashboard as i
$query['i'] = array();
$query['i']['table'] = 'component_dashboard';
$query['i']['view'] = 'components_dashboard';
$query['i']['select'] = array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab');
$query['i']['not_base64'] = array('dashboard_tab' => 'json');
$query['i']['name'] = 'joomla_component';
// return the query string to search
if (isset($query[$target]))
{

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 84 of this MVC
@build 13th October, 2017
@version @update number 86 of this MVC
@build 27th October, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_code.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 84 of this MVC
@build 13th October, 2017
@version @update number 86 of this MVC
@build 27th October, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_codes.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage adminsviews.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage adminviewfolderlist.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage adminviews.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage articles.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage component.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentadminmenus.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentadminviews.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage components.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customadminviews.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customfilelist.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customfolderlist.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customgets.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dbtables.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dynamicget.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dynamicgets.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fields.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fieldtypes.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage ftps.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage joomlacomponents.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage lang.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage maingets.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage matchfield.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage siteviewfolderlist.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage siteviews.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage snippets.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage targetfields.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage viewtabs.php

View File

@ -146,7 +146,7 @@
class="fieldSmall"
required="false"
first="0"
last="100"
last="20"
step="1"
/>
<!-- Title Field. Type: Checkbox. (joomla) -->

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 234 of this MVC
@build 26th October, 2017
@version @update number 243 of this MVC
@build 27th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_view.js

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 84 of this MVC
@build 13th October, 2017
@version @update number 86 of this MVC
@build 27th October, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_code.js
@ -317,7 +317,7 @@ function usedin(functioName, ide) {
jQuery('#note-usedin-not').hide();
jQuery('#note-usedin-found').hide();
jQuery('#loading-usedin').show();
var targets = ['a','b','c','d','e','f','g','h'];
var targets = ['a','b','c','d','e','f','g','h','i'];
var run = 0;
var usedinChecker = setInterval(function(){
var target = targets[run];

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 501 of this MVC
@build 26th October, 2017
@version @update number 505 of this MVC
@build 27th October, 2017
@created 6th May, 2015
@package Component Builder
@subpackage joomla_component.js

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage import.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.9
@build 27th October, 2017
@build 28th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage import_joomla_components.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 501 of this MVC
@build 26th October, 2017
@version @update number 505 of this MVC
@build 27th October, 2017
@created 6th May, 2015
@package Component Builder
@subpackage joomla_component.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 501 of this MVC
@build 26th October, 2017
@version @update number 505 of this MVC
@build 27th October, 2017
@created 6th May, 2015
@package Component Builder
@subpackage joomla_components.php
@ -186,15 +186,15 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
// create the folders
JFolder::create($this->packagePath);
// Get the basic encription.
// Get the basic encryption.
$basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encription object.
if ($basickey)
{
$basic = new FOFEncryptAes($basickey, 128);
}
// add custom code
$this->setData('custom_code', $pks, 'component');
// update $pks with returned IDs
$pks = array();
// start loading the components
$this->smartExport['joomla_component'] = array();
foreach ($items as $nr => &$item)
@ -252,27 +252,28 @@ class ComponentbuilderModelJoomla_components extends JModelList
// keep the key locked for exported data set
$this->exportPackageLinks[$keyName] = $item->export_package_link;
}
// build files
$this->moveIt($item->addfiles, 'file');
// build folders
$this->moveIt($item->addfolders, 'folder');
// component image
$this->moveIt(array('image' => array($item->image)), 'image');
// add config fields
$this->setData('field', $this->getIds($item->addconfig, 'repeatable', 'field'), 'id');
// add admin views
$this->setData('admin_view', $this->getIds($item->addadmin_views, 'repeatable', 'adminview'), 'id');
// add custom admin views
$this->setData('custom_admin_view', $this->getIds($item->addcustom_admin_views, 'repeatable', 'customadminview'), 'id');
// add site views
$this->setData('site_view', $this->getIds($item->addsite_views, 'repeatable', 'siteview'), 'id');
$this->moveIt(array($item->image), 'image');
// set the custom code ID's
$this->setCustomCodeIds($item, 'joomla_component');
// set the language strings for this component
$this->setLanguageTranslation($item->id);
// load to global object
$this->smartExport['joomla_component'][$item->id] = $item;
// add to pks
$pks[] = $item->id;
}
// load all tables linked to joomla_component
$this->setData('custom_code', $pks, 'component');
$this->setData('component_files_folders', $pks, 'joomla_component');
$this->setData('component_admin_views', $pks, 'joomla_component');
$this->setData('component_config', $pks, 'joomla_component');
$this->setData('component_site_views', $pks, 'joomla_component');
$this->setData('component_custom_admin_views', $pks, 'joomla_component');
$this->setData('component_updates', $pks, 'joomla_component');
$this->setData('component_mysql_tweaks', $pks, 'joomla_component');
$this->setData('component_custom_admin_menus', $pks, 'joomla_component');
$this->setData('component_dashboard', $pks, 'joomla_component');
// add fields and conditions
if (isset($this->exportIDs['admin_view']) && ComponentbuilderHelper::checkArray($this->exportIDs['admin_view']))
{
@ -356,11 +357,11 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
/**
* Method to get ids.
* Method to get values from repeatable or subform.
*
* @return mixed An array of ids on success, false on failure.
* @return mixed An array of values on success, false on failure.
*/
protected function getIds($values, $type, $key = null)
protected function getValues($values, $type, $key = null, $prep = 'table')
{
// the ids bucket
$bucket = array();
@ -385,7 +386,14 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
elseif (ComponentbuilderHelper::checkString($value[$key]))
{
$bucket[] = $this->_db->quote($value[$key]);
if ('table' === $prep)
{
$bucket[] = $this->_db->quote($value[$key]);
}
else
{
$bucket[] = $value[$key];
}
}
}
}
@ -396,19 +404,26 @@ class ComponentbuilderModelJoomla_components extends JModelList
return array_unique($bucket);
}
}
// check if the key is an array (targeting subform)
// check if the key is an array (targeting repeatable)
if ('repeatable' === $type && $key)
{
if (isset($values[$key]))
{
return array_map(function($id) {
if (is_numeric($id))
return array_map(function($value) use($prep){
if (is_numeric($value))
{
return $id;
return $value;
}
elseif (ComponentbuilderHelper::checkString($id))
elseif (ComponentbuilderHelper::checkString($value))
{
return $this->_db->quote($id);
if ('table' === $prep)
{
return $this->_db->quote($value);
}
else
{
return $value;
}
}
}, array_unique($values[$key]) );
}
@ -489,23 +504,55 @@ class ComponentbuilderModelJoomla_components extends JModelList
$this->smartExport[$table][$item->id] = $item;
// set the custom code ID's
$this->setCustomCodeIds($item, $table);
// actions to take if table is component_files_folders
if ('component_files_folders' === $table)
{
// build files
$this->moveIt($this->getValues($item->addfiles, 'subform', 'file', null), 'file');
// build folders
$this->moveIt($this->getValues($item->addfolders, 'subform', 'folder', null), 'folder');
}
// actions to take if table is component_config
if ('component_config' === $table)
{
// add config fields
$this->setData('field', $this->getValues($item->addconfig, 'subform', 'field'), 'id');
}
// actions to take if table is component_admin_views
if ('component_admin_views' === $table)
{
// add admin views
$this->setData('admin_view', $this->getValues($item->addadmin_views, 'subform', 'adminview'), 'id');
}
// actions to take if table is component_site_views
if ('component_site_views' === $table)
{
// add site views
$this->setData('site_view', $this->getValues($item->addsite_views, 'subform', 'siteview'), 'id');
}
// actions to take if table is component_custom_admin_views
if ('component_custom_admin_views' === $table)
{
// add custom admin views
$this->setData('custom_admin_view', $this->getValues($item->addcustom_admin_views, 'subform', 'customadminview'), 'id');
}
// actions to take if table is admin_view
if ('admin_view' === $table)
{
// add fields & conditions
$this->setExportIDs($item->id, 'admin_view');
// admin icon
$this->moveIt(array('image' => array($item->icon)), 'image');
$this->moveIt(array($item->icon), 'image');
// admin icon_add
$this->moveIt(array('image' => array($item->icon_add)), 'image');
$this->moveIt(array($item->icon_add), 'image');
// admin icon_category
$this->moveIt(array('image' => array($item->icon_category)), 'image');
$this->moveIt(array($item->icon_category), 'image');
}
// actions to take if table is admin_fields
if ('admin_fields' === $table)
{
// add fields
$this->setData('field', $this->getIds($item->addfields, 'subform', 'field'), 'id');
$this->setData('field', $this->getValues($item->addfields, 'subform', 'field'), 'id');
}
// actions to take if table is field
if ('field' === $table)
@ -555,7 +602,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
if ('custom_admin_view' === $table && isset($item->icon))
{
// view icon
$this->moveIt(array('image' => array($item->icon)), 'image');
$this->moveIt(array($item->icon), 'image');
}
// add snippets
$this->setExportIDs((int) $item->snippet, 'snippet');
@ -718,29 +765,24 @@ class ComponentbuilderModelJoomla_components extends JModelList
*
* @return bool
*/
protected function moveIt($data, $type)
protected function moveIt($paths, $type)
{
// if json convert to array
if (ComponentbuilderHelper::checkJson($data))
{
$data = json_decode($data, true);
}
// make sure we have an array
if (!ComponentbuilderHelper::checkArray($data) || !isset($data[$type]) || !ComponentbuilderHelper::checkArray($data[$type]))
if (!ComponentbuilderHelper::checkArray($paths))
{
return false;
}
// set the name of the folder
if ('file' === $type || 'folder' === $type)
{
$name = 'custom';
$folderName = 'custom';
}
if ('image' === $type)
{
$name = 'images';
$folderName = 'images';
}
// setup the type path
$tmpPath = str_replace('//', '/', $this->packagePath . '/' . $name);
$tmpPath = str_replace('//', '/', $this->packagePath . '/' . $folderName);
// create type path if not set
if (!JFolder::exists($tmpPath))
{
@ -748,7 +790,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
JFolder::create($tmpPath);
}
// now move it
foreach ($data[$type] as $item)
foreach ($paths as $item)
{
if (ComponentbuilderHelper::checkString($item))
{
@ -1116,7 +1158,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// add languages
if (isset($item->translation))
{
$this->setData('language', $this->getIds($item->translation, 'subform', 'language'), 'langtag');
$this->setData('language', $this->getValues($item->translation, 'subform', 'language'), 'langtag');
}
}
}
@ -1159,15 +1201,20 @@ class ComponentbuilderModelJoomla_components extends JModelList
protected function getCodeSearchKeys($target)
{
$targets = array();
// #__componentbuilder_joomla_component as a
// #__componentbuilder_joomla_component
$targets['joomla_component'] = array();
$targets['joomla_component']['search'] = array('php_preflight_install','php_postflight_install',
'php_preflight_update','php_postflight_update','php_method_uninstall',
'php_helper_admin','php_admin_event','php_helper_both','php_helper_site',
'php_site_event','php_dashboard_methods','dashboard_tab');
$targets['joomla_component']['not_base64'] = array('dashboard_tab' => 'json');
'php_site_event');
$targets['joomla_component']['not_base64'] = array();
// #__componentbuilder_admin_view as b
// #__componentbuilder_component_dashboard
$targets['component_dashboard'] = array();
$targets['component_dashboard']['search'] = array('php_dashboard_methods','dashboard_tab');
$targets['component_dashboard']['not_base64'] = array('dashboard_tab' => 'json');
// #__componentbuilder_admin_view
$targets['admin_view'] = array();
$targets['admin_view']['search'] = array('javascript_view_file','javascript_view_footer','javascript_views_file',
'javascript_views_footer','php_getitem','php_save','php_postsavehook','php_getitems',
@ -1177,35 +1224,35 @@ class ComponentbuilderModelJoomla_components extends JModelList
'php_import','php_import_setdata','php_import_save','html_import_view','php_ajaxmethod');
$targets['admin_view']['not_base64'] = array();
// #__componentbuilder_custom_admin_view as c
// #__componentbuilder_custom_admin_view
$targets['custom_admin_view'] = array();
$targets['custom_admin_view']['search'] = array('default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_model','php_controller');
$targets['custom_admin_view']['not_base64'] = array();
// #__componentbuilder_site_view as d
// #__componentbuilder_site_view
$targets['site_view'] = array();
$targets['site_view']['search'] = array('default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller');
$targets['site_view']['not_base64'] = array();
// #__componentbuilder_field as e
// #__componentbuilder_field
$targets['field'] = array();
$targets['field']['search'] = array('xml','javascript_view_footer','javascript_views_footer');
$targets['field']['not_base64'] = array('xml' => 'json');
// #__componentbuilder_dynamic_get as f
// #__componentbuilder_dynamic_get
$targets['dynamic_get'] = array();
$targets['dynamic_get']['search'] = array('php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems',
'php_getlistquery');
$targets['dynamic_get']['not_base64'] = array();
// #__componentbuilder_template as g
// #__componentbuilder_template
$targets['template'] = array();
$targets['template']['search'] = array('php_view','template');
$targets['template']['not_base64'] = array();
// #__componentbuilder_layout as h
// #__componentbuilder_layout
$targets['layout'] = array();
$targets['layout']['search'] = array('php_view','layout');
$targets['layout']['not_base64'] = array();