From f1cd1a5c6c2874be62bb38ef51a7ce9871b261f2 Mon Sep 17 00:00:00 2001 From: unimatrixgit <95320811+unimatrixgit@users.noreply.github.com> Date: Mon, 16 Nov 2026 19:46:07 +0100 Subject: [PATCH] design: compact illustrated internal boards with native controls --- docs/design/SYSTEM-BOARDS.md | 4 ++ .../mybb/inc/plugins/dune_accounts.php | 1 + .../mybb/provision-system-boards.php | 9 ++- .../integrations/mybb/system-board-embed.php | 29 +++++++--- website/integrations/mybb/system-board.css | 58 +++++++++++++++++++ .../mybb/test-system-board-embed.php | 30 ++++++++++ .../mybb/test-system-board-native.php | 2 +- 7 files changed, 122 insertions(+), 11 deletions(-) create mode 100644 website/integrations/mybb/system-board.css create mode 100644 website/integrations/mybb/test-system-board-embed.php diff --git a/docs/design/SYSTEM-BOARDS.md b/docs/design/SYSTEM-BOARDS.md index 780bc925..ebcebb72 100644 --- a/docs/design/SYSTEM-BOARDS.md +++ b/docs/design/SYSTEM-BOARDS.md @@ -52,3 +52,7 @@ Ordinary SSH as unimatrix works; sudo -n currently requires interactive authenti ## Deleted organisations On clan deletion, current central membership grants disappear. Preserve forum history and let native MyBB autoprune handle eventual post cleanup. No custom clan/forum deletion or cleanup worker is required (user decision, 16 November 2026). + +## Compact internal view + +The first board batch is live from main 39bb5486 (PR #351, CI #354); the four existing active clans have private forums. Native MyBB permission merging passed 52 checks. The user has posted a test thread successfully. The following styling batch gives embedded CP pages a separate green/gold dev presentation and shared palace background, small author rows, no public-profile decoration or signatures, and a full-forum link. Category defaults use MyBB’s native collapse cookie once, then respect the user preference. No custom deletion/pruning worker is needed. diff --git a/website/integrations/mybb/inc/plugins/dune_accounts.php b/website/integrations/mybb/inc/plugins/dune_accounts.php index 6b19d657..e307b637 100644 --- a/website/integrations/mybb/inc/plugins/dune_accounts.php +++ b/website/integrations/mybb/inc/plugins/dune_accounts.php @@ -7,6 +7,7 @@ if(is_file(MYBB_ROOT.'system-board-membership.php')){ require_once MYBB_ROOT.'system-board-policy.php'; require_once MYBB_ROOT.'system-board-embed.php'; $plugins->add_hook('pre_output_page','dune_system_board_embed',20); + $plugins->add_hook('index_start','dune_system_board_default_collapse'); } $plugins->add_hook('global_intermediate','dune_central_account_permissions'); $plugins->add_hook('usercp_menu','dune_central_account_menu',1); diff --git a/website/integrations/mybb/provision-system-boards.php b/website/integrations/mybb/provision-system-boards.php index 22b0b60a..c8714ec2 100644 --- a/website/integrations/mybb/provision-system-boards.php +++ b/website/integrations/mybb/provision-system-boards.php @@ -48,9 +48,14 @@ try { foreach ($input['organisations'] as $org) { $board = make_board($org['kind'], $org['id'], $org['name'], (int)($org['kind']==='clan' ? $clans['fid'] : $companies['fid']), 'f'); foreach (['member_gid','leader_gid'] as $field) { - if ((int)$board[$field] > 0) continue; + $role=$field==='leader_gid'?'leaders':'members'; + $title=my_substr(($org['kind']==='clan'?'Clan':'Company').' '.$role.' · '.$org['name'],0,45); + if ((int)$board[$field] > 0) { + $db->update_query('usergroups',['title'=>$db->escape_string($title)],'gid='.(int)$board[$field]); + continue; + } $group = $groups[2]; unset($group['gid']); - $group['title'] = 'System Board '.substr(hash('sha256', $org['kind'].':'.$org['id']),0,12).' '.$field; + $group['title'] = $title; $group['cancp'] = 0; $group['issupermod'] = 0; $group['canmodcp'] = $field==='leader_gid' ? 1 : 0; foreach ($group as $key=>$value) if (is_string($value)) $group[$key]=$db->escape_string($value); $gid = (int)$db->insert_query('usergroups', $group); diff --git a/website/integrations/mybb/system-board-embed.php b/website/integrations/mybb/system-board-embed.php index ddd4a4fa..28abc9ee 100644 --- a/website/integrations/mybb/system-board-embed.php +++ b/website/integrations/mybb/system-board-embed.php @@ -1,25 +1,38 @@ table_exists('dune_system_boards')) { - $root=$db->fetch_array($db->simple_select('dune_system_boards','fid',"kind='system' AND organisation_id='root'")); - $fid=(int)($root['fid'] ?? 0); - if ($fid>0) $page=str_replace('','',$page); - } if (($_GET['dune_embed'] ?? '') !== '1') return; $fid=(int)($_GET['fid'] ?? 0); $identity=$GLOBALS['dune_system_board_identity'] ?? []; $boards=dune_system_board_registry(); $parents=[]; $query=$db->simple_select('forums','fid,pid'); while($row=$db->fetch_array($query))$parents[(int)$row['fid']]=(int)$row['pid']; + $manage=''; foreach($identity['systemBoards']['organisations'] ?? [] as $grant){ $board=$boards[($grant['kind'] ?? '').':'.($grant['id'] ?? '')] ?? null; if(!$board||($grant['manage'] ?? false)!==true||!dune_board_descendant($fid,(int)$board['fid'],$parents))continue; $href='/system-board-manage.php?kind='.rawurlencode($grant['kind']).'&organisation='.rawurlencode($grant['id']).'&dune_embed=1'; - $page=preg_replace('/(]*>)/i','$1
Manage board · Add forum or category
',$page,1); + $manage='Manage board'; } - $style = ''; + $page=preg_replace_callback('/]*)>/i',function($match){$attributes=$match[1];if(str_contains($attributes,'class="'))$attributes=str_replace('class="','class="dune-board-embedded ',$attributes);else $attributes.=' class="dune-board-embedded"';return '';},$page,1); + $path=parse_url($_SERVER['REQUEST_URI'] ?? '/index.php',PHP_URL_PATH);if(!in_array($path,['/forumdisplay.php','/showthread.php'],true))$path='/index.php'; + $params=$_GET;unset($params['dune_embed']);$outside='https://forums.dunerealms.com'.$path.($params?'?'.http_build_query($params):''); + $toolbar='
Internal BoardsPrivate conversations · Your organisation
'; + $page=preg_replace('/(]*>)/i','$1'.$toolbar,$page,1); + $style = ''; $script = <<<'JS' - + JS; $page = str_replace('', $style.'', $page); $page = str_replace('', $script.'', $page); } + +// Initialize once, then let MyBB's existing category expander and cookie keep +// the user's preference. No second collapse implementation or local storage. +function dune_system_board_default_collapse(): void { + global $mybb,$db,$collapse,$collapsed,$collapsedimg,$collapsedthead; + if(!empty($mybb->cookies['dune_system_board_default'])||!$db->table_exists('dune_system_boards'))return; + $root=$db->fetch_array($db->simple_select('dune_system_boards','fid',"kind='system' AND organisation_id='root'")); + if(empty($root['fid']))return;$key='cat_'.(int)$root['fid']; + $collapse=array_values(array_unique(array_merge($collapse??[],[$key]))); + $collapsed[$key.'_e']='display: none;';$collapsedimg[$key]='_collapsed';$collapsedthead[$key]=' thead_collapsed'; + my_setcookie('collapsed',implode('|',$collapse));my_setcookie('dune_system_board_default','1'); +} diff --git a/website/integrations/mybb/system-board.css b/website/integrations/mybb/system-board.css new file mode 100644 index 00000000..91e905c1 --- /dev/null +++ b/website/integrations/mybb/system-board.css @@ -0,0 +1,58 @@ +/* Internal CP view only. The public forum keeps its original theme. */ +html:has(body.dune-board-embedded){height:auto!important;min-height:0!important;background:#102b25} +body.dune-board-embedded{--board-ink:#e1e8dd;--board-muted:#b2c5b8;--board-gold:#e1c37f;--board-line:#496355;box-sizing:border-box!important;min-width:0!important;min-height:0!important;height:auto!important;margin:0!important;padding:16px!important;color:var(--board-ink)!important;font:14px/1.6 system-ui,sans-serif!important;background:linear-gradient(125deg,#102d27ed,#142d28f5),url('https://www.dunerealms.com/assets/political-imperial-chamber-v1.png') center top/cover!important} +body.dune-board-embedded *{box-sizing:border-box} +body.dune-board-embedded :is(#header,#footer,#copyright,.navigation,.breadcrumb,.dune-site-header,.dune-memorial,.dune-shared-header,.dune-shared-footer){display:none!important} +body.dune-board-embedded :is(#container,#content,.wrapper){width:100%!important;min-width:0!important;max-width:100%!important;height:auto!important;min-height:0!important;padding:0!important;margin:0!important;background:transparent!important;border:0!important;box-shadow:none!important;overflow-wrap:anywhere} +body.dune-board-embedded .system-board-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin:0 0 18px;padding:14px 16px;border:1px solid #b49b57;border-radius:10px;background:linear-gradient(110deg,#1f4638ed,#142e29e6),url('https://www.dunerealms.com/assets/political-imperial-chamber-v1.png') center/cover;box-shadow:0 6px 22px #0002} +body.dune-board-embedded .system-board-toolbar strong{color:var(--board-gold);font-size:16px;letter-spacing:.02em} +body.dune-board-embedded .system-board-toolbar small{display:block;color:var(--board-muted);font-size:12px} +body.dune-board-embedded .system-board-toolbar nav{display:flex;flex-wrap:wrap;gap:8px} +body.dune-board-embedded :is(a, .largetext a){color:var(--board-gold)!important} +body.dune-board-embedded :is(a.button,button,input.button,input[type=submit],.postbit_buttons a,.system-board-toolbar a){display:inline-flex;align-items:center;justify-content:center;gap:6px;max-width:100%;min-height:36px;padding:7px 12px!important;border:1px solid #8e864d!important;border-radius:7px!important;background:#234838!important;color:#f2dda4!important;font:600 13px/1.4 system-ui,sans-serif!important;text-decoration:none!important;white-space:normal!important;vertical-align:middle} +body.dune-board-embedded :is(button,input[type=submit],.system-board-toolbar a):hover{background:#315c46!important;border-color:#ddc079!important} +body.dune-board-embedded :is(input,select,textarea){min-width:0!important;max-width:100%!important;border:1px solid #4a6c5b!important;border-radius:6px!important;background:#102c25!important;color:var(--board-ink)!important;padding:7px!important;font:inherit!important} +body.dune-board-embedded textarea{width:100%!important;resize:vertical} +body.dune-board-embedded :is(table.tborder,table.tborder>tbody){max-width:100%!important} +body.dune-board-embedded table.tborder{width:100%!important;table-layout:auto;border:1px solid var(--board-line)!important;border-spacing:0!important;border-radius:9px!important;overflow:hidden;background:#15352c!important;margin:12px 0!important} +body.dune-board-embedded table.tborder :is(td,th){min-width:0!important;overflow-wrap:anywhere;padding:10px!important;border-color:#385345!important;color:var(--board-ink)!important} +body.dune-board-embedded :is(.thead,.tcat){background:#23483a!important;color:#f2dda4!important;font-size:13px!important} +body.dune-board-embedded :is(.trow1,.trow2){background:#16362c!important;color:var(--board-ink)!important} +body.dune-board-embedded :is(.tfoot,.trow_sep){background:#1d4032!important;color:var(--board-muted)!important} +body.dune-board-embedded [nowrap]{white-space:normal!important} +body.dune-board-embedded :is(.float_left,.float_right){max-width:100%;margin-bottom:8px} +body.dune-board-embedded :is(.pagination,.multipage){max-width:100%;white-space:normal!important} +body.dune-board-embedded .post{width:100%!important;min-width:0!important;margin:14px 0!important;border:1px solid var(--board-line)!important;border-radius:9px!important;background:#14342b!important;overflow:hidden} +body.dune-board-embedded .post .post_author{display:flex!important;align-items:center;gap:12px;flex-wrap:wrap;float:none!important;width:100%!important;min-width:0!important;max-width:100%!important;padding:12px 14px!important;border:0!important;border-bottom:1px solid #506d52!important;background:linear-gradient(110deg,#234b3d,#19372f)!important} +body.dune-board-embedded .post .post_author::before,body.dune-board-embedded .post .post_author::after{display:none!important} +body.dune-board-embedded .post .author_information{float:none!important;width:auto!important;min-width:0!important;flex:1;padding:0!important;margin:0!important;font-size:13px!important} +body.dune-board-embedded .post .author_information .largetext{font-size:14px!important;line-height:1.4!important} +body.dune-board-embedded :is(.author_statistics,.dune-author-recognition,.dune-author-bio,.dune-clan-emblem,.dune-author-clan,.signature,.dune-managed-signature-panel){display:none!important} +body.dune-board-embedded .author_information :is(.smalltext,img,br){display:none!important} +body.dune-board-embedded .post .author_avatar{float:none!important;flex:0 0 32px;width:32px!important;height:32px!important;margin:0!important;overflow:hidden;border-radius:6px} +body.dune-board-embedded .author_avatar img{display:block;width:32px!important;height:32px!important;max-width:32px!important;padding:0!important;border:0!important} +body.dune-board-embedded .author_avatar span[role=img]{transform:scale(.5);transform-origin:top left} +body.dune-board-embedded .post :is(.post_content,.post_body,.post_head){width:100%!important;min-width:0!important;max-width:100%!important;float:none!important} +body.dune-board-embedded .post .post_content{padding:14px!important;background:#14342b!important} +body.dune-board-embedded .post_body{overflow-wrap:anywhere;line-height:1.75!important;color:var(--board-ink)!important} +body.dune-board-embedded .post_body :is(img,video,iframe){max-width:100%!important;height:auto} +body.dune-board-embedded .post_body pre{max-width:100%;overflow:auto;white-space:pre-wrap} +body.dune-board-embedded .post_controls{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;padding:9px!important;background:#1a3b2e!important} +body.dune-board-embedded .postbit_buttons{display:flex;gap:4px;flex-wrap:wrap;float:none!important} +body.dune-board-embedded .postbit_buttons a{margin:0!important} +body.dune-board-embedded :is(.sceditor-container,.sceditor-container iframe,.sceditor-container textarea){width:100%!important;max-width:100%!important;min-width:0!important} +body.dune-board-embedded .sceditor-toolbar{white-space:normal!important} +@media(max-width:760px){ + body.dune-board-embedded{padding:10px!important} + body.dune-board-embedded .system-board-toolbar{padding:12px;align-items:flex-start} + body.dune-board-embedded table.tborder :is(td,th){padding:7px!important;font-size:12px!important} + body.dune-board-embedded .post .post_author{padding:10px!important} + body.dune-board-embedded :is(.float_left,.float_right){float:none!important;display:flex;gap:6px;flex-wrap:wrap} + body.dune-board-embedded .thead .float_right{margin-top:8px} + body.dune-board-embedded :is(#quickreply_e,form table.tborder)>tbody>tr{display:flex;flex-wrap:wrap} + body.dune-board-embedded :is(#quickreply_e,form table.tborder)>tbody>tr>td{width:100%!important} +} + +body.dune-board-embedded .dune-author-identity{display:contents!important} + +body.dune-board-embedded label{color:var(--board-ink)!important} diff --git a/website/integrations/mybb/test-system-board-embed.php b/website/integrations/mybb/test-system-board-embed.php new file mode 100644 index 00000000..2982c286 --- /dev/null +++ b/website/integrations/mybb/test-system-board-embed.php @@ -0,0 +1,30 @@ +['fid'=>12]];} +function my_setcookie($key,$value){$GLOBALS['cookies_written'][$key]=$value;} +class BoardFixtureDatabase { + function table_exists($name){return true;} + function simple_select($table,...$unused){return (object)['rows'=>$table==='forums'?[['fid'=>12,'pid'=>0],['fid'=>13,'pid'=>12]]:[['fid'=>50]],'index'=>0];} + function fetch_array($query){return $query->rows[$query->index++]??false;} +} +$db=new BoardFixtureDatabase(); +function check_embed($ok,$message){if(!$ok)throw new RuntimeException($message);} +$original='
Thread content
'; +$_GET=[];$html=$original;dune_system_board_embed($html);check_embed($html===$original,'Public forum output was changed'); +$_GET=['fid'=>'13','dune_embed'=>'1'];$_SERVER['REQUEST_URI']='/forumdisplay.php?fid=13&dune_embed=1'; +$GLOBALS['dune_system_board_identity']=['systemBoards'=>['organisations'=>[['kind'=>'clan','id'=>'ours','manage'=>true]]]]; +$html=$original;dune_system_board_embed($html); +check_embed(str_contains($html,'class="dune-board-embedded dune-forum"'),'Embedded body scope missing'); +check_embed(str_contains($html,'/system-board.css?v=dev1'),'Embedded stylesheet missing'); +check_embed(str_contains($html,'>Manage board'),'Own-subtree management link missing'); +check_embed(str_contains($html,'href="https://forums.dunerealms.com/forumdisplay.php?fid=13"'),'External link did not leave the compact view'); +check_embed(str_contains($html,'data-system-board-external'),'Full forum link can be overwritten by embedded navigation'); +$_GET['fid']='99';$html=$original;dune_system_board_embed($html);check_embed(!str_contains($html,'>Manage board'),'Management link escaped own subtree'); +$mybb=(object)['cookies'=>[]];$collapse=['cat_4'];$collapsed=$collapsedimg=$collapsedthead=[];$cookies_written=[]; +dune_system_board_default_collapse(); +check_embed($collapsed['cat_50_e']==='display: none;'&&$collapsedimg['cat_50']==='_collapsed','Native initial collapsed state missing'); +check_embed($cookies_written['collapsed']==='cat_4|cat_50','Existing native collapse preferences were overwritten'); +$mybb->cookies['dune_system_board_default']='1';$cookies_written=[];dune_system_board_default_collapse();check_embed($cookies_written===[],'Native expander preference was reset'); +echo "System board embed: 10 checks passed\n"; diff --git a/website/integrations/mybb/test-system-board-native.php b/website/integrations/mybb/test-system-board-native.php index 6a9ec792..e7bf2bf1 100644 --- a/website/integrations/mybb/test-system-board-native.php +++ b/website/integrations/mybb/test-system-board-native.php @@ -5,7 +5,7 @@ $_SERVER['SCRIPT_NAME']='/dune-sso.php'; $_SERVER['REQUEST_METHOD']='GET'; $_SERVER['REMOTE_ADDR']='127.0.0.1'; $_SERVER['HTTP_HOST']='forums.dunerealms.com'; define('IN_MYBB',1); chdir('/home/dunerealms/apps/integrations/mybb'); ob_start(); require 'global.php'; ob_end_clean(); -require_once __DIR__.'/system-board-membership.php'; +if(!function_exists('dune_system_board_registry'))require_once __DIR__.'/system-board-membership.php'; $boards=dune_system_board_registry(); $count=0; if (!$boards) throw new RuntimeException('No organisation boards were provisioned'); foreach ($boards as $key=>$board) {