Skip to content

Commit ccc9b5b

Browse files
boneliferclaude
andauthored
Add NV Newspage screenshots (#32)
Posts three example news topics in place of the welcome topic, makes the board's first forum the news forum with poster information and post buttons off, and saves the news page, a news item, the ACP settings and the phone layout. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ecfe56d commit ccc9b5b

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

‎phpbb-test-board/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ Saves PNG screenshots of an extension's or style's pages with [Playwright](https
110110

111111
`phpbbmodders/knowledgebase` makes its own categories, articles (live, waiting for review, with a revision, and a draft) and forum questions, so a board search for `backup` shows its block; `--seed` with seed-forum's standard fixtures adds members to write them. Its two ACP pages are taken in full, so a new setting is not cut off.
112112

113+
`phpbbmodders/newspage` replaces the board's welcome topic with three example news topics and makes that forum the news forum, with poster information and post buttons off. It saves the news page, one news item, the ACP settings (in full) and the news page on a phone, then the news page three more times: with poster information and post buttons on, shortened to 120 characters, and without the filters.
114+
113115
For example, ProMinoDeux's screenshots:
114116

115117
```bash

‎phpbb-test-board/screenshots.py‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,10 +851,85 @@ def hide_who_is_online(p) -> None:
851851
selector="#page-body", prepare=hide_who_is_online)
852852

853853

854+
NEWSPAGE_NEWS = [
855+
("Board upgraded to the latest phpBB release",
856+
"We have moved the board to the latest phpBB release. Pages load faster, and the editor now "
857+
"remembers your draft if you lose your connection.\n\n[b]What you need to do:[/b] nothing. "
858+
"If something looks wrong, clear your browser cache and let us know in the Support forum."),
859+
("New members' area is open",
860+
"The members' area now has its own forum for introductions and project showcases. "
861+
"Say hello, tell us what you are working on, and share screenshots of your setup."),
862+
("Scheduled maintenance this weekend",
863+
"The board will be read-only for about an hour on Saturday morning while we move to a new server. "
864+
"Posts made just before the move are kept."),
865+
]
866+
867+
NEWSPAGE_SEED = r"""
868+
require_once $phpbb_root_path . 'includes/functions_posting.php';
869+
require_once $phpbb_root_path . 'includes/functions_admin.php';
870+
// the install's welcome topic is in the same forum; the news page shows only the example news
871+
delete_topics('forum_id', [2]);
872+
$news = json_decode(%s, true);
873+
$keep = $user->data;
874+
$user->data = array_merge($keep, ['user_id' => 2, 'username' => 'admin', 'user_ip' => '127.0.0.1',
875+
'is_registered' => true, 'is_bot' => false]);
876+
$auth->acl($user->data);
877+
$ids = [];
878+
foreach ($news as $i => $item) {
879+
list($subject, $message) = $item;
880+
$uid = $bitfield = '';
881+
$options = 0;
882+
generate_text_for_storage($message, $uid, $bitfield, $options, true, true, true);
883+
$d = ['forum_id' => 2, 'topic_id' => 0, 'topic_title' => $subject, 'icon_id' => 0, 'poster_id' => 2,
884+
'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => false,
885+
'message' => $message, 'message_md5' => md5($message), 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield,
886+
'enable_indexing' => true, 'notify' => false, 'notify_set' => false, 'post_edit_locked' => false,
887+
'topic_time_limit' => 0, 'topic_status' => ITEM_UNLOCKED, 'forum_name' => '',
888+
'force_approved_state' => ITEM_APPROVED, 'post_time' => time() - (count($news) - $i) * 86400];
889+
$poll = [];
890+
submit_post('post', $subject, '', POST_NORMAL, $poll, $d);
891+
$ids[] = (int) $d['topic_id'];
892+
}
893+
$user->data = $keep;
894+
echo "\nNEWS-TOPICS:" . json_encode($ids) . "\n";
895+
"""
896+
897+
898+
def shots_newspage(board: Board, shoot: Shooter, args: argparse.Namespace) -> None:
899+
"""phpbbmodders/newspage: the news page, one news item and the ACP settings.
900+
901+
Replaces the install's welcome topic in the board's first forum with three
902+
news topics and makes it the news forum. Poster information and the post
903+
buttons are turned off, so the news text stands out; the other settings
904+
stay at their defaults. Three more shots of the news page show it with
905+
poster information and post buttons on (as the admin, who sees every
906+
button), with the news shortened to 120 characters, and without the
907+
forum and date filters.
908+
"""
909+
out = board.php(NEWSPAGE_SEED % php_string(json.dumps(NEWSPAGE_NEWS)), check=True)
910+
topics = json.loads(out.split("NEWS-TOPICS:")[1].split()[0])
911+
set_config(board, {"news_forums": "2", "news_user_info": "0", "news_post_buttons": "0"})
912+
913+
shoot.shot("newspage-news", "app.php/news")
914+
shoot.shot("newspage-single", f"app.php/news/{topics[0]}")
915+
shoot.shot("newspage-acp-settings", "adm/index.php?i=-phpbbmodders-newspage-acp-main_module&mode=settings&sid={sid}",
916+
admin=True, full_page=True)
917+
shoot.shot("newspage-news-phone", "app.php/news", phone=True)
918+
919+
# The same page with other settings, one change at a time
920+
set_config(board, {"news_user_info": "1", "news_post_buttons": "1"})
921+
shoot.shot("newspage-news-full", "app.php/news?sid={sid}", admin=True)
922+
set_config(board, {"news_user_info": "0", "news_post_buttons": "0", "news_char_limit": "120"})
923+
shoot.shot("newspage-news-shortened", "app.php/news")
924+
set_config(board, {"news_char_limit": "500", "news_cat_show": "0", "news_archive_show": "0"})
925+
shoot.shot("newspage-news-no-filters", "app.php/news")
926+
927+
854928
SHOTS = {
855929
"phpbbmodders/contactadmin": shots_contactadmin,
856930
"phpbbmodders/documentation": shots_documentation,
857931
"phpbbmodders/knowledgebase": shots_knowledgebase,
932+
"phpbbmodders/newspage": shots_newspage,
858933
"phpbbmodders/sfscompanion": shots_sfscompanion,
859934
"phpbbmodders/stopforumspam": shots_stopforumspam,
860935
"phpbbmodders/wiki": shots_wiki,

0 commit comments

Comments
 (0)