I'm developing a small webapp on which I'm using elFinder, so users can browse some remote dirs.
The main problem I'm having is that I can open the root of the remote folder, but the objective is to have dedicated links directly to each folder.
Right now I'm using this code:
$(document).ready(function() {
var myCommands = elFinder.prototype._options.commands;
var disabled = ['extract', 'archive','home','quicklook','rm','duplicate','rename','mkdir','mkfile','copy','cut','paste','edit','archive','search','resize'];
$.each(disabled, function(i, cmd) {
(idx = $.inArray(cmd, myCommands)) !== -1 && myCommands.splice(idx,1);
});
var elf = $('#elfinder').elfinder({
url : 'elfinder/php/connector.php', // connector URL (REQUIRED)
width: 1024,
height: 768,
commands: myCommands,
}).elfinder('instance');
});
And my html is something like this:
<div id="modal_reuniaoproducao" class="modal container fade" tabindex="-1" style="display: none;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Responsive</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12 col-lg-12">
<div id="elfinder"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-default">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
Would it be possible with the same connector to change the folder I want to open on each modal?
How can I accomplish that?
I recommend you use the events system like is said in Bootstrap's documentation. For exemple, register the show event for each modal.
$('#modal_reuniaoproducao').on('show.bs.modal', function (e) {
// do something, in this case open elfinder.
var elf = $('#elfinder').elfinder({
url : 'elfinder/php/connector.php', // connector URL (REQUIRED)
width: 1024,
height: 768,
commands: myCommands,
}).elfinder('instance');
});
And you can send the "control" with method get to connector.php, like connector.php&folderState=1. Its just an example.
Don't forget to destroy clean modal body on close and clear elfinder instance so when you make another call to connector you have a "clean sheet".
I Hope it helps.