feat: add admin component (6 views) + webservices plugin (5 API routes)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<?xml version="1.0"?><access component="com_mokosuitelibrary"><section name="component"><action name="core.admin"/><action name="core.manage"/><action name="core.create"/><action name="core.edit"/><action name="core.delete"/></section></access>
|
||||
@@ -0,0 +1 @@
|
||||
<?xml version="1.0"?><config><fieldset name="component"><field name="note" type="note" label="Configuration coming soon."/></fieldset></config>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\Extension\ComponentInterface;
|
||||
use Joomla\CMS\Extension\MVCComponent;
|
||||
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
return new class implements ServiceProviderInterface {
|
||||
public function register(Container $container): void {
|
||||
$container->set(ComponentInterface::class, function (Container $container) {
|
||||
$c = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
||||
$c->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||
return $c;
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace Moko\Component\MokoSuiteLibrary\Administrator\Controller;
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
class DisplayController extends BaseController {
|
||||
protected $default_view = 'librarydashboard';
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace Moko\Component\MokoSuiteLibrary\Administrator\Model;
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
|
||||
class LibraryDashboardModel extends BaseDatabaseModel {
|
||||
public function getDashboard(): object { return (object)['status' => 'ok']; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Moko\Component\MokoSuiteLibrary\Administrator\View\LibraryCatalog;
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
class HtmlView extends BaseHtmlView {
|
||||
public function display($tpl = null): void {
|
||||
ToolbarHelper::title('MokoSuite Library - LibraryCatalog');
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Moko\Component\MokoSuiteLibrary\Administrator\View\LibraryCheckouts;
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
class HtmlView extends BaseHtmlView {
|
||||
public function display($tpl = null): void {
|
||||
ToolbarHelper::title('MokoSuite Library - LibraryCheckouts');
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Moko\Component\MokoSuiteLibrary\Administrator\View\LibraryDashboard;
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
class HtmlView extends BaseHtmlView {
|
||||
public function display($tpl = null): void {
|
||||
ToolbarHelper::title('MokoSuite Library - LibraryDashboard');
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Moko\Component\MokoSuiteLibrary\Administrator\View\LibraryFines;
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
class HtmlView extends BaseHtmlView {
|
||||
public function display($tpl = null): void {
|
||||
ToolbarHelper::title('MokoSuite Library - LibraryFines');
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Moko\Component\MokoSuiteLibrary\Administrator\View\LibraryPatrons;
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
class HtmlView extends BaseHtmlView {
|
||||
public function display($tpl = null): void {
|
||||
ToolbarHelper::title('MokoSuite Library - LibraryPatrons');
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Moko\Component\MokoSuiteLibrary\Administrator\View\LibraryReservations;
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
class HtmlView extends BaseHtmlView {
|
||||
public function display($tpl = null): void {
|
||||
ToolbarHelper::title('MokoSuite Library - LibraryReservations');
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<?php defined('_JEXEC') or die; ?><div><h2>LibraryCatalog</h2><p>Coming soon.</p></div>
|
||||
@@ -0,0 +1 @@
|
||||
<?php defined('_JEXEC') or die; ?><div><h2>LibraryCheckouts</h2><p>Coming soon.</p></div>
|
||||
@@ -0,0 +1 @@
|
||||
<?php defined('_JEXEC') or die; ?><div><h2>LibraryDashboard</h2><p>Coming soon.</p></div>
|
||||
@@ -0,0 +1 @@
|
||||
<?php defined('_JEXEC') or die; ?><div><h2>LibraryFines</h2><p>Coming soon.</p></div>
|
||||
@@ -0,0 +1 @@
|
||||
<?php defined('_JEXEC') or die; ?><div><h2>LibraryPatrons</h2><p>Coming soon.</p></div>
|
||||
@@ -0,0 +1 @@
|
||||
<?php defined('_JEXEC') or die; ?><div><h2>LibraryReservations</h2><p>Coming soon.</p></div>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" method="upgrade">
|
||||
<name>MokoSuite Library</name>
|
||||
<author>Moko Consulting</author>
|
||||
<creationDate>2026-06-23</creationDate>
|
||||
<copyright>Copyright (C) 2026 Moko Consulting.</copyright>
|
||||
<license>GPL-3.0-or-later</license>
|
||||
<version>01.00.00</version>
|
||||
<namespace path="src">Moko\Component\MokoSuiteLibrary</namespace>
|
||||
<administration>
|
||||
<files folder="admin"><folder>services</folder><folder>src</folder><folder>tmpl</folder></files>
|
||||
<menu>COM_MOKOSUITELIBRARY</menu>
|
||||
</administration>
|
||||
</extension>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<extension type="plugin" group="webservices" method="upgrade">
|
||||
<name>Web Services - MokoSuite Library</name>
|
||||
<element>mokosuitelibrary</element>
|
||||
<author>Moko Consulting</author>
|
||||
<version>01.00.00</version>
|
||||
<license>GPL-3.0-or-later</license>
|
||||
<namespace path="src">Moko\Plugin\WebServices\MokoSuiteLibrary</namespace>
|
||||
<files><folder>src</folder><folder>services</folder></files>
|
||||
</extension>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Moko\Plugin\WebServices\MokoSuiteLibrary\Extension\MokoSuiteLibrary;
|
||||
return new class implements ServiceProviderInterface {
|
||||
public function register(Container $container): void {
|
||||
$container->set(PluginInterface::class, function (Container $container) {
|
||||
return new MokoSuiteLibrary($container->get(DispatcherInterface::class), (array) PluginHelper::getPlugin('webservices', 'mokosuitelibrary'));
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace Moko\Plugin\WebServices\MokoSuiteLibrary\Extension;
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
class MokoSuiteLibrary extends CMSPlugin implements SubscriberInterface {
|
||||
public static function getSubscribedEvents(): array {
|
||||
return ['onBeforeApiRoute' => 'onBeforeApiRoute'];
|
||||
}
|
||||
public function onBeforeApiRoute(&$event): void {
|
||||
$router = $event->getArgument('router');
|
||||
$router->createCRUDRoutes('v1/mokosuitelibrary/items', 'items', ['component' => 'com_mokosuitelibrary']);
|
||||
$router->createCRUDRoutes('v1/mokosuitelibrary/patrons', 'patrons', ['component' => 'com_mokosuitelibrary']);
|
||||
$router->createCRUDRoutes('v1/mokosuitelibrary/checkouts', 'checkouts', ['component' => 'com_mokosuitelibrary']);
|
||||
$router->createCRUDRoutes('v1/mokosuitelibrary/reservations', 'reservations', ['component' => 'com_mokosuitelibrary']);
|
||||
$router->createCRUDRoutes('v1/mokosuitelibrary/fines', 'fines', ['component' => 'com_mokosuitelibrary']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user