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>"
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)
//-----------------------------------------------------------------------------------
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);
}
//-----------------------------------------------------------------------------------