Skip to content

Commit

Permalink
Resolved gh-321 by adding the option te set a create menu for admin e…
Browse files Browse the repository at this point in the history
…dit views that are also added to the front-end.
  • Loading branch information
Llewellynvdm committed Apr 9, 2019
1 parent fd154a8 commit a817bae
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -150,7 +150,7 @@ TODO
+ *Version*: 2.9.15
+ *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*: **203724**
+ *Line count*: **203733**
+ *Field count*: **1116**
+ *File count*: **1338**
+ *Folder count*: **209**
Expand Down
2 changes: 1 addition & 1 deletion admin/README.txt
Expand Up @@ -150,7 +150,7 @@ TODO
+ *Version*: 2.9.15
+ *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*: **203724**
+ *Line count*: **203733**
+ *Field count*: **1116**
+ *File count*: **1338**
+ *Folder count*: **209**
Expand Down
6 changes: 6 additions & 0 deletions admin/compiler/joomla_3/settings.json
Expand Up @@ -600,6 +600,12 @@
"rename": false,
"type": "menu"
},
"default.xml": {
"path": "c0mp0n3nt/site/views/VIEW/tmpl",
"rename": "new",
"newName": "edit.xml",
"type": "admin_menu"
},
"module_forms.xml": {
"path": "c0mp0n3nt/site/models/forms",
"rename": "module_forms",
Expand Down
2 changes: 1 addition & 1 deletion admin/helpers/compiler/a_Get.php
Expand Up @@ -1162,7 +1162,7 @@ public function getComponentData()
return $value;
}, $array);
// check if we must add to site
if (isset($array['edit_create_site_view']) && $array['edit_create_site_view'])
if (isset($array['edit_create_site_view']) && is_numeric($array['edit_create_site_view']) && $array['edit_create_site_view'] > 0)
{
$this->siteEditView[$array['adminview']] = true;
$this->lang = 'both';
Expand Down
2 changes: 1 addition & 1 deletion admin/helpers/compiler/b_Structure.php
Expand Up @@ -963,7 +963,7 @@ private function setDynamique()
$config = array($this->hhh . 'CREATIONDATE' . $this->hhh => $created, $this->hhh . 'BUILDDATE' . $this->hhh => $modified, $this->hhh . 'VERSION' . $this->hhh => $view['settings']->version);
$this->buildDynamique($target, 'single', false, $config);
}
if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0)
{
// setup the front site edit-view files
$target = array('site' => $view['settings']->name_single);
Expand Down
26 changes: 26 additions & 0 deletions admin/helpers/compiler/e_Interpretation.php
Expand Up @@ -1470,6 +1470,32 @@ public function setCreateUserHelperMethod($add)
return '';
}

public function setAdminViewMenu(&$viewName_single, &$view)
{
$xml = '';
// build the file
$target = array('site' => $viewName_single);
$done = $this->buildDynamique($target, 'admin_menu');
if ($done)
{
// set the lang
$lang = ComponentbuilderHelper::safeString('com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '_menu_' . $viewName_single, 'U');
$this->langContent['adminsys'][$lang . '_TITLE'] = 'Create ' . $view['settings']->name_single;
$this->langContent['adminsys'][$lang . '_OPTION'] = 'Create ' . $view['settings']->name_single;
$this->langContent['adminsys'][$lang . '_DESC'] = $view['settings']->short_description;
//start loading xml
$xml = '<?xml version="1.0" encoding="utf-8" ?>';
$xml .= PHP_EOL . '<metadata>';
$xml .= PHP_EOL . $this->_t(1) . '<layout title="' . $lang . '_TITLE" option="' . $lang . '_OPTION">';
$xml .= PHP_EOL . $this->_t(2) . '<message>';
$xml .= PHP_EOL . $this->_t(3) . '<![CDATA[' . $lang . '_DESC]]>';
$xml .= PHP_EOL . $this->_t(2) . '</message>';
$xml .= PHP_EOL . $this->_t(1) . '</layout>';
$xml .= PHP_EOL . '</metadata>';
}
return $xml;
}

public function setCustomViewMenu(&$view)
{
$xml = '';
Expand Down
12 changes: 9 additions & 3 deletions admin/helpers/compiler/f_Infusion.php
Expand Up @@ -248,7 +248,7 @@ protected function buildFileContent()
$this->setViewPlaceholders($view['settings']);

// set site edit view array
if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0)
{
$site_edit_view_array[] = $this->_t(4) . "'" . $viewName_single . "'";
$this->lang = 'both';
Expand Down Expand Up @@ -357,9 +357,15 @@ protected function buildFileContent()
$this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEWCSS' . $this->hhh] = $this->getCustomScriptBuilder('css_view', $viewName_single, '', null, true);

// add css to front end
if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0)
{
$this->fileContentDynamic[$viewName_single][$this->hhh . 'SITE_VIEWCSS' . $this->hhh] = $this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEWCSS' . $this->hhh];
// check if we should add a create menu
if ($view['edit_create_site_view'] == 2)
{
// SITE_MENU_XML <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single][$this->hhh . 'SITE_MENU_XML' . $this->hhh] = $this->setAdminViewMenu($viewName_single, $view);
}
}
}
// set the views names
Expand Down Expand Up @@ -552,7 +558,7 @@ protected function buildFileContent()
}
$this->fileContentStatic[$this->hhh . 'ROUTEHELPER' . $this->hhh] .= $this->setRouterHelp($viewName_single, $viewName_list);

if (isset($view['edit_create_site_view']) && $view['edit_create_site_view'])
if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0)
{
// add needed router stuff for front edit views
$this->fileContentStatic[$this->hhh . 'ROUTER_PARSE_SWITCH' . $this->hhh] .= $this->routerParseSwitch($viewName_single, null, false);
Expand Down
3 changes: 3 additions & 0 deletions admin/language/en-GB/en-GB.com_componentbuilder.ini
Expand Up @@ -1846,9 +1846,11 @@ COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Component Upda
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS="Component Admin Views"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ACCESS_DESCRIPTION="Select if this view<br />should use access."
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ACCESS_LABEL="Add Access"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADD="Add"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS="Addadmin Views"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS_DESCRIPTION="Setup the admin views for this component."
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS_LABEL="Admin Views"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDMENU="Add+Menu"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDRESS="Address"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADMINVIEW="Adminview"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADMINVIEW_DESCRIPTION="Select an admin view"
Expand Down Expand Up @@ -2012,6 +2014,7 @@ COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEW="A New Component Admin Views"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEW_TAB="New Tab"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEW_TAB_TWO="New Tab 2"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEXT="Next"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NONE="None"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NOTE_ON_ADMIN_VIEWS_DESCRIPTION="Do not add the same view twice it will not work. Please <a href='https://youtu.be/39vY66X7GGU?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE' target='_blank'>watch this tutorial for more help</a>."
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NOTE_ON_ADMIN_VIEWS_LABEL="Setting Admin Views"
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NOTIFICATION="Notification"
Expand Down
20 changes: 13 additions & 7 deletions admin/models/forms/component_admin_views.xml
Expand Up @@ -664,17 +664,23 @@
description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_PORT_DESCRIPTION"
class="inputbox"
/>
<!-- Edit_create_site_view Field. Type: Checkbox. (joomla) -->
<!-- Edit_create_site_view Field. Type: List. (joomla) -->
<field
type="checkbox"
type="list"
name="edit_create_site_view"
label="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_EDIT_CREATE_SITE_VIEW_LABEL"
value="1"
default=""
required="false"
description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_EDIT_CREATE_SITE_VIEW_DESCRIPTION"
class="inputbox"
/>
class="list_class fieldMedium"
multiple="false"
required="false">
<!-- Option Set. -->
<option value="">
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NONE</option>
<option value="1">
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADD</option>
<option value="2">
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDMENU</option>
</field>
<!-- Order Field. Type: Integer. (joomla) -->
<field
type="integer"
Expand Down

0 comments on commit a817bae

Please sign in to comment.