[svn r16197] LP menu improvements see FS#2841

skala
Julio Montoya 16 years ago
parent fa616756ad
commit 7dc7fab256
  1. 16
      main/css/public_admin/scormfs.css
  2. 71
      main/newscorm/learnpath.class.php
  3. 13
      main/newscorm/lp_author_image.php
  4. 9
      main/newscorm/lp_controller.php
  5. 26
      main/newscorm/lp_edit.php

@ -78,9 +78,15 @@
clear: both;
}
.preview_image
{
text-align: right;
margin-right: 5px;
padding-left: 15px;
#image_preview
{
padding-left: 17px;
}
#author_name
{
padding-left: 5px;
padding-top: 5px;
font-size: 11px;
color:#888;
}

@ -8534,47 +8534,48 @@ EOD;
$new_path=$updir.'/'.$new_file_name;
//$result= @move_uploaded_file($image_array['tmp_name'], $new_path);
// resize the image
include_once (api_get_path(LIBRARY_PATH).'image.lib.php');
$temp = new image($image_array['tmp_name']);
$picture_infos=getimagesize($image_array['tmp_name']); // $picture_infos[0]-> width
if ($picture_infos[0]>240)
$thumbwidth=240;
else
$thumbwidth=$picture_infos[0];
if ($picture_infos[1]>100)
$new_height=100;
else
$new_height = $picture_infos[1];
// resize the image
include_once (api_get_path(LIBRARY_PATH).'image.lib.php');
$temp = new image($image_array['tmp_name']);
$picture_infos=getimagesize($image_array['tmp_name']); // $picture_infos[0]-> width
if ($picture_infos[0]>240)
$thumbwidth=240;
else
$thumbwidth=$picture_infos[0];
if ($picture_infos[1]>100)
$new_height=100;
else
$new_height = $picture_infos[1];
//$new_height = round(($thumbwidth/$picture_infos[0])*$picture_infos[1]);
//$new_height = round(($thumbwidth/$picture_infos[0])*$picture_infos[1]);
$temp->resize($thumbwidth,$new_height,0);
$type=$picture_infos[2];
switch ($type) {
case 2 : $temp->send_image('JPG',$new_path);
break;
case 3 : $temp->send_image('PNG',$new_path);
break;
case 1 : $temp->send_image('GIF',$new_path);
break;
}
$temp->resize($thumbwidth,$new_height,0);
$type=$picture_infos[2];
$result=false;
// Storing the attachments if any
if (1)
switch ($type)
{
case 2 :
$result=$temp->send_image('JPG',$new_path);
break;
case 3 :
$result=$temp->send_image('PNG',$new_path);
break;
case 1 :
$result=$temp->send_image('GIF',$new_path);
break;
}
// Storing the image filename
if ($result)
{
$image_moved=true;
$this->set_preview_image($new_file_name);
//return true;
}
return true;
}
}
}

@ -1,6 +1,6 @@
<?php //$id: $
/**
* Script that displays the author name and image
* Script that displays the author name and image of a LP
* @package dokeos.learnpath
* @author Julio Montoya Armas <gugli100@gmail.com>
*/
@ -10,7 +10,7 @@ require_once('back_compat.inc.php');
require_once('learnpath.class.php');
require_once('scorm.class.php');
require_once('aicc.class.php');
//Getting the LP
if(isset($_SESSION['lpobject']))
{
$oLP = unserialize($_SESSION['lpobject']);
@ -22,9 +22,9 @@ if(isset($_SESSION['lpobject']))
} /*
$charset = $_SESSION['oLP']->encoding;
$lp_theme_css=$_SESSION['oLP']->get_theme();
*/
$scorm_css_header=true;
// scorm.css loaded
include_once('../inc/reduced_header.inc.php');
echo '<html>
@ -34,13 +34,12 @@ echo '<html>
echo '<table STYLE="width:250px;height:110px;background-image: url('.$image.');">';
echo '<tr><td align="center">';
if ($_SESSION['oLP']->get_preview_image()!='')
echo '<img alt="'.$_SESSION['oLP']->get_author().'" src="'.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image().'">';
echo '<img alt="" src="'.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image().'">';
else
echo Display::display_icon('unknown_250_100.jpg',$_SESSION['oLP']->get_author());
echo Display::display_icon('unknown_250_100.jpg',' ');
echo '</td></tr>';
echo '</table>';
echo '<div id="author_name">';
echo '<div id="author_name">';
echo $_SESSION['oLP']->get_author();
echo '</div>';
echo '</div>';

@ -569,13 +569,18 @@ switch($action)
case 'update_lp':
if(!api_is_allowed_to_edit()){
api_not_allowed(true);
}
}
if($debug>0) error_log('New LP - update_lp action triggered',0);
if(!$lp_found){ error_log('New LP - No learnpath given for edit',0); require('lp_list.php'); }
else{
$_SESSION['refresh'] = 1;
$_SESSION['oLP']->set_name($_REQUEST['lp_name']);
$_SESSION['oLP']->set_author($_REQUEST['lp_author']);
$author= $_REQUEST['lp_author'];
//fixing the author name (no body or html tags)
$len = strpos($author,'</p>')-strpos($author,'<p>');
$author_fixed=substr($author,strpos($author,'<p>'), $len+4);
$_SESSION['oLP']->set_author($author_fixed);
$_SESSION['oLP']->set_encoding($_REQUEST['lp_encoding']);
$_SESSION['oLP']->set_maker($_REQUEST['lp_maker']);
$_SESSION['oLP']->set_proximity($_REQUEST['lp_proximity']);

@ -3,14 +3,12 @@
* Script allowing simple edition of learnpath information (title, description, etc)
* @package dokeos.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
*/
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
$show_description_field = false; //for now
$nameTools = get_lang("Doc");
event_access_tool(TOOL_LEARNPATH);
if (! $is_allowed_in_course) api_not_allowed();
@ -23,13 +21,17 @@ Display::display_header(null,'Path');
//Page subtitle
echo '<h4>'.get_lang('_edit_learnpath').'</h4>';
$fck_attribute['Width'] = '400px';
$fck_attribute['Height'] = '150px';
$fck_attribute['ToolbarSet'] = 'Comment';
$defaults=array();
$form = new FormValidator('form1', 'post', 'lp_controller.php');
//Title
$form -> addElement('text', 'lp_name', ucfirst(get_lang('_title')));
//Ecoding
//Encoding
$encoding_select = &$form->addElement('select', 'lp_encoding', get_lang('Charset'));
$encodings = array('UTF-8','ISO-8859-1','ISO-8859-15','cp1251','cp1252','KOI8-R','BIG5','GB2312','Shift_JIS','EUC-JP');
foreach($encodings as $encoding){
@ -80,12 +82,12 @@ if (api_get_setting('allow_course_theme') == 'true')
}
//Author
$form -> addElement('text', 'lp_author', ucfirst(get_lang('Author')));
//$form -> addElement('text', 'lp_author', ucfirst(get_lang('Author')));
//$form->add_html_editor('lp_author', get_lang('Author'));
// LP image
$form->addElement('html_editor','lp_author',get_lang('Author'));
// LP image
$form->add_progress_bar();
if( strlen($_SESSION['oLP']->get_preview_image() ) > 0)
{
@ -97,8 +99,7 @@ if( strlen($_SESSION['oLP']->get_preview_image() ) > 0)
</div>
</div>';
$form->addElement('html', $div .'<br/>');
$form->addElement('checkbox', 'remove_picture', null, get_lang('DelImage'));
$form->addElement('checkbox', 'remove_picture', null, get_lang('DelImage'));
}
$form->addElement('file', 'lp_preview_image', ($_SESSION['oLP']->get_preview_image() != '' ? get_lang('UpdateImage') : get_lang('AddImage')));
@ -113,8 +114,6 @@ $form->addElement('html', $div);
$form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'mimetype', array('image/gif', 'image/jpeg', 'image/png'));
//default values
$content_proximity_select -> setSelected($s_selected_proximity);
$origin_select -> setSelected($s_selected_origin);
@ -129,10 +128,7 @@ $form->addElement('submit', 'Submit', get_lang('Ok'));
$form->addElement('hidden', 'action', 'update_lp');
$form->addElement('hidden', 'lp_id', $_SESSION['oLP']->get_id());
$form->setDefaults($defaults);
$form -> display();
Display::display_footer();
?>
Loading…
Cancel
Save