[svn r18097] partial missing to edit see FS#3565

skala
Carlos Vargas 16 years ago
parent 2d85d461b3
commit b06991e90d
  1. 22
      main/work/work.lib.php
  2. 13
      main/work/work.php

@ -1,4 +1,4 @@
<?php //$Id: work.lib.php 18095 2009-01-30 21:23:55Z cfasanando $
<?php //$Id: work.lib.php 18097 2009-01-30 23:07:49Z cvargas1 $
/* For licensing terms, see /dokeos_license.txt */
/**
* @package dokeos.work
@ -6,7 +6,7 @@
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University - ability for course admins to specify wether uploaded documents are visible or invisible by default.
* @author Roan Embrechts, code refactoring and virtual course support
* @author Frederic Vauthier, directories management
* @version $Id: work.lib.php 18095 2009-01-30 21:23:55Z cfasanando $
* @version $Id: work.lib.php 18097 2009-01-30 23:07:49Z cvargas1 $
*/
/**
* Displays action links (for admins, authorized groups members and authorized students)
@ -369,6 +369,7 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
$sql_select_directory.=" AND work.url LIKE BINARY '".$mydir_temp."' AND work.filetype = 'folder' AND prop.tool='work' $session_condition";
$result=api_sql_query($sql_select_directory,__FILE__,__LINE__);
$row=Database::fetch_array($result);
if(!$row) {
// the folder belongs to another session
@ -909,6 +910,9 @@ function update_work_url($id,$new_path)
$row = Database::fetch_array($res);
$filename = basename($row['url']);
$new_url = $new_path.$filename;
$sql2 = "UPDATE $table SET url = '$new_url' WHERE id=$id";
$res2 = api_sql_query($sql2);
return $res2;
@ -946,8 +950,11 @@ function update_dir_name($path, $new_name)
while($work = Database :: fetch_array($rs)) {
$new_dir=$work['url'];
$name_with_directory=substr($new_dir,$work_len,strlen($new_dir));
$sql = 'UPDATE '.$table.' SET url="work/'.$path_to_dir.$new_name.$name_with_directory.'" WHERE id= '.$work['id'];
$name_with_directory=substr($new_dir,$work_len,strlen($new_dir));
$pre_directory=$path_to_dir.$new_name.replace_dangerous_char($name_with_directory);
$new_directory=replace_accents($pre_directory);
$sql = 'UPDATE '.$table.' SET url="work/'.$new_directory.'" WHERE id= '.$work['id'];
api_sql_query($sql, __FILE__, __LINE__);
}
@ -957,8 +964,11 @@ function update_dir_name($path, $new_name)
$work_len=strlen('/'.$path);
while($work = Database :: fetch_array($rs)) {
$new_dir=$work['url'];
$name_with_directory=substr($new_dir,$work_len,strlen($new_dir));
$sql = 'UPDATE '.$table.' SET url="/'.$path_to_dir.$new_name.$name_with_directory.'" WHERE id= '.$work['id'];
$name_with_directory=substr($new_dir,$work_len,strlen($new_dir));
$pre_directory=$path_to_dir.$new_name.replace_dangerous_char($name_with_directory);
$new_directory=replace_accents($pre_directory);
$sql = 'UPDATE '.$table.' SET url="/'.$new_directory.'" WHERE id= '.$work['id'];
api_sql_query($sql, __FILE__, __LINE__);
}
}

@ -1,4 +1,4 @@
<?php //$Id: work.php 18008 2009-01-26 19:45:00Z cfasanando $
<?php //$Id: work.php 18097 2009-01-30 23:07:49Z cvargas1 $
/* For licensing terms, see /dokeos_license.txt */
/**
* @package dokeos.work
@ -6,7 +6,7 @@
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University - ability for course admins to specify wether uploaded documents are visible or invisible by default.
* @author Roan Embrechts, code refactoring and virtual course support
* @author Frederic Vauthier, directories management
* @version $Id: work.php 18008 2009-01-26 19:45:00Z cfasanando $
* @version $Id: work.php 18097 2009-01-30 23:07:49Z cvargas1 $
*
* @todo refactor more code into functions, use quickforms, coding standards, ...
*/
@ -489,8 +489,11 @@ if (api_is_allowed_to_edit(false,true)) {
$fend = get_date_from_select('ends');
include_once (api_get_path(LIBRARY_PATH) . "fileUpload.lib.php");
$added_slash = (substr($cur_dir_path, -1, 1) == '/') ? '' : '/';
$dir_name = $cur_dir_path . $added_slash . replace_dangerous_char($_POST['new_dir']);
$added_slash = (substr($cur_dir_path, -1, 1) == '/') ? '' : '/';
$directory =replace_accents($_POST['new_dir']);
$dir_name = $cur_dir_path . $added_slash . replace_dangerous_char($directory);
$created_dir = create_unexisting_work_directory($base_work_dir, $dir_name);
// we insert here the directory in the table $work_table
@ -505,7 +508,7 @@ if (api_is_allowed_to_edit(false,true)) {
}
$sql_add_publication = "INSERT INTO " . $work_table . " SET " .
"url = '" . $dir_name_sql . "',
"url = '". $dir_name_sql ."',
title = '',
description = '".Database::escape_string($_POST['description'])."',
author = '',

Loading…
Cancel
Save