Changes for page 学校ページ テンプレート
Last modified by Super Admin on 2026/04/05 18:59
From version
91.1
edited by Super Admin
on 2026/03/20 02:26
on 2026/03/20 02:26
Change comment:
There is no comment for this version
To version
69.1
edited by Super Admin
on 2026/03/18 11:44
on 2026/03/18 11:44
Change comment:
There is no comment for this version
Summary
Details
- Page properties
-
- Content
-
... ... @@ -1,11 +1,5 @@ 1 1 {{velocity}} 2 2 ## ===== 学校ページ テンプレート ===== 3 -## ゲストが ?sheet= 付きURL(編集フォーム等)に直接アクセスした場合、ログインページへリダイレクト 4 -#if($xcontext.user == 'XWiki.XWikiGuest' && $request.sheet && $request.sheet != '') 5 - #set($currentUrl = $doc.getURL('view', "sheet=${request.sheet}")) 6 - $response.sendRedirect("/bin/login/XWiki/XWikiLogin?srid=$escapetool.url($currentUrl)") 7 - #stop 8 -#end 9 9 {{html clean="false"}} 10 10 ## メンテナンスバナー({{include}}ではなくインラインで記述し、<p>タグ挿入を回避) 11 11 #set($bannerDoc = $xwiki.getDocument('SeitokaiAdmin.MaintenanceBanner')) ... ... @@ -34,10 +34,8 @@ 34 34 #set($schoolLevel = $doc.getValue('schoolLevel')) 35 35 #set($schoolSystem = $doc.getValue('schoolSystem')) 36 36 #set($website = $doc.getValue('website')) 37 -#set($schoolPhoto = $doc.getValue('schoolPhoto')) 38 -#set($schoolDescription = $doc.getValue('schoolDescription')) 39 39 40 -## --- 生徒会組織 ---32 +## --- 組織図 --- 41 41 #set($orgChart = $doc.getValue('orgChart')) 42 42 #set($orgChartImage = $doc.getValue('orgChartImage')) 43 43 ... ... @@ -57,7 +57,7 @@ 57 57 #set($budgetAllocation = $doc.getValue('budgetAllocation')) 58 58 #set($budgetNote = $doc.getValue('budgetNote')) 59 59 60 -## --- 校則 ・生徒会会則の見直し ---52 +## --- 校則の見直し --- 61 61 #set($ruleReviewStatus = $doc.getValue('ruleReviewStatus')) 62 62 #set($ruleReviewContent = $doc.getValue('ruleReviewContent')) 63 63 #set($ruleReviewProposer = $doc.getValue('ruleReviewProposer')) ... ... @@ -103,8 +103,6 @@ 103 103 #set($viewerDoc = $xwiki.getDocument($viewerUser)) 104 104 #set($viewerAccountType = $!viewerDoc.getValue('accountType')) 105 105 #set($viewerSchoolCode = $!viewerDoc.getValue('schoolCode')) 106 - #set($viewerSecondarySchoolCode = $!viewerDoc.getValue('secondarySchoolCode')) 107 - #set($viewerUserRole = $!viewerDoc.getValue('userRole')) 108 108 #if($viewerAccountType == 'admin') 109 109 #set($isViewerAdmin = true) 110 110 #end ... ... @@ -114,31 +114,10 @@ 114 114 #set($affiliatedSchoolCode = $!doc.getValue('affiliatedSchoolCode')) 115 115 #set($affiliatedSchoolName = $!doc.getValue('affiliatedSchoolName')) 116 116 #set($isAffiliated = false) 117 -#if($affiliatedSchoolCode && $affiliatedSchoolCode != '') 118 - #if($viewerSchoolCode == $affiliatedSchoolCode) 119 - #set($isAffiliated = true) 120 - #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $affiliatedSchoolCode) 121 - #set($isAffiliated = true) 122 - #end 107 +#if($affiliatedSchoolCode && $affiliatedSchoolCode != '' && $viewerSchoolCode == $affiliatedSchoolCode) 108 + #set($isAffiliated = true) 123 123 #end 124 124 125 -## --- 校内判定(卒業生を除外、secondarySchoolCodeも含む) --- 126 -#set($isSchoolMember = false) 127 -#if(!$isGuest && $viewerUserRole != 'graduate') 128 - #if($viewerSchoolCode == $schoolCode || $isAffiliated) 129 - #set($isSchoolMember = true) 130 - #elseif($viewerSecondarySchoolCode && $viewerSecondarySchoolCode != '' && $viewerSecondarySchoolCode == $schoolCode) 131 - #set($isSchoolMember = true) 132 - #end 133 -#end 134 -## 卒業生の母校判定(投稿バッジ用) 135 -#set($isAlumniOfSchool = false) 136 -#if(!$isGuest && $viewerUserRole == 'graduate') 137 - #if($viewerSchoolCode == $schoolCode || ($affiliatedSchoolCode != '' && $viewerSchoolCode == $affiliatedSchoolCode)) 138 - #set($isAlumniOfSchool = true) 139 - #end 140 -#end 141 - 142 142 ## --- 学校ページ非表示チェック --- 143 143 #set($schoolHidden = $doc.getValue('hidden')) 144 144 #if($schoolHidden == 1) ... ... @@ -172,7 +172,7 @@ 172 172 173 173 ## --- 投稿固定/解除処理 --- 174 174 #set($pinAction = $!request.action) 175 -#if(($pinAction == 'pin' || $pinAction == 'unpin') && ($viewerAccountType == 'admin' || ($viewerAccountType == 'verified' && $i sSchoolMember)) && $services.csrf.isTokenValid($request.form_token))144 +#if(($pinAction == 'pin' || $pinAction == 'unpin') && ($viewerAccountType == 'admin' || ($viewerAccountType == 'verified' && ($viewerSchoolCode == $schoolCode || $isAffiliated))) && $services.csrf.isTokenValid($request.form_token)) 176 176 #set($pinPostObjStr = $!request.postObj) 177 177 #if(!$pinPostObjStr.matches('^\d+$')) 178 178 ## 不正な値 → 無視 ... ... @@ -202,7 +202,7 @@ 202 202 203 203 ## --- 特色ある活動 選定/解除処理 --- 204 204 #set($featAction = $!request.action) 205 -#if(($featAction == 'feature' || $featAction == 'unfeature') && ($viewerAccountType == 'admin' || (($viewerAccountType == 'verified' || $viewerAccountType == 'referred') && $i sSchoolMember)) && $services.csrf.isTokenValid($request.form_token))174 +#if(($featAction == 'feature' || $featAction == 'unfeature') && ($viewerAccountType == 'admin' || (($viewerAccountType == 'verified' || $viewerAccountType == 'referred') && $viewerSchoolCode == $schoolCode)) && $services.csrf.isTokenValid($request.form_token)) 206 206 #set($featActObjStr = $!request.actObj) 207 207 #if($featActObjStr.matches('^\d+$')) 208 208 #set($actObjNum = $mathtool.toInteger($featActObjStr)) ... ... @@ -304,7 +304,7 @@ 304 304 305 305 ## --- 編集ボタン(権限があるユーザーのみ表示) --- 306 306 #set($canEditSchool = false) 307 -#if(!$isGuest && ($isViewerAdmin || $i sSchoolMember))276 +#if(!$isGuest && ($isViewerAdmin || $viewerSchoolCode == $schoolCode || $isAffiliated)) 308 308 #set($canEditSchool = true) 309 309 #end 310 310 #if($canEditSchool) ... ... @@ -334,30 +334,22 @@ 334 334 ## --- ① 学校基本情報 --- 335 335 <div class="school-info-card collapsed" id="card-basic-info"> 336 336 <h2 role="button" tabindex="0" aria-expanded="false" onclick="toggleInfoCard('card-basic-info')" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();toggleInfoCard('card-basic-info')}"><span><svg class="ico ico-md" viewBox="0 0 24 24"><path d="M4 19.5A2.5 2.5 0 016.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z"/></svg> 学校基本情報</span><span class="collapse-toggle"><span class="collapse-label-open">たたむ</span><span class="collapse-label-closed">開く</span> <span class="collapse-arrow">▼</span></span></h2> 337 - <div class="school-basic-info-layout"> 338 - <div class="school-basic-info-table"> 339 - <table class="wiki-table school-info-table"> 340 - <tr><th>学校コード</th><td>$!escapetool.xml($!schoolCode)</td></tr> 341 - <tr><th>学校名</th><td>$!escapetool.xml($!schoolName)</td></tr> 342 - <tr><th>所在地</th><td>$!escapetool.xml($!prefecture) #if($city && $city != '')$!escapetool.xml($city)#end</td></tr> 343 - <tr><th>学級数・生徒数</th><td>#if($classCount && $classCount != '')${classCount}学級#end #if($studentCount && $studentCount != '')/ 約${studentCount}名#end</td></tr> 344 - <tr><th>共学・別学</th><td>$!escapetool.xml($!coeducation)</td></tr> 345 - <tr><th>設置者</th><td>$!escapetool.xml($!establishment)</td></tr> 346 - <tr><th>学校種</th><td>$!escapetool.xml($!schoolLevel)</td></tr> 347 - <tr><th>課程</th><td>#if($schoolSystem && !$schoolSystem.isEmpty())#foreach($ss in $schoolSystem)#if($foreach.count > 1) / #end$!escapetool.xml($ss)#end#end</td></tr> 348 - <tr><th>公式サイト</th><td>#if($website && $website != '')<a href="$!escapetool.xml($website)" target="_blank" rel="noopener">$!escapetool.xml($website)</a>#else<span class="text-placeholder">未登録</span>#end</td></tr> 349 - </table> 350 - </div> 351 - #if($schoolPhoto && $schoolPhoto != '') 352 - <div class="school-photo-area"> 353 - <img src="$doc.getAttachmentURL($schoolPhoto)" alt="$!escapetool.xml($schoolName)" class="school-photo" /> 354 - </div> 355 - #end 356 - </div> 357 - #if($schoolDescription && $schoolDescription.trim() != '') 358 - <div class="free-note" style="margin-top:var(--sp-4);">$!escapetool.xml($schoolDescription)</div> 306 + <table class="wiki-table school-info-table"> 307 + <tr><th>学校コード</th><td>$!escapetool.xml($!schoolCode)</td></tr> 308 + <tr><th>学校名</th><td>$!escapetool.xml($!schoolName)</td></tr> 309 + <tr><th>所在地</th><td>$!escapetool.xml($!prefecture) #if($city && $city != '')$!escapetool.xml($city)#end</td></tr> 310 + <tr><th>学級数・生徒数</th><td>#if($classCount && $classCount != '')${classCount}学級#end #if($studentCount && $studentCount != '')/ 約${studentCount}名#end</td></tr> 311 + <tr><th>共学・別学</th><td>$!escapetool.xml($!coeducation)</td></tr> 312 + <tr><th>設置者</th><td>$!escapetool.xml($!establishment)</td></tr> 313 + <tr><th>学校種</th><td>$!escapetool.xml($!schoolLevel)</td></tr> 314 + <tr><th>課程</th><td>#if($schoolSystem && !$schoolSystem.isEmpty())#foreach($ss in $schoolSystem)#if($foreach.count > 1) / #end$!escapetool.xml($ss)#end#end</td></tr> 315 + <tr><th>公式サイト</th><td>#if($website && $website != '')<a href="$!escapetool.xml($website)" target="_blank" rel="noopener">$!escapetool.xml($website)</a>#else<span class="text-placeholder">未登録</span>#end</td></tr> 316 + </table> 317 + #set($infoEditDate = $!doc.getValue('lastInfoEditedDate')) 318 + #set($infoEditBy = $!doc.getValue('lastInfoEditedBy')) 319 + #if($infoEditDate && $infoEditDate != '') 320 + <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> 359 359 #end 360 - 361 361 </div> 362 362 363 363 ## --- ② 生徒会基本情報(折りたたみカード) --- ... ... @@ -365,25 +365,25 @@ 365 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> 366 366 <div class="seitokai-info-body"> 367 367 368 - ## --- 生徒会組織 ---329 + ## --- 組織図 --- 369 369 #set($hasOrgContent = ($orgChart && $orgChart != '') || ($orgChartImage && $orgChartImage != '')) 370 370 #if($hasOrgContent) 371 371 #set($canViewOrgChart = true) 372 - #if($visibilityOrgChart == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewOrgChart = false)373 - #elseif($visibilityOrgChart == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (( !$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewOrgChart = false)333 + #if($visibilityOrgChart == 'school' && ($isGuest || (!$isViewerAdmin && $viewerSchoolCode != $schoolCode && !$isAffiliated))) #set($canViewOrgChart = false) 334 + #elseif($visibilityOrgChart == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (($viewerSchoolCode != $schoolCode && !$isAffiliated) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewOrgChart = false) 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>338 + <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> 381 381 #end 382 - #if($orgChart && $orgChart != '') <div class="free-note">$!escapetool.xml($orgChart)</div>#end343 + #if($orgChart && $orgChart != '')$!escapetool.xml($orgChart)#end 383 383 </div> 384 384 </div> 385 385 #else 386 - <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 生徒会組織は #if($visibilityOrgChart == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div>347 + <div class="visibility-restricted-notice"><svg class="ico" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg> 組織図は #if($visibilityOrgChart == 'school_trusted')校内の承認済み・紹介メンバー#else校内メンバー#end のみ閲覧可能です</div> 387 387 #end 388 388 #end 389 389 ... ... @@ -392,10 +392,12 @@ 392 392 <div class="seitokai-subsection"> 393 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> 394 394 <div class="seitokai-subsection-content"> 395 - <p class="activity-hint">活動時間 が多い3つ</p>356 + <p class="activity-hint">活動時間の多い順に上位3つ</p> 396 396 <div class="tag-container"> 358 + #set($daIdx = 1) 397 397 #foreach($da in $dailyActivities) 398 - <span class="tag tag-accent">$!escapetool.xml($da.trim())</span> 360 + <span class="tag tag-accent">${daIdx}. $!escapetool.xml($da.trim())</span> 361 + #set($daIdx = $daIdx + 1) 399 399 #end 400 400 </div> 401 401 #if($dailyActivitiesNote && $dailyActivitiesNote.trim() != '') ... ... @@ -447,12 +447,12 @@ 447 447 #set($hasBudget = ($budgetProcess && !$budgetProcess.isEmpty()) || ($studentFee && $studentFee != '') || ($budgetScale && $budgetScale != '')) 448 448 #if($hasBudget) 449 449 #set($canViewBudget = true) 450 - #if($visibilityBudget == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewBudget = false)451 - #elseif($visibilityBudget == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (( !$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewBudget = false)413 + #if($visibilityBudget == 'school' && ($isGuest || (!$isViewerAdmin && $viewerSchoolCode != $schoolCode && !$isAffiliated))) #set($canViewBudget = false) 414 + #elseif($visibilityBudget == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (($viewerSchoolCode != $schoolCode && !$isAffiliated) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewBudget = false) 452 452 #end 453 453 #if($canViewBudget) 454 454 <div class="seitokai-subsection"> 455 - <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>418 + <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> 456 456 <div class="seitokai-subsection-content"> 457 457 #if($budgetProcess && !$budgetProcess.isEmpty()) 458 458 <div class="info-row"> ... ... @@ -459,13 +459,8 @@ 459 459 <span class="info-label">作成過程の生徒関与</span> 460 460 <span class="info-value"> 461 461 <div class="selection-display"> 462 - #set($allBpOpts = ["各部・委員会等への予算希望額調査","予算額調整(折衝等)","生徒会予算案の作成","生徒総会での議決","生徒関与なし","その他"]) 463 - #foreach($bpOpt in $allBpOpts) 464 - #if($budgetProcess.contains($bpOpt)) 465 - <span class="selection-item">$!escapetool.xml($bpOpt)</span> 466 - #else 467 - <span class="selection-item selection-item-off">$!escapetool.xml($bpOpt)</span> 468 - #end 425 + #foreach($bp in $budgetProcess) 426 + <span class="selection-item">$!escapetool.xml($bp.trim())</span> 469 469 #end 470 470 </div> 471 471 </span> ... ... @@ -505,21 +505,20 @@ 505 505 #end 506 506 #end 507 507 508 - ## --- 校則 ・生徒会会則の見直し ---466 + ## --- 校則の見直し --- 509 509 #if($ruleReviewStatus && $ruleReviewStatus != '') 510 510 #set($canViewRuleReview = true) 511 - #if($visibilityRuleReview == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewRuleReview = false)512 - #elseif($visibilityRuleReview == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (( !$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewRuleReview = false)469 + #if($visibilityRuleReview == 'school' && ($isGuest || (!$isViewerAdmin && $viewerSchoolCode != $schoolCode && !$isAffiliated))) #set($canViewRuleReview = false) 470 + #elseif($visibilityRuleReview == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (($viewerSchoolCode != $schoolCode && !$isAffiliated) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewRuleReview = false) 513 513 #end 514 514 #if($canViewRuleReview) 515 515 <div class="seitokai-subsection"> 516 - <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>474 + <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> 517 517 <div class="seitokai-subsection-content"> 518 518 <div class="info-row"> 519 519 <span class="info-label">見直しの有無(3年以内)</span> 520 520 <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($!ruleReviewStatus)</span></span> 521 521 </div> 522 - #if($ruleReviewStatus != '実施なし') 523 523 #if($ruleReviewContent && !$ruleReviewContent.isEmpty()) 524 524 <div class="info-row"> 525 525 <span class="info-label">見直しの内容</span> ... ... @@ -556,7 +556,6 @@ 556 556 </span> 557 557 </div> 558 558 #end 559 - #end 560 560 #if($ruleReviewSystem && $ruleReviewSystem != '') 561 561 <div class="info-row"> 562 562 <span class="info-label">見直しの仕組み</span> ... ... @@ -566,7 +566,7 @@ 566 566 </div> 567 567 </div> 568 568 #else 569 - <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>525 + <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> 570 570 #end 571 571 #end 572 572 ... ... @@ -573,12 +573,12 @@ 573 573 ## --- 生徒会の課題意識 --- 574 574 #if($challenges && $challenges != '') 575 575 #set($canViewChallenges = true) 576 - #if($visibilityChallenges == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewChallenges = false)577 - #elseif($visibilityChallenges == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (( !$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewChallenges = false)532 + #if($visibilityChallenges == 'school' && ($isGuest || (!$isViewerAdmin && $viewerSchoolCode != $schoolCode && !$isAffiliated))) #set($canViewChallenges = false) 533 + #elseif($visibilityChallenges == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (($viewerSchoolCode != $schoolCode && !$isAffiliated) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewChallenges = false) 578 578 #end 579 579 #if($canViewChallenges) 580 580 <div class="seitokai-subsection"> 581 - <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>537 + <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> 582 582 <div class="seitokai-subsection-content"> 583 583 <div class="challenge-text">$!escapetool.xml($challenges)</div> 584 584 </div> ... ... @@ -602,11 +602,6 @@ 602 602 <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> 603 603 <tr><th>その他SNS</th><td>#if($seitokaiOtherSns && $seitokaiOtherSns != '')$!escapetool.xml($seitokaiOtherSns)#else<span class="text-placeholder">未登録</span>#end</td></tr> 604 604 </table> 605 - #set($infoEditDate = $!doc.getValue('lastInfoEditedDate')) 606 - #set($infoEditBy = $!doc.getValue('lastInfoEditedBy')) 607 - #if($infoEditDate && $infoEditDate != '') 608 - <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> 609 - #end 610 610 </div> 611 611 612 612 {{/html}} ... ... @@ -670,7 +670,6 @@ 670 670 <span class="author-legend-title">所属:</span> 671 671 <span class="author-legend-item"><span class="badge badge-school-internal-confirmed badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内(確認済)</span> <span class="text-hint">所属が確認されたこの学校のユーザー</span></span> 672 672 <span class="author-legend-item"><span class="badge badge-school-internal badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内</span> <span class="text-hint">この学校に所属登録しているユーザー</span></span> 673 - <span class="author-legend-item"><span class="badge badge-alumni badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10l-10-5L2 10l10 5 10-5z"/><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5"/></svg> 卒業生</span> <span class="text-hint">この学校の卒業生</span></span> 674 674 <span class="author-legend-item"><span class="badge badge-school-external badge-sm"><svg class="ico" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg> 他校</span> <span class="text-hint">別の学校に所属しているユーザー</span></span> 675 675 <span class="author-legend-item text-hint">※一般アカウントは所属バッジが表示されません</span> 676 676 </div> ... ... @@ -746,18 +746,16 @@ 746 746 <div class="activity-thread" data-fiscal-year="$!escapetool.xml($actFY)"> 747 747 <div class="activity-thread-header"> 748 748 <div class="activity-thread-title"> 749 - <h3 #if($actFeatured == '1')class="featured-title"#end>#if($actFeatured == '1')<svg class="ico ico-fixed-14 ico-star-offset" viewBox="0 0 24 24" fill="currentColor" stroke="none"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg> #end$!escapetool.xml($!actTitle)</h3> 750 - <div class="activity-meta-line"> 751 - <span class="activity-meta">$!escapetool.xml($!actCommittee) | $!escapetool.xml($!actPeriod) #if($actFY != 'unknown')| $!escapetool.xml($actFY)年度#end</span> 752 - #set($actTagsList = $activity.getValue('tags')) 753 - #if($actTagsList && !$actTagsList.isEmpty()) 754 - #foreach($tagItem in $actTagsList) 755 - #if($tagItem && $tagItem.trim() != '')<span class="activity-tag-badge">$escapetool.xml($tagItem)</span>#end 756 - #end 699 + <h3 #if($actFeatured == '1')class="featured-title"#end>$!escapetool.xml($!actTitle) #if($actFeatured == '1')<svg class="ico ico-fixed-14 ico-star-offset" viewBox="0 0 24 24" fill="currentColor" stroke="none"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>#end</h3> 700 + <span class="activity-meta">$!escapetool.xml($!actCommittee) | $!escapetool.xml($!actPeriod) #if($actFY != 'unknown')| $!escapetool.xml($actFY)年度#end</span> 701 + #set($actTagsList = $activity.getValue('tags')) 702 + #if($actTagsList && !$actTagsList.isEmpty()) 703 + #foreach($tagItem in $actTagsList) 704 + #if($tagItem && $tagItem.trim() != '')<span class="activity-tag-badge">$escapetool.xml($tagItem)</span>#end 757 757 #end 758 - </div>706 + #end 759 759 </div> 760 - <div class="thread-meta-r ight">708 + <div class="thread-meta-row"> 761 761 <span class="thread-post-count">${reportCount}件の報告 ・ ${commentCount}件のコメント</span> 762 762 #if($viewerAccountType == 'admin' || $viewerAccountType == 'verified' || $viewerAccountType == 'referred') 763 763 #if($actFeatured == '1') ... ... @@ -817,8 +817,8 @@ 817 817 #set($postVis = $!post.getValue('visibility')) 818 818 #if(!$postVis || $postVis == '') #set($postVis = 'public') #end 819 819 #set($canViewPost = true) 820 - #if($postVis == 'school' && ($isGuest || (!$isViewerAdmin && !$isSchoolMember))) #set($canViewPost = false)821 - #elseif($postVis == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (( !$isSchoolMember) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewPost = false)768 + #if($postVis == 'school' && ($isGuest || (!$isViewerAdmin && $viewerSchoolCode != $schoolCode && !$isAffiliated))) #set($canViewPost = false) 769 + #elseif($postVis == 'school_trusted' && ($isGuest || (!$isViewerAdmin && (($viewerSchoolCode != $schoolCode && !$isAffiliated) || ($viewerAccountType != 'verified' && $viewerAccountType != 'referred'))))) #set($canViewPost = false) 822 822 #end 823 823 #if(!$canViewPost) 824 824 <div class="thread-post visibility-restricted-post"> ... ... @@ -862,11 +862,8 @@ 862 862 <span class="badge badge-general badge-sm">一般</span> 863 863 #end 864 864 ## 所属バッジ(投稿者の学校コードとページの学校コードを比較) 865 - #set($postIsSchoolMatch = ($postSchoolCode == $schoolCode || ($affiliatedSchoolCode != '' && $postSchoolCode == $affiliatedSchoolCode))) 866 866 #if($postSchoolCode && $postSchoolCode != '' && $postAccountType != 'general') 867 - #if($postUserRole == 'graduate' && $postIsSchoolMatch) 868 - <span class="badge badge-alumni badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10l-10-5L2 10l10 5 10-5z"/><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5"/></svg> 卒業生</span> 869 - #elseif($postIsSchoolMatch && $postUserRole != 'graduate') 814 + #if($postSchoolCode == $schoolCode || ($affiliatedSchoolCode != '' && $postSchoolCode == $affiliatedSchoolCode)) 870 870 #if($postAccountType == 'verified' || $postAccountType == 'admin') 871 871 <span class="badge badge-school-internal-confirmed badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M2 20h20"/><path d="M5 20V10l7-5 7 5v10"/><path d="M9 20v-5h6v5"/></svg> 校内(確認済)</span> 872 872 #else ... ... @@ -893,13 +893,6 @@ 893 893 #if($postEdited == 1 || $postEdited == '1') 894 894 <span class="post-edited-label">(編集済み)</span> 895 895 #end 896 - #set($postAuthorRefH = $!post.getValue('authorRef')) 897 - #set($postObjNumH = $post.number) 898 - #if(!$isGuest && $xcontext.user != $postAuthorRefH) 899 - <button type="button" class="btn-post-report btn-post-report-header" onclick="openReportDialog(this, '${doc.fullName}', $postObjNumH, '${services.csrf.getToken()}')" title="この投稿を通報"> 900 - <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" y1="22" x2="4" y2="15"/></svg> 通報 901 - </button> 902 - #end 903 903 </div> 904 904 <div class="thread-post-body"> 905 905 $!escapetool.xml($!postContent) ... ... @@ -964,18 +964,12 @@ 964 964 #end 965 965 </div> 966 966 #if($postVis != 'public') 967 - <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>905 + <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> 968 968 #end 969 - ## 固定/編集/削除/通報/非表示ボタン(横並び) 970 - #set($postAuthorRef = $!post.getValue('authorRef')) 971 - #set($postObjNumED = $post.number) 972 - #set($showPinBtn = ($viewerAccountType == 'admin' || $viewerAccountType == 'verified')) 973 - #set($showEditDeleteBtn = ($xcontext.user == $postAuthorRef || $viewerAccountType == 'admin')) 974 - #set($showHideBtn = ($viewerAccountType == 'admin')) 975 - #if($showPinBtn || $showEditDeleteBtn || $showHideBtn) 976 - <div class="post-edit-actions post-action-mt"> 977 - #if($showPinBtn) 978 - #set($postObjNum = $post.number) 907 + ## 固定/解除ボタン(承認済み・管理者のみ) 908 + #if($viewerAccountType == 'admin' || $viewerAccountType == 'verified') 909 + #set($postObjNum = $post.number) 910 + <div class="post-pin-action post-action-mt"> 979 979 #if($isPinned == '1') 980 980 <a href="$doc.getURL('view', "action=unpin&postObj=${postObjNum}&form_token=${services.csrf.getToken()}")" class="btn-pin-toggle btn-unpin" title="固定を解除"> 981 981 <svg class="ico ico-fixed-14" viewBox="0 0 24 24" fill="currentColor" stroke="none"><path d="M16 2l-4 4-2-1-5 5 3 3-6 6h4l4-4 3 3 5-5-1-2 4-4-5-5z"/></svg> 固定を解除 ... ... @@ -985,12 +985,15 @@ 985 985 <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M16 2l-4 4-2-1-5 5 3 3-6 6h4l4-4 3 3 5-5-1-2 4-4-5-5z"/></svg> 固定する 986 986 </a> 987 987 #end 988 - #end 989 - #if($showEditDeleteBtn) 920 + </div> 921 + #end 922 + ## 編集・削除ボタン(投稿者本人 or 管理者) 923 + #set($postAuthorRef = $!post.getValue('authorRef')) 924 + #set($postObjNumED = $post.number) 925 + #if($xcontext.user == $postAuthorRef || $viewerAccountType == 'admin') 926 + <div class="post-edit-actions post-action-mt"> 990 990 #if($xcontext.user == $postAuthorRef) 991 - #set($editImages = $!post.getValue('images')) 992 - #set($editFiles = $!post.getValue('files')) 993 - <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="この投稿を編集"> 928 + <button type="button" class="btn-post-edit" onclick="openEditPost(this, '${doc.fullName}', $postObjNumED, '$!escapetool.javascript($!postContent)')" title="この投稿を編集"> 994 994 <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> 編集 995 995 </button> 996 996 #end ... ... @@ -997,12 +997,6 @@ 997 997 <button type="button" class="btn-post-delete" onclick="confirmDeletePost('${doc.fullName}', $postObjNumED, '${services.csrf.getToken()}')" title="この投稿を削除"> 998 998 <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg> 削除 999 999 </button> 1000 - #end 1001 - #if($showHideBtn) 1002 - <button type="button" class="btn-post-hide" onclick="openHideDialog(this, '${doc.fullName}', $postObjNumED, '${services.csrf.getToken()}')" title="この投稿を非表示にする"> 1003 - <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg> 非表示 1004 - </button> 1005 - #end 1006 1006 </div> 1007 1007 #end 1008 1008 </div> ... ... @@ -1052,11 +1052,9 @@ 1052 1052 1053 1053 #if($xcontext.user != "XWiki.XWikiGuest") 1054 1054 <div class="thread-add-post"> 1055 - #if($isSchoolMember || $isViewerAdmin) 1056 1056 <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=report" class="btn-thread-add"> 1057 1057 + 活動報告を追加 1058 1058 </a> 1059 - #end 1060 1060 <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=comment" class="btn-thread-comment"> 1061 1061 <svg class="ico" viewBox="0 0 24 24"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/></svg> コメントを書く 1062 1062 </a> ... ... @@ -1133,27 +1133,6 @@ 1133 1133 } 1134 1134 // ページ読み込み時の初期化 1135 1135 document.addEventListener('DOMContentLoaded', function() { 1136 - // 年度タブを降順にソート(「全期間」タブは末尾に固定) 1137 - var tabContainer = document.querySelector('.activity-fy-tabs'); 1138 - if (tabContainer) { 1139 - var tabs = Array.from(tabContainer.querySelectorAll('.activity-fy-tab')); 1140 - var allTab = null; 1141 - var fyTabs = []; 1142 - tabs.forEach(function(t) { 1143 - var onclickStr = t.getAttribute('onclick') || ''; 1144 - if (onclickStr.indexOf("'all'") !== -1) { allTab = t; } 1145 - else { fyTabs.push(t); } 1146 - }); 1147 - // 年度タブを数値の降順でソート 1148 - fyTabs.sort(function(a, b) { 1149 - var aYear = parseInt(a.textContent) || 0; 1150 - var bYear = parseInt(b.textContent) || 0; 1151 - return bYear - aYear; 1152 - }); 1153 - // DOM再配置 1154 - fyTabs.forEach(function(t) { tabContainer.appendChild(t); }); 1155 - if (allTab) { tabContainer.appendChild(allTab); } 1156 - } 1157 1157 // デフォルトで現在の年度を表示 1158 1158 var defaultTab = document.querySelector('.activity-fy-tab.active'); 1159 1159 if (defaultTab) { defaultTab.click(); } ... ... @@ -1223,130 +1223,37 @@ 1223 1223 } 1224 1224 1225 1225 // 投稿の編集(インライン編集フォームを開く) 1226 -function openEditPost(btn) { 1132 +function openEditPost(btn, schoolPage, postObjNum, currentContent) { 1227 1227 var postEl = btn.closest('.thread-post'); 1228 1228 if (!postEl) return; 1135 + // 既存の編集フォームがあれば閉じる 1229 1229 var existing = postEl.querySelector('.post-edit-form'); 1230 1230 if (existing) { existing.remove(); return; } 1231 1231 var bodyEl = postEl.querySelector('.thread-post-body'); 1232 1232 if (!bodyEl) return; 1233 - 1234 - var schoolPage = btn.getAttribute('data-school'); 1235 - var postObjNum = btn.getAttribute('data-obj'); 1236 - var currentContent = btn.getAttribute('data-content') || ''; 1237 - var currentImages = btn.getAttribute('data-images') || ''; 1238 - var currentFiles = btn.getAttribute('data-files') || ''; 1239 - var postType = btn.getAttribute('data-post-type') || 'report'; 1240 - 1241 1241 var form = document.createElement('div'); 1242 1242 form.className = 'post-edit-form'; 1243 - form.setAttribute('data-school', schoolPage); 1244 - form.setAttribute('data-obj', postObjNum); 1245 - 1246 - var html = '<textarea id="editContent_' + postObjNum + '">' + currentContent.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>') + '</textarea>'; 1247 - 1248 - // コメント以外は添付ファイル編集を表示 1249 - if (postType !== 'comment') { 1250 - // 既存画像 1251 - html += '<div class="edit-attachments">'; 1252 - if (currentImages.trim()) { 1253 - html += '<div class="edit-attach-section"><span class="edit-attach-label">画像</span>'; 1254 - var imgs = currentImages.trim().split('\n'); 1255 - for (var i = 0; i < imgs.length; i++) { 1256 - var img = imgs[i].trim(); 1257 - if (!img) continue; 1258 - html += '<div class="edit-attach-item" data-name="' + img.replace(/"/g,'"') + '">' + 1259 - '<img src="/xwiki/bin/download/' + schoolPage.replace(/\./g,'/') + '/' + encodeURIComponent(img) + '" class="edit-attach-thumb" />' + 1260 - '<button type="button" class="edit-attach-remove" onclick="removeEditAttach(this)" title="削除">✕</button>' + 1261 - '<input type="hidden" name="keepImages" value="' + img.replace(/"/g,'"') + '" />' + 1262 - '</div>'; 1263 - } 1264 - html += '</div>'; 1265 - } 1266 - // 既存ファイル 1267 - if (currentFiles.trim()) { 1268 - html += '<div class="edit-attach-section"><span class="edit-attach-label">ファイル</span>'; 1269 - var files = currentFiles.trim().split('\n'); 1270 - for (var j = 0; j < files.length; j++) { 1271 - var f = files[j].trim(); 1272 - if (!f) continue; 1273 - var displayName = f; 1274 - if (/^file_\d{14}_\d+_/.test(f)) displayName = f.replace(/^file_\d{14}_\d+_/, ''); 1275 - html += '<div class="edit-attach-item" data-name="' + f.replace(/"/g,'"') + '">' + 1276 - '<span class="edit-attach-fname">' + displayName.replace(/</g,'<').replace(/>/g,'>') + '</span>' + 1277 - '<button type="button" class="edit-attach-remove" onclick="removeEditAttach(this)" title="削除">✕</button>' + 1278 - '<input type="hidden" name="keepFiles" value="' + f.replace(/"/g,'"') + '" />' + 1279 - '</div>'; 1280 - } 1281 - html += '</div>'; 1282 - } 1283 - // 新規追加 1284 - html += '<div class="edit-attach-add">' + 1285 - '<label class="form-label-sm">画像を追加(最大4枚まで)</label>' + 1286 - '<input type="file" name="editNewImages" accept="image/*" multiple class="form-file-input-sm" />' + 1287 - '<div class="form-hint">JPEG / PNG / GIF / WebP、各5MBまで</div>' + 1288 - '<label class="form-label-sm" style="margin-top:8px;">ファイルを追加(最大2つまで)</label>' + 1289 - '<input type="file" name="editNewFiles" accept=".pdf,.docx,.xlsx,.pptx" multiple class="form-file-input-sm" />' + 1290 - '<div class="form-hint">PDF / Word / Excel / PowerPoint、各10MBまで</div>' + 1291 - '</div>'; 1292 - html += '</div>'; 1293 - } 1294 - 1295 - html += '<div class="post-edit-form-actions">' + 1142 + form.innerHTML = '<textarea id="editContent_' + postObjNum + '">' + currentContent.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>') + '</textarea>' + 1143 + '<div class="post-edit-form-actions">' + 1296 1296 '<button type="button" class="btn-cancel-edit" onclick="this.closest(\'.post-edit-form\').remove()">キャンセル</button>' + 1297 - '<button type="button" class="btn-save" onclick="saveEditPost( this)">保存</button>' +1145 + '<button type="button" class="btn-save" onclick="saveEditPost(\'' + schoolPage + '\', ' + postObjNum + ')">保存</button>' + 1298 1298 '</div>'; 1299 - 1300 - form.innerHTML = html; 1301 1301 bodyEl.parentNode.insertBefore(form, bodyEl.nextSibling); 1302 1302 form.querySelector('textarea').focus(); 1303 1303 } 1304 1304 1305 -function removeEditAttach(btn) { 1306 - var item = btn.closest('.edit-attach-item'); 1307 - if (item) item.remove(); 1308 -} 1309 - 1310 1310 // 投稿の編集を保存 1311 -function saveEditPost(btn) { 1312 - var formEl = btn.closest('.post-edit-form'); 1313 - if (!formEl) return; 1314 - var schoolPage = formEl.getAttribute('data-school'); 1315 - var postObjNum = formEl.getAttribute('data-obj'); 1316 - var textarea = formEl.querySelector('textarea'); 1152 +function saveEditPost(schoolPage, postObjNum) { 1153 + var textarea = document.getElementById('editContent_' + postObjNum); 1317 1317 if (!textarea) return; 1318 1318 var newContent = textarea.value.trim(); 1319 1319 if (!newContent) { alert('投稿内容を入力してください'); return; } 1320 - 1321 1321 var csrfEl = document.querySelector('input[name="form_token"]'); 1322 1322 var csrfToken = csrfEl ? csrfEl.value : ''; 1323 - 1324 - var fd = new FormData(); 1325 - fd.append('schoolPage', schoolPage); 1326 - fd.append('postObj', postObjNum); 1327 - fd.append('newContent', newContent); 1328 - fd.append('form_token', csrfToken); 1329 - 1330 - // 残す画像・ファイル 1331 - formEl.querySelectorAll('input[name="keepImages"]').forEach(function(el) { fd.append('keepImages', el.value); }); 1332 - formEl.querySelectorAll('input[name="keepFiles"]').forEach(function(el) { fd.append('keepFiles', el.value); }); 1333 - 1334 - // 新規画像 1335 - var newImgInput = formEl.querySelector('input[name="editNewImages"]'); 1336 - if (newImgInput && newImgInput.files) { 1337 - for (var i = 0; i < newImgInput.files.length; i++) { fd.append('editNewImages', newImgInput.files[i]); } 1338 - } 1339 - // 新規ファイル 1340 - var newFileInput = formEl.querySelector('input[name="editNewFiles"]'); 1341 - if (newFileInput && newFileInput.files) { 1342 - for (var j = 0; j < newFileInput.files.length; j++) { fd.append('editNewFiles', newFileInput.files[j]); } 1343 - } 1344 - 1345 - btn.disabled = true; 1346 - btn.textContent = '保存中...'; 1347 - 1348 1348 var xhr = new XMLHttpRequest(); 1349 1349 xhr.open('POST', '/bin/get/SeitokaiCode/EditPost?outputSyntax=plain', true); 1161 + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 1162 + var editPostData = 'schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&newContent=' + encodeURIComponent(newContent) + '&form_token=' + encodeURIComponent(csrfToken); 1350 1350 xhr.onload = function() { 1351 1351 try { 1352 1352 var res = JSON.parse(xhr.responseText); ... ... @@ -1354,13 +1354,12 @@ 1354 1354 showToast('投稿を更新しました', 'success'); 1355 1355 setTimeout(function() { location.reload(); }, 800); 1356 1356 } else { 1357 - btn.disabled = false; btn.textContent = '保存'; 1358 1358 alert('編集に失敗しました: ' + (res.error || '')); 1359 1359 } 1360 - } catch(e) { btn.disabled = false; btn.textContent = '保存'; alert('編集に失敗しました'); }1172 + } catch(e) { alert('編集に失敗しました'); } 1361 1361 }; 1362 - xhr.onerror = function() { btn.disabled = false; btn.textContent = '保存'; alert('通信エラーが発生しました'); };1363 - xhr.send( fd);1174 + xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1175 + xhr.send(editPostData); 1364 1364 } 1365 1365 1366 1366 // 投稿の削除(確認ダイアログ付き) ... ... @@ -1384,80 +1384,6 @@ 1384 1384 xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1385 1385 xhr.send(deletePostData); 1386 1386 } 1387 - 1388 -/* --- 通報ダイアログ --- */ 1389 -function openReportDialog(btn, targetPage, postObjNum, token) { 1390 - if (document.getElementById('report-dialog-overlay')) return; 1391 - var reasons = ['宣伝・スパム','不適切な内容','個人情報の露出','誹謗中傷','誤情報','その他']; 1392 - var overlay = document.createElement('div'); 1393 - overlay.id = 'report-dialog-overlay'; 1394 - overlay.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:9999;display:flex;align-items:center;justify-content:center;'; 1395 - var dialog = document.createElement('div'); 1396 - dialog.style.cssText = 'background:#fff;border-radius:12px;padding:24px;max-width:400px;width:90%;max-height:80vh;overflow-y:auto;'; 1397 - var html = '<h3 style="margin:0 0 16px;font-size:1.1em;">投稿を通報</h3>'; 1398 - html += '<p style="margin:0 0 12px;font-size:0.9em;color:#4b5563;">通報された投稿は管理者が確認するまで一時的に非表示になります。</p>'; 1399 - html += '<label style="display:block;margin-bottom:8px;font-weight:600;font-size:0.9em;">通報理由</label>'; 1400 - html += '<select id="report-reason" style="width:100%;padding:8px;border:1px solid #d1d5db;border-radius:8px;margin-bottom:12px;font-size:0.9em;">'; 1401 - for (var i=0; i<reasons.length; i++) html += '<option value="'+reasons[i]+'">'+reasons[i]+'</option>'; 1402 - html += '</select>'; 1403 - html += '<label style="display:block;margin-bottom:8px;font-weight:600;font-size:0.9em;">補足コメント(任意)</label>'; 1404 - html += '<textarea id="report-detail" rows="3" maxlength="500" style="width:100%;padding:8px;border:1px solid #d1d5db;border-radius:8px;resize:vertical;font-size:0.9em;box-sizing:border-box;" placeholder="具体的な内容があればご記入ください"></textarea>'; 1405 - html += '<div style="display:flex;gap:8px;margin-top:16px;justify-content:flex-end;">'; 1406 - html += '<button type="button" id="report-cancel-btn" style="padding:8px 16px;border:1px solid #d1d5db;border-radius:8px;background:#fff;cursor:pointer;">キャンセル</button>'; 1407 - html += '<button type="button" id="report-submit-btn" style="padding:8px 16px;border:none;border-radius:8px;background:#dc2626;color:#fff;cursor:pointer;font-weight:600;">通報する</button>'; 1408 - html += '</div>'; 1409 - dialog.innerHTML = html; 1410 - overlay.appendChild(dialog); 1411 - document.body.appendChild(overlay); 1412 - overlay.addEventListener('click', function(e) { if (e.target === overlay) overlay.remove(); }); 1413 - document.getElementById('report-cancel-btn').addEventListener('click', function() { overlay.remove(); }); 1414 - document.getElementById('report-submit-btn').addEventListener('click', function() { 1415 - var reason = document.getElementById('report-reason').value; 1416 - var detail = document.getElementById('report-detail').value; 1417 - var submitBtn = document.getElementById('report-submit-btn'); 1418 - submitBtn.disabled = true; submitBtn.textContent = '送信中...'; 1419 - var xhr = new XMLHttpRequest(); 1420 - xhr.open('POST', '/bin/get/SeitokaiCode/ReportAction?outputSyntax=plain', true); 1421 - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 1422 - var data = 'targetPage=' + encodeURIComponent(targetPage) + '&targetPost=' + postObjNum + '&reason=' + encodeURIComponent(reason) + '&detail=' + encodeURIComponent(detail) + '&form_token=' + encodeURIComponent(token); 1423 - xhr.onload = function() { 1424 - overlay.remove(); 1425 - showToast('通報を受け付けました', 'success'); 1426 - setTimeout(function() { location.reload(); }, 1000); 1427 - }; 1428 - xhr.onerror = function() { overlay.remove(); alert('通信エラーが発生しました'); }; 1429 - xhr.send(data); 1430 - }); 1431 -} 1432 - 1433 -/* --- 非表示ダイアログ(管理者用) --- */ 1434 -function openHideDialog(btn, targetPage, postObjNum, token) { 1435 - if (document.getElementById('hide-dialog-overlay')) return; 1436 - var overlay = document.createElement('div'); 1437 - overlay.id = 'hide-dialog-overlay'; 1438 - overlay.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:9999;display:flex;align-items:center;justify-content:center;'; 1439 - var dialog = document.createElement('div'); 1440 - dialog.style.cssText = 'background:#fff;border-radius:12px;padding:24px;max-width:400px;width:90%;'; 1441 - var html = '<h3 style="margin:0 0 16px;font-size:1.1em;">投稿を非表示にする</h3>'; 1442 - html += '<label style="display:block;margin-bottom:8px;font-weight:600;font-size:0.9em;">非表示の理由</label>'; 1443 - html += '<input type="text" id="hide-reason" style="width:100%;padding:8px;border:1px solid #d1d5db;border-radius:8px;margin-bottom:12px;font-size:0.9em;box-sizing:border-box;" placeholder="理由を入力" />'; 1444 - html += '<div style="display:flex;gap:8px;margin-top:16px;justify-content:flex-end;">'; 1445 - html += '<button type="button" id="hide-cancel-btn" style="padding:8px 16px;border:1px solid #d1d5db;border-radius:8px;background:#fff;cursor:pointer;">キャンセル</button>'; 1446 - html += '<button type="button" id="hide-submit-btn" style="padding:8px 16px;border:none;border-radius:8px;background:#d97706;color:#fff;cursor:pointer;font-weight:600;">非表示にする</button>'; 1447 - html += '<button type="button" id="hide-warn-btn" style="padding:8px 16px;border:none;border-radius:8px;background:#dc2626;color:#fff;cursor:pointer;font-weight:600;">非表示+警告</button>'; 1448 - html += '</div>'; 1449 - dialog.innerHTML = html; 1450 - overlay.appendChild(dialog); 1451 - document.body.appendChild(overlay); 1452 - overlay.addEventListener('click', function(e) { if (e.target === overlay) overlay.remove(); }); 1453 - document.getElementById('hide-cancel-btn').addEventListener('click', function() { overlay.remove(); }); 1454 - function doHide(action) { 1455 - var reason = document.getElementById('hide-reason').value || '管理者判断'; 1456 - window.location.href = '/bin/view/SeitokaiCode/ModerationAction?action=' + action + '&targetPage=' + encodeURIComponent(targetPage) + '&targetPost=' + postObjNum + '&reason=' + encodeURIComponent(reason) + '&form_token=' + encodeURIComponent(token); 1457 - } 1458 - document.getElementById('hide-submit-btn').addEventListener('click', function() { doHide('hide'); }); 1459 - document.getElementById('hide-warn-btn').addEventListener('click', function() { doHide('hide-warn'); }); 1460 -} 1461 1461 </script> 1462 1462 {{/html}} 1463 1463 {{/velocity}}