Minor bug
[fa-stable.git] / includes / ui / ui_input.inc
index 091a874c7852e8ca7df09606f2e86e40522cf907..a2355cfb02ee4f34c8823d65c63a1feb6910f539 100644 (file)
@@ -231,6 +231,11 @@ function submit_return($name, $value, $title=false, $async=false)
                submit($name, $value, true, $title, $async);
        }
 }
+
+function submit_js_confirm($name, $msg) {
+       add_js_source(
+               "_validate.$name=function(){ return confirm('$msg');};");
+};
 //-----------------------------------------------------------------------------------
 
 function set_icon($icon, $title=false)
@@ -260,7 +265,7 @@ function button($name, $value, $title=false, $icon=false)
 
 function button_cell($name, $value, $title=false, $icon=false)
 {
-       echo "<td>";
+       echo "<td align='center'>";
        echo button($name, $value, $title, $icon);
        echo "</td>";
 }
@@ -315,11 +320,12 @@ function check($label, $name, $value=null, $submit_on_change=false, $title=false
        echo checkbox($label, $name, $value, $submit_on_change, $title);
 }
 
-function check_cells($label, $name, $value, $submit_on_change=false, $title=false)
+function check_cells($label, $name, $value, $submit_on_change=false, $title=false,
+       $params='')
 {
        if ($label != null)
                echo "<td>$label</td>\n";
-       echo "<td align='center'>";
+       echo "<td $params>";
        echo check(null, $name, $value, $submit_on_change, $title);
        echo "</td>";
 }
@@ -754,7 +760,7 @@ function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $
 //  displays value of inactive field as checkbox cell.
 //  Also updates database record after status change.
 //
-function inactive_status_cell($id, $value, $table, $key)
+function inactive_control_cell($id, $value, $table, $key)
 {
        global  $Ajax;
 
@@ -766,14 +772,14 @@ function inactive_status_cell($id, $value, $table, $key)
                        get_post('Update')) && (check_value('Inactive'.$id) != $value)) {
                        update_record_status($id, !$value, $table, $key);
                }
-               echo '<td align="center">'. checkbox(null, $name, $value, true, '')
+               echo '<td align="center">'. checkbox(null, $name, $value, true, '', "align='center'")
                        . hidden("LInact[$id]", $value, false) . '</td>';       
        }
 }
 //
 //     Displays controls for optional display of inactive records
 //
-function show_inactive_row($th) {
+function inactive_control_row($th) {
        echo  "<tr><td colspan=".(count($th)).">"
                ."<div style='float:left;'>"
                . checkbox(null, 'show_inactive', null, true). _("Show also Inactive")
@@ -781,5 +787,16 @@ function show_inactive_row($th) {
                . submit('Update', _('Update'), false, '', null)
                ."</div></td></tr>";
 }
-
+//
+//     Inserts additional column header when display of inactive records is on.
+//
+function inactive_control_column(&$th) {
+       global $Ajax;
+       
+       if (check_value('show_inactive')) 
+               array_insert($th, count($th)-2 , _("Inactive"));
+       if (get_post('_show_inactive_update')) {
+               $Ajax->activate('_page_body');
+       }
+}
 ?>
\ No newline at end of file