diff --git a/main/document/create_audio.php b/main/document/create_audio.php index f8ae725fa9..4e0a341193 100644 --- a/main/document/create_audio.php +++ b/main/document/create_audio.php @@ -44,27 +44,6 @@ $document_id = $document_data['id']; $dir = $document_data['path']; //jquery textareaCounter $htmlHeadXtra[] = ''; -//need jquery for hide menus -$htmlHeadXtra[] = ''; $is_allowed_to_edit = api_is_allowed_to_edit(null, true); @@ -151,6 +130,12 @@ Display :: display_header($nameTools, 'Doc'); echo '
'; echo ''.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).''; + + echo ''.Display::return_icon('google.png',get_lang('GoogleAudio'),'',ICON_SIZE_MEDIUM).''; + + echo ''.Display::return_icon('pediaphon.png', get_lang('Pediaphon'),'',ICON_SIZE_MEDIUM).''; + + echo '
'; ?> @@ -165,13 +150,9 @@ $(document).ready(function(){ 'warningNumber': 20, 'displayFormat' : '#input/#max' }; - $('#textarea').textareaCount(options, function(data){ + $('#textarea_google').textareaCount(options, function(data){ $('#textareaCallBack').html(data); - }); - - $("#option1").show(); - $("#checktext2voiceid").attr('checked',true); - + }); }); @@ -205,11 +186,11 @@ $(document).ready(function(){

'.$icon.get_lang('HelpText2Audio').'

'; - $form = new FormValidator(''); - //Google services - $form->addElement('radio', 'checktext2voice', ''.get_lang('GoogleAudio').'', get_lang('GoogleAudio'), null, - array('id'=>'checktext2voiceid', 'onclick' => "javascript: if(this.checked){document.getElementById('option2').style.display='none'; document.getElementById('option1').style.display='block';}else{document.getElementById('option1').style.display='none';}", - )); - - //Pediaphone - $form->addElement('radio', 'checktext2voice', ''.get_lang('Pediaphon').'', get_lang('Pediaphon'), null, - array('value'=>'2','onclick' => "javascript: if(this.checked){document.getElementById('option1').style.display='none'; document.getElementById('option2').style.display='block';}else{document.getElementById('option2').style.display='none';}", - )); - - $form ->display(); - - echo ''; - - echo ''; - - echo ''; - - ?> - - - - - - + $form = new FormValidator('form2', 'post', null, '', array('id' => 'form2')); + $form->addElement('hidden', 'text2voice_mode','pediaphon'); + $form->addElement('hidden', 'document_id', $document_id); + $form->addElement('text', 'title', get_lang('Title')); + $form->addElement('select', 'lang', get_lang('Language'), $options_pedia, array('onclick' => 'update_voices(this.selectedIndex);')); + $form->addElement('select', 'voices', get_lang('Voice'), array(get_lang('FirstSelectALanguage')), array()); + $speed_options = array(); + $speed_options['1'] = get_lang('Normal'); + $speed_options['0.75'] = get_lang('GoFaster'); + $speed_options['0.8'] = get_lang('Fast'); + $speed_options['1.2'] = get_lang('Slow'); + $speed_options['1.6'] = get_lang('SlowDown'); + + $form->addElement('select', 'speed', get_lang('Speed'), $speed_options, array()); + $form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_pediaphon', 'class' =>'span6')); + //echo Display :: return_icon('info3.gif', get_lang('HelpPediaphon'), array('align' => 'absmiddle', 'hspace' => '3px'), false); + + $form->addElement('style_submit_button', 'submit', get_lang('SaveMP3'), 'class="save"'); + $defaults = array(); + $defaults['lang'] = $selected_language; + $form->setDefaults($defaults); + $form->display(); + echo ''; + + ?> + + + + + window.location.href="'.$location.'"'; return; } global $_course, $_user; @@ -387,6 +365,7 @@ function downloadMP3_google($filepath, $dir) { $clean_title=trim($_POST['title']); $clean_text=trim($_POST['text']); if(empty($clean_title) || empty($clean_text)){ + echo ''; return; } $clean_title=Security::remove_XSS($clean_title); @@ -437,26 +416,31 @@ function downloadMP3_google($filepath, $dir) { $doc_id = add_document($_course, $relativeUrlPath.$audio_filename, 'file', filesize($documentPath), $audio_title); api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id); Display::display_confirmation_message(get_lang('DocumentCreated')); + //return to location + echo ''; } /** - * This function save a post into a file mp3 from pediaphone services + * This function save a post into a file mp3 from pediaphon services * * @param $filepath * @param $dir * @author Juan Carlos RaƱa Trabado * @version january 2011, chamilo 1.8.8 */ -function downloadMP3_pediaphone($filepath, $dir){ +function downloadMP3_pediaphon($filepath, $dir){ + $location='create_audio.php?'.api_get_cidreq().'&id='.Security::remove_XSS($_POST['document_id']).'&dt2a=pediaphon'; //security if(!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) { + echo ''; return; } global $_course, $_user; $clean_title=trim($_POST['title']); $clean_title= Database::escape_string($clean_title); $clean_text=trim($_POST['text']); - if(empty($clean_title) || empty($clean_text)){ + if(empty($clean_title) || empty($clean_text)){ + echo ''; return; } $clean_title=Security::remove_XSS($clean_title); @@ -540,4 +524,6 @@ function downloadMP3_pediaphone($filepath, $dir){ $doc_id = add_document($_course, $relativeUrlPath.$audio_filename, 'file', filesize($documentPath), $audio_title); api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id); Display::display_confirmation_message(get_lang('DocumentCreated')); + //return to location + echo ''; } \ No newline at end of file diff --git a/main/document/document.php b/main/document/document.php index ea9b302366..b5d478369a 100644 --- a/main/document/document.php +++ b/main/document/document.php @@ -1091,8 +1091,10 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_fold // Create new audio from text if (api_get_setting('enabled_text2audio') == 'true'){ + $dt2a='google'; + $req_dt2a='&dt2a='.$dt2a; ?> - +