<?php
/****************************************************************************************/
/* ACollab */
/****************************************************************************************/
/* Copyright (c) 2002-2005 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 479 2005-03-30 14:36:11Z shozubq $
define('AC_INCLUDE_PATH', '../include/');
require(AC_INCLUDE_PATH.'vitals.inc.php');
authenticate(USER_CLIENT, USER_GROUP_ADMIN);
require(AC_INCLUDE_PATH.'lib/folders.inc.php');
$_SECTION[0][0] = _AC('home');
$_SECTION[0][1] = 'home.php';
$_SECTION[1][0] = _AC('drafting_room');
$_SECTION[1][1] = 'drafting/';
require(AC_INCLUDE_PATH.'header.inc.php');
if (isset($_GET['f'])) {
print_feedback($_GET['f']);
}
$folders = get_folders();
if (isset($_GET['id'])) {
$folder_id = intval($_GET['id']);
} else if (!has_private_folder($_SESSION['member_id']) && !empty($folders)) {
$folder_id = key($folders);
$_REQUEST['id'] = $folder_id;
} else {
$folder_id = 0;
}
if ($_GET['mid'] == '') {
$m_id = $_SESSION['member_id'];
} else {
$m_id = intval($_GET['mid']);
}
?>
<table border="0" cellspacing="0" cellpadding="2" align="center" width="95%">
<tr>
<td> </td>
<td align="center"><img src="images/file_types/file_add.gif" class="img" alt="*" /> <a href="drafting/add_file.php?fid=<?php echo $folder_id; ?>"><strong><?php echo _AC('add_file'); ?></strong></a></td>
</tr>
<tr>
<td width="25%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="1" class="box2">
<?php
if (has_private_folder($_SESSION['member_id'])) {
?>
<tr>
<th class="box"><?php echo _AC('private_folders'); ?></th>
</tr>
<tr>
<td class="row0"><?php
if ($m_id == $_SESSION['member_id'] && !$folder_id) {
echo '<img src="images/file_types/folder_personal_open.gif" border="0" alt="*" class="img" />';
echo ' <strong><span style="background-color: yellow;">' . _AC('your_personal_folder') . '</strong>';
} else {
echo '<img src="images/file_types/folder_personal_close.gif" border="0" alt="*" class="img" />';
echo ' <a href="'.$_SERVER['PHP_SELF'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">' . _AC('your_personal_folder') . '</a>';
}
echo '<br />';
?></td>
</tr>
<?php } else { //endif;
if (!$folder_id || $folder_id == '' || $folder_id == 0 ) {
$folder_id = -1 ;
}
}
?>
<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>';
/* print the private folders for all members: */
if (authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK)) {
echo '<tr><th class="box">'._AC('member_folders'), '</th></tr>';
echo '<tr><td class="row0">';
$sql = "SELECT M.member_id, M.login FROM ".MEMBERS_TABLE_PREFIX."members M, ".TABLE_PREFIX."groups_members H WHERE M.member_id=H.member_id AND H.group_id=$_SESSION[group_id] AND M.member_id<>$_SESSION[member_id] ORDER BY M.login";
$result_m = mysql_query($sql, $db);
if ($row_m = mysql_fetch_assoc($result_m)) {
$num_folders = 0;
do {
if (has_private_folder($row_m['member_id'])) {
$num_folders++;
if ($row_m['member_id'] == $m_id) {
echo '<img src="images/file_types/folder_personal_open.gif" border="0" alt="*" class="img" /> <strong><span style="background-color: yellow;">' . $row_m['login'] . '</strong>';
} else {
echo '<img src="images/file_types/folder_personal_close.gif" border="0" alt="*" class="img" />';
echo ' <a href="'.$_SERVER['PHP_SELF'].'?mid='.$row_m['member_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'.$row_m['login'].'</a>';
}
echo '<br />';
}
} while ($row_m = mysql_fetch_assoc($result_m));
}
if ($num_folders == 0) {
echo _AC('no_folders_found');
}
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" align="left"><?php echo _AC('revisions'); ?></th>
<th class="box" scope="col"><?php echo _AC('description'); ?></th>
<th class="box"> </th>
</tr><?php
if ($folder_id) {
$sql = "SELECT * FROM ".TABLE_PREFIX."files WHERE group_id=$_SESSION[group_id] AND folder_id=$folder_id ORDER BY folder_id, title";
} else if (!$folder_id && $m_id && authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK)) {
$sql = "SELECT * FROM ".TABLE_PREFIX."files WHERE group_id=$_SESSION[group_id] AND folder_id=0 AND member_id=$m_id ORDER BY title";
} else if ($m_id == $_SESSION['member_id']) {
$sql = "SELECT * FROM ".TABLE_PREFIX."files WHERE group_id=$_SESSION[group_id] AND folder_id=0 AND member_id=$_SESSION[member_id] ORDER BY title";
}
$result = mysql_query($sql, $db);
if ($row = mysql_fetch_assoc($result)) {
do {
$counter++;
?>
<tr>
<td valign="top" class="row<?php echo ($counter%2); ?>" width="15%"><a href="drafting/revisions.php?id=<?php echo $row['file_id']; ?>"><img src="images/file_types/file.gif" height="16" width="13" border="0" alt="*" class="img" /> <?php echo $row['title']; ?></a><?php
if (!authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK) && $row['locked']) {
echo ' - <img src="images/lock.gif" class="img" height="12" width="16" alt="'._AC('locked').'" border="0" />';
}
?></td>
<td valign="top" class="row<?php echo ($counter%2); ?>" align="center"><?php echo $row['num_revisions']; ?></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"><?php
if (authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK) && !$row['locked']) {
echo '<a href="drafting/lock_file.php?id='.$row['file_id'].SEP.'mid='.$m_id.'"><img src="images/unlock.gif" class="img" height="12" width="16" alt="'._AC('lock_file').'" title="'._AC('lock_file').'" border="0" /></a>';
} else if (authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK) && $row['locked']) {
echo '<a href="drafting/unlock_file.php?id='.$row['file_id'].SEP.'mid='.$m_id.'"><img src="images/lock.gif" class="img" height="12" width="16" alt="'._AC('unlock_file').'" title="'._AC('unlock_file').'" border="0" /></a>';
}
echo '<a href="drafting/edit_file.php?id='.$row['file_id'].'"><img src="images/edit.gif" class="img" height="12" width="16" alt="'._AC('edit').'" title="'._AC('edit').'" border="0" /></a><a href="drafting/delete_file.php?id='.$row['file_id'].'"><img src="images/delete.gif" class="img" height="14" width="14" alt="'._AC('delete').'" title="'._AC('delete').'" border="0" /></a>';
?></td>
</tr>
<?php
} while ($row = mysql_fetch_assoc($result));
} else {
echo '<tr>';
echo '<td colspan="4" valign="top" class="row1">'._AC('empty_folder').'</td></tr>';
}
if (!$m_id) { ?>
<tr>
<td colspan="4" valign="top" class="row1 white" align="center"><img src="images/file_types/file_add.gif" class="img" alt="*" /> <a href="drafting/add_file.php?fid=<?php echo $folder_id; ?>"><strong><?php echo _AC('add_file'); ?></strong></a></td>
</tr>
<?php } ?>
</table>
</td>
</tr>
</table>
<br />
<?php require(AC_INCLUDE_PATH.'footer.inc.php'); ?>