summaryrefslogtreecommitdiff
path: root/lib/scripts/tw-sack.js
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-05-19 18:50:23 +0200
committerAndreas Gohr <andi@splitbrain.org>2006-05-19 18:50:23 +0200
commit3df72098bbc205fa4bd4735d52d2626baad93548 (patch)
tree105ca14ca3ff596ad4c7d20a1985aeb02c5f7caa /lib/scripts/tw-sack.js
parenta219c1f00349b720d262939fec3e7baf19a63402 (diff)
downloadrpg-3df72098bbc205fa4bd4735d52d2626baad93548.tar.gz
rpg-3df72098bbc205fa4bd4735d52d2626baad93548.tar.bz2
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
Diffstat (limited to 'lib/scripts/tw-sack.js')
-rw-r--r--lib/scripts/tw-sack.js28
1 files changed, 15 insertions, 13 deletions
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;
}