summaryrefslogtreecommitdiffstats
path: root/lib/class/ajax.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-10-10 07:30:15 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-10-10 07:30:15 +0000
commitff58181d5b4ddd10b34062a0ad2204435e698cae (patch)
tree60b4654309d0826c81411790efe8448675a038bb /lib/class/ajax.class.php
parent32349846fbd66e4ebc44e63d37fbcd8cff5a8a73 (diff)
downloadampache-ff58181d5b4ddd10b34062a0ad2204435e698cae.tar.gz
ampache-ff58181d5b4ddd10b34062a0ad2204435e698cae.tar.bz2
ampache-ff58181d5b4ddd10b34062a0ad2204435e698cae.zip
fixed acls, fixed transcoding issues
Diffstat (limited to 'lib/class/ajax.class.php')
-rw-r--r--lib/class/ajax.class.php25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/class/ajax.class.php b/lib/class/ajax.class.php
index d0bf4eee..2c0c9aff 100644
--- a/lib/class/ajax.class.php
+++ b/lib/class/ajax.class.php
@@ -40,7 +40,7 @@ class Ajax {
* observe
* This returns a string with the correct and full ajax 'observe' stuff from prototype
*/
- public static function observe($source,$method,$action) {
+ public static function observe($source,$method,$action,$post='') {
$non_quoted = array('document','window');
@@ -51,8 +51,13 @@ class Ajax {
$source_txt = "'$source'";
}
+ // If it's a post then we need to stop events
+ if ($post) {
+ $action = 'Event.stop(e); ' . $action;
+ }
+
$observe = "<script type=\"text/javascript\">";
- $observe .= "Event.observe($source_txt,'$method',function(){" . $action . ";});";
+ $observe .= "Event.observe($source_txt,'$method',function(e){" . $action . ";});";
$observe .= "</script>";
return $observe;
@@ -98,7 +103,7 @@ class Ajax {
// Get the correct action
$ajax_string = self::action($action,$source,$post);
- // If they passed a span class
+ // If they passed a span class
if ($class) {
$class_txt = ' class="' . $class . '"';
}
@@ -106,13 +111,13 @@ class Ajax {
$string = get_user_icon($icon,$alt);
- // Generate a <a> so that it's more compliant with older browsers
- // (ie :hover actions) and also to unify linkbuttons (w/o ajax) display
- $string = "<a href=\"javascript:void(0);\" id=\"$source\" $class_txt>".$string."</a>\n";
+ // Generate a <a> so that it's more compliant with older browsers
+ // (ie :hover actions) and also to unify linkbuttons (w/o ajax) display
+ $string = "<a href=\"javascript:void(0);\" id=\"$source\" $class_txt>".$string."</a>\n";
$string .= self::observe($source,'click',$ajax_string);
- return $string;
+ return $string;
} // button
@@ -126,17 +131,13 @@ class Ajax {
// Format the string we wanna use
$ajax_string = self::action($action,$source,$post);
- //$class.= ($class?' ':'') . 'link';
-
// If they passed a span class
if ($class) {
$class_txt = ' class="' . $class . '"';
}
// If we pass a source put it in the ID
- //$string = "<div id=\"$source\" $class_txt>$text</div>\n";
-
- $string = "<a href=\"javascript:void(0);\" id=\"$source\" $class_txt>$text</a>\n";
+ $string = "<a href=\"javascript:void(0);\" id=\"$source\" $class_txt>$text</a>\n";
$string .= self::observe($source,'click',$ajax_string);