Resolved gh-194 to allow for [close & New] Button in linked views

This commit is contained in:
Llewellyn van der Merwe 2017-12-12 15:18:27 +02:00
parent ba07f1aae3
commit 258f7441d7
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
8 changed files with 73 additions and 24 deletions

View File

@ -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**

View File

@ -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**

View File

@ -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### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single.'_'.$layoutCodeName]['###LAYOUTITEMSTABLE###'] = $head.$body;
// ###LAYOUTITEMSHEADER### <<<DYNAMIC>>>
$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### <<<DYNAMIC>>>
@ -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 = '<?php if ('.$accessCheck.'): ?>';
$head .= PHP_EOL."\t".'<a class="btn btn-small btn-success" href="<?php echo $new; ?>"><span class="icon-new icon-white"></span> <?php echo JText::_('."'".$this->langPrefix."_NEW'".'); ?></a><br /><br />';
// make group button if needed
$tabB = "";
if ($addNewButon == 2)
{
$head .= PHP_EOL."\t".'<div class="btn-group">';
$tabB = "\t";
}
// add the new buttons
if ($addNewButon == 1 || $addNewButon == 2)
{
$head .= PHP_EOL.$tabB."\t".'<a class="btn btn-small btn-success" href="<?php echo $new; ?>"><span class="icon-new icon-white"></span> <?php echo JText::_('."'".$this->langPrefix."_NEW'".'); ?></a>';
}
// add the close and new button
if ($addNewButon == 2 || $addNewButon == 3)
{
$head .= PHP_EOL.$tabB."\t".'<a class="btn btn-small" onclick="Joomla.submitbutton(\''.$refview.'.cancel\');" href="<?php echo $close_new; ?>"><span class="icon-new"></span> <?php echo JText::_('."'".$this->langPrefix."_CLOSE_NEW'".'); ?></a>';
}
// close group button if needed
if ($addNewButon == 2)
{
$head .= PHP_EOL."\t".'</div><br /><br />';
}
else
{
$head .= '<br /><br />';
}
$head .= PHP_EOL.'<?php endif; ?>'.PHP_EOL;
}
$head .= '<?php if ('.$Helper.'::checkArray($items)): ?>';

View File

@ -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="<p>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.</p>"
COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_ADVANCED_IMPORT_LABEL="Advanced notice."
COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_BEGINNER_IMPORT_DESCRIPTION="<p>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.</p>"
@ -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"

View File

@ -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');
?>
<div class="form-vertical">

View File

@ -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";
?>
<div class="form-vertical">

View File

@ -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";
?>
<div class="form-vertical">

View File

@ -509,14 +509,22 @@
filter="WORD"
message="COM_COMPONENTBUILDER_ADMIN_VIEW_PARENTKEY_MESSAGE"
hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PARENTKEY_HINT" />
<!-- Addnew Field. Type: Checkbox. (joomla)-->
<field type="checkbox"
<!-- Addnew Field. Type: List. (joomla)-->
<field type="list"
name="addnew"
label="COM_COMPONENTBUILDER_ADMIN_VIEW_ADDNEW_LABEL"
value="1"
default="1"
description="COM_COMPONENTBUILDER_ADMIN_VIEW_ADDNEW_DESCRIPTION"
class="list_class"
multiple="false"
filter="int"
required="false"
class="inputbox" />
default="0">
<!-- Option Set.-->
<option value="0">COM_COMPONENTBUILDER_ADMIN_VIEW_NONE</option>
<option value="1">COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_NEW_BUTTON</option>
<option value="2">COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_NEW_NEW_CLOSE_BUTTON</option>
<option value="3">COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_NEW_CLOSE_BUTTON</option>
</field>
</form>
</field>
<!-- Php_before_delete Field. Type: Textarea. (joomla)-->