- let makePathfield return usable values for the formfield (dynamically changing between select, text and hidden, depending on settings)

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2011-02-24 10:50:59 +01:00
parent ca9128bdbf
commit 393a5ce570
7 changed files with 43 additions and 27 deletions

View File

@@ -36,11 +36,15 @@ function makePathfield($path, $uid, $gid, $fieldType, $value = '')
{
global $lng;
$value = str_replace($path, '', $value);
$field = '';
$field = array();
if($fieldType == 'Manual')
{
$field = '<input type="text" name="path" value="' . htmlspecialchars($value) . '" />';
$field = array(
'type' => 'text',
'value' => htmlspecialchars($value)
);
}
elseif($fieldType == 'Dropdown')
{
@@ -58,7 +62,7 @@ function makePathfield($path, $uid, $gid, $fieldType, $value = '')
{
if(sizeof($dirList) <= 100)
{
$field = '<select name="path">';
$_field = '';
foreach($dirList as $key => $dir)
{
if(strpos($dir, $path) === 0)
@@ -66,23 +70,35 @@ function makePathfield($path, $uid, $gid, $fieldType, $value = '')
$dir = makeCorrectDir(substr($dir, strlen($path)));
}
$field.= makeoption($dir, $dir, $value);
$_field.= makeoption($dir, $dir, $value);
}
$field.= '</select>';
$field = array(
'type' => 'select',
'value' => $_field
);
}
else
{
// remove starting slash we added
// for the Dropdown, #225
$value = substr($value, 1);
$field = $lng['panel']['toomanydirs'];
$field.= '<br /><input type="text" name="path" value="' . htmlspecialchars($value) . '" />';
//$field = $lng['panel']['toomanydirs'];
$field = array(
'type' => 'text',
'value' => htmlspecialchars($value),
'note' => $lng['panel']['toomanydirs']
);
}
}
else
{
$field = $lng['panel']['dirsmissing'];
$field.= '<input type="hidden" name="path" value="/" />';
//$field = $lng['panel']['dirsmissing'];
$field = '<input type="hidden" name="path" value="/" />';
$field = array(
'type' => 'hidden',
'value' => '/',
'note' => $lng['panel']['dirsmissing']
);
}
}