skala
Julio Montoya 13 years ago
commit 8680ced54e
  1. 2
      main/document/document_slideshow.inc.php
  2. 109
      main/document/slideshow.php
  3. 11
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php
  4. 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_upload.php
  5. 11
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php
  6. 3474
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/jscripts/ajaxfilemanager.js
  7. 8
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/jscripts/thickbox.js

@ -25,7 +25,7 @@
* too much things in one file , I decided to put the code for document.php here and to include this
* file into document.php
*/
$accepted_extensions = array('.jpg', '.jpeg', '.gif', '.png');
$accepted_extensions = array('.jpg', '.jpeg', '.gif', '.png', '.bmp','.svg');
// Resetting the images of the slideshow = destroying the slideshow
if (isset($_GET['action']) && $_GET['action'] == 'exit_slideshow') {

@ -178,24 +178,104 @@ if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resiz
// This is for viewing all the images in the slideshow as thumbnails.
$image_tag = array ();
if ($slide_id == 'all') {
$thumbnail_width = 100;
$thumbnail_height = 100;
$row_items = 4;
// Create the template_thumbnails folder (if no exist)
if (!$sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/') {
@mkdir($sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/', api_get_permissions_for_new_directories());
}
// Config thumbnails
$row_items = 4;
$allowed_thumbnail_types = array('jpg','jpeg','gif','png');
$max_thumbnail_width = 100;
$max_thumbnail_height = 100;
$png_compression = 0;//0(none)-9
$jpg_quality = 75;//from 0 to 100 (default is 75). More queality less compression
// check files and thumbnails
if (is_array($image_files_only)) {
foreach ($image_files_only as $one_image_file) {
$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
$image_thumbnail= $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/.'.$one_image_file;
if (file_exists($image)) {
$image_height_width = resize_image($image, $thumbnail_width, $thumbnail_height, 1);
$image_height = $image_height_width[0];
$image_width = $image_height_width[1];
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
$image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">';
}
}
}
//check thumbnail
$imagetype = explode(".", $image);
$imagetype = strtolower($imagetype[count($imagetype)-1]);
if(in_array($imagetype,$allowed_thumbnail_types)) {
if (!file_exists($image_thumbnail)){
$original_image_size = api_getimagesize($image);
switch($imagetype) {
case 'gif':
$source_img = imagecreatefromgif($image);
break;
case 'jpg':
$source_img = imagecreatefromjpeg($image);
break;
case 'png':
$source_img = imagecreatefrompng($image);
break;
}
$new_thumbnail_size = api_calculate_image_size($original_image_size['width'], $original_image_size['height'], $max_thumbnail_width, $max_thumbnail_height);
$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
// preserve transparency
if($imagetype == "png"){
imagesavealpha($crop, true);
$color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
imagefill($crop, 0, 0, $color);
}
if($imagetype == "gif"){
$transindex = imagecolortransparent($image);
//GIF89a for transparent and anim (first clip), either GIF87a
if($transindex >= 0){
$transcol = imagecolorsforindex($image, $transindex);
$transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
imagefill($crop, 0, 0, $transindex);
imagecolortransparent($crop, $transindex);
}
}
//resampled image
imagecopyresampled($crop,$source_img,0,0,0,0,$new_thumbnail_size['width'],$new_thumbnail_size['height'],$original_image_size['width'],$original_image_size['height']);
if($imagetype == ("jpg" || "jpeg")) {
imagejpeg($crop,$image_thumbnail,$jpg_quality);
}
if($imagetype == "png") {
imagepng($crop,$image_thumbnail,$png_compression);
}
if($imagetype == "gif"){
imagegif($crop,$image_thumbnail);
}
//clean memory
imagedestroy($crop);
}//end exist thumbnail
//show thumbnail and link
$one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
$image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
}
else{
//image format no support, get path original image
$image_height_width = resize_image($image, $thumbnail_width, $thumbnail_height, 1);
$image_height = $image_height_width[0];
$image_width = $image_height_width[1];
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
$image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$max_thumbnail_width.'" height="'.$max_thumbnail_height.'" title="'.$one_image_file.'">';
}//end allowed image types
}//end if exist file image
}//end foreach
}//end image files only
}
// Creating the table
@ -237,7 +317,6 @@ if ($slide_id != 'all') {
$height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
}
// Showing the comment of the image, Patrick Cool, 8 april 2005
// This is done really quickly and should be cleaned up a little bit using the API functions
$tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
if ($path == '/') {

@ -65,7 +65,16 @@ foreach ($fileList as $file) {
switch($file['cssClass']) {
case 'filePicture':
echo '<a id="thumbUrl' . $count . '" rel="thumbPhotos" href="' . $file['public_path'] . '">';
echo '<img src="' . appendQueryString($thumbnailBaseUrl, ' path=' . base64_encode($file['path'])) . '" id="thumbImg' . $count . '"></a>' . "\n";
//improve for Chamilo load thumbnails from disk
$thumbnail_disk= dirname($file['path']).'/.thumbs/.'.basename($file['path']);
if (file_exists($thumbnail_disk)) {
echo '<img src="' . appendQueryString($thumbnailBaseUrl, ' path=' . base64_encode($thumbnail_disk)) . '" id="thumbImg' . $count . '"></a>' . "\n";
}
else {
echo '<img src="' . appendQueryString($thumbnailBaseUrl, ' path=' . base64_encode($file['path'])) . '" id="thumbImg' . $count . '"></a>' . "\n";
}
break;
case 'fileFlash':
case 'fileVideo':

@ -96,6 +96,7 @@ if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) {
$error = ERR_FILE_NOT_AVAILABLE;
}
}
echo "error:'" . $error . "'";
echo $info;
echo "}";

@ -84,7 +84,7 @@ if(!empty($_GET['view'])) {
//end hack
}
var globalSettings = {'upload_init':false};
var queryString = '<?php echo makeQueryString(array('path')); ?>';
var queryString = '<?php echo makeQueryString(array('path')); ?>';
var paths = {'root':'<?php echo addTrailingSlash(backslashToSlash(CONFIG_SYS_ROOT_PATH)); ?>', 'root_title':'<?php echo LBL_FOLDER_ROOT; ?>'};
<!-- Chamilo hack for breadcrumb into shared folders -->
@ -524,7 +524,8 @@ if(!empty($_GET['view'])) {
<div id="winUpload" style="display:none">
<div class="jqmContainer">
<div class="jqmHeader">
<a href="#" onclick="tb_remove();">
<!-- Adding return windowRefresch() for Chamilo -->
<a href="#" onclick="tb_remove();return windowRefresh();">
<img src="theme/default/images/flagno.png"title="<?php echo LBL_ACTION_CLOSE; ?>">
<?php echo LBL_ACTION_CLOSE; ?>
</a>
@ -557,9 +558,9 @@ if(!empty($_GET['view'])) {
<input type="file" class="input" name="file" />
<input type="button" class="upload_button" value="<?php echo FILE_LBL_UPLOAD; ?>" /><!-- change style of upload button by Chamilo -->
<a href="#" class="action" title="<?php echo get_lang('Cancel')?>" style="display:none" ><!-- Chamilo lang var added -->
<span class="cancel">&nbsp;</span>
<span class="cancel">&nbsp;</span><span class="uploadProcessing" style="display:none">&nbsp;</span>
</a>
<span class="uploadProcessing" style="display:none">&nbsp;</span>
</td>
</tr>
</tbody>
@ -571,7 +572,7 @@ if(!empty($_GET['view'])) {
<div id="winNewFolder" style="display:none">
<div class="jqmContainer">
<div class="jqmHeader">
<a href="#" onclick="return tb_remove();"><img src="theme/default/images/flagno.png"title="<?php echo LBL_ACTION_CLOSE; ?>"><?php echo LBL_ACTION_CLOSE; ?></a><!-- Add close image for Chamilo -->
<a href="#" onclick="return tb_remove();"><img src="theme/default/images/flagno.png"title="<?php echo LBL_ACTION_CLOSE; ?>"><?php echo LBL_ACTION_CLOSE; ?></a><!-- Add close image for Chamilo -->
</div>
<div class="jqmBody">
<form id="formNewFolder" name="formNewFolder" method="post" action="">

@ -125,7 +125,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
TB_WIDTH = (imageWidth + 30 > 250?imageWidth + 30 :250);
TB_HEIGHT = imageHeight + 60;
$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>" + thickbox.close +"</a></div>");
$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>" + thickbox.close +"</a></div>");//Note for Chamilo: image preview
$("#TB_closeWindowButton").click(tb_remove);
@ -185,7 +185,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
var params = tb_parseQuery( queryString );
TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
TB_HEIGHT = (params['height']*1) + 40 || 40; //defaults to 440 if no paramaters were added to URL. Chamilo change 440 by 40
ajaxContentW = TB_WIDTH - 30;
ajaxContentH = TB_HEIGHT - 45;
@ -193,7 +193,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
urlNoQuery = url.split('TB_');
$("#TB_iframeContent").remove();
if(params['modal'] != "true"){//iframe no modal
$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>X</a> / Esc</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>"+ thickbox.close +"</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");//Note for Chamilo: preview html files. Added chickbox.close text
// START: ANDRE SILVA resolve pdf preview bug
$("#TB_window").css({display:"block"}); //for safari using css instead of show
// END: ANDRE SILVA resolve pdf preview bug
@ -205,7 +205,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
}else{// not an iframe, ajax
if($("#TB_window").css("display") != "block"){
if(params['modal'] != "true"){//ajax no modal
$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>X</a> / Esc</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>"+ thickbox.close +"</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");//added Chamilo thickbox.close text
}else{//ajax modal
$("#TB_overlay").unbind();
$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");

Loading…
Cancel
Save