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
aad0c784
Commit
aad0c784
authored
Apr 30, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhance:Setting) 「默认设置」新增「数据管理」设置
parent
f701cbb1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
680 additions
and
18 deletions
+680
-18
CHANGELOG.md
CHANGELOG.md
+14
-0
package.json
package.json
+1
-1
en.js
source/language/en.js
+65
-0
zh.js
source/language/zh.js
+65
-0
zh_hk.js
source/language/zh_hk.js
+65
-0
zh_tw.js
source/language/zh_tw.js
+65
-0
adefault.js
source/modules/settings/adefault.js
+391
-16
contextmenu.js
source/modules/shellmanager/list/contextmenu.js
+14
-1
No files found.
CHANGELOG.md
View file @
aad0c784
...
@@ -8,6 +8,20 @@
...
@@ -8,6 +8,20 @@
*
修复 download multipart 发包时 download 发包为空的问题 (asunescape 功能引起)
*
修复 download multipart 发包时 download 发包为空的问题 (asunescape 功能引起)
### 数据管理
*
「添加数据」时自动载入「默认设置」中「数据管理」全局配置内容

### 其它
*
「默认设置」新增「数据管理」设置, 可配置「是否忽略HTTPS证书」、「默认请求超时时长」、「默认 HTTP Header」和「默认 HTTP Body」
> 该配置项仅在「添加数据」时生效,不影响已有配置的 Shell。在添加数据界面修改相应的值, 仅对当前 Shell 配置产生影响,不会影响到默认配置

## 2019/04/27 `v(2.1.1)`
## 2019/04/27 `v(2.1.1)`
### 核心模块
### 核心模块
...
...
package.json
View file @
aad0c784
{
{
"name"
:
"antsword"
,
"name"
:
"antsword"
,
"version"
:
"2.1.1"
,
"version"
:
"2.1.1
.2
"
,
"description"
:
"中国蚁剑是一款跨平台的开源网站管理工具"
,
"description"
:
"中国蚁剑是一款跨平台的开源网站管理工具"
,
"main"
:
"app.js"
,
"main"
:
"app.js"
,
"dependencies"
:
{
"dependencies"
:
{
...
...
source/language/en.js
View file @
aad0c784
...
@@ -835,6 +835,71 @@ Hot Keys:
...
@@ -835,6 +835,71 @@ Hot Keys:
success
:
'Edit success'
success
:
'Edit success'
}
}
},
},
},
shellmanager
:
{
title
:
'ShellManager'
,
header
:
{
title
:
'Default HTTP Headers'
,
nodata
:
'No HTTP Header data, click the right mouse button add'
,
grid
:
{
name
:
'Name'
,
value
:
'Vaule'
,
},
bmenu
:
{
add
:
'Add HTTP Header'
,
del
:
'Del HTTP Header'
},
add
:
{
title
:
'Add HTTP Header'
,
success
:
'Add success'
,
namedup
:
'The name cannot be duplicated'
,
name_invalid
:
'Name is invalid'
,
addbtn
:
'Confirm'
},
del
:
{
title
:
'Delete HTTP Header'
,
confirm
:
(
num
)
=>
antSword
.
noxss
(
`Are you sure to delete
${
typeof
(
num
)
===
'number'
?
num
+
' Headers'
:
num
+
" "
}
?`
),
success
:
'Delete success'
},
edit
:
{
namedup
:
'The name cannot be duplicated'
,
name_invalid
:
'Name is invalid'
,
success
:
'Edit success'
}
},
body
:
{
title
:
'Default HTTP Body'
,
nodata
:
'No HTTP Body data, click the right mouse button add'
,
grid
:
{
name
:
'Name'
,
value
:
'Value'
,
},
bmenu
:
{
add
:
'Add HTTP Body'
,
del
:
'Del HTTP Body'
},
add
:
{
title
:
'Add HTTP Body'
,
success
:
'Add success'
,
namedup
:
'The name cannot be duplicated'
,
name_invalid
:
'Name is invalid'
,
addbtn
:
'Confirm'
},
del
:
{
title
:
'Delete HTTP Body'
,
confirm
:
(
num
)
=>
antSword
.
noxss
(
`Are you sure to delete
${
typeof
(
num
)
===
'number'
?
num
+
' HTTP Body'
:
num
+
" "
}
?`
),
success
:
'Delete success'
},
edit
:
{
namedup
:
'The name cannot be duplicated'
,
name_invalid
:
'Name is invalid'
,
success
:
'Edit success'
}
},
other
:
{
nohttps
:
'Ignore HTTPS certificate'
,
requestTimeout
:
'Request timeout'
,
}
}
}
}
}
},
},
...
...
source/language/zh.js
View file @
aad0c784
...
@@ -837,6 +837,71 @@ module.exports = {
...
@@ -837,6 +837,71 @@ module.exports = {
success
:
'更新成功'
success
:
'更新成功'
}
}
},
},
},
shellmanager
:
{
title
:
'数据管理'
,
header
:
{
title
:
'默认请求头'
,
nodata
:
'暂无全局请求头, 请单击右键添加'
,
grid
:
{
name
:
'名称'
,
value
:
'值'
,
},
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
:
'更新成功'
}
},
body
:
{
title
:
'默认请求 Body'
,
nodata
:
'暂无默认Body, 请单击右键添加'
,
grid
:
{
name
:
'名称'
,
value
:
'值'
,
},
bmenu
:
{
add
:
'添加Body'
,
del
:
'删除Body'
},
add
:
{
title
:
'添加默认请求Body'
,
success
:
'添加成功'
,
namedup
:
'名称不能重复'
,
name_invalid
:
'名称不合法'
,
addbtn
:
'确定'
},
del
:
{
title
:
'删除默认请求头Body'
,
confirm
:
(
num
)
=>
antSword
.
noxss
(
`你确定要删除
${
typeof
(
num
)
===
'number'
?
num
+
' 个请求Body'
:
num
+
" "
}
吗?`
),
success
:
'删除成功'
},
edit
:
{
namedup
:
'名称不能重复'
,
name_invalid
:
'名称不合法'
,
success
:
'更新成功'
}
},
other
:
{
nohttps
:
'忽略HTTPS证书'
,
requestTimeout
:
'请求超时'
,
}
}
}
}
}
},
},
...
...
source/language/zh_hk.js
View file @
aad0c784
...
@@ -836,6 +836,71 @@ module.exports = {
...
@@ -836,6 +836,71 @@ module.exports = {
success
:
'更新成功'
success
:
'更新成功'
}
}
},
},
},
shellmanager
:
{
title
:
'數據管理'
,
header
:
{
title
:
'默認請求頭'
,
nodata
:
'暫無全局請求頭, 請單擊右鍵添加'
,
grid
:
{
name
:
'名稱'
,
value
:
'值'
,
},
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
:
'更新成功'
}
},
body
:
{
title
:
'默認請求 Body'
,
nodata
:
'暫無默認Body, 請單擊右鍵添加'
,
grid
:
{
name
:
'名稱'
,
value
:
'值'
,
},
bmenu
:
{
add
:
'添加Body'
,
del
:
'刪除Body'
},
add
:
{
title
:
'添加默認請求Body'
,
success
:
'添加成功'
,
namedup
:
'名稱不能重複'
,
name_invalid
:
'名稱不合法'
,
addbtn
:
'確定'
},
del
:
{
title
:
'刪除默認請求頭Body'
,
confirm
:
(
num
)
=>
antSword
.
noxss
(
`你確定要刪除
${
typeof
(
num
)
===
'number'
?
num
+
' 個請求Body'
:
num
+
" "
}
嗎?`
),
success
:
'刪除成功'
},
edit
:
{
namedup
:
'名稱不能重複'
,
name_invalid
:
'名稱不合法'
,
success
:
'更新成功'
}
},
other
:
{
nohttps
:
'忽略HTTPS證書'
,
requestTimeout
:
'請求超時'
,
}
}
}
}
}
},
},
...
...
source/language/zh_tw.js
View file @
aad0c784
...
@@ -836,6 +836,71 @@ module.exports = {
...
@@ -836,6 +836,71 @@ module.exports = {
success
:
'更新成功'
success
:
'更新成功'
}
}
},
},
},
shellmanager
:
{
title
:
'數據管理'
,
header
:
{
title
:
'默認請求頭'
,
nodata
:
'暫無全局請求頭, 請單擊右鍵添加'
,
grid
:
{
name
:
'名稱'
,
value
:
'值'
,
},
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
:
'更新成功'
}
},
body
:
{
title
:
'默認請求 Body'
,
nodata
:
'暫無默認Body, 請單擊右鍵添加'
,
grid
:
{
name
:
'名稱'
,
value
:
'值'
,
},
bmenu
:
{
add
:
'添加Body'
,
del
:
'刪除Body'
},
add
:
{
title
:
'添加默認請求Body'
,
success
:
'添加成功'
,
namedup
:
'名稱不能重複'
,
name_invalid
:
'名稱不合法'
,
addbtn
:
'確定'
},
del
:
{
title
:
'刪除默認請求頭Body'
,
confirm
:
(
num
)
=>
antSword
.
noxss
(
`你確定要刪除
${
typeof
(
num
)
===
'number'
?
num
+
' 個請求Body'
:
num
+
" "
}
嗎?`
),
success
:
'刪除成功'
},
edit
:
{
namedup
:
'名稱不能重複'
,
name_invalid
:
'名稱不合法'
,
success
:
'更新成功'
}
},
other
:
{
nohttps
:
'忽略HTTPS證書'
,
requestTimeout
:
'請求超時'
,
}
}
}
}
}
},
},
...
...
source/modules/settings/adefault.js
View file @
aad0c784
...
@@ -22,6 +22,14 @@ class ADefault {
...
@@ -22,6 +22,14 @@ class ADefault {
database
:
{
database
:
{
bookmarks
:
{},
bookmarks
:
{},
},
},
shellmanager
:
{
headers
:
{},
bodys
:
{},
others
:
{
"ignore-https"
:
0
,
"request-timeout"
:
'10000'
,
},
}
};
};
// 读取配置
// 读取配置
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
)));
...
@@ -36,6 +44,17 @@ class ADefault {
...
@@ -36,6 +44,17 @@ class ADefault {
this
.
database_settings
.
bookmarks
=
default_config
.
database
.
bookmarks
;
this
.
database_settings
.
bookmarks
=
default_config
.
database
.
bookmarks
;
}
}
const
shellmanager_settings
=
JSON
.
parse
(
antSword
[
'storage'
](
"adefault_shellmanager"
,
false
,
JSON
.
stringify
(
default_config
.
shellmanager
)));
this
.
shellmanager_settings
=
shellmanager_settings
;
if
(
!
this
.
shellmanager_settings
.
headers
)
{
this
.
shellmanager_settings
.
headers
=
default_config
.
shellmanager
.
headers
;
}
if
(
!
this
.
shellmanager_settings
.
bodys
)
{
this
.
shellmanager_settings
.
bodys
=
default_config
.
shellmanager
.
bodys
;
}
if
(
!
this
.
shellmanager_settings
.
others
)
{
this
.
shellmanager_settings
.
others
=
default_config
.
shellmanager
.
others
;
}
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'
}
...
@@ -70,6 +89,34 @@ class ADefault {
...
@@ -70,6 +89,34 @@ class ADefault {
{
type
:
'container'
,
name
:
'database_bookmarks'
,
inputWidth
:
600
,
inputHeight
:
200
},
{
type
:
'container'
,
name
:
'database_bookmarks'
,
inputWidth
:
600
,
inputHeight
:
200
},
]},
]},
]
]
},
{
type
:
'fieldset'
,
label
:
`<i class="fa fa-th-large"></i>
${
LANG
[
'shellmanager'
][
'title'
]}
`
,
list
:
[
{
type
:
'block'
,
list
:
[
{
type
:
'checkbox'
,
position
:
'label-right'
,
name
:
'shellmanager_ignore-https'
,
label
:
LANG
[
'shellmanager'
][
'other'
][
'nohttps'
],
checked
:
self
.
shellmanager_settings
.
others
[
'ignore-https'
]
===
1
},
{
type
:
"label"
,
label
:
LANG
[
'shellmanager'
][
'other'
][
'requestTimeout'
]},
{
type
:
"combo"
,
position
:
'label-right'
,
label
:
'/ms'
,
inputWidth
:
100
,
name
:
"shellmanager_request-timeout"
,
options
:
((
items
)
=>
{
let
ret
=
[];
// 如果自定义的路径不在items里,则++
if
(
items
.
indexOf
(
self
.
shellmanager_settings
.
others
[
'request-timeout'
])
===
-
1
)
{
items
.
unshift
(
self
.
shellmanager_settings
.
others
[
'request-timeout'
]);
}
items
.
map
((
_
)
=>
{
ret
.
push
({
text
:
_
,
value
:
_
,
selected
:
self
.
shellmanager_settings
.
others
[
'request-timeout'
]
===
_
})
});
return
ret
;
})([
'5000'
,
'10000'
,
'30000'
,
'60000'
])},
{
type
:
'label'
,
label
:
LANG
[
'shellmanager'
][
'header'
][
'title'
]
},
{
type
:
'container'
,
name
:
'shellmanager_headers'
,
inputWidth
:
600
,
inputHeight
:
150
},
{
type
:
'label'
,
label
:
LANG
[
'shellmanager'
][
'body'
][
'title'
]
},
{
type
:
'container'
,
name
:
'shellmanager_bodys'
,
inputWidth
:
600
,
inputHeight
:
150
},
]},
]
},
},
// 后续其它模块
// 后续其它模块
]},
]},
...
@@ -87,14 +134,7 @@ class ADefault {
...
@@ -87,14 +134,7 @@ class ADefault {
bookmark_grid
.
setInitWidths
(
"40,*,200"
);
bookmark_grid
.
setInitWidths
(
"40,*,200"
);
bookmark_grid
.
setColAlign
(
"center,left,left"
);
bookmark_grid
.
setColAlign
(
"center,left,left"
);
bookmark_grid
.
enableMultiselect
(
true
);
bookmark_grid
.
enableMultiselect
(
true
);
// grid右键
// 空白数据右键fix
$
(
'.objbox'
).
on
(
'contextmenu'
,
(
e
)
=>
{
(
e
.
target
.
nodeName
===
'DIV'
&&
e
.
target
.
grid
===
bookmark_grid
&&
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
)
=>
{
bookmark_grid
.
attachEvent
(
'onRightClick'
,
(
id
,
lid
,
event
)
=>
{
let
_ids
=
(
bookmark_grid
.
getSelectedId
()
||
''
).
split
(
','
);
let
_ids
=
(
bookmark_grid
.
getSelectedId
()
||
''
).
split
(
','
);
if
(
id
===
-
1
)
{
if
(
id
===
-
1
)
{
...
@@ -169,14 +209,6 @@ class ADefault {
...
@@ -169,14 +209,6 @@ class ADefault {
db_bookmark_grid
.
setColAlign
(
"center,left,left"
);
db_bookmark_grid
.
setColAlign
(
"center,left,left"
);
db_bookmark_grid
.
enableMultiselect
(
true
);
db_bookmark_grid
.
enableMultiselect
(
true
);
// grid右键
// 空白数据右键fix
$
(
'.objbox'
).
on
(
'contextmenu'
,
(
e
)
=>
{
(
e
.
target
.
nodeName
===
'DIV'
&&
e
.
target
.
grid
===
db_bookmark_grid
&&
db_bookmark_grid
.
callEvent
instanceof
Function
&&
antSword
[
'tabbar'
].
getActiveTab
()
===
"tab_about"
&&
sidebar
.
getActiveItem
()
===
"adefault"
)
?
db_bookmark_grid
.
callEvent
(
'onRightClick'
,
[
-
1
,
-
1
,
e
])
:
null
;
});
$
(
'.objbox'
).
on
(
'click'
,
(
e
)
=>
{
bmenu
.
hide
();
});
db_bookmark_grid
.
attachEvent
(
'onRightClick'
,
(
id
,
lid
,
event
)
=>
{
db_bookmark_grid
.
attachEvent
(
'onRightClick'
,
(
id
,
lid
,
event
)
=>
{
let
_ids
=
(
db_bookmark_grid
.
getSelectedId
()
||
''
).
split
(
','
);
let
_ids
=
(
db_bookmark_grid
.
getSelectedId
()
||
''
).
split
(
','
);
if
(
id
===
-
1
)
{
if
(
id
===
-
1
)
{
...
@@ -242,10 +274,16 @@ class ADefault {
...
@@ -242,10 +274,16 @@ class ADefault {
config
.
filemanager
.
bookmarks
=
self
.
filemanager_settings
.
bookmarks
;
config
.
filemanager
.
bookmarks
=
self
.
filemanager_settings
.
bookmarks
;
config
.
database
.
bookmarks
=
self
.
database_settings
.
bookmarks
;
config
.
database
.
bookmarks
=
self
.
database_settings
.
bookmarks
;
config
.
shellmanager
.
headers
=
self
.
shellmanager_settings
.
headers
;
config
.
shellmanager
.
bodys
=
self
.
shellmanager_settings
.
bodys
;
config
.
shellmanager
.
others
[
"ignore-https"
]
=
_formvals
[
'shellmanager_ignore-https'
];
config
.
shellmanager
.
others
[
"request-timeout"
]
=
_formvals
[
'shellmanager_request-timeout'
];
// save
// save
// save 文件管理设置
// save 文件管理设置
antSword
[
'storage'
](
'adefault_filemanager'
,
config
.
filemanager
);
antSword
[
'storage'
](
'adefault_filemanager'
,
config
.
filemanager
);
antSword
[
'storage'
](
'adefault_database'
,
config
.
database
);
antSword
[
'storage'
](
'adefault_database'
,
config
.
database
);
antSword
[
'storage'
](
'adefault_shellmanager'
,
config
.
shellmanager
);
toastr
.
success
(
LANG
[
'success'
],
LANG_T
[
'success'
]);
toastr
.
success
(
LANG
[
'success'
],
LANG_T
[
'success'
]);
// 重启应用
// 重启应用
layer
.
confirm
(
LANG
[
'confirm'
][
'content'
],
{
layer
.
confirm
(
LANG
[
'confirm'
][
'content'
],
{
...
@@ -261,9 +299,168 @@ class ADefault {
...
@@ -261,9 +299,168 @@ class ADefault {
}
}
});
});
// 数据管理配置
// 请求 headers
let
shellmanager_headers_grid
=
new
dhtmlXGridObject
(
form
.
getContainer
(
'shellmanager_headers'
));
shellmanager_headers_grid
.
setHeader
(
`
,
${
LANG
[
'shellmanager'
][
'header'
][
'grid'
][
'name'
]}
,
${
LANG
[
'shellmanager'
][
'header'
][
'grid'
][
'value'
]}
`
);
shellmanager_headers_grid
.
setColTypes
(
"ro,edtxt,edtxt"
);
shellmanager_headers_grid
.
setColSorting
(
'str,str,str'
);
shellmanager_headers_grid
.
setInitWidths
(
"40,200,*"
);
shellmanager_headers_grid
.
setColAlign
(
"center,left,left"
);
shellmanager_headers_grid
.
enableMultiselect
(
true
);
shellmanager_headers_grid
.
attachEvent
(
'onRightClick'
,
(
id
,
lid
,
event
)
=>
{
let
_ids
=
(
shellmanager_headers_grid
.
getSelectedId
()
||
''
).
split
(
','
);
if
(
id
===
-
1
)
{
_ids
=
[];
}
else
if
(
_ids
.
length
===
1
)
{
// 如果没有选中?则选中右键对应选项
shellmanager_headers_grid
.
selectRowById
(
id
);
_ids
=
[
id
];
};
let
ids
=
[];
_ids
.
map
((
_
)
=>
{
ids
.
push
(
shellmanager_headers_grid
.
getRowAttribute
(
_
,
'bname'
));
});
id
=
ids
[
0
]
||
''
;
let
menu
=
[
{
text
:
LANG
[
'shellmanager'
][
'header'
][
'bmenu'
][
'add'
],
icon
:
'fa fa-plus-circle'
,
action
:
self
.
addShellmanagerHeaders
.
bind
(
self
)},
{
text
:
LANG
[
'shellmanager'
][
'header'
][
'bmenu'
][
'del'
],
icon
:
'fa fa-trash-o'
,
action
:
()
=>
{
self
.
delShellmanagerHeaders
(
ids
);
}},
];
bmenu
(
menu
,
event
);
return
true
;
});
shellmanager_headers_grid
.
attachEvent
(
"onEditCell"
,
function
(
stage
,
rId
,
cInd
,
nValue
,
oValue
){
// 2 编辑完成
if
(
stage
===
2
)
{
if
(
nValue
===
oValue
){
return
;}
var
obname
=
shellmanager_headers_grid
.
getRowAttribute
(
rId
,
"bname"
);
var
obpath
=
shellmanager_headers_grid
.
getRowAttribute
(
rId
,
"bvalue"
);
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
.
shellmanager_settings
.
headers
.
hasOwnProperty
(
obname
)){
delete
self
.
shellmanager_settings
.
headers
[
obname
];
self
.
shellmanager_settings
.
headers
[
nValue
]
=
obpath
;
}
toastr
.
success
(
LANG
[
"shellmanager"
][
'header'
][
'edit'
][
"success"
],
LANG_T
[
"success"
]);
break
;
case
2
:
// value
if
(
self
.
shellmanager_settings
.
headers
.
hasOwnProperty
(
obname
)){
self
.
shellmanager_settings
.
headers
[
obname
]
=
nValue
;
}
break
;
}
antSword
[
'storage'
](
'adefault_shellmanager'
,
self
.
shellmanager_settings
);
self
.
reloadShellmanagerHeaders
();
}
});
shellmanager_headers_grid
.
init
();
this
.
shellmanager_headers_grid
=
shellmanager_headers_grid
;
// 请求Body
let
shellmanager_bodys_grid
=
new
dhtmlXGridObject
(
form
.
getContainer
(
'shellmanager_bodys'
));
shellmanager_bodys_grid
.
setHeader
(
`
,
${
LANG
[
'shellmanager'
][
'body'
][
'grid'
][
'name'
]}
,
${
LANG
[
'shellmanager'
][
'body'
][
'grid'
][
'value'
]}
`
);
shellmanager_bodys_grid
.
setColTypes
(
"ro,edtxt,edtxt"
);
shellmanager_bodys_grid
.
setColSorting
(
'str,str,str'
);
shellmanager_bodys_grid
.
setInitWidths
(
"40,200,*"
);
shellmanager_bodys_grid
.
setColAlign
(
"center,left,left"
);
shellmanager_bodys_grid
.
enableMultiselect
(
true
);
shellmanager_bodys_grid
.
attachEvent
(
'onRightClick'
,
(
id
,
lid
,
event
)
=>
{
let
_ids
=
(
shellmanager_bodys_grid
.
getSelectedId
()
||
''
).
split
(
','
);
if
(
id
===
-
1
)
{
_ids
=
[];
}
else
if
(
_ids
.
length
===
1
)
{
// 如果没有选中?则选中右键对应选项
shellmanager_bodys_grid
.
selectRowById
(
id
);
_ids
=
[
id
];
};
let
ids
=
[];
_ids
.
map
((
_
)
=>
{
ids
.
push
(
shellmanager_bodys_grid
.
getRowAttribute
(
_
,
'bname'
));
});
id
=
ids
[
0
]
||
''
;
let
menu
=
[
{
text
:
LANG
[
'shellmanager'
][
'body'
][
'bmenu'
][
'add'
],
icon
:
'fa fa-plus-circle'
,
action
:
self
.
addShellmanagerBodys
.
bind
(
self
)},
{
text
:
LANG
[
'shellmanager'
][
'body'
][
'bmenu'
][
'del'
],
icon
:
'fa fa-trash-o'
,
action
:
()
=>
{
self
.
delShellmanagerBodys
(
ids
);
}},
];
bmenu
(
menu
,
event
);
return
true
;
});
shellmanager_bodys_grid
.
attachEvent
(
"onEditCell"
,
function
(
stage
,
rId
,
cInd
,
nValue
,
oValue
){
// 2 编辑完成
if
(
stage
===
2
)
{
if
(
nValue
===
oValue
){
return
;}
var
obname
=
shellmanager_bodys_grid
.
getRowAttribute
(
rId
,
"bname"
);
var
obpath
=
shellmanager_bodys_grid
.
getRowAttribute
(
rId
,
"bvalue"
);
switch
(
cInd
){
// 具体是哪一列被编辑了
case
1
:
// name
// if(!nValue.match(/^[a-zA-Z0-9_/]+$/)){
// toastr.error(LANG["shellmanager"]['body']['edit']["name_invalid"], LANG_T['error']);
// return
// }
if
(
self
.
shellmanager_settings
.
bodys
.
hasOwnProperty
(
obname
)){
delete
self
.
shellmanager_settings
.
bodys
[
obname
];
self
.
shellmanager_settings
.
bodys
[
nValue
]
=
obpath
;
}
toastr
.
success
(
LANG
[
"shellmanager"
][
'body'
][
'edit'
][
"success"
],
LANG_T
[
"success"
]);
break
;
case
2
:
// path
if
(
self
.
shellmanager_settings
.
bodys
.
hasOwnProperty
(
obname
)){
self
.
shellmanager_settings
.
bodys
[
obname
]
=
nValue
;
}
break
;
}
antSword
[
'storage'
](
'adefault_shellmanager'
,
self
.
shellmanager_settings
);
self
.
reloadShellmanagerBodys
();
}
});
shellmanager_bodys_grid
.
init
();
this
.
shellmanager_bodys_grid
=
shellmanager_bodys_grid
;
// grid右键
[
bookmark_grid
,
db_bookmark_grid
,
shellmanager_headers_grid
,
shellmanager_bodys_grid
].
forEach
((
g
)
=>
{
// 空白数据右键fix
$
(
'.objbox'
).
on
(
'contextmenu'
,
(
e
)
=>
{
(
e
.
target
.
nodeName
===
'DIV'
&&
e
.
target
.
grid
===
g
&&
g
.
callEvent
instanceof
Function
&&
antSword
[
'tabbar'
].
getActiveTab
()
===
"tab_about"
&&
sidebar
.
getActiveItem
()
===
"adefault"
)
?
g
.
callEvent
(
'onRightClick'
,
[
-
1
,
-
1
,
e
])
:
null
;
});
});
$
(
'.objbox'
).
on
(
'click'
,
(
e
)
=>
{
bmenu
.
hide
();
});
this
.
reloadFMBookmarks
();
this
.
reloadFMBookmarks
();
this
.
reloadDatabaseBookmarks
();
this
.
reloadDatabaseBookmarks
();
this
.
reloadShellManager
();
}
}
reloadShellManager
()
{
this
.
reloadShellmanagerHeaders
();
this
.
reloadShellmanagerBodys
();
}
// 重载 bookmarks grid
// 重载 bookmarks grid
reloadFMBookmarks
(){
reloadFMBookmarks
(){
let
self
=
this
;
let
self
=
this
;
...
@@ -449,6 +646,184 @@ class ADefault {
...
@@ -449,6 +646,184 @@ class ADefault {
}
}
)
)
}
}
// 重载 shellmanager headers grid
reloadShellmanagerHeaders
(){
let
self
=
this
;
let
data
=
[];
let
_id
=
1
;
Object
.
keys
(
self
.
shellmanager_settings
.
headers
).
map
((
t
)
=>
{
data
.
push
({
id
:
_id
,
bname
:
t
,
bvalue
:
self
.
shellmanager_settings
.
headers
[
t
],
data
:
[
`<i class="fa fa-bookmark-o"></i>`
,
t
,
self
.
shellmanager_settings
.
headers
[
t
],
]
});
_id
++
;
});
if
(
data
.
length
==
0
){
data
.
push
({
id
:
_id
,
bname
:
''
,
bvalue
:
''
,
data
:
[
`<i class="fa fa-bookmark-o"></i>`
,
LANG
[
'shellmanager'
][
'header'
][
'nodata'
],
' '
]
});
}
self
.
shellmanager_headers_grid
.
clearAll
();
self
.
shellmanager_headers_grid
.
parse
({
'rows'
:
data
},
'json'
);
}
addShellmanagerHeaders
()
{
let
self
=
this
;
let
hash
=
+
new
Date
();
let
index
=
layer
.
prompt
({
title
:
`<i class="fa fa-bookmark"></i>
${
LANG
[
'shellmanager'
][
'header'
][
'add'
][
'title'
]}
`
,
content
:
'<input type="text" style="width:300px;" class="layui-layer-input" id="bname_'
+
hash
+
'" value="" placeholder="name"><p/><input style="width:300px;" type="text" id="bvalue_'
+
hash
+
'" class="layui-layer-input" value="" placeholder="value">'
,
btn
:
[
LANG
[
'shellmanager'
][
'header'
][
'add'
][
'addbtn'
]],
yes
:
(
i
)
=>
{
let
_bname
=
$
(
`#bname_
${
hash
}
`
);
let
_bvalue
=
$
(
`#bvalue_
${
hash
}
`
);
let
bname
=
_bname
.
val
();
let
bvalue
=
_bvalue
.
val
();
let
gbm
=
self
.
shellmanager_settings
.
headers
;
if
(
gbm
.
hasOwnProperty
(
bname
))
{
_bname
.
focus
();
return
toastr
.
warning
(
LANG
[
'shellmanager'
][
'header'
][
'add'
][
'namedup'
],
LANG_T
[
'warning'
]);
}
gbm
[
bname
]
=
bvalue
;
self
.
shellmanager_settings
.
headers
=
gbm
;
antSword
[
'storage'
](
'adefault_shellmanager'
,
self
.
shellmanager_settings
);
self
.
reloadShellmanagerHeaders
();
toastr
.
success
(
LANG
[
'shellmanager'
][
'header'
][
'add'
][
'success'
],
LANG_T
[
'success'
]);
layer
.
close
(
i
);
}
});
}
delShellmanagerHeaders
(
ids
)
{
let
self
=
this
;
if
(
ids
.
length
===
1
&&
!
ids
[
0
])
{
return
}
layer
.
confirm
(
LANG
[
'shellmanager'
][
'header'
][
'del'
][
'confirm'
](
ids
.
length
>
1
?
ids
.
length
:
ids
[
0
]),
{
icon
:
2
,
shift
:
6
,
title
:
`<i class="fa fa-trash"></i>
${
LANG
[
'shellmanager'
][
'header'
][
'del'
][
'title'
]}
`
,
},
(
_
)
=>
{
layer
.
close
(
_
);
ids
.
map
((
p
)
=>
{
if
(
self
.
shellmanager_settings
.
headers
.
hasOwnProperty
(
p
))
{
delete
self
.
shellmanager_settings
.
headers
[
p
];
}
});
antSword
[
'storage'
](
'adefault_shellmanager'
,
self
.
shellmanager_settings
);
self
.
reloadShellmanagerHeaders
();
toastr
.
success
(
LANG
[
'shellmanager'
][
'header'
][
'del'
][
'success'
],
LANG_T
[
'success'
]);
}
)
}
// 重载 shellmanager bodys grid
reloadShellmanagerBodys
(){
let
self
=
this
;
let
data
=
[];
let
_id
=
1
;
Object
.
keys
(
self
.
shellmanager_settings
.
bodys
).
map
((
t
)
=>
{
data
.
push
({
id
:
_id
,
bname
:
t
,
bvalue
:
self
.
shellmanager_settings
.
bodys
[
t
],
data
:
[
`<i class="fa fa-bookmark-o"></i>`
,
t
,
self
.
shellmanager_settings
.
bodys
[
t
],
]
});
_id
++
;
});
if
(
data
.
length
==
0
){
data
.
push
({
id
:
_id
,
bname
:
''
,
bvalue
:
''
,
data
:
[
`<i class="fa fa-bookmark-o"></i>`
,
LANG
[
'shellmanager'
][
'body'
][
'nodata'
],
' '
]
});
}
self
.
shellmanager_bodys_grid
.
clearAll
();
self
.
shellmanager_bodys_grid
.
parse
({
'rows'
:
data
},
'json'
);
}
addShellmanagerBodys
()
{
let
self
=
this
;
let
hash
=
+
new
Date
();
let
index
=
layer
.
prompt
({
title
:
`<i class="fa fa-bookmark"></i>
${
LANG
[
'shellmanager'
][
'body'
][
'add'
][
'title'
]}
`
,
content
:
'<input type="text" style="width:300px;" class="layui-layer-input" id="bname_'
+
hash
+
'" value="" placeholder="name"><p/><input style="width:300px;" type="text" id="bvalue_'
+
hash
+
'" class="layui-layer-input" value="" placeholder="value">'
,
btn
:
[
LANG
[
'shellmanager'
][
'body'
][
'add'
][
'addbtn'
]],
yes
:
(
i
)
=>
{
let
_bname
=
$
(
`#bname_
${
hash
}
`
);
let
_bvalue
=
$
(
`#bvalue_
${
hash
}
`
);
let
bname
=
_bname
.
val
();
let
bvalue
=
_bvalue
.
val
();
let
gbm
=
self
.
shellmanager_settings
.
bodys
;
if
(
gbm
.
hasOwnProperty
(
bname
))
{
_bname
.
focus
();
return
toastr
.
warning
(
LANG
[
'shellmanager'
][
'body'
][
'add'
][
'namedup'
],
LANG_T
[
'warning'
]);
}
gbm
[
bname
]
=
bvalue
;
self
.
shellmanager_settings
.
bodys
=
gbm
;
antSword
[
'storage'
](
'adefault_shellmanager'
,
self
.
shellmanager_settings
);
self
.
reloadShellmanagerBodys
();
toastr
.
success
(
LANG
[
'shellmanager'
][
'body'
][
'add'
][
'success'
],
LANG_T
[
'success'
]);
layer
.
close
(
i
);
}
});
}
delShellmanagerBodys
(
ids
)
{
let
self
=
this
;
if
(
ids
.
length
===
1
&&
!
ids
[
0
])
{
return
}
layer
.
confirm
(
LANG
[
'shellmanager'
][
'body'
][
'del'
][
'confirm'
](
ids
.
length
>
1
?
ids
.
length
:
ids
[
0
]),
{
icon
:
2
,
shift
:
6
,
title
:
`<i class="fa fa-trash"></i>
${
LANG
[
'shellmanager'
][
'body'
][
'del'
][
'title'
]}
`
,
},
(
_
)
=>
{
layer
.
close
(
_
);
ids
.
map
((
p
)
=>
{
if
(
self
.
shellmanager_settings
.
bodys
.
hasOwnProperty
(
p
))
{
delete
self
.
shellmanager_settings
.
bodys
[
p
];
}
});
antSword
[
'storage'
](
'adefault_shellmanager'
,
self
.
shellmanager_settings
);
self
.
reloadShellmanagerBodys
();
toastr
.
success
(
LANG
[
'shellmanager'
][
'body'
][
'del'
][
'success'
],
LANG_T
[
'success'
]);
}
)
}
}
}
module
.
exports
=
ADefault
;
module
.
exports
=
ADefault
;
source/modules/shellmanager/list/contextmenu.js
View file @
aad0c784
...
@@ -190,11 +190,24 @@ class ContextMenu {
...
@@ -190,11 +190,24 @@ class ContextMenu {
* 添加数据
* 添加数据
*/
*/
addData
()
{
addData
()
{
let
config
=
{
headers
:
{},
bodys
:
{},
others
:
{},
};
let
shellmanager_setting
=
JSON
.
parse
(
antSword
[
'storage'
](
"adefault_shellmanager"
,
false
,
JSON
.
stringify
(
config
)));
let
args
=
{
httpConf
:
{
headers
:
shellmanager_setting
.
headers
,
body
:
shellmanager_setting
.
bodys
,
},
otherConf
:
shellmanager_setting
.
others
||
{},
};
new
Form
({
new
Form
({
title
:
LANG
[
'list'
][
'add'
][
'title'
],
title
:
LANG
[
'list'
][
'add'
][
'title'
],
icon
:
'plus-circle'
,
icon
:
'plus-circle'
,
text
:
LANG
[
'list'
][
'add'
][
'toolbar'
][
'add'
]
text
:
LANG
[
'list'
][
'add'
][
'toolbar'
][
'add'
]
},
{}
,
(
data
)
=>
{
},
args
,
(
data
)
=>
{
return
new
Promise
((
res
,
rej
)
=>
{
return
new
Promise
((
res
,
rej
)
=>
{
// 获取当前分类
// 获取当前分类
data
[
'base'
][
'category'
]
=
antSword
.
modules
.
shellmanager
.
category
.
sidebar
.
getActiveItem
();
data
[
'base'
][
'category'
]
=
antSword
.
modules
.
shellmanager
.
category
.
sidebar
.
getActiveItem
();
...
...
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