Changes for page 学校ページ テンプレート
Last modified by Super Admin on 2026/04/05 18:59
From version
45.1
edited by Super Admin
on 2026/03/13 02:03
on 2026/03/13 02:03
Change comment:
There is no comment for this version
To version
38.1
edited by Super Admin
on 2026/03/10 14:46
on 2026/03/10 14:46
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')) ... ... @@ -102,12 +102,8 @@ 102 102 103 103 ## --- 投稿固定/解除処理 --- 104 104 #set($pinAction = $!request.action) 105 -#if(($pinAction == 'pin' || $pinAction == 'unpin') && ($viewerAccountType == 'admin' || ($viewerAccountType == 'verified' && $viewerSchoolCode == $schoolCode)) && $services.csrf.isTokenValid($request.form_token)) 106 - #set($pinPostObjStr = $!request.postObj) 107 - #if(!$pinPostObjStr.matches('^\d+$')) 108 - ## 不正な値 → 無視 109 - #else 110 - #set($postObjNum = $mathtool.toInteger($pinPostObjStr)) 111 +#if(($pinAction == 'pin' || $pinAction == 'unpin') && ($viewerAccountType == 'admin' || $viewerAccountType == 'verified') && $services.csrf.isTokenValid($request.form_token)) 112 + #set($postObjNum = $mathtool.toInteger($!request.postObj)) 111 111 #set($postObj = $doc.getObject('SeitokaiCode.ActivityPostClass', $postObjNum)) 112 112 #if($postObj) 113 113 #if($pinAction == 'pin') ... ... @@ -127,15 +127,12 @@ 127 127 $response.sendRedirect($doc.getURL('view')) 128 128 #stop 129 129 #end 130 - #end## /matches 131 131 #end 132 132 133 133 ## --- 特色ある活動 選定/解除処理 --- 134 134 #set($featAction = $!request.action) 135 -#if(($featAction == 'feature' || $featAction == 'unfeature') && ($viewerAccountType == 'admin' || (($viewerAccountType == 'verified' || $viewerAccountType == 'referred') && $viewerSchoolCode == $schoolCode)) && $services.csrf.isTokenValid($request.form_token)) 136 - #set($featActObjStr = $!request.actObj) 137 - #if($featActObjStr.matches('^\d+$')) 138 - #set($actObjNum = $mathtool.toInteger($featActObjStr)) 136 +#if(($featAction == 'feature' || $featAction == 'unfeature') && ($viewerAccountType == 'admin' || $viewerAccountType == 'verified' || $viewerAccountType == 'referred') && $services.csrf.isTokenValid($request.form_token)) 137 + #set($actObjNum = $mathtool.toInteger($!request.actObj)) 139 139 #set($actObj = $doc.getObject('SeitokaiCode.ActivityClass', $actObjNum)) 140 140 #if($actObj) 141 141 #if($featAction == 'feature') ... ... @@ -167,7 +167,6 @@ 167 167 $response.sendRedirect($doc.getURL('view')) 168 168 #stop 169 169 #end 170 - #end## /matches 171 171 #end 172 172 173 173 ## --- ユーザー情報取得 --- ... ... @@ -255,7 +255,7 @@ 255 255 <tr><th>共学・別学</th><td>$!escapetool.xml($!coeducation)</td></tr> 256 256 <tr><th>設置者</th><td>$!escapetool.xml($!establishment)</td></tr> 257 257 <tr><th>学校種</th><td>$!escapetool.xml($!schoolLevel)</td></tr> 258 - <tr><th>課程</th><td>#if($schoolSystem && !$schoolSystem.isEmpty())#foreach($ssin$schoolSystem)#if($foreach.count>1)/ #end$!escapetool.xml($ss)#end#end</td></tr>256 + <tr><th>課程</th><td>#if($schoolSystem && $schoolSystem != '' && $schoolSystem != '[]')$!escapetool.xml($!schoolSystem)#end</td></tr> 259 259 <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> 260 260 </table> 261 261 #set($infoEditDate = $!doc.getValue('lastInfoEditedDate')) ... ... @@ -313,7 +313,7 @@ 313 313 314 314 ## --- ③④⑤ 日常の活動・選挙・定例活動 --- 315 315 <div class="school-section-grid"> 316 - #if($dailyActivities && !$dailyActivities.isEmpty())314 + #if($dailyActivities && $dailyActivities != '') 317 317 <div class="school-section-card"> 318 318 <h3><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> 319 319 <div class="card-inner"> ... ... @@ -320,7 +320,7 @@ 320 320 <p class="activity-hint">活動時間の多い順に上位3つ</p> 321 321 <div class="tag-container"> 322 322 #set($daIdx = 1) 323 - #foreach($da in $dailyActivities) 321 + #foreach($da in $dailyActivities.split(",")) 324 324 <span class="tag tag-accent">${daIdx}. $!escapetool.xml($da.trim())</span> 325 325 #set($daIdx = $daIdx + 1) 326 326 #end ... ... @@ -371,7 +371,7 @@ 371 371 #end 372 372 373 373 ## --- ⑦ 予算 --- 374 - #set($hasBudget = ($budgetProcess && !$budgetProcess.isEmpty())|| ($studentFee && $studentFee != '') || ($budgetScale && $budgetScale != ''))372 + #set($hasBudget = ($budgetProcess && $budgetProcess != '') || ($studentFee && $studentFee != '') || ($budgetScale && $budgetScale != '')) 375 375 #if($hasBudget) 376 376 ## 公開範囲チェック 377 377 #set($canViewBudget = true) ... ... @@ -382,12 +382,12 @@ 382 382 <div class="school-section-card"> 383 383 <h3><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 == 'members')<svg class="ico" viewBox="0 0 24 24"><path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 00-3-3.87"/><path d="M16 3.13a4 4 0 010 7.75"/></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> 384 384 <div class="card-inner"> 385 - #if($budgetProcess && !$budgetProcess.isEmpty())383 + #if($budgetProcess && $budgetProcess != '') 386 386 <div class="info-row"> 387 387 <span class="info-label">作成過程の生徒関与</span> 388 388 <span class="info-value"> 389 389 <div class="selection-display"> 390 - #foreach($bp in $budgetProcess) 388 + #foreach($bp in $budgetProcess.split(",")) 391 391 <span class="selection-item">$!escapetool.xml($bp.trim())</span> 392 392 #end 393 393 </div> ... ... @@ -406,12 +406,12 @@ 406 406 <span class="info-value">$!escapetool.xml($!budgetScale)</span> 407 407 </div> 408 408 #end 409 - #if($budgetAllocation && !$budgetAllocation.isEmpty())407 + #if($budgetAllocation && $budgetAllocation != '') 410 410 <div class="info-row"> 411 411 <span class="info-label">主な予算配分</span> 412 412 <span class="info-value"> 413 413 <div class="selection-display"> 414 - #foreach($ba in $budgetAllocation) 412 + #foreach($ba in $budgetAllocation.split(",")) 415 415 <span class="selection-item">$!escapetool.xml($ba.trim())</span> 416 416 #end 417 417 </div> ... ... @@ -444,12 +444,12 @@ 444 444 <span class="info-label">見直しの有無(3年以内)</span> 445 445 <span class="info-value"><span class="tag tag-primary tag-sm">$!escapetool.xml($!ruleReviewStatus)</span></span> 446 446 </div> 447 - #if($ruleReviewContent && !$ruleReviewContent.isEmpty())445 + #if($ruleReviewContent && $ruleReviewContent != '') 448 448 <div class="info-row"> 449 449 <span class="info-label">見直しの内容</span> 450 450 <span class="info-value"> 451 451 <div class="selection-display"> 452 - #foreach($rc in $ruleReviewContent) 450 + #foreach($rc in $ruleReviewContent.split(",")) 453 453 <span class="selection-item">$!escapetool.xml($rc.trim())</span> 454 454 #end 455 455 </div> ... ... @@ -456,12 +456,12 @@ 456 456 </span> 457 457 </div> 458 458 #end 459 - #if($ruleReviewProposer && !$ruleReviewProposer.isEmpty())457 + #if($ruleReviewProposer && $ruleReviewProposer != '') 460 460 <div class="info-row"> 461 461 <span class="info-label">見直しの提案者</span> 462 462 <span class="info-value"> 463 463 <div class="selection-display"> 464 - #foreach($rp in $ruleReviewProposer) 462 + #foreach($rp in $ruleReviewProposer.split(",")) 465 465 <span class="selection-item">$!escapetool.xml($rp.trim())</span> 466 466 #end 467 467 </div> ... ... @@ -468,12 +468,12 @@ 468 468 </span> 469 469 </div> 470 470 #end 471 - #if($ruleReviewImplementer && !$ruleReviewImplementer.isEmpty())469 + #if($ruleReviewImplementer && $ruleReviewImplementer != '') 472 472 <div class="info-row"> 473 473 <span class="info-label">見直しの実施者</span> 474 474 <span class="info-value"> 475 475 <div class="selection-display"> 476 - #foreach($ri in $ruleReviewImplementer) 474 + #foreach($ri in $ruleReviewImplementer.split(",")) 477 477 <span class="selection-item">$!escapetool.xml($ri.trim())</span> 478 478 #end 479 479 </div> ... ... @@ -917,10 +917,10 @@ 917 917 918 918 #if($xcontext.user != "XWiki.XWikiGuest") 919 919 <div class="thread-add-post"> 920 - <a href="/bin/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=report" class="btn-thread-add"> 918 + <a href="/bin/view/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/SeitokaiCode/ActivityPostForm?schoolPage=${doc.fullName}&activityIndex=${actIdx}&schoolCode=$!escapetool.url($schoolCode)&postType=comment" class="btn-thread-comment"> 921 + <a href="/bin/view/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/SeitokaiCode/ActivityForm?schoolPage=${doc.fullName}&schoolCode=$!escapetool.url($schoolCode)" class="btn btn-primary btn-add-activity"> 943 + <a href="/bin/view/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,6 +949,59 @@ 949 949 {{/html}} 950 950 #end 951 951 950 +## --- 年度アーカイブ セクション --- 951 +{{html clean="false"}} 952 +<div class="school-section-card school-archive-card"> 953 + <h2 class="archive-section-title"> 954 + <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> 955 + 年度アーカイブ 956 + </h2> 957 + <div class="archive-meta"> 958 + 現在のページ: <strong>${pageFiscalYear}年度</strong> 959 + #set($lyud = $!doc.getValue('lastYearUpdateDate')) 960 + #if($lyud && $lyud != '') 961 + | 最終年度更新: $!escapetool.xml($lyud) ($!escapetool.xml($!doc.getValue('lastYearUpdateBy'))) 962 + #end 963 + </div> 964 + 965 + ## 過去アーカイブの検索 966 + #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)) 967 + #set($archivePages = $archiveQuery.execute()) 968 + 969 + #if($archivePages && $archivePages.size() > 0) 970 + <div class="archive-card-field-lg"> 971 + <div class="archive-list-label">過去の年度アーカイブ</div> 972 + <div class="archive-list"> 973 + #foreach($archPage in $archivePages) 974 + #set($archPageDoc = $xwiki.getDocument($archPage)) 975 + #set($archPageObj = $archPageDoc.getObject('SeitokaiCode.SchoolClass')) 976 + #if($archPageObj) 977 + #set($archPageFY = $!archPageObj.getValue('fiscalYear')) 978 + <a href="$archPageDoc.getURL('view')" class="archive-link"> 979 + <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> 980 + ${archPageFY}年度 981 + </a> 982 + #end 983 + #end 984 + </div> 985 + </div> 986 + #else 987 + <div class="archive-empty">過去のアーカイブはまだありません</div> 988 + #end 989 + 990 + ## 新年度に移行ボタン(承認済み・管理者のみ) 991 + #if($viewerAccountType == 'admin' || $viewerAccountType == 'verified') 992 + <div class="archive-action"> 993 + <a href="/bin/view/SeitokaiCode/YearArchiveAction?schoolPage=${doc.fullName}" class="btn-accent"> 994 + <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> 995 + ${pageFiscalYear}年度をアーカイブして新年度に移行 996 + </a> 997 + <div class="archive-action-hint">現在の学校情報を${pageFiscalYear}年度として保存し、新しい年度に移行します。</div> 998 + </div> 999 + #end 1000 +</div> 1001 +{{/html}} 1002 + 952 952 ## --- 年度タブ切り替え JavaScript --- 953 953 {{html clean="false"}} 954 954 <script> ... ... @@ -971,6 +971,9 @@ 971 971 var defaultTab = document.querySelector('.activity-fy-tab.active'); 972 972 if (defaultTab) { defaultTab.click(); } 973 973 // 保存成功時のトースト通知 1025 + if (window.location.search.indexOf('archived=1') !== -1) { 1026 + showToast('年度アーカイブを作成しました', 'success'); 1027 + } 974 974 if (window.location.search.indexOf('saved=1') !== -1) { 975 975 showToast('学校情報を保存しました', 'success'); 976 976 // URLパラメータをクリーンアップ(リロード時に再表示されないよう) ... ... @@ -1037,9 +1037,7 @@ 1037 1037 var csrfEl = document.querySelector('input[name="form_token"]'); 1038 1038 var csrfToken = csrfEl ? csrfEl.value : ''; 1039 1039 var xhr = new XMLHttpRequest(); 1040 - xhr.open('POST', '/bin/SeitokaiCode/EditPost?outputSyntax=plain', true); 1041 - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 1042 - var editPostData = 'schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&newContent=' + encodeURIComponent(newContent) + '&form_token=' + encodeURIComponent(csrfToken); 1094 + xhr.open('GET', '/bin/view/SeitokaiCode/EditPost?outputSyntax=plain&schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&newContent=' + encodeURIComponent(newContent) + '&form_token=' + encodeURIComponent(csrfToken), true); 1043 1043 xhr.onload = function() { 1044 1044 try { 1045 1045 var res = JSON.parse(xhr.responseText); ... ... @@ -1052,7 +1052,7 @@ 1052 1052 } catch(e) { alert('編集に失敗しました'); } 1053 1053 }; 1054 1054 xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1055 - xhr.send( editPostData);1107 + xhr.send(); 1056 1056 } 1057 1057 1058 1058 // 投稿の削除(確認ダイアログ付き) ... ... @@ -1059,9 +1059,7 @@ 1059 1059 function confirmDeletePost(schoolPage, postObjNum, token) { 1060 1060 if (!confirm('この投稿を削除しますか?\\n削除後は「この投稿は削除されました」と表示されます。')) return; 1061 1061 var xhr = new XMLHttpRequest(); 1062 - xhr.open('POST', '/bin/SeitokaiCode/DeletePost?outputSyntax=plain', true); 1063 - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 1064 - var deletePostData = 'schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&form_token=' + encodeURIComponent(token); 1114 + xhr.open('GET', '/bin/view/SeitokaiCode/DeletePost?outputSyntax=plain&schoolPage=' + encodeURIComponent(schoolPage) + '&postObj=' + postObjNum + '&form_token=' + encodeURIComponent(token), true); 1065 1065 xhr.onload = function() { 1066 1066 try { 1067 1067 var res = JSON.parse(xhr.responseText); ... ... @@ -1074,7 +1074,7 @@ 1074 1074 } catch(e) { alert('削除に失敗しました'); } 1075 1075 }; 1076 1076 xhr.onerror = function() { alert('通信エラーが発生しました'); }; 1077 - xhr.send( deletePostData);1127 + xhr.send(); 1078 1078 } 1079 1079 </script> 1080 1080 {{/html}}