diff --git a/Admin/Activate.php b/Admin/Activate.php new file mode 100644 index 0000000..5383b48 --- /dev/null +++ b/Admin/Activate.php @@ -0,0 +1,44 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Editor\Admin; + + +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Module\ActivateAbstract; +use phpOMS\Module\InfoManager; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Activate extends ActivateAbstract +{ + + /** + * {@inheritdoc} + */ + public static function activate(DatabasePool $dbPool, InfoManager $info) + { + parent::activate($dbPool, $info); + } +} diff --git a/Admin/Deactivate.php b/Admin/Deactivate.php new file mode 100644 index 0000000..f1b2414 --- /dev/null +++ b/Admin/Deactivate.php @@ -0,0 +1,44 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Editor\Admin; + + +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Module\DeactivateAbstract; +use phpOMS\Module\InfoManager; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Deactivate extends DeactivateAbstract +{ + + /** + * {@inheritdoc} + */ + public static function deactivate(DatabasePool $dbPool, InfoManager $info) + { + parent::deactivate($dbPool, $info); + } +} diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json new file mode 100644 index 0000000..819dca2 --- /dev/null +++ b/Admin/Install/Navigation.install.json @@ -0,0 +1,48 @@ +[ + { + "id": 1005301001, + "pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd", + "type": 2, + "subtype": 1, + "name": "Editor", + "uri": "/{/lang}/backend/editor/list?{?}", + "target": "self", + "icon": null, + "order": 75, + "from": "Editor", + "permission": null, + "parent": 1003301001, + "children": [ + { + "id": 1005302001, + "pid": "439884690b4c05681a7c7ca9292d5cfb03d2971f", + "type": 3, + "subtype": 1, + "name": "List", + "uri": "/{/lang}/backend/editor/list?{?}", + "target": "self", + "icon": null, + "order": 1, + "from": "Editor", + "permission": null, + "parent": 1005301001, + "children": [] + }, + { + "id": 1005302101, + "pid": "439884690b4c05681a7c7ca9292d5cfb03d2971f", + "type": 3, + "subtype": 5, + "name": "Create", + "uri": "/{/lang}/backend/editor/create?{?}", + "target": "self", + "icon": null, + "order": 15, + "from": "Editor", + "permission": null, + "parent": 1005301001, + "children": [] + } + ] + } +] diff --git a/Admin/Install/Navigation.php b/Admin/Install/Navigation.php new file mode 100644 index 0000000..b89cdff --- /dev/null +++ b/Admin/Install/Navigation.php @@ -0,0 +1,40 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Editor\Admin\Install; +use phpOMS\DataStorage\Database\DatabasePool; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Navigation +{ + public static function install(string $path, DatabasePool $dbPool) + { + $navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true); + + $class = '\\Modules\\Navigation\\Admin\\Installer'; + /** @var $class \Modules\Navigation\Admin\Installer */ + $class::installExternal($dbPool, $navData); + } +} diff --git a/Admin/Installer.php b/Admin/Installer.php new file mode 100644 index 0000000..dbd38fd --- /dev/null +++ b/Admin/Installer.php @@ -0,0 +1,82 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Editor\Admin; + +use phpOMS\DataStorage\Database\DatabaseType; +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Module\InfoManager; +use phpOMS\Module\InstallerAbstract; + +/** + * Editor install class. + * + * @category Modules + * @package Modules\Editor + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Installer extends InstallerAbstract +{ + + /** + * {@inheritdoc} + */ + public static function install(string $path, DatabasePool $dbPool, InfoManager $info) + { + parent::install($path, $dbPool, $info); + + switch ($dbPool->get('core')->getType()) { + case DatabaseType::MYSQL: + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'editor_doc` ( + `editor_doc_id` int(11) NOT NULL AUTO_INCREMENT, + `editor_doc_title` varchar(250) NOT NULL, + `editor_doc_plain` text NOT NULL, + `editor_doc_content` text NOT NULL, + `editor_doc_path` varchar(255) NOT NULL, + `editor_doc_created_at` datetime NOT NULL, + `editor_doc_created_by` int(11) NOT NULL, + PRIMARY KEY (`editor_doc_id`), + KEY `editor_doc_created_by` (`editor_doc_created_by`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'editor_doc` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'editor_doc_ibfk_1` FOREIGN KEY (`editor_doc_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'editor_tag` ( + `editor_tag_id` int(11) NOT NULL AUTO_INCREMENT, + `editor_tag_doc` int(11) NOT NULL, + `editor_tag_tag` varchar(20) NOT NULL, + PRIMARY KEY (`editor_tag_id`), + KEY `editor_tag_doc` (`editor_tag_doc`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'editor_tag` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'editor_tag_ibfk_1` FOREIGN KEY (`editor_tag_doc`) REFERENCES `' . $dbPool->get('core')->prefix . 'editor_doc` (`editor_doc_id`);' + )->execute(); + break; + } + } +} diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php new file mode 100644 index 0000000..308d911 --- /dev/null +++ b/Admin/Routes/Web/Api.php @@ -0,0 +1,12 @@ + [ + [ + 'dest' => '\Modules\Editor\Controller:apiEditorCreate', + 'verb' => RouteVerb::SET, + ], + ], +]; diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php new file mode 100644 index 0000000..2519faf --- /dev/null +++ b/Admin/Routes/Web/Backend.php @@ -0,0 +1,28 @@ + [ + [ + 'dest' => '\Modules\Editor\Controller:setUpEditorEditor', + 'verb' => RouteVerb::GET, + ], + [ + 'dest' => '\Modules\Editor\Controller:viewEditorCreate', + 'verb' => RouteVerb::GET, + ], + ], + '^.*/backend/editor/list.*$' => [ + [ + 'dest' => '\Modules\Editor\Controller:viewEditorList', + 'verb' => RouteVerb::GET, + ], + ], + '^.*/backend/editor/single.*$' => [ + [ + 'dest' => '\Modules\Editor\Controller:viewEditorSingle', + 'verb' => RouteVerb::GET, + ], + ], +]; diff --git a/Admin/Routes/console.php b/Admin/Routes/console.php new file mode 100644 index 0000000..1ecbfac --- /dev/null +++ b/Admin/Routes/console.php @@ -0,0 +1,3 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Editor\Admin; + + +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Module\UninstallAbstract; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Uninstall extends UninstallAbstract +{ + + /** + * {@inheritdoc} + */ + public static function uninstall(DatabasePool $dbPool, InfoManager $info) + { + parent::uninstall($dbPool, $info); + } +} diff --git a/Admin/Update.php b/Admin/Update.php new file mode 100644 index 0000000..c2f0432 --- /dev/null +++ b/Admin/Update.php @@ -0,0 +1,46 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Editor\Admin; + + +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Module\UpdateAbstract; +use phpOMS\System\File\Directory; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Update extends UpdateAbstract +{ + + /** + * {@inheritdoc} + */ + public static function update(DatabasePool $dbPool, array $info) + { + Directory::deletePath(__DIR__ . '/Update'); + mkdir('Update'); + parent::update($dbPool, $info); + } +} diff --git a/Controller.js b/Controller.js new file mode 100644 index 0000000..e69de29 diff --git a/Controller.php b/Controller.php new file mode 100644 index 0000000..65cfdbb --- /dev/null +++ b/Controller.php @@ -0,0 +1,207 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Editor; + +use Model\Message\FormValidation; +use Modules\Navigation\Models\Navigation; +use Modules\Navigation\Views\NavigationView; +use Modules\Editor\Models\EditorDoc; +use Modules\Editor\Models\EditorDocMapper; +use phpOMS\Asset\AssetType; +use phpOMS\Contract\RenderableInterface; +use phpOMS\Message\RequestAbstract; +use phpOMS\Message\ResponseAbstract; +use phpOMS\Module\ModuleAbstract; +use phpOMS\Module\WebInterface; +use phpOMS\Views\View; +use phpOMS\Views\ViewLayout; + +/** + * Calendar controller class. + * + * @category Modules + * @package Editor + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Controller extends ModuleAbstract implements WebInterface +{ + + /** + * Module path. + * + * @var string + * @since 1.0.0 + */ + /* public */ const MODULE_PATH = __DIR__; + + /** + * Module version. + * + * @var string + * @since 1.0.0 + */ + /* public */ const MODULE_VERSION = '1.0.0'; + + /** + * Module name. + * + * @var string + * @since 1.0.0 + */ + /* public */ const MODULE_NAME = 'Editor'; + + /** + * Providing. + * + * @var string + * @since 1.0.0 + */ + protected static $providing = []; + + /** + * Dependencies. + * + * @var string + * @since 1.0.0 + */ + protected static $dependencies = [ + ]; + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setUpEditorEditor(RequestAbstract $request, ResponseAbstract $response, $data = null) + { + $head = $response->get('Content')->getData('head'); + $head->addAsset(AssetType::JS, $request->getUri()->getBase() . 'Modules/Editor/Controller.js'); + } + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return \Serializable + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewEditorCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/Editor/Theme/Backend/editor-create'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005301001, $request, $response)); + + return $view; + } + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return \Serializable + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewEditorList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/Editor/Theme/Backend/editor-list'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005301001, $request, $response)); + + $docs = EditorDocMapper::getNewest(50); + $view->addData('docs', $docs); + + return $view; + } + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return \Serializable + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewEditorSingle(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/Editor/Theme/Backend/editor-single'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005301001, $request, $response)); + + $doc = EditorDocMapper::get((int) $request->getData('id')); + $view->addData('doc', $doc); + + return $view; + } + + private function validateEditorCreate(RequestAbstract $request) : array + { + $val = []; + if ( + ($val['title'] = empty($request->getData('title'))) + || ($val['plain'] = empty($request->getData('plain'))) + ) { + return $val; + } + + return []; + } + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function apiEditorCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) + { + if (!empty($val = $this->validateEditorCreate($request))) { + $response->set('editor_create', new FormValidation($val)); + + return; + } + + $doc = new EditorDoc(); + $doc->setTitle($request->getData('title') ?? ''); + $doc->setPlain($request->getData('plain') ?? ''); + $doc->setContent($request->getData('plain') ?? ''); + $doc->setCreatedAt(new \DateTime('now')); + $doc->setCreatedBy($request->getAccount()); + + EditorDocMapper::create($doc); + + $response->set('editor', $doc->jsonSerialize()); + } + +} diff --git a/Models/Editor.js b/Models/Editor.js new file mode 100644 index 0000000..9ffd623 --- /dev/null +++ b/Models/Editor.js @@ -0,0 +1,28 @@ +(function (jsOMS) + { + "use strict"; + + jsOMS.Modules.Editor.Editor = function (editor) + { + + }; + + jsOMS.Modules.Editor.prototype.getSelectedText = function() + { + var text = ''; + var activeEl = document.activeElement; + var activeElTagName = activeEl ? activeEl.tagName.toLowerCase() : null; + if ( + (activeElTagName === 'textarea' || activeElTagName === 'input') && + /^(?:text|search|password|tel|url)$/i.test(activeEl.type) && + (typeof activeEl.selectionStart === 'number') + ) { + text = activeEl.value.slice(activeEl.selectionStart, activeEl.selectionEnd); + } else if (window.getSelection) { + text = window.getSelection().toString(); + } + return text; + }; + + }(window.jsOMS = window.jsOMS || {}) +); \ No newline at end of file diff --git a/Models/EditorDoc.php b/Models/EditorDoc.php new file mode 100644 index 0000000..32daf0a --- /dev/null +++ b/Models/EditorDoc.php @@ -0,0 +1,275 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Editor\Models; + +use phpOMS\Contract\ArrayableInterface; + +/** + * News article class. + * + * @category Module + * @package Framework + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class EditorDoc implements ArrayableInterface, \JsonSerializable +{ + + /** + * Article ID. + * + * @var int + * @since 1.0.0 + */ + private $id = 0; + + /** + * Title. + * + * @var string + * @since 1.0.0 + */ + private $title = ''; + + /** + * Content. + * + * @var string + * @since 1.0.0 + */ + private $content = ''; + + /** + * Unparsed. + * + * @var string + * @since 1.0.0 + */ + private $plain = ''; + + /** + * Doc path for organizing. + * + * @var string + * @since 1.0.0 + */ + private $path = ''; + + /** + * Created. + * + * @var \DateTime + * @since 1.0.0 + */ + private $createdAt = null; + + /** + * Creator. + * + * @var int + * @since 1.0.0 + */ + private $createdBy = 0; + + /** + * Constructor. + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function __construct() + { + $this->createdAt = new \DateTime('NOW'); + } + + /** + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getContent() : string + { + return $this->content; + } + + /** + * @param string $content + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setContent(string $content) + { + $this->content = $content; + } + + /** + * @param string $plain + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setPlain(string $plain) + { + $this->plain = $plain; + } + + /** + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getPlain() : string + { + return $this->plain; + } + + /** + * @return \DateTime + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getCreatedAt() : \DateTime + { + return $this->createdAt; + } + + /** + * @return int + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getId() : int + { + return $this->id; + } + + /** + * @return int + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getCreatedBy() : int + { + return $this->createdBy; + } + + /** + * @param int $id + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setCreatedBy(int $id) + { + $this->createdBy = $id; + } + + /** + * @param \DateTime $createdAt + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setCreatedAt(\DateTime $createdAt) + { + $this->createdAt = $createdAt; + } + + /** + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getTitle() : string + { + return $this->title; + } + + /** + * @param string $title + * + * @return mixed + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setTitle(string $title) + { + $this->title = $title; + } + + /** + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getPath() : string + { + return $this->path; + } + + /** + * @param string $path + * + * @return mixed + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setPath(string $path) + { + $this->path = $path; + } + + public function toArray() : array + { + return [ + 'id' => $this->id, + 'title' => $this->title, + 'plain' => $this->plain, + 'content' => $this->content, + 'createdAt' => $this->createdAt, + 'createdBy' => $this->createdBy, + ]; + } + + public function __toString() + { + return json_encode($this->toArray()); + } + + public function jsonSerialize() + { + return $this->toArray(); + } +} diff --git a/Models/EditorDocMapper.php b/Models/EditorDocMapper.php new file mode 100644 index 0000000..8896b46 --- /dev/null +++ b/Models/EditorDocMapper.php @@ -0,0 +1,132 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Editor\Models; + +use Modules\Admin\Models\AccountMapper; +use phpOMS\DataStorage\Database\DataMapperAbstract; +use phpOMS\DataStorage\Database\Query\Builder; +use phpOMS\DataStorage\Database\Query\Column; +use phpOMS\DataStorage\Database\RelationType; + +class EditorDocMapper extends DataMapperAbstract +{ + + /** + * Columns. + * + * @var array + * @since 1.0.0 + */ + static protected $columns = [ + 'editor_doc_id' => ['name' => 'editor_doc_id', 'type' => 'int', 'internal' => 'id'], + 'editor_doc_created_by' => ['name' => 'editor_doc_created_by', 'type' => 'string', 'internal' => 'createdBy'], + 'editor_doc_title' => ['name' => 'editor_doc_title', 'type' => 'string', 'internal' => 'title'], + 'editor_doc_plain' => ['name' => 'editor_doc_plain', 'type' => 'string', 'internal' => 'plain'], + 'editor_doc_content' => ['name' => 'editor_doc_content', 'type' => 'string', 'internal' => 'content'], + 'editor_doc_path' => ['name' => 'editor_doc_path', 'type' => 'string', 'internal' => 'path'], + 'editor_doc_created_at' => ['name' => 'editor_doc_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'], + ]; + + static protected $belongsTo = [ + 'createdBy' => [ + 'mapper' => AccountMapper::class, + 'src' => 'editor_doc_created_by', + ], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static $table = 'editor_doc'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static $primaryField = 'editor_doc_id'; + + /** + * Created at. + * + * @var string + * @since 1.0.0 + */ + protected static $createdAt = 'editor_doc_created_at'; + + /** + * Create object. + * + * @param mixed $obj Object + * @param int $relations Behavior for relations creation + * + * @return mixed + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public static function create($obj, int $relations = RelationType::ALL) + { + try { + $objId = parent::create($obj, $relations); + $query = new Builder(self::$db); + $query->prefix(self::$db->getPrefix()) + ->insert( + 'account_permission_account', + 'account_permission_from', + 'account_permission_for', + 'account_permission_id1', + 'account_permission_id2', + 'account_permission_r', + 'account_permission_w', + 'account_permission_m', + 'account_permission_d', + 'account_permission_p' + ) + ->into('account_permission') + ->values($obj->getCreatedBy(), 'editor', 'editor', 1, $objId, 1, 1, 1, 1, 1); + + self::$db->con->prepare($query->toSql())->execute(); + } catch (\Exception $e) { + return false; + } + + return $objId; + } + + /** + * Find. + * + * @param array $columns Columns to select + * + * @return Builder + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public static function find(...$columns) : Builder + { + return parent::find(...$columns)->from('account_permission') + ->where('account_permission.account_permission_for', '=', 'editor') + ->where('account_permission.account_permission_id1', '=', 1) + ->where('news.news_id', '=', new Column('account_permission.account_permission_id2')) + ->where('account_permission.account_permission_r', '=', 1); + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php new file mode 100644 index 0000000..4c814f0 --- /dev/null +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +return ['Navigation' => [ + 'Create' => 'Create', + 'Editor' => 'Editor', + 'List' => 'List', +]]; diff --git a/Theme/Backend/Lang/api.en.lang.php b/Theme/Backend/Lang/api.en.lang.php new file mode 100644 index 0000000..d28b242 --- /dev/null +++ b/Theme/Backend/Lang/api.en.lang.php @@ -0,0 +1,17 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +return ['Navigation' => [ +]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php new file mode 100644 index 0000000..dfce45b --- /dev/null +++ b/Theme/Backend/Lang/en.lang.php @@ -0,0 +1,31 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +return ['Editor' => [ + 'Created' => 'Created', + 'Creator' => 'Creator', + 'Documents' => 'Documents', + 'Editor' => 'Editor', + 'GroupUser' => 'Group/User', + 'Insert' => 'Insert', + 'Layout' => 'Layout', + 'Name' => 'Name', + 'Permission' => 'Permission', + 'Preview' => 'Preview', + 'Save' => 'Save', + 'Start' => 'Start', + 'Text' => 'Text', + 'Title' => 'Title', +]]; diff --git a/Theme/Backend/editor-create.tpl.php b/Theme/Backend/editor-create.tpl.php new file mode 100644 index 0000000..0314ef8 --- /dev/null +++ b/Theme/Backend/editor-create.tpl.php @@ -0,0 +1,137 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +/** + * @var \phpOMS\Views\View $this + */ + +echo $this->getData('nav')->render(); ?> + +
+
+
+
+
+ + +
+
+
+
+
+ +
+
+
+
+ +
+ +
+
    +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
+
+ +
+
    +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+ +
+ +
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
diff --git a/Theme/Backend/editor-list.tpl.php b/Theme/Backend/editor-list.tpl.php new file mode 100644 index 0000000..52005e0 --- /dev/null +++ b/Theme/Backend/editor-list.tpl.php @@ -0,0 +1,55 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +/** + * @var \phpOMS\Views\View $this + */ + +$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response); +$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig'); +$footerView->setPages(20); +$footerView->setPage(1); + +$docs = $this->getData('docs'); + +echo $this->getData('nav')->render(); ?> +
+
+
+ + + + + + + + $value) : $count++; + $url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/editor/single?{?}&id=' . $value->getId()); ?> + +
getText('Documents'); ?>
getText('Title'); ?> + getText('Creator'); ?> + getText('Created'); ?> +
render(); ?> +
getTitle(); ?> + getCreatedBy(); ?> + getCreatedAt()->format('Y-m-d H:i:s'); ?> + + +
getText('Empty', 0, 0); ?> + +
+
+
+
diff --git a/Theme/Backend/editor-single.tpl.php b/Theme/Backend/editor-single.tpl.php new file mode 100644 index 0000000..7737b33 --- /dev/null +++ b/Theme/Backend/editor-single.tpl.php @@ -0,0 +1,7 @@ +getData('nav')->render(); ?> + +
+
+ +
+
\ No newline at end of file diff --git a/Theme/Backend/editor.tpl.php b/Theme/Backend/editor.tpl.php new file mode 100644 index 0000000..82c2058 --- /dev/null +++ b/Theme/Backend/editor.tpl.php @@ -0,0 +1,65 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +/** + * @var \phpOMS\Views\View $this + */ + +$doc = $this->getData('doc') ?? null; +?> +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + +
+
+ +
+
+ +
+ + +
+ +
+ + +
+ getContent() : ''; ?> +
+
+
+
\ No newline at end of file diff --git a/info.json b/info.json new file mode 100644 index 0000000..4f61ea8 --- /dev/null +++ b/info.json @@ -0,0 +1,44 @@ +{ + "name": { + "id": 1005300000, + "internal": "Editor", + "external": "OMS Editor" + }, + "version": "1.0.0", + "requirements": { + "phpOMS": "1.0.0", + "phpOMS-db": "1.0.0" + }, + "creator": { + "name": "Orange Management", + "website": "www.spl1nes.com" + }, + "description": "The administration module.", + "directory": "Editor", + "dependencies": { + "Admin" : "1.0.0" + }, + "providing": { + "Navigation": "*" + }, + "load": [ + { + "pid": [ + "439884690b4c05681a7c7ca9292d5cfb03d2971f" + ], + "type": 4, + "for": "Content", + "file": "Editor", + "from": "Editor" + }, + { + "pid": [ + "754a08ddf8bcb1cf22f310f09206dd783d42f7dd" + ], + "type": 5, + "from": "Editor", + "for": "Navigation", + "file": "Navigation" + } + ] +}