Code style for Woogie - not fixed yet

1.9.x
Yannick Warnier 11 years ago
parent 3e373a87ff
commit dfb1ba063c
  1. 2
      main/newscorm/lp_upload.php
  2. 70
      main/upload/upload_word.php

@ -100,7 +100,7 @@ if( Request::is_post() && $is_error){
break;
case 'woogie':
require_once 'openoffice_text.class.php';
$split_steps = $_POST['split_steps'];
$split_steps = (empty($_POST['split_steps']) || $_POST['split_steps'] == 'per_page') ? 'per_page' : 'per_chapter';
$o_doc = new OpenofficeText($split_steps);
$first_item_id = $o_doc->convert_document($_FILES['user_file']);
break;

@ -1,7 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Action controller for the upload process. The display scripts (web forms) redirect
* Action controller for the upload process. The display scripts (web forms)
* redirect
* the process here to do what needs to be done with each file.
* @package chamilo.upload
* @author Yannick Warnier <ywarnier@beeznest.org>
@ -16,14 +17,12 @@ $language_file[] = "learnpath";
$language_file[] = "scormdocument";
// global settings initialisation
// also provides access to main api (inc/lib/main_api.lib.php)
include("../inc/global.inc.php");
require_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
require_once(api_get_path(LIBRARY_PATH) . 'document.lib.php');
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
include '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'formvalidator/FormValidator.class.php';
$form_style= '
<style>
$form_style= '<style>
.row {
width: 200px;
}
@ -40,20 +39,19 @@ $htmlHeadXtra[] = '<script type="text/javascript">
var myUpload = new upload(0);
</script>';
$htmlHeadXtra[] = $form_style;
if (api_get_setting('search_enabled')=='true')
{
if (api_get_setting('search_enabled')=='true') {
$specific_fields = get_specific_field_list();
}
if (isset($_POST['convert'])) {
$cwdir = getcwd();
if(isset($_FILES['user_file']))
{
if (isset($_FILES['user_file'])) {
$allowed_extensions = array('doc','docx','odt','txt','sxw','rtf');
if(in_array(strtolower(pathinfo($_FILES['user_file']['name'],PATHINFO_EXTENSION)),$allowed_extensions))
{
if (in_array(strtolower(pathinfo($_FILES['user_file']['name'],PATHINFO_EXTENSION)),$allowed_extensions)) {
require('../newscorm/lp_upload.php');
if (isset($o_doc) && $first_item_id != 0) {
// Search-related section
if (api_get_setting('search_enabled')=='true') {
require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
$specific_fields = get_specific_field_list();
@ -69,29 +67,24 @@ if(isset($_POST['convert'])){
}
}
}
}
} //end of search-related section
header('Location: ../newscorm/lp_controller.php?'.api_get_cidreq().'&lp_id='.$o_doc->lp_id.'&action=view_item&id='.$first_item_id);
}
else {
if(!empty($o_doc->error))
} else {
if (!empty($o_doc->error)) {
$errorMessage = $o_doc->error;
else
} else {
$errorMessage = get_lang('OogieUnknownError');
}
}
else
{
} else {
$errorMessage = get_lang('WoogieBadExtension');
}
}
}
event_access_tool(TOOL_UPLOAD);
// check access permissions (edit permission is needed to add a document or a LP)
$is_allowed_to_edit = api_is_allowed_to_edit();
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
@ -100,18 +93,10 @@ $interbreadcrumb[]= array ("url"=>"../newscorm/lp_controller.php?action=list", "
$nameTools = get_lang("WoogieConversionPowerPoint");
Display :: display_header($nameTools);
?>
<img src="../img/mascot.png"><br>
<span style="color: #5577af; font-size: 16px; font-family: Arial; margin-left: 10px;"><?php echo get_lang("WelcomeWoogieSubtitle");?></span><br>
<?php
//echo '<img src="../img/mascot.png"><br />';
echo '<span style="color: #5577af; font-size: 16px; font-family: Arial; margin-left: 10px;">'.get_lang("WelcomeWoogieSubtitle").'</span><br>';
$message = get_lang("WelcomeWoogieConverter");
echo '<br>';
echo '<br />';
$s_style = "border-width: 1px;
border-style: solid;
margin-left: 0;
@ -175,8 +160,7 @@ EOT;
$renderer->setElementTemplate($user_file_template);
$form -> addElement ('file', 'user_file','<img src="../img/word_big.gif" align="absbottom" />');
if (api_get_setting('search_enabled')=='true')
{
if (api_get_setting('search_enabled')=='true') {
$form -> addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument'));
$form -> addElement ('html','<br />');
$form -> addElement ('html', get_lang('SearchFeatureDocumentLanguage').': &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'. api_get_languages_combo());
@ -193,24 +177,12 @@ if (api_get_setting('search_enabled')=='true')
* $form -> addElement ('radio', 'split_steps',null, get_lang('SplitStepsPerChapter'),'per_chapter');
*/
$form -> addElement ('hidden', 'split_steps','per_page');
$form -> addElement ('submit', 'convert', get_lang('ConvertToLP'), 'class="convert_button"');
$form -> addElement ('hidden', 'woogie', 'true');
$form -> add_real_progress_bar(md5(rand(0,10000)), 'user_file', 1, true);
$defaults = array('split_steps'=>'per_page','index_document'=>'checked="checked"');
$form -> setDefaults($defaults);
// display the form
$form -> display();
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
?>
Loading…
Cancel
Save