summaryrefslogtreecommitdiffstats
path: root/lib/class/ajax.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-04 05:25:25 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-04 05:25:25 +0000
commit2ebfdf4c29ac9e33b8070243856b48ef665e61a9 (patch)
tree706831ca65800d8469cba2f4855d13246c78f206 /lib/class/ajax.class.php
parentb909c08509458f4a76ba0ba7922316cd7e55b0d4 (diff)
downloadampache-2ebfdf4c29ac9e33b8070243856b48ef665e61a9.tar.gz
ampache-2ebfdf4c29ac9e33b8070243856b48ef665e61a9.tar.bz2
ampache-2ebfdf4c29ac9e33b8070243856b48ef665e61a9.zip
fixed potential issue with kajax, and added advanced search button to top, right bar
Diffstat (limited to 'lib/class/ajax.class.php')
-rw-r--r--lib/class/ajax.class.php42
1 files changed, 24 insertions, 18 deletions
diff --git a/lib/class/ajax.class.php b/lib/class/ajax.class.php
index b3d35f07..441d9a47 100644
--- a/lib/class/ajax.class.php
+++ b/lib/class/ajax.class.php
@@ -51,21 +51,34 @@ class Ajax {
} // observe
/**
+ * action
+ * This takes the action, the source and the post (if passed) and generated the full
+ * ajax link
+ */
+ public static function action($action,$source,$post='') {
+
+ $url = Config::get('ajax_url') . $action;
+
+ if ($post) {
+ $ajax_string = "ajaxPost('$url','$post','$source')";
+ }
+ else {
+ $ajax_string = "ajaxPut('$url','$source')";
+ }
+
+ return $ajax_string;
+
+ } // action
+
+ /**
* button
* This prints out an img of the specified icon with the specified alt text
* and then sets up the required ajax for it
*/
public static function button($action,$icon,$alt,$source='',$post='') {
- $url = Config::get('ajax_url') . $action;
-
- // Define the Action that is going to be performed
- if ($post) {
- $ajax_string = "ajaxPost('$url','$post','$source')";
- }
- else {
- $ajax_string = "ajaxPut('$url','$source')";
- }
+ // Get the correct action
+ $ajax_string = self::action($action,$source,$post);
$string = get_user_icon($icon,$alt,$source);
@@ -82,15 +95,8 @@ class Ajax {
*/
public static function text($action,$text,$source,$post='',$span_class='') {
- $url = Config::get('ajax_url') . $action;
-
- // Use ajaxPost() if we are doing a post
- if ($post) {
- $ajax_string = "ajaxPost('$url','$post','$source')";
- }
- else {
- $ajax_string = "ajaxPut('$url','$source')";
- }
+ // Format the string we wanna use
+ $ajax_string = self::action($action,$source,$post);
// If they passed a span class
if ($span_class) {