From 3df72098bbc205fa4bd4735d52d2626baad93548 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 19 May 2006 18:50:23 +0200 Subject: new mediamanager This patch adds a completely rewritten media popup. The following noteworthy changes were made: - media manager uses a collapsible namespace tree - media manager uses AJAX if available - media manager popup can be kept open when selecting a media file - only one template is used for the media manager :!: Template - Editable image metadata is configured in conf/mediameta.php now - The JS cookie mechanism was enhanced to store key/value pairs - Language strings can be exported to JS in js.php darcs-hash:20060519165023-7ad00-4932b4553fc919aa4a8b8187958b823acf4f8cee.gz --- lib/scripts/tw-sack.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'lib/scripts/tw-sack.js') diff --git a/lib/scripts/tw-sack.js b/lib/scripts/tw-sack.js index 0c7e81bf1..cfcbe0ea9 100644 --- a/lib/scripts/tw-sack.js +++ b/lib/scripts/tw-sack.js @@ -15,6 +15,7 @@ function sack(file){ this.onLoaded = function() { }; this.onInteractive = function() { }; this.onCompletion = function() { }; + this.afterCompletion = function() { }; this.createAJAX = function() { try { @@ -30,10 +31,10 @@ function sack(file){ this.xmlhttp = new XMLHttpRequest(); } if (!this.xmlhttp){ - this.failed = true; + this.failed = true; } }; - + this.setVar = function(name, value){ if (this.URLString.length < 3){ this.URLString = name + "=" + value; @@ -41,12 +42,12 @@ function sack(file){ this.URLString += "&" + name + "=" + value; } }; - + this.encVar = function(name, value){ var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value); return varString; }; - + this.encodeURLString = function(string){ varArray = string.split('&'); for (i = 0; i < varArray.length; i++){ @@ -58,25 +59,25 @@ function sack(file){ } return varArray.join('&'); }; - + this.runResponse = function(){ eval(this.response); }; - + this.runAJAX = function(urlstring){ this.responseStatus = new Array(2); - if(this.failed && this.AjaxFailedAlert){ - alert(this.AjaxFailedAlert); + if(this.failed && this.AjaxFailedAlert){ + alert(this.AjaxFailedAlert); } else { - if (urlstring){ + if (urlstring){ if (this.URLString.length){ - this.URLString = this.URLString + "&" + urlstring; + this.URLString = this.URLString + "&" + urlstring; } else { - this.URLString = urlstring; + this.URLString = urlstring; } } if (this.encodeURIString){ - var timeval = new Date().getTime(); + var timeval = new Date().getTime(); this.URLString = this.encodeURLString(this.URLString); this.setVar("rndval", timeval); } @@ -93,7 +94,7 @@ function sack(file){ try { this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); } catch (e) {} - } + } this.xmlhttp.onreadystatechange = function() { switch (self.xmlhttp.readyState){ @@ -122,6 +123,7 @@ function sack(file){ self.elementObj.innerHTML = self.response; } } + self.afterCompletion(); self.URLString = ""; break; } -- cgit v1.2.3