aboutsummaryrefslogtreecommitdiffhomepage
path: root/main/app
diff options
context:
space:
mode:
Diffstat (limited to 'main/app')
-rw-r--r--main/app/sprinkles/FormGenerator/.gitignore3
-rw-r--r--main/app/sprinkles/FormGenerator/CHANGELOG.md78
-rw-r--r--main/app/sprinkles/FormGenerator/LICENSE21
-rw-r--r--main/app/sprinkles/FormGenerator/README.md352
-rw-r--r--main/app/sprinkles/FormGenerator/asset-bundles.json17
-rw-r--r--main/app/sprinkles/FormGenerator/assets/js/widget-formGenerator.js353
-rw-r--r--main/app/sprinkles/FormGenerator/bower.json30
-rw-r--r--main/app/sprinkles/FormGenerator/composer.json29
-rw-r--r--main/app/sprinkles/FormGenerator/locale/en_US/FormGenerator.php14
-rw-r--r--main/app/sprinkles/FormGenerator/locale/fr_FR/FormGenerator.php14
-rw-r--r--main/app/sprinkles/FormGenerator/routes/FormGenerator.php12
-rw-r--r--main/app/sprinkles/FormGenerator/src/Controller/FormGeneratorController.php28
-rw-r--r--main/app/sprinkles/FormGenerator/src/Element/Alert.php34
-rw-r--r--main/app/sprinkles/FormGenerator/src/Element/BaseInput.php111
-rw-r--r--main/app/sprinkles/FormGenerator/src/Element/Checkbox.php39
-rw-r--r--main/app/sprinkles/FormGenerator/src/Element/Hidden.php33
-rw-r--r--main/app/sprinkles/FormGenerator/src/Element/InputInterface.php22
-rw-r--r--main/app/sprinkles/FormGenerator/src/Element/Select.php42
-rw-r--r--main/app/sprinkles/FormGenerator/src/Element/Text.php38
-rw-r--r--main/app/sprinkles/FormGenerator/src/Element/Textarea.php39
-rw-r--r--main/app/sprinkles/FormGenerator/src/Form.php182
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig35
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig30
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig5
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig5
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig3
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig7
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig10
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig6
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/modal-large.html.twig3
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig65
-rw-r--r--main/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig15
-rw-r--r--main/app/sprinkles/FormGenerator/tests/Unit/FormGeneratorTest.php402
-rw-r--r--main/app/sprinkles/FormGenerator/tests/Unit/data/bad.json12
-rw-r--r--main/app/sprinkles/FormGenerator/tests/Unit/data/good.json67
-rw-r--r--main/app/sprinkles/account/assets/userfrosting/js/pages/forgot-password.js1
-rw-r--r--main/app/sprinkles/account/assets/userfrosting/js/pages/resend-verification.js1
-rw-r--r--main/app/sprinkles/account/assets/userfrosting/js/pages/set-or-reset-password.js1
-rw-r--r--main/app/sprinkles/account/src/Authenticate/Authenticator.php2
-rw-r--r--main/app/sprinkles/account/src/Controller/AccountController.php10
-rw-r--r--main/app/sprinkles/account/src/Database/Models/Group.php2
-rw-r--r--main/app/sprinkles/account/src/Database/Models/User.php6
-rw-r--r--main/app/sprinkles/account/src/Repository/PasswordResetRepository.php2
-rw-r--r--main/app/sprinkles/account/src/Repository/VerificationRepository.php1
-rw-r--r--main/app/sprinkles/account/src/ServicesProvider/ServicesProvider.php2
-rw-r--r--main/app/sprinkles/admin/assets/userfrosting/js/widgets/users.js2
-rw-r--r--main/app/sprinkles/admin/routes/posts.php4
-rw-r--r--main/app/sprinkles/admin/routes/users.php2
-rw-r--r--main/app/sprinkles/admin/src/Controller/GroupController.php1
-rw-r--r--main/app/sprinkles/admin/src/Controller/PostController.php60
-rw-r--r--main/app/sprinkles/admin/src/Controller/RoleController.php3
-rw-r--r--main/app/sprinkles/admin/src/Controller/UserController.php86
-rw-r--r--main/app/sprinkles/core/asset-bundles.json1
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/js/chat.js14
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/js/imageCaching.js132
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/js/main.js65
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/js/popups.js4
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/AbstractConnectionDecorator.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/WebSocket/WsServerInterface.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/tests/unit/Wamp/WampServerTest.php1
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/guzzlehttp/psr7/src/BufferStream.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Factory/Worker/EnsureFilterWorker.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CompassFilter.php3
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssEmbedFilter.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssImportFilter.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessFilter.php6
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessphpFilter.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/PhpCssEmbedFilter.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/RooleFilter.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/Sass/BaseSassFilter.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/SprocketsFilter.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/StylusFilter.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/NegotiatorInterface.php4
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/RequestVerifier.php12
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/ServerNegotiator.php4
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Messaging/Frame.php6
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/tests/unit/Messaging/FrameTest.php10
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/promise/tests/FunctionResolveTest.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/socket/src/StreamEncryption.php2
-rw-r--r--main/app/sprinkles/core/assets/SiteAssets/php/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php4
-rw-r--r--main/app/sprinkles/core/assets/userfrosting/css/AdminLTE.css2
-rw-r--r--main/app/sprinkles/core/assets/userfrosting/js/AdminLTE.js3
-rw-r--r--main/app/sprinkles/core/assets/userfrosting/js/uf-form.js4
-rw-r--r--main/app/sprinkles/core/assets/userfrosting/js/uf-modal.js2
-rw-r--r--main/app/sprinkles/core/assets/userfrosting/js/uf-table.js2
-rw-r--r--main/app/sprinkles/core/src/Controller/CoreController.php8
-rw-r--r--main/app/sprinkles/core/src/Database/Relations/Concerns/Unique.php4
-rw-r--r--main/app/sprinkles/core/src/Error/Renderer/WhoopsRenderer.php6
-rw-r--r--main/app/sprinkles/core/src/Mail/Mailer.php2
-rw-r--r--main/app/sprinkles/core/src/Mail/TwigMailMessage.php2
-rw-r--r--main/app/sprinkles/core/src/ServicesProvider/ServicesProvider.php6
-rw-r--r--main/app/sprinkles/core/src/Sprunje/Sprunje.php2
-rw-r--r--main/app/sprinkles/core/templates/pages/index.html.twig8
-rw-r--r--main/app/sprinkles/core/templates/pages/partials/page.js.twig4
-rw-r--r--main/app/sprinkles/extend-user/.gitignore3
-rw-r--r--main/app/sprinkles/extend-user/README.md29
-rw-r--r--main/app/sprinkles/extend-user/composer.json22
-rw-r--r--main/app/sprinkles/extend-user/routes/member.php7
-rw-r--r--main/app/sprinkles/extend-user/schema/requests/user/create.yaml86
-rw-r--r--main/app/sprinkles/extend-user/schema/requests/user/edit-info.yaml50
-rw-r--r--main/app/sprinkles/extend-user/src/Controller/MemberController.php123
-rw-r--r--main/app/sprinkles/extend-user/src/Database/Migrations/v400/MembersTable.php33
-rw-r--r--main/app/sprinkles/extend-user/src/Database/Models/Member.php118
-rw-r--r--main/app/sprinkles/extend-user/src/Database/Models/MemberAux.php20
-rw-r--r--main/app/sprinkles/extend-user/src/Database/Scopes/MemberAuxScope.php35
-rw-r--r--main/app/sprinkles/extend-user/src/ServicesProvider/ServicesProvider.php25
-rw-r--r--main/app/sprinkles/extend-user/templates/forms/user.html.twig166
-rw-r--r--main/app/sprinkles/extend-user/templates/pages/user.html.twig11
108 files changed, 219 insertions, 3200 deletions
diff --git a/main/app/sprinkles/FormGenerator/.gitignore b/main/app/sprinkles/FormGenerator/.gitignore
deleted file mode 100644
index 3afbe61..0000000
--- a/main/app/sprinkles/FormGenerator/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-
-.DS_Store
-assets/vendor/ \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/CHANGELOG.md b/main/app/sprinkles/FormGenerator/CHANGELOG.md
deleted file mode 100644
index 0975d22..0000000
--- a/main/app/sprinkles/FormGenerator/CHANGELOG.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# Change Log
-
-## 2.2.10
-- Added support for Repository
-
-## 2.2.9
-- Fix issue when setting data that is a collection
-- `formSuccess` and `confirmSuccess` events now include the request data as a second argument
-
-## 2.2.8
-- Fix icon in textarea macro
-
-## 2.2.7
-- Added `modal-large` template file.
-
-## 2.2.6
-- Fix issue with `binary` checkbox tests.
-- Fix Text input style when no icon is added
-
-## 2.2.5
-- Added `binary` option for checkbox to disable UF binary checkbox system (bool; default true).
-
-## 2.2.4
-- Add necessary HTML to disable submit and cancel button in modal form.
-
-## 2.2.3
-- New `$form->setOptions` function to set options of a select element. Shortcut for using `setInputArgument` and `setValue`.
-
-## 2.2.2
-- Fix issue with error alert no displaying on confirmation dialog
-
-## 2.2.1
-- Initialize ufAlert if not already done
-- Autofocus first form field when modal is displayed
-
-## 2.2.0
-- Refactored the javascript plugin
-- Added new events
-- Added new `redirectAfterSuccess` boolean option
-
-## 2.1.2
-- Fix warning with select macro
-
-## 2.1.1
-- Fix issue with the select macro
-- Renamed macro templates with the `*.html.twig` extension
-
-## 2.1.0
-- Completely refactored how form fields are parsed, including how default value are defined. Each input type now defines it's own class for defining default values and transforming some input.
-- Twig templates updated to reflect the new parser.
-- Twig macros changed from `*.generate(name, value)` to `*.generate(input)`.
-- **`Bool` type changed to `checkbox`**.
-- Removed the `number` Twig template (Will use the text input one).
-- Added unit tests.
-- Support for any attributes in the schema. For example, if you need to add a data attribute to a field, your schema would be:
-```
-"myField" : {
- "form" : {
- "type" : "text",
- "label" : "My Field",
- "icon" : "fa-pencil",
- "data-something" : "blah"
- }
-}
-```
-
-## 2.0.0
-- Updated for UserFrosting v4.1.x
-
-The custom `RequestSchema` have been removed. Instead of building the form directly on the schema using `$schema->initForm()`, you now create a new Form using `$form = new Form($schema)` and go on from there. Handling complex schema can now be done using the new loader system from UF 4.1.
-
-`$schema->generateForm();` has also been changed to `$form->generate();`.
-
-## 1.0.1
-- Bug fixes
-
-## 1.0.0
-- Initial release
diff --git a/main/app/sprinkles/FormGenerator/LICENSE b/main/app/sprinkles/FormGenerator/LICENSE
deleted file mode 100644
index 09386f7..0000000
--- a/main/app/sprinkles/FormGenerator/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2016 Louis Charette
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/main/app/sprinkles/FormGenerator/README.md b/main/app/sprinkles/FormGenerator/README.md
deleted file mode 100644
index 2924ede..0000000
--- a/main/app/sprinkles/FormGenerator/README.md
+++ /dev/null
@@ -1,352 +0,0 @@
-# Form Generator Sprinkle for [UserFrosting 4](https://www.userfrosting.com)
-This Sprinkle provides helper classes, Twig template and JavaScript plugins to generate HTML forms, modals and confirm modal bases on UserFrosting/[validation schemas](https://learn.userfrosting.com/routes-and-controllers/client-input/validation).
-
-> This version only works with UserFrosting 4.1.x !
-
-# Help and Contributing
-
-If you need help using this sprinkle or found any bug, feels free to open an issue or submit a pull request. You can also find me on the [UserFrosting Chat](https://chat.userfrosting.com/) most of the time for direct support.
-
-<a href='https://ko-fi.com/A7052ICP' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
-
-# Installation
-Edit UserFrosting `app/sprinkles.json` file and add the following to the `require` list : `"lcharette/uf_formgenerator": "^2.0.0"`. Also add `FormGenerator` to the `base` list. For example:
-
-```
-{
- "require": {
- "lcharette/uf_formgenerator": "^2.0.0"
- },
- "base": [
- "core",
- "account",
- "admin",
- "FormGenerator"
- ]
-}
-```
-
-Run `composer update` then `php bakery bake` to install the sprinkle.
-
-# Features and usage
-Before starting with _FormGenerator_, you should read the main UserFrosting guide to familiarize yourself with _validation schemas_: (https://learn.userfrosting.com/routes-and-controllers/client-input/validation).
-
-## Form generation
-### Defining the fields in the schema
-This sprinkle uses the `schemas` used by UserFrosting to validate form data to build form. To achieve this, a new `form` key is simply added to the fields found in a `schema` file.
-
-For example, here's a simple `schema` used to validate a form used to create a `project`. The form will contain a `name`, `description` and `status` fields.
-
-```
-{
- "name" : {
- "validators" : {
- "length" : {
- "min" : 1,
- "max" : 100
- },
- "required" : {
- "message" : "PROJECT.VALIDATE.REQUIRED_NAME"
- }
- }
- },
- "description" : {
- "validators" : {}
- },
- "status" : {
- "validators" : {
- "member_of" : {
- "values" : [
- "0", "1"
- ]
- },
- "required" : {
- "message" : "PROJECT.VALIDATE.STATUS"
- }
- }
- }
-}
-```
-> Note: FormGenerator works with json and YAML schemas.
-
-At this point, with typical UserFrosting setup, you would be going into your controller and Twig files to manually create your HTML form. This can be easy if you have a two or three fields, but can be a pain with a dozen fields and more. This is where FormGenerator steps in with the use of a new `form` attribute. Let's add it to our `project` form :
-
-```
-{
- "name" : {
- "validators" : {
- "length" : {
- "min" : 1,
- "max" : 100
- },
- "required" : {
- "message" : "VALIDATE.REQUIRED_NAME"
- }
- },
- "form" : {
- "type" : "text",
- "label" : "NAME",
- "icon" : "fa-flag",
- "placeholder" : "NAME"
- }
- },
- "description" : {
- "validators" : {},
- "form" : {
- "type" : "textarea",
- "label" : "DESCRIPTION",
- "icon" : "fa-pencil",
- "placeholder" : "DESCRIPTION",
- "rows" : 5
- }
- },
- "status" : {
- "validators" : {
- "member_of" : {
- "values" : [
- "0", "1"
- ]
- },
- "required" : {
- "message" : "VALIDATE.STATUS"
- }
- },
- "form" : {
- "type" : "select",
- "label" : "STATUS",
- "options" : {
- "0" : "Active",
- "1" : "Disabled"
- }
- }
- }
-}
-```
-
-Let's look closer at the `name` field :
-
-```
-"form" : {
- "type" : "text",
- "label" : "PROJECT.NAME",
- "icon" : "fa-flag",
- "placeholder" : "PROJECT.NAME"
-}
-```
-
-Here you can see that we define the `type`, `label`, `icon` and `placeholder` value for this `name` field. You can define any standard [form attributes](http://www.w3schools.com/html/html_form_attributes.asp), plus the `icon`, `label` and `default` attributes. `data-*` attributes can also be defined in your schema if you need them. For the `select` element, a special `options` attribute containing an array of `key : value` can be used to define the dropdown options. The select options (as any other attributes) can also be set in PHP (see further below).
-
-And of course, the values of the `label` and `placeholder` attributes can be defined using _translation keys_.
-
-Currently, FormGenerator supports the following form elements :
-- text (and any input supported by the HTML5 standard : number, tel, password, etc.)
-- textarea
-- select
-- checkbox
-- hidden
-- alert (Display a static alert box in the form)
-
-### The controller part
-Once your fields defined in the `schema` json or yaml file, you need to load that schema in your controller.
-
-First thing to do is add FormGenerator's `Form` class to your "use" list :
-`use UserFrosting\Sprinkle\FormGenerator\Form;`
-
-Next, where you load the schema and setup the `validator`, you simply add the new Form creation:
-```
-// Load validator rules
-$schema = new RequestSchema("schema://project.json");
-$validator = new JqueryValidationAdapter($schema, $this->ci->translator);
-
-// Create the form
-$form = new Form($schema, $project);
-```
-
-In this example, `$project` can contain the default (or current value) of the fields. A data collection fetched from the database with eloquent can also be passed directly. That second argument can also be omited to create an empty form.
-
-Last thing to do is send the fields to Twig. In the list of retuned variables to the template, add the `fields` variable:
-```
-$this->ci->view->render($response, "pages/myPage.html.twig", [
- "fields" => $form->generate(),
- "validators" => $validator->rules('json', true)
-]);
-
-```
-
-### The Twig template part
-
-Now it's time to display the form in `myPage.html.twig` !
-
-```
-<form name="MyForm" method="post" action="/Path/to/Controller/Handling/Form">
- {% include "forms/csrf.html.twig" %}
- <div id="form-alerts"></div>
- <div class="row">
- <div class="col-sm-8">
- {% include 'FormGenerator/FormGenerator.html.twig' %}
- </div>
- </div>
- <div class="row">
- <button type="submit" class="btn btn-block btn-lg btn-success">Submit</button>
- </div>
-</form>
-```
-
-That's it! No need to list all the field manually. The ones defined in the `fields` variable will be displayed by `FormGenerator/FormGenerator.html.twig`. Note that this will only load the fields, not the form itself. The `<form>` tag and `submit` button needs to be added manually.
-
-## Modal form
-What if you want to show a form in a modal window? Well, FormGenerator makes it even easier! It's basically three steps:
-1. Setup your form schema (described above)
-2. Setup the form in your controller
-3. Call the modal from your template
-
-### Setup the form in your controller
-With your schema in hand, it's time to create a controller and route to load your modal. The controller code will be like any basic UserFrosting modal, plus the `$form` part above and one changes in the `render` part. For example :
-
-```
-$this->ci->view->render($response, "FormGenerator/modal.html.twig", [
- "box_id" => $get['box_id'],
- "box_title" => "PROJECT.CREATE",
- "submit_button" => "CREATE",
- "form_action" => '/project/create',
- "fields" => $form->generate(),
- "validators" => $validator->rules('json', true)
-]);
-```
-
-As you can see, instead of rendering your own Twig template, you simply have to specify FormGenerator's modal template. This template requires the following variables:
-1. `box_id`: This should always be `$get['box_id']`. This is used by the JavaScript code to actually display the modal.
-2. `box_title`: The title of the modal.
-3. `submit_button`: The label of the submit button. Optional. Default to `SUBMIT` (localized).
-4. `form_action`: The route where the form will be sent
-5. `fields`: The fields. Should always be `$form->generate()`
-6. `validators`: Client side validators
-
-### Call the modal from your template
-So at this point you have a controller that displays the modal at a `/path/to/controller` route. Time to show that modal. Again, two steps:
-
-First, define a link or a button that will call the modal when clicked. For example :
-```
-<button class="btn btn-success js-displayForm" data-toggle="modal" data-formUrl="/path/to/controller">Create</button>
-```
-
-The important part here is the `data-formUrl` attribute. This is the route that will load your form. `js-displayForm` is used here to bind the button to the action.
-
-Second, load the FormGenerator JavaScript widget. Add this to your Twig file:
-```
-{% block scripts_page %}
- {{ assets.js('js/FormGenerator') | raw }}
-{% endblock %}
-```
-
-By default, the `formGenerator` plugin will bind a **form modal** to every element with the `js-displayForm` class.
-
-## Modal confirmation
-
-One side features of FormGenerator is the ability to add a confirmation modal to your pages with simple HTML5 attributes. The process is similar to adding a modal form, without the need to create any controller or route.
-
-Let's look at a delete button / confirmation for our `project` :
-```
-<a href="#" class="btn btn-danger js-displayConfirm"
- data-confirm-title="Delete project ?"
- data-confirm-message="Are you sure you want to delete this project?"
- data-confirm-button="Yes, delete project"
- data-post-url="/porject/delete"
-data-toggle="modal"><i class="fa fa-trash-o"></i> Delete</a>
-```
-(Note that content of data attributes can be translation keys)
-
-If not aready done, make sure the FormGenerator assets are included in your template.
-```
-{% block scripts_page %}
- {{ assets.js('js/FormGenerator') | raw }}
-{% endblock %}
-```
-
-By default, the `formGenerator` plugin will bind a **confirmation modal** to every element with the `js-displayConfirm` class.
-
-## Advance usage
-
-### Defining attributes in PHP
-
-#### setInputArgument
-
-Form field input attributes can also be added or edited from PHP. This can be usefull when dynamically defining a Select input options. To do this, simply use the `setInputArgument($inputName, $property, $data)` method. For example, to add a list to a `clients` select :
-
-```
-// Get clients from the db model
-$clients = Clients::all();
-
-$form = new Form($schema);
-$form->setInputArgument('clients', 'options', $clients);
-```
-
-#### setData
-
-If you want to set the form values once the form instance is created, you can use the `setData($data)` method:
-
-```
-$form = new Form($schema);
-$form->setData($clients, $project);
-```
-
-#### setValue
-
-Similar to the `setData` method, you can set a specific input value using the `setValue($inputName, $value)` method :
-
-```
-$currentClient = ...
-
-$form = new Form($schema, $project);
-$form->setValue('clients', $currentClient);
-```
-
-#### setFormNamespace
-
-When dealing with multiple form on the same page or a dynamic number of input (you can use the new `Loader` system in 4.1 to build dynamic schemas!), it can be useful to wrap form elements in an array using the `setFormNamespace($namespace)` method. This can also your the input names [to contains dot syntaxt](http://stackoverflow.com/a/20365198/445757).
-
-For example, `$form->setFormNamespace("data");` will transform all the input names from `<input name="foo" [...] />` to `<input name="data[foo]" [...] />`.
-
-### Javascript Plugin
-
-By default, the `formGenerator` plugin will bind a **form modal** to every element with the `js-displayForm` class and will bind a **confirmation modal** to every element with the `js-displayConfirm` class. You can
-
-#### Options
-The following options are available:
-
-Just pass an object with those
- - `mainAlertElement` (jQuery element). The element on the main page where the main alerts will be displayed. Default to `$('#alerts-page')`.
- - `redirectAfterSuccess` (bool). If set to true, the page will reload when the form submission or confirmation is succesful. Default to `true`.
-
-Example:
-```
-$(".project-edit-button").formGenerator({redirectAfterSuccess: false});
-```
-
-#### Events
-You can listen for some events returned by FormGenerator. Those events can be used to apply some actions when the modal is displayed or the form is successfully sent. For example, this is can be used with `redirectAfterSuccess` on `false` to refresh the data on the page when the form is submitted successfully.
-
-- `formSuccess.formGenerator`
-- `displayForm.formGenerator`
-- `displayConfirmation.formGenerator`
-- `confirmSuccess.formGenerator`
-- `error.formGenerator`
-
-Example:
-```
-$(".project-edit-button").on("formSuccess.formGenerator", function () {
- // Refresh data
-});
-```
-
-# Working example
-
-See the [UF_FormGeneratorExample](https://github.com/lcharette/UF_FormGeneratorExample) repo for an example of the FormGenerator full code.
-
-# Running tests
-
-FormGenerator comes with some unit tests. Before submitting a new Pull Request, you need to make sure all tests are a go. With the sprinkle added to your UserFrosting installation, simply execute the `php bakery test` command to run the tests.
-
-# Licence
-
-By [Louis Charette](https://github.com/lcharette). Copyright (c) 2017, free to use in personal and commercial software as per the MIT license.
diff --git a/main/app/sprinkles/FormGenerator/asset-bundles.json b/main/app/sprinkles/FormGenerator/asset-bundles.json
deleted file mode 100644
index 43ea863..0000000
--- a/main/app/sprinkles/FormGenerator/asset-bundles.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "bundle": {
- "js/FormGenerator": {
- "scripts": [
- "vendor/bootstrap3-typeahead/bootstrap3-typeahead.js",
- "js/widget-formGenerator.js"
- ],
- "options": {
- "result": {
- "type": {
- "scripts": "plain"
- }
- }
- }
- }
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/assets/js/widget-formGenerator.js b/main/app/sprinkles/FormGenerator/assets/js/widget-formGenerator.js
deleted file mode 100644
index 6cfcce8..0000000
--- a/main/app/sprinkles/FormGenerator/assets/js/widget-formGenerator.js
+++ /dev/null
@@ -1,353 +0,0 @@
-/*!
- * FormGenerator Plugin
- *
- * JQuery plugin for the UserFrosting FormGenerator Sprinkle
- * Based on UserFrosting v3
- *
- * @package UF_FormGenerator
- * @author Louis Charette
- * @link https://github.com/lcharette/UF_FormGenerator
- * @license MIT
- */
-
-;(function ($, window, document, undefined) {
- "use strict";
-
- // Define plugin name and defaults.
- var pluginName = "formGenerator",
- defaults = {
- DEBUG: false,
- mainAlertElement: $('#alerts-page'),
- redirectAfterSuccess: true,
- autofocusModalElement: true
- };
-
- // Constructor
- function Plugin(element, options) {
- this.elements = element;
- this.$elements = $(this.elements);
- this.settings = $.extend(true, {}, defaults, options);
- this._defaults = defaults;
- this._name = pluginName;
-
- // Detect changes to element attributes
- this.$elements.attrchange({
- callback: function (event) {
- this.elements = event.target;
- }.bind(this)
- });
-
- // Initialise ufAlerts
- if (!this.settings.mainAlertElement.data('ufAlerts')) {
- this.settings.mainAlertElement.ufAlerts();
- }
-
- return this;
- }
-
- // Functions
- $.extend(Plugin.prototype, {
- /**
- * Bind the display action for a form to the button
- */
- display: function () {
- this.$elements.on('click', $.proxy(this._fetchForm, this));
- return this.$elements;
- },
- /**
- * Bind the confirm action to the button
- */
- confirm: function () {
- this.$elements.on('click', $.proxy(this._fetchConfirmModal, this));
- return this.$elements;
- },
- /**
- * Fetch the form HTML
- */
- _fetchForm: function (event) {
-
- // Get the button element
- var button = event.currentTarget;
-
- // Get the box_id. Define one if none is defined
- var box_id = $(button).data('target');
- if (box_id == undefined) {
- box_id = "formGeneratorModal";
- }
-
- // Delete any existing instance of the form with the same name
- if ($('#' + box_id).length) {
- $('#' + box_id).remove();
- }
-
- // Prepare the ajax payload
- var payload = $.extend({
- box_id: box_id
- }
- , button.dataset);
-
- // Fetch and render the form
- $.ajax({
- type: "GET",
- url: $(button).data('formurl'),
- data: payload,
- cache: false
- })
- .done($.proxy(this._displayForm, this, box_id, button))
- .fail($.proxy(this._displayFailure, this, button));
- },
- /**
- * Displays the form modal and set up ufForm
- */
- _displayForm: function (box_id, button, data) {
-
- // Trigger pre-display event
- $(button).trigger("displayForm." + this._name);
-
- // Append the form as a modal dialog to the body
- $("body").append(data);
- $('#' + box_id).modal('show');
-
- // Set focus on first element
- if (this.settings.autofocusModalElement) {
- $('#' + box_id).on('shown.bs.modal', function () {
- $(this).find(".modal-body").find(':input:enabled:visible:first').focus();
- });
- }
-
- // Setup ufAlerts
- var boxMsgTarget = $("#" + box_id + " #form-alerts");
-
- // Show the alert. We could have info alert coming in
- if (!boxMsgTarget.data('ufAlerts')) {
- boxMsgTarget.ufAlerts();
- }
- boxMsgTarget.ufAlerts('clear').ufAlerts('fetch').ufAlerts('render');
-
- // Setup the loaded form with ufForm
- $('#' + box_id).find("form").ufForm({
- validators: validators,
- msgTarget: $("#" + box_id + " #form-alerts")
- })
- .on("submitSuccess.ufForm", $.proxy(this._formPostSuccess, this, box_id, button))
- .on("submitError.ufForm", $.proxy(this._displayFormFaillure, this, box_id, button));
- },
- /**
- * Action done when a form is successful
- */
- _formPostSuccess: function (box_id, button, event, data) {
-
- // Trigger success event
- $(button).trigger("formSuccess." + this._name, data);
-
- // Refresh page or close modal
- if (this.settings.redirectAfterSuccess) {
- window.location.reload(true);
- } else {
- $('#' + box_id).modal('hide');
- this.settings.mainAlertElement.ufAlerts('clear').ufAlerts('fetch').ufAlerts('render');
- }
- },
- /**
- * Fetch confirmation modal
- */
- _fetchConfirmModal: function (event) {
-
- // Get the button element
- var button = event.currentTarget;
-
- // Get the box_id. Define one if none is defined
- var box_id = $(button).data('target');
- if (box_id == undefined) {
- box_id = "formGeneratorModal";
- }
-
- // Delete any existing instance of the form with the same name
- if ($('#' + box_id).length) {
- $('#' + box_id).remove();
- }
-
- // Prepare the ajax payload
- var payload = $.extend({
- box_id: box_id,
- box_title: $(button).data('confirmTitle') ? $(button).data('confirmTitle') : null,
- confirm_message: $(button).data('confirmMessage') ? $(button).data('confirmMessage') : null,
- confirm_warning: $(button).data('confirmWarning') ? $(button).data('confirmWarning') : null,
- confirm_button: $(button).data('confirmButton') ? $(button).data('confirmButton') : null,
- cancel_button: $(button).data('cancelButton') ? $(button).data('cancelButton') : null
- }, button.dataset);
-
- // Fetch and render the form
- $.ajax({
- type: "GET",
- url: $(button).data('formurl') ? $(button).data('formurl') : site['uri']['public'] + "/forms/confirm",
- data: payload,
- cache: false
- })
- .done($.proxy(this._displayConfirmation, this, box_id, button))
- .fail($.proxy(this._displayFailure, this, button));
- },
- /**
- * Display confirmation modal
- */
- _displayConfirmation: function (box_id, button, data) {
-
- // Trigger pre-display event
- $(button).trigger("displayConfirmation." + this._name);
-
- // Append the form as a modal dialog to the body
- $("body").append(data);
- $('#' + box_id).modal('show');
-
- $('#' + box_id + ' .js-confirm').on('click', $.proxy(this._sendConfirmation, this, box_id, button));
- },
- /**
- * Send confirmation query
- */
- _sendConfirmation: function (box_id, button) {
-
- // Prepare payload
- var url = $(button).data('postUrl');
- var method = ($(button).data('postMethod')) ? $(button).data('postMethod') : "POST";
- var data = {
- bData: button.dataset,
- csrf_name: $('#' + box_id).find("input[name='csrf_name']").val(),
- csrf_value: $('#' + box_id).find("input[name='csrf_value']").val()
- };
-
- // Send ajax
- $.ajax({
- type: method,
- url: url,
- data: data
- })
- .done($.proxy(this._confirmationSuccess, this, box_id, button))
- .fail($.proxy(this._displayConfirmationFaillure, this, box_id, button));
- },
- /**
- * Action done when a confirmation request is successful
- */
- _confirmationSuccess: function (box_id, button, data) {
-
- // Trigger success event
- $(button).trigger("confirmSuccess." + this._name, data);
-
- // Refresh page or close modal
- if (this.settings.redirectAfterSuccess) {
-
- // Redirect if result contains intrusctions to
- if (data.redirect) {
- window.location.replace(data.redirect);
- } else {
- window.location.reload(true);
- }
- } else {
- $('#' + box_id).modal('hide');
- this.settings.mainAlertElement.ufAlerts('clear').ufAlerts('fetch').ufAlerts('render');
- }
- },
- /**
- * Failure callback for ajax requests. Displays the error in the main alertElement
- */
- _displayFailure: function (button, response) {
- $(button).trigger("error." + this._name);
- if ((typeof site !== "undefined") && site.debug.ajax && response.responseText) {
- document.write(response.responseText);
- document.close();
- } else {
- if (this.settings.DEBUG) {
- $.error("Error (" + response.status + "): " + response.responseText);
- }
- this.settings.mainAlertElement.ufAlerts('clear').ufAlerts('fetch').ufAlerts('render');
- }
- },
- /**
- * Faillure callback for ajax requests to be displayed in a modal form
- */
- _displayFormFaillure: function (box_id, button) {
- $(button).trigger("error." + this._name);
- $("#" + box_id + " #form-alerts").show();
- },
- /**
- * Faillure callback for ajax requests to be displayed in a confirmation form
- */
- _displayConfirmationFaillure: function (box_id, button) {
- $(button).trigger("error." + this._name);
-
- // Setup ufAlerts
- var boxMsgTarget = $("#" + box_id + " #confirmation-alerts");
-
- // Show the alert. We could have info alert coming in
- if (!boxMsgTarget.data('ufAlerts')) {
- boxMsgTarget.ufAlerts();
- }
- boxMsgTarget.ufAlerts('clear').ufAlerts('fetch').ufAlerts('render');
- },
- /**
- * Completely destroy the ufAlerts plugin on the element.
- */
- destroy: function () {
- // Unbind any bound events
- this.$elements.off('.' + this._name);
-
- // Grab jQuery wrapped element before plugin destruction
- var $elements = this.$elements;
-
- // Remove plugin from element
- this.$elements.removeData(this._name);
-
- return $elements;
- }
- });
-
- // Handles instantiation and access to non-private methods.
- $.fn[pluginName] = function (methodOrOptions) {
-
- // If the plugin is called on a non existing element, return nothing
- if (this.length == 0) {
- return this;
- }
-
- // Grab plugin instance
- var instance = $(this).data(pluginName);
-
- // If undefined or object, uses the default `display` method.
- if (methodOrOptions === undefined || typeof methodOrOptions === 'object') {
- var method = "display";
- var options = methodOrOptions;
- }
- // Otherwise ensure first parameter is a valid string
- else if (typeof methodOrOptions === 'string') {
- // Ensure not a private function
- if (methodOrOptions.indexOf('_') !== 0) {
- var method = methodOrOptions;
- var options = Array.prototype.slice.call(arguments, 1)[0];
- }
- else {
- $.error('Method ' + methodOrOptions + ' is private!');
- }
- }
- else {
- $.error('Method ' + methodOrOptions + ' is invalid.');
- }
-
- // Only initalise if not previously done.
- if (!instance) {
- $(this).data(pluginName, new Plugin(this, options));
- instance = $(this).data(pluginName);
- }
-
- // Make sure method exist
- if (typeof instance[method] === 'function') {
- // Run the required method
- return instance[method](options);
- } else {
- $.error('Method ' + method + ' does not exist.');
- }
- };
-
- // Apply on default selector
- $(".js-displayForm").formGenerator();
- $(".js-displayConfirm").formGenerator('confirm');
-
-})(jQuery, window, document); \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/bower.json b/main/app/sprinkles/FormGenerator/bower.json
deleted file mode 100644
index 6ce7156..0000000
--- a/main/app/sprinkles/FormGenerator/bower.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "formgenerator-assets",
- "version": "0.0.1",
- "homepage": "https://github.com/lcharette/UF_FormGenerator",
- "authors": [
- "lcharette"
- ],
- "moduleType": [
- "node"
- ],
- "license": "MIT",
- "ignore": [
- "**/.*",
- "node_modules",
- "bower_components",
- "assets/vendor",
- "examples",
- "demo-resources",
- "demo",
- "test",
- "tests"
- ],
- "dependencies": {
- "bootstrap3-typeahead": "~3.1.0"
- },
- "resolutions": {
- "jquery": ">= 2.2.4",
- "bootstrap": "3.x"
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/composer.json b/main/app/sprinkles/FormGenerator/composer.json
deleted file mode 100644
index 797e029..0000000
--- a/main/app/sprinkles/FormGenerator/composer.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "lcharette/uf_formgenerator",
- "type": "userfrosting-sprinkle",
- "description": "Form generator for UserFrosting V4",
- "keywords": [
- "Form",
- "generator",
- "userfrosting"
- ],
- "homepage": "https://github.com/lcharette/UF_FormGenerator",
- "license": "MIT",
- "authors": [
- {
- "name": "Louis Charette",
- "homepage": "https://github.com/lcharette"
- }
- ],
- "require": {
- "php": ">=5.6"
- },
- "autoload": {
- "psr-4": {
- "UserFrosting\\Sprinkle\\FormGenerator\\": "src/"
- }
- },
- "extra": {
- "installer-name": "FormGenerator"
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/locale/en_US/FormGenerator.php b/main/app/sprinkles/FormGenerator/locale/en_US/FormGenerator.php
deleted file mode 100644
index 41d7bfa..0000000
--- a/main/app/sprinkles/FormGenerator/locale/en_US/FormGenerator.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-return [
-
- "CONFIRM" => [
- "@TRANSLATION" => "Confirm action",
-
- "MESSAGE" => "Are you sure you want to do this?",
-
- "WARNING" => "This action cannot be undone.",
-
- "YES" => "Yes, do it"
- ]
-]; \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/locale/fr_FR/FormGenerator.php b/main/app/sprinkles/FormGenerator/locale/fr_FR/FormGenerator.php
deleted file mode 100644
index 9ede59c..0000000
--- a/main/app/sprinkles/FormGenerator/locale/fr_FR/FormGenerator.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-return [
-
- "CONFIRM" => [
- "@TRANSLATION" => "Confirmer l'action",
-
- "MESSAGE" => "Êtes-vous certain de vouloir faire ceci?",
-
- "WARNING" => "Cette action ne peut pas être annulée.",
-
- "YES" => "Oui"
- ]
-]; \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/routes/FormGenerator.php b/main/app/sprinkles/FormGenerator/routes/FormGenerator.php
deleted file mode 100644
index c770793..0000000
--- a/main/app/sprinkles/FormGenerator/routes/FormGenerator.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-/**
- * UserFrosting (http://www.userfrosting.com)
- *
- * @link https://github.com/userfrosting/UserFrosting
- * @copyright Copyright (c) 2013-2016 Alexander Weissman
- * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
- */
-
-global $app;
-
-$app->get('/forms/confirm', 'UserFrosting\Sprinkle\FormGenerator\Controller\FormGeneratorController:confirm'); \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/src/Controller/FormGeneratorController.php b/main/app/sprinkles/FormGenerator/src/Controller/FormGeneratorController.php
deleted file mode 100644
index 5bd46e1..0000000
--- a/main/app/sprinkles/FormGenerator/src/Controller/FormGeneratorController.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator\Controller;
-
-use UserFrosting\Sprinkle\Core\Controller\SimpleController;
-
-/**
- * FormGeneratorController Class
- *
- * Controller class for /forms/confirm/* URLs. Handles rendering the confirm dialog
- */
-class FormGeneratorController extends SimpleController
-{
-
- /**
- * Display the confirmation dialog
- */
- public function confirm($request, $response, $args) {
- $this->ci->view->render($response, 'FormGenerator/confirm.html.twig', $request->getQueryParams());
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/src/Element/Alert.php b/main/app/sprinkles/FormGenerator/src/Element/Alert.php
deleted file mode 100644
index 31453d3..0000000
--- a/main/app/sprinkles/FormGenerator/src/Element/Alert.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator\Element;
-
-use UserFrosting\Sprinkle\FormGenerator\Element\BaseInput;
-
-/**
- * Alert input type class.
- * Manage the default attributes required to display an alert
- *
- * @extends BaseInput
- */
-class Alert extends BaseInput
-{
-
- /**
- * {@inheritDoc}
- */
- protected function applyTransformations() {
- $this->element = array_merge([
- "class" => "alert-danger",
- "icon" => "fa-ban",
- "value" => $this->value,
- "name" => $this->name
- ], $this->element);
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/src/Element/BaseInput.php b/main/app/sprinkles/FormGenerator/src/Element/BaseInput.php
deleted file mode 100644
index cf78dc6..0000000
--- a/main/app/sprinkles/FormGenerator/src/Element/BaseInput.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator\Element;
-
-use UserFrosting\Sprinkle\FormGenerator\Element\InputInterface;
-use UserFrosting\Sprinkle\Core\Facades\Translator;
-use UserFrosting\Sprinkle\Core\Facades\Debug;
-
-/**
- * BaseInput class.
- *
- * Parse the schema data for a form input element to add the default
- * attributes values and transform other attributes.
- * @abstract
- * @implements InputInterface
- */
-abstract class BaseInput implements InputInterface
-{
-
- /**
- * @var String The name of the input.
- */
- var $name;
-
- /**
- * @var object The input schema data.
- */
- var $element;
-
- /**
- * @var String The input value.
- */
- var $value;
-
- /**
- * Constructor.
- *
- * @access public
- * @param String $name
- * @param object $element
- * @param mixed $value (default: null)
- * @return void
- */
- public function __construct($name, $element, $value = NULL) {
- $this->name = $name;
- $this->element = $element;
- $this->value = $value;
- }
-
- /**
- * parse function.
- *
- * Return the parsed input attributes
- * @access public
- * @return void
- */
- public function parse() {
- $this->applyTransformations();
- return $this->element;
- }
-
- /**
- * translateArgValue function.
- *
- * Translate the value of passed argument using the Translator Facade
- * @access public
- * @param String $argument
- * @return void
- */
- public function translateArgValue($argument) {
- if (isset($this->element[$argument])) {
- $this->element[$argument] = Translator::translate($this->element[$argument]);
- }
- }
-
- /**
- * getValue function.
- *
- * Return the value of the current input element. If not value is set in
- * `$this->value`, return the default value (from the schema data), if any.
- * @access public
- * @return string The input current value
- */
- public function getValue() {
- if (isset($this->value) && $this->value !== NULL) {
- return $this->value;
- } else if (isset($this->element['default'])) {
- return $this->element['default'];
- } else {
- return "";
- }
- }
-
- /**
- * applyTransformations function.
- *
- * Add defaut attributes to the current input element. Also transform
- * attributes values passed from the schema
- * @access protected
- * @abstract
- * @return void
- */
- abstract protected function applyTransformations();
-}
diff --git a/main/app/sprinkles/FormGenerator/src/Element/Checkbox.php b/main/app/sprinkles/FormGenerator/src/Element/Checkbox.php
deleted file mode 100644
index 97bfdba..0000000
--- a/main/app/sprinkles/FormGenerator/src/Element/Checkbox.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator\Element;
-
-use UserFrosting\Sprinkle\FormGenerator\Element\BaseInput;
-
-/**
- * Checkbox input type class.
- * Manage the default attributes required to display a checkbox input
- *
- * @extends BaseInput
- */
-class Checkbox extends BaseInput
-{
-
- /**
- * {@inheritDoc}
- */
- protected function applyTransformations() {
- $this->element = array_merge([
- "class" => "js-icheck",
- "name" => $this->name,
- "id" => "field_" . $this->name,
- "binary" => TRUE
- ], $this->element);
-
- // We add the check status instead of the value
- if ($this->element["binary"] !== FALSE && $this->getValue() == 1) {
- $this->element["checked"] = "checked";
- }
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/src/Element/Hidden.php b/main/app/sprinkles/FormGenerator/src/Element/Hidden.php
deleted file mode 100644
index 6f79ecd..0000000
--- a/main/app/sprinkles/FormGenerator/src/Element/Hidden.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator\Element;
-
-use UserFrosting\Sprinkle\FormGenerator\Element\BaseInput;
-
-/**
- * Hidden input type class.
- * Manage the default attributes required to display an hidden input type
- *
- * @extends BaseInput
- */
-class Hidden extends BaseInput
-{
-
- /**
- * {@inheritDoc}
- */
- protected function applyTransformations() {
- $this->element = array_merge([
- "value" => $this->getValue(),
- "name" => $this->name,
- "id" => "field_" . $this->name
- ], $this->element);
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/src/Element/InputInterface.php b/main/app/sprinkles/FormGenerator/src/Element/InputInterface.php
deleted file mode 100644
index 66225bc..0000000
--- a/main/app/sprinkles/FormGenerator/src/Element/InputInterface.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator\Element;
-
-/**
- * InputInterface
- *
- * Interface for Form elements classes
- */
-interface InputInterface
-{
- public function __construct($name, $element, $value = NULL);
-
- public function parse();
-}
diff --git a/main/app/sprinkles/FormGenerator/src/Element/Select.php b/main/app/sprinkles/FormGenerator/src/Element/Select.php
deleted file mode 100644
index da91fbd..0000000
--- a/main/app/sprinkles/FormGenerator/src/Element/Select.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator\Element;
-
-use UserFrosting\Sprinkle\FormGenerator\Element\BaseInput;
-
-/**
- * Select input type class.
- * Manage the default attributes required to display a select input type
- *
- * @extends BaseInput
- */
-class Select extends BaseInput
-{
-
- /**
- * {@inheritDoc}
- */
- protected function applyTransformations() {
- $this->element = array_merge([
- "class" => "form-control js-select2",
- "value" => $this->getValue(),
- "name" => $this->name,
- "id" => "field_" . $this->name
- ], $this->element);
-
- // Placeholder is required to be in `data-*` for select 2
- // Plus we translate the placeholder
- if (isset($this->element["placeholder"])) {
- $this->element["data-placeholder"] = $this->element["placeholder"];
- unset($this->element["placeholder"]);
- $this->translateArgValue('data-placeholder');
- }
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/src/Element/Text.php b/main/app/sprinkles/FormGenerator/src/Element/Text.php
deleted file mode 100644
index 375153d..0000000
--- a/main/app/sprinkles/FormGenerator/src/Element/Text.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator\Element;
-
-use UserFrosting\Sprinkle\FormGenerator\Element\BaseInput;
-
-/**
- * Text input type class.
- * Manage the default attributes required to display a text and other html5 input
- *
- * @extends BaseInput
- */
-class Text extends BaseInput
-{
-
- /**
- * {@inheritDoc}
- */
- protected function applyTransformations() {
- $this->element = array_merge([
- "autocomplete" => "off",
- "class" => "form-control",
- "value" => $this->getValue(),
- "name" => $this->name,
- "id" => "field_" . $this->name
- ], $this->element);
-
- // Translate placeholder
- $this->translateArgValue('placeholder');
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/src/Element/Textarea.php b/main/app/sprinkles/FormGenerator/src/Element/Textarea.php
deleted file mode 100644
index b2a84f9..0000000
--- a/main/app/sprinkles/FormGenerator/src/Element/Textarea.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator\Element;
-
-use UserFrosting\Sprinkle\FormGenerator\Element\BaseInput;
-
-/**
- * Textarea input type class.
- * Manage the default attributes required to display a textarea input
- *
- * @extends BaseInput
- */
-class Textarea extends BaseInput
-{
-
- /**
- * {@inheritDoc}
- */
- protected function applyTransformations() {
- $this->element = array_merge([
- "autocomplete" => "off",
- "class" => "form-control",
- "value" => $this->getValue(),
- "name" => $this->name,
- "rows" => 3,
- "id" => "field_" . $this->name
- ], $this->element);
-
- // Translate placeholder
- $this->translateArgValue('placeholder');
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/src/Form.php b/main/app/sprinkles/FormGenerator/src/Form.php
deleted file mode 100644
index 5b948f7..0000000
--- a/main/app/sprinkles/FormGenerator/src/Form.php
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\FormGenerator;
-
-use Illuminate\Contracts\Config\Repository;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Collection;
-use Illuminate\Support\Str;
-use UserFrosting\Fortress\RequestSchema\RequestSchemaInterface;
-
-/**
- * Form Class
- *
- * The FormGenerator class, which is used to return the `form` part from a Fortress
- * schema for html form generator in Twig.
- */
-class Form
-{
-
- /**
- * @var RequestSchemaInterface The form fields definition
- */
- protected $schema;
-
- /**
- * @var array|object The form values
- */
- protected $data = [];
-
- /**
- * @var string Use this to wrap form fields in top-level array
- */
- protected $formNamespace = "";
-
- /**
- * Constructor
- *
- * @param RequestSchemaInterface $schema
- * @param array|object $data (default: [])
- * @return void
- */
- public function __construct(RequestSchemaInterface $schema, $data = []) {
- $this->setSchema($schema);
- $this->setData($data);
- }
-
- /**
- * Set the form current values
- *
- * @param array|object $data The form values
- */
- public function setData($data) {
- if ($data instanceof Collection || $data instanceof Model) {
- $this->data = $data->toArray();
- } else if (is_array($data) || $data instanceof Repository) {
- $this->data = $data;
- } else {
- throw new \InvalidArgumentException("Data must be an array, a Collection, a Model or a Repository");
- }
- }
-
- /**
- * Set the schema for this validator.
- *
- * @param RequestSchemaInterface $schema A RequestSchemaInterface object, containing the form definition.
- */
- public function setSchema(RequestSchemaInterface $schema) {
- $this->schema = $schema;
- }
-
- /**
- * Use to define the value of a form input when `setData` is already set
- *
- * @param mixed $inputName
- * @param mixed $value
- * @return void
- */
- public function setValue($inputName, $value) {
- $this->data[$inputName] = $value;
- }
-
- /**
- * Function used to overwrite the input argument from a schema file
- * Can also be used to overwrite an argument hardcoded in the Twig file.
- * Use `setCustomFormData` to set any other tag.
- *
- * @param string $inputName The input name where the argument will be added
- * @param string $property The argument name. Example "data-color"
- * @param string $data The value of the argument
- * @return void
- */
- public function setInputArgument($inputName, $property, $data) {
- if ($this->schema->has($inputName)) {
- // Get the element and force set the property
- $element = $this->schema->get($inputName);
- $element['form'][$property] = $data;
-
- // Push back the modifyed element in the schema
- $this->schema->set($inputName, $element);
- }
- }
-
- /**
- * Function used to set options of a select element. Shortcut for using
- * `setInputArgument` and `setValue`.
- *
- * @param string $inputName The select name to add options to
- * @param array $data An array of `value => label` options
- * @param string $selected The selected key
- * @return void
- */
- public function setOptions($inputName, $data = [], $selected = NULL) {
- // Set opdations
- $this->setInputArgument($inputName, 'options', $data);
-
- // Set the value
- if (!is_null($selected)) {
- $this->setValue($inputName, $selected);
- }
- }
-
- /**
- * Function to set the form namespace.
- * Use the form namespace to wrap the fields name in a top level array.
- * Useful when using multiple schemas at once or if the names are using dot syntaxt.
- * See : http://stackoverflow.com/a/20365198/445757
- *
- * @param string $namespace
- * @return void
- */
- public function setFormNamespace($namespace) {
- $this->formNamespace = $namespace;
- }
-
- /**
- * Generate an array contining all nececerry value to generate a form
- * with Twig.
- *
- * @return array The form fields data
- */
- public function generate() {
- $form = collect([]);
-
- // Loop all the the fields in the schema
- foreach ($this->schema->all() as $name => $input) {
-
- // Skip the one that don't have a `form` definition
- if (isset($input['form'])) {
-
- // Get the value from the data
- $value = isset($this->data[$name]) ? $this->data[$name] : NULL;
-
- // Add the namespace to the name if it's defined
- $name = ($this->formNamespace != "") ? $this->formNamespace . "[" . $name . "]" : $name;
-
- // Get the element class and make sure it exist
- $type = (isset($input['form']['type'])) ? $input['form']['type'] : "text";
- $type = "UserFrosting\\Sprinkle\\FormGenerator\\Element\\" . Str::studly($type);
-
- // If class doesn't esist, default to Text element
- if (!class_exists($type)) {
- $type = "UserFrosting\\Sprinkle\\FormGenerator\\Element\\Text";
- }
-
- // Create a new instance
- $element = new $type($name, $input['form'], $value);
-
- // Push data to `$form`
- $form->put($name, $element->parse());
- }
- }
-
- return $form->toArray();
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig
deleted file mode 100644
index 688c96c..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig
+++ /dev/null
@@ -1,35 +0,0 @@
-{% import "FormGenerator/macros/checkbox.html.twig" as checkbox %}
-{% import "FormGenerator/macros/textarea.html.twig" as textarea %}
-{% import "FormGenerator/macros/select.html.twig" as select %}
-{% import "FormGenerator/macros/text.html.twig" as text %}
-{% import "FormGenerator/macros/hidden.html.twig" as hidden %}
-{% import "FormGenerator/macros/alert.html.twig" as alert %}
-
-{% for name,input in fields %}
- {% if input.type == "hidden" %}
- {{ hidden.generate(input) }}
- {% elseif input.type == "alert" %}
- {{ alert.generate(input) }}
- {% else %}
- {% if not input.hidden %}
- <div class="form-group has-feedback">
- {% if formLayout == 'horizontal' %}<label for="{{ input.id }}" class="col-sm-2 control-label">{% else %}
- <label for="{{ input.id }}">{% endif %}
- {% if input.label %}{{ translate(input.label) }}{% else %}&nbsp;{% endif %}
- </label>
- {% if formLayout == 'horizontal' %}
- <div class="col-sm-10">{% endif %}
- {% if input.type == "textarea" %}
- {{ textarea.generate(input) }}
- {% elseif input.type == "checkbox" %}
- {{ checkbox.generate(input) }}
- {% elseif input.type == "select" %}
- {{ select.generate(input) }}
- {% else %}
- {{ text.generate(input) }}
- {% endif %}
- {% if formLayout == 'horizontal' %}</div>{% endif %}
- </div>
- {% endif %}
- {% endif %}
-{% endfor %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig
deleted file mode 100644
index 67ba757..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig
+++ /dev/null
@@ -1,30 +0,0 @@
-<div id='{{ box_id }}' class='modal fade'>
- <div class="modal-dialog">
- <div class="modal-content">
- <div class='modal-header'>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- <h4 class='modal-title'>{% if box_title %}{{ translate(box_title) }}{% else %}{{ translate("CONFIRM") }}{% endif %}</h4>
- </div>
- <div class='modal-body'>
- <div id="confirmation-alerts"></div>
- <h4>
- {% if confirm_message %}{{ translate(confirm_message) }}{% else %}{{ translate("CONFIRM.MESSAGE") }}{% endif %}
- <br />
- <small>{% if confirm_warning %}{{ translate(confirm_warning) }}{% else %}{{ translate("CONFIRM.WARNING") }}{% endif %}</small>
- </h4>
- <br>
- <div class='btn-group-action'>
- {% include "forms/csrf.html.twig" %}
- <button type='button'
- class='btn btn-danger btn-lg btn-block js-confirm'>{% if confirm_button %}{{ translate(confirm_button) }}{% else %}{{ translate("CONFIRM.YES") }}{% endif %}</button>
- <button type='button' class='btn btn-default btn-lg btn-block'
- data-dismiss='modal'>{% if cancel_button %}{{ translate(cancel_button) }}{% else %}{{ translate("CANCEL") }}{% endif %}</button>
- </div>
- </div>
- </div>
- <!-- /.modal-content -->
- </div>
- <!-- /.modal-dialog -->
-</div> \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig
deleted file mode 100644
index 03409b5..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig
+++ /dev/null
@@ -1,5 +0,0 @@
-{% macro generate(input) %}
- <div class="alert {{ input.class }}">
- {% if input.icon %}<i class="icon fa {{ input.icon }}"></i> {% endif %}{{ translate(input.value) }}
- </div>
-{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig
deleted file mode 100644
index 95855c2..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig
+++ /dev/null
@@ -1,5 +0,0 @@
-{% macro generate(input) %}
- <div class="checkbox icheck">
- <input{% for type,value in input %} {{ type }}="{{ value }}"{% endfor %}></input>
- </div>
-{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig
deleted file mode 100644
index 34c2d9d..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig
+++ /dev/null
@@ -1,3 +0,0 @@
-{% macro generate(input) %}
- <input{% for type,value in input %} {{ type }}="{{ value }}"{% endfor %}></input>
-{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig
deleted file mode 100644
index 152947b..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig
+++ /dev/null
@@ -1,7 +0,0 @@
-{% macro generate(input) %}
- <select{% for type,value in input %}{% if type != "options" %} {{ type }}="{{ value }}"{% endif %}{% endfor %}>
- {% for option, label in input.options %}
- <option value="{{ option }}"
- {% if (option == input.value) %}selected{% endif %}>{{ translate(label) }}</option>{% endfor %}
- </select>
-{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig
deleted file mode 100644
index 8551fbb..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig
+++ /dev/null
@@ -1,10 +0,0 @@
-{% macro generate(input) %}
- {% if input.icon %}
-<div class="input-group">
- <span class="input-group-addon"><i class="fa {{ input.icon }} fa-fw"></i></span>
- {% else %}
- <div class="form-group">
- {% endif %}
- <input{% for type,value in input %} {{ type }}="{{ value }}"{% endfor %}></input>
- </div>
- {% endmacro %}
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig
deleted file mode 100644
index d924be4..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig
+++ /dev/null
@@ -1,6 +0,0 @@
-{% macro generate(input) %}
- {% if input.icon %}<div class="input-group">
- <span class="input-group-addon"><i class="fa {{ input.icon }} fa-fw"></i></span>{% endif %}
- <textarea{% for type,value in input %} {{ type }}="{{ value }}"{% endfor %}>{{ input.value }}</textarea>
- {% if input.icon %}</div>{% endif %}
-{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal-large.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal-large.html.twig
deleted file mode 100644
index b2de3f9..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal-large.html.twig
+++ /dev/null
@@ -1,3 +0,0 @@
-{% extends "FormGenerator/modal.html.twig" %}
-
-{% block modal_size %}modal-lg{% endblock %}
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig
deleted file mode 100644
index 82d3ea0..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig
+++ /dev/null
@@ -1,65 +0,0 @@
-{% block modal %}
- <div id='{{ box_id }}' class='modal fade'>
- <div class="modal-dialog {% block modal_size %}{% endblock %}" role="document">
- <div class="modal-content">
- <form name="ModalFormGenerator" method="{{ (form_method) ? form_method : 'post' }}"
- action="{{ form_action }}">
- {% include "forms/csrf.html.twig" %}
- <div class='modal-header'>
- <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>
- <h4 class='modal-title'>{% if box_title %}{{ translate(box_title) }}{% endif %}</h4>
- </div>
- <div class='modal-body'>
- <div id="form-alerts"></div>
- {% block form_content %}
- {% include 'FormGenerator/FormGenerator.html.twig' %}
- {% endblock %}
- </div>
- <div class='modal-footer'>
- <div class="row">
- {% if "submit" not in buttons.hidden %}
- <div class="col-xs-8 col-sm-4">
- <div class="vert-pad">
- <button type="submit"
- class="btn btn-block btn-lg btn-success js-submit"{% if 'submit' in buttons.disabled %} disabled{% endif %}>
- {% if submit_button %}{{ translate(submit_button) }}{% else %}{{ translate("SUBMIT") }}{% endif %}
- </button>
- </div>
- </div>
- {% endif %}
- {% if "cancel" not in buttons.hidden %}
- <div class="col-xs-4 col-sm-3 pull-right">
- <div class="vert-pad">
- <button type="button" class="btn btn-block btn-lg btn-link"
- data-dismiss="modal"{% if 'cancel' in buttons.disabled %} disabled{% endif %}>
- {{ translate("CANCEL") }}
- </button>
- </div>
- </div>
- {% endif %}
- </div>
- </div>
- </form>
- </div>
- <!-- /.modal-content -->
- </div>
- <!-- /.modal-dialog -->
- </div>
-{% endblock %}
-
-{% block scripts_page %}
- <!-- Need to reload and reaply those since we're in modal -->
- <script>
- // Load the validator rules for this form
- var validators = {{ validators|default('{}')| raw }};
-
- $(function () {
- $('#{{ box_id }}').iCheck({
- checkboxClass: 'icheckbox_square-blue',
- radioClass: 'iradio_square-blue',
- increaseArea: '20%' // optional
- });
- $('#{{ box_id }}').find('.js-select2').select2({minimumResultsForSearch: Infinity, width: '100%'});
- });
- </script>
-{% endblock %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig
deleted file mode 100644
index 3e5c079..0000000
--- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig
+++ /dev/null
@@ -1,15 +0,0 @@
-{% extends "FormGenerator/modal.html.twig" %}
-
-{% block scripts_page %}
- {{ parent() }}
-
- <script>
- $("input[name='{{ typeaheadInput }}']").typeahead({
- source: function (query, process) {
- return $.getJSON('{{ typeaheadUrl }}', {input: query}, function (data) {
- return process(data);
- });
- }
- });
- </script>
-{% endblock %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/tests/Unit/FormGeneratorTest.php b/main/app/sprinkles/FormGenerator/tests/Unit/FormGeneratorTest.php
deleted file mode 100644
index d75f4f7..0000000
--- a/main/app/sprinkles/FormGenerator/tests/Unit/FormGeneratorTest.php
+++ /dev/null
@@ -1,402 +0,0 @@
-<?php
-/**
- * UF Form Generator
- *
- * @link https://github.com/lcharette/UF_FormGenerator
- * @copyright Copyright (c) 2017 Louis Charette
- * @license https://github.com/lcharette/UF_FormGenerator/blob/master/LICENSE (MIT License)
- */
-
-namespace UserFrosting\Tests\Unit;
-
-use UserFrosting\Tests\TestCase;
-use UserFrosting\Tests\DatabaseTransactions;
-use League\FactoryMuffin\Faker\Facade as Faker;
-use UserFrosting\Support\Repository\Loader\YamlFileLoader;
-use UserFrosting\Fortress\RequestSchema;
-use UserFrosting\Fortress\RequestSchema\RequestSchemaRepository;
-use UserFrosting\Fortress\RequestDataTransformer;
-use UserFrosting\Fortress\ServerSideValidator;
-use UserFrosting\Fortress\Adapter\JqueryValidationAdapter;
-use UserFrosting\Sprinkle\FormGenerator\Form;
-use UserFrosting\Sprinkle\FormGenerator\Element\InputInterface;
-
-
-/**
- * FormGeneratorTest
- * The FormGenerator unit tests.
- */
-class FormGeneratorTest extends TestCase
-{
- var $basePath;
-
- public function setUp() {
- parent::setUp();
- $this->basePath = __DIR__ . '/data';
- }
-
- /**
- * Test the base `Test` element class works on it's own
- */
- public function testTextFormElement() {
- // Get Schema
- $loader = new YamlFileLoader($this->basePath . '/good.json');
- $schema = new RequestSchemaRepository($loader->load());
-
- // Get TextInput from the `name` element of the schema
- $inputSchema = $schema["name"]["form"];
- $textInput = new \UserFrosting\Sprinkle\FormGenerator\Element\Text("name", $inputSchema);
-
- // Test instanceof $textInput
- $this->assertInstanceof(InputInterface::class, $textInput);
-
- // Parse the input
- $text = $textInput->parse();
-
- // Test the parsing
- $expected = [
- "type" => "text",
- "label" => "Project Name",
- "icon" => "fa-flag",
- "autocomplete" => "off",
- "class" => "form-control",
- "placeholder" => "Project Name",
- 'name' => 'name',
- 'id' => 'field_name',
- 'value' => ''
- ];
-
- // We test the generated result
- $this->assertEquals($expected, $text);
- }
-
- /**
- * This test make sure the `Text` element works correctly when a current
- * value is passed to the constructor. Should return the same as the
- * previous test, but with the `value` setup instead of empty
- */
- public function testTextFormElementWithData() {
- // Get Schema
- $loader = new YamlFileLoader($this->basePath . '/good.json');
- $schema = new RequestSchemaRepository($loader->load());
-
- // Get TextInput from the `name` element of the schema
- $inputSchema = $schema["name"]["form"];
- $textInput = new \UserFrosting\Sprinkle\FormGenerator\Element\Text("name", $inputSchema, "The Bar project");
-
- // Test instanceof $textInput
- $this->assertInstanceof(InputInterface::class, $textInput);
-
- // Parse the input
- $text = $textInput->parse();
-
- // Test the parsing
- $expected = [
- "type" => "text",
- "label" => "Project Name",
- "icon" => "fa-flag",
- "autocomplete" => "off",
- "class" => "form-control",
- "placeholder" => "Project Name",
- 'name' => 'name',
- 'id' => 'field_name',
- 'value' => 'The Bar project'
- ];
-
- // We test the generated result
- $this->assertEquals($expected, $text);
- }
-
- /**
- * This test is the same as the one before, but we test the `owener` field with some data
- * This make sure the `default` schema field will work correctly when empty data is passed
- */
- public function testTextFormElementWithEmptyData() {
- // Get Schema
- $loader = new YamlFileLoader($this->basePath . '/good.json');
- $schema = new RequestSchemaRepository($loader->load());
-
- // Get TextInput from the `name` element of the schema
- $inputSchema = $schema["owner"]["form"];
- $textInput = new \UserFrosting\Sprinkle\FormGenerator\Element\Text("owner", $inputSchema, "");
-
- // Test instanceof $textInput
- $this->assertInstanceof(InputInterface::class, $textInput);
-
- // Parse the input
- $text = $textInput->parse();
-
- // Test the parsing
- $expected = [
- 'label' => 'Project Owner',
- 'autocomplete' => 'off',
- 'class' => 'form-control',
- 'value' => '', //Shoudn't be a value here ! "" is overwritting "Foo"
- 'name' => 'owner',
- 'id' => 'owner',
- 'type' => 'text',
- 'icon' => 'fa-user',
- 'placeholder' => 'Project Owner',
- 'default' => 'Foo'
- ];
-
- // We test the generated result
- $this->assertEquals($expected, $text);
- }
-
- /**
- * Test the Form Class.
- * Run the test with no current values (empty form)
- */
- public function testForm() {
- // Get Schema
- $loader = new YamlFileLoader($this->basePath . '/good.json');
- $schema = new RequestSchemaRepository($loader->load());
-
- // Generate the form
- $form = new Form($schema);
-
- // Test to make sure the class creation is fine
- $this->assertInstanceof(Form::class, $form);
-
- // Test the form generation
- $generatedForm = $form->generate();
- $this->assertInternalType("array", $generatedForm);
-
- // Test one of the form input
- $expected = [
- 'number' => [
- 'label' => 'Project Number',
- 'autocomplete' => 'off',
- 'class' => 'form-control',
- 'value' => '',
- 'name' => 'number',
- 'id' => 'field_number',
- 'type' => 'number',
- 'icon' => 'fa-edit',
- 'placeholder' => 'Project Number'
- ],
- 'owner' => [
- 'label' => 'Project Owner',
- 'autocomplete' => 'off',
- 'class' => 'form-control',
- 'value' => 'Foo',
- 'name' => 'owner',
- 'id' => 'owner',
- 'type' => 'text',
- 'icon' => 'fa-user',
- 'placeholder' => 'Project Owner',
- 'default' => 'Foo'
- ],
- 'name' => [
- 'label' => 'Project Name',
- 'autocomplete' => 'off',
- 'class' => 'form-control',
- 'value' => '',
- 'name' => 'name',
- 'id' => 'field_name',
- 'type' => 'text',
- 'icon' => 'fa-flag',
- 'placeholder' => 'Project Name'
- ],
- 'description' => [
- 'label' => 'Project Description',
- 'autocomplete' => 'off',
- 'class' => 'form-control',
- 'value' => '',
- 'name' => 'description',
- 'rows' => 5,
- 'id' => 'field_description',
- 'type' => 'textarea',
- 'icon' => 'fa-pencil',
- 'placeholder' => 'Project Description'
- ],
- 'status' => [
- 'label' => 'Project Status',
- 'class' => 'form-control js-select2',
- 'value' => '',
- 'name' => 'status',
- 'id' => 'field_status',
- 'type' => 'select',
- 'options' => [
- 0 => 'Closed',
- 1 => 'Open'
- ]
- ],
- 'active' => [
- 'label' => 'Active',
- 'class' => 'js-icheck',
- 'name' => 'active',
- 'id' => 'field_active',
- 'type' => 'checkbox',
- 'binary' => TRUE
- ],
- 'hidden' => [
- 'value' => 'Something',
- 'name' => 'hidden',
- 'id' => 'field_hidden',
- 'type' => 'hidden'
- ],
- 'alert' => [
- 'class' => 'alert-success',
- 'icon' => 'fa-check',
- 'value' => 'You\'re awesome!',
- 'name' => 'alert',
- 'type' => 'alert'
- ]
- ];
-
- // We test the generated result
- $this->assertEquals($expected, $generatedForm);
- }
-
- /**
- * Test the Form Clas with values to make sure filled form works correctly
- */
- public function testFormWithData() {
- // Get Schema
- $loader = new YamlFileLoader($this->basePath . '/good.json');
- $schema = new RequestSchemaRepository($loader->load());
-
- // The data
- $data = [
- "name" => "Bar project",
- "owner" => "",
- "description" => "The bar project is less awesome, but at least it's open.",
- "status" => 1,
- "hiddenString" => "The Bar secret code is...",
- "completion" => 12,
- "active" => TRUE
- ];
-
- // Generate the form
- $form = new Form($schema, $data);
-
- // Test to make sure the class creation is fine
- $this->assertInstanceof(Form::class, $form);
-
- // Test the form generation
- $generatedForm = $form->generate();
- $this->assertInternalType("array", $generatedForm);
-
- // Test one of the form input
- $expected = [
- 'number' => [
- 'label' => 'Project Number',
- 'autocomplete' => 'off',
- 'class' => 'form-control',
- 'value' => '',
- 'name' => 'number',
- 'id' => 'field_number',
- 'type' => 'number',
- 'icon' => 'fa-edit',
- 'placeholder' => 'Project Number'
- ],
- 'name' => [
- 'label' => 'Project Name',
- 'autocomplete' => 'off',
- 'class' => 'form-control',
- 'value' => 'Bar project', //Value here !
- 'name' => 'name',
- 'id' => 'field_name',
- 'type' => 'text',
- 'icon' => 'fa-flag',
- 'placeholder' => 'Project Name'
- ],
- 'owner' => [
- 'label' => 'Project Owner',
- 'autocomplete' => 'off',
- 'class' => 'form-control',
- 'value' => '', //Shoudn't be a value here ! "" is overwritting "Foo"
- 'name' => 'owner',
- 'id' => 'owner',
- 'type' => 'text',
- 'icon' => 'fa-user',
- 'placeholder' => 'Project Owner',
- 'default' => 'Foo'
- ],
- 'description' => [
- 'label' => 'Project Description',
- 'autocomplete' => 'off',
- 'class' => 'form-control',
- 'value' => 'The bar project is less awesome, but at least it\'s open.', //Value here !
- 'name' => 'description',
- 'rows' => 5,
- 'id' => 'field_description',
- 'type' => 'textarea',
- 'icon' => 'fa-pencil',
- 'placeholder' => 'Project Description'
- ],
- 'status' => [
- 'label' => 'Project Status',
- 'class' => 'form-control js-select2',
- 'value' => 1, //Value here !
- 'name' => 'status',
- 'id' => 'field_status',
- 'type' => 'select',
- 'options' => [
- 0 => 'Closed',
- 1 => 'Open'
- ]
- ],
- 'active' => [
- 'label' => 'Active',
- 'class' => 'js-icheck',
- 'name' => 'active',
- 'id' => 'field_active',
- 'type' => 'checkbox',
- 'checked' => 'checked', //Value here !
- 'binary' => TRUE
- ],
- 'hidden' => [
- 'value' => 'Something',
- 'name' => 'hidden',
- 'id' => 'field_hidden',
- 'type' => 'hidden'
- ],
- 'alert' => [
- 'class' => 'alert-success',
- 'icon' => 'fa-check',
- 'value' => 'You\'re awesome!',
- 'name' => 'alert',
- 'type' => 'alert'
- ]
- ];
-
- // We test the generated result
- $this->assertEquals($expected, $generatedForm);
- }
-
- /**
- * Test a non existant input type. It's supposed to not find the class and
- * default back to the `Text` element class.
- */
- public function testUndefinedFormElement() {
- // Get Schema
- $loader = new YamlFileLoader($this->basePath . '/bad.json');
- $schema = new RequestSchemaRepository($loader->load());
-
- // Generate the form
- $form = new Form($schema);
-
- // Test to make sure the class creation is fine
- $this->assertInstanceof(Form::class, $form);
-
- // Test the form generation
- $generatedForm = $form->generate();
- $this->assertInternalType("array", $generatedForm);
-
- // Test one of the form input
- $expected = [
- "type" => "foo",
- "autocomplete" => "off",
- "class" => "form-control",
- 'name' => 'myField',
- 'id' => 'field_myField',
- 'value' => ''
- ];
-
- // We test the generated result
- $this->assertEquals($expected, $generatedForm['myField']);
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/tests/Unit/data/bad.json b/main/app/sprinkles/FormGenerator/tests/Unit/data/bad.json
deleted file mode 100644
index 50f1c00..0000000
--- a/main/app/sprinkles/FormGenerator/tests/Unit/data/bad.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "myField": {
- "form": {
- "type": "foo"
- }
- },
- "myOtherField": {
- "form": {
- "value": "Bar"
- }
- }
-}
diff --git a/main/app/sprinkles/FormGenerator/tests/Unit/data/good.json b/main/app/sprinkles/FormGenerator/tests/Unit/data/good.json
deleted file mode 100644
index 1592515..0000000
--- a/main/app/sprinkles/FormGenerator/tests/Unit/data/good.json
+++ /dev/null
@@ -1,67 +0,0 @@
-{
- "number": {
- "form": {
- "type": "number",
- "label": "Project Number",
- "icon": "fa-edit",
- "placeholder": "Project Number"
- }
- },
- "name": {
- "form": {
- "type": "text",
- "label": "Project Name",
- "icon": "fa-flag",
- "placeholder": "Project Name"
- }
- },
- "owner": {
- "form": {
- "type": "text",
- "label": "Project Owner",
- "icon": "fa-user",
- "id": "owner",
- "placeholder": "Project Owner",
- "default": "Foo"
- }
- },
- "description": {
- "form": {
- "type": "textarea",
- "label": "Project Description",
- "icon": "fa-pencil",
- "placeholder": "Project Description",
- "rows": 5
- }
- },
- "status": {
- "form": {
- "type": "select",
- "label": "Project Status",
- "options": {
- "0": "Closed",
- "1": "Open"
- }
- }
- },
- "active": {
- "form": {
- "type": "checkbox",
- "label": "Active"
- }
- },
- "hidden": {
- "form": {
- "type": "hidden",
- "value": "Something"
- }
- },
- "alert": {
- "form": {
- "type": "alert",
- "class": "alert-success",
- "icon": "fa-check",
- "value": "You're awesome!"
- }
- }
-}
diff --git a/main/app/sprinkles/account/assets/userfrosting/js/pages/forgot-password.js b/main/app/sprinkles/account/assets/userfrosting/js/pages/forgot-password.js
index 962bf4c..95247fc 100644
--- a/main/app/sprinkles/account/assets/userfrosting/js/pages/forgot-password.js
+++ b/main/app/sprinkles/account/assets/userfrosting/js/pages/forgot-password.js
@@ -8,7 +8,6 @@
*/
$(document).ready(function () {
- // TODO: Process form
$("#request-password-reset").ufForm({
validators: page.validators.forgot_password,
msgTarget: $("#alerts-page")
diff --git a/main/app/sprinkles/account/assets/userfrosting/js/pages/resend-verification.js b/main/app/sprinkles/account/assets/userfrosting/js/pages/resend-verification.js
index 3e9eea1..7da85fa 100644
--- a/main/app/sprinkles/account/assets/userfrosting/js/pages/resend-verification.js
+++ b/main/app/sprinkles/account/assets/userfrosting/js/pages/resend-verification.js
@@ -8,7 +8,6 @@
*/
$(document).ready(function () {
- // TODO: Process form
$("#request-verification-email").ufForm({
validators: page.validators.resend_verification,
msgTarget: $("#alerts-page")
diff --git a/main/app/sprinkles/account/assets/userfrosting/js/pages/set-or-reset-password.js b/main/app/sprinkles/account/assets/userfrosting/js/pages/set-or-reset-password.js
index 5e60bb1..62fbf4b 100644
--- a/main/app/sprinkles/account/assets/userfrosting/js/pages/set-or-reset-password.js
+++ b/main/app/sprinkles/account/assets/userfrosting/js/pages/set-or-reset-password.js
@@ -13,7 +13,6 @@ $(document).ready(function () {
msgTarget: $("#alerts-page")
}).on("submitSuccess.ufForm", function () {
// Forward to home page on success
- // TODO: forward to landing/last page
window.location.replace(site.uri.public + "/account/sign-in");
});
});
diff --git a/main/app/sprinkles/account/src/Authenticate/Authenticator.php b/main/app/sprinkles/account/src/Authenticate/Authenticator.php
index 8ee51b8..735a688 100644
--- a/main/app/sprinkles/account/src/Authenticate/Authenticator.php
+++ b/main/app/sprinkles/account/src/Authenticate/Authenticator.php
@@ -181,7 +181,7 @@ class Authenticator
* This method logs in the specified user, allowing the client to assume the user's identity for the duration of the session.
* @param User $user The user to log in.
* @param bool $rememberMe Set to true to make this a "persistent session", i.e. one that will re-login even after the session expires.
- * @todo Figure out a way to update the currentUser service to reflect the logged-in user *immediately* in the service provider.
+ * @odo Figure out a way to update the currentUser service to reflect the logged-in user *immediately* in the service provider.
* As it stands, the currentUser service will still reflect a "guest user" for the remainder of the request.
*/
public function login($user, $rememberMe = FALSE) {
diff --git a/main/app/sprinkles/account/src/Controller/AccountController.php b/main/app/sprinkles/account/src/Controller/AccountController.php
index 25961ec..7373923 100644
--- a/main/app/sprinkles/account/src/Controller/AccountController.php
+++ b/main/app/sprinkles/account/src/Controller/AccountController.php
@@ -65,7 +65,7 @@ class AccountController extends SimpleController
// Validate, and halt on validation errors.
$validator = new ServerSideValidator($schema, $this->ci->translator);
if (!$validator->validate($data)) {
- // TODO: encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
+ // O: encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
$e = new BadRequestException('Missing or malformed request data!');
foreach ($validator->errors() as $idx => $field) {
foreach ($field as $eidx => $error) {
@@ -163,8 +163,8 @@ class AccountController extends SimpleController
* This is because we need to allow users to re-request a reset, even if they lose the first reset email.
* This route is "public access".
* Request type: POST
- * @todo require additional user information
- * @todo prevent password reset requests for root account?
+ * @odo require additional user information
+ * @odo prevent password reset requests for root account?
*
* @param Request $request
* @param Response $response
@@ -244,8 +244,6 @@ class AccountController extends SimpleController
}
});
- // TODO: create delay to prevent timing-based attacks
-
$ms->addMessageTranslated('success', 'PASSWORD.FORGET.REQUEST_SENT', ['email' => $data['email']]);
return $response->withStatus(200);
}
@@ -1191,7 +1189,7 @@ class AccountController extends SimpleController
*
* This route is "public access".
* Request type: GET
- * @todo Can this route be abused for account enumeration? If so we should throttle it as well.
+ * @odo Can this route be abused for account enumeration? If so we should throttle it as well.
*
* @param Request $request
* @param Response $response
diff --git a/main/app/sprinkles/account/src/Database/Models/Group.php b/main/app/sprinkles/account/src/Database/Models/Group.php
index b904eb5..f0a1e1f 100644
--- a/main/app/sprinkles/account/src/Database/Models/Group.php
+++ b/main/app/sprinkles/account/src/Database/Models/Group.php
@@ -47,7 +47,7 @@ class Group extends Model
/**
* Delete this group from the database, along with any user associations
*
- * @todo What do we do with users when their group is deleted? Reassign them? Or, can a user be "groupless"?
+ * @odo What do we do with users when their group is deleted? Reassign them? Or, can a user be "groupless"?
*/
public function delete() {
// Delete the group
diff --git a/main/app/sprinkles/account/src/Database/Models/User.php b/main/app/sprinkles/account/src/Database/Models/User.php
index 6a7996a..b401db2 100644
--- a/main/app/sprinkles/account/src/Database/Models/User.php
+++ b/main/app/sprinkles/account/src/Database/Models/User.php
@@ -178,8 +178,6 @@ class User extends Model
$classMapper->staticMethod('password_reset', 'where', 'user_id', $this->id)->delete();
$classMapper->staticMethod('verification', 'where', 'user_id', $this->id)->delete();
- // TODO: remove any persistences
-
// Delete the user
$result = parent::forceDelete();
} else {
@@ -332,7 +330,7 @@ class User extends Model
*
* By default, adds a new sign-in activity and updates any legacy hash.
* @param mixed[] $params Optional array of parameters used for this event handler.
- * @todo Transition to Laravel Event dispatcher to handle this
+ * @odo Transition to Laravel Event dispatcher to handle this
*/
public function onLogin($params = []) {
// Add a sign in activity (time is automatically set by database)
@@ -369,7 +367,7 @@ class User extends Model
*
* By default, adds a new sign-out activity.
* @param mixed[] $params Optional array of parameters used for this event handler.
- * @todo Transition to Laravel Event dispatcher to handle this
+ * @do Transition to Laravel Event dispatcher to handle this
*/
public function onLogout($params = []) {
static::$ci->userActivityLogger->info("User {$this->user_name} signed out.", [
diff --git a/main/app/sprinkles/account/src/Repository/PasswordResetRepository.php b/main/app/sprinkles/account/src/Repository/PasswordResetRepository.php
index e21b5d6..21ff548 100644
--- a/main/app/sprinkles/account/src/Repository/PasswordResetRepository.php
+++ b/main/app/sprinkles/account/src/Repository/PasswordResetRepository.php
@@ -28,7 +28,7 @@ class PasswordResetRepository extends TokenRepository
*/
protected function updateUser($user, $args) {
$user->password = Password::hash($args['password']);
- // TODO: generate user activity? or do this in controller?
+ // DO: generate user activity? or do this in controller?
$user->save();
}
}
diff --git a/main/app/sprinkles/account/src/Repository/VerificationRepository.php b/main/app/sprinkles/account/src/Repository/VerificationRepository.php
index 405efc5..d714dce 100644
--- a/main/app/sprinkles/account/src/Repository/VerificationRepository.php
+++ b/main/app/sprinkles/account/src/Repository/VerificationRepository.php
@@ -26,7 +26,6 @@ class VerificationRepository extends TokenRepository
*/
protected function updateUser($user, $args) {
$user->flag_verified = 1;
- // TODO: generate user activity? or do this in controller?
$user->save();
}
}
diff --git a/main/app/sprinkles/account/src/ServicesProvider/ServicesProvider.php b/main/app/sprinkles/account/src/ServicesProvider/ServicesProvider.php
index 5c1bf20..38d81d5 100644
--- a/main/app/sprinkles/account/src/ServicesProvider/ServicesProvider.php
+++ b/main/app/sprinkles/account/src/ServicesProvider/ServicesProvider.php
@@ -346,7 +346,7 @@ class ServicesProvider
/**
* This method is invoked when a user attempts to perform certain public actions when they are already logged in.
*
- * @todo Forward to user's landing page or last visited page
+ * Forward to user's landing page or last visited page
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ResponseInterface $response
* @param array $args
diff --git a/main/app/sprinkles/admin/assets/userfrosting/js/widgets/users.js b/main/app/sprinkles/admin/assets/userfrosting/js/widgets/users.js
index 952b241..7951807 100644
--- a/main/app/sprinkles/admin/assets/userfrosting/js/widgets/users.js
+++ b/main/app/sprinkles/admin/assets/userfrosting/js/widgets/users.js
@@ -107,7 +107,7 @@ function updateUser(userName, fieldName, fieldValue) {
console.log("Error (" + jqXHR.status + "): " + jqXHR.responseText);
// Display errors on failure
- // TODO: ufAlerts widget should have a 'destroy' method
+ // ufAlerts widget should have a 'destroy' method
if (!$("#alerts-page").data('ufAlerts')) {
$("#alerts-page").ufAlerts();
} else {
diff --git a/main/app/sprinkles/admin/routes/posts.php b/main/app/sprinkles/admin/routes/posts.php
index fa2ee4a..ac523b2 100644
--- a/main/app/sprinkles/admin/routes/posts.php
+++ b/main/app/sprinkles/admin/routes/posts.php
@@ -9,7 +9,9 @@
/**
* Routes for posting.
*/
-$app->get('/image/{PostID}', 'UserFrosting\Sprinkle\Admin\Controller\PostController:showImage')->add('authGuard');
+$app->get('/feed/{user_name}', 'UserFrosting\Sprinkle\Admin\Controller\PostController:getFeed')->add('authGuard');
+
+$app->get('/image/{post_id}', 'UserFrosting\Sprinkle\Admin\Controller\PostController:showImage')->add('authGuard');
$app->group('/api/posts', function () {
$this->post('/image', 'UserFrosting\Sprinkle\Admin\Controller\PostController:postImage');
diff --git a/main/app/sprinkles/admin/routes/users.php b/main/app/sprinkles/admin/routes/users.php
index ddc1353..6bace28 100644
--- a/main/app/sprinkles/admin/routes/users.php
+++ b/main/app/sprinkles/admin/routes/users.php
@@ -25,8 +25,6 @@ $app->group('/api/users', function () {
$this->get('/u/{user_name}/activities', 'UserFrosting\Sprinkle\Admin\Controller\UserController:getActivities');
- $this->get('/u/{user_name}/posts', 'UserFrosting\Sprinkle\Admin\Controller\UserController:getActivities');
-
$this->get('/u/{user_name}/roles', 'UserFrosting\Sprinkle\Admin\Controller\UserController:getRoles');
$this->get('/u/{user_name}/permissions', 'UserFrosting\Sprinkle\Admin\Controller\UserController:getPermissions');
diff --git a/main/app/sprinkles/admin/src/Controller/GroupController.php b/main/app/sprinkles/admin/src/Controller/GroupController.php
index 2077363..720f12d 100644
--- a/main/app/sprinkles/admin/src/Controller/GroupController.php
+++ b/main/app/sprinkles/admin/src/Controller/GroupController.php
@@ -692,7 +692,6 @@ class GroupController extends SimpleController
// Validate, and throw exception on validation errors.
$validator = new ServerSideValidator($schema, $this->ci->translator);
if (!$validator->validate($data)) {
- // TODO: encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
$e = new BadRequestException();
foreach ($validator->errors() as $idx => $field) {
foreach ($field as $eidx => $error) {
diff --git a/main/app/sprinkles/admin/src/Controller/PostController.php b/main/app/sprinkles/admin/src/Controller/PostController.php
index 98bee5a..18efff9 100644
--- a/main/app/sprinkles/admin/src/Controller/PostController.php
+++ b/main/app/sprinkles/admin/src/Controller/PostController.php
@@ -29,6 +29,48 @@ use Illuminate\Database\Capsule\Manager as DB;
class PostController extends SimpleController
{
+ /**
+ * Gets the feed of the requested user (for non-administrators only own feed allowed)
+ *
+ * @param Request $request
+ * @param Response $response
+ * @param $args
+ * @throws BadRequestException
+ * @throws NotFoundException
+ */
+ public function getFeed(Request $request, Response $response, $args) {
+ $user = $this->getUserFromParams($args);
+
+ // If the user doesn't exist, return 404
+ if (!$user) {
+ throw new NotFoundException($request, $response);
+ }
+
+ // Get friends first
+ $UsersFriends = DB::select("SELECT id FROM (SELECT user_id AS id FROM user_follow WHERE followed_by_id = $user->id UNION ALL SELECT followed_by_id FROM user_follow WHERE user_id = $user->id) t GROUP BY id HAVING COUNT(id) > 1");
+ /** @var UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
+ $classMapper = $this->ci->classMapper;
+ foreach ($UsersFriends as $Key => $UsersFriendId) { // NOT THAT EFFICIENT...
+ $UsersFriendInformation = $classMapper->createInstance('user')// raw select doesnt work with instance
+ ->where('id', $UsersFriendId->id)
+ ->get();
+
+ $ImagesFromFriends[] = DB::table('image_posts')
+ ->where('UserID', '=', $UsersFriendInformation[0]->id)
+ ->value('File');
+ }
+ }
+
+ /**
+ * Shows the requested image
+ *
+ * @param Request $request
+ * @param Response $response
+ * @param $args
+ * @return Response
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ */
public function showImage(Request $request, Response $response, $args) {
// check if user is authorized
$authorizer = $this->ci->authorizer;
@@ -36,7 +78,7 @@ class PostController extends SimpleController
if (!$authorizer->checkAccess($currentUser, 'view_image')) {
throw new ForbiddenException();
}
- $postID = $args['PostID'];
+ $postID = $args['post_id'];
// get filename from database
$FileRequestedImage = DB::table('image_posts')
@@ -54,6 +96,14 @@ class PostController extends SimpleController
}
}
+ /**
+ * posts a image
+ *
+ * @param Request $request
+ * @param Response $response
+ * @return Response
+ * @throws ForbiddenException
+ */
public function postImage(Request $request, Response $response) {
// check if user is authorized
$authorizer = $this->ci->authorizer;
@@ -82,10 +132,15 @@ class PostController extends SimpleController
DB::table('image_posts')
->insert(['UserID' => $currentUser->id, 'File' => $filename]);
- $response->write('Uploaded successfully! <br/>');
+ return $response->write('Uploaded successfully! <br/>');
}
}
+ /**
+ * @param $params
+ * @return mixed
+ * @throws BadRequestException
+ */
protected function getUserFromParams($params) {
// Load the request schema
$schema = new RequestSchema('schema://requests/user/get-by-username.yaml');
@@ -97,7 +152,6 @@ class PostController extends SimpleController
// Validate, and throw exception on validation errors.
$validator = new ServerSideValidator($schema, $this->ci->translator);
if (!$validator->validate($data)) {
- // TODO: encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
$e = new BadRequestException();
foreach ($validator->errors() as $idx => $field) {
foreach ($field as $eidx => $error) {
diff --git a/main/app/sprinkles/admin/src/Controller/RoleController.php b/main/app/sprinkles/admin/src/Controller/RoleController.php
index e4ebd98..80ac6a0 100644
--- a/main/app/sprinkles/admin/src/Controller/RoleController.php
+++ b/main/app/sprinkles/admin/src/Controller/RoleController.php
@@ -836,7 +836,6 @@ class RoleController extends SimpleController
// Validate, and throw exception on validation errors.
$validator = new ServerSideValidator($schema, $this->ci->translator);
if (!$validator->validate($data)) {
- // TODO: encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
$e = new BadRequestException();
foreach ($validator->errors() as $idx => $field) {
foreach ($field as $eidx => $error) {
@@ -894,7 +893,7 @@ class RoleController extends SimpleController
// Validate, and throw exception on validation errors.
$validator = new ServerSideValidator($schema, $this->ci->translator);
if (!$validator->validate($data)) {
- // TODO: encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
+ // encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
$e = new BadRequestException();
foreach ($validator->errors() as $idx => $field) {
foreach ($field as $eidx => $error) {
diff --git a/main/app/sprinkles/admin/src/Controller/UserController.php b/main/app/sprinkles/admin/src/Controller/UserController.php
index 3621fbc..52e4d1a 100644
--- a/main/app/sprinkles/admin/src/Controller/UserController.php
+++ b/main/app/sprinkles/admin/src/Controller/UserController.php
@@ -46,6 +46,9 @@ class UserController extends SimpleController
* This route requires authentication.
* Request type: POST
* @see getModalCreate
+ * @throws ForbiddenException
+ * @throws BadRequestException
+ * @throws ForbiddenException
*/
public function create($request, $response, $args) {
// Get POST parameters: user_name, first_name, last_name, email, locale, (group)
@@ -176,6 +179,9 @@ class UserController extends SimpleController
* 4. The submitted data is valid.
* This route requires authentication.
* Request type: POST
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function createPasswordReset($request, $response, $args) {
// Get the username from the URL
@@ -235,6 +241,9 @@ class UserController extends SimpleController
/**
* Sets the users public key
* Request type: POST
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function setPublicKey($request, $response, $args) {
$requestedUser = $this->getUserFromParams($args);
@@ -270,6 +279,10 @@ class UserController extends SimpleController
* 2. You have permission to delete the target user's account.
* This route requires authentication (and should generally be limited to admins or the root user).
* Request type: DELETE
+ * @throws BadRequestException
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function delete($request, $response, $args) {
$user = $this->getUserFromParams($args);
@@ -332,6 +345,9 @@ class UserController extends SimpleController
*
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getActivities($request, $response, $args) {
$user = $this->getUserFromParams($args);
@@ -377,6 +393,9 @@ class UserController extends SimpleController
*
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getInfo($request, $response, $args) {
$user = $this->getUserFromParams($args);
@@ -423,6 +442,7 @@ class UserController extends SimpleController
* Generates a list of users, optionally paginated, sorted and/or filtered.
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
*/
public function getList($request, $response, $args) {
// GET parameters
@@ -455,6 +475,10 @@ class UserController extends SimpleController
* This does NOT render a complete page. Instead, it renders the HTML for the modal, which can be embedded in other pages.
* This page requires authentication.
* Request type: GET
+ * @throws BadRequestException
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getModalConfirmDelete($request, $response, $args) {
// GET parameters
@@ -507,6 +531,7 @@ class UserController extends SimpleController
* Otherwise, the user will be added to the default group and receive the default roles automatically.
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
*/
public function getModalCreate($request, $response, $args) {
// GET parameters
@@ -533,7 +558,6 @@ class UserController extends SimpleController
$config = $this->ci->config;
// Determine form fields to hide/disable
- // TODO: come back to this when we finish implementing theming
$fields = [
'hidden' => ['theme'],
'disabled' => []
@@ -590,6 +614,9 @@ class UserController extends SimpleController
* This does NOT render a complete page. Instead, it renders the HTML for the modal, which can be embedded in other pages.
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getModalEdit($request, $response, $args) {
// GET parameters
@@ -676,6 +703,9 @@ class UserController extends SimpleController
* This does NOT render a complete page. Instead, it renders the HTML for the form, which can be embedded in other pages.
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getModalEditPassword($request, $response, $args) {
// GET parameters
@@ -720,6 +750,9 @@ class UserController extends SimpleController
* This does NOT render a complete page. Instead, it renders the HTML for the form, which can be embedded in other pages.
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getModalEditRoles($request, $response, $args) {
// GET parameters
@@ -757,6 +790,9 @@ class UserController extends SimpleController
* Generates a list of permissions, optionally paginated, sorted and/or filtered.
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getPermissions($request, $response, $args) {
$user = $this->getUserFromParams($args);
@@ -801,6 +837,9 @@ class UserController extends SimpleController
*
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getRoles($request, $response, $args) {
$user = $this->getUserFromParams($args);
@@ -848,6 +887,8 @@ class UserController extends SimpleController
* This will also try to show buttons for activating, disabling/enabling, deleting, and editing the user.
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
+ * @throws BadRequestException
*/
public function pageInfo($request, $response, $args) {
$user = $this->getUserFromParams($args);
@@ -977,6 +1018,7 @@ class UserController extends SimpleController
* Actions typically include: edit user details, activate user, enable/disable user, delete user.
* This page requires authentication.
* Request type: GET
+ * @throws ForbiddenException
*/
public function pageList($request, $response, $args) {
/** @var UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -996,6 +1038,8 @@ class UserController extends SimpleController
/**
* Gets the users public key
* Request type: GET
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getPublicKey($request, $response, $args) {
$requestedUser = $this->getUserFromParams($args);
@@ -1026,13 +1070,16 @@ class UserController extends SimpleController
}
return $response->withStatus(200);
} else {
- throw new NotFoundException();
+ throw new NotFoundException($request, $response);
}
}
/**
* Gets the users which are following the requested user
* Request type: GET
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getFollowers($request, $response, $args) {
$user = $this->getUserFromParams($args);
@@ -1069,6 +1116,9 @@ class UserController extends SimpleController
/**
* Get users which the user follows
* Request type: GET
+ * @throws ForbiddenException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function getFollows($request, $response, $args) {
$user = $this->getUserFromParams($args);
@@ -1085,9 +1135,9 @@ class UserController extends SimpleController
$currentUser = $this->ci->currentUser;
// Access-controlled page
- if (!$authorizer->checkAccess($currentUser, 'uri_user', [
- 'user' => $user
- ])) {
+ if (($user->id == $currentUser->id) || (!$authorizer->checkAccess($currentUser, 'uri_user', [
+ 'user' => $user
+ ]))) {
throw new ForbiddenException();
}
@@ -1105,6 +1155,9 @@ class UserController extends SimpleController
/**
* Get users which the user follows and which are following the user
* Request type: GET
+ * @throws NotFoundException
+ * @throws ForbiddenException
+ * @throws BadRequestException
*/
public function getFriends($request, $response, $args) {
$user = $this->getUserFromParams($args);
@@ -1133,7 +1186,7 @@ class UserController extends SimpleController
$classMapper = $this->ci->classMapper;
foreach ($UsersFriends as $Key => $UsersFriendId) { // NOT THAT EFFICIENT...
- $UsersFriendInformation = $classMapper->createInstance('user')// select doesnt work with instance
+ $UsersFriendInformation = $classMapper->createInstance('user')// raw select doesnt work with instance
->where('id', $UsersFriendId->id)
->get();
@@ -1145,7 +1198,11 @@ class UserController extends SimpleController
$result = $UsersFriends;
- return $response->withJson($result, 200, JSON_PRETTY_PRINT);
+ if (sizeof($result) > 0) { // USER HAS FRIENDS
+ return $response->withJson($result, 200, JSON_PRETTY_PRINT);
+ } else {
+ throw new NotFoundException($request, $response);
+ }
}
@@ -1158,6 +1215,10 @@ class UserController extends SimpleController
* 3. The submitted data is valid.
* This route requires authentication.
* Request type: PUT
+ * @throws NotFoundException
+ * @throws ForbiddenException
+ * @throws BadRequestException
+ * @throws BadRequestException
*/
public function updateInfo($request, $response, $args) {
// Get the username from the URL
@@ -1277,6 +1338,14 @@ class UserController extends SimpleController
* 3. The submitted data is valid.
* This route requires authentication.
* Request type: PUT
+ * @throws ForbiddenException
+ * @throws BadRequestException
+ * @throws BadRequestException
+ * @throws BadRequestException
+ * @throws BadRequestException
+ * @throws BadRequestException
+ * @throws NotFoundException
+ * @throws BadRequestException
*/
public function updateField($request, $response, $args) {
// Get the username from the URL
@@ -1336,7 +1405,7 @@ class UserController extends SimpleController
// Validate, and throw exception on validation errors.
$validator = new ServerSideValidator($schema, $this->ci->translator);
if (!$validator->validate($data)) {
- // TODO: encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
+ // encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
$e = new BadRequestException();
foreach ($validator->errors() as $idx => $field) {
foreach ($field as $eidx => $error) {
@@ -1426,7 +1495,6 @@ class UserController extends SimpleController
// Validate, and throw exception on validation errors.
$validator = new ServerSideValidator($schema, $this->ci->translator);
if (!$validator->validate($data)) {
- // TODO: encapsulate the communication of error messages from ServerSideValidator to the BadRequestException
$e = new BadRequestException();
foreach ($validator->errors() as $idx => $field) {
foreach ($field as $eidx => $error) {
diff --git a/main/app/sprinkles/core/asset-bundles.json b/main/app/sprinkles/core/asset-bundles.json
index e3dbdc1..ef8e244 100644
--- a/main/app/sprinkles/core/asset-bundles.json
+++ b/main/app/sprinkles/core/asset-bundles.json
@@ -51,7 +51,6 @@
"SiteAssets/js/encryption.js",
"SiteAssets/js/swiper.js",
"SiteAssets/js/console.image.js",
- "SiteAssets/js/imageCaching.js",
"SiteAssets/js/popups.js",
"SiteAssets/js/push.js",
"SiteAssets/js/chat.js",
diff --git a/main/app/sprinkles/core/assets/SiteAssets/js/chat.js b/main/app/sprinkles/core/assets/SiteAssets/js/chat.js
index d54cbe6..484102d 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/js/chat.js
+++ b/main/app/sprinkles/core/assets/SiteAssets/js/chat.js
@@ -250,11 +250,13 @@ function InitializeChatServer() {
ChatTextInput.keyup(function (e) {
if (ChatSocket.readyState === 1) {
if (e.keyCode === 13 && ChatTextInput.val().length > 0) {
+ const ChatTextInputText = ChatTextInput.val();
+ ChatTextInput.val("");
var LastMessage = $(".MessageWrapper.Normal:last .ChatMessage");
if (!LastMessage.hasClass("MessageSent")) { // CHECK IF PREVIOUS MESSAGE WAS FROM HIMSELF TOO -> IF NOT, CREATE NEW 'ALONE' MESSAGE
- ChatMessages.append("<div class='MessageWrapper Normal'><div class='ChatMessage MessageSent AloneMessage animated fadeInRight'>" + ChatTextInput.val() + "</div></div>");
+ ChatMessages.append("<div class='MessageWrapper Normal'><div class='ChatMessage MessageSent AloneMessage animated fadeInRight'>" + ChatTextInputText + "</div></div>");
} else if (LastMessage.hasClass("MessageSent")) { // IF PREVIOUS MESSAGE WAS FROM HIMSELF TOO -> CREATE WITH CORRESPONDING CLASSES FOR DESIGN
- ChatMessages.append("<div class='MessageWrapper Normal'><div class='ChatMessage MessageSent BottomMessage animated fadeInRight'>" + ChatTextInput.val() + "</div></div>");
+ ChatMessages.append("<div class='MessageWrapper Normal'><div class='ChatMessage MessageSent BottomMessage animated fadeInRight'>" + ChatTextInputText + "</div></div>");
if (LastMessage.hasClass("AloneMessage")) {
LastMessage.removeClass("AloneMessage");
LastMessage.addClass("TopMessage");
@@ -271,7 +273,7 @@ function InitializeChatServer() {
// ENCRYPT AND SEND MESSAGE WITH OWN PUBLIC KEY
options = {
- data: ChatTextInput.val(),
+ data: ChatTextInputText,
publicKeys: openpgp.key.readArmored(PublicKey[current_username]).keys,
privateKeys: [privKeyObj] // FOR SIGNING
};
@@ -284,13 +286,11 @@ function InitializeChatServer() {
EncryptedWithKeyOfUsername: current_username,
Message: EncryptedMessage
}));
- ChatTextInput.val("");
- ChatTextInput.val("");
});
// ENCRYPT AND SEND MESSAGE WITH RECEIVERS PUBLIC KEY
options = {
- data: ChatTextInput.val(),
+ data: ChatTextInputText,
publicKeys: openpgp.key.readArmored(PublicKey[ReceiversUsername]).keys,
privateKeys: [privKeyObj] // FOR SIGNING
};
@@ -303,8 +303,6 @@ function InitializeChatServer() {
EncryptedWithKeyOfUsername: ReceiversUsername,
Message: EncryptedMessage
}));
- ChatTextInput.val("");
- ChatTextInput.val("");
});
}
} else {
diff --git a/main/app/sprinkles/core/assets/SiteAssets/js/imageCaching.js b/main/app/sprinkles/core/assets/SiteAssets/js/imageCaching.js
deleted file mode 100644
index ee11c70..0000000
--- a/main/app/sprinkles/core/assets/SiteAssets/js/imageCaching.js
+++ /dev/null
@@ -1,132 +0,0 @@
-;(function ($) {
- function jQueryImageCaching(params) {
- var ImageCaching = {
- selector: 'img',
- debugMode: false,
- cachingKeyAttribute: 'data-caching-key',
- sourceKeyAttribute: 'data-src',
- renderCallback: null,
- crossOrigin: 'Anonymous',
- init: function (params) {
- ImageCaching.log('Initialization of ImageCaching');
- for (var param in params) {
- ImageCaching[param] = params[param];
- console.log("%c[CACHE LOGGER] Image caching initialized for " + params[param]['selector'] + "!", "color: brown;");
- }
-
- $(ImageCaching.selector).each(function () {
- ImageCaching.applyToImage($(this));
- });
- },
- getCookie(cookie) {
- var value = "; " + document.cookie;
- var parts = value.split("; " + cookie + "=");
- if (parts.length === 2) return parts.pop().split(";").shift();
- },
- getCacheKey: function (element) {
- if (element.attr(ImageCaching.cachingKeyAttribute)) {
- return element.attr(ImageCaching.cachingKeyAttribute);
- } else {
- return element.attr(ImageCaching.sourceKeyAttribute);
- }
- },
- getCache: function (element) {
- var key = this.getCacheKey(element);
- return this.getCookie(key);
- },
- setCache: function (element, imageData) {
- var key = ImageCaching.getCacheKey(element);
- ImageCaching.log('Set cache', key, imageData, element);
- document.cookie = key + "=" + encodeURIComponent(imageData) + "; expires=Mon, 18 Dec 2102 04:48:00 CEST; path=/"; // save image data
- return true;
- },
- removeCache: function (element) {
- var key = ImageCaching.getCacheKey(element);
- ImageCaching.log('Remove cache', key);
- document.cookie = key + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"; // delete image data
- return true;
- },
- renderImage: function (element, picture) {
- ImageCaching.log('Rendering...', picture, element);
- element.attr('src', picture);
-
- if (this.renderCallback) {
- ImageCaching.log('Render Callback...', element);
- this.renderCallback(picture, element);
- }
- },
- applyToImage: function (element, force) {
- var cache = null;
- if (!force) {
- cache = this.getCache(element);
- }
-
- if (cache) {
- ImageCaching.log('Image from cache', element);
- this.renderImage(element, cache);
- } else {
- var sourceLink = element.attr(ImageCaching.sourceKeyAttribute);
- var getParamPrefix = "?";
- if (sourceLink.indexOf('?') > 0) {
- getParamPrefix = "&";
- }
- sourceLink += getParamPrefix + 'cacheTime=' + Date.now();
-
- ImageCaching.log('Request to: ' + sourceLink, element);
-
- var img = new Image();
-
- if (ImageCaching.crossOrigin) {
- img.setAttribute('crossOrigin', 'Anonymous');
- }
-
- img.onload = function () {
- ImageCaching.log('Loading completed', img);
- var canvas = document.createElement('canvas');
- canvas.width = img.width;
- canvas.height = img.height;
-
- // Copy the image contents to the canvas
- var ctx = canvas.getContext("2d");
- ctx.drawImage(img, 0, 0);
-
- var imageData = canvas.toDataURL("image/png");
- ImageCaching.setCache(element, imageData);
- ImageCaching.renderImage(element, imageData);
- };
- img.src = sourceLink;
- }
- },
- refresh: function (itemsSelector) {
- var selector = null;
- if (itemsSelector) {
- selector = itemsSelector;
- } else {
- selector = ImageCaching.selector;
- }
-
- $(selector).each(function () {
- ImageCaching.applyToImage($(this), true);
- });
-
- },
- log: function () {
- if (this.debugMode) {
- console.log(arguments);
- }
- }
-
- };
- ImageCaching.init(params);
- return ImageCaching;
- }
-
- $.fn.extend({
- imageCaching: function (options) {
- var params = {selector: this};
- params = $.extend(params, options);
-
- return new jQueryImageCaching(params);
- }
- });
-})(jQuery); \ No newline at end of file
diff --git a/main/app/sprinkles/core/assets/SiteAssets/js/main.js b/main/app/sprinkles/core/assets/SiteAssets/js/main.js
index 33716b5..0a991fc 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/js/main.js
+++ b/main/app/sprinkles/core/assets/SiteAssets/js/main.js
@@ -38,62 +38,6 @@ function triggerErrorPopup(ErrorCode) {
}
/**
- * ENCRYPTION
- */
-/*var openpgp = window.openpgp;
-var options, EncryptedText, DecryptedText, PrivateKey, PassPhrase, PrivateKeyObj;
-var PublicKey = [];
-openpgp.initWorker({path: '/assets-raw/core/assets/SiteAssets/js/openpgp.worker.js'});
-
-$.ajax({
- type: 'GET',
- url: site.uri.public + '/api/users/u/' + current_username + '/publickey',
- dataType : "json",
- success: function (response) {
- if (response.user_id === current_user_id) {
- PublicKey[current_username] = response.PublicKey;
- PrivateKey = localStorage.getItem("PrivateKey");
- PassPhrase = localStorage.getItem("🔒")
- }
- }
-});
-
-function EncryptMessage(Message, Username) {
- if (!Username in PublicKey) {
- $.ajax({
- type: 'GET',
- url: site.uri.public + '/api/users/u/' + Username + '/publickey',
- dataType : "json",
- success: function (response) {
- if (response.user_id === current_user_id) {
- PublicKey[Username] = response.PublicKey;
- }
- }
- });
- }
- options = {
- data: Message,
- publicKeys: openpgp.key.readArmored(PublicKey[Username]).keys
- };
- openpgp.encrypt(options).then(function (EncryptedText) {
- EncryptedText = EncryptedText.data;
- });
-}
-
-function DecryptMessage(EncryptedText) {
- PrivateKeyObj = openpgp.key.readArmored(PrivateKey).keys[0];
- PrivateKeyObj.decrypt(PassPhrase);
- options = {
- message: openpgp.message.readArmored(EncryptedText),
- privateKeys: [PrivateKeyObj]
- };
-
- openpgp.decrypt(options).then(function (DecryptedText) {
- DecryptedText = DecryptedText.data;
- });
-}*/
-
-/**
* OLD BROWSER
* @type {boolean}
*/
@@ -150,10 +94,6 @@ MainTabWindows.on('beforeChange', function (event, slick, currentSlide, nextSlid
currentSlide.children().attr("src", (currentSlide.children().attr("src").split('.svg')[0].replace('Activated', '') + ".svg"));
nextSlide.children().attr("src", nextSlide.children().attr("src").split('.svg')[0] + "Activated.svg");
- //currentSlide.children().attr("data-src", (currentSlide.children().attr("data-src").split('.svg')[0].replace('Activated', '') + ".svg"));
- //nextSlide.children().attr("data-caching-key", nextSlide.children().attr("data-src").split('.svg')[0].split('/').pop() + "Activated_nav_cached");
- //nextSlide.children().attr("data-src", nextSlide.children().attr("data-src").split('.svg')[0] + "Activated.svg");
- //cachedNavbarIcons.refresh();
$el = nextSlide;
$el.addClass("ActiveTab");
leftPos = $el.position().left;
@@ -179,10 +119,7 @@ UserSearchBar.keyup(function () {
//var RandomGifUrl = GifUrls[RandomGif];
//console.image(RandomGifUrl, 0.5);
- alerts.ufAlerts().ufAlerts('fetch');
-
SearchResults.append("<img class='Avatar' src='" + answer.avatar + "'/><div class='UsersFullName'>" + answer.full_name + "</div>");
- //$(".SearchResults .Avatar").imageCaching(); // refresh
},
error: function () {
console.log("%c[SEARCH LOGGER] User " + RequestedUser + " was not found!", "color: red");
@@ -206,7 +143,7 @@ $(document).ready(function () {
})
},
error: function () {
- console.log("%c[SEARCH LOGGER] User " + RequestedUser + " was not found!", "color: red");
+ console.log("%c[FRIENDLY LOGGER] No friends were found! :(", "color: red");
alerts.ufAlerts().ufAlerts('fetch');
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/js/popups.js b/main/app/sprinkles/core/assets/SiteAssets/js/popups.js
index 00851d6..7980509 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/js/popups.js
+++ b/main/app/sprinkles/core/assets/SiteAssets/js/popups.js
@@ -1625,7 +1625,7 @@
return new Promise(function (resolve, reject) {
// functions to handle all resolving/rejecting/settling
var succeedWith = function succeedWith(value) {
- constructor.closePopup(innerParams.onClose, innerParams.onAfterClose); // TODO: make closePopup an *instance* method
+ constructor.closePopup(innerParams.onClose, innerParams.onAfterClose); // O: make closePopup an *instance* method
if (innerParams.useRejections) {
resolve(value);
} else {
@@ -1682,7 +1682,7 @@
var confirm = function confirm(value) {
if (innerParams.showLoaderOnConfirm) {
- constructor.showLoading(); // TODO: make showLoading an *instance* method
+ constructor.showLoading(); // make showLoading an *instance* method
}
if (innerParams.preConfirm) {
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/AbstractConnectionDecorator.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/AbstractConnectionDecorator.php
index ddb7c7b..df7580d 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/AbstractConnectionDecorator.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/AbstractConnectionDecorator.php
@@ -5,7 +5,7 @@ namespace Ratchet;
/**
* Wraps ConnectionInterface objects via the decorator pattern but allows
* parameters to bubble through with magic methods
- * @todo It sure would be nice if I could make most of this a trait...
+ * It sure would be nice if I could make most of this a trait...
*/
abstract class AbstractConnectionDecorator implements ConnectionInterface
{
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/WebSocket/WsServerInterface.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/WebSocket/WsServerInterface.php
index f83b273..2f42a11 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/WebSocket/WsServerInterface.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/src/Ratchet/WebSocket/WsServerInterface.php
@@ -10,7 +10,7 @@ interface WsServerInterface
/**
* If any component in a stack supports a WebSocket sub-protocol return each supported in an array
* @return array
- * @todo This method may be removed in future version (note that will not break code, just make some code obsolete)
+ * @odo This method may be removed in future version (note that will not break code, just make some code obsolete)
*/
function getSubProtocols();
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/tests/unit/Wamp/WampServerTest.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/tests/unit/Wamp/WampServerTest.php
index 0f427fe..7f877ff 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/tests/unit/Wamp/WampServerTest.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/cboden/ratchet/tests/unit/Wamp/WampServerTest.php
@@ -36,7 +36,6 @@ class WampServerTest extends AbstractMessageComponentTestCase
}
public function testGetSubProtocols() {
- // todo: could expand on this
$this->assertInternalType('array', $this->_serv->getSubProtocols());
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/guzzlehttp/psr7/src/BufferStream.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/guzzlehttp/psr7/src/BufferStream.php
index ab21e27..2a73f25 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/guzzlehttp/psr7/src/BufferStream.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/guzzlehttp/psr7/src/BufferStream.php
@@ -104,7 +104,7 @@ class BufferStream implements StreamInterface
public function write($string) {
$this->buffer .= $string;
- // TODO: What should happen here?
+ // What should happen here?
if (strlen($this->buffer) >= $this->hwm) {
return FALSE;
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Factory/Worker/EnsureFilterWorker.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Factory/Worker/EnsureFilterWorker.php
index 680a16c..45cdc32 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Factory/Worker/EnsureFilterWorker.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Factory/Worker/EnsureFilterWorker.php
@@ -19,7 +19,7 @@ use Assetic\Filter\FilterInterface;
* Applies a filter to an asset based on a source and/or target path match.
*
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
- * @todo A better asset-matcher mechanism
+ * A better asset-matcher mechanism
*/
class EnsureFilterWorker implements WorkerInterface
{
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CompassFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CompassFilter.php
index 40e3941..ffc7e9e 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CompassFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CompassFilter.php
@@ -290,14 +290,13 @@ class CompassFilter extends BaseSassFilter
if (NULL !== $this->scss) {
$type = $this->scss ? 'scss' : 'sass';
} else if ($path = $asset->getSourcePath()) {
- // FIXME: what if the extension is something else?
$type = pathinfo($path, PATHINFO_EXTENSION);
} else {
$type = 'scss';
}
$tempName = tempnam($tempDir, 'assetic_compass');
- unlink($tempName); // FIXME: don't use tempnam() here
+ unlink($tempName);
// input
$input = $tempName . '.' . $type;
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssEmbedFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssEmbedFilter.php
index da9a61a..d537dee 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssEmbedFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssEmbedFilter.php
@@ -126,7 +126,7 @@ class CssEmbedFilter extends BaseProcessFilter implements DependencyExtractorInt
}
public function getChildren(AssetFactory $factory, $content, $loadPath = NULL) {
- // todo
+
return array();
}
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssImportFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssImportFilter.php
index 3939bfe..dc4797c 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssImportFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssImportFilter.php
@@ -98,7 +98,7 @@ class CssImportFilter extends BaseCssFilter implements DependencyExtractorInterf
}
public function getChildren(AssetFactory $factory, $content, $loadPath = NULL) {
- // todo
+
return array();
}
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessFilter.php
index 4532cdd..3f5a817 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessFilter.php
@@ -153,8 +153,8 @@ EOF;
}
/**
- * @todo support for import-once
- * @todo support for import (less) "lib.css"
+ * support for import-once
+ * support for import (less) "lib.css"
*/
public function getChildren(AssetFactory $factory, $content, $loadPath = NULL) {
$loadPaths = $this->loadPaths;
@@ -170,7 +170,7 @@ EOF;
foreach (LessUtils::extractImports($content) as $reference) {
if ('.css' === substr($reference, -4)) {
// skip normal css imports
- // todo: skip imports with media queries
+ // skip imports with media queries
continue;
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessphpFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessphpFilter.php
index 5424655..181db96 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessphpFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessphpFilter.php
@@ -130,7 +130,7 @@ class LessphpFilter implements DependencyExtractorInterface
foreach (LessUtils::extractImports($content) as $reference) {
if ('.css' === substr($reference, -4)) {
// skip normal css imports
- // todo: skip imports with media queries
+ // skip imports with media queries
continue;
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/PhpCssEmbedFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/PhpCssEmbedFilter.php
index dd41eb6..1c1d667 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/PhpCssEmbedFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/PhpCssEmbedFilter.php
@@ -42,7 +42,7 @@ class PhpCssEmbedFilter implements DependencyExtractorInterface
}
public function getChildren(AssetFactory $factory, $content, $loadPath = NULL) {
- // todo
+
return array();
}
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/RooleFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/RooleFilter.php
index f841d6f..b5cc5af 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/RooleFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/RooleFilter.php
@@ -74,7 +74,7 @@ class RooleFilter extends BaseNodeFilter implements DependencyExtractorInterface
}
public function getChildren(AssetFactory $factory, $content, $loadPath = NULL) {
- // todo
+
return array();
}
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/Sass/BaseSassFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/Sass/BaseSassFilter.php
index 7d1e7fb..714a112 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/Sass/BaseSassFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/Sass/BaseSassFilter.php
@@ -34,7 +34,7 @@ abstract class BaseSassFilter extends BaseProcessFilter implements DependencyExt
foreach (SassUtils::extractImports($content) as $reference) {
if ('.css' === substr($reference, -4)) {
// skip normal css imports
- // todo: skip imports with media queries
+ // skip imports with media queries
continue;
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/SprocketsFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/SprocketsFilter.php
index b1d8610..69a83cf 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/SprocketsFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/SprocketsFilter.php
@@ -120,7 +120,7 @@ EOF;
}
public function getChildren(AssetFactory $factory, $content, $loadPath = NULL) {
- // todo
+
return array();
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/StylusFilter.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/StylusFilter.php
index bca2206..b7a44fa 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/StylusFilter.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/kriswallsmith/assetic/src/Assetic/Filter/StylusFilter.php
@@ -114,7 +114,7 @@ EOF;
}
public function getChildren(AssetFactory $factory, $content, $loadPath = NULL) {
- // todo
+
return array();
}
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/NegotiatorInterface.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/NegotiatorInterface.php
index 0f0b58e..b80769a 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/NegotiatorInterface.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/NegotiatorInterface.php
@@ -6,7 +6,7 @@ use Psr\Http\Message\RequestInterface;
/**
* A standard interface for interacting with the various version of the WebSocket protocol
- * @todo Look in to extension support
+ * Look in to extension support
*/
interface NegotiatorInterface
{
@@ -42,7 +42,7 @@ interface NegotiatorInterface
* If enabled and support for a subprotocol has been added handshake
* will not upgrade if a match between request and supported subprotocols
* @param boolean $enable
- * @todo Consider extending this interface and moving this there.
+ * Consider extending this interface and moving this there.
* The spec does says the server can fail for this reason, but
* it is not a requirement. This is an implementation detail.
*/
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/RequestVerifier.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/RequestVerifier.php
index 7a8660a..59b9bcc 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/RequestVerifier.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/RequestVerifier.php
@@ -7,7 +7,7 @@ use Psr\Http\Message\RequestInterface;
/**
* These are checks to ensure the client requested handshake are valid
* Verification rules come from section 4.2.1 of the RFC6455 document
- * @todo Currently just returning invalid - should consider returning appropriate HTTP status code error #s
+ * Currently just returning invalid - should consider returning appropriate HTTP status code error #s
*/
class RequestVerifier
{
@@ -74,7 +74,7 @@ class RequestVerifier
/**
* @param array $hostHeader
* @return bool
- * @todo Once I fix HTTP::getHeaders just verify this isn't NULL or empty...or maybe need to verify it's a valid domain??? Or should it equal $_SERVER['HOST'] ?
+ * Once I fix HTTP::getHeaders just verify this isn't NULL or empty...or maybe need to verify it's a valid domain??? Or should it equal $_SERVER['HOST'] ?
*/
public function verifyHost(array $hostHeader) {
return (1 === count($hostHeader));
@@ -113,8 +113,8 @@ class RequestVerifier
* This function verifies the nonce is valid (64 big encoded, 16 bytes random string)
* @param array $keyHeader
* @return bool
- * @todo The spec says we don't need to base64_decode - can I just check if the length is 24 and not decode?
- * @todo Check the spec to see what the encoding of the key could be
+ * The spec says we don't need to base64_decode - can I just check if the length is 24 and not decode?
+ * Check the spec to see what the encoding of the key could be
*/
public function verifyKey(array $keyHeader) {
return (1 === count($keyHeader) && 16 === strlen(base64_decode($keyHeader[0])));
@@ -130,13 +130,13 @@ class RequestVerifier
}
/**
- * @todo Write logic for this method. See section 4.2.1.8
+ * Write logic for this method. See section 4.2.1.8
*/
public function verifyProtocol($val) {
}
/**
- * @todo Write logic for this method. See section 4.2.1.9
+ * Write logic for this method. See section 4.2.1.9
*/
public function verifyExtensions($val) {
}
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/ServerNegotiator.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/ServerNegotiator.php
index 8ef854c..e8273a4 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/ServerNegotiator.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Handshake/ServerNegotiator.php
@@ -7,7 +7,7 @@ use GuzzleHttp\Psr7\Response;
/**
* The latest version of the WebSocket protocol
- * @todo Unicode: return mb_convert_encoding(pack("N",$u), mb_internal_encoding(), 'UCS-4BE');
+ * Unicode: return mb_convert_encoding(pack("N",$u), mb_internal_encoding(), 'UCS-4BE');
*/
class ServerNegotiator implements NegotiatorInterface
{
@@ -129,7 +129,7 @@ class ServerNegotiator implements NegotiatorInterface
* If enabled and support for a subprotocol has been added handshake
* will not upgrade if a match between request and supported subprotocols
* @param boolean $enable
- * @todo Consider extending this interface and moving this there.
+ * Consider extending this interface and moving this there.
* The spec does says the server can fail for this reason, but
* it is not a requirement. This is an implementation detail.
*/
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Messaging/Frame.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Messaging/Frame.php
index 62f5446..ac019c3 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Messaging/Frame.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/src/Messaging/Frame.php
@@ -313,7 +313,7 @@ class Frame implements FrameInterface
return $payload ^ str_pad('', $len, $maskingKey, STR_PAD_RIGHT);
- // TODO: Remove this before publish - keeping methods here to compare performance (above is faster but need control against v0.3.3)
+ // Remove this before publish - keeping methods here to compare performance (above is faster but need control against v0.3.3)
$applied = '';
for ($i = 0, $len = strlen($payload); $i < $len; $i++) {
@@ -424,7 +424,7 @@ class Frame implements FrameInterface
/**
* {@inheritdoc}
- * @todo Consider not checking mask, always returning the payload, masked or not
+ * Consider not checking mask, always returning the payload, masked or not
*/
public function getPayload() {
if (!$this->isCoalesced()) {
@@ -436,7 +436,7 @@ class Frame implements FrameInterface
/**
* Get the raw contents of the frame
- * @todo This is untested, make sure the substr is right - trying to return the frame w/o the overflow
+ * This is untested, make sure the substr is right - trying to return the frame w/o the overflow
*/
public function getContents() {
return substr($this->data, 0, $this->getPayloadStartingByte() + $this->getPayloadLength());
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/tests/unit/Messaging/FrameTest.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/tests/unit/Messaging/FrameTest.php
index 39edd11..59884b2 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/tests/unit/Messaging/FrameTest.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/ratchet/rfc6455/tests/unit/Messaging/FrameTest.php
@@ -6,8 +6,8 @@ use Ratchet\RFC6455\Messaging\Frame;
/**
* @covers Ratchet\RFC6455\Messaging\Frame
- * @todo getMaskingKey, getPayloadStartingByte don't have tests yet
- * @todo Could use some clean up in general, I had to rush to fix a bug for a deadline, sorry.
+ * getMaskingKey, getPayloadStartingByte don't have tests yet
+ * Could use some clean up in general, I had to rush to fix a bug for a deadline, sorry.
*/
class FrameTest extends \PHPUnit_Framework_TestCase
{
@@ -260,7 +260,7 @@ class FrameTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider UnframeMessageProvider
* covers Ratchet\RFC6455\Messaging\Frame::getPayloadLength
- * @todo Not yet testing when second additional payload length descriptor
+ * Not yet testing when second additional payload length descriptor
*/
public function testGetPayloadLengthFromFullMessage($msg, $encoded) {
$this->_frame->addBuffer(base64_decode($encoded));
@@ -279,7 +279,7 @@ class FrameTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider maskingKeyProvider
* covers Ratchet\RFC6455\Messaging\Frame::getMaskingKey
- * @todo I I wrote the dataProvider incorrectly, skipping for now
+ * I I wrote the dataProvider incorrectly, skipping for now
*/
public function testGetMaskingKey($mask) {
$this->_frame->addBuffer(static::encode($this->_firstByteFinText));
@@ -299,7 +299,7 @@ class FrameTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider UnframeMessageProvider
* covers Ratchet\RFC6455\Messaging\Frame::getPayload
- * @todo Move this test to bottom as it requires all methods of the class
+ * Move this test to bottom as it requires all methods of the class
*/
public function testUnframeFullMessage($unframed, $base_framed) {
$this->_frame->addBuffer(base64_decode($base_framed));
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/promise/tests/FunctionResolveTest.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/promise/tests/FunctionResolveTest.php
index c82a370..7642c87 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/promise/tests/FunctionResolveTest.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/promise/tests/FunctionResolveTest.php
@@ -119,7 +119,7 @@ class FunctionResolveTest extends TestCase
public function shouldSupportVeryDeepNestedPromises() {
$deferreds = [];
- // @TODO Increase count once global-queue is merged
+ // Increase count once global-queue is merged
for ($i = 0; $i < 10; $i++) {
$deferreds[] = $d = new Deferred();
$p = $d->promise();
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/socket/src/StreamEncryption.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/socket/src/StreamEncryption.php
index 8e2a250..17b9ec4 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/socket/src/StreamEncryption.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/react/socket/src/StreamEncryption.php
@@ -72,7 +72,7 @@ class StreamEncryption
// pause actual stream instance to continue operation on raw stream socket
$stream->pause();
- // TODO: add write() event to make sure we're not sending any excessive data
+ // add write() event to make sure we're not sending any excessive data
$deferred = new Deferred(function ($_, $reject) use ($toggle) {
// cancelling this leaves this stream in an inconsistent state…
diff --git a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
index d2a1230..bc8a096 100644
--- a/main/app/sprinkles/core/assets/SiteAssets/php/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
+++ b/main/app/sprinkles/core/assets/SiteAssets/php/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
@@ -429,7 +429,7 @@ class PdoSessionHandler extends AbstractSessionHandler
*
* @return string
*
- * @todo implement missing support for oci DSN (which look totally different from other PDO ones)
+ * implement missing support for oci DSN (which look totally different from other PDO ones)
*/
private function buildDsnFromUrl($dsnOrUrl) {
// (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid
@@ -652,7 +652,7 @@ class PdoSessionHandler extends AbstractSessionHandler
*
* @throws \DomainException When an unsupported PDO driver is used
*
- * @todo implement missing advisory locks
+ * implement missing advisory locks
* - for oci using DBMS_LOCK.REQUEST
* - for sqlsrv using sp_getapplock with LockOwner = Session
*/
diff --git a/main/app/sprinkles/core/assets/userfrosting/css/AdminLTE.css b/main/app/sprinkles/core/assets/userfrosting/css/AdminLTE.css
index 38fe523..dfe6b4b 100644
--- a/main/app/sprinkles/core/assets/userfrosting/css/AdminLTE.css
+++ b/main/app/sprinkles/core/assets/userfrosting/css/AdminLTE.css
@@ -2233,7 +2233,7 @@ a:focus {
font-size: 12px;
}
-/* Widget: TODO LIST */
+/* Widget:*/
.todo-list {
margin: 0;
padding: 0;
diff --git a/main/app/sprinkles/core/assets/userfrosting/js/AdminLTE.js b/main/app/sprinkles/core/assets/userfrosting/js/AdminLTE.js
index 8f31ca5..0bdfc9d 100644
--- a/main/app/sprinkles/core/assets/userfrosting/js/AdminLTE.js
+++ b/main/app/sprinkles/core/assets/userfrosting/js/AdminLTE.js
@@ -709,12 +709,11 @@ function _init() {
})(jQuery);
/*
- * TODO LIST CUSTOM PLUGIN
+ LIST CUSTOM PLUGIN
* -----------------------
* This plugin depends on iCheck plugin for checkbox and radio inputs
*
* @type plugin
- * @usage $("#todo-widget").todolist( options );
*/
(function ($) {
diff --git a/main/app/sprinkles/core/assets/userfrosting/js/uf-form.js b/main/app/sprinkles/core/assets/userfrosting/js/uf-form.js
index 3724ef7..06fcc43 100644
--- a/main/app/sprinkles/core/assets/userfrosting/js/uf-form.js
+++ b/main/app/sprinkles/core/assets/userfrosting/js/uf-form.js
@@ -29,7 +29,7 @@
* UserFrosting https://www.userfrosting.com
* @author Alexander Weissman <https://alexanderweissman.com>
*
- * @todo Implement proper fallback for when `set` function isn't supported by FormData.
+ * Implement proper fallback for when `set` function isn't supported by FormData.
*/
;(function ($, window, document, undefined) {
'use strict';
@@ -166,7 +166,7 @@
console.log('Error (' + jqXHR.status + '): ' + jqXHR.responseText);
}
// Display errors on failure
- // TODO: ufAlerts widget should have a 'destroy' method
+ // ufAlerts widget should have a 'destroy' method
if (!this.settings.msgTarget.data('ufAlerts')) {
this.settings.msgTarget.ufAlerts();
} else {
diff --git a/main/app/sprinkles/core/assets/userfrosting/js/uf-modal.js b/main/app/sprinkles/core/assets/userfrosting/js/uf-modal.js
index 588c40b..221a2fc 100644
--- a/main/app/sprinkles/core/assets/userfrosting/js/uf-modal.js
+++ b/main/app/sprinkles/core/assets/userfrosting/js/uf-modal.js
@@ -82,7 +82,7 @@
console.log("Error (" + data.status + "): " + data.responseText);
}
// Display errors on failure
- // TODO: ufAlerts widget should have a 'destroy' method
+ // ufAlerts widget should have a 'destroy' method
if (!base.options.msgTarget.data('ufAlerts')) {
base.options.msgTarget.ufAlerts();
} else {
diff --git a/main/app/sprinkles/core/assets/userfrosting/js/uf-table.js b/main/app/sprinkles/core/assets/userfrosting/js/uf-table.js
index 692dccc..8981bb3 100644
--- a/main/app/sprinkles/core/assets/userfrosting/js/uf-table.js
+++ b/main/app/sprinkles/core/assets/userfrosting/js/uf-table.js
@@ -551,7 +551,7 @@
console.log('Error (' + jqXHR.status + '): ' + jqXHR.responseText);
}
// Display errors on failure
- // TODO: ufAlerts widget should have a 'destroy' method
+ // ufAlerts widget should have a 'destroy' method
if (!this.settings.msgTarget.data('ufAlerts')) {
this.settings.msgTarget.ufAlerts();
} else {
diff --git a/main/app/sprinkles/core/src/Controller/CoreController.php b/main/app/sprinkles/core/src/Controller/CoreController.php
index f78d4c1..4bacef2 100644
--- a/main/app/sprinkles/core/src/Controller/CoreController.php
+++ b/main/app/sprinkles/core/src/Controller/CoreController.php
@@ -29,10 +29,6 @@ class CoreController extends SimpleController
*/
public function pageIndex($request, $response, $args) {
- $FeedImages = DB::table('image_posts')
- ->orderBy('Created')
- ->get();
-
// AUTHORIZATION - ONLY FOR ADMINS RIGHT KNOW (BUILD PROCESS)
$authorizer = $this->ci->authorizer;
$currentUser = $this->ci->currentUser;
@@ -40,9 +36,7 @@ class CoreController extends SimpleController
//throw new ForbiddenException();
}
- return $this->ci->view->render($response, 'pages/index.html.twig', [
- 'FeedImages' => $FeedImages
- ]);
+ return $this->ci->view->render($response, 'pages/index.html.twig');
}
diff --git a/main/app/sprinkles/core/src/Database/Relations/Concerns/Unique.php b/main/app/sprinkles/core/src/Database/Relations/Concerns/Unique.php
index 71c1c4c..3a321e4 100644
--- a/main/app/sprinkles/core/src/Database/Relations/Concerns/Unique.php
+++ b/main/app/sprinkles/core/src/Database/Relations/Concerns/Unique.php
@@ -74,7 +74,7 @@ trait Unique
/**
* Set the "offset" value of the query.
*
- * @todo Implement for 'unionOffset' as well? (By checking the value of $this->query->getQuery()->unions)
+ * Implement for 'unionOffset' as well? (By checking the value of $this->query->getQuery()->unions)
* @see \Illuminate\Database\Query\Builder
* @param int $value
* @return $this
@@ -98,7 +98,7 @@ trait Unique
/**
* Set the "limit" value of the query.
*
- * @todo Implement for 'unionLimit' as well? (By checking the value of $this->query->getQuery()->unions)
+ * Implement for 'unionLimit' as well? (By checking the value of $this->query->getQuery()->unions)
* @see \Illuminate\Database\Query\Builder
* @param int $value
* @return $this
diff --git a/main/app/sprinkles/core/src/Error/Renderer/WhoopsRenderer.php b/main/app/sprinkles/core/src/Error/Renderer/WhoopsRenderer.php
index 2ef6588..4113470 100644
--- a/main/app/sprinkles/core/src/Error/Renderer/WhoopsRenderer.php
+++ b/main/app/sprinkles/core/src/Error/Renderer/WhoopsRenderer.php
@@ -165,7 +165,7 @@ class WhoopsRenderer extends ErrorRenderer
public function render() {
if (!$this->handleUnconditionally()) {
// Check conditions for outputting HTML:
- // @todo: Make this more robust
+ // : Make this more robust
if (php_sapi_name() === 'cli') {
// Help users who have been relying on an internal test value
// fix their code to the proper method
@@ -221,7 +221,7 @@ class WhoopsRenderer extends ErrorRenderer
$vars = [
"page_title" => $this->getPageTitle(),
- // @todo: Asset compiler
+ // : Asset compiler
"stylesheet" => file_get_contents($cssFile),
"zepto" => file_get_contents($zeptoFile),
"clipboard" => file_get_contents($clipboard),
@@ -269,7 +269,7 @@ class WhoopsRenderer extends ErrorRenderer
}
// Add extra entries list of data tables:
- // @todo: Consolidate addDataTable and addDataTableCallback
+ // : Consolidate addDataTable and addDataTableCallback
$extraTables = array_map(function ($table) use ($inspector) {
return $table instanceof \Closure ? $table($inspector) : $table;
}, $this->getDataTables());
diff --git a/main/app/sprinkles/core/src/Mail/Mailer.php b/main/app/sprinkles/core/src/Mail/Mailer.php
index 82302b8..761d15a 100644
--- a/main/app/sprinkles/core/src/Mail/Mailer.php
+++ b/main/app/sprinkles/core/src/Mail/Mailer.php
@@ -64,7 +64,7 @@ class Mailer
}
// Set any additional message-specific options
- // TODO: enforce which options can be set through this subarray
+ // enforce which options can be set through this subarray
if (isset($config['message_options'])) {
$this->setOptions($config['message_options']);
}
diff --git a/main/app/sprinkles/core/src/Mail/TwigMailMessage.php b/main/app/sprinkles/core/src/Mail/TwigMailMessage.php
index e20b906..aa4daea 100644
--- a/main/app/sprinkles/core/src/Mail/TwigMailMessage.php
+++ b/main/app/sprinkles/core/src/Mail/TwigMailMessage.php
@@ -43,7 +43,7 @@ class TwigMailMessage extends MailMessage
$twig = $this->view->getEnvironment();
// Must manually merge in global variables for block rendering
- // TODO: should we keep this separate from the local parameters?
+ // should we keep this separate from the local parameters?
$this->params = $twig->getGlobals();
if ($filename !== NULL) {
diff --git a/main/app/sprinkles/core/src/ServicesProvider/ServicesProvider.php b/main/app/sprinkles/core/src/ServicesProvider/ServicesProvider.php
index 27544c7..6ac8c41 100644
--- a/main/app/sprinkles/core/src/ServicesProvider/ServicesProvider.php
+++ b/main/app/sprinkles/core/src/ServicesProvider/ServicesProvider.php
@@ -124,7 +124,7 @@ class ServicesProvider
// Load Sprinkle assets
$sprinkles = $c->sprinkleManager->getSprinkleNames();
- // TODO: move this out into PathBuilder and Loader classes in userfrosting/assets
+ // move this out into PathBuilder and Loader classes in userfrosting/assets
// This would also allow us to define and load bundles in themes
$bundleSchemas = array_reverse($locator->findResources('sprinkles://' . $config['assets.raw.schema'], TRUE, TRUE));
@@ -176,7 +176,7 @@ class ServicesProvider
/**
* Middleware to check environment.
*
- * @todo We should cache the results of this, the first time that it succeeds.
+ * We should cache the results of this, the first time that it succeeds.
*/
$container['checkEnvironment'] = function ($c) {
$checkEnvironment = new CheckEnvironment($c->view, $c->locator, $c->cache);
@@ -279,7 +279,7 @@ class ServicesProvider
/**
* Initialize Eloquent Capsule, which provides the database layer for UF.
*
- * @todo construct the individual objects rather than using the facade
+ * construct the individual objects rather than using the facade
*/
$container['db'] = function ($c) {
$config = $c->config;
diff --git a/main/app/sprinkles/core/src/Sprunje/Sprunje.php b/main/app/sprinkles/core/src/Sprunje/Sprunje.php
index 840eff0..ea066a3 100644
--- a/main/app/sprinkles/core/src/Sprunje/Sprunje.php
+++ b/main/app/sprinkles/core/src/Sprunje/Sprunje.php
@@ -139,7 +139,7 @@ abstract class Sprunje
$v->rule('integer', 'page');
$v->rule('regex', 'format', '/json|csv/i');
- // TODO: translated rules
+ // translated rules
if (!$v->validate()) {
$e = new BadRequestException();
foreach ($v->errors() as $idx => $field) {
diff --git a/main/app/sprinkles/core/templates/pages/index.html.twig b/main/app/sprinkles/core/templates/pages/index.html.twig
index 9b21dd4..0479fb8 100644
--- a/main/app/sprinkles/core/templates/pages/index.html.twig
+++ b/main/app/sprinkles/core/templates/pages/index.html.twig
@@ -24,7 +24,7 @@
<div class="MainInTab FeedTabWindow">
{% for FeedImage in FeedImages %}
<img class="FeedImage" src="{{ site.uri.public }}/image/{{ FeedImage.PostID }}"
- alt="You probably don't have an permission to see this image.">
+ alt="You probably don't have a permission to see this image.">
<br>
{% endfor %}
</div>
@@ -65,11 +65,9 @@
<hr class="ChatHeaderDivider">
</div>
<div class="MainInTab ChatWindow">
- <div class="SelectReceiver">
-
- </div>
+ <div class="SelectReceiver"></div>
<div class="SelectedReceiver">
- <div id="ChatMessages" class="ChatMessages">
+ <div id="ChatMessages" class="ChatMessages" data-username="">
<!-- Messages -->
</div>
<input title="{{ translate("CHAT_MESSAGES.WRITE_MESSAGE_PH") }}"
diff --git a/main/app/sprinkles/core/templates/pages/partials/page.js.twig b/main/app/sprinkles/core/templates/pages/partials/page.js.twig
index c8ce880..b4ee732 100644
--- a/main/app/sprinkles/core/templates/pages/partials/page.js.twig
+++ b/main/app/sprinkles/core/templates/pages/partials/page.js.twig
@@ -1,4 +1,4 @@
{# Page variables needed by client-side code (Javascript). #}
{% autoescape 'js' %}
-{{ page | json_encode(constant('JSON_PRETTY_PRINT')) | raw }}
-{% au t esca e%}
+ var page = {{ page | json_encode(constant('JSON_PRETTY_PRINT')) | raw }}
+{% endautoescape %}
diff --git a/main/app/sprinkles/extend-user/.gitignore b/main/app/sprinkles/extend-user/.gitignore
deleted file mode 100644
index 187c903..0000000
--- a/main/app/sprinkles/extend-user/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.DS_Store
-.idea
-*.komodoproject
diff --git a/main/app/sprinkles/extend-user/README.md b/main/app/sprinkles/extend-user/README.md
deleted file mode 100644
index 60a4bcd..0000000
--- a/main/app/sprinkles/extend-user/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# User Extension Sprinkle (UserFrosting 4.1)
-
-Example sprinkle for extending the User class to contain additional fields.
-
-# Installation
-
-Edit UserFrosting `app/sprinkles.json` and add the following to the `require` list : `"userfrosting/extend-user": "~4.1.1"`. Also add `extend-user` to the `base` list. For example:
-
-```
-{
- "require": {
- "userfrosting/extend-user": "~4.1.1"
- },
- "base": [
- "core",
- "account",
- "admin",
- "extend-user"
- ]
-}
-```
-
-### Update Composer
-
-- Run `composer update` from the root project directory.
-
-### Run migration
-
-- Run `php bakery bake` from the root project directory.
diff --git a/main/app/sprinkles/extend-user/composer.json b/main/app/sprinkles/extend-user/composer.json
deleted file mode 100644
index fe94c04..0000000
--- a/main/app/sprinkles/extend-user/composer.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "userfrosting/extend-user",
- "type": "userfrosting-sprinkle",
- "description": "An example Sprinkle for extending the User model and table with additional fields or relationships.",
- "homepage": "https://github.com/userfrosting/extend-user",
- "license": "MIT",
- "authors": [
- {
- "name": "Alexander Weissman",
- "homepage": "https://alexanderweissman.com"
- }
- ],
- "autoload": {
- "psr-4": {
- "UserFrosting\\Sprinkle\\ExtendUser\\": "src/"
- }
- },
- "extra": {
- "installer-name": "extend-user"
- }
-}
-
diff --git a/main/app/sprinkles/extend-user/routes/member.php b/main/app/sprinkles/extend-user/routes/member.php
deleted file mode 100644
index 19028ac..0000000
--- a/main/app/sprinkles/extend-user/routes/member.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-/**
- * Routes for administrative user management. Overrides routes defined in routes://admin/users.php
- */
-$app->group('/admin/users', function () {
- $this->get('/u/{user_name}', 'UserFrosting\Sprinkle\ExtendUser\Controller\MemberController:pageInfo');
-})->add('authGuard'); \ No newline at end of file
diff --git a/main/app/sprinkles/extend-user/schema/requests/user/create.yaml b/main/app/sprinkles/extend-user/schema/requests/user/create.yaml
deleted file mode 100644
index 2df2955..0000000
--- a/main/app/sprinkles/extend-user/schema/requests/user/create.yaml
+++ /dev/null
@@ -1,86 +0,0 @@
----
-user_name:
- validators:
- length:
- label: "&USERNAME"
- min: 1
- max: 50
- message: VALIDATE.LENGTH_RANGE
- no_leading_whitespace:
- label: "&USERNAME"
- message: VALIDATE.NO_LEAD_WS
- no_trailing_whitespace:
- label: "&USERNAME"
- message: VALIDATE.NO_TRAIL_WS
- required:
- label: "&USERNAME"
- message: VALIDATE.REQUIRED
- username:
- label: "&USERNAME"
- message: VALIDATE.USERNAME
-first_name:
- validators:
- length:
- label: "&FIRST_NAME"
- min: 1
- max: 20
- message: VALIDATE.LENGTH_RANGE
- required:
- label: "&FIRST_NAME"
- message: VALIDATE.REQUIRED
- transformations:
- - trim
-last_name:
- validators:
- length:
- label: "&LAST_NAME"
- min: 1
- max: 30
- message: VALIDATE.LENGTH_RANGE
- transformations:
- - trim
-email:
- validators:
- required:
- label: "&EMAIL"
- message: VALIDATE.REQUIRED
- length:
- label: "&EMAIL"
- min: 1
- max: 150
- message: VALIDATE.LENGTH_RANGE
- email:
- message: VALIDATE.INVALID_EMAIL
-locale:
- default: en_US
- validators:
- required:
- label: "&LOCALE"
- domain: server
- message: VALIDATE.REQUIRED
- length:
- label: "&LOCALE"
- min: 1
- max: 10
- domain: server
- message: VALIDATE.LENGTH_RANGE
-group_id:
- validators:
- integer:
- label: "&GROUP"
- domain: server
- message: VALIDATE.INTEGER
-city:
- validators:
- length:
- label: City
- min: 1
- max: 255
- message: VALIDATE.LENGTH_RANGE
-country:
- validators:
- length:
- label: Country
- min: 1
- max: 255
- message: VALIDATE.LENGTH_RANGE
diff --git a/main/app/sprinkles/extend-user/schema/requests/user/edit-info.yaml b/main/app/sprinkles/extend-user/schema/requests/user/edit-info.yaml
deleted file mode 100644
index edfae6e..0000000
--- a/main/app/sprinkles/extend-user/schema/requests/user/edit-info.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
----
-first_name:
- validators:
- length:
- label: "&FIRST_NAME"
- min: 1
- max: 20
- message: VALIDATE.LENGTH_RANGE
-last_name:
- validators:
- length:
- label: "&LAST_NAME"
- min: 1
- max: 30
- message: VALIDATE.LENGTH_RANGE
-email:
- validators:
- length:
- label: "&EMAIL"
- min: 1
- max: 150
- message: VALIDATE.LENGTH_RANGE
- email:
- message: VALIDATE.INVALID_EMAIL
-locale:
- validators:
- length:
- label: "&LOCALE"
- min: 1
- max: 10
- message: VALIDATE.LENGTH_RANGE
-group_id:
- validators:
- integer:
- label: "&GROUP"
- message: VALIDATE.INTEGER
-city:
- validators:
- length:
- label: City
- min: 1
- max: 255
- message: VALIDATE.LENGTH_RANGE
-country:
- validators:
- length:
- label: Country
- min: 1
- max: 255
- message: VALIDATE.LENGTH_RANGE \ No newline at end of file
diff --git a/main/app/sprinkles/extend-user/src/Controller/MemberController.php b/main/app/sprinkles/extend-user/src/Controller/MemberController.php
deleted file mode 100644
index 0fcc481..0000000
--- a/main/app/sprinkles/extend-user/src/Controller/MemberController.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-namespace UserFrosting\Sprinkle\ExtendUser\Controller;
-
-use Illuminate\Database\Capsule\Manager as Capsule;
-use Psr\Http\Message\ResponseInterface as Response;
-use Psr\Http\Message\ServerRequestInterface as Request;
-use UserFrosting\Sprinkle\Admin\Controller\UserController;
-use UserFrosting\Sprinkle\Core\Facades\Debug;
-use UserFrosting\Support\Exception\ForbiddenException;
-
-class MemberController extends UserController
-{
- /**
- * Renders a page displaying a user's information, in read-only mode.
- *
- * This checks that the currently logged-in user has permission to view the requested user's info.
- * It checks each field individually, showing only those that you have permission to view.
- * This will also try to show buttons for activating, disabling/enabling, deleting, and editing the user.
- * This page requires authentication.
- * Request type: GET
- */
- public function pageInfo($request, $response, $args) {
- $user = $this->getUserFromParams($args);
-
- // If the user no longer exists, forward to main user listing page
- if (!$user) {
- $usersPage = $this->ci->router->pathFor('uri_users');
- return $response->withRedirect($usersPage, 404);
- }
-
- /** @var UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
- $authorizer = $this->ci->authorizer;
-
- /** @var UserFrosting\Sprinkle\Account\Database\Models\User $currentUser */
- $currentUser = $this->ci->currentUser;
-
- // Access-controlled page
- if (!$authorizer->checkAccess($currentUser, 'uri_user', [
- 'user' => $user
- ])) {
- throw new ForbiddenException();
- }
-
- /** @var UserFrosting\Config\Config $config */
- $config = $this->ci->config;
-
- // Get a list of all locales
- $locales = $config->getDefined('site.locales.available');
-
- // Determine fields that currentUser is authorized to view
- $fieldNames = ['user_name', 'name', 'email', 'locale', 'group', 'roles', 'address'];
-
- // Generate form
- $fields = [
- // Always hide these
- 'hidden' => ['theme']
- ];
-
- // Determine which fields should be hidden
- foreach ($fieldNames as $field) {
- if (!$authorizer->checkAccess($currentUser, 'view_user_field', [
- 'user' => $user,
- 'property' => $field
- ])) {
- $fields['hidden'][] = $field;
- }
- }
-
- // Determine buttons to display
- $editButtons = [
- 'hidden' => []
- ];
-
- if (!$authorizer->checkAccess($currentUser, 'update_user_field', [
- 'user' => $user,
- 'fields' => ['name', 'email', 'locale']
- ])) {
- $editButtons['hidden'][] = 'edit';
- }
-
- if (!$authorizer->checkAccess($currentUser, 'update_user_field', [
- 'user' => $user,
- 'fields' => ['flag_enabled']
- ])) {
- $editButtons['hidden'][] = 'enable';
- }
-
- if (!$authorizer->checkAccess($currentUser, 'update_user_field', [
- 'user' => $user,
- 'fields' => ['flag_verified']
- ])) {
- $editButtons['hidden'][] = 'activate';
- }
-
- if (!$authorizer->checkAccess($currentUser, 'update_user_field', [
- 'user' => $user,
- 'fields' => ['password']
- ])) {
- $editButtons['hidden'][] = 'password';
- }
-
- if (!$authorizer->checkAccess($currentUser, 'update_user_field', [
- 'user' => $user,
- 'fields' => ['roles']
- ])) {
- $editButtons['hidden'][] = 'roles';
- }
-
- if (!$authorizer->checkAccess($currentUser, 'delete_user', [
- 'user' => $user
- ])) {
- $editButtons['hidden'][] = 'delete';
- }
-
- return $this->ci->view->render($response, 'pages/user.html.twig', [
- 'user' => $user,
- 'locales' => $locales,
- 'fields' => $fields,
- 'tools' => $editButtons
- ]);
- }
-}
diff --git a/main/app/sprinkles/extend-user/src/Database/Migrations/v400/MembersTable.php b/main/app/sprinkles/extend-user/src/Database/Migrations/v400/MembersTable.php
deleted file mode 100644
index fe5aa93..0000000
--- a/main/app/sprinkles/extend-user/src/Database/Migrations/v400/MembersTable.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-namespace UserFrosting\Sprinkle\ExtendUser\Database\Migrations\v400;
-
-use UserFrosting\System\Bakery\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Schema\Builder;
-
-class MembersTable extends Migration
-{
- public $dependencies = [
- '\UserFrosting\Sprinkle\Account\Database\Migrations\v400\UsersTable'
- ];
-
- public function up() {
- if (!$this->schema->hasTable('members')) {
- $this->schema->create('members', function (Blueprint $table) {
- $table->increments('id');
- $table->string('city', 255)->nullable();
- $table->string('country', 255)->nullable();
-
- $table->engine = 'InnoDB';
- $table->collation = 'utf8_unicode_ci';
- $table->charset = 'utf8';
- $table->foreign('id')->references('id')->on('users');
- });
- }
- }
-
- public function down() {
- $this->schema->drop('members');
- }
-}
diff --git a/main/app/sprinkles/extend-user/src/Database/Models/Member.php b/main/app/sprinkles/extend-user/src/Database/Models/Member.php
deleted file mode 100644
index 094d14c..0000000
--- a/main/app/sprinkles/extend-user/src/Database/Models/Member.php
+++ /dev/null
@@ -1,118 +0,0 @@
-<?php
-
-namespace UserFrosting\Sprinkle\ExtendUser\Database\Models;
-
-use UserFrosting\Sprinkle\Account\Database\Models\User;
-use UserFrosting\Sprinkle\ExtendUser\Database\Models\MemberAux;
-use UserFrosting\Sprinkle\ExtendUser\Database\Scopes\MemberAuxScope;
-
-trait LinkMemberAux
-{
- /**
- * The "booting" method of the trait.
- *
- * @return void
- */
- protected static function bootLinkMemberAux() {
- /**
- * Create a new MemberAux if necessary, and save the associated member data every time.
- */
- static::saved(function ($member) {
- $member->createAuxIfNotExists();
-
- if ($member->auxType) {
- // Set the aux PK, if it hasn't been set yet
- if (!$member->aux->id) {
- $member->aux->id = $member->id;
- }
-
- $member->aux->save();
- }
- });
- }
-}
-
-class Member extends User
-{
- use LinkMemberAux;
-
- protected $fillable = [
- 'user_name',
- 'first_name',
- 'last_name',
- 'email',
- 'locale',
- 'theme',
- 'group_id',
- 'flag_verified',
- 'flag_enabled',
- 'last_activity_id',
- 'password',
- 'deleted_at',
- 'city',
- 'country'
- ];
-
- protected $auxType = 'UserFrosting\Sprinkle\ExtendUser\Database\Models\MemberAux';
-
- /**
- * Required to be able to access the `aux` relationship in Twig without needing to do eager loading.
- * @see http://stackoverflow.com/questions/29514081/cannot-access-eloquent-attributes-on-twig/35908957#35908957
- */
- public function __isset($name) {
- if (in_array($name, [
- 'aux'
- ])) {
- return TRUE;
- } else {
- return parent::__isset($name);
- }
- }
-
- /**
- * Globally joins the `members` table to access additional properties.
- */
- protected static function boot() {
- parent::boot();
-
- static::addGlobalScope(new MemberAuxScope);
- }
-
- /**
- * Custom mutator for Member property
- */
- public function setCityAttribute($value) {
- $this->createAuxIfNotExists();
-
- $this->aux->city = $value;
- }
-
- /**
- * Custom mutator for Member property
- */
- public function setCountryAttribute($value) {
- $this->createAuxIfNotExists();
-
- $this->aux->country = $value;
- }
-
- /**
- * Relationship for interacting with aux model (`members` table).
- */
- public function aux() {
- return $this->hasOne($this->auxType, 'id');
- }
-
- /**
- * If this instance doesn't already have a related aux model (either in the db on in the current object), then create one
- */
- protected function createAuxIfNotExists() {
- if ($this->auxType && !count($this->aux)) {
- // Create aux model and set primary key to be the same as the main user's
- $aux = new $this->auxType;
-
- // Needed to immediately hydrate the relation. It will actually get saved in the bootLinkMemberAux method.
- $this->setRelation('aux', $aux);
- }
- }
-}
diff --git a/main/app/sprinkles/extend-user/src/Database/Models/MemberAux.php b/main/app/sprinkles/extend-user/src/Database/Models/MemberAux.php
deleted file mode 100644
index 6612586..0000000
--- a/main/app/sprinkles/extend-user/src/Database/Models/MemberAux.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-namespace UserFrosting\Sprinkle\ExtendUser\Database\Models;
-
-use UserFrosting\Sprinkle\Core\Database\Models\Model;
-
-class MemberAux extends Model
-{
- public $timestamps = FALSE;
-
- /**
- * @var string The name of the table for the current model.
- */
- protected $table = 'members';
-
- protected $fillable = [
- 'city',
- 'country'
- ];
-}
diff --git a/main/app/sprinkles/extend-user/src/Database/Scopes/MemberAuxScope.php b/main/app/sprinkles/extend-user/src/Database/Scopes/MemberAuxScope.php
deleted file mode 100644
index 624c4f6..0000000
--- a/main/app/sprinkles/extend-user/src/Database/Scopes/MemberAuxScope.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-namespace UserFrosting\Sprinkle\ExtendUser\Database\Scopes;
-
-use Illuminate\Database\Eloquent\Scope;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Database\Eloquent\Builder;
-
-class MemberAuxScope implements Scope
-{
- /**
- * Apply the scope to a given Eloquent query builder.
- *
- * @param \Illuminate\Database\Eloquent\Builder $builder
- * @param \Illuminate\Database\Eloquent\Model $model
- * @return void
- */
- public function apply(Builder $builder, Model $model) {
- $baseTable = $model->getTable();
- // Hardcode the table name here, or you can access it using the classMapper and `getTable`
- $auxTable = 'members';
-
- // Specify columns to load from base table and aux table
- $builder->addSelect(
- "$baseTable.*",
- "$auxTable.city as city",
- "$auxTable.country as country"
- );
-
- // Join on matching `member` records
- $builder->leftJoin($auxTable, function ($join) use ($baseTable, $auxTable) {
- $join->on("$auxTable.id", '=', "$baseTable.id");
- });
- }
-}
diff --git a/main/app/sprinkles/extend-user/src/ServicesProvider/ServicesProvider.php b/main/app/sprinkles/extend-user/src/ServicesProvider/ServicesProvider.php
deleted file mode 100644
index 22d8c7b..0000000
--- a/main/app/sprinkles/extend-user/src/ServicesProvider/ServicesProvider.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-// In /app/sprinkles/site/src/ServicesProvider/ServicesProvider.php
-
-namespace UserFrosting\Sprinkle\ExtendUser\ServicesProvider;
-
-class ServicesProvider
-{
- /**
- * Register extended user fields services.
- *
- * @param Container $container A DI container implementing ArrayAccess and container-interop.
- */
- public function register($container) {
- /**
- * Extend the 'classMapper' service to register model classes.
- *
- * Mappings added: Member
- */
- $container->extend('classMapper', function ($classMapper, $c) {
- $classMapper->setClassMapping('user', 'UserFrosting\Sprinkle\ExtendUser\Database\Models\Member');
- return $classMapper;
- });
- }
-}
diff --git a/main/app/sprinkles/extend-user/templates/forms/user.html.twig b/main/app/sprinkles/extend-user/templates/forms/user.html.twig
deleted file mode 100644
index 11edfd0..0000000
--- a/main/app/sprinkles/extend-user/templates/forms/user.html.twig
+++ /dev/null
@@ -1,166 +0,0 @@
-<form class="js-form" method="{{ form.method | default('POST') }}" action="{{ site.uri.public }}/{{ form.action }}">
- {% include "forms/csrf.html.twig" %}
- <div class="js-form-alerts">
- </div>
- <div class="row">
- {% block user_form %}
- {% if 'user_name' not in form.fields.hidden %}
- <div class="col-sm-6">
- <div class="form-group">
- <label>{{ translate('USERNAME') }}</label>
- <div class="input-group">
- <span class="input-group-addon"><i class="fa fa-edit fa-fw"></i></span>
- <input type="text" class="form-control" name="user_name" autocomplete="off"
- value="{{ user.user_name }}" placeholder="{{ translate('USERNAME') }}"
- {% if 'user_name' in form.fields.disabled %}disabled{% endif %}>
- </div>
- </div>
- </div>
- {% endif %}
- {% if 'group' not in form.fields.hidden %}
- <div class="col-sm-6">
- <div class="form-group">
- <label for="input-group">{{ translate('GROUP') }}</label>
- <div class="input-group">
- <span class="input-group-addon"><i class="fa fa-users fa-fw"></i></span>
- {% if 'group' in form.fields.disabled %}
- <input type="text" class="form-control" name="theme" value="{{ user.group.name }}"
- disabled>
- {% else %}
- <select id="input-group" class="form-control js-select2" name="group_id">
- {% for group in groups %}
- <option value="{{ group.id }}"
- {% if (group.id == user.group_id) %}selected{% endif %}>{{ group.name }}</option>
- {% endfor %}
- </select>
- {% endif %}
- </div>
- </div>
- </div>
- {% endif %}
- {% if 'name' not in form.fields.hidden %}
- <div class="col-sm-6">
- <div class="form-group">
- <label>{{ translate('FIRST_NAME') }}</label>
- <div class="input-group">
- <span class="input-group-addon"><i class="fa fa-edit fa-fw"></i></span>
- <input type="text" class="form-control" name="first_name" autocomplete="off"
- value="{{ user.first_name }}" placeholder="{{ translate('FIRST_NAME') }}"
- {% if 'name' in form.fields.disabled %}disabled{% endif %}>
- </div>
- </div>
- </div>
- <div class="col-sm-6">
- <div class="form-group">
- <label>{{ translate('LAST_NAME') }}</label>
- <div class="input-group">
- <span class="input-group-addon"><i class="fa fa-edit fa-fw"></i></span>
- <input type="text" class="form-control" name="last_name" autocomplete="off"
- value="{{ user.last_name }}" placeholder="{{ translate('LAST_NAME') }}"
- {% if 'name' in form.fields.disabled %}disabled{% endif %}>
- </div>
- </div>
- </div>
- {% endif %}
- {% if 'email' not in form.fields.hidden %}
- <div class="col-sm-6">
- <div class="form-group">
- <label>{{ translate('EMAIL') }}</label>
- <div class="input-group js-copy-container">
- <span class="input-group-addon"><i class="fa fa-envelope fa-fw"></i></span>
- <input type="text" class="form-control js-copy-target" name="email" autocomplete="off"
- value="{{ user.email }}" placeholder="{{ translate('EMAIL') }}"
- {% if 'email' in form.fields.disabled %}disabled{% endif %}>
- {% if 'email' in form.fields.disabled %}
- <span class="input-group-btn">
- <button class="btn btn-default js-copy-trigger" type="button"><i
- class="fa fa-clipboard"></i></button>
- </span>
- {% endif %}
- </div>
- </div>
- </div>
- {% endif %}
- {% if 'theme' not in form.fields.hidden %}
- <div class="col-sm-6">
- <div class="form-group">
- <label for="input-theme">{{ translate('THEME') }}</label>
- <div class="input-group">
- <span class="input-group-addon"><i class="fa fa-puzzle-piece fa-fw"></i></span>
- {% if 'theme' in form.fields.disabled %}
- <input type="text" class="form-control" name="theme" value="{{ themes[user.theme] }}"
- disabled>
- {% else %}
- <select id="input-theme" class="form-control js-select2" name="theme">
- {% for option, label in theme %}
- <option value="{{ option }}"
- {% if (option == user.theme) %}selected{% endif %}>{{ label }}</option>
- {% endfor %}
- </select>
- {% endif %}
- </div>
- </div>
- </div>
- {% endif %}
- {% if 'locale' not in form.fields.hidden %}
- <div class="col-sm-6">
- <div class="form-group">
- <label for="input-locale">{{ translate('LOCALE') }}</label>
- <div class="input-group">
- <span class="input-group-addon"><i class="fa fa-language fa-fw"></i></span>
- {% if 'locale' in form.fields.disabled %}
- <input type="text" class="form-control" name="theme" value="{{ locales[user.locale] }}"
- disabled>
- {% else %}
- <select id="input-locale" class="form-control js-select2" name="locale">
- {% for option, label in locales %}
- <option value="{{ option }}"
- {% if (option == user.locale) %}selected{% endif %}>{{ label }}</option>
- {% endfor %}
- </select>
- {% endif %}
- </div>
- </div>
- </div>
- {% endif %}
- {% if 'address' not in form.fields.hidden %}
- <div class="col-sm-6">
- <div class="form-group">
- <label>City</label>
- <div class="input-group js-copy-container">
- <span class="input-group-addon"><i class="fa fa-map-pin"></i></span>
- <input type="text" class="form-control" name="city" autocomplete="off"
- value="{{ user.city }}" placeholder="City"
- {% if 'address' in form.fields.disabled %}disabled{% endif %}>
- </div>
- </div>
- </div>
- <div class="col-sm-6">
- <div class="form-group">
- <label>Country</label>
- <div class="input-group js-copy-container">
- <span class="input-group-addon"><i class="fa fa-map-pin"></i></span>
- <input type="text" class="form-control" name="country" autocomplete="off"
- value="{{ user.country }}" placeholder="Country"
- {% if 'address' in form.fields.disabled %}disabled{% endif %}>
- </div>
- </div>
- </div>
- {% endif %}
- {% endblock %}
- </div>
- <br>
- <div class="row">
- <div class="col-xs-8 col-sm-4">
- <button type="submit" class="btn btn-block btn-lg btn-success">{{ form.submit_text }}</button>
- </div>
- <div class="col-xs-4 col-sm-3 pull-right">
- <button type="button" class="btn btn-block btn-lg btn-link"
- data-dismiss="modal">{{ translate('CANCEL') }}</button>
- </div>
- </div>
-</form>
-<!-- Include validation rules -->
-<script>
- {% include "pages/partials/page.js.twig" %}
-</script>
diff --git a/main/app/sprinkles/extend-user/templates/pages/user.html.twig b/main/app/sprinkles/extend-user/templates/pages/user.html.twig
deleted file mode 100644
index 13c79e6..0000000
--- a/main/app/sprinkles/extend-user/templates/pages/user.html.twig
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "@admin/pages/user.html.twig" %}
-
-{% block user_profile %}
- {% if 'locale' not in fields.hidden %}
- <hr>
- <strong><i class="fa fa-map-marker margin-r-5"></i> Location</strong>
- <p class="text-muted box-profile-property">
- {{ user.city }}, {{ user.country }}
- </p>
- {% endif %}
-{% endblock %}