Added ajax and some smaller fixes in sales module files
[fa-stable.git] / includes / ui / ui_controls.inc
index 9d52934fad5fdf9e7fa6ece110d05efb4b446b12..3452b0bd4725f8d8dd7bf9fed7a2146c65cc3c8c 100644 (file)
@@ -63,7 +63,8 @@ function hyperlink_back($center=true)
 {
        if ($center)
                echo "<center>";
-       echo "<a href='javascript:goBack();'>"._("Back")."</a>\n";
+       //echo "<a href='javascript:goBack();'>"._("Back")."</a>\n";
+       echo "<p><a href='javascript:goBack();'>"._("Back")."</a></p>\n";
        if ($center)
                echo "</center>";
        echo "<br>";
@@ -150,19 +151,22 @@ function table_header($labels)
        end_row();
 }
 
-function edit_link_cell($param)
+function edit_link_cell($param, $title=false)
 {
-       label_cell("<a href='" . $_SERVER['PHP_SELF']. "?" . "$param'>" . _("Edit") . "</a>", "nowrap");
+    label_cell("<a href='" . $_SERVER['PHP_SELF']. "?" . "$param'"
+        .($title ? " title='$title'":'').">" . _("Edit") . "</a>", "nowrap");
 }
 
-function delete_link_cell($param)
+function delete_link_cell($param, $title=false)
 {
-       label_cell("<a href='" . $_SERVER['PHP_SELF']. "?" . "$param'>" . _("Delete") . "</a>", "nowrap");
+    label_cell("<a href='" . $_SERVER['PHP_SELF']. "?" . "$param'"
+       .($title ? " title='$title'":'') .">" . _("Delete") . "</a>", "nowrap");
 }
 
-function edit_button_cell($name, $value)
+function edit_button_cell($name, $value, $title=false)
 {
-    label_cell("<input type=\"submit\" class=\"editbutton\" name=\"$name\" value=\"$value\" />\n");
+    label_cell("<input type=\"submit\" class=\"editbutton\" name=\"$name\" value=\"$value\""
+       .($title ? " title='$title'":'')." />\n");
 }
 
 //-----------------------------------------------------------------------------------
@@ -188,11 +192,11 @@ function br($num=1)
 
 $ajax_divs = array();
 
-function div_start($id='')
+function div_start($id='', $trigger=null)
 {
     global $ajax_divs;
 
-    array_push($ajax_divs, $id);
+    array_push($ajax_divs, array($id, $trigger===null ? $id : $trigger));
     echo "<div ". ($id !='' ? "id='$id'" : '').">";
     ob_start();
 }
@@ -203,8 +207,8 @@ function div_end()
 
     if (count($ajax_divs))
     {
-               $id = array_pop($ajax_divs);
-               $Ajax->addUpdate($id, $id, ob_get_flush());
+               $div = array_pop($ajax_divs);
+               $Ajax->addUpdate($div[1], $div[0], ob_get_flush());
                echo "</div>";
     }
 }