View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0012012 | mantisbt | plug-ins | public | 2010-06-09 02:36 | 2015-08-23 09:21 |
Reporter | dominik | Assigned To | vboctor | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | duplicate | ||
Product Version | 1.2.1 | ||||
Summary | 0012012: Plugin DragAndDropFileUploadJavaApplet (and required core changes) | ||||
Description | During the development of the drag and drop fiel upload plugin some code changes at the Mantis core were required... Attached a patch file with the required changes: Added Event EVENT_FILE_UPLOAD_FORM which allows to change the whole file upload form snippet (I use it to "insert" the drag 'n drop dropzone) Added Event EVENT_FILE_ADDED which is called after each uploaded file Added the parameter $p_page when signalling the event EVENT_MENU_ACCOUNT from html_api.php. This enables us to detect if we are on the current page or not and show/hide links accordingly. Added support for multiple file uploads at once (currently this is only supported with the dnd-plugin) Unfortunately I had private files in theses commits so I had to manually remove files -> if you have problems to apply the patch please let me know (or if you know how I can exlude files when creating patches please let me know as well ;-)) | ||||
Tags | No tags attached. | ||||
Attached Files | 2010-06-09_changes_for_plugin_drag_and_drop_file_upload.patch (6,600 bytes)
From e22a0309230b0bb3fc15347a22ada9ef5d86e04a Mon Sep 17 00:00:00 2001 From: Dominik Blunk <dominik@blunk.ch> Date: Thu, 3 Jun 2010 19:26:34 +0200 Subject: [PATCH 10/19] Plugin Drag and Drop File Upload (Java Applet) implemented - Part 2 --- .gitignore | 16 +- bug_file_upload_inc.php | 10 + core/events_inc.php | 4 + core/file_api.php | 1 + .../DragAndDropFileUploadJavaApplet.php | 192 +++++++++++++++++-- .../DragAndDropFileUploadJavaApplet/files/dnd.jar | Bin 0 -> 75584 bytes .../files/dndlite.jar | Bin 0 -> 56433 bytes .../files/dndplus.jar | Bin 0 -> 94460 bytes .../lang/strings_english.txt | 32 ++-- .../pages/applet_properties.php | 197 ++++++++++++++++++++ .../pages/config.php | 48 +++--- .../pages/config_edit.php | 57 +++--- 12 files changed, 466 insertions(+), 91 deletions(-) create mode 100644 plugins/DragAndDropFileUploadJavaApplet/files/dnd.jar create mode 100644 plugins/DragAndDropFileUploadJavaApplet/files/dndlite.jar create mode 100644 plugins/DragAndDropFileUploadJavaApplet/files/dndplus.jar create mode 100644 plugins/DragAndDropFileUploadJavaApplet/pages/applet_properties.php diff --git a/bug_file_upload_inc.php b/bug_file_upload_inc.php index 9cc9386..ba60acd 100644 --- a/bug_file_upload_inc.php +++ b/bug_file_upload_inc.php @@ -31,6 +31,9 @@ } $t_max_file_size = (int)min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) ); + + # start output buffering + ob_start( ); ?> <br /> @@ -77,3 +80,10 @@ <?php collapse_end( 'upload_form' ); + + # end output buffering + $t_form_html_snippet = ob_get_contents( ); + ob_end_clean ( ); + + # print file upload form + print event_signal( 'EVENT_FILE_UPLOAD_FORM', $t_form_html_snippet, $f_bug_id ); diff --git a/core/events_inc.php b/core/events_inc.php index 74621d6..79e6462 100644 --- a/core/events_inc.php +++ b/core/events_inc.php @@ -105,6 +105,10 @@ event_declare_many( array( 'EVENT_TAG_ATTACHED' => EVENT_TYPE_EXECUTE, 'EVENT_TAG_DETACHED' => EVENT_TYPE_EXECUTE, + # File events + 'EVENT_FILE_UPLOAD_FORM' => EVENT_TYPE_CHAIN, + 'EVENT_FILE_ADDED' => EVENT_TYPE_EXECUTE, + # Email notification events 'EVENT_NOTIFY_USER_INCLUDE' => EVENT_TYPE_DEFAULT, 'EVENT_NOTIFY_USER_EXCLUDE' => EVENT_TYPE_DEFAULT, diff --git a/core/file_api.php b/core/file_api.php index 4729d4d..6fafe2b 100644 --- a/core/file_api.php +++ b/core/file_api.php @@ -726,6 +726,7 @@ function file_add( $p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc # log new bug history_log_event_special( $p_bug_id, FILE_ADDED, $t_file_name ); } + event_signal('EVENT_FILE_ADDED', $p_file); } # -------------------- -- 1.7.0.2.msysgit.0 From 5e71ef30376329e49670efaadb9ef32642488b0c Mon Sep 17 00:00:00 2001 From: Dominik Blunk <dominik@blunk.ch> Date: Fri, 4 Jun 2010 11:33:32 +0200 Subject: [PATCH 11/19] Drag and Drop File Upload Plugin finished so far... --- core/html_api.php | 2 +- .../DragAndDropFileUploadJavaApplet.php | 36 ++++++--------- .../lang/strings_english.txt | 1 + .../pages/account_plugin_prefs.php | 47 ++++++++++++++++++++ .../pages/account_plugin_prefs_update.php | 19 ++++++++ .../pages/config.php | 4 +- .../pages/config_edit.php | 39 ---------------- .../pages/config_update.php | 39 ++++++++++++++++ .../DragAndDropFileUploadJavaApplet/pages/foo.php | 17 ------- 9 files changed, 123 insertions(+), 81 deletions(-) create mode 100644 plugins/DragAndDropFileUploadJavaApplet/pages/account_plugin_prefs.php create mode 100644 plugins/DragAndDropFileUploadJavaApplet/pages/account_plugin_prefs_update.php delete mode 100644 plugins/DragAndDropFileUploadJavaApplet/pages/config_edit.php create mode 100644 plugins/DragAndDropFileUploadJavaApplet/pages/config_update.php delete mode 100644 plugins/DragAndDropFileUploadJavaApplet/pages/foo.php diff --git a/core/html_api.php b/core/html_api.php index 61be4d4..dea70ae 100644 --- a/core/html_api.php +++ b/core/html_api.php @@ -1116,7 +1116,7 @@ function print_account_menu( $p_page = '' ) { } # Plugin / Event added options - $t_event_menu_options = event_signal( 'EVENT_MENU_ACCOUNT' ); + $t_event_menu_options = event_signal( 'EVENT_MENU_ACCOUNT', $p_page ); $t_menu_options = array(); foreach( $t_event_menu_options as $t_plugin => $t_plugin_menu_options ) { foreach( $t_plugin_menu_options as $t_callback => $t_callback_menu_options ) { -- 1.7.0.2.msysgit.0 From bc68ab67ca1dd81dcd9ab7270ac34604b93b82d4 Mon Sep 17 00:00:00 2001 From: Dominik Blunk <dominik@blunk.ch> Date: Fri, 4 Jun 2010 14:10:51 +0200 Subject: [PATCH 14/19] Enabled multiple files upload --- bug_file_add.php | 21 ++++++++++++++++++- .../DragAndDropFileUploadJavaApplet.php | 13 +----------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/bug_file_add.php b/bug_file_add.php index ae768da..524ab64 100644 --- a/bug_file_add.php +++ b/bug_file_add.php @@ -52,8 +52,25 @@ access_ensure_bug_level( config_get( 'upload_bug_file_threshold' ), $f_bug_id ); - file_add( $f_bug_id, $f_file, 'bug' ); - + if ( is_array( $f_file['tmp_name'] ) ) { + # multiple files uploaded + for ( $i = 0; $i < count( $f_file['tmp_name'] ); $i++ ) { + $t_single_file_data = array( 'name' => $f_file['name'][$i], + 'type' => $f_file['type'][$i], + 'tmp_name' => $f_file['tmp_name'][$i], + 'error' => $f_file['error'][$i], + 'size' => $f_file['size'][$i] + ); + file_add( $f_bug_id, $t_single_file_data, 'bug' ); + } + # because multiple files are only possible with Drag And Drop File Upload Java Applet Plugin + # we quit here (response is sent by hooked event EVENT_FILE_ADDED) + exit(); + } + else { + file_add( $f_bug_id, $f_file, 'bug' ); + } + form_security_purge( 'bug_file_add' ); # Determine which view page to redirect back to. -- 1.7.0.2.msysgit.0 | ||||
Remember that if you want the best experience you have to buy the standard or the plus version of the RAD upload applet. The bundled Lite version is free but has some limitations! There are three different Rad Upload Applets available: |
|
I think with HTML5 gaining momentum we could consider making a plugin using the HTML Drag and Drop features described in more detail here: |
|
+1 |
|