[svn r11790] using correct display_messages

skala
Patrick Cool 18 years ago
parent 12a0f4c070
commit 4d5951a77e
  1. 29
      main/document/document.php
  2. 24
      main/document/edit_document.php
  3. 23
      main/document/upload.php

@ -1,4 +1,4 @@
<?php // $Id: document.php 11250 2007-02-27 10:55:02Z elixir_julian $
<?php // $Id: document.php 11790 2007-03-29 20:58:06Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -62,7 +62,7 @@
==============================================================================
*/
// name of the language file that needs to be included
// name of the language file that needs to be included
$language_file = 'document';
include("../inc/global.inc.php");
@ -322,17 +322,15 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
$dbTable = Database::get_course_table(TABLE_DOCUMENT);
//security fix: make sure they can't move files that are not in the document table
if(DocumentManager::get_document_id($_course,$_POST['move_file'])) {
//Display::display_normal_message('We want to move '.$_POST['move_file'].' to '.$_POST['move_to']);
if(DocumentManager::get_document_id($_course,$_POST['move_file']))
{
if ( move($base_work_dir.$_POST['move_file'],$base_work_dir.$_POST['move_to']) )
{
update_db_info("update", $_POST['move_file'], $_POST['move_to']."/".basename($_POST['move_file']));
//set the current path
$curdirpath = $_POST['move_to'];
$curdirpathurl = urlencode($_POST['move_to']);
Display::display_normal_message(get_lang('DirMv'));
Display::display_confirmation_message(get_lang('DirMv'));
}
else
{
@ -355,11 +353,11 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
include_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php');
if(DocumentManager::delete_document($_course,$_GET['delete'],$base_work_dir))
{
Display::display_normal_message(get_lang('DocDeleted'));
Display::display_confirmation_message(get_lang('DocDeleted'));
}
else
{
Display::display_normal_message(get_lang('DocDeleteError'));
Display::display_error_message(get_lang('DocDeleteError'));
}
}
@ -372,7 +370,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
{
DocumentManager::delete_document($_course,$path,$base_work_dir);
}
Display::display_normal_message(get_lang('DocDeleted'));
Display::display_confirmation_message(get_lang('DocDeleted'));
break;
}
}
@ -391,8 +389,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
$created_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$dir_name,$_POST['dirname']);
if($created_dir)
{
//Display::display_normal_message("<strong>".$created_dir."</strong> was created!");
Display::display_normal_message('<span title="'.$created_dir.'">'.get_lang('DirCr').'</span>',false);
Display::display_confirmation_message('<span title="'.$created_dir.'">'.get_lang('DirCr').'</span>',false);
//uncomment if you want to enter the created dir
//$curdirpath = $created_dir;
//$curdirpathurl = urlencode($curdirpath);
@ -437,7 +434,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
//update item_property to change visibility
if(api_item_property_update($_course, TOOL_DOCUMENT, $update_id, $visibility_command, $_user['user_id']))
{
Display::display_normal_message(get_lang("ViMod"));
Display::display_confirmation_message(get_lang("ViMod"));
}
else
{
@ -467,8 +464,8 @@ echo(build_directory_selector($folders,$curdirpath,$group_properties['directory'
<?php
echo "<div id=\"doc_links\">";
/* GO TO PARENT DIRECTORY */
if ($curdirpath!= '/'&& $curdirpath!=$group_properties['directory'])
@ -563,7 +560,7 @@ if($docs_and_folders)
if ($is_allowed_to_edit || $group_member_with_upload_rights)
{
$edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key);
$row[] = $edit_icons;
}
$sortable_data[] = $row;

@ -1,4 +1,4 @@
<?php // $Id: edit_document.php 11577 2007-03-14 17:33:31Z yannoo $
<?php // $Id: edit_document.php 11790 2007-03-29 20:58:06Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -50,12 +50,6 @@
==============================================================================
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/
// name of the language file that needs to be included
$language_file = 'document';
@ -98,8 +92,6 @@ $baseServUrl = $_configuration['url_append']."/";
$courseDir = $_course['path']."/document";
$baseWorkDir = $baseServDir.$courseDir;
$group_document = false;
// name of the language file that needs to be included
$language_file = 'document';
$use_document_title = (get_setting('use_document_title')=='true')?true:false;
$noPHP_SELF=true;
@ -196,8 +188,6 @@ event_access_tool(TOOL_DOCUMENT);
*/
function change_name($baseWorkDir, $sourceFile, $renameTo, $dir, $doc)
{
$file_name_for_change = $baseWorkDir.$dir.$sourceFile;
//api_display_debug_info("call my_rename: params $file_name_for_change, $renameTo");
@ -289,9 +279,9 @@ if (isset($_POST['newComment']))
*/
if (isset($_POST['renameTo']))
{
{
$info_message = change_name($baseWorkDir, $_GET['sourceFile'], $_POST['renameTo'], $dir, $doc);
//assume name change was successful
}
@ -330,7 +320,7 @@ if($is_allowedToEdit)
if($_POST['formSent']==1)
{
if(isset($_POST['renameTo']))
{
{
$_POST['filename']=disable_dangerous_file($_POST['renameTo']);
$extension=explode('.',$_POST['filename']);
@ -373,8 +363,8 @@ if($is_allowedToEdit)
{
if($fp=@fopen($filepath.$filename.'.'.$extension,'w'))
{
$texte = text_filter($texte);
$texte = text_filter($texte);
//echo('file path: '.$filepath.$filename.'.'.$extension);
$path_to_remove=api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$dir;
@ -475,7 +465,7 @@ api_display_tool_title(get_lang("EditDocument") . ": $file_name");
if(isset($msgError))
{
Display::display_normal_message($msgError); //main API
Display::display_error_message($msgError); //main API
}
if( isset($info_message))
{

@ -1,4 +1,4 @@
<?php // $Id: upload.php 11321 2007-03-02 09:05:54Z yannoo $
<?php // $Id: upload.php 11790 2007-03-29 20:58:06Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -109,7 +109,7 @@ if(isset($_SESSION['_gid']) && $_SESSION['_gid']!='') //if the group id is set,
//get group info
$group_properties = GroupManager::get_group_properties($_SESSION['_gid']);
$noPHP_SELF=true;
if($is_allowed_to_edit || GroupManager::is_user_in_group($_user['user_id'],$_SESSION['_gid'])) //only courseadmin or group members allowed
{
$to_group_id = $_SESSION['_gid'];
@ -140,7 +140,7 @@ elseif (isset($_POST['curdirpath']))
{
$path = $_POST['curdirpath'];
}
else
else
{
$path = '/';
}
@ -210,7 +210,7 @@ if(isset($_FILES['user_upload']))
//echo("<pre>");
//print_r($_FILES['user_upload']);
//echo("</pre>");
$upload_ok = process_uploaded_file($_FILES['user_upload']);
if($upload_ok)
{
@ -218,7 +218,7 @@ if(isset($_FILES['user_upload']))
$new_path = handle_uploaded_document($_course, $_FILES['user_upload'],$base_work_dir,$_POST['curdirpath'],$_user['user_id'],$to_group_id,$to_user_id,$max_filled_space,$_POST['unzip'],$_POST['if_exists']);
$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
if ($new_path && ($new_comment || $new_title))
if (($docid = DocumentManager::get_document_id($_course, $new_path)))
{
@ -226,7 +226,7 @@ if(isset($_FILES['user_upload']))
$ct = '';
if ($new_comment) $ct .= ", comment='$new_comment'";
if ($new_title) $ct .= ", title='$new_title'";
api_sql_query("UPDATE $table_document SET" . substr($ct, 1) .
api_sql_query("UPDATE $table_document SET" . substr($ct, 1) .
" WHERE id = '$docid'", __FILE__, __LINE__);
}
//check for missing images in html files
@ -254,7 +254,7 @@ if(isset($_POST['submit_image']))
//open the html file and replace the paths
replace_img_path_in_html_file($_POST['img_file_path'],$paths_to_replace_in_file,$base_work_dir.$_POST['related_file']);
//update parent folders
item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
}
}
//they want to create a directory
@ -265,11 +265,10 @@ if(isset($_POST['create_dir']) && $_POST['dirname']!='')
$created_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$dir_name,$_POST['dirname']);
if($created_dir)
{
//Display::display_normal_message("<strong>".$created_dir."</strong> was created!");
Display::display_normal_message(get_lang('DirCr'),false);
Display::display_confirmation_message(get_lang('DirCr'),false);
$path = $created_dir;
}
else
else
{
display_error(get_lang('CannotCreateDir'));
}
@ -296,7 +295,7 @@ if(isset($_GET['createdir']))
$new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>';
$new_folder_text .= '</form>';
//show the form
Display::display_normal_message($new_folder_text);
Display::display_normal_message($new_folder_text, false);
}
else { //give them a link to create a directory
?>
@ -347,7 +346,7 @@ $form->display();
<!-- end upload form -->
<!-- so they can get back to the documents -->
<!-- so they can get back to the documents -->
<p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p>
<?php

Loading…
Cancel
Save