ImageManager
[ class tree: ImageManager ] [ index: ImageManager ] [ all elements ]

Source for file genericManager.php

Documentation is available at genericManager.php

  1. <?php
  2. /**
  3.  * The main GUI for the ImageManager.
  4.  * @author $Author: Wei Zhuo $
  5.  * @package ImageManager
  6.  */
  7.  
  8. require_once('../ImageManager/config.inc.php');
  9. require_once('../ImageManager/Classes/ImageManager.php');
  10.  
  11. $manager new ImageManager($IMConfig);
  12. $dirs $manager->getDirs();
  13.  
  14. ?>
  15. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  16.  
  17. <html>
  18. <head>
  19. <title>Insert Image</title>
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  21. <link href="../ImageManager/assets/manager.css" rel="stylesheet" type="text/css" />    
  22.  
  23. <script type="text/javascript">
  24.  
  25.  
  26.     var thumbdir = "<?php echo $IMConfig['thumbnail_dir']?>";
  27.     var base_url = "<?php echo $manager->getBaseURL()?>";
  28.     var server_name = "<?php echo $IMConfig['server_name']?>";
  29.     
  30.     <?php
  31.     //It's a teacher
  32.         if(api_is_allowed_to_edit()){
  33.             echo "window.resizeTo(600, 430);";
  34.         }
  35.         else{
  36.             echo "window.resizeTo(600, 125);";
  37.         }
  38.     ?>
  39.     
  40. </script>
  41.  
  42. <script type="text/javascript">
  43.  
  44.     // Generic Manager function
  45.     
  46.     function onLoad() {
  47.         var imageFileParent = window.opener.document.getElementsByName("imagefile")[0];
  48.         var imageFile = window.document.getElementById("f_url");
  49.         imageFile.value = imageFileParent.value; 
  50.         var imageLabelParent = window.opener.document.getElementsByName("imageLabel")[0];
  51.         var imageLabel = window.document.getElementById("f_alt");
  52.         imageLabel.value = imageLabelParent.value;
  53.         document.getElementById('advanced_settings').style.display='block';
  54.     }
  55.     
  56.      function onOKLocal() {
  57.         var imageFileParent = window.opener.document.getElementsByName("imagefile")[0];
  58.         var imageFile = window.document.getElementById("f_url");
  59.         if(imageFile.value.indexOf('://') < 0 ) {
  60.             imageFileParent.value = makeURL( base_url, imageFile.value );        
  61.         } else {
  62.             imageFileParent.value = imageFile.value;
  63.         }
  64.         
  65.         var imageLabelParent = window.opener.document.getElementsByName("imageLabel")[0];
  66.         var imageLabel = window.document.getElementById("f_alt");
  67.         imageLabelParent.value = imageLabel.value;
  68.         
  69.         window.close();
  70.      }
  71.      
  72.      function onCancelLocal() {
  73.          window.close();
  74.      }
  75.      
  76.      //similar to the Files::makeFile() in Files.php
  77.     function makeURL(pathA, pathB) 
  78.     {
  79.         if(pathA.substring(pathA.length-1) != '/')
  80.             pathA += '/';
  81.  
  82.         if(pathB.charAt(0) == '/');    
  83.             pathB = pathB.substring(1);
  84.  
  85.         return pathA+pathB;
  86.     }
  87.  
  88.  
  89. </script>
  90.  
  91. <script type="text/javascript" src="../ImageManager/assets/popup.js"></script>
  92. <script type="text/javascript" src="../ImageManager/assets/dialog.js"></script>
  93. <script type="text/javascript" src="genericManager.js"></script>
  94.  
  95. </head>
  96.  
  97. <body onload="onLoad();">
  98. <div class="title">Insert Image</div>
  99. <form action="../ImageManager/images.php<?php if(isset($_GET['uploadPath']&& $_GET['uploadPath']!=""echo "?uploadPath=".$_GET['uploadPath']?>" id="uploadForm" method="post" enctype="multipart/form-data">
  100.  
  101. <fieldset <?php if(!api_is_allowed_to_edit()) echo "style='display: none;'"?>><legend>Image Manager</legend>
  102. <div class="dirs">
  103.     <label for="dirPath">Directory</label>
  104.     <select name="dir" class="dirWidth" id="dirPath" onchange="updateDir(this)">
  105.     <option value="/">/</option>
  106. <?php foreach($dirs as $relative=>$fullpath?>
  107.         <option value="<?php echo rawurlencode($relative)?>"><?php echo $relative?></option>
  108. <?php ?>
  109.     </select>
  110.     <a href="#" onclick="javascript: goUpDir();" title="Directory Up"><img src="img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" /></a>
  111. <?php if($IMConfig['safe_mode'== false && $IMConfig['allow_new_dir']?>
  112.     <a href="#" onclick="newFolder();" title="New Folder"><img src="img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a>
  113. <?php ?>
  114.     <div id="messages" style="display: none;"><span id="message"></span><img SRC="img/dots.gif" width="22" height="12" alt="..." /></div>
  115.     <iframe src="../ImageManager/images.php<?php if(isset($_GET['uploadPath']&& $_GET['uploadPath']!=""echo "?uploadPath=".$_GET['uploadPath']?>" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe>
  116. </div>
  117. </fieldset>
  118.  
  119.  
  120. <!-- image properties -->
  121. <input type="file" name="upload" id="upload"/>&nbsp;<button type="submit" name="submit" onclick="doUpload();"/>Upload</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  122.           <button type="button" class="buttons" onclick="return refresh();" style="display: none">Refresh</button>
  123.           <button type="button" class="buttons" onclick="return onOKLocal();">OK</button>
  124.           <button type="button" class="buttons" onclick="return onCancelLocal();">Cancel</button>
  125.     <table class="inputTable" style="display: none" id="advanced_settings">
  126.         <tr>
  127.             <td align="right"><label for="f_url">Image File</label></td>
  128.             <td><input type="text" id="f_url" class="largelWidth" value="" /></td>
  129.             <td rowspan="3" align="right">&nbsp;</td>
  130.         </tr>
  131.         <tr>
  132.             <td align="right"><label for="f_alt">Alt</label></td>
  133.             <td><input type="text" id="f_alt" class="largelWidth" value="" /></td>
  134.         </tr>
  135.  
  136.     </table>
  137.  
  138.     <input type="hidden" id="f_file" name="f_file" />
  139. </form>
  140. </body>
  141. </html>

Documentation generated on Thu, 12 Jun 2008 13:32:43 -0500 by phpDocumentor 1.4.1