Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
Conflicts: admin-dev/themes/default/css/admin-theme.css
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -116,12 +116,10 @@ input[type="text"],input[type="search"],input[type="password"], textarea, select
|
||||
.panel-footer
|
||||
margin: 15px -20px -20px
|
||||
height: 73px
|
||||
.panel-footer
|
||||
.btn.pull-right
|
||||
margin-left: 3px
|
||||
|
||||
//todo: fix focus firefox
|
||||
*:focus
|
||||
outline: none!important
|
||||
-moz-outline: none!important
|
||||
-moz-user-focus: ignore!important
|
||||
|
||||
//components
|
||||
@import "admin-theme/admin-header"
|
||||
|
||||
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* jQuery File Upload Image Preview & Resize Plugin 1.3.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global define, window, document, DataView, Blob, Uint8Array */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'load-image',
|
||||
'load-image-meta',
|
||||
'load-image-exif',
|
||||
'load-image-ios',
|
||||
'canvas-to-blob',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// Prepend to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
||||
{
|
||||
action: 'loadImageMetaData',
|
||||
disableImageHead: '@',
|
||||
disableExif: '@',
|
||||
disableExifThumbnail: '@',
|
||||
disableExifSub: '@',
|
||||
disableExifGps: '@',
|
||||
disabled: '@disableImageMetaDataLoad'
|
||||
},
|
||||
{
|
||||
action: 'loadImage',
|
||||
// Use the action as prefix for the "@" options:
|
||||
prefix: true,
|
||||
fileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
noRevoke: '@',
|
||||
disabled: '@disableImageLoad'
|
||||
},
|
||||
{
|
||||
action: 'resizeImage',
|
||||
// Use "image" as prefix for the "@" options:
|
||||
prefix: 'image',
|
||||
maxWidth: '@',
|
||||
maxHeight: '@',
|
||||
minWidth: '@',
|
||||
minHeight: '@',
|
||||
crop: '@',
|
||||
orientation: '@',
|
||||
disabled: '@disableImageResize'
|
||||
},
|
||||
{
|
||||
action: 'saveImage',
|
||||
disabled: '@disableImageResize'
|
||||
},
|
||||
{
|
||||
action: 'saveImageMetaData',
|
||||
disabled: '@disableImageMetaDataSave'
|
||||
},
|
||||
{
|
||||
action: 'resizeImage',
|
||||
// Use "preview" as prefix for the "@" options:
|
||||
prefix: 'preview',
|
||||
maxWidth: '@',
|
||||
maxHeight: '@',
|
||||
minWidth: '@',
|
||||
minHeight: '@',
|
||||
crop: '@',
|
||||
orientation: '@',
|
||||
thumbnail: '@',
|
||||
canvas: '@',
|
||||
disabled: '@disableImagePreview'
|
||||
},
|
||||
{
|
||||
action: 'setImage',
|
||||
name: '@imagePreviewName',
|
||||
disabled: '@disableImagePreview'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Resize plugin extends the fileupload widget
|
||||
// with image resize functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The regular expression for the types of images to load:
|
||||
// matched against the file type:
|
||||
loadImageFileTypes: /^image\/(gif|jpeg|png)$/,
|
||||
// The maximum file size of images to load:
|
||||
loadImageMaxFileSize: 10000000, // 10MB
|
||||
// The maximum width of resized images:
|
||||
imageMaxWidth: 1920,
|
||||
// The maximum height of resized images:
|
||||
imageMaxHeight: 1080,
|
||||
// Defines the image orientation (1-8) or takes the orientation
|
||||
// value from Exif data if set to true:
|
||||
imageOrientation: false,
|
||||
// Define if resized images should be cropped or only scaled:
|
||||
imageCrop: false,
|
||||
// Disable the resize image functionality by default:
|
||||
disableImageResize: true,
|
||||
// The maximum width of the preview images:
|
||||
previewMaxWidth: 80,
|
||||
// The maximum height of the preview images:
|
||||
previewMaxHeight: 80,
|
||||
// Defines the preview orientation (1-8) or takes the orientation
|
||||
// value from Exif data if set to true:
|
||||
previewOrientation: true,
|
||||
// Create the preview using the Exif data thumbnail:
|
||||
previewThumbnail: true,
|
||||
// Define if preview images should be cropped or only scaled:
|
||||
previewCrop: false,
|
||||
// Define if preview images should be resized as canvas elements:
|
||||
previewCanvas: true
|
||||
},
|
||||
|
||||
processActions: {
|
||||
|
||||
// Loads the image given via data.files and data.index
|
||||
// as img element, if the browser supports the File API.
|
||||
// Accepts the options fileTypes (regular expression)
|
||||
// and maxFileSize (integer) to limit the files to load:
|
||||
loadImage: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
dfd = $.Deferred();
|
||||
if (($.type(options.maxFileSize) === 'number' &&
|
||||
file.size > options.maxFileSize) ||
|
||||
(options.fileTypes &&
|
||||
!options.fileTypes.test(file.type)) ||
|
||||
!loadImage(
|
||||
file,
|
||||
function (img) {
|
||||
if (img.src) {
|
||||
data.img = img;
|
||||
}
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
options
|
||||
)) {
|
||||
return data;
|
||||
}
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
// Resizes the image given as data.canvas or data.img
|
||||
// and updates data.canvas or data.img with the resized image.
|
||||
// Also stores the resized image as preview property.
|
||||
// Accepts the options maxWidth, maxHeight, minWidth,
|
||||
// minHeight, canvas and crop:
|
||||
resizeImage: function (data, options) {
|
||||
if (options.disabled || !(data.canvas || data.img)) {
|
||||
return data;
|
||||
}
|
||||
options = $.extend({canvas: true}, options);
|
||||
var that = this,
|
||||
dfd = $.Deferred(),
|
||||
img = (options.canvas && data.canvas) || data.img,
|
||||
resolve = function (newImg) {
|
||||
if (newImg && (newImg.width !== img.width ||
|
||||
newImg.height !== img.height)) {
|
||||
data[newImg.getContext ? 'canvas' : 'img'] = newImg;
|
||||
}
|
||||
data.preview = newImg;
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
thumbnail;
|
||||
if (data.exif) {
|
||||
if (options.orientation === true) {
|
||||
options.orientation = data.exif.get('Orientation');
|
||||
}
|
||||
if (options.thumbnail) {
|
||||
thumbnail = data.exif.get('Thumbnail');
|
||||
if (thumbnail) {
|
||||
loadImage(thumbnail, resolve, options);
|
||||
return dfd.promise();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (img) {
|
||||
resolve(loadImage.scale(img, options));
|
||||
return dfd.promise();
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// Saves the processed image given as data.canvas
|
||||
// inplace at data.index of data.files:
|
||||
saveImage: function (data, options) {
|
||||
if (!data.canvas || options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
name = file.name,
|
||||
dfd = $.Deferred(),
|
||||
callback = function (blob) {
|
||||
if (!blob.name) {
|
||||
if (file.type === blob.type) {
|
||||
blob.name = file.name;
|
||||
} else if (file.name) {
|
||||
blob.name = file.name.replace(
|
||||
/\..+$/,
|
||||
'.' + blob.type.substr(6)
|
||||
);
|
||||
}
|
||||
}
|
||||
// Store the created blob at the position
|
||||
// of the original file in the files list:
|
||||
data.files[data.index] = blob;
|
||||
dfd.resolveWith(that, [data]);
|
||||
};
|
||||
// Use canvas.mozGetAsFile directly, to retain the filename, as
|
||||
// Gecko doesn't support the filename option for FormData.append:
|
||||
if (data.canvas.mozGetAsFile) {
|
||||
callback(data.canvas.mozGetAsFile(
|
||||
(/^image\/(jpeg|png)$/.test(file.type) && name) ||
|
||||
((name && name.replace(/\..+$/, '')) ||
|
||||
'blob') + '.png',
|
||||
file.type
|
||||
));
|
||||
} else if (data.canvas.toBlob) {
|
||||
data.canvas.toBlob(callback, file.type);
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
loadImageMetaData: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
dfd = $.Deferred();
|
||||
loadImage.parseMetaData(data.files[data.index], function (result) {
|
||||
$.extend(data, result);
|
||||
dfd.resolveWith(that, [data]);
|
||||
}, options);
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
saveImageMetaData: function (data, options) {
|
||||
if (!(data.imageHead && data.canvas &&
|
||||
data.canvas.toBlob && !options.disabled)) {
|
||||
return data;
|
||||
}
|
||||
var file = data.files[data.index],
|
||||
blob = new Blob([
|
||||
data.imageHead,
|
||||
// Resized images always have a head size of 20 bytes,
|
||||
// including the JPEG marker and a minimal JFIF header:
|
||||
this._blobSlice.call(file, 20)
|
||||
], {type: file.type});
|
||||
blob.name = file.name;
|
||||
data.files[data.index] = blob;
|
||||
return data;
|
||||
},
|
||||
|
||||
// Sets the resized version of the image as a property of the
|
||||
// file object, must be called after "saveImage":
|
||||
setImage: function (data, options) {
|
||||
if (data.preview && !options.disabled) {
|
||||
data.files[data.index][options.name || 'preview'] = data.preview;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* jQuery File Upload Processing Plugin 1.2.2
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true */
|
||||
/*global define, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'./jquery.fileupload'
|
||||
], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery
|
||||
);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
var originalAdd = $.blueimp.fileupload.prototype.options.add;
|
||||
|
||||
// The File Upload Processing plugin extends the fileupload widget
|
||||
// with file processing functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The list of processing actions:
|
||||
processQueue: [
|
||||
/*
|
||||
{
|
||||
action: 'log',
|
||||
type: 'debug'
|
||||
}
|
||||
*/
|
||||
],
|
||||
add: function (e, data) {
|
||||
var $this = $(this);
|
||||
data.process(function () {
|
||||
return $this.fileupload('process', data);
|
||||
});
|
||||
originalAdd.call(this, e, data);
|
||||
}
|
||||
},
|
||||
|
||||
processActions: {
|
||||
/*
|
||||
log: function (data, options) {
|
||||
console[options.type](
|
||||
'Processing "' + data.files[data.index].name + '"'
|
||||
);
|
||||
}
|
||||
*/
|
||||
},
|
||||
|
||||
_processFile: function (data) {
|
||||
var that = this,
|
||||
dfd = $.Deferred().resolveWith(that, [data]),
|
||||
chain = dfd.promise();
|
||||
this._trigger('process', null, data);
|
||||
$.each(data.processQueue, function (i, settings) {
|
||||
var func = function (data) {
|
||||
return that.processActions[settings.action].call(
|
||||
that,
|
||||
data,
|
||||
settings
|
||||
);
|
||||
};
|
||||
chain = chain.pipe(func, settings.always && func);
|
||||
});
|
||||
chain
|
||||
.done(function () {
|
||||
that._trigger('processdone', null, data);
|
||||
that._trigger('processalways', null, data);
|
||||
})
|
||||
.fail(function () {
|
||||
that._trigger('processfail', null, data);
|
||||
that._trigger('processalways', null, data);
|
||||
});
|
||||
return chain;
|
||||
},
|
||||
|
||||
// Replaces the settings of each processQueue item that
|
||||
// are strings starting with an "@", using the remaining
|
||||
// substring as key for the option map,
|
||||
// e.g. "@autoUpload" is replaced with options.autoUpload:
|
||||
_transformProcessQueue: function (options) {
|
||||
var processQueue = [];
|
||||
$.each(options.processQueue, function () {
|
||||
var settings = {},
|
||||
action = this.action,
|
||||
prefix = this.prefix === true ? action : this.prefix;
|
||||
$.each(this, function (key, value) {
|
||||
if ($.type(value) === 'string' &&
|
||||
value.charAt(0) === '@') {
|
||||
settings[key] = options[
|
||||
value.slice(1) || (prefix ? prefix +
|
||||
key.charAt(0).toUpperCase() + key.slice(1) : key)
|
||||
];
|
||||
} else {
|
||||
settings[key] = value;
|
||||
}
|
||||
|
||||
});
|
||||
processQueue.push(settings);
|
||||
});
|
||||
options.processQueue = processQueue;
|
||||
},
|
||||
|
||||
// Returns the number of files currently in the processsing queue:
|
||||
processing: function () {
|
||||
return this._processing;
|
||||
},
|
||||
|
||||
// Processes the files given as files property of the data parameter,
|
||||
// returns a Promise object that allows to bind callbacks:
|
||||
process: function (data) {
|
||||
var that = this,
|
||||
options = $.extend({}, this.options, data);
|
||||
if (options.processQueue && options.processQueue.length) {
|
||||
this._transformProcessQueue(options);
|
||||
if (this._processing === 0) {
|
||||
this._trigger('processstart');
|
||||
}
|
||||
$.each(data.files, function (index) {
|
||||
var opts = index ? $.extend({}, options) : options,
|
||||
func = function () {
|
||||
return that._processFile(opts);
|
||||
};
|
||||
opts.index = index;
|
||||
that._processing += 1;
|
||||
that._processingQueue = that._processingQueue.pipe(func, func)
|
||||
.always(function () {
|
||||
that._processing -= 1;
|
||||
if (that._processing === 0) {
|
||||
that._trigger('processstop');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return this._processingQueue;
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
this._super();
|
||||
this._processing = 0;
|
||||
this._processingQueue = $.Deferred().resolveWith(this)
|
||||
.promise();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* jQuery File Upload Validation Plugin 1.1.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global define, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery
|
||||
);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Append to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.push(
|
||||
{
|
||||
action: 'validate',
|
||||
// Always trigger this action,
|
||||
// even if the previous action was rejected:
|
||||
always: true,
|
||||
// Options taken from the global options map:
|
||||
acceptFileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
minFileSize: '@',
|
||||
maxNumberOfFiles: '@',
|
||||
disabled: '@disableValidation'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Validation plugin extends the fileupload widget
|
||||
// with file validation functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
/*
|
||||
// The regular expression for allowed file types, matches
|
||||
// against either file type or file name:
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
|
||||
// The maximum allowed file size in bytes:
|
||||
maxFileSize: 10000000, // 10 MB
|
||||
// The minimum allowed file size in bytes:
|
||||
minFileSize: undefined, // No minimal file size
|
||||
// The limit of files to be uploaded:
|
||||
maxNumberOfFiles: 10,
|
||||
*/
|
||||
|
||||
// Function returning the current number of files,
|
||||
// has to be overriden for maxNumberOfFiles validation:
|
||||
getNumberOfFiles: $.noop,
|
||||
|
||||
// Error and info messages:
|
||||
messages: {
|
||||
maxNumberOfFiles: 'Maximum number of files exceeded',
|
||||
acceptFileTypes: 'File type not allowed',
|
||||
maxFileSize: 'File is too large',
|
||||
minFileSize: 'File is too small'
|
||||
}
|
||||
},
|
||||
|
||||
processActions: {
|
||||
|
||||
validate: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var dfd = $.Deferred(),
|
||||
settings = this.options,
|
||||
file = data.files[data.index];
|
||||
if ($.type(options.maxNumberOfFiles) === 'number' &&
|
||||
(settings.getNumberOfFiles() || 0) + data.files.length >
|
||||
options.maxNumberOfFiles) {
|
||||
file.error = settings.i18n('maxNumberOfFiles');
|
||||
} else if (options.acceptFileTypes &&
|
||||
!(options.acceptFileTypes.test(file.type) ||
|
||||
options.acceptFileTypes.test(file.name))) {
|
||||
file.error = settings.i18n('acceptFileTypes');
|
||||
} else if (options.maxFileSize && file.size >
|
||||
options.maxFileSize) {
|
||||
file.error = settings.i18n('maxFileSize');
|
||||
} else if ($.type(file.size) === 'number' &&
|
||||
file.size < options.minFileSize) {
|
||||
file.error = settings.i18n('minFileSize');
|
||||
} else {
|
||||
delete file.error;
|
||||
}
|
||||
if (file.error || data.files.error) {
|
||||
data.files.error = true;
|
||||
dfd.rejectWith(this, [data]);
|
||||
} else {
|
||||
dfd.resolveWith(this, [data]);
|
||||
}
|
||||
return dfd.promise();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
+1367
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* jQuery Iframe Transport Plugin 1.8.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint unparam: true, nomen: true */
|
||||
/*global define, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Helper variable to create unique names for the transport iframes:
|
||||
var counter = 0;
|
||||
|
||||
// The iframe transport accepts four additional options:
|
||||
// options.fileInput: a jQuery collection of file input fields
|
||||
// options.paramName: the parameter name for the file form data,
|
||||
// overrides the name property of the file input field(s),
|
||||
// can be a string or an array of strings.
|
||||
// options.formData: an array of objects with name and value properties,
|
||||
// equivalent to the return data of .serializeArray(), e.g.:
|
||||
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
||||
// options.initialIframeSrc: the URL of the initial iframe src,
|
||||
// by default set to "javascript:false;"
|
||||
$.ajaxTransport('iframe', function (options) {
|
||||
if (options.async) {
|
||||
// javascript:false as initial iframe src
|
||||
// prevents warning popups on HTTPS in IE6:
|
||||
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
|
||||
form,
|
||||
iframe,
|
||||
addParamChar;
|
||||
return {
|
||||
send: function (_, completeCallback) {
|
||||
form = $('<form style="display:none;"></form>');
|
||||
form.attr('accept-charset', options.formAcceptCharset);
|
||||
addParamChar = /\?/.test(options.url) ? '&' : '?';
|
||||
// XDomainRequest only supports GET and POST:
|
||||
if (options.type === 'DELETE') {
|
||||
options.url = options.url + addParamChar + '_method=DELETE';
|
||||
options.type = 'POST';
|
||||
} else if (options.type === 'PUT') {
|
||||
options.url = options.url + addParamChar + '_method=PUT';
|
||||
options.type = 'POST';
|
||||
} else if (options.type === 'PATCH') {
|
||||
options.url = options.url + addParamChar + '_method=PATCH';
|
||||
options.type = 'POST';
|
||||
}
|
||||
// IE versions below IE8 cannot set the name property of
|
||||
// elements that have already been added to the DOM,
|
||||
// so we set the name along with the iframe HTML markup:
|
||||
counter += 1;
|
||||
iframe = $(
|
||||
'<iframe src="' + initialIframeSrc +
|
||||
'" name="iframe-transport-' + counter + '"></iframe>'
|
||||
).bind('load', function () {
|
||||
var fileInputClones,
|
||||
paramNames = $.isArray(options.paramName) ?
|
||||
options.paramName : [options.paramName];
|
||||
iframe
|
||||
.unbind('load')
|
||||
.bind('load', function () {
|
||||
var response;
|
||||
// Wrap in a try/catch block to catch exceptions thrown
|
||||
// when trying to access cross-domain iframe contents:
|
||||
try {
|
||||
response = iframe.contents();
|
||||
// Google Chrome and Firefox do not throw an
|
||||
// exception when calling iframe.contents() on
|
||||
// cross-domain requests, so we unify the response:
|
||||
if (!response.length || !response[0].firstChild) {
|
||||
throw new Error();
|
||||
}
|
||||
} catch (e) {
|
||||
response = undefined;
|
||||
}
|
||||
// The complete callback returns the
|
||||
// iframe content document as response object:
|
||||
completeCallback(
|
||||
200,
|
||||
'success',
|
||||
{'iframe': response}
|
||||
);
|
||||
// Fix for IE endless progress bar activity bug
|
||||
// (happens on form submits to iframe targets):
|
||||
$('<iframe src="' + initialIframeSrc + '"></iframe>')
|
||||
.appendTo(form);
|
||||
window.setTimeout(function () {
|
||||
// Removing the form in a setTimeout call
|
||||
// allows Chrome's developer tools to display
|
||||
// the response result
|
||||
form.remove();
|
||||
}, 0);
|
||||
});
|
||||
form
|
||||
.prop('target', iframe.prop('name'))
|
||||
.prop('action', options.url)
|
||||
.prop('method', options.type);
|
||||
if (options.formData) {
|
||||
$.each(options.formData, function (index, field) {
|
||||
$('<input type="hidden"/>')
|
||||
.prop('name', field.name)
|
||||
.val(field.value)
|
||||
.appendTo(form);
|
||||
});
|
||||
}
|
||||
if (options.fileInput && options.fileInput.length &&
|
||||
options.type === 'POST') {
|
||||
fileInputClones = options.fileInput.clone();
|
||||
// Insert a clone for each file input field:
|
||||
options.fileInput.after(function (index) {
|
||||
return fileInputClones[index];
|
||||
});
|
||||
if (options.paramName) {
|
||||
options.fileInput.each(function (index) {
|
||||
$(this).prop(
|
||||
'name',
|
||||
paramNames[index] || options.paramName
|
||||
);
|
||||
});
|
||||
}
|
||||
// Appending the file input fields to the hidden form
|
||||
// removes them from their original location:
|
||||
form
|
||||
.append(options.fileInput)
|
||||
.prop('enctype', 'multipart/form-data')
|
||||
// enctype must be set as encoding for IE:
|
||||
.prop('encoding', 'multipart/form-data');
|
||||
}
|
||||
form.submit();
|
||||
// Insert the file input fields at their original location
|
||||
// by replacing the clones with the originals:
|
||||
if (fileInputClones && fileInputClones.length) {
|
||||
options.fileInput.each(function (index, input) {
|
||||
var clone = $(fileInputClones[index]);
|
||||
$(input).prop('name', clone.prop('name'));
|
||||
clone.replaceWith(input);
|
||||
});
|
||||
}
|
||||
});
|
||||
form.append(iframe).appendTo(document.body);
|
||||
},
|
||||
abort: function () {
|
||||
if (iframe) {
|
||||
// javascript:false as iframe src aborts the request
|
||||
// and prevents warning popups on HTTPS in IE6.
|
||||
// concat is used to avoid the "Script URL" JSLint error:
|
||||
iframe
|
||||
.unbind('load')
|
||||
.prop('src', initialIframeSrc);
|
||||
}
|
||||
if (form) {
|
||||
form.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// The iframe transport returns the iframe content document as response.
|
||||
// The following adds converters from iframe to text, json, html, xml
|
||||
// and script.
|
||||
// Please note that the Content-Type for JSON responses has to be text/plain
|
||||
// or text/html, if the browser doesn't include application/json in the
|
||||
// Accept header, else IE will show a download dialog.
|
||||
// The Content-Type for XML responses on the other hand has to be always
|
||||
// application/xml or text/xml, so IE properly parses the XML response.
|
||||
// See also
|
||||
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'iframe text': function (iframe) {
|
||||
return iframe && $(iframe[0].body).text();
|
||||
},
|
||||
'iframe json': function (iframe) {
|
||||
return iframe && $.parseJSON($(iframe[0].body).text());
|
||||
},
|
||||
'iframe html': function (iframe) {
|
||||
return iframe && $(iframe[0].body).html();
|
||||
},
|
||||
'iframe xml': function (iframe) {
|
||||
var xmlDoc = iframe && iframe[0];
|
||||
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
|
||||
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
||||
$(xmlDoc.body).html());
|
||||
},
|
||||
'iframe script': function (iframe) {
|
||||
return iframe && $.globalEval($(iframe[0].body).text());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,530 @@
|
||||
/*
|
||||
* jQuery UI Widget 1.10.3+amd
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/jQuery.widget/
|
||||
*/
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(["jquery"], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function( $, undefined ) {
|
||||
|
||||
var uuid = 0,
|
||||
slice = Array.prototype.slice,
|
||||
_cleanData = $.cleanData;
|
||||
$.cleanData = function( elems ) {
|
||||
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
||||
try {
|
||||
$( elem ).triggerHandler( "remove" );
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
} catch( e ) {}
|
||||
}
|
||||
_cleanData( elems );
|
||||
};
|
||||
|
||||
$.widget = function( name, base, prototype ) {
|
||||
var fullName, existingConstructor, constructor, basePrototype,
|
||||
// proxiedPrototype allows the provided prototype to remain unmodified
|
||||
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||
proxiedPrototype = {},
|
||||
namespace = name.split( "." )[ 0 ];
|
||||
|
||||
name = name.split( "." )[ 1 ];
|
||||
fullName = namespace + "-" + name;
|
||||
|
||||
if ( !prototype ) {
|
||||
prototype = base;
|
||||
base = $.Widget;
|
||||
}
|
||||
|
||||
// create selector for plugin
|
||||
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
||||
return !!$.data( elem, fullName );
|
||||
};
|
||||
|
||||
$[ namespace ] = $[ namespace ] || {};
|
||||
existingConstructor = $[ namespace ][ name ];
|
||||
constructor = $[ namespace ][ name ] = function( options, element ) {
|
||||
// allow instantiation without "new" keyword
|
||||
if ( !this._createWidget ) {
|
||||
return new constructor( options, element );
|
||||
}
|
||||
|
||||
// allow instantiation without initializing for simple inheritance
|
||||
// must use "new" keyword (the code above always passes args)
|
||||
if ( arguments.length ) {
|
||||
this._createWidget( options, element );
|
||||
}
|
||||
};
|
||||
// extend with the existing constructor to carry over any static properties
|
||||
$.extend( constructor, existingConstructor, {
|
||||
version: prototype.version,
|
||||
// copy the object used to create the prototype in case we need to
|
||||
// redefine the widget later
|
||||
_proto: $.extend( {}, prototype ),
|
||||
// track widgets that inherit from this widget in case this widget is
|
||||
// redefined after a widget inherits from it
|
||||
_childConstructors: []
|
||||
});
|
||||
|
||||
basePrototype = new base();
|
||||
// we need to make the options hash a property directly on the new instance
|
||||
// otherwise we'll modify the options hash on the prototype that we're
|
||||
// inheriting from
|
||||
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
||||
$.each( prototype, function( prop, value ) {
|
||||
if ( !$.isFunction( value ) ) {
|
||||
proxiedPrototype[ prop ] = value;
|
||||
return;
|
||||
}
|
||||
proxiedPrototype[ prop ] = (function() {
|
||||
var _super = function() {
|
||||
return base.prototype[ prop ].apply( this, arguments );
|
||||
},
|
||||
_superApply = function( args ) {
|
||||
return base.prototype[ prop ].apply( this, args );
|
||||
};
|
||||
return function() {
|
||||
var __super = this._super,
|
||||
__superApply = this._superApply,
|
||||
returnValue;
|
||||
|
||||
this._super = _super;
|
||||
this._superApply = _superApply;
|
||||
|
||||
returnValue = value.apply( this, arguments );
|
||||
|
||||
this._super = __super;
|
||||
this._superApply = __superApply;
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
})();
|
||||
});
|
||||
constructor.prototype = $.widget.extend( basePrototype, {
|
||||
// TODO: remove support for widgetEventPrefix
|
||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||
// don't prefix for widgets that aren't DOM-based
|
||||
widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
|
||||
}, proxiedPrototype, {
|
||||
constructor: constructor,
|
||||
namespace: namespace,
|
||||
widgetName: name,
|
||||
widgetFullName: fullName
|
||||
});
|
||||
|
||||
// If this widget is being redefined then we need to find all widgets that
|
||||
// are inheriting from it and redefine all of them so that they inherit from
|
||||
// the new version of this widget. We're essentially trying to replace one
|
||||
// level in the prototype chain.
|
||||
if ( existingConstructor ) {
|
||||
$.each( existingConstructor._childConstructors, function( i, child ) {
|
||||
var childPrototype = child.prototype;
|
||||
|
||||
// redefine the child widget using the same prototype that was
|
||||
// originally used, but inherit from the new version of the base
|
||||
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
||||
});
|
||||
// remove the list of existing child constructors from the old constructor
|
||||
// so the old child constructors can be garbage collected
|
||||
delete existingConstructor._childConstructors;
|
||||
} else {
|
||||
base._childConstructors.push( constructor );
|
||||
}
|
||||
|
||||
$.widget.bridge( name, constructor );
|
||||
};
|
||||
|
||||
$.widget.extend = function( target ) {
|
||||
var input = slice.call( arguments, 1 ),
|
||||
inputIndex = 0,
|
||||
inputLength = input.length,
|
||||
key,
|
||||
value;
|
||||
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
||||
for ( key in input[ inputIndex ] ) {
|
||||
value = input[ inputIndex ][ key ];
|
||||
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
||||
// Clone objects
|
||||
if ( $.isPlainObject( value ) ) {
|
||||
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
||||
$.widget.extend( {}, target[ key ], value ) :
|
||||
// Don't extend strings, arrays, etc. with objects
|
||||
$.widget.extend( {}, value );
|
||||
// Copy everything else by reference
|
||||
} else {
|
||||
target[ key ] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
$.widget.bridge = function( name, object ) {
|
||||
var fullName = object.prototype.widgetFullName || name;
|
||||
$.fn[ name ] = function( options ) {
|
||||
var isMethodCall = typeof options === "string",
|
||||
args = slice.call( arguments, 1 ),
|
||||
returnValue = this;
|
||||
|
||||
// allow multiple hashes to be passed on init
|
||||
options = !isMethodCall && args.length ?
|
||||
$.widget.extend.apply( null, [ options ].concat(args) ) :
|
||||
options;
|
||||
|
||||
if ( isMethodCall ) {
|
||||
this.each(function() {
|
||||
var methodValue,
|
||||
instance = $.data( this, fullName );
|
||||
if ( !instance ) {
|
||||
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
||||
"attempted to call method '" + options + "'" );
|
||||
}
|
||||
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
||||
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
||||
}
|
||||
methodValue = instance[ options ].apply( instance, args );
|
||||
if ( methodValue !== instance && methodValue !== undefined ) {
|
||||
returnValue = methodValue && methodValue.jquery ?
|
||||
returnValue.pushStack( methodValue.get() ) :
|
||||
methodValue;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.each(function() {
|
||||
var instance = $.data( this, fullName );
|
||||
if ( instance ) {
|
||||
instance.option( options || {} )._init();
|
||||
} else {
|
||||
$.data( this, fullName, new object( options, this ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
};
|
||||
|
||||
$.Widget = function( /* options, element */ ) {};
|
||||
$.Widget._childConstructors = [];
|
||||
|
||||
$.Widget.prototype = {
|
||||
widgetName: "widget",
|
||||
widgetEventPrefix: "",
|
||||
defaultElement: "<div>",
|
||||
options: {
|
||||
disabled: false,
|
||||
|
||||
// callbacks
|
||||
create: null
|
||||
},
|
||||
_createWidget: function( options, element ) {
|
||||
element = $( element || this.defaultElement || this )[ 0 ];
|
||||
this.element = $( element );
|
||||
this.uuid = uuid++;
|
||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||
this.options = $.widget.extend( {},
|
||||
this.options,
|
||||
this._getCreateOptions(),
|
||||
options );
|
||||
|
||||
this.bindings = $();
|
||||
this.hoverable = $();
|
||||
this.focusable = $();
|
||||
|
||||
if ( element !== this ) {
|
||||
$.data( element, this.widgetFullName, this );
|
||||
this._on( true, this.element, {
|
||||
remove: function( event ) {
|
||||
if ( event.target === element ) {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.document = $( element.style ?
|
||||
// element within the document
|
||||
element.ownerDocument :
|
||||
// element is window or document
|
||||
element.document || element );
|
||||
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
||||
}
|
||||
|
||||
this._create();
|
||||
this._trigger( "create", null, this._getCreateEventData() );
|
||||
this._init();
|
||||
},
|
||||
_getCreateOptions: $.noop,
|
||||
_getCreateEventData: $.noop,
|
||||
_create: $.noop,
|
||||
_init: $.noop,
|
||||
|
||||
destroy: function() {
|
||||
this._destroy();
|
||||
// we can probably remove the unbind calls in 2.0
|
||||
// all event bindings should go through this._on()
|
||||
this.element
|
||||
.unbind( this.eventNamespace )
|
||||
// 1.9 BC for #7810
|
||||
// TODO remove dual storage
|
||||
.removeData( this.widgetName )
|
||||
.removeData( this.widgetFullName )
|
||||
// support: jquery <1.6.3
|
||||
// http://bugs.jquery.com/ticket/9413
|
||||
.removeData( $.camelCase( this.widgetFullName ) );
|
||||
this.widget()
|
||||
.unbind( this.eventNamespace )
|
||||
.removeAttr( "aria-disabled" )
|
||||
.removeClass(
|
||||
this.widgetFullName + "-disabled " +
|
||||
"ui-state-disabled" );
|
||||
|
||||
// clean up events and states
|
||||
this.bindings.unbind( this.eventNamespace );
|
||||
this.hoverable.removeClass( "ui-state-hover" );
|
||||
this.focusable.removeClass( "ui-state-focus" );
|
||||
},
|
||||
_destroy: $.noop,
|
||||
|
||||
widget: function() {
|
||||
return this.element;
|
||||
},
|
||||
|
||||
option: function( key, value ) {
|
||||
var options = key,
|
||||
parts,
|
||||
curOption,
|
||||
i;
|
||||
|
||||
if ( arguments.length === 0 ) {
|
||||
// don't return a reference to the internal hash
|
||||
return $.widget.extend( {}, this.options );
|
||||
}
|
||||
|
||||
if ( typeof key === "string" ) {
|
||||
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||
options = {};
|
||||
parts = key.split( "." );
|
||||
key = parts.shift();
|
||||
if ( parts.length ) {
|
||||
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
||||
for ( i = 0; i < parts.length - 1; i++ ) {
|
||||
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
||||
curOption = curOption[ parts[ i ] ];
|
||||
}
|
||||
key = parts.pop();
|
||||
if ( value === undefined ) {
|
||||
return curOption[ key ] === undefined ? null : curOption[ key ];
|
||||
}
|
||||
curOption[ key ] = value;
|
||||
} else {
|
||||
if ( value === undefined ) {
|
||||
return this.options[ key ] === undefined ? null : this.options[ key ];
|
||||
}
|
||||
options[ key ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
this._setOptions( options );
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOptions: function( options ) {
|
||||
var key;
|
||||
|
||||
for ( key in options ) {
|
||||
this._setOption( key, options[ key ] );
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOption: function( key, value ) {
|
||||
this.options[ key ] = value;
|
||||
|
||||
if ( key === "disabled" ) {
|
||||
this.widget()
|
||||
.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
|
||||
.attr( "aria-disabled", value );
|
||||
this.hoverable.removeClass( "ui-state-hover" );
|
||||
this.focusable.removeClass( "ui-state-focus" );
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
return this._setOption( "disabled", false );
|
||||
},
|
||||
disable: function() {
|
||||
return this._setOption( "disabled", true );
|
||||
},
|
||||
|
||||
_on: function( suppressDisabledCheck, element, handlers ) {
|
||||
var delegateElement,
|
||||
instance = this;
|
||||
|
||||
// no suppressDisabledCheck flag, shuffle arguments
|
||||
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
||||
handlers = element;
|
||||
element = suppressDisabledCheck;
|
||||
suppressDisabledCheck = false;
|
||||
}
|
||||
|
||||
// no element argument, shuffle and use this.element
|
||||
if ( !handlers ) {
|
||||
handlers = element;
|
||||
element = this.element;
|
||||
delegateElement = this.widget();
|
||||
} else {
|
||||
// accept selectors, DOM elements
|
||||
element = delegateElement = $( element );
|
||||
this.bindings = this.bindings.add( element );
|
||||
}
|
||||
|
||||
$.each( handlers, function( event, handler ) {
|
||||
function handlerProxy() {
|
||||
// allow widgets to customize the disabled handling
|
||||
// - disabled as an array instead of boolean
|
||||
// - disabled class as method for disabling individual parts
|
||||
if ( !suppressDisabledCheck &&
|
||||
( instance.options.disabled === true ||
|
||||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
||||
return;
|
||||
}
|
||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||
.apply( instance, arguments );
|
||||
}
|
||||
|
||||
// copy the guid so direct unbinding works
|
||||
if ( typeof handler !== "string" ) {
|
||||
handlerProxy.guid = handler.guid =
|
||||
handler.guid || handlerProxy.guid || $.guid++;
|
||||
}
|
||||
|
||||
var match = event.match( /^(\w+)\s*(.*)$/ ),
|
||||
eventName = match[1] + instance.eventNamespace,
|
||||
selector = match[2];
|
||||
if ( selector ) {
|
||||
delegateElement.delegate( selector, eventName, handlerProxy );
|
||||
} else {
|
||||
element.bind( eventName, handlerProxy );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_off: function( element, eventName ) {
|
||||
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
|
||||
element.unbind( eventName ).undelegate( eventName );
|
||||
},
|
||||
|
||||
_delay: function( handler, delay ) {
|
||||
function handlerProxy() {
|
||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||
.apply( instance, arguments );
|
||||
}
|
||||
var instance = this;
|
||||
return setTimeout( handlerProxy, delay || 0 );
|
||||
},
|
||||
|
||||
_hoverable: function( element ) {
|
||||
this.hoverable = this.hoverable.add( element );
|
||||
this._on( element, {
|
||||
mouseenter: function( event ) {
|
||||
$( event.currentTarget ).addClass( "ui-state-hover" );
|
||||
},
|
||||
mouseleave: function( event ) {
|
||||
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_focusable: function( element ) {
|
||||
this.focusable = this.focusable.add( element );
|
||||
this._on( element, {
|
||||
focusin: function( event ) {
|
||||
$( event.currentTarget ).addClass( "ui-state-focus" );
|
||||
},
|
||||
focusout: function( event ) {
|
||||
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_trigger: function( type, event, data ) {
|
||||
var prop, orig,
|
||||
callback = this.options[ type ];
|
||||
|
||||
data = data || {};
|
||||
event = $.Event( event );
|
||||
event.type = ( type === this.widgetEventPrefix ?
|
||||
type :
|
||||
this.widgetEventPrefix + type ).toLowerCase();
|
||||
// the original event may come from any element
|
||||
// so we need to reset the target on the new event
|
||||
event.target = this.element[ 0 ];
|
||||
|
||||
// copy original event properties over to the new event
|
||||
orig = event.originalEvent;
|
||||
if ( orig ) {
|
||||
for ( prop in orig ) {
|
||||
if ( !( prop in event ) ) {
|
||||
event[ prop ] = orig[ prop ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.element.trigger( event, data );
|
||||
return !( $.isFunction( callback ) &&
|
||||
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
||||
event.isDefaultPrevented() );
|
||||
}
|
||||
};
|
||||
|
||||
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
||||
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
||||
if ( typeof options === "string" ) {
|
||||
options = { effect: options };
|
||||
}
|
||||
var hasOptions,
|
||||
effectName = !options ?
|
||||
method :
|
||||
options === true || typeof options === "number" ?
|
||||
defaultEffect :
|
||||
options.effect || defaultEffect;
|
||||
options = options || {};
|
||||
if ( typeof options === "number" ) {
|
||||
options = { duration: options };
|
||||
}
|
||||
hasOptions = !$.isEmptyObject( options );
|
||||
options.complete = callback;
|
||||
if ( options.delay ) {
|
||||
element.delay( options.delay );
|
||||
}
|
||||
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
||||
element[ method ]( options );
|
||||
} else if ( effectName !== method && element[ effectName ] ) {
|
||||
element[ effectName ]( options.duration, options.easing, callback );
|
||||
} else {
|
||||
element.queue(function( next ) {
|
||||
$( this )[ method ]();
|
||||
if ( callback ) {
|
||||
callback.call( element[ 0 ] );
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -24,51 +24,6 @@
|
||||
*}
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
|
||||
{block name="input"}
|
||||
{if $input.type == 'file'}
|
||||
<input id="{$input.name}" type="file" name="{$input.name}" class="hide" />
|
||||
<div class="dummyfile input-group">
|
||||
<span class="input-group-addon"><i class="icon-file"></i></span>
|
||||
<input id="{$input.name}-name" type="text" class="disabled" name="filename" readonly />
|
||||
<span class="input-group-btn">
|
||||
<button id="{$input.name}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
|
||||
<i class="icon-folder-open"></i> {l s='Choose a file'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
{if isset($input.desc)}<p>{$input.desc}</p>{/if}
|
||||
{if isset($fields_value.image) && $fields_value.image}
|
||||
<div class="clearfix"> </div>
|
||||
<div id="image" class="thumbnail">
|
||||
{$fields_value.image}
|
||||
<div class="text-center">
|
||||
<p>{l s='File size'} {$fields_value.size}kb</p>
|
||||
<a class="btn btn-default" href="{$current}&{$identifier}={$form_id}&token={$token}&deleteImage=1">
|
||||
<i class="icon-remove text-danger"></i> {l s='Delete'}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#{$input.name}-selectbutton').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}-name').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}').change(function(e){
|
||||
var val = $(this).val();
|
||||
var file = val.split(/[\\/]/);
|
||||
$('#{$input.name}-name').val(file[file.length-1]);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{$displayBackOfficeCategory}
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
||||
{block name="input"}
|
||||
{if $input.name == "link_rewrite"}
|
||||
<script type="text/javascript">
|
||||
@@ -82,6 +37,10 @@
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
|
||||
{if $input.name == 'image'}
|
||||
{$displayBackOfficeCategory}
|
||||
{/if}
|
||||
{/block}
|
||||
{block name="description"}
|
||||
{$smarty.block.parent}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="#" class="show-forgot-password pull-right" >
|
||||
{l s='Lost password'}…
|
||||
{l s='Lost password'}
|
||||
</a>
|
||||
<label class="control-label" for="passwd">
|
||||
{l s='Password'}
|
||||
@@ -138,16 +138,16 @@
|
||||
id="email_forgot"
|
||||
class="form-control"
|
||||
autofocus="autofocus"
|
||||
tabindex="1"
|
||||
tabindex="5"
|
||||
placeholder="test@example.com" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<button href="#" class="btn btn-default show-login-form" tabindex="3">
|
||||
<button href="#" class="btn btn-default show-login-form" tabindex="7">
|
||||
<i class="icon-caret-left"></i>
|
||||
{l s='Back to login'}
|
||||
</button>
|
||||
<button class="btn btn-default pull-right" name="submitLogin" type="submit" tabindex="2">
|
||||
<button class="btn btn-default pull-right" name="submitLogin" type="submit" tabindex="6">
|
||||
<i class="icon-ok text-success"></i>
|
||||
{l s='Send'}
|
||||
</button>
|
||||
|
||||
@@ -61,53 +61,7 @@
|
||||
{/block}
|
||||
|
||||
{block name="other_input"}
|
||||
{if $key == 'rightCols'}
|
||||
{foreach $field as $input}
|
||||
{if $input.type == 'file'}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3">{$input.label} </label>
|
||||
<div class="col-lg-7">
|
||||
<input id="{$input.name}" type="file" name="{$input.name}" class="hide" />
|
||||
<div class="dummyfile input-group">
|
||||
<span class="input-group-addon"><i class="icon-file"></i></span>
|
||||
<input id="{$input.name}-name" type="text" class="disabled" name="filename" readonly />
|
||||
<span class="input-group-btn">
|
||||
<button id="{$input.name}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
|
||||
<i class="icon-folder-open"></i> {l s='Choose a file'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
{if isset($input.desc)}<p>{$input.desc}</p>{/if}
|
||||
{if isset($fields_value.image) && $fields_value.image}
|
||||
<div class="clearfix"> </div>
|
||||
<div id="image" class="img-thumbnail">
|
||||
{$fields_value.image}
|
||||
<div class="text-center">
|
||||
<p>{l s='File size'} {$fields_value.size}kb</p>
|
||||
<a class="btn btn-default" href="{$current}&{$identifier}={$form_id}&token={$token}&deleteImage=1">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#{$input.name}-selectbutton').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}-name').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}').change(function(e){
|
||||
var val = $(this).val();
|
||||
var file = val.split(/[\\/]/);
|
||||
$('#{$input.name}-name').val(file[file.length-1]);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $key == 'hours'}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3">{l s='Hours:'}</label>
|
||||
<div class="col-lg-9"><p class="form-control-static">{l s='e.g. 10:00AM - 9:30PM'}</p></div>
|
||||
@@ -118,6 +72,5 @@
|
||||
<div class="col-lg-9"><input type="text" size="25" name="hours_{$k}" value="{if isset($fields_value.hours[$k-1])}{$fields_value.hours[$k-1]|escape:'htmlall'}{/if}" /></div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/block}
|
||||
@@ -456,56 +456,6 @@
|
||||
</label>
|
||||
</div>
|
||||
{/foreach}
|
||||
{elseif $input.type == 'file'}
|
||||
{if isset($input.display_image) && $input.display_image}
|
||||
{if isset($fields_value[$input.name].image) && $fields_value[$input.name].image}
|
||||
<div id="image">
|
||||
{$fields_value[$input.name].image}
|
||||
<p>{l s='File size'} {$fields_value[$input.name].size}kb</p>
|
||||
<a class="btn btn-default" href="{$current}&{$identifier}={$form_id}&token={$token}&deleteImage=1">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{if isset($input['thumb']) && $input['thumb']}
|
||||
<div class="row">
|
||||
<div class="col-lg-7">
|
||||
<img src="{$input['thumb']}" alt="{$input['name']}" title="{$input['name']}" />
|
||||
<br/><br/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="row">
|
||||
<div class="col-lg-7">
|
||||
<input id="{$input.name}" type="file" name="{$input.name}" class="hide" />
|
||||
<div class="dummyfile input-group">
|
||||
<span class="input-group-addon"><i class="icon-file"></i></span>
|
||||
<input id="{$input.name}-name" type="text" class="disabled" name="filename" readonly />
|
||||
<span class="input-group-btn">
|
||||
<button id="{$input.name}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
|
||||
<i class="icon-folder-open"></i> {l s='Choose a file'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#{$input.name}-selectbutton').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}-name').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}').change(function(e){
|
||||
var val = $(this).val();
|
||||
var file = val.split(/[\\/]/);
|
||||
$('#{$input.name}-name').val(file[file.length-1]);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{elseif $input.type == 'password'}
|
||||
<input type="password"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
@@ -554,6 +504,8 @@
|
||||
{$input.html}
|
||||
{elseif $input.type == 'categories'}
|
||||
{$categories_tree}
|
||||
{elseif $input.type == 'file'}
|
||||
{$input.file}
|
||||
{elseif $input.type == 'categories_select'}
|
||||
{$input.category_tree}
|
||||
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
{elseif isset($params.callback)}
|
||||
{$tr.$key}
|
||||
{elseif $key == 'color'}
|
||||
<div style="background-color: {$tr.$key}"></div>
|
||||
<div style="background-color: {$tr.$key};" class="attributes-color-container"></div>
|
||||
{elseif isset($params.maxlength) && Tools::strlen($tr.$key) > $params.maxlength}
|
||||
<span title="{$tr.$key|escape:'htmlall':'UTF-8'}">{$tr.$key|truncate:$params.maxlength:'...'|escape:'htmlall':'UTF-8'}</span>
|
||||
{else}
|
||||
|
||||
@@ -200,14 +200,7 @@
|
||||
<textarea class="textarea-autosize" name={$key} cols="{$field['cols']}" rows="{$field['rows']}">{$field['value']|escape:'htmlall':'UTF-8'}</textarea>
|
||||
</div>
|
||||
{elseif $field['type'] == 'file'}
|
||||
{if isset($field['thumb']) && $field['thumb']}
|
||||
<div class="col-lg-3">
|
||||
<img src="{$field['thumb']}" alt="{$field['title']}" title="{$field['title']}" />
|
||||
</div>
|
||||
{/if}
|
||||
<div class="col-lg-5">
|
||||
<input type="file" name="{$key}" />
|
||||
</div>
|
||||
<div class="col-lg-9">{$field['file']}</div>
|
||||
{elseif $field['type'] == 'color'}
|
||||
<div class="col-lg-2">
|
||||
<div class="row">
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
{*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if isset($images) && $images}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
{foreach $images as $image}
|
||||
<div class="img-thumbnail text-center">
|
||||
{$image}
|
||||
{if isset($size)}<p>{l s='File size'} {$size}kb</p>{/if}
|
||||
{if isset($delete_url)}
|
||||
<a class="btn btn-default" href="{$delete_url}">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<input id="{$id}" type="file" name="{$name}[]"{if isset($url)} data-url="{$url}"{/if}{if isset($multiple) && $multiple} multiple="multiple"{/if} class="hide" />
|
||||
<button class="btn btn-default" data-style="expand-right" data-size="s" type="button" id="{$id}-add-button">
|
||||
<i class="icon-plus-sign"></i> {if isset($multiple) && $multiple}{l s='Add files'}{else}{l s='Add file'}{/if}
|
||||
</button>
|
||||
<button class="ladda-button" data-style="expand-right" data-size="s" type="button" id="{$id}-upload-button" style="display:none;">
|
||||
<i class="icon-cloud-upload"></i> <span class="ladda-label">{if isset($multiple) && $multiple}{l s='Upload files'}{else}{l s='Upload file'}{/if}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="row" style="display:none">
|
||||
<div class="alert alert-info" id="{$id}-files-list">
|
||||
<strong>{l s='Files:'}</strong>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="display:none">
|
||||
<div class="alert alert-danger" id="{$id}-errors"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$( document ).ready(function() {
|
||||
$('#{$id}-add-button').on('click', function() {
|
||||
$('#{$id}').trigger('click');
|
||||
});
|
||||
|
||||
var upload_button = Ladda.create( document.querySelector('#{$id}-upload-button' ));
|
||||
var total_files = 0;
|
||||
var total_uploaded_files = 0;
|
||||
|
||||
$('#{$id}').fileupload({
|
||||
dataType: 'json',
|
||||
autoUpload: false,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
|
||||
maxFileSize: 5000000, // 5 MB
|
||||
// Enable image resizing, except for Android and Opera,
|
||||
// which actually support image resizing, but fail to
|
||||
// send Blob objects via XHR requests:
|
||||
disableImageResize: /Android(?!.*Chrome)|Opera/
|
||||
.test(window.navigator.userAgent),
|
||||
previewMaxWidth: 100,
|
||||
previewMaxHeight: 100,
|
||||
previewCrop: false,
|
||||
start: function () {
|
||||
upload_button.start();
|
||||
},
|
||||
done: function (e, data) {
|
||||
$.each(data.result, function (index, file) {
|
||||
if (file[0].error)
|
||||
$('#{$id}-errors').append(file[0].error+'<br/>').parent().show();
|
||||
else
|
||||
total_uploaded_files ++;
|
||||
});
|
||||
|
||||
if (total_uploaded_files == data.originalFiles.length)
|
||||
$('#{$id}-upload-button').css('background-color', 'green').children('.icon-cloud-upload').removeClass('icon-cloud-upload').addClass('icon-check');
|
||||
},
|
||||
progressall: function (e, data) {
|
||||
upload_button.setProgress(data.loaded / data.total);
|
||||
},
|
||||
add: function (e, data) {
|
||||
data.context = $('#{$id}-files-list');
|
||||
data.context.parent().show();
|
||||
|
||||
$.each(data.files, function (index, file) {
|
||||
var node = '<div class="row"><span>'+file.name+'</span><button class="btn btn-default pull-right" type="button"><i class="icon-trash"></i> Remove from list</button></div>';
|
||||
data.context.append(node);
|
||||
});
|
||||
|
||||
$('#{$id}-upload-button').show().on('click', function () {
|
||||
total_files = data.originalFiles.length;
|
||||
data.submit();
|
||||
});
|
||||
},
|
||||
fail: function (e, data) {
|
||||
$('#{$id}-errors').html(data.errorThrown.message).parent().show();
|
||||
},
|
||||
always: function (e, data) {
|
||||
total_files--;
|
||||
|
||||
if (total_files == 0)
|
||||
upload_button.stop();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../../../');
|
||||
exit;
|
||||
@@ -0,0 +1,83 @@
|
||||
{*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if isset($display_image) && $display_image}
|
||||
{if isset($image) && $image}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
<div class="img-thumbnail text-center">
|
||||
{$image}
|
||||
{if isset($size)}<p>{l s='File size'} {$size}kb</p>{/if}
|
||||
{if isset($delete_url)}
|
||||
<a class="btn btn-default" href="{$delete_url}">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{if isset($thumb) && $thumb}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
<img src="{$thumb}" alt="{$title}" title="{$title}" class="img-thumbnail" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
<input id="{$id}" type="file" name="{$name}"{if isset($multiple) && $multiple} multiple="multiple"{/if} class="hide" />
|
||||
<div class="dummyfile input-group">
|
||||
<span class="input-group-addon"><i class="icon-file"></i></span>
|
||||
<input id="{$id}-name" type="text" class="disabled" name="filename" readonly />
|
||||
<span class="input-group-btn">
|
||||
<button id="{$id}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
|
||||
<i class="icon-folder-open"></i> {if isset($multiple) && $multiple}{l s='Add files'}{else}{l s='Add file'}{/if}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#{$id}-selectbutton').click(function(e) {
|
||||
$('#{$id}').trigger('click');
|
||||
});
|
||||
$('#{$id}-name').click(function(e) {
|
||||
$('#{$id}').trigger('click');
|
||||
});
|
||||
$('#{$id}').change(function(e) {
|
||||
var files = $(this)[0].files;
|
||||
var name = '';
|
||||
|
||||
$.each(files, function(index, value) {
|
||||
name += value.name+', ';
|
||||
});
|
||||
|
||||
$('#{$id}-name').val(name.slice(0, -2));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Vendored
+4
@@ -378,6 +378,8 @@
|
||||
'HelperTreeCategoriesCore' => 'classes/helper/HelperTreeCategories.php',
|
||||
'HelperTreeShops' => '',
|
||||
'HelperTreeShopsCore' => 'classes/helper/HelperTreeShops.php',
|
||||
'HelperUploader' => '',
|
||||
'HelperUploaderCore' => 'classes/helper/HelperUploader.php',
|
||||
'HelperView' => '',
|
||||
'HelperViewCore' => 'classes/helper/HelperView.php',
|
||||
'HistoryController' => '',
|
||||
@@ -644,6 +646,8 @@
|
||||
'TreeToolbarSearchCore' => 'classes/tree/TreeToolbarSearch.php',
|
||||
'Upgrader' => '',
|
||||
'UpgraderCore' => 'classes/Upgrader.php',
|
||||
'Uploader' => '',
|
||||
'UploaderCore' => 'classes/Uploader.php',
|
||||
'Validate' => '',
|
||||
'ValidateCore' => 'classes/Validate.php',
|
||||
'Warehouse' => '',
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class UploaderCore
|
||||
{
|
||||
const DEFAULT_MAX_SIZE = 10485760;
|
||||
|
||||
private $_accept_types;
|
||||
private $_files;
|
||||
private $_max_size;
|
||||
private $_name;
|
||||
private $_save_path;
|
||||
|
||||
public function __construct($name = null)
|
||||
{
|
||||
$this->setName($name);
|
||||
}
|
||||
|
||||
public function setAcceptTypes($value)
|
||||
{
|
||||
$this->_accept_types = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAcceptTypes()
|
||||
{
|
||||
if (!isset($this->_accept_types))
|
||||
$this->setAcceptTypes('/.+$/i');
|
||||
|
||||
return $this->_accept_types;
|
||||
}
|
||||
|
||||
public function getFiles()
|
||||
{
|
||||
if (!isset($this->_files))
|
||||
$this->_files = array();
|
||||
|
||||
return $this->_files;
|
||||
}
|
||||
|
||||
public function setMaxSize($value)
|
||||
{
|
||||
$this->_max_size = intval($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMaxSize()
|
||||
{
|
||||
if (!isset($this->_max_size))
|
||||
$this->setMaxSize(self::DEFAULT_MAX_SIZE);
|
||||
|
||||
return $this->_max_size;
|
||||
}
|
||||
|
||||
public function setName($value)
|
||||
{
|
||||
$this->_name = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
public function setSavePath($value)
|
||||
{
|
||||
$this->_save_path = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSavePath()
|
||||
{
|
||||
if (!isset($this->_save_path))
|
||||
$this->setSavePath(_PS_UPLOAD_DIR_);
|
||||
|
||||
return $this->_normalizeDirectory($this->_save_path);
|
||||
}
|
||||
|
||||
public function getUniqueFileName()
|
||||
{
|
||||
return uniqid('', true);
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
$this->files = array();
|
||||
$upload = isset($_FILES[$this->getName()]) ? $_FILES[$this->getName()] : null;
|
||||
|
||||
if ($upload && is_array($upload['tmp_name']))
|
||||
foreach ($upload['tmp_name'] as $index => $value)
|
||||
$this->files[] = $this->upload(
|
||||
$upload['tmp_name'][$index],
|
||||
$upload['name'][$index],
|
||||
$upload['size'][$index],
|
||||
$upload['type'][$index],
|
||||
$upload['error'][$index]
|
||||
);
|
||||
else
|
||||
$this->files[] = $this->upload(
|
||||
$upload['tmp_name'],
|
||||
$upload['name'],
|
||||
isset($upload['size']) ? $upload['size'] : $this->_getServerVars('CONTENT_LENGTH'),
|
||||
isset($upload['type']) ? $upload['type'] : $this->_getServerVars('CONTENT_TYPE'),
|
||||
isset($upload['error']) ? $upload['error'] : null
|
||||
);
|
||||
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
public function upload($tmp_name, $name, $size, $type, $error)
|
||||
{
|
||||
$file = new stdClass();
|
||||
$file->name = $name; //TODO: add unique file name if name is null
|
||||
$file->size = intval($size);
|
||||
$file->type = $type;
|
||||
|
||||
if ($this->validate($tmp_name, $file, $error))
|
||||
{
|
||||
$file_path = $this->getSavePath().$file->name;
|
||||
|
||||
if ($tmp_name && is_uploaded_file($tmp_name)) {
|
||||
move_uploaded_file($tmp_name, $file_path);
|
||||
} else {
|
||||
// Non-multipart uploads (PUT method support)
|
||||
file_put_contents($file_path, fopen('php://input', 'r'));
|
||||
}
|
||||
|
||||
$file_size = $this->_getFileSize($file_path);
|
||||
|
||||
if ($file_size === $file->size)
|
||||
{
|
||||
//TODO do image processing
|
||||
}
|
||||
else
|
||||
{
|
||||
$file->size = $file_size;
|
||||
unlink($file_path);
|
||||
$file->error = 'abort';
|
||||
}
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
protected function validate($tmp_name, $file, $error)
|
||||
{
|
||||
if ($error)
|
||||
{
|
||||
$file->error = Tools::displayError($error);
|
||||
return false;
|
||||
}
|
||||
|
||||
$post_max_size = $this->_getPostMaxSizeBytes();
|
||||
|
||||
if ($post_max_size && ($this->_getServerVars('CONTENT_LENGTH') > $post_max_size))
|
||||
{
|
||||
$file->error = Tools::displayError('The uploaded file exceeds the post_max_size directive in php.ini');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!preg_match($this->getAcceptTypes(), $file->name))
|
||||
{
|
||||
$file->error = Tools::displayError('Filetype not allowed');
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($file->size > $this->getMaxSize())
|
||||
{
|
||||
$file->error = Tools::displayError('File is too big');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function _getFileSize($file_path, $clear_stat_cache = false) {
|
||||
if ($clear_stat_cache)
|
||||
clearstatcache(true, $file_path);
|
||||
|
||||
return filesize($file_path);
|
||||
}
|
||||
|
||||
private function _getPostMaxSizeBytes() {
|
||||
$post_max_size = ini_get('post_max_size');
|
||||
$bytes = trim($post_max_size);
|
||||
$last = strtolower($post_max_size[strlen($post_max_size) - 1]);
|
||||
|
||||
switch ($last)
|
||||
{
|
||||
case 'g': $bytes *= 1024;
|
||||
case 'm': $bytes *= 1024;
|
||||
case 'k': $bytes *= 1024;
|
||||
}
|
||||
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
private function _getServerVars($var)
|
||||
{
|
||||
return (isset($_SERVER[$var]) ? $_SERVER[$var] : '');
|
||||
}
|
||||
|
||||
protected function _normalizeDirectory($directory)
|
||||
{
|
||||
$last = $directory[strlen($directory) - 1];
|
||||
|
||||
if (in_array($last, array('/', '\\'))) {
|
||||
$directory[strlen($directory) - 1] = DIRECTORY_SEPARATOR;
|
||||
return $directory;
|
||||
}
|
||||
|
||||
$directory .= DIRECTORY_SEPARATOR;
|
||||
return $directory;
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,7 @@ class HelperFormCore extends Helper
|
||||
$date = true;
|
||||
$tinymce = true;
|
||||
$textarea_autosize = true;
|
||||
$file = true;
|
||||
foreach ($this->fields_form as $fieldset_key => &$fieldset)
|
||||
if (isset($fieldset['form']['input']))
|
||||
foreach ($fieldset['form']['input'] as $key => &$params)
|
||||
@@ -110,6 +111,23 @@ class HelperFormCore extends Helper
|
||||
}
|
||||
break;
|
||||
|
||||
case 'file':
|
||||
$uploader = new HelperUploader();
|
||||
$uploader->setId(isset($params['id'])?$params['id']:null);
|
||||
$uploader->setName($params['name']);
|
||||
$uploader->setUrl(isset($params['url'])?$params['url']:null);
|
||||
$uploader->setMultiple(isset($params['multiple'])?$params['multiple']:false);
|
||||
$uploader->setUseAjax(isset($params['ajax'])?$params['ajax']:false);
|
||||
$uploader->setDisplayImage(isset($params['display_image'])?$params['display_image']:false);
|
||||
$uploader->setImage(isset($params['image'])?$params['image']:null);
|
||||
$uploader->setThumb(isset($params['thumb'])?$params['thumb']:null);
|
||||
$uploader->setSize(isset($params['size'])?$params['size']:null);
|
||||
$uploader->setTitle(isset($params['title'])?$params['title']:null);
|
||||
$uploader->setDeleteUrl(isset($params['delete_url'])?$params['delete_url']:null);
|
||||
|
||||
$params['file'] = $uploader->render();
|
||||
break;
|
||||
|
||||
case 'color':
|
||||
if ($color)
|
||||
{
|
||||
|
||||
@@ -95,6 +95,24 @@ class HelperOptionsCore extends Helper
|
||||
|
||||
if ($field['type'] == 'texarea' || $field['type'] == 'textareaLang')
|
||||
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/plugins/jquery.autosize.min.js');
|
||||
|
||||
if ($field['type'] == 'file')
|
||||
{
|
||||
$uploader = new HelperUploader();
|
||||
$uploader->setId(isset($field['id'])?$field['id']:null);
|
||||
$uploader->setName($field['name']);
|
||||
$uploader->setUrl(isset($field['url'])?$field['url']:null);
|
||||
$uploader->setMultiple(isset($field['multiple'])?$field['multiple']:false);
|
||||
$uploader->setUseAjax(isset($field['ajax'])?$field['ajax']:false);
|
||||
$uploader->setDisplayImage(isset($field['display_image'])?$field['display_image']:false);
|
||||
$uploader->setImage(isset($field['image'])?$field['image']:null);
|
||||
$uploader->setThumb(isset($field['thumb'])?$field['thumb']:null);
|
||||
$uploader->setSize(isset($field['size'])?$field['size']:null);
|
||||
$uploader->setTitle(isset($field['title'])?$field['title']:null);
|
||||
$uploader->setDeleteUrl(isset($field['delete_url'])?$field['delete_url']:null);
|
||||
|
||||
$field['file'] = $uploader->render();
|
||||
}
|
||||
|
||||
// Cast options values if specified
|
||||
if ($field['type'] == 'select' && isset($field['cast']))
|
||||
|
||||
@@ -0,0 +1,319 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class HelperUploaderCore extends Uploader
|
||||
{
|
||||
const DEFAULT_TEMPLATE_DIRECTORY = 'helpers/uploader';
|
||||
const DEFAULT_TEMPLATE = 'simple.tpl';
|
||||
const DEFAULT_AJAX_TEMPLATE = 'ajax.tpl';
|
||||
|
||||
private $_context;
|
||||
private $_delete_url;
|
||||
private $_display_image;
|
||||
private $_id;
|
||||
private $_image;
|
||||
private $_name;
|
||||
private $_multiple;
|
||||
private $_size;
|
||||
protected $_template;
|
||||
private $_template_directory;
|
||||
private $_title;
|
||||
private $_thumb;
|
||||
private $_url;
|
||||
private $_use_ajax;
|
||||
|
||||
public function setContext($value)
|
||||
{
|
||||
$this->_context = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getContext()
|
||||
{
|
||||
if (!isset($this->_context))
|
||||
$this->_context = Context::getContext();
|
||||
|
||||
return $this->_context;
|
||||
}
|
||||
|
||||
public function setDeleteUrl($value)
|
||||
{
|
||||
$this->_delete_url = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDeleteUrl()
|
||||
{
|
||||
return $this->_delete_url;
|
||||
}
|
||||
|
||||
public function setDisplayImage($value)
|
||||
{
|
||||
$this->_display_image = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setId($value)
|
||||
{
|
||||
$this->_id = (string)$value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
if (!isset($this->_id) || trim($this->_id) === '')
|
||||
$this->_id = $this->getName();
|
||||
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
public function setImage($value)
|
||||
{
|
||||
$this->_image = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImage()
|
||||
{
|
||||
return $this->_image;
|
||||
}
|
||||
|
||||
public function setName($value)
|
||||
{
|
||||
$this->_name = (string)$value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
public function setMultiple($value)
|
||||
{
|
||||
$this->_multiple = (bool)$value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSize($value)
|
||||
{
|
||||
$this->_size = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSize()
|
||||
{
|
||||
return $this->_size;
|
||||
}
|
||||
|
||||
public function setTemplate($value)
|
||||
{
|
||||
$this->_template = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
if (!isset($this->_template))
|
||||
$this->setTemplate(self::DEFAULT_TEMPLATE);
|
||||
|
||||
return $this->_template;
|
||||
}
|
||||
|
||||
public function setTemplateDirectory($value)
|
||||
{
|
||||
$this->_template_directory = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTemplateDirectory()
|
||||
{
|
||||
if (!isset($this->_template_directory))
|
||||
$this->_template_directory = self::DEFAULT_TEMPLATE_DIRECTORY;
|
||||
|
||||
return $this->_normalizeDirectory($this->_template_directory);
|
||||
}
|
||||
|
||||
public function getTemplateFile($template)
|
||||
{
|
||||
if (preg_match_all('/((?:^|[A-Z])[a-z]+)/', get_class($this->getContext()->controller), $matches) !== FALSE)
|
||||
$controllerName = strtolower($matches[0][1]);
|
||||
|
||||
if ($this->getContext()->controller instanceof ModuleAdminController)
|
||||
return $this->_normalizeDirectory(
|
||||
$this->getContext()->controller->getTemplatePath())
|
||||
.$this->getTemplateDirectory().$template;
|
||||
else if ($this->getContext()->controller instanceof AdminController
|
||||
&& isset($controllerName) && file_exists($this->_normalizeDirectory(
|
||||
$this->getContext()->smarty->getTemplateDir(0)).'controllers'
|
||||
.DIRECTORY_SEPARATOR
|
||||
.$controllerName
|
||||
.DIRECTORY_SEPARATOR
|
||||
.$this->getTemplateDirectory().$template))
|
||||
return $this->_normalizeDirectory(
|
||||
$this->getContext()->smarty->getTemplateDir(0)).'controllers'
|
||||
.DIRECTORY_SEPARATOR
|
||||
.$controllerName
|
||||
.DIRECTORY_SEPARATOR
|
||||
.$this->getTemplateDirectory().$template;
|
||||
else if (file_exists($this->_normalizeDirectory(
|
||||
$this->getContext()->smarty->getTemplateDir(1))
|
||||
.$this->getTemplateDirectory().$template))
|
||||
return $this->_normalizeDirectory(
|
||||
$this->getContext()->smarty->getTemplateDir(1))
|
||||
.$this->getTemplateDirectory().$template;
|
||||
else if (file_exists($this->_normalizeDirectory(
|
||||
$this->getContext()->smarty->getTemplateDir(0))
|
||||
.$this->getTemplateDirectory().$template))
|
||||
return $this->_normalizeDirectory(
|
||||
$this->getContext()->smarty->getTemplateDir(0))
|
||||
.$this->getTemplateDirectory().$template;
|
||||
else
|
||||
return $this->getTemplateDirectory().$template;
|
||||
}
|
||||
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->_title = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
public function setThumb($value)
|
||||
{
|
||||
$this->_thumb = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getThumb()
|
||||
{
|
||||
return $this->_thumb;
|
||||
}
|
||||
|
||||
public function setUrl($value)
|
||||
{
|
||||
$this->_url = (string)$value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
public function setUseAjax($value)
|
||||
{
|
||||
$this->_use_ajax = (bool)$value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function displayImage()
|
||||
{
|
||||
return (isset($this->_display_image) && $this->_display_image);
|
||||
}
|
||||
|
||||
public function isMultiple()
|
||||
{
|
||||
return (isset($this->_multiple) && $this->_multiple);
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
$files = parent::process();
|
||||
die(Tools::jsonEncode(array($this->getName() => $files)));
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_);
|
||||
$admin_webpath = preg_replace('/^'.preg_quote(DIRECTORY_SEPARATOR, '/').'/', '', $admin_webpath);
|
||||
$bo_theme = ((Validate::isLoadedObject($this->getContext()->employee)
|
||||
&& $this->getContext()->employee->bo_theme) ? $this->getContext()->employee->bo_theme : 'default');
|
||||
|
||||
if (!file_exists(_PS_BO_ALL_THEMES_DIR_.$bo_theme.DIRECTORY_SEPARATOR
|
||||
.'template'))
|
||||
$bo_theme = 'default';
|
||||
|
||||
if ($this->getContext()->controller->ajax)
|
||||
{
|
||||
$html = '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/vendor/jquery.ui.widget.js"></script>';
|
||||
$html .= '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js"></script>';
|
||||
$html .= '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload.js"></script>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = '';
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/vendor/jquery.ui.widget.js');
|
||||
//$context->controller->addJs('http://blueimp.github.io/JavaScript-Load-Image/js/load-image.min.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload.js');
|
||||
/*$context->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload-image.js');*/
|
||||
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.'/js/vendor/spin.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.'/js/vendor/ladda.js');
|
||||
|
||||
}
|
||||
|
||||
if ($this->useAjax())
|
||||
$this->setTemplate(self::DEFAULT_AJAX_TEMPLATE);
|
||||
|
||||
$template = $this->getContext()->smarty->createTemplate(
|
||||
$this->getTemplateFile($this->getTemplate()), $this->getContext()->smarty
|
||||
);
|
||||
|
||||
$template->assign(array(
|
||||
'id' => $this->getId(),
|
||||
'name' => $this->getName(),
|
||||
'url' => $this->getUrl(),
|
||||
'multiple' => $this->isMultiple(),
|
||||
'display_image' => $this->displayImage(),
|
||||
'image' => $this->getImage(),
|
||||
'thumb' => $this->getThumb(),
|
||||
'size' => $this->getSize(),
|
||||
'delete_url' => $this->getDeleteUrl(),
|
||||
'title' => $this->getTitle()
|
||||
));
|
||||
|
||||
$html .= $template->fetch();
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function useAjax()
|
||||
{
|
||||
return (isset($this->_use_ajax) && $this->_use_ajax);
|
||||
}
|
||||
}
|
||||
@@ -388,6 +388,14 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$guest_group_information = sprintf($this->l('%s - Customer who placed an order with the guest checkout.'), '<b>'.$guest->name[$this->context->language->id].'</b>');
|
||||
$default_group_information = sprintf($this->l('%s - All people who have created an account on this site.'), '<b>'.$default->name[$this->context->language->id].'</b>');
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = _PS_CAT_IMG_DIR_.$obj->id.'.jpg';
|
||||
$image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350,
|
||||
$this->imageType, true, true);
|
||||
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
|
||||
$this->fields_form = array(
|
||||
'tinymce' => true,
|
||||
'legend' => array(
|
||||
@@ -402,7 +410,6 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'lang' => true,
|
||||
'required' => true,
|
||||
'class' => 'copy2friendlyUrl',
|
||||
'col' => '4',
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}',
|
||||
),
|
||||
array(
|
||||
@@ -447,15 +454,17 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'label' => $this->l('Image:'),
|
||||
'name' => 'image',
|
||||
'display_image' => true,
|
||||
'col' => '4',
|
||||
'hint' => $this->l('Upload a category logo from your computer.')
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'size' => $image_size,
|
||||
'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->id.'&token='.$this->token.'&deleteImage=1',
|
||||
'hint' => $this->l('Upload a category logo from your computer.'),
|
||||
'col' => 4
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Meta title:'),
|
||||
'name' => 'meta_title',
|
||||
'lang' => true,
|
||||
'col' => '4',
|
||||
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
@@ -463,7 +472,6 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'label' => $this->l('Meta description:'),
|
||||
'name' => 'meta_description',
|
||||
'lang' => true,
|
||||
'col' => '6',
|
||||
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
@@ -471,7 +479,6 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'label' => $this->l('Meta keywords:'),
|
||||
'name' => 'meta_keywords',
|
||||
'lang' => true,
|
||||
'col' => '6',
|
||||
'hint' => $this->l('To add "tags," click in the field, write something, and then press "Enter."').' '.$this->l('Forbidden characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
@@ -480,7 +487,6 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'name' => 'link_rewrite',
|
||||
'lang' => true,
|
||||
'required' => true,
|
||||
'col' => '4',
|
||||
'hint' => $this->l('Only letters and the minus (-) character are allowed.')
|
||||
),
|
||||
array(
|
||||
@@ -492,7 +498,6 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'unidentified' => $unidentified_group_information,
|
||||
'guest' => $guest_group_information,
|
||||
'customer' => $default_group_information,
|
||||
'col' => '6',
|
||||
'hint' => $this->l('Mark all of the customer groups you;d like to have access to this category.')
|
||||
)
|
||||
),
|
||||
|
||||
@@ -221,7 +221,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
'date_add' => array('title' => $this->l('Register date'), 'type' => 'date', 'class' => 'fixed-width-md', 'align' => 'center'),
|
||||
'active' => array('title' => $this->l('Enabled'),'align' => 'center', 'class' => 'fixed-width-sm', 'active' => 'status','type' => 'bool', 'filter_key' => 'c!active')
|
||||
));
|
||||
$this->_select = 'c.*';
|
||||
$this->_select = 'c.*, a.id_group';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (a.`id_customer` = c.`id_customer`)';
|
||||
$this->_where = 'AND a.`id_group` = '.(int)$group->id.' AND c.`deleted` != 1';
|
||||
self::$currentIndex = self::$currentIndex.'&viewgroup';
|
||||
|
||||
@@ -268,6 +268,14 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!($manufacturer = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = _PS_MANU_IMG_DIR_.$manufacturer->id.'.jpg';
|
||||
$image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$manufacturer->id.'.'.$this->imageType, 350,
|
||||
$this->imageType, true, true);
|
||||
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
|
||||
$this->fields_form = array(
|
||||
'tinymce' => true,
|
||||
'legend' => array(
|
||||
@@ -309,6 +317,8 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Logo:'),
|
||||
'name' => 'logo',
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'size' => $image_size,
|
||||
'display_image' => true,
|
||||
'col' => 6,
|
||||
'hint' => $this->l('Upload a manufacturer logo from your computer.')
|
||||
@@ -380,13 +390,6 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
'class' => 'button'
|
||||
);
|
||||
|
||||
$image = ImageManager::thumbnail(_PS_MANU_IMG_DIR_.'/'.$manufacturer->id.'.jpg', $this->table.'_'.(int)$manufacturer->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
|
||||
$this->fields_value = array(
|
||||
'image' => $image ? $image : false,
|
||||
'size' => $image ? filesize(_PS_MANU_IMG_DIR_.'/'.$manufacturer->id.'.jpg') / 1000 : false
|
||||
);
|
||||
|
||||
foreach ($this->_languages as $language)
|
||||
{
|
||||
$this->fields_value['short_description_'.$language['id_lang']] = htmlentities(stripslashes($this->getFieldValue(
|
||||
|
||||
@@ -163,6 +163,14 @@ class AdminStoresControllerCore extends AdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = _PS_STORE_IMG_DIR_.$obj->id.'.jpg';
|
||||
$image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350,
|
||||
$this->imageType, true, true);
|
||||
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Stores'),
|
||||
@@ -274,16 +282,19 @@ class AdminStoresControllerCore extends AdminController
|
||||
)
|
||||
),
|
||||
'hint' => $this->l('Whether or not to display this store')
|
||||
)
|
||||
),
|
||||
'rightCols' => array (
|
||||
'input' => array(
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Picture'),
|
||||
'name' => 'image',
|
||||
'display_image' => true,
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'size' => $image_size,
|
||||
'hint' => $this->l('Storefront picture')
|
||||
)
|
||||
),
|
||||
'hours' => array(
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'btn btn-default'
|
||||
@@ -299,15 +310,6 @@ class AdminStoresControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.$this->table.'_'.(int)$obj->id.'.'.$this->imageType)) {
|
||||
@unlink(_PS_TMP_IMG_DIR_.$this->table.'_'.(int)$obj->id.'.'.$this->imageType);
|
||||
}
|
||||
|
||||
$image = ImageManager::thumbnail(_PS_STORE_IMG_DIR_.DIRECTORY_SEPARATOR.$obj->id.'.jpg', $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true, true);
|
||||
|
||||
$days = array();
|
||||
$days[1] = $this->l('Monday');
|
||||
$days[2] = $this->l('Tuesday');
|
||||
@@ -324,8 +326,6 @@ class AdminStoresControllerCore extends AdminController
|
||||
$this->fields_value = array(
|
||||
'latitude' => $this->getFieldValue($obj, 'latitude') ? $this->getFieldValue($obj, 'latitude') : Configuration::get('PS_STORES_CENTER_LAT'),
|
||||
'longitude' => $this->getFieldValue($obj, 'longitude') ? $this->getFieldValue($obj, 'longitude') : Configuration::get('PS_STORES_CENTER_LONG'),
|
||||
'image' => $image ? $image : false,
|
||||
'size' => $image ? filesize(_PS_STORE_IMG_DIR_.DIRECTORY_SEPARATOR.$obj->id.'.jpg') / 1000 : false,
|
||||
'days' => $days,
|
||||
'hours' => isset($hours_unserialized) ? $hours_unserialized : false
|
||||
);
|
||||
|
||||
@@ -88,6 +88,11 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = _PS_SUPP_IMG_DIR_.$obj->id.'.jpg';
|
||||
$image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350,
|
||||
$this->imageType, true, true);
|
||||
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Suppliers'),
|
||||
@@ -185,6 +190,8 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
'label' => $this->l('Logo:'),
|
||||
'name' => 'logo',
|
||||
'display_image' => true,
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'size' => $image_size,
|
||||
'hint' => $this->l('Upload a supplier logo from your computer')
|
||||
),
|
||||
array(
|
||||
@@ -281,11 +288,6 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
// set logo image
|
||||
$image = ImageManager::thumbnail(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg', $this->table.'_'.(int)$this->object->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
$this->fields_value['image'] = $image ? $image : false;
|
||||
$this->fields_value['size'] = $image ? filesize(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg') / 1000 : false;
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
@@ -296,15 +298,13 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
*/
|
||||
public function initToolbar()
|
||||
{
|
||||
switch ($this->display)
|
||||
{
|
||||
default:
|
||||
parent::initToolbar();
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=suppliers',
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
}
|
||||
parent::initToolbar();
|
||||
|
||||
if (empty($this->display))
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=suppliers',
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
|
||||
@@ -133,6 +133,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
'title' => $this->l('Header logo'),
|
||||
'hint' => $this->l('Will appear on main page. Recommended height: 52px. Maximum height on default theme: 65px.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_LOGO',
|
||||
'thumb' => _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()
|
||||
),
|
||||
'PS_LOGO_MOBILE' => array(
|
||||
@@ -141,6 +142,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
((Configuration::get('PS_LOGO_MOBILE') === false) ? '<span class="light-warning">'.$this->l('Warning: No mobile logo has been defined. The header logo will be used instead.').'</span><br />' : '').
|
||||
$this->l('Will appear on the main page of your mobile template. If left undefined, the header logo will be used.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_LOGO_MOBILE',
|
||||
'thumb' => (Configuration::get('PS_LOGO_MOBILE') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MOBILE'))) ? _PS_IMG_.Configuration::get('PS_LOGO_MOBILE').'?date='.time() : _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()
|
||||
),
|
||||
'PS_LOGO_MAIL' => array(
|
||||
@@ -149,6 +151,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
((Configuration::get('PS_LOGO_MAIL') === false) ? '<span class="light-warning">'.$this->l('Warning: No email logo has been indentified. The header logo will be used instead.').'</span><br />' : '').
|
||||
$this->l('Will appear on email headers. If undefined, the header logo will be used.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_LOGO_MAIL',
|
||||
'thumb' => (Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL'))) ? _PS_IMG_.Configuration::get('PS_LOGO_MAIL').'?date='.time() : _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()
|
||||
),
|
||||
'PS_LOGO_INVOICE' => array(
|
||||
@@ -157,6 +160,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
((Configuration::get('PS_LOGO_INVOICE') === false) ? '<span class="light-warning">'.$this->l('Warning: No invoice logo has been defined. The header logo will be used instead.').'</span><br />' : '').
|
||||
$this->l('Will appear on invoice headers. If undefined, the header logo will be used.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_LOGO_INVOICE',
|
||||
'thumb' => (Configuration::get('PS_LOGO_INVOICE') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_INVOICE'))) ? _PS_IMG_.Configuration::get('PS_LOGO_INVOICE').'?date='.time() : _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()
|
||||
),
|
||||
'PS_FAVICON' => array(
|
||||
@@ -164,6 +168,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
'hint' => $this->l('Only ICO format allowed'),
|
||||
'hint' => $this->l('Will appear in the address bar of your web browser.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_FAVICON',
|
||||
'thumb' => _PS_IMG_.Configuration::get('PS_FAVICON').'?date='.time()
|
||||
),
|
||||
'PS_STORES_ICON' => array(
|
||||
@@ -171,6 +176,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
'hint' => $this->l('Only GIF format allowed.'),
|
||||
'hint' => $this->l('Will appear on the store locator (inside Google Maps).').'<br />'.$this->l('Suggested size: 30x30, Transparent GIF'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_STORES_ICON',
|
||||
'thumb' => _PS_IMG_.Configuration::get('PS_STORES_ICON').'?date='.time()
|
||||
),
|
||||
'PS_NAVIGATION_PIPE' => array(
|
||||
|
||||
@@ -708,6 +708,7 @@ function checkMultishopDefaultValue(obj, key)
|
||||
{
|
||||
$('#conf_id_'+key+' input, #conf_id_'+key+' textarea, #conf_id_'+key+' select').attr('disabled', true);
|
||||
$('#conf_id_'+key+' label.conf_title').addClass('isDisabled');
|
||||
$(obj).attr('disabled', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+11
-15
@@ -59,18 +59,18 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$('.show-forgot-password').click(function(e) {
|
||||
// Kill default behaviour
|
||||
$('.show-forgot-password').on('click',function(e) {
|
||||
e.preventDefault();
|
||||
displayForgotPassword();
|
||||
});
|
||||
|
||||
$('.show-login-form').click(function(e) {
|
||||
// Kill default behaviour
|
||||
$('.show-login-form').on('click',function(e) {
|
||||
e.preventDefault();
|
||||
displayLogin();
|
||||
});
|
||||
|
||||
$('#email').focus();
|
||||
|
||||
//Tab-index loop
|
||||
$('form').each(function(){
|
||||
var list = $(this).find('*[tabindex]').sort(function(a,b){ return a.tabIndex < b.tabIndex ? -1 : 1; }),
|
||||
@@ -84,7 +84,7 @@ $(document).ready(function() {
|
||||
});
|
||||
});
|
||||
|
||||
//todo: ladda init - move to top
|
||||
//todo: ladda init
|
||||
var l = new Object();
|
||||
function feedbackSubmit() {
|
||||
l = Ladda.create( document.querySelector( 'button[type=submit]' ) );
|
||||
@@ -127,16 +127,17 @@ function doAjaxLogin(redirect) {
|
||||
redirect: redirect,
|
||||
stay_logged_in: $('#stay_logged_in:checked').val()
|
||||
},
|
||||
beforeSend: function(){
|
||||
beforeSend: function() {
|
||||
feedbackSubmit();
|
||||
l.start();
|
||||
},
|
||||
success: function(jsonData) {
|
||||
if (jsonData.hasErrors)
|
||||
if (jsonData.hasErrors) {
|
||||
displayErrors(jsonData.errors);
|
||||
l.stop();
|
||||
else
|
||||
} else {
|
||||
window.location.assign(jsonData.redirect);
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
l.stop();
|
||||
@@ -164,9 +165,9 @@ function doAjaxForgot() {
|
||||
email_forgot: $('#email_forgot').val()
|
||||
},
|
||||
success: function(jsonData) {
|
||||
if (jsonData.hasErrors)
|
||||
if (jsonData.hasErrors) {
|
||||
displayErrors(jsonData.errors);
|
||||
else {
|
||||
} else {
|
||||
alert(jsonData.confirm);
|
||||
$('#forgot_password_form').hide();
|
||||
displayLogin();
|
||||
@@ -185,9 +186,4 @@ function displayErrors(errors) {
|
||||
for (var error in errors) //IE6 bug fix
|
||||
if (error != 'indexOf') str_errors += '<li>' + errors[error] + '</li>';
|
||||
$('#error').html(str_errors + '</ol>').removeClass('hide').fadeIn('slow');
|
||||
|
||||
|
||||
// $("#login").effect("shake", {
|
||||
// times: 4
|
||||
// }, 100);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<tr>
|
||||
<td class="space_footer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer">
|
||||
<span><?php echo t('<a href="{shop_url}">{shop_name}</a> powered by <a href="http://www.prestashop.com/">PrestaShop™</a>'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
if(!function_exists('t'))
|
||||
{
|
||||
function t($str)
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('findRelativePathToAdminDir'))
|
||||
{
|
||||
function findRelativePathToAdminDir($maxDepth=6)
|
||||
{
|
||||
$path = '';
|
||||
for($i=0; $i<$maxDepth; $i++)
|
||||
{
|
||||
foreach(scandir(dirname(__FILE__).'/'.$path) as $dir)
|
||||
{
|
||||
$candidate = $path.$dir.'/';
|
||||
if(is_dir(dirname(__FILE__).'/'.$candidate.'tabs'))
|
||||
{
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
$path .= '../';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$admin = findRelativePathToAdminDir();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title><?php echo t('Message from {shop_name}'); ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $admin ?>themes/default/css/admin-theme/email.css">
|
||||
</head>
|
||||
<body>
|
||||
<table class="table table-mail">
|
||||
<tr>
|
||||
<td class="space"> </td>
|
||||
<td align="center">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td align="center" class="logo">
|
||||
<a title="{shop_name}" href="{shop_url}">
|
||||
<img src="{shop_logo}" alt="{shop_name}" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php include ('header.php'); ?>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<span class="title"><?php echo t('Congratulations!'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box">
|
||||
<span>
|
||||
<?php echo t('Your referred friend,'); ?> <span><strong>{sponsored_firstname} {sponsored_lastname}</strong></span> <?php echo t('has placed his or her first order on <a href="{shop_url}">{shop_name}</a>!'); ?><br /><br />
|
||||
<?php echo t('We are pleased to offer you a voucher worth'); ?> <span><strong>{discount_display} (voucher # {discount_name})</strong></span> <?php echo t('that you can use on your next order.'); ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span><?php echo t('Best regards,'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php include ('footer.php'); ?>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php include ('header.php'); ?>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<span class="title">{firstname_friend} {lastname_friend}, <?php echo t('join us!'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box">
|
||||
<span>
|
||||
<?php echo t('Your friend,'); ?> <span><strong>{firstname} {lastname}</strong></span> <?php echo t('wants to refer you on <a href="{shop_url}">{shop_name}</a>!'); ?><br /><br />
|
||||
<?php echo t('We are pleased to offer you a voucher worth'); ?> <span><strong>{discount_display} (voucher # {discount_name})</strong></span> <?php echo t('that you can use on your next order.'); ?><br /><br />
|
||||
<?php echo t('Get referred and earn a discount voucher of'); ?> <span><strong>{discount}!</strong></span>
|
||||
<a title="Register" href="{link}"><?php echo t('It's very easy to sign up. Just click here!'); ?></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span><?php echo t('When signing up, don't forget to provide the e-mail address of your referring friend:'); ?> <span><strong>{email}</strong></span>.<br/><br/>
|
||||
<span><?php echo t('Best regards,'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php include ('footer.php'); ?>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php include ('header.php'); ?>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<span class="title"><?php echo t('Hi {firstname} {lastname},'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box">
|
||||
<p>
|
||||
<?php echo t('Referral Program'); ?>
|
||||
</p>
|
||||
<span>
|
||||
<?php echo t('We have created a voucher in your name for referring a friend.'); ?><br />
|
||||
<?php echo t('Here is the code of your voucher:'); ?> <span><strong>{voucher_num}</strong></span><?php echo t(', with an amount of'); ?> <span><strong>{voucher_amount}</strong></span>.<br /><br />
|
||||
<?php echo t('Simply copy/paste this code during the payment process for your next order.'); ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php include ('footer.php'); ?>
|
||||
@@ -0,0 +1,15 @@
|
||||
<tr>
|
||||
<td class="space_footer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer">
|
||||
<span><?php echo t('<a href="{shop_url}">{shop_name}</a> powered by <a href="http://www.prestashop.com/">PrestaShop™</a>'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
if(!function_exists('t'))
|
||||
{
|
||||
function t($str)
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('findRelativePathToAdminDir'))
|
||||
{
|
||||
function findRelativePathToAdminDir($maxDepth=6)
|
||||
{
|
||||
$path = '';
|
||||
for($i=0; $i<$maxDepth; $i++)
|
||||
{
|
||||
foreach(scandir(dirname(__FILE__).'/'.$path) as $dir)
|
||||
{
|
||||
$candidate = $path.$dir.'/';
|
||||
if(is_dir(dirname(__FILE__).'/'.$candidate.'tabs'))
|
||||
{
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
$path .= '../';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$admin = findRelativePathToAdminDir();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title><?php echo t('Message from {shop_name}'); ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $admin ?>themes/default/css/admin-theme/email.css">
|
||||
</head>
|
||||
<body>
|
||||
<table class="table table-mail">
|
||||
<tr>
|
||||
<td class="space"> </td>
|
||||
<td align="center">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td align="center" class="logo">
|
||||
<a title="{shop_name}" href="{shop_url}">
|
||||
<img src="{shop_logo}" alt="{shop_name}" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php include ('header.php'); ?>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<span class="title"><?php echo t('Hi {name},'); ?></span><br/>
|
||||
<span class="subtitle"><?php echo t('Thank you for creating a customer account at {shop_name}.'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box">
|
||||
<p>
|
||||
{customer} <?php echo t('has sent you a link to a product that (s)he thinks may interest you.'); ?>
|
||||
</p>
|
||||
<span>
|
||||
<?php echo t('Click here to view this item:'); ?> <a href="{product_link}">{product}</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php include ('footer.php'); ?>
|
||||
Reference in New Issue
Block a user