forked from joomla/Component-Builder
resolved gh-380 to insure that the list view JS file also gets added if set.
This commit is contained in:
parent
a5de53c5fa
commit
ccbf21fddb
@ -146,7 +146,7 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 5th March, 2019
|
||||
+ *Last Build*: 6th March, 2019
|
||||
+ *Version*: 2.9.13
|
||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
|
@ -146,7 +146,7 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 5th March, 2019
|
||||
+ *Last Build*: 6th March, 2019
|
||||
+ *Version*: 2.9.13
|
||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
|
@ -189,7 +189,7 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_('COM_###COMPONENT###_###VIEWS###'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_###component###/assets/css/###views###.css", (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_###component###/assets/css/###views###.css", (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');###ADMIN_ADD_JAVASCRIPT_FILE###
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -503,6 +503,11 @@
|
||||
"path": "c0mp0n3nt/",
|
||||
"rename": "update_server",
|
||||
"type": "update_server"
|
||||
},
|
||||
"viewFile.js": {
|
||||
"path": "c0mp0n3nt/admin/assets/js",
|
||||
"rename": "viewFile",
|
||||
"type": "javascript_file"
|
||||
}
|
||||
},
|
||||
"site": {
|
||||
|
@ -1,4 +1,4 @@
|
||||
###BOM###
|
||||
|
||||
/* JS Document */
|
||||
###ADMINJS###
|
||||
###ADMIN_JAVASCRIPT_FILE###
|
@ -96,11 +96,11 @@ class Interpretation extends Fields
|
||||
public $validationFixBuilder = array();
|
||||
|
||||
/**
|
||||
* The edit body script builder
|
||||
* The view script builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $editBodyViewScriptBuilder = array();
|
||||
public $viewScriptBuilder = array();
|
||||
|
||||
/**
|
||||
* The target relation control
|
||||
@ -9646,15 +9646,12 @@ class Interpretation extends Fields
|
||||
$fileScript = $initial . $func . $validation . $isSet;
|
||||
$footerScript = $listener;
|
||||
}
|
||||
// add custom script to file
|
||||
if (isset($this->customScriptBuilder['view_file'][$viewName]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['view_file'][$viewName]))
|
||||
{
|
||||
// add custom script to edit form JS file
|
||||
if (!isset($fileScript))
|
||||
{
|
||||
$fileScript = '';
|
||||
}
|
||||
$fileScript .= PHP_EOL . PHP_EOL . $this->setPlaceholders($this->customScriptBuilder['view_file'][$viewName], $this->placeholders);
|
||||
}
|
||||
$fileScript .= $this->getCustomScriptBuilder('view_file', $viewName, PHP_EOL . PHP_EOL, null, true, '');
|
||||
// add custom script to footer
|
||||
if (isset($this->customScriptBuilder['view_footer'][$viewName]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['view_footer'][$viewName]))
|
||||
{
|
||||
@ -9670,6 +9667,37 @@ class Interpretation extends Fields
|
||||
unset($customFooterScript);
|
||||
}
|
||||
}
|
||||
// set view listname
|
||||
$viewName_list = ComponentbuilderHelper::safeString($viewArray['settings']->name_list);
|
||||
// add custom script to list view JS file
|
||||
if (($list_fileScript = $this->getCustomScriptBuilder('views_file', $viewName, PHP_EOL . PHP_EOL, null, true, false)) !== false &&
|
||||
ComponentbuilderHelper::checkString($list_fileScript))
|
||||
{
|
||||
// get dates
|
||||
$_created = $this->getCreatedDate($viewArray);
|
||||
$_modified = $this->getLastModifiedDate($viewArray);
|
||||
// add file to view
|
||||
$_target = array($this->target => $viewName_list);
|
||||
$_config = array($this->hhh . 'CREATIONDATE' . $this->hhh => $_created, $this->hhh . 'BUILDDATE' . $this->hhh => $_modified, $this->hhh . 'VERSION' . $this->hhh => $viewArray['settings']->version);
|
||||
$this->buildDynamique($_target, 'javascript_file', false, $_config);
|
||||
// set path
|
||||
$_path = '/administrator/components/com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '/assets/js/' . $viewName_list . '.js';
|
||||
// load the file to the list view
|
||||
$this->fileContentDynamic[$viewName_list][$this->hhh . 'ADMIN_ADD_JAVASCRIPT_FILE' . $this->hhh] = PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Add List View JavaScript File" . PHP_EOL . $this->_t(2) . $this->setIncludeLibScript($_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
$list_fileScript = '';
|
||||
$this->fileContentDynamic[$viewName_list][$this->hhh . 'ADMIN_ADD_JAVASCRIPT_FILE' . $this->hhh] = '';
|
||||
}
|
||||
// minfy the script
|
||||
if ($this->minify && isset($list_fileScript) && ComponentbuilderHelper::checkString($list_fileScript))
|
||||
{
|
||||
// minify the fielScript javscript
|
||||
$minifier = new JS;
|
||||
$minifier->add($list_fileScript);
|
||||
$list_fileScript = $minifier->minify();
|
||||
}
|
||||
// minfy the script
|
||||
if ($this->minify && isset($fileScript) && ComponentbuilderHelper::checkString($fileScript))
|
||||
{
|
||||
@ -9687,6 +9715,12 @@ class Interpretation extends Fields
|
||||
$footerScript = $minifier->minify();
|
||||
}
|
||||
// make sure there is script to add
|
||||
if (isset($list_fileScript) && ComponentbuilderHelper::checkString($list_fileScript))
|
||||
{
|
||||
// load the script
|
||||
$this->viewScriptBuilder[$viewName]['list_fileScript'] = $list_fileScript;
|
||||
}
|
||||
// make sure there is script to add
|
||||
if (isset($fileScript) && ComponentbuilderHelper::checkString($fileScript))
|
||||
{
|
||||
// add the head script if set
|
||||
@ -9695,7 +9729,7 @@ class Interpretation extends Fields
|
||||
$fileScript = "// Some Global Values" . PHP_EOL . $head . PHP_EOL . $fileScript;
|
||||
}
|
||||
// load the script
|
||||
$this->editBodyViewScriptBuilder[$viewName]['fileScript'] = $fileScript;
|
||||
$this->viewScriptBuilder[$viewName]['fileScript'] = $fileScript;
|
||||
}
|
||||
// make sure to add custom footer script if php was found in it, since we canot minfy it with php
|
||||
if (isset($customFooterScript) && ComponentbuilderHelper::checkString($customFooterScript))
|
||||
@ -9711,7 +9745,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
// add the needed script tags
|
||||
$footerScript = PHP_EOL . PHP_EOL . '<script type="text/javascript">' . PHP_EOL . $footerScript . PHP_EOL . "</script>";
|
||||
$this->editBodyViewScriptBuilder[$viewName]['footerScript'] = $footerScript;
|
||||
$this->viewScriptBuilder[$viewName]['footerScript'] = $footerScript;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10306,20 +10340,11 @@ class Interpretation extends Fields
|
||||
return $clear;
|
||||
}
|
||||
|
||||
public function setViewScript(&$view)
|
||||
public function setViewScript(&$view, $type)
|
||||
{
|
||||
if (isset($this->editBodyViewScriptBuilder[$view]) && isset($this->editBodyViewScriptBuilder[$view]['fileScript']))
|
||||
if (isset($this->viewScriptBuilder[$view]) && isset($this->viewScriptBuilder[$view][$type]))
|
||||
{
|
||||
return $this->editBodyViewScriptBuilder[$view]['fileScript'];
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function setEditBodyScript(&$view)
|
||||
{
|
||||
if (isset($this->editBodyViewScriptBuilder[$view]) && isset($this->editBodyViewScriptBuilder[$view]['footerScript']))
|
||||
{
|
||||
return $this->editBodyViewScriptBuilder[$view]['footerScript'];
|
||||
return $this->viewScriptBuilder[$view][$type];
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
@ -285,10 +285,10 @@ class Infusion extends Interpretation
|
||||
$this->buildTheViewScript($view);
|
||||
|
||||
// VIEW_SCRIPT
|
||||
$this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEW_SCRIPT' . $this->hhh] = $this->setViewScript($viewName_single);
|
||||
$this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEW_SCRIPT' . $this->hhh] = $this->setViewScript($viewName_single, 'fileScript');
|
||||
|
||||
// EDITBODYSCRIPT
|
||||
$this->fileContentDynamic[$viewName_single][$this->hhh . 'EDITBODYSCRIPT' . $this->hhh] = $this->setEditBodyScript($viewName_single);
|
||||
$this->fileContentDynamic[$viewName_single][$this->hhh . 'EDITBODYSCRIPT' . $this->hhh] = $this->setViewScript($viewName_single, 'footerScript');
|
||||
|
||||
// AJAXTOKE <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_single][$this->hhh . 'AJAXTOKE' . $this->hhh] = $this->setAjaxToke($viewName_single);
|
||||
@ -401,6 +401,8 @@ class Infusion extends Interpretation
|
||||
// CHECKINCALL <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_list][$this->hhh . 'CHECKINCALL' . $this->hhh] = '';
|
||||
}
|
||||
// admin list file contnet
|
||||
$this->fileContentDynamic[$viewName_list][$this->hhh . 'ADMIN_JAVASCRIPT_FILE' . $this->hhh] = $this->setViewScript($viewName_list, 'list_fileScript');
|
||||
// ADMIN_CUSTOM_BUTTONS_LIST
|
||||
$this->fileContentDynamic[$viewName_list][$this->hhh . 'ADMIN_CUSTOM_BUTTONS_LIST' . $this->hhh] = $this->setCustomButtons($view, 3, $this->_t(1));
|
||||
$this->fileContentDynamic[$viewName_list][$this->hhh . 'ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST' . $this->hhh] = $this->setFunctionOnlyButtons($viewName_list);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>5th March, 2019</creationDate>
|
||||
<creationDate>6th March, 2019</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||
|
Loading…
Reference in New Issue
Block a user