[svn r18624] Now it is not necessary to activate Portal Administration > Dokeos configuration settings > Tools > Use a title for the document name to show user names. Also show images

skala
Juan Carlos Raña 17 years ago
parent 555aa2867e
commit 9ef00d3f6b
  1. 48
      main/document/document.inc.php
  2. 25
      main/document/document.php
  3. 2
      main/inc/lib/fckeditor/editor/filemanager/browser/default/connectors/php/commands.php
  4. 482
      main/inc/lib/fckeditor/editor/filemanager/upload/php/upload.php
  5. 1712
      main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php
  6. 4
      main/inc/lib/fckeditor/editor/plugins/ImageManager/config.inc.php
  7. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.base.php
  8. 6
      main/inc/lib/fckeditor/fckeditor.php
  9. 9
      main/inc/lib/fckeditor/repositories_config.php

@ -1,4 +1,4 @@
<?php // $Id: document.inc.php 18585 2009-02-19 02:09:38Z herodoto $
<?php // $Id: document.inc.php 18624 2009-02-20 18:31:55Z herodoto $
/*
==============================================================================
@ -94,6 +94,17 @@ function build_directory_selector($folders,$curdirpath,$group_dir='',$changeRend
{
$selected = ($curdirpath==$folder)?' selected="selected"':'';
$path_parts = explode('/',$folder);
if($folder_titles[$folder]=='shared_folder')
{
$folder_titles[$folder]=get_lang('SharedFolder');
}
elseif(strstr($folder_titles[$folder], 'sf_user_'))
{
$userinfo=Database::get_user_info_from_id(substr($folder_titles[$folder],8));
$folder_titles[$folder]=$userinfo['lastname'].', '.$userinfo['firstname'];
}
$label = str_repeat('&nbsp;&nbsp;&nbsp;',count($path_parts)-2).' &mdash; '.$folder_titles[$folder];
$parent_select -> addOption($label,$folder);
if($selected!='') $parent_select->setSelected($folder);
@ -192,15 +203,29 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
//$tooltip_title = str_replace('?cidReq='.$_GET['cidReq'],'',basename($path));
$tooltip_title = explode('?', basename($path));
$tooltip_title = $tooltip_title[0];
if($tooltip_title=='shared_folder')
{
$tooltip_title_alt=get_lang('SharedFolder');
}
elseif(strstr($tooltip_title, 'sf_user_'))
{
$userinfo=Database::get_user_info_from_id(substr($tooltip_title,8));
$tooltip_title_alt=$userinfo['lastname'].', '.$userinfo['firstname'];
}
else
{
$tooltip_title_alt=$tooltip_title;
}
if (!$show_as_icon)
{
$force_download_html = ($size==0)?'':'<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.Display::return_icon($forcedownload_icon, get_lang('Download'),array('height'=>'16', 'width' => '16')).'</a>';
return '<a href="'.$url.'" title="'.$tooltip_title.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.$title.'</a>'.$force_download_html;
return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.$title.'</a>'.$force_download_html;
}
else
{
return '<a href="'.$url.'" title="'.$tooltip_title.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $tooltip_title).'</a>';
return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $tooltip_title).'</a>';
}
}
@ -226,6 +251,21 @@ function build_document_icon_tag($type, $path)
$icon = 'shared_folder.gif';
$basename = get_lang('HelpSharedFolder');
}
elseif(strstr($basename, 'sf_user_'))
{
$userinfo=Database::get_user_info_from_id(substr($basename,8));
$image_path = UserManager::get_user_picture_path_by_id(substr($basename,8),'web',false, true);
if($image_path['file']=='unknown.jpg')
{
$icon = $image_path['file'];
}
else
{
$icon = '../upload/users/'.substr($basename,8).'/'.$image_path['file'];
}
$basename = $userinfo['lastname'].', '.$userinfo['firstname'];
}
else
{
if($basename =='audio' || $basename =='flash' || $basename =='images' || $basename =='video')
@ -236,7 +276,7 @@ function build_document_icon_tag($type, $path)
}
}
return Display::return_icon($icon, $basename, array('hspace'=>'5', 'align' => 'middle'));
return Display::return_icon($icon, $basename, array('hspace'=>'5', 'align' => 'middle', 'height'=> 22, 'width' => 22));
}
/**

@ -1,4 +1,4 @@
<?php // $Id: document.php 18319 2009-02-07 00:03:42Z herodoto $
<?php // $Id: document.php 18624 2009-02-20 18:31:55Z herodoto $
/*
==============================================================================
Dokeos - elearning and course management software
@ -307,6 +307,16 @@ if ($array_len >1)
$dir_acum='';
for ($i=0; $i<$array_len;$i++)
{
if($dir_array[$i] =='shared_folder')
{
$dir_array[$i]=get_lang('SharedFolder');
}
elseif(strstr($dir_array[$i], 'sf_user_'))
{
$userinfo=Database::get_user_info_from_id(substr($dir_array[$i], 8));
$dir_array[$i]=$userinfo['lastname'].', '.$userinfo['firstname'];
}
$url_dir='document.php?&curdirpath='.$dir_acum.$dir_array[$i];
$interbreadcrumb[]= array ('url'=>$url_dir, 'name'=> $dir_array[$i]);
$dir_acum.=$dir_array[$i].'/';
@ -692,7 +702,18 @@ if(isset($docs_and_folders) && is_array($docs_and_folders))
if ($use_document_title=='true' AND $id['title']<>'') {
$document_name=$id['title'];
} else {
$document_name=basename($id['path']);
$document_name=basename($id['path']);
//Juan Carlos Raña get lastname and firstname when folder is in shared_folder
//TODO: check if is also necessary (above else)
if(strstr($document_name, 'sf_user_'))
{
$userinfo=Database::get_user_info_from_id(substr($document_name, 8));
$document_name=$userinfo['lastname'].', '.$userinfo['firstname'];
}
elseif(strstr($document_name, 'shared_folder'))
{
$document_name=get_lang('SharedFolder');
}
}
//data for checkbox
if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1) {

@ -45,7 +45,7 @@ function GetFolders( $resourceType, $currentFolder )
&& strpos( $sFile, 'chat_files' ) === false
&& strpos( $sFile, 'HotPotatoes_files' ) === false
&& ( $in_group || ( !$in_group && strpos( $sFile, '_groupdocs' ) === false ) )
&& (!$in_shared_folder || ($in_shared_folder && $sFile == $user_id))
&& (!$in_shared_folder || ($in_shared_folder && $sFile == 'sf_user_'.$user_id))
&& $sFile != '.thumbs'
&& $sFile != '.svn'
&& is_dir( $sServerDir . $sFile ) )

@ -1,241 +1,241 @@
<?php
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: upload.php
* This is the "File Uploader" for PHP.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
$language_file = array('create_course');
include '../../../../../../global.inc.php';
require_once api_get_path(INCLUDE_PATH).'lib/fckeditor/repositories_config.php';
require('config.php') ;
require('util.php') ;
// This is the function that sends the results of the uploading process.
function SendResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' )
{
echo '<script type="text/javascript">' ;
echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . str_replace( '"', '\\"', $fileUrl ) . '","' . str_replace( '"', '\\"', $fileName ) . '", "' . str_replace( '"', '\\"', $customMsg ) . '") ;' ;
echo '</script>' ;
exit ;
}
function check_and_create_resource_directory($repository_path, $resource_directory, $resource_directory_name)
{
global $permissions_for_new_directories;
$resource_directory_full_path = substr($repository_path, 0, strlen($repository_path) - 1) . $resource_directory . '/';
if (!is_dir($resource_directory_full_path))
{
if (@mkdir($resource_directory_full_path, $permissions_for_new_directories))
{
// While we are in a course: Registering the newly created folder in the course's database.
if (api_is_in_course())
{
global $_course, $_user;
global $group_properties, $to_group_id;
$group_directory = !empty($group_properties['directory']) ? $group_properties['directory'] : '';
$doc_id = add_document($_course, $group_directory.$resource_directory, 'folder', 0, $resource_directory_name);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', $_user['user_id'], $to_group_id);
}
return true;
}
return false;
}
return true;
}
// Check if this uploader has been enabled.
if ( !$Config['Enabled'] )
SendResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/upload/php/config.php" file' ) ;
// Check if the file has been correctly uploaded.
if ( !isset( $_FILES['NewFile'] ) || is_null( $_FILES['NewFile']['tmp_name'] ) || $_FILES['NewFile']['name'] == '' )
SendResults( '202' ) ;
// Get the posted file.
$oFile = $_FILES['NewFile'] ;
// Get the uploaded file name and extension.
$sFileName = $oFile['name'] ;
$sOriginalFileName = $sFileName ;
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
// The the file type (from the QueryString, by default 'File').
$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
// Get the allowed and denied extensions arrays.
$arAllowed = $Config['AllowedExtensions'][$sType] ;
$arDenied = $Config['DeniedExtensions'][$sType] ;
// Check if it is an allowed extension.
if ( ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) || ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) )){
SendResults( '202' ) ;
}
$sErrorNumber = '0' ;
$sFileUrl = '' ;
// Initializes the counter used to rename the file, if another one with the same name already exists.
$iCounter = 0 ;
$sType=strtolower($sType);
// Choosing the repository to be used.
if (api_is_in_course())
{
if (!api_is_in_group())
{
// 1. We are inside a course and not in a group.
if (api_is_allowed_to_edit())
{
// 1.1. Teacher
$sServerDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/';
$sserverWebath = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/';
}
else
{
// 1.2. Student
$sServerDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/shared_folder/'.api_get_user_id().'/';
$sserverWebath = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/'.api_get_user_id().'/';
}
}
else
{
// 2. Inside a course and inside a group.
$sServerDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/';
$sserverWebath = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/';
}
}
else
{
if (api_is_platform_admin() && $_SESSION['this_section'] == 'platform_admin')
{
// 3. Platform administration activities.
$sServerDir = $_configuration['root_sys'].'home/default_platform_document/';
$sserverWebath = $_configuration['root_web'].'home/default_platform_document/';
}
else
{
// 4. The user is outside courses.
$sServerDir = $_configuration['root_sys'].'main/upload/users/'.api_get_user_id().'/my_files/';
$sserverWebath = $_configuration['root_web'].'main/upload/users/'.api_get_user_id().'/my_files/';
}
}
// Set the upload path according to the resource type.
if ($sType == 'audio')
{
check_and_create_resource_directory($sServerDir, '/audio', get_lang('Audio'));
$sServerDir = $sServerDir.'audio/';
$sserverWebath = $sserverWebath.'audio/';
$path = '/audio/';
}
elseif ($sType == 'mp3')
{
$sType = 'audio';
check_and_create_resource_directory($sServerDir, '/audio', get_lang('Audio'));
$sServerDir = $sServerDir.'audio/';
$sserverWebath = $sserverWebath.'audio/';
$path = '/audio/';
}
elseif ($sType == 'flash')
{
check_and_create_resource_directory($sServerDir, '/flash', get_lang('Flash'));
$sServerDir = $sServerDir.'flash/';
$sserverWebath = $sserverWebath.'flash/';
$path = '/flash/';
}
elseif ($sType == 'images')
{
check_and_create_resource_directory($sServerDir, '/images', get_lang('Images'));
$sServerDir = $sServerDir.'images/';
$sserverWebath = $sserverWebath.'images/';
$path = '/images/';
}
elseif ($sType == 'video')
{
check_and_create_resource_directory($sServerDir, '/video', get_lang('Video'));
$sServerDir = $sServerDir.'video/';
$sserverWebath = $sserverWebath.'video/';
$path = '/video/';
}
elseif ($sType == 'video/flv')
{
check_and_create_resource_directory($sServerDir, '/video', get_lang('Video'));
check_and_create_resource_directory($sServerDir, '/video/flv', 'flv');
$sServerDir = $sServerDir.'video/flv/';
$sserverWebath = $sserverWebath.'video/flv/';
$path = '/video/flv/';
}
else
{
$path = '/';
}
// Try to add an extension to the file if it has'nt one
$sFileName = add_ext_on_mime(stripslashes($oFile['name']),$oFile['type']);
// Replace dangerous characters
$sFileName = replace_dangerous_char($sFileName,'strict');
// Transform any .php file in .phps for security
$sFileName = php2phps($sFileName);
if ( is_file( $sServerDir.$sFileName ) ){
$dotIndex = strrpos($sFileName, '.');
$ext = '';
if(is_int($dotIndex))
{
$ext = substr($sFileName, $dotIndex);
$base = substr($sFileName, 0, $dotIndex);
}
$counter = 0;
while(is_file($sServerDir.$sFileName))
{
$counter++;
$sFileName = $base.'_'.$counter.$ext;
}
}
if (!move_uploaded_file( $oFile['tmp_name'], $sServerDir.$sFileName )) $sErrorNumber = '203' ; // Check php.ini setting.
if ( is_file( $sServerDir.$sFileName ) )
{
$oldumask = umask(0) ;
chmod( $sServerDir.$sFileName, $permissions_for_new_files ) ;
umask( $oldumask ) ;
// If we are in a course we record the uploaded file in database.
if (api_is_in_course())
{
$document_name = $sFileName;
$document_size=$oFile["size"];
$group_directory = !empty($group_properties['directory']) ? $group_properties['directory'] : '';
$doc_id = add_document($_course, $group_directory.$path.$document_name, 'file', $document_size, $document_name);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentCreated', $_user['user_id'], $to_group_id);
}
}
SendResults( $sErrorNumber, $sserverWebath.$sFileName, $sFileName ) ;
?>
<?php
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: upload.php
* This is the "File Uploader" for PHP.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
$language_file = array('create_course');
include '../../../../../../global.inc.php';
require_once api_get_path(INCLUDE_PATH).'lib/fckeditor/repositories_config.php';
require('config.php') ;
require('util.php') ;
// This is the function that sends the results of the uploading process.
function SendResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' )
{
echo '<script type="text/javascript">' ;
echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . str_replace( '"', '\\"', $fileUrl ) . '","' . str_replace( '"', '\\"', $fileName ) . '", "' . str_replace( '"', '\\"', $customMsg ) . '") ;' ;
echo '</script>' ;
exit ;
}
function check_and_create_resource_directory($repository_path, $resource_directory, $resource_directory_name)
{
global $permissions_for_new_directories;
$resource_directory_full_path = substr($repository_path, 0, strlen($repository_path) - 1) . $resource_directory . '/';
if (!is_dir($resource_directory_full_path))
{
if (@mkdir($resource_directory_full_path, $permissions_for_new_directories))
{
// While we are in a course: Registering the newly created folder in the course's database.
if (api_is_in_course())
{
global $_course, $_user;
global $group_properties, $to_group_id;
$group_directory = !empty($group_properties['directory']) ? $group_properties['directory'] : '';
$doc_id = add_document($_course, $group_directory.$resource_directory, 'folder', 0, $resource_directory_name);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', $_user['user_id'], $to_group_id);
}
return true;
}
return false;
}
return true;
}
// Check if this uploader has been enabled.
if ( !$Config['Enabled'] )
SendResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/upload/php/config.php" file' ) ;
// Check if the file has been correctly uploaded.
if ( !isset( $_FILES['NewFile'] ) || is_null( $_FILES['NewFile']['tmp_name'] ) || $_FILES['NewFile']['name'] == '' )
SendResults( '202' ) ;
// Get the posted file.
$oFile = $_FILES['NewFile'] ;
// Get the uploaded file name and extension.
$sFileName = $oFile['name'] ;
$sOriginalFileName = $sFileName ;
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
// The the file type (from the QueryString, by default 'File').
$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
// Get the allowed and denied extensions arrays.
$arAllowed = $Config['AllowedExtensions'][$sType] ;
$arDenied = $Config['DeniedExtensions'][$sType] ;
// Check if it is an allowed extension.
if ( ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) || ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) )){
SendResults( '202' ) ;
}
$sErrorNumber = '0' ;
$sFileUrl = '' ;
// Initializes the counter used to rename the file, if another one with the same name already exists.
$iCounter = 0 ;
$sType=strtolower($sType);
// Choosing the repository to be used.
if (api_is_in_course())
{
if (!api_is_in_group())
{
// 1. We are inside a course and not in a group.
if (api_is_allowed_to_edit())
{
// 1.1. Teacher
$sServerDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/';
$sserverWebath = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/';
}
else
{
// 1.2. Student
$sServerDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$sserverWebath = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
}
}
else
{
// 2. Inside a course and inside a group.
$sServerDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/';
$sserverWebath = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/';
}
}
else
{
if (api_is_platform_admin() && $_SESSION['this_section'] == 'platform_admin')
{
// 3. Platform administration activities.
$sServerDir = $_configuration['root_sys'].'home/default_platform_document/';
$sserverWebath = $_configuration['root_web'].'home/default_platform_document/';
}
else
{
// 4. The user is outside courses.
$sServerDir = $_configuration['root_sys'].'main/upload/users/'.api_get_user_id().'/my_files/';
$sserverWebath = $_configuration['root_web'].'main/upload/users/'.api_get_user_id().'/my_files/';
}
}
// Set the upload path according to the resource type.
if ($sType == 'audio')
{
check_and_create_resource_directory($sServerDir, '/audio', get_lang('Audio'));
$sServerDir = $sServerDir.'audio/';
$sserverWebath = $sserverWebath.'audio/';
$path = '/audio/';
}
elseif ($sType == 'mp3')
{
$sType = 'audio';
check_and_create_resource_directory($sServerDir, '/audio', get_lang('Audio'));
$sServerDir = $sServerDir.'audio/';
$sserverWebath = $sserverWebath.'audio/';
$path = '/audio/';
}
elseif ($sType == 'flash')
{
check_and_create_resource_directory($sServerDir, '/flash', get_lang('Flash'));
$sServerDir = $sServerDir.'flash/';
$sserverWebath = $sserverWebath.'flash/';
$path = '/flash/';
}
elseif ($sType == 'images')
{
check_and_create_resource_directory($sServerDir, '/images', get_lang('Images'));
$sServerDir = $sServerDir.'images/';
$sserverWebath = $sserverWebath.'images/';
$path = '/images/';
}
elseif ($sType == 'video')
{
check_and_create_resource_directory($sServerDir, '/video', get_lang('Video'));
$sServerDir = $sServerDir.'video/';
$sserverWebath = $sserverWebath.'video/';
$path = '/video/';
}
elseif ($sType == 'video/flv')
{
check_and_create_resource_directory($sServerDir, '/video', get_lang('Video'));
check_and_create_resource_directory($sServerDir, '/video/flv', 'flv');
$sServerDir = $sServerDir.'video/flv/';
$sserverWebath = $sserverWebath.'video/flv/';
$path = '/video/flv/';
}
else
{
$path = '/';
}
// Try to add an extension to the file if it has'nt one
$sFileName = add_ext_on_mime(stripslashes($oFile['name']),$oFile['type']);
// Replace dangerous characters
$sFileName = replace_dangerous_char($sFileName,'strict');
// Transform any .php file in .phps for security
$sFileName = php2phps($sFileName);
if ( is_file( $sServerDir.$sFileName ) ){
$dotIndex = strrpos($sFileName, '.');
$ext = '';
if(is_int($dotIndex))
{
$ext = substr($sFileName, $dotIndex);
$base = substr($sFileName, 0, $dotIndex);
}
$counter = 0;
while(is_file($sServerDir.$sFileName))
{
$counter++;
$sFileName = $base.'_'.$counter.$ext;
}
}
if (!move_uploaded_file( $oFile['tmp_name'], $sServerDir.$sFileName )) $sErrorNumber = '203' ; // Check php.ini setting.
if ( is_file( $sServerDir.$sFileName ) )
{
$oldumask = umask(0) ;
chmod( $sServerDir.$sFileName, $permissions_for_new_files ) ;
umask( $oldumask ) ;
// If we are in a course we record the uploaded file in database.
if (api_is_in_course())
{
$document_name = $sFileName;
$document_size=$oFile["size"];
$group_directory = !empty($group_properties['directory']) ? $group_properties['directory'] : '';
$doc_id = add_document($_course, $group_directory.$path.$document_name, 'file', $document_size, $document_name);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentCreated', $_user['user_id'], $to_group_id);
}
}
SendResults( $sErrorNumber, $sserverWebath.$sFileName, $sFileName ) ;
?>

@ -47,8 +47,8 @@ if (api_is_in_course())
else
{
// 1.2. Student
$IMConfig['base_dir'] = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/shared_folder/'.api_get_user_id().'/';
$IMConfig['base_url'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/'.api_get_user_id().'/';
$IMConfig['base_dir'] = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$IMConfig['base_url'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
}
}
else

@ -101,7 +101,7 @@
}
else
{
$PathDokeosAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/shared_folder/'.api_get_user_id().'/';
$PathDokeosAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/shared_folder/sf_user_'.api_get_user_id().'/';
}
}
}

@ -250,12 +250,12 @@ class FCKeditor
if (empty($this->Config['CreateDocumentWebDir']))
{
$this->Config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/'.api_get_user_id().'/';
$this->Config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
}
if (is_null($this->Config['CreateDocumentDir']))
{
$this->Config['CreateDocumentDir'] = $relative_path_prefix.'courses/'.api_get_course_path().'/document/shared_folder/'.api_get_user_id().'/';
$this->Config['CreateDocumentDir'] = $relative_path_prefix.'courses/'.api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
}
if (empty($this->Config['BaseHref']))
@ -263,7 +263,7 @@ class FCKeditor
$this->Config['BaseHref'] = $script_path;
}
$upload_path = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/shared_folder/'.api_get_user_id().'/';
$upload_path = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
}
}
else

@ -56,14 +56,13 @@ if (api_is_in_course()) {
// Added by Ivan Tcholakov.
// When the current user is inside a course, his/her own hidden folder is created (if it does not exist) under shared_folder.
// This new folder is to be used by the online editor when the user is not in group-specific context.
// The name of the newly created folder is the user_id, the title is created from user names (first name and last name).
if (!file_exists($course_shared_folder.api_get_user_id())) {
if (!file_exists($course_shared_folder.'sf_user_'.api_get_user_id())) {
//@todo call the create_unexisting_directory function and replace this code Julio Montoya
$new_user_dir = api_get_path(SYS_PATH).'courses/'.$_course['path'].'/document/shared_folder/'.api_get_user_id().'/';
$new_user_dir = api_get_path(SYS_PATH).'courses/'.$_course['path'].'/document/shared_folder/sf_user_'.api_get_user_id().'/';
@mkdir($new_user_dir);
chmod($new_user_dir,$permissions_for_new_directories);
$doc_id = add_document($_course, '/shared_folder/'.api_get_user_id(), 'folder', 0, $_user['firstName'].' '.$_user['lastName']);
$doc_id = add_document($_course, '/shared_folder/sf_user_'.api_get_user_id(), 'folder', 0, $_user['firstName'].' '.$_user['lastName']);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id());
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id());
}

Loading…
Cancel
Save