Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
1b12fb82
Commit
1b12fb82
authored
Jun 18, 2017
by
LE GAC Renaud
Browse files
Update RowEditorUnlockStatusOk to polish the code.
parent
a7e85ca8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
static/limbra/src/grid/plugin/RowEditorUnlockStatusOk.js
static/limbra/src/grid/plugin/RowEditorUnlockStatusOk.js
+16
-9
No files found.
static/limbra/src/grid/plugin/RowEditorUnlockStatusOk.js
View file @
1b12fb82
...
...
@@ -19,6 +19,15 @@ Ext.define("Limbra.grid.plugin.RowEditorUnlockStatusOk", {
*/
idStatusOk
:
3
,
/**
* @cfg {String}
* URL to the controller which will change the status.
* The joker APP will be replace by the name of the application
* The parameter id is the publications identifier in the database.
*
*/
controller
:
"
/APP/publications/unlock_status?id=
"
,
// shotcuts
rowEditor
:
null
,
...
...
@@ -79,8 +88,7 @@ Ext.define("Limbra.grid.plugin.RowEditorUnlockStatusOk", {
/**
* Handler to unlock the publication.
* A confirmation by te user is required to unlock the publication.
* Technically, the status field is reset to 1 (undefined)
* A confirmation is required to unlock the publication.
*
*/
onUnlock
:
function
()
{
...
...
@@ -97,14 +105,14 @@ Ext.define("Limbra.grid.plugin.RowEditorUnlockStatusOk", {
idStatus
=
record
.
get
(
"
PublicationsId_status
"
);
// inform the user that there is nothing to do
if
(
idStatus
!==
me
.
idStatusOk
)
{
Ext
.
Msg
.
alert
(
me
.
textInformation
,
me
.
textMsgInformation
);
return
;
}
// build the confirmation key. It is the family name of one authors
// of my institute signing the publications.
// the name is chosen randomly.
// build the confirmation key. It is the family name of my authors
// selected randoly
myAuthors
=
record
.
get
(
"
PublicationsAuthors_institute
"
).
split
(
"
,
"
);
iAuth
=
Math
.
floor
(
Math
.
random
()
*
(
myAuthors
.
length
-
1
));
...
...
@@ -114,9 +122,9 @@ Ext.define("Limbra.grid.plugin.RowEditorUnlockStatusOk", {
msg
=
me
.
textMsgConfirmation
.
replace
(
"
XYZ
"
,
ask
);
// confirmation process
// modify the status when the value is equal to ask
// modify the status when the
entered
value is equal to ask
// the process is complex since the protection on the status
// have to be bypass. They are implemented at the database level
// have to be bypass
ed
. They are implemented at the database level
// using callback.
Ext
.
Msg
.
prompt
(
me
.
textConfirmation
,
msg
,
function
(
buttonId
,
value
)
{
...
...
@@ -132,8 +140,7 @@ Ext.define("Limbra.grid.plugin.RowEditorUnlockStatusOk", {
Ext
.
Ajax
.
request
({
// go back to server to bypass protection on the status
url
:
"
/
"
+
Dbui
.
name
+
"
/publications/unlock_status?id=
"
+
url
:
me
.
controller
.
replace
(
"
APP
"
,
Dbui
.
name
)
+
record
.
get
(
"
PublicationsId
"
),
// something went wrong on the server side, inform the user
...
...
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