[svn r15178] Cleanup and fixes for document tool

skala
Yannick Warnier 18 years ago
parent f2bc260ed4
commit 23b11353ce
  1. 29
      main/document/document.php
  2. 10
      main/document/document_slideshow.inc.php
  3. 4
      main/inc/lib/sortabletable.class.php

@ -1,4 +1,4 @@
<?php // $Id: document.php 15176 2008-04-29 18:20:02Z yannoo $ <?php // $Id: document.php 15178 2008-04-29 18:35:20Z yannoo $
/* /*
============================================================================== ==============================================================================
@ -286,7 +286,7 @@ for ($i=0; $i<$array_len;$i++)
$dir_acum.=$dir_array[$i].'/'; $dir_acum.=$dir_array[$i].'/';
} }
Display::display_header($tool_name,"Doc"); Display::display_header('',"Doc");
$is_allowed_to_edit = api_is_allowed_to_edit(); $is_allowed_to_edit = api_is_allowed_to_edit();
/* /*
@ -313,7 +313,14 @@ if($to_group_id !=0) //add group name after for group documents
----------------------------------------------------------- -----------------------------------------------------------
*/ */
Display::display_introduction_section(TOOL_DOCUMENT.$_SESSION['_gid']); if(!empty($_SESSION['_gid']))
{
Display::display_introduction_section(TOOL_DOCUMENT.$_SESSION['_gid']);
}
else
{
Display::display_introduction_section(TOOL_DOCUMENT);
}
/*============================================================================*/ /*============================================================================*/
@ -555,7 +562,7 @@ if($folders===false)
{ {
$folders = array(); $folders = array();
} }
echo(build_directory_selector($folders,$curdirpath,$group_properties['directory'],true)); echo(build_directory_selector($folders,$curdirpath,(isset($group_properties['directory'])?$group_properties['directory']:array()),true));
?> ?>
</div> </div>
<?php <?php
@ -603,7 +610,7 @@ echo(build_directory_selector($folders,$curdirpath,$group_properties['directory'
//============================================================================== //==============================================================================
if($docs_and_folders) if(isset($docs_and_folders) && is_array($docs_and_folders))
{ {
//echo('<pre>'); //echo('<pre>');
//print_r($docs_and_folders); //print_r($docs_and_folders);
@ -655,14 +662,15 @@ if($docs_and_folders)
//admins get an edit column //admins get an edit column
if ($is_allowed_to_edit || $group_member_with_upload_rights) if ($is_allowed_to_edit || $group_member_with_upload_rights)
{ {
$is_template = (isset($id['is_template'])?$id['is_template']:false);
// if readonly, check if it the owner of the file ? // if readonly, check if it the owner of the file ?
if ($id['insert_user_id'] == $_user['user_id'] || api_is_platform_admin()) if ($id['insert_user_id'] == $_user['user_id'] || api_is_platform_admin())
{ {
$edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key, $id['is_template'],0); $edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key, $is_template,0);
} }
else else
{ {
$edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key, $id['is_template'],$id['readonly']); $edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key, $is_template,$id['readonly']);
} }
$row[] = $edit_icons; $row[] = $edit_icons;
} }
@ -723,6 +731,7 @@ if(isset($_SESSION['_gid']))
{ {
$query_vars['gidReq'] = $_SESSION['_gid']; $query_vars['gidReq'] = $_SESSION['_gid'];
} }
$query_vars['cidReq'] = api_get_course_id();
$table->set_additional_parameters($query_vars); $table->set_additional_parameters($query_vars);
$column = 0; $column = 0;
@ -755,8 +764,10 @@ if (count($docs_and_folders)>1)
} }
$table->display(); $table->display();
echo $table_footer; if(!empty($table_footer))
{
echo $table_footer;
}
/* /*
============================================================================== ==============================================================================

@ -1,4 +1,4 @@
<?php // $Id: document_slideshow.inc.php 12923 2007-09-03 12:40:45Z elixir_julian $ <?php // $Id: document_slideshow.inc.php 15178 2008-04-29 18:35:20Z yannoo $
/* /*
============================================================================== ==============================================================================
Dokeos - elearning and course management software Dokeos - elearning and course management software
@ -66,7 +66,7 @@ the same starting point.
$accepted_extensions = array('.jpg','.jpeg','.gif','.png'); $accepted_extensions = array('.jpg','.jpeg','.gif','.png');
// resetting the images of the slideshow = destroying the slideshow // resetting the images of the slideshow = destroying the slideshow
if ($_GET['action']=="exit_slideshow") if (isset($_GET['action']) && $_GET['action']=="exit_slideshow")
{ {
$_SESSION["image_files_only"]=null; $_SESSION["image_files_only"]=null;
unset($image_files_only); unset($image_files_only);
@ -107,14 +107,14 @@ if ( count($all_files) > 0 )
} }
} }
$tablename_column = $_GET['tablename_column']; $tablename_column = (isset($_GET['tablename_column'])?$_GET['tablename_column']:0);
if($tablename_column==0){ if($tablename_column==0){
$tablename_column=1; $tablename_column=1;
} }
else{ else{
$tablename_column= intval($tablename_column)-1; $tablename_column= intval($tablename_column)-1;
} }
$tablename_direction = $_GET['tablename_direction']; $tablename_direction = (isset($_GET['tablename_direction'])?$_GET['tablename_direction']:'ASC');
$image_files_only = sort_files($array_to_search); $image_files_only = sort_files($array_to_search);
$_SESSION["image_files_only"] = $image_files_only; $_SESSION["image_files_only"] = $image_files_only;
@ -161,4 +161,4 @@ function sort_table($a, $b)
?> ?>

@ -234,7 +234,7 @@ class SortableTable extends HTML_Table
} }
/*]]>*/ /*]]>*/
</script>'; </script>';
$params = $this->get_sortable_table_param_string.'&amp;'.$this->get_additional_url_paramstring(); $params = $this->get_sortable_table_param_string().'&amp;'.$this->get_additional_url_paramstring();
$html .= '<form method="post" action="'.api_get_self().'?'.$params.'" name="form_'.$this->table_name.'">'; $html .= '<form method="post" action="'.api_get_self().'?'.$params.'" name="form_'.$this->table_name.'">';
} }
@ -679,4 +679,4 @@ class SortableTableFromArrayConfig extends SortableTable
return count($this->table_data); return count($this->table_data);
} }
} }
?> ?>

Loading…
Cancel
Save