Button helpers moved to ui_input.inc, reusable button code.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 5 Dec 2008 08:58:54 +0000 (08:58 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 5 Dec 2008 08:58:54 +0000 (08:58 +0000)
includes/ui/ui_controls.inc
includes/ui/ui_input.inc

index d851544c524358f057043e133528508c65c0758f..5d9f6113e5969273078d5bf44684fb69adfdf4c3 100644 (file)
@@ -184,51 +184,6 @@ function table_header($labels)
                labelheader_cell($label);
        end_row();
 }
-
-//-----------------------------------------------------------------------------------
-
-function set_icon($icon, $title=false)
-{
-       global $path_to_root;
-       return "<img src='$path_to_root/themes/".user_theme()."/images/$icon' width='14' height='14' border='0'".($title ? " title='$title'" : "")." />\n";     
-}
-
-function button($name, $value, $title=false, $icon=false)
-{
-       // php silently changes dots,spaces,'[' and characters 128-159
-       // to underscore in POST names, to maintain compatibility with register_globals
-       if (user_graphic_links() && $icon)
-       {
-               if ($value == _("Delete")) // Helper during implementation
-                       $icon = ICON_DELETE;
-               echo "<button type='submit' class='editbutton' name='".
-                       htmlentities(strtr($name, array('.'=>'=2E',' '=>'=20','='=>'=3D','['=>'=5B'))).
-                       "' value=''" . ($title ? " title='$title'":" title='$value'")." />".set_icon($icon)."\n";
-       }
-       else
-               echo "<input type='submit' class='editbutton' name='"
-                       .htmlentities(strtr($name, array('.'=>'=2E',' '=>'=20','='=>'=3D','['=>'=5B')))
-                       ."' value='$value'"
-                       .($title ? " title='$title'":'')." />\n";
-}
-
-function button_cell($name, $value, $title=false, $icon=false)
-{
-       echo "<td>";
-       button($name, $value, $title, $icon);
-       echo "</td>";
-}
-
-function delete_button_cell($name, $value, $title=false)
-{
-       button_cell($name, $value, $title, ICON_DELETE);
-}
-
-function edit_button_cell($name, $value, $title=false)
-{
-       button_cell($name, $value, $title, ICON_EDIT);
-}
-
 //-----------------------------------------------------------------------------------
 
 function start_row($param="")
index 64df8c49182ed34dfeed38bbe27388d28907bb08..aca6e1deab9db00d1132d20f1178b70617598873 100644 (file)
@@ -203,23 +203,49 @@ function submit_return($name, $value, $title=false, $async=false)
                submit($name, $value, true, $title, $async);
        }
 }
-//---------------------------------------------------------------------------------
-/*
-function button($name, $value, $onclick, $title=false)
+//-----------------------------------------------------------------------------------
+
+function set_icon($icon, $title=false)
 {
-       default_focus($name);
-       echo "<input type=\"button\" class=\"inputsubmit\" name=\"$name\" value=\"$value\" onclick=\"$onclick\""
-           .($title ? " title='$title'" : '')
-           ." />\n";
+       global $path_to_root;
+       return "<img src='$path_to_root/themes/".user_theme()."/images/$icon' width='14' height='14' border='0'".($title ? " title='$title'" : "")." />\n";     
 }
 
-function button_cell($name, $value, $onclick, $title=false)
+function button($name, $value, $title=false, $icon=false)
+{
+       // php silently changes dots,spaces,'[' and characters 128-159
+       // to underscore in POST names, to maintain compatibility with register_globals
+       if (user_graphic_links() && $icon)
+       {
+               if ($value == _("Delete")) // Helper during implementation
+                       $icon = ICON_DELETE;
+               return "<button type='submit' class='editbutton' name='".
+                       htmlentities(strtr($name, array('.'=>'=2E',' '=>'=20','='=>'=3D','['=>'=5B'))).
+                       "' value=''" . ($title ? " title='$title'":" title='$value'")." />".set_icon($icon)."\n";
+       }
+       else
+               return "<input type='submit' class='editbutton' name='"
+                       .htmlentities(strtr($name, array('.'=>'=2E',' '=>'=20','='=>'=3D','['=>'=5B')))
+                       ."' value='$value'"
+                       .($title ? " title='$title'":'')." />\n";
+}
+
+function button_cell($name, $value, $title=false, $icon=false)
 {
        echo "<td>";
-       button($name, $value, $onclick, $title);
-       echo "</td>\n";
+       echo button($name, $value, $title, $icon);
+       echo "</td>";
+}
+
+function delete_button_cell($name, $value, $title=false)
+{
+       button_cell($name, $value, $title, ICON_DELETE);
+}
+
+function edit_button_cell($name, $value, $title=false)
+{
+       button_cell($name, $value, $title, ICON_EDIT);
 }
-*/
 //-----------------------------------------------------------------------------------
 
 function check_value($name)