Completed the get snippets area so JCB community snippets can with easy be added to the local snippets gh-92.

This commit is contained in:
2017-11-17 18:18:47 +02:00
parent f34e1b19f8
commit 268b609cea
9 changed files with 427 additions and 37 deletions

View File

@ -60,6 +60,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
$this->registerTask('checkFunctionName', 'ajax');
$this->registerTask('usedin', 'ajax');
$this->registerTask('snippetDetails', 'ajax');
$this->registerTask('setSnippetGithub', 'ajax');
$this->registerTask('fieldOptions', 'ajax');
}
@ -768,6 +769,45 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
}
}
break;
case 'setSnippetGithub':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$pathValue = $jinput->get('path', NULL, 'STRING');
$statusValue = $jinput->get('status', NULL, 'WORD');
if($pathValue && $statusValue && $user->id != 0)
{
$result = $this->getModel('ajax')->setSnippetGithub($pathValue, $statusValue);
}
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 'fieldOptions':
try
{