From 258f7441d7b0248765c717980de35ffbb4652ea5 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 12 Dec 2017 15:18:27 +0200 Subject: [PATCH] Resolved gh-194 to allow for [close & New] Button in linked views --- README.md | 2 +- admin/README.txt | 2 +- admin/helpers/compiler/e_Interpretation.php | 55 +++++++++++++++---- .../en-GB/en-GB.com_componentbuilder.ini | 8 ++- admin/layouts/fieldtype/fields_fullwidth.php | 8 +-- .../ftp/linked_components_fullwidth.php | 2 +- .../translation_fullwidth.php | 2 +- admin/models/forms/admin_view.xml | 18 ++++-- 8 files changed, 73 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index fad0ea3ff..2ee827e34 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.6.6 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **177924** ++ *Line count*: **177938** + *File count*: **1142** + *Folder count*: **184** diff --git a/admin/README.txt b/admin/README.txt index fad0ea3ff..2ee827e34 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -115,7 +115,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.6.6 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **177924** ++ *Line count*: **177938** + *File count*: **1142** + *Folder count*: **184** diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 95c336abb..57641e0ce 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -5767,6 +5767,7 @@ class Interpretation extends Fields $this->langContent['admin'][$this->langPrefix.'_SAVE_WARNING'] = "The value already existed so please select another."; $this->langContent['admin'][$this->langPrefix.'_HELP_MANAGER'] = "Help"; $this->langContent['admin'][$this->langPrefix.'_NEW'] = "New"; + $this->langContent['admin'][$this->langPrefix.'_CLOSE_NEW'] = "Close & New"; $this->langContent['admin'][$this->langPrefix.'_CREATE_NEW_S'] = "Create New %s"; $this->langContent['admin'][$this->langPrefix.'_EDIT_S'] = "Edit %s"; $this->langContent['admin'][$this->langPrefix.'_KEEP_ORIGINAL_STATE'] = "- Keep Original State -"; @@ -7085,18 +7086,27 @@ class Interpretation extends Fields } if (ComponentbuilderHelper::checkString($single) && ComponentbuilderHelper::checkString($list)) { - $head = $this->setListHeadLinked($single,$list,$addNewButon); - $body = $this->setListBodyLinked($single,$list,$viewName_single); + $head = $this->setListHeadLinked($single, $list, $addNewButon, $viewName_single); + $body = $this->setListBodyLinked($single, $list, $viewName_single); $functionName = ComponentbuilderHelper::safeString($codeName,'F'); // ###LAYOUTITEMSTABLE### <<>> $this->fileContentDynamic[$viewName_single.'_'.$layoutCodeName]['###LAYOUTITEMSTABLE###'] = $head.$body; // ###LAYOUTITEMSHEADER### <<>> - $headerscript = '$edit = "index.php?option=com_'.$this->fileContentStatic['###component###'].'&view='.$list.'&task='.$single.'.edit";'; - if ($addNewButon) + $headerscript = '$edit = "index.php?option=com_'.$this->fileContentStatic['###component###'].'&view='.$list.'&task='.$single.'.edit";'; + if ($addNewButon > 0) { - $headerscript .= PHP_EOL.'$ref = ($id) ? "&ref='.$viewName_single.'&refid=".$id : "";'; - $headerscript .= PHP_EOL.'$new = "index.php?option=com_'.$this->fileContentStatic['###component###'].'&view='.$single.'&layout=edit".$ref;'; - $headerscript .= PHP_EOL.'$can = '.$this->fileContentStatic['###Component###'].'Helper::getActions('."'".$single."'".');'; + // add the link for new + if ($addNewButon == 1 || $addNewButon == 2) + { + $headerscript .= PHP_EOL.'$ref = ($id) ? "&ref='.$viewName_single.'&refid=".$id : "";'; + $headerscript .= PHP_EOL.'$new = "index.php?option=com_'.$this->fileContentStatic['###component###'].'&view='.$single.'&layout=edit".$ref;'; + } + // and the link for close and new + if ($addNewButon == 2 || $addNewButon == 3) + { + $headerscript .= PHP_EOL.'$close_new = "index.php?option=com_'.$this->fileContentStatic['###component###'].'&view='.$single.'&layout=edit";'; + } + $headerscript .= PHP_EOL.'$can = '.$this->fileContentStatic['###Component###'].'Helper::getActions('."'".$single."'".');'; } $this->fileContentDynamic[$viewName_single.'_'.$layoutCodeName]['###LAYOUTITEMSHEADER###'] = $headerscript; // ###LINKEDVIEWITEMS### <<>> @@ -7512,7 +7522,7 @@ class Interpretation extends Fields return ''; } - public function setListHeadLinked($viewName_single,$viewName_list,$addNewButon) + public function setListHeadLinked($viewName_single, $viewName_list, $addNewButon, $refview) { if (isset($this->listBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listBuilder[$viewName_list])) { @@ -7520,7 +7530,7 @@ class Interpretation extends Fields $Helper = $this->fileContentStatic['###Component###'].'Helper'; $head = ''; // only add new button if set - if ($addNewButon) + if ($addNewButon > 0) { // setup correct core target $coreLoad = false; @@ -7542,7 +7552,32 @@ class Interpretation extends Fields } // add a button for new $head = ''; - $head .= PHP_EOL."\t".' langPrefix."_NEW'".'); ?>

'; + // make group button if needed + $tabB = ""; + if ($addNewButon == 2) + { + $head .= PHP_EOL."\t".'
'; + $tabB = "\t"; + } + // add the new buttons + if ($addNewButon == 1 || $addNewButon == 2) + { + $head .= PHP_EOL.$tabB."\t".' langPrefix."_NEW'".'); ?>'; + } + // add the close and new button + if ($addNewButon == 2 || $addNewButon == 3) + { + $head .= PHP_EOL.$tabB."\t".' langPrefix."_CLOSE_NEW'".'); ?>'; + } + // close group button if needed + if ($addNewButon == 2) + { + $head .= PHP_EOL."\t".'


'; + } + else + { + $head .= '

'; + } $head .= PHP_EOL.''.PHP_EOL; } $head .= ''; diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index a4298a9d9..3c58621a3 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -271,7 +271,8 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_ADD="Add" COM_COMPONENTBUILDER_ADMIN_VIEW_ADDLINKED_VIEWS="Addlinked Views" COM_COMPONENTBUILDER_ADMIN_VIEW_ADDLINKED_VIEWS_DESCRIPTION="Setup the linked views for this view." COM_COMPONENTBUILDER_ADMIN_VIEW_ADDLINKED_VIEWS_LABEL="Linked Views" -COM_COMPONENTBUILDER_ADMIN_VIEW_ADDNEW_LABEL="Add New Button" +COM_COMPONENTBUILDER_ADMIN_VIEW_ADDNEW_DESCRIPTION="in tab" +COM_COMPONENTBUILDER_ADMIN_VIEW_ADDNEW_LABEL="Top Button" COM_COMPONENTBUILDER_ADMIN_VIEW_ADDPERMISSIONS="Addpermissions" COM_COMPONENTBUILDER_ADMIN_VIEW_ADDPERMISSIONS_DESCRIPTION="Set permissions for this view" COM_COMPONENTBUILDER_ADMIN_VIEW_ADDPERMISSIONS_LABEL="Permissions" @@ -301,6 +302,9 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_JAVASCRIPT_VIEW_FILE="Add Javascript View Fi COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_JAVASCRIPT_VIEW_FILE_LABEL="Add JavaScript (view-file)" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_JAVASCRIPT_VIEW_FOOTER="Add Javascript View Footer" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL="Add JavaScript (view-footer)" +COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_NEW_BUTTON="Add New Button" +COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_NEW_CLOSE_BUTTON="Add New & Close Button" +COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_NEW_NEW_CLOSE_BUTTON="Add New + New & Close Button" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AFTER_DELETE="Add Php After Delete" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AFTER_DELETE_LABEL="Add PHP (script - after delete)" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AFTER_PUBLISH="Add Php After Publish" @@ -585,6 +589,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_NEW_TAB="New Tab" COM_COMPONENTBUILDER_ADMIN_VIEW_NEW_TAB_TWO="New Tab 2" COM_COMPONENTBUILDER_ADMIN_VIEW_NEXT="Next" COM_COMPONENTBUILDER_ADMIN_VIEW_NO="No" +COM_COMPONENTBUILDER_ADMIN_VIEW_NONE="None" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_ADVANCED_IMPORT_DESCRIPTION="

The scripts that are automatic added to the input fields below is identical to the default import scripts used. Adapt them to your own custom needs.

" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_ADVANCED_IMPORT_LABEL="Advanced notice." COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_BEGINNER_IMPORT_DESCRIPTION="

Please do not change this area unless you would like to add special import to this view that goes beyond the default import concept that Component Builder already does automatic if this view is set to have import & export in the component area where this view is linked to the component.

" @@ -916,6 +921,7 @@ COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_ COM_COMPONENTBUILDER_CHAIN="Chain" COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="Check your owner details, it has not been set. Open the JCB Global Options, go to the Company tab and add the correct company details there." COM_COMPONENTBUILDER_CLEAR_TMP="Clear tmp" +COM_COMPONENTBUILDER_CLOSE_NEW="Close & New" COM_COMPONENTBUILDER_COMPANY="Company" COM_COMPONENTBUILDER_COMPANY_NAME="Company Name" COM_COMPONENTBUILDER_COMPANY_S="Company: %s" diff --git a/admin/layouts/fieldtype/fields_fullwidth.php b/admin/layouts/fieldtype/fields_fullwidth.php index b57918936..71b6b89dc 100644 --- a/admin/layouts/fieldtype/fields_fullwidth.php +++ b/admin/layouts/fieldtype/fields_fullwidth.php @@ -31,10 +31,10 @@ defined('_JEXEC') or die('Restricted access'); $items = $displayData->vzwfields; $user = JFactory::getUser(); $id = $displayData->item->id; -$edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; -$ref = ($id) ? "&ref=fieldtype&refid=".$id : ""; -$new = "index.php?option=com_componentbuilder&view=field&layout=edit".$ref; -$can = ComponentbuilderHelper::getActions('field'); +$edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; +$ref = ($id) ? "&ref=fieldtype&refid=".$id : ""; +$new = "index.php?option=com_componentbuilder&view=field&layout=edit".$ref; +$can = ComponentbuilderHelper::getActions('field'); ?>
diff --git a/admin/layouts/ftp/linked_components_fullwidth.php b/admin/layouts/ftp/linked_components_fullwidth.php index a437256a6..cb7feed10 100644 --- a/admin/layouts/ftp/linked_components_fullwidth.php +++ b/admin/layouts/ftp/linked_components_fullwidth.php @@ -31,7 +31,7 @@ defined('_JEXEC') or die('Restricted access'); $items = $displayData->vzxlinked_components; $user = JFactory::getUser(); $id = $displayData->item->id; -$edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit"; +$edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit"; ?>
diff --git a/admin/layouts/joomla_component/translation_fullwidth.php b/admin/layouts/joomla_component/translation_fullwidth.php index 745e1c411..9eac4eec1 100644 --- a/admin/layouts/joomla_component/translation_fullwidth.php +++ b/admin/layouts/joomla_component/translation_fullwidth.php @@ -31,7 +31,7 @@ defined('_JEXEC') or die('Restricted access'); $items = $displayData->vwmtranslation; $user = JFactory::getUser(); $id = $displayData->item->id; -$edit = "index.php?option=com_componentbuilder&view=language_translations&task=language_translation.edit"; +$edit = "index.php?option=com_componentbuilder&view=language_translations&task=language_translation.edit"; ?>
diff --git a/admin/models/forms/admin_view.xml b/admin/models/forms/admin_view.xml index cb0df038f..14de9cdd7 100644 --- a/admin/models/forms/admin_view.xml +++ b/admin/models/forms/admin_view.xml @@ -509,14 +509,22 @@ filter="WORD" message="COM_COMPONENTBUILDER_ADMIN_VIEW_PARENTKEY_MESSAGE" hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PARENTKEY_HINT" /> - - + + default="0"> + + + + + +