Wiki source code of 学校一覧

Version 5.1 by Super Admin on 2026/03/06 15:39

Show last authors
1 {{velocity}}
2 ## ===== 学校一覧ページ =====
3 ## ソート: 更新順(デフォルト)/ 都道府県順
4 ## カード形式で表示し、活動数・投稿数・最終更新日を表示
5
6 #set($sortParam = $!request.sort)
7 #if(!$sortParam || $sortParam == '')
8 #set($sortParam = 'updated')
9 #end
10
11 ## ソート順に応じたXWQLクエリ
12 #if($sortParam == 'pref')
13 #set($query = $services.query.xwql("from doc.object(SeitokaiCode.SchoolClass) as school order by school.prefecture, school.schoolName"))
14 #else
15 ## 更新順: ドキュメントの最終更新日でソート(降順)
16 #set($query = $services.query.xwql("from doc.object(SeitokaiCode.SchoolClass) as school order by doc.date desc"))
17 #end
18 #set($results = $query.execute())
19
20 {{html clean="false"}}
21 <h1 class="home-section-title" style="font-size:1.4em;margin-bottom:20px;">登録されている学校</h1>
22 <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;flex-wrap:wrap;gap:10px;">
23 <div style="font-size:0.9em;color:#64748b;">
24 $results.size() 校が登録されています
25 </div>
26 <div style="display:flex;gap:4px;background:#f1f5f9;border-radius:8px;padding:3px;">
27 <a href="$doc.getURL('view', 'sort=updated')"
28 style="padding:6px 14px;border-radius:6px;font-size:0.84em;font-weight:600;text-decoration:none;display:inline-flex;align-items:center;gap:4px;
29 #if($sortParam == 'updated')background:#fff;color:#1e293b;box-shadow:0 1px 3px rgba(0,0,0,0.1);#else color:#64748b;#end">
30 <svg style="width:14px;height:14px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg> 更新順
31 </a>
32 <a href="$doc.getURL('view', 'sort=pref')"
33 style="padding:6px 14px;border-radius:6px;font-size:0.84em;font-weight:600;text-decoration:none;display:inline-flex;align-items:center;gap:4px;
34 #if($sortParam == 'pref')background:#fff;color:#1e293b;box-shadow:0 1px 3px rgba(0,0,0,0.1);#else color:#64748b;#end">
35 <svg style="width:14px;height:14px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg> 都道府県順
36 </a>
37 </div>
38 </div>
39 {{/html}}
40
41 #if($results.size() > 0)
42
43 ## 都道府県順の場合、都道府県グループヘッダーを表示
44 #set($currentPref = '')
45
46 {{html clean="false"}}
47 <div style="display:grid;grid-template-columns:repeat(auto-fill, minmax(320px, 1fr));gap:16px;">
48 #foreach($docName in $results)
49 #set($schoolDoc = $xwiki.getDocument($docName))
50 #set($schoolObj = $schoolDoc.getObject('SeitokaiCode.SchoolClass'))
51 #if($schoolObj)
52 #set($sName = $!schoolObj.getValue('schoolName'))
53 #set($sPref = $!schoolObj.getValue('prefecture'))
54 #set($sCity = $!schoolObj.getValue('city'))
55 #set($sType = $!schoolObj.getValue('schoolType'))
56 #set($sEst = $!schoolObj.getValue('establishment'))
57 #set($sCoed = $!schoolObj.getValue('coeducation'))
58 #set($sSystem = $!schoolObj.getValue('schoolSystem'))
59 #set($lastUpdate = $datetool.format('yyyy/MM/dd', $schoolDoc.date))
60 ## 活動数をカウント
61 #set($actCount = $schoolDoc.getObjects('SeitokaiCode.ActivityClass').size())
62 ## 投稿数をカウント(全活動の投稿合計)
63 #set($postCount = $schoolDoc.getObjects('SeitokaiCode.ActivityPostClass').size())
64 ## 特色ある活動の数をカウント
65 #set($schoolActivities = $schoolDoc.getObjects('SeitokaiCode.ActivityClass'))
66 #set($featuredCount = 0)
67 #if($schoolActivities)
68 #foreach($sa in $schoolActivities)
69 #if($!sa.getValue('featured') == '1')
70 #set($featuredCount = $featuredCount + 1)
71 #end
72 #end
73 #end
74
75 ## 都道府県グループヘッダー(都道府県順の場合)
76 #if($sortParam == 'pref' && $sPref != $currentPref)
77 #set($currentPref = $sPref)
78 <div style="grid-column:1/-1;margin-top:12px;padding:8px 0;border-bottom:2px solid #e2e8f0;">
79 <span style="font-size:1.05em;font-weight:700;color:#1e293b;display:inline-flex;align-items:center;gap:4px;"><svg style="width:16px;height:16px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg> $!escapetool.xml($currentPref)</span>
80 </div>
81 #end
82
83 <a href="$schoolDoc.getURL('view')" style="text-decoration:none;color:inherit;display:block;background:#fff;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden;transition:box-shadow 0.2s,transform 0.1s;"
84 onmouseover="this.style.boxShadow='0 4px 12px rgba(0,0,0,0.08)';this.style.transform='translateY(-1px)'"
85 onmouseout="this.style.boxShadow='';this.style.transform=''">
86 <div style="padding:16px 20px;">
87 <div style="display:flex;align-items:center;gap:8px;margin-bottom:4px;flex-wrap:wrap;">
88 <div style="font-weight:700;font-size:0.95em;color:#1e293b;">$!escapetool.xml($sName)</div>
89 #if($sEst)
90 <span style="font-size:0.72em;padding:2px 8px;border-radius:4px;font-weight:600;
91 #if($sEst == '公立')background:#dbeafe;color:#1d4ed8;
92 #elseif($sEst == '私立')background:#fce7f3;color:#be185d;
93 #else background:#f3e8ff;color:#7c3aed;#end">$!escapetool.xml($sEst)</span>
94 #end
95 </div>
96 <div style="font-size:0.82em;color:#94a3b8;margin-bottom:8px;">
97 $!escapetool.xml($sPref) $!escapetool.xml($sCity)
98 #if($sCoed) ・ $!escapetool.xml($sCoed)#end
99 #if($sSystem) ・ $!escapetool.xml($sSystem)#end
100 </div>
101 ## 特色ある活動バッジ
102 #if($featuredCount > 0)
103 <div style="display:flex;gap:4px;flex-wrap:wrap;margin-bottom:8px;">
104 <span style="font-size:0.72em;padding:2px 8px;background:#fef3c7;color:#92400e;border-radius:4px;font-weight:600;display:inline-flex;align-items:center;gap:3px;"><svg style="width:11px;height:11px;" 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> 特色ある活動 ${featuredCount}件</span>
105 </div>
106 #end
107 <div style="display:flex;gap:14px;font-size:0.8em;color:#94a3b8;">
108 <span style="display:inline-flex;align-items:center;gap:3px;"><svg style="width:13px;height:13px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><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> 活動 <strong style="color:#334155;">$actCount</strong>件</span>
109 <span style="display:inline-flex;align-items:center;gap:3px;"><svg style="width:13px;height:13px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/></svg> 投稿 <strong style="color:#334155;">$postCount</strong>件</span>
110 <span style="display:inline-flex;align-items:center;gap:3px;"><svg style="width:13px;height:13px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg> 更新 $lastUpdate</span>
111 </div>
112 </div>
113 </a>
114 #end
115 #end
116 </div>
117 {{/html}}
118
119 #else
120 //まだ学校ページが登録されていません。//
121
122 [[学校ページを作成する>>SeitokaiCode.CreateSchool]]
123 #end
124 {{/velocity}}