Changes for page 新しい学校ページを作成
Last modified by Super Admin on 2026/03/22 00:39
From version
36.1
edited by Super Admin
on 2026/03/18 20:41
on 2026/03/18 20:41
Change comment:
There is no comment for this version
To 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
Summary
Details
- Page properties
-
- Content
-
... ... @@ -222,13 +222,16 @@ 222 222 .catch(function() { return false; }); 223 223 224 224 // 関連校チェック(他校の関連校として登録されているか確認) 225 - var affiliatedCheck = fetch('$request.contextPath/bin/view/SeitokaiCode/CheckAffiliated?code=' + encodeURIComponent(school.code) + '&outputSyntax=plain') 226 - .then(function(r) { return r.ok ? r.json() : { found: false }; }) 227 - .catch(function() { return { found: false }; }); 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 []; }); 228 228 229 229 Promise.all([duplicateCheck, affiliatedCheck]).then(function(results) { 230 230 var isDuplicate = results[0]; 231 - var aff Data= results[1];234 + var affResults = results[1]; 232 232 var affNotice = document.getElementById('affiliatedNotice'); 233 233 234 234 if (isDuplicate) { ... ... @@ -242,10 +242,15 @@ 242 242 } 243 243 244 244 // 関連校として登録されている場合 245 - if (affData && affData.found) { 246 - var linkHref = '$request.contextPath/bin/Schools/' + affData.mainCode + '/'; 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 + '/') : '#'; 247 247 document.getElementById('affiliatedNoticeText').innerHTML = 248 - ' <a href="' + escapeHtml(linkHref) + '">' + escapeHtml(affData.mainName) + '</a>に中高一貫校の関連校として統合されています。' +256 + '別の学校ページに中高一貫校の関連校として統合されています。' + 249 249 '<a href="' + escapeHtml(linkHref) + '">統合先のページへ移動する →</a>'; 250 250 affNotice.style.display = 'flex'; 251 251 } else {