diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index 7c69f93e7b..721a089cdd 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -128,6 +128,7 @@ $GLOBALS['phpgw_info']['etemplate']['to_process'] = array(); $html = ($this->stable ? $this->html->themeStyles()."\n\n" : ''). // so they get included once $this->html->form($this->include_java_script(1). + $this->html->input_hidden('submit_button','',False). $this->show($this->complete_array_merge($content,$changes),$sel_options,$readonlys,'exec'),array( 'etemplate_exec_id' => $id ),'/etemplate/process_exec.php?menuaction='.$method,'','eTemplate',$GLOBALS['phpgw_info']['etemplate']['form_options']); @@ -210,6 +211,10 @@ // this prevents an empty screen, if the sessiondata gets lost somehow $this->location(array('menuaction' => $_GET['menuaction'])); } + if (isset($_POST['submit_button']) && !empty($_POST['submit_button'])) + { + $this->set_array($_POST,$_POST['submit_button'],'pressed'); + } $content = $_POST['exec']; if (!is_array($content)) { @@ -632,7 +637,7 @@ } if ($value) { - $options .= ' CHECKED'; + $options .= ' checked="1"'; } if ($readonly) { @@ -652,7 +657,7 @@ if ($value == $set_val) { - $options .= ' CHECKED'; + $options .= ' checked="1"'; } if ($readonly) { @@ -666,26 +671,19 @@ break; case 'button': list($app) = explode('.',$this->name); - if ($this->java_script() && $cell['onchange'] != '' && !$cell['needed']) // use a link instead of a button + list($img,$ro_img) = explode(',',$cell_options); + $title = strlen($label) <= 1 || $cell['no_lang'] ? $label : lang($label); + if ($this->java_script() && ($cell['onchange'] != '' || $img && !$readonly) && !$cell['needed']) // use a link instead of a button { - if ($cell['onchange'] == 1) - { - $html .= $this->html->input_hidden($form_name,'',False) . "\n"; - $html .= '' . - (strlen($label) <= 1 || $cell['no_lang'] ? $label : lang($label)) . ''; - } - else // use custom javascript - { - $html .= '' . - (strlen($label) <= 1 || $cell['no_lang'] ? $label : lang($label)) . ''; - } + $onclick = ($cell['onchange'] == 1 || $img) ? "return submitit(document.eTemplate,'$form_name');" : $cell['onchange'].'; return false;'; + $html .= '' . + ($img ? $this->html->image($app,$img,$title,'border="0"') : $title) . ''; } else { - list($img,$ro_img) = explode(',',$cell_options); if (!empty($img)) { - $options .= ' TITLE="'.(strlen($label)<=1||$cell['no_lang']?$label:lang($label)).'"'; + $options .= ' title="'.$title.'"'; } $html .= !$readonly ? $this->html->submit_button($form_name,$label,$cell['onchange'], strlen($label) <= 1 || $cell['no_lang'],$options,$img,$app) : @@ -978,7 +976,7 @@ } if (is_int($this->debug) && $this->debug >= 1 || $this->debug == $this->name && $this->name) { - echo "
process_show($this->name) start: content ="; _debug_array($content); + echo "
process_show($this->name) cname='$cname' start: content ="; _debug_array($content); } $content_in = $cname ? array($cname => $content) : $content; $content = array(); diff --git a/etemplate/js/etemplate.js b/etemplate/js/etemplate.js index 9901580730..acd4f6cf19 100644 --- a/etemplate/js/etemplate.js +++ b/etemplate/js/etemplate.js @@ -11,6 +11,14 @@ /* $Id$ */ +function submitit(form,name) +{ + //alert(name+' pressed'); + form.submit_button.value = name; + form.submit(); + return false; +} + function set_element(form,name,value) { //alert('set_element: '+name+'='+value); diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index 2ac900f327..92bf96c52d 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -202,8 +202,7 @@ { $image = substr($image,0,strpos($image,'.')); } - if (!($path = $GLOBALS['phpgw']->common->image($app,$image)) && - !($path = $GLOBALS['phpgw']->common->image('phpgwapi',$image))) + if (!($path = $GLOBALS['phpgw']->common->image($app,$image))) { $path = $image; // name may already contain absolut path } @@ -349,6 +348,10 @@ function image( $app,$name,$title='',$options='' ) { + if (strpos($name,'.')) + { + $name = substr($name,0,strpos($name,'.')); + } if (!($path = $GLOBALS['phpgw']->common->image($app,$name))) { $path = $name; // name may already contain absolut path