mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 13:06:14 +00:00
make code theme independent, open confirm dialog for category change, check if category, user, docs are selected before opening confirm dialog
This commit is contained in:
parent
a2676573a6
commit
ec990ef1c5
|
@ -54,14 +54,12 @@ class SeedDMS_View_Search extends SeedDMS_Theme_Style {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
$('#export').on('click', function(e) {
|
$('#export').on('click', function(ev) {
|
||||||
e.preventDefault();
|
ev.preventDefault();
|
||||||
var url = "";
|
ev.stopPropagation();
|
||||||
url = $(this).attr('href')+'&includecontent='+($('#includecontent').prop('checked') ? '1' : '0');
|
var url = $(this).attr('href')+'&includecontent='+($('#includecontent').prop('checked') ? '1' : '0');
|
||||||
|
|
||||||
var inputs = $('input[name^=\"marks\"]');
|
|
||||||
var values = {};
|
var values = {};
|
||||||
inputs.each(function() {
|
$('input[name^=\"marks\"]').each(function() {
|
||||||
if(this.checked)
|
if(this.checked)
|
||||||
values[this.name] = 1;
|
values[this.name] = 1;
|
||||||
});
|
});
|
||||||
|
@ -69,83 +67,46 @@ $(document).ready( function() {
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#changecategory').on('click', function(e) {
|
$('#changecategory').on('click', function(ev) {
|
||||||
e.preventDefault();
|
ev.preventDefault();
|
||||||
var url = "";
|
ev.stopPropagation();
|
||||||
url = $(this).attr('href')+'&changecategory='+$('#batchcategory').val()+'&removecategory='+($('#removecategory').prop('checked') ? '1' : '0');
|
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
|
||||||
var inputs = $('input[name^=\"marks\"]');
|
var url = $(this).attr('href')+'&changecategory='+$('#batchcategory').val()+'&removecategory='+($('#removecategory').prop('checked') ? '1' : '0');
|
||||||
var values = {};
|
var values = {};
|
||||||
inputs.each(function() {
|
$('input[name^=\"marks\"]').each(function() {
|
||||||
if(this.checked)
|
if(this.checked)
|
||||||
values[this.name] = 1;
|
values[this.name] = 1;
|
||||||
});
|
});
|
||||||
url += '&'+$.param(values);
|
url += '&'+$.param(values);
|
||||||
window.location.href = url;
|
if($('#batchcategory').val() && Object.keys(values).length > 0) {
|
||||||
|
SeedDMSBox.redirect(url, {
|
||||||
|
'message': confirmmsg,
|
||||||
|
'cancelLabel': '<?= getMLText("cancel") ?>',
|
||||||
|
'confirmLabel': '<i class="fa fa-user"></i> <?= getMLText("batch_change_category") ?>'
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php if($this->getParam('theme') !== 'bootstrap4'): ?>
|
|
||||||
$('body').on('click', 'a.change-owner-btn', function(ev){
|
$('body').on('click', 'a.change-owner-btn', function(ev){
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
|
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
|
||||||
href = $(ev.currentTarget).attr('href');
|
href = $(ev.currentTarget).attr('href');
|
||||||
bootbox.dialog(confirmmsg, [{
|
var url = href+'&newowner='+($('#newowner').val());
|
||||||
"label" : "<i class='fa fa-user'></i> <?= getMLText("batch_change_owner") ?>",
|
var values = {};
|
||||||
"class" : "btn-danger",
|
$('input[name^=\"marks\"]').each(function() {
|
||||||
"callback": function() {
|
if(this.checked)
|
||||||
var url = "";
|
values[this.name] = 1;
|
||||||
url = href+'&newowner='+($('#newowner').val());
|
|
||||||
var inputs = $('input[name^=\"marks\"]');
|
|
||||||
var values = {};
|
|
||||||
inputs.each(function() {
|
|
||||||
if(this.checked)
|
|
||||||
values[this.name] = 1;
|
|
||||||
});
|
|
||||||
url += '&'+$.param(values);
|
|
||||||
window.location.href = url;
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"label" : "<?= getMLText("cancel") ?>",
|
|
||||||
"class" : "btn-cancel",
|
|
||||||
"callback": function() {
|
|
||||||
}
|
|
||||||
}]);
|
|
||||||
});
|
|
||||||
<?php else: ?>
|
|
||||||
$('body').on('click', 'a.change-owner-btn', function(ev){
|
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
|
|
||||||
href = $(ev.currentTarget).attr('href');
|
|
||||||
bootbox.confirm({
|
|
||||||
"message": confirmmsg,
|
|
||||||
"buttons": {
|
|
||||||
"confirm": {
|
|
||||||
"label" : "<i class='fa fa-user'></i> <?= getMLText("batch_change_owner") ?>",
|
|
||||||
"className" : "btn-danger",
|
|
||||||
},
|
|
||||||
"cancel": {
|
|
||||||
"label" : " <?= getMLText("cancel") ?>",
|
|
||||||
"className" : "btn-secondary",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"callback": function(result) {
|
|
||||||
if(result) {
|
|
||||||
var url = "";
|
|
||||||
url = href+'&newowner='+($('#newowner').val());
|
|
||||||
var inputs = $('input[name^=\"marks\"]');
|
|
||||||
var values = {};
|
|
||||||
inputs.each(function() {
|
|
||||||
if(this.checked)
|
|
||||||
values[this.name] = 1;
|
|
||||||
});
|
|
||||||
url += '&'+$.param(values);
|
|
||||||
window.location.href = url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
url += '&'+$.param(values);
|
||||||
|
if($('#newowner').val() && Object.keys(values).length > 0) {
|
||||||
|
SeedDMSBox.redirect(url, {
|
||||||
|
'message': confirmmsg,
|
||||||
|
'cancelLabel': '<?= getMLText("cancel") ?>',
|
||||||
|
'confirmLabel': '<i class="fa fa-user"></i> <?= getMLText("batch_change_owner") ?>'
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
<?php endif; ?>
|
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
// $this->printFolderChooserJs("form1");
|
// $this->printFolderChooserJs("form1");
|
||||||
|
@ -1386,7 +1347,6 @@ $(document).ready(function() {
|
||||||
ob_start();
|
ob_start();
|
||||||
$users = $dms->getAllUsers();
|
$users = $dms->getAllUsers();
|
||||||
$options = array();
|
$options = array();
|
||||||
$options[] = array("-1", getMLText("choose_user"));
|
|
||||||
foreach ($users as $currUser) {
|
foreach ($users as $currUser) {
|
||||||
$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin().' - '.$currUser->getFullName()), false, array(array('data-subtitle', htmlspecialchars($currUser->getEmail()))));
|
$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin().' - '.$currUser->getFullName()), false, array(array('data-subtitle', htmlspecialchars($currUser->getEmail()))));
|
||||||
}
|
}
|
||||||
|
@ -1397,6 +1357,7 @@ $(document).ready(function() {
|
||||||
'id'=>'newowner',
|
'id'=>'newowner',
|
||||||
'class'=>'chzn-select',
|
'class'=>'chzn-select',
|
||||||
'options'=>$options,
|
'options'=>$options,
|
||||||
|
'allow_empty'=>true,
|
||||||
'placeholder'=>getMLText('select_users'),
|
'placeholder'=>getMLText('select_users'),
|
||||||
'attributes'=>array(array('style', 'width: 100%;'))
|
'attributes'=>array(array('style', 'width: 100%;'))
|
||||||
)
|
)
|
||||||
|
@ -1412,7 +1373,6 @@ $(document).ready(function() {
|
||||||
$cats = $dms->getDocumentCategories();
|
$cats = $dms->getDocumentCategories();
|
||||||
if($cats) {
|
if($cats) {
|
||||||
$options = array();
|
$options = array();
|
||||||
$options[] = array("-1", getMLText("choose_category"));
|
|
||||||
foreach ($cats as $currcat) {
|
foreach ($cats as $currcat) {
|
||||||
$options[] = array($currcat->getID(), htmlspecialchars($currcat->getName()), false);
|
$options[] = array($currcat->getID(), htmlspecialchars($currcat->getName()), false);
|
||||||
}
|
}
|
||||||
|
@ -1424,6 +1384,7 @@ $(document).ready(function() {
|
||||||
'class'=>'chzn-select',
|
'class'=>'chzn-select',
|
||||||
'options'=>$options,
|
'options'=>$options,
|
||||||
'multiple'=>false,
|
'multiple'=>false,
|
||||||
|
'allow_empty'=>true,
|
||||||
'placeholder'=>getMLText('select_category'),
|
'placeholder'=>getMLText('select_category'),
|
||||||
'attributes'=>array(array('style', 'width: 100%;'))
|
'attributes'=>array(array('style', 'width: 100%;'))
|
||||||
)
|
)
|
||||||
|
@ -1438,7 +1399,7 @@ $(document).ready(function() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
print $this->html_link('Search', array_merge($_GET, array('action'=>'changecategory')), array('class'=>'btn btn-primary change-category-btn mt-4', 'id'=>'changecategory'), "<i class=\"fa fa-user\"></i> ".getMLText("batch_change_category"), false, true)."\n";
|
print $this->html_link('Search', array_merge($_GET, array('action'=>'changecategory')), array('class'=>'btn btn-primary change-category-btn mt-4', 'confirmmsg'=>htmlspecialchars(getMLText("confirm_change_category", array ()), ENT_QUOTES), 'id'=>'changecategory'), "<i class=\"fa fa-user\"></i> ".getMLText("batch_change_category"), false, true)."\n";
|
||||||
|
|
||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
$this->printAccordion(getMLText('batch_change_category'), $content);
|
$this->printAccordion(getMLText('batch_change_category'), $content);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user