Last modified by Super Admin on 2026/04/05 18:59

From version Icon 96.1 Icon
edited by Super Admin
on 2026/03/20 18:06
Change comment: There is no comment for this version
To version Icon 116.1 Icon
edited by Super Admin
on 2026/03/27 15:41
Change comment: There is no comment for this version

Summary

Details

Icon Page properties
Content
... ... @@ -7,6 +7,19 @@
7 7   #stop
8 8  #end
9 9  {{html clean="false"}}
10 +## --- OGP メタタグ(SNSシェア対応) ---
11 +#set($ogTitle = "$!{schoolName} — 生徒会Wiki")
12 +#set($ogDesc = "$!{schoolName}の生徒会活動情報。全国の高校の生徒会活動事例を集積・共有するプラットフォーム。")
13 +#set($ogUrl = "https://${request.serverName}${doc.getURL('view')}")
14 +<meta property="og:type" content="article" />
15 +<meta property="og:title" content="$escapetool.xml($ogTitle)" />
16 +<meta property="og:description" content="$escapetool.xml($ogDesc)" />
17 +<meta property="og:url" content="$escapetool.xml($ogUrl)" />
18 +<meta property="og:site_name" content="生徒会Wiki" />
19 +<meta property="og:locale" content="ja_JP" />
20 +<meta name="twitter:card" content="summary" />
21 +<meta name="twitter:title" content="$escapetool.xml($ogTitle)" />
22 +<meta name="twitter:description" content="$escapetool.xml($ogDesc)" />
10 10  ## メンテナンスバナー({{include}}ではなくインラインで記述し、<p>タグ挿入を回避)
11 11  #set($bannerDoc = $xwiki.getDocument('SeitokaiAdmin.MaintenanceBanner'))
12 12  #set($bannerObj = $bannerDoc.getObject('SeitokaiCode.MaintenanceBannerClass'))
... ... @@ -68,6 +68,7 @@
68 68  #set($activityPlace = $doc.getValue('activityPlace'))
69 69  #set($activityRoomEquipment = $doc.getValue('activityRoomEquipment'))
70 70  #set($activityRoomImage = $doc.getValue('activityRoomImage'))
84 +#set($ictTools = $doc.getValue('ictTools'))
71 71  #set($ictUsage = $doc.getValue('ictUsage'))
72 72  
73 73  ## --- 生徒総会 ---
... ... @@ -144,6 +144,7 @@
144 144  #set($isGuest = $viewerUser == 'XWiki.XWikiGuest')
145 145  #set($isViewerAdmin = false)
146 146  #set($viewerSchoolCode = '')
161 +#set($viewerSecondaryGraduated = false)
147 147  #if(!$isGuest)
148 148   #set($viewerDoc = $xwiki.getDocument($viewerUser))
149 149   #set($viewerAccountType = $!viewerDoc.getValue('accountType'))
... ... @@ -153,6 +153,24 @@
153 153   #if($viewerAccountType == 'admin')
154 154   #set($isViewerAdmin = true)
155 155   #end
171 + ## 第2所属校の在学年数超過チェック
172 + #set($viewerSecEnrollYear = $!viewerDoc.getValue('secondaryEnrollmentYear'))
173 + #if($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecEnrollYear && $viewerSecEnrollYear != '')
174 + #set($vNow = $datetool.date)
175 + #set($vCurYear = $mathtool.toInteger($datetool.format('yyyy', $vNow)))
176 + #set($vCurMonth = $mathtool.toInteger($datetool.format('MM', $vNow)))
177 + #if($vCurMonth >= 4)#set($vSchoolYear = $vCurYear)#else#set($vSchoolYear = $mathtool.sub($vCurYear, 1))#end
178 + #set($vSecEnroll = $mathtool.toInteger($viewerSecEnrollYear))
179 + #set($vSecMax = 3)
180 + #if($viewerSecondarySchoolCode.length() >= 2)
181 + #set($vSecType = $viewerSecondarySchoolCode.substring(0, 2))
182 + #if($vSecType == 'C2')#set($vSecMax = 9)#elseif($vSecType == 'D2')#set($vSecMax = 6)#end
183 + #end
184 + #set($vSecGrade = $mathtool.add($mathtool.sub($vSchoolYear, $vSecEnroll), 1))
185 + #if($vSecGrade > $vSecMax)
186 + #set($viewerSecondaryGraduated = true)
187 + #end
188 + #end
156 156  #end
157 157  
158 158  ## --- 関連校(中高一貫校)情報 ---
... ... @@ -162,7 +162,7 @@
162 162  #if($affiliatedSchoolCode && $affiliatedSchoolCode != '')
163 163   #if($viewerSchoolCode == $affiliatedSchoolCode)
164 164   #set($isAffiliated = true)
165 - #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $affiliatedSchoolCode)
198 + #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $affiliatedSchoolCode && !$viewerSecondaryGraduated)
166 166   #set($isAffiliated = true)
167 167   #end
168 168  #end
... ... @@ -172,7 +172,7 @@
172 172  #if(!$isGuest && $viewerUserRole != 'graduate')
173 173   #if($viewerSchoolCode == $schoolCode || $isAffiliated)
174 174   #set($isSchoolMember = true)
175 - #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $schoolCode)
208 + #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $schoolCode && !$viewerSecondaryGraduated)
176 176   #set($isSchoolMember = true)
177 177   #end
178 178  #end
... ... @@ -432,10 +432,132 @@
432 432   #end
433 433   #end
434 434  
468 + ## --- 活動環境 ---
469 + #set($hasActivityEnv = ($activityPlace && !$activityPlace.isEmpty()) || ($activityRoomEquipment && $activityRoomEquipment != '') || ($activityRoomImage && $activityRoomImage != '') || ($ictTools && !$ictTools.isEmpty()) || ($ictUsage && !$ictUsage.isEmpty()))
470 + #if($hasActivityEnv)
471 + #set($canViewAE = true)
472 + #if($visibilityActivityEnv == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewAE = false)
473 + #elseif($visibilityActivityEnv == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewAE = false)
474 + #end
475 + #if($canViewAE)
476 + <div class="seitokai-subsection">
477 + <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>
478 + <div class="seitokai-subsection-content">
479 + #if($activityPlace && !$activityPlace.isEmpty())
480 + <div class="info-row">
481 + <span class="info-label">普段の活動場所</span>
482 + <span class="info-value">
483 + <div class="selection-display">
484 + #foreach($ap in $activityPlace)
485 + <span class="selection-item">$!escapetool.xml($ap.trim())</span>
486 + #end
487 + </div>
488 + </span>
489 + </div>
490 + #end
491 + #if($activityRoomEquipment && $activityRoomEquipment != '')
492 + <div class="info-row">
493 + <span class="info-label">生徒会室の設備</span>
494 + <span class="info-value free-text-value">$!escapetool.xml($activityRoomEquipment)</span>
495 + </div>
496 + #end
497 + #if($activityRoomImage && $activityRoomImage != '')
498 + <div class="info-row">
499 + <span class="info-label">活動場所の写真</span>
500 + <span class="info-value"><div class="school-org-img-wrap"><img src="$doc.getAttachmentURL($activityRoomImage)" alt="活動場所の写真" class="org-chart-img" /></div></span>
501 + </div>
502 + #end
503 + #if($ictTools && !$ictTools.isEmpty())
504 + <div class="info-row">
505 + <span class="info-label">利用しているICTツール</span>
506 + <span class="info-value">
507 + #set($ictCatDisplay = [
508 + ["連絡ツール", ["メール","LINE","LINE WORKS","Discord","Slack","Microsoft Teams","Google Chat","InstagramのDM","XのDM","その他(連絡)"]],
509 + ["ドキュメント作成・共有", ["Googleドキュメント","Googleスプレッドシート","Googleスライド","Googleドライブ","Word","Excel","PowerPoint","OneDrive","SharePoint","Notion","Pages","Numbers","Keynote","Dropbox","Box","その他(ドキュメント)"]],
510 + ["タスク管理", ["Googleカレンダー","Google ToDoリスト","Trello","Asana","Excel等スプレッドシート","その他(タスク管理)"]],
511 + ["ビデオ会議ツール", ["Zoom","Google Meet","その他(ビデオ会議)"]],
512 + ["アンケート", ["Googleフォーム","Microsoft Forms","その他(アンケート)"]],
513 + ["デザイン・クリエイティブ", ["Canva","各種Adobe","CapCut","LumaFusion","AviUtl","ibisPaint","その他(デザイン)"]],
514 + ["その他", ["独自のWebシステム・自作アプリ"]]
515 + ])
516 + #foreach($catD in $ictCatDisplay)
517 + #set($catHasItems = false)
518 + #foreach($t in $catD.get(1))
519 + #if($ictTools.contains($t)) #set($catHasItems = true) #end
520 + #end
521 + #if($catHasItems)
522 + <div style="margin-bottom:6px">
523 + <span style="font-size:0.8em;font-weight:600;color:var(--text-mid)">$catD.get(0):</span>
524 + <div class="selection-display" style="margin-top:2px">
525 + #foreach($t in $catD.get(1))
526 + #if($ictTools.contains($t))
527 + <span class="selection-item">$!escapetool.xml($t)</span>
528 + #end
529 + #end
530 + </div>
531 + </div>
532 + #end
533 + #end
534 + </span>
535 + </div>
536 + #end
537 + #if($ictUsage && !$ictUsage.isEmpty())
538 + <div class="info-row">
539 + <span class="info-label">ICT活用している場面</span>
540 + <span class="info-value">
541 + <div class="selection-display">
542 + #foreach($iu in $ictUsage)
543 + <span class="selection-item">$!escapetool.xml($iu.trim())</span>
544 + #end
545 + </div>
546 + </span>
547 + </div>
548 + #end
549 + </div>
550 + </div>
551 + #else
552 + <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>
553 + #end
554 + #end
555 +
556 + ## --- 年間主要行事 ---
557 + #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]])
558 + #set($hasAnyEvent = false)
559 + #foreach($m in $months)
560 + #if($m.get(1) && $m.get(1) != '') #set($hasAnyEvent = true) #end
561 + #end
562 + #if($hasAnyEvent)
563 + #set($canViewAN = true)
564 + #if($visibilityAnnualEvents == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewAN = false)
565 + #elseif($visibilityAnnualEvents == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewAN = false)
566 + #end
567 + #if($canViewAN)
568 + <div class="seitokai-subsection">
569 + <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>
570 + <div class="seitokai-subsection-content">
571 + <table class="wiki-table school-info-table" style="margin:0">
572 + #foreach($m in $months)
573 + #if($m.get(1) && $m.get(1) != '')
574 + <tr><td style="width:60px;font-weight:600;white-space:nowrap">$m.get(0)</td><td>$!escapetool.xml($m.get(1))</td></tr>
575 + #end
576 + #end
577 + </table>
578 + </div>
579 + </div>
580 + #else
581 + <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>
582 + #end
583 + #end
584 +
435 435   ## --- 日常の活動 ---
436 436   #if($dailyActivities && !$dailyActivities.isEmpty())
587 + #set($canViewDA = true)
588 + #if($visibilityDailyActivities == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewDA = false)
589 + #elseif($visibilityDailyActivities == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewDA = false)
590 + #end
591 + #if($canViewDA)
437 437   <div class="seitokai-subsection">
438 - <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> 日常の活動</h3>
593 + <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>
439 439   <div class="seitokai-subsection-content">
440 440   <p class="activity-hint">活動時間が多い3つ</p>
441 441   <div class="tag-container">
... ... @@ -448,34 +448,20 @@
448 448   #end
449 449   </div>
450 450   </div>
606 + #else
607 + <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>
608 + #end
451 451   #end
452 452  
453 - ## --- 選挙 ---
454 - #if($electionExists && $electionExists != '')
455 - <div class="seitokai-subsection">
456 - <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> 選挙</h3>
457 - <div class="seitokai-subsection-content">
458 - <div class="info-row">
459 - <span class="info-label">役員選挙</span>
460 - <span class="info-value">$!escapetool.xml($!electionExists)</span>
461 - </div>
462 - #if($electionType && $electionType != '')
463 - <div class="info-row">
464 - <span class="info-label">直近の選挙方式</span>
465 - <span class="info-value">$!escapetool.xml($!electionType)</span>
466 - </div>
467 - #end
468 - #if($electionNote && $electionNote.trim() != '')
469 - <div class="free-note">$!escapetool.xml($electionNote)</div>
470 - #end
471 - </div>
472 - </div>
473 - #end
474 -
475 475   ## --- 定例活動 ---
476 476   #if($meetingFrequency && $meetingFrequency != '')
613 + #set($canViewMT = true)
614 + #if($visibilityMeeting == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewMT = false)
615 + #elseif($visibilityMeeting == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewMT = false)
616 + #end
617 + #if($canViewMT)
477 477   <div class="seitokai-subsection">
478 - <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> 定例活動</h3>
619 + <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>
479 479   <div class="seitokai-subsection-content">
480 480   <div class="info-row">
481 481   <span class="info-label">役員定例会の頻度</span>
... ... @@ -486,70 +486,101 @@
486 486   #end
487 487   </div>
488 488   </div>
630 + #else
631 + <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>
632 + #end
489 489   #end
490 490  
491 - ## --- 予算 ---
492 - #set($hasBudget = ($budgetProcess && !$budgetProcess.isEmpty()) || ($studentFee && $studentFee != '') || ($budgetScale && $budgetScale != ''))
493 - #if($hasBudget)
494 - #set($canViewBudget = true)
495 - #if($visibilityBudget == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewBudget = false)
496 - #elseif($visibilityBudget == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewBudget = false)
635 + ## --- 生徒総会 ---
636 + #set($hasAssembly = ($assemblyFormat && $assemblyFormat != '') || ($assemblyCount && $assemblyCount > 0) || ($assemblyAgenda && !$assemblyAgenda.isEmpty()) || ($assemblyTopics && !$assemblyTopics.isEmpty()) || ($assemblyNote && $assemblyNote != ''))
637 + #if($hasAssembly)
638 + #set($canViewAS = true)
639 + #if($visibilityAssembly == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewAS = false)
640 + #elseif($visibilityAssembly == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewAS = false)
497 497   #end
498 - #if($canViewBudget)
642 + #if($canViewAS)
499 499   <div class="seitokai-subsection">
500 - <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>
644 + <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>
501 501   <div class="seitokai-subsection-content">
502 - #if($budgetProcess && !$budgetProcess.isEmpty())
646 + #if($assemblyFormat && $assemblyFormat != '')
503 503   <div class="info-row">
504 - <span class="info-label">作成過程の生徒関与</span>
505 - <span class="info-value">
506 - <div class="selection-display">
507 - #set($allBpOpts = ["各部・委員会等への予算希望額調査","予算額調整(折衝等)","生徒会予算案の作成","生徒総会での議決","生徒関与なし","その他"])
508 - #foreach($bpOpt in $allBpOpts)
509 - #if($budgetProcess.contains($bpOpt))
510 - <span class="selection-item">$!escapetool.xml($bpOpt)</span>
511 - #else
512 - <span class="selection-item selection-item-off">$!escapetool.xml($bpOpt)</span>
513 - #end
514 - #end
515 - </div>
516 - </span>
648 + <span class="info-label">開催方式</span>
649 + <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($assemblyFormat)</span></span>
517 517   </div>
518 518   #end
519 - #if($studentFee && $studentFee != '')
652 + #if($assemblyCount && $assemblyCount > 0)
520 520   <div class="info-row">
521 - <span class="info-label">生徒会費(年)</span>
522 - <span class="info-value">$!escapetool.xml($!studentFee)</span>
654 + <span class="info-label">開催回数(年)</span>
655 + <span class="info-value">$!escapetool.xml($assemblyCount)</span>
523 523   </div>
524 524   #end
525 - #if($budgetScale && $budgetScale != '')
658 + #if($assemblyAgenda && !$assemblyAgenda.isEmpty())
526 526   <div class="info-row">
527 - <span class="info-label">予算規模</span>
528 - <span class="info-value">$!escapetool.xml($!budgetScale)</span>
660 + <span class="info-label">議案の集め方</span>
661 + <span class="info-value">
662 + <div class="selection-display">
663 + #foreach($aa in $assemblyAgenda)
664 + <span class="selection-item">$!escapetool.xml($aa.trim())</span>
665 + #end
666 + </div>
667 + </span>
529 529   </div>
530 530   #end
531 - #if($budgetAllocation && !$budgetAllocation.isEmpty())
670 + #if($assemblyTopics && !$assemblyTopics.isEmpty())
532 532   <div class="info-row">
533 - <span class="info-label">主な予算配分</span>
672 + <span class="info-label">扱う内容</span>
534 534   <span class="info-value">
535 535   <div class="selection-display">
536 - #foreach($ba in $budgetAllocation)
537 - <span class="selection-item">$!escapetool.xml($ba.trim())</span>
675 + #foreach($at in $assemblyTopics)
676 + <span class="selection-item">$!escapetool.xml($at.trim())</span>
538 538   #end
539 539   </div>
540 540   </span>
541 541   </div>
542 542   #end
543 - #if($budgetNote && $budgetNote.trim() != '')
544 - <div class="free-note">$!escapetool.xml($budgetNote)</div>
682 + #if($assemblyNote && $assemblyNote != '')
683 + <div class="info-row">
684 + <span class="info-label">自由記述</span>
685 + <span class="info-value free-text-value">$!escapetool.xml($assemblyNote)</span>
686 + </div>
545 545   #end
546 546   </div>
547 547   </div>
548 548   #else
549 - <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>
691 + <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>
550 550   #end
551 551   #end
552 552  
695 + ## --- 選挙 ---
696 + #if($electionExists && $electionExists != '')
697 + #set($canViewEL = true)
698 + #if($visibilityElection == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewEL = false)
699 + #elseif($visibilityElection == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewEL = false)
700 + #end
701 + #if($canViewEL)
702 + <div class="seitokai-subsection">
703 + <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>
704 + <div class="seitokai-subsection-content">
705 + <div class="info-row">
706 + <span class="info-label">役員選挙</span>
707 + <span class="info-value">$!escapetool.xml($!electionExists)</span>
708 + </div>
709 + #if($electionType && $electionType != '')
710 + <div class="info-row">
711 + <span class="info-label">直近の選挙方式</span>
712 + <span class="info-value">$!escapetool.xml($!electionType)</span>
713 + </div>
714 + #end
715 + #if($electionNote && $electionNote.trim() != '')
716 + <div class="free-note">$!escapetool.xml($electionNote)</div>
717 + #end
718 + </div>
719 + </div>
720 + #else
721 + <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>
722 + #end
723 + #end
724 +
553 553   ## --- 校則・生徒会会則の見直し ---
554 554   #if($ruleReviewStatus && $ruleReviewStatus != '')
555 555   #set($canViewRuleReview = true)
... ... @@ -615,109 +615,78 @@
615 615   #end
616 616   #end
617 617  
618 - ## --- 活動環境 ---
619 - #set($hasActivityEnv = ($activityPlace && !$activityPlace.isEmpty()) || ($activityRoomEquipment && $activityRoomEquipment != '') || ($activityRoomImage && $activityRoomImage != '') || ($ictUsage && !$ictUsage.isEmpty()))
620 - #if($hasActivityEnv)
790 + ## --- 予算 ---
791 + #set($hasBudget = ($budgetProcess && !$budgetProcess.isEmpty()) || ($studentFee && $studentFee != '') || ($budgetScale && $budgetScale != ''))
792 + #if($hasBudget)
793 + #set($canViewBudget = true)
794 + #if($visibilityBudget == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewBudget = false)
795 + #elseif($visibilityBudget == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewBudget = false)
796 + #end
797 + #if($canViewBudget)
621 621   <div class="seitokai-subsection">
622 - <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> 生徒会の活動環境</h3>
799 + <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>
623 623   <div class="seitokai-subsection-content">
624 - #if($activityPlace && !$activityPlace.isEmpty())
801 + #if($budgetProcess && !$budgetProcess.isEmpty())
625 625   <div class="info-row">
626 - <span class="info-label">普段活動場所</span>
803 + <span class="info-label">作成過程生徒関与</span>
627 627   <span class="info-value">
628 628   <div class="selection-display">
629 - #foreach($ap in $activityPlace)
630 - <span class="selection-item">$!escapetool.xml($ap.trim())</span>
806 + #set($allBpOpts = ["各部・委員会等への予算希望額調査","予算額調整(折衝等)","生徒会予算案の作成","生徒総会での議決","生徒関与なし","その他"])
807 + #foreach($bpOpt in $allBpOpts)
808 + #if($budgetProcess.contains($bpOpt))
809 + <span class="selection-item">$!escapetool.xml($bpOpt)</span>
810 + #else
811 + <span class="selection-item selection-item-off">$!escapetool.xml($bpOpt)</span>
812 + #end
631 631   #end
632 632   </div>
633 633   </span>
634 634   </div>
635 635   #end
636 - #if($activityRoomEquipment && $activityRoomEquipment != '')
818 + #if($studentFee && $studentFee != '')
637 637   <div class="info-row">
638 - <span class="info-label">生徒会室の設備</span>
639 - <span class="info-value free-text-value">$!escapetool.xml($activityRoomEquipment)</span>
820 + <span class="info-label">生徒会費(年額)</span>
821 + <span class="info-value">$!escapetool.xml($!studentFee)</span>
640 640   </div>
641 641   #end
642 - #if($activityRoomImage && $activityRoomImage != '')
824 + #if($budgetScale && $budgetScale != '')
643 643   <div class="info-row">
644 - <span class="info-label">活動場所の写真</span>
645 - <span class="info-value"><div class="school-org-img-wrap"><img src="$doc.getAttachmentURL($activityRoomImage)" alt="活動場所の写真" class="org-chart-img" /></div></span>
826 + <span class="info-label">予算規模</span>
827 + <span class="info-value">$!escapetool.xml($!budgetScale)</span>
646 646   </div>
647 647   #end
648 - #if($ictUsage && !$ictUsage.isEmpty())
830 + #if($budgetAllocation && !$budgetAllocation.isEmpty())
649 649   <div class="info-row">
650 - <span class="info-label">ICT活用している場面</span>
832 + <span class="info-label">主な予算配分</span>
651 651   <span class="info-value">
652 652   <div class="selection-display">
653 - #foreach($iu in $ictUsage)
654 - <span class="selection-item">$!escapetool.xml($iu.trim())</span>
835 + #foreach($ba in $budgetAllocation)
836 + <span class="selection-item">$!escapetool.xml($ba.trim())</span>
655 655   #end
656 656   </div>
657 657   </span>
658 658   </div>
659 659   #end
660 - </div>
661 - </div>
662 - #end
663 -
664 - ## --- 生徒総会 ---
665 - #set($hasAssembly = ($assemblyFormat && $assemblyFormat != '') || ($assemblyCount && $assemblyCount > 0) || ($assemblyAgenda && !$assemblyAgenda.isEmpty()) || ($assemblyTopics && !$assemblyTopics.isEmpty()) || ($assemblyNote && $assemblyNote != ''))
666 - #if($hasAssembly)
667 - <div class="seitokai-subsection">
668 - <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> 生徒総会</h3>
669 - <div class="seitokai-subsection-content">
670 - #if($assemblyFormat && $assemblyFormat != '')
671 - <div class="info-row">
672 - <span class="info-label">開催方式</span>
673 - <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($assemblyFormat)</span></span>
674 - </div>
842 + #if($budgetNote && $budgetNote.trim() != '')
843 + <div class="free-note">$!escapetool.xml($budgetNote)</div>
675 675   #end
676 - #if($assemblyCount && $assemblyCount > 0)
677 - <div class="info-row">
678 - <span class="info-label">開催回数(年)</span>
679 - <span class="info-value">$!escapetool.xml($assemblyCount)回</span>
680 - </div>
681 - #end
682 - #if($assemblyAgenda && !$assemblyAgenda.isEmpty())
683 - <div class="info-row">
684 - <span class="info-label">議案の集め方</span>
685 - <span class="info-value">
686 - <div class="selection-display">
687 - #foreach($aa in $assemblyAgenda)
688 - <span class="selection-item">$!escapetool.xml($aa.trim())</span>
689 - #end
690 - </div>
691 - </span>
692 - </div>
693 - #end
694 - #if($assemblyTopics && !$assemblyTopics.isEmpty())
695 - <div class="info-row">
696 - <span class="info-label">扱う内容</span>
697 - <span class="info-value">
698 - <div class="selection-display">
699 - #foreach($at in $assemblyTopics)
700 - <span class="selection-item">$!escapetool.xml($at.trim())</span>
701 - #end
702 - </div>
703 - </span>
704 - </div>
705 - #end
706 - #if($assemblyNote && $assemblyNote != '')
707 - <div class="info-row">
708 - <span class="info-label">自由記述</span>
709 - <span class="info-value free-text-value">$!escapetool.xml($assemblyNote)</span>
710 - </div>
711 - #end
712 712   </div>
713 713   </div>
847 + #else
848 + <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>
849 + #end
714 714   #end
715 715  
716 716   ## --- 広報 ---
717 717   #set($hasPublicity = ($publicityMethod && !$publicityMethod.isEmpty()) || ($publicityFrequency && $publicityFrequency != '') || ($publicityNote && $publicityNote != ''))
718 718   #if($hasPublicity)
855 + #set($canViewPB = true)
856 + #if($visibilityPublicity == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewPB = false)
857 + #elseif($visibilityPublicity == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewPB = false)
858 + #end
859 + #if($canViewPB)
719 719   <div class="seitokai-subsection">
720 - <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> 広報</h3>
861 + <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>
721 721   <div class="seitokai-subsection-content">
722 722   #if($publicityMethod && !$publicityMethod.isEmpty())
723 723   <div class="info-row">
... ... @@ -745,13 +745,21 @@
745 745   #end
746 746   </div>
747 747   </div>
889 + #else
890 + <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>
891 + #end
748 748   #end
749 749  
750 750   ## --- 外部連携 ---
751 751   #set($hasExternal = ($externalCooperation && $externalCooperation != '') || ($externalOrgName && $externalOrgName != '') || ($socialParticipation && !$socialParticipation.isEmpty()))
752 752   #if($hasExternal)
897 + #set($canViewEX = true)
898 + #if($visibilityExternal == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewEX = false)
899 + #elseif($visibilityExternal == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewEX = false)
900 + #end
901 + #if($canViewEX)
753 753   <div class="seitokai-subsection">
754 - <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> 外部連携</h3>
903 + <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>
755 755   <div class="seitokai-subsection-content">
756 756   #if($externalCooperation && $externalCooperation != '')
757 757   <div class="info-row">
... ... @@ -779,29 +779,11 @@
779 779   #end
780 780   </div>
781 781   </div>
931 + #else
932 + <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>
933 + #end
782 782   #end
783 783  
784 - ## --- 年間主要行事 ---
785 - #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]])
786 - #set($hasAnyEvent = false)
787 - #foreach($m in $months)
788 - #if($m.get(1) && $m.get(1) != '') #set($hasAnyEvent = true) #end
789 - #end
790 - #if($hasAnyEvent)
791 - <div class="seitokai-subsection">
792 - <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> 年間主要行事</h3>
793 - <div class="seitokai-subsection-content">
794 - <table class="wiki-table school-info-table" style="margin:0">
795 - #foreach($m in $months)
796 - #if($m.get(1) && $m.get(1) != '')
797 - <tr><td style="width:60px;font-weight:600;white-space:nowrap">$m.get(0)</td><td>$!escapetool.xml($m.get(1))</td></tr>
798 - #end
799 - #end
800 - </table>
801 - </div>
802 - </div>
803 - #end
804 -
805 805   ## --- 生徒会の課題意識 ---
806 806   #if($challenges && $challenges != '')
807 807   #set($canViewChallenges = true)
... ... @@ -873,13 +873,13 @@
873 873  
874 874  <div class="activity-toolbar">
875 875   <div class="activity-fy-tabs">
876 - <button class="activity-fy-tab active" onclick="switchActivityFY('$currentFYStr', this)">$currentFYStr 年度</button>
1007 + <button class="activity-fy-tab" onclick="switchActivityFY('$currentFYStr', this)">$currentFYStr 年度</button>
877 877   #foreach($fy in $fySet)
878 878   #if($fy != $currentFYStr)
879 879   <button class="activity-fy-tab" onclick="switchActivityFY('$fy', this)">$fy 年度</button>
880 880   #end
881 881   #end
882 - <button class="activity-fy-tab" onclick="switchActivityFY('all', this)">全期間</button>
1013 + <button class="activity-fy-tab active" onclick="switchActivityFY('all', this)">全期間</button>
883 883   </div>
884 884   <div class="activity-toolbar-right">
885 885   <button class="btn-view-toggle" id="btnViewToggle" onclick="toggleCompactView()" title="タイトルのみ表示">
... ... @@ -918,22 +918,64 @@
918 918  
919 919  {{/html}}
920 920  
921 -## 特色ある活動を先頭に表示するため、並び替え用リストを作成
922 -#set($featuredActivities = [])
923 -#set($normalActivities = [])
924 -#if($activities && $activities.size() > 0)
925 - #foreach($act in $activities)
926 - #set($isFeatured = $!act.getValue('featured'))
927 - #if($isFeatured == '1')
928 - #set($discard = $featuredActivities.add($foreach.index))
1052 +## 活動を「年度降順 + 特色あり先頭」で並び替え
1053 +## Step1: fySet から年度を降順ソート(Velocity ネイティブ実装)
1054 +#set($fyNums = [])
1055 +#foreach($fy in $fySet)
1056 + #if($fy && $fy != '' && $fy != 'unknown')
1057 + #set($discard = $fyNums.add($fy))
1058 + #end
1059 +#end
1060 +## 最大値を順番に取り出して降順リストを構築(最大20年度まで対応)
1061 +#set($fyDesc = [])
1062 +#set($fyRemaining = [])
1063 +#foreach($fy in $fyNums)
1064 + #set($discard = $fyRemaining.add($fy))
1065 +#end
1066 +#foreach($dummy in [1..20])
1067 + #if($fyRemaining.isEmpty())#break#end
1068 + #set($fyMax = $fyRemaining.get(0))
1069 + #foreach($fy in $fyRemaining)
1070 + #if($fy > $fyMax)#set($fyMax = $fy)#end
1071 + #end
1072 + #set($discard = $fyDesc.add($fyMax))
1073 + #set($fyNextRem = [])
1074 + #set($fyMaxRemoved = false)
1075 + #foreach($fy in $fyRemaining)
1076 + #if(!$fyMaxRemoved && $fy == $fyMax)
1077 + #set($fyMaxRemoved = true)
929 929   #else
930 - #set($discard = $normalActivities.add($foreach.index))
1079 + #set($discard = $fyNextRem.add($fy))
931 931   #end
932 932   #end
1082 + #set($fyRemaining = $fyNextRem)
933 933  #end
1084 +## 年度未設定の活動は末尾に表示(fySetに'unknown'は入らないため無条件追加)
1085 +#set($discard = $fyDesc.add('unknown'))
1086 +## Step2: 年度降順で featured → normal の順にインデックスを収集
934 934  #set($orderedActivityIndices = [])
935 -#set($discard = $orderedActivityIndices.addAll($featuredActivities))
936 -#set($discard = $orderedActivityIndices.addAll($normalActivities))
1088 +#foreach($curFY in $fyDesc)
1089 + ## 同年度の特色あり活動を先頭に
1090 + #set($actIdx2 = 0)
1091 + #foreach($act in $activities)
1092 + #set($aFY2 = $!act.getValue('fiscalYear'))
1093 + #if(!$aFY2 || $aFY2 == '') #set($aFY2 = 'unknown') #end
1094 + #if($aFY2 == $curFY && $act.getValue('featured') == '1')
1095 + #set($discard = $orderedActivityIndices.add($actIdx2))
1096 + #end
1097 + #set($actIdx2 = $actIdx2 + 1)
1098 + #end
1099 + ## 同年度の通常活動
1100 + #set($actIdx2 = 0)
1101 + #foreach($act in $activities)
1102 + #set($aFY2 = $!act.getValue('fiscalYear'))
1103 + #if(!$aFY2 || $aFY2 == '') #set($aFY2 = 'unknown') #end
1104 + #if($aFY2 == $curFY && $act.getValue('featured') != '1')
1105 + #set($discard = $orderedActivityIndices.add($actIdx2))
1106 + #end
1107 + #set($actIdx2 = $actIdx2 + 1)
1108 + #end
1109 +#end
937 937  
938 938  #if($activities && $activities.size() > 0)
939 939   #foreach($actIdx in $orderedActivityIndices)
... ... @@ -1198,6 +1198,25 @@
1198 1198   #if($postVis != 'public')
1199 1199   <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>
1200 1200   #end
1374 + ## いいねボタン
1375 + #set($postLikeCount = $!post.getValue('likeCount'))
1376 + #if(!$postLikeCount || $postLikeCount == '') #set($postLikeCount = 0) #end
1377 + #set($postLikedBy = $!post.getValue('likedBy'))
1378 + #set($isLikedByMe = false)
1379 + #if($postLikedBy && $postLikedBy.contains($xcontext.user)) #set($isLikedByMe = true) #end
1380 + <div class="post-like-row post-action-mt">
1381 + #if($xcontext.user != 'XWiki.XWikiGuest')
1382 + <button type="button" class="btn-like #if($isLikedByMe)liked#end" data-page="$escapetool.xml($doc.fullName)" data-obj="$post.number" data-csrf="$services.csrf.getToken()" onclick="toggleLike(this)">
1383 + <svg class="ico ico-fixed-14" viewBox="0 0 24 24" #if($isLikedByMe)fill="currentColor" stroke="none"#end><path d="M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 000-7.78z"/></svg>
1384 + <span class="like-count">$postLikeCount</span>
1385 + </button>
1386 + #else
1387 + <span class="btn-like disabled">
1388 + <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 000-7.78z"/></svg>
1389 + <span class="like-count">$postLikeCount</span>
1390 + </span>
1391 + #end
1392 + </div>
1201 1201   ## 固定/編集/削除/通報/非表示ボタン(横並び)
1202 1202   #set($postAuthorRef = $!post.getValue('authorRef'))
1203 1203   #set($postObjNumED = $post.number)
... ... @@ -1318,10 +1318,68 @@
1318 1318  {{/html}}
1319 1319  #end
1320 1320  
1513 +## --- OGP / SNSシェア対応 ---
1514 +#set($ogpTitle = "${schoolName} — 生徒会Wiki")
1515 +#set($ogpDesc = "${schoolName}の生徒会活動情報。")
1516 +#if($prefecture && $prefecture != '') #set($ogpDesc = "${ogpDesc}${prefecture}") #end
1517 +#if($city && $city != '') #set($ogpDesc = "${ogpDesc}${city}。") #end
1518 +#if($dailyActivities && $dailyActivities != '') #set($ogpDesc = "${ogpDesc} 主な活動: ${dailyActivities}") #end
1519 +#set($ogpUrl = "https://${request.serverName}${doc.getURL()}")
1520 +
1321 1321  ## --- 年度タブ切り替え JavaScript ---
1322 1322  {{html clean="false"}}
1323 1323  <script>
1524 +// OGPメタタグ挿入
1525 +(function() {
1526 + var ogp = {
1527 + 'og:title': '$escapetool.javascript($ogpTitle)',
1528 + 'og:description': '$escapetool.javascript($ogpDesc)',
1529 + 'og:type': 'article',
1530 + 'og:url': '$escapetool.javascript($ogpUrl)',
1531 + 'og:site_name': '生徒会Wiki',
1532 + 'twitter:card': 'summary'
1533 + };
1534 + for (var p in ogp) {
1535 + var meta = document.createElement('meta');
1536 + meta.setAttribute('property', p);
1537 + meta.setAttribute('content', ogp[p]);
1538 + document.head.appendChild(meta);
1539 + }
1540 + // twitter用
1541 + var tw = document.createElement('meta');
1542 + tw.setAttribute('name', 'twitter:card');
1543 + tw.setAttribute('content', 'summary');
1544 + document.head.appendChild(tw);
1545 +})();
1324 1324  // コンパクト表示(タイトルのみ)トグル
1547 +// いいねトグル
1548 +function toggleLike(btn) {
1549 + var page = btn.getAttribute('data-page');
1550 + var obj = btn.getAttribute('data-obj');
1551 + var csrf = btn.getAttribute('data-csrf');
1552 + btn.disabled = true;
1553 + var fd = new FormData();
1554 + fd.append('page', page);
1555 + fd.append('obj', obj);
1556 + fd.append('form_token', csrf);
1557 + fetch('/bin/SeitokaiCode/LikePost', { method: 'POST', body: fd })
1558 + .then(function(r) { return r.json(); })
1559 + .then(function(data) {
1560 + btn.querySelector('.like-count').textContent = data.count;
1561 + if (data.action === 'liked') {
1562 + btn.classList.add('liked');
1563 + btn.querySelector('svg').setAttribute('fill', 'currentColor');
1564 + btn.querySelector('svg').setAttribute('stroke', 'none');
1565 + } else {
1566 + btn.classList.remove('liked');
1567 + btn.querySelector('svg').removeAttribute('fill');
1568 + btn.querySelector('svg').setAttribute('stroke', 'currentColor');
1569 + }
1570 + })
1571 + .catch(function() { alert('エラーが発生しました'); })
1572 + .finally(function() { btn.disabled = false; });
1573 +}
1574 +
1325 1325  function toggleCompactView() {
1326 1326   var container = document.querySelector('.xwiki-content') || document.body;
1327 1327   var isCompact = container.classList.toggle('activity-compact-view');
... ... @@ -1365,7 +1365,7 @@
1365 1365  }
1366 1366  // ページ読み込み時の初期化
1367 1367  document.addEventListener('DOMContentLoaded', function() {
1368 - // 年度タブを降順にソート(「全期間」タブは末尾に固定)
1618 + // 年度タブを降順にソート(「全期間」タブは先頭に固定)
1369 1369   var tabContainer = document.querySelector('.activity-fy-tabs');
1370 1370   if (tabContainer) {
1371 1371   var tabs = Array.from(tabContainer.querySelectorAll('.activity-fy-tab'));
... ... @@ -1382,11 +1382,11 @@
1382 1382   var bYear = parseInt(b.textContent) || 0;
1383 1383   return bYear - aYear;
1384 1384   });
1385 - // DOM再配置
1386 - fyTabs.forEach(function(t) { tabContainer.appendChild(t); });
1635 + // DOM再配置(全期間を先頭、年度タブを降順で続ける)
1387 1387   if (allTab) { tabContainer.appendChild(allTab); }
1637 + fyTabs.forEach(function(t) { tabContainer.appendChild(t); });
1388 1388   }
1389 - // デフォルトで現在の年度を表示
1639 + // デフォルトで全期間を表示
1390 1390   var defaultTab = document.querySelector('.activity-fy-tab.active');
1391 1391   if (defaultTab) { defaultTab.click(); }
1392 1392   // 保存成功時のトースト通知
... ... @@ -1439,7 +1439,15 @@
1439 1439   };
1440 1440   var toast = document.createElement('div');
1441 1441   toast.className = 'toast toast-' + type;
1442 - toast.innerHTML = (icons[type] || '') + '<span>' + message + '</span>';
1692 + var iconSvg = icons[type] || '';
1693 + if (iconSvg) {
1694 + var iconSpan = document.createElement('span');
1695 + iconSpan.innerHTML = iconSvg;
1696 + toast.appendChild(iconSpan);
1697 + }
1698 + var msgSpan = document.createElement('span');
1699 + msgSpan.textContent = message;
1700 + toast.appendChild(msgSpan);
1443 1443   container.appendChild(toast);
1444 1444   setTimeout(function() { toast.remove(); }, 3200);
1445 1445  }
... ... @@ -1478,6 +1478,7 @@
1478 1478   var html = '<textarea id="editContent_' + postObjNum + '">' + currentContent.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') + '</textarea>';
1479 1479  
1480 1480   // コメント以外は添付ファイル編集を表示
1739 + function escAttr(s) { return s.replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#39;').replace(/</g,'&lt;').replace(/>/g,'&gt;'); }
1481 1481   if (postType !== 'comment') {
1482 1482   // 既存画像
1483 1483   html += '<div class="edit-attachments">';
... ... @@ -1487,10 +1487,10 @@
1487 1487   for (var i = 0; i < imgs.length; i++) {
1488 1488   var img = imgs[i].trim();
1489 1489   if (!img) continue;
1490 - html += '<div class="edit-attach-item" data-name="' + img.replace(/"/g,'&quot;') + '">' +
1749 + html += '<div class="edit-attach-item" data-name="' + escAttr(img) + '">' +
1491 1491   '<img src="/xwiki/bin/download/' + schoolPage.replace(/\./g,'/') + '/' + encodeURIComponent(img) + '" class="edit-attach-thumb" />' +
1492 1492   '<button type="button" class="edit-attach-remove" onclick="removeEditAttach(this)" title="削除">✕</button>' +
1493 - '<input type="hidden" name="keepImages" value="' + img.replace(/"/g,'&quot;') + '" />' +
1752 + '<input type="hidden" name="keepImages" value="' + escAttr(img) + '" />' +
1494 1494   '</div>';
1495 1495   }
1496 1496   html += '</div>';
... ... @@ -1504,10 +1504,10 @@
1504 1504   if (!f) continue;
1505 1505   var displayName = f;
1506 1506   if (/^file_\d{14}_\d+_/.test(f)) displayName = f.replace(/^file_\d{14}_\d+_/, '');
1507 - html += '<div class="edit-attach-item" data-name="' + f.replace(/"/g,'&quot;') + '">' +
1508 - '<span class="edit-attach-fname">' + displayName.replace(/</g,'&lt;').replace(/>/g,'&gt;') + '</span>' +
1766 + html += '<div class="edit-attach-item" data-name="' + escAttr(f) + '">' +
1767 + '<span class="edit-attach-fname">' + escAttr(displayName) + '</span>' +
1509 1509   '<button type="button" class="edit-attach-remove" onclick="removeEditAttach(this)" title="削除">✕</button>' +
1510 - '<input type="hidden" name="keepFiles" value="' + f.replace(/"/g,'&quot;') + '" />' +
1769 + '<input type="hidden" name="keepFiles" value="' + escAttr(f) + '" />' +
1511 1511   '</div>';
1512 1512   }
1513 1513   html += '</div>';