Changes for page 新しい学校ページを作成
Last modified by Super Admin on 2026/03/22 00:39
From version
35.1
edited by Super Admin
on 2026/03/18 20:38
on 2026/03/18 20:38
Change comment:
There is no comment for this version
To version
37.1
edited by Super Admin
on 2026/03/18 20:43
on 2026/03/18 20:43
Change comment:
There is no comment for this version
Summary
Details
- Page properties
-
- Content
-
... ... @@ -222,16 +222,20 @@ 222 222 .catch(function() { return false; }); 223 223 224 224 // 関連校チェック(他校の関連校として登録されているか確認) 225 - var affCheckUrl = restBase + '/query?q=' + 226 - encodeURIComponent("select doc.fullName, school.affiliatedSchoolName from Document doc, doc.object(SeitokaiCode.SchoolClass) school where school.affiliatedSchoolCode = :code") + 227 - '&type=hql&queryFilters=unique¶meters=code:' + encodeURIComponent(school.code); 228 - var affiliatedCheck = fetch(affCheckUrl, { headers: { 'Accept': 'application/json' } }) 229 - .then(function(r) { return r.ok ? r.json() : []; }) 230 - .catch(function() { return []; }); 225 + var affiliatedCheck = fetch('$request.contextPath/bin/view/SeitokaiCode/CheckAffiliated?code=' + encodeURIComponent(school.code) + '&outputSyntax=plain') 226 + .then(function(r) { return r.ok ? r.text() : ''; }) 227 + .then(function(t) { 228 + try { 229 + var jsonEnd = t.indexOf('}'); 230 + if (jsonEnd >= 0) return JSON.parse(t.substring(0, jsonEnd + 1)); 231 + } catch(e) {} 232 + return { found: false }; 233 + }) 234 + .catch(function() { return { found: false }; }); 231 231 232 232 Promise.all([duplicateCheck, affiliatedCheck]).then(function(results) { 233 233 var isDuplicate = results[0]; 234 - var aff Results= results[1];238 + var affData = results[1]; 235 235 var affNotice = document.getElementById('affiliatedNotice'); 236 236 237 237 if (isDuplicate) { ... ... @@ -245,15 +245,10 @@ 245 245 } 246 246 247 247 // 関連校として登録されている場合 248 - if (affResults && affResults.length > 0) { 249 - var mainPageRef = affResults[0]; 250 - var mainCode = ''; 251 - if (typeof mainPageRef === 'string' && mainPageRef.indexOf('Schools.') === 0) { 252 - mainCode = mainPageRef.split('.')[1]; 253 - } 254 - var linkHref = mainCode ? ('$request.contextPath/bin/Schools/' + mainCode + '/') : '#'; 252 + if (affData && affData.found) { 253 + var linkHref = '$request.contextPath/bin/Schools/' + affData.mainCode + '/'; 255 255 document.getElementById('affiliatedNoticeText').innerHTML = 256 - ' 別の学校ページに中高一貫校の関連校として統合されています。' +255 + '<a href="' + escapeHtml(linkHref) + '">' + escapeHtml(affData.mainName) + '</a> に中高一貫校の関連校として統合されています。' + 257 257 '<a href="' + escapeHtml(linkHref) + '">統合先のページへ移動する →</a>'; 258 258 affNotice.style.display = 'flex'; 259 259 } else {