Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
仰若水
frappe
Commits
6dbd1544
Commit
6dbd1544
authored
9 years ago
by
Anand Doshi
Browse files
Options
Download
Plain Diff
Merge branch 'develop'
parents
473d1e41
2c501801
No related merge requests found
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
frappe/__init__.py
+3
-1
frappe/__init__.py
frappe/__version__.py
+1
-1
frappe/__version__.py
frappe/async.py
+10
-9
frappe/async.py
frappe/commands.py
+2
-0
frappe/commands.py
frappe/core/doctype/comment/comment.py
+6
-4
frappe/core/doctype/comment/comment.py
frappe/core/doctype/communication/communication.js
+1
-1
frappe/core/doctype/communication/communication.js
frappe/core/doctype/communication/communication.py
+1
-1
frappe/core/doctype/communication/communication.py
frappe/core/page/data_import_tool/importer.py
+1
-1
frappe/core/page/data_import_tool/importer.py
frappe/desk/page/applications/applications.py
+3
-3
frappe/desk/page/applications/applications.py
frappe/hooks.py
+1
-1
frappe/hooks.py
frappe/model/document.py
+2
-2
frappe/model/document.py
frappe/public/build.json
+9
-6
frappe/public/build.json
frappe/public/css/common.css
+1
-0
frappe/public/css/common.css
frappe/public/css/desk.css
+1
-0
frappe/public/css/desk.css
frappe/public/css/website.css
+1
-0
frappe/public/css/website.css
frappe/public/js/frappe/desk.js
+8
-0
frappe/public/js/frappe/desk.js
frappe/public/js/frappe/dom.js
+12
-0
frappe/public/js/frappe/dom.js
frappe/public/js/frappe/form/control.js
+6
-4
frappe/public/js/frappe/form/control.js
frappe/public/js/frappe/form/footer/timeline.js
+1
-1
frappe/public/js/frappe/form/footer/timeline.js
frappe/public/js/frappe/form/formatters.js
+1
-1
frappe/public/js/frappe/form/formatters.js
with
71 additions
and
36 deletions
+71
-36
frappe/__init__.py
View file @
6dbd1544
...
...
@@ -1052,7 +1052,9 @@ def publish_realtime(*args, **kwargs):
:param room: Room in which to publish update (default entire site)
:param user: Transmit to user
:param doctype: Transmit to doctype, docname
:param docname: Transmit to doctype, docname"""
:param docname: Transmit to doctype, docname
:param after_commit: (default False) will emit after current transaction is committed
"""
import
frappe.async
return
frappe
.
async
.
publish_realtime
(
*
args
,
**
kwargs
)
...
...
This diff is collapsed.
Click to expand it.
frappe/__version__.py
View file @
6dbd1544
from
__future__
import
unicode_literals
__version__
=
"6.17.
4
"
__version__
=
"6.17.
5
"
This diff is collapsed.
Click to expand it.
frappe/async.py
View file @
6dbd1544
...
...
@@ -97,7 +97,7 @@ def is_file_old(file_path):
return
((
time
.
time
()
-
os
.
stat
(
file_path
).
st_mtime
)
>
TASK_LOG_MAX_AGE
)
def
publish_realtime
(
event
=
None
,
message
=
None
,
room
=
None
,
user
=
None
,
doctype
=
None
,
docname
=
None
,
now
=
False
):
def
publish_realtime
(
event
=
None
,
message
=
None
,
room
=
None
,
user
=
None
,
doctype
=
None
,
docname
=
None
,
after_commit
=
False
):
"""Publish real-time updates
:param event: Event name, like `task_progress` etc. that will be handled by the client (default is `task_progress` if within task or `global`)
...
...
@@ -105,23 +105,24 @@ def publish_realtime(event=None, message=None, room=None, user=None, doctype=Non
:param room: Room in which to publish update (default entire site)
:param user: Transmit to user
:param doctype: Transmit to doctype, docname
:param docname: Transmit to doctype, docname"""
:param docname: Transmit to doctype, docname
:param after_commit: (default False) will emit after current transaction is committed"""
if
message
is
None
:
message
=
{}
if
event
is
None
:
if
frappe
.
local
.
task_id
:
if
getattr
(
frappe
.
local
,
"
task_id
"
,
None
)
:
event
=
"task_progress"
else
:
event
=
"global"
if
not
room
:
if
frappe
.
local
.
task_id
:
if
getattr
(
frappe
.
local
,
"
task_id
"
,
None
)
:
room
=
get_task_progress_room
()
if
not
"task_id"
in
message
:
message
[
"task_id"
]
=
frappe
.
local
.
task_id
now
=
Tru
e
after_commit
=
Fals
e
elif
user
:
room
=
get_user_room
(
user
)
elif
doctype
and
docname
:
...
...
@@ -129,10 +130,10 @@ def publish_realtime(event=None, message=None, room=None, user=None, doctype=Non
else
:
room
=
get_site_room
()
if
now
:
emit_via_redis
(
event
,
message
,
room
)
else
:
if
after_commit
:
frappe
.
local
.
realtime_log
.
append
([
event
,
message
,
room
])
else
:
emit_via_redis
(
event
,
message
,
room
)
def
emit_via_redis
(
event
,
message
,
room
):
"""Publish real-time updates via redis
...
...
@@ -159,7 +160,7 @@ def put_log(line_no, line, task_id=None):
"lines"
:
{
line_no
:
line
}
},
"task_id"
:
task_id
},
room
=
task_progress_room
,
now
=
True
)
},
room
=
task_progress_room
)
r
.
hset
(
task_log_key
,
line_no
,
line
)
r
.
expire
(
task_log_key
,
3600
)
...
...
This diff is collapsed.
Click to expand it.
frappe/commands.py
View file @
6dbd1544
...
...
@@ -218,6 +218,7 @@ def migrate(context, rebuild_website=False):
clear_notifications
()
finally
:
frappe
.
publish_realtime
(
"version-update"
)
frappe
.
destroy
()
if
rebuild_website
:
...
...
@@ -225,6 +226,7 @@ def migrate(context, rebuild_website=False):
else
:
call_command
(
sync_www
,
context
)
def
prepare_for_update
():
from
frappe.sessions
import
clear_global_cache
clear_global_cache
()
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/comment/comment.py
View file @
6dbd1544
...
...
@@ -46,13 +46,15 @@ class Comment(Document):
if
self
.
comment_docname
==
frappe
.
session
.
user
:
message
=
self
.
as_dict
()
message
[
'broadcast'
]
=
True
frappe
.
publish_realtime
(
'new_message'
,
message
)
frappe
.
publish_realtime
(
'new_message'
,
message
,
after_commit
=
True
)
else
:
# comment_docname contains the user who is addressed in the messages' page comment
frappe
.
publish_realtime
(
'new_message'
,
self
.
as_dict
(),
user
=
self
.
comment_docname
)
frappe
.
publish_realtime
(
'new_message'
,
self
.
as_dict
(),
user
=
self
.
comment_docname
,
after_commit
=
True
)
else
:
frappe
.
publish_realtime
(
'new_comment'
,
self
.
as_dict
(),
doctype
=
self
.
comment_doctype
,
docname
=
self
.
comment_docname
)
frappe
.
publish_realtime
(
'new_comment'
,
self
.
as_dict
(),
doctype
=
self
.
comment_doctype
,
docname
=
self
.
comment_docname
,
after_commit
=
True
)
self
.
notify_mentions
()
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/communication.js
View file @
6dbd1544
...
...
@@ -30,7 +30,7 @@ frappe.ui.form.on("Communication", "refresh", function(frm) {
frappe
.
ui
.
form
.
on
(
"
Communication
"
,
"
onload
"
,
function
(
frm
)
{
if
(
frm
.
doc
.
content
)
{
frm
.
doc
.
content
=
frappe
.
utils
.
remove_script_and_style
(
frm
.
doc
.
content
);
frm
.
doc
.
content
=
frappe
.
dom
.
remove_script_and_style
(
frm
.
doc
.
content
);
}
frm
.
set_query
(
"
reference_doctype
"
,
function
()
{
return
{
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/communication.py
View file @
6dbd1544
...
...
@@ -51,7 +51,7 @@ class Communication(Document):
comment
[
"comment_type"
]
=
comment
[
"communication_medium"
]
frappe
.
publish_realtime
(
'new_comment'
,
comment
,
doctype
=
self
.
reference_doctype
,
docname
=
self
.
reference_name
)
docname
=
self
.
reference_name
,
after_commit
=
True
)
def
on_update
(
self
):
"""Update parent status as `Open` or `Replied`."""
...
...
This diff is collapsed.
Click to expand it.
frappe/core/page/data_import_tool/importer.py
View file @
6dbd1544
...
...
@@ -218,7 +218,7 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False,
# publish task_update
frappe
.
publish_realtime
(
"data_import_progress"
,
{
"progress"
:
[
i
,
total
]},
user
=
frappe
.
session
.
user
,
now
=
True
)
user
=
frappe
.
session
.
user
)
try
:
doc
=
get_doc
(
row_idx
)
...
...
This diff is collapsed.
Click to expand it.
frappe/desk/page/applications/applications.py
View file @
6dbd1544
...
...
@@ -74,12 +74,12 @@ def install_app(name):
frappe
.
throw
(
_
(
"You cannot install this app"
))
frappe
.
publish_realtime
(
"install_app_progress"
,
{
"status"
:
_
(
"Installing App {0}"
).
format
(
name
)},
user
=
frappe
.
session
.
user
,
now
=
True
)
user
=
frappe
.
session
.
user
)
frappe
.
installer
.
install_app
(
name
)
frappe
.
publish_realtime
(
"install_app_progress"
,
{
"status"
:
_
(
"{0} Installed"
).
format
(
name
)},
user
=
frappe
.
session
.
user
,
now
=
True
)
user
=
frappe
.
session
.
user
)
def
get_app
(
name
):
"""Get app using git clone and install it in bench environment"""
...
...
@@ -89,7 +89,7 @@ def get_app(name):
raise
frappe
.
ValidationError
frappe
.
publish_realtime
(
"install_app_progress"
,
{
"status"
:
_
(
"Downloading App {0}"
).
format
(
name
)},
user
=
frappe
.
session
.
user
,
now
=
True
)
user
=
frappe
.
session
.
user
)
args
=
[
find_executable
(
'bench'
),
'get-app'
,
name
,
app_listing
[
name
][
'repo_url'
]]
...
...
This diff is collapsed.
Click to expand it.
frappe/hooks.py
View file @
6dbd1544
...
...
@@ -5,7 +5,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
app_description
=
"Full stack web framework with Python, Javascript, MariaDB, Redis, Node"
app_icon
=
"octicon octicon-circuit-board"
app_version
=
"6.17.
4
"
app_version
=
"6.17.
5
"
app_color
=
"orange"
source_link
=
"https://github.com/frappe/frappe"
app_license
=
"MIT"
...
...
This diff is collapsed.
Click to expand it.
frappe/model/document.py
View file @
6dbd1544
...
...
@@ -649,11 +649,11 @@ class Document(BaseDocument):
def
notify_update
(
self
):
"""Publish realtime that the current document is modified"""
frappe
.
publish_realtime
(
"doc_update"
,
{
"modified"
:
self
.
modified
,
"doctype"
:
self
.
doctype
,
"name"
:
self
.
name
},
doctype
=
self
.
doctype
,
docname
=
self
.
name
)
doctype
=
self
.
doctype
,
docname
=
self
.
name
,
after_commit
=
True
)
if
not
self
.
meta
.
get
(
"read_only"
)
and
not
self
.
meta
.
get
(
"issingle"
)
and
\
not
self
.
meta
.
get
(
"istable"
):
frappe
.
publish_realtime
(
"list_update"
,
{
"doctype"
:
self
.
doctype
})
frappe
.
publish_realtime
(
"list_update"
,
{
"doctype"
:
self
.
doctype
}
,
after_commit
=
True
)
def
check_no_back_links_exist
(
self
):
...
...
This diff is collapsed.
Click to expand it.
frappe/public/build.json
View file @
6dbd1544
...
...
@@ -18,11 +18,15 @@
"website/js/website.js"
,
"public/js/lib/socket.io.min.js"
],
"js/editor.min.js"
:
[
"public/js/lib/jquery/jquery.hotkeys.js"
,
"public/js/lib/beautify-html.js"
,
"public/js/frappe/ui/editor.html"
,
"public/js/frappe/ui/editor.js"
"js/dialog.min.js"
:
[
"public/js/frappe/dom.js"
,
"public/js/frappe/ui/modal.html"
,
"public/js/frappe/form/formatters.js"
,
"public/js/frappe/form/layout.js"
,
"public/js/frappe/ui/field_group.js"
,
"public/js/frappe/form/control.js"
,
"public/js/frappe/form/link_selector.js"
,
"public/js/frappe/ui/dialog.js"
],
"css/desk.min.css"
:
[
"public/js/lib/jquery/bootstrap_theme/jquery-ui.selected.css"
,
...
...
@@ -81,7 +85,6 @@
"public/js/frappe/form/control.js"
,
"public/js/frappe/form/link_selector.js"
,
"public/js/frappe/ui/dialog.js"
,
"public/js/frappe/ui/button.js"
,
"public/js/frappe/ui/app_icon.js"
,
"public/js/frappe/model/model.js"
,
...
...
This diff is collapsed.
Click to expand it.
frappe/public/css/common.css
View file @
6dbd1544
...
...
@@ -108,6 +108,7 @@ a.badge-hover:active .badge {
background-color
:
#D8DFE5
;
}
.msgprint
{
margin
:
15px
0px
;
text-align
:
center
;
}
.msgprint
pre
{
...
...
This diff is collapsed.
Click to expand it.
frappe/public/css/desk.css
View file @
6dbd1544
...
...
@@ -108,6 +108,7 @@ a.badge-hover:active .badge {
background-color
:
#D8DFE5
;
}
.msgprint
{
margin
:
15px
0px
;
text-align
:
center
;
}
.msgprint
pre
{
...
...
This diff is collapsed.
Click to expand it.
frappe/public/css/website.css
View file @
6dbd1544
...
...
@@ -108,6 +108,7 @@ a.badge-hover:active .badge {
background-color
:
#D8DFE5
;
}
.msgprint
{
margin
:
15px
0px
;
text-align
:
center
;
}
.msgprint
pre
{
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/desk.js
View file @
6dbd1544
...
...
@@ -70,6 +70,14 @@ frappe.Application = Class.extend({
frappe
.
csrf_token
=
data
.
csrf_token
;
}
});
frappe
.
realtime
.
on
(
"
version-update
"
,
function
()
{
var
dialog
=
frappe
.
msgprint
(
__
(
"
The application has been updated to a new version, please refresh this page
"
));
dialog
.
set_primary_action
(
"
Refresh
"
,
function
()
{
location
.
reload
(
true
);
});
dialog
.
get_close_btn
().
toggle
(
false
);
});
},
load_bootinfo
:
function
()
{
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/dom.js
View file @
6dbd1544
...
...
@@ -24,6 +24,18 @@ frappe.dom = {
// execute the script globally
document
.
getElementsByTagName
(
'
head
'
)[
0
].
appendChild
(
el
);
},
remove_script_and_style
:
function
(
txt
)
{
var
div
=
document
.
createElement
(
'
div
'
);
div
.
innerHTML
=
txt
;
[
"
script
"
,
"
style
"
,
"
noscript
"
,
"
title
"
,
"
meta
"
,
"
base
"
,
"
head
"
].
forEach
(
function
(
e
,
i
)
{
var
elements
=
div
.
getElementsByTagName
(
e
);
var
i
=
elements
.
length
;
while
(
i
--
)
{
elements
[
i
].
parentNode
.
removeChild
(
elements
[
i
]);
}
});
return
div
.
innerHTML
;
},
set_style
:
function
(
txt
,
id
)
{
if
(
!
txt
)
return
;
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/form/control.js
View file @
6dbd1544
...
...
@@ -102,9 +102,11 @@ frappe.ui.form.Control = Class.extend({
undefined
;
},
set_model_value
:
function
(
value
)
{
if
(
frappe
.
model
.
set_value
(
this
.
doctype
,
this
.
docname
,
this
.
df
.
fieldname
,
value
,
this
.
df
.
fieldtype
))
{
this
.
last_value
=
value
;
if
(
this
.
doctype
)
{
if
(
frappe
.
model
.
set_value
(
this
.
doctype
,
this
.
docname
,
this
.
df
.
fieldname
,
value
,
this
.
df
.
fieldtype
))
{
this
.
last_value
=
value
;
}
}
},
});
...
...
@@ -1384,7 +1386,7 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({
},
_set_input
:
function
(
value
)
{
if
(
value
==
null
)
value
=
""
;
value
=
frappe
.
utils
.
remove_script_and_style
(
value
);
value
=
frappe
.
dom
.
remove_script_and_style
(
value
);
this
.
editor
.
set_input
(
value
);
this
.
md_editor
.
val
(
value
);
this
.
last_value
=
value
;
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/form/footer/timeline.js
View file @
6dbd1544
...
...
@@ -148,7 +148,7 @@ frappe.ui.form.Comments = Class.extend({
if
(
c
.
comment_type
==
"
Email
"
)
{
c
.
comment
=
c
.
comment
.
split
(
"
<!-- original-reply -->
"
)[
0
];
c
.
comment
=
frappe
.
utils
.
strip_original_content
(
c
.
comment
);
c
.
comment
=
frappe
.
utils
.
remove_script_and_style
(
c
.
comment
);
c
.
comment
=
frappe
.
dom
.
remove_script_and_style
(
c
.
comment
);
c
.
original_comment
=
c
.
comment
;
c
.
comment
=
frappe
.
utils
.
toggle_blockquote
(
c
.
comment
);
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/form/formatters.js
View file @
6dbd1544
...
...
@@ -202,7 +202,7 @@ frappe.format = function(value, df, options, doc) {
var
formatted
=
formatter
(
value
,
df
,
options
,
doc
);
if
(
typeof
formatted
==
"
string
"
)
formatted
=
frappe
.
utils
.
remove_script_and_style
(
formatted
);
formatted
=
frappe
.
dom
.
remove_script_and_style
(
formatted
);
return
formatted
;
}
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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
Menu
Projects
Groups
Snippets
Help