Minor - format code.

pull/2487/head
jmontoyaa 7 years ago
parent 1f8b52f300
commit f64e37b5ed
  1. 85
      main/document/document_slideshow.inc.php
  2. 6
      main/document/download.php
  3. 6
      main/document/download_scorm.php
  4. 17
      main/document/edit_document.php
  5. 89
      main/document/edit_draw.php
  6. 3
      main/document/edit_odf.php
  7. 124
      main/document/edit_paint.php
  8. 4
      main/document/exit_pixlr.php
  9. 5
      main/document/record_audio.php
  10. 7
      main/document/save_pixlr.php
  11. 44
      main/document/slideshowoptions.php
  12. 59
      main/document/webcam_clip.php

@ -1,34 +1,35 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
* files (since these are the files that can be viewed in a browser) and creates
* a slideshow with it by allowing to go to the next/previous image.
* You can also have a quick overview (thumbnail view) of all the images in
* that particular folder.
* This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
* files (since these are the files that can be viewed in a browser) and creates
* a slideshow with it by allowing to go to the next/previous image.
* You can also have a quick overview (thumbnail view) of all the images in
* that particular folder.
*
* Each slideshow is folder based. Only
* the images of the chosen folder are shown.
* Each slideshow is folder based. Only
* the images of the chosen folder are shown.
*
* This file has two large sections.
* 1. code that belongs in document.php, but to avoid clutter I put the code here
* (not present) 2. the function resize_image that handles the image resizing
* This file has two large sections.
* 1. code that belongs in document.php, but to avoid clutter I put the code here
* (not present) 2. the function resize_image that handles the image resizing
*
* @author Patrick Cool, responsible author
* @author Roan Embrechts, minor cleanup
* @package chamilo.document
* @author Patrick Cool, responsible author
* @author Roan Embrechts, minor cleanup
* @package chamilo.document
*/
/**
* General code that belongs in document.php
* General code that belongs in document.php
*
* This code should indeed go in documents.php but since document.php is already a really ugly file with
* too much things in one file , I decided to put the code for document.php here and to include this
* file into document.php
* This code should indeed go in documents.php but since document.php is already a really ugly file with
* too much things in one file , I decided to put the code for document.php here and to include this
* file into document.php
*/
// Resetting the images of the slideshow = destroying the slideshow
if (isset($_GET['action']) && $_GET['action'] == 'exit_slideshow') {
$_SESSION['image_files_only'] = null;
unset($image_files_only);
$_SESSION['image_files_only'] = null;
unset($image_files_only);
}
// We check if there are images in this folder by searching the extensions for .jpg, .gif, .png
@ -37,32 +38,32 @@ if (isset($_GET['action']) && $_GET['action'] == 'exit_slideshow') {
$array_to_search = !empty($documentAndFolders) && is_array($documentAndFolders) ? $documentAndFolders : array();
if (count($array_to_search) > 0) {
while (list($key) = each($array_to_search)) {
$all_files[] = basename($array_to_search[$key]['path']);
//echo basename($array_to_search[$key]['path']).'<br />';
}
while (list($key) = each($array_to_search)) {
$all_files[] = basename($array_to_search[$key]['path']);
//echo basename($array_to_search[$key]['path']).'<br />';
}
}
// Always show gallery.
$image_present = 1;
/*
if (isset($all_files) && 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)) {
$image_present = 1;
break;
}
}
foreach ($all_files as & $file) {
$slideshow_extension = strrchr($file, '.');
$slideshow_extension = strtolower($slideshow_extension);
if (in_array($slideshow_extension, $accepted_extensions)) {
$image_present = 1;
break;
}
}
}*/
$tablename_column = isset($_GET['tablename_column']) ? Security::remove_XSS($_GET['tablename_column']) : 0;
if ($tablename_column == 0) {
$tablename_column = 1;
$tablename_column = 1;
} else {
$tablename_column = intval($tablename_column) - 1;
$tablename_column = intval($tablename_column) - 1;
}
$image_files_only = sort_files($array_to_search);
@ -96,15 +97,19 @@ function sort_files($table)
$final_array[] = $file_array[1];
}
return $final_array;
return $final_array;
}
function sort_table($a, $b) {
global $tablename_column;
return strnatcmp($a[$tablename_column], $b[$tablename_column]);
function sort_table($a, $b)
{
global $tablename_column;
return strnatcmp($a[$tablename_column], $b[$tablename_column]);
}
function rsort_table($a, $b) {
global $tablename_column;
return strnatcmp($b[$tablename_column], $a[$tablename_column]);
function rsort_table($a, $b)
{
global $tablename_column;
return strnatcmp($b[$tablename_column], $a[$tablename_column]);
}

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file is responsible for passing requested documents to the browser.
* Many functions updated and moved to lib/document.lib.php
* @package chamilo.document
* This file is responsible for passing requested documents to the browser.
* Many functions updated and moved to lib/document.lib.php
* @package chamilo.document
*/
session_cache_limiter('none');

@ -1,9 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file is responsible for passing requested documents to the browser.
* This file is responsible for passing requested documents to the browser.
*
* @package chamilo.document
* @package chamilo.document
*/
session_cache_limiter('none');
@ -13,7 +14,6 @@ $this_section = SECTION_COURSES;
// Protection
api_protect_course_script();
$_course = api_get_course_info();
if (!isset($_course)) {

@ -325,8 +325,6 @@ if (file_exists($document_data['absolute_path'])) {
}
}
/* Display user interface */
// Display the header
$nameTools = get_lang('EditDocument').': '.Security::remove_XSS($document_data['title']);
Display::display_header($nameTools, 'Doc');
@ -363,7 +361,13 @@ if ($owner_id == api_get_user_id() ||
if ($is_certificate_mode) {
$action .= '&curdirpath=/certificates&selectcat=1';
}
$form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical'));
$form = new FormValidator(
'formEdit',
'post',
$action,
null,
array('class' => 'form-vertical')
);
// Form title
$form->addElement('header', $nameTools);
@ -374,7 +378,12 @@ if ($owner_id == api_get_user_id() ||
$form->addElement('hidden', 'showedit');
$form->addElement('hidden', 'origin');
$form->addElement('hidden', 'origin_opt');
$form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
$form->addText(
'title',
get_lang('Title'),
true,
array('cols-size' => [2, 10, 0], 'autofocus')
);
$defaults['title'] = $document_data['title'];

@ -4,9 +4,9 @@
use ChamiloSession as Session;
/**
* This file allows creating new svg and png documents with an online editor.
* This file allows creating new svg and png documents with an online editor.
*
* @package chamilo.document
* @package chamilo.document
*
* @author Juan Carlos Ra<EFBFBD>a Trabado
* @since 25/september/2010
@ -46,7 +46,7 @@ $group_id = api_get_group_id();
//path for svg-edit save
$_SESSION['draw_dir'] = Security::remove_XSS($dir);
if ($_SESSION['draw_dir'] == '/') {
$_SESSION['draw_dir'] = '';
$_SESSION['draw_dir'] = '';
}
$_SESSION['draw_file'] = basename(Security::remove_XSS($file_path));
$get_file = Security::remove_XSS($file_path);
@ -62,26 +62,26 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
/* Please, do not modify this dirname formatting */
if (strstr($dir, '..')) {
$dir = '/';
$dir = '/';
}
if ($dir[0] == '.') {
$dir = substr($dir, 1);
$dir = substr($dir, 1);
}
if ($dir[0] != '/') {
$dir = '/'.$dir;
$dir = '/'.$dir;
}
if ($dir[strlen($dir) - 1] != '/') {
$dir .= '/';
$dir .= '/';
}
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
if (!is_dir($filepath)) {
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$dir = '/';
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$dir = '/';
}
//groups //TODO:clean
@ -90,8 +90,8 @@ if (!empty($group_id)) {
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace'),
);
$group_document = true;
$noPHP_SELF = true;
$group_document = true;
$noPHP_SELF = true;
}
$is_certificate_mode = DocumentManager::is_certificate_mode($dir);
@ -102,7 +102,10 @@ if (!$is_certificate_mode) {
"name" => get_lang('Documents'),
);
} else {
$interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array(
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook')
);
}
// Interbreadcrumb for the current directory root path
@ -113,15 +116,17 @@ if (empty($document_data['parents'])) {
if ($document_data['title'] == $document_sub_data['title']) {
continue;
}
$interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']);
$interbreadcrumb[] = array(
'url' => $document_sub_data['document_url'],
'name' => $document_sub_data['title']
);
}
}
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $groupRights ||
DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $groupRights || DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
if (!$is_allowedToEdit) {
api_not_allowed(true);
api_not_allowed(true);
}
Event::event_access_tool(TOOL_DOCUMENT);
@ -135,33 +140,35 @@ echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&origin
echo '</div>';
if (api_browser_support('svg')) {
//automatic loading the course language
$svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
$langsvgedit = api_get_language_isocode();
$langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit;
$langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en';
$svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit;
?>
<script>
document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $svg_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>');
function resizeIframe() {
var height = window.innerHeight -50;
//max lower size
if (height<550) {
height=550;
}
document.getElementById('frame').style.height = height +"px";
};
document.getElementById('frame').onload = resizeIframe;
window.onresize = resizeIframe;
</script>
//automatic loading the course language
$svgedit_code_translation_table = array(
'' => 'en',
'pt' => 'pt-Pt',
'sr' => 'sr_latn'
);
$langsvgedit = api_get_language_isocode();
$langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit;
$langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en';
$svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit;
?>
<script>
document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $svg_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>');
function resizeIframe() {
var height = window.innerHeight -50;
//max lower size
if (height<550) {
height=550;
}
document.getElementById('frame').style.height = height +"px";
};
document.getElementById('frame').onload = resizeIframe;
window.onresize = resizeIframe;
</script>
<?php
echo '<noscript>';
echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0\' src="'.$svg_url.'"<noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>';
echo '</noscript>';
echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0\' src="'.$svg_url.'"<noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>';
echo '</noscript>';
} else {
echo Display::return_message(get_lang('BrowserDontSupportsSVG'), 'error');
echo Display::return_message(get_lang('BrowserDontSupportsSVG'), 'error');
}
Display::display_footer();

@ -42,8 +42,7 @@ $pathinfo = pathinfo($headerFile);
$showOdfEditor = false;
$webOdfSupportedFiles = DocumentManager::get_web_odf_extension_list();
if (
in_array(strtolower($pathinfo['extension']), $webOdfSupportedFiles) &&
if (in_array(strtolower($pathinfo['extension']), $webOdfSupportedFiles) &&
api_get_configuration_value('enabled_support_odf') === true
) {
$showOdfEditor = true;

@ -4,10 +4,10 @@
use ChamiloSession as Session;
/**
* This file allows creating new svg and png documents with an online editor.
* This file allows creating new svg and png documents with an online editor.
*
* @package chamilo.document
* @todo used the document_id instead of the curdirpath
* @package chamilo.document
* @todo used the document_id instead of the curdirpath
*
* @author Juan Carlos Raña Trabado
* @since 30/january/2011
@ -30,10 +30,10 @@ $document_data = DocumentManager::get_document_data_by_id(
if (empty($document_data)) {
api_not_allowed();
} else {
$document_id = $document_data['id'];
$file_path = $document_data['path'];
$dir = dirname($document_data['path']);
$parent_id = DocumentManager::get_document_id(api_get_course_info(), $dir);
$document_id = $document_data['id'];
$file_path = $document_data['path'];
$dir = dirname($document_data['path']);
$parent_id = DocumentManager::get_document_id(api_get_course_info(), $dir);
$my_cur_dir_path = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
}
@ -47,62 +47,62 @@ if ($_SESSION['paint_dir'] == '/') {
$_SESSION['paint_dir'] = '';
}
$_SESSION['paint_file'] = basename(Security::remove_XSS($file_path));
$get_file = Security::remove_XSS($file_path);
$file = basename($get_file);
$temp_file = explode(".", $file);
$filename = $temp_file[0];
$nameTools = get_lang('EditDocument').': '.$filename;
$courseDir = $_course['path'].'/document';
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
/* Other initialization code */
/* Please, do not modify this dirname formatting */
if (strstr($dir, '..')) {
$dir = '/';
$dir = '/';
}
if ($dir[0] == '.') {
$dir = substr($dir, 1);
$dir = substr($dir, 1);
}
if ($dir[0] != '/') {
$dir = '/'.$dir;
$dir = '/'.$dir;
}
if ($dir[strlen($dir) - 1] != '/') {
$dir .= '/';
$dir .= '/';
}
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
if (!is_dir($filepath)) {
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$dir = '/';
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$dir = '/';
}
//groups //TODO:clean
if (!empty($groupId)) {
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace'),
);
$group_document = true;
$noPHP_SELF = true;
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace'),
);
$group_document = true;
$noPHP_SELF = true;
}
$is_certificate_mode = DocumentManager::is_certificate_mode($dir);
if (!$is_certificate_mode)
$interbreadcrumb[] = array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
else
$interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
if (!$is_certificate_mode) {
$interbreadcrumb[] = array(
"url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(),
"name" => get_lang('Documents')
);
} else {
$interbreadcrumb[] = array(
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook')
);
}
// Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) {
@ -120,7 +120,7 @@ $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $groupRights ||
DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
if (!$is_allowedToEdit) {
api_not_allowed(true);
api_not_allowed(true);
}
Event::event_access_tool(TOOL_DOCUMENT);
@ -142,31 +142,27 @@ $loc = $langpixlr; // deprecated ?? TODO:check pixlr read user browser
$exit_path = api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
$_SESSION['exit_pixlr'] = Security::remove_XSS($parent_id);
$referrer = "Chamilo";
$target_path = api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
$target = $target_path;
$locktarget = "true";
$locktitle = "false";
if ($_SERVER['HTTP_HOST'] == "localhost") {
$path_and_file = api_get_path(SYS_PATH).'/crossdomain.xml';
if (!file_exists($path_and_file)) {
$crossdomain = '<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="cdn.pixlr.com" />
<site-control permitted-cross-domain-policies="master-only"/>
<allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/>
</cross-domain-policy>';//more open domain="*"
@file_put_contents($path_and_file, $crossdomain);
}
$credentials = "true";
}
else {
$credentials = "false";
$path_and_file = api_get_path(SYS_PATH).'/crossdomain.xml';
if (!file_exists($path_and_file)) {
$crossdomain = '<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="cdn.pixlr.com" />
<site-control permitted-cross-domain-policies="master-only"/>
<allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/>
</cross-domain-policy>';//more open domain="*"
@file_put_contents($path_and_file, $crossdomain);
}
$credentials = "true";
} else {
$credentials = "false";
}
//make temp images
@ -178,24 +174,22 @@ if (!file_exists($temp_folder)) {
//make htaccess with allow from all, and file index.html into temp/images
$htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess';
if (!file_exists($htaccess)) {
$htaccess_content = "order deny,allow\r\nallow from all\r\nOptions -Indexes";
$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
if ($fp) {
fwrite($fp, $htaccess_content);
fclose($fp);
}
$htaccess_content = "order deny,allow\r\nallow from all\r\nOptions -Indexes";
$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
if ($fp) {
fwrite($fp, $htaccess_content);
fclose($fp);
}
}
$html_index = api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html';
if (!file_exists($html_index)) {
$html_index_content = "<html><head></head><body></body></html>";
$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
if ($fp) {
fwrite($fp, $html_index_content);
fclose($fp);
}
$html_index_content = "<html><head></head><body></body></html>";
$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
if ($fp) {
fwrite($fp, $html_index_content);
fclose($fp);
}
}
//encript temp name file
@ -217,9 +211,7 @@ $pixlr_url = api_get_protocol().'://pixlr.com/editor/?title='.$title.'&image='.$
//make frame an send image
?>
<script type="text/javascript">
<script>
document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $pixlr_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>');
function resizeIframe() {
var height = window.innerHeight;

@ -2,9 +2,9 @@
/* For licensing terms, see /license.txt */
/**
* This file allows creating new svg and png documents with an online editor.
* This file allows creating new svg and png documents with an online editor.
*
* @package chamilo.document
* @package chamilo.document
*
* @author Juan Carlos Ra<EFBFBD>a Trabado
* @since 30/january/2011

@ -14,7 +14,6 @@ $_SESSION['whereami'] = 'document/voicerecord';
$this_section = SECTION_COURSES;
$groupRights = Session::read('group_member_with_upload_rights');
$nameTools = get_lang('VoiceRecord');
api_protect_course_script();
@ -47,7 +46,7 @@ $dir = $document_data['path'];
//make some vars
$wamidir = $dir;
if ($wamidir == "/") {
$wamidir = "";
$wamidir = '';
}
$wamiurlplay = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$wamidir."/";
$groupId = api_get_group_id();
@ -109,7 +108,7 @@ if (!($is_allowed_to_edit || $groupRights ||
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
if (isset ($group)) {
if (isset($group)) {
$display_dir = explode('/', $dir);
unset($display_dir[0]);
unset($display_dir[1]);

@ -1,16 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file allows creating new svg and png documents with an online editor.
* This file allows creating new svg and png documents with an online editor.
*
* @package chamilo.document
* @package chamilo.document
*
* @author Juan Carlos Raña Trabado
* @since 30/january/2011
*/
/**
* Code
*/
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script();

@ -1,24 +1,23 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Patrick Cool
* @package chamilo.document
* @author Patrick Cool
* @package chamilo.document
* @author Patrick Cool, patrick.cool@UGent.be, Ghent University, May 2004, http://icto.UGent.be
* Please bear in mind that this is only an beta release.
* I wrote this quite quick and didn't think too much about it in advance.
* It is not perfect at all but it is workable and usefull (I think)
* Do not consider this as a powerpoint replacement, although it has
* the same starting point.
* This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
* files (since these are the files that can be viewed in a browser) and creates
* a slideshow with it by allowing to go to the next/previous image.
* You can also have a quick overview (thumbnail view) of all the images in
* that particular folder.
* Maybe it is important to notice that each slideshow is folder based. Only
* the images of the chosen folder are shown.
*
* On this page the options of the slideshow can be set: maintain the original file
* or resize the file to a given width.
* This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
* files (since these are the files that can be viewed in a browser) and creates
* a slideshow with it by allowing to go to the next/previous image.
* You can also have a quick overview (thumbnail view) of all the images in
* that particular folder.
* Maybe it is important to notice that each slideshow is folder based. Only
* the images of the chosen folder are shown.
* On this page the options of the slideshow can be set: maintain the original file
* or resize the file to a given width.
*/
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script();
@ -45,19 +44,18 @@ Display::display_header($originaltoolname, 'Doc');
$image_resizing = isset($_SESSION['image_resizing']) ? $_SESSION['image_resizing'] : null;
?>
<script type="text/javascript">
<script>
function enableresizing() { //v2.0
document.options.width.disabled=false;
//document.options.width.className='enabled_input';
document.options.height.disabled=false;
//document.options.height.className='enabled_input';
document.options.width.disabled=false;
//document.options.width.className='enabled_input';
document.options.height.disabled=false;
//document.options.height.className='enabled_input';
}
function disableresizing() { //v2.0
document.options.width.disabled=true;
//document.options.width.className='disabled_input';
document.options.height.disabled=true;
//document.options.height.className='disabled_input';
document.options.width.disabled=true;
//document.options.width.className='disabled_input';
document.options.height.disabled=true;
//document.options.height.className='disabled_input';
}
window.onload = <?php echo $image_resizing == 'resizing' ? 'enableresizing' : 'disableresizing'; ?>;
</script>
@ -69,7 +67,7 @@ echo Display::toolbarAction('toolbar-slideshow', [$actions])
?>
<div class="panel panel-default">
<div class="panel-body">
<form action="slideshow.php?curdirpath=<?php echo $pathurl; ?>" method="post" name="options" id="options" class="form-horizontal">
<form action="slideshow.php?curdirpath=<?php echo $pathurl; ?>" method="post" name="options" id="options" class="form-horizontal">
<legend><?php echo get_lang('SlideshowOptions') ?></legend>
<div class="radio">
<label>

@ -4,9 +4,9 @@
use ChamiloSession as Session;
/**
* This file allows record wav files.
* This file allows record wav files.
*
* @package chamilo.document
* @package chamilo.document
*
* @author Juan Carlos Raña Trabado herodoto@telefonica.net
* @since 7/jun/2012
@ -37,28 +37,27 @@ $dir = $document_data['path'];
//make some vars
$webcamdir = $dir;
if ($webcamdir == "/") {
$webcamdir = "";
$webcamdir = '';
}
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
// Please, do not modify this dirname formatting
if (strstr($dir, '..')) {
$dir = '/';
$dir = '/';
}
if ($dir[0] == '.') {
$dir = substr($dir, 1);
$dir = substr($dir, 1);
}
if ($dir[0] != '/') {
$dir = '/'.$dir;
$dir = '/'.$dir;
}
if ($dir[strlen($dir) - 1] != '/') {
$dir .= '/';
$dir .= '/';
}
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
@ -71,24 +70,27 @@ if (!is_dir($filepath)) {
$groupId = api_get_group_id();
if (!empty($groupId)) {
$interbreadcrumb[] = array("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
$noPHP_SELF = true;
$group = GroupManager :: get_group_properties($groupId);
$path = explode('/', $dir);
if ('/'.$path[1] != $group['directory']) {
api_not_allowed(true);
}
$interbreadcrumb[] = array(
"url" => "../group/group_space.php?".api_get_cidreq(),
"name" => get_lang('GroupSpace')
);
$noPHP_SELF = true;
$group = GroupManager :: get_group_properties($groupId);
$path = explode('/', $dir);
if ('/'.$path[1] != $group['directory']) {
api_not_allowed(true);
}
}
$interbreadcrumb[] = array("url" => "./document.php?id=".$document_id."&".api_get_cidreq(), "name" => get_lang('Documents'));
if (!api_is_allowed_in_course()) {
api_not_allowed(true);
api_not_allowed(true);
}
if (!($is_allowed_to_edit || $groupRights ||
DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir), api_get_session_id()))) {
api_not_allowed(true);
DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir), api_get_session_id()))) {
api_not_allowed(true);
}
/* Header */
@ -96,10 +98,10 @@ Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
if (isset ($group)) {
$display_dir = explode('/', $dir);
unset($display_dir[0]);
unset($display_dir[1]);
$display_dir = implode('/', $display_dir);
$display_dir = explode('/', $dir);
unset($display_dir[0]);
unset($display_dir[1]);
$display_dir = implode('/', $display_dir);
}
// Interbreadcrumb for the current directory root path
@ -141,7 +143,7 @@ echo '</div>';
<div id="chamilo-camera"></div>
</div>
<!-- Configure a few settings and attach the camera to the div container -->
<script language="JavaScript">
<script>
Webcam.set({
width: 320,
height: 240,
@ -152,7 +154,6 @@ echo '</div>';
//This line Fix a minor bug that made a conflict with a videochat feature in another module file
$('video').addClass('skip');
</script>
<!-- Using now Jquery to do the webcamJS Functions and handle the server response (see webcam_receiver.php now in webcamJS directory) -->
<script language="JavaScript">
$(document).ready(function() {
@ -198,9 +199,8 @@ echo '</div>';
});
});
}
</script>
<script language=javascript>
</script>
<script>
var interval=null;
var timeout=null;
var counter=0;
@ -227,13 +227,10 @@ echo '</div>';
interval=window.clearInterval(interval);
}
}
</script>
</script>
</td><td width=50></td><td valign='top' align='center'>
<div id="upload_results" style="background-color:#ffffff;"></div>
</td></tr></table>
<!-- Implementing Button html5 Tags instead Inputs and some cool bootstrap button styles -->
<div>
<br/>

Loading…
Cancel
Save