diff --git a/main/document/edit_document.php b/main/document/edit_document.php
index fd8750ad89..904b1054e2 100644
--- a/main/document/edit_document.php
+++ b/main/document/edit_document.php
@@ -1,4 +1,4 @@
-addElement('hidden','filename');
- $form->addElement('hidden','extension');
+ $form->addElement('hidden','extension');
$form->addElement('hidden','file_path');
$form->addElement('hidden','commentPath');
+ $form->addElement('hidden','showedit');
+
if($use_document_title)
{
$form->add_textfield('newTitle',get_lang('Title'));
@@ -537,9 +568,29 @@ if (api_is_allowed_to_edit() || GroupManager :: is_user_in_group($_user['user_id
$form->addElement('hidden','formSent');
$defaults['formSent'] = 1;
$form->addElement('submit','submit',get_lang('Ok'));
- $form->add_html_editor('texte','
',false,true);
+
+ //echo $read_only_flag=$_POST['readonly'];
$defaults['texte'] = $texte;
+
+ if (!empty($readonly) && $readonly==1)
+ {
+ $file_web_path=api_get_path('WEB_COURSE_PATH').$_course['path'].'/document/';
+ $filepath=api_get_path('SYS_COURSE_PATH').$_course['path'].'/document/';
+ $filename_noedit=$file_web_path.$file_name;
+ $_SESSION['showedit']=0;
+ if (file_exists($filepath.$file_name))
+ {
+ $form->addelement('html','
',false,true);
+ }
+
}
+
if(!$group_document)
{
$metadata_link = ''.get_lang('AddMetadata').'';
@@ -548,19 +599,11 @@ if (api_is_allowed_to_edit() || GroupManager :: is_user_in_group($_user['user_id
$form->addElement('textarea','newComment',get_lang('Comment'),'rows="3" style="width:300px;"');
- /* if($owner_id != $_user['user_id'])
- {
- $form->addElement('hidden','readonly');
- }
- else
- {
- */
- $renderer = $form->defaultRenderer();
+ $renderer = $form->defaultRenderer();
$renderer->setElementTemplate('