Added some helper script to the new Joomla Module Builder. Consolidated some ajax calls.

This commit is contained in:
2019-12-11 01:18:55 +02:00
parent 8c284aaed4
commit b9729c49af
16 changed files with 488 additions and 514 deletions

View File

@ -31,6 +31,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
$this->registerTask('getCronPath', 'ajax');
$this->registerTask('getJCBpackageInfo', 'ajax');
$this->registerTask('getCrowdinDetails', 'ajax');
$this->registerTask('getModuleCode', 'ajax');
$this->registerTask('getClassCode', 'ajax');
$this->registerTask('getClassCodeIds', 'ajax');
$this->registerTask('getClassHeaderCode', 'ajax');
@ -304,6 +305,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
}
}
break;
case 'getModuleCode':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$dataValue = $jinput->get('data', NULL, 'STRING');
if($dataValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getModuleCode($dataValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode($e).");";
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getClassCode':
try
{
@ -655,7 +694,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$typeValue = $jinput->get('type', NULL, 'INT');
$typeValue = $jinput->get('type', NULL, 'ALNUM');
if($typeValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getLinked($typeValue);
@ -693,7 +732,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$typeValue = $jinput->get('type', NULL, 'INT');
$typeValue = $jinput->get('type', NULL, 'ALNUM');
if($typeValue && $user->id != 0)
{
$result = $this->getModel('ajax')->checkAliasField($typeValue);