function showSelectForm($label, $specifics)
{
    echo    '<tr><td align="right" class="alternativeBgDark">', "\n",
        	'<form action="', api_get_self(), '" method="post">', "\n",
            	get_lang($label), ' :', "\n", $specifics, "\n",
                '<input type="submit" value="', '  '.get_lang('Ok').'  ', '" />', "\n",
            '</form></td></tr>', "\n";
}

echo '<h3>', get_lang('OrElse'), '</h3>', "\n<table>\n";

$specifics = '<select name="workWith">' . "\n" .
	'<option value="" style="color:#999999">' . get_lang('Root') . "</option>\n";

if (($dirList = index_and_sort_dir($baseWorkDir)))  // fileManage.lib
{
    $someDirs = array();

    foreach ($dirList as $pathValue)
        $someDirs[$pathValue] = file_exists($pathValue. '/'. MFFNAME. MFFDEXT);

    foreach ($someDirs as $pathValue => $mfExists) if ($mfExists)
    {
        while (($i = strrpos($pathValue, '/')))
        {
            $pathValue = substr($pathValue, 0, $i);
            if (!array_key_exists($pathValue, $someDirs)) break;
            $someDirs[$pathValue] = TRUE;
        }
    }
/**
 * Builds a html form listing all directories of a given directory
 *
 */
function form_dir_list($source_type, $source_component, $command, $base_work_dir)
{
    $dir_list = index_and_sort_dir($base_work_dir);
    $dialog_box .= "<form action=\"" . api_get_self() . "\" method=\"post\">\n";
    $dialog_box .= "<input type=\"hidden\" name=\"" . $source_type . "\" value=\"" . $source_component . "\">\n";
    $dialog_box .= get_lang('Move') . ' ' . $source_component . ' ' . get_lang('To');
    $dialog_box .= "<select name=\"" . $command . "\">\n";
    $dialog_box .= "<option value=\"\" style=\"color:#999999\">" . get_lang('Root') . "\n";
    $bwdLen = strlen($base_work_dir);
    // base directories lenght, used under
    /* build html form inputs */
    if ($dir_list) {
        while (list(, $path_value) = each($dir_list)) {
            $path_value = substr($path_value, $bwdLen);
            // Truncates cunfidential informations confidentielles
            $dirname = basename($path_value);
            // Extracts $path_value directory name du nom
            /* compute de the display tab */
            $tab = "";
            // $tab reinitialisation
            $depth = substr_count($path_value, '/');
            // The number of nombre '/' indicates the directory deepness
            for ($h = 0; $h < $depth; $h++) {
                $tab .= "&nbsp;&nbsp;";
            }
            $dialog_box .= "<option value=\"{$path_value}\">{$tab}>{$dirname}\n";
        }
    }
    $dialog_box .= "</select>\n";
    $dialog_box .= "<input type=\"submit\" value=\"" . get_lang('Ok') . "\">";
    $dialog_box .= "</form>\n";
    return $dialog_box;
}
示例#3
0
/**
 * build an html form listing all directories of a given directory and file to move
 *
 * @param file        string: filename to o move
 * @param baseWorkDir string: complete path to root directory to prupose as target for move
 */
function form_dir_list($file, $baseWorkDir)
{
    $dirList = index_and_sort_dir($baseWorkDir);
    $dialogBox = '<strong>' . get_lang('Move') . '</strong>' . "\n" . "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">\n" . claro_form_relay_context() . "<input type=\"hidden\" name=\"cmd\" value=\"exMv\" />\n" . "<input type=\"hidden\" name=\"file\" value=\"" . base64_encode($file) . "\" />\n" . "<label for=\"destiantion\">" . get_lang('Move <i>%filename</i> to', array('%filename' => basename($file))) . "</label> \n" . "<select name=\"destination\">\n";
    if (dirname($file) == '/' || dirname($file) == '\\') {
        $dialogBox .= '<option value="" class="invisible">root</option>' . "\n";
    } else {
        $dialogBox .= '<option value="" >root</option>' . "\n";
    }
    $bwdLen = strlen($baseWorkDir);
    // base directories length, used under
    /* build html form inputs */
    if ($dirList) {
        while (list(, $pathValue) = each($dirList)) {
            $pathValue = substr($pathValue, $bwdLen);
            // truncate confidential informations
            $dirname = basename($pathValue);
            // extract $pathValue directory name
            /* compute de the display tab */
            $tab = '';
            // $tab reinitialisation
            $depth = substr_count($pathValue, '/');
            // The number of nombre '/' indicates the directory deepness
            for ($h = 0; $h < $depth; $h++) {
                $tab .= '&nbsp;&nbsp';
            }
            if ($file == $pathValue or dirname($file) == $pathValue) {
                $dialogBox .= '<option class="invisible" value="' . $pathValue . '">' . $tab . ' &gt; ' . $dirname . '</option>' . "\n";
            } else {
                $dialogBox .= '<option value="' . $pathValue . '">' . $tab . ' &gt; ' . $dirname . '</option>' . "\n";
            }
        }
    }
    $dialogBox .= '</select>' . "\n" . '<br /><br />' . '<input type="submit" value="' . get_lang('Ok') . '" />&nbsp;' . claro_html_button($_SERVER['PHP_SELF'] . '?cmd=exChDir&file=' . claro_htmlspecialchars(claro_dirname($file)), get_lang('Cancel')) . '</form>' . "\n";
    return $dialogBox;
}
function form_dir_list($sourceType, $sourceComponent, $command, $baseWorkDir, $language)
{
    //Aadido por Fernando Acero Martin
    include_once '../lang/english/trad4all.inc.php';
    include_once "../lang/{$language}/trad4all.inc.php";
    include_once '../lang/english/document.inc.php';
    include_once "../lang/{$language}/document.inc.php";
    //Fin del aadido
    $dirList = index_and_sort_dir($baseWorkDir);
    $dialogBox .= "<form action=\"" . $_SERVER[PHP_SELF] . "\" method=\"post\">\n";
    $dialogBox .= "<input type=\"hidden\" name=\"{$sourceType}\" value=\"{$sourceComponent}\">\n";
    $dialogBox .= "{$langMove} " . $sourceComponent . " {$langTo}: \n";
    $dialogBox .= "<select name=\"{$command}\">\n";
    $dialogBox .= "<option value=\"\" style=\"color:#999999\">Ra&iacute;z\n";
    $bwdLen = strlen($baseWorkDir);
    // base directories lenght, used under
    /* build html form inputs */
    if ($dirList) {
        while (list(, $pathValue) = each($dirList)) {
            $pathValue = substr($pathValue, $bwdLen);
            // truncate cunfidential informations confidentielles
            $dirname = basename($pathValue);
            // extract $pathValue directory name du nom
            /* compute de the display tab */
            $tab = '';
            // $tab reinitialisation
            $depth = substr_count($pathValue, '/');
            // The number of nombre '/' indicates the directory deepness
            for ($h = 0; $h < $depth; $h++) {
                $tab .= '&nbsp;&nbsp';
            }
            $dialogBox .= "<option value=\"{$pathValue}\">{$tab}>{$dirname}\n";
        }
    }
    $dialogBox .= "</select>\n";
    $dialogBox .= "<input type=\"submit\" value=\"{$langOk}\">";
    $dialogBox .= "</form>\n";
    return $dialogBox;
}