changed: plugin jQuery File Upload has been updated to version 9.7.0
(changed 'upload' and 'rm' winix functions) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@958 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 ; i<req.item_tab.size() ; ++i)
|
||||
{
|
||||
PT::Space & file = req.info.AddSpace(L"");
|
||||
PT::Space & file = files.AddSpace(L"");
|
||||
|
||||
file.Add(L"name", req.item_tab[i].url);
|
||||
file.Add(L"size", req.item_tab[i].file_size);
|
||||
@@ -280,23 +280,31 @@ void Upload::CreateAnswer()
|
||||
std::wstring & link = file.Add(L"url", L"");
|
||||
system->CreateItemLink(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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user