Git Product home page Git Product logo

luya-module-cms's Introduction

LUYA Logo

LUYA Content Management System

LUYA Tests Maintainability Test Coverage Latest Stable Version Total Downloads

The LUYA CMS module provides a full functional Content Management System for adding contents based on blocks.

LUYA CMS MODULE

To use the LUYA CMS module you have to run a LUYA Application which is provided by the LUYA core.

For installation and usage please check: LUYA.IO

Installation

For the installation of modules Composer is required.

composer require luyadev/luya-module-cms

Configuration

Add the frontend and admin module of the cms module to your configuration modules section and bootstrap the cms frontend module:

'modules' => [
    // ...
    'cms' => 'luya\cms\frontend\Module',
    'cmsadmin' => 'luya\cms\admin\Module',
    // ...
]

Initialization

After successfully installation and configuration run the migrate, import and setup command to initialize the module in your project.

1.) Migrate your database.

./vendor/bin/luya migrate

2.) Import the module and migrations into your LUYA project.

./vendor/bin/luya import

Please note that the module names cms and cmsadmin are required and should not be changed!

Developers

If you want to contribute, make sure to read the guidelines.

Unit Testing

  1. cp phpunit.xml.dist phpunit.xml
  2. docker compose up
  3. docker compose run luyacmsphpunit tests to run all tests or docker compose run luyacmsphpunit tests/src/helpers/UrlTest.php to run a specific test.

luya-module-cms's People

Contributors

andregm avatar antikon avatar arhell avatar asyou99 avatar boehsermoe avatar charescape avatar chemezov avatar dennisgon avatar dependabot[bot] avatar dev7ch avatar devtronic avatar dven84 avatar emericanec avatar hbugdoll avatar jdl747 avatar johnnymcweed avatar leeyuryeon avatar martinpetrasch avatar mrbig00 avatar nadar avatar naiiytom avatar nandes2062 avatar nick-denry avatar ph0tonic avatar rainerch avatar rolandschaub avatar testt23 avatar themaaarc avatar vavepl avatar vuongxuongminh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luya-module-cms's Issues

Custom admin view for layout blocks placeholder.

This issue has originally been reported by @guif2r at luyadev/luya#1532.
Moved here by @nadar.


What steps will reproduce the problem?

Without admin panel, I would like to get personal information for the layout-blocks, I made a plugin for the whole world, for example, in each column but I would like to see it in the admin view. Can you help us? Thank you!

What is the expected result?

It was possible to observe the placeholder background in the admin panel or custom view for placeholder.

What do you get instead? (A Screenshot can help us a lot!)

screen shot 2017-10-04 at 15 38 48

LUYA Check ouput (run this script and post the result: luyacheck.php)

CMS menu order by: create, update timestamp

This issue has originally been reported by @nadar at luyadev/luya#1656.
Moved here by @nadar.


  • Add ability to sort by create or update timestamp: orderBy([]).
  • Add ability to change date of nav item page.
  • Add new publish date option for cms_nav which can be used for orderBy as well as for where condition to limit page visibilities.

Rename main.min.js to main.js

Instead of changing the main.js to main.min.js in the admin module (see luyadev/luya-module-admin#48), change the main.min.js to main.js in the cms module.

Reason is that it makes more sense to not tell the "state" of the code at all rather than implying that the file is minified when it actually isn't. (CMS is minified but ADMIN isn't because of angular complications)

Disallow trailing slashes in url

Now the cms url's are valid with trailing slash, but the cms url generator never returns urls with urlManger suffix. Therefore URLs with trailing slashes are invalid urls and 404 should be thrown.

Copy page version bug, run out of memory

When creating a new version based on an existing version, it can cause an out of memory exception

{
"name":"PHP Fatal Error",
"message":"Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes)",
"code":1,
"type":"yii\\base\\ErrorException","file":"vendor/luyadev/luya-module-cms/src/models/NavItem.php","line":56
}

API:

admin/api-cms-navitem/create-page-version

Params:

layoutId:0
navItemId:287
name:test 3
fromPageId:243

getFieldHelp support for multiple inputs block type

This issue has originally been reported by @adipriyantobpn at luyadev/luya#1769.
Moved here by @nadar.


Have CMS Block with zaa-multiple-inputs type, which contains 2 fields or more, like this:

public function config()
{
    return [
        'vars' => [
            ['var' => 'features', 'label' => "Features", 'type' => 'zaa-multiple-inputs', 'options' => [
                ['var' => 'icon', 'label' => 'Icon', 'type' => 'zaa-select', 'options' => [...]],
                ['var' => 'title', 'label' => 'Title', 'type' => 'zaa-text'],
                ['var' => 'text', 'label' => 'Text', 'type' => 'zaa-wysiwyg'],
                ['var' => 'bgColor', 'label' => 'Bg. Color', 'type' => 'zaa-select', 'options' => [...]],
            ],
        ],
    ];
}

It would be nice if getFieldHelp() function can render help for each field inside zaa-multiple-inputs, too.

Structured array like this will be suffice.

public function getFieldHelp()
{
    return [
        'features' => [
            'icon' => 'Icon name, will be shown at the top of the each feature',
            'title' => 'Title of the feature',
            'text' => 'Some explaination',
            'bgColor' => 'Background color for feature box',
        ],
    ];
}

Block Assets not registered when caching is enabled

This issue has originally been reported by @dven84 at luyadev/luya#1657.
Moved here by @nadar.


What steps will reproduce the problem?

class ExampleBlock extends PhpBlock { public $cacheEnabled = true; ...
view:
CustomAsset::register($this->appView)

What is the expected result?

Resources on the page

What do you get instead?

Resources from CustomAsset are not available on the page

Additional infos

Q A
LUYA Version RC4
PHP Version 7.0
Platform Apache
Operating system Linux

Change NAV page icon to gear icon.

This issue has originally been reported by @sanicode at luyadev/luya#1782.
Moved here by @nadar.


Not Found (#404)
Home item could not be found, have you forget to set a default page?
The above error occurred while the Web server was processing your request.

Please contact us if you think this is a server error. Thank you.

2018-03-26 07:53:07

Feature Request: Schedule visibility of block

It would be great to be able to schedule the visibility of a content block (making this a core feature of all blocks). A clock button could open a tab with the following form fields:

[x] Only display this block during the following timeframe:
From: [dd].[mm].[yyyy] [hh]:[ii]
To: [dd].[mm].[yyyy] [hh]:[ii]

Leave start date empty to only schedule end date.
Leave end date empty to only schedule start date.

Url::toMenuItem alternative for nav_id

Create an alternative function to generate a link to a menuItem by navId. Url::toMenuItem searches by the actual id that is only visible in the database.

Deleting a CMS block does not close confirm dialog

When deleting a block in CMS, the confirm dialog does not close when clicking "Yes":

bildschirmfoto von 2018-05-07 12-19-22

Clicking Yes multiple times results in the error:

bildschirmfoto von 2018-05-07 12-21-34

the deletion itself works as the change is visible in the background. also closing the dialog via "Cancel" works.

Browser: Firefox 59.0.2 (64-Bit)

Importer: Layout cols

This issue has originally been reported by @TheMaaarc at luyadev/luya#1793.
Moved here by @nadar.


What steps will reproduce the problem?

  1. Create (or use and existing) layout
  2. Define the layout with the .json file
    e.g. {"cols": 12, "var": "content", "label": "Conent"}
  3. Import the layout / definition
  4. Change the cols of one column
    e.g. e.g. {"cols": 5, "var": "content", "label": "Conent"}
  5. Run importer

What is the expected result?

Layout cols should be updated based on the new cols value.

What do you get instead? (A Screenshot can help us a lot!)

Layout won't be updated and I've to change the value in the database.

Additional infos

"require": {
    "luyadev/luya-core" : "~1.0.0",
    "luyadev/luya-module-cms" : "~1.0.0",
    "luyadev/luya-module-admin" : "~1.1.0",
    "luyadev/luya-bootstrap4": "1.0.0-RC4",
    "luyadev/luya-module-news": "~1.0.0",
    "luyadev/luya-module-crawler": "~1.0.0",
    "luyadev/luya-module-contactform": "~1.0.0",
    "luyadev/luya-generic" : "~1.0.0",
    "luyadev/luya-bootstrap3" : "~1.0.0",
},

Reload URL with F5

Example url, reload with F5: admin#!/template/cmsadmin2Fdefault2Findex/update/4

bildschirmfoto 2018-01-25 um 08 45 21

data not resolved?

bildschirmfoto 2018-01-25 um 08 47 55

Menu should respect 'sort_index' attribute of any items

Hi!

Menu doesn't respect 'sort_index' property of InjectedItem if different elements are used.

I have a menu with 2 cms pages items, and want to inject another item from module.

Do it via subclassing luya\cms\menu\InjectItem. There is toArray() method of my custon InjectItem class

<?php

namespace app\modules\mymodule\menu;

use Yii;
use luya\cms\menu\InjectItem as BaseInjectItem;

class InjectItem extends BaseInjectItem
{

    /**
     * Parse the injected item to an array.
     *
     * @return array
     */
    public function toArray()
    {
        return [
            'id' => '43',
            'nav_id' => '2',
            'lang' => 'ru',
            'link' => '/mymodule/somelink',
            'title' => 'Injected Item',
            'alias' => 'somelink',
            'description' => '',
            'keywords' => NULL,
            'create_user_id' => '1',
            'update_user_id' => '1',
            'timestamp_create' => '1457091369',
            'timestamp_update' => '1483367249',
            'is_home' => '0',
            'parent_nav_id' => '0',
            'sort_index' => '0',
            'is_hidden' => '0',
            'type' => '1',
            'nav_item_type_id' => '42',
            'redirect' => false,
            'module_name' => false,
            'container' => 'mycontainer',
            'depth' => 1,
        ];
    }
}

Then I've got this:

2018-04-09 23 19 34

The first two items are pages. Items have following sort_index values:

["sort_index"]=> string(1) "1" first
["sort_index"]=> string(1) "2" second
["sort_index"]=> string(1) "0" injected

But injected item appears last.

LUYA should remember version last worked on

This issue has originally been reported by @rolandschaub at luyadev/luya#1663.
Moved here by @nadar.


What steps will reproduce the problem?

Create a version of a page and start to edit this version, click on another menu item and return to the page with the newly created version.

What is the expected result?

The lastly edited version should still be active.

What do you get instead? (A Screenshot can help us a lot!)

The published version is active. If you don't notice this and manually switch to the version you were editing, you are editing the published version.

So:

  • LUYA should remember the edited version and load it again when accessing the page the next time
  • It would make sense to have a signal (e.g. a color code) that changes dependent on the version that is edited: published version shows another color than unpublished version

Injection of a menu item throws 404 error

Hi!

I'm trying to inject menu item like it described in guide via placing following config to components section of the env-local.php

'menu' => [
    'class' => 'luya\cms\Menu',
    'on eventAfterLoad'  => function($event) {
        $event->sender->injectItem(new \luya\cms\menu\InjectItem([
            'childOf' => 1,
            'title' => 'Inject Title',
            'alias' => 'inject-title',
        ]));
    }
],

Then I get error

Not Found (#404)
Unable to find item with id 1

The above error occurred while the Web server was processing your request.

Please contact us if you think this is a server error. Thank you.
2018-04-04 20:58:06 

That's what I got in log:

yii\web\NotFoundHttpException: Unable to find item with id 1 in /var/www/project/vendor/luyadev/luya-module-cms/src/frontend/controllers/DefaultController.php:68

Stack trace and DB Queries:
trace-1.txt

This is my real cms_nav_item table

2018-04-04 22 18 34

Assume that

$current = Yii::$app->menu->current;
is not set somehow.

The problem related to this query:

$this->_item = Yii::$app->menu->find()->where(['id' => $this->childOf])->with('hidden')->one();

if nav_id used instead of id menu item injected well but appears in left sidebar.

CMS Block editor as WYSWYG directive for CRUD

This issue has originally been reported by @Misavan at luyadev/luya#1758.
Moved here by @nadar.


Right now there is no WYSIWYG editors integrated and it will not be https://github.com/luyadev/luya/issues/950. But it is very usefull to have it. As example in News module. News content should have option to add images, links and etc.
So if developers do not wont to integrate WYSIWYG editors, lets have option to manage content(some field in any module) as it is done in 'Pages' section. There is all needed to have nice and flixible content management. What you thinks?

CMS Frontend Toolbar colors

Ensure if the new luya admin primary color is used in the luya cms frontend toolbar, replace with current primary color if needed.

  • Toolbar toggle arrow
  • Active tb tab color

Admin primary: #E50060 (?)
Current color in tb: #FF006B

bildschirmfoto 2018-02-05 um 10 34 26

bildschirmfoto 2018-02-05 um 10 34 43

Console command to find blocks

Add new command in order to find blocks by its name and display how many times they are used inside the contents. This can be part of a migration to in order to rename class names.

/**
 * Usage:
 * 
 * ```
 * ./luya cms/block/find
 * ```
 * 
 * Filter for a given name:
 * 
 * ```
 * ./luya cms/block/find html
 * ```
 * 
 * Filter for different names combined as OR conditions:
 * 
 * ```
 * ./luya cms/block/find html,module
 * ```
 */

Wrong url and content format inside CMS-Module-Block

  1. Problem
    Inside a module thats included via cms-block the Url::to function will generate by the cms-page names (pretty url). But only when I pass an array as route it will be correctly, with a string it will generate the "raw" url (not pretty url).

  2. Problem
    I include the yii CaptchaWidget inside a cms-module-block and the CaptchaAction inside a controller of this module. The CaptchaAction-Url will generate correctly because the CaptchaWidget add the "v" parameter and pass the route as array. When I call the CaptchaAction-Url I will get an empty image. The result of NavItemModule::getContent will not return direct to the output.

    // it is a json response (so the Response object is set to JSON_FORMAT).
    if (is_array($content)) {
    return $content;
    }
    an array will be handled as JSON, maybe there should be inspect theYii::$app->response->format == Response::FORMAT_RAW and the other formats.

Configurable Preview URL

Please provide a URL configuration for the "Auto-Preview" feature.
'url' => 'http://myheadlesswebsite.com/module/?version=versionId&item=navId (or similar)

Feature Request: Make permission for the luya-cms-toolbar

I think it is good to provide a permission or option to enable/disable luya-cms-toolbar.

The reason is that toolbar colud be overhead/annoyiing for some particular group of admin users (e.g. sellers), cause they know nothing about content managment or seo.

For my opion a permission is better than an option.

luya-module-cms Blocks + Placeholder recursion

This issue has originally been reported by @tskodaw at luyadev/luya#1541.
Moved here by @nadar.


feature requests/design requests for discussion:

  • It would be great to have restrictions for blocks in placeholders like Blockgroup/Interface matchings. In two ways, a Block can restrict "children" Blocks, and a block can desire a certain type of parent block. Or even better, a parentBlock should have the possibility to catch an event, when a childblock is inserted, to deny this or accept this.
  • While rendering CMS-Blocks, I think it would generally be nice to have more control from parent/containing blocks about what is going on in it's children/placeholder contained blocks. Like a bubbling up beforeRenderChildBlock(PhpBlock $childBlock)

Why?

The desire for it arose while I was experimenting with creating a Form-Block, containing InputField-Blocks:

in the editor-view:
image

on the page:

image

(angular+php parts):
There should be a Form-Block, containing in it's placeholders Inputblocks (i.e. TextInput-Block, Date-InputBlock, SelectInput-Block etc.) and managing the whole thing in general (like generate the Datamodel, starting the ActiveForm). The Inputblocks in my actual idea are using features of the parent* block, so putting an Inputblock into a normal Layoutblock, not having a FormBlock somewhere "upstream" already initialized leads to errors (for instance the used datamodel for the whole form is not instantiated, no ActiveForm instantiated).

typematch/insert-event leads to sth like:

image

Why formdesign in CMS?:
Using the CMS with it's blocks is really cool, because the editors can be more involved in planning/designing the form not requiring someone to change any view-files all the time their ideas change. Constructing forms should nevertheless be error-tolerant to those content-editors, so if they want to put an Inputfield somewhere not applicable, it should somehow be forbidden.

(php-part)
Further, the FormBlock should perhaps have some control before an Input-child* Block is rendered, like injecting the datamodel-object or prevent child rendering under certain conditions.
like $blockObject->onBeforePlaceholderBlockRender($cancel, $childBlock)
and $blockObject->onAfterPlaceHolderBlockRendered($childBlock)
with the possibility of bubbling it up so that in this case the FormBlock knows when somewhere down the recursion a *InputBlock is going to be rendered.

Use: for instance I plan on generating (in PHP, not in any fancy special Javascript works) like a Form that has "slides" so my FormBlock, can contain SlideBlocks, those can contain InputFieldBlocks. The FormBlock should manage which slide to render, dataflow etc. like allowing slide-child 1 to be rendered, and slide-child-2 to not beeing rendered at one moment.

for the onBeforeChildRender/afterChildRender thing a starting point is in the NavItemPage recursion:

luya\cms\models\NavItemPage:265 (as a point to start, the specific "event"call seems to have to be somewhere else down in the recursive function)

$blockObject->setEnvOption('equalIndex', $equalIndex);
                    
                    // render sub placeholders and set into object
                    $insertedHolders = [];
                    foreach ($blockObject->getConfigPlaceholdersExport() as $item) {
/** ---> something like
***  if($blockObject->beforeRenderPlaceholderItem( $ConfiguredBlockItemToBeRendered)){ **/
                        $insertedHolders[$item['var']] = $this->renderPlaceholderRecursive($navItemPageId, $item['var'], $placeholder['id']);

/** --> and $blockObject->afterRenderPlaceholderItem($placeHolderObject,$insertedHolders[$item[

/**   } <-- **/
                    }
                    $blockObject->setPlaceholderValues($insertedHolders);
                    // output buffer the rendered frontend method of the block
                    $blockResponse = $blockObject->renderFrontend();

well that's my idea at the moment.

Further one could think of some communication between ChildBlocks/Parentblocks on cms-admin-side-of-things to assist things like:

  • having a data model chosen in the FormBlock
  • all child-InputBlocks obtain possible variable-names and types from Parent-FormBlock. (but well that's for later)

PHP 7.2 compatbility

luya\cms\Menu:::getHasParent()

PHP Warning – yii\base\ErrorException
count(): Parameter must be an array or an object that implements Countable

$parent = $this->getParent();
return ($parent && count($parent) > 0) ? true : false;

getParent does not return an array.

Invalid URL generation with offline pages in path

This issue has originally been reported by @rolandschaub at luyadev/luya#1382.
Moved here by @nadar.


What steps will reproduce the problem?

Make a web page with children offline. URLs to the child pages won't be formed correctly – LUYA will omit all path segments except the one for the target page. Example:

www.testsite.com/abc/def/ghj
will turn to the following when the page with the path segment "def" is offline:
www.testsite.com/ghj

What is the expected result?

The URL should include all path segments, including the ones of offline pages:
www.testsite.com/abc/def/ghj

Of course, the URL www.testsite.com/abc/def/ should still throw a 404 error, but www.testsite.com/abc/def/ghj should work and be generated correctly.

Block CLI generation: Extend Helper to make block var types better selectable and readable

This issue has originally been reported by @dev7ch at luyadev/luya#1523.
Moved here by @nadar.


What steps will reproduce the problem?

1.) generate a block with the command ./vendor/bin/luya cms/block/create
2.) follow the instructions until you can select the field type

What is the expected result?

sth like this:

block_cli_2

What do you get instead? (A Screenshot can help us a lot!)

  • block var types not selectable via number.
  • block var types in on singel line ( bad readability )

Additional infos

extracted from this closed issue #1516

Q A
LUYA Version dev master

Page preview link when online but invisble.

When previewing a CMS page which is Online but Invisible, the Websites frontend url should be used instead of the /preview url. This makes it possible to share the link with collaborators which are not logged in to the admin UI.

CMS: Blockvariation option doesn´t seem to work

Setting the block variations inside your configs following the docs doesn´t work properly.

  • it shows up in the Admin UI
  • but don't have an effect on the frontend
            'blockVariations' => [
                    \luya\bootstrap4\blocks\ImageBlock::variations()
                        ->add('float-right', 'Right align')->cfgs(['imgClass' => 'blockvars-img-right'])
                        ->add('float-left', 'Left align')->cfgs(['imgClass' => 'blockvars-img-right'])
                        ->add('accordion', 'Accordion Image')->cfgs(['imgClass' => 'blockvars-img-accordion'])->register(),
                    \luya\generic\blocks\TextBlock::variations()
                        ->add('bold', 'Bold Font with Markdown')->cfgs(['cssClass' => 'bold-font-class'])->vars(['textType' => 1])
                        ->add('italic', 'Italic Font')->cfgs(['cssClass' => 'italic-font-class'])->register(),
            ],

Do I missing something?

Changing page type from "redirect" to "page" doesn't create empty page version

What steps will reproduce the problem?

Change a "redirect" page to "page" type

What is the expected result?

There should be a first empty version of the page (like when you create a new page with type "page")

What do you get instead? (A Screenshot can help us a lot!)

An empty page without any versions in it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.