diff --git a/README.md b/README.md
index e0bc07564..e04a07bd7 100644
--- a/README.md
+++ b/README.md
@@ -150,7 +150,7 @@ TODO
+ *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
-+ *Line count*: **206669**
++ *Line count*: **206638**
+ *Field count*: **1136**
+ *File count*: **1344**
+ *Folder count*: **209**
diff --git a/admin/README.txt b/admin/README.txt
index e0bc07564..e04a07bd7 100644
--- a/admin/README.txt
+++ b/admin/README.txt
@@ -150,7 +150,7 @@ TODO
+ *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
-+ *Line count*: **206669**
++ *Line count*: **206638**
+ *Field count*: **1136**
+ *File count*: **1344**
+ *Folder count*: **209**
diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php
index b103231ff..70bf10151 100644
--- a/admin/helpers/compiler/e_Interpretation.php
+++ b/admin/helpers/compiler/e_Interpretation.php
@@ -201,6 +201,13 @@ class Interpretation extends Fields
protected $hasIdRequest = array();
protected $libwarning = array();
+ /**
+ * alignment names
+ *
+ * @var array
+ */
+ protected $alignmentOptions = array(1 => 'left', 2 => 'right', 3 => 'fullwidth', 4 => 'above', 5 => 'under', 6 => 'leftside', 7 => 'rightside');
+
/**
* Constructor
*/
@@ -7445,219 +7452,39 @@ class Interpretation extends Fields
return '';
}
+ /**
+ * set Edit Body
+ *
+ * @param array $view The view data
+ *
+ * @return string The edit body
+ *
+ */
public function setEditBody(&$view)
{
// set view name
- $viewName_single = ComponentbuilderHelper::safeString($view['settings']->name_single);
- // alignment
- $alignmentNames = array(1 => 'left', 2 => 'right', 3 => 'fullwidth', 4 => 'above', 5 => 'under', 6 => 'leftside', 7 => 'rightside');
+ $view_name_single = ComponentbuilderHelper::safeString($view['settings']->name_single);
// main lang prefix
- $langView = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($viewName_single, 'U');
-
- if (isset($this->layoutBuilder[$viewName_single]) && ComponentbuilderHelper::checkArray($this->layoutBuilder[$viewName_single]))
+ $langView = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($view_name_single, 'U');
+ // check if the load build is set for this view
+ if (isset($this->layoutBuilder[$view_name_single]) && ComponentbuilderHelper::checkArray($this->layoutBuilder[$view_name_single]))
{
- // set the linked view tabs
- $linkedTab = array();
+ // reset the linked keys
$keys = array();
- // setup correct core target
- $coreLoad = false;
- if (isset($this->permissionCore[$viewName_single]))
- {
- $core = $this->permissionCore[$viewName_single];
- $coreLoad = true;
- }
- if (isset($this->linkedAdminViews[$viewName_single]) && ComponentbuilderHelper::checkArray($this->linkedAdminViews[$viewName_single]))
- {
- foreach ($this->linkedAdminViews[$viewName_single] as $linkedView)
- {
- $tabName = $view['settings']->tabs[(int) $linkedView['tab']];
- $this->tabCounter[$viewName_single][$linkedView['tab']] = $tabName;
- $linkedTab[$linkedView['adminview']] = $linkedView['tab'];
- if (ComponentbuilderHelper::checkString($linkedView['key']) && ComponentbuilderHelper::checkString($linkedView['parentkey']))
- {
- $keys[$linkedView['adminview']] = array('key' => $linkedView['key'], 'parentKey' => $linkedView['parentkey']);
- }
- else
- {
- $keys[$linkedView['adminview']] = array('key' => null, 'parentKey' => null);
- }
- if (isset($linkedView['addnew']))
- {
- $keys[$linkedView['adminview']]['addNewButton'] = (int) $linkedView['addnew'];
- }
- else
- {
- $keys[$linkedView['adminview']]['addNewButton'] = 0;
- }
- }
- }
+ $linkedViewIdentifier = array();
+ // set the linked view tabs
+ $linkedTab = $this->getEditBodyLinkedAdminViewsTabs($view, $view_name_single, $keys, $linkedViewIdentifier);
// custom tab searching array
$searchTabs = array();
- // start tab set
- $bucket = array();
+ // reset tab values
$leftside = '';
$rightside = '';
$footer = '';
$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)
- {
- $tabWidth = 12;
- $lrCounter = 0;
- // set tab lang
- $tabLangName = $langView . '_' . ComponentbuilderHelper::safeString($tabName, 'U');
- // set tab code name
- $tabCodeName = ComponentbuilderHelper::safeString($tabName);
- /// set the values to use in search latter
- $searchTabs[$tabCodeName] = $tabNr;
- // add to lang array
- if (!isset($this->langContent[$this->lang][$tabLangName]))
- {
- $this->langContent[$this->lang][$tabLangName] = $tabName;
- }
- // check if linked view belongs to this tab
- $buildLayout = true;
- $linkedViewId = '';
- if (ComponentbuilderHelper::checkArray($linkedTab))
- {
- if (($linkedViewId = array_search($tabNr, $linkedTab)) !== false)
- {
- // don't build
- $buildLayout = false;
- }
- }
- // build layout since just fields
- if ($buildLayout)
- {
- // sort to make sure it loads left first
- $alignments = $this->layoutBuilder[$viewName_single][$tabName];
- ksort($alignments);
- foreach ($alignments as $alignment => $names)
- {
- // set layout code name
- $layoutCodeName = $tabCodeName . '_' . $alignmentNames[$alignment];
- // 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)
- {
- $items .= "'" . $name . "'";
- }
- else
- {
- $items .= "," . PHP_EOL . $this->_t(1) . "'" . $name . "'";
- }
- $itemCounter++;
- }
- // based on alignment build the layout
- switch ($alignment)
- {
- case 1: // left
- case 2: // right
- // count
- $lrCounter++;
- // set as items layout
- $this->setLayout($viewName_single, $layoutCodeName, $items, 'layoutitems');
- // set the lang to tab
- $bucket[$tabCodeName]['lang'] = $tabLangName;
- // load the body
- if (!isset($bucket[$tabCodeName][(int) $alignment]))
- {
- $bucket[$tabCodeName][(int) $alignment] = '';
- }
- $bucket[$tabCodeName][(int) $alignment] .= "";
- break;
- case 3: // fullwidth
- // set as items layout
- $this->setLayout($viewName_single, $layoutCodeName, $items, 'layoutfull');
- // set the lang to tab
- $bucket[$tabCodeName]['lang'] = $tabLangName;
- // load the body
- if (!isset($bucket[$tabCodeName][(int) $alignment]))
- {
- $bucket[$tabCodeName][(int) $alignment] = '';
- }
- $bucket[$tabCodeName][(int) $alignment] .= "";
- break;
- case 4: // above
- // set as title layout
- $this->setLayout($viewName_single, $layoutCodeName, $items, 'layouttitle');
- // load to header
- $header .= PHP_EOL . $this->_t(1) . "";
- break;
- case 5: // under
- // set as title layout
- $this->setLayout($viewName_single, $layoutCodeName, $items, 'layouttitle');
- // load to footer
- $footer .= PHP_EOL . PHP_EOL . "
" . PHP_EOL . "";
- break;
- case 6: // left side
- $tabWidth = $tabWidth - 2;
- // set as items layout
- $this->setLayout($viewName_single, $layoutCodeName, $items, 'layoutitems');
- // load the body
- $leftside .= PHP_EOL . $this->_t(1) . "";
- break;
- case 7: // right side
- $tabWidth = $tabWidth - 2;
- // set as items layout
- $this->setLayout($viewName_single, $layoutCodeName, $items, 'layoutitems');
- // load the body
- $rightside .= PHP_EOL . $this->_t(1) . "";
- break;
- }
- }
- }
- else
- {
- // set layout code name
- $layoutCodeName = $tabCodeName . '_fullwidth';
- // set identifiers
- $linkedViewIdentifier[$linkedViewId] = $tabCodeName;
- //set function name
- $codeName = ComponentbuilderHelper::safeString($this->uniquekey(3) . $tabCodeName);
- // set as items layout
- $this->setLayout($viewName_single, $layoutCodeName, $codeName, 'layoutlinkedview');
- // set the lang to tab
- $bucket[$tabCodeName]['lang'] = $tabLangName;
- // set all the linked view stuff
- $this->secondRunAdmin['setLinkedView'][] = array(
- 'viewId' => $linkedViewId,
- 'viewName_single' => $viewName_single,
- 'codeName' => $codeName,
- 'layoutCodeName' => $layoutCodeName,
- 'key' => $keys[$linkedViewId]['key'],
- 'parentKey' => $keys[$linkedViewId]['parentKey'],
- 'addNewButon' => $keys[$linkedViewId]['addNewButton']);
- // load the body
- if (!isset($bucket[$tabCodeName][3]))
- {
- $bucket[$tabCodeName][3] = '';
- }
- $bucket[$tabCodeName][3] .= "";
- }
- // width calculator :)
- if ($tabWidth == 8)
- {
- $mainwidth = 8;
- $sidewidth = 2;
- }
- elseif ($tabWidth == 10 && $mainwidth != 8)
- {
- $mainwidth = 9;
- $sidewidth = 3;
- }
- $bucket[$tabCodeName]['lr'] = $lrCounter;
- }
+ // get the tabs with positions
+ $tabBucket = $this->getEditBodyTabs($view_name_single, $langView, $linkedTab, $keys, $linkedViewIdentifier, $searchTabs, $leftside, $rightside, $footer, $header, $mainwidth, $sidewidth);
// tab counter
$tabCounter = 0;
// check if width is still 12
@@ -7672,64 +7499,28 @@ class Interpretation extends Fields
{
$body .= PHP_EOL . $this->_t(1) . '
';
}
- // now build the template
- foreach ($bucket as $tabCodeName => $posions)
+ // now build the dynamic tabs
+ foreach ($tabBucket as $tabCodeName => $positions)
{
- // check main if both left and right is set
- $lrCounter = $posions['lr'];
// get lang string
- $tabLangName = $posions['lang'];
- // build main center
+ $tabLangName = $positions['lang'];
+ // build main center position
$main = '';
$mainbottom = '';
- foreach ($posions as $posion => $string)
- {
- if ($lrCounter == 2)
- {
- switch ($posion)
- {
- case 1: // left
- case 2: // right
- $main .= PHP_EOL . $this->_t(3) . '
";
+ // add main body bottom div if needed
if (strlen($mainbottom) > 0)
{
// add the main bottom
@@ -7772,255 +7564,38 @@ class Interpretation extends Fields
$body .= $mainbottom;
$body .= PHP_EOL . $this->_t(2) . "
";
}
+ // end addtab body
$body .= PHP_EOL . $this->_t(1) . "";
+ // if we had permissions added
if ($closeIT)
{
$body .= PHP_EOL . $this->_t(1) . "";
}
// check if custom tab must be added
- if (($_customTabHTML = $this->addCustomTabs($searchTabs[$tabCodeName], $viewName_single, 2)) !== false)
+ if (($_customTabHTML = $this->addCustomTabs($searchTabs[$tabCodeName], $view_name_single, 2)) !== false)
{
$body .= $_customTabHTML;
}
// set counter
$tabCounter++;
}
- // add option to load forms loded in via plugins (TODO) we may want to move these tab locations
+ // add option to load forms loaded in via plugins (TODO) we may want to move these tab locations
$body .= PHP_EOL . PHP_EOL . $this->_t(1) . "ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>";
- $body .= PHP_EOL . $this->_t(1) . "tab_name = '" . $viewName_single . "Tab'; ?>";
+ $body .= PHP_EOL . $this->_t(1) . "tab_name = '" . $view_name_single . "Tab'; ?>";
$body .= PHP_EOL . $this->_t(1) . "";
- // set default publishing tab lang
- $tabLangName = $langView . '_PUBLISHING';
- // add to lang array
- if (!isset($this->langContent[$this->lang][$tabLangName]))
- {
- $this->langContent[$this->lang][$tabLangName] = 'Publishing';
- }
- // the default publishing items
- $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]))
- {
- foreach ($this->newPublishingFields[$viewName_single] as $df_alignment => $df_items)
- {
- foreach ($df_items as $df_order => $df_name)
- {
- if ($df_alignment == 2 || $df_alignment == 1)
- {
- $items[$alignmentNames[$df_alignment]][$df_order] = $df_name;
- }
- else
- {
- $this->app->enqueueMessage(JText::_('
Field Warning
'), 'Warning');
- $this->app->enqueueMessage(JText::sprintf('Your %s field could not be added, since the %s alignment position is not available in the %s (publishing) tab. Please only target Left or right in the publishing tab.', $df_name, $alignmentNames[$df_alignment], $viewName_single), 'Warning');
- }
- }
- }
- // 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]))
- {
- 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;
- }
- }
- }
- }
- // check if metadata is added to this view
- if (isset($this->metadataBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName_single]))
- {
- // set default publishing tab code name
- $tabCodeNameLeft = 'publishing';
- $tabCodeNameRight = 'metadata';
- // the default publishing tiems
- if (ComponentbuilderHelper::checkArray($items['left']) || ComponentbuilderHelper::checkArray($items['right']))
- {
- $items_one = '';
- // load the items into one side
- if (ComponentbuilderHelper::checkArray($items['left']))
- {
- $items_one .= "'" . implode("'," . PHP_EOL . $this->_t(1) . "'", $items['left']) . "'";
- }
- if (ComponentbuilderHelper::checkArray($items['right']))
- {
- // there is already fields just add these
- if (strlen($items_one) > 3)
- {
- $items_one .= "," . PHP_EOL . $this->_t(1) . "'" . implode("'," . PHP_EOL . $this->_t(1) . "'", $items['right']) . "'";
- }
- // no fields has been added yet
- else
- {
- $items_one .= "'" . implode("'," . PHP_EOL . $this->_t(1) . "'", $items['right']) . "'";
- }
- }
- // only triger the info notice if there were custom fields targeted to the right alignment position.
- if ($fieldsAddedRight)
- {
- $this->app->enqueueMessage(JText::_('
Field Notice
'), 'Notice');
- $this->app->enqueueMessage(JText::sprintf('Your field/s added to the right alignment position in the %s (publishing) tab was added to the left. 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;
- }
- else
- {
- $items_one = false;
- }
- // set the metadata layout
- $this->setLayout($viewName_single, $tabCodeNameRight, false, 'layoutmetadata');
- $items_two = true;
- }
- else
- {
- // set default publishing tab code name
- $tabCodeNameLeft = 'publishing';
- $tabCodeNameRight = 'publlshing';
- // the default publishing tiems
- if (ComponentbuilderHelper::checkArray($items['left']) || ComponentbuilderHelper::checkArray($items['right']))
- {
- // load left items that remain
- if (ComponentbuilderHelper::checkArray($items['left']))
- {
- // load all items
- $items_one = "'" . implode("'," . PHP_EOL . $this->_t(1) . "'", $items['left']) . "'";
- // set the publishing layout
- $this->setLayout($viewName_single, $tabCodeNameLeft, $items_one, 'layoutpublished');
- $items_one = true;
- }
- // load right items that remain
- if (ComponentbuilderHelper::checkArray($items['right']))
- {
- // load all items
- $items_two = "'" . implode("'," . PHP_EOL . $this->_t(1) . "'", $items['right']) . "'";
- // set the publishing layout
- $this->setLayout($viewName_single, $tabCodeNameRight, $items_two, 'layoutpublished');
- $items_two = true;
- }
- }
- else
- {
- $items_one = false;
- $items_two = false;
- }
- }
- if ($items_one && $items_two)
- {
- $classs = "span6";
- }
- elseif ($items_one || $items_two)
- {
- $classs = "span12";
- }
- // only load this if needed
- if ($items_one || $items_two)
- {
- // check if the item has permissions.
- $publishingPer = array();
- $allToBeChekced = array('core.delete', 'core.edit.created_by', 'core.edit.state', 'core.edit.created');
- foreach ($allToBeChekced as $core_permission)
- {
- if ($coreLoad && isset($core[$core_permission]) && isset($this->permissionBuilder['global'][$core[$core_permission]]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core[$core_permission]]) && in_array($viewName_single, $this->permissionBuilder['global'][$core[$core_permission]]))
- {
- // set permissions.
- $publishingPer[] = "\$this->canDo->get('" . $core[$core_permission] . "')";
- }
- else
- {
- // set permissions.
- $publishingPer[] = "\$this->canDo->get('" . $core_permission . "')";
- }
- }
- // check if custom tab must be added
- if (($_customTabHTML = $this->addCustomTabs(15, $viewName_single, 1)) !== false)
- {
- $body .= $_customTabHTML;
- }
- $body .= PHP_EOL . PHP_EOL . $this->_t(1) . "";
- // set the default publishing tab
- $body .= PHP_EOL . $this->_t(1) . "";
- $body .= PHP_EOL . $this->_t(2) . '