home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / modules / cms / template_file_selector.php < prev    next >
PHP Script  |  2004-03-08  |  2KB  |  74 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. //load Group-Office
  14. require("../../Group-Office.php");
  15.  
  16. //load the CMS module class library
  17. require($GO_CONFIG->class_path.'cms.class.inc');
  18. $cms = new cms();
  19.  
  20. //authenticate the user
  21. $GO_SECURITY->authenticate();
  22.  
  23. //see if the user has access to this module
  24. //for this to work there must be a module named 'example'
  25. $GO_MODULES->authenticate('cms');
  26.  
  27. //get the language file
  28. require($GO_LANGUAGE->get_language_file('cms'));
  29.  
  30. require($GO_THEME->theme_path.'header.inc');
  31.  
  32. echo '<input type="hidden" name="template_file_id" />';
  33. echo '<input type="hidden" name="task" />';
  34. echo '<table border="0" cellpadding="3" cellspacing="0"><tr>';
  35. echo '<td width="16"> </td>';
  36. echo '<td width="100" nowrap><h3>'.$strName.'</h3></td>';
  37. echo '<td width="100" nowrap><h3>'.$strType.'</h3></td></tr>';
  38.  
  39. //list the files
  40. $total_size = 0;
  41. $count_files = $cms->get_template_files($_REQUEST['template_id']);
  42. while ($cms->next_record())
  43. {
  44.     $total_size += $cms->f('size');
  45.     $short_name = cut_string($cms->f('name'), 30);
  46.  
  47.     echo '<tr class="Table1">';
  48.     echo '<td><img width="16" height="16" border="0" src="'.$GO_CONFIG->control_url.'icon.php?extension='.$cms->f('extension').'" /></td>';
  49.     echo '<td nowrap> <a href="javascript:paste_url(\''.$GO_CONFIG->host.$GO_MODULES->path.'template_file.php?template_file_id='.$cms->f('id').'\')" title="'.$cms->f('name').'">'.$short_name.'</a>  </td>';
  50.     echo '<td nowrap>'.$cms->f('content_type_friendly').'  </td></tr>';
  51. }
  52. echo '<tr><td colspan="99" height="18"> '.$count_files.' '.$cms_items.'</td></tr>';
  53.  
  54. echo '</table>
  55. <script type="text/javascript">
  56.  
  57. function paste_url(url)
  58. {
  59.     var textarea = opener.document.forms[0].'.$_REQUEST['SET_FIELD'].';
  60.  
  61.     if (document.all)
  62.     {
  63.         textarea.value=url+"\r\n"+textarea.value
  64.     }else
  65.     {
  66.         textarea.value=textarea.value.substring(0,textarea.selectionStart)+url+textarea.value.substring(textarea.selectionEnd,textarea.value.length);
  67.     }
  68.     window.close();
  69. }
  70.  
  71. </script>';
  72.  
  73. require($GO_THEME->theme_path.'footer.inc');
  74. ?>