Futher improved the redirect option to use return and stack the return path to take the user back to the original area from where they clicked away.

This commit is contained in:
2018-08-18 14:09:17 +02:00
parent 70e198abf3
commit 103457eef7
37 changed files with 455 additions and 70 deletions

View File

@ -1868,7 +1868,7 @@ class Get
}
}
// add_php
$addArrayP = array('php_getitem', 'php_before_save', 'php_save', 'php_getform', 'php_postsavehook', 'php_getitems', 'php_getitems_after_all', 'php_getlistquery', 'php_allowedit', 'php_before_delete', 'php_after_delete', 'php_before_publish', 'php_after_publish', 'php_batchcopy', 'php_batchmove', 'php_document');
$addArrayP = array('php_getitem', 'php_before_save', 'php_save', 'php_getform', 'php_postsavehook', 'php_getitems', 'php_getitems_after_all', 'php_getlistquery', 'php_allowadd', 'php_allowedit', 'php_before_delete', 'php_after_delete', 'php_before_publish', 'php_after_publish', 'php_batchcopy', 'php_batchmove', 'php_document');
foreach ($addArrayP as $scripter)
{
if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1)

View File

@ -2927,7 +2927,8 @@ class Fields extends Structure
$addButton[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " get the view name & id";
$addButton[] = $this->_t(3) . "\$values = \$jinput->getArray(array(";
$addButton[] = $this->_t(4) . "'id' => 'int',";
$addButton[] = $this->_t(4) . "'view' => 'word'";
$addButton[] = $this->_t(4) . "'view' => 'word',";
$addButton[] = $this->_t(4) . "'return' => 'base64'";
$addButton[] = $this->_t(3) . "));";
$addButton[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " check if new item";
$addButton[] = $this->_t(3) . "\$ref = '';";
@ -2939,6 +2940,12 @@ class Fields extends Structure
$addButton[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " only load referal if not new item.";
$addButton[] = $this->_t(4) . "\$ref = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];";
$addButton[] = $this->_t(4) . "\$refJ = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];";
$addButton[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " get the return value.";
$addButton[] = $this->_t(4) . "\$_uri = (string) JUri::getInstance();";
$addButton[] = $this->_t(4) . "\$_return = urlencode(base64_encode(\$_uri));";
$addButton[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " load return value.";
$addButton[] = $this->_t(4) . "\$ref .= '&return=' . \$_return;";
$addButton[] = $this->_t(4) . "\$refJ .= '&return=' . \$_return;";
$addButton[] = $this->_t(3) . "}";
}
else

View File

@ -7740,20 +7740,33 @@ class Interpretation extends Fields
// LAYOUTITEMSTABLE <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single . '_' . $layoutCodeName][$this->hhh . 'LAYOUTITEMSTABLE' . $this->hhh] = $head . $body;
// LAYOUTITEMSHEADER <<<DYNAMIC>>>
$headerscript = '$edit = "index.php?option=com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '&view=' . $list . '&task=' . $single . '.edit";';
$headerscript .= '//' . $this->setLine(__LINE__) . ' set the edit URL';
$headerscript .= PHP_EOL . '$edit = "index.php?option=com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '&view=' . $list . '&task=' . $single . '.edit";';
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set a return value';
$headerscript .= PHP_EOL . '$return = ($id) ? "index.php?option=com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '&view=' . $viewName_single . '&layout=edit&id=" . $id : "";';
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' check for a return value';
$headerscript .= PHP_EOL . '$jinput = JFactory::getApplication()->input;';
$headerscript .= PHP_EOL . "if (\$_return = \$jinput->get('return', null, 'base64'))";
$headerscript .= PHP_EOL . '{';
$headerscript .= PHP_EOL . $this->_t(1) . '$return .= "&return=" . $_return;';
$headerscript .= PHP_EOL . '}';
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set the referral values';
$headerscript .= PHP_EOL . '$ref = ($id) ? "&ref=' . $viewName_single . '&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "";';
if ($addNewButon > 0)
{
// add the link for new
if ($addNewButon == 1 || $addNewButon == 2)
{
$headerscript .= PHP_EOL . '$ref = ($id) ? "&ref=' . $viewName_single . '&refid=".$id : "";';
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set the create new URL';
$headerscript .= PHP_EOL . '$new = "index.php?option=com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '&view=' . $single . '&layout=edit".$ref;';
}
// and the link for close and new
if ($addNewButon == 2 || $addNewButon == 3)
{
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set the create new and close URL';
$headerscript .= PHP_EOL . '$close_new = "index.php?option=com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '&view=' . $single . '&layout=edit";';
}
$headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' load the action object';
$headerscript .= PHP_EOL . '$can = ' . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . 'Helper::getActions(' . "'" . $single . "'" . ');';
}
$this->fileContentDynamic[$viewName_single . '_' . $layoutCodeName][$this->hhh . 'LAYOUTITEMSHEADER' . $this->hhh] = $headerscript;
@ -7906,7 +7919,7 @@ class Interpretation extends Fields
foreach ($this->listBuilder[$viewName_list] as $item)
{
// set the ref
$ref = '&ref=' . $refview . '&refid=<?php echo $id; ?>';
$ref = '<?php echo $ref; ?>';
// set some defaults
$customAdminViewButtons = '';
// set the item row