2 /****************************************************************/
\r
4 /****************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or*/
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /****************************************************************/
\r
15 define('AT_INCLUDE_PATH', '../../../include/');
\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
17 require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); // for get_human_size()
\r
18 require(AT_INCLUDE_PATH.'../mods/_standard/file_storage/file_storage.inc.php');
\r
20 $owner_type = abs($_REQUEST['ot']);
\r
21 $owner_id = abs($_REQUEST['oid']);
\r
22 $owner_arg_prefix = '?ot='.$owner_type.SEP.'oid='.$owner_id. SEP;
\r
23 if (!($owner_status = fs_authenticate($owner_type, $owner_id))) {
\r
24 $msg->addError('ACCESS_DENIED');
\r
25 header('Location: '.url_rewrite('mods/_standard/file_storage/index.php', AT_PRETTY_URL_IS_HEADER));
\r
29 if (isset($_GET['download'], $_GET['revision'])) {
\r
30 header('Location: '.AT_BASE_HREF.'mods/_standard/file_storage/index.php'.$owner_arg_prefix.'download=1'.SEP.'files'.urlencode('[]').'='.$_GET['revision']);
\r
32 } else if (query_bit($owner_status, WORKSPACE_AUTH_WRITE) && isset($_GET['delete'], $_GET['revision'])) {
\r
33 header('Location: '.AT_BASE_HREF.'mods/_standard/file_storage/delete_revision.php'.$owner_arg_prefix.'id='.$_GET['revision']);
\r
35 } else if (isset($_GET['cancel'])) {
\r
36 header('Location: '.url_rewrite('mods/_standard/file_storage/index.php'.$owner_arg_prefix.'folder='.$_GET['folder'], AT_PRETTY_URL_IS_HEADER));
\r
38 } else if (isset($_GET['comments'])) {
\r
39 header('Location: '.url_rewrite('mods/_standard/file_storage/comments.php'.$owner_arg_prefix.'id='.$_GET['revision'], AT_PRETTY_URL_IS_HEADER));
\r
43 require(AT_INCLUDE_PATH.'header.inc.php');
\r
45 $id = abs($_GET['id']);
\r
47 $orders = array('asc' => 'desc', 'desc' => 'asc');
\r
48 $cols = array('num_revisions' => 1, 'file_name' => 1, 'date' => 1, 'num_comments' => 1, 'file_size' => 1);
\r
50 if (isset($_GET['asc'])) {
\r
52 $col = isset($cols[$_GET['asc']]) ? $_GET['asc'] : 'num_revisions';
\r
53 } else if (isset($_GET['desc'])) {
\r
55 $col = isset($cols[$_GET['desc']]) ? $_GET['desc'] : 'num_revisions';
\r
59 $col = 'num_revisions';
\r
62 $files = fs_get_revisions($id, $owner_type, $owner_id, $col, $order);
\r
63 $current_file = current($files);
\r
66 usort($files, 'fs_revisions_sort_compare');
\r
70 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">
\r
71 <input type="hidden" name="folder" value="<?php echo $current_file['folder_id']; ?>" />
\r
72 <input type="hidden" name="ot" value="<?php echo $owner_type; ?>" />
\r
73 <input type="hidden" name="oid" value="<?php echo $owner_id; ?>" />
\r
74 <table class="data">
\r
76 <?php if ($col == 'num_revisions'): ?>
\r
78 <col class="sort" />
\r
80 <?php elseif($col == 'file_name'): ?>
\r
82 <col class="sort" />
\r
84 <?php elseif($col == 'date'): ?>
\r
86 <col class="sort" />
\r
88 <?php elseif($col == 'num_comments'): ?>
\r
90 <col class="sort" />
\r
92 <?php elseif($col == 'file_size'): ?>
\r
94 <col class="sort" />
\r
100 <th><a href="<?php echo $_SERVER['PHP_SELF'] . $owner_arg_prefix . 'id='.$id.SEP.$orders[$order]; ?>=num_revisions"><?php echo _AT('revision'); ?></a></th>
\r
101 <th><a href="<?php echo $_SERVER['PHP_SELF'] . $owner_arg_prefix . 'id='.$id.SEP.$orders[$order]; ?>=file_name"><?php echo _AT('file_name'); ?></a></th>
\r
102 <th><a href="<?php echo $_SERVER['PHP_SELF'] . $owner_arg_prefix . 'id='.$id.SEP.$orders[$order]; ?>=date"><?php echo _AT('date'); ?></a></th>
\r
103 <th><?php echo _AT('author'); ?></th>
\r
104 <th><a href="<?php echo $_SERVER['PHP_SELF'] . $owner_arg_prefix . 'id='.$id.SEP.$orders[$order]; ?>=num_comments"><?php echo _AT('comments'); ?></a></th>
\r
105 <th><a href="<?php echo $_SERVER['PHP_SELF'] . $owner_arg_prefix . 'id='.$id.SEP.$orders[$order]; ?>=file_size"><?php echo _AT('size'); ?></a></th>
\r
112 <input type="submit" name="download" value="<?php echo _AT('download'); ?>" />
\r
113 <?php if (query_bit($owner_status, WORKSPACE_AUTH_WRITE)): ?>
\r
114 <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />
\r
116 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
\r
121 <?php foreach ($files as $file): ?>
\r
122 <tr onmousedown="document.form['r<?php echo $file['file_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $file['file_id']; ?>_0">
\r
123 <td valign="top"><input type="radio" name="revision" value="<?php echo $file['file_id']; ?>" id="r<?php echo $file['file_id']; ?>" /></td>
\r
124 <td valign="top"><?php echo $file['num_revisions']; ?></td>
\r
126 <?php echo $file['file_name']; ?>
\r
127 <?php if ($file['comments']): ?>
\r
128 <p><?php echo nl2br($file['comments']); ?></p>
\r
131 <td valign="top"><?php echo AT_date(_AT('filemanager_date_format'), $file['date'], AT_DATE_MYSQL_DATETIME); ?></td>
\r
132 <td valign="top"><?php echo get_display_name($file['member_id']); ?></td>
\r
133 <td valign="top"><a href="<?php echo url_rewrite('mods/_standard/file_storage/comments.php'.$owner_arg_prefix.'id='.$file['file_id']); ?>"><?php echo $file['num_comments']; ?></a></td>
\r
134 <td valign="top"><?php echo get_human_size($file['file_size']); ?></td>
\r
136 <?php endforeach; ?>
\r
142 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>