mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
Merge branch 'MDL-73121' of https://github.com/paulholden/moodle
This commit is contained in:
commit
34d55890f3
@ -151,11 +151,12 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || {
|
||||
_getUsedFiles: function() {
|
||||
var content = Y.one(window.parent.document.getElementById(this._elementid + 'editable')),
|
||||
baseUrl = M.cfg.wwwroot + '/draftfile.php/' + this._usercontext + '/user/draft/' + this._itemid + '/',
|
||||
pattern = new RegExp(baseUrl.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
|
||||
pattern = new RegExp("[\"']" + baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
|
||||
filename = '',
|
||||
match = '',
|
||||
usedFiles = {};
|
||||
|
||||
// The pattern matches any draftfile URL contained within quotes, e.g. 'src="<filename>"' or 'href="<filename>"'.
|
||||
while ((match = pattern.exec(content.get('innerHTML'))) !== null) {
|
||||
filename = decodeURIComponent(match[1]);
|
||||
usedFiles[filename] = true;
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-atto_managefiles-usedfiles",function(d,e){var o="has-missing-files",f="has-unused-files",r=".fitem",u="#atto_managefiles_manageform",m=".missing-files";M.atto_managefiles=M.atto_managefiles||{},M.atto_managefiles.usedfiles=M.atto_managefiles.usedfiles||{_usercontext:null,_itemid:null,_elementid:null,init:function(e){var i,n,t,s,l,a;if(this._usercontext=e.usercontext,this._itemid=e.itemid,this._elementid=e.elementid,e=e.files,(i=d.one(u))&&window.parent)if(n=this._getUsedFiles(),t=this.findUnusedFiles(e,n),s=this.findMissingFiles(e,n),0<t.length?(i.all('input[type=checkbox][name^="deletefile"]').each(function(e){-1===d.Array.indexOf(t,e.getData("filename"))&&e.ancestor(r).remove()}),i.addClass(f)):i.removeClass(f),0<s.length){for(l="<ul>",a=0;a<s.length;a++)l+="<li>"+d.Escape.html(s[a])+"</li>";l+="</ul>",i.one(m).setHTML("").append(l),i.addClass(o)}else i.removeClass(o)},_getUsedFiles:function(){for(var e,i=d.one(window.parent.document.getElementById(this._elementid+"editable")),n=M.cfg.wwwroot+"/draftfile.php/"+this._usercontext+"/user/draft/"+this._itemid+"/",t=new RegExp(n.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g,"\\$&")+"(.+?)[\\?\"']","gm"),s={};null!==(e=t.exec(i.get("innerHTML")));)s[decodeURIComponent(e[1])]=!0;return s},findUnusedFiles:function(e,i){var n,t=[];for(n in e)i[n]||t.push(n);return t},findMissingFiles:function(e,i){var n,t=[];for(n in i)e[n]||t.push(n);return t}}},"@VERSION@",{requires:["node","escape"]});
|
||||
YUI.add("moodle-atto_managefiles-usedfiles",function(d,e){var o="has-missing-files",f="has-unused-files",r=".fitem",u="#atto_managefiles_manageform",m=".missing-files";M.atto_managefiles=M.atto_managefiles||{},M.atto_managefiles.usedfiles=M.atto_managefiles.usedfiles||{_usercontext:null,_itemid:null,_elementid:null,init:function(e){var i,n,t,s,l,a;if(this._usercontext=e.usercontext,this._itemid=e.itemid,this._elementid=e.elementid,e=e.files,(i=d.one(u))&&window.parent)if(n=this._getUsedFiles(),t=this.findUnusedFiles(e,n),s=this.findMissingFiles(e,n),0<t.length?(i.all('input[type=checkbox][name^="deletefile"]').each(function(e){-1===d.Array.indexOf(t,e.getData("filename"))&&e.ancestor(r).remove()}),i.addClass(f)):i.removeClass(f),0<s.length){for(l="<ul>",a=0;a<s.length;a++)l+="<li>"+d.Escape.html(s[a])+"</li>";l+="</ul>",i.one(m).setHTML("").append(l),i.addClass(o)}else i.removeClass(o)},_getUsedFiles:function(){for(var e,i=d.one(window.parent.document.getElementById(this._elementid+"editable")),n=M.cfg.wwwroot+"/draftfile.php/"+this._usercontext+"/user/draft/"+this._itemid+"/",t=new RegExp("[\"']"+n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")+"(.+?)[\\?\"']","gm"),s={};null!==(e=t.exec(i.get("innerHTML")));)s[decodeURIComponent(e[1])]=!0;return s},findUnusedFiles:function(e,i){var n,t=[];for(n in e)i[n]||t.push(n);return t},findMissingFiles:function(e,i){var n,t=[];for(n in i)e[n]||t.push(n);return t}}},"@VERSION@",{requires:["node","escape"]});
|
@ -150,11 +150,12 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || {
|
||||
_getUsedFiles: function() {
|
||||
var content = Y.one(window.parent.document.getElementById(this._elementid + 'editable')),
|
||||
baseUrl = M.cfg.wwwroot + '/draftfile.php/' + this._usercontext + '/user/draft/' + this._itemid + '/',
|
||||
pattern = new RegExp(baseUrl.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
|
||||
pattern = new RegExp("[\"']" + baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
|
||||
filename = '',
|
||||
match = '',
|
||||
usedFiles = {};
|
||||
|
||||
// The pattern matches any draftfile URL contained within quotes, e.g. 'src="<filename>"' or 'href="<filename>"'.
|
||||
while ((match = pattern.exec(content.get('innerHTML'))) !== null) {
|
||||
filename = decodeURIComponent(match[1]);
|
||||
usedFiles[filename] = true;
|
||||
|
@ -149,11 +149,12 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || {
|
||||
_getUsedFiles: function() {
|
||||
var content = Y.one(window.parent.document.getElementById(this._elementid + 'editable')),
|
||||
baseUrl = M.cfg.wwwroot + '/draftfile.php/' + this._usercontext + '/user/draft/' + this._itemid + '/',
|
||||
pattern = new RegExp(baseUrl.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
|
||||
pattern = new RegExp("[\"']" + baseUrl.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
|
||||
filename = '',
|
||||
match = '',
|
||||
usedFiles = {};
|
||||
|
||||
// The pattern matches any draftfile URL contained within quotes, e.g. 'src="<filename>"' or 'href="<filename>"'.
|
||||
while ((match = pattern.exec(content.get('innerHTML'))) !== null) {
|
||||
filename = decodeURIComponent(match[1]);
|
||||
usedFiles[filename] = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user