Bug in demensions_list. If dimensions are closed they shall NOT show up in the lists.
[fa-stable.git] / includes / ui / ui_input.inc
index 3da07206ac88c05321bf6260661bc22f5f0839c5..dd2930c4dc2e2f5ef71c8a2f941eb6e18fcbf987 100644 (file)
@@ -103,17 +103,23 @@ function hidden($name, $value=null, $echo=true)
        else
                return $ret;
 }
-
-function submit($name, $value, $echo=true, $title=false, $async=false, $icon=false)
+/*
+       Various types of submit button selected by $type:
+       null    - button visible only in fallback mode
+       false   - normal submit button
+       true    - ajax driven submit
+       'process' - ajax button with long timeout 
+*/
+function submit($name, $value, $echo=true, $title=false, $type=false, $icon=false)
 {
        global $path_to_root;
-       
+
        default_focus($name);
        $submit_str = "<button class=\""
-           .($async ? 'ajaxsubmit' : 'inputsubmit')
+           .($type ? 'ajaxsubmit' : 'inputsubmit')
                ."\" type=\"submit\""
-               .($async === null ? (fallback_mode() ? ' aspect="fallback"' : " style='display:none;'" ): 
-                       ($async === 'process' ? 'aspect="process"' : '') )
+               .($type === null ? (fallback_mode() ? ' aspect="fallback"' : " style='display:none;'" ): 
+                       ($type === 'process' ? 'aspect="process"' : '') )
            ." name=\"$name\"  id=\"$name\" value=\"$value\""
            .($title ? " title='$title'" : '')
            ."><span>$value</span>"
@@ -203,6 +209,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)
@@ -448,22 +459,38 @@ function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null,
 //-----------------------------------------------------------------------------------
 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);
+       if (get_post($name)) 
+               $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
+       text_row($label, $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);
+       if (get_post($name)) 
+               $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
+       text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
 }
 
 function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
 {
-       text_row("<a href='".$_POST[$name]."' target='_blank'>$label</a>", $name, $value, $size, $max, $title, $params, $post_label);
+       $val = get_post($name);
+       if ($val) {
+               if (strpos($val,'http://')===false)
+                       $val = 'http://'.$val;
+               $label = "<a href='$val' target='_blank'>$label</a>";
+       }
+       text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
 }
 
 function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
 {
-       text_row_ex("<a href='".$_POST[$name]."' target='_blank'>$label</a>", $name, $size, $max, $title, $value, $params, $post_label);
+       $val = get_post($name);
+       if ($val) {
+               if (strpos($val,'http://')===false)
+                       $val = 'http://'.$val;
+               $label = "<a href='$val' target='_blank'>$label</a>";
+       }
+       text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
 }
 
 //-----------------------------------------------------------------------------------