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
686e0399
Commit
686e0399
authored
Jun 17, 2017
by
LE GAC Renaud
Browse files
Add the plugin RowEditorUnlockStatusOk.
parent
16208cc7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
195 additions
and
14 deletions
+195
-14
modules/ui_core.py
modules/ui_core.py
+1
-0
static/app.js
static/app.js
+15
-14
static/limbra/locale/limbra-lang-fr.js
static/limbra/locale/limbra-lang-fr.js
+28
-0
static/limbra/src/grid/plugin/RowEditorUnlockStatusOk.js
static/limbra/src/grid/plugin/RowEditorUnlockStatusOk.js
+151
-0
No files found.
modules/ui_core.py
View file @
686e0399
...
...
@@ -330,6 +330,7 @@ class CoreUI(object):
mdf
.
configure
(
plugins
=
[
"pGridPaging"
,
"pMathJax"
,
"pGridRowEditorUnlockStatusOk"
,
{
"ptype"
:
"pGridRowEditorConfirmDelete"
,
"resetFields"
:
[
"PublicationsId_status"
,
"PublicationsOrigin"
]}])
...
...
static/app.js
View file @
686e0399
...
...
@@ -9,24 +9,25 @@ if (Dbui.debug) {
disableCaching
:
false
,
enabled
:
true
,
paths
:
{
'
Dbui
'
:
'
/
'
+
Dbui
.
name
+
'
/static/plugin_dbui/src
'
,
'
Ext
'
:
'
/
'
+
Dbui
.
name
+
'
/static/plugin_extjs/src
'
,
'
Limbra
'
:
'
/
'
+
Dbui
.
name
+
'
/static/limbra/src
'
"
Dbui
"
:
"
/
"
+
Dbui
.
name
+
"
/static/plugin_dbui/src
"
,
"
Ext
"
:
"
/
"
+
Dbui
.
name
+
"
/static/plugin_extjs/src
"
,
"
Limbra
"
:
"
/
"
+
Dbui
.
name
+
"
/static/limbra/src
"
}
});
}
Ext
.
require
(
'
Dbui.container.Viewport
'
);
Ext
.
require
(
'
Dbui.grid.plugin.RowEditorAddWizard
'
);
Ext
.
require
(
'
Dbui.plugin.MathJax
'
);
Ext
.
require
(
"
Dbui.container.Viewport
"
);
Ext
.
require
(
"
Dbui.grid.plugin.RowEditorAddWizard
"
);
Ext
.
require
(
"
Dbui.plugin.MathJax
"
);
Ext
.
require
(
'
Ext.direct.Manager
'
);
Ext
.
require
(
'
Ext.direct.RemotingProvider
'
);
Ext
.
require
(
'
Ext.EventManager
'
);
Ext
.
require
(
'
Ext.tip.QuickTipManager
'
);
Ext
.
require
(
"
Ext.direct.Manager
"
);
Ext
.
require
(
"
Ext.direct.RemotingProvider
"
);
Ext
.
require
(
"
Ext.EventManager
"
);
Ext
.
require
(
"
Ext.tip.QuickTipManager
"
);
Ext
.
require
(
'
Limbra.grid.plugin.AffiliationKeysContextMenu
'
);
Ext
.
require
(
'
Limbra.wizard.Harvester
'
);
Ext
.
require
(
"
Limbra.grid.plugin.AffiliationKeysContextMenu
"
);
Ext
.
require
(
"
Limbra.grid.plugin.RowEditorUnlockStatusOk
"
);
Ext
.
require
(
"
Limbra.wizard.Harvester
"
);
Ext
.
onReady
(
function
(){
...
...
@@ -50,8 +51,8 @@ Ext.onReady(function(){
// NOTE: It should work when the browser is closed to.
// Not working with FireFox 17.0.8, web2py 2.4.5 and Ext JS 3.4.0.
// nor with Firefox 38, web2py 2.14.6, Ext JS 6.0.1
Ext
.
getWin
().
on
(
'
beforeunload
'
,
Dbui
.
closeUserSession
);
Ext
.
getWin
().
on
(
"
beforeunload
"
,
Dbui
.
closeUserSession
);
// Instantiate the application
app
=
Ext
.
create
(
'
Dbui.container.Viewport
'
,
Dbui
.
config
.
viewport
);
app
=
Ext
.
create
(
"
Dbui.container.Viewport
"
,
Dbui
.
config
.
viewport
);
});
\ No newline at end of file
static/limbra/locale/limbra-lang-fr.js
View file @
686e0399
...
...
@@ -12,6 +12,34 @@ Ext.define('Limbra.local.fr.grid.plugin.AffiliationKeysContextMenu', {
});
Ext
.
define
(
"
Limbra.local.fr.grid.plugin.RowEditorUnlockStatusOk
"
,
{
override
:
'
Limbra.grid.plugin.RowEditorUnlockStatusOk
'
,
textConfirmation
:
"
Confirmation demandée
"
,
textError
:
"
Erreur
"
,
textErrorServer
:
"
Erreur coté serveur dans la procédure de
"
+
"
changement de status.
"
,
textFail
:
"
La valeur demandée est fausse.<br>
"
+
"
Essayer à nouveau.
"
,
textInformation
:
"
Information
"
,
textMsgConfirmation
:
"
La publication est verrouillée.<br>
"
+
"
Elle est donc protégée contre les modifications
"
+
"
ou la destruction.<br><br>
"
+
"
Entrez <font color='red'>XYZ</font>
"
+
"
pour déverrouiller la publication.<br>
"
+
"
Il sera alors possible de la modifier, de la détruire
"
+
"
ou de la verrouiller à nouveau.
"
,
textMsgInformation
:
"
La publication n'est pas verrouillée.<br>
"
+
"
Il est donc possible de la modifier ou de la
"
+
"
détruire à tous moments.
"
,
textSucess
:
"
La publication est déverrouillée.
"
,
textUnlock
:
"
Déverrouiller le status
"
,
});
Ext
.
define
(
'
Limbra.local.fr.wizard.AffiliationFromInstituteDb
'
,
{
override
:
'
Limbra.wizard.AffiliationFromInstituteDb
'
,
...
...
static/limbra/src/grid/plugin/RowEditorUnlockStatusOk.js
0 → 100644
View file @
686e0399
/**
* Add the entry 'Unlock status' in the RowEditor context menu.
*
* The new entry allows to unlock publication marked OK by resetting
* the status to undefined. A confirmation by the user is required.
*
* @since 0.9.6.5
*
*/
Ext
.
define
(
"
Limbra.grid.plugin.RowEditorUnlockStatusOk
"
,
{
extend
:
"
Ext.AbstractPlugin
"
,
alias
:
"
plugin.pGridRowEditorUnlockStatusOk
"
,
/**
* @cfg {Number}
* Identifier of the status OK defined in the database.
*
*/
idStatusOk
:
3
,
// shotcuts
rowEditor
:
null
,
// private properties for internationalization
textConfirmation
:
"
Confirmation required
"
,
textError
:
"
Error
"
,
textErrorServer
:
"
Error on the server changing the status.
"
,
textFail
:
"
Confirmation value is wrong.<br>
"
+
"
Try again.
"
,
textInformation
:
"
Information
"
,
textMsgConfirmation
:
"
The publication is locked.<br>
"
+
"
It is, therefore, protected against modification
"
+
"
or removal.<br><br>
"
+
"
Please type <font color='red'>XYZ</font>
"
+
"
to unlock the publication.<br>
"
+
"
Latter on, you can modify it, delete it
"
+
"
or lock it again.
"
,
textMsgInformation
:
"
The publication is not locked.<br>
"
+
"
Therefore, you can modify or delete it at any time.
"
,
textSucess
:
"
The publication is unlocked.
"
,
textUnlock
:
"
Unlock status
"
,
/**
* Initialize the plugin.
*
* @param {Dbui.grid.Panel} grid
*/
init
:
function
(
grid
)
{
"
use strict
"
;
var
me
=
this
,
rowEditor
=
grid
.
getPlugin
(
"
rowEditor
"
),
contextMenu
,
newItems
;
me
.
setCmp
(
grid
);
// protection
if
(
!
rowEditor
)
{
throw
new
Error
(
"
no grid plugin RowEditor !!!
"
);
}
contextMenu
=
grid
.
findPlugin
(
"
pGridRowEditorContextMenu
"
);
if
(
!
contextMenu
)
{
throw
new
Error
(
"
no grid plugin RowEditorContextMenu !!!
"
);
}
// the new item
newItems
=
[
"
-
"
,
{
text
:
me
.
textUnlock
,
handler
:
me
.
onUnlock
,
scope
:
me
}];
contextMenu
.
menu
.
insert
(
-
1
,
newItems
);
me
.
rowEditor
=
rowEditor
;
},
/**
* 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)
*
*/
onUnlock
:
function
()
{
"
use strict
"
;
var
me
=
this
,
record
=
me
.
rowEditor
.
getSelected
(),
ask
,
iAuth
,
idStatus
,
msg
,
myAuthors
;
if
(
!
record
)
{
return
;
}
idStatus
=
record
.
get
(
"
PublicationsId_status
"
);
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.
myAuthors
=
record
.
get
(
"
PublicationsAuthors_institute
"
).
split
(
"
,
"
);
iAuth
=
Math
.
floor
(
Math
.
random
()
*
(
myAuthors
.
length
-
1
));
ask
=
myAuthors
[
iAuth
].
split
(
"
"
);
ask
=
ask
[
ask
.
length
-
1
];
msg
=
me
.
textMsgConfirmation
.
replace
(
"
XYZ
"
,
ask
);
// confirmation process
// modify the status when the 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
// using callback.
Ext
.
Msg
.
prompt
(
me
.
textConfirmation
,
msg
,
function
(
buttonId
,
value
)
{
if
(
buttonId
!==
"
ok
"
)
{
return
;
}
if
(
value
!==
ask
)
{
Ext
.
Msg
.
alert
(
me
.
textError
,
me
.
textFail
);
return
;
}
Ext
.
Ajax
.
request
({
// go back to server to bypass protection on the status
url
:
"
/
"
+
Dbui
.
name
+
"
/publications/unlock_status?id=
"
+
record
.
get
(
"
PublicationsId
"
),
// something went wrong on the server side, inform the user
failure
:
function
()
{
Ext
.
Msg
.
alert
(
me
.
textError
,
me
.
textErrorServer
);
},
// refresh the store when the transaction is successful
success
:
function
()
{
me
.
getCmp
().
getStore
().
reload
();
}
});
});
}
});
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