[svn r12759] remove filename when document title option is enabled (FS#1770)

skala
Eric Marguin 18 years ago
parent e5953e0dae
commit e1994a063a
  1. 13
      main/document/create_document.php
  2. 9
      main/document/edit_document.php

@ -1,5 +1,5 @@
<?php <?php
// $Id: create_document.php 12218 2007-05-01 18:27:14Z yannoo $ // $Id: create_document.php 12759 2007-07-19 07:52:56Z elixir_inter $
/* /*
============================================================================== ==============================================================================
Dokeos - elearning and course management software Dokeos - elearning and course management software
@ -241,8 +241,6 @@ $default['dir'] = $dir;
$form->addElement('hidden','title_edited','false','id="title_edited"'); $form->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 * 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"'); $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 // HTML-editor
$form->add_html_editor('content', get_lang('Content'), false, true); $form->add_html_editor('content', get_lang('Content'), false, true);
// Comment-field // Comment-field
@ -277,6 +280,10 @@ if ($form->validate())
{ {
$values['title'] = $values['filename']; $values['title'] = $values['filename'];
} }
else
{
$values['filename'] = $values['title'];
}
$filename = replace_dangerous_char($values['filename']); $filename = replace_dangerous_char($values['filename']);
$texte = $values['content']; $texte = $values['content'];
$title = $values['filename']; $title = $values['filename'];

@ -1,4 +1,4 @@
<?php // $Id: edit_document.php 12272 2007-05-03 14:40:45Z elixir_julian $ <?php // $Id: edit_document.php 12759 2007-07-19 07:52:56Z elixir_inter $
/* /*
============================================================================== ==============================================================================
Dokeos - elearning and course management software Dokeos - elearning and course management software
@ -375,7 +375,7 @@ if($is_allowedToEdit)
//echo (fputs($fp,$texte))?'FPUTS OK':'FPUTS NIET OK'; //echo (fputs($fp,$texte))?'FPUTS OK':'FPUTS NIET OK';
fputs($fp,$texte); fputs($fp,$texte);
fclose($fp); fclose($fp);
if(!is_dir($filepath.'css')) if(!is_dir($filepath.'css'))
@ -477,12 +477,15 @@ $form->addElement('hidden','filename');
$form->addElement('hidden','extension'); $form->addElement('hidden','extension');
$form->addElement('hidden','file_path'); $form->addElement('hidden','file_path');
$form->addElement('hidden','commentPath'); $form->addElement('hidden','commentPath');
$form->add_textfield('renameTo',get_lang('FileName'));
if($use_document_title) if($use_document_title)
{ {
$form->add_textfield('newTitle',get_lang('Title')); $form->add_textfield('newTitle',get_lang('Title'));
$defaults['newTitle'] = $oldTitle; $defaults['newTitle'] = $oldTitle;
} }
else
{
$form->addElement('hidden','renameTo');
}
if($extension == "htm" || $extension == "html") if($extension == "htm" || $extension == "html")
{ {
$form->addElement('hidden','formSent'); $form->addElement('hidden','formSent');

Loading…
Cancel
Save