slideshowoptions.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. /**
  24. * Code
  25. */
  26. // Language files that need to be included
  27. $language_file = array('slideshow', 'document');
  28. //require_once '../inc/global.inc.php';
  29. api_protect_course_script();
  30. $path = Security::remove_XSS($_GET['curdirpath']);
  31. $pathurl = urlencode($path);
  32. // Breadcrumb navigation
  33. $url = 'document.php?curdirpath='.$pathurl;
  34. $originaltoolname = get_lang('Documents');
  35. $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname);
  36. $url = 'slideshow.php?curdirpath='.$pathurl;
  37. $originaltoolname = get_lang('SlideShow');
  38. $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname);
  39. // Because $nametools uses $_SERVER['PHP_SELF'] for the breadcrumbs instead of $_SERVER['REQUEST_URI'], I had to
  40. // bypass the $nametools thing and use <b></b> tags in the $interbreadcrump array
  41. $url = 'slideshowoptions.php?curdirpath='.$pathurl;
  42. $originaltoolname = '<b>'.get_lang('SlideshowOptions').'</b>';
  43. $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname );
  44. Display::display_header($originalToolName, 'Doc');
  45. $image_resizing = isset($_SESSION['image_resizing']) ? $_SESSION['image_resizing'] : null;
  46. ?>
  47. <style type="text/css">
  48. <!--
  49. .disabled_input {
  50. background-color: #cccccc;
  51. }
  52. .enabled_input {
  53. background-color: #ffffff;
  54. }
  55. -->
  56. </style>
  57. <script language="JavaScript" type="text/javascript">
  58. <!--
  59. function enableresizing() { //v2.0
  60. document.options.width.disabled=false;
  61. document.options.width.className='enabled_input';
  62. document.options.height.disabled=false;
  63. document.options.height.className='enabled_input';
  64. }
  65. function disableresizing() { //v2.0
  66. document.options.width.disabled=true;
  67. document.options.width.className='disabled_input';
  68. document.options.height.disabled=true;
  69. document.options.height.className='disabled_input';
  70. }
  71. window.onload = <?php echo $image_resizing == 'resizing' ? 'enableresizing' : 'disableresizing'; ?>;
  72. //-->
  73. </script>
  74. <?php
  75. echo '<div class="actions">';
  76. 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>';
  77. echo '<a href="slideshow.php?curdirpath='.$pathurl.'">'.Display::return_icon('slideshow.png',get_lang('BackTo').' '.get_lang('SlideShow'),'',ICON_SIZE_MEDIUM).'</a>';
  78. echo '</div>';
  79. ?>
  80. <form action="slideshow.php?curdirpath=<?php echo $pathurl; ?>" method="post" name="options" id="options">
  81. <legend><?php echo get_lang('SlideshowOptions') ?></legend>
  82. <div>
  83. <div class="label">
  84. <input class="checkbox" name="radio_resizing" type="radio" onClick="disableresizing()" value="noresizing" <?php
  85. if ($image_resizing == 'noresizing' || $image_resizing == '') {
  86. echo ' checked';
  87. }
  88. ?>>
  89. <?php echo get_lang('NoResizing');?>
  90. </div>
  91. <div><?php echo get_lang('NoResizingComment');?>
  92. </div>
  93. </div>
  94. <div>
  95. <div class="label">
  96. <input class="checkbox" name="radio_resizing" type="radio" onClick="disableresizing()" value="autoresizing" <?php
  97. if ($image_resizing == 'resizing_auto' || $image_resizing == '') {
  98. echo ' checked';
  99. }
  100. ?>>
  101. <?php echo get_lang('ResizingAuto');?>
  102. </div>
  103. <div><?php echo get_lang('ResizingAutoComment');?>
  104. </div>
  105. </div>
  106. <div>
  107. <div class="label">
  108. <input class="checkbox" name="radio_resizing" type="radio" onClick="javascript: enableresizing();" value="resizing" <?php
  109. if ($image_resizing == 'resizing') {
  110. echo ' checked';
  111. $width = $_SESSION['image_resizing_width'];
  112. $height = $_SESSION['image_resizing_height'];
  113. }
  114. ?>>
  115. <?php echo get_lang('Resizing'); ?>
  116. </div>
  117. <div>
  118. <?php echo get_lang('ResizingComment'); ?><br />
  119. <?php echo get_lang('Width'); ?>:
  120. &nbsp;<input name="width" type="text" id="width" <?php
  121. if ($image_resizing == 'resizing') {
  122. echo ' value="'.$width.'"';
  123. echo ' class="enabled_input"';
  124. } else {
  125. echo ' class="disabled_input"';
  126. }
  127. ?> >
  128. <br />
  129. <?php echo get_lang('Height');?>:
  130. &nbsp;&nbsp;&nbsp;&nbsp;<input name="height" type="text" id="height" <?php
  131. if ($image_resizing == 'resizing') {
  132. echo ' value="'.$height.'"';
  133. echo ' class="enabled_input"';
  134. } else {
  135. echo ' class="disabled_input"';
  136. }
  137. ?> >
  138. <br />
  139. </div>
  140. </div>
  141. <div>
  142. <div class="label">
  143. </div>
  144. <div>
  145. <br />
  146. <button type="submit" class="save" name="Submit" value="Save" ><?php echo get_lang('Save'); ?></button>
  147. </div>
  148. </div>
  149. </form>
  150. <?php
  151. Display::display_footer();