Version 98.1 by Super Admin on 2026/03/20 18:16

Show last authors
1 {{velocity}}
2 ## ===== 学校ページ テンプレート =====
3 ## ゲストが ?sheet= 付きURL(編集フォーム等)に直接アクセスした場合、ログインページへリダイレクト
4 #if($xcontext.user == 'XWiki.XWikiGuest' && $request.sheet && $request.sheet != '')
5 #set($currentUrl = $doc.getURL('view', "sheet=${request.sheet}"))
6 $response.sendRedirect("/bin/login/XWiki/XWikiLogin?srid=$escapetool.url($currentUrl)")
7 #stop
8 #end
9 {{html clean="false"}}
10 ## メンテナンスバナー({{include}}ではなくインラインで記述し、<p>タグ挿入を回避)
11 #set($bannerDoc = $xwiki.getDocument('SeitokaiAdmin.MaintenanceBanner'))
12 #set($bannerObj = $bannerDoc.getObject('SeitokaiCode.MaintenanceBannerClass'))
13 #if($bannerObj && $bannerObj.getValue('enabled') == 1)
14 #set($bannerMsg = $bannerObj.getValue('message'))
15 #set($bannerLevel = $bannerObj.getValue('level'))
16 #if(!$bannerLevel || $bannerLevel == '')#set($bannerLevel = 'warning')#end
17 <div class="maintenance-banner active maintenance-${bannerLevel}" id="maintenance-banner">
18 <div class="maintenance-banner-inner">
19 <span class="maintenance-icon">#if($bannerLevel == 'urgent')<svg class="ico-banner" viewBox="0 0 24 24"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>#elseif($bannerLevel == 'info')<svg class="ico-banner" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>#else<svg class="ico-banner" viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"/></svg>#end</span>
20 <span class="maintenance-text">$!escapetool.xml($bannerMsg)</span>
21 <button class="maintenance-close" onclick="document.getElementById('maintenance-banner').style.display='none'">&times;</button>
22 </div>
23 </div>
24 #end
25 ## --- 学校基本情報フィールド ---
26 #set($schoolCode = $doc.getValue('schoolCode'))
27 #set($schoolName = $doc.getValue('schoolName'))
28 #set($prefecture = $doc.getValue('prefecture'))
29 #set($city = $doc.getValue('city'))
30 #set($classCount = $doc.getValue('classCount'))
31 #set($studentCount = $doc.getValue('studentCount'))
32 #set($coeducation = $doc.getValue('coeducation'))
33 #set($establishment = $doc.getValue('establishment'))
34 #set($schoolLevel = $doc.getValue('schoolLevel'))
35 #set($schoolSystem = $doc.getValue('schoolSystem'))
36 #set($website = $doc.getValue('website'))
37 #set($schoolPhoto = $doc.getValue('schoolPhoto'))
38 #set($schoolDescription = $doc.getValue('schoolDescription'))
39
40 ## --- 生徒会組織 ---
41 #set($orgChart = $doc.getValue('orgChart'))
42 #set($orgChartImage = $doc.getValue('orgChartImage'))
43
44 ## --- 日常の活動・選挙・定例活動 ---
45 #set($dailyActivities = $doc.getValue('dailyActivities'))
46 #set($dailyActivitiesNote = $doc.getValue('dailyActivitiesNote'))
47 #set($electionExists = $doc.getValue('electionExists'))
48 #set($electionType = $doc.getValue('electionType'))
49 #set($electionNote = $doc.getValue('electionNote'))
50 #set($meetingFrequency = $doc.getValue('meetingFrequency'))
51 #set($regularActivitiesNote = $doc.getValue('regularActivitiesNote'))
52
53 ## --- 予算 ---
54 #set($budgetProcess = $doc.getValue('budgetProcess'))
55 #set($studentFee = $doc.getValue('studentFee'))
56 #set($budgetScale = $doc.getValue('budgetScale'))
57 #set($budgetAllocation = $doc.getValue('budgetAllocation'))
58 #set($budgetNote = $doc.getValue('budgetNote'))
59
60 ## --- 校則・生徒会会則の見直し ---
61 #set($ruleReviewStatus = $doc.getValue('ruleReviewStatus'))
62 #set($ruleReviewContent = $doc.getValue('ruleReviewContent'))
63 #set($ruleReviewProposer = $doc.getValue('ruleReviewProposer'))
64 #set($ruleReviewImplementer = $doc.getValue('ruleReviewImplementer'))
65 #set($ruleReviewSystem = $doc.getValue('ruleReviewSystem'))
66
67 ## --- 活動環境 ---
68 #set($activityPlace = $doc.getValue('activityPlace'))
69 #set($activityRoomEquipment = $doc.getValue('activityRoomEquipment'))
70 #set($activityRoomImage = $doc.getValue('activityRoomImage'))
71 #set($ictTools = $doc.getValue('ictTools'))
72 #set($ictUsage = $doc.getValue('ictUsage'))
73
74 ## --- 生徒総会 ---
75 #set($assemblyFormat = $doc.getValue('assemblyFormat'))
76 #set($assemblyCount = $doc.getValue('assemblyCount'))
77 #set($assemblyAgenda = $doc.getValue('assemblyAgenda'))
78 #set($assemblyTopics = $doc.getValue('assemblyTopics'))
79 #set($assemblyNote = $doc.getValue('assemblyNote'))
80
81 ## --- 広報 ---
82 #set($publicityMethod = $doc.getValue('publicityMethod'))
83 #set($publicityFrequency = $doc.getValue('publicityFrequency'))
84 #set($publicityNote = $doc.getValue('publicityNote'))
85
86 ## --- 外部連携 ---
87 #set($externalCooperation = $doc.getValue('externalCooperation'))
88 #set($externalOrgName = $doc.getValue('externalOrgName'))
89 #set($socialParticipation = $doc.getValue('socialParticipation'))
90
91 ## --- 年間主要行事 ---
92 #set($eventApril = $doc.getValue('eventApril'))
93 #set($eventMay = $doc.getValue('eventMay'))
94 #set($eventJune = $doc.getValue('eventJune'))
95 #set($eventJuly = $doc.getValue('eventJuly'))
96 #set($eventAugust = $doc.getValue('eventAugust'))
97 #set($eventSeptember = $doc.getValue('eventSeptember'))
98 #set($eventOctober = $doc.getValue('eventOctober'))
99 #set($eventNovember = $doc.getValue('eventNovember'))
100 #set($eventDecember = $doc.getValue('eventDecember'))
101 #set($eventJanuary = $doc.getValue('eventJanuary'))
102 #set($eventFebruary = $doc.getValue('eventFebruary'))
103 #set($eventMarch = $doc.getValue('eventMarch'))
104
105 ## --- 課題・連絡先 ---
106 #set($challenges = $doc.getValue('challenges'))
107 #set($contactInfo = $doc.getValue('contactInfo'))
108 #set($seitokaiWebsite = $doc.getValue('seitokaiWebsite'))
109 #set($seitokaiTwitter = $doc.getValue('seitokaiTwitter'))
110 #set($seitokaiInstagram = $doc.getValue('seitokaiInstagram'))
111 #set($seitokaiYoutube = $doc.getValue('seitokaiYoutube'))
112 #set($seitokaiOtherSns = $doc.getValue('seitokaiOtherSns'))
113
114 ## --- 現在の年度を計算(4月始まり) ---
115 #set($nowFY = $datetool.date)
116 #set($currentFYMonth = $mathtool.toInteger($datetool.format('MM', $nowFY)))
117 #set($currentFYYear = $mathtool.toInteger($datetool.format('yyyy', $nowFY)))
118 #if($currentFYMonth >= 4)
119 #set($currentFiscalYear = $currentFYYear)
120 #else
121 #set($currentFiscalYear = $mathtool.sub($currentFYYear, 1))
122 #end
123
124 ## --- 公開範囲フィールド ---
125 #set($visibilityOrgChart = $!doc.getValue('visibilityOrgChart'))
126 #set($visibilityBudget = $!doc.getValue('visibilityBudget'))
127 #set($visibilityRuleReview = $!doc.getValue('visibilityRuleReview'))
128 #set($visibilityChallenges = $!doc.getValue('visibilityChallenges'))
129 #set($visibilityDailyActivities = $!doc.getValue('visibilityDailyActivities'))
130 #set($visibilityElection = $!doc.getValue('visibilityElection'))
131 #set($visibilityMeeting = $!doc.getValue('visibilityMeeting'))
132 #set($visibilityActivityEnv = $!doc.getValue('visibilityActivityEnv'))
133 #set($visibilityAssembly = $!doc.getValue('visibilityAssembly'))
134 #set($visibilityPublicity = $!doc.getValue('visibilityPublicity'))
135 #set($visibilityExternal = $!doc.getValue('visibilityExternal'))
136 #set($visibilityAnnualEvents = $!doc.getValue('visibilityAnnualEvents'))
137 ## デフォルト値(未設定なら全体公開)
138 #if(!$visibilityOrgChart || $visibilityOrgChart == '') #set($visibilityOrgChart = 'public') #end
139 #if(!$visibilityBudget || $visibilityBudget == '') #set($visibilityBudget = 'public') #end
140 #if(!$visibilityRuleReview || $visibilityRuleReview == '') #set($visibilityRuleReview = 'public') #end
141 #if(!$visibilityChallenges || $visibilityChallenges == '') #set($visibilityChallenges = 'public') #end
142
143 ## --- 閲覧者情報(公開範囲チェック用) ---
144 #set($viewerUser = $xcontext.user)
145 #set($isGuest = $viewerUser == 'XWiki.XWikiGuest')
146 #set($isViewerAdmin = false)
147 #set($viewerSchoolCode = '')
148 #if(!$isGuest)
149 #set($viewerDoc = $xwiki.getDocument($viewerUser))
150 #set($viewerAccountType = $!viewerDoc.getValue('accountType'))
151 #set($viewerSchoolCode = $!viewerDoc.getValue('schoolCode'))
152 #set($viewerSecondarySchoolCode = $!viewerDoc.getValue('secondarySchoolCode'))
153 #set($viewerUserRole = $!viewerDoc.getValue('userRole'))
154 #if($viewerAccountType == 'admin')
155 #set($isViewerAdmin = true)
156 #end
157 #end
158
159 ## --- 関連校(中高一貫校)情報 ---
160 #set($affiliatedSchoolCode = $!doc.getValue('affiliatedSchoolCode'))
161 #set($affiliatedSchoolName = $!doc.getValue('affiliatedSchoolName'))
162 #set($isAffiliated = false)
163 #if($affiliatedSchoolCode && $affiliatedSchoolCode != '')
164 #if($viewerSchoolCode == $affiliatedSchoolCode)
165 #set($isAffiliated = true)
166 #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $affiliatedSchoolCode)
167 #set($isAffiliated = true)
168 #end
169 #end
170
171 ## --- 校内判定(卒業生を除外、secondarySchoolCodeも含む) ---
172 #set($isSchoolMember = false)
173 #if(!$isGuest && $viewerUserRole != 'graduate')
174 #if($viewerSchoolCode == $schoolCode || $isAffiliated)
175 #set($isSchoolMember = true)
176 #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $schoolCode)
177 #set($isSchoolMember = true)
178 #end
179 #end
180 ## 卒業生の母校判定(投稿バッジ用)
181 #set($isAlumniOfSchool = false)
182 #if(!$isGuest && $viewerUserRole == 'graduate')
183 #if($viewerSchoolCode == $schoolCode || ($affiliatedSchoolCode != '' && $viewerSchoolCode == $affiliatedSchoolCode))
184 #set($isAlumniOfSchool = true)
185 #end
186 #end
187
188 ## --- 学校ページ非表示チェック ---
189 #set($schoolHidden = $doc.getValue('hidden'))
190 #if($schoolHidden == 1)
191 #if($isViewerAdmin)
192 ## 管理者: 黄色バナー + ページ内容は通常表示(プレビュー)
193 <div class="school-hidden-banner admin">
194 <svg class="ico" viewBox="0 0 24 24"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 01-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
195 <div>
196 <strong>このページは非表示になっています</strong>(管理者のみ閲覧可能)
197 #set($hBy = $!doc.getValue('hiddenBy'))
198 #set($hAt = $!doc.getValue('hiddenAt'))
199 #set($hReason = $!doc.getValue('hiddenReason'))
200 <div class="school-hidden-detail">
201 非表示: $!escapetool.xml($hAt) / $!escapetool.xml($hBy)
202 #if($hReason && $hReason != '') ・ 理由: $!escapetool.xml($hReason)#end
203 </div>
204 <a href="$xwiki.getURL('SeitokaiAdmin.SchoolManagement', 'view')" style="color:#92400e;text-decoration:underline">学校ページ管理へ</a>
205 </div>
206 </div>
207 #else
208 ## 一般ユーザー・ゲスト: 非公開メッセージを表示して停止
209 <div class="school-hidden-public">
210 <svg class="ico" viewBox="0 0 24 24" style="width:2.5em;height:2.5em"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 01-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>
211 <h2>このページは現在公開されていません</h2>
212 <p>このページは管理者により非公開に設定されています。</p>
213 <a href="$xwiki.getURL('Schools.WebHome', 'view')" class="btn-back-list">学校一覧に戻る</a>
214 </div>
215 #stop
216 #end
217 #end
218
219 ## --- 投稿固定/解除処理 ---
220 #set($pinAction = $!request.action)
221 #if(($pinAction == 'pin' || $pinAction == 'unpin') && ($viewerAccountType == 'admin' || ($viewerAccountType == 'verified' && $isSchoolMember)) && $services.csrf.isTokenValid($request.form_token))
222 #set($pinPostObjStr = $!request.postObj)
223 #if(!$pinPostObjStr.matches('^\d+$'))
224 ## 不正な値 → 無視
225 #else
226 #set($postObjNum = $mathtool.toInteger($pinPostObjStr))
227 #set($postObj = $doc.getObject('SeitokaiCode.ActivityPostClass', $postObjNum))
228 #if($postObj)
229 #if($pinAction == 'pin')
230 $postObj.set('pinned', '1')
231 #set($pinnerDoc = $xwiki.getDocument($xcontext.user))
232 #set($pinnerName = $!pinnerDoc.getValue('displayName'))
233 #if(!$pinnerName || $pinnerName == '')#set($pinnerName = $xwiki.getUserName($xcontext.user))#end
234 $postObj.set('pinnedBy', $pinnerName)
235 $postObj.set('pinnedDate', $datetool.format('yyyy/MM/dd HH:mm', $datetool.date))
236 $doc.saveWithProgrammingRights('投稿を固定')
237 #else
238 $postObj.set('pinned', '')
239 $postObj.set('pinnedBy', '')
240 $postObj.set('pinnedDate', '')
241 $doc.saveWithProgrammingRights('投稿の固定を解除')
242 #end
243 $response.sendRedirect($doc.getURL('view'))
244 #stop
245 #end
246 #end## /matches
247 #end
248
249 ## --- 特色ある活動 選定/解除処理 ---
250 #set($featAction = $!request.action)
251 #if(($featAction == 'feature' || $featAction == 'unfeature') && ($viewerAccountType == 'admin' || (($viewerAccountType == 'verified' || $viewerAccountType == 'referred') && $isSchoolMember)) && $services.csrf.isTokenValid($request.form_token))
252 #set($featActObjStr = $!request.actObj)
253 #if($featActObjStr.matches('^\d+$'))
254 #set($actObjNum = $mathtool.toInteger($featActObjStr))
255 #set($actObj = $doc.getObject('SeitokaiCode.ActivityClass', $actObjNum))
256 #if($actObj)
257 #if($featAction == 'feature')
258 ## 上限3件チェック
259 #set($allActs = $doc.getObjects('SeitokaiCode.ActivityClass'))
260 #set($featCount = 0)
261 #if($allActs)
262 #foreach($fa in $allActs)
263 #if($!fa.getValue('featured') == '1')
264 #set($featCount = $featCount + 1)
265 #end
266 #end
267 #end
268 #if($featCount < 3)
269 $actObj.set('featured', '1')
270 #set($featurerDoc = $xwiki.getDocument($xcontext.user))
271 #set($featurerName = $!featurerDoc.getValue('displayName'))
272 #if(!$featurerName || $featurerName == '')#set($featurerName = $xwiki.getUserName($xcontext.user))#end
273 $actObj.set('featuredBy', $featurerName)
274 $actObj.set('featuredDate', $datetool.format('yyyy/MM/dd HH:mm', $datetool.date))
275 $doc.saveWithProgrammingRights('特色ある活動に選定')
276 #end
277 #else
278 $actObj.set('featured', '')
279 $actObj.set('featuredBy', '')
280 $actObj.set('featuredDate', '')
281 $doc.saveWithProgrammingRights('特色ある活動の選定を解除')
282 #end
283 $response.sendRedirect($doc.getURL('view'))
284 #stop
285 #end
286 #end## /matches
287 #end
288
289 ## --- ユーザー情報取得 ---
290 ## displayName: Wiki上の表示名(ニックネーム)。本名(firstName/lastName)は管理者のみ閲覧可能。
291 #set($lastAuthor = $doc.author)
292 #set($lastAuthorDoc = $xwiki.getDocument($lastAuthor))
293 #set($authorAccountType = '')
294 #set($authorUserRole = '')
295 #set($authorUserStatus = '')
296 #set($authorEnrollmentYear = '')
297 #set($authorGrade = '')
298 #set($authorDisplayName = '')
299 #if($lastAuthorDoc)
300 #set($authorAccountType = $!lastAuthorDoc.getValue('accountType'))
301 #set($authorUserRole = $!lastAuthorDoc.getValue('userRole'))
302 #set($authorUserStatus = $!lastAuthorDoc.getValue('userStatus'))
303 #set($authorEnrollmentYear = $!lastAuthorDoc.getValue('enrollmentYear'))
304 #set($authorDisplayName = $!lastAuthorDoc.getValue('displayName'))
305 #if(!$authorDisplayName || $authorDisplayName == '')
306 ## false引数でプレーンテキスト(HTMLリンクなし)を取得
307 #set($authorDisplayName = $xwiki.getUserName($doc.author, false))
308 #end
309 ## --- 学年の動的計算(学校種別対応) ---
310 ## 日本の学校年度: 4月始まり。currentSchoolYear = (月>=4) ? 今年 : 去年
311 ## 学年 = currentSchoolYear - enrollmentYear + 1
312 ## 在学年数超過: 卒業生として表示
313 #set($authorSchoolCode = $!lastAuthorDoc.getValue('schoolCode'))
314 #if($authorEnrollmentYear && $authorEnrollmentYear != '' && $authorUserRole == 'student')
315 #set($now = $datetool.date)
316 #set($currentYear = $datetool.format('yyyy', $now))
317 #set($currentMonth = $datetool.format('MM', $now))
318 #set($currentYearInt = $mathtool.toInteger($currentYear))
319 #set($currentMonthInt = $mathtool.toInteger($currentMonth))
320 #set($enrollYearInt = $mathtool.toInteger($authorEnrollmentYear))
321 #if($currentMonthInt >= 4)
322 #set($schoolYear = $currentYearInt)
323 #else
324 #set($schoolYear = $mathtool.sub($currentYearInt, 1))
325 #end
326 ## 学校種別から在学年数を判定: C1=中学(3年), C2=義務教育(9年), D1=高校(3年), D2=中等教育(6年)
327 #set($authorMaxYears = 3)
328 #if($authorSchoolCode && $authorSchoolCode.length() >= 2)
329 #set($authorSchoolType = $authorSchoolCode.substring(0, 2))
330 #if($authorSchoolType == 'C2')
331 #set($authorMaxYears = 9)
332 #elseif($authorSchoolType == 'D2')
333 #set($authorMaxYears = 6)
334 #end
335 #end
336 #set($gradeNum = $mathtool.add($mathtool.sub($schoolYear, $enrollYearInt), 1))
337 #if($gradeNum >= 1 && $gradeNum <= $authorMaxYears)
338 #set($authorGrade = "${gradeNum}年生")
339 #elseif($gradeNum > $authorMaxYears)
340 #set($authorGrade = "卒業生")
341 #end
342 #end
343 #end
344
345 ## --- 学校名見出し(XWikiデフォルトタイトルを非表示にし、学校名を表示) ---
346 #if($schoolName && $schoolName != '')
347 <style>.document-header { display: none !important; }</style>
348 <h1 class="school-page-title">$!escapetool.xml($schoolName)</h1>
349 #end
350
351 ## --- 編集ボタン(権限があるユーザーのみ表示) ---
352 #set($canEditSchool = false)
353 #if(!$isGuest && ($isViewerAdmin || $isSchoolMember || $isAlumniOfSchool))
354 #set($canEditSchool = true)
355 #end
356 #if($canEditSchool)
357 <div style="text-align:right; margin-bottom:12px;">
358 <a href="$doc.getURL('view', 'sheet=SeitokaiCode.SchoolEditForm')" class="btn-school-edit"><svg class="ico" viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/></svg> 基本情報を編集</a>
359 </div>
360 #end
361
362 ## --- 関連校(中高一貫校)バナー ---
363 #if($affiliatedSchoolCode && $affiliatedSchoolCode != '')
364 #set($affiliatedPageRef = "Schools.${affiliatedSchoolCode}.WebHome")
365 #set($affiliatedPageExists = $xwiki.exists($affiliatedPageRef))
366 <div class="affiliated-school-banner">
367 <svg class="ico" viewBox="0 0 24 24" stroke-width="1.5"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg>
368 <div>
369 <strong>中高一貫校</strong>:
370 #if($affiliatedPageExists)
371 <a href="$xwiki.getURL($affiliatedPageRef, 'view')">$!escapetool.xml($affiliatedSchoolName)</a>
372 #else
373 $!escapetool.xml($affiliatedSchoolName)
374 #end
375 と連携しています
376 </div>
377 </div>
378 #end
379
380 ## --- ① 学校基本情報 ---
381 <div class="school-info-card collapsed" id="card-basic-info">
382 <h2 role="button" tabindex="0" aria-expanded="false" onclick="toggleInfoCard('card-basic-info')" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();toggleInfoCard('card-basic-info')}"><span><svg class="ico ico-md" viewBox="0 0 24 24"><path d="M4 19.5A2.5 2.5 0 016.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z"/></svg> 学校基本情報</span><span class="collapse-toggle"><span class="collapse-label-open">たたむ</span><span class="collapse-label-closed">開く</span> <span class="collapse-arrow">▼</span></span></h2>
383 <div class="school-basic-info-layout">
384 <div class="school-basic-info-table">
385 <table class="wiki-table school-info-table">
386 <tr><th>学校コード</th><td>$!escapetool.xml($!schoolCode)</td></tr>
387 <tr><th>学校名</th><td>$!escapetool.xml($!schoolName)</td></tr>
388 <tr><th>所在地</th><td>$!escapetool.xml($!prefecture) #if($city && $city != '')$!escapetool.xml($city)#end</td></tr>
389 <tr><th>学級数・生徒数</th><td>#if($classCount && $classCount != '')${classCount}学級#end #if($studentCount && $studentCount != '')/ 約${studentCount}名#end</td></tr>
390 <tr><th>共学・別学</th><td>$!escapetool.xml($!coeducation)</td></tr>
391 <tr><th>設置者</th><td>$!escapetool.xml($!establishment)</td></tr>
392 <tr><th>学校種</th><td>$!escapetool.xml($!schoolLevel)</td></tr>
393 <tr><th>課程</th><td>#if($schoolSystem && !$schoolSystem.isEmpty())#foreach($ss in $schoolSystem)#if($foreach.count > 1) / #end$!escapetool.xml($ss)#end#end</td></tr>
394 <tr><th>公式サイト</th><td>#if($website && $website != '')<a href="$!escapetool.xml($website)" target="_blank" rel="noopener">$!escapetool.xml($website)</a>#else<span class="text-placeholder">未登録</span>#end</td></tr>
395 </table>
396 </div>
397 #if($schoolPhoto && $schoolPhoto != '')
398 <div class="school-photo-area">
399 <img src="$doc.getAttachmentURL($schoolPhoto)" alt="$!escapetool.xml($schoolName)" class="school-photo" />
400 </div>
401 #end
402 </div>
403 #if($schoolDescription && $schoolDescription.trim() != '')
404 <div class="free-note" style="margin-top:var(--sp-4);">$!escapetool.xml($schoolDescription)</div>
405 #end
406
407 </div>
408
409 ## --- ② 生徒会情報(折りたたみカード) ---
410 <div class="school-info-card" id="card-seitokai-info">
411 <h2 role="button" tabindex="0" aria-expanded="true" onclick="toggleInfoCard('card-seitokai-info')" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();toggleInfoCard('card-seitokai-info')}"><span><svg class="ico ico-md" viewBox="0 0 24 24"><path d="M3 21h18"/><path d="M5 21V7l7-4 7 4v14"/><path d="M9 21v-4h6v4"/></svg> 生徒会情報</span><span class="collapse-toggle"><span class="collapse-label-open">たたむ</span><span class="collapse-label-closed">開く</span> <span class="collapse-arrow">▼</span></span></h2>
412 <div class="seitokai-info-body">
413
414 ## --- 生徒会組織 ---
415 #set($hasOrgContent = ($orgChart && $orgChart != '') || ($orgChartImage && $orgChartImage != ''))
416 #if($hasOrgContent)
417 #set($canViewOrgChart = true)
418 #if($visibilityOrgChart == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewOrgChart = false)
419 #elseif($visibilityOrgChart == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewOrgChart = false)
420 #end
421 #if($canViewOrgChart)
422 <div class="seitokai-subsection">
423 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><path d="M3 21h18"/><path d="M5 21V7l7-4 7 4v14"/><path d="M9 21v-4h6v4"/><line x1="9" y1="10" x2="9" y2="10.01"/><line x1="15" y1="10" x2="15" y2="10.01"/><line x1="9" y1="14" x2="9" y2="14.01"/><line x1="15" y1="14" x2="15" y2="14.01"/></svg> 生徒会組織 #if($visibilityOrgChart != 'public')<span class="visibility-badge visibility-${visibilityOrgChart}">#if($visibilityOrgChart == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
424 <div class="seitokai-subsection-content">
425 #if($orgChartImage && $orgChartImage != '')
426 <div class="school-org-img-wrap"><img src="$doc.getAttachmentURL($orgChartImage)" alt="組織図" class="org-chart-img" /></div>
427 #end
428 #if($orgChart && $orgChart != '')<div class="free-note">$!escapetool.xml($orgChart)</div>#end
429 </div>
430 </div>
431 #else
432 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 生徒会組織は #if($visibilityOrgChart == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
433 #end
434 #end
435
436 ## --- 日常の活動 ---
437 #if($dailyActivities && !$dailyActivities.isEmpty())
438 #set($canViewDA = true)
439 #if($visibilityDailyActivities == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewDA = false)
440 #elseif($visibilityDailyActivities == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewDA = false)
441 #end
442 #if($canViewDA)
443 <div class="seitokai-subsection">
444 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg> 日常の活動 #if($visibilityDailyActivities != '' && $visibilityDailyActivities != 'public')<span class="visibility-badge visibility-${visibilityDailyActivities}">#if($visibilityDailyActivities == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
445 <div class="seitokai-subsection-content">
446 <p class="activity-hint">活動時間が多い3つ</p>
447 <div class="tag-container">
448 #foreach($da in $dailyActivities)
449 <span class="tag tag-accent">$!escapetool.xml($da.trim())</span>
450 #end
451 </div>
452 #if($dailyActivitiesNote && $dailyActivitiesNote.trim() != '')
453 <div class="free-note">$!escapetool.xml($dailyActivitiesNote)</div>
454 #end
455 </div>
456 </div>
457 #else
458 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 日常の活動情報は #if($visibilityDailyActivities == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
459 #end
460 #end
461
462 ## --- 選挙 ---
463 #if($electionExists && $electionExists != '')
464 #set($canViewEL = true)
465 #if($visibilityElection == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewEL = false)
466 #elseif($visibilityElection == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewEL = false)
467 #end
468 #if($canViewEL)
469 <div class="seitokai-subsection">
470 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 13l3 3 7-7"/></svg> 選挙 #if($visibilityElection != '' && $visibilityElection != 'public')<span class="visibility-badge visibility-${visibilityElection}">#if($visibilityElection == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
471 <div class="seitokai-subsection-content">
472 <div class="info-row">
473 <span class="info-label">役員選挙</span>
474 <span class="info-value">$!escapetool.xml($!electionExists)</span>
475 </div>
476 #if($electionType && $electionType != '')
477 <div class="info-row">
478 <span class="info-label">直近の選挙方式</span>
479 <span class="info-value">$!escapetool.xml($!electionType)</span>
480 </div>
481 #end
482 #if($electionNote && $electionNote.trim() != '')
483 <div class="free-note">$!escapetool.xml($electionNote)</div>
484 #end
485 </div>
486 </div>
487 #else
488 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 選挙情報は #if($visibilityElection == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
489 #end
490 #end
491
492 ## --- 定例活動 ---
493 #if($meetingFrequency && $meetingFrequency != '')
494 #set($canViewMT = true)
495 #if($visibilityMeeting == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewMT = false)
496 #elseif($visibilityMeeting == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewMT = false)
497 #end
498 #if($canViewMT)
499 <div class="seitokai-subsection">
500 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg> 定例活動 #if($visibilityMeeting != '' && $visibilityMeeting != 'public')<span class="visibility-badge visibility-${visibilityMeeting}">#if($visibilityMeeting == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
501 <div class="seitokai-subsection-content">
502 <div class="info-row">
503 <span class="info-label">役員定例会の頻度</span>
504 <span class="info-value">$!escapetool.xml($!meetingFrequency)</span>
505 </div>
506 #if($regularActivitiesNote && $regularActivitiesNote.trim() != '')
507 <div class="free-note">$!escapetool.xml($regularActivitiesNote)</div>
508 #end
509 </div>
510 </div>
511 #else
512 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 定例活動情報は #if($visibilityMeeting == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
513 #end
514 #end
515
516 ## --- 予算 ---
517 #set($hasBudget = ($budgetProcess && !$budgetProcess.isEmpty()) || ($studentFee && $studentFee != '') || ($budgetScale && $budgetScale != ''))
518 #if($hasBudget)
519 #set($canViewBudget = true)
520 #if($visibilityBudget == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewBudget = false)
521 #elseif($visibilityBudget == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewBudget = false)
522 #end
523 #if($canViewBudget)
524 <div class="seitokai-subsection">
525 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"/></svg> 予算 #if($visibilityBudget != 'public')<span class="visibility-badge visibility-${visibilityBudget}">#if($visibilityBudget == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
526 <div class="seitokai-subsection-content">
527 #if($budgetProcess && !$budgetProcess.isEmpty())
528 <div class="info-row">
529 <span class="info-label">作成過程の生徒関与</span>
530 <span class="info-value">
531 <div class="selection-display">
532 #set($allBpOpts = ["各部・委員会等への予算希望額調査","予算額調整(折衝等)","生徒会予算案の作成","生徒総会での議決","生徒関与なし","その他"])
533 #foreach($bpOpt in $allBpOpts)
534 #if($budgetProcess.contains($bpOpt))
535 <span class="selection-item">$!escapetool.xml($bpOpt)</span>
536 #else
537 <span class="selection-item selection-item-off">$!escapetool.xml($bpOpt)</span>
538 #end
539 #end
540 </div>
541 </span>
542 </div>
543 #end
544 #if($studentFee && $studentFee != '')
545 <div class="info-row">
546 <span class="info-label">生徒会費(年額)</span>
547 <span class="info-value">$!escapetool.xml($!studentFee)</span>
548 </div>
549 #end
550 #if($budgetScale && $budgetScale != '')
551 <div class="info-row">
552 <span class="info-label">予算規模</span>
553 <span class="info-value">$!escapetool.xml($!budgetScale)</span>
554 </div>
555 #end
556 #if($budgetAllocation && !$budgetAllocation.isEmpty())
557 <div class="info-row">
558 <span class="info-label">主な予算配分</span>
559 <span class="info-value">
560 <div class="selection-display">
561 #foreach($ba in $budgetAllocation)
562 <span class="selection-item">$!escapetool.xml($ba.trim())</span>
563 #end
564 </div>
565 </span>
566 </div>
567 #end
568 #if($budgetNote && $budgetNote.trim() != '')
569 <div class="free-note">$!escapetool.xml($budgetNote)</div>
570 #end
571 </div>
572 </div>
573 #else
574 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 予算情報は #if($visibilityBudget == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
575 #end
576 #end
577
578 ## --- 校則・生徒会会則の見直し ---
579 #if($ruleReviewStatus && $ruleReviewStatus != '')
580 #set($canViewRuleReview = true)
581 #if($visibilityRuleReview == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewRuleReview = false)
582 #elseif($visibilityRuleReview == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewRuleReview = false)
583 #end
584 #if($canViewRuleReview)
585 <div class="seitokai-subsection">
586 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><path d="M16 4h2a2 2 0 012 2v12a2 2 0 01-2 2h-2"/><path d="M8 4H6a2 2 0 00-2 2v12a2 2 0 002 2h2"/><line x1="12" y1="4" x2="12" y2="8"/><line x1="12" y1="16" x2="12" y2="20"/><line x1="8" y1="8" x2="16" y2="8"/><line x1="8" y1="16" x2="16" y2="16"/></svg> 校則・生徒会会則の見直し #if($visibilityRuleReview != 'public')<span class="visibility-badge visibility-${visibilityRuleReview}">#if($visibilityRuleReview == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
587 <div class="seitokai-subsection-content">
588 <div class="info-row">
589 <span class="info-label">見直しの有無(3年以内)</span>
590 <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($!ruleReviewStatus)</span></span>
591 </div>
592 #if($ruleReviewStatus != '実施なし')
593 #if($ruleReviewContent && !$ruleReviewContent.isEmpty())
594 <div class="info-row">
595 <span class="info-label">見直しの内容</span>
596 <span class="info-value">
597 <div class="selection-display">
598 #foreach($rc in $ruleReviewContent)
599 <span class="selection-item">$!escapetool.xml($rc.trim())</span>
600 #end
601 </div>
602 </span>
603 </div>
604 #end
605 #if($ruleReviewProposer && !$ruleReviewProposer.isEmpty())
606 <div class="info-row">
607 <span class="info-label">見直しの提案者</span>
608 <span class="info-value">
609 <div class="selection-display">
610 #foreach($rp in $ruleReviewProposer)
611 <span class="selection-item">$!escapetool.xml($rp.trim())</span>
612 #end
613 </div>
614 </span>
615 </div>
616 #end
617 #if($ruleReviewImplementer && !$ruleReviewImplementer.isEmpty())
618 <div class="info-row">
619 <span class="info-label">見直しの実施者</span>
620 <span class="info-value">
621 <div class="selection-display">
622 #foreach($ri in $ruleReviewImplementer)
623 <span class="selection-item">$!escapetool.xml($ri.trim())</span>
624 #end
625 </div>
626 </span>
627 </div>
628 #end
629 #end
630 #if($ruleReviewSystem && $ruleReviewSystem != '')
631 <div class="info-row">
632 <span class="info-label">見直しの仕組み</span>
633 <span class="info-value">$!escapetool.xml($!ruleReviewSystem)</span>
634 </div>
635 #end
636 </div>
637 </div>
638 #else
639 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 校則・生徒会会則の見直し情報は #if($visibilityRuleReview == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
640 #end
641 #end
642
643 ## --- 活動環境 ---
644 #set($hasActivityEnv = ($activityPlace && !$activityPlace.isEmpty()) || ($activityRoomEquipment && $activityRoomEquipment != '') || ($activityRoomImage && $activityRoomImage != '') || ($ictTools && !$ictTools.isEmpty()) || ($ictUsage && !$ictUsage.isEmpty()))
645 #if($hasActivityEnv)
646 #set($canViewAE = true)
647 #if($visibilityActivityEnv == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewAE = false)
648 #elseif($visibilityActivityEnv == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewAE = false)
649 #end
650 #if($canViewAE)
651 <div class="seitokai-subsection">
652 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg> 生徒会の活動環境 #if($visibilityActivityEnv != '' && $visibilityActivityEnv != 'public')<span class="visibility-badge visibility-${visibilityActivityEnv}">#if($visibilityActivityEnv == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
653 <div class="seitokai-subsection-content">
654 #if($activityPlace && !$activityPlace.isEmpty())
655 <div class="info-row">
656 <span class="info-label">普段の活動場所</span>
657 <span class="info-value">
658 <div class="selection-display">
659 #foreach($ap in $activityPlace)
660 <span class="selection-item">$!escapetool.xml($ap.trim())</span>
661 #end
662 </div>
663 </span>
664 </div>
665 #end
666 #if($activityRoomEquipment && $activityRoomEquipment != '')
667 <div class="info-row">
668 <span class="info-label">生徒会室の設備</span>
669 <span class="info-value free-text-value">$!escapetool.xml($activityRoomEquipment)</span>
670 </div>
671 #end
672 #if($activityRoomImage && $activityRoomImage != '')
673 <div class="info-row">
674 <span class="info-label">活動場所の写真</span>
675 <span class="info-value"><div class="school-org-img-wrap"><img src="$doc.getAttachmentURL($activityRoomImage)" alt="活動場所の写真" class="org-chart-img" /></div></span>
676 </div>
677 #end
678 #if($ictTools && !$ictTools.isEmpty())
679 <div class="info-row">
680 <span class="info-label">利用しているICTツール</span>
681 <span class="info-value">
682 #set($ictCatDisplay = [
683 ["連絡ツール", ["メール","LINE","LINE WORKS","Discord","Slack","Microsoft Teams","Google Chat","InstagramのDM","XのDM","その他(連絡)"]],
684 ["ドキュメント作成・共有", ["Googleドキュメント","Googleスプレッドシート","Googleスライド","Googleドライブ","Word","Excel","PowerPoint","OneDrive","SharePoint","Notion","Pages","Numbers","Keynote","Dropbox","Box","その他(ドキュメント)"]],
685 ["タスク管理", ["Googleカレンダー","Google ToDoリスト","Trello","Asana","Excel等スプレッドシート","その他(タスク管理)"]],
686 ["ビデオ会議ツール", ["Zoom","Google Meet","その他(ビデオ会議)"]],
687 ["アンケート", ["Googleフォーム","Microsoft Forms","その他(アンケート)"]],
688 ["デザイン・クリエイティブ", ["Canva","各種Adobe","CapCut","LumaFusion","AviUtl","ibisPaint","その他(デザイン)"]],
689 ["その他", ["独自のWebシステム・自作アプリ"]]
690 ])
691 #foreach($catD in $ictCatDisplay)
692 #set($catHasItems = false)
693 #foreach($t in $catD.get(1))
694 #if($ictTools.contains($t)) #set($catHasItems = true) #end
695 #end
696 #if($catHasItems)
697 <div style="margin-bottom:6px">
698 <span style="font-size:0.8em;font-weight:600;color:var(--text-mid)">$catD.get(0):</span>
699 <div class="selection-display" style="margin-top:2px">
700 #foreach($t in $catD.get(1))
701 #if($ictTools.contains($t))
702 <span class="selection-item">$!escapetool.xml($t)</span>
703 #end
704 #end
705 </div>
706 </div>
707 #end
708 #end
709 </span>
710 </div>
711 #end
712 #if($ictUsage && !$ictUsage.isEmpty())
713 <div class="info-row">
714 <span class="info-label">ICT活用している場面</span>
715 <span class="info-value">
716 <div class="selection-display">
717 #foreach($iu in $ictUsage)
718 <span class="selection-item">$!escapetool.xml($iu.trim())</span>
719 #end
720 </div>
721 </span>
722 </div>
723 #end
724 </div>
725 </div>
726 #else
727 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 活動環境情報は #if($visibilityActivityEnv == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
728 #end
729 #end
730
731 ## --- 生徒総会 ---
732 #set($hasAssembly = ($assemblyFormat && $assemblyFormat != '') || ($assemblyCount && $assemblyCount > 0) || ($assemblyAgenda && !$assemblyAgenda.isEmpty()) || ($assemblyTopics && !$assemblyTopics.isEmpty()) || ($assemblyNote && $assemblyNote != ''))
733 #if($hasAssembly)
734 #set($canViewAS = true)
735 #if($visibilityAssembly == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewAS = false)
736 #elseif($visibilityAssembly == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewAS = false)
737 #end
738 #if($canViewAS)
739 <div class="seitokai-subsection">
740 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 00-3-3.87"/><path d="M16 3.13a4 4 0 010 7.75"/></svg> 生徒総会 #if($visibilityAssembly != '' && $visibilityAssembly != 'public')<span class="visibility-badge visibility-${visibilityAssembly}">#if($visibilityAssembly == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
741 <div class="seitokai-subsection-content">
742 #if($assemblyFormat && $assemblyFormat != '')
743 <div class="info-row">
744 <span class="info-label">開催方式</span>
745 <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($assemblyFormat)</span></span>
746 </div>
747 #end
748 #if($assemblyCount && $assemblyCount > 0)
749 <div class="info-row">
750 <span class="info-label">開催回数(年)</span>
751 <span class="info-value">$!escapetool.xml($assemblyCount)回</span>
752 </div>
753 #end
754 #if($assemblyAgenda && !$assemblyAgenda.isEmpty())
755 <div class="info-row">
756 <span class="info-label">議案の集め方</span>
757 <span class="info-value">
758 <div class="selection-display">
759 #foreach($aa in $assemblyAgenda)
760 <span class="selection-item">$!escapetool.xml($aa.trim())</span>
761 #end
762 </div>
763 </span>
764 </div>
765 #end
766 #if($assemblyTopics && !$assemblyTopics.isEmpty())
767 <div class="info-row">
768 <span class="info-label">扱う内容</span>
769 <span class="info-value">
770 <div class="selection-display">
771 #foreach($at in $assemblyTopics)
772 <span class="selection-item">$!escapetool.xml($at.trim())</span>
773 #end
774 </div>
775 </span>
776 </div>
777 #end
778 #if($assemblyNote && $assemblyNote != '')
779 <div class="info-row">
780 <span class="info-label">自由記述</span>
781 <span class="info-value free-text-value">$!escapetool.xml($assemblyNote)</span>
782 </div>
783 #end
784 </div>
785 </div>
786 #else
787 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 生徒総会情報は #if($visibilityAssembly == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
788 #end
789 #end
790
791 ## --- 広報 ---
792 #set($hasPublicity = ($publicityMethod && !$publicityMethod.isEmpty()) || ($publicityFrequency && $publicityFrequency != '') || ($publicityNote && $publicityNote != ''))
793 #if($hasPublicity)
794 #set($canViewPB = true)
795 #if($visibilityPublicity == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewPB = false)
796 #elseif($visibilityPublicity == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewPB = false)
797 #end
798 #if($canViewPB)
799 <div class="seitokai-subsection">
800 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg> 広報 #if($visibilityPublicity != '' && $visibilityPublicity != 'public')<span class="visibility-badge visibility-${visibilityPublicity}">#if($visibilityPublicity == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
801 <div class="seitokai-subsection-content">
802 #if($publicityMethod && !$publicityMethod.isEmpty())
803 <div class="info-row">
804 <span class="info-label">方法</span>
805 <span class="info-value">
806 <div class="selection-display">
807 #foreach($pm in $publicityMethod)
808 <span class="selection-item">$!escapetool.xml($pm.trim())</span>
809 #end
810 </div>
811 </span>
812 </div>
813 #end
814 #if($publicityFrequency && $publicityFrequency != '')
815 <div class="info-row">
816 <span class="info-label">頻度</span>
817 <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($publicityFrequency)</span></span>
818 </div>
819 #end
820 #if($publicityNote && $publicityNote != '')
821 <div class="info-row">
822 <span class="info-label">自由記述</span>
823 <span class="info-value free-text-value">$!escapetool.xml($publicityNote)</span>
824 </div>
825 #end
826 </div>
827 </div>
828 #else
829 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 広報情報は #if($visibilityPublicity == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
830 #end
831 #end
832
833 ## --- 外部連携 ---
834 #set($hasExternal = ($externalCooperation && $externalCooperation != '') || ($externalOrgName && $externalOrgName != '') || ($socialParticipation && !$socialParticipation.isEmpty()))
835 #if($hasExternal)
836 #set($canViewEX = true)
837 #if($visibilityExternal == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewEX = false)
838 #elseif($visibilityExternal == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewEX = false)
839 #end
840 #if($canViewEX)
841 <div class="seitokai-subsection">
842 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg> 外部連携 #if($visibilityExternal != '' && $visibilityExternal != 'public')<span class="visibility-badge visibility-${visibilityExternal}">#if($visibilityExternal == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
843 <div class="seitokai-subsection-content">
844 #if($externalCooperation && $externalCooperation != '')
845 <div class="info-row">
846 <span class="info-label">他校の生徒会との連携</span>
847 <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($externalCooperation)</span></span>
848 </div>
849 #end
850 #if($externalOrgName && $externalOrgName != '')
851 <div class="info-row">
852 <span class="info-label">参加している生徒会団体の名前</span>
853 <span class="info-value">$!escapetool.xml($externalOrgName)</span>
854 </div>
855 #end
856 #if($socialParticipation && !$socialParticipation.isEmpty())
857 <div class="info-row">
858 <span class="info-label">社会参加・地域連携・ボランティア</span>
859 <span class="info-value">
860 <div class="selection-display">
861 #foreach($sp2 in $socialParticipation)
862 <span class="selection-item">$!escapetool.xml($sp2.trim())</span>
863 #end
864 </div>
865 </span>
866 </div>
867 #end
868 </div>
869 </div>
870 #else
871 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 外部連携情報は #if($visibilityExternal == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
872 #end
873 #end
874
875 ## --- 年間主要行事 ---
876 #set($months = [["4月", $eventApril], ["5月", $eventMay], ["6月", $eventJune], ["7月", $eventJuly], ["8月", $eventAugust], ["9月", $eventSeptember], ["10月", $eventOctober], ["11月", $eventNovember], ["12月", $eventDecember], ["1月", $eventJanuary], ["2月", $eventFebruary], ["3月", $eventMarch]])
877 #set($hasAnyEvent = false)
878 #foreach($m in $months)
879 #if($m.get(1) && $m.get(1) != '') #set($hasAnyEvent = true) #end
880 #end
881 #if($hasAnyEvent)
882 #set($canViewAN = true)
883 #if($visibilityAnnualEvents == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewAN = false)
884 #elseif($visibilityAnnualEvents == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewAN = false)
885 #end
886 #if($canViewAN)
887 <div class="seitokai-subsection">
888 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg> 年間主要行事 #if($visibilityAnnualEvents != '' && $visibilityAnnualEvents != 'public')<span class="visibility-badge visibility-${visibilityAnnualEvents}">#if($visibilityAnnualEvents == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
889 <div class="seitokai-subsection-content">
890 <table class="wiki-table school-info-table" style="margin:0">
891 #foreach($m in $months)
892 #if($m.get(1) && $m.get(1) != '')
893 <tr><td style="width:60px;font-weight:600;white-space:nowrap">$m.get(0)</td><td>$!escapetool.xml($m.get(1))</td></tr>
894 #end
895 #end
896 </table>
897 </div>
898 </div>
899 #else
900 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 年間主要行事情報は #if($visibilityAnnualEvents == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
901 #end
902 #end
903
904 ## --- 生徒会の課題意識 ---
905 #if($challenges && $challenges != '')
906 #set($canViewChallenges = true)
907 #if($visibilityChallenges == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewChallenges = false)
908 #elseif($visibilityChallenges == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewChallenges = false)
909 #end
910 #if($canViewChallenges)
911 <div class="seitokai-subsection">
912 <h3 class="seitokai-subsection-title"><svg class="ico" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg> 生徒会の課題意識 #if($visibilityChallenges != 'public')<span class="visibility-badge visibility-${visibilityChallenges}">#if($visibilityChallenges == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</span>#end</h3>
913 <div class="seitokai-subsection-content">
914 <div class="challenge-text">$!escapetool.xml($challenges)</div>
915 </div>
916 </div>
917 #else
918 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 課題情報は #if($visibilityChallenges == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
919 #end
920 #end
921
922 </div>## seitokai-info-body 終了
923 </div>## card-seitokai-info 終了
924
925 ## --- ③ SNS・連絡先 ---
926 <div class="school-info-card collapsed" id="card-contact">
927 <h2 role="button" tabindex="0" aria-expanded="false" onclick="toggleInfoCard('card-contact')" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();toggleInfoCard('card-contact')}"><span><svg class="ico ico-md" viewBox="0 0 24 24"><path d="M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.5 19.5 0 01-6-6 19.79 19.79 0 01-3.07-8.67A2 2 0 014.11 2h3a2 2 0 012 1.72c.127.96.361 1.903.7 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0122 16.92z"/></svg> SNS・連絡先</span><span class="collapse-toggle"><span class="collapse-label-open">たたむ</span><span class="collapse-label-closed">開く</span> <span class="collapse-arrow">▼</span></span></h2>
928 <table class="wiki-table school-info-table">
929 <tr><th>問い合わせ先</th><td>#if($contactInfo && $contactInfo != '')$!escapetool.xml($contactInfo)#else<span class="text-placeholder">未登録</span>#end</td></tr>
930 <tr><th>生徒会Web</th><td>#if($seitokaiWebsite && $seitokaiWebsite != '')<a href="$!escapetool.xml($seitokaiWebsite)" target="_blank" rel="noopener"><svg class="ico" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg> $!escapetool.xml($seitokaiWebsite)</a>#else<span class="text-placeholder">未登録</span>#end</td></tr>
931 <tr><th>X (Twitter)</th><td>#if($seitokaiTwitter && $seitokaiTwitter != '')<a href="https://x.com/$!escapetool.url($seitokaiTwitter)" target="_blank" rel="noopener">𝕏 @$!escapetool.xml($seitokaiTwitter)</a>#else<span class="text-placeholder">未登録</span>#end</td></tr>
932 <tr><th>Instagram</th><td>#if($seitokaiInstagram && $seitokaiInstagram != '')<a href="https://instagram.com/$!escapetool.url($seitokaiInstagram)" target="_blank" rel="noopener"><svg class="ico" viewBox="0 0 24 24"><path d="M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"/><circle cx="12" cy="13" r="4"/></svg> @$!escapetool.xml($seitokaiInstagram)</a>#else<span class="text-placeholder">未登録</span>#end</td></tr>
933 <tr><th>YouTube</th><td>#if($seitokaiYoutube && $seitokaiYoutube != '')<a href="$!escapetool.xml($seitokaiYoutube)" target="_blank" rel="noopener"><svg class="ico" viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg> YouTubeチャンネル</a>#else<span class="text-placeholder">未登録</span>#end</td></tr>
934 <tr><th>その他SNS</th><td>#if($seitokaiOtherSns && $seitokaiOtherSns != '')$!escapetool.xml($seitokaiOtherSns)#else<span class="text-placeholder">未登録</span>#end</td></tr>
935 </table>
936 #set($infoEditDate = $!doc.getValue('lastInfoEditedDate'))
937 #set($infoEditBy = $!doc.getValue('lastInfoEditedBy'))
938 #if($infoEditDate && $infoEditDate != '')
939 <div class="info-last-updated"><svg class="ico" viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/></svg> 基本情報の最終更新: $!escapetool.xml($infoEditBy) — $!escapetool.xml($infoEditDate)</div>
940 #end
941 </div>
942
943 {{/html}}
944
945 ----
946
947 ## --- ⑩ 活動報告一覧(スレッド型・年度タブ付き) ---
948 = 活動報告 =
949
950 ## --- 年度タブ + 投稿者ステータス凡例 ---
951 {{html clean="false"}}
952
953 ## --- 年度タブ ---
954 ## 全活動から年度一覧を収集
955 #set($activities = $doc.getObjects('SeitokaiCode.ActivityClass'))
956 #set($allPosts = $doc.getObjects('SeitokaiCode.ActivityPostClass'))
957 #set($fySet = [])
958 #if($activities && $activities.size() > 0)
959 #foreach($act in $activities)
960 #set($aFY = $!act.getValue('fiscalYear'))
961 #if($aFY && $aFY != '' && !$fySet.contains($aFY))
962 #set($discard = $fySet.add($aFY))
963 #end
964 #end
965 #end
966 ## 現在の年度が含まれていなければ追加
967 #set($currentFYStr = $currentFiscalYear.toString())
968 #if(!$fySet.contains($currentFYStr))
969 #set($discard = $fySet.add($currentFYStr))
970 #end
971 ## ソート(降順にしたいが Velocity にはないので JS で制御)
972
973 <div class="activity-toolbar">
974 <div class="activity-fy-tabs">
975 <button class="activity-fy-tab active" onclick="switchActivityFY('$currentFYStr', this)">$currentFYStr 年度</button>
976 #foreach($fy in $fySet)
977 #if($fy != $currentFYStr)
978 <button class="activity-fy-tab" onclick="switchActivityFY('$fy', this)">$fy 年度</button>
979 #end
980 #end
981 <button class="activity-fy-tab" onclick="switchActivityFY('all', this)">全期間</button>
982 </div>
983 <div class="activity-toolbar-right">
984 <button class="btn-view-toggle" id="btnViewToggle" onclick="toggleCompactView()" title="タイトルのみ表示">
985 <svg class="ico-list" viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
986 <svg class="ico-detail" viewBox="0 0 24 24" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/></svg>
987 <span class="toggle-label">一覧表示</span>
988 </button>
989 </div>
990 <div class="author-legend-wrapper">
991 <button class="author-legend-toggle" onclick="this.classList.toggle('open');this.nextElementSibling.classList.toggle('open')"><svg class="ico" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg> バッジの見方 <span class="chevron">▼</span></button>
992 <div class="author-legend-body">
993 <div class="author-legend">
994 <span class="author-legend-title">投稿者の信頼度:</span>
995 <span class="author-legend-item"><span class="bar bar-admin"></span> 管理者 <span class="text-hint">— 運営スタッフ</span></span>
996 <span class="author-legend-item"><span class="bar bar-verified"></span> 承認済み <span class="text-hint">— 本人確認済みのユーザー</span></span>
997 <span class="author-legend-item"><span class="bar bar-referred"></span> 紹介 <span class="text-hint">— 承認済みユーザーからの紹介</span></span>
998 <span class="author-legend-item"><span class="bar bar-general"></span> 一般 <span class="text-hint">— 一般登録ユーザー</span></span>
999 </div>
1000 <div class="author-legend">
1001 <span class="author-legend-title">所属:</span>
1002 <span class="author-legend-item"><span class="badge badge-school-internal-confirmed badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内(確認済)</span> <span class="text-hint">所属が確認されたこの学校のユーザー</span></span>
1003 <span class="author-legend-item"><span class="badge badge-school-internal badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内</span> <span class="text-hint">この学校に所属登録しているユーザー</span></span>
1004 <span class="author-legend-item"><span class="badge badge-alumni badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10l-10-5L2 10l10 5 10-5z"/><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5"/></svg> 卒業生</span> <span class="text-hint">この学校の卒業生</span></span>
1005 <span class="author-legend-item"><span class="badge badge-school-external badge-sm"><svg class="ico" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg> 他校</span> <span class="text-hint">別の学校に所属しているユーザー</span></span>
1006 <span class="author-legend-item text-hint">※一般アカウントは所属バッジが表示されません</span>
1007 </div>
1008 <div class="author-legend">
1009 <span class="author-legend-title">役割:</span>
1010 <span class="author-legend-item"><span class="badge badge-role-student badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10v6M2 10l10-5 10 5-10 5z"/><path d="M6 12v5c0 2 4 3 6 3s6-1 6-3v-5"/></svg> 生徒</span></span>
1011 <span class="author-legend-item"><span class="badge badge-role-officer badge-sm"><svg class="ico" viewBox="0 0 24 24"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg> 役員</span> <span class="text-hint">生徒会役員</span></span>
1012 <span class="author-legend-item"><span class="badge badge-role-teacher badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/></svg> 教員</span></span>
1013 </div>
1014 </div>
1015 </div>
1016 </div>
1017
1018 {{/html}}
1019
1020 ## 特色ある活動を先頭に表示するため、並び替え用リストを作成
1021 #set($featuredActivities = [])
1022 #set($normalActivities = [])
1023 #if($activities && $activities.size() > 0)
1024 #foreach($act in $activities)
1025 #set($isFeatured = $!act.getValue('featured'))
1026 #if($isFeatured == '1')
1027 #set($discard = $featuredActivities.add($foreach.index))
1028 #else
1029 #set($discard = $normalActivities.add($foreach.index))
1030 #end
1031 #end
1032 #end
1033 #set($orderedActivityIndices = [])
1034 #set($discard = $orderedActivityIndices.addAll($featuredActivities))
1035 #set($discard = $orderedActivityIndices.addAll($normalActivities))
1036
1037 #if($activities && $activities.size() > 0)
1038 #foreach($actIdx in $orderedActivityIndices)
1039 #set($activity = $activities.get($actIdx))
1040 #set($actTitle = $activity.getValue('title'))
1041 #set($actCommittee = $activity.getValue('committee'))
1042 #set($actPeriod = $activity.getValue('period'))
1043 #set($actFY = $!activity.getValue('fiscalYear'))
1044 #set($actFeatured = $!activity.getValue('featured'))
1045 #if(!$actFY || $actFY == '') #set($actFY = 'unknown') #end
1046 ## この活動に紐づく投稿を収集(固定投稿を先頭に)
1047 #set($pinnedPosts = [])
1048 #set($normalPosts = [])
1049 #if($allPosts)
1050 #foreach($post in $allPosts)
1051 #if($post.getValue('activityIndex') == $actIdx)
1052 #set($isPinned = $!post.getValue('pinned'))
1053 #if($isPinned == '1')
1054 #set($discard = $pinnedPosts.add($post))
1055 #else
1056 #set($discard = $normalPosts.add($post))
1057 #end
1058 #end
1059 #end
1060 #end
1061 #set($threadPosts = [])
1062 #set($discard = $threadPosts.addAll($pinnedPosts))
1063 #set($discard = $threadPosts.addAll($normalPosts))
1064 ## report/comment カウント
1065 #set($reportCount = 0)
1066 #set($commentCount = 0)
1067 #foreach($tp in $threadPosts)
1068 #set($tpType = $!tp.getValue('postType'))
1069 #if($tpType == 'comment')
1070 #set($commentCount = $commentCount + 1)
1071 #else
1072 #set($reportCount = $reportCount + 1)
1073 #end
1074 #end
1075
1076 {{html clean="false"}}
1077 <div class="activity-thread" data-fiscal-year="$!escapetool.xml($actFY)">
1078 <div class="activity-thread-header">
1079 <div class="activity-thread-title">
1080 <h3 #if($actFeatured == '1')class="featured-title"#end>#if($actFeatured == '1')<svg class="ico ico-fixed-14 ico-star-offset" viewBox="0 0 24 24" fill="currentColor" stroke="none"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg> #end$!escapetool.xml($!actTitle)</h3>
1081 <div class="activity-meta-line">
1082 <span class="activity-meta">$!escapetool.xml($!actCommittee) | $!escapetool.xml($!actPeriod) #if($actFY != 'unknown')| $!escapetool.xml($actFY)年度#end</span>
1083 #set($actTagsList = $activity.getValue('tags'))
1084 #if($actTagsList && !$actTagsList.isEmpty())
1085 #foreach($tagItem in $actTagsList)
1086 #if($tagItem && $tagItem.trim() != '')<span class="activity-tag-badge">$escapetool.xml($tagItem)</span>#end
1087 #end
1088 #end
1089 </div>
1090 </div>
1091 <div class="thread-meta-right">
1092 <span class="thread-post-count">${reportCount}件の報告 ・ ${commentCount}件のコメント</span>
1093 #if($viewerAccountType == 'admin' || $viewerAccountType == 'verified' || $viewerAccountType == 'referred')
1094 #if($actFeatured == '1')
1095 <a href="$doc.getURL('view', "action=unfeature&actObj=${actIdx}&form_token=${services.csrf.getToken()}")" class="btn-featured-toggle btn-unfeature" title="特色ある活動の選定を解除"><svg class="ico ico-fixed-14" viewBox="0 0 24 24" fill="currentColor" stroke="none"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg> 特色解除</a>
1096 #else
1097 <a href="$doc.getURL('view', "action=feature&actObj=${actIdx}&form_token=${services.csrf.getToken()}")" class="btn-featured-toggle btn-feature" title="特色ある活動に選定(最大3件)"><svg class="ico ico-fixed-14" viewBox="0 0 24 24"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg> 特色設定</a>
1098 #end
1099 #end
1100 </div>
1101 </div>
1102
1103 ## --- 活動報告セクション ---
1104 #foreach($post in $threadPosts)
1105 #set($thisPostType = $!post.getValue('postType'))
1106 #if($thisPostType != 'comment')
1107 #set($postContent = $post.getValue('content'))
1108 #set($postAuthor = $post.getValue('author'))
1109 #set($postAccountType = $!post.getValue('authorAccountType'))
1110 #set($postUserRole = $!post.getValue('authorUserRole'))
1111 #set($postGrade = $!post.getValue('authorGrade'))
1112 #set($postSchoolCode = $!post.getValue('authorSchoolCode'))
1113 #set($postDate = $post.getValue('createdDate'))
1114 ## 論理削除チェック
1115 #set($postDeleted = $!post.getValue('deleted'))
1116 #if($postDeleted == 1 || $postDeleted == '1')
1117 #if($viewerAccountType == 'admin')
1118 <div class="thread-post thread-post-deleted thread-post-admin-deleted">
1119 <div class="thread-post-admin-deleted-content">
1120 <svg class="ico" viewBox="0 0 24 24"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>
1121 <strong>投稿者により削除済み</strong>($!post.getValue('deletedAt'))
1122 <div class="thread-post-restored-content">$!escapetool.xml($!postContent)</div>
1123 </div>
1124 </div>
1125 #else
1126 <div class="thread-post thread-post-deleted thread-post-user-deleted">
1127 <div class="thread-post-user-deleted-content">
1128 <svg class="ico" viewBox="0 0 24 24"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>
1129 この投稿は削除されました
1130 </div>
1131 </div>
1132 #end
1133 #else
1134 ## 通報による非表示チェック
1135 #set($postHidden = $!post.getValue('hidden'))
1136 #if($postHidden == 1 || $postHidden == '1')
1137 #if($viewerAccountType == 'admin')
1138 <div class="thread-post thread-post-admin-hidden">
1139 <div class="thread-post-admin-hidden-content">
1140 <svg class="ico" viewBox="0 0 24 24"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>
1141 <strong>通報により非表示中</strong>(理由: $!escapetool.xml($!post.getValue('hiddenReason')))
1142 <div class="thread-post-restored-content">$!escapetool.xml($!postContent)</div>
1143 </div>
1144 </div>
1145 #end
1146 #else
1147 ## 投稿の公開範囲チェック
1148 #set($postVis = $!post.getValue('visibility'))
1149 #if(!$postVis || $postVis == '') #set($postVis = 'public') #end
1150 #set($canViewPost = true)
1151 #if($postVis == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewPost = false)
1152 #elseif($postVis == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewPost = false)
1153 #end
1154 #if(!$canViewPost)
1155 <div class="thread-post visibility-restricted-post">
1156 <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> この投稿は #if($postVis == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>
1157 </div>
1158 #else
1159 ## 投稿者のアカウント種別に基づいたCSSクラス
1160 #set($postAuthorClass = 'author-general')
1161 #if($postAccountType == 'admin')
1162 #set($postAuthorClass = 'author-admin')
1163 #elseif($postAccountType == 'verified')
1164 #set($postAuthorClass = 'author-verified')
1165 #elseif($postAccountType == 'referred')
1166 #set($postAuthorClass = 'author-referred')
1167 #end
1168
1169 #set($isPinned = $!post.getValue('pinned'))
1170 <div class="thread-post $postAuthorClass #if($isPinned == '1')thread-post-pinned#end">
1171 <div class="thread-post-sidebar"><div class="thread-post-bar"></div></div>
1172 <div class="thread-post-content">
1173 <div class="thread-post-header">
1174 #if($isPinned == '1')
1175 <span class="pin-badge"><svg class="ico ico-fixed-14" viewBox="0 0 24 24" fill="currentColor" stroke="none"><path d="M16 2l-4 4-2-1-5 5 3 3-6 6h4l4-4 3 3 5-5-1-2 4-4-5-5z"/></svg> 固定</span>
1176 #end
1177 #set($postAuthorRef = $!post.getValue('authorRef'))
1178 <span class="thread-post-author">
1179 #if($postAuthorRef && $postAuthorRef != '')
1180 <a href="$xwiki.getURL('SeitokaiCode.UserProfile', 'view', "user=${escapetool.url($postAuthorRef)}")">$!escapetool.xml($!postAuthor)</a>
1181 #else
1182 $!escapetool.xml($!postAuthor)
1183 #end
1184 </span>
1185 <span class="author-badge">
1186 #if($postAccountType == 'admin')
1187 <span class="badge badge-admin badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 管理者</span>
1188 #elseif($postAccountType == 'verified')
1189 <span class="badge badge-verified badge-sm"><svg class="ico" viewBox="0 0 24 24" stroke-width="2.5"><path d="M20 6L9 17l-5-5"/></svg> 承認済み</span>
1190 #elseif($postAccountType == 'referred')
1191 <span class="badge badge-referred badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/></svg> 紹介</span>
1192 #else
1193 <span class="badge badge-general badge-sm">一般</span>
1194 #end
1195 ## 所属バッジ(投稿者の学校コードとページの学校コードを比較)
1196 #set($postIsSchoolMatch = ($postSchoolCode == $schoolCode || ($affiliatedSchoolCode != '' && $postSchoolCode == $affiliatedSchoolCode)))
1197 #if($postSchoolCode && $postSchoolCode != '' && $postAccountType != 'general')
1198 #if($postUserRole == 'graduate' && $postIsSchoolMatch)
1199 <span class="badge badge-alumni badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10l-10-5L2 10l10 5 10-5z"/><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5"/></svg> 卒業生</span>
1200 #elseif($postIsSchoolMatch && $postUserRole != 'graduate')
1201 #if($postAccountType == 'verified' || $postAccountType == 'admin')
1202 <span class="badge badge-school-internal-confirmed badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内(確認済)</span>
1203 #else
1204 <span class="badge badge-school-internal badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内</span>
1205 #end
1206 #else
1207 <span class="badge badge-school-external badge-sm"><svg class="ico" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg> 他校</span>
1208 #end
1209 #end
1210 #if($postUserRole == 'student')
1211 <span class="badge badge-role-student badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10l-10-5L2 10l10 5 10-5z"/><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5"/></svg> 生徒</span>
1212 #set($postIsOfficer = $!post.getValue('authorIsOfficer'))
1213 #if($postIsOfficer == 'true')
1214 <span class="badge badge-role-officer badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg> 役員</span>
1215 #end
1216 #elseif($postUserRole == 'teacher')
1217 <span class="badge badge-role-teacher badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M4 19.5A2.5 2.5 0 016.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z"/></svg> 教員</span>
1218 #elseif($postUserRole == 'graduate')
1219 <span class="badge badge-role-graduate badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10l-10-5L2 10l10 5 10-5z"/><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5"/></svg> 卒業生</span>
1220 #end
1221 </span>
1222 <span class="thread-post-date">$!postDate</span>
1223 #set($postEdited = $!post.getValue('edited'))
1224 #if($postEdited == 1 || $postEdited == '1')
1225 <span class="post-edited-label">(編集済み)</span>
1226 #end
1227 #set($postAuthorRefH = $!post.getValue('authorRef'))
1228 #set($postObjNumH = $post.number)
1229 #if(!$isGuest && $xcontext.user != $postAuthorRefH)
1230 <button type="button" class="btn-post-report btn-post-report-header" onclick="openReportDialog(this, '${doc.fullName}', $postObjNumH, '${services.csrf.getToken()}')" title="この投稿を通報">
1231 <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" y1="22" x2="4" y2="15"/></svg> 通報
1232 </button>
1233 #end
1234 </div>
1235 <div class="thread-post-body">
1236 $!escapetool.xml($!postContent)
1237 #set($postImages = $!post.getValue('images'))
1238 #if($postImages && $postImages.trim() != '')
1239 <div class="post-images">
1240 #set($imageList = $postImages.trim().split("\n"))
1241 #set($imageCount = $imageList.size())
1242 #if($imageCount > 4)#set($imageCount = 4)#end
1243 <div class="post-image-grid post-image-count-${imageCount}">
1244 #foreach($imgFile in $imageList)
1245 #if($foreach.count <= 4)
1246 #set($imgName = $imgFile.trim())
1247 #if($imgName != '')
1248 <div class="post-image-item">
1249 <a href="$doc.getAttachmentURL($imgName)" target="_blank">
1250 <img src="$doc.getAttachmentURL($imgName)" alt="$!escapetool.xml($imgName)" loading="lazy"/>
1251 </a>
1252 </div>
1253 #end
1254 #end
1255 #end
1256 </div>
1257 </div>
1258 #end
1259 ## ファイル添付の表示
1260 #set($postFiles = $!post.getValue('files'))
1261 #if($postFiles && $postFiles.trim() != '')
1262 <div class="post-files">
1263 #set($fileList = $postFiles.trim().split("\n"))
1264 #foreach($attachFile in $fileList)
1265 #if($foreach.count <= 2)
1266 #set($fName = $attachFile.trim())
1267 #if($fName != '')
1268 #set($fLower = $fName.toLowerCase())
1269 #set($fIcon = 'file')
1270 #set($fColor = '#64748b')
1271 #if($fLower.endsWith('.pdf'))#set($fIcon = 'pdf')#set($fColor = '#dc2626')#end
1272 #if($fLower.endsWith('.docx'))#set($fIcon = 'word')#set($fColor = '#2563eb')#end
1273 #if($fLower.endsWith('.xlsx'))#set($fIcon = 'excel')#set($fColor = '#16a34a')#end
1274 #if($fLower.endsWith('.pptx'))#set($fIcon = 'ppt')#set($fColor = '#ea580c')#end
1275 ## ファイル名からプレフィックス(file_YYYYMMDDHHMMSS_N_)を除去して表示
1276 #set($displayName = $fName)
1277 #if($fName.matches('file_\d{14}_\d+_.*'))
1278 #set($displayName = $fName.replaceFirst('file_\d{14}_\d+_', ''))
1279 #end
1280 <div class="post-file-item">
1281 <a href="$doc.getAttachmentURL($fName)" target="_blank" download="$!escapetool.xml($displayName)">
1282 #if($fIcon == 'pdf')<svg class="ico ico-md" style="color:${fColor};" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><path d="M9 15v-2h1.5a1.5 1.5 0 010 3H9"/></svg>
1283 #elseif($fIcon == 'word')<svg class="ico ico-md" style="color:${fColor};" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><path d="M8 15l1.5-5 1.5 5 1.5-5 1.5 5"/></svg>
1284 #elseif($fIcon == 'excel')<svg class="ico ico-md" style="color:${fColor};" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="16" y2="17"/><line x1="12" y1="13" x2="12" y2="17"/></svg>
1285 #elseif($fIcon == 'ppt')<svg class="ico ico-md" style="color:${fColor};" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><rect x="8" y="12" width="8" height="6" rx="1"/></svg>
1286 #else<svg class="ico ico-md" style="color:${fColor};" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>
1287 #end
1288 <span class="post-file-name">$!escapetool.xml($displayName)</span>
1289 </a>
1290 </div>
1291 #end
1292 #end
1293 #end
1294 </div>
1295 #end
1296 </div>
1297 #if($postVis != 'public')
1298 <div class="visibility-badge visibility-${postVis} post-action-mt">#if($postVis == 'school_trusted')<svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 校内承認・紹介限定#else<svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内限定#end</div>
1299 #end
1300 ## 固定/編集/削除/通報/非表示ボタン(横並び)
1301 #set($postAuthorRef = $!post.getValue('authorRef'))
1302 #set($postObjNumED = $post.number)
1303 #set($showPinBtn = ($viewerAccountType == 'admin' || $viewerAccountType == 'verified'))
1304 #set($showEditDeleteBtn = ($xcontext.user == $postAuthorRef || $viewerAccountType == 'admin'))
1305 #set($showHideBtn = ($viewerAccountType == 'admin'))
1306 #if($showPinBtn || $showEditDeleteBtn || $showHideBtn)
1307 <div class="post-edit-actions post-action-mt">
1308 #if($showPinBtn)
1309 #set($postObjNum = $post.number)
1310 #if($isPinned == '1')
1311 <a href="$doc.getURL('view', "action=unpin&postObj=${postObjNum}&form_token=${services.csrf.getToken()}")" class="btn-pin-toggle btn-unpin" title="固定を解除">
1312 <svg class="ico ico-fixed-14" viewBox="0 0 24 24" fill="currentColor" stroke="none"><path d="M16 2l-4 4-2-1-5 5 3 3-6 6h4l4-4 3 3 5-5-1-2 4-4-5-5z"/></svg> 固定を解除
1313 </a>
1314 #else
1315 <a href="$doc.getURL('view', "action=pin&postObj=${postObjNum}&form_token=${services.csrf.getToken()}")" class="btn-pin-toggle btn-pin" title="この投稿を固定">
1316 <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M16 2l-4 4-2-1-5 5 3 3-6 6h4l4-4 3 3 5-5-1-2 4-4-5-5z"/></svg> 固定する
1317 </a>
1318 #end
1319 #end
1320 #if($showEditDeleteBtn)
1321 #if($xcontext.user == $postAuthorRef)
1322 #set($editImages = $!post.getValue('images'))
1323 #set($editFiles = $!post.getValue('files'))
1324 <button type="button" class="btn-post-edit" data-school="${doc.fullName}" data-obj="$postObjNumED" data-content="$!escapetool.xml($!postContent)" data-images="$!escapetool.xml($!editImages)" data-files="$!escapetool.xml($!editFiles)" data-post-type="$!post.getValue('postType')" onclick="openEditPost(this)" title="この投稿を編集">
1325 <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/></svg> 編集
1326 </button>
1327 #end
1328 <button type="button" class="btn-post-delete" onclick="confirmDeletePost('${doc.fullName}', $postObjNumED, '${services.csrf.getToken()}')" title="この投稿を削除">
1329 <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg> 削除
1330 </button>
1331 #end
1332 #if($showHideBtn)
1333 <button type="button" class="btn-post-hide" onclick="openHideDialog(this, '${doc.fullName}', $postObjNumED, '${services.csrf.getToken()}')" title="この投稿を非表示にする">
1334 <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg> 非表示
1335 </button>
1336 #end
1337 </div>
1338 #end
1339 </div>
1340 </div>
1341 #end## /canViewPost
1342 #end## /postHidden
1343 #end## /postDeleted
1344 #end## /postType != comment
1345 #end## /foreach reports
1346
1347 ## --- コメントセクション(折りたたみ) ---
1348 #if($commentCount > 0)
1349 <details class="thread-comments-section">
1350 <summary class="thread-comments-toggle">
1351 <svg class="ico" viewBox="0 0 24 24"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/></svg> ${commentCount}件のコメント
1352 </summary>
1353 #foreach($post in $threadPosts)
1354 #set($thisPostType = $!post.getValue('postType'))
1355 #if($thisPostType == 'comment')
1356 #set($postContent = $post.getValue('content'))
1357 #set($postAuthor = $post.getValue('author'))
1358 #set($postAccountType = $!post.getValue('authorAccountType'))
1359 #set($postDate = $post.getValue('createdDate'))
1360 #set($postDeleted = $!post.getValue('deleted'))
1361 #if($postDeleted == 1 || $postDeleted == '1')
1362 <div class="thread-comment thread-comment-deleted">
1363 <span class="thread-comment-meta">このコメントは削除されました</span>
1364 </div>
1365 #else
1366 #set($postHidden = $!post.getValue('hidden'))
1367 #if($postHidden == 1 || $postHidden == '1')
1368 <div class="thread-comment thread-comment-hidden">
1369 <span class="thread-comment-meta">このコメントは非表示にされました</span>
1370 </div>
1371 #else
1372 <div class="thread-comment">
1373 <span class="thread-comment-author">$!escapetool.xml($postAuthor)</span>
1374 <span class="thread-comment-date">$!postDate</span>
1375 <div class="thread-comment-body">$!escapetool.xml($postContent)</div>
1376 </div>
1377 #end
1378 #end
1379 #end
1380 #end
1381 </details>
1382 #end
1383
1384 #if($xcontext.user != "XWiki.XWikiGuest")
1385 <div class="thread-add-post">
1386 #if($isSchoolMember || $isAlumniOfSchool || $isViewerAdmin)
1387 <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=report" class="btn-thread-add">
1388 + 活動報告を追加
1389 </a>
1390 #end
1391 <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=comment" class="btn-thread-comment">
1392 <svg class="ico" viewBox="0 0 24 24"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/></svg> コメントを書く
1393 </a>
1394 </div>
1395 #end
1396 </div>
1397 {{/html}}
1398 #end
1399 #else
1400 {{html clean="false"}}
1401 <div class="empty-state">
1402 <div class="empty-state-icon"><svg class="ico" viewBox="0 0 24 24" stroke-width="1.5"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg></div>
1403 <div class="empty-state-title">活動報告はまだありません</div>
1404 <div class="empty-state-desc">この学校の活動を記録して、他校と共有しましょう。<br>「活動を追加」ボタンから最初の活動を作成できます。</div>
1405 </div>
1406 {{/html}}
1407 #end
1408
1409 ## --- 活動追加ボタン ---
1410 #if($xcontext.user != "XWiki.XWikiGuest")
1411 {{html clean="false"}}
1412 <div class="activity-add-section">
1413 <a href="/bin/SeitokaiCode/ActivityForm?schoolPage=${doc.fullName}&schoolCode=$!escapetool.url($schoolCode)" class="btn btn-primary btn-add-activity">
1414 <svg class="ico" viewBox="0 0 24 24" stroke-width="2.5"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> 活動を追加
1415 </a>
1416 </div>
1417 {{/html}}
1418 #end
1419
1420 ## --- 年度タブ切り替え JavaScript ---
1421 {{html clean="false"}}
1422 <script>
1423 // コンパクト表示(タイトルのみ)トグル
1424 function toggleCompactView() {
1425 var container = document.querySelector('.xwiki-content') || document.body;
1426 var isCompact = container.classList.toggle('activity-compact-view');
1427 var btn = document.getElementById('btnViewToggle');
1428 if (btn) {
1429 btn.querySelector('.toggle-label').textContent = isCompact ? '詳細表示' : '一覧表示';
1430 btn.title = isCompact ? '詳細表示に戻す' : 'タイトルのみ表示';
1431 }
1432 // コンパクトモードでは各スレッドヘッダーをクリックで個別展開可能にする
1433 document.querySelectorAll('.activity-thread').forEach(function(thread) {
1434 if (isCompact) {
1435 thread.classList.remove('compact-expanded');
1436 }
1437 });
1438 }
1439
1440 // コンパクトモードで個別スレッドを展開/折りたたみ
1441 function toggleThreadExpand(e) {
1442 var container = document.querySelector('.xwiki-content') || document.body;
1443 if (!container.classList.contains('activity-compact-view')) return;
1444 // リンクやボタンのクリックはスルー
1445 if (e.target.closest('a, button, .btn-featured-toggle')) return;
1446 var thread = e.target.closest('.activity-thread');
1447 if (thread) {
1448 thread.classList.toggle('compact-expanded');
1449 }
1450 }
1451
1452 function switchActivityFY(fy, btn) {
1453 // タブのアクティブ状態を切り替え
1454 document.querySelectorAll('.activity-fy-tab').forEach(function(t) { t.classList.remove('active'); });
1455 btn.classList.add('active');
1456 // 活動スレッドの表示切り替え
1457 document.querySelectorAll('.activity-thread[data-fiscal-year]').forEach(function(thread) {
1458 if (fy === 'all' || thread.getAttribute('data-fiscal-year') === fy) {
1459 thread.classList.remove('fy-hidden');
1460 } else {
1461 thread.classList.add('fy-hidden');
1462 }
1463 });
1464 }
1465 // ページ読み込み時の初期化
1466 document.addEventListener('DOMContentLoaded', function() {
1467 // 年度タブを降順にソート(「全期間」タブは末尾に固定)
1468 var tabContainer = document.querySelector('.activity-fy-tabs');
1469 if (tabContainer) {
1470 var tabs = Array.from(tabContainer.querySelectorAll('.activity-fy-tab'));
1471 var allTab = null;
1472 var fyTabs = [];
1473 tabs.forEach(function(t) {
1474 var onclickStr = t.getAttribute('onclick') || '';
1475 if (onclickStr.indexOf("'all'") !== -1) { allTab = t; }
1476 else { fyTabs.push(t); }
1477 });
1478 // 年度タブを数値の降順でソート
1479 fyTabs.sort(function(a, b) {
1480 var aYear = parseInt(a.textContent) || 0;
1481 var bYear = parseInt(b.textContent) || 0;
1482 return bYear - aYear;
1483 });
1484 // DOM再配置
1485 fyTabs.forEach(function(t) { tabContainer.appendChild(t); });
1486 if (allTab) { tabContainer.appendChild(allTab); }
1487 }
1488 // デフォルトで現在の年度を表示
1489 var defaultTab = document.querySelector('.activity-fy-tab.active');
1490 if (defaultTab) { defaultTab.click(); }
1491 // 保存成功時のトースト通知
1492 if (window.location.search.indexOf('saved=1') !== -1) {
1493 showToast('学校情報を保存しました', 'success');
1494 // URLパラメータをクリーンアップ(リロード時に再表示されないよう)
1495 if (window.history.replaceState) {
1496 window.history.replaceState({}, document.title, window.location.pathname);
1497 }
1498 }
1499 // コンパクトモード: スレッドヘッダークリックで個別展開
1500 document.querySelectorAll('.activity-thread-header').forEach(function(header) {
1501 header.addEventListener('click', toggleThreadExpand);
1502 });
1503 // 長文投稿の折りたたみ初期化(max-height: 12em 超で省略)
1504 document.querySelectorAll('.thread-post-body').forEach(function(body) {
1505 // pre-wrapのまま高さを測定し、max-height(12em ≒ ~200px)を超える場合に折りたたむ
1506 var fullH = body.scrollHeight;
1507 // 12em を px に変換(font-size × line-height × 行数 の近似値ではなくCSSと同じ値を取得)
1508 body.classList.add('truncated');
1509 var maxH = body.clientHeight; // max-height: 12em 適用後の高さ
1510 body.classList.remove('truncated');
1511 if (fullH > maxH + 30) {
1512 body.classList.add('truncated');
1513 var btn = document.createElement('button');
1514 btn.className = 'btn-read-more';
1515 btn.textContent = '広げて読む ▼';
1516 btn.addEventListener('click', function() {
1517 var isExpanded = body.classList.toggle('expanded');
1518 btn.textContent = isExpanded ? '折りたたむ ▲' : '広げて読む ▼';
1519 });
1520 body.parentNode.insertBefore(btn, body.nextSibling);
1521 }
1522 });
1523 });
1524
1525 // トースト通知表示
1526 function showToast(message, type) {
1527 type = type || 'success';
1528 var container = document.getElementById('toast-container');
1529 if (!container) {
1530 container = document.createElement('div');
1531 container.id = 'toast-container';
1532 container.className = 'toast-container';
1533 document.body.appendChild(container);
1534 }
1535 var icons = {
1536 success: '<svg class="ico ico-md" viewBox="0 0 24 24" stroke-width="2.5"><path d="M20 6L9 17l-5-5"/></svg>',
1537 error: '<svg class="ico ico-md" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>'
1538 };
1539 var toast = document.createElement('div');
1540 toast.className = 'toast toast-' + type;
1541 toast.innerHTML = (icons[type] || '') + '<span>' + message + '</span>';
1542 container.appendChild(toast);
1543 setTimeout(function() { toast.remove(); }, 3200);
1544 }
1545
1546 // 学校基本情報・連絡先の折りたたみトグル
1547 function toggleInfoCard(cardId) {
1548 var card = document.getElementById(cardId);
1549 if (!card) return;
1550 card.classList.toggle('collapsed');
1551 var isCollapsed = card.classList.contains('collapsed');
1552 var h2 = card.querySelector('h2[role="button"]');
1553 if (h2) h2.setAttribute('aria-expanded', !isCollapsed);
1554 }
1555
1556 // 投稿の編集(インライン編集フォームを開く)
1557 function openEditPost(btn) {
1558 var postEl = btn.closest('.thread-post');
1559 if (!postEl) return;
1560 var existing = postEl.querySelector('.post-edit-form');
1561 if (existing) { existing.remove(); return; }
1562 var bodyEl = postEl.querySelector('.thread-post-body');
1563 if (!bodyEl) return;
1564
1565 var schoolPage = btn.getAttribute('data-school');
1566 var postObjNum = btn.getAttribute('data-obj');
1567 var currentContent = btn.getAttribute('data-content') || '';
1568 var currentImages = btn.getAttribute('data-images') || '';
1569 var currentFiles = btn.getAttribute('data-files') || '';
1570 var postType = btn.getAttribute('data-post-type') || 'report';
1571
1572 var form = document.createElement('div');
1573 form.className = 'post-edit-form';
1574 form.setAttribute('data-school', schoolPage);
1575 form.setAttribute('data-obj', postObjNum);
1576
1577 var html = '<textarea id="editContent_' + postObjNum + '">' + currentContent.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') + '</textarea>';
1578
1579 // コメント以外は添付ファイル編集を表示
1580 if (postType !== 'comment') {
1581 // 既存画像
1582 html += '<div class="edit-attachments">';
1583 if (currentImages.trim()) {
1584 html += '<div class="edit-attach-section"><span class="edit-attach-label">画像</span>';
1585 var imgs = currentImages.trim().split('\n');
1586 for (var i = 0; i < imgs.length; i++) {
1587 var img = imgs[i].trim();
1588 if (!img) continue;
1589 html += '<div class="edit-attach-item" data-name="' + img.replace(/"/g,'&quot;') + '">' +
1590 '<img src="/xwiki/bin/download/' + schoolPage.replace(/\./g,'/') + '/' + encodeURIComponent(img) + '" class="edit-attach-thumb" />' +
1591 '<button type="button" class="edit-attach-remove" onclick="removeEditAttach(this)" title="削除">✕</button>' +
1592 '<input type="hidden" name="keepImages" value="' + img.replace(/"/g,'&quot;') + '" />' +
1593 '</div>';
1594 }
1595 html += '</div>';
1596 }
1597 // 既存ファイル
1598 if (currentFiles.trim()) {
1599 html += '<div class="edit-attach-section"><span class="edit-attach-label">ファイル</span>';
1600 var files = currentFiles.trim().split('\n');
1601 for (var j = 0; j < files.length; j++) {
1602 var f = files[j].trim();
1603 if (!f) continue;
1604 var displayName = f;
1605 if (/^file_\d{14}_\d+_/.test(f)) displayName = f.replace(/^file_\d{14}_\d+_/, '');
1606 html += '<div class="edit-attach-item" data-name="' + f.replace(/"/g,'&quot;') + '">' +
1607 '<span class="edit-attach-fname">' + displayName.replace(/</g,'&lt;').replace(/>/g,'&gt;') + '</span>' +
1608 '<button type="button" class="edit-attach-remove" onclick="removeEditAttach(this)" title="削除">✕</button>' +
1609 '<input type="hidden" name="keepFiles" value="' + f.replace(/"/g,'&quot;') + '" />' +
1610 '</div>';
1611 }
1612 html += '</div>';
1613 }
1614 // 新規追加
1615 html += '<div class="edit-attach-add">' +
1616 '<label class="form-label-sm">画像を追加(最大4枚まで)</label>' +
1617 '<input type="file" name="editNewImages" accept="image/*" multiple class="form-file-input-sm" />' +
1618 '<div class="form-hint">JPEG / PNG / GIF / WebP、各5MBまで</div>' +
1619 '<label class="form-label-sm" style="margin-top:8px;">ファイルを追加(最大2つまで)</label>' +
1620 '<input type="file" name="editNewFiles" accept=".pdf,.docx,.xlsx,.pptx" multiple class="form-file-input-sm" />' +
1621 '<div class="form-hint">PDF / Word / Excel / PowerPoint、各10MBまで</div>' +
1622 '</div>';
1623 html += '</div>';
1624 }
1625
1626 html += '<div class="post-edit-form-actions">' +
1627 '<button type="button" class="btn-cancel-edit" onclick="this.closest(\'.post-edit-form\').remove()">キャンセル</button>' +
1628 '<button type="button" class="btn-save" onclick="saveEditPost(this)">保存</button>' +
1629 '</div>';
1630
1631 form.innerHTML = html;
1632 bodyEl.parentNode.insertBefore(form, bodyEl.nextSibling);
1633 form.querySelector('textarea').focus();
1634 }
1635
1636 function removeEditAttach(btn) {
1637 var item = btn.closest('.edit-attach-item');
1638 if (item) item.remove();
1639 }
1640
1641 // 投稿の編集を保存
1642 function saveEditPost(btn) {
1643 var formEl = btn.closest('.post-edit-form');
1644 if (!formEl) return;
1645 var schoolPage = formEl.getAttribute('data-school');
1646 var postObjNum = formEl.getAttribute('data-obj');
1647 var textarea = formEl.querySelector('textarea');
1648 if (!textarea) return;
1649 var newContent = textarea.value.trim();
1650 if (!newContent) { alert('投稿内容を入力してください'); return; }
1651
1652 var csrfEl = document.querySelector('input[name="form_token"]');
1653 var csrfToken = csrfEl ? csrfEl.value : '';
1654
1655 var fd = new FormData();
1656 fd.append('schoolPage', schoolPage);
1657 fd.append('postObj', postObjNum);
1658 fd.append('newContent', newContent);
1659 fd.append('form_token', csrfToken);
1660
1661 // 残す画像・ファイル
1662 formEl.querySelectorAll('input[name="keepImages"]').forEach(function(el) { fd.append('keepImages', el.value); });
1663 formEl.querySelectorAll('input[name="keepFiles"]').forEach(function(el) { fd.append('keepFiles', el.value); });
1664
1665 // 新規画像
1666 var newImgInput = formEl.querySelector('input[name="editNewImages"]');
1667 if (newImgInput && newImgInput.files) {
1668 for (var i = 0; i < newImgInput.files.length; i++) { fd.append('editNewImages', newImgInput.files[i]); }
1669 }
1670 // 新規ファイル
1671 var newFileInput = formEl.querySelector('input[name="editNewFiles"]');
1672 if (newFileInput && newFileInput.files) {
1673 for (var j = 0; j < newFileInput.files.length; j++) { fd.append('editNewFiles', newFileInput.files[j]); }
1674 }
1675
1676 btn.disabled = true;
1677 btn.textContent = '保存中...';
1678
1679 var xhr = new XMLHttpRequest();
1680 xhr.open('POST', '/bin/get/SeitokaiCode/EditPost?outputSyntax=plain', true);
1681 xhr.onload = function() {
1682 try {
1683 var res = JSON.parse(xhr.responseText);
1684 if (res.success) {
1685 showToast('投稿を更新しました', 'success');
1686 setTimeout(function() { location.reload(); }, 800);
1687 } else {
1688 btn.disabled = false; btn.textContent = '保存';
1689 alert('編集に失敗しました: ' + (res.error || ''));
1690 }
1691 } catch(e) { btn.disabled = false; btn.textContent = '保存'; alert('編集に失敗しました'); }
1692 };
1693 xhr.onerror = function() { btn.disabled = false; btn.textContent = '保存'; alert('通信エラーが発生しました'); };
1694 xhr.send(fd);
1695 }
1696
1697 // 投稿の削除(確認ダイアログ付き)
1698 function confirmDeletePost(schoolPage, postObjNum, token) {
1699 if (!confirm('この投稿を削除しますか?\\n削除後は「この投稿は削除されました」と表示されます。')) return;
1700 var xhr = new XMLHttpRequest();
1701 xhr.open('POST', '/bin/get/SeitokaiCode/DeletePost?outputSyntax=plain', true);
1702 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1703 var deletePostData = 'schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&form_token=' + encodeURIComponent(token);
1704 xhr.onload = function() {
1705 try {
1706 var res = JSON.parse(xhr.responseText);
1707 if (res.success) {
1708 showToast('投稿を削除しました', 'success');
1709 setTimeout(function() { location.reload(); }, 800);
1710 } else {
1711 alert('削除に失敗しました: ' + (res.error || ''));
1712 }
1713 } catch(e) { alert('削除に失敗しました'); }
1714 };
1715 xhr.onerror = function() { alert('通信エラーが発生しました'); };
1716 xhr.send(deletePostData);
1717 }
1718
1719 /* --- 通報ダイアログ --- */
1720 function openReportDialog(btn, targetPage, postObjNum, token) {
1721 if (document.getElementById('report-dialog-overlay')) return;
1722 var reasons = ['宣伝・スパム','不適切な内容','個人情報の露出','誹謗中傷','誤情報','その他'];
1723 var overlay = document.createElement('div');
1724 overlay.id = 'report-dialog-overlay';
1725 overlay.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:9999;display:flex;align-items:center;justify-content:center;';
1726 var dialog = document.createElement('div');
1727 dialog.style.cssText = 'background:#fff;border-radius:12px;padding:24px;max-width:400px;width:90%;max-height:80vh;overflow-y:auto;';
1728 var html = '<h3 style="margin:0 0 16px;font-size:1.1em;">投稿を通報</h3>';
1729 html += '<p style="margin:0 0 12px;font-size:0.9em;color:#4b5563;">通報された投稿は管理者が確認するまで一時的に非表示になります。</p>';
1730 html += '<label style="display:block;margin-bottom:8px;font-weight:600;font-size:0.9em;">通報理由</label>';
1731 html += '<select id="report-reason" style="width:100%;padding:8px;border:1px solid #d1d5db;border-radius:8px;margin-bottom:12px;font-size:0.9em;">';
1732 for (var i=0; i<reasons.length; i++) html += '<option value="'+reasons[i]+'">'+reasons[i]+'</option>';
1733 html += '</select>';
1734 html += '<label style="display:block;margin-bottom:8px;font-weight:600;font-size:0.9em;">補足コメント(任意)</label>';
1735 html += '<textarea id="report-detail" rows="3" maxlength="500" style="width:100%;padding:8px;border:1px solid #d1d5db;border-radius:8px;resize:vertical;font-size:0.9em;box-sizing:border-box;" placeholder="具体的な内容があればご記入ください"></textarea>';
1736 html += '<div style="display:flex;gap:8px;margin-top:16px;justify-content:flex-end;">';
1737 html += '<button type="button" id="report-cancel-btn" style="padding:8px 16px;border:1px solid #d1d5db;border-radius:8px;background:#fff;cursor:pointer;">キャンセル</button>';
1738 html += '<button type="button" id="report-submit-btn" style="padding:8px 16px;border:none;border-radius:8px;background:#dc2626;color:#fff;cursor:pointer;font-weight:600;">通報する</button>';
1739 html += '</div>';
1740 dialog.innerHTML = html;
1741 overlay.appendChild(dialog);
1742 document.body.appendChild(overlay);
1743 overlay.addEventListener('click', function(e) { if (e.target === overlay) overlay.remove(); });
1744 document.getElementById('report-cancel-btn').addEventListener('click', function() { overlay.remove(); });
1745 document.getElementById('report-submit-btn').addEventListener('click', function() {
1746 var reason = document.getElementById('report-reason').value;
1747 var detail = document.getElementById('report-detail').value;
1748 var submitBtn = document.getElementById('report-submit-btn');
1749 submitBtn.disabled = true; submitBtn.textContent = '送信中...';
1750 var xhr = new XMLHttpRequest();
1751 xhr.open('POST', '/bin/get/SeitokaiCode/ReportAction?outputSyntax=plain', true);
1752 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1753 var data = 'targetPage=' + encodeURIComponent(targetPage) + '&targetPost=' + postObjNum + '&reason=' + encodeURIComponent(reason) + '&detail=' + encodeURIComponent(detail) + '&form_token=' + encodeURIComponent(token);
1754 xhr.onload = function() {
1755 overlay.remove();
1756 showToast('通報を受け付けました', 'success');
1757 setTimeout(function() { location.reload(); }, 1000);
1758 };
1759 xhr.onerror = function() { overlay.remove(); alert('通信エラーが発生しました'); };
1760 xhr.send(data);
1761 });
1762 }
1763
1764 /* --- 非表示ダイアログ(管理者用) --- */
1765 function openHideDialog(btn, targetPage, postObjNum, token) {
1766 if (document.getElementById('hide-dialog-overlay')) return;
1767 var overlay = document.createElement('div');
1768 overlay.id = 'hide-dialog-overlay';
1769 overlay.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:9999;display:flex;align-items:center;justify-content:center;';
1770 var dialog = document.createElement('div');
1771 dialog.style.cssText = 'background:#fff;border-radius:12px;padding:24px;max-width:400px;width:90%;';
1772 var html = '<h3 style="margin:0 0 16px;font-size:1.1em;">投稿を非表示にする</h3>';
1773 html += '<label style="display:block;margin-bottom:8px;font-weight:600;font-size:0.9em;">非表示の理由</label>';
1774 html += '<input type="text" id="hide-reason" style="width:100%;padding:8px;border:1px solid #d1d5db;border-radius:8px;margin-bottom:12px;font-size:0.9em;box-sizing:border-box;" placeholder="理由を入力" />';
1775 html += '<div style="display:flex;gap:8px;margin-top:16px;justify-content:flex-end;">';
1776 html += '<button type="button" id="hide-cancel-btn" style="padding:8px 16px;border:1px solid #d1d5db;border-radius:8px;background:#fff;cursor:pointer;">キャンセル</button>';
1777 html += '<button type="button" id="hide-submit-btn" style="padding:8px 16px;border:none;border-radius:8px;background:#d97706;color:#fff;cursor:pointer;font-weight:600;">非表示にする</button>';
1778 html += '<button type="button" id="hide-warn-btn" style="padding:8px 16px;border:none;border-radius:8px;background:#dc2626;color:#fff;cursor:pointer;font-weight:600;">非表示+警告</button>';
1779 html += '</div>';
1780 dialog.innerHTML = html;
1781 overlay.appendChild(dialog);
1782 document.body.appendChild(overlay);
1783 overlay.addEventListener('click', function(e) { if (e.target === overlay) overlay.remove(); });
1784 document.getElementById('hide-cancel-btn').addEventListener('click', function() { overlay.remove(); });
1785 function doHide(action) {
1786 var reason = document.getElementById('hide-reason').value || '管理者判断';
1787 window.location.href = '/bin/view/SeitokaiCode/ModerationAction?action=' + action + '&targetPage=' + encodeURIComponent(targetPage) + '&targetPost=' + postObjNum + '&reason=' + encodeURIComponent(reason) + '&form_token=' + encodeURIComponent(token);
1788 }
1789 document.getElementById('hide-submit-btn').addEventListener('click', function() { doHide('hide'); });
1790 document.getElementById('hide-warn-btn').addEventListener('click', function() { doHide('hide-warn'); });
1791 }
1792 </script>
1793 {{/html}}
1794 {{/velocity}}