Version Notes
1.9.3.0
Download this release
Release Info
Developer | Magento Core Team |
Extension | Lib_Js_Mage |
Version | 1.9.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.9.2.4 to 1.9.3.0
- js/lib/uploader/flow.min.js +2 -0
- js/lib/uploader/fusty-flow-factory.js +14 -0
- js/lib/uploader/fusty-flow.js +429 -0
- js/mage/adminhtml/accordion.js +1 -1
- js/mage/adminhtml/backup.js +1 -1
- js/mage/adminhtml/browser.js +6 -6
- js/mage/adminhtml/events.js +3 -1
- js/mage/adminhtml/flexuploader.js +4 -4
- js/mage/adminhtml/form.js +10 -10
- js/mage/adminhtml/giftmessage.js +3 -3
- js/mage/adminhtml/giftoptions/tooltip.js +2 -2
- js/mage/adminhtml/grid.js +2 -2
- js/mage/adminhtml/image.js +1 -1
- js/mage/adminhtml/loader.js +3 -3
- js/mage/adminhtml/product.js +15 -13
- js/mage/adminhtml/product/composite/configure.js +3 -3
- js/mage/adminhtml/rules.js +2 -2
- js/mage/adminhtml/sales.js +12 -12
- js/mage/adminhtml/sales/packaging.js +9 -9
- js/mage/adminhtml/scrollbar.js +113 -105
- js/mage/adminhtml/tabs.js +7 -7
- js/mage/adminhtml/tools.js +7 -7
- js/mage/adminhtml/uploader/instance.js +508 -0
- js/mage/adminhtml/wysiwyg/tiny_mce/setup.js +256 -1
- js/mage/adminhtml/wysiwyg/widget.js +4 -4
- js/mage/captcha.js +2 -2
- js/mage/directpost.js +16 -23
- js/mage/translate.js +1 -1
- js/mage/translate_inline.js +4 -4
- js/varien/accordion.js +4 -4
- js/varien/configurable.js +5 -5
- js/varien/form.js +7 -7
- js/varien/iehover-fix.js +11 -7
- js/varien/js.js +30 -20
- js/varien/payment.js +1 -1
- js/varien/product.js +7 -266
- js/varien/product_options.js +287 -0
- js/varien/telephone.js +1 -1
- package.xml +6 -6
js/lib/uploader/flow.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
/*! flow.js 2.9.0 */
|
2 |
+
!function(a,b,c){"use strict";function d(b){if(this.support=!("undefined"==typeof File||"undefined"==typeof Blob||"undefined"==typeof FileList||!Blob.prototype.slice&&!Blob.prototype.webkitSlice&&!Blob.prototype.mozSlice),this.support){this.supportDirectory=/WebKit/.test(a.navigator.userAgent),this.files=[],this.defaults={chunkSize:1048576,forceChunkSize:!1,simultaneousUploads:3,singleFile:!1,fileParameterName:"file",progressCallbacksInterval:500,speedSmoothingFactor:.1,query:{},headers:{},withCredentials:!1,preprocess:null,method:"multipart",testMethod:"GET",uploadMethod:"POST",prioritizeFirstAndLastChunk:!1,target:"/",testChunks:!0,generateUniqueIdentifier:null,maxChunkRetries:0,chunkRetryInterval:null,permanentErrors:[404,415,500,501],successStatuses:[200,201,202],onDropStopPropagation:!1},this.opts={},this.events={};var c=this;this.onDrop=function(a){c.opts.onDropStopPropagation&&a.stopPropagation(),a.preventDefault();var b=a.dataTransfer;b.items&&b.items[0]&&b.items[0].webkitGetAsEntry?c.webkitReadDataTransfer(a):c.addFiles(b.files,a)},this.preventEvent=function(a){a.preventDefault()},this.opts=d.extend({},this.defaults,b||{})}}function e(a,b){this.flowObj=a,this.file=b,this.name=b.fileName||b.name,this.size=b.size,this.relativePath=b.relativePath||b.webkitRelativePath||this.name,this.uniqueIdentifier=a.generateUniqueIdentifier(b),this.chunks=[],this.paused=!1,this.error=!1,this.averageSpeed=0,this.currentSpeed=0,this._lastProgressCallback=Date.now(),this._prevUploadedSize=0,this._prevProgress=0,this.bootstrap()}function f(a,b,c){this.flowObj=a,this.fileObj=b,this.fileObjSize=b.size,this.offset=c,this.tested=!1,this.retries=0,this.pendingRetry=!1,this.preprocessState=0,this.loaded=0,this.total=0;var d=this.flowObj.opts.chunkSize;this.startByte=this.offset*d,this.endByte=Math.min(this.fileObjSize,(this.offset+1)*d),this.xhr=null,this.fileObjSize-this.endByte<d&&!this.flowObj.opts.forceChunkSize&&(this.endByte=this.fileObjSize);var e=this;this.event=function(a,b){b=Array.prototype.slice.call(arguments),b.unshift(e),e.fileObj.chunkEvent.apply(e.fileObj,b)},this.progressHandler=function(a){a.lengthComputable&&(e.loaded=a.loaded,e.total=a.total),e.event("progress",a)},this.testHandler=function(){var a=e.status(!0);"error"===a?(e.event(a,e.message()),e.flowObj.uploadNextChunk()):"success"===a?(e.tested=!0,e.event(a,e.message()),e.flowObj.uploadNextChunk()):e.fileObj.paused||(e.tested=!0,e.send())},this.doneHandler=function(){var a=e.status();if("success"===a||"error"===a)e.event(a,e.message()),e.flowObj.uploadNextChunk();else{e.event("retry",e.message()),e.pendingRetry=!0,e.abort(),e.retries++;var b=e.flowObj.opts.chunkRetryInterval;null!==b?setTimeout(function(){e.send()},b):e.send()}}}function g(a,b){var c=a.indexOf(b);c>-1&&a.splice(c,1)}function h(a,b){return"function"==typeof a&&(b=Array.prototype.slice.call(arguments),a=a.apply(null,b.slice(1))),a}function i(a,b){setTimeout(a.bind(b),0)}function j(a){return k(arguments,function(b){b!==a&&k(b,function(b,c){a[c]=b})}),a}function k(a,b,c){if(a){var d;if("undefined"!=typeof a.length){for(d=0;d<a.length;d++)if(b.call(c,a[d],d)===!1)return}else for(d in a)if(a.hasOwnProperty(d)&&b.call(c,a[d],d)===!1)return}}var l=a.navigator.msPointerEnabled;d.prototype={on:function(a,b){a=a.toLowerCase(),this.events.hasOwnProperty(a)||(this.events[a]=[]),this.events[a].push(b)},off:function(a,b){a!==c?(a=a.toLowerCase(),b!==c?this.events.hasOwnProperty(a)&&g(this.events[a],b):delete this.events[a]):this.events={}},fire:function(a,b){b=Array.prototype.slice.call(arguments),a=a.toLowerCase();var c=!1;return this.events.hasOwnProperty(a)&&k(this.events[a],function(a){c=a.apply(this,b.slice(1))===!1||c},this),"catchall"!=a&&(b.unshift("catchAll"),c=this.fire.apply(this,b)===!1||c),!c},webkitReadDataTransfer:function(a){function b(a){g+=a.length,k(a,function(a){if(a.isFile){var e=a.fullPath;a.file(function(a){c(a,e)},d)}else a.isDirectory&&a.createReader().readEntries(b,d)}),e()}function c(a,b){a.relativePath=b.substring(1),h.push(a),e()}function d(a){throw a}function e(){0==--g&&f.addFiles(h,a)}var f=this,g=a.dataTransfer.items.length,h=[];k(a.dataTransfer.items,function(a){var f=a.webkitGetAsEntry();return f?void(f.isFile?c(a.getAsFile(),f.fullPath):f.createReader().readEntries(b,d)):void e()})},generateUniqueIdentifier:function(a){var b=this.opts.generateUniqueIdentifier;if("function"==typeof b)return b(a);var c=a.relativePath||a.webkitRelativePath||a.fileName||a.name;return a.size+"-"+c.replace(/[^0-9a-zA-Z_-]/gim,"")},uploadNextChunk:function(a){var b=!1;if(this.opts.prioritizeFirstAndLastChunk&&(k(this.files,function(a){return!a.paused&&a.chunks.length&&"pending"===a.chunks[0].status()&&0===a.chunks[0].preprocessState?(a.chunks[0].send(),b=!0,!1):!a.paused&&a.chunks.length>1&&"pending"===a.chunks[a.chunks.length-1].status()&&0===a.chunks[0].preprocessState?(a.chunks[a.chunks.length-1].send(),b=!0,!1):void 0}),b))return b;if(k(this.files,function(a){return a.paused||k(a.chunks,function(a){return"pending"===a.status()&&0===a.preprocessState?(a.send(),b=!0,!1):void 0}),b?!1:void 0}),b)return!0;var c=!1;return k(this.files,function(a){return a.isComplete()?void 0:(c=!0,!1)}),c||a||i(function(){this.fire("complete")},this),!1},assignBrowse:function(a,c,d,e){"undefined"==typeof a.length&&(a=[a]),k(a,function(a){var f;"INPUT"===a.tagName&&"file"===a.type?f=a:(f=b.createElement("input"),f.setAttribute("type","file"),j(f.style,{visibility:"hidden",position:"absolute"}),a.appendChild(f),a.addEventListener("click",function(){f.click()},!1)),this.opts.singleFile||d||f.setAttribute("multiple","multiple"),c&&f.setAttribute("webkitdirectory","webkitdirectory"),k(e,function(a,b){f.setAttribute(b,a)});var g=this;f.addEventListener("change",function(a){g.addFiles(a.target.files,a),a.target.value=""},!1)},this)},assignDrop:function(a){"undefined"==typeof a.length&&(a=[a]),k(a,function(a){a.addEventListener("dragover",this.preventEvent,!1),a.addEventListener("dragenter",this.preventEvent,!1),a.addEventListener("drop",this.onDrop,!1)},this)},unAssignDrop:function(a){"undefined"==typeof a.length&&(a=[a]),k(a,function(a){a.removeEventListener("dragover",this.preventEvent),a.removeEventListener("dragenter",this.preventEvent),a.removeEventListener("drop",this.onDrop)},this)},isUploading:function(){var a=!1;return k(this.files,function(b){return b.isUploading()?(a=!0,!1):void 0}),a},_shouldUploadNext:function(){var a=0,b=!0,c=this.opts.simultaneousUploads;return k(this.files,function(d){k(d.chunks,function(d){return"uploading"===d.status()&&(a++,a>=c)?(b=!1,!1):void 0})}),b&&a},upload:function(){var a=this._shouldUploadNext();if(a!==!1){this.fire("uploadStart");for(var b=!1,c=1;c<=this.opts.simultaneousUploads-a;c++)b=this.uploadNextChunk(!0)||b;b||i(function(){this.fire("complete")},this)}},resume:function(){k(this.files,function(a){a.resume()})},pause:function(){k(this.files,function(a){a.pause()})},cancel:function(){for(var a=this.files.length-1;a>=0;a--)this.files[a].cancel()},progress:function(){var a=0,b=0;return k(this.files,function(c){a+=c.progress()*c.size,b+=c.size}),b>0?a/b:0},addFile:function(a,b){this.addFiles([a],b)},addFiles:function(a,b){var c=[];k(a,function(a){if((!l||l&&a.size>0)&&(a.size%4096!==0||"."!==a.name&&"."!==a.fileName)&&!this.getFromUniqueIdentifier(this.generateUniqueIdentifier(a))){var d=new e(this,a);this.fire("fileAdded",d,b)&&c.push(d)}},this),this.fire("filesAdded",c,b)&&k(c,function(a){this.opts.singleFile&&this.files.length>0&&this.removeFile(this.files[0]),this.files.push(a)},this),this.fire("filesSubmitted",c,b)},removeFile:function(a){for(var b=this.files.length-1;b>=0;b--)this.files[b]===a&&(this.files.splice(b,1),a.abort())},getFromUniqueIdentifier:function(a){var b=!1;return k(this.files,function(c){c.uniqueIdentifier===a&&(b=c)}),b},getSize:function(){var a=0;return k(this.files,function(b){a+=b.size}),a},sizeUploaded:function(){var a=0;return k(this.files,function(b){a+=b.sizeUploaded()}),a},timeRemaining:function(){var a=0,b=0;return k(this.files,function(c){c.paused||c.error||(a+=c.size-c.sizeUploaded(),b+=c.averageSpeed)}),a&&!b?Number.POSITIVE_INFINITY:a||b?Math.floor(a/b):0}},e.prototype={measureSpeed:function(){var a=Date.now()-this._lastProgressCallback;if(a){var b=this.flowObj.opts.speedSmoothingFactor,c=this.sizeUploaded();this.currentSpeed=Math.max((c-this._prevUploadedSize)/a*1e3,0),this.averageSpeed=b*this.currentSpeed+(1-b)*this.averageSpeed,this._prevUploadedSize=c}},chunkEvent:function(a,b,c){switch(b){case"progress":if(Date.now()-this._lastProgressCallback<this.flowObj.opts.progressCallbacksInterval)break;this.measureSpeed(),this.flowObj.fire("fileProgress",this,a),this.flowObj.fire("progress"),this._lastProgressCallback=Date.now();break;case"error":this.error=!0,this.abort(!0),this.flowObj.fire("fileError",this,c,a),this.flowObj.fire("error",c,this,a);break;case"success":if(this.error)return;this.measureSpeed(),this.flowObj.fire("fileProgress",this,a),this.flowObj.fire("progress"),this._lastProgressCallback=Date.now(),this.isComplete()&&(this.currentSpeed=0,this.averageSpeed=0,this.flowObj.fire("fileSuccess",this,c,a));break;case"retry":this.flowObj.fire("fileRetry",this,a)}},pause:function(){this.paused=!0,this.abort()},resume:function(){this.paused=!1,this.flowObj.upload()},abort:function(a){this.currentSpeed=0,this.averageSpeed=0;var b=this.chunks;a&&(this.chunks=[]),k(b,function(a){"uploading"===a.status()&&(a.abort(),this.flowObj.uploadNextChunk())},this)},cancel:function(){this.flowObj.removeFile(this)},retry:function(){this.bootstrap(),this.flowObj.upload()},bootstrap:function(){this.abort(!0),this.error=!1,this._prevProgress=0;for(var a=this.flowObj.opts.forceChunkSize?Math.ceil:Math.floor,b=Math.max(a(this.file.size/this.flowObj.opts.chunkSize),1),c=0;b>c;c++)this.chunks.push(new f(this.flowObj,this,c))},progress:function(){if(this.error)return 1;if(1===this.chunks.length)return this._prevProgress=Math.max(this._prevProgress,this.chunks[0].progress()),this._prevProgress;var a=0;k(this.chunks,function(b){a+=b.progress()*(b.endByte-b.startByte)});var b=a/this.size;return this._prevProgress=Math.max(this._prevProgress,b>.9999?1:b),this._prevProgress},isUploading:function(){var a=!1;return k(this.chunks,function(b){return"uploading"===b.status()?(a=!0,!1):void 0}),a},isComplete:function(){var a=!1;return k(this.chunks,function(b){var c=b.status();return"pending"===c||"uploading"===c||1===b.preprocessState?(a=!0,!1):void 0}),!a},sizeUploaded:function(){var a=0;return k(this.chunks,function(b){a+=b.sizeUploaded()}),a},timeRemaining:function(){if(this.paused||this.error)return 0;var a=this.size-this.sizeUploaded();return a&&!this.averageSpeed?Number.POSITIVE_INFINITY:a||this.averageSpeed?Math.floor(a/this.averageSpeed):0},getType:function(){return this.file.type&&this.file.type.split("/")[1]},getExtension:function(){return this.name.substr((~-this.name.lastIndexOf(".")>>>0)+2).toLowerCase()}},f.prototype={getParams:function(){return{flowChunkNumber:this.offset+1,flowChunkSize:this.flowObj.opts.chunkSize,flowCurrentChunkSize:this.endByte-this.startByte,flowTotalSize:this.fileObjSize,flowIdentifier:this.fileObj.uniqueIdentifier,flowFilename:this.fileObj.name,flowRelativePath:this.fileObj.relativePath,flowTotalChunks:this.fileObj.chunks.length}},getTarget:function(a,b){return a+=a.indexOf("?")<0?"?":"&",a+b.join("&")},test:function(){this.xhr=new XMLHttpRequest,this.xhr.addEventListener("load",this.testHandler,!1),this.xhr.addEventListener("error",this.testHandler,!1);var a=h(this.flowObj.opts.testMethod,this.fileObj,this),b=this.prepareXhrRequest(a,!0);this.xhr.send(b)},preprocessFinished:function(){this.preprocessState=2,this.send()},send:function(){var a=this.flowObj.opts.preprocess;if("function"==typeof a)switch(this.preprocessState){case 0:return this.preprocessState=1,void a(this);case 1:return}if(this.flowObj.opts.testChunks&&!this.tested)return void this.test();this.loaded=0,this.total=0,this.pendingRetry=!1;var b=this.fileObj.file.slice?"slice":this.fileObj.file.mozSlice?"mozSlice":this.fileObj.file.webkitSlice?"webkitSlice":"slice",c=this.fileObj.file[b](this.startByte,this.endByte,this.fileObj.file.type);this.xhr=new XMLHttpRequest,this.xhr.upload.addEventListener("progress",this.progressHandler,!1),this.xhr.addEventListener("load",this.doneHandler,!1),this.xhr.addEventListener("error",this.doneHandler,!1);var d=h(this.flowObj.opts.uploadMethod,this.fileObj,this),e=this.prepareXhrRequest(d,!1,this.flowObj.opts.method,c);this.xhr.send(e)},abort:function(){var a=this.xhr;this.xhr=null,a&&a.abort()},status:function(a){return this.pendingRetry||1===this.preprocessState?"uploading":this.xhr?this.xhr.readyState<4?"uploading":this.flowObj.opts.successStatuses.indexOf(this.xhr.status)>-1?"success":this.flowObj.opts.permanentErrors.indexOf(this.xhr.status)>-1||!a&&this.retries>=this.flowObj.opts.maxChunkRetries?"error":(this.abort(),"pending"):"pending"},message:function(){return this.xhr?this.xhr.responseText:""},progress:function(){if(this.pendingRetry)return 0;var a=this.status();return"success"===a||"error"===a?1:"pending"===a?0:this.total>0?this.loaded/this.total:0},sizeUploaded:function(){var a=this.endByte-this.startByte;return"success"!==this.status()&&(a=this.progress()*a),a},prepareXhrRequest:function(a,b,c,d){var e=h(this.flowObj.opts.query,this.fileObj,this,b);e=j(this.getParams(),e);var f=h(this.flowObj.opts.target,this.fileObj,this,b),g=null;if("GET"===a||"octet"===c){var i=[];k(e,function(a,b){i.push([encodeURIComponent(b),encodeURIComponent(a)].join("="))}),f=this.getTarget(f,i),g=d||null}else g=new FormData,k(e,function(a,b){g.append(b,a)}),g.append(this.flowObj.opts.fileParameterName,d,this.fileObj.file.name);return this.xhr.open(a,f,!0),this.xhr.withCredentials=this.flowObj.opts.withCredentials,k(h(this.flowObj.opts.headers,this.fileObj,this,b),function(a,b){this.xhr.setRequestHeader(b,a)},this),g}},d.evalOpts=h,d.extend=j,d.each=k,d.FlowFile=e,d.FlowChunk=f,d.version="2.9.0","object"==typeof module&&module&&"object"==typeof module.exports?module.exports=d:(a.Flow=d,"function"==typeof define&&define.amd&&define("flow",[],function(){return d}))}(window,document);
|
js/lib/uploader/fusty-flow-factory.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (Flow, FustyFlow, window) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
var fustyFlowFactory = function (opts) {
|
5 |
+
var flow = new Flow(opts);
|
6 |
+
if (flow.support) {
|
7 |
+
return flow;
|
8 |
+
}
|
9 |
+
return new FustyFlow(opts);
|
10 |
+
}
|
11 |
+
|
12 |
+
window.fustyFlowFactory = fustyFlowFactory;
|
13 |
+
|
14 |
+
})(window.Flow, window.FustyFlow, window);
|
js/lib/uploader/fusty-flow.js
ADDED
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (Flow, window, document, undefined) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
var extend = Flow.extend;
|
5 |
+
var each = Flow.each;
|
6 |
+
|
7 |
+
function addEvent(element, type, handler) {
|
8 |
+
if (element.addEventListener) {
|
9 |
+
element.addEventListener(type, handler, false);
|
10 |
+
} else if (element.attachEvent) {
|
11 |
+
element.attachEvent("on" + type, handler);
|
12 |
+
} else {
|
13 |
+
element["on" + type] = handler;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
function removeEvent(element, type, handler) {
|
18 |
+
if (element.removeEventListener) {
|
19 |
+
element.removeEventListener(type, handler, false);
|
20 |
+
} else if (element.detachEvent) {
|
21 |
+
element.detachEvent("on" + type, handler);
|
22 |
+
} else {
|
23 |
+
element["on" + type] = null;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
function removeElement(element) {
|
28 |
+
element.parentNode.removeChild(element);
|
29 |
+
}
|
30 |
+
|
31 |
+
function isFunction(functionToCheck) {
|
32 |
+
var getType = {};
|
33 |
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Not resumable file upload library, for IE7-IE9 browsers
|
38 |
+
* @name FustyFlow
|
39 |
+
* @param [opts]
|
40 |
+
* @param {bool} [opts.singleFile]
|
41 |
+
* @param {string} [opts.fileParameterName]
|
42 |
+
* @param {Object|Function} [opts.query]
|
43 |
+
* @param {Object} [opts.headers]
|
44 |
+
* @param {string} [opts.target]
|
45 |
+
* @param {Function} [opts.generateUniqueIdentifier]
|
46 |
+
* @param {bool} [opts.matchJSON]
|
47 |
+
* @constructor
|
48 |
+
*/
|
49 |
+
function FustyFlow(opts) {
|
50 |
+
// Shortcut of "r instanceof Flow"
|
51 |
+
this.support = false;
|
52 |
+
|
53 |
+
this.files = [];
|
54 |
+
this.events = [];
|
55 |
+
this.defaults = {
|
56 |
+
simultaneousUploads: 3,
|
57 |
+
fileParameterName: 'file',
|
58 |
+
query: {},
|
59 |
+
target: '/',
|
60 |
+
generateUniqueIdentifier: null,
|
61 |
+
matchJSON: false
|
62 |
+
};
|
63 |
+
|
64 |
+
var $ = this;
|
65 |
+
|
66 |
+
this.inputChangeEvent = function (event) {
|
67 |
+
var input = event.target || event.srcElement;
|
68 |
+
removeEvent(input, 'change', $.inputChangeEvent);
|
69 |
+
var newClone = input.cloneNode(false);
|
70 |
+
// change current input with new one
|
71 |
+
input.parentNode.replaceChild(newClone, input);
|
72 |
+
// old input will be attached to hidden form
|
73 |
+
$.addFile(input, event);
|
74 |
+
// reset new input
|
75 |
+
newClone.value = '';
|
76 |
+
addEvent(newClone, 'change', $.inputChangeEvent);
|
77 |
+
};
|
78 |
+
|
79 |
+
this.opts = Flow.extend({}, this.defaults, opts || {});
|
80 |
+
}
|
81 |
+
|
82 |
+
FustyFlow.prototype = {
|
83 |
+
on: Flow.prototype.on,
|
84 |
+
off: Flow.prototype.off,
|
85 |
+
fire: Flow.prototype.fire,
|
86 |
+
cancel: Flow.prototype.cancel,
|
87 |
+
assignBrowse: function (domNodes) {
|
88 |
+
if (typeof domNodes.length == 'undefined') {
|
89 |
+
domNodes = [domNodes];
|
90 |
+
}
|
91 |
+
each(domNodes, function (domNode) {
|
92 |
+
var input;
|
93 |
+
if (domNode.tagName === 'INPUT' && domNode.type === 'file') {
|
94 |
+
input = domNode;
|
95 |
+
} else {
|
96 |
+
input = document.createElement('input');
|
97 |
+
input.setAttribute('type', 'file');
|
98 |
+
|
99 |
+
extend(domNode.style, {
|
100 |
+
display: 'inline-block',
|
101 |
+
position: 'relative',
|
102 |
+
overflow: 'hidden',
|
103 |
+
verticalAlign: 'top'
|
104 |
+
});
|
105 |
+
|
106 |
+
extend(input.style, {
|
107 |
+
position: 'absolute',
|
108 |
+
top: 0,
|
109 |
+
right: 0,
|
110 |
+
fontFamily: 'Arial',
|
111 |
+
// 4 persons reported this, the max values that worked for them were 243, 236, 236, 118
|
112 |
+
fontSize: '118px',
|
113 |
+
margin: 0,
|
114 |
+
padding: 0,
|
115 |
+
opacity: 0,
|
116 |
+
filter: 'alpha(opacity=0)',
|
117 |
+
cursor: 'pointer'
|
118 |
+
});
|
119 |
+
|
120 |
+
domNode.appendChild(input);
|
121 |
+
}
|
122 |
+
// When new files are added, simply append them to the overall list
|
123 |
+
addEvent(input, 'change', this.inputChangeEvent);
|
124 |
+
}, this);
|
125 |
+
},
|
126 |
+
assignDrop: function () {
|
127 |
+
// not supported
|
128 |
+
},
|
129 |
+
unAssignDrop: function () {
|
130 |
+
// not supported
|
131 |
+
},
|
132 |
+
isUploading: function () {
|
133 |
+
var uploading = false;
|
134 |
+
each(this.files, function (file) {
|
135 |
+
if (file.isUploading()) {
|
136 |
+
uploading = true;
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
});
|
140 |
+
return uploading;
|
141 |
+
},
|
142 |
+
upload: function () {
|
143 |
+
// Kick off the queue
|
144 |
+
var files = 0;
|
145 |
+
each(this.files, function (file) {
|
146 |
+
if (file.progress() == 1 || file.isPaused()) {
|
147 |
+
return;
|
148 |
+
}
|
149 |
+
if (file.isUploading()) {
|
150 |
+
files++;
|
151 |
+
return;
|
152 |
+
}
|
153 |
+
if (files++ >= this.opts.simultaneousUploads) {
|
154 |
+
return false;
|
155 |
+
}
|
156 |
+
if (files == 1) {
|
157 |
+
this.fire('uploadStart');
|
158 |
+
}
|
159 |
+
file.send();
|
160 |
+
}, this);
|
161 |
+
if (!files) {
|
162 |
+
this.fire('complete');
|
163 |
+
}
|
164 |
+
},
|
165 |
+
pause: function () {
|
166 |
+
each(this.files, function (file) {
|
167 |
+
file.pause();
|
168 |
+
});
|
169 |
+
},
|
170 |
+
resume: function () {
|
171 |
+
each(this.files, function (file) {
|
172 |
+
file.resume();
|
173 |
+
});
|
174 |
+
},
|
175 |
+
progress: function () {
|
176 |
+
var totalDone = 0;
|
177 |
+
var totalFiles = 0;
|
178 |
+
each(this.files, function (file) {
|
179 |
+
totalDone += file.progress();
|
180 |
+
totalFiles++;
|
181 |
+
});
|
182 |
+
return totalFiles > 0 ? totalDone / totalFiles : 0;
|
183 |
+
},
|
184 |
+
addFiles: function (elementsList, event) {
|
185 |
+
var files = [];
|
186 |
+
each(elementsList, function (element) {
|
187 |
+
// is domElement ?
|
188 |
+
if (element.nodeType === 1 && element.value) {
|
189 |
+
var f = new FustyFlowFile(this, element);
|
190 |
+
if (this.fire('fileAdded', f, event)) {
|
191 |
+
files.push(f);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}, this);
|
195 |
+
if (this.fire('filesAdded', files, event)) {
|
196 |
+
each(files, function (file) {
|
197 |
+
if (this.opts.singleFile && this.files.length > 0) {
|
198 |
+
this.removeFile(this.files[0]);
|
199 |
+
}
|
200 |
+
this.files.push(file);
|
201 |
+
}, this);
|
202 |
+
}
|
203 |
+
this.fire('filesSubmitted', files, event);
|
204 |
+
},
|
205 |
+
addFile: function (file, event) {
|
206 |
+
this.addFiles([file], event);
|
207 |
+
},
|
208 |
+
generateUniqueIdentifier: function (element) {
|
209 |
+
var custom = this.opts.generateUniqueIdentifier;
|
210 |
+
if (typeof custom === 'function') {
|
211 |
+
return custom(element);
|
212 |
+
}
|
213 |
+
return 'xxxxxxxx-xxxx-yxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
214 |
+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
215 |
+
return v.toString(16);
|
216 |
+
});
|
217 |
+
},
|
218 |
+
getFromUniqueIdentifier: function (uniqueIdentifier) {
|
219 |
+
var ret = false;
|
220 |
+
each(this.files, function (f) {
|
221 |
+
if (f.uniqueIdentifier == uniqueIdentifier) ret = f;
|
222 |
+
});
|
223 |
+
return ret;
|
224 |
+
},
|
225 |
+
removeFile: function (file) {
|
226 |
+
for (var i = this.files.length - 1; i >= 0; i--) {
|
227 |
+
if (this.files[i] === file) {
|
228 |
+
this.files.splice(i, 1);
|
229 |
+
}
|
230 |
+
}
|
231 |
+
},
|
232 |
+
getSize: function () {
|
233 |
+
// undefined
|
234 |
+
},
|
235 |
+
timeRemaining: function () {
|
236 |
+
// undefined
|
237 |
+
},
|
238 |
+
sizeUploaded: function () {
|
239 |
+
// undefined
|
240 |
+
}
|
241 |
+
};
|
242 |
+
|
243 |
+
function FustyFlowFile(flowObj, element) {
|
244 |
+
this.flowObj = flowObj;
|
245 |
+
this.element = element;
|
246 |
+
this.name = element.value && element.value.replace(/.*(\/|\\)/, "");
|
247 |
+
this.relativePath = this.name;
|
248 |
+
this.uniqueIdentifier = flowObj.generateUniqueIdentifier(element);
|
249 |
+
this.iFrame = null;
|
250 |
+
|
251 |
+
this.finished = false;
|
252 |
+
this.error = false;
|
253 |
+
this.paused = false;
|
254 |
+
|
255 |
+
var $ = this;
|
256 |
+
this.iFrameLoaded = function (event) {
|
257 |
+
// when we remove iframe from dom
|
258 |
+
// the request stops, but in IE load
|
259 |
+
// event fires
|
260 |
+
if (!$.iFrame || !$.iFrame.parentNode) {
|
261 |
+
return;
|
262 |
+
}
|
263 |
+
$.finished = true;
|
264 |
+
try {
|
265 |
+
// fixing Opera 10.53
|
266 |
+
if ($.iFrame.contentDocument &&
|
267 |
+
$.iFrame.contentDocument.body &&
|
268 |
+
$.iFrame.contentDocument.body.innerHTML == "false") {
|
269 |
+
// In Opera event is fired second time
|
270 |
+
// when body.innerHTML changed from false
|
271 |
+
// to server response approx. after 1 sec
|
272 |
+
// when we upload file with iframe
|
273 |
+
return;
|
274 |
+
}
|
275 |
+
} catch (error) {
|
276 |
+
//IE may throw an "access is denied" error when attempting to access contentDocument
|
277 |
+
$.error = true;
|
278 |
+
$.abort();
|
279 |
+
$.flowObj.fire('fileError', $, error);
|
280 |
+
return;
|
281 |
+
}
|
282 |
+
// iframe.contentWindow.document - for IE<7
|
283 |
+
var doc = $.iFrame.contentDocument || $.iFrame.contentWindow.document;
|
284 |
+
var innerHtml = doc.body.innerHTML;
|
285 |
+
if ($.flowObj.opts.matchJSON) {
|
286 |
+
innerHtml = /(\{.*\})/.exec(innerHtml)[0];
|
287 |
+
}
|
288 |
+
|
289 |
+
$.abort();
|
290 |
+
$.flowObj.fire('fileSuccess', $, innerHtml);
|
291 |
+
$.flowObj.upload();
|
292 |
+
};
|
293 |
+
this.bootstrap();
|
294 |
+
}
|
295 |
+
|
296 |
+
FustyFlowFile.prototype = {
|
297 |
+
getExtension: Flow.FlowFile.prototype.getExtension,
|
298 |
+
getType: function () {
|
299 |
+
// undefined
|
300 |
+
},
|
301 |
+
send: function () {
|
302 |
+
if (this.finished) {
|
303 |
+
return;
|
304 |
+
}
|
305 |
+
var o = this.flowObj.opts;
|
306 |
+
var form = this.createForm();
|
307 |
+
var params = o.query;
|
308 |
+
if (isFunction(params)) {
|
309 |
+
params = params(this);
|
310 |
+
}
|
311 |
+
params[o.fileParameterName] = this.element;
|
312 |
+
params['flowFilename'] = this.name;
|
313 |
+
params['flowRelativePath'] = this.relativePath;
|
314 |
+
params['flowIdentifier'] = this.uniqueIdentifier;
|
315 |
+
|
316 |
+
this.addFormParams(form, params);
|
317 |
+
addEvent(this.iFrame, 'load', this.iFrameLoaded);
|
318 |
+
form.submit();
|
319 |
+
removeElement(form);
|
320 |
+
},
|
321 |
+
abort: function (noupload) {
|
322 |
+
if (this.iFrame) {
|
323 |
+
this.iFrame.setAttribute('src', 'java' + String.fromCharCode(115) + 'cript:false;');
|
324 |
+
removeElement(this.iFrame);
|
325 |
+
this.iFrame = null;
|
326 |
+
!noupload && this.flowObj.upload();
|
327 |
+
}
|
328 |
+
},
|
329 |
+
cancel: function () {
|
330 |
+
this.flowObj.removeFile(this);
|
331 |
+
this.abort();
|
332 |
+
},
|
333 |
+
retry: function () {
|
334 |
+
this.bootstrap();
|
335 |
+
this.flowObj.upload();
|
336 |
+
},
|
337 |
+
bootstrap: function () {
|
338 |
+
this.abort(true);
|
339 |
+
this.finished = false;
|
340 |
+
this.error = false;
|
341 |
+
},
|
342 |
+
timeRemaining: function () {
|
343 |
+
// undefined
|
344 |
+
},
|
345 |
+
sizeUploaded: function () {
|
346 |
+
// undefined
|
347 |
+
},
|
348 |
+
resume: function () {
|
349 |
+
this.paused = false;
|
350 |
+
this.flowObj.upload();
|
351 |
+
},
|
352 |
+
pause: function () {
|
353 |
+
this.paused = true;
|
354 |
+
this.abort();
|
355 |
+
},
|
356 |
+
isUploading: function () {
|
357 |
+
return this.iFrame !== null;
|
358 |
+
},
|
359 |
+
isPaused: function () {
|
360 |
+
return this.paused;
|
361 |
+
},
|
362 |
+
isComplete: function () {
|
363 |
+
return this.progress() === 1;
|
364 |
+
},
|
365 |
+
progress: function () {
|
366 |
+
if (this.error) {
|
367 |
+
return 1;
|
368 |
+
}
|
369 |
+
return this.finished ? 1 : 0;
|
370 |
+
},
|
371 |
+
|
372 |
+
createIframe: function () {
|
373 |
+
var iFrame = (/MSIE (6|7|8)/).test(navigator.userAgent) ?
|
374 |
+
document.createElement('<iframe name="' + this.uniqueIdentifier + '_iframe' + '">') :
|
375 |
+
document.createElement('iframe');
|
376 |
+
|
377 |
+
iFrame.setAttribute('id', this.uniqueIdentifier + '_iframe_id');
|
378 |
+
iFrame.setAttribute('name', this.uniqueIdentifier + '_iframe');
|
379 |
+
iFrame.style.display = 'none';
|
380 |
+
document.body.appendChild(iFrame);
|
381 |
+
return iFrame;
|
382 |
+
},
|
383 |
+
createForm: function() {
|
384 |
+
var target = this.flowObj.opts.target;
|
385 |
+
if (typeof target === "function") {
|
386 |
+
target = target.apply(null);
|
387 |
+
}
|
388 |
+
|
389 |
+
var form = document.createElement('form');
|
390 |
+
form.encoding = "multipart/form-data";
|
391 |
+
form.method = "POST";
|
392 |
+
form.setAttribute('action', target);
|
393 |
+
if (!this.iFrame) {
|
394 |
+
this.iFrame = this.createIframe();
|
395 |
+
}
|
396 |
+
form.setAttribute('target', this.iFrame.name);
|
397 |
+
form.style.display = 'none';
|
398 |
+
document.body.appendChild(form);
|
399 |
+
return form;
|
400 |
+
},
|
401 |
+
addFormParams: function(form, params) {
|
402 |
+
var input;
|
403 |
+
each(params, function (value, key) {
|
404 |
+
if (value && value.nodeType === 1) {
|
405 |
+
input = value;
|
406 |
+
} else {
|
407 |
+
input = document.createElement('input');
|
408 |
+
input.setAttribute('value', value);
|
409 |
+
}
|
410 |
+
input.setAttribute('name', key);
|
411 |
+
form.appendChild(input);
|
412 |
+
});
|
413 |
+
}
|
414 |
+
};
|
415 |
+
|
416 |
+
FustyFlow.FustyFlowFile = FustyFlowFile;
|
417 |
+
|
418 |
+
if (typeof module !== 'undefined') {
|
419 |
+
module.exports = FustyFlow;
|
420 |
+
} else if (typeof define === "function" && define.amd) {
|
421 |
+
// AMD/requirejs: Define the module
|
422 |
+
define(function(){
|
423 |
+
return FustyFlow;
|
424 |
+
});
|
425 |
+
} else {
|
426 |
+
window.FustyFlow = FustyFlow;
|
427 |
+
}
|
428 |
+
})(window.Flow, window, document);
|
429 |
+
|
js/mage/adminhtml/accordion.js
CHANGED
@@ -136,4 +136,4 @@ varienAccordion.prototype = {
|
|
136 |
}
|
137 |
}
|
138 |
}
|
139 |
-
}
|
136 |
}
|
137 |
}
|
138 |
}
|
139 |
+
};
|
js/mage/adminhtml/backup.js
CHANGED
@@ -189,4 +189,4 @@ AdminBackup.prototype = {
|
|
189 |
$$('.backup-dialog').each(Element.hide);
|
190 |
$('popup-window-mask').hide();
|
191 |
}
|
192 |
-
}
|
189 |
$$('.backup-dialog').each(Element.hide);
|
190 |
$('popup-window-mask').hide();
|
191 |
}
|
192 |
+
};
|
js/mage/adminhtml/browser.js
CHANGED
@@ -140,7 +140,7 @@ Mediabrowser.prototype = {
|
|
140 |
var div = Event.findElement(event, 'DIV');
|
141 |
$$('div.filecnt.selected[id!="' + div.id + '"]').each(function(e) {
|
142 |
e.removeClassName('selected');
|
143 |
-
})
|
144 |
div.toggleClassName('selected');
|
145 |
if(div.hasClassName('selected')) {
|
146 |
this.showFileButtons();
|
@@ -265,7 +265,7 @@ Mediabrowser.prototype = {
|
|
265 |
try {
|
266 |
this.onAjaxSuccess(transport);
|
267 |
if (transport.responseText.isJSON()) {
|
268 |
-
var response = transport.responseText.evalJSON()
|
269 |
var newNode = new Ext.tree.AsyncTreeNode({
|
270 |
text: response.short_name,
|
271 |
draggable:false,
|
@@ -281,7 +281,7 @@ Mediabrowser.prototype = {
|
|
281 |
alert(e.message);
|
282 |
}
|
283 |
}.bind(this)
|
284 |
-
})
|
285 |
},
|
286 |
|
287 |
deleteFolder: function() {
|
@@ -300,7 +300,7 @@ Mediabrowser.prototype = {
|
|
300 |
alert(e.message);
|
301 |
}
|
302 |
}.bind(this)
|
303 |
-
})
|
304 |
},
|
305 |
|
306 |
deleteFiles: function() {
|
@@ -384,7 +384,7 @@ Mediabrowser.prototype = {
|
|
384 |
|
385 |
onAjaxSuccess: function(transport) {
|
386 |
if (transport.responseText.isJSON()) {
|
387 |
-
var response = transport.responseText.evalJSON()
|
388 |
if (response.error) {
|
389 |
throw response;
|
390 |
} else if (response.ajaxExpired && response.ajaxRedirect) {
|
@@ -392,4 +392,4 @@ Mediabrowser.prototype = {
|
|
392 |
}
|
393 |
}
|
394 |
}
|
395 |
-
}
|
140 |
var div = Event.findElement(event, 'DIV');
|
141 |
$$('div.filecnt.selected[id!="' + div.id + '"]').each(function(e) {
|
142 |
e.removeClassName('selected');
|
143 |
+
});
|
144 |
div.toggleClassName('selected');
|
145 |
if(div.hasClassName('selected')) {
|
146 |
this.showFileButtons();
|
265 |
try {
|
266 |
this.onAjaxSuccess(transport);
|
267 |
if (transport.responseText.isJSON()) {
|
268 |
+
var response = transport.responseText.evalJSON();
|
269 |
var newNode = new Ext.tree.AsyncTreeNode({
|
270 |
text: response.short_name,
|
271 |
draggable:false,
|
281 |
alert(e.message);
|
282 |
}
|
283 |
}.bind(this)
|
284 |
+
});
|
285 |
},
|
286 |
|
287 |
deleteFolder: function() {
|
300 |
alert(e.message);
|
301 |
}
|
302 |
}.bind(this)
|
303 |
+
});
|
304 |
},
|
305 |
|
306 |
deleteFiles: function() {
|
384 |
|
385 |
onAjaxSuccess: function(transport) {
|
386 |
if (transport.responseText.isJSON()) {
|
387 |
+
var response = transport.responseText.evalJSON();
|
388 |
if (response.error) {
|
389 |
throw response;
|
390 |
} else if (response.ajaxExpired && response.ajaxRedirect) {
|
392 |
}
|
393 |
}
|
394 |
}
|
395 |
+
};
|
js/mage/adminhtml/events.js
CHANGED
@@ -102,7 +102,9 @@ varienEvents.prototype = {
|
|
102 |
if (this.arrEvents[evtName][i].asynch) {
|
103 |
var eventArgs = arguments[1];
|
104 |
var method = this.arrEvents[evtName][i].method.bind(this);
|
105 |
-
setTimeout(function() {
|
|
|
|
|
106 |
}
|
107 |
else{
|
108 |
result = this.arrEvents[evtName][i].method(arguments[1]);
|
102 |
if (this.arrEvents[evtName][i].asynch) {
|
103 |
var eventArgs = arguments[1];
|
104 |
var method = this.arrEvents[evtName][i].method.bind(this);
|
105 |
+
setTimeout(function() {
|
106 |
+
method(eventArgs);
|
107 |
+
}.bind(this), 10);
|
108 |
}
|
109 |
else{
|
110 |
result = this.arrEvents[evtName][i].method(arguments[1]);
|
js/mage/adminhtml/flexuploader.js
CHANGED
@@ -303,9 +303,9 @@ if(!window.Flex) {
|
|
303 |
this.files.each(function(file){
|
304 |
if (file.size > maxUploadFileSizeInBytes) {
|
305 |
hasTooBigFiles = true;
|
306 |
-
this.uploader.removeFile(file.id)
|
307 |
} else {
|
308 |
-
newFiles.push(file)
|
309 |
}
|
310 |
}.bind(this));
|
311 |
this.files = newFiles;
|
@@ -363,10 +363,10 @@ if(!window.Flex) {
|
|
363 |
checkAllComplete: function() {
|
364 |
if (this.files) {
|
365 |
return !this.files.any(function(file) {
|
366 |
-
return (file.status !== 'full_complete')
|
367 |
});
|
368 |
}
|
369 |
return true;
|
370 |
}
|
371 |
-
}
|
372 |
}
|
303 |
this.files.each(function(file){
|
304 |
if (file.size > maxUploadFileSizeInBytes) {
|
305 |
hasTooBigFiles = true;
|
306 |
+
this.uploader.removeFile(file.id);
|
307 |
} else {
|
308 |
+
newFiles.push(file);
|
309 |
}
|
310 |
}.bind(this));
|
311 |
this.files = newFiles;
|
363 |
checkAllComplete: function() {
|
364 |
if (this.files) {
|
365 |
return !this.files.any(function(file) {
|
366 |
+
return (file.status !== 'full_complete');
|
367 |
});
|
368 |
}
|
369 |
return true;
|
370 |
}
|
371 |
+
};
|
372 |
}
|
js/mage/adminhtml/form.js
CHANGED
@@ -107,7 +107,7 @@ varienForm.prototype = {
|
|
107 |
}
|
108 |
$form.submit();
|
109 |
}
|
110 |
-
}
|
111 |
|
112 |
/**
|
113 |
* redeclare Validation.isVisible function
|
@@ -124,7 +124,7 @@ Validation.isVisible = function(elm){
|
|
124 |
elm = elm.parentNode;
|
125 |
}
|
126 |
return true;
|
127 |
-
}
|
128 |
|
129 |
/**
|
130 |
* Additional elements methods
|
@@ -135,7 +135,7 @@ var varienElementMethods = {
|
|
135 |
var elm = element;
|
136 |
while(elm && elm.tagName != 'BODY') {
|
137 |
if(elm.statusBar)
|
138 |
-
Element.addClassName($(elm.statusBar), 'changed')
|
139 |
elm = elm.parentNode;
|
140 |
}
|
141 |
},
|
@@ -154,14 +154,14 @@ var varienElementMethods = {
|
|
154 |
form.errorSections.set(elm.statusBar.id, flag);
|
155 |
}
|
156 |
else if(!form.errorSections.get(elm.statusBar.id)){
|
157 |
-
Element.removeClassName($(elm.statusBar), 'error')
|
158 |
}
|
159 |
}
|
160 |
elm = elm.parentNode;
|
161 |
}
|
162 |
this.canShowElement = false;
|
163 |
}
|
164 |
-
}
|
165 |
|
166 |
Element.addMethods(varienElementMethods);
|
167 |
|
@@ -388,7 +388,7 @@ RegionUpdater.prototype = {
|
|
388 |
$(elem).value = currentVal;
|
389 |
return;
|
390 |
}
|
391 |
-
}
|
392 |
|
393 |
regionUpdater = RegionUpdater;
|
394 |
|
@@ -402,7 +402,7 @@ Event.pointerX = function(event){
|
|
402 |
catch(e){
|
403 |
|
404 |
}
|
405 |
-
}
|
406 |
Event.pointerY = function(event){
|
407 |
try{
|
408 |
return event.pageY || (event.clientY +(document.documentElement.scrollTop || document.body.scrollTop));
|
@@ -410,7 +410,7 @@ Event.pointerY = function(event){
|
|
410 |
catch(e){
|
411 |
|
412 |
}
|
413 |
-
}
|
414 |
|
415 |
SelectUpdater = Class.create();
|
416 |
SelectUpdater.prototype = {
|
@@ -465,7 +465,7 @@ SelectUpdater.prototype = {
|
|
465 |
select.appendChild(option);
|
466 |
}
|
467 |
}
|
468 |
-
}
|
469 |
|
470 |
|
471 |
/**
|
@@ -561,4 +561,4 @@ FormElementDependenceController.prototype = {
|
|
561 |
$(idTo).up(this._config.levels_up).hide();
|
562 |
}
|
563 |
}
|
564 |
-
}
|
107 |
}
|
108 |
$form.submit();
|
109 |
}
|
110 |
+
};
|
111 |
|
112 |
/**
|
113 |
* redeclare Validation.isVisible function
|
124 |
elm = elm.parentNode;
|
125 |
}
|
126 |
return true;
|
127 |
+
};
|
128 |
|
129 |
/**
|
130 |
* Additional elements methods
|
135 |
var elm = element;
|
136 |
while(elm && elm.tagName != 'BODY') {
|
137 |
if(elm.statusBar)
|
138 |
+
Element.addClassName($(elm.statusBar), 'changed');
|
139 |
elm = elm.parentNode;
|
140 |
}
|
141 |
},
|
154 |
form.errorSections.set(elm.statusBar.id, flag);
|
155 |
}
|
156 |
else if(!form.errorSections.get(elm.statusBar.id)){
|
157 |
+
Element.removeClassName($(elm.statusBar), 'error');
|
158 |
}
|
159 |
}
|
160 |
elm = elm.parentNode;
|
161 |
}
|
162 |
this.canShowElement = false;
|
163 |
}
|
164 |
+
};
|
165 |
|
166 |
Element.addMethods(varienElementMethods);
|
167 |
|
388 |
$(elem).value = currentVal;
|
389 |
return;
|
390 |
}
|
391 |
+
};
|
392 |
|
393 |
regionUpdater = RegionUpdater;
|
394 |
|
402 |
catch(e){
|
403 |
|
404 |
}
|
405 |
+
};
|
406 |
Event.pointerY = function(event){
|
407 |
try{
|
408 |
return event.pageY || (event.clientY +(document.documentElement.scrollTop || document.body.scrollTop));
|
410 |
catch(e){
|
411 |
|
412 |
}
|
413 |
+
};
|
414 |
|
415 |
SelectUpdater = Class.create();
|
416 |
SelectUpdater.prototype = {
|
465 |
select.appendChild(option);
|
466 |
}
|
467 |
}
|
468 |
+
};
|
469 |
|
470 |
|
471 |
/**
|
561 |
$(idTo).up(this._config.levels_up).hide();
|
562 |
}
|
563 |
}
|
564 |
+
};
|
js/mage/adminhtml/giftmessage.js
CHANGED
@@ -217,7 +217,7 @@ GiftOptionsPopup.prototype = {
|
|
217 |
this.giftOptionsWindowMask.style.display = 'none';
|
218 |
this.giftOptionsWindow.style.display = 'none';
|
219 |
}
|
220 |
-
}
|
221 |
|
222 |
|
223 |
/********************* GIFT OPTIONS SET ***********************/
|
@@ -241,7 +241,7 @@ GiftMessageSet.prototype = {
|
|
241 |
if ($('gift-message-form-data-' + this.id)) {
|
242 |
this.fields.each(function(el) {
|
243 |
if ($(this.sourcePrefix + this.id + '_' + el) && $(this.destPrefix + el)) {
|
244 |
-
$(this.destPrefix + el).value = $(this.sourcePrefix + this.id + '_' + el).value
|
245 |
}
|
246 |
}, this);
|
247 |
$('gift_options_giftmessage').show();
|
@@ -268,4 +268,4 @@ GiftMessageSet.prototype = {
|
|
268 |
order.loadArea(['items'], true, data.toObject());
|
269 |
}
|
270 |
}
|
271 |
-
}
|
217 |
this.giftOptionsWindowMask.style.display = 'none';
|
218 |
this.giftOptionsWindow.style.display = 'none';
|
219 |
}
|
220 |
+
};
|
221 |
|
222 |
|
223 |
/********************* GIFT OPTIONS SET ***********************/
|
241 |
if ($('gift-message-form-data-' + this.id)) {
|
242 |
this.fields.each(function(el) {
|
243 |
if ($(this.sourcePrefix + this.id + '_' + el) && $(this.destPrefix + el)) {
|
244 |
+
$(this.destPrefix + el).value = $(this.sourcePrefix + this.id + '_' + el).value;
|
245 |
}
|
246 |
}, this);
|
247 |
$('gift_options_giftmessage').show();
|
268 |
order.loadArea(['items'], true, data.toObject());
|
269 |
}
|
270 |
}
|
271 |
+
};
|
js/mage/adminhtml/giftoptions/tooltip.js
CHANGED
@@ -149,7 +149,7 @@ GiftOptionsTooltip.prototype = {
|
|
149 |
tooltipContent = this._tooltipContentLoaderFunction(itemId);
|
150 |
}
|
151 |
if (tooltipContent != '') {
|
152 |
-
this._updateTooltipWindowContent(tooltipContent)
|
153 |
this._moveTooltip(event);
|
154 |
new Element.show(this._tooltipWindow);
|
155 |
return true;
|
@@ -206,6 +206,6 @@ GiftOptionsTooltip.prototype = {
|
|
206 |
{
|
207 |
this._tooltipWindowContent.update(content);
|
208 |
}
|
209 |
-
}
|
210 |
|
211 |
giftOptionsTooltip = new GiftOptionsTooltip();
|
149 |
tooltipContent = this._tooltipContentLoaderFunction(itemId);
|
150 |
}
|
151 |
if (tooltipContent != '') {
|
152 |
+
this._updateTooltipWindowContent(tooltipContent);
|
153 |
this._moveTooltip(event);
|
154 |
new Element.show(this._tooltipWindow);
|
155 |
return true;
|
206 |
{
|
207 |
this._tooltipWindowContent.update(content);
|
208 |
}
|
209 |
+
};
|
210 |
|
211 |
giftOptionsTooltip = new GiftOptionsTooltip();
|
js/mage/adminhtml/grid.js
CHANGED
@@ -178,7 +178,7 @@ varienGrid.prototype = {
|
|
178 |
var responseText = transport.responseText.replace(/>\s+</g, '><');
|
179 |
|
180 |
if (transport.responseText.isJSON()) {
|
181 |
-
var response = transport.responseText.evalJSON()
|
182 |
if (response.error) {
|
183 |
alert(response.message);
|
184 |
}
|
@@ -898,7 +898,7 @@ serializerController.prototype = {
|
|
898 |
|
899 |
//Stuff methods
|
900 |
getGridDataHash: function (_object){
|
901 |
-
return $H(this.multidimensionalMode ? _object : this.convertArrayToObject(_object))
|
902 |
},
|
903 |
getDataForReloadParam: function(){
|
904 |
return this.multidimensionalMode ? this.gridData.keys() : this.gridData.values();
|
178 |
var responseText = transport.responseText.replace(/>\s+</g, '><');
|
179 |
|
180 |
if (transport.responseText.isJSON()) {
|
181 |
+
var response = transport.responseText.evalJSON();
|
182 |
if (response.error) {
|
183 |
alert(response.message);
|
184 |
}
|
898 |
|
899 |
//Stuff methods
|
900 |
getGridDataHash: function (_object){
|
901 |
+
return $H(this.multidimensionalMode ? _object : this.convertArrayToObject(_object));
|
902 |
},
|
903 |
getDataForReloadParam: function(){
|
904 |
return this.multidimensionalMode ? this.gridData.keys() : this.gridData.values();
|
js/mage/adminhtml/image.js
CHANGED
@@ -87,5 +87,5 @@ if(!window.Flex) {
|
|
87 |
getImage: function() {
|
88 |
this.getInnerElement('b64').value = this.flex.getBridge().getBase64Image();
|
89 |
}
|
90 |
-
}
|
91 |
}
|
87 |
getImage: function() {
|
88 |
this.getInnerElement('b64').value = this.flex.getBridge().getBase64Image();
|
89 |
}
|
90 |
+
};
|
91 |
}
|
js/mage/adminhtml/loader.js
CHANGED
@@ -137,7 +137,7 @@ varienLoader.prototype = {
|
|
137 |
|
138 |
getCache : function(url){
|
139 |
if(this.cache.get(url)){
|
140 |
-
return this.cache.get(url)
|
141 |
}
|
142 |
return false;
|
143 |
},
|
@@ -183,7 +183,7 @@ varienLoader.prototype = {
|
|
183 |
this.callback(transport.responseText);
|
184 |
}
|
185 |
}
|
186 |
-
}
|
187 |
|
188 |
if (!window.varienLoaderHandler)
|
189 |
var varienLoaderHandler = new Object();
|
@@ -197,7 +197,7 @@ varienLoaderHandler.handler = {
|
|
197 |
request.options.loaderArea = $$('#html-body .wrapper')[0]; // Blocks all page
|
198 |
|
199 |
if(request && request.options.loaderArea){
|
200 |
-
Element.clonePosition($('loading-mask'), $(request.options.loaderArea), {offsetLeft:-2})
|
201 |
toggleSelectsUnderBlock($('loading-mask'), false);
|
202 |
Element.show('loading-mask');
|
203 |
setLoaderPosition();
|
137 |
|
138 |
getCache : function(url){
|
139 |
if(this.cache.get(url)){
|
140 |
+
return this.cache.get(url);
|
141 |
}
|
142 |
return false;
|
143 |
},
|
183 |
this.callback(transport.responseText);
|
184 |
}
|
185 |
}
|
186 |
+
};
|
187 |
|
188 |
if (!window.varienLoaderHandler)
|
189 |
var varienLoaderHandler = new Object();
|
197 |
request.options.loaderArea = $$('#html-body .wrapper')[0]; // Blocks all page
|
198 |
|
199 |
if(request && request.options.loaderArea){
|
200 |
+
Element.clonePosition($('loading-mask'), $(request.options.loaderArea), {offsetLeft:-2});
|
201 |
toggleSelectsUnderBlock($('loading-mask'), false);
|
202 |
Element.show('loading-mask');
|
203 |
setLoaderPosition();
|
js/mage/adminhtml/product.js
CHANGED
@@ -34,18 +34,18 @@ Product.Gallery.prototype = {
|
|
34 |
idIncrement :1,
|
35 |
containerId :'',
|
36 |
container :null,
|
37 |
-
uploader :null,
|
38 |
imageTypes : {},
|
39 |
-
initialize : function(containerId,
|
40 |
this.containerId = containerId, this.container = $(this.containerId);
|
41 |
-
this.uploader = uploader;
|
42 |
this.imageTypes = imageTypes;
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
49 |
this.images = this.getElement('save').value.evalJSON();
|
50 |
this.imagesValues = this.getElement('save_image').value.evalJSON();
|
51 |
this.template = new Template('<tr id="__id__" class="preview">' + this
|
@@ -56,6 +56,9 @@ Product.Gallery.prototype = {
|
|
56 |
varienGlobalEvents.attachEventHandler('moveTab', this.onImageTabMove
|
57 |
.bind(this));
|
58 |
},
|
|
|
|
|
|
|
59 |
onImageTabMove : function(event) {
|
60 |
var imagesTab = false;
|
61 |
this.container.ancestors().each( function(parentItem) {
|
@@ -113,7 +116,6 @@ Product.Gallery.prototype = {
|
|
113 |
newImage.disabled = 0;
|
114 |
newImage.removed = 0;
|
115 |
this.images.push(newImage);
|
116 |
-
this.uploader.removeFile(item.id);
|
117 |
}.bind(this));
|
118 |
this.container.setHasChanges();
|
119 |
this.updateImages();
|
@@ -397,7 +399,7 @@ Product.Configurable.prototype = {
|
|
397 |
li.id = this.idPrefix + '_attribute_' + index;
|
398 |
attribute.html_id = li.id;
|
399 |
if (attribute && attribute.label && attribute.label.blank()) {
|
400 |
-
attribute.label = ' '
|
401 |
}
|
402 |
var label_readonly = '';
|
403 |
var use_default_checked = '';
|
@@ -475,7 +477,7 @@ Product.Configurable.prototype = {
|
|
475 |
this.grid.reload(null);
|
476 |
},
|
477 |
createEmptyProduct : function() {
|
478 |
-
this.createPopup(this.createEmptyUrl)
|
479 |
},
|
480 |
createNewProduct : function() {
|
481 |
this.createPopup(this.createNormalUrl);
|
@@ -988,7 +990,7 @@ Product.Configurable.prototype = {
|
|
988 |
showNoticeMessage : function() {
|
989 |
$('assign_product_warrning').show();
|
990 |
}
|
991 |
-
}
|
992 |
|
993 |
var onInitDisableFieldsList = [];
|
994 |
|
34 |
idIncrement :1,
|
35 |
containerId :'',
|
36 |
container :null,
|
|
|
37 |
imageTypes : {},
|
38 |
+
initialize : function(containerId, imageTypes) {
|
39 |
this.containerId = containerId, this.container = $(this.containerId);
|
|
|
40 |
this.imageTypes = imageTypes;
|
41 |
+
|
42 |
+
document.on('uploader:fileSuccess', function(event) {
|
43 |
+
var memo = event.memo;
|
44 |
+
if(memo && this._checkCurrentContainer(memo.containerId)) {
|
45 |
+
this.handleUploadComplete([{response: memo.response}]);
|
46 |
+
}
|
47 |
+
}.bind(this));
|
48 |
+
|
49 |
this.images = this.getElement('save').value.evalJSON();
|
50 |
this.imagesValues = this.getElement('save_image').value.evalJSON();
|
51 |
this.template = new Template('<tr id="__id__" class="preview">' + this
|
56 |
varienGlobalEvents.attachEventHandler('moveTab', this.onImageTabMove
|
57 |
.bind(this));
|
58 |
},
|
59 |
+
_checkCurrentContainer: function(child) {
|
60 |
+
return $(this.containerId).down('#' + child);
|
61 |
+
},
|
62 |
onImageTabMove : function(event) {
|
63 |
var imagesTab = false;
|
64 |
this.container.ancestors().each( function(parentItem) {
|
116 |
newImage.disabled = 0;
|
117 |
newImage.removed = 0;
|
118 |
this.images.push(newImage);
|
|
|
119 |
}.bind(this));
|
120 |
this.container.setHasChanges();
|
121 |
this.updateImages();
|
399 |
li.id = this.idPrefix + '_attribute_' + index;
|
400 |
attribute.html_id = li.id;
|
401 |
if (attribute && attribute.label && attribute.label.blank()) {
|
402 |
+
attribute.label = ' ';
|
403 |
}
|
404 |
var label_readonly = '';
|
405 |
var use_default_checked = '';
|
477 |
this.grid.reload(null);
|
478 |
},
|
479 |
createEmptyProduct : function() {
|
480 |
+
this.createPopup(this.createEmptyUrl);
|
481 |
},
|
482 |
createNewProduct : function() {
|
483 |
this.createPopup(this.createNormalUrl);
|
990 |
showNoticeMessage : function() {
|
991 |
$('assign_product_warrning').show();
|
992 |
}
|
993 |
+
};
|
994 |
|
995 |
var onInitDisableFieldsList = [];
|
996 |
|
js/mage/adminhtml/product/composite/configure.js
CHANGED
@@ -430,13 +430,13 @@ ProductConfigure.prototype = {
|
|
430 |
var states = new Array;
|
431 |
var selects = this.blockForm.getElementsByTagName("select");
|
432 |
for(var i=0; i<selects.length; i++){
|
433 |
-
states[i] = selects[i].style.visibility
|
434 |
}
|
435 |
}
|
436 |
toggleSelectsUnderBlock(this.blockMask, flag);
|
437 |
if (this.blockForm) {
|
438 |
for(i=0; i<selects.length; i++){
|
439 |
-
selects[i].style.visibility = states[i]
|
440 |
}
|
441 |
}
|
442 |
}
|
@@ -584,7 +584,7 @@ ProductConfigure.prototype = {
|
|
584 |
var pattern = null;
|
585 |
var patternFlat = null;
|
586 |
var replacement = null;
|
587 |
-
var replacementFlat = null
|
588 |
var scopeArr = blockItem.id.match(/.*\[\w+\]\[([^\]]+)\]$/);
|
589 |
var itemId = scopeArr[1];
|
590 |
if (method == 'current_confirmed_to_form') {
|
430 |
var states = new Array;
|
431 |
var selects = this.blockForm.getElementsByTagName("select");
|
432 |
for(var i=0; i<selects.length; i++){
|
433 |
+
states[i] = selects[i].style.visibility;
|
434 |
}
|
435 |
}
|
436 |
toggleSelectsUnderBlock(this.blockMask, flag);
|
437 |
if (this.blockForm) {
|
438 |
for(i=0; i<selects.length; i++){
|
439 |
+
selects[i].style.visibility = states[i];
|
440 |
}
|
441 |
}
|
442 |
}
|
584 |
var pattern = null;
|
585 |
var patternFlat = null;
|
586 |
var replacement = null;
|
587 |
+
var replacementFlat = null;
|
588 |
var scopeArr = blockItem.id.match(/.*\[\w+\]\[([^\]]+)\]$/);
|
589 |
var itemId = scopeArr[1];
|
590 |
if (method == 'current_confirmed_to_form') {
|
js/mage/adminhtml/rules.js
CHANGED
@@ -313,7 +313,7 @@ VarienRulesForm.prototype = {
|
|
313 |
|
314 |
_processSuccess : function(transport) {
|
315 |
if (transport.responseText.isJSON()) {
|
316 |
-
var response = transport.responseText.evalJSON()
|
317 |
if (response.error) {
|
318 |
alert(response.message);
|
319 |
}
|
@@ -380,4 +380,4 @@ VarienRulesForm.prototype = {
|
|
380 |
grid.reloadParams = {'selected[]':this.chooserSelectedItems.keys()};
|
381 |
this.updateElement.value = this.chooserSelectedItems.keys().join(', ');
|
382 |
}
|
383 |
-
}
|
313 |
|
314 |
_processSuccess : function(transport) {
|
315 |
if (transport.responseText.isJSON()) {
|
316 |
+
var response = transport.responseText.evalJSON();
|
317 |
if (response.error) {
|
318 |
alert(response.message);
|
319 |
}
|
380 |
grid.reloadParams = {'selected[]':this.chooserSelectedItems.keys()};
|
381 |
this.updateElement.value = this.chooserSelectedItems.keys().join(', ');
|
382 |
}
|
383 |
+
};
|
js/mage/adminhtml/sales.js
CHANGED
@@ -68,7 +68,7 @@ AdminOrder.prototype = {
|
|
68 |
window.setTimeout(function () {
|
69 |
el.remove();
|
70 |
}, 10);
|
71 |
-
}
|
72 |
|
73 |
this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) {
|
74 |
proceed();
|
@@ -197,10 +197,10 @@ AdminOrder.prototype = {
|
|
197 |
var data;
|
198 |
|
199 |
if(this.isBillingField(field.id)){
|
200 |
-
data = this.serializeData(this.billingAddressContainer)
|
201 |
}
|
202 |
else{
|
203 |
-
data = this.serializeData(this.shippingAddressContainer)
|
204 |
}
|
205 |
data = data.toObject();
|
206 |
|
@@ -377,7 +377,7 @@ AdminOrder.prototype = {
|
|
377 |
if(!this.paymentMethod || method){
|
378 |
$('order-billing_method_form').select('input', 'select', 'textarea').each(function(elem){
|
379 |
if(elem.type != 'radio') elem.disabled = true;
|
380 |
-
})
|
381 |
}
|
382 |
|
383 |
if ($('payment_form_'+method)){
|
@@ -393,7 +393,7 @@ AdminOrder.prototype = {
|
|
393 |
field.bindChange = true;
|
394 |
field.paymentContainer = form; /** @deprecated after 1.4.0.0-rc1 */
|
395 |
field.method = method;
|
396 |
-
field.observe('change', this.changePaymentData.bind(this))
|
397 |
}
|
398 |
},this);
|
399 |
}
|
@@ -797,7 +797,7 @@ AdminOrder.prototype = {
|
|
797 |
for(var i=0; i<elems.length; i++){
|
798 |
if(!elems[i].bindOnchange){
|
799 |
elems[i].bindOnchange = true;
|
800 |
-
elems[i].observe('change', this.itemChange.bind(this))
|
801 |
}
|
802 |
}
|
803 |
},
|
@@ -880,10 +880,10 @@ AdminOrder.prototype = {
|
|
880 |
var fields = $(container).select('input', 'select', 'textarea');
|
881 |
for(var i=0; i<fields.length; i++){
|
882 |
if(fields[i].id == 'group_id'){
|
883 |
-
fields[i].observe('change', this.accountGroupChange.bind(this))
|
884 |
}
|
885 |
else{
|
886 |
-
fields[i].observe('change', this.accountFieldChange.bind(this))
|
887 |
}
|
888 |
}
|
889 |
}
|
@@ -901,7 +901,7 @@ AdminOrder.prototype = {
|
|
901 |
if($(container)){
|
902 |
var fields = $(container).select('input', 'textarea');
|
903 |
for(var i=0; i<fields.length; i++)
|
904 |
-
fields[i].observe('change', this.commentFieldChange.bind(this))
|
905 |
}
|
906 |
},
|
907 |
|
@@ -913,7 +913,7 @@ AdminOrder.prototype = {
|
|
913 |
if($(container)){
|
914 |
var fields = $(container).select('input', 'textarea');
|
915 |
for(var i=0; i<fields.length; i++)
|
916 |
-
fields[i].observe('change', this.giftmessageFieldChange.bind(this))
|
917 |
}
|
918 |
},
|
919 |
|
@@ -1103,7 +1103,7 @@ AdminOrder.prototype = {
|
|
1103 |
if (typeof(show) == 'undefined') { show = true; }
|
1104 |
|
1105 |
var orderObj = this;
|
1106 |
-
var obj = this.overlayData.get(elId)
|
1107 |
if (!obj) {
|
1108 |
obj = {
|
1109 |
show: show,
|
@@ -1112,7 +1112,7 @@ AdminOrder.prototype = {
|
|
1112 |
fx: function(event) {
|
1113 |
this.order.processOverlay(this.el, this.show);
|
1114 |
}
|
1115 |
-
}
|
1116 |
obj.bfx = obj.fx.bindAsEventListener(obj);
|
1117 |
this.overlayData.set(elId, obj);
|
1118 |
}
|
68 |
window.setTimeout(function () {
|
69 |
el.remove();
|
70 |
}, 10);
|
71 |
+
};
|
72 |
|
73 |
this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) {
|
74 |
proceed();
|
197 |
var data;
|
198 |
|
199 |
if(this.isBillingField(field.id)){
|
200 |
+
data = this.serializeData(this.billingAddressContainer);
|
201 |
}
|
202 |
else{
|
203 |
+
data = this.serializeData(this.shippingAddressContainer);
|
204 |
}
|
205 |
data = data.toObject();
|
206 |
|
377 |
if(!this.paymentMethod || method){
|
378 |
$('order-billing_method_form').select('input', 'select', 'textarea').each(function(elem){
|
379 |
if(elem.type != 'radio') elem.disabled = true;
|
380 |
+
});
|
381 |
}
|
382 |
|
383 |
if ($('payment_form_'+method)){
|
393 |
field.bindChange = true;
|
394 |
field.paymentContainer = form; /** @deprecated after 1.4.0.0-rc1 */
|
395 |
field.method = method;
|
396 |
+
field.observe('change', this.changePaymentData.bind(this));
|
397 |
}
|
398 |
},this);
|
399 |
}
|
797 |
for(var i=0; i<elems.length; i++){
|
798 |
if(!elems[i].bindOnchange){
|
799 |
elems[i].bindOnchange = true;
|
800 |
+
elems[i].observe('change', this.itemChange.bind(this));
|
801 |
}
|
802 |
}
|
803 |
},
|
880 |
var fields = $(container).select('input', 'select', 'textarea');
|
881 |
for(var i=0; i<fields.length; i++){
|
882 |
if(fields[i].id == 'group_id'){
|
883 |
+
fields[i].observe('change', this.accountGroupChange.bind(this));
|
884 |
}
|
885 |
else{
|
886 |
+
fields[i].observe('change', this.accountFieldChange.bind(this));
|
887 |
}
|
888 |
}
|
889 |
}
|
901 |
if($(container)){
|
902 |
var fields = $(container).select('input', 'textarea');
|
903 |
for(var i=0; i<fields.length; i++)
|
904 |
+
fields[i].observe('change', this.commentFieldChange.bind(this));
|
905 |
}
|
906 |
},
|
907 |
|
913 |
if($(container)){
|
914 |
var fields = $(container).select('input', 'textarea');
|
915 |
for(var i=0; i<fields.length; i++)
|
916 |
+
fields[i].observe('change', this.giftmessageFieldChange.bind(this));
|
917 |
}
|
918 |
},
|
919 |
|
1103 |
if (typeof(show) == 'undefined') { show = true; }
|
1104 |
|
1105 |
var orderObj = this;
|
1106 |
+
var obj = this.overlayData.get(elId);
|
1107 |
if (!obj) {
|
1108 |
obj = {
|
1109 |
show: show,
|
1112 |
fx: function(event) {
|
1113 |
this.order.processOverlay(this.el, this.show);
|
1114 |
}
|
1115 |
+
};
|
1116 |
obj.bfx = obj.fx.bindAsEventListener(obj);
|
1117 |
this.overlayData.set(elId, obj);
|
1118 |
}
|
js/mage/adminhtml/sales/packaging.js
CHANGED
@@ -132,7 +132,7 @@ Packaging.prototype = {
|
|
132 |
var weight, length, width, height = null;
|
133 |
var packagesParams = [];
|
134 |
this.packagesContent.childElements().each(function(pack) {
|
135 |
-
var packageId = pack.id.match(/\d
|
136 |
weight = parseFloat(pack.select('input[name="container_weight"]')[0].value);
|
137 |
length = parseFloat(pack.select('input[name="container_length"]')[0].value);
|
138 |
width = parseFloat(pack.select('input[name="container_width"]')[0].value);
|
@@ -170,7 +170,7 @@ Packaging.prototype = {
|
|
170 |
}
|
171 |
var deliveryConfirmation = pack.select('select[name="delivery_confirmation_types"]');
|
172 |
if (deliveryConfirmation.length) {
|
173 |
-
packagesParams[packageId]['delivery_confirmation'] = deliveryConfirmation[0].value
|
174 |
}
|
175 |
}.bind(this));
|
176 |
for (var packageId in this.packages) {
|
@@ -260,7 +260,7 @@ Packaging.prototype = {
|
|
260 |
dimensionElements.each(callback);
|
261 |
|
262 |
return result = $$('[id^="package_block_"] input').collect(function (element) {
|
263 |
-
return this.validateElement(element)
|
264 |
}, this).all();
|
265 |
},
|
266 |
|
@@ -345,7 +345,7 @@ Packaging.prototype = {
|
|
345 |
item.remove();
|
346 |
this.messages.hide().update();
|
347 |
this._recalcContainerWeightAndCustomsValue(packItems);
|
348 |
-
this._setAllItemsPackedState()
|
349 |
},
|
350 |
|
351 |
recalcContainerWeightAndCustomsValue: function(obj) {
|
@@ -394,7 +394,7 @@ Packaging.prototype = {
|
|
394 |
if (items[packedItemId]) {
|
395 |
items[packedItemId] += this.packages[packageId]['items'][packedItemId]['qty'];
|
396 |
} else {
|
397 |
-
items[packedItemId] = this.packages[packageId]['items'][packedItemId]['qty']
|
398 |
}
|
399 |
}
|
400 |
}
|
@@ -506,7 +506,7 @@ Packaging.prototype = {
|
|
506 |
packagePrepare.hide();
|
507 |
packageBlock.select('.AddSelectedBtn')[0].hide();
|
508 |
packageBlock.select('.AddItemsBtn')[0].show();
|
509 |
-
this._setAllItemsPackedState()
|
510 |
},
|
511 |
|
512 |
validateItemQty: function (itemId, qty) {
|
@@ -627,13 +627,13 @@ Packaging.prototype = {
|
|
627 |
Form.Element.disable(inputElement);
|
628 |
inputElement.addClassName('disabled');
|
629 |
if (inputElement.nodeName == 'INPUT') {
|
630 |
-
$(inputElement).value = ''
|
631 |
}
|
632 |
} else {
|
633 |
Form.Element.enable(inputElement);
|
634 |
inputElement.removeClassName('disabled');
|
635 |
}
|
636 |
-
})
|
637 |
},
|
638 |
|
639 |
changeContentTypes: function(obj) {
|
@@ -759,7 +759,7 @@ Packaging.prototype = {
|
|
759 |
packagePrapare.select('tbody input[type="checkbox"]').each(function(item){
|
760 |
$(item).observe('change', this._observeQty);
|
761 |
this._observeQty.call(item);
|
762 |
-
}.bind(this))
|
763 |
},
|
764 |
|
765 |
_observeQty: function() {
|
132 |
var weight, length, width, height = null;
|
133 |
var packagesParams = [];
|
134 |
this.packagesContent.childElements().each(function(pack) {
|
135 |
+
var packageId = pack.id.match(/\d+$/)[0];
|
136 |
weight = parseFloat(pack.select('input[name="container_weight"]')[0].value);
|
137 |
length = parseFloat(pack.select('input[name="container_length"]')[0].value);
|
138 |
width = parseFloat(pack.select('input[name="container_width"]')[0].value);
|
170 |
}
|
171 |
var deliveryConfirmation = pack.select('select[name="delivery_confirmation_types"]');
|
172 |
if (deliveryConfirmation.length) {
|
173 |
+
packagesParams[packageId]['delivery_confirmation'] = deliveryConfirmation[0].value;
|
174 |
}
|
175 |
}.bind(this));
|
176 |
for (var packageId in this.packages) {
|
260 |
dimensionElements.each(callback);
|
261 |
|
262 |
return result = $$('[id^="package_block_"] input').collect(function (element) {
|
263 |
+
return this.validateElement(element);
|
264 |
}, this).all();
|
265 |
},
|
266 |
|
345 |
item.remove();
|
346 |
this.messages.hide().update();
|
347 |
this._recalcContainerWeightAndCustomsValue(packItems);
|
348 |
+
this._setAllItemsPackedState();
|
349 |
},
|
350 |
|
351 |
recalcContainerWeightAndCustomsValue: function(obj) {
|
394 |
if (items[packedItemId]) {
|
395 |
items[packedItemId] += this.packages[packageId]['items'][packedItemId]['qty'];
|
396 |
} else {
|
397 |
+
items[packedItemId] = this.packages[packageId]['items'][packedItemId]['qty'];
|
398 |
}
|
399 |
}
|
400 |
}
|
506 |
packagePrepare.hide();
|
507 |
packageBlock.select('.AddSelectedBtn')[0].hide();
|
508 |
packageBlock.select('.AddItemsBtn')[0].show();
|
509 |
+
this._setAllItemsPackedState();
|
510 |
},
|
511 |
|
512 |
validateItemQty: function (itemId, qty) {
|
627 |
Form.Element.disable(inputElement);
|
628 |
inputElement.addClassName('disabled');
|
629 |
if (inputElement.nodeName == 'INPUT') {
|
630 |
+
$(inputElement).value = '';
|
631 |
}
|
632 |
} else {
|
633 |
Form.Element.enable(inputElement);
|
634 |
inputElement.removeClassName('disabled');
|
635 |
}
|
636 |
+
});
|
637 |
},
|
638 |
|
639 |
changeContentTypes: function(obj) {
|
759 |
packagePrapare.select('tbody input[type="checkbox"]').each(function(item){
|
760 |
$(item).observe('change', this._observeQty);
|
761 |
this._observeQty.call(item);
|
762 |
+
}.bind(this));
|
763 |
},
|
764 |
|
765 |
_observeQty: function() {
|
js/mage/adminhtml/scrollbar.js
CHANGED
@@ -114,8 +114,8 @@ var Drag = {
|
|
114 |
nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
|
115 |
ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
|
116 |
|
117 |
-
if (o.xMapper) nx = o.xMapper(y)
|
118 |
-
else if (o.yMapper) ny = o.yMapper(x)
|
119 |
|
120 |
Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
|
121 |
Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
|
@@ -156,165 +156,173 @@ var Drag = {
|
|
156 |
|
157 |
|
158 |
|
159 |
-
ypSimpleScroll.prototype.scrollNorth = function(count) {
|
160 |
-
|
161 |
-
|
162 |
-
ypSimpleScroll.prototype.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
ypSimpleScroll.prototype.startScroll = function(deg, count) {
|
165 |
if (this.loaded){
|
166 |
-
if (this.aniTimer) window.clearTimeout(this.aniTimer)
|
167 |
-
this.overrideScrollAngle(deg)
|
168 |
-
this.speed = this.origSpeed
|
169 |
-
this.lastTime = (new Date()).getTime() - this.y.minRes
|
170 |
-
this.aniTimer = window.setTimeout(this.gRef + ".scroll('"+deg+"','"+count+"')", this.y.minRes)
|
171 |
}
|
172 |
-
}
|
173 |
|
174 |
ypSimpleScroll.prototype.endScroll = function() {
|
175 |
if (this.loaded){
|
176 |
-
window.clearTimeout(this.aniTimer)
|
177 |
this.aniTimer = 0;
|
178 |
-
this.speed = this.origSpeed
|
179 |
}
|
180 |
-
}
|
181 |
|
182 |
ypSimpleScroll.prototype.overrideScrollAngle = function(deg) {
|
183 |
if (this.loaded){
|
184 |
-
deg = deg % 360
|
185 |
if (deg % 90 == 0) {
|
186 |
-
var cos = deg == 0 ? 1 : deg == 180 ? -1 : 0
|
187 |
-
var sin = deg == 90 ? -1 : deg == 270 ? 1 : 0
|
188 |
}
|
189 |
else {
|
190 |
-
var angle = deg * Math.PI / 180
|
191 |
-
var cos = Math.cos(angle)
|
192 |
-
var sin = Math.sin(angle)
|
193 |
-
sin = -sin
|
194 |
}
|
195 |
-
this.fx = cos / (Math.abs(cos) + Math.abs(sin))
|
196 |
-
this.fy = sin / (Math.abs(cos) + Math.abs(sin))
|
197 |
-
this.stopH = deg == 90 || deg == 270 ? this.scrollLeft : deg < 90 || deg > 270 ? this.scrollW : 0
|
198 |
-
this.stopV = deg == 0 || deg == 180 ? this.scrollTop : deg < 180 ? 0 : this.scrollH
|
199 |
}
|
200 |
-
}
|
201 |
|
202 |
ypSimpleScroll.prototype.overrideScrollSpeed = function(speed) {
|
203 |
-
if (this.loaded) this.speed = speed
|
204 |
-
}
|
205 |
|
206 |
|
207 |
ypSimpleScroll.prototype.scrollTo = function(stopH, stopV, aniLen) {
|
208 |
if (this.loaded){
|
209 |
if (stopH != this.scrollLeft || stopV != this.scrollTop) {
|
210 |
-
if (this.aniTimer) window.clearTimeout(this.aniTimer)
|
211 |
-
this.lastTime = (new Date()).getTime()
|
212 |
-
var dx = Math.abs(stopH - this.scrollLeft)
|
213 |
-
var dy = Math.abs(stopV - this.scrollTop)
|
214 |
-
var d = Math.sqrt(Math.pow(dx,2) + Math.pow(dy,2))
|
215 |
-
this.fx = (stopH - this.scrollLeft) / (dx + dy)
|
216 |
-
this.fy = (stopV - this.scrollTop) / (dx + dy)
|
217 |
-
this.stopH = stopH
|
218 |
-
this.stopV = stopV
|
219 |
-
this.speed = d / aniLen * 1000
|
220 |
-
window.setTimeout(this.gRef + ".scroll()", this.y.minRes)
|
221 |
}
|
222 |
}
|
223 |
-
}
|
224 |
|
225 |
ypSimpleScroll.prototype.jumpTo = function(nx, ny) {
|
226 |
if (this.loaded){
|
227 |
-
nx = Math.min(Math.max(nx, 0), this.scrollW)
|
228 |
-
ny = Math.min(Math.max(ny, 0), this.scrollH)
|
229 |
-
this.scrollLeft = nx
|
230 |
-
this.scrollTop = ny
|
231 |
-
if (this.y.ns4)this.content.moveTo(-nx, -ny)
|
232 |
else {
|
233 |
-
this.content.style.left = -nx + "px"
|
234 |
-
this.content.style.top = -ny + "px"
|
235 |
}
|
236 |
}
|
237 |
-
}
|
238 |
|
239 |
-
ypSimpleScroll.minRes = 10
|
240 |
-
ypSimpleScroll.ie = document.all ? 1 : 0
|
241 |
-
ypSimpleScroll.ns4 = document.layers ? 1 : 0
|
242 |
-
ypSimpleScroll.dom = document.getElementById ? 1 : 0
|
243 |
-
ypSimpleScroll.mac = navigator.platform == "MacPPC"
|
244 |
-
ypSimpleScroll.mo5 = document.getElementById && !document.all ? 1 : 0
|
245 |
|
246 |
ypSimpleScroll.prototype.scroll = function(deg,count) {
|
247 |
-
this.aniTimer = window.setTimeout(this.gRef + ".scroll('"+deg+"','"+count+"')", this.y.minRes)
|
248 |
-
var nt = (new Date()).getTime()
|
249 |
-
var d = Math.round((nt - this.lastTime) / 1000 * this.speed)
|
250 |
if (d > 0){
|
251 |
-
var nx = d * this.fx + this.scrollLeft
|
252 |
-
var ny = d * this.fy + this.scrollTop
|
253 |
-
var xOut = (nx >= this.scrollLeft && nx >= this.stopH) || (nx <= this.scrollLeft && nx <= this.stopH)
|
254 |
-
var yOut = (ny >= this.scrollTop && ny >= this.stopV) || (ny <= this.scrollTop && ny <= this.stopV)
|
255 |
if (nt - this.lastTime != 0 &&
|
256 |
((this.fx == 0 && this.fy == 0) ||
|
257 |
(this.fy == 0 && xOut) ||
|
258 |
(this.fx == 0 && yOut) ||
|
259 |
(this.fx != 0 && this.fy != 0 &&
|
260 |
xOut && yOut))) {
|
261 |
-
this.jumpTo(this.stopH, this.stopV)
|
262 |
-
this.endScroll()
|
263 |
}
|
264 |
else {
|
265 |
-
this.jumpTo(nx, ny)
|
266 |
-
this.lastTime = nt
|
267 |
}
|
268 |
// (zgtc) now we also update dragger position:
|
269 |
if(deg=='270') theThumb[count].style.top = parseInt(((theThumb[count].maxY-theThumb[count].minY)*this.scrollTop/this.stopV)+theThumb[count].minY) + "px"; //ok nomes down
|
270 |
if(deg=='90') theThumb[count].style.top = parseInt(((theThumb[count].maxY-theThumb[count].minY)*this.scrollTop/this.scrollH)+theThumb[count].minY) + "px"; //ok nomes down
|
271 |
}
|
272 |
-
}
|
273 |
|
274 |
function ypSimpleScroll(id, left, top, width, height, speed) {
|
275 |
width -= 2;
|
276 |
-
var y = this.y = ypSimpleScroll
|
277 |
-
if (document.layers && !y.ns4) history.go(0)
|
278 |
if (y.ie || y.ns4 || y.dom) {
|
279 |
-
this.loaded = false
|
280 |
-
this.id = id
|
281 |
-
this.origSpeed = speed
|
282 |
-
this.aniTimer = false
|
283 |
-
this.op = ""
|
284 |
-
this.lastTime = 0
|
285 |
-
this.clipH = height
|
286 |
-
this.clipW = width
|
287 |
-
this.scrollTop = 0
|
288 |
-
this.scrollLeft = 0
|
289 |
-
this.gRef = "ypSimpleScroll_"+id
|
290 |
-
eval(this.gRef+"=this")
|
291 |
-
var d = document
|
292 |
-
d.write('<style type="text/css">')
|
293 |
-
d.write('#' + this.id + 'Container { left:0px; top:' + top + 'px; width:' + (width+15) + 'px; height:' + (height+12) + 'px; clip:rect(0 ' + (width+15) + ' ' + (height+12) + ' 0); overflow:hidden; }')
|
294 |
-
d.write('#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; }')
|
295 |
-
d.write('#' + this.id + 'Content { left:' + (-this.scrollLeft) + 'px; top:' + (-this.scrollTop) + 'px; width:' + width + 'px; }')
|
296 |
// (zgtc) fix to overwrite p/div/ul width (would be clipped if wider than scroller in css):
|
297 |
// d.write('#' + this.id + 'Container p, #' + this.id + 'Container div {width:' + parseInt(width-10) + 'px; }')
|
298 |
-
d.write('</style>')
|
299 |
}
|
300 |
}
|
301 |
|
302 |
ypSimpleScroll.prototype.load = function() {
|
303 |
-
var d, lyrId1, lyrId2
|
304 |
-
d = document
|
305 |
-
lyrId1 = this.id + "Container"
|
306 |
-
lyrId2 = this.id + "Content"
|
307 |
-
this.container = this.y.dom ? d.getElementById(lyrId1) : this.y.ie ? d.all[lyrId1] : d.layers[lyrId1]
|
308 |
-
this.content = obj2 = this.y.ns4 ? this.container.layers[lyrId2] : this.y.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
|
309 |
-
this.docH = Math.max(this.y.ns4 ? this.content.document.height : this.content.offsetHeight, this.clipH)
|
310 |
-
this.docW = Math.max(this.y.ns4 ? this.content.document.width : this.content.offsetWidth, this.clipW)
|
311 |
-
this.scrollH = this.docH - this.clipH
|
312 |
-
this.scrollW = this.docW - this.clipW
|
313 |
-
this.loaded = true
|
314 |
-
this.scrollLeft = Math.max(Math.min(this.scrollLeft, this.scrollW),0)
|
315 |
-
this.scrollTop = Math.max(Math.min(this.scrollTop, this.scrollH),0)
|
316 |
-
this.jumpTo(this.scrollLeft, this.scrollTop)
|
317 |
-
}
|
318 |
|
319 |
// ==============================================================
|
320 |
// HANDLES SCROLLER/S
|
@@ -370,7 +378,7 @@ function createDragger(count, handler, root, thumb, minX, maxX, minY, maxY){
|
|
370 |
|
371 |
theThumb[count].onDrag = function(x, y) {
|
372 |
theScroll[count].jumpTo(null, Math.round((y - theThumb[count].minY) * ratio[count]));
|
373 |
-
}
|
374 |
}
|
375 |
|
376 |
// INITIALIZER:
|
@@ -385,7 +393,7 @@ function addLoadEvent(fn) {
|
|
385 |
window.onload = function() {
|
386 |
old();
|
387 |
fn();
|
388 |
-
}
|
389 |
}
|
390 |
}
|
391 |
addLoadEvent(function(){
|
@@ -394,4 +402,4 @@ addLoadEvent(function(){
|
|
394 |
createDragger(i, "handle"+i, "root"+i, "thumb"+i, theScroll[i].clipW, theScroll[i].clipW, 15, theScroll[i].clipH-30);
|
395 |
}
|
396 |
}
|
397 |
-
})
|
114 |
nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
|
115 |
ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
|
116 |
|
117 |
+
if (o.xMapper) nx = o.xMapper(y);
|
118 |
+
else if (o.yMapper) ny = o.yMapper(x);
|
119 |
|
120 |
Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
|
121 |
Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
|
156 |
|
157 |
|
158 |
|
159 |
+
ypSimpleScroll.prototype.scrollNorth = function(count) {
|
160 |
+
this.startScroll(90, count);
|
161 |
+
};
|
162 |
+
ypSimpleScroll.prototype.scrollSouth = function(count) {
|
163 |
+
this.startScroll(270, count);
|
164 |
+
};
|
165 |
+
ypSimpleScroll.prototype.scrollWest = function(count) {
|
166 |
+
this.startScroll(180, count);
|
167 |
+
};
|
168 |
+
ypSimpleScroll.prototype.scrollEast = function(count) {
|
169 |
+
this.startScroll(0, count);
|
170 |
+
};
|
171 |
|
172 |
ypSimpleScroll.prototype.startScroll = function(deg, count) {
|
173 |
if (this.loaded){
|
174 |
+
if (this.aniTimer) window.clearTimeout(this.aniTimer);
|
175 |
+
this.overrideScrollAngle(deg);
|
176 |
+
this.speed = this.origSpeed;
|
177 |
+
this.lastTime = (new Date()).getTime() - this.y.minRes;
|
178 |
+
this.aniTimer = window.setTimeout(this.gRef + ".scroll('"+deg+"','"+count+"')", this.y.minRes);
|
179 |
}
|
180 |
+
};
|
181 |
|
182 |
ypSimpleScroll.prototype.endScroll = function() {
|
183 |
if (this.loaded){
|
184 |
+
window.clearTimeout(this.aniTimer);
|
185 |
this.aniTimer = 0;
|
186 |
+
this.speed = this.origSpeed;
|
187 |
}
|
188 |
+
};
|
189 |
|
190 |
ypSimpleScroll.prototype.overrideScrollAngle = function(deg) {
|
191 |
if (this.loaded){
|
192 |
+
deg = deg % 360;
|
193 |
if (deg % 90 == 0) {
|
194 |
+
var cos = deg == 0 ? 1 : deg == 180 ? -1 : 0;
|
195 |
+
var sin = deg == 90 ? -1 : deg == 270 ? 1 : 0;
|
196 |
}
|
197 |
else {
|
198 |
+
var angle = deg * Math.PI / 180;
|
199 |
+
var cos = Math.cos(angle);
|
200 |
+
var sin = Math.sin(angle);
|
201 |
+
sin = -sin;
|
202 |
}
|
203 |
+
this.fx = cos / (Math.abs(cos) + Math.abs(sin));
|
204 |
+
this.fy = sin / (Math.abs(cos) + Math.abs(sin));
|
205 |
+
this.stopH = deg == 90 || deg == 270 ? this.scrollLeft : deg < 90 || deg > 270 ? this.scrollW : 0;
|
206 |
+
this.stopV = deg == 0 || deg == 180 ? this.scrollTop : deg < 180 ? 0 : this.scrollH;
|
207 |
}
|
208 |
+
};
|
209 |
|
210 |
ypSimpleScroll.prototype.overrideScrollSpeed = function(speed) {
|
211 |
+
if (this.loaded) this.speed = speed;
|
212 |
+
};
|
213 |
|
214 |
|
215 |
ypSimpleScroll.prototype.scrollTo = function(stopH, stopV, aniLen) {
|
216 |
if (this.loaded){
|
217 |
if (stopH != this.scrollLeft || stopV != this.scrollTop) {
|
218 |
+
if (this.aniTimer) window.clearTimeout(this.aniTimer);
|
219 |
+
this.lastTime = (new Date()).getTime();
|
220 |
+
var dx = Math.abs(stopH - this.scrollLeft);
|
221 |
+
var dy = Math.abs(stopV - this.scrollTop);
|
222 |
+
var d = Math.sqrt(Math.pow(dx,2) + Math.pow(dy,2));
|
223 |
+
this.fx = (stopH - this.scrollLeft) / (dx + dy);
|
224 |
+
this.fy = (stopV - this.scrollTop) / (dx + dy);
|
225 |
+
this.stopH = stopH;
|
226 |
+
this.stopV = stopV;
|
227 |
+
this.speed = d / aniLen * 1000;
|
228 |
+
window.setTimeout(this.gRef + ".scroll()", this.y.minRes);
|
229 |
}
|
230 |
}
|
231 |
+
};
|
232 |
|
233 |
ypSimpleScroll.prototype.jumpTo = function(nx, ny) {
|
234 |
if (this.loaded){
|
235 |
+
nx = Math.min(Math.max(nx, 0), this.scrollW);
|
236 |
+
ny = Math.min(Math.max(ny, 0), this.scrollH);
|
237 |
+
this.scrollLeft = nx;
|
238 |
+
this.scrollTop = ny;
|
239 |
+
if (this.y.ns4)this.content.moveTo(-nx, -ny);
|
240 |
else {
|
241 |
+
this.content.style.left = -nx + "px";
|
242 |
+
this.content.style.top = -ny + "px";
|
243 |
}
|
244 |
}
|
245 |
+
};
|
246 |
|
247 |
+
ypSimpleScroll.minRes = 10;
|
248 |
+
ypSimpleScroll.ie = document.all ? 1 : 0;
|
249 |
+
ypSimpleScroll.ns4 = document.layers ? 1 : 0;
|
250 |
+
ypSimpleScroll.dom = document.getElementById ? 1 : 0;
|
251 |
+
ypSimpleScroll.mac = navigator.platform == "MacPPC";
|
252 |
+
ypSimpleScroll.mo5 = document.getElementById && !document.all ? 1 : 0;
|
253 |
|
254 |
ypSimpleScroll.prototype.scroll = function(deg,count) {
|
255 |
+
this.aniTimer = window.setTimeout(this.gRef + ".scroll('"+deg+"','"+count+"')", this.y.minRes);
|
256 |
+
var nt = (new Date()).getTime();
|
257 |
+
var d = Math.round((nt - this.lastTime) / 1000 * this.speed);
|
258 |
if (d > 0){
|
259 |
+
var nx = d * this.fx + this.scrollLeft;
|
260 |
+
var ny = d * this.fy + this.scrollTop;
|
261 |
+
var xOut = (nx >= this.scrollLeft && nx >= this.stopH) || (nx <= this.scrollLeft && nx <= this.stopH);
|
262 |
+
var yOut = (ny >= this.scrollTop && ny >= this.stopV) || (ny <= this.scrollTop && ny <= this.stopV);
|
263 |
if (nt - this.lastTime != 0 &&
|
264 |
((this.fx == 0 && this.fy == 0) ||
|
265 |
(this.fy == 0 && xOut) ||
|
266 |
(this.fx == 0 && yOut) ||
|
267 |
(this.fx != 0 && this.fy != 0 &&
|
268 |
xOut && yOut))) {
|
269 |
+
this.jumpTo(this.stopH, this.stopV);
|
270 |
+
this.endScroll();
|
271 |
}
|
272 |
else {
|
273 |
+
this.jumpTo(nx, ny);
|
274 |
+
this.lastTime = nt;
|
275 |
}
|
276 |
// (zgtc) now we also update dragger position:
|
277 |
if(deg=='270') theThumb[count].style.top = parseInt(((theThumb[count].maxY-theThumb[count].minY)*this.scrollTop/this.stopV)+theThumb[count].minY) + "px"; //ok nomes down
|
278 |
if(deg=='90') theThumb[count].style.top = parseInt(((theThumb[count].maxY-theThumb[count].minY)*this.scrollTop/this.scrollH)+theThumb[count].minY) + "px"; //ok nomes down
|
279 |
}
|
280 |
+
};
|
281 |
|
282 |
function ypSimpleScroll(id, left, top, width, height, speed) {
|
283 |
width -= 2;
|
284 |
+
var y = this.y = ypSimpleScroll;
|
285 |
+
if (document.layers && !y.ns4) history.go(0);
|
286 |
if (y.ie || y.ns4 || y.dom) {
|
287 |
+
this.loaded = false;
|
288 |
+
this.id = id;
|
289 |
+
this.origSpeed = speed;
|
290 |
+
this.aniTimer = false;
|
291 |
+
this.op = "";
|
292 |
+
this.lastTime = 0;
|
293 |
+
this.clipH = height;
|
294 |
+
this.clipW = width;
|
295 |
+
this.scrollTop = 0;
|
296 |
+
this.scrollLeft = 0;
|
297 |
+
this.gRef = "ypSimpleScroll_"+id;
|
298 |
+
eval(this.gRef+"=this");
|
299 |
+
var d = document;
|
300 |
+
d.write('<style type="text/css">');
|
301 |
+
d.write('#' + this.id + 'Container { left:0px; top:' + top + 'px; width:' + (width+15) + 'px; height:' + (height+12) + 'px; clip:rect(0 ' + (width+15) + ' ' + (height+12) + ' 0); overflow:hidden; }');
|
302 |
+
d.write('#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; }');
|
303 |
+
d.write('#' + this.id + 'Content { left:' + (-this.scrollLeft) + 'px; top:' + (-this.scrollTop) + 'px; width:' + width + 'px; }');
|
304 |
// (zgtc) fix to overwrite p/div/ul width (would be clipped if wider than scroller in css):
|
305 |
// d.write('#' + this.id + 'Container p, #' + this.id + 'Container div {width:' + parseInt(width-10) + 'px; }')
|
306 |
+
d.write('</style>');
|
307 |
}
|
308 |
}
|
309 |
|
310 |
ypSimpleScroll.prototype.load = function() {
|
311 |
+
var d, lyrId1, lyrId2;
|
312 |
+
d = document;
|
313 |
+
lyrId1 = this.id + "Container";
|
314 |
+
lyrId2 = this.id + "Content";
|
315 |
+
this.container = this.y.dom ? d.getElementById(lyrId1) : this.y.ie ? d.all[lyrId1] : d.layers[lyrId1];
|
316 |
+
this.content = obj2 = this.y.ns4 ? this.container.layers[lyrId2] : this.y.ie ? d.all[lyrId2] : d.getElementById(lyrId2);
|
317 |
+
this.docH = Math.max(this.y.ns4 ? this.content.document.height : this.content.offsetHeight, this.clipH);
|
318 |
+
this.docW = Math.max(this.y.ns4 ? this.content.document.width : this.content.offsetWidth, this.clipW);
|
319 |
+
this.scrollH = this.docH - this.clipH;
|
320 |
+
this.scrollW = this.docW - this.clipW;
|
321 |
+
this.loaded = true;
|
322 |
+
this.scrollLeft = Math.max(Math.min(this.scrollLeft, this.scrollW),0);
|
323 |
+
this.scrollTop = Math.max(Math.min(this.scrollTop, this.scrollH),0);
|
324 |
+
this.jumpTo(this.scrollLeft, this.scrollTop);
|
325 |
+
};
|
326 |
|
327 |
// ==============================================================
|
328 |
// HANDLES SCROLLER/S
|
378 |
|
379 |
theThumb[count].onDrag = function(x, y) {
|
380 |
theScroll[count].jumpTo(null, Math.round((y - theThumb[count].minY) * ratio[count]));
|
381 |
+
};
|
382 |
}
|
383 |
|
384 |
// INITIALIZER:
|
393 |
window.onload = function() {
|
394 |
old();
|
395 |
fn();
|
396 |
+
};
|
397 |
}
|
398 |
}
|
399 |
addLoadEvent(function(){
|
402 |
createDragger(i, "handle"+i, "root"+i, "thumb"+i, theScroll[i].clipW, theScroll[i].clipW, 15, theScroll[i].clipH-30);
|
403 |
}
|
404 |
}
|
405 |
+
});
|
js/mage/adminhtml/tabs.js
CHANGED
@@ -49,7 +49,7 @@ varienTabs.prototype = {
|
|
49 |
this.tabs[tab].container = this;
|
50 |
this.tabs[tab].show = function(){
|
51 |
this.container.showTabContent(this);
|
52 |
-
}
|
53 |
if(varienGlobalEvents){
|
54 |
varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]});
|
55 |
}
|
@@ -88,7 +88,7 @@ varienTabs.prototype = {
|
|
88 |
this.tabs[tab].container = this;
|
89 |
this.tabs[tab].show = function(){
|
90 |
this.container.showTabContent(this);
|
91 |
-
}
|
92 |
if(varienGlobalEvents){
|
93 |
varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]});
|
94 |
}
|
@@ -176,7 +176,7 @@ varienTabs.prototype = {
|
|
176 |
onSuccess: function(transport) {
|
177 |
try {
|
178 |
if (transport.responseText.isJSON()) {
|
179 |
-
var response = transport.responseText.evalJSON()
|
180 |
if (response.error) {
|
181 |
alert(response.message);
|
182 |
}
|
@@ -185,12 +185,12 @@ varienTabs.prototype = {
|
|
185 |
}
|
186 |
} else {
|
187 |
$(tabContentElement.id).update(transport.responseText);
|
188 |
-
this.showTabContentImmediately(tab)
|
189 |
}
|
190 |
}
|
191 |
catch (e) {
|
192 |
$(tabContentElement.id).update(transport.responseText);
|
193 |
-
this.showTabContentImmediately(tab)
|
194 |
}
|
195 |
}.bind(this)
|
196 |
});
|
@@ -210,7 +210,7 @@ varienTabs.prototype = {
|
|
210 |
onSuccess: function(transport) {
|
211 |
try {
|
212 |
if (transport.responseText.isJSON()) {
|
213 |
-
var response = transport.responseText.evalJSON()
|
214 |
if (response.error) {
|
215 |
alert(response.message);
|
216 |
}
|
@@ -245,4 +245,4 @@ varienTabs.prototype = {
|
|
245 |
varienGlobalEvents.fireEvent('hideTab', {tab:tab});
|
246 |
}
|
247 |
}
|
248 |
-
}
|
49 |
this.tabs[tab].container = this;
|
50 |
this.tabs[tab].show = function(){
|
51 |
this.container.showTabContent(this);
|
52 |
+
};
|
53 |
if(varienGlobalEvents){
|
54 |
varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]});
|
55 |
}
|
88 |
this.tabs[tab].container = this;
|
89 |
this.tabs[tab].show = function(){
|
90 |
this.container.showTabContent(this);
|
91 |
+
};
|
92 |
if(varienGlobalEvents){
|
93 |
varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]});
|
94 |
}
|
176 |
onSuccess: function(transport) {
|
177 |
try {
|
178 |
if (transport.responseText.isJSON()) {
|
179 |
+
var response = transport.responseText.evalJSON();
|
180 |
if (response.error) {
|
181 |
alert(response.message);
|
182 |
}
|
185 |
}
|
186 |
} else {
|
187 |
$(tabContentElement.id).update(transport.responseText);
|
188 |
+
this.showTabContentImmediately(tab);
|
189 |
}
|
190 |
}
|
191 |
catch (e) {
|
192 |
$(tabContentElement.id).update(transport.responseText);
|
193 |
+
this.showTabContentImmediately(tab);
|
194 |
}
|
195 |
}.bind(this)
|
196 |
});
|
210 |
onSuccess: function(transport) {
|
211 |
try {
|
212 |
if (transport.responseText.isJSON()) {
|
213 |
+
var response = transport.responseText.evalJSON();
|
214 |
if (response.error) {
|
215 |
alert(response.message);
|
216 |
}
|
245 |
varienGlobalEvents.fireEvent('hideTab', {tab:tab});
|
246 |
}
|
247 |
}
|
248 |
+
};
|
js/mage/adminhtml/tools.js
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
function setLocation(url){
|
26 |
-
window.location.href = url;
|
27 |
}
|
28 |
|
29 |
function confirmSetLocation(message, url){
|
@@ -94,7 +94,7 @@ function imagePreview(element){
|
|
94 |
win.document.close();
|
95 |
Event.observe(win, 'load', function(){
|
96 |
var img = win.document.getElementById('image_preview');
|
97 |
-
win.resizeTo(img.width+40, img.height+80)
|
98 |
});
|
99 |
}
|
100 |
}
|
@@ -167,7 +167,7 @@ function submitAndReloadArea(area, url) {
|
|
167 |
onSuccess: function(transport) {
|
168 |
try {
|
169 |
if (transport.responseText.isJSON()) {
|
170 |
-
var response = transport.responseText.evalJSON()
|
171 |
if (response.error) {
|
172 |
alert(response.message);
|
173 |
}
|
@@ -204,7 +204,7 @@ Event.observe(window, 'load', function() {
|
|
204 |
});
|
205 |
*/
|
206 |
function syncOnchangeValue(baseElem, distElem){
|
207 |
-
var compare = {baseElem:baseElem, distElem:distElem}
|
208 |
Event.observe(baseElem, 'change', function(){
|
209 |
if($(this.baseElem) && $(this.distElem)){
|
210 |
$(this.distElem).value = $(this.baseElem).value;
|
@@ -311,7 +311,7 @@ var toolbarToggle = {
|
|
311 |
// Create copy of header, that will serve as floating toolbar docked to top of window
|
312 |
this.headerCopy = $(document.createElement('div'));
|
313 |
this.headerCopy.appendChild(this.header.cloneNode(true));
|
314 |
-
document.body.insertBefore(this.headerCopy, document.body.lastChild)
|
315 |
this.headerCopy.addClassName('content-header-floating');
|
316 |
|
317 |
// Remove duplicated buttons and their container
|
@@ -393,7 +393,7 @@ var toolbarToggle = {
|
|
393 |
if (buttons.oldParent == buttons.parentNode) {
|
394 |
// Make static dimensions for placeholder, so it's not collapsed when buttons are removed
|
395 |
if (buttons.placeholder) {
|
396 |
-
var dimensions = buttons.placeholder.getDimensions()
|
397 |
buttons.placeholder.style.width = dimensions.width + 'px';
|
398 |
buttons.placeholder.style.height = dimensions.height + 'px';
|
399 |
}
|
@@ -476,7 +476,7 @@ var toolbarToggle = {
|
|
476 |
|
477 |
this.eventsAdded = false;
|
478 |
}
|
479 |
-
}
|
480 |
|
481 |
// Deprecated since 1.4.2.0-beta1 - use toolbarToggle.reset() instead
|
482 |
function updateTopButtonToolbarToggle()
|
23 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
*/
|
25 |
function setLocation(url){
|
26 |
+
window.location.href = encodeURI(url);
|
27 |
}
|
28 |
|
29 |
function confirmSetLocation(message, url){
|
94 |
win.document.close();
|
95 |
Event.observe(win, 'load', function(){
|
96 |
var img = win.document.getElementById('image_preview');
|
97 |
+
win.resizeTo(img.width+40, img.height+80);
|
98 |
});
|
99 |
}
|
100 |
}
|
167 |
onSuccess: function(transport) {
|
168 |
try {
|
169 |
if (transport.responseText.isJSON()) {
|
170 |
+
var response = transport.responseText.evalJSON();
|
171 |
if (response.error) {
|
172 |
alert(response.message);
|
173 |
}
|
204 |
});
|
205 |
*/
|
206 |
function syncOnchangeValue(baseElem, distElem){
|
207 |
+
var compare = {baseElem:baseElem, distElem:distElem};
|
208 |
Event.observe(baseElem, 'change', function(){
|
209 |
if($(this.baseElem) && $(this.distElem)){
|
210 |
$(this.distElem).value = $(this.baseElem).value;
|
311 |
// Create copy of header, that will serve as floating toolbar docked to top of window
|
312 |
this.headerCopy = $(document.createElement('div'));
|
313 |
this.headerCopy.appendChild(this.header.cloneNode(true));
|
314 |
+
document.body.insertBefore(this.headerCopy, document.body.lastChild);
|
315 |
this.headerCopy.addClassName('content-header-floating');
|
316 |
|
317 |
// Remove duplicated buttons and their container
|
393 |
if (buttons.oldParent == buttons.parentNode) {
|
394 |
// Make static dimensions for placeholder, so it's not collapsed when buttons are removed
|
395 |
if (buttons.placeholder) {
|
396 |
+
var dimensions = buttons.placeholder.getDimensions();
|
397 |
buttons.placeholder.style.width = dimensions.width + 'px';
|
398 |
buttons.placeholder.style.height = dimensions.height + 'px';
|
399 |
}
|
476 |
|
477 |
this.eventsAdded = false;
|
478 |
}
|
479 |
+
};
|
480 |
|
481 |
// Deprecated since 1.4.2.0-beta1 - use toolbarToggle.reset() instead
|
482 |
function updateTopButtonToolbarToggle()
|
js/mage/adminhtml/uploader/instance.js
ADDED
@@ -0,0 +1,508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|