diff --git a/e107_admin/header.php b/e107_admin/header.php
index 7c83d90c9..4f4922628 100644
--- a/e107_admin/header.php
+++ b/e107_admin/header.php
@@ -44,8 +44,7 @@ e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2);
e107::css('core', 'password/style.css', 'jquery');
e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2);
-//
-e107::js("core", "plupload/customUpload.js","jquery",3);
+
e107::js("core", "core/mediaManager.js","jquery",3);
e107::js("core", "tooltip/jquery.tipsy.js","jquery",3);
diff --git a/e107_admin/image.php b/e107_admin/image.php
index 8beae21a9..e872be907 100644
--- a/e107_admin/image.php
+++ b/e107_admin/image.php
@@ -574,7 +574,7 @@ class media_admin_ui extends e_admin_ui
function uploadPage()
{
- $text = '
+ $text = '
';
diff --git a/e107_files/jslib/core/admin.jquery.js b/e107_files/jslib/core/admin.jquery.js
index 10131a004..9bcac0dd3 100644
--- a/e107_files/jslib/core/admin.jquery.js
+++ b/e107_files/jslib/core/admin.jquery.js
@@ -392,7 +392,63 @@ $(document).ready(function()
+ // ----------------- Upload --------------------------------------
+
+ var upath = $("#uploader").attr("rel");
+
+ $("#uploader").pluploadQueue({
+ // General settings
+ runtimes : "html5,html4",
+ url : upath,
+ max_file_size : "10mb",
+ chunk_size : "1mb",
+ unique_names : false,
+
+ // Resize images on clientside if we can
+ // resize : {width : 320, height : 240, quality : 90},
+
+ // Specify what files to browse for
+ filters : [
+ {title : "Image files", extensions : "jpg,gif,png"},
+ {title : "Zip files", extensions : "zip,gz"}
+ ],
+ preinit : {
+ Init: function(up, info) {
+ //log('[Init]', 'Info:', info, 'Features:', up.features);
+ }
+ },
+ init : {
+
+ FilesAdded: function(up, files) {
+
+ },
+ FileUploaded: function(up, file, info) { // Called when a file has finished uploading
+ //log('[FileUploaded] File:', file, "Info:", info);
+ },
+ UploadProgress: function(up, file) { // Called while a file is being uploaded
+
+ // console.log(up.total);
+ // console.log('[UploadProgress]', 'File:', file, "Total:", up.total);
+ },
+ UploadComplete: function(up, files){
+ document.location.reload(); // refresh the page.
+
+ },
+ ChunkUploaded: function(up, file, info) { // Called when a file chunk has finished uploading
+
+ //log('[ChunkUploaded] File:', file, "Info:", info);
+ // console.log(info);
+ },
+ Error: function(up, args) { // Called when a error has occured
+ alert('There was an error');
+ // console.log(args);
+ }
+
+ }
+ });
+
+ // -----------------------------------------------------------------
diff --git a/e107_files/jslib/plupload/customUpload.js b/e107_files/jslib/plupload/customUpload.js
deleted file mode 100644
index e27b9e59b..000000000
--- a/e107_files/jslib/plupload/customUpload.js
+++ /dev/null
@@ -1,125 +0,0 @@
-$(document).ready(function()
- {
- var path = $("#uploader").attr("rel");
-
- $("#uploader").pluploadQueue({
- // General settings
- runtimes : "html5,html4",
- url : path,
- max_file_size : "10mb",
- chunk_size : "1mb",
- unique_names : false,
-
- // Resize images on clientside if we can
- resize : {width : 320, height : 240, quality : 90},
-
- // Specify what files to browse for
- filters : [
- {title : "Image files", extensions : "jpg,gif,png"},
- {title : "Zip files", extensions : "zip,gz"}
- ]
- ,
- // Error reporting etc
- preinit: attachError,
- setup: attachCallbacks
- });
-
-
-
-
-
- // Attach widget callbacks
- function attachError(Uploader) {
- Uploader.bind("FileUploaded", function(up, file, response) {
- var data = $.parseJSON(response.response);
- console.log("[FileUploaded] Response - " + response.response);
-
- if (data.error == 1) {
- up.trigger("Error", {message: "'" + data.message + "'", file: file});
- console.log("[Error] " + file.id + " : " + data.message);
- return false;
- }
- });
- }
-
- function attachCallbacks(uploader) {
-
- uploader.bind("Init", function(up) {
- up.settings.multipart_params = {
- "upload_type" : $("#uploadQueue").attr("data-uploadType"),
- "xref_id" : $("#uploadQueue").attr("data-xrefID"),
- "image_category" : $("#uploadQueue").attr("data-imageCategory")
- };
- });
-
- uploader.bind("UploadComplete", function(up, files) {
- console.log("[UploadComplete]");
-
- $(".plupload_buttons").css("display", "inline");
- $(".plupload_upload_status").css("display", "inline");
- $(".plupload_start").addClass("plupload_disabled");
- alert("it worked");
- up.refresh();
- });
-
-
- uploader.bind('FilesAdded', function(up, files) {
- for (var i in files) {
- alert(files[i].id + ' hello');
- //$('#' + files[i].id).append('hello');
- $('#' + files[i].id).prepend("WOWWs");
- // $('#' + files[i].id).html('
');
- }
- // $('#uploadfiles').removeAttr('disabled');
- // $('.uploadInfos .total').html(parseInt($('.uploadInfos .total').html()) + files.length );
- });
-
-
- uploader.bind('UploadFile', function(up, file) {
- $.extend(up.settings.multipart_params, { legende : $('#' + file.id + 'Legende').val(), titre : $('#' + file.id + 'Titre').val(), marquage : $('#' + file.id + 'Marquage').is(':checked')});
-
- $('.uploadInfos .envois').html(parseInt($('.uploadInfos .envois').html()) + 1 );
- $('#' + file.id).prepend('

');
- });
-
- uploader.bind('FileUploaded', function(up, file, response) {
- resJ = $.parseJSON(response.response);
- $('#' + file.id + ' i').html(' ' + resJ.reduceSize + 'Kb');
- if (resJ.url != '' && resJ.filetype == 'image') {
- $('#' + file.id + ' img').attr('src', resJ.url);
- $('#' + file.id + ' img').attr('alt', 'aperçus image');
- }
- else if (resJ.url && resJ.filetype == 'audio') {
- //$('#' + file.id + ' img').after('Some text
and bold!').remove();
- }
- else{
- //$('#' + file.id + ' img').attr('src', '');
- //$('#' + file.id + ' img').attr('alt', 'vignette indisponible');
- }
-
- if ($("#tab-gallery").html() == null) {
- $("#tab-type").after('
Galerie de l\'article');
- }
- $('#attachments-count').html(parseInt($('#attachments-count').html()) + 1);
- up.refresh();
- });
-
- uploader.bind('UploadProgress', function(up, file) {
- $('#' + file.id + ' b').html(file.percent + "%");
- });
-
-
- uploader.bind('Error', function(up, err) {
- $('#filelist').append("Error: " + err.code +
- ", Message: " + err.message +
- (err.file ? ", File: " + err.file.name : "") +
- "
"
- );
- up.refresh(); // Reposition Flash/Silverlight
- });
-
-
-
- }
-
-});
diff --git a/e107_files/jslib/plupload/upload.php b/e107_files/jslib/plupload/upload.php
index 0414b530f..dad241164 100644
--- a/e107_files/jslib/plupload/upload.php
+++ b/e107_files/jslib/plupload/upload.php
@@ -14,6 +14,11 @@
require_once("../../../class2.php");
+if(!ADMIN)
+{
+ exit;
+}
+
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
@@ -131,11 +136,13 @@ if (!$chunks || $chunk == $chunks - 1) {
}
-rename($targetDir.$fileName,e_MEDIA."images/2012-05/",$fileName);
-e107::getMedia()->importFile($fileName,'news');
+// rename($targetDir.$fileName,e_MEDIA."images/2012-05/",$fileName);
+$result = e107::getMedia()->importFile($fileName,$_GET['for']);
+$array = array("jsonrpc"=>"2.0", "result"=>$result,"id"=>"id");
+echo json_encode($array);
// Return JSON-RPC response
-die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
+// die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
?>
\ No newline at end of file