manager.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?php
  2. /**
  3. * The main GUI for the ImageManager.
  4. * @author Wei Zhuo
  5. * @version $Id: manager.php,v 1.4 2006/12/17 14:57:17 thierrybo Exp $
  6. * @package ImageManager
  7. */
  8. require_once('config.inc.php');
  9. require_once('Classes/ImageManager.php');
  10. $manager = new ImageManager($IMConfig);
  11. $dirs = $manager->getDirs();
  12. $var = explode('/',$_GET['base_url_alt']);
  13. // if the base_url_alt parameter there is a default_course_document we change the allow upload parameter
  14. if ($var[count($var)-2] == 'default_course_document')
  15. {
  16. $IMConfig['allow_upload']=false;
  17. }
  18. ?>
  19. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  20. <html>
  21. <head>
  22. <title>Insert Image</title>
  23. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  24. <link href="assets/manager.css" rel="stylesheet" type="text/css" />
  25. <script type="text/javascript">
  26. /*<![CDATA[*/
  27. var thumbdir = "<?php echo $IMConfig['thumbnail_dir']; ?>";
  28. var base_url = "<?php echo $manager->getBaseURL(); ?>";
  29. var base_url_alt= "<?php echo $_GET['base_url_alt'].'images'; ?>";
  30. var server_name = "<?php echo $IMConfig['server_name']; ?>";
  31. window.resizeTo(680, 550);
  32. if(window.opener.ImageManager && window.opener.ImageManager.I18N)
  33. {
  34. I18N = window.opener.ImageManager.I18N;
  35. }
  36. // language object not found?
  37. if (!this.I18N)
  38. {
  39. // Read it now - copy in next script block
  40. document.write('<script type="text/javascript" src="lang/' + window.opener._editor_lang + '.js"><\/script>');
  41. }
  42. /*]]>*/
  43. </script>
  44. <script type="text/javascript">
  45. /*<![CDATA[*/
  46. // now copy the language object of the included script - needed a seperate new script block to be able to do so
  47. if (!this.I18N)
  48. {
  49. I18N = this.ImageManager.I18N;
  50. }
  51. /*]]>*/
  52. </script>
  53. <script type="text/javascript" src="assets/popup.js"></script>
  54. <script type="text/javascript" src="assets/dialog.js"></script>
  55. <script type="text/javascript" src="assets/manager.js"></script>
  56. </head>
  57. <body>
  58. <div class="title">Insert Image</div>
  59. <form action="images.php" id="uploadForm" method="post" enctype="multipart/form-data">
  60. <fieldset><legend>Image Manager</legend>
  61. <div class="dirs">
  62. <label for="dirPath">Directory</label>
  63. <select name="dir" class="dirWidth" id="dirPath" onchange="updateDir(this)">
  64. <option value="/">/</option>
  65. <?php foreach($dirs as $relative=>$fullpath) { ?>
  66. <option value="<?php echo rawurlencode($relative); ?>"><?php echo $relative; ?></option>
  67. <?php } ?>
  68. </select>
  69. <a href="#" onclick="javascript: goUpDir();" title="Directory Up"><img src="img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" /></a>
  70. <?php if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir']) { ?>
  71. <a href="#" onclick="newFolder();" title="New Folder"><img src="img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a>
  72. <?php } ?>
  73. <div id="messages" style="display: none;"><span id="message"></span><img SRC="img/dots.gif" width="22" height="12" alt="..." /></div>
  74. <iframe src="images.php" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe>
  75. </div>
  76. </fieldset>
  77. <!-- image properties -->
  78. <table class="inputTable">
  79. <tr>
  80. <td align="right"><label for="f_url">Image File</label></td>
  81. <td><input type="text" id="f_url" class="largelWidth" value="" /></td>
  82. <td rowspan="3" align="right">&nbsp;</td>
  83. <td align="right"><label for="f_width">Width</label></td>
  84. <td><input type="text" id="f_width" class="smallWidth" value="" onchange="javascript:checkConstrains('width');"/></td>
  85. <td rowspan="2" align="right"><img src="img/locked.gif" id="imgLock" width="25" height="32" alt="Constrained Proportions" /></td>
  86. <td rowspan="3" align="right">&nbsp;</td>
  87. <td align="right"><label for="f_vert">V Space</label></td>
  88. <td><input type="text" id="f_vert" class="smallWidth" value="" /></td>
  89. </tr>
  90. <tr>
  91. <td align="right"><label for="f_alt">Alt</label></td>
  92. <td><input type="text" id="f_alt" class="largelWidth" value="" /></td>
  93. <td align="right"><label for="f_height">Height</label></td>
  94. <td><input type="text" id="f_height" class="smallWidth" value="" onchange="javascript:checkConstrains('height');"/></td>
  95. <td align="right"><label for="f_horiz">H Space</label></td>
  96. <td><input type="text" id="f_horiz" class="smallWidth" value="" /></td>
  97. </tr>
  98. <tr>
  99. <?php if($IMConfig['allow_upload'] == true) { ?>
  100. <td align="right"><label for="upload">Upload</label></td>
  101. <td>
  102. <table cellpadding="0" cellspacing="0" border="0">
  103. <tr>
  104. <td><input type="file" name="upload" id="upload"/></td>
  105. <td>&nbsp;<button type="submit" name="submit" onclick="doUpload();"/>Upload</button></td>
  106. </tr>
  107. </table>
  108. </td>
  109. <?php } else { ?>
  110. <td colspan="2"></td>
  111. <?php } ?>
  112. <td align="right"><label for="f_align">Align</label></td>
  113. <td colspan="2">
  114. <select size="1" id="f_align" title="Positioning of this image">
  115. <option value="" >Not Set</option>
  116. <option value="left" >Left</option>
  117. <option value="right" >Right</option>
  118. <option value="texttop" >Texttop</option>
  119. <option value="absmiddle" >Absmiddle</option>
  120. <option value="baseline" selected="selected" >Baseline</option>
  121. <option value="absbottom" >Absbottom</option>
  122. <option value="bottom" >Bottom</option>
  123. <option value="middle" >Middle</option>
  124. <option value="top" >Top</option>
  125. </select>
  126. </td>
  127. <td align="right"><label for="f_border">Border</label></td>
  128. <td><input type="text" id="f_border" class="smallWidth" value="" /></td>
  129. </tr>
  130. <tr>
  131. <?php if (count($IMConfig['maxWidth']) > 1 && $IMConfig['allow_upload']){ ?>
  132. <td align="right"><label for="uploadSize" style="white-space: nowrap;">Upload Size</label></td>
  133. <td>
  134. <table cellpadding="0" cellspacing="0">
  135. <tr>
  136. <td>
  137. <select name="uploadSize" id="uploadSize">
  138. <?php for ($i = 0; $i < count($IMConfig['maxWidth']); $i++){ ?>
  139. <option value="<?=$i?>"><?=$IMConfig['maxWidth'][$i] . " x " . $IMConfig['maxHeight'][$i]?></option>
  140. <?php } ?>
  141. </select>
  142. </td>
  143. <td style="padding-left: 5px;">
  144. (max width x height dimensions)
  145. </td>
  146. </tr>
  147. </table>
  148. </td>
  149. <td></td>
  150. <td align="right">
  151. <?php }else{ ?>
  152. <td colspan="4" align="right">
  153. <?php } ?>
  154. <input type="hidden" id="orginal_width" />
  155. <input type="hidden" id="orginal_height" />
  156. <input type="checkbox" id="constrain_prop" checked="checked" onclick="javascript:toggleConstrains(this);" />
  157. </td>
  158. <td colspan="5"><label for="constrain_prop">Constrain Proportions</label></td>
  159. </tr>
  160. </table>
  161. <!--// image properties -->
  162. <div style="text-align: right;">
  163. <hr />
  164. <button type="button" class="buttons" onclick="return refresh();">Refresh</button>
  165. <button type="button" class="buttons" onclick="return onOK();">OK</button>
  166. <button type="button" class="buttons" onclick="return onCancel();">Cancel</button>
  167. </div>
  168. <input type="hidden" id="f_file" name="f_file" />
  169. </form>
  170. </body>
  171. </html>