You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey wanted to know how the custom search method will be integrated the wiki document does not have enough explanation of how the custom searches will be called in the backend bind using PHP I have pasted my custom methods below but it does not return the files object when search input will entered.
Front view js code:
<script>
define('elFinderConfig', {
// elFinder options (REQUIRED)
// Documentation for client options:
// https://github.com/Studio-42/elFinder/wiki/Client-configuration-options
defaultOpts: {
url: '<?php echo $connector ?>' // connector URL (REQUIRED)
,
commandsOptions: {
edit: {
extraOptions: {
// set API key to enable Creative Cloud image editor
// see https://console.adobe.io/
creativeCloudApiKey: '',
// browsing manager URL for CKEditor, TinyMCE
// uses self location with the empty value
managerUrl: ''
}
},
quicklook: {
// to enable preview with Google Docs Viewer
googleDocsMimes: ['application/pdf', 'image/tiff', 'application/vnd.ms-office', 'application/msword', 'application/vnd.ms-word', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']
},
help : { view : ['about', 'shortcuts', 'help'] },
search : {
// Additional search types
searchTypes : {
// Custom search types configuration
Custom : {
name : 'Meta Data',
title : 'Do serach contents of meta data.'
}
}
}
}
// bootCalback calls at before elFinder boot up
,
bootCallback: function(fm, extraObj) {
/* any bind functions etc. */
fm.bind('init', function() {
// any your code
// custom search bind function
});
// Add the new bind function here
fm.bind('search', function(e) {
console.log(e);
});
// for example set document.title dynamically.
var title = document.title;
fm.bind('open', function() {
var path = '',
cwd = fm.cwd();
if (cwd) {
path = fm.path(cwd.hash) || null;
}
document.title = path ? path + ':' + title : title;
}).bind('destroy', function() {
document.title = title;
});
}
},
managers: {
// 'DOM Element ID': { /* elFinder options of this DOM Element */ }
'elfinder': {}
}
});
define('returnVoid', void 0);
(function() {
var // elFinder version
elver = '<?php echo elFinder::getApiFullVersion() ?>',
// jQuery and jQueryUI version
jqver = '3.2.1',
uiver = '1.12.1',
// Start elFinder (REQUIRED)
start = function(elFinder, editors, config) {
// load jQueryUI CSS
elFinder.prototype.loadCss('//cdnjs.cloudflare.com/ajax/libs/jqueryui/' + uiver + '/themes/smoothness/jquery-ui.css');
$(function() {
var elfEditorCustomData = {};
if (typeof(csrfData) !== 'undefined') {
elfEditorCustomData[csrfData['token_name']] = csrfData['hash'];
}
var optEditors = {
commandsOptions: {
edit: {
editors: Array.isArray(editors) ? editors : []
}
}
},
opts = {
height: 700,
customData: elfEditorCustomData,
contextmenu: {
files: [
'getfile', '|', 'open', 'quicklook', '|', 'download', '|', 'copy', 'cut', 'paste', 'duplicate', '|',
'rm', '|', 'edit', 'rename', '|', 'archive', 'extract'
]
},
// https://github.com/Studio-42/elFinder/wiki/Client-configuration-options-2.1#ui
// Removes Places
ui: ['toolbar', 'tree', 'path', 'stat'],
uiOptions: {
// toolbar configuration
toolbar: [
['back', 'forward'],
['mkdir', 'mkfile', 'upload'],
['open', 'download', 'getfile'],
['quicklook'],
['copy', 'paste'],
['rm'],
['duplicate', 'rename', 'edit'],
['extract', 'archive'],
['search'],
['view'],
['info'],
['about']
],
},
// directories tree options
tree : {
// expand current root on init
openRootOnLoad : true,
// expand current work directory on open
openCwdOnOpen : true,
// auto load current dir parents
syncTree : true
// ,
// /**
// * Add CSS class name to navbar directories (optional)
// * see: https://github.com/Studio-42/elFinder/pull/1061,
// * https://github.com/Studio-42/elFinder/issues/1231
// *
// * @type Function
// */
// getClass: function(dir) {
// // e.g. This adds the directory's name (lowercase) with prefix as a CSS class
// return 'elfinder-tree-' + dir.name.replace(/[ "]/g, '').toLowerCase();
// }
},
};
// Interpretation of "elFinderConfig"
if (config && config.managers) {
$.each(config.managers, function(id, mOpts) {
opts = Object.assign(opts, config.defaultOpts || {});
// editors marges to opts.commandOptions.edit
try {
mOpts.commandsOptions.edit.editors = mOpts.commandsOptions.edit.editors.concat(editors || []);
} catch (e) {
Object.assign(mOpts, optEditors);
}
// Make elFinder
$('#' + id).elfinder(
// 1st Arg - options
$.extend(true, {
lang: '<?php echo get_media_locale($locale); ?>'
}, opts, mOpts || {}),
// 2nd Arg - before boot up function
function(fm, extraObj) {
// `init` event callback function
fm.bind('init', function() {
});
}
);
});
} else {
console.error('"elFinderConfig" object is wrong.');
}
});
},
// JavaScript loader (REQUIRED)
load = function() {
require(
[
'elfinder',
'extras/editors.default', // load text, image editors
'elFinderConfig'
// , 'extras/quicklook.googledocs' // optional preview for GoogleApps contents on the GoogleDrive volume
],
start,
function(error) {
alert(error.message);
}
);
},
// is IE8? for determine the jQuery version to use (optional)
ie8 = (typeof window.addEventListener === 'undefined' && typeof document.getElementsByClassName === 'undefined');
// config of RequireJS (REQUIRED)
require.config({
baseUrl: site_url + 'assets/plugins/elFinder/js',
paths: {
'jquery': '//cdnjs.cloudflare.com/ajax/libs/jquery/' + (ie8 ? '1.12.4' : jqver) + '/jquery.min',
'jquery-ui': '//cdnjs.cloudflare.com/ajax/libs/jqueryui/' + uiver + '/jquery-ui.min',
'elfinder': 'elfinder.min',
// 'encoding-japanese': '//cdn.rawgit.com/polygonplanet/encoding.js/master/encoding.min'
},
waitSeconds: 10 // optional
});
// load JavaScripts (REQUIRED)
load();
})();
</script>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey wanted to know how the custom search method will be integrated the wiki document does not have enough explanation of how the custom searches will be called in the backend bind using PHP I have pasted my custom methods below but it does not return the files object when search input will entered.
Front view js code:
Connection PHP:
Beta Was this translation helpful? Give feedback.
All reactions