Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
pve-manager
Commits
c410dce9
Commit
c410dce9
authored
Jun 23, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy button/Button.js from manager to manager5
parent
32bf884a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
Button.js
www/manager5/button/Button.js
+76
-0
No files found.
www/manager5/button/Button.js
0 → 100644
View file @
c410dce9
/* Button features:
* - observe selection changes to enable/disable the button using enableFn()
* - pop up confirmation dialog using confirmMsg()
*/
Ext
.
define
(
'
PVE.button.Button
'
,
{
extend
:
'
Ext.button.Button
'
,
alias
:
'
widget.pveButton
'
,
// the selection model to observe
selModel
:
undefined
,
// if 'false' handler will not be called (button disabled)
enableFn
:
function
(
record
)
{
},
// function(record) or text
confirmMsg
:
false
,
// take special care in confirm box (select no as default).
dangerous
:
false
,
initComponent
:
function
()
{
/*jslint confusion: true */
var
me
=
this
;
if
(
me
.
handler
)
{
me
.
realHandler
=
me
.
handler
;
me
.
handler
=
function
(
button
,
event
)
{
var
rec
,
msg
;
if
(
me
.
selModel
)
{
rec
=
me
.
selModel
.
getSelection
()[
0
];
if
(
!
rec
||
(
me
.
enableFn
(
rec
)
===
false
))
{
return
;
}
}
if
(
me
.
confirmMsg
)
{
msg
=
me
.
confirmMsg
;
if
(
Ext
.
isFunction
(
me
.
confirmMsg
))
{
msg
=
me
.
confirmMsg
(
rec
);
}
Ext
.
MessageBox
.
defaultButton
=
me
.
dangerous
?
2
:
1
;
Ext
.
Msg
.
show
({
title
:
gettext
(
'
Confirm
'
),
icon
:
me
.
dangerous
?
Ext
.
Msg
.
WARNING
:
Ext
.
Msg
.
QUESTION
,
msg
:
msg
,
buttons
:
Ext
.
Msg
.
YESNO
,
callback
:
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
me
.
realHandler
(
button
,
event
,
rec
);
}
});
}
else
{
me
.
realHandler
(
button
,
event
,
rec
);
}
};
}
me
.
callParent
();
if
(
me
.
selModel
)
{
me
.
mon
(
me
.
selModel
,
"
selectionchange
"
,
function
()
{
var
rec
=
me
.
selModel
.
getSelection
()[
0
];
if
(
!
rec
||
(
me
.
enableFn
(
rec
)
===
false
))
{
me
.
setDisabled
(
true
);
}
else
{
me
.
setDisabled
(
false
);
}
});
}
}
});
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