diff --git a/HELP.md b/HELP.md index 3f57301f..844610bd 100644 --- a/HELP.md +++ b/HELP.md @@ -136,6 +136,7 @@ Right mouse click button shows context menu with items: - Rename - Delete - Zip file +- Unzip file - (Un)Select All - Upload to (Dropbox, Github, GDrive, FilePicker) - Download diff --git a/css/icons.css b/css/icons.css index 2e688b15..cbd00035 100644 --- a/css/icons.css +++ b/css/icons.css @@ -91,4 +91,9 @@ .icon-zip-file::before { font-family : 'Fontello'; content : '\e813 '; +} + +.icon-unzip-file::before { + font-family : 'Fontello'; + content : '\e814 '; } \ No newline at end of file diff --git a/font/fontello.eot b/font/fontello.eot index 80090827..213a2047 100644 Binary files a/font/fontello.eot and b/font/fontello.eot differ diff --git a/font/fontello.json b/font/fontello.json index 8022b12c..5cf7a86e 100644 --- a/font/fontello.json +++ b/font/fontello.json @@ -128,6 +128,12 @@ "code": 59401, "src": "fontawesome" }, + { + "uid": "e594fc6e5870b4ab7e49f52571d52577", + "css": "resize-full", + "code": 59412, + "src": "fontawesome" + }, { "uid": "3c24ee33c9487bbf18796ca6dffa1905", "css": "resize-small", diff --git a/font/fontello.svg b/font/fontello.svg index 6cdc88e1..9bd36b55 100644 --- a/font/fontello.svg +++ b/font/fontello.svg @@ -1,7 +1,7 @@ -Copyright (C) 2013 by original authors @ fontello.com +Copyright (C) 2014 by original authors @ fontello.com @@ -17,6 +17,7 @@ + diff --git a/font/fontello.ttf b/font/fontello.ttf index 0efe8f01..0ee2ce13 100644 Binary files a/font/fontello.ttf and b/font/fontello.ttf differ diff --git a/font/fontello.woff b/font/fontello.woff index 285e6127..03c83739 100644 Binary files a/font/fontello.woff and b/font/fontello.woff differ diff --git a/lib/client/dom.js b/lib/client/dom.js index 5ab956fc..00cb694d 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -602,6 +602,23 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; RESTful.zip(fileFrom, CloudCmd.refresh); }; + /** + * unzip file + * + */ + this.unzipFile = function() { + var RESTful = DOM.RESTful, + name = Cmd.getCurrentName(), + dir = Cmd.getCurrentDirPath(), + path = dir + name, + fileFrom = { + from : path + }; + + if (name && name !== '..') + RESTful.unzip(fileFrom, CloudCmd.refresh); + }; + /** * prompt and delete current file or selected files diff --git a/lib/client/menu.js b/lib/client/menu.js index be37d632..790654b2 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -189,7 +189,8 @@ var CloudCmd, Util, DOM, CloudFunc, $; }, 'Delete' : DOM.promptDelete, '(Un)Select All': DOM.toggleAllSelectedFiles, - 'Zip file' : DOM.zipFile + 'Zip file' : DOM.zipFile, + 'Unzip file' : DOM.unzipFile }; if (UploadToItemNames.length) diff --git a/lib/client/rest.js b/lib/client/rest.js index 982d482d..12da0e2c 100644 --- a/lib/client/rest.js +++ b/lib/client/rest.js @@ -62,6 +62,15 @@ var Util, DOM, CloudFunc, CloudCmd; }); }; + this.unzip = function(data, callback) { + sendRequest({ + method : 'PUT', + url : '/unzip', + data : data, + callback : callback + }); + }; + this.mv = function(data, callback) { sendRequest({ method : 'PUT', diff --git a/lib/server/pipe.js b/lib/server/pipe.js index cdad9a66..befddb21 100644 --- a/lib/server/pipe.js +++ b/lib/server/pipe.js @@ -52,8 +52,12 @@ Util.exec(p.callback, error); }; - if (p.gzip) { - gzip = zlib.createGzip(); + if (p.gzip || p.gunzip) { + if (p.gzip) + gzip = zlib.createGzip(); + else + gzip = zlib.createGunzip(); + read.on('error', onError); read = read.pipe(gzip); } diff --git a/lib/server/rest.js b/lib/server/rest.js index 94d4ce05..f1f69af1 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -307,6 +307,24 @@ break; + case 'unzip': + if (!Util.checkObjTrue(lFiles, ['from'])) + sendError(pParams, p.data); + else + pipe.create({ + from : lFiles.from, + to : lFiles.to || Util.removeStrOneTime(lFiles.from, ['.zip', '.gzip']), + gunzip : true, + callback : function(error) { + checkSendError(error, pParams, function() { + var name = path.basename(lFiles.from); + sendMsg(pParams, 'zip', name); + }); + } + }); + + break; + case 'config': var hash, passwd = lFiles && lFiles.password,