mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-19 00:29:21 +01:00
- LSview : Utilisation de LSconfirmBox pour la confirmation de suppression.
This commit is contained in:
parent
66b1ea7916
commit
2377c265f9
3 changed files with 54 additions and 1 deletions
|
@ -9,6 +9,18 @@ var LSview = new Class({
|
|||
$$('td.LSobject-list-names').each(function(el) {
|
||||
el.addEvent('mouseleave',this.onTdLSobjectListNamesOut.bind(this,el));
|
||||
}, this);
|
||||
$$('a.LSobject-list-actions').each(function(el) {
|
||||
var checkRemove = /remove\.php.*/;
|
||||
if (checkRemove.exec(el.href)) {
|
||||
el.addEvent('click',this.onRemoveListBtnClick.bindWithEvent(this,el));
|
||||
}
|
||||
}, this);
|
||||
$$('a.LSview-actions').each(function(el) {
|
||||
var checkRemove = /remove\.php.*/;
|
||||
if (checkRemove.exec(el.href)) {
|
||||
el.addEvent('click',this.onRemoveViewBtnClick.bindWithEvent(this,el));
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
onTdLSobjectListNamesClick: function(td) {
|
||||
|
@ -23,6 +35,42 @@ var LSview = new Class({
|
|||
|
||||
onTdLSobjectListNamesOut: function(td) {
|
||||
td.imgEdit.destroy();
|
||||
},
|
||||
|
||||
onRemoveListBtnClick: function(event,a) {
|
||||
Event(event).stop();
|
||||
if (!this._confirmBoxOpen) {
|
||||
this._confirmBoxOpen = 1;
|
||||
var name = a.getParent().getPrevious('td').getElement('a').innerHTML;
|
||||
this.confirmBox = new LSconfirmBox({
|
||||
text: 'Etês-vous sur de vouloir supprimer "'+name+'" ?',
|
||||
startElement: a,
|
||||
onConfirm: this.removeFromA.bind(this,a),
|
||||
onClose: this.onConfirmBoxClose.bind(this)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onRemoveViewBtnClick: function(event,a) {
|
||||
Event(event).stop();
|
||||
if (!this._confirmBoxOpen) {
|
||||
this._confirmBoxOpen = 1;
|
||||
var name = $('LSview_title').innerHTML;
|
||||
this.confirmBox = new LSconfirmBox({
|
||||
text: 'Etês-vous sur de vouloir supprimer "'+name+'" ?',
|
||||
startElement: a,
|
||||
onConfirm: this.removeFromA.bind(this,a),
|
||||
onClose: this.onConfirmBoxClose.bind(this)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onConfirmBoxClose: function() {
|
||||
this._confirmBoxOpen = 0;
|
||||
},
|
||||
|
||||
removeFromA: function(a) {
|
||||
document.location = a.href+'&valid';
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{include file='top.tpl'}
|
||||
{if $pagetitle != ''}<h1>{$pagetitle}</h1>{/if}
|
||||
{if $pagetitle != ''}<h1 id='LSview_title'>{$pagetitle}</h1>{/if}
|
||||
{if $LSview_actions != ''}
|
||||
<ul class='LSview-actions'>
|
||||
{foreach from=$LSview_actions item=item}
|
||||
|
|
|
@ -120,6 +120,9 @@ if($LSsession -> startLSsession()) {
|
|||
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css');
|
||||
$GLOBALS['LSsession'] -> addJSscript('LSrelation.js');
|
||||
$GLOBALS['LSsession'] -> addCssFile('LSrelation.css');
|
||||
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js');
|
||||
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css');
|
||||
$GLOBALS['LSsession'] -> addJSscript('LSview.js');
|
||||
|
||||
if($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
|
||||
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
|
||||
|
@ -433,6 +436,8 @@ if($LSsession -> startLSsession()) {
|
|||
$GLOBALS['Smarty']->assign('LSobject_list_nbpage',$searchData['LSobject_list_nbpage']);
|
||||
}
|
||||
|
||||
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js');
|
||||
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css');
|
||||
$GLOBALS['LSsession'] -> addJSscript('LSview.js');
|
||||
|
||||
$GLOBALS['Smarty']->assign('LSview_search',array(
|
||||
|
|
Loading…
Reference in a new issue