forked from extern/egroupware
added eTemplate widget file / FileUpload
added options param to html.form
This commit is contained in:
parent
f92c84b48c
commit
d927ce6f07
@ -49,6 +49,7 @@
|
|||||||
'select-account' => 'Select Account', // label=accounts(default),groups,both
|
'select-account' => 'Select Account', // label=accounts(default),groups,both
|
||||||
// size: -1=Single+not assigned, 0=Single, >0=Multiple
|
// size: -1=Single+not assigned, 0=Single, >0=Multiple
|
||||||
'raw' => 'Raw', // Raw html in $content[$cell['name']]
|
'raw' => 'Raw', // Raw html in $content[$cell['name']]
|
||||||
|
'file' => 'FileUpload' // show an input type='file', set the local name as ${name}_path
|
||||||
);
|
);
|
||||||
/*!
|
/*!
|
||||||
@function boetemplate
|
@function boetemplate
|
||||||
|
@ -95,9 +95,9 @@ class html
|
|||||||
return "<input type=\"checkbox\" name=\"$name\" value=\"True\"" .($value ? ' checked' : '') . ">\n";
|
return "<input type=\"checkbox\" name=\"$name\" value=\"True\"" .($value ? ' checked' : '') . ">\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 = "<form method=\"$method\" ".($name != '' ? "name=\"$name\" " : '')."action=\"".$this->link($url,$url_vars)."\">\n";
|
$html = "<form method=\"$method\" ".($name != '' ? "name=\"$name\" " : '')."action=\"".$this->link($url,$url_vars)."\" $options>\n";
|
||||||
$html .= $this->input_hidden($hidden_vars);
|
$html .= $this->input_hidden($hidden_vars);
|
||||||
|
|
||||||
if ($content) {
|
if ($content) {
|
||||||
@ -111,7 +111,7 @@ class html
|
|||||||
$form_name='',$method='POST')
|
$form_name='',$method='POST')
|
||||||
{
|
{
|
||||||
return $this->form($this->submit_button($name,$lang),
|
return $this->form($this->submit_button($name,$lang),
|
||||||
$hidden_vars,$url,$url_vars,$form_name,$method);
|
$hidden_vars,$url,$url_vars,$form_name,'',$method);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
// 3=calls to show_cell and process_show_cell, or template-name or cell-type
|
// 3=calls to show_cell and process_show_cell, or template-name or cell-type
|
||||||
var $html,$sbox; // instance of html / sbox2-class
|
var $html,$sbox; // instance of html / sbox2-class
|
||||||
var $loop = 0; // set by process_show if an other Exec-ProcessExec loop is needed
|
var $loop = 0; // set by process_show if an other Exec-ProcessExec loop is needed
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function etemplate
|
@function etemplate
|
||||||
@abstract constructor of etemplate class, reads an eTemplate if $name is given
|
@abstract constructor of etemplate class, reads an eTemplate if $name is given
|
||||||
@ -102,10 +101,13 @@
|
|||||||
|
|
||||||
$id = $this->appsession_id();
|
$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
|
$html .= $this->html->nextMatchStyles($this->style)."\n\n". // so they get included once
|
||||||
$this->html->form($this->include_java_script() .
|
$this->html->form($this->include_java_script() .
|
||||||
$this->show($this->complete_array_merge($content,$changes),$sel_options,$readonlys,'exec'),
|
$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(
|
$id = $this->save_appsession($this->as_array(1) + array(
|
||||||
'readonlys' => $readonlys,
|
'readonlys' => $readonlys,
|
||||||
@ -542,6 +544,12 @@
|
|||||||
$html .= $name == '' ? $image : $this->html->a_href($image,$name);
|
$html .= $name == '' ? $image : $this->html->a_href($image,$name);
|
||||||
$extra_label = False;
|
$extra_label = False;
|
||||||
break;
|
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:
|
default:
|
||||||
if (!isset($this->extension[$cell['type']]))
|
if (!isset($this->extension[$cell['type']]))
|
||||||
{
|
{
|
||||||
@ -853,6 +861,27 @@ document.write(\''.str_replace("\n",'',$this->html->input_hidden('java_script','
|
|||||||
$js .= '<script language="JavaScript">
|
$js .= '<script language="JavaScript">
|
||||||
function set_element(form,name,value)
|
function set_element(form,name,value)
|
||||||
{
|
{
|
||||||
|
'. /* ' alert("set_element: "+name+"="+value);'. */ '
|
||||||
|
for (i = 0; i < form.length; i++)
|
||||||
|
{
|
||||||
|
if (form.elements[i].name == name)
|
||||||
|
{
|
||||||
|
form.elements[i].value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_element2(form,name,vname)
|
||||||
|
{
|
||||||
|
'. /* ' alert("set_element2: "+name+"="+vname);'. */ '
|
||||||
|
for (i = 0; i < form.length; i++)
|
||||||
|
{
|
||||||
|
if (form.elements[i].name == vname)
|
||||||
|
{
|
||||||
|
value = form.elements[i].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'. /* ' alert("set_element2: "+name+"="+value);'. */ '
|
||||||
for (i = 0; i < form.length; i++)
|
for (i = 0; i < form.length; i++)
|
||||||
{
|
{
|
||||||
if (form.elements[i].name == name)
|
if (form.elements[i].name == name)
|
||||||
|
Loading…
Reference in New Issue
Block a user