Repository: incubator-wave Updated Branches: refs/heads/dev [created] 49f9a125e
Implements WAVE-420 - Makes login page customizable by moving welcome text from GXP template into HTML fragment. Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/775a88f3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/775a88f3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/775a88f3 Branch: refs/heads/dev Commit: 775a88f305f1e7dbb586778a246c8de878804ab3 Parents: 4f986cd Author: Yuri Zelikov <[email protected]> Authored: Sat Aug 30 02:35:50 2014 +0300 Committer: Yuri Zelikov <[email protected]> Committed: Sat Aug 30 02:51:32 2014 +0300 ---------------------------------------------------------------------- .../box/server/gxp/AuthenticationPage.gxp | 55 +++------------- .../box/server/rpc/AuthenticationServlet.java | 3 - war/static/loadHtmlFragment.js | 41 ++++++++++++ war/static/welcome-fragment.html | 66 ++++++++++++++++++++ 4 files changed, 117 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/775a88f3/src/org/waveprotocol/box/server/gxp/AuthenticationPage.gxp ---------------------------------------------------------------------- diff --git a/src/org/waveprotocol/box/server/gxp/AuthenticationPage.gxp b/src/org/waveprotocol/box/server/gxp/AuthenticationPage.gxp index d8791d4..e8a13b5 100644 --- a/src/org/waveprotocol/box/server/gxp/AuthenticationPage.gxp +++ b/src/org/waveprotocol/box/server/gxp/AuthenticationPage.gxp @@ -40,6 +40,7 @@ <link rel="shortcut icon" href="/static/favicon.ico" /> <title>Wave in a Box login</title> <call:AnalyticsFragment expr:account='analyticsAccount'/> + <script type="text/javascript" src="/static/loadHtmlFragment.js"></script> </head> <body onload="init()"> <table width="100%" border="0" align="center" cellpadding="0" @@ -66,51 +67,8 @@ <td valign="top"> <table> <td> - <div style="margin: 0 75px 0 25px;"> - <span style="font-weight: bold; font-size: larger"> - Apache Wave lets you communicate and collaborate in real time - </span> - <p> - <b>Wave is equal parts conversation and document.</b> - People can communicate and work together with richly formatted text, - gadgets, robots and more. - </p> - <p> - <b>Wave is shared.</b> Any participant can reply anywhere in the message, - edit the content and add participants at any point in the process. - </p> - <p> - <b>Wave is live.</b> - With live transmission as you type, participants on a wave can have faster - conversations, see edits and interact with extensions in real-time. - </p> - <div> - <br /> - <a href="/static/wiab_screenshot.jpg" target="_blank" title="Click to enlarge"> - <img src="/static/wiab_screenshot_small.jpg" - style="float: right; align: right; margin: 0 25px 0 35px;" alt="WIAB client."/> - </a> - <p style="width: 60%;"> - <ul> - <li> - Apache Wave is a rich, distributed, real-time collaboration platform, - which allows users to work together in new and exciting ways. - </li> - <li> - <a href="http://incubator.apache.org/wave/" target="_blank"> - "Wave in a Box" (WIAB) - </a> - project is a stand alone wave server and rich web client that can - serve as an Apache Wave reference implementation. - </li> - <li> - This project lets developers and - enterprise users run wave servers and host waves on their own hardware. - And then share those waves with other wave servers. - </li> - </ul> - </p> - </div> + <div style="margin: 0 75px 0 25px;" id="welcome-data-include"> + /static/welcome-fragment.html </div> </td> </table> @@ -240,6 +198,13 @@ messageLbl.innerHTML = message; } } + + window.onload = function() { + var element = document.getElementById('welcome-data-include'); + var url = element.textContent; + element.innerHTML=""; + fragment(element, url); + } </script> </body> </html> http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/775a88f3/src/org/waveprotocol/box/server/rpc/AuthenticationServlet.java ---------------------------------------------------------------------- diff --git a/src/org/waveprotocol/box/server/rpc/AuthenticationServlet.java b/src/org/waveprotocol/box/server/rpc/AuthenticationServlet.java index 49d5964..0358b14 100644 --- a/src/org/waveprotocol/box/server/rpc/AuthenticationServlet.java +++ b/src/org/waveprotocol/box/server/rpc/AuthenticationServlet.java @@ -28,12 +28,10 @@ import com.google.inject.name.Named; import org.eclipse.jetty.util.MultiMap; import org.eclipse.jetty.util.UrlEncoded; import org.waveprotocol.box.server.CoreSettings; -import org.waveprotocol.box.server.account.HumanAccountDataImpl; import org.waveprotocol.box.server.authentication.HttpRequestBasedCallbackHandler; import org.waveprotocol.box.server.authentication.ParticipantPrincipal; import org.waveprotocol.box.server.authentication.SessionManager; import org.waveprotocol.box.server.persistence.AccountStore; -import org.waveprotocol.box.server.persistence.PersistenceException; import org.waveprotocol.box.server.gxp.AuthenticationPage; import org.waveprotocol.box.server.robots.agent.welcome.WelcomeRobot; import org.waveprotocol.box.server.util.RegistrationUtil; @@ -128,7 +126,6 @@ private final WelcomeRobot welcomeBot; this.analyticsAccount = analyticsAccount; } - @SuppressWarnings("unchecked") private LoginContext login(BufferedReader body) throws IOException, LoginException { try { Subject subject = new Subject(); http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/775a88f3/war/static/loadHtmlFragment.js ---------------------------------------------------------------------- diff --git a/war/static/loadHtmlFragment.js b/war/static/loadHtmlFragment.js new file mode 100644 index 0000000..794a583 --- /dev/null +++ b/war/static/loadHtmlFragment.js @@ -0,0 +1,41 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Java script function that injects HTML fragment into element. + * + * Author: [email protected] (Yuri Zelikov) + */ +function fragment(el, url) { + xmlhttp = new XMLHttpRequest(); + status = 0; + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4) { + status = xmlhttp.status; + } + if (xmlhttp.readyState == 4 && status == 200) { + el.outerHTML = xmlhttp.responseText; + } + } + + try { + xmlhttp.open("GET", url, true); + xmlhttp.send(); + } catch(err) {} +} http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/775a88f3/war/static/welcome-fragment.html ---------------------------------------------------------------------- diff --git a/war/static/welcome-fragment.html b/war/static/welcome-fragment.html new file mode 100644 index 0000000..137dd73 --- /dev/null +++ b/war/static/welcome-fragment.html @@ -0,0 +1,66 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + + HTML fragment for the welcome message on the user authentication (login) page. + Author: [email protected] (Yuri Zelikov) +--> + +<span style="font-weight: bold; font-size: larger"> + Apache Wave lets you communicate and collaborate in real time +</span> +<p> + <b>Wave is equal parts conversation and document.</b> + People can communicate and work together with richly formatted text, + gadgets, robots and more. +</p> +<p> + <b>Wave is shared.</b> Any participant can reply anywhere in the message, + edit the content and add participants at any point in the process. +</p> +<p> + <b>Wave is live.</b> + With live transmission as you type, participants on a wave can have faster + conversations, see edits and interact with extensions in real-time. +</p> + <div> + <br /> + <a href="/static/wiab_screenshot.jpg" target="_blank" title="Click to enlarge"> + <img src="/static/wiab_screenshot_small.jpg" + style="float: right; align: right; margin: 0 25px 0 35px;" alt="WIAB client."/> + </a> + <p style="width: 60%;"> + <ul> + <li> + Apache Wave is a rich, distributed, real-time collaboration platform, + which allows users to work together in new and exciting ways. + </li> + <li> + <a href="http://incubator.apache.org/wave/" target="_blank"> + "Wave in a Box" (WIAB) + </a> + project is a stand alone wave server and rich web client that can + serve as an Apache Wave reference implementation. + </li> + <li> + This project lets developers and + enterprise users run wave servers and host waves on their own hardware. + And then share those waves with other wave servers. + </li> + </ul> + </p> + </div> \ No newline at end of file
