Changes for page 学校ページ テンプレート
Last modified by Super Admin on 2026/04/05 18:59
From version
34.1
edited by Super Admin
on 2026/03/10 14:35
on 2026/03/10 14:35
Change comment:
There is no comment for this version
To version
43.1
edited by Super Admin
on 2026/03/12 17:54
on 2026/03/12 17:54
Change comment:
There is no comment for this version
Summary
Details
- Page properties
-
- Content
-
... ... @@ -19,10 +19,6 @@ 19 19 ## --- 学校基本情報フィールド --- 20 20 #set($schoolCode = $doc.getValue('schoolCode')) 21 21 #set($schoolName = $doc.getValue('schoolName')) 22 -## ページタイトルを学校名に設定(デフォルトでは学校コードが表示されるため) 23 -#if($schoolName && $schoolName != '') 24 -$!doc.setTitle($schoolName) 25 -#end 26 26 #set($prefecture = $doc.getValue('prefecture')) 27 27 #set($city = $doc.getValue('city')) 28 28 #set($classCount = $doc.getValue('classCount')) ... ... @@ -69,9 +69,7 @@ 69 69 #set($seitokaiYoutube = $doc.getValue('seitokaiYoutube')) 70 70 #set($seitokaiOtherSns = $doc.getValue('seitokaiOtherSns')) 71 71 72 -## --- 年度アーカイブ --- 73 -#set($pageFiscalYear = $!doc.getValue('fiscalYear')) 74 -## 現在の年度を計算(4月始まり) 68 +## --- 現在の年度を計算(4月始まり) --- 75 75 #set($nowFY = $datetool.date) 76 76 #set($currentFYMonth = $mathtool.toInteger($datetool.format('MM', $nowFY))) 77 77 #set($currentFYYear = $mathtool.toInteger($datetool.format('yyyy', $nowFY))) ... ... @@ -80,10 +80,6 @@ 80 80 #else 81 81 #set($currentFiscalYear = $mathtool.sub($currentFYYear, 1)) 82 82 #end 83 -## fiscalYear 未設定時はデフォルトとして現在の年度を使う 84 -#if(!$pageFiscalYear || $pageFiscalYear == '') 85 - #set($pageFiscalYear = $currentFiscalYear.toString()) 86 -#end 87 87 88 88 ## --- 公開範囲フィールド --- 89 89 #set($visibilityOrgChart = $!doc.getValue('visibilityOrgChart')) ... ... @@ -228,6 +228,12 @@ 228 228 #end 229 229 #end 230 230 221 +## --- 学校名見出し(XWikiデフォルトタイトルを非表示にし、学校名を表示) --- 222 +#if($schoolName && $schoolName != '') 223 +<style>.document-header { display: none !important; }</style> 224 +<h1 class="school-page-title">$!escapetool.xml($schoolName)</h1> 225 +#end 226 + 231 231 ## --- 編集ボタン(権限があるユーザーのみ表示) --- 232 232 #set($canEditSchool = false) 233 233 #if(!$isGuest && ($isViewerAdmin || $viewerSchoolCode == $schoolCode)) ... ... @@ -913,10 +913,10 @@ 913 913 914 914 #if($xcontext.user != "XWiki.XWikiGuest") 915 915 <div class="thread-add-post"> 916 - <a href="/bin/ view/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=report" class="btn-thread-add">912 + <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=report" class="btn-thread-add"> 917 917 + 活動報告を追加 918 918 </a> 919 - <a href="/bin/ view/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=comment" class="btn-thread-comment">915 + <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=comment" class="btn-thread-comment"> 920 920 <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> コメントを書く 921 921 </a> 922 922 </div> ... ... @@ -938,7 +938,7 @@ 938 938 #if($xcontext.user != "XWiki.XWikiGuest") 939 939 {{html clean="false"}} 940 940 <div class="activity-add-section"> 941 - <a href="/bin/ view/SeitokaiCode/ActivityForm?schoolPage=${doc.fullName}&schoolCode=$!escapetool.url($schoolCode)" class="btn btn-primary btn-add-activity">937 + <a href="/bin/SeitokaiCode/ActivityForm?schoolPage=${doc.fullName}&schoolCode=$!escapetool.url($schoolCode)" class="btn btn-primary btn-add-activity"> 942 942 <svg class="ico" viewBox="0 0 24 24" stroke-width="2.5"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> 活動を追加 943 943 </a> 944 944 </div> ... ... @@ -945,59 +945,6 @@ 945 945 {{/html}} 946 946 #end 947 947 948 -## --- 年度アーカイブ セクション --- 949 -{{html clean="false"}} 950 -<div class="school-section-card school-archive-card"> 951 - <h2 class="archive-section-title"> 952 - <svg class="ico ico-md" viewBox="0 0 24 24"><path d="M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg> 953 - 年度アーカイブ 954 - </h2> 955 - <div class="archive-meta"> 956 - 現在のページ: <strong>${pageFiscalYear}年度</strong> 957 - #set($lyud = $!doc.getValue('lastYearUpdateDate')) 958 - #if($lyud && $lyud != '') 959 - | 最終年度更新: $!escapetool.xml($lyud) ($!escapetool.xml($!doc.getValue('lastYearUpdateBy'))) 960 - #end 961 - </div> 962 - 963 - ## 過去アーカイブの検索 964 - #set($archiveQuery = $services.query.hql("where doc.fullName like :pattern and doc.fullName like '%Archive_%' order by doc.fullName desc").bindValue("pattern", "${doc.fullName}.Archive_%").setLimit(20)) 965 - #set($archivePages = $archiveQuery.execute()) 966 - 967 - #if($archivePages && $archivePages.size() > 0) 968 - <div class="archive-card-field-lg"> 969 - <div class="archive-list-label">過去の年度アーカイブ</div> 970 - <div class="archive-list"> 971 - #foreach($archPage in $archivePages) 972 - #set($archPageDoc = $xwiki.getDocument($archPage)) 973 - #set($archPageObj = $archPageDoc.getObject('SeitokaiCode.SchoolClass')) 974 - #if($archPageObj) 975 - #set($archPageFY = $!archPageObj.getValue('fiscalYear')) 976 - <a href="$archPageDoc.getURL('view')" class="archive-link"> 977 - <svg class="ico" viewBox="0 0 24 24"><path d="M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg> 978 - ${archPageFY}年度 979 - </a> 980 - #end 981 - #end 982 - </div> 983 - </div> 984 - #else 985 - <div class="archive-empty">過去のアーカイブはまだありません</div> 986 - #end 987 - 988 - ## 新年度に移行ボタン(承認済み・管理者のみ) 989 - #if($viewerAccountType == 'admin' || $viewerAccountType == 'verified') 990 - <div class="archive-action"> 991 - <a href="/bin/view/SeitokaiCode/YearArchiveAction?schoolPage=${doc.fullName}" class="btn-accent"> 992 - <svg class="ico" viewBox="0 0 24 24" stroke-width="2.5"><path d="M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg> 993 - ${pageFiscalYear}年度をアーカイブして新年度に移行 994 - </a> 995 - <div class="archive-action-hint">現在の学校情報を${pageFiscalYear}年度として保存し、新しい年度に移行します。</div> 996 - </div> 997 - #end 998 -</div> 999 -{{/html}} 1000 - 1001 1001 ## --- 年度タブ切り替え JavaScript --- 1002 1002 {{html clean="false"}} 1003 1003 <script> ... ... @@ -1014,14 +1014,12 @@ 1014 1014 } 1015 1015 }); 1016 1016 } 1017 -// ページ読み込み時 にデフォルトで現在の年度を表示960 +// ページ読み込み時の初期化 1018 1018 document.addEventListener('DOMContentLoaded', function() { 962 + // デフォルトで現在の年度を表示 1019 1019 var defaultTab = document.querySelector('.activity-fy-tab.active'); 1020 1020 if (defaultTab) { defaultTab.click(); } 1021 1021 // 保存成功時のトースト通知 1022 - if (window.location.search.indexOf('archived=1') !== -1) { 1023 - showToast('年度アーカイブを作成しました', 'success'); 1024 - } 1025 1025 if (window.location.search.indexOf('saved=1') !== -1) { 1026 1026 showToast('学校情報を保存しました', 'success'); 1027 1027 // URLパラメータをクリーンアップ(リロード時に再表示されないよう) ... ... @@ -1088,7 +1088,9 @@ 1088 1088 var csrfEl = document.querySelector('input[name="form_token"]'); 1089 1089 var csrfToken = csrfEl ? csrfEl.value : ''; 1090 1090 var xhr = new XMLHttpRequest(); 1091 - xhr.open('GET', '/bin/view/SeitokaiCode/EditPost?outputSyntax=plain&schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&newContent=' + encodeURIComponent(newContent) + '&form_token=' + encodeURIComponent(csrfToken), true); 1032 + xhr.open('POST', '/bin/SeitokaiCode/EditPost?outputSyntax=plain', true); 1033 + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 1034 + var editPostData = 'schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&newContent=' + encodeURIComponent(newContent) + '&form_token=' + encodeURIComponent(csrfToken); 1092 1092 xhr.onload = function() { 1093 1093 try { 1094 1094 var res = JSON.parse(xhr.responseText); ... ... @@ -1101,7 +1101,7 @@ 1101 1101 } catch(e) { alert('編集に失敗しました'); } 1102 1102 }; 1103 1103 xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1104 - xhr.send(); 1047 + xhr.send(editPostData); 1105 1105 } 1106 1106 1107 1107 // 投稿の削除(確認ダイアログ付き) ... ... @@ -1108,7 +1108,9 @@ 1108 1108 function confirmDeletePost(schoolPage, postObjNum, token) { 1109 1109 if (!confirm('この投稿を削除しますか?\\n削除後は「この投稿は削除されました」と表示されます。')) return; 1110 1110 var xhr = new XMLHttpRequest(); 1111 - xhr.open('GET', '/bin/view/SeitokaiCode/DeletePost?outputSyntax=plain&schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&form_token=' + encodeURIComponent(token), true); 1054 + xhr.open('POST', '/bin/SeitokaiCode/DeletePost?outputSyntax=plain', true); 1055 + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 1056 + var deletePostData = 'schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&form_token=' + encodeURIComponent(token); 1112 1112 xhr.onload = function() { 1113 1113 try { 1114 1114 var res = JSON.parse(xhr.responseText); ... ... @@ -1121,7 +1121,7 @@ 1121 1121 } catch(e) { alert('削除に失敗しました'); } 1122 1122 }; 1123 1123 xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1124 - xhr.send(); 1069 + xhr.send(deletePostData); 1125 1125 } 1126 1126 </script> 1127 1127 {{/html}}