',c=b.createElement(d),"FORM"!==this.element.tagName?(e=b.createElement(''),e.appendChild(c)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=e?e:c)},b.prototype.getExistingFallback=function(){var a,b,c,d,e,f;for(b=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c],/(^| )fallback($| )/.test(b.className))return b},f=["div","form"],d=0,e=f.length;e>d;d++)if(c=f[d],a=b(this.element.getElementsByTagName(c)))return a},b.prototype.setupEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.addEventListener(b,c,!1));return e}());return g},b.prototype.removeEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.removeEventListener(b,c,!1));return e}());return g},b.prototype.disable=function(){var a,b,c,d,e;for(this.clickableElements.forEach(function(a){return a.classList.remove("dz-clickable")}),this.removeEventListeners(),d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(this.cancelUpload(a));return e},b.prototype.enable=function(){return this.clickableElements.forEach(function(a){return a.classList.add("dz-clickable")}),this.setupEventListeners()},b.prototype.filesize=function(a){var b;return a>=109951162777.6?(a/=109951162777.6,b="TiB"):a>=107374182.4?(a/=107374182.4,b="GiB"):a>=104857.6?(a/=104857.6,b="MiB"):a>=102.4?(a/=102.4,b="KiB"):(a=10*a,b="b"),""+Math.round(a)/10+" "+b},b.prototype._updateMaxFilesReachedClass=function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")},b.prototype.drop=function(a){var b,c;a.dataTransfer&&(this.emit("drop",a),b=a.dataTransfer.files,b.length&&(c=a.dataTransfer.items,c&&c.length&&null!=c[0].webkitGetAsEntry?this._addFilesFromItems(c):this.handleFiles(b)))},b.prototype.paste=function(a){},b.prototype.handleFiles=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addFile(b));return e},b.prototype._addFilesFromItems=function(a){var b,c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],null!=c.webkitGetAsEntry&&(b=c.webkitGetAsEntry())?b.isFile?f.push(this.addFile(c.getAsFile())):b.isDirectory?f.push(this._addFilesFromDirectory(b,b.name)):f.push(void 0):null!=c.getAsFile?null==c.kind||"file"===c.kind?f.push(this.addFile(c.getAsFile())):f.push(void 0):f.push(void 0);return f},b.prototype._addFilesFromDirectory=function(a,b){var c,d,e=this;return c=a.createReader(),d=function(a){var c,d,f;for(d=0,f=a.length;f>d;d++)c=a[d],c.isFile?c.file(function(a){return e.options.ignoreHiddenFiles&&"."===a.name.substring(0,1)?void 0:(a.fullPath=""+b+"/"+a.name,e.addFile(a))}):c.isDirectory&&e._addFilesFromDirectory(c,""+b+"/"+c.name)},c.readEntries(d,function(a){return"undefined"!=typeof console&&null!==console?"function"==typeof console.log?console.log(a):void 0:void 0})},b.prototype.accept=function(a,c){return a.size>1024*this.options.maxFilesize*1024?c(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(a.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):b.isValidFile(a,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(c(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",a)):this.options.accept.call(this,a,c):c(this.options.dictInvalidFileType)},b.prototype.addFile=function(a){var c=this;return a.upload={progress:0,total:a.size,bytesSent:0},this.files.push(a),a.status=b.ADDED,this.emit("addedfile",a),this._enqueueThumbnail(a),this.accept(a,function(b){return b?(a.accepted=!1,c._errorProcessing([a],b)):c.enqueueFile(a),c._updateMaxFilesReachedClass()})},b.prototype.enqueueFiles=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)b=a[c],this.enqueueFile(b);return null},b.prototype.enqueueFile=function(a){var c=this;if(a.accepted=!0,a.status!==b.ADDED)throw new Error("This file can't be queued because it has already been processed or was rejected.");return a.status=b.QUEUED,this.options.autoProcessQueue?setTimeout(function(){return c.processQueue()},0):void 0},b.prototype._thumbnailQueue=[],b.prototype._processingThumbnail=!1,b.prototype._enqueueThumbnail=function(a){var b=this;return this.options.createImageThumbnails&&a.type.match(/image.*/)&&a.size<=1024*this.options.maxThumbnailFilesize*1024?(this._thumbnailQueue.push(a),setTimeout(function(){return b._processThumbnailQueue()},0)):void 0},b.prototype._processThumbnailQueue=function(){var a=this;if(!this._processingThumbnail&&0!==this._thumbnailQueue.length)return this._processingThumbnail=!0,this.createThumbnail(this._thumbnailQueue.shift(),function(){return a._processingThumbnail=!1,a._processThumbnailQueue()})},b.prototype.removeFile=function(a){return a.status===b.UPLOADING&&this.cancelUpload(a),this.files=j(this.files,a),this.emit("removedfile",a),0===this.files.length?this.emit("reset"):void 0},b.prototype.removeAllFiles=function(a){var c,d,e,f;for(null==a&&(a=!1),f=this.files.slice(),d=0,e=f.length;e>d;d++)c=f[d],(c.status!==b.UPLOADING||a)&&this.removeFile(c);return null},b.prototype.createThumbnail=function(a,b){var c,d=this;return c=new FileReader,c.onload=function(){var e;return e=document.createElement("img"),e.onload=function(){var c,f,g,i,j,k,l,m;return a.width=e.width,a.height=e.height,g=d.options.resize.call(d,a),null==g.trgWidth&&(g.trgWidth=d.options.thumbnailWidth),null==g.trgHeight&&(g.trgHeight=d.options.thumbnailHeight),c=document.createElement("canvas"),f=c.getContext("2d"),c.width=g.trgWidth,c.height=g.trgHeight,h(f,e,null!=(j=g.srcX)?j:0,null!=(k=g.srcY)?k:0,g.srcWidth,g.srcHeight,null!=(l=g.trgX)?l:0,null!=(m=g.trgY)?m:0,g.trgWidth,g.trgHeight),i=c.toDataURL("image/png"),d.emit("thumbnail",a,i),null!=b?b():void 0},e.src=c.result},c.readAsDataURL(a)},b.prototype.processQueue=function(){var a,b,c,d;if(b=this.options.parallelUploads,c=this.getUploadingFiles().length,a=c,!(c>=b)&&(d=this.getQueuedFiles(),d.length>0)){if(this.options.uploadMultiple)return this.processFiles(d.slice(0,b-c));for(;b>a;){if(!d.length)return;this.processFile(d.shift()),a++}}},b.prototype.processFile=function(a){return this.processFiles([a])},b.prototype.processFiles=function(a){var c,d,e;for(d=0,e=a.length;e>d;d++)c=a[d],c.processing=!0,c.status=b.UPLOADING,this.emit("processing",c);return this.options.uploadMultiple&&this.emit("processingmultiple",a),this.uploadFiles(a)},b.prototype._getFilesWithXhr=function(a){var b,c;return c=function(){var c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.xhr===a&&f.push(b);return f}.call(this)},b.prototype.cancelUpload=function(a){var c,d,e,f,g,h,i;if(a.status===b.UPLOADING){for(d=this._getFilesWithXhr(a.xhr),e=0,g=d.length;g>e;e++)c=d[e],c.status=b.CANCELED;for(a.xhr.abort(),f=0,h=d.length;h>f;f++)c=d[f],this.emit("canceled",c);this.options.uploadMultiple&&this.emit("canceledmultiple",d)}else((i=a.status)===b.ADDED||i===b.QUEUED)&&(a.status=b.CANCELED,this.emit("canceled",a),this.options.uploadMultiple&&this.emit("canceledmultiple",[a]));return this.options.autoProcessQueue?this.processQueue():void 0},b.prototype.uploadFile=function(a){return this.uploadFiles([a])},b.prototype.uploadFiles=function(a){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=this;for(s=new XMLHttpRequest,t=0,x=a.length;x>t;t++)d=a[t],d.xhr=s;s.open(this.options.method,this.options.url,!0),s.withCredentials=!!this.options.withCredentials,p=null,f=function(){var b,c,e;for(e=[],b=0,c=a.length;c>b;b++)d=a[b],e.push(I._errorProcessing(a,p||I.options.dictResponseError.replace("{{statusCode}}",s.status),s));return e},q=function(b){var c,e,f,g,h,i,j,k,l;if(null!=b)for(e=100*b.loaded/b.total,f=0,i=a.length;i>f;f++)d=a[f],d.upload={progress:e,total:b.total,bytesSent:b.loaded};else{for(c=!0,e=100,g=0,j=a.length;j>g;g++)d=a[g],(100!==d.upload.progress||d.upload.bytesSent!==d.upload.total)&&(c=!1),d.upload.progress=e,d.upload.bytesSent=d.upload.total;if(c)return}for(l=[],h=0,k=a.length;k>h;h++)d=a[h],l.push(I.emit("uploadprogress",d,e,d.upload.bytesSent));return l},s.onload=function(c){var d;if(a[0].status!==b.CANCELED&&4===s.readyState){if(p=s.responseText,s.getResponseHeader("content-type")&&~s.getResponseHeader("content-type").indexOf("application/json"))try{p=JSON.parse(p)}catch(e){c=e,p="Invalid JSON response from server."}return q(),200<=(d=s.status)&&300>d?I._finished(a,p,c):f()}},s.onerror=function(){return a[0].status!==b.CANCELED?f():void 0},o=null!=(D=s.upload)?D:s,o.onprogress=q,i={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"},this.options.headers&&c(i,this.options.headers);for(g in i)h=i[g],s.setRequestHeader(g,h);if(e=new FormData,this.options.params){E=this.options.params;for(m in E)r=E[m],e.append(m,r)}for(u=0,y=a.length;y>u;u++)d=a[u],this.emit("sending",d,s,e);if(this.options.uploadMultiple&&this.emit("sendingmultiple",a,s,e),"FORM"===this.element.tagName)for(F=this.element.querySelectorAll("input, textarea, select, button"),v=0,z=F.length;z>v;v++)if(j=F[v],k=j.getAttribute("name"),l=j.getAttribute("type"),"SELECT"===j.tagName&&j.hasAttribute("multiple"))for(G=j.options,w=0,A=G.length;A>w;w++)n=G[w],n.selected&&e.append(k,n.value);else(!l||"checkbox"!==(H=l.toLowerCase())&&"radio"!==H||j.checked)&&e.append(k,j.value);for(C=0,B=a.length;B>C;C++)d=a[C],e.append(""+this.options.paramName+(this.options.uploadMultiple?"[]":""),d,d.name);return s.send(e)},b.prototype._finished=function(a,c,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=b.SUCCESS,this.emit("success",e,c,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("successmultiple",a,c,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},b.prototype._errorProcessing=function(a,c,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=b.ERROR,this.emit("error",e,c,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("errormultiple",a,c,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},b}(d),a.version="3.8.3",a.options={},a.optionsForElement=function(b){return b.getAttribute("id")?a.options[e(b.getAttribute("id"))]:void 0},a.instances=[],a.forElement=function(a){if("string"==typeof a&&(a=document.querySelector(a)),null==(null!=a?a.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return a.dropzone},a.autoDiscover=!0,a.discover=function(){var b,c,d,e,f,g;for(document.querySelectorAll?d=document.querySelectorAll(".dropzone"):(d=[],b=function(a){var b,c,e,f;for(f=[],c=0,e=a.length;e>c;c++)b=a[c],/(^| )dropzone($| )/.test(b.className)?f.push(d.push(b)):f.push(void 0);return f},b(document.getElementsByTagName("div")),b(document.getElementsByTagName("form"))),g=[],e=0,f=d.length;f>e;e++)c=d[e],a.optionsForElement(c)!==!1?g.push(new a(c)):g.push(void 0);return g},a.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i],a.isBrowserSupported=function(){var b,c,d,e,f;if(b=!0,window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(f=a.blacklistedBrowsers,d=0,e=f.length;e>d;d++)c=f[d],c.test(navigator.userAgent)&&(b=!1);else b=!1;else b=!1;return b},j=function(a,b){var c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],c!==b&&f.push(c);return f},e=function(a){return a.replace(/[\-_](\w)/g,function(a){return a[1].toUpperCase()})},a.createElement=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.childNodes[0]},a.elementInside=function(a,b){if(a===b)return!0;for(;a=a.parentNode;)if(a===b)return!0;return!1},a.getElement=function(a,b){var c;if("string"==typeof a?c=document.querySelector(a):null!=a.nodeType&&(c=a),null==c)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector or a plain HTML element.");return c},a.getElements=function(a,b){var c,d,e,f,g,h,i,j;if(a instanceof Array){e=[];try{for(f=0,h=a.length;h>f;f++)d=a[f],e.push(this.getElement(d,b))}catch(k){c=k,e=null}}else if("string"==typeof a)for(e=[],j=document.querySelectorAll(a),g=0,i=j.length;i>g;g++)d=j[g],e.push(d);else null!=a.nodeType&&(e=[a]);if(null==e||!e.length)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return e},a.confirm=function(a,b,c){return window.confirm(a)?b():null!=c?c():void 0},a.isValidFile=function(a,b){var c,d,e,f,g;if(!b)return!0;for(b=b.split(","),d=a.type,c=d.replace(/\/.*$/,""),f=0,g=b.length;g>f;f++)if(e=b[f],e=e.trim(),"."===e.charAt(0)){if(-1!==a.name.toLowerCase().indexOf(e.toLowerCase(),a.name.length-e.length))return!0}else if(/\/\*$/.test(e)){if(c===e.replace(/\/.*$/,""))return!0}else if(d===e)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(b){return this.each(function(){return new a(this,b)})}),"undefined"!=typeof c&&null!==c?c.exports=a:window.Dropzone=a,a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success",g=function(a){var b,c,d,e,f,g,h,i,j,k;for(h=a.naturalWidth,g=a.naturalHeight,c=document.createElement("canvas"),c.width=1,c.height=g,d=c.getContext("2d"),d.drawImage(a,0,0),e=d.getImageData(0,0,1,g).data,k=0,f=g,i=g;i>k;)b=e[4*(i-1)+3],0===b?f=i:k=i,i=f+k>>1;return j=i/g,0===j?1:j},h=function(a,b,c,d,e,f,h,i,j,k){var l;return l=g(b),a.drawImage(b,c,d,e,f,h,i,j,k/l)},f=function(a,b){var c,d,e,f,g,h,i,j,k;if(e=!1,k=!0,d=a.document,j=d.documentElement,c=d.addEventListener?"addEventListener":"attachEvent",i=d.addEventListener?"removeEventListener":"detachEvent",h=d.addEventListener?"":"on",f=function(c){return"readystatechange"!==c.type||"complete"===d.readyState?(("load"===c.type?a:d)[i](h+c.type,f,!1),!e&&(e=!0)?b.call(a,c.type||c):void 0):void 0},g=function(){var a;try{j.doScroll("left")}catch(b){return a=b,setTimeout(g,50),void 0}return f("poll")},"complete"!==d.readyState){if(d.createEventObject&&j.doScroll){try{k=!a.frameElement}catch(l){}k&&g()}return d[c](h+"DOMContentLoaded",f,!1),d[c](h+"readystatechange",f,!1),a[c](h+"load",f,!1)}},a._autoDiscoverFunction=function(){return a.autoDiscover?a.discover():void 0},f(window,a._autoDiscoverFunction)}).call(this)}),a.alias("component-emitter/index.js","dropzone/deps/emitter/index.js"),a.alias("component-emitter/index.js","emitter/index.js"),"object"==typeof exports?module.exports=a("dropzone"):"function"==typeof define&&define.amd?define(function(){return a("dropzone")}):this.Dropzone=a("dropzone")}();
\ No newline at end of file
diff --git a/views/js/controllers/module/module.js b/views/js/controllers/module/module.js
index 7b9ec3125..fc419ff16 100644
--- a/views/js/controllers/module/module.js
+++ b/views/js/controllers/module/module.js
@@ -39,6 +39,19 @@ $(document).ready(function() {
},
getAvgRateClass: function(avg_rate) {
return 'module-stars module-star-ranking-grid-' + Math.round(avg_rate) + ' small';
+ },
+ visibleModules: function() {
+ var visibleModules = 0;
+
+ if (typeof window.vApp !== 'undefined' && typeof window.vApp.modules !== 'undefined') {
+ $.each(window.vApp.modules, function(index, value) {
+ if (value.attributes.visible === true) {
+ visibleModules++;
+ }
+ });
+ }
+
+ return visibleModules;
}
}
});
@@ -55,8 +68,6 @@ $(document).ready(function() {
window.vApp.modules = parsedData.modules;
window.vApp.categories = parsedData.categories;
- console.log(window.vApp.categories);
-
if (typeof filterCategoryTab !== 'undefined') {
$.each(window.vApp.modules, function (key, value) {
if (value.attributes.tab == filterCategoryTab) {
@@ -90,4 +101,21 @@ $(document).ready(function() {
return true;
});
+ var urlToCall = $('#notification_count_url').val();
+ if (urlToCall !== '') {
+ var destinationTab = $("#subtab-AdminModulesNotifications");
+ if (destinationTab.length === 0) {
+ return;
+ }
+
+ $.getJSON(urlToCall, function(badge) {
+ destinationTab.append('\
+ '+badge.count+'\
+ \
+ ');
+ }).fail(function() {
+ console.error('Could not retrieve module notifications count.');
+ });
+ }
+
});
\ No newline at end of file
diff --git a/views/js/controllers/module/search.js b/views/js/controllers/module/search.js
index fe4e4a980..cda6c7343 100644
--- a/views/js/controllers/module/search.js
+++ b/views/js/controllers/module/search.js
@@ -432,7 +432,7 @@ var AdminModuleController = function() {
this.initAddonsConnect = function () {
var self = this;
-
+
// Make addons connect modal ready to be clicked
if ($(this.addonsConnectModalBtnSelector).attr('href') == '#') {
$(this.addonsConnectModalBtnSelector).attr('data-toggle', 'modal');
@@ -508,21 +508,23 @@ var AdminModuleController = function() {
// Change the way Dropzone.js lib handle file input trigger
body.on(
- 'click', '.dropzone:not('+this.moduleImportSelectFileManualSelector+', '+this.moduleImportSuccessConfigureBtnSelector+')',
- function(event, manual_select) {
- // if click comes from .module-import-start-select-manual, stop everything
- if (typeof manual_select == "undefined") {
- event.stopPropagation();
- event.preventDefault();
- }
- }
+ 'click', '.dropzone:not('+this.moduleImportSelectFileManualSelector+', '+this.moduleImportSuccessConfigureBtnSelector+')',
+ function(event, manual_select) {
+ // if click comes from .module-import-start-select-manual, stop everything
+ if (typeof manual_select == "undefined") {
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ }
);
body.on('click', this.moduleImportSelectFileManualSelector, function(event) {
- event.stopPropagation();
- event.preventDefault();
- // Trigger click on hidden file input, and pass extra data to .dropzone click handler fro it to notice it comes from here
- $('.dz-hidden-input').trigger('click', ["manual_select"]);
+ event.stopPropagation();
+ event.preventDefault();
+
+ // Trigger click on hidden file input, and pass extra data to .dropzone click handler fro it to notice it comes from here
+ $('#importDropzone').trigger('click', ["manual_select"]);
+// $('.dz-hidden-input').trigger('click', ["manual_select"]);
});
// Handle modal closure
@@ -547,38 +549,48 @@ var AdminModuleController = function() {
});
// @see: dropzone.js
-// var dropzoneOptions = {
-// url: 'import' + window.location.search,
-// acceptedFiles: '.zip, .tar',
-// // The name that will be used to transfer the file
-// paramName: 'file_uploaded',
-// maxFilesize: 50, // can't be greater than 50Mb because it's an addons limitation
-// uploadMultiple: false,
-// addRemoveLinks: true,
-// dictDefaultMessage: '',
-// hiddenInputContainer: self.dropZoneImportZoneSelector,
-// addedfile: function() {
-// self.animateStartUpload();
-// },
-// processing: function () {
-// // Leave it empty since we don't require anything while processing upload
-// },
-// error: function (file, message) {
-// self.displayOnUploadError(message);
-// },
-// complete: function (file) {
-// if (file.status !== 'error') {
-// var responseObject = jQuery.parseJSON(file.xhr.response);
-// if (typeof responseObject.is_configurable === 'undefined') responseObject.is_configurable = null;
-// if (typeof responseObject.module_name === 'undefined') responseObject.module_name = null;
-//
-// self.displayOnUploadDone(responseObject);
-// }
-// // State that we have finish the process to unlock some actions
-// self.isUploadStarted = false;
-// }
-// };
-// dropzone.dropzone($.extend(dropzoneOptions));
+ var dropzoneOptions = {
+ url: $('#install_url').val(),
+ acceptedFiles: '.zip, .tar',
+ // The name that will be used to transfer the file
+ paramName: 'file_uploaded',
+ maxFilesize: 50, // can't be greater than 50Mb because it's an addons limitation
+ uploadMultiple: false,
+ addRemoveLinks: true,
+ dictDefaultMessage: '',
+ hiddenInputContainer: self.dropZoneImportZoneSelector,
+ addedfile: function() {
+ self.animateStartUpload();
+ },
+ processing: function () {
+ // Leave it empty since we don't require anything while processing upload
+ },
+ sending: function() {
+ // Prevent JS errors
+ },
+ uploadprogress: function() {
+ // Prevent JS errors
+ },
+ success: function() {
+ // Prevent JS errors
+ },
+ error: function (file, message) {
+ self.displayOnUploadError(message);
+ },
+ complete: function (file) {
+ if (file.status !== 'error') {
+ var responseObject = jQuery.parseJSON(file.xhr.response);
+ if (typeof responseObject.is_configurable === 'undefined') responseObject.is_configurable = null;
+ if (typeof responseObject.module_name === 'undefined') responseObject.module_name = null;
+
+ self.displayOnUploadDone(responseObject);
+ }
+ // State that we have finish the process to unlock some actions
+ self.isUploadStarted = false;
+ }
+ };
+ dropzone.dropzone($.extend(dropzoneOptions));
+ console.log(dropzone);
this.animateStartUpload = function() {
// State that we start module upload
@@ -602,10 +614,12 @@ var AdminModuleController = function() {
self.animateEndUpload(function() {
if (result.status === true) {
if (result.is_configurable === true) {
- var configureLink = self.baseAdminDir + 'module/manage/action/configure/' + result.module_name + window.location.search;
+ var configureLink = self.baseAdminDir + 'module/manage/action/configure/' + result.module_name + '?_token=' + $('#module_controller_token').val();
$(self.moduleImportSuccessConfigureBtnSelector).attr('href', configureLink);
$(self.moduleImportSuccessConfigureBtnSelector).show();
- }
+ } else {
+ $('.module-import-success-configure').hide();
+ }
$(self.moduleImportSuccessSelector).fadeIn();
} else if (typeof result.confirmation_subject !== 'undefined') {
self.displayPrestaTrustStep(result);
diff --git a/views/templates/admin/include/menu_top.tpl b/views/templates/admin/include/menu_top.tpl
index 6fabaea34..e95500b96 100644
--- a/views/templates/admin/include/menu_top.tpl
+++ b/views/templates/admin/include/menu_top.tpl
@@ -49,7 +49,7 @@
- [[ modules.length ]] {l s='modules and services selected for you' d='Admin.Modules.Feature'}
+ {l s='modules and services selected for you' d='Admin.Modules.Feature'}
diff --git a/views/templates/admin/include/modal_addons_connect.tpl b/views/templates/admin/include/modal_addons_connect.tpl
new file mode 100644
index 000000000..c4e294154
--- /dev/null
+++ b/views/templates/admin/include/modal_addons_connect.tpl
@@ -0,0 +1,107 @@
+{**
+ * 2007-2018 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:
+ * https://opensource.org/licenses/OSL-3.0
+ * 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
+ * @copyright 2007-2018 PrestaShop SA
+ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
+ * International Registered Trademark & Property of PrestaShop SA
+ *}
+
+{if $addons_connect['connected'] === false}
+
+
+
+
+
+
{l s='Connect to Addons marketplace' mod='Admin.Modules.Feature'}
+
+
+
+ {* {% if level <= constant('PrestaShopBundle\\Security\\Voter\\PageVoter::LEVEL_UPDATE') %}
+
+
+
+
+ {{ errorMessage }}
+
+
+
+
+ {% else %}*}
+
+
+
+ {l s='Link your shop to your Addons account to automatically receive important updates for the modules you purchased. Don\'t have an account yet?' mod='Admin.Modules.Feature'}
+ {l s='Sign up now' mod='Admin.Modules.Feature'}
+
+ {l s='You are about to log out your Addons account. You might miss important updates of Addons you\'ve bought.' mod='Admin.Modules.Notification'}
+
+
+
+
+
+
+
+
+{/if}
\ No newline at end of file
diff --git a/views/templates/admin/include/modal_confirm_prestatrust.tpl b/views/templates/admin/include/modal_confirm_prestatrust.tpl
new file mode 100644
index 000000000..d983e87b1
--- /dev/null
+++ b/views/templates/admin/include/modal_confirm_prestatrust.tpl
@@ -0,0 +1,48 @@
+
diff --git a/views/templates/admin/include/modal_import.tpl b/views/templates/admin/include/modal_import.tpl
new file mode 100644
index 000000000..5a896df00
--- /dev/null
+++ b/views/templates/admin/include/modal_import.tpl
@@ -0,0 +1,94 @@
+{**
+ * 2007-2018 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:
+ * https://opensource.org/licenses/OSL-3.0
+ * 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
+ * @copyright 2007-2018 PrestaShop SA
+ * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
+ * International Registered Trademark & Property of PrestaShop SA
+ *}
+
+
+
+
+
+
{l s='Upload a module' mod='Admin.Modules.Feature'}
+
+
+
+{* {% if level <= constant('PrestaShopBundle\\Security\\Voter\\PageVoter::LEVEL_UPDATE') %}
+
+
+
+
+ {{ errorMessage }}
+
+
+
+
+ {% else %}*}
+
+
+
+
+
+{* {% endif %}*}
+
+
+
+
+
diff --git a/views/templates/admin/module-toolbar.tpl b/views/templates/admin/module-toolbar.tpl
new file mode 100644
index 000000000..71ac6e5c2
--- /dev/null
+++ b/views/templates/admin/module-toolbar.tpl
@@ -0,0 +1,26 @@
+