skala
Yannick Warnier 14 years ago
commit a0a35b9f64
  1. 51
      documentation/optimization.html
  2. BIN
      main/img/go_home.png
  3. BIN
      main/img/home.png
  4. 12
      main/inc/lib/svg-edit/extensions/ext-imagelib.js
  5. 128
      main/inc/lib/svg-edit/extensions/imagelib/groups.php
  6. 24
      main/inc/lib/svg-edit/extensions/imagelib/index.php
  7. 108
      main/inc/lib/svg-edit/extensions/imagelib/users.php
  8. 1
      main/lang/english/learnpath.inc.php
  9. 3
      main/lang/english/trad4all.inc.php
  10. 2
      main/lang/italian/exercice.inc.php
  11. 1
      main/lang/italian/forum.inc.php
  12. 1
      main/lang/italian/learnpath.inc.php
  13. 5
      main/lang/spanish/trad4all.inc.php
  14. 2
      main/wiki/index.php

@ -36,6 +36,7 @@
<li><a href="#3.Indexes-caching">Indexes caching</a></li>
<li><a href="#4.Sessions-directories">Sessions directories</a></li>
<li><a href="#5.Users-upload-directories">Users upload directories</a></li>
<li><a href="#6.Zlib-compression">Zlib compressed output</a></li>
</ol>
<h2><a name="1.Using-XCache"></a>1. Using xCache</h2>
@ -81,6 +82,8 @@ if(!empty($_course['id'])) {
}
</pre>
Note that, as xCache is a shared caching system, it is very important to prefix your variables with a domain name or some kind of identifier, otherwise it would end up in disaster if you use a shared server for several portals.<br />
<br />
An optional additional caching mechanism you may use is the realpath_cache_size and realpath_cache_ttl php.ini parameters. See <a href="http://php.net/manual/en/ini.core.php">the PHP documentation</a> for more details.
<hr />
<h2><a name="2.Slow-queries"></a>2. Slow queries</h2>
Enable slow_queries in /etc/mysqld/my.cnf, restart MySQL then follow using sudo tail -f /var/log/mysql/mysql-slow.log
@ -101,4 +104,52 @@ Don't have time or resources to optimize your Chamilo installation yourself? Hir
<a href="http://jigsaw.w3.org/css-validator/">
<img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" style="margin: 1em; float: right;" alt="Valid CSS" />
</a>
<hr />
<h2><a name="#6.Zlib-compression"></a>Zlib compressed output</h2>
Although this will not make your server faster, compressing the pages you are sending to the users will definitely make them feel like your website's responses are a lot faster, and thus increase their well-being when using Chamilo.<br /><br />
Zlib output compression has to be set at two levels: PHP configuration for PHP pages and Apache for images and CSS.<br /><br />
To update the PHP configuration (either in php.ini or in your VirtualHost), use the <a href="http://php.net/manual/en/zlib.configuration.php">zlib.output_compression</a>. If you set this inside your Apache's VirtualHost, you should use the following syntax.
<pre>
php_value zlib.output_compression 1
</pre>
<br />
Configuring your Apache server to use output compression is a bit trickier. You have to use <a href="http://php.net/manual/en/zlib.configuration.php">the mod_deflate module</a> to do it. Your configuration should look like something like this (please read the corresponding documentation before implementing in production).<br />
Easy mode:
<pre>
AddOutputFilterByType DEFLATE text/html text/plain text/xml
</pre> or, for every content type (dangerous) you can put the following inside a location or directory block:<pre>SetOutputFilter DEFLATE</pre>
<br />
Advanced mode:
<pre>
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>
</pre>
<hr />
<h2>Authors</h2>
<ul>
<li>Yannick Warnier, Zend Certified PHP Engineer, BeezNest Belgium SPRL, <a href="mailto:ywarnier@beeznest.net">ywarnier@beeznest.net</a></li>
</ul>
</body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

After

Width:  |  Height:  |  Size: 806 B

@ -14,6 +14,18 @@ svgEditor.addExtension("imagelib", function() {
url: 'extensions/imagelib/index.php',
//description: 'Demonstration library for SVG-edit on this server'// Chamilo change this line by below
description: 'Course gallery'
},
{
name: 'Local library',
url: 'extensions/imagelib/groups.php',
//description: 'Demonstration library for SVG-edit on this server'// Chamilo change this line by below
description: 'Group gallery'
},
{
name: 'Local library',
url: 'extensions/imagelib/users.php',
//description: 'Demonstration library for SVG-edit on this server'// Chamilo change this line by below
description: 'Personal gallery'
},
{
name: 'IAN Symbol Libraries',

@ -0,0 +1,128 @@
<?php
/* Integrate svg-edit libraries with Chamilo default documents
* @author Juan Carlos Raña Trabado
* @since 25/september/2010
*/
//Chamilo load libraries
require_once '../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
//Add security from Chamilo
api_protect_course_script();
api_block_anonymous_users();
//
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$group_properties = GroupManager::get_group_properties($_SESSION['_gid']);
$groupdirpath = $group_properties['directory'];
$group_disk_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$groupdirpath.'/';
$group_web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$groupdirpath.'/';
//get all group files and folders
$docs_and_folders = DocumentManager::get_all_document_data($_course, $groupdirpath, $_SESSION['_gid'], null, $is_allowed_to_edit, false);
//get all group filenames
$array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array();
if (count($array_to_search) > 0) {
while (list($key) = each($array_to_search)) {
$all_files[] = basename($array_to_search[$key]['path']);
}
}
//get all svg and png group files
$accepted_extensions = array('.svg', '.png');
if (is_array($all_files) && count($all_files) > 0) {
foreach ($all_files as & $file) {
$slideshow_extension = strrchr($file, '.');
$slideshow_extension = strtolower($slideshow_extension);
if (in_array($slideshow_extension, $accepted_extensions)) {
$png_svg_files[] =$file;
}
}
}
?>
<!doctype html>
<script src="../../jquery.js"></script><!--Chamilo TODO: compress this file and changing loads -->
<body>
<?php
if(($group_properties['doc_state'] == 2 && ($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid']))) || $group_properties['doc_state'] == 1){
echo '<h1>'.get_lang('GroupSingle').': '.$group_properties['name'].'</h1>';
echo '<h2>'.get_lang('SelectSVGEditImage').'</h2>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image=$group_disk_path.$filename;
$new_sizes = api_resize_image($image, 60, 60);
if (strpos($filename, "svg")){
echo '<li style="display:inline; padding:8px;"><a href="'.$group_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}else{
echo '<li style="display:inline; padding:8px;"><a href="'.$group_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$group_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}
}
echo '</ul>';
}
else{
echo '<h1>'.get_lang('OnlyAccessFromYourGroup').'</h1>';
}
?>
</body>
<script>
$('a').click(function() {
var href = this.href;
// Convert Non-SVG images to data URL first
// (this could also have been done server-side by the library)
if(this.href.indexOf('.svg') === -1) {
var meta_str = JSON.stringify({
name: $(this).text(),
id: href
});
window.top.postMessage(meta_str, "*");
var img = new Image();
img.onload = function() {
var canvas = document.createElement("canvas");
canvas.width = this.width;
canvas.height = this.height;
// load the raster image into the canvas
canvas.getContext("2d").drawImage(this,0,0);
// retrieve the data: URL
try {
var dataurl = canvas.toDataURL();
} catch(err) {
// This fails in Firefox with file:// URLs :(
alert("Data URL conversion failed: " + err);
var dataurl = "";
}
window.top.postMessage('|' + href + '|' + dataurl, "*");
}
img.src = href;
} else {
// Send metadata (also indicates file is about to be sent)
var meta_str = JSON.stringify({
name: $(this).text(),
id: href
});
window.top.postMessage(meta_str, "*");
// Do ajax request for image's href value
$.get(href, function(data) {
data = '|' + href + '|' + data;
// This is where the magic happens!
window.top.postMessage(data, "*");
}, 'html'); // 'html' is necessary to keep returned data as a string
}
return false;
});
</script>

@ -9,7 +9,6 @@ require_once api_get_path(LIBRARY_PATH).'document.lib.php';
//Add security from Chamilo
api_protect_course_script();
api_block_anonymous_users();
//
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@ -50,21 +49,18 @@ $web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/images/gal
<body>
<h1>Select an image:</h1>
<?php
echo '<h1>'.get_lang('Course').': '.$_course['name'].'</h1>';
echo '<h2>'.get_lang('SelectSVGEditImage').'</h2>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image=$disk_path.$filename;
$new_sizes = api_resize_image($image, 60, 60);
if (strpos($filename, "svg")){
echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}else{
echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}
$image=$disk_path.$filename;
$new_sizes = api_resize_image($image, 60, 60);
if (strpos($filename, "svg")){
echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}else{
echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}
}
echo '</ul>';
?>
@ -121,4 +117,4 @@ $('a').click(function() {
return false;
});
</script>
</script>

@ -0,0 +1,108 @@
<?php
/* Integrate svg-edit libraries with Chamilo default documents
* @author Juan Carlos Raña Trabado
* @since 25/september/2010
*/
$language_file = array('userInfo');
//Chamilo load libraries
require_once '../../../../../inc/global.inc.php';
//Add security from Chamilo
api_protect_course_script();
api_block_anonymous_users();
//
$user_disk_path = api_get_path(SYS_PATH).'main/upload/users/'.api_get_user_id().'/my_files/';
$user_web_path = api_get_path(WEB_PATH).'main/upload/users/'.api_get_user_id().'/my_files/';
//get all files and folders
$scan_files = scandir($user_disk_path);
//get all svg and png files
$accepted_extensions = array('.svg', '.png');
if (is_array($scan_files) && count($scan_files) > 0) {
foreach ($scan_files as & $file) {
$slideshow_extension = strrchr($file, '.');
$slideshow_extension = strtolower($slideshow_extension);
if (in_array($slideshow_extension, $accepted_extensions)) {
$png_svg_files[] =$file;
}
}
}
?>
<!doctype html>
<script src="../../jquery.js"></script><!--Chamilo TODO: compress this file and changing loads -->
<body>
<?php
echo '<h1>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h1>';
echo '<h2>'.get_lang('SelectSVGEditImage').'</h2>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image=$user_disk_path.$filename;
$new_sizes = api_resize_image($image, 60, 60);
if (strpos($filename, "svg")){
echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}else{
echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}
}
echo '</ul>';
?>
</body>
<script>
$('a').click(function() {
var href = this.href;
// Convert Non-SVG images to data URL first
// (this could also have been done server-side by the library)
if(this.href.indexOf('.svg') === -1) {
var meta_str = JSON.stringify({
name: $(this).text(),
id: href
});
window.top.postMessage(meta_str, "*");
var img = new Image();
img.onload = function() {
var canvas = document.createElement("canvas");
canvas.width = this.width;
canvas.height = this.height;
// load the raster image into the canvas
canvas.getContext("2d").drawImage(this,0,0);
// retrieve the data: URL
try {
var dataurl = canvas.toDataURL();
} catch(err) {
// This fails in Firefox with file:// URLs :(
alert("Data URL conversion failed: " + err);
var dataurl = "";
}
window.top.postMessage('|' + href + '|' + dataurl, "*");
}
img.src = href;
} else {
// Send metadata (also indicates file is about to be sent)
var meta_str = JSON.stringify({
name: $(this).text(),
id: href
});
window.top.postMessage(meta_str, "*");
// Do ajax request for image's href value
$.get(href, function(data) {
data = '|' + href + '|' + data;
// This is where the magic happens!
window.top.postMessage(data, "*");
}, 'html'); // 'html' is necessary to keep returned data as a string
}
return false;
});
</script>

@ -249,4 +249,5 @@ $ModifyHotPotatoes = "Modify hotpotatoes";
$SaveHotpotatoes = "Save hotpotatoes";
$ReturnToLPList = "Return to list";
$LpPrerequisiteDescription = "Selecting another learning path as a prerequisite will hide the current prerequisite until the one in prerequisite is fully completed (100%)";
$ExerciseCantBeEditedAfterAddingToTheLP = "Exercise can't be edited after being added to the Learning Path";
?>

@ -970,4 +970,7 @@ $IAcceptTermsAndConditions = "I have read and I accept the Terms and Conditions"
$YouHaveToAcceptTermsAndConditions = "You have to accept our Terms and Conditions to proceed.";
$BrowserDontSupportsSVG = "Your browser does not support SVG files. To use the drawing tool you must have an advanced browser like: Firefox or Chrome";
$FillWithExemplaryContent = "Fill with exemplary content";
$ToolVideoconference = "Videoconference";
$SelectSVGEditImage = "Select a picture";
$OnlyAccessFromYourGroup = "Only accessible from your group";
?>

@ -358,7 +358,7 @@ $RandomAnswers = "Mescola le risposte";
$NotMarkActivity = "Non è possibile valutare l'attività";
$YouHaveToCreateAtLeastOneAnswer = "Devi indicare almeno una risposta valida";
$ExerciseAttempted = "Quesito affrontato";
$MultipleSelectCombination = "Selezione esatta";
$MultipleSelectCombination = "Risposta esatta";
$MultipleAnswerCombination = "Combinazione esatta";
$ExerciceExpiredTimeMessage = "Il tempo assegnato allo svolgimento dell'esercizio è scaduto; i quesiti completati saranno comunque presi in considerazione.";
$CopyExercise = "Duplica il quesito creandone una copia";

@ -143,4 +143,5 @@ $ForumcategoryLocked = "Categoria di forum bloccata";
$PreviewImage = "Anteprima immagine";
$UpdateImage = "Aggiorna immagine";
$EnableTimeLimits = "Abilita tempo limite";
$RemoveSearchResults = "Pulisci il modulo di ricerca";
?>

@ -249,4 +249,5 @@ $ModifyHotPotatoes = "Modifica l'elemento HotPotatoes";
$SaveHotpotatoes = "Salva hotpotatoes";
$ReturnToLPList = "Ritorna all'elenco";
$LpPrerequisiteDescription = "Se un modulo didattico costituisce un prerequisito di un altro, quest'ultimo risulterà invisibile fino al completamento (100%) del primo";
$ExerciseCantBeEditedAfterAddingToTheLP = "I Quesiti non possono essere modificati dopo esser stati aggiunti ad un modulo didattico";
?>

@ -608,7 +608,7 @@ $ErrorMessage = "Mensaje de error";
$Glossary = "Glosario";
$Coach = "Tutor";
$Condition = "Condición";
$CourseSettings = "Configuración de la lección";
$CourseSettings = "Configuración del curso";
$EmailNotifications = "Notificaciones por e-mail";
$UserRights = "Derechos de usuario";
$Theming = "Tema";
@ -971,4 +971,7 @@ $IAcceptTermsAndConditions = "He leido y acepto las condiciones del servicio";
$YouHaveToAcceptTermsAndConditions = "Para continuar debe aceptar nuestros términos y condiciones";
$BrowserDontSupportsSVG = "Su navegador no soporta archivos SVG. Para poder utilizar esta herramienta debe tener instalado un navegador avanzado del tipo: Firefox o Chrome";
$FillWithExemplaryContent = "Rellenar con contenido de ejemplo";
$ToolVideoconference = "Videoconferencia";
$SelectSVGEditImage = "Selecciones una imagen (svg, png)";
$OnlyAccessFromYourGroup = "Sólo accesible desde su grupo";
?>

@ -101,7 +101,7 @@ if ($_SESSION['_gid'] OR $_GET['group_id']) {
$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups'));
$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_clean['group_id'], "name"=> get_lang('GroupSpace').' '.$group_properties['name']);
$add_group_to_title = ' ('.$group_properties['name'].')';
$add_group_to_title = ' '.$group_properties['name'];
$groupfilter='group_id="'.$_clean['group_id'].'"';
//ensure this tool in groups whe it's private or deactivated

Loading…
Cancel
Save