Skip to content

Commit

Permalink
Prepped for Extension Package
Browse files Browse the repository at this point in the history
  • Loading branch information
rockhopsoft committed Jan 30, 2021
1 parent 41b4c18 commit 4631d6c
Show file tree
Hide file tree
Showing 39 changed files with 330 additions and 150 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Among other methods, the resulting data can also be provided as XML included an
```

Edit the environment file to connect the default MYSQL database:
Edit these lines of the environment file to connect the default MYSQL database:
```
% nano .env
```
Expand Down Expand Up @@ -128,7 +128,9 @@ If installing on a server, you might also need to fix some permissions before th

Clear caches and publish the package migrations...
```
% php artisan optimize:clear
% php artisan config:cache
% php artisan route:cache
% php artisan view:cache
% echo "0" | php artisan vendor:publish --force
% composer dump-autoload
% curl http://myopenpolice.local/css-reload
Expand Down Expand Up @@ -158,13 +160,13 @@ $ php artisan db:seed --class=ZipCodeSeeder4
### Initialize OpenPolice Installation

Then browsing to the home page should prompt you to create the first admin user account:<br />
http://openpolice.local
http://myopenpolice.local

If everything looks janky, then manually load the style sheets, etc:<br />
http://openpolice.local/css-reload
http://myopenpolice.local/css-reload

After logging in as an admin, this link rebuilds many supporting files:<br />
http://openpolice.local/dashboard/settings?refresh=2
http://myopenpolice.local/dashboard/settings?refresh=2


# <a name="documentation"></a>Documentation
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/DepartmentScores.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.0.7
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand Down
22 changes: 21 additions & 1 deletion src/Controllers/OpenAjax.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.0.12
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand All @@ -25,13 +25,19 @@ class OpenAjax extends OpenAjaxCachePrep
/**
* Check for ajax requests customized beyond
* Survloop's default behavior, called via /ajax/{type}.
* This overrides the ajaxChecks function in
* RockHopSoft\Survloop\Controllers\Tree\TreeSurv.
*
* @param Illuminate\Http\Request $request
* @param string $type
* @return boolean
*/
public function ajaxChecksCustom(Request $request, $type = '')
{
$extension = $this->extensionAjaxChecks($request, $type);
if (trim($extension) != '') {
return $extension;
}
if ($type == 'dept-kml-desc') {
return $this->ajaxDeptKmlDesc($request);
} elseif ($type == 'save-default-state') {
Expand All @@ -53,6 +59,20 @@ public function ajaxChecksCustom(Request $request, $type = '')
return '';
}

/**
* Check for ajax requests customized beyond
* Survloop's default behavior, called via /ajax/{type}.
* e.g. flexyourrights/openpolice-extension
*
* @param Illuminate\Http\Request $request
* @param string $type
* @return boolean
*/
protected function extensionAjaxChecks(Request $request, $type = '')
{
return '';
}

/**
* Print home page complaints previews.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/OpenAjaxCachePrep.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.0.12
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand Down
24 changes: 23 additions & 1 deletion src/Controllers/OpenComplaintConditions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.0.15
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand All @@ -22,13 +22,20 @@ class OpenComplaintConditions extends OpenSessDataOverride
/**
* Delegate the conditional checks which are customized from
* the simpler default Survloop existing thus far.
* This overrides the parseConditions function in
* RockHopSoft\Survloop\Controllers\Tree\TreeSurvConds.
* Return 0 or 1 (instead of -1) to override.
*
* @param int $nID
* @param string $condition
* @return int
*/
protected function checkNodeConditionsCustom($nID, $condition = '')
{
$extension = $this->extensionCheckNodeConditions($nID, $condition);
if (in_array($extension, [0, 1])) {
return $extension;
}
$complaint = null;
if (isset($this->sessData->dataSets["complaints"])
&& isset($this->sessData->dataSets["complaints"][0])
Expand Down Expand Up @@ -155,6 +162,21 @@ protected function checkNodeConditionsCustom($nID, $condition = '')
}
return -1;
}

/**
* Delegate the conditional checks which are customized from
* the simpler default OpenPolice.org & Survloop existing thus far.
* Return 0 or 1 (instead of -1) to override.
* e.g. flexyourrights/openpolice-extension
*
* @param int $nID
* @param string $condition
* @return int
*/
protected function extensionCheckNodeConditions($nID, $condition = '')
{
return -1;
}

/**
* Checks whether or not this incident began
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/OpenComplaintEmails.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.0.12
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/OpenComplaintPrints.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.0.12
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand Down
25 changes: 21 additions & 4 deletions src/Controllers/OpenComplaintSaves.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.0.12
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand All @@ -26,14 +26,18 @@ class OpenComplaintSaves extends OpenComplaintConditions
/**
* Override default behavior for submitting survey forms,
* delegateing specifc saving procedures for custom nodes.
* This overrides the postNodePublic function in
* RockHopSoft\Survloop\Controllers\Tree\TreeSurvInput.
*
* @param int $nID
* @param string $nIDtxt
* @param array $tmpSubTier
* @param TreeNodeSurv $curr
* @return boolean
*/
protected function postNodePublicCustom(&$curr)
{
$extension = $this->extensionPostNodePublic($curr);
if ($extension !== false) {
return $extension;
}
$nID = $curr->nID;
if (empty($tmpSubTier)) {
$tmpSubTier = $this->loadNodeSubTier($nID);
Expand Down Expand Up @@ -89,6 +93,19 @@ protected function postNodePublicCustom(&$curr)
}
return false; // false to continue standard post processing
}

/**
* Override default behavior for submitting survey forms,
* delegateing specifc saving procedures for custom nodes.
* e.g. flexyourrights/openpolice-extension
*
* @param TreeNodeSurv $curr
* @return boolean
*/
protected function extensionPostNodePublic(&$curr)
{
return false; // false to continue standard post processing
}

/**
* Store the start date — and optionally start time — of the incident.
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/OpenDashAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.0.12
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/OpenDeptStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.2.18
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/OpenDepts.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.0.12
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/OpenDevelopment.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* OpenPolice.org
* @package flexyourrights/openpolice
* @author Morgan Lesko <rockhoppers@runbox.com>
* @author Morgan Lesko <morgan@flexyourrights.org>
* @since v0.2.1
*/
namespace FlexYourRights\OpenPolice\Controllers;
Expand Down
Loading

0 comments on commit 4631d6c

Please sign in to comment.