diff --git a/etemplate/inc/class.boetemplate.inc.php b/etemplate/inc/class.boetemplate.inc.php index 66a97cda2d..221e8098b7 100644 --- a/etemplate/inc/class.boetemplate.inc.php +++ b/etemplate/inc/class.boetemplate.inc.php @@ -49,6 +49,7 @@ 'select-account' => 'Select Account', // label=accounts(default),groups,both // size: -1=Single+not assigned, 0=Single, >0=Multiple 'raw' => 'Raw', // Raw html in $content[$cell['name']] + 'file' => 'FileUpload' // show an input type='file', set the local name as ${name}_path ); /*! @function boetemplate diff --git a/etemplate/inc/class.html.inc.php b/etemplate/inc/class.html.inc.php index 24ff27c61b..9977540cd0 100644 --- a/etemplate/inc/class.html.inc.php +++ b/etemplate/inc/class.html.inc.php @@ -95,9 +95,9 @@ class html return "\n"; } - function form($content,$hidden_vars,$url,$url_vars='',$name='',$method='POST') + function form($content,$hidden_vars,$url,$url_vars='',$name='',$options='',$method='POST') { - $html = "
link($url,$url_vars)."\">\n"; + $html = "link($url,$url_vars)."\" $options>\n"; $html .= $this->input_hidden($hidden_vars); if ($content) { @@ -111,7 +111,7 @@ class html $form_name='',$method='POST') { return $this->form($this->submit_button($name,$lang), - $hidden_vars,$url,$url_vars,$form_name,$method); + $hidden_vars,$url,$url_vars,$form_name,'',$method); } /*! diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index ac6562cc82..ef0a02aed8 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -34,7 +34,6 @@ // 3=calls to show_cell and process_show_cell, or template-name or cell-type var $html,$sbox; // instance of html / sbox2-class var $loop = 0; // set by process_show if an other Exec-ProcessExec loop is needed - /*! @function etemplate @abstract constructor of etemplate class, reads an eTemplate if $name is given @@ -102,10 +101,13 @@ $id = $this->appsession_id(); + $GLOBALS['phpgw_info']['etemplate']['form_options'] = ''; // might be set in show $html .= $this->html->nextMatchStyles($this->style)."\n\n". // so they get included once $this->html->form($this->include_java_script() . $this->show($this->complete_array_merge($content,$changes),$sel_options,$readonlys,'exec'), - array('etemplate_exec_id' => $id),'/index.php?menuaction=etemplate.etemplate.process_exec','','eTemplate'); + array('etemplate_exec_id' => $id), + '/index.php?menuaction=etemplate.etemplate.process_exec','','eTemplate', + $GLOBALS['phpgw_info']['etemplate']['form_options']); $id = $this->save_appsession($this->as_array(1) + array( 'readonlys' => $readonlys, @@ -542,6 +544,12 @@ $html .= $name == '' ? $image : $this->html->a_href($image,$name); $extra_label = False; break; + case 'file': + $html .= $this->html->input_hidden($path = str_replace($name,$name.'_path',$form_name),'.'); + $html .= $this->html->input($form_name,'','file'); + $GLOBALS['phpgw_info']['etemplate']['form_options'] = + "enctype=\"multipart/form-data\" onSubmit=\"set_element2(this,'$path','$form_name')\""; + break; default: if (!isset($this->extension[$cell['type']])) { @@ -853,6 +861,27 @@ document.write(\''.str_replace("\n",'',$this->html->input_hidden('java_script',' $js .= '