manager.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. $base_url_alt = str_replace('"','',$_GET['base_url_alt']);
  14. ?>
  15. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  16. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $IMConfig['language']; ?>" lang="<?php echo $IMConfig['language']; ?>">
  17. <head>
  18. <title>Insert Image</title>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  20. <link href="assets/manager.css" rel="stylesheet" type="text/css" />
  21. <script type="text/javascript">
  22. /*<![CDATA[*/
  23. var thumbdir = "<?php echo $IMConfig['thumbnail_dir']; ?>";
  24. var base_url = "<?php echo $manager->getBaseURL(); ?>";
  25. var base_url_alt= "<?php echo $base_url_alt.'images/gallery/'; ?>";
  26. var server_name = "<?php echo $IMConfig['server_name']; ?>";
  27. var oEditor = null ;
  28. if ( !window.opener && window.parent )
  29. {
  30. // The image manager is inside a dialog.
  31. window.parent.SetAutoSize( true ) ;
  32. oEditor = window.parent.InnerDialogLoaded() ;
  33. }
  34. var _editor_lang = 'en' ;
  35. if ( window.opener )
  36. {
  37. window.resizeTo( 900, 535 ) ;
  38. if ( window.opener.ImageManager && window.opener.ImageManager.I18N )
  39. {
  40. I18N = window.opener.ImageManager.I18N ;
  41. }
  42. if ( window.opener._editor_lang )
  43. {
  44. _editor_lang = window.opener._editor_lang ;
  45. }
  46. }
  47. else if ( window.parent )
  48. {
  49. _editor_lang = oEditor._editor_lang ;
  50. if ( oEditor.ImageManager && oEditor.ImageManager.I18N )
  51. {
  52. I18N = oEditor.ImageManager.I18N ;
  53. }
  54. }
  55. // Language object not found?
  56. if ( !this.I18N )
  57. {
  58. // Read it now - copy in next script block
  59. document.write( '<script type="text/javascript" src="lang/' + _editor_lang + '.js"><\/script>' );
  60. }
  61. /*]]>*/
  62. </script>
  63. <script type="text/javascript">
  64. /*<![CDATA[*/
  65. // now copy the language object of the included script - needed a seperate new script block to be able to do so
  66. if (!this.I18N)
  67. {
  68. I18N = this.ImageManager.I18N;
  69. }
  70. /*]]>*/
  71. </script>
  72. <script type="text/javascript" src="assets/popup.js"></script>
  73. <script type="text/javascript" src="assets/dialog.js"></script>
  74. <script type="text/javascript" src="assets/manager.js"></script>
  75. <style type="text/css" media="screen, projection">
  76. /*<![CDATA[*/
  77. body {
  78. padding: 0px;
  79. overflow: hidden;
  80. }
  81. /*]]>*/
  82. </style>
  83. <script type="text/javascript">
  84. /*<![CDATA[*/
  85. function Init()
  86. {
  87. if ( window.opener )
  88. {
  89. document.getElementById('dialog_title').style.visibility = '' ;
  90. }
  91. else if ( window.parent )
  92. {
  93. var title = window.parent.document.getElementById( 'TitleArea' ).innerHTML ;
  94. if ( title )
  95. {
  96. window.parent.document.getElementById( 'TitleArea' ).innerHTML = title.replace( 'Insert Image', i18n( 'Insert Image' ) ) ;
  97. }
  98. }
  99. }
  100. /*]]>*/
  101. </script>
  102. <style type="text/css">
  103. body, td, input, textarea, select, label { font-family: Arial, Verdana, Geneva, helvetica, sans-serif; font-size: 11px; }
  104. </style>
  105. </head>
  106. <body dir="<?php echo $IMConfig['text_direction']; ?>" onload="javascript: Init();">
  107. <div id="dialog_title" class="PopupTitle" style="visibility: hidden;">Insert Image</div>
  108. <form action="images.php" id="uploadForm" method="post" enctype="multipart/form-data">
  109. <fieldset style="margin-left: 15px; margin-right: 15px;"><legend>Image Manager</legend>
  110. <div class="dirs">
  111. <label for="dirPath">Directory</label>
  112. <select name="dir" class="dirWidth" id="dirPath" onchange="javascript: updateDir(this);" style="width: 400px;">
  113. <option value="/">/</option>
  114. <?php
  115. foreach($dirs as $relative=>$fullpath) { ?>
  116. <?php if($relative == '/images/gallery/') {?>
  117. <option value="<?php echo rawurlencode($relative); ?>" selected="selected"><?php echo $relative; ?></option>
  118. <?php } else {?>
  119. <option value="<?php echo rawurlencode($relative); ?>"><?php echo $relative; ?></option>
  120. <?php } ?>
  121. <?php } ?>
  122. </select>
  123. <a href="javascript: void(0);" onclick="javascript: goUpDir();" title="Directory Up"><img src="img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" />&nbsp;<span>Directory Up</span></a>
  124. <?php if (!$IMConfig['safe_mode'] && $IMConfig['allow_new_dir']) { ?>
  125. <a href="javascript: void(0);" onclick="newFolder();" title="New Folder"><img src="img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a>
  126. <?php } ?>
  127. <div id="messages" style="display: none;"><span id="message"></span><img SRC="img/dots.gif" width="22" height="12" alt="..." /></div>
  128. <iframe src="images.php" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe>
  129. </div>
  130. </fieldset>
  131. <!-- image properties -->
  132. <table class="inputTable">
  133. <tr>
  134. <td align="right"><label for="f_url">Image File</label></td>
  135. <td><input type="text" id="f_url" class="largelWidth" value="" /></td>
  136. <td rowspan="3" align="right">&nbsp;</td>
  137. <td align="right"><label for="f_width">Width</label></td>
  138. <td><input type="text" id="f_width" class="smallWidth" value="" onchange="javascript: checkConstrains('width');"/></td>
  139. <td rowspan="2" align="right"><img src="img/locked.gif" id="imgLock" width="25" height="32" alt="Constrained Proportions" /></td>
  140. <td rowspan="3" align="right">&nbsp;</td>
  141. <td align="right"><label for="f_vert">V Space</label></td>
  142. <td><input type="text" id="f_vert" class="smallWidth" value="" /></td>
  143. </tr>
  144. <tr>
  145. <td align="right"><label for="f_alt">Alt</label></td>
  146. <td><input type="text" id="f_alt" class="largelWidth" value="" /></td>
  147. <td align="right"><label for="f_height">Height</label></td>
  148. <td><input type="text" id="f_height" class="smallWidth" value="" onchange="javascript: checkConstrains('height');"/></td>
  149. <td align="right"><label for="f_horiz">H Space</label></td>
  150. <td><input type="text" id="f_horiz" class="smallWidth" value="" /></td>
  151. </tr>
  152. <tr>
  153. <?php if ($IMConfig['allow_upload']) { ?>
  154. <td align="right"><label for="upload">Upload</label></td>
  155. <td>
  156. <table cellpadding="0" cellspacing="0" border="0">
  157. <tr>
  158. <td><input type="file" name="upload" id="upload"/></td>
  159. <td>&nbsp;<button type="submit" class="upload" name="submit" onclick="javascript: doUpload();"/>Upload</button></td>
  160. </tr>
  161. </table>
  162. </td>
  163. <?php } else { ?>
  164. <td colspan="2"></td>
  165. <?php } ?>
  166. <td align="right"><label for="f_align">Align</label></td>
  167. <td colspan="2">
  168. <select size="1" id="f_align" title="Positioning of this image" style="width: 130px;">
  169. <option value="" >Not Set</option>
  170. <option value="left" >Left</option>
  171. <option value="right" >Right</option>
  172. <option value="texttop" >Texttop</option>
  173. <option value="absmiddle" >Absmiddle</option>
  174. <option value="baseline" selected="selected" >Baseline</option>
  175. <option value="absbottom" >Absbottom</option>
  176. <option value="bottom" >Bottom</option>
  177. <option value="middle" >Middle</option>
  178. <option value="top" >Top</option>
  179. </select>
  180. </td>
  181. <td align="right"><label for="f_border">Border</label></td>
  182. <td><input type="text" id="f_border" class="smallWidth" value="" /></td>
  183. </tr>
  184. <tr>
  185. <?php if (count($IMConfig['maxWidth']) > 1 && $IMConfig['allow_upload']){ ?>
  186. <td align="right"><label for="uploadSize" style="white-space: nowrap;">Upload Size</label></td>
  187. <td>
  188. <table cellpadding="0" cellspacing="0">
  189. <tr>
  190. <td>
  191. <select name="uploadSize" id="uploadSize">
  192. <?php for ($i = 0; $i < count($IMConfig['maxWidth']); $i++){ ?>
  193. <option value="<?php echo $i ?>"><?php echo $IMConfig['maxWidth'][$i] . " x " . $IMConfig['maxHeight'][$i] ?></option>
  194. <?php } ?>
  195. </select>
  196. </td>
  197. <td style="padding-left: 5px;">
  198. (max width x height dimensions)
  199. </td>
  200. </tr>
  201. </table>
  202. </td>
  203. <td></td>
  204. <td align="right">
  205. <?php }else{ ?>
  206. <td colspan="4" align="right">
  207. <?php } ?>
  208. <input type="hidden" id="orginal_width" />
  209. <input type="hidden" id="orginal_height" />
  210. <input type="checkbox" id="constrain_prop" checked="checked" onclick="javascript: toggleConstrains(this);" />
  211. </td>
  212. <td colspan="5"><label for="constrain_prop">Constrain Proportions</label></td>
  213. </tr>
  214. </table>
  215. <!--// image properties -->
  216. <div class="PopupButtons" style="width: 100%;">
  217. <div style="float: right; white-space: nowrap; margin-right: 25px;">
  218. <button type="button" class="refresh" onclick="javascript: return refresh();">Refresh</button>&nbsp;
  219. <button type="button" class="save" onclick="javascript: return onOK();">OK</button>&nbsp;
  220. <button type="button" class="cancel" onclick="javascript: return onCancel();">Cancel</button>
  221. </div>
  222. </div>
  223. <input type="hidden" id="f_file" name="f_file" />
  224. </form>
  225. </body>
  226. </html>