[svn r10522] improve the display of the oogie form

skala
Eric Marguin 18 years ago
parent 527da78734
commit c002b742b5
  1. 16
      main/inc/lib/formvalidator/FormValidator.class.php
  2. 31
      main/upload/upload_ppt.php

@ -222,9 +222,11 @@ EOT;
/**
* Use the new functions (php 5.2) allowing to display a real upload progress.
* @param upload_id the value of the field UPLOAD_IDENTIFIER
* @param elementAfter the first element of the form (to place at first UPLOAD_IDENTIFIER
* @param delay the frequency of the xajax call
* @param waitAfterUpload
*/
function add_real_progress_bar($upload_id, $delay=2,$waitAfterupload=false)
function add_real_progress_bar($upload_id, $elementAfter, $delay=2,$waitAfterUpload=false)
{
if(!function_exists('uploadprogress_get_info'))
{
@ -241,19 +243,19 @@ EOT;
$xajax_upload -> registerFunction ('updateProgress');
// IMPORTANT : must be the first element of the form (that's why we don't use addElement(hidden...)
$this->addElement('html','<input name="UPLOAD_IDENTIFIER" type="hidden" value="'.$upload_id.'" />');
// IMPORTANT : must be the first element of the form
$el = $this->insertElementBefore(FormValidator::createElement('html','<input type="hidden" name="UPLOAD_IDENTIFIER" value="'.$upload_id.'" />'), $elementAfter);
// add the div where the progress bar will be displayed
$this->addElement('html','
<div id="dynamic_div_container" style="display:none;"><br /><br />
<div id="dynamic_div_container" style="display:none;"><br />
<div id="dynamic_div_label">'.get_lang('UploadFile').'</div>
<div id="dynamic_div_frame" style="width:214px; height:12px; border:1px solid grey; background-image:url('.api_get_path(REL_PATH).'main/img/real_upload_frame.gif);">
<div id="dynamic_div_filled" style="width:0%;height:100%;background-image:url('.api_get_path(REL_PATH).'main/img/real_upload_step.gif);background-repeat:repeat-x;background-position:center;"></div>
</div>
</div>');
if($waitAfterupload){
if($waitAfterUpload){
$this->addElement('html','
<div id="dynamic_div_waiter_container" style="display:none;">
<div id="dynamic_div_waiter_label">
@ -276,7 +278,7 @@ EOT;
// add the upload event
$this->updateAttributes("onsubmit=\"myUpload.startRealUpload('dynamic_div','".$upload_id."','".$this->getAttribute('id')."',".$waitAfterupload.")\"");
$this->updateAttributes("onsubmit=\"myUpload.startRealUpload('dynamic_div','".$upload_id."','".$this->getAttribute('id')."',".$waitAfterUpload.")\"");
}

@ -107,17 +107,38 @@ if(!empty($errorMessage)){
//Display::display_error_message($errorMessage);
echo '<div style="'.$s_style_error.'"><div style="float:left; margin-right:10px;"><img src="'.api_get_path(WEB_IMG_PATH)."message_error.gif".'" alt="'.$alt_text.'" '.$attribute_list.' /></div><div style="margin-left: 43px">'.$errorMessage.'</div></div>';
}
echo '
<style>
.row{
width:300px;
}
div.row div.label {
width: 100%;
}
div.row div.formw {
width: 100%;
}
</style>';
$form = new FormValidator('update_course');
$form -> add_real_progress_bar('ppt2lp',1, true);
// build the form
$form -> addElement ('html','<br />');
$group = array();
$group[] = FormValidator::createElement ('image','ppt_img','../img/powerpoint_big.gif','align="absbottom"');
$group[] = FormValidator::createElement ('file', 'user_file',null);
$form -> addGroup($group);
$form -> addElement ('html','<br /><br />');
$form -> addElement('file', 'user_file','<img src="../img/powerpoint_big.gif" />');
$form -> addGroup ($elements, null, null, '&nbsp;&nbsp;');
$form -> addElement ('hidden', 'ppt2lp', 'true');
$form -> addElement ('html','<br /><br />');
$form -> addElement ('submit', 'convert', get_lang('ConvertToLP'));
$form -> addElement ('submit', 'convert', get_lang('ConvertToLP'), null);
$form -> addElement ('html','<br />');
$form -> add_real_progress_bar('ppt2lp', 'user_file', 1, true);
// display the form

Loading…
Cancel
Save