feature(dom) add Dialog

This commit is contained in:
coderaiser 2013-10-21 13:42:39 +00:00
parent f52f122a6b
commit 6b2fd62cb1

View file

@ -1,4 +1,4 @@
var CloudCmd, Util, DOM, CloudFunc;
var CloudCmd, Util, DOM, CloudFunc, Dialog;
(function(Util) {
'use strict';
@ -6,6 +6,11 @@ var CloudCmd, Util, DOM, CloudFunc;
var DOMFunc = function() {},
DOMProto,
DialogProto = function() {
this.alert = alert.bind(window);
this.prompt = prompt.bind(window);
},
ImagesProto = function() {
var LImagesProto = function() {
function getImage(pName) {
@ -114,7 +119,7 @@ var CloudCmd, Util, DOM, CloudFunc;
if (lText) {
Util.log(lText);
setTimeout(Util.retFunc(alert, lText), 100);
setTimeout(Util.retFunc(Dialog.alert, lText), 100);
}
return lErrorImage;
@ -1098,7 +1103,7 @@ var CloudCmd, Util, DOM, CloudFunc;
if (lName === '..')
lName = '';
lName = prompt(lMsg, lName);
lName = Dialog.prompt(lMsg, lName);
if (lName)
RESTfull.save(lDir + lName + lType, null, CloudCmd.refresh);
@ -1175,7 +1180,7 @@ var CloudCmd, Util, DOM, CloudFunc;
if (lName !== '..')
lRet = confirm(lMsg);
else
alert('No files selected!');
Dialog.alert('No files selected!');
if (lRet) {
var lUrl;
@ -1813,7 +1818,7 @@ var CloudCmd, Util, DOM, CloudFunc;
var lCurrent = pCurrentFile || Cmd.getCurrentFile(),
lFrom = Cmd.getCurrentName(lCurrent),
lTo = prompt('Rename', lFrom) || lFrom,
lTo = Dialog.prompt('Rename', lFrom) || lFrom,
lDirPath = Cmd.getCurrentDirPath();
if ( !Util.strCmp(lFrom, lTo) ) {
@ -1842,7 +1847,7 @@ var CloudCmd, Util, DOM, CloudFunc;
lFromPath = Cmd.getCurrentPath(),
lToPath = Cmd.getNotCurrentDirPath() + lName;
lToPath = prompt( 'Rename/Move file "' + lName + '"', lToPath );
lToPath = Dialog.prompt('Rename/Move file "' + lName + '"', lToPath);
if ( lToPath && !Util.strCmp(lFromPath, lToPath) ) {
var lFiles = {
@ -1875,7 +1880,7 @@ var CloudCmd, Util, DOM, CloudFunc;
lName = Cmd.getCurrentName(lCurrent),
lFromPath = Cmd.getCurrentPath(),
lToPath = Cmd.getNotCurrentDirPath() + lName;
lToPath = prompt( 'Copy file "' + lName + '" to', lToPath );
lToPath = Dialog.prompt( 'Copy file "' + lName + '" to', lToPath );
if ( lToPath && !Util.strCmp(lFromPath, lToPath) ) {
var lFiles = {
@ -1945,6 +1950,8 @@ var CloudCmd, Util, DOM, CloudFunc;
DOMProto = DOMFunc.prototype = new CmdProto();
Dialog = new DialogProto();
Util.extend(DOMProto, [
DOMTree,
Loader, {