Lib_Js_Mage - Version 1.9.3.0

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 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() { method(eventArgs) }.bind(this), 10);
 
 
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, uploader, imageTypes) {
40
  this.containerId = containerId, this.container = $(this.containerId);
41
- this.uploader = uploader;
42
  this.imageTypes = imageTypes;
43
- if (this.uploader) {
44
- this.uploader.onFilesComplete = this.handleUploadComplete
45
- .bind(this);
46
- }
47
- // this.uploader.onFileProgress = this.handleUploadProgress.bind(this);
48
- // this.uploader.onFileError = this.handleUploadError.bind(this);
 
 
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 = '&nbsp;'
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 = '&nbsp;';
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$/)[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,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) { this.startScroll(90, count) }
160
- ypSimpleScroll.prototype.scrollSouth = function(count) { this.startScroll(270, count) }
161
- ypSimpleScroll.prototype.scrollWest = function(count) { this.startScroll(180, count) }
162
- ypSimpleScroll.prototype.scrollEast = function(count) { this.startScroll(0, count) }
 
 
 
 
 
 
 
 
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 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magento.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magento.com for more information.
19
+ *
20
+ * @category Mage
21
+ * @package Mage_Adminhtml
22
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+
26
+ (function(flowFactory, window, document) {
27
+ 'use strict';
28
+ window.Uploader = Class.create({
29
+
30
+ /**
31
+ * @type {Boolean} Are we in debug mode?
32
+ */
33
+ debug: false,
34
+
35
+ /**
36
+ * @constant
37
+ * @type {String} templatePattern
38
+ */
39
+ templatePattern: /(^|.|\r|\n)({{(\w+)}})/,
40
+
41
+ /**
42
+ * @type {JSON} Array of elements ids to instantiate DOM collection
43
+ */
44
+ elementsIds: [],
45
+
46
+ /**
47
+ * @type {Array.<HTMLElement>} List of elements ids across all uploader functionality
48
+ */
49
+ elements: [],
50
+
51
+ /**
52
+ * @type {(FustyFlow|Flow)} Uploader object instance
53
+ */
54
+ uploader: {},
55
+
56
+ /**
57
+ * @type {JSON} General Uploader config
58
+ */
59
+ uploaderConfig: {},
60
+
61
+ /**
62
+ * @type {JSON} browseConfig General Uploader config
63
+ */
64
+ browseConfig: {},
65
+
66
+ /**
67
+ * @type {JSON} Misc settings to manipulate Uploader
68
+ */
69
+ miscConfig: {},
70
+
71
+ /**
72
+ * @type {Array.<String>} Sizes in plural
73
+ */
74
+ sizesPlural: ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
75
+
76
+ /**
77
+ * @type {Number} Precision of calculation during convetion to human readable size format
78
+ */
79
+ sizePrecisionDefault: 3,
80
+
81
+ /**
82
+ * @type {Number} Unit type conversion kib or kb, etc
83
+ */
84
+ sizeUnitType: 1024,
85
+
86
+ /**
87
+ * @type {String} Default delete button selector
88
+ */
89
+ deleteButtonSelector: '.delete',
90
+
91
+ /**
92
+ * @type {Number} Timeout of completion handler
93
+ */
94
+ onCompleteTimeout: 1000,
95
+
96
+ /**
97
+ * @type {(null|Array.<FlowFile>)} Files array stored for success event
98
+ */
99
+ files: null,
100
+
101
+
102
+ /**
103
+ * @name Uploader
104
+ *
105
+ * @param {JSON} config
106
+ *
107
+ * @constructor
108
+ */
109
+ initialize: function(config) {
110
+ this.elementsIds = config.elementIds;
111
+ this.elements = this.getElements(this.elementsIds);
112
+
113
+ this.uploaderConfig = config.uploaderConfig;
114
+ this.browseConfig = config.browseConfig;
115
+ this.miscConfig = config.miscConfig;
116
+
117
+ this.uploader = flowFactory(this.uploaderConfig);
118
+
119
+ this.attachEvents();
120
+
121
+ /**
122
+ * Bridging functions to retain functionality of existing modules
123
+ */
124
+ this.formatSize = this._getPluralSize.bind(this);
125
+ this.upload = this.onUploadClick.bind(this);
126
+ this.onContainerHideBefore = this.onTabChange.bind(this);
127
+ },
128
+
129
+ /**
130
+ * Array of strings containing elements ids
131
+ *
132
+ * @param {JSON.<string, Array.<string>>} ids as JSON map,
133
+ * {<type> => ['id1', 'id2'...], <type2>...}
134
+ * @returns {Array.<HTMLElement>} An array of DOM elements
135
+ */
136
+ getElements: function (ids) {
137
+ /** @type {Hash} idsHash */
138
+ var idsHash = $H(ids);
139
+
140
+ idsHash.each(function (id) {
141
+ var result = this.getElementsByIds(id.value);
142
+
143
+ idsHash.set(id.key, result);
144
+ }.bind(this));
145
+
146
+ return idsHash.toObject();
147
+ },
148
+
149
+ /**
150
+ * Get HTMLElement from hash values
151
+ *
152
+ * @param {(Array|String)}ids
153
+ * @returns {(Array.<HTMLElement>|HTMLElement)}
154
+ */
155
+ getElementsByIds: function (ids) {
156
+ var result = [];
157
+ if(ids && Object.isArray(ids)) {
158
+ ids.each(function(fromId) {
159
+ var DOMElement = $(fromId);
160
+
161
+ if (DOMElement) {
162
+ // Add it only if it's valid HTMLElement, otherwise skip.
163
+ result.push(DOMElement);
164
+ }
165
+ });
166
+ } else {
167
+ result = $(ids);
168
+ }
169
+
170
+ return result;
171
+ },
172
+
173
+ /**
174
+ * Attach all types of events
175
+ */
176
+ attachEvents: function() {
177
+ this.assignBrowse();
178
+
179
+ this.uploader.on('filesSubmitted', this.onFilesSubmitted.bind(this));
180
+
181
+ this.uploader.on('uploadStart', this.onUploadStart.bind(this));
182
+
183
+ this.uploader.on('fileSuccess', this.onFileSuccess.bind(this));
184
+ this.uploader.on('complete', this.onSuccess.bind(this));
185
+
186
+ if(this.elements.container && !this.elements.delete) {
187
+ this.elements.container.on('click', this.deleteButtonSelector, this.onDeleteClick.bind(this));
188
+ } else {
189
+ if(this.elements.delete) {
190
+ this.elements.delete.on('click', Event.fire.bind(this, document, 'upload:simulateDelete', {
191
+ containerId: this.elementsIds.container
192
+ }));
193
+ }
194
+ }
195
+ if(this.elements.upload) {
196
+ this.elements.upload.invoke('on', 'click', this.onUploadClick.bind(this));
197
+ }
198
+ if(this.debug) {
199
+ this.uploader.on('catchAll', this.onCatchAll.bind(this));
200
+ }
201
+ },
202
+
203
+ onTabChange: function (successFunc) {
204
+ if(this.uploader.files.length && !Object.isArray(this.files)) {
205
+ if(confirm(
206
+ this._translate('There are files that were selected but not uploaded yet. After switching to another tab your selections will be lost. Do you wish to continue ?')
207
+ )
208
+ ) {
209
+ if(Object.isFunction(successFunc)) {
210
+ successFunc();
211
+ } else {
212
+ this._handleDelete(this.uploader.files);
213
+ document.fire('uploader:fileError', {
214
+ containerId: this.elementsIds.container
215
+ });
216
+ }
217
+ } else {
218
+ return 'cannotchange';
219
+ }
220
+ }
221
+ },
222
+
223
+ /**
224
+ * Assign browse buttons to appropriate targets
225
+ */
226
+ assignBrowse: function() {
227
+ if (this.elements.browse && this.elements.browse.length) {
228
+ this.uploader.assignBrowse(
229
+ this.elements.browse,
230
+ this.browseConfig.isDirectory || false,
231
+ this.browseConfig.singleFile || false,
232
+ this.browseConfig.attributes || {}
233
+ );
234
+ }
235
+ },
236
+
237
+ /**
238
+ * @event
239
+ * @param {Array.<FlowFile>} files
240
+ */
241
+ onFilesSubmitted: function (files) {
242
+ files.filter(function (file) {
243
+ if(this._checkFileSize(file)) {
244
+ alert(
245
+ this._translate('Maximum allowed file size for upload is') +
246
+ " " + this.miscConfig.maxSizePlural + "\n" +
247
+ this._translate('Please check your server PHP settings.')
248
+ );
249
+ file.cancel();
250
+ return false;
251
+ }
252
+ return true;
253
+ }.bind(this)).each(function (file) {
254
+ this._handleUpdateFile(file);
255
+ }.bind(this));
256
+ },
257
+
258
+ _handleUpdateFile: function (file) {
259
+ var replaceBrowseWithRemove = this.miscConfig.replaceBrowseWithRemove;
260
+ if(replaceBrowseWithRemove) {
261
+ document.fire('uploader:simulateNewUpload', { containerId: this.elementsIds.container });
262
+ }
263
+ this.elements.container
264
+ [replaceBrowseWithRemove ? 'update':'insert'](this._renderFromTemplate(
265
+ this.elements.templateFile,
266
+ {
267
+ name: file.name,
268
+ size: file.size ? '(' + this._getPluralSize(file.size) + ')' : '',
269
+ id: file.uniqueIdentifier
270
+ }
271
+ )
272
+ );
273
+ },
274
+
275
+ /**
276
+ * Upload button is being pressed
277
+ *
278
+ * @event
279
+ */
280
+ onUploadStart: function () {
281
+ var files = this.uploader.files;
282
+
283
+ files.each(function (file) {
284
+ var id = file.uniqueIdentifier;
285
+
286
+ this._getFileContainerById(id)
287
+ .removeClassName('new')
288
+ .removeClassName('error')
289
+ .addClassName('progress');
290
+ this._getProgressTextById(id).update(this._translate('Uploading...'));
291
+
292
+ var deleteButton = this._getDeleteButtonById(id);
293
+ if(deleteButton) {
294
+ this._getDeleteButtonById(id).hide();
295
+ }
296
+ }.bind(this));
297
+
298
+ this.files = this.uploader.files;
299
+ },
300
+
301
+ /**
302
+ * Get file-line container by id
303
+ *
304
+ * @param {String} id
305
+ * @returns {HTMLElement}
306
+ * @private
307
+ */
308
+ _getFileContainerById: function (id) {
309
+ return $(id + '-container');
310
+ },
311
+
312
+ /**
313
+ * Get text update container
314
+ *
315
+ * @param id
316
+ * @returns {*}
317
+ * @private
318
+ */
319
+ _getProgressTextById: function (id) {
320
+ return this._getFileContainerById(id).down('.progress-text');
321
+ },
322
+
323
+ _getDeleteButtonById: function(id) {
324
+ return this._getFileContainerById(id).down('.delete');
325
+ },
326
+
327
+ /**
328
+ * Handle delete button click
329
+ *
330
+ * @event
331
+ * @param {Event} e
332
+ */
333
+ onDeleteClick: function (e) {
334
+ var element = Event.findElement(e);
335
+ var id = element.id;
336
+ if(!id) {
337
+ id = element.up(this.deleteButtonSelector).id;
338
+ }
339
+ this._handleDelete([this.uploader.getFromUniqueIdentifier(id)]);
340
+ },
341
+
342
+ /**
343
+ * Complete handler of uploading process
344
+ *
345
+ * @event
346
+ */
347
+ onSuccess: function () {
348
+ document.fire('uploader:success', { files: this.files });
349
+ this.files = null;
350
+ },
351
+
352
+ /**
353
+ * Successfully uploaded file, notify about that other components, handle deletion from queue
354
+ *
355
+ * @param {FlowFile} file
356
+ * @param {JSON} response
357
+ */
358
+ onFileSuccess: function (file, response) {
359
+ response = response.evalJSON();
360
+ var id = file.uniqueIdentifier;
361
+ var error = response.error;
362
+ this._getFileContainerById(id)
363
+ .removeClassName('progress')
364
+ .addClassName(error ? 'error': 'complete')
365
+ ;
366
+ this._getProgressTextById(id).update(this._translate(
367
+ error ? this._XSSFilter(error) :'Complete'
368
+ ));
369
+
370
+ setTimeout(function() {
371
+ if(!error) {
372
+ document.fire('uploader:fileSuccess', {
373
+ response: Object.toJSON(response),
374
+ containerId: this.elementsIds.container
375
+ });
376
+ } else {
377
+ document.fire('uploader:fileError', {
378
+ containerId: this.elementsIds.container
379
+ });
380
+ }
381
+ this._handleDelete([file]);
382
+ }.bind(this) , !error ? this.onCompleteTimeout: this.onCompleteTimeout * 3);
383
+ },
384
+
385
+ /**
386
+ * Upload button click event
387
+ *
388
+ * @event
389
+ */
390
+ onUploadClick: function () {
391
+ try {
392
+ this.uploader.upload();
393
+ } catch(e) {
394
+ if(console) {
395
+ console.error(e);
396
+ }
397
+ }
398
+ },
399
+
400
+ /**
401
+ * Event for debugging purposes
402
+ *
403
+ * @event
404
+ */
405
+ onCatchAll: function () {
406
+ if(console.group && console.groupEnd && console.trace) {
407
+ var args = [].splice.call(arguments, 1);
408
+ console.group();
409
+ console.info(arguments[0]);
410
+ console.log("Uploader Instance:", this);
411
+ console.log("Event Arguments:", args);
412
+ console.trace();
413
+ console.groupEnd();
414
+ } else {
415
+ console.log(this, arguments);
416
+ }
417
+ },
418
+
419
+ /**
420
+ * Handle deletition of files
421
+ * @param {Array.<FlowFile>} files
422
+ * @private
423
+ */
424
+ _handleDelete: function (files) {
425
+ files.each(function (file) {
426
+ file.cancel();
427
+ var container = $(file.uniqueIdentifier + '-container');
428
+ if(container) {
429
+ container.remove();
430
+ }
431
+ }.bind(this));
432
+ },
433
+
434
+ /**
435
+ * Check whenever file size exceeded permitted amount
436
+ *
437
+ * @param {FlowFile} file
438
+ * @returns {boolean}
439
+ * @private
440
+ */
441
+ _checkFileSize: function (file) {
442
+ return file.size > this.miscConfig.maxSizeInBytes;
443
+ },
444
+
445
+ /**
446
+ * Make a translation of string
447
+ *
448
+ * @param {String} text
449
+ * @returns {String}
450
+ * @private
451
+ */
452
+ _translate: function (text) {
453
+ try {
454
+ return Translator.translate(text);
455
+ }
456
+ catch(e){
457
+ return text;
458
+ }
459
+ },
460
+
461
+ /**
462
+ * Render from given template and given variables to assign
463
+ *
464
+ * @param {HTMLElement} template
465
+ * @param {JSON} vars
466
+ * @returns {String}
467
+ * @private
468
+ */
469
+ _renderFromTemplate: function (template, vars) {
470
+ var t = new Template(this._XSSFilter(template.innerHTML), this.templatePattern);
471
+ return t.evaluate(vars);
472
+ },
473
+
474
+ /**
475
+ * Format size with precision
476
+ *
477
+ * @param {Number} sizeInBytes
478
+ * @param {Number} [precision]
479
+ * @returns {String}
480
+ * @private
481
+ */
482
+ _getPluralSize: function (sizeInBytes, precision) {
483
+ if(sizeInBytes == 0) {
484
+ return 0 + this.sizesPlural[0];
485
+ }
486
+ var dm = (precision || this.sizePrecisionDefault) + 1;
487
+ var i = Math.floor(Math.log(sizeInBytes) / Math.log(this.sizeUnitType));
488
+
489
+ return (sizeInBytes / Math.pow(this.sizeUnitType, i)).toPrecision(dm) + ' ' + this.sizesPlural[i];
490
+ },
491
+
492
+ /**
493
+ * Purify template string to prevent XSS attacks
494
+ *
495
+ * @param {String} str
496
+ * @returns {String}
497
+ * @private
498
+ */
499
+ _XSSFilter: function (str) {
500
+ return str
501
+ .stripScripts()
502
+ // Remove inline event handlers like onclick, onload, etc
503
+ .replace(/(on[a-z]+=["][^"]+["])(?=[^>]*>)/img, '')
504
+ .replace(/(on[a-z]+=['][^']+['])(?=[^>]*>)/img, '')
505
+ ;
506
+ }
507
+ });
508
+ })(fustyFlowFactory, window, document);
js/mage/adminhtml/wysiwyg/tiny_mce/setup.js CHANGED
@@ -96,6 +96,261 @@ tinyMceWysiwygSetup.prototype =
96
 
97
  var settings = {
98
  schema : 'html5',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  mode : (mode != undefined ? mode : 'none'),
100
  elements : this.id,
101
  theme : 'advanced',
@@ -361,4 +616,4 @@ tinyMceWysiwygSetup.prototype =
361
  widgetPlaceholderExist: function(filename) {
362
  return this.config.widget_placeholders.indexOf(filename) != -1;
363
  }
364
- }
96
 
97
  var settings = {
98
  schema : 'html5',
99
+ valid_elements : ""
100
+ +"a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name"
101
+ +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
102
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev"
103
+ +"|shape<circle?default?poly?rect|style|tabindex|title|target|type],"
104
+ +"abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
105
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
106
+ +"|title],"
107
+ +"acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress"
108
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
109
+ +"|title],"
110
+ +"address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
111
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
112
+ +"|onmouseup|style|title],"
113
+ +"applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase"
114
+ +"|height|hspace|id|name|object|style|title|vspace|width],"
115
+ +"area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref"
116
+ +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
117
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup"
118
+ +"|shape<circle?default?poly?rect|style|tabindex|title|target],"
119
+ +"base[href|target],"
120
+ +"basefont[color|face|id|size],"
121
+ +"bdo[class|dir<ltr?rtl|id|lang|style|title],"
122
+ +"big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
123
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
124
+ +"|title],"
125
+ +"blockquote[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick"
126
+ +"|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
127
+ +"|onmouseover|onmouseup|style|title],"
128
+ +"body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick"
129
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove"
130
+ +"|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink],"
131
+ +"br[class|clear<all?left?none?right|id|style|title],"
132
+ +"button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur"
133
+ +"|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown"
134
+ +"|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type"
135
+ +"|value],"
136
+ +"caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick"
137
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
138
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
139
+ +"center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
140
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
141
+ +"|title],"
142
+ +"cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
143
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
144
+ +"|title],"
145
+ +"code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
146
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
147
+ +"|title],"
148
+ +"col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
149
+ +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
150
+ +"|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title"
151
+ +"|valign<baseline?bottom?middle?top|width],"
152
+ +"colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl"
153
+ +"|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
154
+ +"|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title"
155
+ +"|valign<baseline?bottom?middle?top|width],"
156
+ +"dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
157
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
158
+ +"del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
159
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
160
+ +"|onmouseup|style|title],"
161
+ +"dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
162
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
163
+ +"|title],"
164
+ +"dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
165
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
166
+ +"|onmouseup|style|title],"
167
+ +"div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
168
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
169
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
170
+ +"dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
171
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
172
+ +"|onmouseup|style|title],"
173
+ +"dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
174
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
175
+ +"em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
176
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
177
+ +"|title],"
178
+ +"fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
179
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
180
+ +"|title],"
181
+ +"font[class|color|dir<ltr?rtl|face|id|lang|size|style|title],"
182
+ +"form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang"
183
+ +"|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
184
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit"
185
+ +"|style|title|target],"
186
+ +"frame[class|frameborder|id|longdesc|marginheight|marginwidth|name"
187
+ +"|noresize<noresize|scrolling<auto?no?yes|src|style|title],"
188
+ +"frameset[class|cols|id|onload|onunload|rows|style|title],"
189
+ +"h1[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
190
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
191
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
192
+ +"h2[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
193
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
194
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
195
+ +"h3[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
196
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
197
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
198
+ +"h4[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
199
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
200
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
201
+ +"h5[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
202
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
203
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
204
+ +"h6[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
205
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
206
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
207
+ +"head[dir<ltr?rtl|lang|profile],"
208
+ +"hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick"
209
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
210
+ +"|onmouseout|onmouseover|onmouseup|size|style|title|width],"
211
+ +"html[dir<ltr?rtl|lang|version],"
212
+ +"iframe[align<bottom?left?middle?right?top|class|frameborder|height|id"
213
+ +"|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style"
214
+ +"|title|width],"
215
+ +"img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height"
216
+ +"|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown"
217
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
218
+ +"|onmouseup|src|style|title|usemap|vspace|width],"
219
+ +"input[accept|accesskey|align<bottom?left?middle?right?top|alt"
220
+ +"|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang"
221
+ +"|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress"
222
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect"
223
+ +"|readonly<readonly|size|src|style|tabindex|title"
224
+ +"|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text"
225
+ +"|usemap|value],"
226
+ +"ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
227
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
228
+ +"|onmouseup|style|title],"
229
+ +"isindex[class|dir<ltr?rtl|id|lang|prompt|style|title],"
230
+ +"kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
231
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
232
+ +"|title],"
233
+ +"label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick"
234
+ +"|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
235
+ +"|onmouseover|onmouseup|style|title],"
236
+ +"legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang"
237
+ +"|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
238
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
239
+ +"li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
240
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type"
241
+ +"|value],"
242
+ +"link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick"
243
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
244
+ +"|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type],"
245
+ +"map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress"
246
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
247
+ +"|title],"
248
+ +"menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
249
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
250
+ +"|onmouseup|style|title],"
251
+ +"meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme],"
252
+ +"noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
253
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
254
+ +"|title],"
255
+ +"noscript[class|dir<ltr?rtl|id|lang|style|title],"
256
+ +"object[align<bottom?left?middle?right?top|archive|border|class|classid"
257
+ +"|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name"
258
+ +"|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
259
+ +"|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap"
260
+ +"|vspace|width],"
261
+ +"ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
262
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
263
+ +"|onmouseup|start|style|title|type],"
264
+ +"optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick"
265
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
266
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
267
+ +"option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick"
268
+ +"|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
269
+ +"|onmouseover|onmouseup|selected<selected|style|title|value],"
270
+ +"p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
271
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
272
+ +"|onmouseout|onmouseover|onmouseup|style|title],"
273
+ +"param[id|name|type|value|valuetype<DATA?OBJECT?REF],"
274
+ +"pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick"
275
+ +"|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
276
+ +"|onmouseover|onmouseup|style|title|width],"
277
+ +"q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
278
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
279
+ +"|title],"
280
+ +"s[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
281
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
282
+ +"samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
283
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
284
+ +"|title],"
285
+ +"script[charset|defer|language|src|type],"
286
+ +"select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name"
287
+ +"|onblur|onchange|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
288
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style"
289
+ +"|tabindex|title],"
290
+ +"small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
291
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
292
+ +"|title],"
293
+ +"span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
294
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
295
+ +"|onmouseup|style|title],"
296
+ +"strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
297
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
298
+ +"|onmouseup|style|title],"
299
+ +"strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
300
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
301
+ +"|title],"
302
+ +"style[dir<ltr?rtl|lang|media|title|type],"
303
+ +"sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
304
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
305
+ +"|title],"
306
+ +"sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
307
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
308
+ +"|title],"
309
+ +"table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class"
310
+ +"|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress"
311
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules"
312
+ +"|style|summary|title|width],"
313
+ +"tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id"
314
+ +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
315
+ +"|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
316
+ +"|valign<baseline?bottom?middle?top],"
317
+ +"td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class"
318
+ +"|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick"
319
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
320
+ +"|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup"
321
+ +"|style|title|valign<baseline?bottom?middle?top|width],"
322
+ +"textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name"
323
+ +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
324
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect"
325
+ +"|readonly<readonly|rows|style|tabindex|title],"
326
+ +"tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
327
+ +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
328
+ +"|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
329
+ +"|valign<baseline?bottom?middle?top],"
330
+ +"th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class"
331
+ +"|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick"
332
+ +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
333
+ +"|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup"
334
+ +"|style|title|valign<baseline?bottom?middle?top|width],"
335
+ +"thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
336
+ +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
337
+ +"|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
338
+ +"|valign<baseline?bottom?middle?top],"
339
+ +"title[dir<ltr?rtl|lang],"
340
+ +"tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class"
341
+ +"|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
342
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
343
+ +"|title|valign<baseline?bottom?middle?top],"
344
+ +"tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
345
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
346
+ +"u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
347
+ +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
348
+ +"ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
349
+ +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
350
+ +"|onmouseup|style|title|type],"
351
+ +"var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
352
+ +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
353
+ +"|title]",
354
  mode : (mode != undefined ? mode : 'none'),
355
  elements : this.id,
356
  theme : 'advanced',
616
  widgetPlaceholderExist: function(filename) {
617
  return this.config.widget_placeholders.indexOf(filename) != -1;
618
  }
619
+ };
js/mage/adminhtml/wysiwyg/widget.js CHANGED
@@ -31,7 +31,7 @@ var widgetTools = {
31
 
32
  onAjaxSuccess: function(transport) {
33
  if (transport.responseText.isJSON()) {
34
- var response = transport.responseText.evalJSON()
35
  if (response.error) {
36
  throw response;
37
  } else if (response.ajaxExpired && response.ajaxRedirect) {
@@ -74,7 +74,7 @@ var widgetTools = {
74
  window.close();
75
  }
76
  }
77
- }
78
 
79
  var WysiwygWidget = {};
80
  WysiwygWidget.Widget = Class.create();
@@ -272,7 +272,7 @@ WysiwygWidget.Widget.prototype = {
272
  getWysiwygNode: function() {
273
  return tinyMCE.activeEditor.selection.getNode();
274
  }
275
- }
276
 
277
  WysiwygWidget.chooser = Class.create();
278
  WysiwygWidget.chooser.prototype = {
@@ -404,4 +404,4 @@ WysiwygWidget.chooser.prototype = {
404
  setElementLabel: function(value) {
405
  this.getElementLabel().innerHTML = value;
406
  }
407
- }
31
 
32
  onAjaxSuccess: function(transport) {
33
  if (transport.responseText.isJSON()) {
34
+ var response = transport.responseText.evalJSON();
35
  if (response.error) {
36
  throw response;
37
  } else if (response.ajaxExpired && response.ajaxRedirect) {
74
  window.close();
75
  }
76
  }
77
+ };
78
 
79
  var WysiwygWidget = {};
80
  WysiwygWidget.Widget = Class.create();
272
  getWysiwygNode: function() {
273
  return tinyMCE.activeEditor.selection.getNode();
274
  }
275
+ };
276
 
277
  WysiwygWidget.chooser = Class.create();
278
  WysiwygWidget.chooser.prototype = {
404
  setElementLabel: function(value) {
405
  this.getElementLabel().innerHTML = value;
406
  }
407
+ };
js/mage/captcha.js CHANGED
@@ -54,10 +54,10 @@ Captcha.prototype = {
54
  document.observe('billing-request:completed', function(event) {
55
  if (typeof window.checkout != 'undefined') {
56
  if (window.checkout.method == 'guest' && $('guest_checkout')){
57
- $('guest_checkout').captcha.refresh()
58
  }
59
  if (window.checkout.method == 'register' && $('register_during_checkout')){
60
- $('register_during_checkout').captcha.refresh()
61
  }
62
  }
63
  });
54
  document.observe('billing-request:completed', function(event) {
55
  if (typeof window.checkout != 'undefined') {
56
  if (window.checkout.method == 'guest' && $('guest_checkout')){
57
+ $('guest_checkout').captcha.refresh();
58
  }
59
  if (window.checkout.method == 'register' && $('register_during_checkout')){
60
+ $('register_during_checkout').captcha.refresh();
61
  }
62
  }
63
  });
js/mage/directpost.js CHANGED
@@ -150,20 +150,17 @@ directPost.prototype = {
150
  $(this.iframeId).hide();
151
  this.resetLoadWaiting();
152
  }
153
- alert(msg);
154
  },
155
 
156
  returnQuote : function() {
157
  var url = this.orderSaveUrl.replace('place', 'returnQuote');
158
  new Ajax.Request(url, {
159
  onSuccess : function(transport) {
160
- try {
161
- response = eval('(' + transport.responseText + ')');
162
- } catch (e) {
163
- response = {};
164
- }
165
  if (response.error_message) {
166
- alert(response.error_message);
167
  }
168
  $(this.iframeId).show();
169
  switch (this.controller) {
@@ -221,27 +218,25 @@ directPost.prototype = {
221
  if (transport.status == 403) {
222
  checkout.ajaxFailure();
223
  }
224
- try {
225
- response = eval('(' + transport.responseText + ')');
226
- } catch (e) {
227
- response = {};
228
- }
229
 
230
  if (response.success && response.directpost) {
231
  this.orderIncrementId = response.directpost.fields.x_invoice_num;
232
  var paymentData = {};
233
  for ( var key in response.directpost.fields) {
234
- paymentData[key] = response.directpost.fields[key];
 
 
235
  }
236
  var preparedData = this.preparePaymentRequest(paymentData);
237
  this.sendPaymentRequest(preparedData);
238
  } else {
239
  var msg = response.error_messages;
240
- if (typeof (msg) == 'object') {
241
  msg = msg.join("\n");
242
  }
243
  if (msg) {
244
- alert(msg);
245
  }
246
 
247
  if (response.update_section) {
@@ -312,17 +307,15 @@ directPost.prototype = {
312
  },
313
 
314
  saveAdminOrderSuccess : function(data) {
315
- try {
316
- response = eval('(' + data + ')');
317
- } catch (e) {
318
- response = {};
319
- }
320
 
321
  if (response.directpost) {
322
  this.orderIncrementId = response.directpost.fields.x_invoice_num;
323
  var paymentData = {};
324
  for ( var key in response.directpost.fields) {
325
- paymentData[key] = response.directpost.fields[key];
 
 
326
  }
327
  var preparedData = this.preparePaymentRequest(paymentData);
328
  this.sendPaymentRequest(preparedData);
@@ -332,11 +325,11 @@ directPost.prototype = {
332
  }
333
  if (response.error_messages) {
334
  var msg = response.error_messages;
335
- if (typeof (msg) == 'object') {
336
  msg = msg.join("\n");
337
  }
338
  if (msg) {
339
- alert(msg);
340
  }
341
  }
342
  }
150
  $(this.iframeId).hide();
151
  this.resetLoadWaiting();
152
  }
153
+ alert(msg.stripTags().toString());
154
  },
155
 
156
  returnQuote : function() {
157
  var url = this.orderSaveUrl.replace('place', 'returnQuote');
158
  new Ajax.Request(url, {
159
  onSuccess : function(transport) {
160
+ var response = transport.responseJSON || transport.responseText.evalJSON(true) || {};
161
+
 
 
 
162
  if (response.error_message) {
163
+ alert(response.error_message.stripTags().toString());
164
  }
165
  $(this.iframeId).show();
166
  switch (this.controller) {
218
  if (transport.status == 403) {
219
  checkout.ajaxFailure();
220
  }
221
+ var response = transport.responseJSON || transport.responseText.evalJSON(true) || {};
 
 
 
 
222
 
223
  if (response.success && response.directpost) {
224
  this.orderIncrementId = response.directpost.fields.x_invoice_num;
225
  var paymentData = {};
226
  for ( var key in response.directpost.fields) {
227
+ if(response.directpost.fields.hasOwnProperty(key)) {
228
+ paymentData[key] = response.directpost.fields[key];
229
+ }
230
  }
231
  var preparedData = this.preparePaymentRequest(paymentData);
232
  this.sendPaymentRequest(preparedData);
233
  } else {
234
  var msg = response.error_messages;
235
+ if (Object.isArray(msg)) {
236
  msg = msg.join("\n");
237
  }
238
  if (msg) {
239
+ alert(msg.stripTags().toString());
240
  }
241
 
242
  if (response.update_section) {
307
  },
308
 
309
  saveAdminOrderSuccess : function(data) {
310
+ var response = transport.responseJSON || transport.responseText.evalJSON(true) || {};
 
 
 
 
311
 
312
  if (response.directpost) {
313
  this.orderIncrementId = response.directpost.fields.x_invoice_num;
314
  var paymentData = {};
315
  for ( var key in response.directpost.fields) {
316
+ if(response.directpost.fields.hasOwnProperty(key)) {
317
+ paymentData[key] = response.directpost.fields[key];
318
+ }
319
  }
320
  var preparedData = this.preparePaymentRequest(paymentData);
321
  this.sendPaymentRequest(preparedData);
325
  }
326
  if (response.error_messages) {
327
  var msg = response.error_messages;
328
+ if (Object.isArray(msg)) {
329
  msg = msg.join("\n");
330
  }
331
  if (msg) {
332
+ alert(msg.stripTags().toString());
333
  }
334
  }
335
  }
js/mage/translate.js CHANGED
@@ -47,4 +47,4 @@ Translate.prototype = {
47
  }.bind(this));
48
  }
49
  }
50
- }
47
  }.bind(this));
48
  }
49
  }
50
+ };
js/mage/translate_inline.js CHANGED
@@ -35,15 +35,15 @@ TranslateInline.prototype = {
35
  $$('*[data-translate]').each(this.initializeElement.bind(this));
36
  var scope = this;
37
  Ajax.Responders.register({ onComplete: function() {
38
- window.setTimeout(scope.reinitElements.bind(scope), 50)
39
  }
40
  });
41
- var ElementNode = (typeof HTMLElement != 'undefined' ? HTMLElement : Element)
42
  var ElementUpdate = ElementNode.prototype.update;
43
  ElementNode.prototype.update = function() {
44
  ElementUpdate.apply(this, arguments);
45
  $(this).select('*[data-translate]').each(scope.initializeElement.bind(scope));
46
- }
47
  }
48
  this.trigEl = $(trigEl);
49
  this.trigEl.observe('click', this.formShow.bind(this));
@@ -222,4 +222,4 @@ TranslateInline.prototype = {
222
  escaped = escaped.replace(/"/g, '&quot;');
223
  return escaped;
224
  }
225
- }
35
  $$('*[data-translate]').each(this.initializeElement.bind(this));
36
  var scope = this;
37
  Ajax.Responders.register({ onComplete: function() {
38
+ window.setTimeout(scope.reinitElements.bind(scope), 50);
39
  }
40
  });
41
+ var ElementNode = (typeof HTMLElement != 'undefined' ? HTMLElement : Element);
42
  var ElementUpdate = ElementNode.prototype.update;
43
  ElementNode.prototype.update = function() {
44
  ElementUpdate.apply(this, arguments);
45
  $(this).select('*[data-translate]').each(scope.initializeElement.bind(scope));
46
+ };
47
  }
48
  this.trigEl = $(trigEl);
49
  this.trigEl.observe('click', this.formShow.bind(this));
222
  escaped = escaped.replace(/"/g, '&quot;');
223
  return escaped;
224
  }
225
+ };
js/varien/accordion.js CHANGED
@@ -61,7 +61,7 @@ Accordion.prototype = {
61
  var pastCurrentSection = false;
62
  for (var i=0; i<this.sections.length; i++) {
63
  if (pastCurrentSection) {
64
- Element.removeClassName(this.sections[i], 'allow')
65
  }
66
  if (this.sections[i].id==section.id) {
67
  pastCurrentSection = true;
@@ -83,7 +83,7 @@ Accordion.prototype = {
83
  var nextIndex = parseInt(section)+1;
84
  if (this.sections[section].id == this.currentSection && this.sections[nextIndex]){
85
  if (setAllow) {
86
- Element.addClassName(this.sections[nextIndex], 'allow')
87
  }
88
  this.openSection(this.sections[nextIndex]);
89
  return;
@@ -96,7 +96,7 @@ Accordion.prototype = {
96
  var prevIndex = parseInt(section)-1;
97
  if (this.sections[section].id == this.currentSection && this.sections[prevIndex]){
98
  if (setAllow) {
99
- Element.addClassName(this.sections[prevIndex], 'allow')
100
  }
101
  this.openSection(this.sections[prevIndex]);
102
  return;
@@ -109,4 +109,4 @@ Accordion.prototype = {
109
  this.closeSection(this.currentSection);
110
  }
111
  }
112
- }
61
  var pastCurrentSection = false;
62
  for (var i=0; i<this.sections.length; i++) {
63
  if (pastCurrentSection) {
64
+ Element.removeClassName(this.sections[i], 'allow');
65
  }
66
  if (this.sections[i].id==section.id) {
67
  pastCurrentSection = true;
83
  var nextIndex = parseInt(section)+1;
84
  if (this.sections[section].id == this.currentSection && this.sections[nextIndex]){
85
  if (setAllow) {
86
+ Element.addClassName(this.sections[nextIndex], 'allow');
87
  }
88
  this.openSection(this.sections[nextIndex]);
89
  return;
96
  var prevIndex = parseInt(section)-1;
97
  if (this.sections[section].id == this.currentSection && this.sections[prevIndex]){
98
  if (setAllow) {
99
+ Element.addClassName(this.sections[prevIndex], 'allow');
100
  }
101
  this.openSection(this.sections[prevIndex]);
102
  return;
109
  this.closeSection(this.currentSection);
110
  }
111
  }
112
+ };
js/varien/configurable.js CHANGED
@@ -72,7 +72,7 @@ Product.Config.prototype = {
72
 
73
  // Put events to check select reloads
74
  this.settings.each(function(element){
75
- Event.observe(element, 'change', this.configure.bind(this))
76
  }.bind(this));
77
 
78
  // fill state
@@ -83,7 +83,7 @@ Product.Config.prototype = {
83
  element.attributeId = attributeId;
84
  this.state[attributeId] = false;
85
  }
86
- }.bind(this))
87
 
88
  // Init settings dropdown
89
  var childSettings = [];
@@ -91,7 +91,7 @@ Product.Config.prototype = {
91
  var prevSetting = this.settings[i-1] ? this.settings[i-1] : false;
92
  var nextSetting = this.settings[i+1] ? this.settings[i+1] : false;
93
  if (i == 0){
94
- this.fillSelect(this.settings[i])
95
  } else {
96
  this.settings[i].disabled = true;
97
  }
@@ -140,7 +140,7 @@ Product.Config.prototype = {
140
  reloadOptionLabels: function(element){
141
  var selectedPrice;
142
  if(element.options[element.selectedIndex].config && !this.config.stablePrices){
143
- selectedPrice = parseFloat(element.options[element.selectedIndex].config.price)
144
  }
145
  else{
146
  selectedPrice = 0;
@@ -317,4 +317,4 @@ Product.Config.prototype = {
317
 
318
  }
319
  }
320
- }
72
 
73
  // Put events to check select reloads
74
  this.settings.each(function(element){
75
+ Event.observe(element, 'change', this.configure.bind(this));
76
  }.bind(this));
77
 
78
  // fill state
83
  element.attributeId = attributeId;
84
  this.state[attributeId] = false;
85
  }
86
+ }.bind(this));
87
 
88
  // Init settings dropdown
89
  var childSettings = [];
91
  var prevSetting = this.settings[i-1] ? this.settings[i-1] : false;
92
  var nextSetting = this.settings[i+1] ? this.settings[i+1] : false;
93
  if (i == 0){
94
+ this.fillSelect(this.settings[i]);
95
  } else {
96
  this.settings[i].disabled = true;
97
  }
140
  reloadOptionLabels: function(element){
141
  var selectedPrice;
142
  if(element.options[element.selectedIndex].config && !this.config.stablePrices){
143
+ selectedPrice = parseFloat(element.options[element.selectedIndex].config.price);
144
  }
145
  else{
146
  selectedPrice = 0;
317
 
318
  }
319
  }
320
+ };
js/varien/form.js CHANGED
@@ -42,7 +42,7 @@ VarienForm.prototype = {
42
  this.bindElements();
43
  if(this.firstFieldFocus){
44
  try{
45
- Form.Element.focus(Form.findFirstElement(this.form))
46
  }
47
  catch(e){}
48
  }
@@ -117,7 +117,7 @@ VarienForm.prototype = {
117
  },
118
 
119
  reloadChildren: function(transport){
120
- var data = eval('(' + transport.responseText + ')');
121
  this.cache[this.currLoader]['data'][this.currDataIndex] = data;
122
  this.setDataToChild(data);
123
  },
@@ -158,7 +158,7 @@ VarienForm.prototype = {
158
  this.callback();
159
  }
160
  }
161
- }
162
 
163
  RegionUpdater = Class.create();
164
  RegionUpdater.prototype = {
@@ -215,7 +215,7 @@ RegionUpdater.prototype = {
215
  } else if (regionRequired) {
216
  wildCard.show();
217
  if (!label.hasClassName('required')) {
218
- label.addClassName('required')
219
  }
220
  }
221
  }
@@ -358,7 +358,7 @@ RegionUpdater.prototype = {
358
  $(elem).value = currentVal;
359
  return;
360
  }
361
- }
362
 
363
  ZipUpdater = Class.create();
364
  ZipUpdater.prototype = {
@@ -377,7 +377,7 @@ ZipUpdater.prototype = {
377
 
378
  // Ajax-request and normal content load compatibility
379
  if (this.zipElement != undefined) {
380
- Validation.reset(this.zipElement)
381
  this._setPostcodeOptional();
382
  } else {
383
  Event.observe(window, "load", this._setPostcodeOptional.bind(this));
@@ -412,4 +412,4 @@ ZipUpdater.prototype = {
412
  }
413
  }
414
  }
415
- }
42
  this.bindElements();
43
  if(this.firstFieldFocus){
44
  try{
45
+ Form.Element.focus(Form.findFirstElement(this.form));
46
  }
47
  catch(e){}
48
  }
117
  },
118
 
119
  reloadChildren: function(transport){
120
+ var data = transport.responseJSON || transport.responseText.evalJSON(true) || {};
121
  this.cache[this.currLoader]['data'][this.currDataIndex] = data;
122
  this.setDataToChild(data);
123
  },
158
  this.callback();
159
  }
160
  }
161
+ };
162
 
163
  RegionUpdater = Class.create();
164
  RegionUpdater.prototype = {
215
  } else if (regionRequired) {
216
  wildCard.show();
217
  if (!label.hasClassName('required')) {
218
+ label.addClassName('required');
219
  }
220
  }
221
  }
358
  $(elem).value = currentVal;
359
  return;
360
  }
361
+ };
362
 
363
  ZipUpdater = Class.create();
364
  ZipUpdater.prototype = {
377
 
378
  // Ajax-request and normal content load compatibility
379
  if (this.zipElement != undefined) {
380
+ Validation.reset(this.zipElement);
381
  this._setPostcodeOptional();
382
  } else {
383
  Event.observe(window, "load", this._setPostcodeOptional.bind(this));
412
  }
413
  }
414
  }
415
+ };
js/varien/iehover-fix.js CHANGED
@@ -31,11 +31,15 @@ function toggleMenu(el, over)
31
  if (over) {
32
  Element.addClassName(el, 'over');
33
 
34
- if(iS){ uL.addClassName('shown-sub')};
 
 
35
  }
36
  else {
37
  Element.removeClassName(el, 'over');
38
- if(iS){ uL.removeClassName('shown-sub')};
 
 
39
  }
40
  }
41
 
@@ -44,8 +48,8 @@ ieHover = function() {
44
  items = $$('#nav ul', '.truncated_full_value .item-options', '.tool-tip');
45
  $$('#checkout-step-payment', '.tool-tip').each(function(el) {
46
  el.show();
47
- el.setStyle({'visibility':'hidden'})
48
- })
49
  for (var j=0; j<items.length; j++) {
50
  iframe = document.createElement('IFRAME');
51
  iframe.src = BLANK_URL;
@@ -58,7 +62,7 @@ ieHover = function() {
58
  }
59
  $$('.tool-tip', '#checkout-step-payment').each(function(el) {
60
  el.hide();
61
- el.setStyle({'visibility':'visible'})
62
- })
63
- }
64
  Event.observe(window, 'load', ieHover);
31
  if (over) {
32
  Element.addClassName(el, 'over');
33
 
34
+ if(iS){
35
+ uL.addClassName('shown-sub');
36
+ };
37
  }
38
  else {
39
  Element.removeClassName(el, 'over');
40
+ if(iS){
41
+ uL.removeClassName('shown-sub');
42
+ };
43
  }
44
  }
45
 
48
  items = $$('#nav ul', '.truncated_full_value .item-options', '.tool-tip');
49
  $$('#checkout-step-payment', '.tool-tip').each(function(el) {
50
  el.show();
51
+ el.setStyle({'visibility':'hidden'});
52
+ });
53
  for (var j=0; j<items.length; j++) {
54
  iframe = document.createElement('IFRAME');
55
  iframe.src = BLANK_URL;
62
  }
63
  $$('.tool-tip', '#checkout-step-payment').each(function(el) {
64
  el.hide();
65
+ el.setStyle({'visibility':'visible'});
66
+ });
67
+ };
68
  Event.observe(window, 'load', ieHover);
js/varien/js.js CHANGED
@@ -28,16 +28,19 @@ function popWin(url,win,para) {
28
  }
29
 
30
  function setLocation(url){
31
- window.location.href = url;
32
  }
33
 
34
  function setPLocation(url, setFocus){
35
  if( setFocus ) {
36
  window.opener.focus();
37
  }
38
- window.opener.location.href = url;
39
  }
40
 
 
 
 
41
  function setLanguageCode(code, fromCode){
42
  //TODO: javascript cookies have different domain and path than php cookies
43
  var href = window.location.href;
@@ -173,7 +176,7 @@ function decorateTable(table, options) {
173
  function decorateList(list, nonRecursive) {
174
  if ($(list)) {
175
  if (typeof(nonRecursive) == 'undefined') {
176
- var items = $(list).select('li')
177
  }
178
  else {
179
  var items = $(list).childElements();
@@ -251,7 +254,7 @@ function formatCurrency(price, format, showPlus){
251
  * when Math.abs(0).toFixed() executed on "0" number.
252
  * Result is "0.-0" :(
253
  */
254
- var r = (j ? i.substr(0, j) + groupSymbol : "") + i.substr(j).replace(re, "$1" + groupSymbol) + (precision ? decimalSymbol + Math.abs(price - i).toFixed(precision).replace(/-/, 0).slice(2) : "")
255
  var pattern = '';
256
  if (format.pattern.indexOf('{sign}') == -1) {
257
  pattern = s + format.pattern;
@@ -264,11 +267,15 @@ function formatCurrency(price, format, showPlus){
264
 
265
  function expandDetails(el, childClass) {
266
  if (Element.hasClassName(el,'show-details')) {
267
- $$(childClass).each(function(item){item.hide()});
 
 
268
  Element.removeClassName(el,'show-details');
269
  }
270
  else {
271
- $$(childClass).each(function(item){item.show()});
 
 
272
  Element.addClassName(el,'show-details');
273
  }
274
  }
@@ -282,11 +289,11 @@ if (!window.Varien)
282
  Varien.showLoading = function(){
283
  var loader = $('loading-process');
284
  loader && loader.show();
285
- }
286
  Varien.hideLoading = function(){
287
  var loader = $('loading-process');
288
  loader && loader.hide();
289
- }
290
  Varien.GlobalHandlers = {
291
  onCreate: function() {
292
  Varien.showLoading();
@@ -369,7 +376,7 @@ Varien.searchForm.prototype = {
369
  }
370
  this.form.submit();
371
  }
372
- }
373
 
374
  Varien.Tabs = Class.create();
375
  Varien.Tabs.prototype = {
@@ -399,7 +406,7 @@ Varien.Tabs.prototype = {
399
  }
400
  });
401
  }
402
- }
403
 
404
  Varien.DateElement = Class.create();
405
  Varien.DateElement.prototype = {
@@ -436,6 +443,9 @@ Varien.DateElement.prototype = {
436
  this.year.setAttribute('autocomplete','off');
437
 
438
  this.advice.hide();
 
 
 
439
  },
440
  validate: function() {
441
  var error = false,
@@ -452,12 +462,13 @@ Varien.DateElement.prototype = {
452
  this.full.value = '';
453
  }
454
  } else if (!day || !month || !year) {
455
- error = 'Please enter a valid full date.';
456
  } else {
457
  var date = new Date, countDaysInMonth = 0, errorType = null;
458
  date.setYear(year);date.setMonth(month-1);date.setDate(32);
459
  countDaysInMonth = 32 - date.getDate();
460
  if(!countDaysInMonth || countDaysInMonth>31) countDaysInMonth = 31;
 
461
 
462
  if (day<1 || day>countDaysInMonth) {
463
  errorType = 'day';
@@ -509,13 +520,12 @@ Varien.DateElement.prototype = {
509
  },
510
  validateData: function() {
511
  var year = this.fullDate.getFullYear();
512
- var date = new Date;
513
- this.curyear = date.getFullYear();
514
  return (year>=1900 && year<=this.curyear);
515
  },
516
  validateDataErrorType: 'year',
517
  validateDataErrorText: 'Please enter a valid year (1900-%d).',
518
  errorTextModifier: function(text) {
 
519
  return text.replace('%d', this.curyear);
520
  },
521
  setDateRange: function(minDate, maxDate) {
@@ -553,15 +563,15 @@ Varien.dateRangeDate.prototype = Object.extend(new Varien.DateElement(), {
553
  if (isNaN(this.minDate)) {
554
  this.minDate = new Date('1/1/1900');
555
  }
556
- validate = validate && (this.fullDate >= this.minDate)
557
  }
558
  if (this.maxDate) {
559
- this.maxDate = new Date(this.maxDate)
560
  this.minDate.setHours(0);
561
  if (isNaN(this.maxDate)) {
562
  this.maxDate = new Date();
563
  }
564
- validate = validate && (this.fullDate <= this.maxDate)
565
  }
566
  if (this.maxDate && this.minDate) {
567
  this.validateDataErrorText = 'Please enter a valid date between %s and %s';
@@ -613,12 +623,12 @@ function truncateOptions() {
613
  $$('.truncated').each(function(element){
614
  Event.observe(element, 'mouseover', function(){
615
  if (element.down('div.truncated_full_value')) {
616
- element.down('div.truncated_full_value').addClassName('show')
617
  }
618
  });
619
  Event.observe(element, 'mouseout', function(){
620
  if (element.down('div.truncated_full_value')) {
621
- element.down('div.truncated_full_value').removeClassName('show')
622
  }
623
  });
624
 
@@ -633,7 +643,7 @@ Element.addMethods({
633
  {
634
  element = $(element);
635
  if(element.innerText && !Prototype.Browser.Opera) {
636
- return element.innerText
637
  }
638
  return element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g, ' ').strip();
639
  }
@@ -668,7 +678,7 @@ function fireEvent(element, event) {
668
  } else {
669
  // dispatch for IE before version 9
670
  var evt = document.createEventObject();
671
- return element.fireEvent('on' + event, evt)
672
  }
673
  }
674
 
28
  }
29
 
30
  function setLocation(url){
31
+ window.location.href = encodeURI(url);
32
  }
33
 
34
  function setPLocation(url, setFocus){
35
  if( setFocus ) {
36
  window.opener.focus();
37
  }
38
+ window.opener.location.href = encodeURI(url);
39
  }
40
 
41
+ /**
42
+ * @deprecated
43
+ */
44
  function setLanguageCode(code, fromCode){
45
  //TODO: javascript cookies have different domain and path than php cookies
46
  var href = window.location.href;
176
  function decorateList(list, nonRecursive) {
177
  if ($(list)) {
178
  if (typeof(nonRecursive) == 'undefined') {
179
+ var items = $(list).select('li');
180
  }
181
  else {
182
  var items = $(list).childElements();
254
  * when Math.abs(0).toFixed() executed on "0" number.
255
  * Result is "0.-0" :(
256
  */
257
+ var r = (j ? i.substr(0, j) + groupSymbol : "") + i.substr(j).replace(re, "$1" + groupSymbol) + (precision ? decimalSymbol + Math.abs(price - i).toFixed(precision).replace(/-/, 0).slice(2) : "");
258
  var pattern = '';
259
  if (format.pattern.indexOf('{sign}') == -1) {
260
  pattern = s + format.pattern;
267
 
268
  function expandDetails(el, childClass) {
269
  if (Element.hasClassName(el,'show-details')) {
270
+ $$(childClass).each(function(item){
271
+ item.hide();
272
+ });
273
  Element.removeClassName(el,'show-details');
274
  }
275
  else {
276
+ $$(childClass).each(function(item){
277
+ item.show();
278
+ });
279
  Element.addClassName(el,'show-details');
280
  }
281
  }
289
  Varien.showLoading = function(){
290
  var loader = $('loading-process');
291
  loader && loader.show();
292
+ };
293
  Varien.hideLoading = function(){
294
  var loader = $('loading-process');
295
  loader && loader.hide();
296
+ };
297
  Varien.GlobalHandlers = {
298
  onCreate: function() {
299
  Varien.showLoading();
376
  }
377
  this.form.submit();
378
  }
379
+ };
380
 
381
  Varien.Tabs = Class.create();
382
  Varien.Tabs.prototype = {
406
  }
407
  });
408
  }
409
+ };
410
 
411
  Varien.DateElement = Class.create();
412
  Varien.DateElement.prototype = {
443
  this.year.setAttribute('autocomplete','off');
444
 
445
  this.advice.hide();
446
+
447
+ var date = new Date;
448
+ this.curyear = date.getFullYear();
449
  },
450
  validate: function() {
451
  var error = false,
462
  this.full.value = '';
463
  }
464
  } else if (!day || !month || !year) {
465
+ error = 'Please enter a valid full date';
466
  } else {
467
  var date = new Date, countDaysInMonth = 0, errorType = null;
468
  date.setYear(year);date.setMonth(month-1);date.setDate(32);
469
  countDaysInMonth = 32 - date.getDate();
470
  if(!countDaysInMonth || countDaysInMonth>31) countDaysInMonth = 31;
471
+ if(year < 1900) error = this.errorTextModifier(this.validateDataErrorText);
472
 
473
  if (day<1 || day>countDaysInMonth) {
474
  errorType = 'day';
520
  },
521
  validateData: function() {
522
  var year = this.fullDate.getFullYear();
 
 
523
  return (year>=1900 && year<=this.curyear);
524
  },
525
  validateDataErrorType: 'year',
526
  validateDataErrorText: 'Please enter a valid year (1900-%d).',
527
  errorTextModifier: function(text) {
528
+ text = Translator.translate(text);
529
  return text.replace('%d', this.curyear);
530
  },
531
  setDateRange: function(minDate, maxDate) {
563
  if (isNaN(this.minDate)) {
564
  this.minDate = new Date('1/1/1900');
565
  }
566
+ validate = validate && (this.fullDate >= this.minDate);
567
  }
568
  if (this.maxDate) {
569
+ this.maxDate = new Date(this.maxDate);
570
  this.minDate.setHours(0);
571
  if (isNaN(this.maxDate)) {
572
  this.maxDate = new Date();
573
  }
574
+ validate = validate && (this.fullDate <= this.maxDate);
575
  }
576
  if (this.maxDate && this.minDate) {
577
  this.validateDataErrorText = 'Please enter a valid date between %s and %s';
623
  $$('.truncated').each(function(element){
624
  Event.observe(element, 'mouseover', function(){
625
  if (element.down('div.truncated_full_value')) {
626
+ element.down('div.truncated_full_value').addClassName('show');
627
  }
628
  });
629
  Event.observe(element, 'mouseout', function(){
630
  if (element.down('div.truncated_full_value')) {
631
+ element.down('div.truncated_full_value').removeClassName('show');
632
  }
633
  });
634
 
643
  {
644
  element = $(element);
645
  if(element.innerText && !Prototype.Browser.Opera) {
646
+ return element.innerText;
647
  }
648
  return element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g, ' ').strip();
649
  }
678
  } else {
679
  // dispatch for IE before version 9
680
  var evt = document.createEventObject();
681
+ return element.fireEvent('on' + event, evt);
682
  }
683
  }
684
 
js/varien/payment.js CHANGED
@@ -65,4 +65,4 @@ paymentForm.prototype = {
65
  this.currentMethod = method;
66
  }
67
  }
68
- }
65
  this.currentMethod = method;
66
  }
67
  }
68
+ };
js/varien/product.js CHANGED
@@ -240,7 +240,7 @@ Product.Zoom.prototype = {
240
 
241
  return [x,y];
242
  }
243
- }
244
 
245
  /**************************** CONFIGURABLE PRODUCT **************************/
246
  Product.Config = Class.create();
@@ -254,7 +254,7 @@ Product.Config.prototype = {
254
  this.prices = config.prices;
255
 
256
  this.settings.each(function(element){
257
- Event.observe(element, 'change', this.configure.bind(this))
258
  }.bind(this));
259
 
260
  // fill state
@@ -265,7 +265,7 @@ Product.Config.prototype = {
265
  element.attributeId = attributeId;
266
  this.state[attributeId] = false;
267
  }
268
- }.bind(this))
269
 
270
  // Init settings dropdown
271
  var childSettings = [];
@@ -273,7 +273,7 @@ Product.Config.prototype = {
273
  var prevSetting = this.settings[i-1] ? this.settings[i-1] : false;
274
  var nextSetting = this.settings[i+1] ? this.settings[i+1] : false;
275
  if(i==0){
276
- this.fillSelect(this.settings[i])
277
  }
278
  else {
279
  this.settings[i].disabled=true;
@@ -340,7 +340,7 @@ Product.Config.prototype = {
340
  reloadOptionLabels: function(element){
341
  var selectedPrice;
342
  if(element.options[element.selectedIndex].config){
343
- selectedPrice = parseFloat(element.options[element.selectedIndex].config.price)
344
  }
345
  else{
346
  selectedPrice = 0;
@@ -509,7 +509,7 @@ Product.Config.prototype = {
509
 
510
  }
511
  }
512
- }
513
 
514
 
515
  /**************************** SUPER PRODUCTS ********************************/
@@ -548,263 +548,4 @@ Product.Super.Configurable.prototype = {
548
  });
549
  }
550
  }
551
- }
552
-
553
- /**************************** PRICE RELOADER ********************************/
554
- Product.OptionsPrice = Class.create();
555
- Product.OptionsPrice.prototype = {
556
- initialize: function(config) {
557
- this.productId = config.productId;
558
- this.priceFormat = config.priceFormat;
559
- this.includeTax = config.includeTax;
560
- this.defaultTax = config.defaultTax;
561
- this.currentTax = config.currentTax;
562
- this.productPrice = config.productPrice;
563
- this.showIncludeTax = config.showIncludeTax;
564
- this.showBothPrices = config.showBothPrices;
565
- this.productOldPrice = config.productOldPrice;
566
- this.priceInclTax = config.priceInclTax;
567
- this.priceExclTax = config.priceExclTax;
568
- this.skipCalculate = config.skipCalculate; /** @deprecated after 1.5.1.0 */
569
- this.duplicateIdSuffix = config.idSuffix;
570
- this.specialTaxPrice = config.specialTaxPrice;
571
- this.tierPrices = config.tierPrices;
572
- this.tierPricesInclTax = config.tierPricesInclTax;
573
-
574
- this.oldPlusDisposition = config.oldPlusDisposition;
575
- this.plusDisposition = config.plusDisposition;
576
- this.plusDispositionTax = config.plusDispositionTax;
577
-
578
- this.oldMinusDisposition = config.oldMinusDisposition;
579
- this.minusDisposition = config.minusDisposition;
580
-
581
- this.exclDisposition = config.exclDisposition;
582
-
583
- this.optionPrices = {};
584
- this.customPrices = {};
585
- this.containers = {};
586
-
587
- this.displayZeroPrice = true;
588
-
589
- this.initPrices();
590
- },
591
-
592
- setDuplicateIdSuffix: function(idSuffix) {
593
- this.duplicateIdSuffix = idSuffix;
594
- },
595
-
596
- initPrices: function() {
597
- this.containers[0] = 'product-price-' + this.productId;
598
- this.containers[1] = 'bundle-price-' + this.productId;
599
- this.containers[2] = 'price-including-tax-' + this.productId;
600
- this.containers[3] = 'price-excluding-tax-' + this.productId;
601
- this.containers[4] = 'old-price-' + this.productId;
602
- },
603
-
604
- changePrice: function(key, price) {
605
- this.optionPrices[key] = price;
606
- },
607
-
608
- addCustomPrices: function(key, price) {
609
- this.customPrices[key] = price;
610
- },
611
- getOptionPrices: function() {
612
- var price = 0;
613
- var nonTaxable = 0;
614
- var oldPrice = 0;
615
- var priceInclTax = 0;
616
- var currentTax = this.currentTax;
617
- $H(this.optionPrices).each(function(pair) {
618
- if ('undefined' != typeof(pair.value.price) && 'undefined' != typeof(pair.value.oldPrice)) {
619
- price += parseFloat(pair.value.price);
620
- oldPrice += parseFloat(pair.value.oldPrice);
621
- } else if (pair.key == 'nontaxable') {
622
- nonTaxable = pair.value;
623
- } else if (pair.key == 'priceInclTax') {
624
- priceInclTax += pair.value;
625
- } else if (pair.key == 'optionsPriceInclTax') {
626
- priceInclTax += pair.value * (100 + currentTax) / 100;
627
- } else {
628
- price += parseFloat(pair.value);
629
- oldPrice += parseFloat(pair.value);
630
- }
631
- });
632
- var result = [price, nonTaxable, oldPrice, priceInclTax];
633
- return result;
634
- },
635
-
636
- reload: function() {
637
- var price;
638
- var formattedPrice;
639
- var optionPrices = this.getOptionPrices();
640
- var nonTaxable = optionPrices[1];
641
- var optionOldPrice = optionPrices[2];
642
- var priceInclTax = optionPrices[3];
643
- optionPrices = optionPrices[0];
644
-
645
- $H(this.containers).each(function(pair) {
646
- var _productPrice;
647
- var _plusDisposition;
648
- var _minusDisposition;
649
- var _priceInclTax;
650
- if ($(pair.value)) {
651
- if (pair.value == 'old-price-'+this.productId && this.productOldPrice != this.productPrice) {
652
- _productPrice = this.productOldPrice;
653
- _plusDisposition = this.oldPlusDisposition;
654
- _minusDisposition = this.oldMinusDisposition;
655
- } else {
656
- _productPrice = this.productPrice;
657
- _plusDisposition = this.plusDisposition;
658
- _minusDisposition = this.minusDisposition;
659
- }
660
- _priceInclTax = priceInclTax;
661
-
662
- if (pair.value == 'old-price-'+this.productId && optionOldPrice !== undefined) {
663
- price = optionOldPrice+parseFloat(_productPrice);
664
- } else if (this.specialTaxPrice == 'true' && this.priceInclTax !== undefined && this.priceExclTax !== undefined) {
665
- price = optionPrices+parseFloat(this.priceExclTax);
666
- _priceInclTax += this.priceInclTax;
667
- } else {
668
- price = optionPrices+parseFloat(_productPrice);
669
- _priceInclTax += parseFloat(_productPrice) * (100 + this.currentTax) / 100;
670
- }
671
-
672
- if (this.specialTaxPrice == 'true') {
673
- var excl = price;
674
- var incl = _priceInclTax;
675
- } else if (this.includeTax == 'true') {
676
- // tax = tax included into product price by admin
677
- var tax = price / (100 + this.defaultTax) * this.defaultTax;
678
- var excl = price - tax;
679
- var incl = excl*(1+(this.currentTax/100));
680
- } else {
681
- var tax = price * (this.currentTax / 100);
682
- var excl = price;
683
- var incl = excl + tax;
684
- }
685
-
686
- var subPrice = 0;
687
- var subPriceincludeTax = 0;
688
- Object.values(this.customPrices).each(function(el){
689
- if (el.excludeTax && el.includeTax) {
690
- subPrice += parseFloat(el.excludeTax);
691
- subPriceincludeTax += parseFloat(el.includeTax);
692
- } else {
693
- subPrice += parseFloat(el.price);
694
- subPriceincludeTax += parseFloat(el.price);
695
- }
696
- });
697
- excl += subPrice;
698
- incl += subPriceincludeTax;
699
-
700
- if (typeof this.exclDisposition == 'undefined') {
701
- excl += parseFloat(_plusDisposition);
702
- }
703
-
704
- incl += parseFloat(_plusDisposition) + parseFloat(this.plusDispositionTax);
705
- excl -= parseFloat(_minusDisposition);
706
- incl -= parseFloat(_minusDisposition);
707
-
708
- //adding nontaxlable part of options
709
- excl += parseFloat(nonTaxable);
710
- incl += parseFloat(nonTaxable);
711
-
712
- if (pair.value == 'price-including-tax-'+this.productId) {
713
- price = incl;
714
- } else if (pair.value == 'price-excluding-tax-'+this.productId) {
715
- price = excl;
716
- } else if (pair.value == 'old-price-'+this.productId) {
717
- if (this.showIncludeTax || this.showBothPrices) {
718
- price = incl;
719
- } else {
720
- price = excl;
721
- }
722
- } else {
723
- if (this.showIncludeTax) {
724
- price = incl;
725
- } else {
726
- price = excl;
727
- }
728
- }
729
-
730
- if (price < 0) price = 0;
731
-
732
- if (price > 0 || this.displayZeroPrice) {
733
- formattedPrice = this.formatPrice(price);
734
- } else {
735
- formattedPrice = '';
736
- }
737
-
738
- if ($(pair.value).select('.price')[0]) {
739
- $(pair.value).select('.price')[0].innerHTML = formattedPrice;
740
- if ($(pair.value+this.duplicateIdSuffix) && $(pair.value+this.duplicateIdSuffix).select('.price')[0]) {
741
- $(pair.value+this.duplicateIdSuffix).select('.price')[0].innerHTML = formattedPrice;
742
- }
743
- } else {
744
- $(pair.value).innerHTML = formattedPrice;
745
- if ($(pair.value+this.duplicateIdSuffix)) {
746
- $(pair.value+this.duplicateIdSuffix).innerHTML = formattedPrice;
747
- }
748
- }
749
- };
750
- }.bind(this));
751
-
752
- if (typeof(skipTierPricePercentUpdate) === "undefined" && typeof(this.tierPrices) !== "undefined") {
753
- for (var i = 0; i < this.tierPrices.length; i++) {
754
- $$('.benefit').each(function(el) {
755
- var parsePrice = function(html) {
756
- var format = this.priceFormat;
757
- var decimalSymbol = format.decimalSymbol === undefined ? "," : format.decimalSymbol;
758
- var regexStr = '[^0-9-' + decimalSymbol + ']';
759
- //remove all characters except number and decimal symbol
760
- html = html.replace(new RegExp(regexStr, 'g'), '');
761
- html = html.replace(decimalSymbol, '.');
762
- return parseFloat(html);
763
- }.bind(this);
764
-
765
- var updateTierPriceInfo = function(priceEl, tierPriceDiff, tierPriceEl, benefitEl) {
766
- if (typeof(tierPriceEl) === "undefined") {
767
- //tierPrice is not shown, e.g., MAP, no need to update the tier price info
768
- return;
769
- }
770
- var price = parsePrice(priceEl.innerHTML);
771
- var tierPrice = price + tierPriceDiff;
772
-
773
- tierPriceEl.innerHTML = this.formatPrice(tierPrice);
774
-
775
- var $percent = Selector.findChildElements(benefitEl, ['.percent.tier-' + i]);
776
- $percent.each(function(el) {
777
- el.innerHTML = Math.ceil(100 - ((100 / price) * tierPrice));
778
- });
779
- }.bind(this);
780
-
781
- var tierPriceElArray = $$('.tier-price.tier-' + i + ' .price');
782
- if (this.showBothPrices) {
783
- var containerExclTax = $(this.containers[3]);
784
- var tierPriceExclTaxDiff = this.tierPrices[i];
785
- var tierPriceExclTaxEl = tierPriceElArray[0];
786
- updateTierPriceInfo(containerExclTax, tierPriceExclTaxDiff, tierPriceExclTaxEl, el);
787
- var containerInclTax = $(this.containers[2]);
788
- var tierPriceInclTaxDiff = this.tierPricesInclTax[i];
789
- var tierPriceInclTaxEl = tierPriceElArray[1];
790
- updateTierPriceInfo(containerInclTax, tierPriceInclTaxDiff, tierPriceInclTaxEl, el);
791
- } else if (this.showIncludeTax) {
792
- var container = $(this.containers[0]);
793
- var tierPriceInclTaxDiff = this.tierPricesInclTax[i];
794
- var tierPriceInclTaxEl = tierPriceElArray[0];
795
- updateTierPriceInfo(container, tierPriceInclTaxDiff, tierPriceInclTaxEl, el);
796
- } else {
797
- var container = $(this.containers[0]);
798
- var tierPriceExclTaxDiff = this.tierPrices[i];
799
- var tierPriceExclTaxEl = tierPriceElArray[0];
800
- updateTierPriceInfo(container, tierPriceExclTaxDiff, tierPriceExclTaxEl, el);
801
- }
802
- }, this);
803
- }
804
- }
805
-
806
- },
807
- formatPrice: function(price) {
808
- return formatCurrency(price, this.priceFormat);
809
- }
810
- }
240
 
241
  return [x,y];
242
  }
243
+ };
244
 
245
  /**************************** CONFIGURABLE PRODUCT **************************/
246
  Product.Config = Class.create();
254
  this.prices = config.prices;
255
 
256
  this.settings.each(function(element){
257
+ Event.observe(element, 'change', this.configure.bind(this));
258
  }.bind(this));
259
 
260
  // fill state
265
  element.attributeId = attributeId;
266
  this.state[attributeId] = false;
267
  }
268
+ }.bind(this));
269
 
270
  // Init settings dropdown
271
  var childSettings = [];
273
  var prevSetting = this.settings[i-1] ? this.settings[i-1] : false;
274
  var nextSetting = this.settings[i+1] ? this.settings[i+1] : false;
275
  if(i==0){
276
+ this.fillSelect(this.settings[i]);
277
  }
278
  else {
279
  this.settings[i].disabled=true;
340
  reloadOptionLabels: function(element){
341
  var selectedPrice;
342
  if(element.options[element.selectedIndex].config){
343
+ selectedPrice = parseFloat(element.options[element.selectedIndex].config.price);
344
  }
345
  else{
346
  selectedPrice = 0;
509
 
510
  }
511
  }
512
+ };
513
 
514
 
515
  /**************************** SUPER PRODUCTS ********************************/
548
  });
549
  }
550
  }
551
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/varien/product_options.js ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magento.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magento.com for more information.
19
+ *
20
+ * @category Varien
21
+ * @package js
22
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+
26
+ var Product = Product || {};
27
+
28
+ /**************************** PRICE RELOADER ********************************/
29
+ Product.OptionsPrice = Class.create();
30
+ Product.OptionsPrice.prototype = {
31
+ initialize: function(config) {
32
+ this.productId = config.productId;
33
+ this.priceFormat = config.priceFormat;
34
+ this.includeTax = config.includeTax;
35
+ this.defaultTax = config.defaultTax;
36
+ this.currentTax = config.currentTax;
37
+ this.productPrice = config.productPrice;
38
+ this.showIncludeTax = config.showIncludeTax;
39
+ this.showBothPrices = config.showBothPrices;
40
+ this.productOldPrice = config.productOldPrice;
41
+ this.priceInclTax = config.priceInclTax;
42
+ this.priceExclTax = config.priceExclTax;
43
+ this.skipCalculate = config.skipCalculate; /** @deprecated after 1.5.1.0 */
44
+ this.duplicateIdSuffix = config.idSuffix;
45
+ this.specialTaxPrice = config.specialTaxPrice;
46
+ this.tierPrices = config.tierPrices;
47
+ this.tierPricesInclTax = config.tierPricesInclTax;
48
+
49
+ this.oldPlusDisposition = config.oldPlusDisposition;
50
+ this.plusDisposition = config.plusDisposition;
51
+ this.plusDispositionTax = config.plusDispositionTax;
52
+
53
+ this.oldMinusDisposition = config.oldMinusDisposition;
54
+ this.minusDisposition = config.minusDisposition;
55
+
56
+ this.exclDisposition = config.exclDisposition;
57
+
58
+ this.optionPrices = {};
59
+ this.customPrices = {};
60
+ this.containers = {};
61
+
62
+ this.displayZeroPrice = true;
63
+
64
+ this.initPrices();
65
+ },
66
+
67
+ setDuplicateIdSuffix: function(idSuffix) {
68
+ this.duplicateIdSuffix = idSuffix;
69
+ },
70
+
71
+ initPrices: function() {
72
+ this.containers[0] = 'product-price-' + this.productId;
73
+ this.containers[1] = 'bundle-price-' + this.productId;
74
+ this.containers[2] = 'price-including-tax-' + this.productId;
75
+ this.containers[3] = 'price-excluding-tax-' + this.productId;
76
+ this.containers[4] = 'old-price-' + this.productId;
77
+ },
78
+
79
+ changePrice: function(key, price) {
80
+ this.optionPrices[key] = price;
81
+ },
82
+
83
+ addCustomPrices: function(key, price) {
84
+ this.customPrices[key] = price;
85
+ },
86
+ getOptionPrices: function() {
87
+ var price = 0;
88
+ var nonTaxable = 0;
89
+ var oldPrice = 0;
90
+ var priceInclTax = 0;
91
+ var currentTax = this.currentTax;
92
+ $H(this.optionPrices).each(function(pair) {
93
+ if ('undefined' != typeof(pair.value.price) && 'undefined' != typeof(pair.value.oldPrice)) {
94
+ price += parseFloat(pair.value.price);
95
+ oldPrice += parseFloat(pair.value.oldPrice);
96
+ } else if (pair.key == 'nontaxable') {
97
+ nonTaxable = pair.value;
98
+ } else if (pair.key == 'priceInclTax') {
99
+ priceInclTax += pair.value;
100
+ } else if (pair.key == 'optionsPriceInclTax') {
101
+ priceInclTax += pair.value * (100 + currentTax) / 100;
102
+ } else {
103
+ price += parseFloat(pair.value);
104
+ oldPrice += parseFloat(pair.value);
105
+ }
106
+ });
107
+ return [price, nonTaxable, oldPrice, priceInclTax];
108
+ },
109
+
110
+ reload: function() {
111
+ var price;
112
+ var formattedPrice;
113
+ var optionPrices = this.getOptionPrices();
114
+ var nonTaxable = optionPrices[1];
115
+ var optionOldPrice = optionPrices[2];
116
+ var priceInclTax = optionPrices[3];
117
+ optionPrices = optionPrices[0];
118
+
119
+ $H(this.containers).each(function(pair) {
120
+ var _productPrice;
121
+ var _plusDisposition;
122
+ var _minusDisposition;
123
+ var _priceInclTax;
124
+ var excl;
125
+ var incl;
126
+ var tax;
127
+ if ($(pair.value)) {
128
+ if (pair.value == 'old-price-'+this.productId && this.productOldPrice != this.productPrice) {
129
+ _productPrice = this.productOldPrice;
130
+ _plusDisposition = this.oldPlusDisposition;
131
+ _minusDisposition = this.oldMinusDisposition;
132
+ } else {
133
+ _productPrice = this.productPrice;
134
+ _plusDisposition = this.plusDisposition;
135
+ _minusDisposition = this.minusDisposition;
136
+ }
137
+ _priceInclTax = priceInclTax;
138
+
139
+ if (pair.value == 'old-price-'+this.productId && optionOldPrice !== undefined) {
140
+ price = optionOldPrice+parseFloat(_productPrice);
141
+ } else if (this.specialTaxPrice == 'true' && this.priceInclTax !== undefined && this.priceExclTax !== undefined) {
142
+ price = optionPrices+parseFloat(this.priceExclTax);
143
+ _priceInclTax += this.priceInclTax;
144
+ } else {
145
+ price = optionPrices+parseFloat(_productPrice);
146
+ _priceInclTax += parseFloat(_productPrice) * (100 + this.currentTax) / 100;
147
+ }
148
+
149
+ if (this.specialTaxPrice == 'true') {
150
+ excl = price;
151
+ incl = _priceInclTax;
152
+ } else if (this.includeTax == 'true') {
153
+ // tax = tax included into product price by admin
154
+ tax = price / (100 + this.defaultTax) * this.defaultTax;
155
+ excl = price - tax;
156
+ incl = excl*(1+(this.currentTax/100));
157
+ } else {
158
+ tax = price * (this.currentTax / 100);
159
+ excl = price;
160
+ incl = excl + tax;
161
+ }
162
+
163
+ var subPrice = 0;
164
+ var subPriceincludeTax = 0;
165
+ Object.values(this.customPrices).each(function(el){
166
+ if (el.excludeTax && el.includeTax) {
167
+ subPrice += parseFloat(el.excludeTax);
168
+ subPriceincludeTax += parseFloat(el.includeTax);
169
+ } else {
170
+ subPrice += parseFloat(el.price);
171
+ subPriceincludeTax += parseFloat(el.price);
172
+ }
173
+ });
174
+ excl += subPrice;
175
+ incl += subPriceincludeTax;
176
+
177
+ if (typeof this.exclDisposition == 'undefined') {
178
+ excl += parseFloat(_plusDisposition);
179
+ }
180
+
181
+ incl += parseFloat(_plusDisposition) + parseFloat(this.plusDispositionTax);
182
+ excl -= parseFloat(_minusDisposition);
183
+ incl -= parseFloat(_minusDisposition);
184
+
185
+ //adding nontaxlable part of options
186
+ excl += parseFloat(nonTaxable);
187
+ incl += parseFloat(nonTaxable);
188
+
189
+ if (pair.value == 'price-including-tax-'+this.productId) {
190
+ price = incl;
191
+ } else if (pair.value == 'price-excluding-tax-'+this.productId) {
192
+ price = excl;
193
+ } else if (pair.value == 'old-price-'+this.productId) {
194
+ if (this.showIncludeTax || this.showBothPrices) {
195
+ price = incl;
196
+ } else {
197
+ price = excl;
198
+ }
199
+ } else {
200
+ if (this.showIncludeTax) {
201
+ price = incl;
202
+ } else {
203
+ price = excl;
204
+ }
205
+ }
206
+
207
+ if (price < 0) price = 0;
208
+
209
+ if (price > 0 || this.displayZeroPrice) {
210
+ formattedPrice = this.formatPrice(price);
211
+ } else {
212
+ formattedPrice = '';
213
+ }
214
+
215
+ if ($(pair.value).select('.price')[0]) {
216
+ $(pair.value).select('.price')[0].innerHTML = formattedPrice;
217
+ if ($(pair.value+this.duplicateIdSuffix) && $(pair.value+this.duplicateIdSuffix).select('.price')[0]) {
218
+ $(pair.value+this.duplicateIdSuffix).select('.price')[0].innerHTML = formattedPrice;
219
+ }
220
+ } else {
221
+ $(pair.value).innerHTML = formattedPrice;
222
+ if ($(pair.value+this.duplicateIdSuffix)) {
223
+ $(pair.value+this.duplicateIdSuffix).innerHTML = formattedPrice;
224
+ }
225
+ }
226
+ };
227
+ }.bind(this));
228
+
229
+ if (typeof(skipTierPricePercentUpdate) === "undefined" && typeof(this.tierPrices) !== "undefined") {
230
+ for (var i = 0; i < this.tierPrices.length; i++) {
231
+ $$('.benefit').each(function(el) {
232
+ var parsePrice = function(html) {
233
+ var format = this.priceFormat;
234
+ var decimalSymbol = format.decimalSymbol === undefined ? "," : format.decimalSymbol;
235
+ var regexStr = '[^0-9-' + decimalSymbol + ']';
236
+ //remove all characters except number and decimal symbol
237
+ html = html.replace(new RegExp(regexStr, 'g'), '');
238
+ html = html.replace(decimalSymbol, '.');
239
+ return parseFloat(html);
240
+ }.bind(this);
241
+
242
+ var updateTierPriceInfo = function(priceEl, tierPriceDiff, tierPriceEl, benefitEl) {
243
+ if (typeof(tierPriceEl) === "undefined") {
244
+ //tierPrice is not shown, e.g., MAP, no need to update the tier price info
245
+ return;
246
+ }
247
+ var price = parsePrice(priceEl.innerHTML);
248
+ var tierPrice = price + tierPriceDiff;
249
+
250
+ tierPriceEl.innerHTML = this.formatPrice(tierPrice);
251
+
252
+ var $percent = Selector.findChildElements(benefitEl, ['.percent.tier-' + i]);
253
+ $percent.each(function(el) {
254
+ el.innerHTML = Math.ceil(100 - ((100 / price) * tierPrice));
255
+ });
256
+ }.bind(this);
257
+
258
+ var tierPriceElArray = $$('.tier-price.tier-' + i + ' .price');
259
+ if (this.showBothPrices) {
260
+ var containerExclTax = $(this.containers[3]);
261
+ var tierPriceExclTaxDiff = this.tierPrices[i];
262
+ var tierPriceExclTaxEl = tierPriceElArray[0];
263
+ updateTierPriceInfo(containerExclTax, tierPriceExclTaxDiff, tierPriceExclTaxEl, el);
264
+ var containerInclTax = $(this.containers[2]);
265
+ var tierPriceInclTaxDiff = this.tierPricesInclTax[i];
266
+ var tierPriceInclTaxEl = tierPriceElArray[1];
267
+ updateTierPriceInfo(containerInclTax, tierPriceInclTaxDiff, tierPriceInclTaxEl, el);
268
+ } else if (this.showIncludeTax) {
269
+ var container = $(this.containers[0]);
270
+ var tierPriceInclTaxDiff = this.tierPricesInclTax[i];
271
+ var tierPriceInclTaxEl = tierPriceElArray[0];
272
+ updateTierPriceInfo(container, tierPriceInclTaxDiff, tierPriceInclTaxEl, el);
273
+ } else {
274
+ var container = $(this.containers[0]);
275
+ var tierPriceExclTaxDiff = this.tierPrices[i];
276
+ var tierPriceExclTaxEl = tierPriceElArray[0];
277
+ updateTierPriceInfo(container, tierPriceExclTaxDiff, tierPriceExclTaxEl, el);
278
+ }
279
+ }, this);
280
+ }
281
+ }
282
+
283
+ },
284
+ formatPrice: function(price) {
285
+ return formatCurrency(price, this.priceFormat);
286
+ }
287
+ };
js/varien/telephone.js CHANGED
@@ -128,4 +128,4 @@ telephoneElem.prototype = {
128
  }
129
  }
130
  }
131
- }
128
  }
129
  }
130
  }
131
+ };
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lib_Js_Mage</name>
4
- <version>1.9.2.4</version>
5
  <stability>stable</stability>
6
  <license>Mixed</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Javascript Libraries for Magento</summary>
10
  <description>Javascript Libraries for Magento</description>
11
- <notes>1.9.2.4</notes>
12
  <authors><author><name>Magento Core Team</name><user>core</user><email>core@magentocommerce.com</email></author></authors>
13
- <date>2016-02-17</date>
14
- <time>18:27:28</time>
15
- <contents><target name="mageweb"><dir name="js"><dir name="lib"><file name="FABridge.js" hash="64244d8d58abd42bd71f0ee3309767ad"/><file name="boxover.js" hash="a5ade77452e8d5066cb84dcac3d34ed5"/><file name="ccard.js" hash="d3e849be0977d53de4af933b40293ff6"/><file name="dropdown.js" hash="3fde17b96923bfdc306bef7543dbfea3"/><file name="ds-sleight.js" hash="85af457d444865d1587bfe4875bd4fc6"/><file name="flex.js" hash="75e89a07d2aa6d4e7cd8bb1f1d438666"/><dir name="jquery"><file name="jquery-1.10.2.js" hash="91515770ce8c55de23b306444d8ea998"/><file name="jquery-1.10.2.min.js" hash="841dc30647f93349b7d8ef61deebe411"/><file name="jquery-1.10.2.min.map" hash="6c3ccfc221d36777d383b6e04d0b8af9"/><file name="noconflict.js" hash="12f820da0f5ba19abfb4f5fc270bb62c"/></dir></dir><dir name="mage"><dir name="adminhtml"><file name="accordion.js" hash="d0bb673a55a159e0f3eb8b21e21fe11a"/><file name="backup.js" hash="f0684a308406d700e6a08eee7326558f"/><file name="browser.js" hash="58317c3027ce227163b9d2b18100d45e"/><file name="events.js" hash="a99453aa38fc6ab1526866af2377b7fd"/><file name="flexuploader.js" hash="49ecd836a99c5b5d675dba20e78cf5f7"/><file name="form.js" hash="22e6a4ecac1e0ef7a5e82abcf385be02"/><file name="giftmessage.js" hash="fdf70df1b70edf307cd0eace57400c2b"/><dir name="giftoptions"><file name="tooltip.js" hash="b0d92d62c38bd51f637581bed1589639"/></dir><file name="grid.js" hash="f4851889a57de7eae94a8e39098f33ce"/><file name="hash.js" hash="0c0010249185c483632126de3bd4fe0a"/><file name="image.js" hash="19fb234bbec57ea7411d9b5c6c76e9b6"/><file name="loader.js" hash="36e96b5613937bf18b8c02abc11d41e7"/><file name="magento-all.js" hash="42ad823ed9988e006c1fa50c6e6fae49"/><dir name="product"><dir name="composite"><file name="configure.js" hash="c2443b6858ccca880e6db95f9888533b"/></dir></dir><file name="product.js" hash="86f98b0f73c377f9f2c35fef82735d10"/><file name="rules.js" hash="2d67c485bede1f299da8695fda84f5d7"/><dir name="sales"><file name="packaging.js" hash="fa4034c74dcb91a6ddcdf6ed1c0c0107"/></dir><file name="sales.js" hash="2adfdc52c344f286283a7ca488ccfcab"/><file name="scrollbar.js" hash="36fe65990d512f79ab1780ac947e1a12"/><file name="tabs.js" hash="5c89c4689930939031c0e340bd3db54f"/><file name="tools.js" hash="cfabd8161e57b1d8b72f9cc436fc9d13"/><file name="uploader.js" hash="8337a066f08680c1f5fc0a197fc09c15"/><file name="variables.js" hash="13c9221601f60facbd9706f3cbc22b7f"/><dir name="wysiwyg"><dir name="tiny_mce"><dir name="plugins"><dir name="magentovariable"><file name="editor_plugin.js" hash="80ba1f07c63ae478086f504faf61218d"/><dir name="img"><file name="icon.gif" hash="682b29a0e734f952cb2edabede6a25d1"/></dir></dir><dir name="magentowidget"><file name="editor_plugin.js" hash="2be4a89460ff89411a69216d6632bb7a"/><dir name="img"><file name="icon.gif" hash="532c141286373f098f1f4362e001c7f8"/></dir></dir></dir><file name="setup.js" hash="d115ae6397d8f166b0fc95d759bea8f0"/><dir name="themes"><dir name="advanced"><dir name="skins"><dir name="default"><file name="content.css" hash="2c737298d2829301f4ed2af3e6d77cb3"/><file name="dialog.css" hash="b516ed4d95b4b3aecad5908c592d0c6a"/></dir></dir></dir></dir></dir><file name="widget.js" hash="060179a58cf181ae2d5d308c8caeefe5"/></dir></dir><file name="captcha.js" hash="eb7f438a871ab6e49e623f8ce6b7e65b"/><file name="centinel.js" hash="7f8c15d42bdab489bae63c9de7530cda"/><file name="cookies.js" hash="5baf73666a850c5d24b6382886dab51d"/><file name="directpost.js" hash="aeb5c642ec91e3dd776b534348ed5240"/><file name="translate.js" hash="2197adb378ed88d3c825ca86f906ec45"/><file name="translate_inline.css" hash="b04b581fd93c8ec742e7ceabcb11e16c"/><file name="translate_inline.js" hash="0bdd045f29a73a8f2b8521ac16c53708"/></dir><dir name="varien"><file name="accordion.js" hash="0af1b449b1c83bc8c331fea0a4868f7b"/><file name="configurable.js" hash="01a0ba2f50ece7fa8c6855e1f87c4a55"/><file name="form.js" hash="190598d16f1e2eddcdb4e31cb56f3c22"/><file name="iehover-fix.js" hash="c65c37de4c823b6413fc4a030630ad46"/><file name="js.js" hash="3912117c67c4c1996f2cd480767576d2"/><file name="menu.js" hash="22fa11c750637f9e4080341e09285e72"/><file name="payment.js" hash="4d6435559237a1812b5b64aaef1ac7e9"/><file name="product.js" hash="efa0e6c4cfe79590a7bc04e47a1da52f"/><file name="telephone.js" hash="23c36bb5ebc164bc8b993e7da7478ac0"/><file name="weee.js" hash="7e21ec88cbd8e5c0a1b837e441f7ee63"/></dir><file name="blank.html" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="index.php" hash="895f2b91bcca2dab72b1d52877892d70"/><file name="spacer.gif" hash="df3e567d6f16d040326c7a0ea29a4f41"/><dir name="flash"><file name="AC_RunActiveContent.js" hash="3e038cea960c1b650442b85cea237053"/></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Lib_Js_Prototype</name><channel>community</channel><min>1.9.2.4</min><max>1.9.2.4</max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lib_Js_Mage</name>
4
+ <version>1.9.3.0</version>
5
  <stability>stable</stability>
6
  <license>Mixed</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Javascript Libraries for Magento</summary>
10
  <description>Javascript Libraries for Magento</description>
11
+ <notes>1.9.3.0</notes>
12
  <authors><author><name>Magento Core Team</name><user>core</user><email>core@magentocommerce.com</email></author></authors>
13
+ <date>2016-10-04</date>
14
+ <time>13:04:29</time>
15
+ <contents><target name="mageweb"><dir name="js"><dir name="lib"><file name="FABridge.js" hash="64244d8d58abd42bd71f0ee3309767ad"/><file name="boxover.js" hash="a5ade77452e8d5066cb84dcac3d34ed5"/><file name="ccard.js" hash="d3e849be0977d53de4af933b40293ff6"/><file name="dropdown.js" hash="3fde17b96923bfdc306bef7543dbfea3"/><file name="ds-sleight.js" hash="85af457d444865d1587bfe4875bd4fc6"/><file name="flex.js" hash="75e89a07d2aa6d4e7cd8bb1f1d438666"/><dir name="jquery"><file name="jquery-1.10.2.js" hash="91515770ce8c55de23b306444d8ea998"/><file name="jquery-1.10.2.min.js" hash="841dc30647f93349b7d8ef61deebe411"/><file name="jquery-1.10.2.min.map" hash="6c3ccfc221d36777d383b6e04d0b8af9"/><file name="noconflict.js" hash="12f820da0f5ba19abfb4f5fc270bb62c"/></dir><dir name="uploader"><file name="flow.min.js" hash="a82a557db407b53d5909fa4e1833a596"/><file name="fusty-flow-factory.js" hash="b3f49be0f28be74e8b8bb76496c52bc3"/><file name="fusty-flow.js" hash="302f440908837093fd4e9b6e76ec01e0"/></dir></dir><dir name="mage"><dir name="adminhtml"><file name="accordion.js" hash="c69fb4275ddd2a0baf7be854cb0b188b"/><file name="backup.js" hash="9538a8fd84c0a65696cba9487d651caa"/><file name="browser.js" hash="c68ad401b06a251ff234d866a378730a"/><file name="events.js" hash="9ec42a72a1946dcec30e5d73111e3f9d"/><file name="flexuploader.js" hash="5478ea9437e07b87687f4cd3c06f3d74"/><file name="form.js" hash="798896e67e23a49ab20816a511297b19"/><file name="giftmessage.js" hash="7e9321a76824a6a516ce4ddc064b05fb"/><dir name="giftoptions"><file name="tooltip.js" hash="42e079edb7bceb6aebe3752dcb370bc2"/></dir><file name="grid.js" hash="993d4f14f6ab979c90e9d261a0414a1b"/><file name="hash.js" hash="0c0010249185c483632126de3bd4fe0a"/><file name="image.js" hash="0a6884666b87b90d098b9a49ad61fd37"/><file name="loader.js" hash="95b9827f8397355e9dab952493603d53"/><file name="magento-all.js" hash="42ad823ed9988e006c1fa50c6e6fae49"/><dir name="product"><dir name="composite"><file name="configure.js" hash="2df7c2efc9dc56d62df4daadad7c3ebc"/></dir></dir><file name="product.js" hash="815c0eba8537afe9ee7841a44aca231b"/><file name="rules.js" hash="11cc661646db09a9d42627df4e1c3b2b"/><dir name="sales"><file name="packaging.js" hash="def1d23d123afe6f488ad9941dbedea6"/></dir><file name="sales.js" hash="720409ee3dec64a678117c488f6b3f47"/><file name="scrollbar.js" hash="78cdcbc2f75ea31209baf10eb877395b"/><file name="tabs.js" hash="a39e63c9dfcc2a112e9933ff2ae2e334"/><file name="tools.js" hash="f35f0a11505bea4570acdd7b288aee13"/><dir name="uploader"><file name="instance.js" hash="cd80adb50e15f551ca4a6a6f9ff017de"/></dir><file name="uploader.js" hash="8337a066f08680c1f5fc0a197fc09c15"/><file name="variables.js" hash="13c9221601f60facbd9706f3cbc22b7f"/><dir name="wysiwyg"><dir name="tiny_mce"><dir name="plugins"><dir name="magentovariable"><file name="editor_plugin.js" hash="80ba1f07c63ae478086f504faf61218d"/><dir name="img"><file name="icon.gif" hash="682b29a0e734f952cb2edabede6a25d1"/></dir></dir><dir name="magentowidget"><file name="editor_plugin.js" hash="2be4a89460ff89411a69216d6632bb7a"/><dir name="img"><file name="icon.gif" hash="532c141286373f098f1f4362e001c7f8"/></dir></dir></dir><file name="setup.js" hash="3b59ed7ab4547616dded944e042b38df"/><dir name="themes"><dir name="advanced"><dir name="skins"><dir name="default"><file name="content.css" hash="2c737298d2829301f4ed2af3e6d77cb3"/><file name="dialog.css" hash="b516ed4d95b4b3aecad5908c592d0c6a"/></dir></dir></dir></dir></dir><file name="widget.js" hash="4c62506df1598495a70a01cd129673db"/></dir></dir><file name="captcha.js" hash="a4da9fb2f7380186f2dbe01332932074"/><file name="centinel.js" hash="7f8c15d42bdab489bae63c9de7530cda"/><file name="cookies.js" hash="5baf73666a850c5d24b6382886dab51d"/><file name="directpost.js" hash="65ec1550f5c434de2fe50c63e410f011"/><file name="translate.js" hash="03c6b2fa8ea4a93a44a5d816d82f60fa"/><file name="translate_inline.css" hash="b04b581fd93c8ec742e7ceabcb11e16c"/><file name="translate_inline.js" hash="c17cd411d63c15a39a06c441a6e62c58"/></dir><dir name="varien"><file name="accordion.js" hash="560046730d15cd2c94c244c73219d3d9"/><file name="configurable.js" hash="726fe3740e0d3d8c37e045f4a407314c"/><file name="form.js" hash="d03d8a462aaecdca691a8da8ee36b39c"/><file name="iehover-fix.js" hash="c6682047fb7f9a1aef62c0848e659a36"/><file name="js.js" hash="421820a5f54384a623bef95993de27f0"/><file name="menu.js" hash="22fa11c750637f9e4080341e09285e72"/><file name="payment.js" hash="ca41bc3307d9006c53c1a6ccf0286eff"/><file name="product.js" hash="179eefbcd233a545ce0d0072f6772caf"/><file name="product_options.js" hash="0edf40c29f7a3552546ded647b74bef1"/><file name="telephone.js" hash="b0d10c172373c4308968717b302f0da8"/><file name="weee.js" hash="7e21ec88cbd8e5c0a1b837e441f7ee63"/></dir><file name="blank.html" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="index.php" hash="895f2b91bcca2dab72b1d52877892d70"/><file name="spacer.gif" hash="df3e567d6f16d040326c7a0ea29a4f41"/><dir name="flash"><file name="AC_RunActiveContent.js" hash="3e038cea960c1b650442b85cea237053"/></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Lib_Js_Prototype</name><channel>community</channel><min>1.9.3.0</min><max>1.9.3.0</max></package></required></dependencies>
18
  </package>