[svn r14649] Layout Improvements in Documents tool (see FS#2369 )

skala
Julio Montoya 17 years ago
parent 6f36c7c0a3
commit 01ab80bb1b
  1. 33
      main/document/document.inc.php
  2. 94
      main/document/document.php
  3. 4
      main/inc/lib/sortabletable.class.php

@ -1,4 +1,27 @@
<?php // $Id: document.inc.php 13981 2007-12-08 23:43:58Z yannoo $
<?php // $Id: document.inc.php 13981 2007-12-08 23:43:58Z yannoo
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2008 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/*
==============================================================================
@ -58,7 +81,7 @@ function build_directory_selector($folders,$curdirpath,$group_dir='',$changeRend
//group documents cannot be uploaded in the root
if($group_dir=='')
{
$parent_select -> addOption(get_lang('Root'),'/');
$parent_select -> addOption(get_lang('HomeDirectory'),'/');
if(is_array($folders))
{
foreach ($folders as $folder)
@ -79,7 +102,7 @@ function build_directory_selector($folders,$curdirpath,$group_dir='',$changeRend
$label = $folder_titles[$folder];
if( $folder == $group_dir)
{
$label = '/ ('.get_lang('Root').')';
$label = '/ ('.get_lang('HomeDirectory').')';
}
else
{
@ -257,7 +280,7 @@ function build_move_to_selector($folders,$curdirpath,$move_file,$group_dir='')
{
if($curdirpath!='/')
{
$form .= '<option value="/">/ ('.get_lang('Root').')</option>';
$form .= '<option value="/">/ ('.get_lang('HomeDirectory').')</option>';
}
if(is_array($folders))
{
@ -281,7 +304,7 @@ function build_move_to_selector($folders,$curdirpath,$move_file,$group_dir='')
if(($curdirpath!=$folder) && ($folder!=$move_file) && (substr($folder,0,strlen($move_file)+1) != $move_file.'/'))//cannot copy dir into his own subdir
{
$display_folder = substr($folder,strlen($group_dir));
$display_folder = ($display_folder == '')?'/ ('.get_lang('Root').')':$display_folder;
$display_folder = ($display_folder == '')?'/ ('.get_lang('HomeDirectory').')':$display_folder;
$form .= '<option value="'.$folder.'">'.$display_folder.'</option>'."\n";
}
}

@ -1,10 +1,10 @@
<?php // $Id: document.php 13779 2007-11-26 23:55:03Z yannoo $
<?php // $Id: document.php 14649 2008-03-18 20:03:41Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) 2004-2008 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
@ -19,7 +19,7 @@
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
@ -189,7 +189,8 @@ include_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
//-----------------------------------------------------------
//check the path
//if the path is not found (no document id), set the path to /
if(!DocumentManager::get_document_id($_course,$curdirpath)){
if(!DocumentManager::get_document_id($_course,$curdirpath))
{
$curdirpath = '/';
//urlencoded version
$curdirpathurl = '%2F';
@ -261,7 +262,30 @@ $image_files_only="";
-----------------------------------------------------------
*/
$tool_name = get_lang("Document"); // title of the page (should come from the language file)
$interbreadcrumb[]= array ('url'=>'#', 'name'=> get_lang('Document'));
//------interbreadcrumb for the current directory root path
$dir_array=explode("/",$curdirpath);
$array_len=count($dir_array);
if ($array_len >1)
{
if(! isset($_SESSION['_gid']) && $_SESSION['_gid']=='')
{
$url_dir='document.php?&curdirpath=/';
$interbreadcrumb[]= array ('url'=>$url_dir, 'name'=> get_lang('HomeDirectory'));
}
}
$dir_acum='';
for ($i=0; $i<$array_len;$i++)
{
$url_dir='document.php?&curdirpath='.$dir_acum.$dir_array[$i];
$interbreadcrumb[]= array ('url'=>$url_dir, 'name'=> $dir_array[$i]);
$dir_acum.=$dir_array[$i].'/';
}
Display::display_header($tool_name,"Doc");
$is_allowed_to_edit = api_is_allowed_to_edit();
@ -570,6 +594,7 @@ if($docs_and_folders)
$use_document_title = get_setting('use_document_title');
//create a sortable table with our data
$sortable_data = array();
while (list ($key, $id) = each($docs_and_folders))
{
$row = array ();
@ -588,31 +613,32 @@ if($docs_and_folders)
{
$document_name=basename($id['path']);
}
//$row[] = $key; //testing
//data for checkbox
if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1)
{
$row[] = $id['path'];
$row[] = $id['path'];
}
//icons
$row[]= build_document_icon_tag($id['filetype'],$id['path']);
$row[]= build_document_icon_tag($id['filetype'],$id['path']);
//document title with hyperlink
$row[] = create_document_link($http_www,$document_name,$id['path'],$id['filetype'],$size,$id['visibility']).'<br />'.$invisibility_span_open.nl2br(htmlspecialchars($id['comment'],ENT_QUOTES,$charset)).$invisibility_span_close;
//comments => display comment under the document name
//$row[] = $invisibility_span_open.nl2br(htmlspecialchars($id['comment'])).$invisibility_span_close;
$display_size = format_file_size($size);
$row[] = '<span style="display:none;">'.$size.'</span>'.$invisibility_span_open.$display_size.$invisibility_span_close;
//last edit date
$display_date = format_date(strtotime($id['lastedit_date']));
$row[] = '<span style="display:none;">'.$id['lastedit_date'].'</span>'.$invisibility_span_open.$display_date.$invisibility_span_close;
$last_edit_date=$id['lastedit_date'];
$display_date = date_to_str_ago($last_edit_date).'<br><span class="dropbox_date">'.$last_edit_date.'</span>';
$row[] = $invisibility_span_open.$display_date.$invisibility_span_close;
//admins get an edit column
if ($is_allowed_to_edit || $group_member_with_upload_rights)
{
$edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key, $id['is_template']);
$row[] = $edit_icons;
}
$row[]=$last_edit_date;
$sortable_data[] = $row;
}
//*******************************************************************************************
@ -621,17 +647,57 @@ else
{
$sortable_data='';
$table_footer='<div style="text-align:center;"><strong>'.get_lang('NoDocsInFolder').'</strong></div>';
//echo('<p><strong>'.get_lang('NoDocsInFolder').'</strong></p>');
}
$table = new SortableTableFromArray($sortable_data,2,100);
$column_show=array();
if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1)
{
$column_show[]=1;
}
$column_show[]=1;
$column_show[]=1;
$column_show[]=1;
$column_show[]=1;
if ($is_allowed_to_edit || $group_member_with_upload_rights)
{
$column_show[]=1;
}
$column_show[]=0;
$column_order=array();
if (count($row)==7)
{
$column_order[]=1;
$column_order[]=2;
$column_order[]=3;
$column_order[]=6;
$column_order[]=5;
}
if (count($row)==5)
{
$column_order[]=1;
$column_order[]=2;
$column_order[]=4;
$column_order[]=4;
}
$table = new SortableTableFromArrayConfig($sortable_data,4,100,'tablename',$column_show,$column_order,'ASC');
$query_vars['curdirpath'] = $curdirpath;
if(isset($_SESSION['_gid']))
{
$query_vars['gidReq'] = $_SESSION['_gid'];
}
$table->set_additional_parameters($query_vars);
$column = 0;
if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1)
{
$table->set_header($column++,'',false);
@ -654,7 +720,7 @@ if (count($docs_and_folders)>1)
{
if ($is_allowed_to_edit || $group_member_with_upload_rights)
{
$form_actions = array();
$form_actions = array();
$form_action['delete'] = get_lang('Delete');
$table->set_form_actions($form_action,'path');
}

@ -651,12 +651,12 @@ class SortableTableFromArrayConfig extends SortableTable
* @param array $column_show An array with binary values 1: we show the column 2: we don't show it
* @param array $column_order An array of integers that let us decide how the columns are going to be sort.
*/
public function SortableTableFromArrayConfig($table_data, $default_column = 1, $default_items_per_page = 20, $tablename = 'tablename',$column_show=null,$column_order=null)
public function SortableTableFromArrayConfig($table_data, $default_column = 1, $default_items_per_page = 20, $tablename = 'tablename',$column_show=null,$column_order=null,$direction='ASC')
{
$this->column_show=$column_show;
$this->column_order=$column_order;
parent :: SortableTable($tablename, null, null, $default_column, $default_items_per_page,'ASC');
parent :: SortableTable($tablename, null, null, $default_column, $default_items_per_page,$direction);
$this->table_data = $table_data;
}

Loading…
Cancel
Save