Skip to content

Commit

Permalink
stable fixes. basic tag management
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Jan 23, 2020
1 parent c1dac0b commit fb809fc
Show file tree
Hide file tree
Showing 16 changed files with 745 additions and 30 deletions.
14 changes: 14 additions & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@
],
],
],
'tag-entity' => [
'type' => Segment::class,
'options' => [
'route' => '/tag/entity[/:action[/:filter]]',
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'filter' => '[a-zA-Z0-9_-]+',
],
'defaults' => [
'controller' => Controller\EntityController::class,
'action' => 'index',
],
],
],
],
],

Expand Down
81 changes: 69 additions & 12 deletions data/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@
CREATE TABLE `core_tag` (
`Tag_ID` int(11) NOT NULL,
`tag_key` varchar(50) NOT NULL,
`tag_label` varchar(255) NOT NULL
`tag_label` varchar(255) NOT NULL,
`created_by` int(11) NOT NULL,
`created_date` datetime NOT NULL,
`modified_by` int(11) NOT NULL,
`modified_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `core_tag` (`Tag_ID`, `tag_key`, `tag_label`) VALUES
(1, 'category', 'Category'),
(2, 'state', 'State');

ALTER TABLE `core_tag`
ADD PRIMARY KEY (`Tag_ID`),
ADD UNIQUE KEY `tag_key` (`tag_key`);

ALTER TABLE `core_tag`
MODIFY `Tag_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
MODIFY `Tag_ID` int(11) NOT NULL AUTO_INCREMENT;

INSERT INTO `core_tag` (`Tag_ID`, `tag_key`, `tag_label`) VALUES
(NULL, 'category', 'Category'),
(NULL, 'state', 'State');

--
-- Core Entity Tag
Expand All @@ -39,15 +43,68 @@ ALTER TABLE `core_entity_tag`
ALTER TABLE `core_entity_tag`
MODIFY `Entitytag_ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- Core Entity Tag - Entity
--
CREATE TABLE `core_entity_tag_entity` (
`entity_idfs` int(11) NOT NULL,
`entity_tag_idfs` int(11) NOT NULL,
`entity_type` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

ALTER TABLE `core_entity_tag_entity`
ADD PRIMARY KEY (`entity_idfs`,`entity_type`,`entity_tag_idfs`);

--
-- Permissions
--
INSERT INTO `permission` (`permission_key`, `module`, `label`, `show_in_menu`) VALUES
('add', 'OnePlace\\Tag\\Controller\\TagController', 'Add', 0),
('edit', 'OnePlace\\Tag\\Controller\\TagController', 'Edit', 0),
('view', 'OnePlace\\Tag\\Controller\\TagController', 'View', 0),
('index', 'OnePlace\\Tag\\Controller\\TagController', 'Index', 1),
('list', 'OnePlace\\Tag\\Controller\\ApiController', 'List', 1);
INSERT INTO `permission` (`permission_key`, `module`, `label`, `nav_label`, `nav_href`, `show_in_menu`) VALUES
('add', 'OnePlace\\Tag\\Controller\\TagController', 'Add', '', '', 0),
('edit', 'OnePlace\\Tag\\Controller\\TagController', 'Edit', '', '', 0),
('index', 'OnePlace\\Tag\\Controller\\TagController', 'Index', 'Tags', '/tag', 1),
('list', 'OnePlace\\Tag\\Controller\\ApiController', 'List', '', '', 1),
('view', 'OnePlace\\Tag\\Controller\\TagController', 'View', '', '', 0),
('add', 'OnePlace\\Tag\\Controller\\EntityController', 'Add', '', '', 0);

--
-- TAG - Core Form
--
INSERT INTO `core_form` (`form_key`, `label`) VALUES
('tag-single', 'Tag'),
('entitytag-single', 'Entity Tag');

--
-- TAG - Core Form Button
--
INSERT INTO `core_form_button` (`Button_ID`, `label`, `icon`, `title`, `href`, `class`, `append`, `form`, `mode`, `filter_check`, `filter_value`) VALUES
(NULL, 'Save Tag', 'fas fa-save', 'Save Tag', '#', 'primary saveForm', '', 'tag-single', 'link', '', ''),
(NULL, 'Edit Tag', 'fas fa-edit', 'Edit Tag', '/tag/edit/##ID##', 'primary', '', 'tag-view', 'link', '', ''),
(NULL, 'Add Tag', 'fas fa-plus', 'Add Tag', '/tag/add', 'primary', '', 'tag-index', 'link', '', ''),
(NULL, 'Add Entity Tag', 'fas fa-plus', 'Add Entity Tag', '/tag/entity/add/##ID##', 'primary', '', 'tag-view', 'link', '', ''),
(NULL, 'Save Entity Tag', 'fas fa-save', 'Save Entity Tag', '#', 'primary saveForm', '', 'entitytag-single', 'link', '', '');

--
-- TAG - Core Form Tab
--
INSERT INTO `core_form_tab` (`Tab_ID`, `form`, `title`, `subtitle`, `icon`, `counter`, `sort_id`, `filter_check`, `filter_value`) VALUES
('tag-base', 'tag-single', 'Tag', 'Base', 'fas fa-tags', '', '0', '', ''),
('tag-entitytags', 'tag-single', 'Tags', 'Entity Tags', 'fas fa-tags', '', 0, '', ''),
('entitytag-base', 'entitytag-single', 'Entity Tag', 'Base', 'fas fa-tags', '', '0', '', '');

--
-- TAG - Core Form Field
--

INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_ist`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES
(NULL, 'text', 'Name', 'tag_label', 'tag-base', 'tag-single', 'col-md-3', '/tag/view/##ID##', '', 0, 1, 0, '', '', ''),
(NULL, 'text', 'Key', 'tag_key', 'tag-base', 'tag-single', 'col-md-3', '/tag/view/##ID##', '', 0, 1, 1, '', '', ''),
(NULL, 'partial', 'Entity Tags', 'entitytags', 'tag-entitytags', 'tag-single', 'col-md-12', '', '', '0', '1', '0', '', '', ''),
(NULL, 'text', 'Name', 'tag_value', 'entitytag-base', 'entitytag-single', 'col-md-3', '/tag/entity/view/##ID##', '', '0', '1', '0', '', '', '');

--
-- TAG - Core Index Table
--
INSERT INTO `core_index_table` (`table_name`, `form`, `label`) VALUES ('tag-index', 'tag-single', 'Tag Index');

--
-- Save
Expand Down
16 changes: 16 additions & 0 deletions docs/book/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# oneplace-core

onePlace Tag Module. Add Tags to every Module in onePlace with ease!

## Installation

Using composer

```bash
$ composer require oneplace/oneplace-tag
```

## Support
* Issues: [github.com/oneplc/plc_x_tag/issues](https://github.com/oneplc/plc_x_tag/issues)
* Source: [github.com/oneplc/plc_x_tag/](https://github.com/oneplc/plc_x_tag/)
* Telegram Group: [t.me/oneplc](https://t.me/oneplc)
9 changes: 2 additions & 7 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@ docs_dir: docs/book
site_dir: docs/html
nav:
- Home: index.md
- Introduction: intro.md
- 'Quick Start': quick-start.md
- Reference:
- 'Dynamic Fields': dynamic-fields.md
- Examples: examples.md
site_name: oneplace-tag
site_description: "onePlace Application Tag Module"
site_description: "onePlace Tag Module"
repo_url: 'https://github.com/OnePlc/PLC_X_Tag'
theme: readthedocs
theme: bootstrap4
extra:
project: onePlc
3 changes: 2 additions & 1 deletion src/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
namespace OnePlace\Tag\Controller;

use Application\Controller\CoreController;
use OnePlace\Tag\Model\EntityTagTable;
use OnePlace\Tag\Model\TagTable;
use Laminas\View\Model\ViewModel;
use Laminas\Db\Adapter\AdapterInterface;
Expand All @@ -37,7 +38,7 @@ class ApiController extends CoreController {
* @param TagTable $oTableGateway
* @since 1.0.0
*/
public function __construct(AdapterInterface $oDbAdapter,TagTable $oTableGateway,$oServiceManager) {
public function __construct(AdapterInterface $oDbAdapter,EntityTagTable $oTableGateway,$oServiceManager) {
parent::__construct($oDbAdapter,$oTableGateway,$oServiceManager);
$this->oTableGateway = $oTableGateway;
$this->sSingleForm = 'tag-single';
Expand Down
Loading

0 comments on commit fb809fc

Please sign in to comment.