Fixed the dashboard to allow offline work

This commit is contained in:
Llewellyn van der Merwe 2022-07-09 22:37:56 +02:00
parent f81f05936a
commit d4ffc3addc
Signed by untrusted user: Llewellyn
GPG Key ID: A9201372263741E7
13 changed files with 206 additions and 124 deletions

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have! Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.3) with **ALL** its features and **ALL** concepts totally open-source and free! You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.4) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -141,10 +141,10 @@ TODO
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 9th July, 2022 + *Last Build*: 9th July, 2022
+ *Version*: 3.1.3 + *Version*: 3.1.4
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311259** + *Line count*: **311349**
+ *Field count*: **2002** + *Field count*: **2002**
+ *File count*: **2050** + *File count*: **2050**
+ *Folder count*: **349** + *Folder count*: **349**

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have! Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.3) with **ALL** its features and **ALL** concepts totally open-source and free! You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.4) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -141,10 +141,10 @@ TODO
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 9th July, 2022 + *Last Build*: 9th July, 2022
+ *Version*: 3.1.3 + *Version*: 3.1.4
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311259** + *Line count*: **311349**
+ *Field count*: **2002** + *Field count*: **2002**
+ *File count*: **2050** + *File count*: **2050**
+ *Folder count*: **349** + *Folder count*: **349**

View File

@ -20,7 +20,7 @@ defined('_JEXEC') or die('Restricted access');
?> ?>
<img alt="<?php echo JText::_('COM_###COMPONENT###'); ?>" src="components/com_###component###/assets/images/vdm-component.###COMP_IMAGE_TYPE###"> <img alt="<?php echo JText::_('COM_###COMPONENT###'); ?>" src="components/com_###component###/assets/images/vdm-component.###COMP_IMAGE_TYPE###">
<ul class="list-striped"> <ul class="list-striped">
<li><b><?php echo JText::_('COM_###COMPONENT###_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice"></span></li> <li><b><?php echo JText::_('COM_###COMPONENT###_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice" id="component-update-notice"></span></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li> <li><b><?php echo JText::_('COM_###COMPONENT###_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li> <li><b><?php echo JText::_('COM_###COMPONENT###_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li> <li><b><?php echo JText::_('COM_###COMPONENT###_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li>

View File

@ -35,6 +35,7 @@ class ComponentbuilderControllerAjax extends BaseController
$this->registerTask('getComponentDetails', 'ajax'); $this->registerTask('getComponentDetails', 'ajax');
$this->registerTask('getCronPath', 'ajax'); $this->registerTask('getCronPath', 'ajax');
$this->registerTask('getWiki', 'ajax'); $this->registerTask('getWiki', 'ajax');
$this->registerTask('getVersion', 'ajax');
$this->registerTask('getJCBpackageInfo', 'ajax'); $this->registerTask('getJCBpackageInfo', 'ajax');
$this->registerTask('getCrowdinDetails', 'ajax'); $this->registerTask('getCrowdinDetails', 'ajax');
$this->registerTask('getModuleCode', 'ajax'); $this->registerTask('getModuleCode', 'ajax');
@ -295,6 +296,47 @@ class ComponentbuilderControllerAjax extends BaseController
} }
} }
break; break;
case 'getVersion':
try
{
$versionValue = $jinput->get('version', NULL, 'INT');
if($versionValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getVersion($versionValue);
}
else
{
$result = false;
}
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getJCBpackageInfo': case 'getJCBpackageInfo':
try try
{ {

View File

@ -5483,7 +5483,7 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC="Allows the users
COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY="Get the snippet from gitHub and install it locally" COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY="Get the snippet from gitHub and install it locally"
COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION="Get the snippet from gitHub and update the local version" COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION="Get the snippet from gitHub and update the local version"
COM_COMPONENTBUILDER_GET_TOKEN="Get Token" COM_COMPONENTBUILDER_GET_TOKEN="Get Token"
COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_FOR_UPDATES_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS="Get token from VDM for updates, and add it to your global options" COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_TO_GET_UPDATE_NOTICE_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS="Get token from VDM to get update notice, and add it to your global options."
COM_COMPONENTBUILDER_GLOBAL="Global" COM_COMPONENTBUILDER_GLOBAL="Global"
COM_COMPONENTBUILDER_GLUECODE="Glue/Code" COM_COMPONENTBUILDER_GLUECODE="Glue/Code"
COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK="Great, this function name will work!" COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK="Great, this function name will work!"
@ -7810,7 +7810,7 @@ COM_COMPONENTBUILDER_OPTIONS="Options"
COM_COMPONENTBUILDER_ORDER_BEFORE="Order Before" COM_COMPONENTBUILDER_ORDER_BEFORE="Order Before"
COM_COMPONENTBUILDER_ORDER_IN_EDIT="Order in Edit" COM_COMPONENTBUILDER_ORDER_IN_EDIT="Order in Edit"
COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS="Order in list views" COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS="Order in list views"
COM_COMPONENTBUILDER_OUT_OF_DATE="Out of Date" COM_COMPONENTBUILDER_OUT_OF_DATE="Out of date"
COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET="Owner details was set" COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET="Owner details was set"
COM_COMPONENTBUILDER_OWNER_S="Owner: %s" COM_COMPONENTBUILDER_OWNER_S="Owner: %s"
COM_COMPONENTBUILDER_PACKAGE="Package" COM_COMPONENTBUILDER_PACKAGE="Package"
@ -8117,6 +8117,7 @@ COM_COMPONENTBUILDER_PROPERTY_VALUE="Property Value"
COM_COMPONENTBUILDER_PUBLIC_ACCESS="Public Access" COM_COMPONENTBUILDER_PUBLIC_ACCESS="Public Access"
COM_COMPONENTBUILDER_PUBLISHED="Published" COM_COMPONENTBUILDER_PUBLISHED="Published"
COM_COMPONENTBUILDER_PUBLISHING="Publishing" COM_COMPONENTBUILDER_PUBLISHING="Publishing"
COM_COMPONENTBUILDER_README="Readme"
COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT="Ready to compile a component" COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT="Ready to compile a component"
COM_COMPONENTBUILDER_REFRESH="Refresh" COM_COMPONENTBUILDER_REFRESH="Refresh"
COM_COMPONENTBUILDER_REMOVE="Remove" COM_COMPONENTBUILDER_REMOVE="Remove"
@ -9347,6 +9348,7 @@ COM_COMPONENTBUILDER_WE_DID_NOT_CHECK_THE_SNIPPET_IT_SELF_TO_SEE_IF_IT_CHANGED_W
COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB="We failed to move <b>%s</b>!" COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB="We failed to move <b>%s</b>!"
COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB="We successfully moved <b>%s</b>!" COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB="We successfully moved <b>%s</b>!"
COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION="While we download all 26 compiler GIF animations randomly used in the compiler GUI during compilation" COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION="While we download all 26 compiler GIF animations randomly used in the compiler GUI during compilation"
COM_COMPONENTBUILDER_WIKI="Wiki"
COM_COMPONENTBUILDER_YES="Yes" COM_COMPONENTBUILDER_YES="Yes"
COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY="Your data is encrypted with a AES 128 bit encryption using the above 32 character key." COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY="Your data is encrypted with a AES 128 bit encryption using the above 32 character key."
COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE="Your data is encrypted with a AES 128 bit encryption using the above 32 character key. Without this key it will take the current technology with a brute force attack method more then <a href="http://random-ize.com/how-long-to-hack-pass/" target="_blank" title="How long to hack pass">700 000 000 000 000 000 000 000 000 000 000</a> years to crack theoretically. Unless they have this key above, so do keep it safe." COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE="Your data is encrypted with a AES 128 bit encryption using the above 32 character key. Without this key it will take the current technology with a brute force attack method more then <a href="http://random-ize.com/how-long-to-hack-pass/" target="_blank" title="How long to hack pass">700 000 000 000 000 000 000 000 000 000 000</a> years to crack theoretically. Unless they have this key above, so do keep it safe."

View File

@ -305,15 +305,15 @@ class ComponentbuilderModelAjax extends ListModel
} }
catch (DomainException $e) catch (DomainException $e)
{ {
return $this->getTokenFromVDM($e->getMessage()); return $this->getTokenForWiki($e->getMessage());
} }
catch (InvalidArgumentException $e) catch (InvalidArgumentException $e)
{ {
return $this->getTokenFromVDM($e->getMessage()); return $this->getTokenForWiki($e->getMessage());
} }
catch (Exception $e) catch (Exception $e)
{ {
return $this->getTokenFromVDM($e->getMessage()); return $this->getTokenForWiki($e->getMessage());
} }
// get the html // get the html
@ -322,10 +322,10 @@ class ComponentbuilderModelAjax extends ListModel
return ['page' => $page]; return ['page' => $page];
} }
return $this->getTokenFromVDM(); return $this->getTokenForWiki();
} }
protected function getTokenFromVDM($message = null) protected function getTokenForWiki($message = null)
{ {
if ($message) if ($message)
{ {
@ -335,6 +335,93 @@ class ComponentbuilderModelAjax extends ListModel
return ['error' => JText::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION')]; return ['error' => JText::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION')];
} }
public function getVersion($version = null)
{
// get the token if set
$token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false);
// only add if token is set
if ($token)
{
// setup a registry
$options = new Registry;
$options->set('access.token', $token);
// get the gitea http
try
{
// get gitea object
$gitea = new Gitea($options);
// get a list of all the repos tags
$tags = $gitea->repo->getListTags('joomla', 'Component-Builder');
}
catch (DomainException $e)
{
return $this->getTokenForVersion($e->getMessage());
}
catch (InvalidArgumentException $e)
{
return $this->getTokenForVersion($e->getMessage());
}
catch (Exception $e)
{
return $this->getTokenForVersion($e->getMessage());
}
// do we have tags returned
if (isset($tags[0]) && isset($tags[0]->name))
{
// get the version
$manifest = ComponentbuilderHelper::manifest();
$local_version = (string) $manifest->version;
$current_version = trim($tags[0]->name, 'vV');
// now check if this version is out dated
if ($current_version === $local_version)
{
return ['notice' => '<small><span style="color:green;"><span class="icon-shield"></span>' . JText::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '</span></small>'];
}
else
{
// check if this is beta version
$current_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $current_version));
$local_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $local_version));
if (($local_array[0] > $current_array[0]) ||
($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) ||
($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2]))
{
return ['notice' => '<small><span style="color:#F7B033;"><span class="icon-wrench"></span>' . JText::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '</span></small>'];
}
else
{
// download link of the latest version
$download = "https://git.vdm.dev/api/v1/repos/joomla/Component-Builder/archive/" . $tags[0]->name . ".zip?access_token=" . $token;
return ['notice' => '<small><span style="color:red;"><span class="icon-warning-circle"></span>' . JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '!</span> <a style="color:green;" href="' .
$download . '" title="' . JText::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '">' . JText::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>'];
}
}
}
}
return $this->getTokenForVersion();
}
protected function getTokenForVersion($message = null)
{
// the URL
$url = 'https://git.vdm.dev/user/settings/applications';
// create link
$a = '<small><a style="color:#F7B033;" href="' . $url . '" title="';
$a_ = '">';
$_a = '</a></small>';
if ($message)
{
return ['error' => $a . $message . $a_ . JText::_('COM_COMPONENTBUILDER_GET_TOKEN') . $_a];
}
return ['error' => $a . JText::_('COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_TO_GET_UPDATE_NOTICE_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS') . $a_ . JText::_('COM_COMPONENTBUILDER_GET_TOKEN') . $_a];
}
// Used in joomla_module // Used in joomla_module
public function getModuleCode($data) public function getModuleCode($data)
{ {

View File

@ -416,90 +416,26 @@ class ComponentbuilderModelComponentbuilder extends ListModel
$call_url = JUri::base() . 'index.php?option=com_componentbuilder&task=ajax.getWiki&format=json&raw=true&' . JSession::getFormToken() . '=1&name=Home'; $call_url = JUri::base() . 'index.php?option=com_componentbuilder&task=ajax.getWiki&format=json&raw=true&' . JSession::getFormToken() . '=1&name=Home';
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$document->addScriptDeclaration(' $document->addScriptDeclaration('
fetch("' . $call_url . '").then((response) => { function getWikiPage(){
if (response.ok) {
return response.json(); fetch("' . $call_url . '").then((response) => {
} if (response.ok) {
}).then((result) => { return response.json();
if (typeof result.page !== "undefined") { }
document.getElementById("wiki-md").innerHTML = result.page; }).then((result) => {
} else if (typeof result.error !== "undefined") { if (typeof result.page !== "undefined") {
document.getElementById("wiki-md-error").innerHTML = result.error document.getElementById("wiki-md").innerHTML = result.page;
} } else if (typeof result.error !== "undefined") {
});'); document.getElementById("wiki-md-error").innerHTML = result.error
}
});
}
setTimeout(getWikiPage, 1000);');
return '<div id="wiki-md"><small>'.JText::_('COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING').'.<span class="loading-dots">.</span></small></div><div id="wiki-md-error" style="color: red"></div>'; return '<div id="wiki-md"><small>'.JText::_('COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING').'.<span class="loading-dots">.</span></small></div><div id="wiki-md-error" style="color: red"></div>';
} }
public function getGitea()
{
// get the document
$document = JFactory::getDocument();
// get the token if set
$token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false);
// only add if token is set
if ($token)
{
// setup a registry
$options = new Registry;
$options->set('access.token', $token);
// get the gitea http
try
{
// get gitea object
$gitea = new Gitea($options);
// get a list of all the repos tags
$tags = $gitea->repo->getListTags('joomla', 'Component-Builder');
}
catch (DomainException $m)
{
$token = false;
}
// get the document to load the scripts
if ($token && isset($tags[0]) && isset($tags[0]->name))
{
// download link of the latest version
$download = "https://git.vdm.dev/api/v1/repos/joomla/Component-Builder/archive/" . $tags[0]->name . ".zip?access_token=" . $token;
// load the JavaScript to the page
$document->addScriptDeclaration('
jQuery(document).ready(function () {
var activeVersion = "' . trim($tags[0]->name, 'vV') . '";
if (activeVersion === manifest.version) {
// local version is in sync with latest release
jQuery(".update-notice").html("<small><span style=\'color:green;\'><span class=\'icon-shield\'></span>' . JText::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '</span></small>");
} else {
// split versions in to array
var activeVersionArray = activeVersion.split(".");
var localVersionArray = manifest.version.split(".");
if ((+localVersionArray[0] > +activeVersionArray[0]) ||
(+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] > +activeVersionArray[1]) ||
(+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] == +activeVersionArray[1] && +localVersionArray[2] > +activeVersionArray[2])) {
// local version head latest release
jQuery(".update-notice").html("<small><span style=\'color:#F7B033;\'><span class=\'icon-wrench\'></span>' . JText::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '</span></small>");
} else {
// local version behind latest release
jQuery(".update-notice").html("<small><span style=\'color:red;\'><span class=\'icon-warning-circle\'></span>' . JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '</span> <a style=\'color:green;\' href=\'' .
$download . '\' title=\'' . JText::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '\'>' .
JText::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>");
}
}
});');
return;
}
}
// the URL
$url = 'https://git.vdm.dev/user/settings/applications';
// give a notice to get the token
$document->addScriptDeclaration(
'jQuery(document).ready(function () {jQuery(".update-notice").html("<small><a style=\'color:#F7B033;\' href=\'' .
$url . '\' title=\'' . JText::_('COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_FOR_UPDATES_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS') . '\'>' .
JText::_('COM_COMPONENTBUILDER_GET_TOKEN') . '!</a></small>");});'
);
}
public function getNoticeboard() public function getNoticeboard()
{ {
// get the document to load the scripts // get the document to load the scripts
@ -591,4 +527,27 @@ jQuery(document).ready( function($) {
return '<div id="readme-md"><small>'.JText::_('COM_COMPONENTBUILDER_THE_README_IS_LOADING').'.<span class="loading-dots">.</span></small></div>'; return '<div id="readme-md"><small>'.JText::_('COM_COMPONENTBUILDER_THE_README_IS_LOADING').'.<span class="loading-dots">.</span></small></div>';
} }
public function getVersion()
{
// the call URL
$call_url = JUri::base() . 'index.php?option=com_componentbuilder&task=ajax.getVersion&format=json&raw=true&' . JSession::getFormToken() . '=1&version=1';
$document = JFactory::getDocument();
$document->addScriptDeclaration('
function getComponentVersionStatus() {
fetch("' . $call_url . '").then((response) => {
if (response.ok) {
return response.json();
}
}).then((result) => {
if (typeof result.notice !== "undefined") {
document.getElementById("component-update-notice").innerHTML = result.notice;
} else if (typeof result.error !== "undefined") {
document.getElementById("component-update-notice").innerHTML = result.error;
}
});
}
setTimeout(getComponentVersionStatus, 800);');
}
} }

View File

@ -38,58 +38,50 @@ defined('_JEXEC') or die('Restricted access');
</div> </div>
<?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'wiki', JText::_('Wiki', true)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'wiki', JText::_('COM_COMPONENTBUILDER_WIKI', true)); ?>
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'wiki_accordian', array('active' => 'wiki_one')); ?> <?php echo JHtml::_('bootstrap.startAccordion', 'wiki_accordian', array('active' => 'wiki_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'wiki_accordian', 'Tutorials', 'wiki_one'); ?> <?php echo JHtml::_('bootstrap.addSlide', 'wiki_accordian', 'Tutorials', 'wiki_one'); ?>
<?php echo $this->loadTemplate('wiki_tutorials');?> <?php echo $this->loadTemplate('wiki_tutorials');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?> <?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?> <?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div> </div>
<div class="span2">
<?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?>
</div>
</div> </div>
<?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'notice_board', JText::_('Notice Board', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'notice_board', JText::_('COM_COMPONENTBUILDER_NOTICE_BOARD', true)); ?>
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'notice_board_accordian', array('active' => 'notice_board_one')); ?> <?php echo JHtml::_('bootstrap.startAccordion', 'notice_board_accordian', array('active' => 'notice_board_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'Vast Development Method', 'notice_board_one'); ?> <?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'Vast Development Method', 'notice_board_one'); ?>
<?php echo $this->loadTemplate('notice_board_vast_development_method');?> <?php echo $this->loadTemplate('notice_board_vast_development_method');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?> <?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?> <?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div> </div>
<div class="span2">
<?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?>
</div>
</div> </div>
<?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'readme', JText::_('Readme', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'readme', JText::_('COM_COMPONENTBUILDER_README', true)); ?>
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'readme_accordian', array('active' => 'readme_one')); ?> <?php echo JHtml::_('bootstrap.startAccordion', 'readme_accordian', array('active' => 'readme_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'readme_accordian', 'Information', 'readme_one'); ?> <?php echo JHtml::_('bootstrap.addSlide', 'readme_accordian', 'Information', 'readme_one'); ?>
<?php echo $this->loadTemplate('readme_information');?> <?php echo $this->loadTemplate('readme_information');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?> <?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?> <?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div> </div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'notice_board', JText::_('COM_COMPONENTBUILDER_NOTICE_BOARD', true)); ?>
<div class="row-fluid">
<div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'notice_board_accordian', array('active' => 'notice_board_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'Vast Development Method', 'notice_board_one'); ?>
<?php echo $this->loadTemplate('notice_board_vast_development_method');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'JCB Pro Membership', 'notice_board_two'); ?>
<?php echo $this->loadTemplate('notice_board_jcb_pro_membership');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div>
<div class="span2"> <div class="span2">
<?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?> <?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?>
</div> </div>
</div> </div>
<?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?> <?php echo JHtml::_('bootstrap.endTabSet'); ?>

View File

@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access');
?> ?>
<img alt="<?php echo JText::_('COM_COMPONENTBUILDER'); ?>" src="components/com_componentbuilder/assets/images/vdm-component.jpg"> <img alt="<?php echo JText::_('COM_COMPONENTBUILDER'); ?>" src="components/com_componentbuilder/assets/images/vdm-component.jpg">
<ul class="list-striped"> <ul class="list-striped">
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice"></span></li> <li><b><?php echo JText::_('COM_COMPONENTBUILDER_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice" id="component-update-notice"></span></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li> <li><b><?php echo JText::_('COM_COMPONENTBUILDER_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li> <li><b><?php echo JText::_('COM_COMPONENTBUILDER_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li> <li><b><?php echo JText::_('COM_COMPONENTBUILDER_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li>

View File

@ -29,9 +29,9 @@ class ComponentbuilderViewComponentbuilder extends JViewLegacy
$this->icons = $this->get('Icons'); $this->icons = $this->get('Icons');
$this->contributors = ComponentbuilderHelper::getContributors(); $this->contributors = ComponentbuilderHelper::getContributors();
$this->wiki = $this->get('Wiki'); $this->wiki = $this->get('Wiki');
$this->gitea = $this->get('Gitea');
$this->noticeboard = $this->get('Noticeboard'); $this->noticeboard = $this->get('Noticeboard');
$this->readme = $this->get('Readme'); $this->readme = $this->get('Readme');
$this->version = $this->get('Version');
// get the manifest details of the component // get the manifest details of the component
$this->manifest = ComponentbuilderHelper::manifest(); $this->manifest = ComponentbuilderHelper::manifest();

View File

@ -7,9 +7,9 @@
<authorUrl>https://dev.vdm.io</authorUrl> <authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright> <copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license> <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>3.1.3</version> <version>3.1.4</version>
<description><![CDATA[ <description><![CDATA[
<h1>Component Builder (v.3.1.3)</h1> <h1>Component Builder (v.3.1.4)</h1>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time. <p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.

View File

@ -1079,10 +1079,10 @@
<element>pkg_component_builder</element> <element>pkg_component_builder</element>
<type>package</type> <type>package</type>
<client>site</client> <client>site</client>
<version>3.1.3</version> <version>3.1.4</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl> <infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads> <downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.3.zip</downloadurl> <downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.4.zip</downloadurl>
</downloads> </downloads>
<tags> <tags>
<tag>stable</tag> <tag>stable</tag>

View File

@ -9422,7 +9422,7 @@ class com_componentbuilderInstallerScript
echo '<a target="_blank" href="https://dev.vdm.io" title="Component Builder"> echo '<a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/> <img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a> </a>
<h3>Upgrade to Version 3.1.3 Was Successful! Let us know if anything is not working as expected.</h3>'; <h3>Upgrade to Version 3.1.4 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already. // Set db if not set already.
if (!isset($db)) if (!isset($db))