From e1994a063aded0061249d5eb3794f08797ccddb6 Mon Sep 17 00:00:00 2001 From: Eric Marguin Date: Thu, 19 Jul 2007 09:52:56 +0200 Subject: [PATCH] [svn r12759] remove filename when document title option is enabled (FS#1770) --- main/document/create_document.php | 13 ++++++++++--- main/document/edit_document.php | 9 ++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/main/document/create_document.php b/main/document/create_document.php index 34966aa294..84d79d7d54 100644 --- a/main/document/create_document.php +++ b/main/document/create_document.php @@ -1,5 +1,5 @@ addElement('hidden','title_edited','false','id="title_edited"'); -$form->add_textfield('filename', get_lang('FileName'),true,'class="input_titles" id="filename" onblur="check_if_still_empty()"'); -$form->addRule('filename', get_lang('FileExists'), 'callback', 'document_exists'); /** * Check if a document width the choosen filename allready exists */ @@ -262,6 +260,11 @@ if (api_get_setting('use_document_title') == 'true') { $form->add_textfield('title', get_lang('Title'),true,'class="input_titles" id="title"'); } +else +{ + $form->add_textfield('filename', get_lang('FileName'),true,'class="input_titles" id="filename" onblur="check_if_still_empty()"'); + $form->addRule('filename', get_lang('FileExists'), 'callback', 'document_exists'); +} // HTML-editor $form->add_html_editor('content', get_lang('Content'), false, true); // Comment-field @@ -277,6 +280,10 @@ if ($form->validate()) { $values['title'] = $values['filename']; } + else + { + $values['filename'] = $values['title']; + } $filename = replace_dangerous_char($values['filename']); $texte = $values['content']; $title = $values['filename']; diff --git a/main/document/edit_document.php b/main/document/edit_document.php index 8cf76b334e..29ad84b4d2 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','file_path'); $form->addElement('hidden','commentPath'); -$form->add_textfield('renameTo',get_lang('FileName')); if($use_document_title) { $form->add_textfield('newTitle',get_lang('Title')); $defaults['newTitle'] = $oldTitle; } +else +{ + $form->addElement('hidden','renameTo'); +} if($extension == "htm" || $extension == "html") { $form->addElement('hidden','formSent');