Skip to content

Commit

Permalink
ZK-5596: Simplify the JavaScript url when enable embedded mode
Browse files Browse the repository at this point in the history
  • Loading branch information
JamsonChan authored and jumperchen committed Dec 19, 2023
1 parent e81b5b0 commit 9653c09
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 16 deletions.
3 changes: 3 additions & 0 deletions zkdoc/release-note
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ZK 10.0.0
ZK-5517: change the current year with a keyboard
ZK-5048: MVVM DebuggerFactory should log via SLF4J
ZK-5595: Upgrade Servlet version from 2.4 to 3.1 aligned with Java EE 7
ZK-5596: Simplify the JavaScript url when enable embedded mode

* Bugs
ZK-5393: Update ZK jars to jakarta-friendly uploads
Expand All @@ -26,6 +27,8 @@ ZK 10.0.0
+ ZK's corresponding features now require Java EE 7 API level, including:
Servlet 3.1, Bean Validation 1.1, EL 3.0, and JSP 2.3.
+ Remove all deprecated Java APIs and the legacy module "zkplus-legacy".
+ Use /zkEmbedded url (or specify yourself) to simply include embedded.js, instead of specify the real path to embedded.js,
simplifying the source to enable embedded mode.

--------
ZK 10.0.0-Beta
Expand Down
9 changes: 9 additions & 0 deletions zktest/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,13 @@ Copyright (C) 2004 Potix Corporation. All Rights Reserved.
<!-- <filter-name>embeddedCORSFilter</filter-name>-->
<!-- <url-pattern>/*</url-pattern>-->
<!-- </filter-mapping>-->

<servlet>
<servlet-name>zkEmbedded</servlet-name>
<servlet-class>org.zkoss.zkmax.ui.http.EmbeddedServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>zkEmbedded</servlet-name>
<url-pattern>/zkEmbedded</url-pattern>
</servlet-mapping>
</web-app>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B90-ZK-4495.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
Enabled Embedded ZK in zk.xml (ZK-4390)
</div>
<button id="btn" onClick="zEmbedded.load('aaa', '/zktest/test2/B90-ZK-4495-1.zul?p1=aaa');">Click it, and you should see "aaa"</button>
<script src="/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B90-ZK-4502.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!DOCTYPE html>
<html>
<head>
<script src="/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
</head>
<body>
<button id="trigger">load zk</button>
Expand Down
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B90-ZK-4507.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
Enabled Embedded ZK in zk.xml (ZK-4390)
</div>
<button id="btn" onClick="zEmbedded.load('aaa', '/zktest/test2/B90-ZK-4507-1.zul');">Click it</button>
<script src="/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B95-ZK-4581.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>
<button id="btn">Click it, see 'ZK is ready!'</button>
<button id="btn1">Click it, see error message 'ZK mounting error: Error: Unknown element #: bbb'</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
<script>
var btn = document.getElementById('btn');
btn.addEventListener('click', embedZK, false);
Expand Down
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B95-ZK-4715.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Embedded ZK Minimal</title>
<script id="embeddedScript"
src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
src="/zktest/zkEmbedded"></script>
</head>
<body>
<h1>Multiple-Embeds</h1>
Expand Down
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B96-ZK-4922test.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
Enabled Embedded ZK in zk.xml (ZK-4390)
</div>
<button id="btn" onClick="zEmbedded.load('aaa', 'http://localhost:8080/zktest/test2/B96-ZK-4922.zul');">Click it, then upload any image, it should work fine</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
</body>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B96-ZK-4923-1test.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
Enabled Embedded ZK in zk.xml (ZK-4390)
</div>
<button id="btn" onClick="zEmbedded.load('aaa', 'http://localhost:8080/zktest/test2/B96-ZK-4923.zul');">Click it, and see 5 images and 1 button with image (absolute url)</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
</body>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B96-ZK-4923test.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
Enabled Embedded ZK in zk.xml (ZK-4390)
</div>
<button id="btn" onClick="zEmbedded.load('aaa', 'http://localhost:8080/zktest/test2/B96-ZK-4923.zul');">Click it, then click button to download, it should work fine</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
</body>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B96-ZK-4944-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
Enabled Embedded ZK in zk.xml (ZK-4390)
</div>
<button id="btn" onClick="zEmbedded.load('aaa', 'http://localhost:8080/zktest/test2/B96-ZK-4944.zul');">Click it to embed ZK</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B96-ZK-4948-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Create server proxy to change the path '/4948-embedded/' to http://localhost:8080/zktest/...
</div>
<button id="loadBtn">Click it to load embedded ZK</button>
<script src="/4948-embedded/embedded.js"></script>
<script src="/4948-embedded/index.js"></script>
<script>
var loadBtn = document.getElementById('loadBtn');
loadBtn.addEventListener('click', embedZK, false);
Expand Down
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B96-ZK-4953-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
Enabled Embedded ZK in zk.xml (ZK-4390)
</div>
<button id="btn" onClick="zEmbedded.load('aaa', 'http://localhost:8080/zktest/test2/B96-ZK-4953.zul');">Click it to embed ZK</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/B96-ZK-5083-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<button id="loadBtn">Click it to load embedded ZK</button>
<button id="destroyBtn">Click it to destory, and see 'destroy!'</button>
<button id="seeDtCntBtn">Click it and see number 0 (desktop count) and undefined (in zk.Desktop.all)</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
<script>
var loadBtn = document.getElementById('loadBtn');
loadBtn.addEventListener('click', embedZK, false);
Expand Down
15 changes: 15 additions & 0 deletions zktest/src/main/webapp/test2/F100-ZK-5596.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<script src="/zktest/zkEmbedded"></script>
</head>
<body>
<button id="btn">load zk</button>
<div id="zkapp"/>
<script>
btn.addEventListener('click', () => {
zEmbedded.load('zkapp', '/zktest/test2/F100-ZK-5596.zul');
});
</script>
</body>
</html>
16 changes: 16 additions & 0 deletions zktest/src/main/webapp/test2/F100-ZK-5596.zul
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
F100-ZK-5596.zul
Purpose:
Description:
History:
Wed Dec 13 18:26:12 CST 2023, Created by jamson
Copyright (C) 2023 Potix Corporation. All Rights Reserved.
-->
<zk>
<ckeditor/>
</zk>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/F90-ZK-4499.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<button id="btn">Click it, see 'ZK is ready!'</button>
<button id="btn1">Click it, see error message</button>
<button id="btn2">Click it to destroy embedded ZK</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
<script>
var btn = document.getElementById('btn');
btn.addEventListener('click', embedZK, false);
Expand Down
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/F90-ZK-4500test.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
<script>
window.ZK4500 = true;
</script>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/F90-ZK-4529.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Enabled Embedded ZK in zk.xml (ZK-4390)
</div>
<button id="btn">Click it, see 'ZK is ready!' + uuid</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
<script>
var btn = document.getElementById('btn');
btn.addEventListener('click', embedZK, false);
Expand Down
2 changes: 1 addition & 1 deletion zktest/src/main/webapp/test2/F96-ZK-4943-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div id="status"></div>
<button id="loadBtn">Click it to load embedded ZK</button>
<button id="destroyBtn">Click it to destory, and see 'destroy!'</button>
<script src="http://localhost:8080/zktest/zkau/web/js/zkmax/embedded/embedded.js"></script>
<script src="/zktest/zkEmbedded"></script>
<script>
var loadBtn = document.getElementById('loadBtn');
loadBtn.addEventListener('click', embedZK, false);
Expand Down
1 change: 1 addition & 0 deletions zktest/src/main/webapp/test2/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3110,6 +3110,7 @@ B90-ZK-4431.zul=A,E,Multislider
##zats##B100-ZK-5569.zul=A,E,Radiogroup,onCheck
##zats##B100-ZK-5161.zul=A,E,XSS,Security,Page
##Manually##B100-ZK-5598.zul=A,E,CKEditor,Embedded,NPE
##manully##F100-ZK-5596.zul=A,E,Embedded,Url

##
# Features - 3.0.x version
Expand Down

0 comments on commit 9653c09

Please sign in to comment.