Julian Prud'homme 19 years ago
parent 32fef54069
commit a4768670ac
  1. 454
      main/dropbox/index.php

@ -29,7 +29,7 @@
* @version 1.3 * @version 1.3
* *
* @author Jan Bols <jan@ivpv.UGent.be>, main programmer, initial version * @author Jan Bols <jan@ivpv.UGent.be>, main programmer, initial version
* @author René Haentjens <rene.haentjens@UGent.be>, several contributions (see RH) * @author Ren<EFBFBD> Haentjens <rene.haentjens@UGent.be>, several contributions (see RH)
* @author Roan Embrechts, virtual course support * @author Roan Embrechts, virtual course support
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (see history version 1.3) * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (see history version 1.3)
* *
@ -395,7 +395,7 @@ if (!$_GET['view'] OR $_GET['view']=='received' OR $dropbox_cnf['sent_received_t
$dropbox_category_data[]='<a href="'.api_get_self().'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=editcategory&amp;id='.$category['cat_id'].'"><img src="../img/edit.gif" alt="'.get_lang('Edit').'" /></a> $dropbox_category_data[]='<a href="'.api_get_self().'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=editcategory&amp;id='.$category['cat_id'].'"><img src="../img/edit.gif" alt="'.get_lang('Edit').'" /></a>
<a href="'.api_get_self().'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletereceivedcategory&amp;id='.$category['cat_id'].'" onclick="return confirmation(\''.$category['cat_name'].'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" /></a>'; <a href="'.api_get_self().'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletereceivedcategory&amp;id='.$category['cat_id'].'" onclick="return confirmation(\''.$category['cat_name'].'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" /></a>';
} }
if (is_array($dropbox_category_data)) if (is_array($dropbox_category_data) && count($dropbox_category_data)>0)
{ {
$dropbox_data_recieved[]=$dropbox_category_data; $dropbox_data_recieved[]=$dropbox_category_data;
} }
@ -540,7 +540,7 @@ if ($_GET['view']=='sent' OR $dropbox_cnf['sent_received_tabs']==false)
$dropbox_category_data[]='<a href="'.api_get_self().'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=editcategory&id='.$category['cat_id'].'"><img src="../img/edit.gif" alt="'.get_lang('Edit').'"/></a> $dropbox_category_data[]='<a href="'.api_get_self().'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=editcategory&id='.$category['cat_id'].'"><img src="../img/edit.gif" alt="'.get_lang('Edit').'"/></a>
<a href="'.api_get_self().'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletesentcategory&amp;id='.$category['cat_id'].'" onclick="return confirmation(\''.$category['cat_name'].'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" /></a>'; <a href="'.api_get_self().'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletesentcategory&amp;id='.$category['cat_id'].'" onclick="return confirmation(\''.$category['cat_name'].'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" /></a>';
} }
if (is_array($dropbox_category_data)) if (is_array($dropbox_category_data) && count($dropbox_category_data)>0)
{ {
$dropbox_data_sent[]=$dropbox_category_data; $dropbox_data_sent[]=$dropbox_category_data;
} }
@ -567,451 +567,5 @@ if ($_GET['view']=='sent' OR $dropbox_cnf['sent_received_tabs']==false)
Display::display_footer(); Display::display_footer();
exit;
?>
if ( $_GET['mailing']) // RH: Mailing detail window passes parameter
{
getUserOwningThisMailing($_GET['mailing'], $_user['user_id'], '304'); // RH or die
$dropbox_person = new Dropbox_Person( $_GET['mailing'], $is_courseAdmin, $is_courseTutor);
$mailingInUrl = "&mailing=" . urlencode( $_GET['mailing']);
}
else
{
$mailingInUrl = "";
}
$dropbox_person->orderReceivedWork ($receivedOrder);
if( isset($_GET['dropbox_user_filter']) && $_GET['dropbox_user_filter'] != -1)
{
$dropbox_person->filter_received_work('uploader_id',$_GET['dropbox_user_filter']);
}
$dropbox_person->orderSentWork ($sentOrder);
if (isset($_POST["feedbackid"]) && isset($_POST["feedbacktext"])) // RH: Feedback
{
$dropbox_person->updateFeedback ($_POST["feedbackid"], get_magic_quotes_gpc() ?
stripslashes($_POST["feedbacktext"]) : $_POST["feedbacktext"]);
}
/*
==============================================================================
FORM UPLOAD FILE
==============================================================================
*/
if ( $_GET['mailing']) // RH: Mailing detail: no form upload
{
echo "<h3>", htmlspecialchars( getUserNameFromId ( $_GET['mailing'])), "</h3>";
echo "<a href='index.php?".api_get_cidreq()."&origin=$origin'>".dropbox_lang("mailingBackToDropbox").'</a><br><br>';
}
else
{
} // RH: Mailing: end of 'Mailing detail: no form upload'
/*
==============================================================================
FILES LIST
==============================================================================
*/
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">",
"<tr>",
"<td valign=\"top\" align=\"center\">";
/*
-----------------------------------------------------------
RECEIVED FILES LIST: TABLE HEADER
-----------------------------------------------------------
*/
if ( !$_GET['mailing']) // RH: Mailing detail: no received files
{
?>
<table cellpadding="5" cellspacing="1" border="0" width="100%">
<!--This is no longer neede because of sortable table -->
<tr class="cell_header">
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name="formReceived" method="get" action="index.php?<?php echo "origin=$origin"; ?>">
<span class="dropbox_listTitle"><?php echo dropbox_lang("orderBy")?></span>
<?php if ($origin=='learnpath') { echo "<input type='hidden' name='origin' value='learnpath'>"; } ?>
<select name="receivedOrder" onchange="javascript: this.form.submit()">
<option value="lastDate" <?php if ($receivedOrder=="lastDate") {
echo "selected";
}?>><?php echo dropbox_lang("lastDate")?></option>
<?php if (dropbox_cnf("allowOverwrite")) { ?>
<option value="firstDate" <?php if ($receivedOrder=="firstDate") {
echo "selected";
}?>><?php echo dropbox_lang("firstDate")?></option>
<?php } ?>
<option value="title" <?php if ($receivedOrder=="title") {
echo "selected";
}?>><?php echo dropbox_lang("title")?></option>
<option value="size" <?php if ($receivedOrder=="size") {
echo "selected";
}?>><?php echo dropbox_lang("size")?></option>
<option value="author" <?php if ($receivedOrder=="author") {
echo "selected";
}?>><?php echo dropbox_lang("author")?></option>
<option value="sender" <?php if ($receivedOrder=="sender") {
echo "selected";
}?>><?php echo dropbox_lang("sender")?></option>
</select>
<span class="dropbox_listTitle"><?php echo dropbox_lang('sentBy'); ?></span>
<select name="dropbox_user_filter" onchange="javascript: this.form.submit()">
<option value="-1"><?php echo get_lang('All'); ?></option>
<?php
foreach ($complete_user_list_for_dropbox as $current_user)
{
$full_name = $current_user['lastcommafirst'];
echo '<option value="' . $current_user['user_id'] . '"'.($_GET['dropbox_user_filter'] == $current_user['user_id'] ? 'selected="selected"' : '').'>' . $full_name . '</option>';
}
?>
</select>
<noscript><input type="submit" value="OK"/></noscript>
</form>
</td>
<td align="right"><div class="dropbox_listTitle"><?php echo strtoupper( dropbox_lang("receivedTitle"))?></div></td>
<td align="right" width="30px">
<a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteReceived=all&dropbox_unid=<?php echo urlencode( $dropbox_unid)?>"
onClick="return confirmation('<?php echo addslashes( dropbox_lang("all", "noDLTT"))?>');">
<img src="../img/delete.gif" border="0" title="<?php echo get_lang("Delete"); ?>" alt="" /></a>
<?php if ($origin=='learnpath') { echo "<input type='hidden' name='origin' value='learnpath' />"; } ?>
</td>
</tr>
</table>
</td>
</tr>
<?php
/*
-----------------------------------------------------------
RECEIVED FILES LIST
-----------------------------------------------------------
*/
$numberDisplayed = count($dropbox_person -> receivedWork); // RH
$i = 0;
// RH: Feedback: pencil for Give/Edit Feedback, UI rearranged, feedback added
foreach ( $dropbox_person -> receivedWork as $w)
{
if ( $w -> uploader_id == $_user['user_id']) // RH: justUpload
{
$numberDisplayed -= 1; continue;
}
?>
<tr>
<td valign="top" algin="left" width="25">
<a href="dropbox_download.php?<?php echo api_get_cidreq()."&origin=$origin"; ?>&id=<?php echo urlencode($w->id)?>">
<img src="../img/travaux.gif" border="0" alt="" /></a>
</td>
<td valign="top" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<a href="dropbox_download.php?<?php echo api_get_cidreq()."&origin=$origin"; ?>&id=<?php echo urlencode($w->id)?>">
<?php echo $w -> title?></a> <span class="dropbox_detail">(<?php echo ceil(($w->filesize)/1024)?> kB)</span>
</td>
<td align="right" valign="top">
<a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&editFeedback=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid)?>">
<img src="../img/comment.gif" border="0" title="<?php echo dropbox_lang("giveFeedback", "noDLTT"); ?>" alt="" /></a>
<a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteReceived=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid)?>"
onClick='return confirmation("<?php echo htmlentities($w->title, ENT_COMPAT)?>");'>
<img src="../img/delete.gif" border="0" title="<?php echo $langDelete; ?>" alt="" /></a>
</td>
</tr>
<tr><td>
<?php
if ( $w -> author != '') //only show if filled in in DB
{
?> <span class="dropbox_detail"><?php echo dropbox_lang("authors").': '.$w -> author?></span><br>
<?php
}
if ( $w -> description != '')
{
?> <span class="dropbox_detail"><?php echo dropbox_lang("description").': '.$w -> description?></span><br>
<?php
}
?> <span class="dropbox_detail"><?php echo dropbox_lang("sentBy")?> <span class="dropbox_person"><?php echo $w -> uploaderName?></span> <?php echo dropbox_lang("sentOn")?> <span class="dropbox_date"><?php echo $w -> upload_date?></span></span>
<?php
if ($w -> upload_date != $w->last_upload_date)
{
?> <br>
<span class="dropbox_detail"><?php echo dropbox_lang("lastUpdated")?> <span class="dropbox_date"><?php echo $w->last_upload_date?></span></span>
<?php
}
?>
</td>
<td align="right">
<?php
if (($fbtext = $w -> feedback))
{
?> <div class="dropbox_feedback"><?php echo dropbox_lang("sentOn")?> <span class="dropbox_date">
<?php echo htmlspecialchars($w->feedback_date), ':</span><br>',
nl2br(htmlspecialchars($fbtext)); ?>
</div>
<?php
}
?>
</td></tr>
</table>
</td>
</tr>
<?php
$i++;
} //end of foreach
if ( $numberDisplayed == 0)
{ // RH
?>
<tr>
<td align="center"><?php echo get_lang('TheListIsEmpty'); ?>
</td>
</tr>
<?php
}
?>
</table>
<br>
<?php
} // RH: Mailing: end of 'Mailing detail: no received files'
/**
* --------------------------------------
*       SENT FILES LIST: TABLE HEADER
* --------------------------------------
*/
?>
<table cellpadding="5" cellspacing="1" border="0" width="100%">
<tr class="cell_header">
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name="formSent" method="get" action="index.php?<?php echo "origin=$origin"; ?>">
<?php if ($origin=='learnpath') { echo "<input type='hidden' name='origin' value='learnpath' />"; } ?>
<span class="dropbox_listTitle"><?php echo dropbox_lang("orderBy")?></span>
<select name="sentOrder" onchange="javascript: this.form.submit()">
<option value="lastDate" <?php if ($sentOrder=="lastDate") {
echo "selected";
}?>><?php echo dropbox_lang("lastDate")?></option>
<?php if (dropbox_cnf("allowOverwrite")) { ?>
<option value="firstDate" <?php if ($sentOrder=="firstDate") {
echo "selected";
}?>><?php echo dropbox_lang("firstDate")?></option>
<?php } ?>
<option value="title" <?php if ($sentOrder=="title") {
echo "selected";
}?>><?php echo dropbox_lang("title")?></option>
<option value="size" <?php if ($sentOrder=="size") {
echo "selected";
}?>><?php echo dropbox_lang("size")?></option>
<option value="author" <?php if ($sentOrder=="author") {
echo "selected";
}?>><?php echo dropbox_lang("author")?></option>
<option value="recipient" <?php if ($sentOrder=="recipient") {
echo "selected";
}?>><?php echo dropbox_lang("recipient")?></option>
</select>
<noscript><input type="submit" value="OK"/></noscript>
</form>
</td>
<td align="right"><div class="dropbox_listTitle"><?php echo strtoupper( dropbox_lang("sentTitle"))?></div></td>
<td align="right" width="30px">
<!-- Users cannot delete their own sent files
<img src="shim.gif" width="20" height="20" border="0">
-->
<a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteSent=all&dropbox_unid=<?php echo urlencode( $dropbox_unid).$mailingInUrl?>"
onClick="return confirmation('<?php echo addslashes( dropbox_lang("all", "noDLTT"))?>');">
<img src="../img/delete.gif" border="0" title="<?php echo $langDelete; ?>" alt="" /></a>
<!-- -->
</td>
</tr>
</table>
</td>
</tr>
<?php
/**
* --------------------------------------
*       SENT FILES LIST
* --------------------------------------
*/
$i = 0;
// RH: Feedback: UI rearranged, feedback added
foreach ( $dropbox_person -> sentWork as $w)
{
$langSentTo = dropbox_lang("sentTo", "noDLTT") . '&nbsp;'; // RH: Mailing: not for unsent
// RH: Mailing: clickable folder image for detail
if ( $w->recipients[0]['id'] > dropbox_cnf("mailingIdBase"))
{
$ahref = "index.php?".api_get_cidreq()."&origin=$origin&mailing=" . urlencode($w->recipients[0]['id']);
$imgsrc = '../img/folder.gif';
}
else
{
$ahref = "dropbox_download.php?".api_get_cidreq()."&origin=$origin&id=" . urlencode($w->id) . $mailingInUrl;
$imgsrc = '../img/travaux.gif';
}
?>
<tr>
<td valign="top" algin="left" width="25">
<a href="<?php echo $ahref?>">
<img src="<?php echo $imgsrc?>" border="0" alt="" /></a>
</td>
<td valign="top" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<a href="<?php echo $ahref?>">
<?php echo $w -> title?></a> <span class="dropbox_detail">(<?php echo ceil(($w->filesize)/1024)?> kB)</span>
</td>
<td align="right" valign="top">
<?php // RH: Mailing: clickable images for examine and send
if ( $w->recipients[0]['id'] == $_user['user_id'])
{
$langSentTo = dropbox_lang("justUploadInList", "noDLTT") . '&nbsp;'; // RH: justUpload
}
elseif ( $w->recipients[0]['id'] > dropbox_cnf("mailingIdBase"))
{
?>
<a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&mailingIndex=<?php echo urlencode( $i)?>&dropbox_unid=<?php echo urlencode( $dropbox_unid).$mailingInUrl?>">
<img src="../img/checkzip.gif" border="0" title="<?php echo dropbox_lang("mailingExamine", "noDLTT")?>" alt="" /></a>
<?php // RH: Mailing: filesize is set to zero on send, allow no 2nd send!
if ( $w->filesize != 0)
{
$langSentTo = ''; // unsent: do not write 'Sent to'
?>
<a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&mailingIndex=<?php echo urlencode( $i)?>&mailingSend=yes&dropbox_unid=<?php echo urlencode( $dropbox_unid).$mailingInUrl?>"
onClick='return confirmsend();'>
<img src="../img/sendzip.gif" border="0" title="<?php echo dropbox_lang("mailingSend", "noDLTT")?>" alt="" /></a>
<?php // RH: Mailing: end of 'clickable images for examine and send'
}
}
// RH: Feedback
$lastfeedbackdate = ''; $lastfeedbackfrom = '';
foreach ($w -> recipients as $r) if (($fb = $r["feedback"]))
if ($r["feedback_date"] > $lastfeedbackdate)
{
$lastfeedbackdate = $r["feedback_date"]; $lastfeedbackfrom = $r["name"];
}
if ($lastfeedbackdate)
{
?>
<span class="dropbox_feedback" title="<?php echo $lastfeedbackfrom; ?>"><?php echo $lastfeedbackdate; ?></span>
<a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&showFeedback=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid)?>">
<img src="../img/comment.gif" border="0" alt="" title="<?php echo dropbox_lang("showFeedback", "noDLTT"); ?>"/></a>
<?php
}
?>
<a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteSent=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid) . $mailingInUrl?>"
onClick='return confirmation("<?php echo htmlentities($w->title, ENT_COMPAT)?>");'>
<img src="../img/delete.gif" border="0" title="<?php echo $langDelete; ?>" alt="" /></a>
</td>
</tr>
<tr><td>
<?php
if ( $w -> author != '') //only show if filled in in DB
{
?> <span class="dropbox_detail"><?php echo dropbox_lang("authors").': '.$w -> author?></span><br>
<?php
}
if ( $w -> description != '')
{
?> <span class="dropbox_detail"><?php echo dropbox_lang("description").': '.$w -> description?></span><br>
<?php
}
echo '<span class="dropbox_detail">', $langSentTo, '<span class="dropbox_person">';
foreach( $w -> recipients as $r){ echo $r["name"], ', '; }
echo '</span>', dropbox_lang("sentOn"), ' <span class="dropbox_date">', $w -> upload_date, '</span></span>';
if ($w -> upload_date != $w->last_upload_date)
{
?> <br>
<span class="dropbox_detail"><?php echo dropbox_lang("lastResent")?> <span class="dropbox_date"><?php echo $w->last_upload_date?></span></span>
<?php
}
?>
</td>
<td align="right">
<div class="dropbox_feedback">&nbsp;</div>
</td>
</tr>
</table>
</td>
</tr>
<?php
$i++;
} //end of foreach
if (count($dropbox_person -> sentWork)==0)
{
echo "<tr>",
"<td align=\"center\">",get_lang('TheListIsEmpty'),
"</td>",
"</tr>";
}
echo "</table>",
"</td>",
"</tr>",
"</table>";
if ($origin != 'learnpath')
{
//we are not in the learning path tool
Display::display_footer();
}
?>
Loading…
Cancel
Save