This commit is contained in:
Sara Arjona 2019-07-01 18:34:38 +02:00
commit 90f59ece67
4 changed files with 4 additions and 4 deletions

View File

@ -157,7 +157,7 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || {
usedFiles = {};
while ((match = pattern.exec(content.get('innerHTML'))) !== null) {
filename = decodeURI(match[1]);
filename = decodeURIComponent(match[1]);
usedFiles[filename] = true;
}

View File

@ -1 +1 @@
YUI.add("moodle-atto_managefiles-usedfiles",function(e,t){var n={HASMISSINGFILES:"has-missing-files",HASUNUSEDFILES:"has-unused-files"},r={FILEANCESTOR:".fitem",FORM:"#atto_managefiles_manageform",MISSINGFILES:".missing-files"};M.atto_managefiles=M.atto_managefiles||{},M.atto_managefiles.usedfiles=M.atto_managefiles.usedfiles||{_usercontext:null,_itemid:null,_elementid:null,init:function(t){this._usercontext=t.usercontext,this._itemid=t.itemid,this._elementid=t.elementid;var i=t.files,s=e.one(r.FORM),o,u,a,f,l;if(!s||!window.parent)return;o=this._getUsedFiles(),u=this.findUnusedFiles(i,o),a=this.findMissingFiles(i,o),u.length>0?(s.all('input[type=checkbox][name^="deletefile"]').each(function(t){e.Array.indexOf(u,t.getData("filename"))===-1&&t.ancestor(r.FILEANCESTOR).remove()}),s.addClass(n.HASUNUSEDFILES)):s.removeClass(n.HASUNUSEDFILES);if(a.length>0){f="<ul>";for(l=0;l<a.length;l++)f+="<li>"+e.Escape.html(a[l])+"</li>";f+="</ul>",s.one(r.MISSINGFILES).setHTML("").append(f),s.addClass(n.HASMISSINGFILES)}else s.removeClass(n.HASMISSINGFILES)},_getUsedFiles:function(){var t=e.one(window.parent.document.getElementById(this._elementid+"editable")),n=M.cfg.wwwroot+"/draftfile.php/"+this._usercontext+"/user/draft/"+this._itemid+"/",r=new RegExp(n.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g,"\\$&")+"(.+?)[\\?\"']","gm"),i="",s="",o={};while((s=r.exec(t.get("innerHTML")))!==null)i=decodeURI(s[1]),o[i]=!0;return o},findUnusedFiles:function(e,t){var n,r=[];for(n in e)t[n]||r.push(n);return r},findMissingFiles:function(e,t){var n,r=[];for(n in t)e[n]||r.push(n);return r}}},"@VERSION@",{requires:["node","escape"]});
YUI.add("moodle-atto_managefiles-usedfiles",function(e,t){var n={HASMISSINGFILES:"has-missing-files",HASUNUSEDFILES:"has-unused-files"},r={FILEANCESTOR:".fitem",FORM:"#atto_managefiles_manageform",MISSINGFILES:".missing-files"};M.atto_managefiles=M.atto_managefiles||{},M.atto_managefiles.usedfiles=M.atto_managefiles.usedfiles||{_usercontext:null,_itemid:null,_elementid:null,init:function(t){this._usercontext=t.usercontext,this._itemid=t.itemid,this._elementid=t.elementid;var i=t.files,s=e.one(r.FORM),o,u,a,f,l;if(!s||!window.parent)return;o=this._getUsedFiles(),u=this.findUnusedFiles(i,o),a=this.findMissingFiles(i,o),u.length>0?(s.all('input[type=checkbox][name^="deletefile"]').each(function(t){e.Array.indexOf(u,t.getData("filename"))===-1&&t.ancestor(r.FILEANCESTOR).remove()}),s.addClass(n.HASUNUSEDFILES)):s.removeClass(n.HASUNUSEDFILES);if(a.length>0){f="<ul>";for(l=0;l<a.length;l++)f+="<li>"+e.Escape.html(a[l])+"</li>";f+="</ul>",s.one(r.MISSINGFILES).setHTML("").append(f),s.addClass(n.HASMISSINGFILES)}else s.removeClass(n.HASMISSINGFILES)},_getUsedFiles:function(){var t=e.one(window.parent.document.getElementById(this._elementid+"editable")),n=M.cfg.wwwroot+"/draftfile.php/"+this._usercontext+"/user/draft/"+this._itemid+"/",r=new RegExp(n.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g,"\\$&")+"(.+?)[\\?\"']","gm"),i="",s="",o={};while((s=r.exec(t.get("innerHTML")))!==null)i=decodeURIComponent(s[1]),o[i]=!0;return o},findUnusedFiles:function(e,t){var n,r=[];for(n in e)t[n]||r.push(n);return r},findMissingFiles:function(e,t){var n,r=[];for(n in t)e[n]||r.push(n);return r}}},"@VERSION@",{requires:["node","escape"]});

View File

@ -156,7 +156,7 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || {
usedFiles = {};
while ((match = pattern.exec(content.get('innerHTML'))) !== null) {
filename = decodeURI(match[1]);
filename = decodeURIComponent(match[1]);
usedFiles[filename] = true;
}

View File

@ -155,7 +155,7 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || {
usedFiles = {};
while ((match = pattern.exec(content.get('innerHTML'))) !== null) {
filename = decodeURI(match[1]);
filename = decodeURIComponent(match[1]);
usedFiles[filename] = true;
}