* @param boolean $return if false, output the form directly, otherwise return the HTML as a string.
* @param string $tooltip a tooltip to add to the button as a title attribute.
* @param boolean $disabled if true, the button will be disabled.
+ * @param string $jsconfirmmessage if not empty then display a confirm dialogue with this string as the question.
* @return string / nothing depending on the $return paramter.
*/
-function print_single_button($link, $options, $label='OK', $method='get', $target='_self', $return=false, $tooltip='', $disabled = false) {
+function print_single_button($link, $options, $label='OK', $method='get', $target='_self', $return=false, $tooltip='', $disabled = false, $jsconfirmmessage='') {
$output = '';
$link = str_replace('"', '"', $link); //basic XSS protection
$output .= '<div class="singlebutton">';
} else {
$disabled = '';
}
- $output .= '<input type="submit" value="'. s($label) ."\" $tooltip $disabled/></div></form></div>";
+ if ($jsconfirmmessage){
+ $jsconfirmmessage = addslashes_js($jsconfirmmessage);
+ $jsconfirmmessage = 'onclick="'.s('return confirm("'.$jsconfirmmessage.'");').'"';
+ }
+ $output .= '<input type="submit" value="'. s($label) ."\" $tooltip $disabled $jsconfirmmessage/></div></form></div>";
if ($return) {
return $output;