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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
a5e72bcc
Commit
a5e72bcc
authored
Apr 04, 2016
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Apr 05, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_jabber_client: Display Date and Time if message are send with more than…
… 30 minutes difference. /reviewed-on
!93
parent
14dda8ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
18 deletions
+42
-18
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_page_dialog_js.js
...plateItem/web_page_module/jabber_gadget_page_dialog_js.js
+42
-18
No files found.
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_page_dialog_js.js
View file @
a5e72bcc
...
...
@@ -13,6 +13,9 @@
});
}
// MESSAGE_FRESHNESS 30 minutes
var
MESSAGE_FRESHNESS
=
1800000
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// ready
...
...
@@ -62,7 +65,11 @@
index
,
displayed_text
=
''
,
is_incoming
=
true
,
is_handled
;
is_handled
,
previous_message_date
,
is_old
,
message_date
,
message_is_incoming
;
function
appendText
(
txt
,
incoming
)
{
var
li
,
pre
;
...
...
@@ -81,36 +88,53 @@
}
}
function
appendDate
(
date
)
{
var
li
,
i_element
;
li
=
document
.
createElement
(
"
li
"
);
li
.
setAttribute
(
"
style
"
,
"
text-align: center; padding-left: 5em; padding: 0;
"
);
i_element
=
document
.
createElement
(
"
i
"
);
i_element
.
setAttribute
(
"
style
"
,
"
white-space: pre-wrap; padding: 0.5em 0 0.5em 0; display: block;
"
);
i_element
.
textContent
=
date
.
toLocaleString
();
li
.
appendChild
(
i_element
);
ul
.
appendChild
(
li
);
}
for
(
i
=
0
;
i
<
line_list
.
length
-
1
;
i
+=
1
)
{
line
=
line_list
[
i
];
is_handled
=
false
;
is_old
=
false
;
if
(
line
.
indexOf
(
'
[
'
)
===
0
)
{
index
=
line
.
indexOf
(
'
]
'
);
if
(
index
!==
-
1
)
{
// Check message freshness
message_date
=
new
Date
(
line
.
substring
(
1
,
index
));
if
(
previous_message_date
===
undefined
)
{
previous_message_date
=
new
Date
(
message_date
-
MESSAGE_FRESHNESS
-
2
);
}
if
(
message_date
-
previous_message_date
>
MESSAGE_FRESHNESS
)
{
is_old
=
true
;
}
// Check direction
tmp_line
=
line
.
substring
(
index
+
2
);
if
(
tmp_line
.
indexOf
(
'
>
'
)
===
0
)
{
line
=
tmp_line
.
substring
(
2
);
// Outgoing
if
(
is_incoming
)
{
appendText
(
displayed_text
,
is_incoming
);
is_incoming
=
false
;
displayed_text
=
line
+
'
\n
'
;
is_handled
=
true
;
}
message_is_incoming
=
false
;
}
else
if
(
tmp_line
.
indexOf
(
'
<
'
)
===
0
)
{
line
=
tmp_line
.
substring
(
2
);
// Incoming
if
(
!
is_incoming
)
{
appendText
(
displayed_text
,
is_incoming
);
is_incoming
=
true
;
displayed_text
=
line
+
'
\n
'
;
is_handled
=
true
;
}
message_is_incoming
=
true
;
}
line
=
tmp_line
.
substring
(
2
);
if
(
message_is_incoming
!==
is_incoming
||
is_old
)
{
appendText
(
displayed_text
,
is_incoming
);
is_incoming
=
message_is_incoming
;
is_handled
=
true
;
displayed_text
=
line
+
'
\n
'
;
}
if
(
is_old
)
{
appendDate
(
message_date
);
}
}
}
previous_message_date
=
message_date
;
if
(
!
is_handled
)
{
displayed_text
+=
line
+
'
\n
'
;
...
...
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