Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
8ef46249
Commit
8ef46249
authored
Aug 04, 2015
by
Vivek
Committed by
Kazuhiko Shiozaki
Aug 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jabberclient: added auto-reconnect after disconnection, updated error handling.
parent
0363c0e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
54 deletions
+54
-54
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberclient_html.xml
...eItem/web_page_module/jabber_gadget_jabberclient_html.xml
+4
-4
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberclient_js.xml
...ateItem/web_page_module/jabber_gadget_jabberclient_js.xml
+48
-48
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberconnection_js.xml
...tem/web_page_module/jabber_gadget_jabberconnection_js.xml
+2
-2
No files found.
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberclient_html.xml
View file @
8ef46249
...
@@ -200,6 +200,7 @@
...
@@ -200,6 +200,7 @@
</div>
\n
</div>
\n
<input
data-inline=
"true"
type=
"submit"
value=
"Log In"
data-theme=
"b"
>
\n
<input
data-inline=
"true"
type=
"submit"
value=
"Log In"
data-theme=
"b"
>
\n
</form>
\n
</form>
\n
<pre
style=
"white-space: pre-wrap;"
>
{{message}}
</pre>
\n
</div>
\n
</div>
\n
<div
class=
"ui-block-c"
></div>
\n
<div
class=
"ui-block-c"
></div>
\n
</div>
\n
</div>
\n
...
@@ -249,7 +250,6 @@
...
@@ -249,7 +250,6 @@
\n
\n
<script
class=
"history-template"
type=
"text/x-handlebars-template"
><pre
style=
"white-space: pre-wrap;"
>
{{text}}
</pre></script>
\n
<script
class=
"history-template"
type=
"text/x-handlebars-template"
><pre
style=
"white-space: pre-wrap;"
>
{{text}}
</pre></script>
\n
\n
\n
<script
class=
"error-template"
type=
"text/x-handlebars-template"
><pre
style=
"white-space: pre-wrap;"
>
{{error_message}}
</pre></script>
\n
<script
class=
"header-template"
type=
"text/x-handlebars-template"
>
\n
<script
class=
"header-template"
type=
"text/x-handlebars-template"
>
\n
{{#if left_url}}\n
{{#if left_url}}\n
<a
href=
"{{left_url}}"
class=
"ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all"
>
{{left_title}}
</a>
\n
<a
href=
"{{left_url}}"
class=
"ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all"
>
{{left_title}}
</a>
\n
...
@@ -407,7 +407,7 @@
...
@@ -407,7 +407,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
zope
</string>
</value>
<value>
<string>
zope
1
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -421,7 +421,7 @@
...
@@ -421,7 +421,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.5
553.6477.32460
</string>
</value>
<value>
<string>
944.5
4830.54261.27972
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -439,7 +439,7 @@
...
@@ -439,7 +439,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
143
5739472.1
</float>
<float>
143
8695309.09
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberclient_js.xml
View file @
8ef46249
...
@@ -239,7 +239,7 @@
...
@@ -239,7 +239,7 @@
var prefix,\n
var prefix,\n
date = new Date(),\n
date = new Date(),\n
timestamp = date.getFullYear() + "-" +\n
timestamp = date.getFullYear() + "-" +\n
zfill(date.getMonth(), 2) + "-" +\n
zfill(date.getMonth()
+ 1
, 2) + "-" +\n
zfill(date.getDate(), 2) + " " +\n
zfill(date.getDate(), 2) + " " +\n
date.toTimeString();\n
date.toTimeString();\n
if (is_incomming) {\n
if (is_incomming) {\n
...
@@ -413,25 +413,6 @@
...
@@ -413,25 +413,6 @@
$(gadget.props.element).trigger("create");\n
$(gadget.props.element).trigger("create");\n
});\n
});\n
}\n
}\n
\n
function renderErrorPage(gadget, error) {\n
var error_text = error;\n
return RSVP.Queue()\n
.push(function () {\n
return gadget.aq_pleasePublishMyState({page: PAGE_CONNECTION});\n
})\n
.push(function (connection_url) {\n
gadget.props.header_element.innerHTML = gadget.props.header_template({\n
left_url: connection_url,\n
left_title: "Login",\n
title: "Error Message"\n
});\n
gadget.props.content_element.innerHTML = gadget.props.error_template({\n
error_message: error_text\n
});\n
$(gadget.props.element).trigger("create");\n
});\n
}\n
\n
\n
function renderDialogPage(gadget, connection_gadget) {\n
function renderDialogPage(gadget, connection_gadget) {\n
var jid,\n
var jid,\n
...
@@ -487,10 +468,13 @@
...
@@ -487,10 +468,13 @@
});\n
});\n
}\n
}\n
\n
\n
function renderConnectPage(gadget) {\n
function renderConnectPage(gadget
, display_message
) {\n
// Always flush the contact list\n
// Always flush the contact list\n
gadget.props.contact_dict = {};\n
gadget.props.contact_dict = {};\n
gadget.props.my_server = \'\',\n
gadget.props.my_jid = \'\';\n
gadget.props.my_jid = \'\';\n
gadget.props.my_password = \'\';\n
gadget.props.connected = false;\n
// Always kill the previous connection gadget to ensure disconnection\n
// Always kill the previous connection gadget to ensure disconnection\n
gadget.props.connection_element.innerHTML = "";\n
gadget.props.connection_element.innerHTML = "";\n
return gadget.dropGadget(CONNECTION_GADGET_SCOPE)\n
return gadget.dropGadget(CONNECTION_GADGET_SCOPE)\n
...
@@ -510,7 +494,9 @@
...
@@ -510,7 +494,9 @@
title: "Connect"\n
title: "Connect"\n
});\n
});\n
gadget.props.content_element.innerHTML =\n
gadget.props.content_element.innerHTML =\n
gadget.props.login_template({});\n
gadget.props.login_template({\n
message: display_message || ""\n
});\n
$(gadget.props.element).trigger("create");\n
$(gadget.props.element).trigger("create");\n
gadget.props.content_element.querySelector("input[name=jid]")\n
gadget.props.content_element.querySelector("input[name=jid]")\n
.focus();\n
.focus();\n
...
@@ -531,15 +517,14 @@
...
@@ -531,15 +517,14 @@
.push(function (result_list) {\n
.push(function (result_list) {\n
var connection_gadget = result_list[0],\n
var connection_gadget = result_list[0],\n
submit_event = result_list[1];\n
submit_event = result_list[1];\n
gadget.props.my_server = submit_event.target[0].value; \n
gadget.props.my_jid = submit_event.target[1].value;\n
gadget.props.my_jid = submit_event.target[1].value;\n
gadget.props.my_password = submit_event.target[2].value;\n
return connection_gadget.connect(\n
return connection_gadget.connect(\n
submit_event.target[0].value,\n
submit_event.target[0].value,\n
submit_event.target[1].value,\n
submit_event.target[1].value,\n
submit_event.target[2].value\n
submit_event.target[2].value\n
);\n
);\n
})\n
.push(function () {\n
return redirectToDefaultPage(gadget);\n
});\n
});\n
}\n
}\n
\n
\n
...
@@ -582,10 +567,8 @@
...
@@ -582,10 +567,8 @@
});\n
});\n
}\n
}\n
\n
\n
function renderResetPasswordPage(gadget, connection_gadget, status) {\n
function renderResetPasswordPage(gadget, connection_gadget, display_message) {\n
if(!status) {\n
var new_password = \'\';\n
status = "";\n
}\n
return new RSVP.Queue()\n
return new RSVP.Queue()\n
.push(function () {\n
.push(function () {\n
return gadget.aq_pleasePublishMyState({page: PAGE_CONTACT});\n
return gadget.aq_pleasePublishMyState({page: PAGE_CONTACT});\n
...
@@ -598,7 +581,7 @@
...
@@ -598,7 +581,7 @@
});\n
});\n
gadget.props.content_element.innerHTML =\n
gadget.props.content_element.innerHTML =\n
gadget.props.reset_password_template({\n
gadget.props.reset_password_template({\n
message:
status
\n
message:
display_message || ""
\n
});\n
});\n
$(gadget.props.element).trigger("create");\n
$(gadget.props.element).trigger("create");\n
gadget.props.content_element.querySelector("input[type=submit]")\n
gadget.props.content_element.querySelector("input[type=submit]")\n
...
@@ -617,6 +600,7 @@
...
@@ -617,6 +600,7 @@
})\n
})\n
.push(function (submit_event) {\n
.push(function (submit_event) {\n
var matched = false;\n
var matched = false;\n
new_password = submit_event.target[1].value;\n
gadget.props.content_element.querySelector("input[type=submit]")\n
gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = true;\n
.disabled = true;\n
matched = validatePassword(\n
matched = validatePassword(\n
...
@@ -629,6 +613,7 @@
...
@@ -629,6 +613,7 @@
submit_event.target[1].value\n
submit_event.target[1].value\n
)\n
)\n
.push(function (status) {\n
.push(function (status) {\n
gadget.props.my_password = new_password;\n
return renderResetPasswordPage(gadget, connection_gadget, status);\n
return renderResetPasswordPage(gadget, connection_gadget, status);\n
}, function (error) {\n
}, function (error) {\n
var message = "Password Reset Failed.";\n
var message = "Password Reset Failed.";\n
...
@@ -667,9 +652,6 @@
...
@@ -667,9 +652,6 @@
g.props.history_template = Handlebars.compile(\n
g.props.history_template = Handlebars.compile(\n
document.querySelector(".history-template").innerHTML\n
document.querySelector(".history-template").innerHTML\n
);\n
);\n
g.props.error_template = Handlebars.compile(\n
document.querySelector(".error-template").innerHTML\n
);\n
g.props.reset_password_template = Handlebars.compile(\n
g.props.reset_password_template = Handlebars.compile(\n
document.querySelector(".reset-password-template").innerHTML\n
document.querySelector(".reset-password-template").innerHTML\n
);\n
);\n
...
@@ -691,7 +673,11 @@
...
@@ -691,7 +673,11 @@
//////////////////////////////////////////\n
//////////////////////////////////////////\n
.allowPublicAcquisition("notifyXMPPConnected", function () {\n
.allowPublicAcquisition("notifyXMPPConnected", function () {\n
var gadget = this;\n
var gadget = this;\n
return gadget.getDeclaredGadget(CONNECTION_GADGET_SCOPE)\n
gadget.props.connected = true;\n
return redirectToDefaultPage(gadget)\n
.push(function() {\n
return gadget.getDeclaredGadget(CONNECTION_GADGET_SCOPE);\n
})\n
.push(function (connection_gadget) {\n
.push(function (connection_gadget) {\n
return connection_gadget.sendPresence();\n
return connection_gadget.sendPresence();\n
})\n
})\n
...
@@ -707,8 +693,8 @@
...
@@ -707,8 +693,8 @@
initializeContact(gadget, all_contacts[key].jid);\n
initializeContact(gadget, all_contacts[key].jid);\n
}\n
}\n
}, function (error) {\n
}, function (error) {\n
var error_text = "
Roster Fetching Failed
";\n
var error_text = "
Fetching Contact List Failed. Please login again.
";\n
return render
Error
Page(gadget, error_text);\n
return render
Connect
Page(gadget, error_text);\n
});\n
});\n
})\n
})\n
.allowPublicAcquisition("notifyXMPPConnecting", function () {\n
.allowPublicAcquisition("notifyXMPPConnecting", function () {\n
...
@@ -788,23 +774,37 @@
...
@@ -788,23 +774,37 @@
\n
\n
.allowPublicAcquisition("notifyXMPPConnectingFail", function () {\n
.allowPublicAcquisition("notifyXMPPConnectingFail", function () {\n
var gadget = this,\n
var gadget = this,\n
error_text = \'
XMPPConnectingFail
\';\n
error_text = \'
Connection Failed. Please login again.
\';\n
return render
Error
Page(gadget, error_text);\n
return render
Connect
Page(gadget, error_text);\n
})\n
})\n
.allowPublicAcquisition("notifyXMPPDisconnecting", function () {\n
.allowPublicAcquisition("notifyXMPPDisconnecting", function () {\n
var gadget = this,\n
return;\n
error_text = \'XMPPDisconnecting\';\n
return renderErrorPage(gadget, error_text);\n
})\n
})\n
.allowPublicAcquisition("notifyXMPPDisconnected", function () {\n
.allowPublicAcquisition("notifyXMPPDisconnected", function () {\n
var gadget = this,\n
var gadget = this,\n
error_text = \'XMPPDisconnected\';\n
error_text = \'Session Disconnected. Please login again.\';\n
return renderErrorPage(gadget, error_text);\n
if(!gadget.props.connected) {\n
return renderConnectPage(gadget, error_text);\n
} else {\n
gadget.props.connected = false;\n
gadget.props.contact_dict = {};\n
return gadget.getDeclaredGadget(CONNECTION_GADGET_SCOPE)\n
.push(function (connection_gadget) {\n
return connection_gadget.connect(\n
gadget.props.my_server, \n
gadget.props.my_jid,\n
gadget.props.my_password\n
);\n
})\n
.push(function () {\n
return redirectToDefaultPage(gadget);\n
});\n
}\n
})\n
})\n
.allowPublicAcquisition("notifyXMPPAuthenticatingFailed", function (error_data) {\n
.allowPublicAcquisition("notifyXMPPAuthenticatingFailed", function (error_data) {\n
var gadget = this,\n
var gadget = this,\n
error_text = \'
XMPPAuthenticatingFailed
\';\n
error_text = \'
Authentication Failed. Please try again.
\';\n
return render
Error
Page(gadget, error_text);\n
return render
Connect
Page(gadget, error_text);\n
})\n
})\n
.declareService(function () {\n
.declareService(function () {\n
\n
\n
...
@@ -998,7 +998,7 @@
...
@@ -998,7 +998,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
zope
</string>
</value>
<value>
<string>
zope
1
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -1012,7 +1012,7 @@
...
@@ -1012,7 +1012,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.5
545.36219.41881
</string>
</value>
<value>
<string>
944.5
4834.23868.16998
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -1030,7 +1030,7 @@
...
@@ -1030,7 +1030,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
143
5744547.72
</float>
<float>
143
8696276.38
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberconnection_js.xml
View file @
8ef46249
...
@@ -583,7 +583,7 @@
...
@@ -583,7 +583,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.
5651.30805.18688
</string>
</value>
<value>
<string>
944.
7242.54723.60006
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -601,7 +601,7 @@
...
@@ -601,7 +601,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
143
5744650.
8
</float>
<float>
143
6191748.3
8
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment