Preparing for Graphic Links final.Optimized.
[fa-stable.git] / includes / ui / ui_controls.inc
index 4fbdb984b4b8ffaf3eb72d265f6e103cedccc15e..46744ae8974b14e38dad7da4c502a6fdf5c624a2 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**********************************************************************
-    Copyright (C) 2005-2008  FrontAccounting, LLC.
+    Copyright (C) FrontAccounting, LLC.
        Released under the terms of the GNU Affero General Public License,
        AGPL, as published by the Free Software Foundation, either version 
        3 of the License, or (at your option) any later version.
@@ -187,24 +187,29 @@ function table_header($labels)
 
 //-----------------------------------------------------------------------------------
 
+function set_icon($icon, $title)
+{
+       global $path_to_root;
+       return "<img src='$path_to_root/themes/".user_theme()."/images/$icon' width='14' height='14' border='0' 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)
        {
-               global $path_to_root;
+               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='' /><img src='$path_to_root/themes/".user_theme().
-                       "/images/$icon' width='14' height='14' border='0' ".($title ? "title='$title'" : "title='$value'")." />\n";
+                       "' value='' />".set_icon($icon, ($title ? $title: $value))."\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)