slideshowoptions.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @author Patrick Cool
  5. * @package chamilo.document
  6. * @author Patrick Cool, patrick.cool@UGent.be, Ghent University, May 2004, http://icto.UGent.be
  7. * Please bear in mind that this is only an beta release.
  8. * I wrote this quite quick and didn't think too much about it in advance.
  9. * It is not perfect at all but it is workable and usefull (I think)
  10. * Do not consider this as a powerpoint replacement, although it has
  11. * the same starting point.
  12. * This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
  13. * files (since these are the files that can be viewed in a browser) and creates
  14. * a slideshow with it by allowing to go to the next/previous image.
  15. * You can also have a quick overview (thumbnail view) of all the images in
  16. * that particular folder.
  17. * Maybe it is important to notice that each slideshow is folder based. Only
  18. * the images of the chosen folder are shown.
  19. *
  20. * On this page the options of the slideshow can be set: maintain the original file
  21. * or resize the file to a given width.
  22. */
  23. // Language files that need to be included
  24. $language_file = array('slideshow', 'document');
  25. require_once '../inc/global.inc.php';
  26. api_protect_course_script();
  27. $path = Security::remove_XSS($_GET['curdirpath']);
  28. $pathurl = urlencode($path);
  29. // Breadcrumb navigation
  30. $url = 'document.php?curdirpath='.$pathurl;
  31. $originaltoolname = get_lang('Documents');
  32. $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname);
  33. $url = 'slideshow.php?curdirpath='.$pathurl;
  34. $originaltoolname = get_lang('SlideShow');
  35. $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname);
  36. // Because $nametools uses $_SERVER['PHP_SELF'] for the breadcrumbs instead of $_SERVER['REQUEST_URI'], I had to
  37. // bypass the $nametools thing and use <b></b> tags in the $interbreadcrump array
  38. $url = 'slideshowoptions.php?curdirpath='.$pathurl;
  39. $originaltoolname = '<b>'.get_lang('SlideshowOptions').'</b>';
  40. $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname );
  41. Display::display_header($originalToolName, 'Doc');
  42. $image_resizing = isset($_SESSION['image_resizing']) ? $_SESSION['image_resizing'] : null;
  43. ?>
  44. <style type="text/css">
  45. <!--
  46. .disabled_input {
  47. background-color: #cccccc;
  48. }
  49. .enabled_input {
  50. background-color: #ffffff;
  51. }
  52. -->
  53. </style>
  54. <script type="text/javascript">
  55. function enableresizing() { //v2.0
  56. document.options.width.disabled=false;
  57. document.options.width.className='enabled_input';
  58. document.options.height.disabled=false;
  59. document.options.height.className='enabled_input';
  60. }
  61. function disableresizing() { //v2.0
  62. document.options.width.disabled=true;
  63. document.options.width.className='disabled_input';
  64. document.options.height.disabled=true;
  65. document.options.height.className='disabled_input';
  66. }
  67. window.onload = <?php echo $image_resizing == 'resizing' ? 'enableresizing' : 'disableresizing'; ?>;
  68. </script>
  69. <?php
  70. echo '<div class="actions">';
  71. echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
  72. echo '<a href="slideshow.php?curdirpath='.$pathurl.'">'.Display::return_icon('slideshow.png',get_lang('BackTo').' '.get_lang('SlideShow'),'',ICON_SIZE_MEDIUM).'</a>';
  73. echo '</div>';
  74. ?>
  75. <form action="slideshow.php?curdirpath=<?php echo $pathurl; ?>" method="post" name="options" id="options">
  76. <legend><?php echo get_lang('SlideshowOptions') ?></legend>
  77. <div>
  78. <div class="label">
  79. <input class="checkbox" name="radio_resizing" type="radio" onClick="disableresizing()" value="noresizing" <?php
  80. if ($image_resizing == 'noresizing' || $image_resizing == '') {
  81. echo ' checked';
  82. }
  83. ?>>
  84. <?php echo get_lang('NoResizing');?>
  85. </div>
  86. <div><?php echo get_lang('NoResizingComment');?>
  87. </div>
  88. </div>
  89. <div>
  90. <div class="label">
  91. <input class="checkbox" name="radio_resizing" type="radio" onClick="disableresizing()" value="autoresizing" <?php
  92. if ($image_resizing == 'resizing_auto' || $image_resizing == '') {
  93. echo ' checked';
  94. }
  95. ?>>
  96. <?php echo get_lang('ResizingAuto');?>
  97. </div>
  98. <div><?php echo get_lang('ResizingAutoComment');?>
  99. </div>
  100. </div>
  101. <div>
  102. <div class="label">
  103. <input class="checkbox" name="radio_resizing" type="radio" onClick="javascript: enableresizing();" value="resizing" <?php
  104. if ($image_resizing == 'resizing') {
  105. echo ' checked';
  106. $width = $_SESSION['image_resizing_width'];
  107. $height = $_SESSION['image_resizing_height'];
  108. }
  109. ?>>
  110. <?php echo get_lang('Resizing'); ?>
  111. </div>
  112. <div>
  113. <?php echo get_lang('ResizingComment'); ?><br />
  114. <?php echo get_lang('Width'); ?>:
  115. &nbsp;<input name="width" type="text" id="width" <?php
  116. if ($image_resizing == 'resizing') {
  117. echo ' value="'.$width.'"';
  118. echo ' class="enabled_input"';
  119. } else {
  120. echo ' class="disabled_input"';
  121. }
  122. ?> >
  123. <br />
  124. <?php echo get_lang('Height');?>:
  125. &nbsp;&nbsp;&nbsp;&nbsp;<input name="height" type="text" id="height" <?php
  126. if ($image_resizing == 'resizing') {
  127. echo ' value="'.$height.'"';
  128. echo ' class="enabled_input"';
  129. } else {
  130. echo ' class="disabled_input"';
  131. }
  132. ?> >
  133. <br />
  134. </div>
  135. </div>
  136. <div>
  137. <div class="label">
  138. </div>
  139. <div>
  140. <br />
  141. <button type="submit" class="save" name="Submit" value="Save" ><?php echo get_lang('Save'); ?></button>
  142. </div>
  143. </div>
  144. </form>
  145. <?php
  146. Display::display_footer();