Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.3.0 #7

Open
wants to merge 6 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_Store
.idea
.idea

config.core.php
50 changes: 47 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# MODX Reviews
![Reviews version](https://img.shields.io/badge/version-1.2.0-brightgreen.svg) ![MODX Extra by Sterc](https://img.shields.io/badge/extra%20by-sterc-magenta.svg) ![MODX version requirements](https://img.shields.io/badge/modx%20version%20requirement-2.4%2B-blue.svg)
![Reviews version](https://img.shields.io/badge/version-1.3.0-brightgreen.svg) ![MODX Extra by Sterc](https://img.shields.io/badge/extra%20by-sterc-magenta.svg) ![MODX version requirements](https://img.shields.io/badge/modx%20version%20requirement-2.4%2B-blue.svg)

Install the Reviews extra for central review management. Each review contains the following fields: name, email, what Resource is being reviewed, rating 0-5, review content, active true/false. The extra becomes available in the 'Extras' menu after installing and comes with a Reviews-snippet to easily show one or more reviews on a page and has default-chunks out of the box, which you can of course change if you wish.

## Example snippet call
## Reviews snippet

This snippet shows the reviews of the current page.

### Example snippet call

```
{'!Reviews' | snippet : [
Expand All @@ -14,7 +18,7 @@ Install the Reviews extra for central review management. Each review contains th
]}
```

## Parameters
### Parameters

| Parameter | Description |
|----------------------------|------------------------------------------------------------------------------|
Expand All @@ -29,6 +33,46 @@ Install the Reviews extra for central review management. Each review contains th
| usePdoTools | [optional] Set to `true` to use pdoTools in the tpl's and enable fenom. (`@FILE` and `@INLINE` do not require this). Default: `false` |
| usePdoElementsPath | [optional] Set to `true` to use the system setting `pdotools_elements_path` as a base-path for the @FILE includes. If `false`, it uses `core/components/reviews/`. Default: `false` |

## FormIt2Reviews hook

This hook allows the frontend user to post his own reviews. All rating range fields are retrieved with the prefix `rating_`.

### Example FormIt call

```
[[!FormIt?
&hooks=`formit2reviews`
&validate=`name:required,
email:email:required,
rating_default:required`
]]
[[!$reviewsFormTpl]]
```

The chunk reviewsFormTpl is part of the package and could be customized to your needs.

### Parameters

| Parameter | Description |
|----------------------------|------------------------------------------------------------------------------|
| reviewsAutoPublish | [optional] Publish the new review automatically. Default: No |
| reviewsAllowOverwrite | [optional] Allow overwriting a review with the same username and email address. Default: No |

## ReviewGroup snippet

This snippet will show the range dropdown of one rating option. See the example usage in the `reviewsFormTpl` chunk.

### Parameters

| Parameter | Description |
|----------------------------|------------------------------------------------------------------------------|
| type | [optional] The range type of the select field (will be prepended with `rating_` in the name attribute). Default: default |
| value | [optional] The initial value of the select field. |
| required | [optional] Set the select field to required. Default: No |
| error | [optional] The error message that could be placed in the error placeholder in the tpl. |
| tpl | [optional] The select field template chunk. Default: @FILE elements/chunks/formselect.chunk.tpl |
| tplOption | [optional] The option template chunk for the select field. Default: @FILE elements/chunks/formoption.chunk.tpl |

# Free Extra
This is a free extra and the code is publicly available for you to change. The extra is being actively maintained and you're free to put in pull requests which match our roadmap. Please create an issue if the pull request differs from the roadmap so we can make sure we're on the same page.

Expand Down
250 changes: 165 additions & 85 deletions _build/config.json
Original file line number Diff line number Diff line change
@@ -1,91 +1,171 @@
{
"name": "Reviews",
"lowCaseName": "reviews",
"description": "A reviews solution for MODX Revolution.",
"author": "Sterc",
"version": "1.2.0-pl",
"package":{
"menus": [{
"text": "reviews",
"description": "reviews.desc",
"parent": "components",
"action": "home",
"permissions": "reviews"
}],
"elements": {
"chunks": [{
"name": "reviewsItemTpl",
"file": "item.chunk.tpl"
},{
"name": "reviewsWrapperTpl",
"file": "wrapper.chunk.tpl"
}],
"snippets": [{
"name": "Reviews",
"file": "reviews.snippet.php",
"properties": [{
"name": "limit",
"value": "10",
"description": "reviews.snippet_limit_desc"
},{
"name": "where",
"value": "{\"active\": \"1\"}",
"description": "reviews.snippet_where_desc"
},{
"name": "sortby",
"value": "{\"createdon\": \"DESC\"}",
"description": "reviews.snippet_sortby_desc"
},{
"name": "tpl",
"value": "@FILE elements/chunks/item.chunk.tpl",
"description": "reviews.snippet_tpl_desc"
},{
"name": "tplWrapper",
"value": "@FILE elements/chunks/wrapper.chunk.tpl",
"description": "reviews.snippet_tplwrapper_desc"
}]
}]
"name": "Reviews",
"lowCaseName": "reviews",
"description": "A reviews solution for MODX Revolution.",
"author": "Sterc",
"version": "1.3.1-pl",
"package": {
"menus": [
{
"text": "reviews",
"description": "reviews.desc",
"parent": "components",
"action": "home",
"permissions": "reviews"
}
],
"elements": {
"chunks": [
{
"name": "reviewsItemTpl",
"file": "item.chunk.tpl"
},
"systemSettings": [{
"key": "branding_url",
"area": "reviews"
},{
"key": "branding_url_help",
"area": "reviews"
},{
"key": "ratings",
"value": "1||5",
"area": "reviews"
},{
"type": "combo-boolean",
"key": "use_editor",
"value": 0,
"area": "reviews"
},{
"key": "include_resources",
"value": "{}",
"area": "reviews"
},{
"type": "combo-boolean",
"key": "resource_aware",
"value": 0,
"area": "reviews"
}]
},
"build":{
"readme": "docs/readme.txt",
"license": "docs/license.txt",
"changelog": "docs/changelog.txt",
"resolver": {
"after": [
"tables.resolver.php",
"permissions.resolver.php",
"setupoptions.resolver.php",
"stercextra.resolver.php"
]
{
"name": "reviewsWrapperTpl",
"file": "wrapper.chunk.tpl"
},
{
"name": "reviewsFormTpl",
"file": "form.chunk.tpl"
}
],
"snippets": [
{
"name": "Reviews",
"file": "reviews.snippet.php",
"properties": [
{
"name": "limit",
"value": "10",
"description": "reviews.snippet_limit_desc"
},
{
"name": "where",
"value": "{\"active\": \"1\"}",
"description": "reviews.snippet_where_desc"
},
{
"name": "sortby",
"value": "{\"createdon\": \"DESC\"}",
"description": "reviews.snippet_sortby_desc"
},
{
"name": "tpl",
"value": "@FILE elements/chunks/item.chunk.tpl",
"description": "reviews.snippet_tpl_desc"
},
{
"name": "tplWrapper",
"value": "@FILE elements/chunks/wrapper.chunk.tpl",
"description": "reviews.snippet_tplwrapper_desc"
}
]
},
"setupOptions":{
"source": "setup.options.php"
{
"name": "Formit2Reviews",
"file": "formit2reviews.hook.php",
"properties": [
{
"name": "reviewsAllowOverwrite",
"type": "combo-boolean",
"value": "0",
"description": "reviews2formit.hook_reviews_allow_overwrite_desc"
},
{
"name": "reviewsAutoPublish",
"type": "combo-boolean",
"value": "0",
"description": "reviews2formit.hook_reviews_auto_publish_desc"
}
]
},
{
"name": "ReviewGroup",
"file": "reviewgroup.snippet.php",
"properties": [
{
"name": "type",
"value": "default",
"description": "reviewgroup.snippet_type_desc"
},
{
"name": "value",
"value": "",
"description": "reviewgroup.snippet_value_desc"
},
{
"name": "required",
"type": "combo-boolean",
"value": "0",
"description": "reviewgroup.snippet_required_desc"
},
{
"name": "tpl",
"value": "@FILE elements/chunks/formselect.chunk.tpl",
"description": "reviewgroup.snippet_tpl_desc"
},
{
"name": "tplWrapper",
"value": "@FILE elements/chunks/formoption.chunk.tpl",
"description": "reviewgroup.snippet_tplwrapper_desc"
}
]
}
]
},
"systemSettings": [
{
"key": "branding_url",
"area": "reviews"
},
{
"key": "branding_url_help",
"area": "reviews"
},
{
"key": "ratings",
"value": "1||5",
"area": "reviews"
},
{
"type": "combo-boolean",
"key": "use_editor",
"value": 0,
"area": "reviews"
},
{
"key": "include_resources",
"value": "{}",
"area": "reviews"
},
{
"type": "combo-boolean",
"key": "resource_aware",
"value": 0,
"area": "reviews"
}
]
},
"database": {
"tables": [
"ReviewsReview",
"ReviewsReviewRating",
"ReviewsRating"
]
},
"build": {
"readme": "docs/readme.txt",
"license": "docs/license.txt",
"changelog": "docs/changelog.txt",
"resolver": {
"after": [
"permissions.resolver.php",
"setupoptions.resolver.php",
"stercextra.resolver.php"
]
},
"setupOptions": {
"source": "setup.options.php"
}
}
}
35 changes: 35 additions & 0 deletions _build/gpm_resolvers/gpm.resolve.tables.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Resolve creating db tables
*
* THIS RESOLVER IS AUTOMATICALLY GENERATED, NO CHANGES WILL APPLY
*
* @package reviews
* @subpackage build
*
* @var mixed $object
* @var modX $modx
* @var array $options
*/

if ($object->xpdo) {
$modx =& $object->xpdo;
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL:
case xPDOTransport::ACTION_UPGRADE:
$modelPath = $modx->getOption('reviews.core_path', null, $modx->getOption('core_path') . 'components/reviews/') . 'model/';

$modx->addPackage('reviews', $modelPath, null);


$manager = $modx->getManager();

$manager->createObjectContainer('ReviewsReview');
$manager->createObjectContainer('ReviewsReviewRating');
$manager->createObjectContainer('ReviewsRating');

break;
}
}

return true;
2 changes: 1 addition & 1 deletion _build/resolvers/stercextra.resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'workspace' => 1,
"(SELECT
`signature`
FROM {$modx->getTableName('modTransportPackage')} AS `latestPackage`
FROM {$modx->getTableName('transport.modTransportPackage')} AS `latestPackage`
WHERE `latestPackage`.`package_name` = `modTransportPackage`.`package_name`
ORDER BY
`latestPackage`.`version_major` DESC,
Expand Down
Loading