slideshowoptions.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. $path = Security::remove_XSS($_GET['curdirpath']);
  30. $pathurl = urlencode($path);
  31. // Breadcrumb navigation
  32. $url = 'document.php?curdirpath='.$pathurl;
  33. $originaltoolname = get_lang('Documents');
  34. $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname);
  35. $url = 'slideshow.php?curdirpath='.$pathurl;
  36. $originaltoolname = get_lang('SlideShow');
  37. $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname);
  38. // Because $nametools uses $_SERVER['PHP_SELF'] for the breadcrumbs instead of $_SERVER['REQUEST_URI'], I had to
  39. // bypass the $nametools thing and use <b></b> tags in the $interbreadcrump array
  40. $url = 'slideshowoptions.php?curdirpath='.$pathurl;
  41. $originaltoolname = '<b>'.get_lang('_slideshow_options').'</b>';
  42. $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname );
  43. Display::display_header($originalToolName, 'Doc');
  44. // can't remember why I put this here. This is probably obsolete code
  45. // loading the slides from the session
  46. //$image_files_only = $_SESSION['image_files_only'];
  47. // calculating the current slide, next slide, previous slide and the number of slides
  48. /*if ($slide_id) {
  49. $slide = $slide_id;
  50. } else {
  51. $slide = 0;
  52. }
  53. $previous_slide = $slide - 1;
  54. $next_slide = $slide + 1;
  55. $total_slides = count($image_files_only);
  56. */
  57. ?>
  58. <style type="text/css">
  59. <!--
  60. .disabled_input {
  61. background-color: #cccccc;
  62. }
  63. .enabled_input {
  64. background-color: #ffffff;
  65. }
  66. -->
  67. </style>
  68. <script language="JavaScript" type="text/javascript">
  69. <!--
  70. function enableresizing() { //v2.0
  71. document.options.width.disabled=false;
  72. document.options.width.className='enabled_input';
  73. document.options.height.disabled=false;
  74. document.options.height.className='enabled_input';
  75. }
  76. function disableresizing() { //v2.0
  77. document.options.width.disabled=true;
  78. document.options.width.className='disabled_input';
  79. document.options.height.disabled=true;
  80. document.options.height.className='disabled_input';
  81. }
  82. window.onload = <?php echo $_SESSION['image_resizing'] == 'resizing' ? 'enableresizing' : 'disableresizing'; ?>;
  83. //-->
  84. </script>
  85. <?php
  86. echo '<div class="actions">';
  87. echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'">'.Display::return_icon('back.png').get_lang('BackTo').' '.get_lang('DocumentsOverview').'</a>';
  88. echo '<a href="slideshow.php?curdirpath='.$pathurl.'">'.Display::return_icon('images_gallery.gif').get_lang('BackTo').' '.get_lang('SlideShow').'</a>';
  89. echo '</div>';
  90. ?>
  91. <form action="slideshow.php?curdirpath=<?php echo $pathurl; ?>" method="post" name="options" id="options">
  92. <div class="row"><div class="form_header"><?php echo get_lang('_slideshow_options') ?></div></div>
  93. <div class="row">
  94. <div class="label">
  95. <input class="checkbox" name="radio_resizing" type="radio" onClick="disableresizing()" value="noresizing" <?php
  96. $image_resizing = $_SESSION['image_resizing'];
  97. if ($image_resizing == 'noresizing' || $image_resizing == '') {
  98. echo ' checked';
  99. }
  100. ?>>
  101. </div>
  102. <div class="formw"><?php echo get_lang('_no_resizing');?><br /><?php echo get_lang('_no_resizing_comment');?>
  103. </div>
  104. </div>
  105. <div class="row">
  106. <div class="label">
  107. <input class="checkbox" name="radio_resizing" type="radio" onClick="javascript: enableresizing();" value="resizing" <?php
  108. $image_resizing = $_SESSION['image_resizing'];
  109. if ($image_resizing == 'resizing') {
  110. echo ' checked';
  111. $width = $_SESSION['image_resizing_width'];
  112. $height = $_SESSION['image_resizing_height'];
  113. }
  114. ?>>
  115. </div>
  116. <div class="formw">
  117. <?php echo get_lang('_resizing'); ?><br /><?php echo get_lang('_resizing_comment'); ?><br />
  118. <?php echo get_lang('_width'); ?>:
  119. &nbsp;<input name="width" type="text" id="width" <?php
  120. if ($image_resizing == 'resizing') {
  121. echo ' value="'.$width.'"';
  122. echo ' class="enabled_input"';
  123. } else {
  124. echo ' class="disabled_input"';
  125. }
  126. ?> >
  127. <br />
  128. <?php echo get_lang('_height');?>:
  129. &nbsp;&nbsp;&nbsp;&nbsp;<input name="height" type="text" id="height" <?php
  130. if ($image_resizing == 'resizing') {
  131. echo ' value="'.$height.'"';
  132. echo ' class="enabled_input"';
  133. } else {
  134. echo ' class="disabled_input"';
  135. }
  136. ?> >
  137. </div>
  138. </div>
  139. <div class="row">
  140. <div class="label">
  141. </div>
  142. <div class="formw">
  143. <br />
  144. <button type="submit" class="save" name="Submit" value="Save" ><?php echo get_lang('Save'); ?></button>
  145. </div>
  146. </div>
  147. </form>
  148. <?php
  149. Display::display_footer();