Added notice of language (tanslations) added or not added with details to compiler

Resolved gh-146 compiler error on joined db in dinamic get thanks to @mwweb & @ro-ot
Resolved gh-147 by adding the sort of fields back into the save method
Resolved gh-144 to ensure that the published tab (fields overwriting and adding) option is available again.
Resolved gh-145 by moving the subforms to their own tab in dynamic get view
Converted all repeatable fields to subform fields in Joomla component view
Moved 9 subforms and other fields to their own table and view (decopuling them fom Joomla component view), that means we added 9 more views and tables to JCB
Added all the ajax for buttons and display views to Joomla component view
Added tmp scripts all across the new areas with subforms to ensure all repeatable fields are converted. Will be removed in v2.7.0
Added synced copy, change state and delete in Joomla components view in relation to all tables linked to it (same as with admin views)
This commit is contained in:
2017-10-26 18:43:51 +02:00
parent ea650f5fc1
commit f15b67cff1
786 changed files with 41899 additions and 6752 deletions

View File

@ -105,6 +105,35 @@ class Compiler extends Infusion
}
// set the lang data now
$this->setLangFileData();
// set the language notice if it was set
if (ComponentbuilderHelper::checkArray($this->langNot) || ComponentbuilderHelper::checkArray($this->langSet))
{
if (ComponentbuilderHelper::checkArray($this->langNot))
{
foreach ($this->langNot as $tag => $percentage)
{
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> language has %s&#37; translated, you will need to translate %s&#37; of the language strings before it will be added.',
$tag, $percentage, $this->percentageLanguageAdd), 'Warning');
}
$this->app->enqueueMessage(JText::sprintf('<b>You can change this percentage of translated strings required in the global options of JCB.</b><br />Please watch this <a href=%s>tutorial for more help surrounding the JCB translations manager</a>.',
'"https://youtu.be/zzAcVkn_cWU?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE" target="_blank" title="JCB Tutorial surrounding Translation Manager"'), 'Notice');
}
// set why the strings were added
$whyAddedLang = JText::sprintf('because more then %s&#37; of the strings have been translated.', $this->percentageLanguageAdd);
if ($this->debugLinenr)
{
$whyAddedLang = JText::_('because the debugging mode is on. (debug line numbers)');
}
// show languages that were added
if (ComponentbuilderHelper::checkArray($this->langSet))
{
foreach ($this->langSet as $tag => $percentage)
{
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> language has %s&#37; translated. Was addeded %s',
$tag, $percentage, $whyAddedLang), 'Notice');
}
}
}
// move the update server into place
$this->setUpdateServer();
// set the global counters
@ -522,8 +551,6 @@ class Compiler extends Infusion
protected function addCustomCode()
{
// load error messages incase code can not be added
$app = JFactory::getApplication();
// reset all these
$this->clearFromPlaceHolders('view');
$this->clearFromPlaceHolders('arg');
@ -636,20 +663,20 @@ class Compiler extends Infusion
{
// Load escaped code since the target endhash has changed
$this->loadEscapedCode($file, $target, $lineBites);
$app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> please review the file at <b>line %s</b>. This could be due to a change to lines below the custom code.', $target['path'], $target['from_line']), 'warning');
$this->app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> please review the file at <b>line %s</b>. This could be due to a change to lines below the custom code.', $target['path'], $target['from_line']), 'warning');
}
}
else
{
// Load escaped code since the target hash has changed
$this->loadEscapedCode($file, $target, $lineBites);
$app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> please review the file at <b>line %s</b>. This could be due to a change to lines above the custom code.', $target['path'], $target['from_line']), 'warning');
$this->app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> please review the file at <b>line %s</b>. This could be due to a change to lines above the custom code.', $target['path'], $target['from_line']), 'warning');
}
}
else
{
// Give developer a notice that file is not found.
$app->enqueueMessage(JText::sprintf('File <b>%s</b> could not be found, so the custom code for this file could not be addded.', $target['path']), 'warning');
$this->app->enqueueMessage(JText::sprintf('File <b>%s</b> could not be found, so the custom code for this file could not be addded.', $target['path']), 'warning');
}
}
}

View File

@ -31,6 +31,13 @@ defined('_JEXEC') or die('Restricted access');
*/
class Get
{
/**
* The app
*
* @var object
*/
public $app;
/**
* The Params
*
@ -498,6 +505,8 @@ class Get
{
if (isset($config) && count($config))
{
// load application
$this->app = JFactory::getApplication();
// Set the params
$this->params = JComponentHelper::getParams('com_componentbuilder');
// load the compiler path
@ -1254,10 +1263,22 @@ class Get
$nr = 1;
foreach ($view->addtabs as $tab)
{
$view->tabs[$nr] = $tab['name'];
$view->tabs[$nr] = trim($tab['name']);
$nr++;
}
}
// if Details tab is not set, then set it here
if (!isset($view->tabs[1]))
{
$view->tabs[1] = 'details';
}
// always make sure that publishing is lowercase
if (($removeKey = array_search('publishing', array_map('strtolower', $view->tabs))) !== false)
{
$view->tabs[$removeKey] = 'publishing';
}
// make sure to set the publishing tab (just incase we need it)
$view->tabs[15] = 'publishing';
unset($view->addtabs);
// add permissions
$view->addpermissions = json_decode($view->addpermissions,true);
@ -2150,7 +2171,7 @@ class Get
$results = $this->db->loadObjectList();
$typeArray = array(1 => 'LEFT', 2 => 'LEFT OUTER', 3 => 'INNER', 4 => 'RIGHT', 5 => 'RIGHT OUTER');
$operatorArray = array(1 => '=', 2 => '!=', 3 => '<>', 4 => '>', 5 => '<', 6 => '>=', 7 => '<=', 8 => '!<', 9 => '!>', 10 => 'IN', 11 => 'NOT IN');
foreach ($results as $nr => &$result)
foreach ($results as $_nr => &$result)
{
// add calculations if set
if($result->addcalculation == 1 && ComponentbuilderHelper::checkString($result->php_calculation))
@ -2307,7 +2328,7 @@ class Get
$join_field = array(); // array(join_field_as, join_field)
$join_field = array_map('trim', explode('.',$option1['join_field']));
$option1['selection'] =
$this->setDataSelection($result->key, $view_code, $value, $option1['db_table'], $option1['as'], $option1['row_type'], 'db');
$this->setDataSelection($result->key, $view_code, $option1['selection'], $option1['db_table'], $option1['as'], $option1['row_type'], 'db');
$option1['key'] = $result->key;
// load to the getters
if ($option1['row_type'] == 1)

View File

@ -1206,7 +1206,7 @@ class Fields extends Structure
$this->movedPublishingFields[$viewName][$name] = $name;
}
}
elseif ($tabName === 'publishing')
elseif ($tabName === 'publishing' || $tabName === 'Publishing' )
{
if (!in_array($name, $this->defaultFields))
{

View File

@ -6119,8 +6119,8 @@ class Interpretation extends Fields
}
// start tab set
$bucket = array();
$leftside = '';
$rightside = '';
$leftside = '';
$rightside = '';
$footer = '';
$header = '';
$mainwidth = 12;
@ -6398,21 +6398,52 @@ class Interpretation extends Fields
{
$this->langContent[$this->lang][$tabLangName] = 'Publishing';
}
// TODO add new publishing fields <-- nice to have, but no time now to do this
// $this->newPublishingFields[$viewName_single]
// the default publishing items
$items = array();
foreach ($this->defaultFields as $defaultField)
$items = array('left' => array(), 'right' => array());
// Setup the default (custom) fields
// only load (1 => 'left', 2 => 'right')
$fieldsAddedRight = false;
if (isset($this->newPublishingFields[$viewName_single]))
{
if (!isset($this->movedPublishingFields[$viewName_single][$defaultField]))
foreach($this->newPublishingFields[$viewName_single] as $df_alignment => $df_items)
{
if ($defaultField != 'access')
foreach($df_items as $df_order => $df_name)
{
$items[] = $defaultField;
if ($df_alignment == 2 || $df_alignment == 1)
{
$items[$alignmentNames[$df_alignment]][$df_order] = $df_name;
}
else
{
$this->app->enqueueMessage(JText::sprintf('Your <b>%s</b> field could not be added, since the <b>%s</b> alignment position is not available in the %s (publishing) tab. Please only target <b>Left or right</b> in the publishing tab.', $df_name, $alignmentNames[$df_alignment], $viewName_single), 'warning');
}
}
elseif ($defaultField === 'access' && isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single]))
}
// set switch to trigger notice if custom fields added to right
if (ComponentbuilderHelper::checkArray($items['right']))
{
$fieldsAddedRight = true;
}
}
// load all defaults
$loadDefaultFields = array(
'left' => array('created', 'created_by', 'modified', 'modified_by'),
'right' => array('published', 'ordering', 'access', 'version', 'hits', 'id')
);
foreach ($loadDefaultFields as $d_alignment => $defaultFields)
{
foreach($defaultFields as $defaultField)
{
if (!isset($this->movedPublishingFields[$viewName_single][$defaultField]))
{
$items[] = $defaultField;
if ($defaultField != 'access')
{
$items[$d_alignment][] = $defaultField;
}
elseif ($defaultField === 'access' && isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single]))
{
$items[$d_alignment][] = $defaultField;
}
}
}
}
@ -6423,10 +6454,32 @@ class Interpretation extends Fields
$tabCodeNameLeft = 'publishing';
$tabCodeNameRight = 'metadata';
// the default publishing tiems
if (ComponentbuilderHelper::checkArray($items))
if (ComponentbuilderHelper::checkArray($items['left']) || ComponentbuilderHelper::checkArray($items['right']))
{
// load all items
$items_one = "'". implode("',".PHP_EOL."\t'", $items)."'";
$items_one = '';
// load the items into one side
if (ComponentbuilderHelper::checkArray($items['left']))
{
$items_one .= "'". implode("',".PHP_EOL."\t'", $items['left'])."'";
}
if (ComponentbuilderHelper::checkArray($items['right']))
{
// there is already fields just add these
if (strlen($items_one) > 3)
{
$items_one .= ",".PHP_EOL."\t'". implode("',".PHP_EOL."\t'", $items['right'])."'";
}
// no fields has been added yet
else
{
$items_one .= "'". implode("',".PHP_EOL."\t'", $items['right'])."'";
}
}
// only triger the info notice if there were custom fields targeted to the right alignment position.
if ($fieldsAddedRight)
{
$this->app->enqueueMessage(JText::sprintf('Your field/s added to the <b>right</b> alignment position in the %s (publishing) tab was added to the <b>left</b>. Since we have metadata fields on the right. Fields can only be loaded to the right of the publishing tab if there is no metadata fields.', $viewName_single), 'Notice');
}
// set the publishing layout
$this->setLayout($viewName_single, $tabCodeNameLeft, $items_one, 'layoutpublished');
$items_one = true;
@ -6445,40 +6498,22 @@ class Interpretation extends Fields
$tabCodeNameLeft = 'publishing';
$tabCodeNameRight = 'publlshing';
// the default publishing tiems
if (ComponentbuilderHelper::checkArray($items))
if (ComponentbuilderHelper::checkArray($items['left']) || ComponentbuilderHelper::checkArray($items['right']))
{
$items_one = array('created', 'created_by', 'modified', 'modified_by');
$items_two = array('published', 'ordering', 'access', 'version', 'hits', 'id');
// check all items
foreach ($items_one as $key_one => $item_one)
{
if (!in_array($item_one, $items))
{
unset($items_one[$key_one]);
}
}
foreach ($items_two as $key_two => $item_two)
{
if (!in_array($item_two, $items))
{
unset($items_two[$key_two]);
}
}
// load all items that remain
if (ComponentbuilderHelper::checkArray($items_one))
// load left items that remain
if (ComponentbuilderHelper::checkArray($items['left']))
{
// load all items
$items_one = "'". implode("',".PHP_EOL."\t'", $items_one)."'";
$items_one = "'". implode("',".PHP_EOL."\t'", $items['left'])."'";
// set the publishing layout
$this->setLayout($viewName_single, $tabCodeNameLeft, $items_one, 'layoutpublished');
$items_one = true;
}
// load all items that remain
if (ComponentbuilderHelper::checkArray($items_two))
// load right items that remain
if (ComponentbuilderHelper::checkArray($items['right']))
{
// load all items
$items_two = "'". implode("',".PHP_EOL."\t'", $items_two)."'";
$items_two = "'". implode("',".PHP_EOL."\t'", $items['right'])."'";
// set the publishing layout
$this->setLayout($viewName_single, $tabCodeNameRight, $items_two, 'layoutpublished');
$items_two = true;

View File

@ -36,6 +36,8 @@ class Infusion extends Interpretation
public $importCustomScripts = array();
public $langFiles = array();
public $removeSiteFolder = false;
public $langNot = array();
public $langSet = array();
/**
* Constructor
@ -1199,18 +1201,28 @@ class Infusion extends Interpretation
{
foreach ($areas as $area => $languageStrings)
{
// force load if debug lines are added
if (!$this->debugLinenr)
// only log messages for none en-GB translations
if ('en-GB' !== $tag)
{
// check if we sould install this translation
$dif = bcdiv(count($languageStrings), $mainLangLoader[$area]);
$percentage = bcmul($dif, 100);
if ($percentage < $this->percentageLanguageAdd)
$langStringNr = count($languageStrings);
$langStringSum = bcmul($langStringNr, 100);
$percentage = bcdiv($langStringSum, $mainLangLoader[$area]);
$stringNAme = ($langStringNr == 1) ? '(string ' . $tag . ' translated)' : '(strings ' . $tag . ' translated)';
// force load if debug lines are added
if (!$this->debugLinenr)
{
// dont add
continue;
// check if we sould install this translation
if ($percentage < $this->percentageLanguageAdd)
{
// dont add
$this->langNot[$area . ' ' . $tag] = '<b>' . $mainLangLoader[$area] . '</b>(total en-GB strings) only <b>' . $langStringNr . '</b>' . $stringNAme . ' = ' . $percentage;
continue;
}
}
// show if it was added as well
$this->langSet[$area . ' ' . $tag] = '<b>' . $mainLangLoader[$area] . '</b>(total en-GB strings) and <b>' . $langStringNr . '</b>' . $stringNAme . ' = ' . $percentage;
}
// set naming convention
$p = 'admin';
$t = '';
if (strpos($area, 'site') !== false)

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.8
@build 21st October, 2017
@version 2.5.9
@build 26th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.8
@build 21st October, 2017
@version 2.5.9
@build 26th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilderemail.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.8
@build 21st October, 2017
@version 2.5.9
@build 26th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage headercheck.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.8
@build 21st October, 2017
@version 2.5.9
@build 26th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage batch_.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.8
@build 21st October, 2017
@version 2.5.9
@build 26th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage indenter.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.8
@build 21st October, 2017
@version 2.5.9
@build 26th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage js.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.8
@build 21st October, 2017
@version 2.5.9
@build 26th October, 2017
@created 30th April, 2015
@package Component Builder
@subpackage minify.php