From 2ebfdf4c29ac9e33b8070243856b48ef665e61a9 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sat, 4 Aug 2007 05:25:25 +0000 Subject: fixed potential issue with kajax, and added advanced search button to top, right bar --- lib/class/ajax.class.php | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'lib/class/ajax.class.php') 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 @@ -50,6 +50,26 @@ 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 @@ -57,15 +77,8 @@ class Ajax { */ 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) { -- cgit