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

From version Icon 82.1 Icon
edited by Super Admin
on 2026/03/19 23:16
Change comment: There is no comment for this version
To version Icon 113.1 Icon
edited by Super Admin
on 2026/03/27 03:42
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'))
... ... @@ -35,6 +35,7 @@
35 35  #set($schoolSystem = $doc.getValue('schoolSystem'))
36 36  #set($website = $doc.getValue('website'))
37 37  #set($schoolPhoto = $doc.getValue('schoolPhoto'))
51 +#set($schoolDescription = $doc.getValue('schoolDescription'))
38 38  
39 39  ## --- 生徒会組織 ---
40 40  #set($orgChart = $doc.getValue('orgChart'))
... ... @@ -56,7 +56,7 @@
56 56  #set($budgetAllocation = $doc.getValue('budgetAllocation'))
57 57  #set($budgetNote = $doc.getValue('budgetNote'))
58 58  
59 -## --- 校則の見直し ---
73 +## --- 校則・生徒会会則の見直し ---
60 60  #set($ruleReviewStatus = $doc.getValue('ruleReviewStatus'))
61 61  #set($ruleReviewContent = $doc.getValue('ruleReviewContent'))
62 62  #set($ruleReviewProposer = $doc.getValue('ruleReviewProposer'))
... ... @@ -63,6 +63,44 @@
63 63  #set($ruleReviewImplementer = $doc.getValue('ruleReviewImplementer'))
64 64  #set($ruleReviewSystem = $doc.getValue('ruleReviewSystem'))
65 65  
80 +## --- 活動環境 ---
81 +#set($activityPlace = $doc.getValue('activityPlace'))
82 +#set($activityRoomEquipment = $doc.getValue('activityRoomEquipment'))
83 +#set($activityRoomImage = $doc.getValue('activityRoomImage'))
84 +#set($ictTools = $doc.getValue('ictTools'))
85 +#set($ictUsage = $doc.getValue('ictUsage'))
86 +
87 +## --- 生徒総会 ---
88 +#set($assemblyFormat = $doc.getValue('assemblyFormat'))
89 +#set($assemblyCount = $doc.getValue('assemblyCount'))
90 +#set($assemblyAgenda = $doc.getValue('assemblyAgenda'))
91 +#set($assemblyTopics = $doc.getValue('assemblyTopics'))
92 +#set($assemblyNote = $doc.getValue('assemblyNote'))
93 +
94 +## --- 広報 ---
95 +#set($publicityMethod = $doc.getValue('publicityMethod'))
96 +#set($publicityFrequency = $doc.getValue('publicityFrequency'))
97 +#set($publicityNote = $doc.getValue('publicityNote'))
98 +
99 +## --- 外部連携 ---
100 +#set($externalCooperation = $doc.getValue('externalCooperation'))
101 +#set($externalOrgName = $doc.getValue('externalOrgName'))
102 +#set($socialParticipation = $doc.getValue('socialParticipation'))
103 +
104 +## --- 年間主要行事 ---
105 +#set($eventApril = $doc.getValue('eventApril'))
106 +#set($eventMay = $doc.getValue('eventMay'))
107 +#set($eventJune = $doc.getValue('eventJune'))
108 +#set($eventJuly = $doc.getValue('eventJuly'))
109 +#set($eventAugust = $doc.getValue('eventAugust'))
110 +#set($eventSeptember = $doc.getValue('eventSeptember'))
111 +#set($eventOctober = $doc.getValue('eventOctober'))
112 +#set($eventNovember = $doc.getValue('eventNovember'))
113 +#set($eventDecember = $doc.getValue('eventDecember'))
114 +#set($eventJanuary = $doc.getValue('eventJanuary'))
115 +#set($eventFebruary = $doc.getValue('eventFebruary'))
116 +#set($eventMarch = $doc.getValue('eventMarch'))
117 +
66 66  ## --- 課題・連絡先 ---
67 67  #set($challenges = $doc.getValue('challenges'))
68 68  #set($contactInfo = $doc.getValue('contactInfo'))
... ... @@ -87,6 +87,14 @@
87 87  #set($visibilityBudget = $!doc.getValue('visibilityBudget'))
88 88  #set($visibilityRuleReview = $!doc.getValue('visibilityRuleReview'))
89 89  #set($visibilityChallenges = $!doc.getValue('visibilityChallenges'))
142 +#set($visibilityDailyActivities = $!doc.getValue('visibilityDailyActivities'))
143 +#set($visibilityElection = $!doc.getValue('visibilityElection'))
144 +#set($visibilityMeeting = $!doc.getValue('visibilityMeeting'))
145 +#set($visibilityActivityEnv = $!doc.getValue('visibilityActivityEnv'))
146 +#set($visibilityAssembly = $!doc.getValue('visibilityAssembly'))
147 +#set($visibilityPublicity = $!doc.getValue('visibilityPublicity'))
148 +#set($visibilityExternal = $!doc.getValue('visibilityExternal'))
149 +#set($visibilityAnnualEvents = $!doc.getValue('visibilityAnnualEvents'))
90 90  ## デフォルト値(未設定なら全体公開)
91 91  #if(!$visibilityOrgChart || $visibilityOrgChart == '') #set($visibilityOrgChart = 'public') #end
92 92  #if(!$visibilityBudget || $visibilityBudget == '') #set($visibilityBudget = 'public') #end
... ... @@ -98,6 +98,7 @@
98 98  #set($isGuest = $viewerUser == 'XWiki.XWikiGuest')
99 99  #set($isViewerAdmin = false)
100 100  #set($viewerSchoolCode = '')
161 +#set($viewerSecondaryGraduated = false)
101 101  #if(!$isGuest)
102 102   #set($viewerDoc = $xwiki.getDocument($viewerUser))
103 103   #set($viewerAccountType = $!viewerDoc.getValue('accountType'))
... ... @@ -107,6 +107,24 @@
107 107   #if($viewerAccountType == 'admin')
108 108   #set($isViewerAdmin = true)
109 109   #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
110 110  #end
111 111  
112 112  ## --- 関連校(中高一貫校)情報 ---
... ... @@ -116,7 +116,7 @@
116 116  #if($affiliatedSchoolCode && $affiliatedSchoolCode != '')
117 117   #if($viewerSchoolCode == $affiliatedSchoolCode)
118 118   #set($isAffiliated = true)
119 - #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $affiliatedSchoolCode)
198 + #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $affiliatedSchoolCode && !$viewerSecondaryGraduated)
120 120   #set($isAffiliated = true)
121 121   #end
122 122  #end
... ... @@ -126,7 +126,7 @@
126 126  #if(!$isGuest && $viewerUserRole != 'graduate')
127 127   #if($viewerSchoolCode == $schoolCode || $isAffiliated)
128 128   #set($isSchoolMember = true)
129 - #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $schoolCode)
208 + #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $schoolCode && !$viewerSecondaryGraduated)
130 130   #set($isSchoolMember = true)
131 131   #end
132 132  #end
... ... @@ -303,7 +303,7 @@
303 303  
304 304  ## --- 編集ボタン(権限があるユーザーのみ表示) ---
305 305  #set($canEditSchool = false)
306 -#if(!$isGuest && ($isViewerAdmin || $isSchoolMember))
385 +#if(!$isGuest && ($isViewerAdmin || $isSchoolMember || $isAlumniOfSchool))
307 307   #set($canEditSchool = true)
308 308  #end
309 309  #if($canEditSchool)
... ... @@ -353,16 +353,15 @@
353 353   </div>
354 354   #end
355 355   </div>
356 - #set($infoEditDate = $!doc.getValue('lastInfoEditedDate'))
357 - #set($infoEditBy = $!doc.getValue('lastInfoEditedBy'))
358 - #if($infoEditDate && $infoEditDate != '')
359 - <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>
435 + #if($schoolDescription && $schoolDescription.trim() != '')
436 + <div class="free-note" style="margin-top:var(--sp-4);">$!escapetool.xml($schoolDescription)</div>
360 360   #end
438 +
361 361  </div>
362 362  
363 -## --- ② 生徒会基本情報(折りたたみカード) ---
441 +## --- ② 生徒会情報(折りたたみカード) ---
364 364  <div class="school-info-card" id="card-seitokai-info">
365 - <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>
443 + <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>
366 366   <div class="seitokai-info-body">
367 367  
368 368   ## --- 生徒会組織 ---
... ... @@ -374,7 +374,7 @@
374 374   #end
375 375   #if($canViewOrgChart)
376 376   <div class="seitokai-subsection">
377 - <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>
455 + <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>
378 378   <div class="seitokai-subsection-content">
379 379   #if($orgChartImage && $orgChartImage != '')
380 380   <div class="school-org-img-wrap"><img src="$doc.getAttachmentURL($orgChartImage)" alt="組織図" class="org-chart-img" /></div>
... ... @@ -387,17 +387,137 @@
387 387   #end
388 388   #end
389 389  
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 +
390 390   ## --- 日常の活動 ---
391 391   #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)
392 392   <div class="seitokai-subsection">
393 - <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>
394 394   <div class="seitokai-subsection-content">
395 - <p class="activity-hint">活動時間多い順に上位3つ</p>
595 + <p class="activity-hint">活動時間多い3つ</p>
396 396   <div class="tag-container">
397 - #set($daIdx = 1)
398 398   #foreach($da in $dailyActivities)
399 - <span class="tag tag-accent">${daIdx}. $!escapetool.xml($da.trim())</span>
400 - #set($daIdx = $daIdx + 1)
598 + <span class="tag tag-accent">$!escapetool.xml($da.trim())</span>
401 401   #end
402 402   </div>
403 403   #if($dailyActivitiesNote && $dailyActivitiesNote.trim() != '')
... ... @@ -405,12 +405,104 @@
405 405   #end
406 406   </div>
407 407   </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
408 408   #end
409 409  
611 + ## --- 定例活動 ---
612 + #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)
618 + <div class="seitokai-subsection">
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>
620 + <div class="seitokai-subsection-content">
621 + <div class="info-row">
622 + <span class="info-label">役員定例会の頻度</span>
623 + <span class="info-value">$!escapetool.xml($!meetingFrequency)</span>
624 + </div>
625 + #if($regularActivitiesNote && $regularActivitiesNote.trim() != '')
626 + <div class="free-note">$!escapetool.xml($regularActivitiesNote)</div>
627 + #end
628 + </div>
629 + </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
633 + #end
634 +
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)
641 + #end
642 + #if($canViewAS)
643 + <div class="seitokai-subsection">
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>
645 + <div class="seitokai-subsection-content">
646 + #if($assemblyFormat && $assemblyFormat != '')
647 + <div class="info-row">
648 + <span class="info-label">開催方式</span>
649 + <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($assemblyFormat)</span></span>
650 + </div>
651 + #end
652 + #if($assemblyCount && $assemblyCount > 0)
653 + <div class="info-row">
654 + <span class="info-label">開催回数(年)</span>
655 + <span class="info-value">$!escapetool.xml($assemblyCount)回</span>
656 + </div>
657 + #end
658 + #if($assemblyAgenda && !$assemblyAgenda.isEmpty())
659 + <div class="info-row">
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>
668 + </div>
669 + #end
670 + #if($assemblyTopics && !$assemblyTopics.isEmpty())
671 + <div class="info-row">
672 + <span class="info-label">扱う内容</span>
673 + <span class="info-value">
674 + <div class="selection-display">
675 + #foreach($at in $assemblyTopics)
676 + <span class="selection-item">$!escapetool.xml($at.trim())</span>
677 + #end
678 + </div>
679 + </span>
680 + </div>
681 + #end
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>
687 + #end
688 + </div>
689 + </div>
690 + #else
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>
692 + #end
693 + #end
694 +
410 410   ## --- 選挙 ---
411 411   #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)
412 412   <div class="seitokai-subsection">
413 - <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>
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>
414 414   <div class="seitokai-subsection-content">
415 415   <div class="info-row">
416 416   <span class="info-label">役員選挙</span>
... ... @@ -427,22 +427,74 @@
427 427   #end
428 428   </div>
429 429   </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
430 430   #end
431 431  
432 - ## --- 定例活動 ---
433 - #if($meetingFrequency && $meetingFrequency != '')
725 + ## --- 校則・生徒会会則の見直し ---
726 + #if($ruleReviewStatus && $ruleReviewStatus != '')
727 + #set($canViewRuleReview = true)
728 + #if($visibilityRuleReview == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewRuleReview = false)
729 + #elseif($visibilityRuleReview == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewRuleReview = false)
730 + #end
731 + #if($canViewRuleReview)
434 434   <div class="seitokai-subsection">
435 - <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>
733 + <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>
436 436   <div class="seitokai-subsection-content">
437 437   <div class="info-row">
438 - <span class="info-label">役員定例会頻度</span>
439 - <span class="info-value">$!escapetool.xml($!meetingFrequency)</span>
736 + <span class="info-label">見直し有無(3年以内)</span>
737 + <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($!ruleReviewStatus)</span></span>
440 440   </div>
441 - #if($regularActivitiesNote && $regularActivitiesNote.trim() != '')
442 - <div class="free-note">$!escapetool.xml($regularActivitiesNote)</div>
739 + #if($ruleReviewStatus != '実施なし')
740 + #if($ruleReviewContent && !$ruleReviewContent.isEmpty())
741 + <div class="info-row">
742 + <span class="info-label">見直しの内容</span>
743 + <span class="info-value">
744 + <div class="selection-display">
745 + #foreach($rc in $ruleReviewContent)
746 + <span class="selection-item">$!escapetool.xml($rc.trim())</span>
747 + #end
748 + </div>
749 + </span>
750 + </div>
443 443   #end
752 + #if($ruleReviewProposer && !$ruleReviewProposer.isEmpty())
753 + <div class="info-row">
754 + <span class="info-label">見直しの提案者</span>
755 + <span class="info-value">
756 + <div class="selection-display">
757 + #foreach($rp in $ruleReviewProposer)
758 + <span class="selection-item">$!escapetool.xml($rp.trim())</span>
759 + #end
760 + </div>
761 + </span>
762 + </div>
763 + #end
764 + #if($ruleReviewImplementer && !$ruleReviewImplementer.isEmpty())
765 + <div class="info-row">
766 + <span class="info-label">見直しの実施者</span>
767 + <span class="info-value">
768 + <div class="selection-display">
769 + #foreach($ri in $ruleReviewImplementer)
770 + <span class="selection-item">$!escapetool.xml($ri.trim())</span>
771 + #end
772 + </div>
773 + </span>
774 + </div>
775 + #end
776 + #end
777 + #if($ruleReviewSystem && $ruleReviewSystem != '')
778 + <div class="info-row">
779 + <span class="info-label">見直しの仕組み</span>
780 + <span class="info-value">$!escapetool.xml($!ruleReviewSystem)</span>
781 + </div>
782 + #end
444 444   </div>
445 445   </div>
785 + #else
786 + <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>
787 + #end
446 446   #end
447 447  
448 448   ## --- 予算 ---
... ... @@ -454,7 +454,7 @@
454 454   #end
455 455   #if($canViewBudget)
456 456   <div class="seitokai-subsection">
457 - <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>
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>
458 458   <div class="seitokai-subsection-content">
459 459   #if($budgetProcess && !$budgetProcess.isEmpty())
460 460   <div class="info-row">
... ... @@ -461,8 +461,13 @@
461 461   <span class="info-label">作成過程の生徒関与</span>
462 462   <span class="info-value">
463 463   <div class="selection-display">
464 - #foreach($bp in $budgetProcess)
465 - <span class="selection-item">$!escapetool.xml($bp.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
466 466   #end
467 467   </div>
468 468   </span>
... ... @@ -502,66 +502,87 @@
502 502   #end
503 503   #end
504 504  
505 - ## --- 校則の見直し ---
506 - #if($ruleReviewStatus && $ruleReviewStatus != '')
507 - #set($canViewRuleReview = true)
508 - #if($visibilityRuleReview == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewRuleReview = false)
509 - #elseif($visibilityRuleReview == 'school_trusted' && ($isGuest || (!$isViewerAdmin && ((!$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewRuleReview = false)
852 + ## --- 広報 ---
853 + #set($hasPublicity = ($publicityMethod && !$publicityMethod.isEmpty()) || ($publicityFrequency && $publicityFrequency != '') || ($publicityNote && $publicityNote != ''))
854 + #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)
510 510   #end
511 - #if($canViewRuleReview)
859 + #if($canViewPB)
512 512   <div class="seitokai-subsection">
513 - <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>
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>
514 514   <div class="seitokai-subsection-content">
863 + #if($publicityMethod && !$publicityMethod.isEmpty())
515 515   <div class="info-row">
516 - <span class="info-label">見直しの有無(3年以内)</span>
517 - <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($!ruleReviewStatus)</span></span>
518 - </div>
519 - #if($ruleReviewContent && !$ruleReviewContent.isEmpty())
520 - <div class="info-row">
521 - <span class="info-label">見直しの内容</span>
865 + <span class="info-label">方法</span>
522 522   <span class="info-value">
523 523   <div class="selection-display">
524 - #foreach($rc in $ruleReviewContent)
525 - <span class="selection-item">$!escapetool.xml($rc.trim())</span>
868 + #foreach($pm in $publicityMethod)
869 + <span class="selection-item">$!escapetool.xml($pm.trim())</span>
526 526   #end
527 527   </div>
528 528   </span>
529 529   </div>
530 530   #end
531 - #if($ruleReviewProposer && !$ruleReviewProposer.isEmpty())
875 + #if($publicityFrequency && $publicityFrequency != '')
532 532   <div class="info-row">
533 - <span class="info-label">見直しの提案者</span>
534 - <span class="info-value">
535 - <div class="selection-display">
536 - #foreach($rp in $ruleReviewProposer)
537 - <span class="selection-item">$!escapetool.xml($rp.trim())</span>
538 - #end
539 - </div>
540 - </span>
877 + <span class="info-label">頻度</span>
878 + <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($publicityFrequency)</span></span>
541 541   </div>
542 542   #end
543 - #if($ruleReviewImplementer && !$ruleReviewImplementer.isEmpty())
881 + #if($publicityNote && $publicityNote != '')
544 544   <div class="info-row">
545 - <span class="info-label">見直しの実施者</span>
883 + <span class="info-label">自由記述</span>
884 + <span class="info-value free-text-value">$!escapetool.xml($publicityNote)</span>
885 + </div>
886 + #end
887 + </div>
888 + </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
892 + #end
893 +
894 + ## --- 外部連携 ---
895 + #set($hasExternal = ($externalCooperation && $externalCooperation != '') || ($externalOrgName && $externalOrgName != '') || ($socialParticipation && !$socialParticipation.isEmpty()))
896 + #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)
902 + <div class="seitokai-subsection">
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>
904 + <div class="seitokai-subsection-content">
905 + #if($externalCooperation && $externalCooperation != '')
906 + <div class="info-row">
907 + <span class="info-label">他校の生徒会との連携</span>
908 + <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($externalCooperation)</span></span>
909 + </div>
910 + #end
911 + #if($externalOrgName && $externalOrgName != '')
912 + <div class="info-row">
913 + <span class="info-label">参加している生徒会団体の名前</span>
914 + <span class="info-value">$!escapetool.xml($externalOrgName)</span>
915 + </div>
916 + #end
917 + #if($socialParticipation && !$socialParticipation.isEmpty())
918 + <div class="info-row">
919 + <span class="info-label">社会参加・地域連携・ボランティア</span>
546 546   <span class="info-value">
547 547   <div class="selection-display">
548 - #foreach($ri in $ruleReviewImplementer)
549 - <span class="selection-item">$!escapetool.xml($ri.trim())</span>
922 + #foreach($sp2 in $socialParticipation)
923 + <span class="selection-item">$!escapetool.xml($sp2.trim())</span>
550 550   #end
551 551   </div>
552 552   </span>
553 553   </div>
554 554   #end
555 - #if($ruleReviewSystem && $ruleReviewSystem != '')
556 - <div class="info-row">
557 - <span class="info-label">見直しの仕組み</span>
558 - <span class="info-value">$!escapetool.xml($!ruleReviewSystem)</span>
559 - </div>
560 - #end
561 561   </div>
562 562   </div>
563 563   #else
564 - <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>
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>
565 565   #end
566 566   #end
567 567  
... ... @@ -573,7 +573,7 @@
573 573   #end
574 574   #if($canViewChallenges)
575 575   <div class="seitokai-subsection">
576 - <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>
944 + <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>
577 577   <div class="seitokai-subsection-content">
578 578   <div class="challenge-text">$!escapetool.xml($challenges)</div>
579 579   </div>
... ... @@ -597,6 +597,11 @@
597 597   <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>
598 598   <tr><th>その他SNS</th><td>#if($seitokaiOtherSns && $seitokaiOtherSns != '')$!escapetool.xml($seitokaiOtherSns)#else<span class="text-placeholder">未登録</span>#end</td></tr>
599 599   </table>
968 + #set($infoEditDate = $!doc.getValue('lastInfoEditedDate'))
969 + #set($infoEditBy = $!doc.getValue('lastInfoEditedBy'))
970 + #if($infoEditDate && $infoEditDate != '')
971 + <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>
972 + #end
600 600  </div>
601 601  
602 602  {{/html}}
... ... @@ -631,13 +631,13 @@
631 631  
632 632  <div class="activity-toolbar">
633 633   <div class="activity-fy-tabs">
634 - <button class="activity-fy-tab active" onclick="switchActivityFY('$currentFYStr', this)">$currentFYStr 年度</button>
1007 + <button class="activity-fy-tab" onclick="switchActivityFY('$currentFYStr', this)">$currentFYStr 年度</button>
635 635   #foreach($fy in $fySet)
636 636   #if($fy != $currentFYStr)
637 637   <button class="activity-fy-tab" onclick="switchActivityFY('$fy', this)">$fy 年度</button>
638 638   #end
639 639   #end
640 - <button class="activity-fy-tab" onclick="switchActivityFY('all', this)">全期間</button>
1013 + <button class="activity-fy-tab active" onclick="switchActivityFY('all', this)">全期間</button>
641 641   </div>
642 642   <div class="activity-toolbar-right">
643 643   <button class="btn-view-toggle" id="btnViewToggle" onclick="toggleCompactView()" title="タイトルのみ表示">
... ... @@ -954,8 +954,27 @@
954 954   #end
955 955   </div>
956 956   #if($postVis != 'public')
957 - <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>
1330 + <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>
958 958   #end
1332 + ## いいねボタン
1333 + #set($postLikeCount = $!post.getValue('likeCount'))
1334 + #if(!$postLikeCount || $postLikeCount == '') #set($postLikeCount = 0) #end
1335 + #set($postLikedBy = $!post.getValue('likedBy'))
1336 + #set($isLikedByMe = false)
1337 + #if($postLikedBy && $postLikedBy.contains($xcontext.user)) #set($isLikedByMe = true) #end
1338 + <div class="post-like-row post-action-mt">
1339 + #if($xcontext.user != 'XWiki.XWikiGuest')
1340 + <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)">
1341 + <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>
1342 + <span class="like-count">$postLikeCount</span>
1343 + </button>
1344 + #else
1345 + <span class="btn-like disabled">
1346 + <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>
1347 + <span class="like-count">$postLikeCount</span>
1348 + </span>
1349 + #end
1350 + </div>
959 959   ## 固定/編集/削除/通報/非表示ボタン(横並び)
960 960   #set($postAuthorRef = $!post.getValue('authorRef'))
961 961   #set($postObjNumED = $post.number)
... ... @@ -978,7 +978,9 @@
978 978   #end
979 979   #if($showEditDeleteBtn)
980 980   #if($xcontext.user == $postAuthorRef)
981 - <button type="button" class="btn-post-edit" onclick="openEditPost(this, '${doc.fullName}', $postObjNumED, '$!escapetool.javascript($!postContent)')" title="この投稿を編集">
1373 + #set($editImages = $!post.getValue('images'))
1374 + #set($editFiles = $!post.getValue('files'))
1375 + <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="この投稿を編集">
982 982   <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> 編集
983 983   </button>
984 984   #end
... ... @@ -1040,7 +1040,7 @@
1040 1040  
1041 1041   #if($xcontext.user != "XWiki.XWikiGuest")
1042 1042   <div class="thread-add-post">
1043 - #if($isSchoolMember || $isViewerAdmin)
1437 + #if($isSchoolMember || $isAlumniOfSchool || $isViewerAdmin)
1044 1044   <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=report" class="btn-thread-add">
1045 1045   + 活動報告を追加
1046 1046   </a>
... ... @@ -1074,10 +1074,68 @@
1074 1074  {{/html}}
1075 1075  #end
1076 1076  
1471 +## --- OGP / SNSシェア対応 ---
1472 +#set($ogpTitle = "${schoolName} — 生徒会Wiki")
1473 +#set($ogpDesc = "${schoolName}の生徒会活動情報。")
1474 +#if($prefecture && $prefecture != '') #set($ogpDesc = "${ogpDesc}${prefecture}") #end
1475 +#if($city && $city != '') #set($ogpDesc = "${ogpDesc}${city}。") #end
1476 +#if($dailyActivities && $dailyActivities != '') #set($ogpDesc = "${ogpDesc} 主な活動: ${dailyActivities}") #end
1477 +#set($ogpUrl = "https://${request.serverName}${doc.getURL()}")
1478 +
1077 1077  ## --- 年度タブ切り替え JavaScript ---
1078 1078  {{html clean="false"}}
1079 1079  <script>
1482 +// OGPメタタグ挿入
1483 +(function() {
1484 + var ogp = {
1485 + 'og:title': '$escapetool.javascript($ogpTitle)',
1486 + 'og:description': '$escapetool.javascript($ogpDesc)',
1487 + 'og:type': 'article',
1488 + 'og:url': '$escapetool.javascript($ogpUrl)',
1489 + 'og:site_name': '生徒会Wiki',
1490 + 'twitter:card': 'summary'
1491 + };
1492 + for (var p in ogp) {
1493 + var meta = document.createElement('meta');
1494 + meta.setAttribute('property', p);
1495 + meta.setAttribute('content', ogp[p]);
1496 + document.head.appendChild(meta);
1497 + }
1498 + // twitter用
1499 + var tw = document.createElement('meta');
1500 + tw.setAttribute('name', 'twitter:card');
1501 + tw.setAttribute('content', 'summary');
1502 + document.head.appendChild(tw);
1503 +})();
1080 1080  // コンパクト表示(タイトルのみ)トグル
1505 +// いいねトグル
1506 +function toggleLike(btn) {
1507 + var page = btn.getAttribute('data-page');
1508 + var obj = btn.getAttribute('data-obj');
1509 + var csrf = btn.getAttribute('data-csrf');
1510 + btn.disabled = true;
1511 + var fd = new FormData();
1512 + fd.append('page', page);
1513 + fd.append('obj', obj);
1514 + fd.append('form_token', csrf);
1515 + fetch('/bin/SeitokaiCode/LikePost', { method: 'POST', body: fd })
1516 + .then(function(r) { return r.json(); })
1517 + .then(function(data) {
1518 + btn.querySelector('.like-count').textContent = data.count;
1519 + if (data.action === 'liked') {
1520 + btn.classList.add('liked');
1521 + btn.querySelector('svg').setAttribute('fill', 'currentColor');
1522 + btn.querySelector('svg').setAttribute('stroke', 'none');
1523 + } else {
1524 + btn.classList.remove('liked');
1525 + btn.querySelector('svg').removeAttribute('fill');
1526 + btn.querySelector('svg').setAttribute('stroke', 'currentColor');
1527 + }
1528 + })
1529 + .catch(function() { alert('エラーが発生しました'); })
1530 + .finally(function() { btn.disabled = false; });
1531 +}
1532 +
1081 1081  function toggleCompactView() {
1082 1082   var container = document.querySelector('.xwiki-content') || document.body;
1083 1083   var isCompact = container.classList.toggle('activity-compact-view');
... ... @@ -1142,7 +1142,7 @@
1142 1142   fyTabs.forEach(function(t) { tabContainer.appendChild(t); });
1143 1143   if (allTab) { tabContainer.appendChild(allTab); }
1144 1144   }
1145 - // デフォルトで現在の年度を表示
1597 + // デフォルトで全期間を表示
1146 1146   var defaultTab = document.querySelector('.activity-fy-tab.active');
1147 1147   if (defaultTab) { defaultTab.click(); }
1148 1148   // 保存成功時のトースト通知
... ... @@ -1195,7 +1195,15 @@
1195 1195   };
1196 1196   var toast = document.createElement('div');
1197 1197   toast.className = 'toast toast-' + type;
1198 - toast.innerHTML = (icons[type] || '') + '<span>' + message + '</span>';
1650 + var iconSvg = icons[type] || '';
1651 + if (iconSvg) {
1652 + var iconSpan = document.createElement('span');
1653 + iconSpan.innerHTML = iconSvg;
1654 + toast.appendChild(iconSpan);
1655 + }
1656 + var msgSpan = document.createElement('span');
1657 + msgSpan.textContent = message;
1658 + toast.appendChild(msgSpan);
1199 1199   container.appendChild(toast);
1200 1200   setTimeout(function() { toast.remove(); }, 3200);
1201 1201  }
... ... @@ -1211,37 +1211,131 @@
1211 1211  }
1212 1212  
1213 1213  // 投稿の編集(インライン編集フォームを開く)
1214 -function openEditPost(btn, schoolPage, postObjNum, currentContent) {
1674 +function openEditPost(btn) {
1215 1215   var postEl = btn.closest('.thread-post');
1216 1216   if (!postEl) return;
1217 - // 既存の編集フォームがあれば閉じる
1218 1218   var existing = postEl.querySelector('.post-edit-form');
1219 1219   if (existing) { existing.remove(); return; }
1220 1220   var bodyEl = postEl.querySelector('.thread-post-body');
1221 1221   if (!bodyEl) return;
1681 +
1682 + var schoolPage = btn.getAttribute('data-school');
1683 + var postObjNum = btn.getAttribute('data-obj');
1684 + var currentContent = btn.getAttribute('data-content') || '';
1685 + var currentImages = btn.getAttribute('data-images') || '';
1686 + var currentFiles = btn.getAttribute('data-files') || '';
1687 + var postType = btn.getAttribute('data-post-type') || 'report';
1688 +
1222 1222   var form = document.createElement('div');
1223 1223   form.className = 'post-edit-form';
1224 - form.innerHTML = '<textarea id="editContent_' + postObjNum + '">' + currentContent.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') + '</textarea>' +
1225 - '<div class="post-edit-form-actions">' +
1691 + form.setAttribute('data-school', schoolPage);
1692 + form.setAttribute('data-obj', postObjNum);
1693 +
1694 + var html = '<textarea id="editContent_' + postObjNum + '">' + currentContent.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') + '</textarea>';
1695 +
1696 + // コメント以外は添付ファイル編集を表示
1697 + function escAttr(s) { return s.replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#39;').replace(/</g,'&lt;').replace(/>/g,'&gt;'); }
1698 + if (postType !== 'comment') {
1699 + // 既存画像
1700 + html += '<div class="edit-attachments">';
1701 + if (currentImages.trim()) {
1702 + html += '<div class="edit-attach-section"><span class="edit-attach-label">画像</span>';
1703 + var imgs = currentImages.trim().split('\n');
1704 + for (var i = 0; i < imgs.length; i++) {
1705 + var img = imgs[i].trim();
1706 + if (!img) continue;
1707 + html += '<div class="edit-attach-item" data-name="' + escAttr(img) + '">' +
1708 + '<img src="/xwiki/bin/download/' + schoolPage.replace(/\./g,'/') + '/' + encodeURIComponent(img) + '" class="edit-attach-thumb" />' +
1709 + '<button type="button" class="edit-attach-remove" onclick="removeEditAttach(this)" title="削除">✕</button>' +
1710 + '<input type="hidden" name="keepImages" value="' + escAttr(img) + '" />' +
1711 + '</div>';
1712 + }
1713 + html += '</div>';
1714 + }
1715 + // 既存ファイル
1716 + if (currentFiles.trim()) {
1717 + html += '<div class="edit-attach-section"><span class="edit-attach-label">ファイル</span>';
1718 + var files = currentFiles.trim().split('\n');
1719 + for (var j = 0; j < files.length; j++) {
1720 + var f = files[j].trim();
1721 + if (!f) continue;
1722 + var displayName = f;
1723 + if (/^file_\d{14}_\d+_/.test(f)) displayName = f.replace(/^file_\d{14}_\d+_/, '');
1724 + html += '<div class="edit-attach-item" data-name="' + escAttr(f) + '">' +
1725 + '<span class="edit-attach-fname">' + escAttr(displayName) + '</span>' +
1726 + '<button type="button" class="edit-attach-remove" onclick="removeEditAttach(this)" title="削除">✕</button>' +
1727 + '<input type="hidden" name="keepFiles" value="' + escAttr(f) + '" />' +
1728 + '</div>';
1729 + }
1730 + html += '</div>';
1731 + }
1732 + // 新規追加
1733 + html += '<div class="edit-attach-add">' +
1734 + '<label class="form-label-sm">画像を追加(最大4枚まで)</label>' +
1735 + '<input type="file" name="editNewImages" accept="image/*" multiple class="form-file-input-sm" />' +
1736 + '<div class="form-hint">JPEG / PNG / GIF / WebP、各5MBまで</div>' +
1737 + '<label class="form-label-sm" style="margin-top:8px;">ファイルを追加(最大2つまで)</label>' +
1738 + '<input type="file" name="editNewFiles" accept=".pdf,.docx,.xlsx,.pptx" multiple class="form-file-input-sm" />' +
1739 + '<div class="form-hint">PDF / Word / Excel / PowerPoint、各10MBまで</div>' +
1740 + '</div>';
1741 + html += '</div>';
1742 + }
1743 +
1744 + html += '<div class="post-edit-form-actions">' +
1226 1226   '<button type="button" class="btn-cancel-edit" onclick="this.closest(\'.post-edit-form\').remove()">キャンセル</button>' +
1227 - '<button type="button" class="btn-save" onclick="saveEditPost(\'' + schoolPage + '\', ' + postObjNum + ')">保存</button>' +
1746 + '<button type="button" class="btn-save" onclick="saveEditPost(this)">保存</button>' +
1228 1228   '</div>';
1748 +
1749 + form.innerHTML = html;
1229 1229   bodyEl.parentNode.insertBefore(form, bodyEl.nextSibling);
1230 1230   form.querySelector('textarea').focus();
1231 1231  }
1232 1232  
1754 +function removeEditAttach(btn) {
1755 + var item = btn.closest('.edit-attach-item');
1756 + if (item) item.remove();
1757 +}
1758 +
1233 1233  // 投稿の編集を保存
1234 -function saveEditPost(schoolPage, postObjNum) {
1235 - var textarea = document.getElementById('editContent_' + postObjNum);
1760 +function saveEditPost(btn) {
1761 + var formEl = btn.closest('.post-edit-form');
1762 + if (!formEl) return;
1763 + var schoolPage = formEl.getAttribute('data-school');
1764 + var postObjNum = formEl.getAttribute('data-obj');
1765 + var textarea = formEl.querySelector('textarea');
1236 1236   if (!textarea) return;
1237 1237   var newContent = textarea.value.trim();
1238 1238   if (!newContent) { alert('投稿内容を入力してください'); return; }
1769 +
1239 1239   var csrfEl = document.querySelector('input[name="form_token"]');
1240 1240   var csrfToken = csrfEl ? csrfEl.value : '';
1772 +
1773 + var fd = new FormData();
1774 + fd.append('schoolPage', schoolPage);
1775 + fd.append('postObj', postObjNum);
1776 + fd.append('newContent', newContent);
1777 + fd.append('form_token', csrfToken);
1778 +
1779 + // 残す画像・ファイル
1780 + formEl.querySelectorAll('input[name="keepImages"]').forEach(function(el) { fd.append('keepImages', el.value); });
1781 + formEl.querySelectorAll('input[name="keepFiles"]').forEach(function(el) { fd.append('keepFiles', el.value); });
1782 +
1783 + // 新規画像
1784 + var newImgInput = formEl.querySelector('input[name="editNewImages"]');
1785 + if (newImgInput && newImgInput.files) {
1786 + for (var i = 0; i < newImgInput.files.length; i++) { fd.append('editNewImages', newImgInput.files[i]); }
1787 + }
1788 + // 新規ファイル
1789 + var newFileInput = formEl.querySelector('input[name="editNewFiles"]');
1790 + if (newFileInput && newFileInput.files) {
1791 + for (var j = 0; j < newFileInput.files.length; j++) { fd.append('editNewFiles', newFileInput.files[j]); }
1792 + }
1793 +
1794 + btn.disabled = true;
1795 + btn.textContent = '保存中...';
1796 +
1241 1241   var xhr = new XMLHttpRequest();
1242 1242   xhr.open('POST', '/bin/get/SeitokaiCode/EditPost?outputSyntax=plain', true);
1243 - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1244 - var editPostData = 'schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&newContent=' + encodeURIComponent(newContent) + '&form_token=' + encodeURIComponent(csrfToken);
1245 1245   xhr.onload = function() {
1246 1246   try {
1247 1247   var res = JSON.parse(xhr.responseText);
... ... @@ -1249,12 +1249,13 @@
1249 1249   showToast('投稿を更新しました', 'success');
1250 1250   setTimeout(function() { location.reload(); }, 800);
1251 1251   } else {
1806 + btn.disabled = false; btn.textContent = '保存';
1252 1252   alert('編集に失敗しました: ' + (res.error || ''));
1253 1253   }
1254 - } catch(e) { alert('編集に失敗しました'); }
1809 + } catch(e) { btn.disabled = false; btn.textContent = '保存'; alert('編集に失敗しました'); }
1255 1255   };
1256 - xhr.onerror = function() { alert('通信エラーが発生しました'); };
1257 - xhr.send(editPostData);
1811 + xhr.onerror = function() { btn.disabled = false; btn.textContent = '保存'; alert('通信エラーが発生しました'); };
1812 + xhr.send(fd);
1258 1258  }
1259 1259  
1260 1260  // 投稿の削除(確認ダイアログ付き)