Changes for page 学校ページ テンプレート
Last modified by Super Admin on 2026/04/05 18:59
From 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
To version
35.1
edited by Super Admin
on 2026/03/10 14:36
on 2026/03/10 14:36
Change comment:
There is no comment for this version
Summary
Details
- Page properties
-
- Content
-
... ... @@ -65,7 +65,9 @@ 65 65 #set($seitokaiYoutube = $doc.getValue('seitokaiYoutube')) 66 66 #set($seitokaiOtherSns = $doc.getValue('seitokaiOtherSns')) 67 67 68 -## --- 現在の年度を計算(4月始まり) --- 68 +## --- 年度アーカイブ --- 69 +#set($pageFiscalYear = $!doc.getValue('fiscalYear')) 70 +## 現在の年度を計算(4月始まり) 69 69 #set($nowFY = $datetool.date) 70 70 #set($currentFYMonth = $mathtool.toInteger($datetool.format('MM', $nowFY))) 71 71 #set($currentFYYear = $mathtool.toInteger($datetool.format('yyyy', $nowFY))) ... ... @@ -74,6 +74,10 @@ 74 74 #else 75 75 #set($currentFiscalYear = $mathtool.sub($currentFYYear, 1)) 76 76 #end 79 +## fiscalYear 未設定時はデフォルトとして現在の年度を使う 80 +#if(!$pageFiscalYear || $pageFiscalYear == '') 81 + #set($pageFiscalYear = $currentFiscalYear.toString()) 82 +#end 77 77 78 78 ## --- 公開範囲フィールド --- 79 79 #set($visibilityOrgChart = $!doc.getValue('visibilityOrgChart')) ... ... @@ -218,12 +218,6 @@ 218 218 #end 219 219 #end 220 220 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 - 227 227 ## --- 編集ボタン(権限があるユーザーのみ表示) --- 228 228 #set($canEditSchool = false) 229 229 #if(!$isGuest && ($isViewerAdmin || $viewerSchoolCode == $schoolCode)) ... ... @@ -909,10 +909,10 @@ 909 909 910 910 #if($xcontext.user != "XWiki.XWikiGuest") 911 911 <div class="thread-add-post"> 912 - <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=report" class="btn-thread-add"> 912 + <a href="/bin/view/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=report" class="btn-thread-add"> 913 913 + 活動報告を追加 914 914 </a> 915 - <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=comment" class="btn-thread-comment"> 915 + <a href="/bin/view/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=comment" class="btn-thread-comment"> 916 916 <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> コメントを書く 917 917 </a> 918 918 </div> ... ... @@ -934,7 +934,7 @@ 934 934 #if($xcontext.user != "XWiki.XWikiGuest") 935 935 {{html clean="false"}} 936 936 <div class="activity-add-section"> 937 - <a href="/bin/SeitokaiCode/ActivityForm?schoolPage=${doc.fullName}&schoolCode=$!escapetool.url($schoolCode)" class="btn btn-primary btn-add-activity"> 937 + <a href="/bin/view/SeitokaiCode/ActivityForm?schoolPage=${doc.fullName}&schoolCode=$!escapetool.url($schoolCode)" class="btn btn-primary btn-add-activity"> 938 938 <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> 活動を追加 939 939 </a> 940 940 </div> ... ... @@ -941,6 +941,59 @@ 941 941 {{/html}} 942 942 #end 943 943 944 +## --- 年度アーカイブ セクション --- 945 +{{html clean="false"}} 946 +<div class="school-section-card school-archive-card"> 947 + <h2 class="archive-section-title"> 948 + <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> 949 + 年度アーカイブ 950 + </h2> 951 + <div class="archive-meta"> 952 + 現在のページ: <strong>${pageFiscalYear}年度</strong> 953 + #set($lyud = $!doc.getValue('lastYearUpdateDate')) 954 + #if($lyud && $lyud != '') 955 + | 最終年度更新: $!escapetool.xml($lyud) ($!escapetool.xml($!doc.getValue('lastYearUpdateBy'))) 956 + #end 957 + </div> 958 + 959 + ## 過去アーカイブの検索 960 + #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)) 961 + #set($archivePages = $archiveQuery.execute()) 962 + 963 + #if($archivePages && $archivePages.size() > 0) 964 + <div class="archive-card-field-lg"> 965 + <div class="archive-list-label">過去の年度アーカイブ</div> 966 + <div class="archive-list"> 967 + #foreach($archPage in $archivePages) 968 + #set($archPageDoc = $xwiki.getDocument($archPage)) 969 + #set($archPageObj = $archPageDoc.getObject('SeitokaiCode.SchoolClass')) 970 + #if($archPageObj) 971 + #set($archPageFY = $!archPageObj.getValue('fiscalYear')) 972 + <a href="$archPageDoc.getURL('view')" class="archive-link"> 973 + <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> 974 + ${archPageFY}年度 975 + </a> 976 + #end 977 + #end 978 + </div> 979 + </div> 980 + #else 981 + <div class="archive-empty">過去のアーカイブはまだありません</div> 982 + #end 983 + 984 + ## 新年度に移行ボタン(承認済み・管理者のみ) 985 + #if($viewerAccountType == 'admin' || $viewerAccountType == 'verified') 986 + <div class="archive-action"> 987 + <a href="/bin/view/SeitokaiCode/YearArchiveAction?schoolPage=${doc.fullName}" class="btn-accent"> 988 + <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> 989 + ${pageFiscalYear}年度をアーカイブして新年度に移行 990 + </a> 991 + <div class="archive-action-hint">現在の学校情報を${pageFiscalYear}年度として保存し、新しい年度に移行します。</div> 992 + </div> 993 + #end 994 +</div> 995 +{{/html}} 996 + 944 944 ## --- 年度タブ切り替え JavaScript --- 945 945 {{html clean="false"}} 946 946 <script> ... ... @@ -959,10 +959,17 @@ 959 959 } 960 960 // ページ読み込み時の初期化 961 961 document.addEventListener('DOMContentLoaded', function() { 1015 + // ページタイトルを学校名に置換(デフォルトでは学校コードが表示されるため) 1016 + var titleEl = document.querySelector('#document-title h1'); 1017 + var schoolNameVal = "$!escapetool.javascript($!schoolName)"; 1018 + if (titleEl && schoolNameVal) { titleEl.textContent = schoolNameVal; } 962 962 // デフォルトで現在の年度を表示 963 963 var defaultTab = document.querySelector('.activity-fy-tab.active'); 964 964 if (defaultTab) { defaultTab.click(); } 965 965 // 保存成功時のトースト通知 1023 + if (window.location.search.indexOf('archived=1') !== -1) { 1024 + showToast('年度アーカイブを作成しました', 'success'); 1025 + } 966 966 if (window.location.search.indexOf('saved=1') !== -1) { 967 967 showToast('学校情報を保存しました', 'success'); 968 968 // URLパラメータをクリーンアップ(リロード時に再表示されないよう) ... ... @@ -1029,9 +1029,7 @@ 1029 1029 var csrfEl = document.querySelector('input[name="form_token"]'); 1030 1030 var csrfToken = csrfEl ? csrfEl.value : ''; 1031 1031 var xhr = new XMLHttpRequest(); 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 + xhr.open('GET', '/bin/view/SeitokaiCode/EditPost?outputSyntax=plain&schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&newContent=' + encodeURIComponent(newContent) + '&form_token=' + encodeURIComponent(csrfToken), true); 1035 1035 xhr.onload = function() { 1036 1036 try { 1037 1037 var res = JSON.parse(xhr.responseText); ... ... @@ -1044,7 +1044,7 @@ 1044 1044 } catch(e) { alert('編集に失敗しました'); } 1045 1045 }; 1046 1046 xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1047 - xhr.send( editPostData);1105 + xhr.send(); 1048 1048 } 1049 1049 1050 1050 // 投稿の削除(確認ダイアログ付き) ... ... @@ -1051,9 +1051,7 @@ 1051 1051 function confirmDeletePost(schoolPage, postObjNum, token) { 1052 1052 if (!confirm('この投稿を削除しますか?\\n削除後は「この投稿は削除されました」と表示されます。')) return; 1053 1053 var xhr = new XMLHttpRequest(); 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 + xhr.open('GET', '/bin/view/SeitokaiCode/DeletePost?outputSyntax=plain&schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&form_token=' + encodeURIComponent(token), true); 1057 1057 xhr.onload = function() { 1058 1058 try { 1059 1059 var res = JSON.parse(xhr.responseText); ... ... @@ -1066,7 +1066,7 @@ 1066 1066 } catch(e) { alert('削除に失敗しました'); } 1067 1067 }; 1068 1068 xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1069 - xhr.send( deletePostData);1125 + xhr.send(); 1070 1070 } 1071 1071 </script> 1072 1072 {{/html}}