Changes for page 学校ページ テンプレート
Last modified by Super Admin on 2026/04/05 18:59
From version
21.1
edited by Super Admin
on 2026/03/08 18:52
on 2026/03/08 18:52
Change comment:
There is no comment for this version
To version
28.1
edited by Super Admin
on 2026/03/09 12:54
on 2026/03/09 12:54
Change comment:
There is no comment for this version
Summary
Details
- Page properties
-
- Content
-
... ... @@ -1,10 +1,21 @@ 1 1 {{velocity}} 2 2 ## ===== 学校ページ テンプレート ===== 3 -## このテンプレートは学校ページの表示と入力フォームを制御します。 4 - 5 -## メンテナンスバナー 6 -{{include reference="SeitokaiCode.MaintenanceBannerInclude" /}} 7 - 3 +{{html clean="false"}} 4 +## メンテナンスバナー({{include}}ではなくインラインで記述し、<p>タグ挿入を回避) 5 +#set($bannerDoc = $xwiki.getDocument('SeitokaiAdmin.MaintenanceBanner')) 6 +#set($bannerObj = $bannerDoc.getObject('SeitokaiCode.MaintenanceBannerClass')) 7 +#if($bannerObj && $bannerObj.getValue('enabled') == 1) 8 +#set($bannerMsg = $bannerObj.getValue('message')) 9 +#set($bannerLevel = $bannerObj.getValue('level')) 10 +#if(!$bannerLevel || $bannerLevel == '')#set($bannerLevel = 'warning')#end 11 +<div class="maintenance-banner active maintenance-${bannerLevel}" id="maintenance-banner"> 12 + <div class="maintenance-banner-inner"> 13 + <span class="maintenance-icon">#if($bannerLevel == 'urgent')<svg class="ico-banner" viewBox="0 0 24 24"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>#elseif($bannerLevel == 'info')<svg class="ico-banner" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>#else<svg class="ico-banner" viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"/></svg>#end</span> 14 + <span class="maintenance-text">$!escapetool.xml($bannerMsg)</span> 15 + <button class="maintenance-close" onclick="document.getElementById('maintenance-banner').style.display='none'">×</button> 16 + </div> 17 +</div> 18 +#end 8 8 ## --- 学校基本情報フィールド --- 9 9 #set($schoolCode = $doc.getValue('schoolCode')) 10 10 #set($schoolName = $doc.getValue('schoolName')) ... ... @@ -174,7 +174,8 @@ 174 174 #set($authorEnrollmentYear = $!lastAuthorDoc.getValue('enrollmentYear')) 175 175 #set($authorDisplayName = $!lastAuthorDoc.getValue('displayName')) 176 176 #if(!$authorDisplayName || $authorDisplayName == '') 177 - #set($authorDisplayName = $xwiki.getUserName($doc.author)) 188 + ## false引数でプレーンテキスト(HTMLリンクなし)を取得 189 + #set($authorDisplayName = $xwiki.getUserName($doc.author, false)) 178 178 #end 179 179 ## --- 学年の動的計算(学校種別対応) --- 180 180 ## 日本の学校年度: 4月始まり。currentSchoolYear = (月>=4) ? 今年 : 去年 ... ... @@ -213,7 +213,6 @@ 213 213 #end 214 214 215 215 ## --- 信頼性バッジ + ユーザー情報 --- 216 -{{html clean="false"}} 217 217 <div class="seitokai-badge-container"> 218 218 ## 承認バッジ 219 219 #if($authorAccountType == 'admin') ... ... @@ -250,11 +250,16 @@ 250 250 <span class="badge badge-status-transferred"><svg class="ico" viewBox="0 0 24 24"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"/></svg> 転校済み</span> 251 251 #end 252 252 <span class="badge-info">最終編集: $!escapetool.xml($authorDisplayName) ($xwiki.formatDate($doc.date, "yyyy/MM/dd"))</span> 264 + ## 編集ボタン(権限があるユーザーのみ表示) 265 + #set($canEditSchool = false) 266 + #if(!$isGuest && ($isViewerAdmin || $viewerSchoolCode == $schoolCode)) 267 + #set($canEditSchool = true) 268 + #end 269 + #if($canEditSchool) 270 + <a href="$doc.getURL('view', 'sheet=SeitokaiCode.SchoolEditForm')" class="btn-school-edit"><svg class="ico" viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/></svg> 学校情報を編集</a> 271 + #end 253 253 </div> 254 -{{/html}} 255 255 256 -{{html clean="false"}} 257 - 258 258 ## --- ① 学校基本情報 + 連絡先(左右グリッド・折りたたみ対応) --- 259 259 <div class="school-info-grid"> 260 260 <div class="school-info-card mobile-collapse" id="card-basic-info"> ... ... @@ -267,7 +267,7 @@ 267 267 <tr><th>共学・別学</th><td>$!escapetool.xml($!coeducation)</td></tr> 268 268 <tr><th>設置者</th><td>$!escapetool.xml($!establishment)</td></tr> 269 269 <tr><th>学校種</th><td>$!escapetool.xml($!schoolLevel)</td></tr> 270 - <tr><th>課程</th><td>$!escapetool.xml($!schoolSystem)</td></tr> 286 + <tr><th>課程</th><td>#if($schoolSystem && $schoolSystem != '' && $schoolSystem != '[]')$!escapetool.xml($!schoolSystem)#end</td></tr> 271 271 <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> 272 272 </table> 273 273 #set($infoEditDate = $!doc.getValue('lastInfoEditedDate')) ... ... @@ -546,6 +546,12 @@ 546 546 <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> 547 547 <span class="author-legend-item text-hint">※一般アカウントは所属未確認のため非表示</span> 548 548 </div> 565 + <div class="author-legend"> 566 + <span class="author-legend-title">役割:</span> 567 + <span class="author-legend-item"><span class="badge badge-role-student badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10v6M2 10l10-5 10 5-10 5z"/><path d="M6 12v5c0 2 4 3 6 3s6-1 6-3v-5"/></svg> 生徒</span></span> 568 + <span class="author-legend-item"><span class="badge badge-role-officer badge-sm"><svg class="ico" viewBox="0 0 24 24"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg> 役員</span></span> 569 + <span class="author-legend-item"><span class="badge badge-role-teacher badge-sm"><svg class="ico" viewBox="0 0 24 24"><path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/></svg> 教員</span></span> 570 + </div> 549 549 </div> 550 550 </div> 551 551 ... ... @@ -625,6 +625,17 @@ 625 625 #set($threadPosts = []) 626 626 #set($discard = $threadPosts.addAll($pinnedPosts)) 627 627 #set($discard = $threadPosts.addAll($normalPosts)) 650 + ## report/comment カウント 651 + #set($reportCount = 0) 652 + #set($commentCount = 0) 653 + #foreach($tp in $threadPosts) 654 + #set($tpType = $!tp.getValue('postType')) 655 + #if($tpType == 'comment') 656 + #set($commentCount = $commentCount + 1) 657 + #else 658 + #set($reportCount = $reportCount + 1) 659 + #end 660 + #end 628 628 629 629 {{html clean="false"}} 630 630 <div class="activity-thread" data-fiscal-year="$!escapetool.xml($actFY)"> ... ... @@ -634,7 +634,7 @@ 634 634 <span class="activity-meta">$!escapetool.xml($!actCommittee) | $!escapetool.xml($!actPeriod) #if($actFY != 'unknown')| $!escapetool.xml($actFY)年度#end</span> 635 635 </div> 636 636 <div class="thread-meta-row"> 637 - <span class="thread-post-count">${ threadPosts.size()}件の投稿</span>670 + <span class="thread-post-count">${reportCount}件の報告 ・ ${commentCount}件のコメント</span> 638 638 #if($viewerAccountType == 'admin' || $viewerAccountType == 'verified' || $viewerAccountType == 'referred') 639 639 #if($actFeatured == '1') 640 640 <a href="$doc.getURL('view', "action=unfeature&actObj=${actIdx}&form_token=${services.csrf.getToken()}")" class="btn-featured-toggle btn-unfeature" title="特色ある活動の選定を解除"><svg class="ico ico-fixed-14" viewBox="0 0 24 24" fill="currentColor" stroke="none"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg> 特色解除</a> ... ... @@ -645,7 +645,10 @@ 645 645 </div> 646 646 </div> 647 647 681 + ## --- 活動報告セクション --- 648 648 #foreach($post in $threadPosts) 683 + #set($thisPostType = $!post.getValue('postType')) 684 + #if($thisPostType != 'comment') 649 649 #set($postContent = $post.getValue('content')) 650 650 #set($postAuthor = $post.getValue('author')) 651 651 #set($postAccountType = $!post.getValue('authorAccountType')) ... ... @@ -867,6 +867,44 @@ 867 867 #end## /canViewPost 868 868 #end## /postHidden 869 869 #end## /postDeleted 906 + #end## /postType != comment 907 + #end## /foreach reports 908 + 909 + ## --- コメントセクション(折りたたみ) --- 910 + #if($commentCount > 0) 911 + <details class="thread-comments-section"> 912 + <summary class="thread-comments-toggle"> 913 + <svg class="ico" viewBox="0 0 24 24"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/></svg> ${commentCount}件のコメント 914 + </summary> 915 + #foreach($post in $threadPosts) 916 + #set($thisPostType = $!post.getValue('postType')) 917 + #if($thisPostType == 'comment') 918 + #set($postContent = $post.getValue('content')) 919 + #set($postAuthor = $post.getValue('author')) 920 + #set($postAccountType = $!post.getValue('authorAccountType')) 921 + #set($postDate = $post.getValue('createdDate')) 922 + #set($postDeleted = $!post.getValue('deleted')) 923 + #if($postDeleted == 1 || $postDeleted == '1') 924 + <div class="thread-comment thread-comment-deleted"> 925 + <span class="thread-comment-meta">このコメントは削除されました</span> 926 + </div> 927 + #else 928 + #set($postHidden = $!post.getValue('hidden')) 929 + #if($postHidden == 1 || $postHidden == '1') 930 + <div class="thread-comment thread-comment-hidden"> 931 + <span class="thread-comment-meta">このコメントは非表示にされました</span> 932 + </div> 933 + #else 934 + <div class="thread-comment"> 935 + <span class="thread-comment-author">$!escapetool.xml($postAuthor)</span> 936 + <span class="thread-comment-date">$!postDate</span> 937 + <div class="thread-comment-body">$!escapetool.xml($postContent)</div> 938 + </div> 939 + #end 940 + #end 941 + #end 942 + #end 943 + </details> 870 870 #end 871 871 872 872 #if($xcontext.user != "XWiki.XWikiGuest") ... ... @@ -965,12 +965,10 @@ 965 965 btn.classList.add('active'); 966 966 // 活動スレッドの表示切り替え 967 967 document.querySelectorAll('.activity-thread[data-fiscal-year]').forEach(function(thread) { 968 - if (fy === 'all') { 969 - thread.style.display = ''; 970 - } else if (thread.getAttribute('data-fiscal-year') === fy) { 971 - thread.style.display = ''; 1042 + if (fy === 'all' || thread.getAttribute('data-fiscal-year') === fy) { 1043 + thread.classList.remove('fy-hidden'); 972 972 } else { 973 - thread. style.display ='none';1045 + thread.classList.add('fy-hidden'); 974 974 } 975 975 }); 976 976 }