Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
020c48ac
Commit
020c48ac
authored
Mar 13, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhance:FileManager) 新增「全局书签」功能, 可在「系统设置-默认设置」单击鼠标右键添加
parent
391863a8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
265 additions
and
0 deletions
+265
-0
CHANGELOG.md
CHANGELOG.md
+8
-0
en.js
source/language/en.js
+29
-0
zh.js
source/language/zh.js
+29
-0
files.js
source/modules/filemanager/files.js
+13
-0
index.js
source/modules/filemanager/index.js
+1
-0
adefault.js
source/modules/settings/adefault.js
+185
-0
No files found.
CHANGELOG.md
View file @
020c48ac
...
@@ -28,6 +28,14 @@
...
@@ -28,6 +28,14 @@
*
优化SQLServer类型数据库默认查询语句
*
优化SQLServer类型数据库默认查询语句
*
php数据管理解析数据时自动猜解编码
*
php数据管理解析数据时自动猜解编码
### 文件管理
*
新增「全局书签」功能, 可在「系统设置-默认设置」单击鼠标右键添加


### 其它
### 其它
*
新增 「JSP Custom Shell For Oracle」
*
新增 「JSP Custom Shell For Oracle」
...
...
source/language/en.js
View file @
020c48ac
...
@@ -707,6 +707,35 @@ module.exports = {
...
@@ -707,6 +707,35 @@ module.exports = {
window
:
'Window'
,
window
:
'Window'
,
tab
:
'Tab'
,
tab
:
'Tab'
,
},
},
bookmark
:
{
title
:
'Global Bookmark'
,
nodata
:
'No data, click the right mouse button add'
,
grid
:
{
name
:
'Name'
,
path
:
'Path'
},
bmenu
:
{
add
:
'Add Bookmark'
,
del
:
'Del Bookmark'
},
add
:
{
title
:
'Add to global bookmark'
,
success
:
'Add success'
,
namedup
:
'The name cannot be duplicated'
,
name_invalid
:
'Name is invalid'
,
addbtn
:
'Confirm'
},
del
:
{
title
:
'Delete Bookmark'
,
confirm
:
(
num
)
=>
antSword
.
noxss
(
`Are you sure to delete
${
typeof
(
num
)
===
'number'
?
num
+
' Bookmarks'
:
num
+
" "
}
?`
),
success
:
'Delete success'
},
edit
:
{
namedup
:
'The name cannot be duplicated'
,
name_invalid
:
'Name is invalid'
,
success
:
'Edit success'
}
},
}
}
}
}
},
},
...
...
source/language/zh.js
View file @
020c48ac
...
@@ -708,6 +708,35 @@ module.exports = {
...
@@ -708,6 +708,35 @@ module.exports = {
window
:
'窗口打开'
,
window
:
'窗口打开'
,
tab
:
'标签打开'
,
tab
:
'标签打开'
,
},
},
bookmark
:
{
title
:
'全局书签'
,
nodata
:
'当前暂无数据, 请单击鼠标右键添加'
,
grid
:
{
name
:
'名称'
,
path
:
'目录'
},
bmenu
:
{
add
:
'添加书签'
,
del
:
'删除书签'
},
add
:
{
title
:
'添加全局书签'
,
success
:
'添加成功'
,
namedup
:
'名称不能重复'
,
name_invalid
:
'名称不合法'
,
addbtn
:
'确定'
},
del
:
{
title
:
'删除书签'
,
confirm
:
(
num
)
=>
antSword
.
noxss
(
`你确定要删除
${
typeof
(
num
)
===
'number'
?
num
+
' 个书签'
:
num
+
" "
}
吗?`
),
success
:
'删除成功'
},
edit
:
{
namedup
:
'名称不能重复'
,
name_invalid
:
'名称不合法'
,
success
:
'更新成功'
}
},
}
}
}
}
},
},
...
...
source/modules/filemanager/files.js
View file @
020c48ac
...
@@ -27,6 +27,19 @@ class Files {
...
@@ -27,6 +27,19 @@ class Files {
text
:
LANG
[
'bookmark'
][
'add'
],
text
:
LANG
[
'bookmark'
][
'add'
],
enabled
:
!
bookmark
[
manager
.
path
]
enabled
:
!
bookmark
[
manager
.
path
]
}];
}];
let
global_bookmarks
=
manager
.
config
.
bookmarks
||
{};
if
(
Object
.
keys
(
global_bookmarks
).
length
>
0
)
{
bookmark_opts
.
push
({
type
:
'separator'
});
for
(
let
gb
in
global_bookmarks
)
{
bookmark_opts
.
push
({
id
:
'bookmark_'
+
global_bookmarks
[
gb
],
text
:
gb
,
icon
:
'bookmark'
,
type
:
'button'
,
enabled
:
manager
.
path
!==
global_bookmarks
[
gb
]
});
}
}
if
(
!
$
.
isEmptyObject
(
bookmark
))
{
if
(
!
$
.
isEmptyObject
(
bookmark
))
{
bookmark_opts
.
push
({
type
:
'separator'
});
bookmark_opts
.
push
({
type
:
'separator'
});
};
};
...
...
source/modules/filemanager/index.js
View file @
020c48ac
...
@@ -41,6 +41,7 @@ class FileManager {
...
@@ -41,6 +41,7 @@ class FileManager {
let
config
=
{
let
config
=
{
openfileintab
:
false
,
openfileintab
:
false
,
bookmarks
:
{},
};
};
this
.
config
=
JSON
.
parse
(
antSword
[
'storage'
](
"adefault_filemanager"
,
false
,
JSON
.
stringify
(
config
)));
this
.
config
=
JSON
.
parse
(
antSword
[
'storage'
](
"adefault_filemanager"
,
false
,
JSON
.
stringify
(
config
)));
...
...
source/modules/settings/adefault.js
View file @
020c48ac
...
@@ -8,6 +8,7 @@ const LANG_T = antSword['language']['toastr'];
...
@@ -8,6 +8,7 @@ const LANG_T = antSword['language']['toastr'];
class
ADefault
{
class
ADefault
{
constructor
(
sidebar
)
{
constructor
(
sidebar
)
{
var
self
=
this
;
sidebar
.
addItem
({
sidebar
.
addItem
({
id
:
'adefault'
,
id
:
'adefault'
,
text
:
`<i class="fa fa-sliders"></i>
${
LANG
[
'title'
]}
`
text
:
`<i class="fa fa-sliders"></i>
${
LANG
[
'title'
]}
`
...
@@ -16,10 +17,16 @@ class ADefault {
...
@@ -16,10 +17,16 @@ class ADefault {
const
default_config
=
{
const
default_config
=
{
filemanager
:
{
filemanager
:
{
openfileintab
:
false
,
openfileintab
:
false
,
bookmarks
:
{},
},
},
};
};
// 读取配置
// 读取配置
const
filemanager_settings
=
JSON
.
parse
(
antSword
[
'storage'
](
"adefault_filemanager"
,
false
,
JSON
.
stringify
(
default_config
.
filemanager
)));
const
filemanager_settings
=
JSON
.
parse
(
antSword
[
'storage'
](
"adefault_filemanager"
,
false
,
JSON
.
stringify
(
default_config
.
filemanager
)));
this
.
filemanager_settings
=
filemanager_settings
;
if
(
!
this
.
filemanager_settings
.
bookmarks
){
this
.
filemanager_settings
.
bookmarks
=
default_config
.
filemanager
.
bookmarks
;
}
const
toolbar
=
cell
.
attachToolbar
();
const
toolbar
=
cell
.
attachToolbar
();
toolbar
.
loadStruct
([
toolbar
.
loadStruct
([
{
id
:
'save'
,
type
:
'button'
,
text
:
LANG
[
'toolbar'
][
'save'
],
icon
:
'save'
}
{
id
:
'save'
,
type
:
'button'
,
text
:
LANG
[
'toolbar'
][
'save'
],
icon
:
'save'
}
...
@@ -42,12 +49,96 @@ class ADefault {
...
@@ -42,12 +49,96 @@ class ADefault {
}
}
]},
]},
// 后续文件管理其它设置
// 后续文件管理其它设置
{
type
:
'block'
,
list
:
[
{
type
:
'label'
,
label
:
LANG
[
'filemanager'
][
'bookmark'
][
'title'
]},
{
type
:
'container'
,
name
:
'filemanager_bookmarks'
,
inputWidth
:
600
,
inputHeight
:
200
},
]},
]
]
}
}
]},
]},
// 后续其它模块
// 后续其它模块
],
true
);
],
true
);
form
.
enableLiveValidation
(
true
);
form
.
enableLiveValidation
(
true
);
let
bookmark_grid
=
new
dhtmlXGridObject
(
form
.
getContainer
(
'filemanager_bookmarks'
));
bookmark_grid
.
setHeader
(
`
,
${
LANG
[
'filemanager'
][
'bookmark'
][
'grid'
][
'name'
]}
,
${
LANG
[
'filemanager'
][
'bookmark'
][
'grid'
][
'path'
]}
`
);
bookmark_grid
.
setColTypes
(
"ro,edtxt,edtxt"
);
bookmark_grid
.
setColSorting
(
'str,str,str'
);
bookmark_grid
.
setInitWidths
(
"40,*,200"
);
bookmark_grid
.
setColAlign
(
"center,left,left"
);
bookmark_grid
.
enableMultiselect
(
true
);
// grid右键
// 空白数据右键fix
$
(
'.objbox'
).
on
(
'contextmenu'
,
(
e
)
=>
{
(
e
.
target
.
nodeName
===
'DIV'
&&
bookmark_grid
.
callEvent
instanceof
Function
&&
antSword
[
'tabbar'
].
getActiveTab
()
===
"tab_about"
&&
sidebar
.
getActiveItem
()
===
"adefault"
)
?
bookmark_grid
.
callEvent
(
'onRightClick'
,
[
-
1
,
-
1
,
e
])
:
null
;
});
$
(
'.objbox'
).
on
(
'click'
,
(
e
)
=>
{
bmenu
.
hide
();
});
bookmark_grid
.
attachEvent
(
'onRightClick'
,
(
id
,
lid
,
event
)
=>
{
let
_ids
=
(
bookmark_grid
.
getSelectedId
()
||
''
).
split
(
','
);
if
(
id
===
-
1
)
{
_ids
=
[];
}
else
if
(
_ids
.
length
===
1
)
{
// 如果没有选中?则选中右键对应选项
bookmark_grid
.
selectRowById
(
id
);
_ids
=
[
id
];
};
let
ids
=
[];
_ids
.
map
((
_
)
=>
{
ids
.
push
(
bookmark_grid
.
getRowAttribute
(
_
,
'bname'
));
});
id
=
ids
[
0
]
||
''
;
let
menu
=
[
{
text
:
LANG
[
'filemanager'
][
'bookmark'
][
'bmenu'
][
'add'
],
icon
:
'fa fa-plus-circle'
,
action
:
self
.
addBookMarks
.
bind
(
self
)},
{
text
:
LANG
[
'filemanager'
][
'bookmark'
][
'bmenu'
][
'del'
],
icon
:
'fa fa-trash-o'
,
action
:
()
=>
{
self
.
delBookMarks
(
ids
);
}},
];
bmenu
(
menu
,
event
);
return
true
;
});
bookmark_grid
.
attachEvent
(
"onEditCell"
,
function
(
stage
,
rId
,
cInd
,
nValue
,
oValue
){
// 2 编辑完成
if
(
stage
===
2
)
{
if
(
nValue
===
oValue
){
return
;}
var
obname
=
bookmark_grid
.
getRowAttribute
(
rId
,
"bname"
);
var
obpath
=
bookmark_grid
.
getRowAttribute
(
rId
,
"bpath"
);
switch
(
cInd
){
// 具体是哪一列被编辑了
case
1
:
// name
// if(!nValue.match(/^[a-zA-Z0-9_/]+$/)){
// toastr.error(LANG["filemanager"]['bookmark']['edit']["name_invalid"], LANG_T['error']);
// return
// }
if
(
self
.
filemanager_settings
.
bookmarks
.
hasOwnProperty
(
obname
)){
delete
self
.
filemanager_settings
.
bookmarks
[
obname
];
self
.
filemanager_settings
.
bookmarks
[
nValue
]
=
obpath
;
}
toastr
.
success
(
LANG
[
"filemanager"
][
'bookmark'
][
'edit'
][
"success"
],
LANG_T
[
"success"
]);
break
;
case
2
:
// path
nValue
=
nValue
.
replace
(
/
\\
/g
,
'/'
);
if
(
!
nValue
.
endsWith
(
'/'
)){
nValue
+=
'/'
;
}
if
(
self
.
filemanager_settings
.
bookmarks
.
hasOwnProperty
(
obname
)){
self
.
filemanager_settings
.
bookmarks
[
obname
]
=
nValue
;
}
break
;
}
antSword
[
'storage'
](
'adefault_filemanager'
,
self
.
filemanager_settings
);
self
.
reloadFMBookmarks
();
}
});
bookmark_grid
.
init
();
this
.
bookmark_grid
=
bookmark_grid
;
// 保存
// 保存
toolbar
.
attachEvent
(
'onClick'
,
(
id
)
=>
{
toolbar
.
attachEvent
(
'onClick'
,
(
id
)
=>
{
switch
(
id
){
switch
(
id
){
...
@@ -74,6 +165,100 @@ class ADefault {
...
@@ -74,6 +165,100 @@ class ADefault {
break
;
break
;
}
}
});
});
this
.
reloadFMBookmarks
();
}
// 重载 bookmarks grid
reloadFMBookmarks
(){
let
self
=
this
;
let
data
=
[];
let
_id
=
1
;
Object
.
keys
(
self
.
filemanager_settings
.
bookmarks
).
map
((
t
)
=>
{
data
.
push
({
id
:
_id
,
bname
:
t
,
bpath
:
self
.
filemanager_settings
.
bookmarks
[
t
],
data
:
[
`<i class="fa fa-bookmark-o"></i>`
,
antSword
.
noxss
(
t
),
antSword
.
noxss
(
self
.
filemanager_settings
.
bookmarks
[
t
])
]
});
_id
++
;
});
if
(
data
.
length
==
0
){
data
.
push
({
id
:
_id
,
bname
:
''
,
bpath
:
''
,
data
:
[
`<i class="fa fa-bookmark-o"></i>`
,
LANG
[
'filemanager'
][
'bookmark'
][
'nodata'
],
' '
]
});
}
self
.
bookmark_grid
.
clearAll
();
self
.
bookmark_grid
.
parse
({
'rows'
:
data
},
'json'
);
}
addBookMarks
()
{
let
self
=
this
;
let
hash
=
+
new
Date
();
let
index
=
layer
.
prompt
({
title
:
`<i class="fa fa-bookmark"></i>
${
LANG
[
'filemanager'
][
'bookmark'
][
'add'
][
'title'
]}
`
,
content
:
'<input type="text" style="width:300px;" class="layui-layer-input" id="bname_'
+
hash
+
'" value="" placeholder="bookmark name"><p/><input style="width:300px;" type="text" id="bpath_'
+
hash
+
'" class="layui-layer-input" value="" placeholder="bookmark path">'
,
btn
:
[
LANG
[
'filemanager'
][
'bookmark'
][
'add'
][
'addbtn'
]],
yes
:
(
i
)
=>
{
let
_bname
=
$
(
`#bname_
${
hash
}
`
);
let
_bpath
=
$
(
`#bpath_
${
hash
}
`
);
let
bname
=
_bname
.
val
();
let
bpath
=
_bpath
.
val
();
let
gbm
=
self
.
filemanager_settings
.
bookmarks
;
if
(
gbm
.
hasOwnProperty
(
bname
))
{
_bname
.
focus
();
return
toastr
.
warning
(
LANG
[
'filemanager'
][
'bookmark'
][
'add'
][
'namedup'
],
LANG_T
[
'warning'
]);
}
bpath
=
bpath
.
replace
(
/
\\
/g
,
'/'
);
if
(
!
bpath
.
endsWith
(
'/'
))
{
bpath
+=
'/'
;
}
gbm
[
bname
]
=
bpath
;
self
.
filemanager_settings
.
bookmarks
=
gbm
;
antSword
[
'storage'
](
'adefault_filemanager'
,
self
.
filemanager_settings
);
self
.
reloadFMBookmarks
();
toastr
.
success
(
LANG
[
'filemanager'
][
'bookmark'
][
'add'
][
'success'
],
LANG_T
[
'success'
]);
layer
.
close
(
i
);
}
});
}
delBookMarks
(
ids
)
{
let
self
=
this
;
if
(
ids
.
length
===
1
&&
!
ids
[
0
])
{
return
}
layer
.
confirm
(
LANG
[
'filemanager'
][
'bookmark'
][
'del'
][
'confirm'
](
ids
.
length
>
1
?
ids
.
length
:
ids
[
0
]),
{
icon
:
2
,
shift
:
6
,
title
:
`<i class="fa fa-trash"></i>
${
LANG
[
'filemanager'
][
'bookmark'
][
'del'
][
'title'
]}
`
,
},
(
_
)
=>
{
layer
.
close
(
_
);
ids
.
map
((
p
)
=>
{
if
(
self
.
filemanager_settings
.
bookmarks
.
hasOwnProperty
(
p
))
{
delete
self
.
filemanager_settings
.
bookmarks
[
p
];
}
});
antSword
[
'storage'
](
'adefault_filemanager'
,
self
.
filemanager_settings
);
self
.
reloadFMBookmarks
();
toastr
.
success
(
LANG
[
'filemanager'
][
'bookmark'
][
'del'
][
'success'
],
LANG_T
[
'success'
]);
}
)
}
}
}
}
...
...
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