Commit 01b24062 authored by Eugene Shen's avatar Eugene Shen

Flatten gadget hierarchy and purify WebRTC gadget

Instead of having chat_panel as a subgadget of chat_webrtc,
both chat_panel and chat_webrtc are direct subgadgets of chat.
Strip out all chat-related functions and variables from chat_webrtc,
so that it can be used for non-chat-related purposes in the future.
Bundle state variables into dictionaries for cross-gadget passing.
Completely rewrite HTML structure to reflect a linear hierarchy.
Fully document and augment existing URL query parameters.
Replace all var declarations with let or const from ES6.
Modify chat panel message_list and last_message_dict
to prepare for multi-room messaging, coming soon.
parent 6ee093ae
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
</head> </head>
<body> <body>
<h1>OfficeJS Chat</h1> <h1>OfficeJS Chat</h1>
<p class="chat-error">
</p>
<form class="login-form"> <form class="login-form">
<label>Name:</label> <label>Name:</label>
...@@ -21,21 +23,8 @@ ...@@ -21,21 +23,8 @@
<label>Folder:</label> <label>Folder:</label>
<br /> <br />
<input type="text" name="folder" required="required" /> <input type="text" name="folder" required="required" />
<br />
<label>Room:</label> <h3>Remote Storage</h3>
<br />
<input type="text" name="room" required="required" />
<br />
<label>Role:</label>
<br />
<input type="radio" name="role" value="host" required="required" />
<label>Host</label>
<br />
<input type="radio" name="role" value="guest" checked="checked" />
<label>Guest</label>
<br />
<label>Remote Storage:</label>
<br />
<input type="radio" name="remote" value="erp5" required="required" /> <input type="radio" name="remote" value="erp5" required="required" />
<label>ERP5</label> <label>ERP5</label>
<br /> <br />
...@@ -45,30 +34,51 @@ ...@@ -45,30 +34,51 @@
<input type="radio" name="remote" value="dropbox" required="required" /> <input type="radio" name="remote" value="dropbox" required="required" />
<label>Dropbox</label> <label>Dropbox</label>
<br /> <br />
<input type="radio" name="remote" value="local" checked="checked" /> <input type="radio" name="remote" value="local" required="required" checked="checked" />
<label>Local is Enough</label> <label>Local is Enough</label>
<br /> <br />
<a href="https://www.dropbox.com/1/oauth2/authorize?client_id=igeiyv4pkt0y0mm&response_type=token&redirect_uri=https://softinst75770.host.vifib.net/erp5/web_site_module/web_chat/"> <h3>Storage Configuration</h3>
Log in to Dropbox first, if you wish to use Dropbox. <a href="https://www.dropbox.com/1/oauth2/authorize?client_id=igeiyv4pkt0y0mm&response_type=token&redirect_uri=https://softinst75770.host.vifib.net/erp5/web_site_module/web_chat/">Dropbox OAuth Link</a>
</a>
<br /> <br />
<label>Fill out ERP5 URL first, if you wish to use ERP5.</label> <label>Dropbox folder:</label>
<br />
<input type="text" name="dropbox_url" value="/Apps/OfficeJS Chat/.jio_documents" />
<br />
<label>ERP5 URL:</label>
<br /> <br />
<input type="text" name="erp5_url" value="https://softinst75770.host.vifib.net/erp5/web_site_module/" /> <input type="text" name="erp5_url" value="https://softinst75770.host.vifib.net/erp5/web_site_module/" />
<br /> <br />
<label>Enter WebDAV parameters first, if you wish to use DAV.</label> <label>WebDAV URL:</label>
<br /> <br />
<label>URL: </label>
<input type="text" name="dav_url" value="https://softinst75722.host.vifib.net/share" /> <input type="text" name="dav_url" value="https://softinst75722.host.vifib.net/share" />
<br /> <br />
<label>Username: </label> <label>WebDAV Username:</label>
<br />
<input type="text" name="dav_user" value="eyqs" /> <input type="text" name="dav_user" value="eyqs" />
<br /> <br />
<label>Password: </label> <label>WebDAV Password:</label>
<br />
<input type="text" name="dav_pass" value="Aoeuidhtns" /> <input type="text" name="dav_pass" value="Aoeuidhtns" />
<br /> <br />
<input type="submit" value="Login!" /> <input type="submit" value="Login!" />
</form> </form>
<form class="room-form">
<input type="text" name="room" required="required" />
<br />
<input type="submit" name="host" value="Create a new room!" />
<input type="submit" name="guest" value="Join an existing room!" />
</form>
<div data-gadget-url="gadget_jio.html"
data-gadget-scope="storage_gadget"
data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_erp5_chat_webrtc.html"
data-gadget-scope="webrtc_gadget"
data-gadget-sandbox="public" class="webrtc-panel"></div>
<div data-gadget-url="gadget_erp5_chat_panel.html"
data-gadget-scope="chat_gadget"
data-gadget-sandbox="public" class="chat-panel"></div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -13,13 +13,7 @@ ...@@ -13,13 +13,7 @@
<script src="gadget_erp5_chat_panel.js"></script> <script src="gadget_erp5_chat_panel.js"></script>
</head> </head>
<body> <body>
<div data-gadget-url="gadget_jio.html"
data-gadget-scope="storage_gadget"
data-gadget-sandbox="public"></div>
<h3>Chat List</h3> <h3>Chat List</h3>
<p class="error">
</p>
<div class="chat"> <div class="chat">
</div> </div>
<form class="send-form"> <form class="send-form">
......
...@@ -11,19 +11,19 @@ ...@@ -11,19 +11,19 @@
<script src="gadget_erp5_chat_webrtc.js"></script> <script src="gadget_erp5_chat_webrtc.js"></script>
</head> </head>
<body> <body>
<h1>OfficeJS Chat</h1> <p class="webrtc-error">
<p class="timeout-alert">
</p> </p>
<form class="dropbox-form"> <form class="auth-form">
<label>Automatically connect via Dropbox</label> <input type="radio" name="auth" value="erp5" required="required" />
<label>ERP5, URL:</label>
<br /> <br />
<input type="submit" value="Authenticate!" /> <input type="text" name="erp5_url" value="https://softinst75770.host.vifib.net/erp5/webrtc_rooms_module/" />
</form> <br />
<input type="radio" name="auth" value="dropbox" required="required" />
<form class="erp5-form"> <label>Dropbox, Folder:</label>
<label>Automatically connect via ERP5</label> <br />
<input type="text" name="dropbox_url" value="/Apps/OfficeJS Chat" />
<br /> <br />
<input type="submit" value="Authenticate!" /> <input type="submit" value="Authenticate!" />
</form> </form>
...@@ -62,9 +62,5 @@ ...@@ -62,9 +62,5 @@
<br /> <br />
<input type="submit" value="Paste it!" /> <input type="submit" value="Paste it!" />
</form> </form>
<div data-gadget-url="gadget_erp5_chat_panel.html"
data-gadget-scope="chat_gadget"
data-gadget-sandbox="public" class="chat-panel"></div>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment