Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
3pia
VISPA
VISPA web
Commits
705a5cf7
Commit
705a5cf7
authored
Dec 31, 2014
by
ThorbenQuast
Browse files
editor: - confirm before file is overwritten (fix #1962)
- complete revision 1827
parent
1e62c5f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
vispa/extensions/codeeditor/static/js/editor.js
View file @
705a5cf7
...
...
@@ -284,19 +284,36 @@ var CodeEditor = Emitter.extend({
var
args
=
{
"
path
"
:
path
,
callback
:
function
(
path
)
{
var
fileExtension
=
path
.
split
(
"
.
"
).
pop
().
toLowerCase
();
if
(
!~
self
.
view
.
_extension
.
fileExtensions
.
indexOf
(
fileExtension
))
{
var
msg
=
"
<html>File extension '
"
+
fileExtension
+
"
' is not supported! <br /> Save anyway?</html>
"
;
self
.
view
.
confirm
(
msg
,
function
(
confirmed
)
{
if
(
confirmed
)
{
self
.
view
.
POST
(
vispa
.
url
.
dynamic
(
"
/ajax/fs/exists
"
),
{
path
:
path
}).
done
(
function
(
selectedType
)
{
var
proceedSave
=
function
()
{
var
fileExtension
=
path
.
split
(
"
.
"
).
pop
().
toLowerCase
();
if
(
!~
self
.
view
.
_extension
.
fileExtensions
.
indexOf
(
fileExtension
))
{
var
msg
=
"
<html>File extension '
"
+
fileExtension
+
"
' is not supported! <br /> Save anyway?</html>
"
;
self
.
view
.
confirm
(
msg
,
function
(
confirmed
)
{
if
(
confirmed
)
{
self
.
save
(
callback
,
"
new
"
,
path
);
}
});
}
else
{
self
.
save
(
callback
,
"
new
"
,
path
);
}
});
}
else
{
self
.
save
(
callback
,
"
new
"
,
path
);
}
};
if
(
selectedType
==
"
f
"
)
{
//selected element is an existing file
var
msg
=
"
<html> File exists already! <br />
"
+
"
Do you want to overwrite it ? </html>
"
;
self
.
view
.
confirm
(
msg
,
function
(
confirmed
)
{
if
(
confirmed
)
proceedSave
();
else
return
;
});
}
else
proceedSave
();
});
},
sort
:
[
"
name
"
,
"
ext
"
],
reverse
:
[
false
,
false
]
...
...
vispa/extensions/codeeditor/static/js/extension.js
View file @
705a5cf7
...
...
@@ -29,7 +29,7 @@ var CodeEditorExtension = vispa.Extension.extend({
// register to listen to certain file extensions
this
.
fileExtensions
=
[
"
bsc
"
,
"
c
"
,
"
cc
"
,
"
conf
"
,
"
cpp
"
,
"
csh
"
,
"
css
"
,
"
diff
"
,
"
f
"
,
"
f70
"
,
"
f90
"
,
"
f95
"
,
"
f03
"
,
"
h
"
,
"
hh
"
,
"
hpp
"
,
"
html
"
,
"
ini
"
,
"
java
"
,
"
js
"
,
"
less
"
,
"
log
"
,
"
json
"
,
"
md
"
,
"
orig
"
,
"
php
"
,
"
py
"
,
"
pyc
"
,
"
rb
"
,
"
sh
"
,
"
tex
"
,
"
txt
"
,
"
xml
"
,
"
yml
"
,
"
yaml
"
,
"
zsh
"
"
md
"
,
"
orig
"
,
"
php
"
,
"
py
"
,
"
rb
"
,
"
sh
"
,
"
tex
"
,
"
txt
"
,
"
xml
"
,
"
yml
"
,
"
yaml
"
,
"
zsh
"
];
$
.
each
(
this
.
fileExtensions
,
function
(
i
,
key
)
{
self
.
addFileHandler
(
key
,
function
(
workspaceId
,
path
)
{
...
...
Write
Preview
Supports
Markdown
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