home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / modules / filesystem / properties.inc < prev    next >
Text File  |  2004-03-08  |  7KB  |  235 lines

  1. <?php
  2. /*
  3. Copyright Intermesh 2003
  4. Author: Merijn Schering <mschering@intermesh.nl>
  5. Version: 1.0 Release date: 08 July 2003
  6.  
  7. This program is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.
  11. */
  12.  
  13. $return_to_path = urlencode(smartstrip($return_to_path));
  14. $filename = basename($path);
  15. $extension = get_extension($filename);
  16. $type = $filetypes->get_type($extension);
  17. $location = dirname($path);
  18. $share = $fs->get_share($path);
  19. //do not let user share it's home folder or modify the name!
  20. $write_perms = ($fs->has_write_permission($GO_SECURITY->user_id, $path) && !$fs->is_home_path($GO_SECURITY->user_id, $path));
  21.  
  22. $return_to = $_SERVER['PHP_SELF'].'?path='.$return_to_path;
  23. $link_back = $_SERVER['REQUEST_URI'];
  24.  
  25. echo '<input type="hidden" name="task" value="properties" />';
  26. echo '<input type="hidden" name="close" value="false" />';
  27.  
  28. $tabtable = new tabtable('properties_tab', $strProperties, '400', '400', '120', '', true);
  29. $tabtable->add_tab('properties', $fbGeneral);
  30.  
  31. if ($share)
  32. {
  33.     $tabtable->add_tab('read_permissions', $strReadRights);
  34.     $tabtable->add_tab('write_permissions', $strWriteRights);
  35. }
  36.  
  37. if ($notes_module = $GO_MODULES->get_module('notes'))
  38. {
  39.     if ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $notes_module['acl_read']) || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $notes_module['acl_write']))
  40.     {
  41.         $tabtable->add_tab('notes', $lang_modules['notes']);
  42.     }
  43. }
  44. $tabtable->print_head();
  45.  
  46. switch($tabtable->get_active_tab_id())
  47. {
  48.     case 'read_permissions':
  49.         print_acl($share['acl_read']);
  50.         echo '<br />';
  51.         $button = new button($cmdClose, 'javascript:document.location=\''.$_SERVER['PHP_SELF'].'?path='.$return_to_path.'\';');
  52.     break;
  53.  
  54.     case 'write_permissions':
  55.         print_acl($share['acl_write']);
  56.         echo '<br />';
  57.         $button = new button($cmdClose, 'javascript:document.location=\''.$_SERVER['PHP_SELF'].'?path='.$return_to_path.'\';');
  58.     break;
  59.  
  60.     case 'notes':
  61.         echo '<input type="hidden" name="sort_cookie_prefix" value="no_" />';
  62.         require($GO_LANGUAGE->get_language_file('notes'));
  63.         require_once($GO_CONFIG->class_path.'notes.class.inc');
  64.         $notes = new notes();
  65.         $notes_module_url = $notes_module['url'];
  66.         $link_back .= '?task=properties&active_tab='.$tabtable->get_active_tab_id();
  67.         $file_path=$path;
  68.         require($GO_CONFIG->root_path.$notes_module['path'].'notes.inc');
  69.         echo '<br />';
  70.         $button = new button($cmdClose, "javascript:document.location='".$return_to."'");
  71.     break;
  72.  
  73.     default:
  74.  
  75.         ?>
  76.         <table border="0" cellpadding="10">
  77.         <tr>
  78.             <td class="TableInside" colspan="99" width="100%" height="300" valign="top">
  79.             <table border="0" cellpadding="4" cellspacing="0">
  80.             <tr>
  81.                 <td colspan="2"><?php if(isset($feedback)) echo $feedback; ?> </td>
  82.             </tr>
  83.             <tr>
  84.                 <td>
  85.                 <?php echo $strName; ?>:
  86.                 </td>
  87.                 <td>
  88.                 <?php
  89.                 if ($write_perms)
  90.                 {
  91.                     echo '<input type="text" class="textbox" name="name" value="'.strip_extension(basename($path)).'" maxlength="100" size="30" />';
  92.                     echo '<input type="hidden" name="extension" value ="'.get_extension(basename($path)).'" />';
  93.                 }else
  94.                 {
  95.                     echo basename($path);
  96.                 }
  97.                 ?>
  98.                 </td>
  99.             </tr>
  100.             <tr>
  101.                 <td>
  102.                 <?php echo $fbLocation; ?>:
  103.                 </td>
  104.                 <td>
  105.                 <?php
  106.                 if (dirname($GO_CONFIG->file_storage_path).$GO_CONFIG->slash.basename($GO_CONFIG->file_storage_path) == $location)
  107.                 {
  108.                     echo $GO_CONFIG->slash;
  109.                 }else
  110.                 {
  111.                     echo str_replace($GO_CONFIG->file_storage_path,$GO_CONFIG->slash,$location);
  112.                 }
  113.                 ?>
  114.                 </td>
  115.             </tr>
  116.             <tr>
  117.                 <td colspan="2"><hr /></td>
  118.             </tr>
  119.             <tr>
  120.                 <td valign="top">
  121.                 <?php echo $strType; ?>:
  122.                 </td>
  123.                 <td>
  124.                 <table border="0" cellpadding="0" cellspacing="0">
  125.                 <tr>
  126.                     <td valign="top">
  127.                     <?php
  128.                     if (is_dir($path))
  129.                     {
  130.                         echo '<img border="0" width="16" height="16" src="'.$GO_THEME->images['folder'].'" />';
  131.                         echo ' </td><td valign="top">';
  132.                         echo $fbFolder;
  133.                     }else
  134.                     {
  135.                         echo '<img border="0" width="16" height="16" src="'.$GO_CONFIG->control_url.'icon.php?extension='.$extension.'" />';
  136.                         echo ' </td><td valign="top">';
  137.                         echo $type['friendly'];
  138.                         if (($type['mime'] != $type['friendly']) && $type['mime'] != '')
  139.                         {
  140.                             echo '<br />('.$type['mime'].')';
  141.                         }
  142.                     }
  143.                     ?>
  144.                     </td>
  145.                 </tr>
  146.                 </table>
  147.                 </td>
  148.             </tr>
  149.             <tr>
  150.                 <td><?php echo $strSize; ?>:</td>
  151.                 <td><?php
  152.                 if (is_dir($path) && !isset($_REQUEST['calc_size']))
  153.                 {
  154.                     echo '<a href="'.$_SERVER['PHP_SELF'].'?task=properties&path='.$urlencoded_path.'&calc_size=true" class="normal">'.$fs_calculate_folder_size.'</a>';
  155.                 }else
  156.                 {
  157.                     echo format_size($fs->size($path));
  158.                 }
  159.                 ?></td>
  160.             </tr>
  161.             <tr>
  162.                 <td colspan="2"><hr /></td>
  163.             </tr>
  164.             <tr>
  165.                 <td>
  166.                 <?php echo $strCreated; ?>:
  167.                 </td>
  168.                 <td>
  169.                 <?php echo date($_SESSION['GO_SESSION']['date_format'].' '.$_SESSION['GO_SESSION']['time_format'], get_time(filectime($path))); ?>
  170.                 </td>
  171.             </tr>
  172.             <tr>
  173.                 <td>
  174.                 <?php echo $strAccessed; ?>:
  175.                 </td>
  176.                 <td>
  177.                 <?php echo date($_SESSION['GO_SESSION']['date_format'].' '.$_SESSION['GO_SESSION']['time_format'], get_time(fileatime($path))); ?>
  178.                 </td>
  179.             </tr>
  180.             <tr>
  181.                 <td>
  182.                 <?php echo $strModified; ?>:
  183.                 </td>
  184.                 <td>
  185.                 <?php echo date($_SESSION['GO_SESSION']['date_format'].' '.$_SESSION['GO_SESSION']['time_format'], get_time(filemtime($path))); ?>
  186.                 </td>
  187.             </tr>
  188.             <?php
  189.             if (is_dir($path))
  190.             {
  191.                 echo '<tr><td colspan="2"><hr /></td></tr>';
  192.                 $disabled = ($fs->is_owner($GO_SECURITY->user_id, $path) && $write_perms) ? false : true;
  193.  
  194.                 echo '<tr><td colspan="2">';
  195.                 $checkbox = new checkbox('share_folder', $path, $fs_activate_sharing, $share, $disabled);
  196.                 if ($disabled)
  197.                 {
  198.                     echo '<input type="hidden" name="share_folder" value="'.$path.'" />';
  199.                 }
  200.                 echo '</td></tr>';
  201.             }
  202.             ?>
  203.             <tr>
  204.                 <td colspan="2" align="center">
  205.                     <br />
  206.                     <?php
  207.                     if ($write_perms)
  208.                     {
  209.                         $button = new button($cmdOk, 'javascript:save_close()');
  210.                         echo '  ';
  211.                         $button = new button($cmdApply, 'javascript:document.forms[0].submit()');
  212.                         echo '  ';
  213.                     }
  214.                     $button = new button($cmdClose, 'javascript:document.location=\''.$_SERVER['PHP_SELF'].'?path='.$return_to_path.'\';');
  215.                     ?>
  216.                 </td>
  217.             </tr>
  218.             </table>
  219.             </td>
  220.         </tr>
  221.         </table>
  222.     <?php
  223.     break;
  224. }
  225. $tabtable->print_foot();
  226. ?>
  227. <script type="text/javascript">
  228. function save_close()
  229. {
  230.     document.forms[0].close.value='true';
  231.     javascript:document.forms[0].submit();
  232. }
  233. </script>
  234.  
  235.