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 @@
</head>
<body>
<h1>OfficeJS Chat</h1>
<p class="chat-error">
</p>
<form class="login-form">
<label>Name:</label>
......@@ -21,21 +23,8 @@
<label>Folder:</label>
<br />
<input type="text" name="folder" required="required" />
<br />
<label>Room:</label>
<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 />
<h3>Remote Storage</h3>
<input type="radio" name="remote" value="erp5" required="required" />
<label>ERP5</label>
<br />
......@@ -45,30 +34,51 @@
<input type="radio" name="remote" value="dropbox" required="required" />
<label>Dropbox</label>
<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>
<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/">
Log in to Dropbox first, if you wish to use Dropbox.
</a>
<h3>Storage Configuration</h3>
<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>
<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 />
<input type="text" name="erp5_url" value="https://softinst75770.host.vifib.net/erp5/web_site_module/" />
<br />
<label>Enter WebDAV parameters first, if you wish to use DAV.</label>
<label>WebDAV URL:</label>
<br />
<label>URL: </label>
<input type="text" name="dav_url" value="https://softinst75722.host.vifib.net/share" />
<br />
<label>Username: </label>
<label>WebDAV Username:</label>
<br />
<input type="text" name="dav_user" value="eyqs" />
<br />
<label>Password: </label>
<label>WebDAV Password:</label>
<br />
<input type="text" name="dav_pass" value="Aoeuidhtns" />
<br />
<input type="submit" value="Login!" />
</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>
</html>
\ No newline at end of file
......@@ -13,13 +13,7 @@
<script src="gadget_erp5_chat_panel.js"></script>
</head>
<body>
<div data-gadget-url="gadget_jio.html"
data-gadget-scope="storage_gadget"
data-gadget-sandbox="public"></div>
<h3>Chat List</h3>
<p class="error">
</p>
<div class="chat">
</div>
<form class="send-form">
......
......@@ -11,19 +11,19 @@
<script src="gadget_erp5_chat_webrtc.js"></script>
</head>
<body>
<h1>OfficeJS Chat</h1>
<p class="timeout-alert">
<p class="webrtc-error">
</p>
<form class="dropbox-form">
<label>Automatically connect via Dropbox</label>
<form class="auth-form">
<input type="radio" name="auth" value="erp5" required="required" />
<label>ERP5, URL:</label>
<br />
<input type="submit" value="Authenticate!" />
</form>
<form class="erp5-form">
<label>Automatically connect via ERP5</label>
<input type="text" name="erp5_url" value="https://softinst75770.host.vifib.net/erp5/webrtc_rooms_module/" />
<br />
<input type="radio" name="auth" value="dropbox" required="required" />
<label>Dropbox, Folder:</label>
<br />
<input type="text" name="dropbox_url" value="/Apps/OfficeJS Chat" />
<br />
<input type="submit" value="Authenticate!" />
</form>
......@@ -62,9 +62,5 @@
<br />
<input type="submit" value="Paste it!" />
</form>
<div data-gadget-url="gadget_erp5_chat_panel.html"
data-gadget-scope="chat_gadget"
data-gadget-sandbox="public" class="chat-panel"></div>
</body>
</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