Better layout. Copyright notes. Mailto links. (2. run)
[fa-stable.git] / includes / ui / ui_input.inc
index 59064f82de031820d3c698b0995031687840cfad..588f867c31ddd381387a3c6a90478d6457a6cc24 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)
@@ -286,6 +312,11 @@ function label_cell($label, $params="", $id=null)
        return $label;
 }
 
+function email_cell($label, $params="", $id=null)
+{
+       label_cell("<a href='mailto:$label'>$label</a>", $params, $id);
+}
+
 function amount_cell($label, $bold=false, $params="", $id=null)
 {
        if ($bold)
@@ -402,6 +433,17 @@ function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null,
        echo "</tr>\n";
 }
 
+//-----------------------------------------------------------------------------------
+function email_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
+{
+       text_row("<a href='Mailto:".$_POST[$name]."'>$label</a>", $name, $value, $size, $max, $title, $params, $post_label);
+}
+
+function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
+{
+       text_row_ex("<a href='Mailto:".$_POST[$name]."'>$label</a>", $name, $size, $max, $title, $value, $params, $post_label);
+}
+
 //-----------------------------------------------------------------------------------
 
 function date_cells($label, $name, $title = null, $init=null, $inc_days=0, 
@@ -494,7 +536,10 @@ function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=nu
        if (!isset($max))
                $max = $size;
 
-       echo "<td>";
+       if ($label != null)
+               echo "<td>";
+       else
+               echo "<td align='right'>";
 
        echo "<input class='amount' type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" dec=\"$dec\" value=\"" . $_POST[$name]. "\">";