Ejemplo n.º 1
0
if ($uploadwithproperties) {
    echo '<a href="' . regenerate_url('uploadwithproperties', 'uploadwithproperties=0') . '">' . T_('Hide advanced upload properties') . '</a>';
} else {
    echo '<a href="' . regenerate_url('uploadwithproperties', 'uploadwithproperties=1') . '">' . T_('Show advanced upload properties') . '</a>';
}
?>
			</td>
		</tr>
	</thead>

	<tbody>
		<tr>
			<?php 
echo '<td id="fm_dirtree">';
// Version with all roots displayed
echo get_directory_tree(NULL, NULL, $ads_list_path, true);
// Version with only the current root displayed:
// echo get_directory_tree( $fm_FileRoot, $fm_FileRoot->ads_path, $ads_list_path, true );
echo '</td>';
echo '<td id="fm_files">';
if (count($failedFiles)) {
    echo '<p class="error">' . T_('Some file uploads failed. Please check the errors below.') . '</p>';
}
?>

			<div class="upload_title"><?php 
echo T_('Files to upload');
?>
</div>

			<ul id="uploadfileinputs">
Ejemplo n.º 2
0
		</div>

			</td>
		</tr>
	</thead>

	<tbody>
		<tr>
			<?php 
// ______________________________ Directory tree ______________________________
if (!$fm_hide_dirtree) {
    echo '<td id="fm_dirtree">';
    // Version with all roots displayed
    //echo get_directory_tree( NULL, NULL, $ads_list_path );
    // Version with only the current root displayed:
    echo get_directory_tree($fm_Filelist->_FileRoot, $fm_Filelist->_FileRoot->ads_path, $ads_list_path);
    echo '</td>';
}
echo '<td id="fm_files">';
// ______________________________ Files ______________________________
require dirname(__FILE__) . '/_file_list.inc.php';
// ______________________________ Toolbar ______________________________
echo '<div class="fileman_toolbars_bottom">';
/*
 * CREATE FILE/FOLDER TOOLBAR:
 */
if (($Settings->get('fm_enable_create_dir') || $Settings->get('fm_enable_create_file')) && $current_User->check_perm('files', 'add', false, $fm_FileRoot)) {
    // dir or file creation is enabled and we're allowed to add files:
    global $create_type;
    echo '<div class="toolbaritem">';
    $Form = new Form(NULL, '', 'post', 'none');
Ejemplo n.º 3
0
/**
 * Get the directories of the supplied path as a radio button tree.
 *
 * @todo fp> Make a DirTree class (those static hacks suck)
 *
 * @param FileRoot A single root or NULL for all available.
 * @param string the root path to use
 * @param boolean add radio buttons ?
 * @param string used by recursion
 * @param string what kind of action do the user ( we need this to check permission )
 * 			fp>asimo : in what case can this be something else than "view" ?
 * 			asimo>fp : on the _file_upload.view, we must show only those roots where current user has permission to add files
 * @return string
 */
function get_directory_tree($Root = NULL, $ads_full_path = NULL, $ads_selected_full_path = NULL, $radios = false, $rds_rel_path = NULL, $is_recursing = false, $action = 'view')
{
    static $js_closeClickIDs;
    // clickopen IDs that should get closed
    static $instance_ID = 0;
    static $fm_highlight;
    global $current_User;
    // A folder might be highlighted (via "Locate this directory!")
    if (!isset($fm_highlight)) {
        $fm_highlight = param('fm_highlight', 'string', '');
    }
    if (!$is_recursing) {
        // This is not a recursive call (yet):
        // Init:
        $instance_ID++;
        $js_closeClickIDs = array();
        $ret = '<ul class="clicktree">';
    } else {
        $ret = '';
    }
    // ________________________ Handle Roots ______________________
    if ($Root === NULL) {
        // We want to list all roots:
        $FileRootCache =& get_FileRootCache();
        $_roots = $FileRootCache->get_available_FileRoots();
        foreach ($_roots as $l_Root) {
            if (!$current_User->check_perm('files', $action, false, $l_Root)) {
                // current user does not have permission to "view" (or other $action) this root
                continue;
            }
            $subR = get_directory_tree($l_Root, $l_Root->ads_path, $ads_selected_full_path, $radios, '', true);
            if (!empty($subR['string'])) {
                $ret .= '<li>' . $subR['string'] . '</li>';
            }
        }
    } else {
        // We'll go through files in current dir:
        $Nodelist = new Filelist($Root, trailing_slash($ads_full_path));
        check_showparams($Nodelist);
        $Nodelist->load();
        $Nodelist->sort('name');
        $has_sub_dirs = $Nodelist->count_dirs();
        $id_path = 'id_path_' . $instance_ID . md5($ads_full_path);
        $r['string'] = '<span class="folder_in_tree"';
        if ($ads_full_path == $ads_selected_full_path) {
            // This is the current open path
            $r['opened'] = true;
            if ($fm_highlight && $fm_highlight == substr($rds_rel_path, 0, -1)) {
                $r['string'] .= ' id="fm_highlighted"';
                unset($fm_highlight);
            }
        } else {
            $r['opened'] = NULL;
        }
        $r['string'] .= '>';
        if ($radios) {
            // Optional radio input to select this path:
            $root_and_path = format_to_output(implode('::', array($Root->ID, $rds_rel_path)), 'formvalue');
            $r['string'] .= '<input type="radio" name="root_and_path" value="' . $root_and_path . '" id="radio_' . $id_path . '"';
            if ($r['opened']) {
                // This is the current open path
                $r['string'] .= ' checked="checked"';
            }
            //.( ! $has_sub_dirs ? ' style="margin-right:'.get_icon( 'collapse', 'size', array( 'size' => 'width' ) ).'px"' : '' )
            $r['string'] .= ' /> &nbsp; &nbsp;';
        }
        // Folder Icon + Name:
        $url = regenerate_url('root,path', 'root=' . $Root->ID . '&amp;path=' . $rds_rel_path);
        $label = action_icon(T_('Open this directory in the file manager'), 'folder', $url) . '<a href="' . $url . '"
			title="' . T_('Open this directory in the file manager') . '">' . (empty($rds_rel_path) ? $Root->name : basename($ads_full_path)) . '</a>';
        // Handle potential subdir:
        if (!$has_sub_dirs) {
            // No subdirs
            $r['string'] .= get_icon('expand', 'noimg', array('class' => '')) . '&nbsp;' . $label . '</span>';
        } else {
            // Process subdirs
            $r['string'] .= get_icon('collapse', 'imgtag', array('onclick' => 'toggle_clickopen(\'' . $id_path . '\');', 'id' => 'clickimg_' . $id_path, 'style' => 'margin:0 2px')) . '&nbsp;' . $label . '</span>' . '<ul class="clicktree" id="clickdiv_' . $id_path . '">' . "\n";
            while ($l_File =& $Nodelist->get_next('dir')) {
                $rSub = get_directory_tree($Root, $l_File->get_full_path(), $ads_selected_full_path, $radios, $l_File->get_rdfs_rel_path(), true);
                if ($rSub['opened']) {
                    // pass opened status on, if given
                    $r['opened'] = $rSub['opened'];
                }
                $r['string'] .= '<li>' . $rSub['string'] . '</li>';
            }
            if (!$r['opened']) {
                $js_closeClickIDs[] = $id_path;
            }
            $r['string'] .= '</ul>';
        }
        if ($is_recursing) {
            return $r;
        } else {
            $ret .= '<li>' . $r['string'] . '</li>';
        }
    }
    if (!$is_recursing) {
        $ret .= '</ul>';
        if (!empty($js_closeClickIDs)) {
            // there are IDs of checkboxes that we want to close
            $ret .= "\n" . '<script type="text/javascript">toggle_clickopen( \'' . implode("' );\ntoggle_clickopen( '", $js_closeClickIDs) . "' );\n</script>";
        }
    }
    return $ret;
}
Ejemplo n.º 4
0
// Just a hint for the browser.
$Form->hidden('upload_quickmode', $upload_quickmode);
$Form->hiddens_by_key(get_memorized());
$Widget = new Widget('file_browser');
$Widget->global_icon(T_('Quit upload mode!'), 'close', regenerate_url('ctrl,fm_mode', 'ctrl=files'));
$Widget->title = T_('File upload') . get_manual_link('upload_multiple');
$Widget->disp_template_replaced('block_start');
?>

<table id="fm_browser" cellspacing="0" cellpadding="0" class="table table-striped table-bordered table-hover table-condensed">
	<tbody>
		<tr>
			<?php 
echo '<td id="fm_dirtree">';
// Version with all roots displayed
echo get_directory_tree(NULL, NULL, $ads_list_path, true, NULL, false, 'add');
// Version with only the current root displayed:
// echo get_directory_tree( $fm_FileRoot, $fm_FileRoot->ads_path, $ads_list_path, true );
echo '</td>';
echo '<td id="fm_files">';
if (count($failedFiles)) {
    echo '<p class="error">' . T_('Some file uploads failed. Please check the errors below.') . '</p>';
}
if (count($renamedMessages)) {
    echo '<p class="error">' . T_('Some uploaded files have been renamed due to conflicting file names. Please check the messages below:') . '</p>';
}
?>

			<div class="upload_title"><?php 
echo T_('Files to upload');
?>