Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Commit

Permalink
jQuery adapter added
Browse files Browse the repository at this point in the history
  • Loading branch information
sunhater committed Aug 23, 2014
1 parent 00db0c0 commit 2a36d5a
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 57 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ KCFinder is free open-source replacement of CKFinder web file manager. It can be
* Ajax engine with JSON responses
* Multiple files upload
* Upload files using HTML5 drag and drop from local file manager
* Drag and drop images from external HTML pages. Multiple images can be dropped using selection (Firefox only)
* Download multiple files or a folder as single ZIP file
* Select multiple files with the Ctrl/Command key
* Clipboard for copying, moving and downloading multiple files
Expand All @@ -26,7 +27,7 @@ KCFinder is free open-source replacement of CKFinder web file manager. It can be
* Multilanguage system
* Preview images in full size

##Compatibility
## Compatibility
* KCFinder is officialy tested on Apache 2 web server only, but probably it will work on other web servers.
* PHP 5.3 or better is required. Safe mode should be off.
* At least one of these PHP extensions is required: GD, ImageMagick or GraphicsMagick.
Expand Down
36 changes: 36 additions & 0 deletions adapters/jquery-example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<html>
<head>
<title>KCFinder jQuery Adapter Example</title>
<script src="http://code.jquery.com/jquery-2.0.3.min.js" type="text/javascript"></script>
<script src="jquery.js" type="text/javascript"></script>
<style type="text/css">
#kcfinder {
width: 700px;
height: 400px;
border: 1px solid #6b6b6b;
border-radius: 5px;
}
#kcfinder iframe {
border-radius: 5px;
}
</style>
<script type="text/javascript">
$(function() {
$('#kcfinder').kcfinder({
url: "../browse.php",
theme: "dark",
lang: "bg",
callback: function(file) {
alert('Selected file: "' + file + '"');
},
callbackMultiple: function(files) {
alert('Selected files:\n "' + files.join('",\n "') + '"');
}
});
});
</script>
</head>
<body>
<div id="kcfinder"></div>
</body>
</html>
5 changes: 5 additions & 0 deletions adapters/jquery-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions adapters/jquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*! jQuery adapter for KCFinder
* http://kcfinder.sunhater.com
* Pavel Tzonkov <[email protected]>
*/
/* BASE USAGE:
* <div id="filemanager" style="width:700px;height:400px"></div>
* <script>
* $('#filemanager').kcfinder();
* </script>
*/

(function($) {
var defaultURL = "browse.php"; // Define here your default URL to KCFinder

$.fn.kcfinder = function(options) {

var url, i,
t = $(this).get(0),

// Default options
o = {
url: defaultURL,
lang: "",
theme: "",
type: "",
dir: "",
callback: false,
callbackMultiple: false
},
ifr = $('<iframe></iframe>'),

// GET parameters to parse URL
parse = ['lang', 'theme', 'type', 'dir'];

$.extend(true, o, options);

// Parse URL
url = o.url;
url += (url.indexOf('?') === -1) ? '?' : "&";
for (i in parse) {
i = parse[i];
if (o[i].length)
url += i + "=" + encodeURIComponent(o[i]) + "&";
}
url = url.substr(0, url.length - 1);

// Iframe setup
ifr.css({
margin: 0,
padding: 0,
width: $(t).innerWidth(),
height: $(t).innerHeight(),
border: "none"
}).attr({
src: url
});

$(t).html(ifr);

// Callbacks
if ($.isFunction(o.callback) || $.isFunction(o.callbackMultiple)) {
if (!window.KCFinder)
window.KCFinder = {};

// Single file callback
if ($.isFunction(o.callback))
window.KCFinder.callBack = o.callback;
else if (window.KCFinder && window.KCFinder.callback)
delete window.KCFinder.callback;

// Multiple files callback
if ($.isFunction(o.callbackMultiple))
window.KCFinder.callBackMultiple = o.callbackMultiple;
else if (window.KCFinder && window.KCFinder.callbackMultiple)
delete window.KCFinder.callbackMultiple;

// No callbacks
} else if (window.KCFinder)
delete window.KCFinder;
}

})(jQuery);
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "sunhater/kcfinder",
"description": "KCFinder web file manager",
"version" : "3.20",
"version": "3.20-test1",
"type": "library",
"keywords" : [
"keywords": [
"kcfinder",
"finder",
"file",
Expand All @@ -13,7 +13,7 @@
"file explorer"
],
"homepage": "http://kcfinder.sunhater.com",
"time": "2014-09-01",
"time": "2014-08-24",
"license": [
"GPL-3.0+",
"LGPL-3.0+"
Expand Down
105 changes: 52 additions & 53 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION 3.20-test1 - 2014-08-19
-------------------------------
3.20-test1: 2014-08-19
----------------------
* "`DOCUMENT_ROOT` is symlink" bugfix
* Uniform is replaced with my alternative - transForm (http://jquery.sunhater.com/transForm)
* Improved image viewer
Expand All @@ -9,75 +9,74 @@ VERSION 3.20-test1 - 2014-08-19
* No border-radius when scrollbar(s) exists into files and folders panes
* `_dropUploadMaxFilesize` option is added. (Drag & dropping bigger files cause crash the web browser)
* `composer.json` file added
* Changelog file is now in Markdown format
* 4 new labels to translate

VERSION 3.12 - 2014-07-09
-------------------------
3.12: 2014-07-09
----------------
* XSS security fix
* Performance fix
* taphold event added. Emulates right-click on touchscreen devices
* Click with `Shift` key functionality added
* Minor fixes

VERSION 3.11 - 2014-04-21
-------------------------
3.11: 2014-04-21
----------------
* "Unknown error." fixes when using `_normalizeFilenames` setting and upon new folder creation

VERSION 3.10 - 2014-04-16
-------------------------
3.10: 2014-04-16
----------------
* Important secirity fixes

VERSION 3.0 - 2014-04-08
------------------------
3.0: 2014-04-08
---------------
* Minor fixes

VERSION 3.0-pre1 - 2014-04-02
-----------------------------
3.0-pre1: 2014-04-02
--------------------
* Now KCFinder requires PHP >= 5.3 becouse of using namespace: `kcfinder`
* Support CSS & JavaScript minifier (on the fly)
* jQuery UI & Uniform support. New theme & theme engine (old themes are not supported)
* Improvements in JavaScript code to be well compressed and faster
* Keep PNG transparency in generated thumbnails
* New image viewer

VERSION 2.54 - 2014-03-12
-------------------------
2.54: 2014-03-12
----------------
* Performance fix only

VERSION 2.53 - 2014-02-22
-------------------------
2.53: 2014-02-22
----------------
* Session start fix
* TinyMCE 4 support

VERSION 2.52 - 2014-01-20
-------------------------
2.52: 2014-01-20
----------------
* Various image drivers support (`gd`, `imagemagick`, `graphicsmagic`)
* Auto-rotate images based on EXIF data
* PNG watermark support

VERSION 2.51 - 2010-08-25
-------------------------
2.51: 2010-08-25
----------------
* Drag and drop uploading plugin - big fixes
* Cookies problem when using single words or IPs as hostname resolved
* Vietnamese localization

VERSION 2.5 - 2010-08-23
------------------------
2.5: 2010-08-23
---------------
* Drupal module support
* Drag and drop uploading plugin
* Two more language labels
* Localhost cookies bugfix
* Renaming current folder bugfix
* Small bugfixes

VERSION 2.41 - 2010-07-24
-------------------------
2.41: 2010-07-24
----------------
* Directory types engine improvement
* New `denyExtensionRename` config setting added

VERSION 2.4 - 2010-07-20
------------------------
2.4: 2010-07-20
---------------
* Online checking if new version is released in About box. To use this feature you should to have `curl`, `http` or `socket` extension, or `allow_url_fopen` ini setting should be `on`
* New `denyUpdateCheck` config setting added
* New `dark` theme added (made by Dark Preacher)
Expand All @@ -88,46 +87,46 @@ VERSION 2.4 - 2010-07-20
* Safari 3 right-click fix
* Small bugfixes

VERSION 2.32 - 2010-07-11
-------------------------
2.32: 2010-07-11
----------------
* `filenameChangeChars` and `dirnameChangeChars` config settings added
* Content-Type header fix for `css.php`, `js_localize.php` and `js/browser/joiner.php`
* CKEditorFuncNum with index `0` bugfix
* Session save handler example in `core/autoload.php`

VERSION 2.31 - 2010-07-01
-------------------------
2.31: 2010-07-01
----------------
* Proportional uploaded image resize bugfix
* Slideshow bugfixes
* Other small bugfixes

VERSION 2.3 - 2010-06-25
------------------------
2.3: 2010-06-25
---------------
* Replace XML Ajax responses with JSON
* Replace old `readonly` config option with advanced `access` option. PLEASE UPDATE YOUR OLD CONFIG FILE!!!
* Slideshow images in current folder using arrow keys
* Multipe files upload similar to Facebook upload (not works in IE!)
* Option to set protocol, domain and port in `uploadURL` setting
* Bugfixes

VERSION 2.21 - 2010-11-19
-------------------------
2.21: 2010-11-19
----------------
* Bugfixes only

VERSION 2.2 - 2010-07-27
------------------------
2.2: 2010-07-27
---------------
* Many bugfixes
* Read-only config option

VERSION 2.1 - 2010-07-04
------------------------
2.1: 2010-07-04
---------------
* Endless JavaScript loop on KCFinder disable bugfix
* New config setting whether to generate `.htaccess` file in upload folder
* Upload to specified folder from CKEditor & FCKeditor direct upload dialog
* Select multiple files bugfixes

VERSION 2.0 - 2010-07-01
------------------------
2.0: 2010-07-01
---------------
* Brand new core
* Option to resize `files/folders` panels with mouse drag
* Select multiple files with `Ctrl` key
Expand All @@ -136,15 +135,15 @@ VERSION 2.0 - 2010-07-01
* Directory Type specific configuration settings
* Download multiple files or a folder as ZIP file

VERSION 1.7 - 2010-06-17
------------------------
1.7: 2010-06-17
---------------
* Maximize toolbar button
* Clipboard for copying and moving multiple files
* Show warning if the browser is not capable to display KCFinder
* Google Chrome Frame support for old versions of Internet Explorer

VERSION 1.6 - 2010-06-02
------------------------
1.6: 2010-06-02
---------------
* Support of Windows Apache server
* Support of Fileinfo PHP extension to detect mime types (`*mime` directory type)
* Option to deny globaly some dangerous extensions like `exe`, `php`, `pl`, `cgi` etc
Expand All @@ -153,26 +152,26 @@ VERSION 1.6 - 2010-06-02
* Missing last character of filenames without extension bugfix
* Some small bugfixes

VERSION 1.5 - 2010-05-30
------------------------
1.5: 2010-05-30
---------------
* Filenames with spaces download bugfix
* FCKEditor direct upload bugfix
* Thumbnail generation bugfixes

VERSION 1.4 - 2010-05-24
------------------------
1.4: 2010-05-24
---------------
* Client-side caching bugfix
* Custom integrations - `window.KCFinder.callBack()`
* Security fixes

VERSION 1.3 - 2010-05-06
------------------------
1.3: 2010-05-06
---------------
* Another session bugfix. Now session configuratin works!
* Show filename by default bugfix
* Loading box on top right corner

VERSION 1.2 - 2010-05-03
------------------------
1.2: 2010-05-03
---------------
* Thumbnail generation bugfix
* Session bugfix
* other small bugfixes

0 comments on commit 2a36d5a

Please sign in to comment.