@ -27,7 +27,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 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 Roan Embrechts, code refactoring and virtual course support
* @author Frederic Vauthier, directories management
* @author Frederic Vauthier, directories management
* @version $Id: work.php 17309 2008-12-15 23:32:23 Z iflorespaz $
* @version $Id: work.php 17438 2008-12-23 19:12:48 Z iflorespaz $
*
*
* @todo refactor more code into functions, use quickforms, coding standards, ...
* @todo refactor more code into functions, use quickforms, coding standards, ...
*/
*/
@ -819,12 +819,16 @@ if (!empty($_POST['submitWork']) && !empty($is_course_member) && !empty($check))
else {
else {
//Get the author ID for that document from the item_property table
//Get the author ID for that document from the item_property table
$is_author = false;
$is_author = false;
if ($id< >'') {
$author_sql = "SELECT * FROM $iprop_table WHERE tool = 'work' AND insert_user_id='$user_id' AND ref=" . mysql_real_escape_string($id);
$author_sql = "SELECT * FROM $iprop_table WHERE tool = 'work' AND insert_user_id='$user_id' AND ref=" . mysql_real_escape_string($id);
$author_qry = api_sql_query($author_sql, __FILE__, __LINE__);
$author_qry = api_sql_query($author_sql, __FILE__, __LINE__);
if (Database :: num_rows($author_qry) == 1) {
if (Database :: num_rows($author_qry) == 1) {
$is_author = true;
$is_author = true;
}
}
} else {
Display::display_error_message(get_lang('IsNotPosibleSaveTheDocument'));
}
if ($id & & ($is_allowed_to_edit or $is_author)) {
if ($id & & ($is_allowed_to_edit or $is_author)) {
if (!$title) {
if (!$title) {
$title = basename($newWorkUrl);
$title = basename($newWorkUrl);