Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -116,12 +116,19 @@ 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
|
||||
|
||||
|
||||
//colors
|
||||
.attributes-color-container
|
||||
width: 40px
|
||||
height: 25px
|
||||
display: block
|
||||
border: solid 1px black
|
||||
|
||||
|
||||
//todo: fix focus firefox
|
||||
*:focus
|
||||
outline: none!important
|
||||
-moz-outline: none!important
|
||||
-moz-user-focus: ignore!important
|
||||
|
||||
//components
|
||||
@import "admin-theme/admin-header"
|
||||
@@ -142,3 +149,4 @@ input[type="text"],input[type="search"],input[type="password"], textarea, select
|
||||
@import "admin-theme/admin-carrier-wizard"
|
||||
@import "admin-theme/admin-modules"
|
||||
@import "admin-theme/admin-dashboard"
|
||||
@import "admin-theme/admin-search"
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
.adminsearch
|
||||
#content
|
||||
.panel .panel
|
||||
padding: 0
|
||||
margin: 0
|
||||
border: none
|
||||
@include border-radius(0)
|
||||
@include box-shadow(0)
|
||||
@@ -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>
|
||||
|
||||
@@ -1085,20 +1085,34 @@
|
||||
|
||||
<ul id="old_carts_orders_navtab" class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a href="#lastOrders" data-toggle="tab">
|
||||
<i class="icon-credit-card"></i>
|
||||
{l s='Orders'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#nonOrderedCarts" data-toggle="tab">
|
||||
<i class="icon-shopping-cart"></i>
|
||||
{l s='Carts'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#lastOrders" data-toggle="tab">
|
||||
<i class="icon-credit-card"></i>
|
||||
{l s='Orders'}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="old_carts_orders" class="tab-content panel collapse in">
|
||||
<div id="lastOrders" class="tab-pane active">
|
||||
<div id="nonOrderedCarts" class="tab-pane active">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box">{l s='ID'}</span></th>
|
||||
<th><span class="title_box">{l s='Date'}</span></th>
|
||||
<th><span class="title_box">{l s='Total'}</span></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="lastOrders" class="tab-pane">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -1115,20 +1129,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="nonOrderedCarts" class="tab-pane">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box">{l s='ID'}</span></th>
|
||||
<th><span class="title_box">{l s='Date'}</span></th>
|
||||
<th><span class="title_box">{l s='Total'}</span></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+4
-2
@@ -22,8 +22,10 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if isset($actions)}
|
||||
<div class="tree-actions col-lg-12">
|
||||
{if isset($actions)}
|
||||
{foreach from=$actions item=action}
|
||||
{$action->render()}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
@@ -29,19 +29,32 @@ $(function() {
|
||||
});
|
||||
</script>
|
||||
|
||||
{if isset($features)}
|
||||
<div class="panel">
|
||||
{if !$features}
|
||||
<h3>{l s='No features matching your query'} : {$query}</h3>
|
||||
{if !$nb_results}
|
||||
<h2>{l s='There are no results matching your query "%s".' sprintf=$query}</h2>
|
||||
{else}
|
||||
<h2>
|
||||
{if $nb_results == 1}
|
||||
{l s='1 result matches your query "%s".' sprintf=$query}
|
||||
{else}
|
||||
<h3>{l s='Features matching your query'} : {$query}</h3>
|
||||
{l s='%d results match your query "%s".' sprintf=[$nb_results|intval, $query]}
|
||||
{/if}
|
||||
</h2>
|
||||
|
||||
{if isset($features)}
|
||||
<div class="panel">
|
||||
<h3>
|
||||
{if $features|@count == 1}
|
||||
{l s='1 feature'}
|
||||
{else}
|
||||
{l s='%d features' sprintf=$features|@count}
|
||||
{/if}
|
||||
</h3>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
{foreach $features key=key item=feature}
|
||||
{foreach $feature key=k item=val name=feature_list}
|
||||
<tr>
|
||||
<td><strong>{if $smarty.foreach.feature_list.first}{$key}{/if}</strong></td>
|
||||
|
||||
<td>
|
||||
<a href="{$val.link}">{$val.value}</a>
|
||||
</td>
|
||||
@@ -50,16 +63,18 @@ $(function() {
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{if isset($modules)}
|
||||
{if isset($modules) && $modules}
|
||||
<div class="panel">
|
||||
{if !$modules}
|
||||
<h3>{l s='No modules matching your query'} : {$query}</h3>
|
||||
{else}
|
||||
<h3>{l s='Modules matching your query'} : {$query}</h3>
|
||||
<h3>
|
||||
{if $modules|@count == 1}
|
||||
{l s='1 module'}
|
||||
{else}
|
||||
{l s='%d modules' sprintf=$modules|@count}
|
||||
{/if}
|
||||
</h3>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
{foreach $modules key=key item=module}
|
||||
@@ -70,16 +85,18 @@ $(function() {
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{if isset($categories)}
|
||||
{if isset($categories) && $categories}
|
||||
<div class="panel">
|
||||
{if !$categories}
|
||||
<h3>{l s='No categories matching your query'} : {$query}</h3>
|
||||
{else}
|
||||
<h3>{l s='Categories matching your query'} : {$query}</h3>
|
||||
<h3>
|
||||
{if $categories|@count == 1}
|
||||
{l s='1 category'}
|
||||
{else}
|
||||
{l s='%d categories' sprintf=$categories|@count}
|
||||
{/if}
|
||||
</h3>
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
{foreach $categories key=key item=category}
|
||||
<tr class="alt_row">
|
||||
@@ -87,39 +104,45 @@ $(function() {
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{if isset($products)}
|
||||
{if isset($products) && $products}
|
||||
<div class="panel">
|
||||
{if !$products}
|
||||
<h3>{l s='There are no products matching your query'} : {$query}</h3>
|
||||
{else}
|
||||
<h3>{l s='Products matching your query'} : {$query}</h3>
|
||||
<h3>
|
||||
{if $products|@count == 1}
|
||||
{l s='1 product'}
|
||||
{else}
|
||||
{l s='%d products' sprintf=$products|@count}
|
||||
{/if}
|
||||
</h3>
|
||||
{$products}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{if isset($customers)}
|
||||
{if isset($customers) && $customers}
|
||||
<div class="panel">
|
||||
{if !$customers}
|
||||
<h3>{l s='There are no customers matching your query'} : {$query}</h3>
|
||||
{else}
|
||||
<h3>{l s='Customers matching your query'} : {$query}</h3>
|
||||
<h3>
|
||||
{if $customers|@count == 1}
|
||||
{l s='1 customer'}
|
||||
{else}
|
||||
{l s='%d customers' sprintf=$customers|@count}
|
||||
{/if}
|
||||
</h3>
|
||||
{$customers}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{if isset($orders)}
|
||||
{if isset($orders) && $orders}
|
||||
<div class="panel">
|
||||
{if !$orders}
|
||||
<h3>{l s='There are no orders matching your query'} : {$query}</h3>
|
||||
{else}
|
||||
<h3>{l s='Orders matching your query'} : {$query}</h3>
|
||||
<h3>
|
||||
{if $orders|@count == 1}
|
||||
{l s='1 order'}
|
||||
{else}
|
||||
{l s='%d orders' sprintf=$orders|@count}
|
||||
{/if}
|
||||
</h3>
|
||||
{$orders}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -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}
|
||||
@@ -105,7 +105,7 @@
|
||||
</head>
|
||||
|
||||
{if $display_header}
|
||||
<body class="{if $employee->bo_menu}page-sidebar {* page-sidebar-closed *}{else}page-topbar{/if}">
|
||||
<body class="{if $employee->bo_menu}page-sidebar {* page-sidebar-closed *}{else}page-topbar{/if} {$smarty.get.controller|escape|strtolower}">
|
||||
|
||||
{* begin HEADER *}
|
||||
<header id="header">
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{if $key == 'legend'}
|
||||
<h3>
|
||||
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title|escape:'htmlall':'UTF-8'}" />{/if}
|
||||
{if isset($field.icon)}<i class="{$field.icon}"/></i>{/if}
|
||||
{if isset($field.icon)}<i class="{$field.icon}"></i>{/if}
|
||||
{$field.title}
|
||||
</h3>
|
||||
{elseif $key == 'description' && $field}
|
||||
@@ -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,10 +504,12 @@
|
||||
{$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}
|
||||
{$asso_shop}
|
||||
{$asso_shop}
|
||||
{elseif $input.type == 'color'}
|
||||
<div class="col-lg-2">
|
||||
<div class="row">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<div class="panel-heading">
|
||||
<div class="tree-panel-heading-controls">
|
||||
<!-- <i class="icon-tag"></i> {l s=$title} -->
|
||||
{if isset($toolbar)}{$toolbar}{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,133 @@
|
||||
{*
|
||||
* 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}
|
||||
{if isset($image.image)}
|
||||
<div class="img-thumbnail text-center">
|
||||
<p>{$image.image}</p>
|
||||
{if isset($image.size)}<p>{l s='File size'} {$image.size}kb</p>{/if}
|
||||
{if isset($image.delete_url)}
|
||||
<p>
|
||||
<a class="btn btn-default" href="{$image.delete_url}">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</a>
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
<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>
|
||||
<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,
|
||||
limitMultiFileUploads: 3,
|
||||
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,105 @@
|
||||
{*
|
||||
* 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}
|
||||
{if isset($image.image)}
|
||||
<div class="img-thumbnail text-center">
|
||||
<p>{$image.image}</p>
|
||||
{if isset($image.size)}<p>{l s='File size'} {$image.size}kb</p>{/if}
|
||||
{if isset($image.delete_url)}
|
||||
<p>
|
||||
<a class="btn btn-default" href="{$image.delete_url}">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</a>
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/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>
|
||||
{if isset($file)}
|
||||
<a href="{$file}">
|
||||
<button type="button" class="btn btn-default">
|
||||
<i class="icon-cloud-download"></i>
|
||||
{if isset($size)}{l s='Download current file (%skb)' sprintf=$size}{else}{l s='Download current file'}{/if}
|
||||
</button>
|
||||
</a>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#{$id}-selectbutton').click(function(e) {
|
||||
$('#{$id}').trigger('click');
|
||||
});
|
||||
|
||||
$('#{$id}-name').click(function(e) {
|
||||
$('#{$id}').trigger('click');
|
||||
});
|
||||
|
||||
$('#{$id}').change(function(e) {
|
||||
if ($(this)[0].files !== undefined)
|
||||
{
|
||||
var files = $(this)[0].files;
|
||||
var name = '';
|
||||
|
||||
$.each(files, function(index, value) {
|
||||
name += value.name+', ';
|
||||
});
|
||||
|
||||
$('#{$id}-name').val(name.slice(0, -2));
|
||||
}
|
||||
else // Internet Explorer 9 Compatibility
|
||||
{
|
||||
var name = $(this).val().split(/[\\/]/);
|
||||
$('#{$id}-name').val(name[name.length-1]);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -22,7 +22,7 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{$header}
|
||||
{if isset($conf)}
|
||||
<div class="alert alert-success">
|
||||
{$conf}
|
||||
@@ -91,3 +91,4 @@
|
||||
{if !$bootstrap}<div id="nobootstrap">{/if}
|
||||
{$page}
|
||||
{if !$bootstrap}</div>{/if}
|
||||
{$footer}
|
||||
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' => '',
|
||||
|
||||
@@ -106,8 +106,8 @@ class AttachmentCore extends ObjectModel
|
||||
public static function deleteProductAttachments($id_product)
|
||||
{
|
||||
$res = Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'product_attachment
|
||||
WHERE id_product = '.(int)$id_product);
|
||||
DELETE FROM '._DB_PREFIX_.'product_attachment
|
||||
WHERE id_product = '.(int)$id_product);
|
||||
|
||||
Product::updateCacheAttachment((int)$id_product);
|
||||
|
||||
|
||||
@@ -396,8 +396,10 @@ class DispatcherCore
|
||||
$this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details);
|
||||
}
|
||||
|
||||
if (!in_array($context->language->id, $languages = Language::getLanguages()))
|
||||
$languages[] = (int)$context->language->id;
|
||||
// Set default routes
|
||||
foreach (Language::getLanguages() as $lang)
|
||||
foreach ($languages as $lang)
|
||||
foreach ($this->default_routes as $id => $route)
|
||||
$this->addRoute(
|
||||
$id,
|
||||
@@ -441,7 +443,10 @@ class DispatcherCore
|
||||
// Load custom routes
|
||||
foreach ($this->default_routes as $route_id => $route_data)
|
||||
if ($custom_route = Configuration::get('PS_ROUTE_'.$route_id, null, null, $id_shop))
|
||||
foreach (Language::getLanguages() as $lang)
|
||||
{
|
||||
if (!in_array($context->language->id, $languages = Language::getLanguages()))
|
||||
$languages[] = (int)$context->language->id;
|
||||
foreach ($languages as $lang)
|
||||
$this->addRoute(
|
||||
$route_id,
|
||||
$custom_route,
|
||||
@@ -451,6 +456,7 @@ class DispatcherCore
|
||||
isset($route_data['params']) ? $route_data['params'] : array(),
|
||||
$id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,7 +599,7 @@ class DispatcherCore
|
||||
$id_lang = (int)Context::getContext()->language->id;
|
||||
if ($id_shop === null)
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
|
||||
|
||||
if (!isset($this->routes[$id_shop]))
|
||||
$this->loadRoutes($id_shop);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -682,6 +682,7 @@ class AdminControllerCore extends Controller
|
||||
'export_content' => $content
|
||||
)
|
||||
);
|
||||
|
||||
$this->layout = 'layout-export.tpl';
|
||||
}
|
||||
|
||||
@@ -1372,12 +1373,14 @@ class AdminControllerCore extends Controller
|
||||
foreach (array('errors', 'warnings', 'informations', 'confirmations') as $type)
|
||||
$this->context->smarty->assign($type, $this->json ? Tools::jsonEncode(array_unique($this->$type)) : array_unique($this->$type));
|
||||
|
||||
$this->context->smarty->assign('page', $this->json ? Tools::jsonEncode($page) : $page);
|
||||
|
||||
if (!$this->ajax)
|
||||
$this->smartyOutputContent(array($header_tpl, $this->layout, $footer_tpl));
|
||||
else
|
||||
$this->smartyOutputContent($this->layout);
|
||||
$this->context->smarty->assign(array(
|
||||
'page' => $this->json ? Tools::jsonEncode($page) : $page,
|
||||
'header' => $this->context->smarty->fetch($header_tpl),
|
||||
'footer' => $this->context->smarty->fetch($footer_tpl)
|
||||
)
|
||||
);
|
||||
|
||||
$this->smartyOutputContent($this->layout);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,31 @@ 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);
|
||||
|
||||
if (isset($params['images']))
|
||||
$uploader->setImages($params['images']);
|
||||
elseif (isset($params['image'])) // Use for retrocompatibility
|
||||
$uploader->setImages(array(
|
||||
0 => array(
|
||||
'image' => isset($params['image'])?$params['image']:null,
|
||||
'size' => isset($params['size'])?$params['size']:null,
|
||||
'delete_url' => isset($params['delete_url'])?$params['delete_url']:null
|
||||
)));
|
||||
|
||||
$uploader->setThumb(isset($params['thumb'])?$params['thumb']:null);
|
||||
$uploader->setFile(isset($params['file'])?$params['file']:null);
|
||||
$uploader->setTitle(isset($params['title'])?$params['title']:null);
|
||||
|
||||
$params['file'] = $uploader->render();
|
||||
break;
|
||||
|
||||
case 'color':
|
||||
if ($color)
|
||||
{
|
||||
|
||||
@@ -95,7 +95,31 @@ 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);
|
||||
|
||||
if (isset($field['images']))
|
||||
$uploader->setImages($field['images']);
|
||||
elseif (isset($field['image'])) // Use for retrocompatibility
|
||||
$uploader->setImages(array(
|
||||
0 => array(
|
||||
'image' => isset($field['image'])?$field['image']:null,
|
||||
'size' => isset($field['size'])?$field['size']:null,
|
||||
'delete_url' => isset($field['delete_url'])?$field['delete_url']:null
|
||||
)));
|
||||
|
||||
$uploader->setThumb(isset($field['thumb'])?$field['thumb']:null);
|
||||
$uploader->setTitle(isset($field['title'])?$field['title']:null);
|
||||
$field['file'] = $uploader->render();
|
||||
}
|
||||
|
||||
// Cast options values if specified
|
||||
if ($field['type'] == 'select' && isset($field['cast']))
|
||||
foreach ($field['list'] as $option_key => $option)
|
||||
|
||||
@@ -0,0 +1,295 @@
|
||||
<?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 $_id;
|
||||
private $_images;
|
||||
private $_name;
|
||||
private $_multiple;
|
||||
private $_file;
|
||||
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 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 setImages($value)
|
||||
{
|
||||
$this->_images = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImages()
|
||||
{
|
||||
if (!isset($this->_images))
|
||||
$this->_images = array();
|
||||
|
||||
return $this->_images;
|
||||
}
|
||||
|
||||
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 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 setFile($value)
|
||||
{
|
||||
$this->_file = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFile()
|
||||
{
|
||||
return $this->_file;
|
||||
}
|
||||
|
||||
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 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(),
|
||||
'images' => $this->getImages(),
|
||||
'thumb' => $this->getThumb(),
|
||||
'file' => $this->getFile(),
|
||||
'title' => $this->getTitle()
|
||||
));
|
||||
|
||||
$html .= $template->fetch();
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function useAjax()
|
||||
{
|
||||
return (isset($this->_use_ajax) && $this->_use_ajax);
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,9 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
$this->_select = 'IFNULL(virtual.products, 0) as products';
|
||||
$this->_join = 'LEFT JOIN (SELECT id_attachment, COUNT(*) as products FROM '._DB_PREFIX_.'product_attachment GROUP BY id_attachment) virtual ON a.id_attachment = virtual.id_attachment';
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_attachment' => array(
|
||||
'title' => $this->l('ID'),
|
||||
@@ -50,7 +53,12 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
),
|
||||
'file' => array(
|
||||
'title' => $this->l('File')
|
||||
)
|
||||
),
|
||||
'products' => array(
|
||||
'title' => $this->l('Associated to'),
|
||||
'suffix' => $this->l('product(s)'),
|
||||
'filter_key' => 'virtual!products',
|
||||
),
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
@@ -70,6 +78,12 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj))
|
||||
{
|
||||
$link = $this->context->link->getPageLink('attachment', true, NULL, 'id_attachment='.$obj->id);
|
||||
$size = round(filesize(_PS_DOWNLOAD_DIR_.$obj->file) / 1024);
|
||||
}
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Attachment'),
|
||||
@@ -82,22 +96,26 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'lang' => true,
|
||||
'col' => 4
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Description:'),
|
||||
'name' => 'description',
|
||||
'lang' => true,
|
||||
'col' => 6
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'file' => isset($link) ? $link : null,
|
||||
'size' => isset($size) ? $size : null,
|
||||
'label' => $this->l('File:'),
|
||||
'name' => 'file',
|
||||
'hint' => $this->l('Upload a file from your computer.')
|
||||
'col' => 6
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save '),
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
|
||||
@@ -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.')
|
||||
)
|
||||
),
|
||||
|
||||
@@ -70,26 +70,33 @@ class AdminCmsControllerCore extends AdminController
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
$this->page_header_toolbar_btn['save-and-preview'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and preview')
|
||||
);
|
||||
$this->page_header_toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
|
||||
return parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!$this->loadObject(true))
|
||||
return;
|
||||
|
||||
|
||||
if (Validate::isLoadedObject($this->object))
|
||||
$this->display = 'edit';
|
||||
else
|
||||
$this->display = 'add';
|
||||
|
||||
$this->toolbar_btn['save-and-preview'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and preview')
|
||||
);
|
||||
$this->toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
$this->initToolbar();
|
||||
$this->initPageHeaderToolbar();
|
||||
|
||||
$categories = CMSCategory::getCategories($this->context->language->id, false);
|
||||
$html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1);
|
||||
@@ -226,16 +233,7 @@ class AdminCmsControllerCore extends AdminController
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('viewcms') && ($id_cms = (int)Tools::getValue('id_cms')) && ($cms = new CMS($id_cms, $this->context->language->id)) && Validate::isLoadedObject($cms))
|
||||
{
|
||||
$redir = $this->context->link->getCMSLink($cms);
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
|
||||
$redir .= '?adtoken='.Tools::getAdminTokenLite('AdminCmsContent').'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
|
||||
}
|
||||
Tools::redirectAdmin($redir);
|
||||
}
|
||||
$this->redirect_after = $this->getPreviewUrl($cms);
|
||||
elseif (Tools::isSubmit('deletecms'))
|
||||
{
|
||||
if (Tools::getValue('id_cms') == Configuration::get('PS_CONDITIONS_CMS_ID'))
|
||||
@@ -301,27 +299,7 @@ class AdminCmsControllerCore extends AdminController
|
||||
$this->updateAssoShop($cms->id);
|
||||
}
|
||||
if (Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
{
|
||||
$alias = $this->getFieldValue($cms, 'link_rewrite', $this->context->language->id);
|
||||
$preview_url = $this->context->link->getCMSLink($cms, $alias, $this->context->language->id);
|
||||
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
|
||||
$params = http_build_query(array(
|
||||
'adtoken' => Tools::getAdminTokenLite('AdminCmsContent'),
|
||||
'ad' => $admin_dir,
|
||||
'id_employee' => (int)$this->context->employee->id)
|
||||
);
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS'))
|
||||
$params = '?'.$params;
|
||||
else
|
||||
$params = '&'.$params;
|
||||
$preview_url .= $cms->active ? '' : $params;
|
||||
}
|
||||
Tools::redirectAdmin($preview_url);
|
||||
}
|
||||
$this->redirect_after = $this->previewUrl($cms);
|
||||
elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$cms->id.'&conf=4&update'.$this->table.'&token='.Tools::getAdminTokenLite('AdminCmsContent'));
|
||||
else
|
||||
@@ -380,6 +358,23 @@ class AdminCmsControllerCore extends AdminController
|
||||
else
|
||||
parent::postProcess(true);
|
||||
}
|
||||
|
||||
public function getPreviewUrl(CMS $cms)
|
||||
{
|
||||
$preview_url = $this->context->link->getCMSLink($cms, null, null, $this->context->language->id);
|
||||
if (!$cms->active)
|
||||
{
|
||||
$params = http_build_query(array(
|
||||
'adtoken' => Tools::getAdminTokenLite('AdminCmsContent'),
|
||||
'ad' => substr(dirname($_SERVER['PHP_SELF']), strrpos(dirname($_SERVER['PHP_SELF']), '/') + 1),
|
||||
'id_employee' => (int)$this->context->employee->id
|
||||
)
|
||||
);
|
||||
$preview_url .= (strpos($preview_url, '?') === false ? '?' : '&').$params;
|
||||
}
|
||||
|
||||
return $preview_url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -2430,11 +2430,58 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (empty($this->display))
|
||||
$this->page_header_toolbar_btn['new_product'] = array(
|
||||
'href' => self::$currentIndex.'&addproduct&token='.$this->token,
|
||||
'desc' => $this->l('Add new product'),
|
||||
'icon' => 'process-icon-new'
|
||||
);
|
||||
'href' => self::$currentIndex.'&addproduct&token='.$this->token,
|
||||
'desc' => $this->l('Add new product'),
|
||||
'icon' => 'process-icon-new'
|
||||
);
|
||||
if ($this->display == 'edit' || $this->display == 'add')
|
||||
{
|
||||
if (($product = $this->loadObject(true)))
|
||||
{
|
||||
// adding button for duplicate this product
|
||||
if ($this->tabAccess['add'] && $this->display != 'add')
|
||||
$this->page_header_toolbar_btn['duplicate'] = array(
|
||||
'short' => 'Duplicate',
|
||||
'desc' => $this->l('Duplicate'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Also copy images').' ?\')) document.location = \''.$this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&duplicateproduct\'; else document.location = \''.$this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&duplicateproduct&noimage=1\';'
|
||||
);
|
||||
|
||||
// adding button for preview this product
|
||||
if ($url_preview = $this->getPreviewUrl($product))
|
||||
$this->page_header_toolbar_btn['preview'] = array(
|
||||
'short' => 'Preview',
|
||||
'href' => $url_preview,
|
||||
'desc' => $this->l('Preview'),
|
||||
'target' => true,
|
||||
'class' => 'previewUrl'
|
||||
);
|
||||
|
||||
// adding button for preview this product statistics
|
||||
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php') && $this->display != 'add')
|
||||
$this->page_header_toolbar_btn['stats'] = array(
|
||||
'short' => 'Statistics',
|
||||
'href' => $this->context->link->getAdminLink('AdminStats').'&module=statsproduct&id_product='.(int)$product->id,
|
||||
'desc' => $this->l('Product sales'),
|
||||
);
|
||||
|
||||
// adding button for delete this product
|
||||
if ($this->tabAccess['delete'] && $this->display != 'add')
|
||||
$this->page_header_toolbar_btn['delete'] = array(
|
||||
'short' => 'Delete',
|
||||
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&deleteproduct',
|
||||
'desc' => $this->l('Delete this product'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Delete product?').'\')){return true;}else{event.preventDefault();}'
|
||||
);
|
||||
|
||||
$this->page_header_toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
}
|
||||
}
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
@@ -2443,76 +2490,25 @@ class AdminProductsControllerCore extends AdminController
|
||||
parent::initToolbar();
|
||||
if ($this->display == 'edit' || $this->display == 'add')
|
||||
{
|
||||
if ($product = $this->loadObject(true))
|
||||
{
|
||||
if ($this->tabAccess['edit'])
|
||||
{
|
||||
$this->toolbar_btn['save'] = array(
|
||||
'short' => 'Save',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save'),
|
||||
);
|
||||
$this->toolbar_btn['save'] = array(
|
||||
'short' => 'Save',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save'),
|
||||
);
|
||||
|
||||
$this->toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
}
|
||||
$this->toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
|
||||
if ((bool)$product->id)
|
||||
{
|
||||
// adding button for duplicate this product
|
||||
if ($this->tabAccess['add'] && $this->display != 'add')
|
||||
$this->toolbar_btn['duplicate'] = array(
|
||||
'short' => 'Duplicate',
|
||||
'desc' => $this->l('Duplicate'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Also copy images').' ?\')) document.location = \''.$this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&duplicateproduct\'; else document.location = \''.$this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&duplicateproduct&noimage=1\';'
|
||||
);
|
||||
|
||||
// adding button for preview this product
|
||||
if ($url_preview = $this->getPreviewUrl($product))
|
||||
$this->toolbar_btn['preview'] = array(
|
||||
'short' => 'Preview',
|
||||
'href' => $url_preview,
|
||||
'desc' => $this->l('Preview'),
|
||||
'target' => true,
|
||||
'class' => 'previewUrl'
|
||||
);
|
||||
|
||||
// adding button for preview this product statistics
|
||||
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php') && $this->display != 'add')
|
||||
$this->toolbar_btn['stats'] = array(
|
||||
'short' => 'Statistics',
|
||||
'href' => $this->context->link->getAdminLink('AdminStats').'&module=statsproduct&id_product='.(int)$product->id,
|
||||
'desc' => $this->l('Product sales'),
|
||||
);
|
||||
|
||||
// adding button for adding a new combination in Combination tab
|
||||
$this->toolbar_btn['newCombination'] = array(
|
||||
'short' => 'New combination',
|
||||
'desc' => $this->l('New combination'),
|
||||
'class' => 'toolbar-new'
|
||||
);
|
||||
|
||||
// adding button for delete this product
|
||||
if ($this->tabAccess['delete'] && $this->display != 'add')
|
||||
$this->toolbar_btn['delete'] = array(
|
||||
'short' => 'Delete',
|
||||
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&deleteproduct',
|
||||
'desc' => $this->l('Delete this product'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Delete product?').'\')){return true;}else{event.preventDefault();}'
|
||||
);
|
||||
}
|
||||
}
|
||||
// adding button for adding a new combination in Combination tab
|
||||
$this->toolbar_btn['newCombination'] = array(
|
||||
'short' => 'New combination',
|
||||
'desc' => $this->l('New combination'),
|
||||
'class' => 'toolbar-new'
|
||||
);
|
||||
}
|
||||
else
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=products',
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
|
||||
$this->context->smarty->assign('toolbar_scroll', 1);
|
||||
$this->context->smarty->assign('show_toolbar', 1);
|
||||
|
||||
@@ -217,8 +217,10 @@ class AdminSearchControllerCore extends AdminController
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT class_name, name
|
||||
FROM '._DB_PREFIX_.'tab t
|
||||
INNER JOIN '._DB_PREFIX_.'tab_lang tl ON (t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$this->context->language->id.')
|
||||
WHERE active = 1');
|
||||
INNER JOIN '._DB_PREFIX_.'tab_lang tl ON (t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$this->context->employee->id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'access a ON (a.id_tab = t.id_tab AND a.id_profile = '.(int)$this->context->employee->id_profile.')
|
||||
WHERE active = 1
|
||||
'.($this->context->employee->id_profile != 1 ? 'AND view = 1' : ''));
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$tabs[strtolower($row['class_name'])] = $row['name'];
|
||||
@@ -227,6 +229,8 @@ class AdminSearchControllerCore extends AdminController
|
||||
foreach (AdminTab::$tabParenting as $key => $value)
|
||||
{
|
||||
$value = stripslashes($value);
|
||||
if (!isset($tabs[strtolower($key)]) || !isset($tabs[strtolower($value)]))
|
||||
continue;
|
||||
$tabs[strtolower($key)] = $tabs[strtolower($value)];
|
||||
$key_match[strtolower($key)] = $key;
|
||||
}
|
||||
@@ -324,16 +328,22 @@ class AdminSearchControllerCore extends AdminController
|
||||
return parent::renderView();
|
||||
else
|
||||
{
|
||||
if (isset($this->_list['features']))
|
||||
$nb_results = 0;
|
||||
foreach ($this->_list as $list)
|
||||
if ($list != false)
|
||||
$nb_results += count($list);
|
||||
$this->tpl_view_vars['nb_results'] = $nb_results;
|
||||
|
||||
if (isset($this->_list['features']) && count($this->_list['features']))
|
||||
$this->tpl_view_vars['features'] = $this->_list['features'];
|
||||
if (isset($this->_list['categories']))
|
||||
if (isset($this->_list['categories']) && count($this->_list['categories']))
|
||||
{
|
||||
$categories = array();
|
||||
foreach ($this->_list['categories'] as $category)
|
||||
$categories[] = getPath($this->context->link->getAdminLink('AdminCategories', false), $category['id_category']);
|
||||
$this->tpl_view_vars['categories'] = $categories;
|
||||
}
|
||||
if (isset($this->_list['products']))
|
||||
if (isset($this->_list['products']) && count($this->_list['products']))
|
||||
{
|
||||
$view = '';
|
||||
$this->initProductList();
|
||||
@@ -353,7 +363,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
|
||||
$this->tpl_view_vars['products'] = $view;
|
||||
}
|
||||
if (isset($this->_list['customers']))
|
||||
if (isset($this->_list['customers']) && count($this->_list['customers']))
|
||||
{
|
||||
$view = '';
|
||||
$this->initCustomerList();
|
||||
@@ -376,7 +386,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
}
|
||||
$this->tpl_view_vars['customers'] = $view;
|
||||
}
|
||||
if (isset($this->_list['orders']))
|
||||
if (isset($this->_list['orders']) && count($this->_list['orders']))
|
||||
{
|
||||
$view = '';
|
||||
$this->initOrderList();
|
||||
@@ -396,7 +406,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
$this->tpl_view_vars['orders'] = $view;
|
||||
}
|
||||
|
||||
if (isset($this->_list['modules']))
|
||||
if (isset($this->_list['modules']) && count($this->_list['modules']))
|
||||
$this->tpl_view_vars['modules'] = $this->_list['modules'];
|
||||
|
||||
return parent::renderView();
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -29,7 +29,7 @@ define ('TEXTAREA_SIZED', 70);
|
||||
class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
/** Name of theme by default */
|
||||
const DEFAULT_THEME_NAME = 'default';
|
||||
const DEFAULT_THEME_NAME = 'default-bootstrap';
|
||||
|
||||
/** @var string : Link which list all pack of language */
|
||||
protected $link_lang_pack = 'http://www.prestashop.com/download/lang_packs/get_each_language_pack.php';
|
||||
|
||||
@@ -47,7 +47,7 @@ if (!defined('__PS_BASE_URI__'))
|
||||
define('__PS_BASE_URI__', substr($_SERVER['REQUEST_URI'], 0, -1 * (strlen($_SERVER['REQUEST_URI']) - strrpos($_SERVER['REQUEST_URI'], '/')) - strlen(substr(dirname($_SERVER['REQUEST_URI']), strrpos(dirname($_SERVER['REQUEST_URI']), '/') + 1))));
|
||||
|
||||
if (!defined('_THEME_NAME_'))
|
||||
define('_THEME_NAME_', 'default');
|
||||
define('_THEME_NAME_', 'default-bootstrap');
|
||||
|
||||
require_once(dirname(_PS_INSTALL_PATH_).'/config/defines.inc.php');
|
||||
require_once(dirname(_PS_INSTALL_PATH_).'/config/defines_uri.inc.php');
|
||||
|
||||
@@ -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