diff --git a/functions/rm.cpp b/functions/rm.cpp index a737109..e35a24f 100755 --- a/functions/rm.cpp +++ b/functions/rm.cpp @@ -465,18 +465,28 @@ void Rm::Clear() + void Rm::CreateJSON(bool status) { + auto & out = cur->request->out_streams[0]; + + out << "{\"files\": [{\""; + JSONescape(out, cur->request->item.url); + out << "\": "; + if( status ) - cur->request->out_streams[0] << "[true]\n"; + out << "true"; else - cur->request->out_streams[0] << "[false]\n"; + out << "false"; + + out << "}]}"; cur->request->page_generated = true; cur->request->use_html_filter[0] = false; } + void Rm::MakePost() { Prepare(); diff --git a/functions/upload.cpp b/functions/upload.cpp index ba6a7b8..8892f65 100755 --- a/functions/upload.cpp +++ b/functions/upload.cpp @@ -35,7 +35,7 @@ Upload::Upload() void Upload::Init() { - json_serializer.TreatAsTable(L"infospace"); + json_serializer.TreatAsTable(L"files"); json_serializer.TreatAsNumeric(L"size"); } @@ -268,11 +268,11 @@ void Upload::MakePost() void Upload::CreateAnswer() { Request & req = *cur->request; - req.info.name = L"infospace"; // 'infospace' will be serialized to an array + PT::Space & files = req.info.AddSpace(L"files"); // 'files' will be serialized to an array for(size_t i=0 ; iCreateItemLink(req.item_tab[i], link); - std::wstring & del_url = file.Add(L"delete_url", link); + std::wstring & del_url = file.Add(L"deleteUrl", link); del_url += L"/rm/jquery_upload"; - file.Add(L"delete_type", L"POST"); + file.Add(L"deleteType", L"POST"); if( req.item_tab[i].file_type == WINIX_ITEM_FILETYPE_IMAGE ) { - std::wstring & thumb = file.Add(L"thumbnail_url", link); + std::wstring & thumb = file.Add(L"thumbnailUrl", link); if( req.item_tab[i].has_thumb ) thumb += L"/-/thumb"; } + + /* + * if there was an error add "error" item e.g. + * "error": "Filetype not allowed" + */ } cur->request->return_json = true; cur->request->return_info_only = true; cur->request->info_serializer = &json_serializer; + + + //cur->request->out_headers.Add(L"Content-Type", L"text/html"); } diff --git a/html/fun_upload.html b/html/fun_upload.html index ee93413..72d1a49 100755 --- a/html/fun_upload.html +++ b/html/fun_upload.html @@ -5,190 +5,144 @@ [end] - -[if winix_function_param_is "jquery_upload"] -\[ - [for item_tab] - \{ - "name":"[item_tab_url]", - "size":[item_tab_file_size], - "url":"[item_tab_link]", - [if item_tab_filetype_is_image]"thumbnail_url":"[if item_tab_has_thumb][item_tab_link]/-/thumb[else][item_tab_link][end]",[end] - "delete_url":"[item_tab_link]/rm/jquery_upload", - "delete_type":"POST" - \} - [if item_tab_has_next],[end] - - [end] -\] -[end] - - [if-any-no winix_function_param_is "ckeditor_upload" winix_function_param_is "jquery_upload"]

{upload_header}

- [# The file upload form used as target for the file upload widget] -
- [# The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload] -
-
- [# The fileinput-button span is used to style the file input field as button] - - - {upload_button_add_files} - - - - - - -
- [# The global progress information] -
- [# The global progress bar] -
-
-
- [# The extended global progress information] -
 
-
+[# the code below are copied from common/fileupload/jquery-ui.html] +[# The file upload form used as target for the file upload widget] + + + [# The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload] +
+
+ [# The fileinput-button span is used to style the file input field as button] + + {upload_button_add_files} + + + + + + + [# The global file processing state] + +
+ [# The global progress state] + - [# The loading indicator is shown during file processing] -
-
- [# The table listing the files available for upload/download] - - - - -[# modal-gallery is the modal dialog used for the image gallery] - + [# The table listing the files available for upload/download] +
+ - [# The template to display files available for upload] - - [# The template to display files available for download] - +[# The blueimp Gallery widget] + + +[# The template to display files available for upload] + + +[# The template to display files available for download] + - $('#fileupload').each(function () \{ - var that = this; - $.getJSON(this.action + '/jquery_upload', function (result) \{ - if (result && result.length) \{ - $(that).fileupload('option', 'done') - .call(that, null, \{result: result\}); - \} - \}); - \});
diff --git a/html/index_head_functions_add.html b/html/index_head_functions_add.html index e7b1cbc..fab0c2b 100755 --- a/html/index_head_functions_add.html +++ b/html/index_head_functions_add.html @@ -114,68 +114,104 @@ [if winix_function_is "upload"] + [# http://blueimp.github.io/jQuery-File-Upload/jquery-ui.html] + [# https://github.com/blueimp/jQuery-File-Upload] + [# we are using the *jQuery UI version* of the plugin] - [# Bootstrap CSS Toolkit styles] - [# I downloaded bootstrap.min.css and removed some normal elements from it such as html, body etc ] - [# I left only items with a class set] - [# ] - + [# Force latest IE rendering engine or ChromeFrame if installed] + - [# Generic page styles, removed, only one item there is there] - [# ] - [# Bootstrap styles for responsive website layout, supporting different screen sizes] - - [# Bootstrap CSS fixes for IE6] - + [# jQuery UI styles] + [# original http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/dark-hive/jquery-ui.css] + + - [# Bootstrap Image Gallery styles] - + [if false] + + + + [end] + [# blueimp Gallery styles] + [# original http://blueimp.github.io/Gallery/css/blueimp-gallery.min.css] + + [# CSS to style the file input field as button and adjust the Bootstrap progress bars] - + + - [# Shim to make HTML5 elements usable in older Internet Explorer versions] - + [# CSS adjustments for browsers with JavaScript disabled] + + - [# can be moved to the end of a page (before tag) ] - + [# those below can be moved to the bottom of the page (outside of ] - [# The jQuery UI widget factory, can be omitted if jQuery UI is already included] - + [# original //ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js] + + + [# original //ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js] + [# The Templates plugin is included to render the upload/download listings] - + [# original http://blueimp.github.io/JavaScript-Templates/js/tmpl.min.js] + [# The Load Image plugin is included for the preview images and image resizing functionality] - + [# original http://blueimp.github.io/JavaScript-Load-Image/js/load-image.min.js] + [# The Canvas to Blob plugin is included for image resizing functionality] - + [# original http://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js] + - [# Bootstrap JS and Bootstrap Image Gallery are not required, but included for the demo] - - + [# blueimp Gallery script] + [# original http://blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js] + [# The Iframe Transport is required for browsers without support for XHR file uploads] - + + [# The basic File Upload plugin] - - [# The File Upload file processing plugin] - + + + [# The File Upload processing plugin] + + + [# The File Upload image preview & resize plugin] + + + [# The File Upload audio preview plugin] + + + [# The File Upload video preview plugin] + + + [# The File Upload validation plugin] + + [# The File Upload user interface plugin] - - [# The localization script] - + - [# do not load main.js - it is at the end of fun_upload.html ] + [# The File Upload jQuery UI plugin] + + [if false] + [# code from fileupload/js/main.js we are using in fun_upload.html (at the bottom)] + + + [end] - [# The XDomainRequest Transport is included for cross-domain file deletion for IE8+] - - + [# The XDomainRequest Transport is included for cross-domain file deletion for IE 8 and IE 9] + [end] diff --git a/locale/en b/locale/en index e16b7aa..070a94b 100755 --- a/locale/en +++ b/locale/en @@ -294,13 +294,14 @@ template_form_from_mount_point = from the mount point upload_header = Files manager upload_button_add_files = Add files... +upload_button_start = Start +upload_button_cancel = Cancel upload_button_start_upload = Start upload upload_button_cancel_upload = Cancel upload upload_button_delete = Delete +upload_button_processing = Processing... upload_button_download = Download -upload_button_slideshow = Slideshow -upload_button_previous = Previous -upload_button_next = Next +upload_error = Error: who_header = Sessions who_tab_index = Ind. diff --git a/locale/pl b/locale/pl index a60db50..1b861d8 100755 --- a/locale/pl +++ b/locale/pl @@ -315,15 +315,14 @@ template_form_from_mount_point = z punktu montowania upload_header = Menedżer plików upload_button_add_files = Dodaj pliki... +upload_button_start = Wysyłaj +upload_button_cancel = Anuluj upload_button_start_upload = Wysyłaj upload_button_cancel_upload = Przerwij wysyłanie upload_button_delete = Usuń +upload_button_processing = Wysyłanie... upload_button_download = Ściągnij -upload_button_slideshow = Pokaz slajdów -upload_button_previous = Poprzedni -upload_button_next = Następny - - +upload_error = Błąd: who_header = Lista sesji who_tab_index = L.p.