<?php
/****************************************************************************************/
/* ACollab */
/****************************************************************************************/
/* Copyright (c) 2002-2004 Adaptive Technology Resource Centre / University of Toronto */
/* */
/* http://atutor.ca/acollab */
/* */
/* This program is free software. You may redistribute it and/or */
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation; either version 2 of the License, */
/* or (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
/* See the GNU General Public License for more details. */
/* */
/* You may access the GNU General Public License at: */
/* http://www.opensource.org/licenses/gpl-license.php */
/* */
/* You may contact the Adaptive Technology Resource Centre at */
/* Robarts Library, University of Toronto */
/* 130 St. George Street, Toronto, Ontario, Canada M5S 1A5 */
/* Further contact information is available at http://www.utoronto.ca/atrc/ */
/****************************************************************************************/
/* Programmer: */
/* Joel Kronenberg - ATRC */
/****************************************************************************************/
// $Id: index.php 480 2005-03-30 14:36:19Z shozubq $
define('AC_INCLUDE_PATH', '../include/');
require(AC_INCLUDE_PATH.'vitals.inc.php');
require(AC_INCLUDE_PATH.'lib/folders.inc.php');
authenticate(USER_CLIENT, USER_GROUP_ADMIN);
$_SECTION[0][0] = _AC('home');
$_SECTION[0][1] = 'home.php';
$_SECTION[1][0] = _AC('library');
$_SECTION[1][1] = 'library/';
require(AC_INCLUDE_PATH.'header.inc.php');
$show_all_group_folders = false;
if ($_GET['show'] == 'all') {
$show_all_group_folders = true;
}
echo '<p align="center"><strong><a href="library/add_file.php" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('add_draft_file').'</a> | <a href="drafting/add_file.php?library=1" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('add_file').'</a></strong></p>';
/*
if ($_SESSION['course_id']) {
echo '<p align="center"><b>';
if (!$_GET['show']) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?show=all" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('view_all_course_files').'</a>';
} else {
echo '<a href="'.$_SERVER['PHP_SELF'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('view_only_group_files').'</a>';
}
echo '</b></p>';
} else {
$show_all_group_folders = false;
}
*/
if (isset($_GET['f'])) {
print_feedback($_GET['f']);
}
$folders = get_folders(false, $show_all_group_folders);
if (isset($_GET['id'])) {
$folder_id = intval($_GET['id']);
} else if (!empty($folders)) {
$folder_id = key($folders);
$_REQUEST['id'] = $folder_id;
}
?>
<table border="0" cellspacing="0" cellpadding="2" align="center" width="95%">
<tr>
<td width="25%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="1" class="box2">
<tr>
<th class="box"><?php echo _AC('group_folders'); ?></th>
</tr>
<tr>
<td valign="top" class="row0" width="25%"><?php
/* the public group folders */
print_folders($folders);
if (authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK)) {
echo '<br />';
echo '<a href="drafting/folders.php">'._AC('manage_folders').'</a>';
echo '<br />';
}
echo '<br /></td></tr>';
?>
</table></td>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="1" class="box2">
<tr>
<th class="box" scope="col" width="25%"><?php echo _AC('title'); ?></th>
<th class="box" scope="col"><?php echo _AC('description'); ?></th>
<th class="box"> </th>
</tr><?php
if ($show_all_group_folders) {
$sql = "SELECT F.* FROM ".TABLE_PREFIX."files F INNER JOIN ".TABLE_PREFIX."groups G USING (group_id) WHERE G.course_id=$_SESSION[course_id] AND F.folder_id=$folder_id AND F.library_revision_id > 0 AND F.folder_id > 0 ORDER BY F.folder_id, F.title";
} else {
$sql = "SELECT * FROM ".TABLE_PREFIX."files WHERE group_id=$_SESSION[group_id] AND folder_id=$folder_id AND library_revision_id > 0 AND folder_id > 0 ORDER BY folder_id, title";
}
$result = mysql_query($sql, $db);
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
$counter++;
?>
<tr>
<td valign="top" class="row<?php echo ($counter%2); ?>" width="15%"><a href="get_file.php?id=<?php echo $row['library_revision_id']; ?>"><img src="images/dl.jpg" height="14" width="14" border="0" alt="<?php echo _AC('download'); ?>" class="img" /> <?php echo $row['title']; ?></a></td>
<td class="row<?php echo ($counter%2); ?>" valign="top"><?php echo nl2br($row['description']); ?></td>
<td class="row<?php echo ($counter%2); ?>" valign="top" align="right"><a href="drafting/revisions.php?id=<?php echo $row['file_id']; ?>"><img src="images/history.gif" class="img" height="15" width="14" alt="" border="0" /> <?php echo _AC('history'); ?></a>
<?php if (authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK)): ?>
| <a href="library/remove.php?id=<?php echo $row['file_id'].SEP.'fid='.$folder_id; ?>"><img src="images/remove.gif" class="img" height="16" width="16" alt="" border="0" /> <?php echo _AC('remove'); ?></a>
<?php endif; ?></td>
</tr>
<?php
}
} else {
echo '<tr>';
echo '<td colspan="4" valign="top" class="row1">'._AC('empty_folder').'</td></tr>';
}
?>
</table></td>
</tr>
</table>
<br />
<?php
require(AC_INCLUDE_PATH.'footer.inc.php');
?>