Changes for page 学校ページ テンプレート
Last modified by Super Admin on 2026/04/05 18:59
From version
36.1
edited by Super Admin
on 2026/03/10 14:40
on 2026/03/10 14:40
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
-
... ... @@ -1,13 +1,5 @@ 1 1 {{velocity}} 2 2 ## ===== 学校ページ テンプレート ===== 3 -## ページタイトルを学校名に設定({{html}}ブロックの前で実行する必要あり) 4 -#set($__titleObj = $doc.getObject('SeitokaiCode.SchoolClass')) 5 -#if($__titleObj) 6 - #set($__titleName = $__titleObj.getValue('schoolName')) 7 - #if($__titleName && $__titleName != '') 8 - $doc.setTitle($__titleName) 9 - #end 10 -#end 11 11 {{html clean="false"}} 12 12 ## メンテナンスバナー({{include}}ではなくインラインで記述し、<p>タグ挿入を回避) 13 13 #set($bannerDoc = $xwiki.getDocument('SeitokaiAdmin.MaintenanceBanner')) ... ... @@ -73,9 +73,7 @@ 73 73 #set($seitokaiYoutube = $doc.getValue('seitokaiYoutube')) 74 74 #set($seitokaiOtherSns = $doc.getValue('seitokaiOtherSns')) 75 75 76 -## --- 年度アーカイブ --- 77 -#set($pageFiscalYear = $!doc.getValue('fiscalYear')) 78 -## 現在の年度を計算(4月始まり) 68 +## --- 現在の年度を計算(4月始まり) --- 79 79 #set($nowFY = $datetool.date) 80 80 #set($currentFYMonth = $mathtool.toInteger($datetool.format('MM', $nowFY))) 81 81 #set($currentFYYear = $mathtool.toInteger($datetool.format('yyyy', $nowFY))) ... ... @@ -84,10 +84,6 @@ 84 84 #else 85 85 #set($currentFiscalYear = $mathtool.sub($currentFYYear, 1)) 86 86 #end 87 -## fiscalYear 未設定時はデフォルトとして現在の年度を使う 88 -#if(!$pageFiscalYear || $pageFiscalYear == '') 89 - #set($pageFiscalYear = $currentFiscalYear.toString()) 90 -#end 91 91 92 92 ## --- 公開範囲フィールド --- 93 93 #set($visibilityOrgChart = $!doc.getValue('visibilityOrgChart')) ... ... @@ -232,6 +232,12 @@ 232 232 #end 233 233 #end 234 234 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 + 235 235 ## --- 編集ボタン(権限があるユーザーのみ表示) --- 236 236 #set($canEditSchool = false) 237 237 #if(!$isGuest && ($isViewerAdmin || $viewerSchoolCode == $schoolCode)) ... ... @@ -917,10 +917,10 @@ 917 917 918 918 #if($xcontext.user != "XWiki.XWikiGuest") 919 919 <div class="thread-add-post"> 920 - <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"> 921 921 + 活動報告を追加 922 922 </a> 923 - <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"> 924 924 <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> コメントを書く 925 925 </a> 926 926 </div> ... ... @@ -942,7 +942,7 @@ 942 942 #if($xcontext.user != "XWiki.XWikiGuest") 943 943 {{html clean="false"}} 944 944 <div class="activity-add-section"> 945 - <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"> 946 946 <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> 活動を追加 947 947 </a> 948 948 </div> ... ... @@ -949,59 +949,6 @@ 949 949 {{/html}} 950 950 #end 951 951 952 -## --- 年度アーカイブ セクション --- 953 -{{html clean="false"}} 954 -<div class="school-section-card school-archive-card"> 955 - <h2 class="archive-section-title"> 956 - <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> 957 - 年度アーカイブ 958 - </h2> 959 - <div class="archive-meta"> 960 - 現在のページ: <strong>${pageFiscalYear}年度</strong> 961 - #set($lyud = $!doc.getValue('lastYearUpdateDate')) 962 - #if($lyud && $lyud != '') 963 - | 最終年度更新: $!escapetool.xml($lyud) ($!escapetool.xml($!doc.getValue('lastYearUpdateBy'))) 964 - #end 965 - </div> 966 - 967 - ## 過去アーカイブの検索 968 - #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)) 969 - #set($archivePages = $archiveQuery.execute()) 970 - 971 - #if($archivePages && $archivePages.size() > 0) 972 - <div class="archive-card-field-lg"> 973 - <div class="archive-list-label">過去の年度アーカイブ</div> 974 - <div class="archive-list"> 975 - #foreach($archPage in $archivePages) 976 - #set($archPageDoc = $xwiki.getDocument($archPage)) 977 - #set($archPageObj = $archPageDoc.getObject('SeitokaiCode.SchoolClass')) 978 - #if($archPageObj) 979 - #set($archPageFY = $!archPageObj.getValue('fiscalYear')) 980 - <a href="$archPageDoc.getURL('view')" class="archive-link"> 981 - <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> 982 - ${archPageFY}年度 983 - </a> 984 - #end 985 - #end 986 - </div> 987 - </div> 988 - #else 989 - <div class="archive-empty">過去のアーカイブはまだありません</div> 990 - #end 991 - 992 - ## 新年度に移行ボタン(承認済み・管理者のみ) 993 - #if($viewerAccountType == 'admin' || $viewerAccountType == 'verified') 994 - <div class="archive-action"> 995 - <a href="/bin/view/SeitokaiCode/YearArchiveAction?schoolPage=${doc.fullName}" class="btn-accent"> 996 - <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> 997 - ${pageFiscalYear}年度をアーカイブして新年度に移行 998 - </a> 999 - <div class="archive-action-hint">現在の学校情報を${pageFiscalYear}年度として保存し、新しい年度に移行します。</div> 1000 - </div> 1001 - #end 1002 -</div> 1003 -{{/html}} 1004 - 1005 1005 ## --- 年度タブ切り替え JavaScript --- 1006 1006 {{html clean="false"}} 1007 1007 <script> ... ... @@ -1024,9 +1024,6 @@ 1024 1024 var defaultTab = document.querySelector('.activity-fy-tab.active'); 1025 1025 if (defaultTab) { defaultTab.click(); } 1026 1026 // 保存成功時のトースト通知 1027 - if (window.location.search.indexOf('archived=1') !== -1) { 1028 - showToast('年度アーカイブを作成しました', 'success'); 1029 - } 1030 1030 if (window.location.search.indexOf('saved=1') !== -1) { 1031 1031 showToast('学校情報を保存しました', 'success'); 1032 1032 // URLパラメータをクリーンアップ(リロード時に再表示されないよう) ... ... @@ -1093,7 +1093,9 @@ 1093 1093 var csrfEl = document.querySelector('input[name="form_token"]'); 1094 1094 var csrfToken = csrfEl ? csrfEl.value : ''; 1095 1095 var xhr = new XMLHttpRequest(); 1096 - 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); 1097 1097 xhr.onload = function() { 1098 1098 try { 1099 1099 var res = JSON.parse(xhr.responseText); ... ... @@ -1106,7 +1106,7 @@ 1106 1106 } catch(e) { alert('編集に失敗しました'); } 1107 1107 }; 1108 1108 xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1109 - xhr.send(); 1047 + xhr.send(editPostData); 1110 1110 } 1111 1111 1112 1112 // 投稿の削除(確認ダイアログ付き) ... ... @@ -1113,7 +1113,9 @@ 1113 1113 function confirmDeletePost(schoolPage, postObjNum, token) { 1114 1114 if (!confirm('この投稿を削除しますか?\\n削除後は「この投稿は削除されました」と表示されます。')) return; 1115 1115 var xhr = new XMLHttpRequest(); 1116 - 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); 1117 1117 xhr.onload = function() { 1118 1118 try { 1119 1119 var res = JSON.parse(xhr.responseText); ... ... @@ -1126,7 +1126,7 @@ 1126 1126 } catch(e) { alert('削除に失敗しました'); } 1127 1127 }; 1128 1128 xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1129 - xhr.send(); 1069 + xhr.send(deletePostData); 1130 1130 } 1131 1131 </script> 1132 1132 {{/html}}