Skip to content

Commit

Permalink
v2.0.0-beta.3
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavs-gutmanis committed Jan 29, 2018
1 parent 0935dbe commit b7935aa
Show file tree
Hide file tree
Showing 27 changed files with 380 additions and 187 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Solspace Freeform Changelog

## 2.0.0-beta.3 - 2018-01-29
### Added
- Added Freeform 1.x to 2.x (Craft 2.x to 3.x) migration path.

### Fixed
- Fixed a bug where Email Notification templates would not update correctly.
- Fixed a bug in Export Profiles view.
- Fixed a bug for sites with databases table prefixes.
- Fixed a bug for some sites with issues installing Freeform.

## 2.0.0-beta.2 - 2018-01-25
### Fixed
- Fixed a bug where Submissions list in control panel would not display any results.
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Freeform is the most powerful form building plugin for Craft CMS. It gives you f

**NOTE: We don't recommend using Freeform in production environments just yet, but feel free to try it out now. Any issues can be reported on GitHub Issues only please.**

**NOTE:** There currently is no support for migrating from Freeform 1 on Craft 2. An upcoming release will include support for this.

![Screenshot](src/icon.svg)

## Requirements
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "solspace/craft3-freeform",
"description": "The most intuitive and powerful form builder for Craft.",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"type": "craft-plugin",
"minimum-stability": "dev",
"authors": [
Expand All @@ -14,7 +14,7 @@
"symfony/property-access": "^3.3",
"symfony/finder": "^3.3",
"symfony/filesystem": "^3.3",
"solspace/craft3-commons": "^1.0",
"solspace/craft3-commons": "^1.0.2",
"hashids/hashids": "^1.0",
"pixel418/markdownify": "2.1.11",
"egulias/email-validator": "^2.1",
Expand Down
17 changes: 8 additions & 9 deletions src/Controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
use craft\db\Query;
use craft\elements\db\ElementQueryInterface;
use craft\helpers\ChartHelper;
use craft\helpers\DateTimeHelper;
use craft\helpers\Db;
use craft\helpers\FileHelper;
use craft\helpers\StringHelper;
use GuzzleHttp\Exception\ClientException;
use Solspace\Commons\Helpers\PermissionHelper;
use Solspace\Freeform\Elements\Submission;
use Solspace\Freeform\Freeform;
use Solspace\Freeform\Library\Composer\Components\AbstractField;
use Solspace\Freeform\Library\Composer\Components\Form;
use Solspace\Freeform\Library\Exceptions\FreeformException;
use Solspace\Freeform\Library\Helpers\PermissionsHelper;
use Solspace\Freeform\Library\Integrations\TokenRefreshInterface;
use Solspace\Freeform\Library\Session\FormValueContext;
use Solspace\Freeform\Models\FieldModel;
Expand Down Expand Up @@ -127,7 +126,7 @@ public function actionForm()
*/
public function actionFields(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FORMS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_FORMS_ACCESS);

return $this->asJson($this->getFieldsService()->getAllFields(false));
}
Expand All @@ -140,7 +139,7 @@ public function actionFields(): Response
*/
public function actionNotifications(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FORMS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_FORMS_ACCESS);

return $this->asJson($this->getNotificationsService()->getAllNotifications(false));
}
Expand All @@ -153,7 +152,7 @@ public function actionNotifications(): Response
*/
public function actionMailingLists(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FORMS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_FORMS_ACCESS);

$mailingLists = $this->getMailingListsService()->getAllIntegrationObjects();
foreach ($mailingLists as $integration) {
Expand All @@ -171,7 +170,7 @@ public function actionMailingLists(): Response
*/
public function actionCrmIntegrations(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FORMS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_FORMS_ACCESS);

$crmIntegrations = $this->getCrmService()->getAllIntegrationObjects();
foreach ($crmIntegrations as $integration) {
Expand Down Expand Up @@ -209,7 +208,7 @@ public function actionCrmIntegrations(): Response
*/
public function actionFormTemplates(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FORMS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_FORMS_ACCESS);

return $this->asJson($this->getSettingsService()->getCustomFormTemplates());
}
Expand Down Expand Up @@ -349,7 +348,7 @@ public function actionQuickCreateNotification(): Response
*/
public function actionGetSubmissionData(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_SUBMISSIONS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_SUBMISSIONS_ACCESS);

// Required for Dashboard widget, unnecessary for Entries Index view
$source = \Craft::$app->request->post('source');
Expand All @@ -370,7 +369,7 @@ public function actionGetSubmissionData(): Response
// Prep the query
$query = (new Query())
->select(['COUNT(*) as [[value]]'])
->from([Submission::TABLE]);
->from([Submission::TABLE . ' ' . Submission::TABLE_STD]);

if ($formId) {
$query->andWhere(['formId' => $formId]);
Expand Down
24 changes: 12 additions & 12 deletions src/Controllers/CodepackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

namespace Solspace\Freeform\Controllers;

use craft\web\Controller;
use Solspace\Commons\Helpers\PermissionHelper;
use Solspace\Freeform\Freeform;
use Solspace\Freeform\Library\Codepack\CodePack;
use Solspace\Freeform\Library\Codepack\Exceptions\CodepackException;
use Solspace\Freeform\Library\Codepack\Exceptions\FileObject\FileObjectException;
use Solspace\Freeform\Library\Codepack\Exceptions\Manifest\ManifestNotPresentException;
use Solspace\Freeform\Library\Helpers\PermissionsHelper;
use Solspace\Freeform\Resources\Bundles\CodepackBundle;
use yii\base\InvalidParamException;
use yii\web\BadRequestHttpException;
Expand All @@ -29,8 +29,8 @@ class CodepackController extends BaseController

public function init()
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_SETTINGS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_SETTINGS_ACCESS);

parent::init();
}

Expand All @@ -44,7 +44,7 @@ public function init()
*/
public function actionListContents(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_SETTINGS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_SETTINGS_ACCESS);

$this->view->registerAssetBundle(CodepackBundle::class);

Expand All @@ -54,19 +54,19 @@ public function actionListContents(): Response
if ($postInstallPrefix) {
return $this->renderTemplate(
'freeform/codepack/_post_install',
array(
[
'codePack' => $codePack,
'prefix' => CodePack::getCleanPrefix($postInstallPrefix),
)
]
);
}

return $this->renderTemplate(
'freeform/codepack',
array(
[
'codePack' => $codePack,
'prefix' => 'freeform_demo',
)
]
);
}

Expand All @@ -81,7 +81,7 @@ public function actionListContents(): Response
*/
public function actionInstall(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_SETTINGS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_SETTINGS_ACCESS);

$this->requirePostRequest();

Expand All @@ -95,11 +95,11 @@ public function actionInstall(): Response
} catch (FileObjectException $exception) {
return $this->renderTemplate(
'freeform/codepack',
array(
[
'codePack' => $codePack,
'prefix' => $prefix,
'exceptionMessage' => $exception->getMessage(),
)
]
);
}

Expand Down
11 changes: 5 additions & 6 deletions src/Controllers/CrmController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
use craft\helpers\UrlHelper;
use craft\web\Controller;
use GuzzleHttp\Exception\BadResponseException;
use Solspace\Commons\Helpers\PermissionHelper;
use Solspace\Freeform\Freeform;
use Solspace\Freeform\Library\Exceptions\Integrations\CRMIntegrationNotFoundException;
use Solspace\Freeform\Library\Exceptions\Integrations\IntegrationException;
use Solspace\Freeform\Library\Helpers\PermissionsHelper;
use Solspace\Freeform\Library\Integrations\CRM\AbstractCRMIntegration;
use Solspace\Freeform\Library\Integrations\CRM\CRMOAuthConnector;
use Solspace\Freeform\Library\Integrations\TokenRefreshInterface;
Expand Down Expand Up @@ -53,7 +52,7 @@ public function init()
*/
public function actionIndex(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_SETTINGS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_SETTINGS_ACCESS);

$integrations = $this->getCRMService()->getAllIntegrations();

Expand Down Expand Up @@ -121,7 +120,7 @@ public function actionEdit(int $id = null, IntegrationModel $model = null): Resp
*/
public function actionSave()
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_SETTINGS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_SETTINGS_ACCESS);

$this->requirePostRequest();

Expand Down Expand Up @@ -280,7 +279,7 @@ public function actionForceAuthorization(string $handle)
public function actionDelete(): Response
{
$this->requirePostRequest();
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_SETTINGS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_SETTINGS_ACCESS);

$id = \Craft::$app->request->post('id');
$this->getCRMService()->delete($id);
Expand All @@ -301,7 +300,7 @@ public function actionDelete(): Response
*/
private function renderEditForm(IntegrationModel $model, string $title): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_SETTINGS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_SETTINGS_ACCESS);

$this->view->registerAssetBundle(IntegrationsBundle::class);

Expand Down
14 changes: 7 additions & 7 deletions src/Controllers/FieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
namespace Solspace\Freeform\Controllers;

use craft\helpers\Assets;
use craft\helpers\UrlHelper;
use craft\web\Controller;
use Solspace\Commons\Helpers\PermissionHelper;
use Solspace\Freeform\Freeform;
use Solspace\Freeform\Library\Composer\Components\AbstractField;
use Solspace\Freeform\Library\Composer\Components\FieldInterface;
use Solspace\Freeform\Library\Exceptions\FreeformException;
use Solspace\Freeform\Library\Helpers\PermissionsHelper;
use Solspace\Freeform\Models\FieldModel;
use Solspace\Freeform\Resources\Bundles\FieldEditorBundle;
use Solspace\Freeform\Services\FieldsService;
Expand All @@ -36,7 +35,7 @@ class FieldsController extends Controller
*/
public function actionIndex(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FIELDS_ACCESS);
PermissionHelper::requirePermission(Freeform::PERMISSION_FIELDS_ACCESS);

$fieldsService = $this->getFieldsService();
$fields = $fieldsService->getAllFields();
Expand All @@ -57,7 +56,7 @@ public function actionIndex(): Response
*/
public function actionCreate(): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FIELDS_MANAGE);
PermissionHelper::requirePermission(Freeform::PERMISSION_FIELDS_MANAGE);

$model = FieldModel::create();

Expand All @@ -74,7 +73,7 @@ public function actionCreate(): Response
*/
public function actionEdit(int $id): Response
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FIELDS_MANAGE);
PermissionHelper::requirePermission(Freeform::PERMISSION_FIELDS_MANAGE);

$model = $this->getFieldsService()->getFieldById($id);

Expand All @@ -93,7 +92,7 @@ public function actionEdit(int $id): Response
*/
public function actionSave()
{
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FIELDS_MANAGE);
PermissionHelper::requirePermission(Freeform::PERMISSION_FIELDS_MANAGE);

$post = \Craft::$app->request->post();

Expand All @@ -105,6 +104,7 @@ public function actionSave()
}

$field->setAttributes($post);
$field->required = (bool) ($post['required'] ?? false);

$fieldHasOptions = \in_array(
$field->type,
Expand Down Expand Up @@ -165,7 +165,7 @@ public function actionSave()
public function actionDelete(): Response
{
$this->requirePostRequest();
PermissionsHelper::requirePermission(PermissionsHelper::PERMISSION_FIELDS_MANAGE);
PermissionHelper::requirePermission(Freeform::PERMISSION_FIELDS_MANAGE);

$fieldId = \Craft::$app->request->post('id');

Expand Down
Loading

0 comments on commit b7935aa

Please sign in to comment.