Initial push
This commit is contained in:
@@ -3,13 +3,16 @@
|
||||
/**
|
||||
* Name: DSC01 DSC Categories
|
||||
* Description: Public civic diagnostic — the legal surfaces where HOA governance disputes manifest.
|
||||
* Version: 0.2.0
|
||||
* Version: 0.3.0
|
||||
* MinVersion: 11.0
|
||||
* MaxVersion: 12.0
|
||||
*/
|
||||
|
||||
use Zotlabs\Extend\Widget;
|
||||
|
||||
require_once 'addon/dsc01/dsc01_renderer.php';
|
||||
require_once 'addon/dsc01/dsc01_spool.php';
|
||||
|
||||
function dsc01_module() {}
|
||||
|
||||
function dsc01_load() {
|
||||
@@ -101,7 +104,7 @@ function dsc01_access_state($association_slug = '') {
|
||||
intval($prof_gid),
|
||||
dbesc($observer)
|
||||
);
|
||||
if ($r) return 'participant';
|
||||
if ($r) return 'professional';
|
||||
}
|
||||
|
||||
return 'public';
|
||||
@@ -127,7 +130,7 @@ function dsc01_access_wall($association_slug = '') {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// CONTENT
|
||||
// CONTENT ROUTER
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function dsc01_content() {
|
||||
@@ -139,38 +142,50 @@ function dsc01_content() {
|
||||
}
|
||||
|
||||
$association_slug = argv(1) ?? '';
|
||||
$sub_route = strtolower(argv(2) ?? '');
|
||||
|
||||
// Index — list the ten DSC categories
|
||||
if (!$association_slug) {
|
||||
return dsc01_render_index();
|
||||
}
|
||||
|
||||
$raw = @file_get_contents('addon/vs01/config.json');
|
||||
$cfg = $raw ? json_decode($raw, true) : [];
|
||||
if (json_last_error() !== JSON_ERROR_NONE || !isset($cfg['associations'][$association_slug])) {
|
||||
return dsc01_render_not_found();
|
||||
}
|
||||
|
||||
$access = dsc01_access_state($association_slug);
|
||||
|
||||
// dsc01 is public — access wall only gates submission, not reading
|
||||
// Manage route — operator only (stub)
|
||||
if ($sub_route === 'manage') {
|
||||
if ($access !== 'operator') {
|
||||
return dsc01_access_wall($association_slug);
|
||||
}
|
||||
return dsc01_render_manage($association_slug);
|
||||
}
|
||||
|
||||
// POST — submission handler
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if ($access === 'public') {
|
||||
return dsc01_access_wall($association_slug);
|
||||
}
|
||||
// TODO: handle POST submission
|
||||
return dsc01_access_wall($association_slug);
|
||||
if (!dsc01_verify_csrf()) {
|
||||
return '<div class="alert alert-danger">Invalid form token. Please reload and try again.</div>';
|
||||
}
|
||||
return dsc01_handle_post($association_slug, $access);
|
||||
}
|
||||
|
||||
return dsc01_render_main($access);
|
||||
// Association landing — checklist
|
||||
return dsc01_render_landing($association_slug, $access);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// RENDER
|
||||
// NOT FOUND
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function dsc01_render_main($access) {
|
||||
$out = '<div class="dsc01-content">';
|
||||
$out .= '<div class="dsc01-header mb-3">';
|
||||
$out .= '<h2>Categories</h2>';
|
||||
$out .= '<p class="text-muted">The legal surfaces where HOA governance disputes manifest, organized from the homeowner\'s perspective.</p>';
|
||||
$out .= '</div>';
|
||||
|
||||
// TODO: render DSC categories
|
||||
|
||||
$out .= '<div class="dsc01-placeholder text-muted fst-italic">Content forthcoming.</div>';
|
||||
$out .= '</div>';
|
||||
|
||||
return $out;
|
||||
function dsc01_render_not_found() {
|
||||
return '<div class="dsc01-content"><div class="alert alert-warning">Association not found.</div></div>';
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user