index.php 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017
  1. <?php // $Id: index.php,v 1.46 2005/09/26 10:20:25 pcool Exp $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2006 Dokeos S.A.
  6. Copyright (c) 2006 Ghent University (UGent)
  7. Copyright (c) various contributors
  8. For a full list of contributors, see "credits.txt".
  9. The full license can be read in "license.txt".
  10. This program is free software; you can redistribute it and/or
  11. modify it under the terms of the GNU General Public License
  12. as published by the Free Software Foundation; either version 2
  13. of the License, or (at your option) any later version.
  14. See the GNU General Public License for more details.
  15. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  16. Mail: info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. * @desc The dropbox is a personal (peer to peer) file exchange module that allows
  22. * you to send documents to a certain (group of) users.
  23. *
  24. * @version 1.3
  25. *
  26. * @author Jan Bols <jan@ivpv.UGent.be>, main programmer, initial version
  27. * @author René Haentjens <rene.haentjens@UGent.be>, several contributions (see RH)
  28. * @author Roan Embrechts, virtual course support
  29. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (see history version 1.3)
  30. *
  31. * @package dokeos.dropbox
  32. *
  33. * @todo complete refactoring. Currently there are about at least 3 sql queries needed for every individual dropbox document.
  34. * first we find all the documents that were sent (resp. received) by the user
  35. * then for every individual document the user(s)information who received (resp. sent) the document is searched
  36. * then for every individual document the feedback is retrieved
  37. * @todo the implementation of the dropbox categories could (on the database level) have been done more elegantly by storing the category
  38. * in the dropbox_person table because this table stores the relationship between the files (sent OR received) and the users
  39. ==============================================================================
  40. */
  41. /**
  42. ==============================================================================
  43. HISTORY
  44. ==============================================================================
  45. Version 1.1
  46. ------------
  47. - dropbox_init1.inc.php: changed include statements to require statements. This way if a file is not found, it stops the execution of a script instead of continuing with warnings.
  48. - dropbox_init1.inc.php: the include files "claro_init_global.inc.php" & "debug.lib.inc.php" are first checked for their existence before including them. If they don't exist, in the .../include dir, they get loaded from the .../inc dir. This change is necessary because the UCL changed the include dir to inc.
  49. - dropbox_init1.inc.php: the databasetable name in the variable $dropbox_cnf["introTbl"] is chnged from "introduction" to "tool_intro"
  50. - install.php: after submit, checks if the database uses accueil or tool_list as a tablename
  51. - index.php: removed the behaviour of only the teachers that are allowed to delete entries
  52. - index.php: added field "lastUploadDate" in table dropbox_file to store information about last update when resubmiting a file
  53. - dropbox.inc.php: added $lang["lastUpdated"]
  54. - index.php: entries in received list show when file was last updated if it is updated
  55. - index.php: entries in sent list show when file was last resent if it was resent
  56. - dropbox_submit.php: add a unique id to every uploaded file
  57. - index.php: add POST-variable to the upload form with overwrite data when user decides to overwrite the previous sent file with new file
  58. - dropbox_submit.php: add sanity checks on POST['overwrite'] data
  59. - index.php: remove title field in upload form
  60. - dropbox_submit.php: remove use of POST['title'] variable
  61. - dropbox_init1.inc.php: added $dropbox_cnf["version"] variable
  62. - dropbox_class.inc.php: add $this->lastUploadDate to Dropbox_work class
  63. - dropbox.inc.php: added $lang['emptyTable']
  64. - index.php: if the received or sent list is empty, a message is displayed
  65. - dropbox_download.php: the $file var is set equal to the title-field of the filetable. So not constructed anymore by substracting the username from the filename
  66. - index.php: add check to see if column lastUploadDate exists in filetable
  67. - index.php: moved javascripts from dropbox_init2.inc.php to index.php
  68. - index.php: when specifying an uploadfile in the form, a checkbox allowing the user to overwrite a previously sent file is shown when the specified file has the same name as a previously uploaded file of that user.
  69. - index.php: assign all the metadata (author, description, date, recipient, sender) of an entry in a list to the class="dropbox_detail" and add css to html-header
  70. - index.php: assign all dates of entries in list to the class="dropbox_date" and add CSS
  71. - index.php: assign all persons in entries of list to the class="dropbox_person" and add CSS
  72. - dropbox.inc.php: added $lang['dropbox_version'] to indicate the lates version. This must be equal to the $dropbox_cnf['version'] variable.
  73. - dropbox_init1.inc.php: if the newest lang file isn't loaded by claro_init_global.inc.php from the .../lang dir it will be loaded locally from the .../plugin/dropbox/ dir. This way an administrator must not install the dropbox.inc.php in the .../lang/english dir, but he can leave it in the local .../plugin/dropbox/ dir. However if you want to present multiple language translations of the file you must still put the file in the /lang/ dir, because there is no language management system inside the .../plugin/dropbox dir.
  74. - mime.inc.php: created this file. It contains an array $mimetype with all the mimetypes that are used by dropbox_download.php to give hinst to the browser during download about content
  75. - dropbox_download.php: remove https specific headers because they're not necessary
  76. - dropbox_download.php: use application/octet-stream as the default mime and inline as the default Content-Disposition
  77. - dropbox.inc.php: add lang vars for "order by" action
  78. - dropbox_class.inc.php: add methods orderSentWork, orderReceivedWork en _cmpWork and propery _orderBy to class Dropbox_person to take care of sorting
  79. - index.php: add selectionlist to headers of sent/received lists to select "order by" and add code to keep selected value in sessionvar.
  80. - index.php: moved part of a <a> hyperlink to previous line to remove the underlined space between symbol and title of a work entry in the sent/received list
  81. - index.php: add filesize info in sent/received lists
  82. - dropbox_submit.php: resubmit prevention only for GET action, because it gives some annoying behaviour in POST situation: white screen in IE6
  83. Version 1.2
  84. -----------
  85. - adapted entire dropbox tool so it can be used as a default tool in Dokeos 1.5
  86. - index.php: add event registration to log use of tool in stats tables
  87. - index.php: upload form checks for correct user selection and file specification before uploading the script
  88. - dropbox_init1.inc.php: added dropbox_cnf["allowOverwrite"] to allow or disallow overwriting of files
  89. - index.php: author name textbox is automatically filled in
  90. - mailing functionality (see RH comments in code)
  91. - allowStudentToStudent and allowJustUpload options (id.)
  92. - help in separate window (id.)
  93. Version 1.3 (Patrick Cool)
  94. --------------------------
  95. - sortable table
  96. - categories
  97. - fixing a security hole
  98. - tabs (which can be disabled: see $dropbox_cnf['sent_received_tabs'])
  99. - same action on multiple documents ([zip]download, move, delete)
  100. - consistency with the docuements tool (open/download file, icons of documents, ...)
  101. - zip download of complete folder
  102. ==============================================================================
  103. */
  104. /*
  105. ==============================================================================
  106. INIT SECTION
  107. ==============================================================================
  108. */
  109. // the file that contains all the initialisation stuff (and includes all the configuration stuff)
  110. require_once( "dropbox_init.inc.php");
  111. // get the last time the user accessed the tool
  112. if ($_SESSION['last_access'][$_course['id']][TOOL_DROPBOX]=='')
  113. {
  114. $last_access=get_last_tool_access(TOOL_DROPBOX,$_course['code'],$_user['user_id']);
  115. $_SESSION['last_access'][$_course['id']][TOOL_DROPBOX]=$last_access;
  116. }
  117. else
  118. {
  119. $last_access=$_SESSION['last_access'][$_course['id']][TOOL_DROPBOX];
  120. }
  121. // do the tracking
  122. event_access_tool(TOOL_DROPBOX);
  123. //this var is used to give a unique value to every page request. This is to prevent resubmiting data
  124. $dropbox_unid = md5( uniqid( rand( ), true));
  125. /*
  126. ==============================================================================
  127. DISPLAY SECTION
  128. ==============================================================================
  129. */
  130. // Tool introduction text
  131. Display::display_introduction_section(TOOL_DROPBOX);
  132. /*
  133. -----------------------------------------------------------
  134. ACTIONS: add a dropbox file, add a dropbox category.
  135. -----------------------------------------------------------
  136. */
  137. // *** display the form for adding a new dropbox item. ***
  138. if ($_GET['action']=="add")
  139. {
  140. display_add_form();
  141. }
  142. if ($_POST['submitWork'])
  143. {
  144. Display :: display_normal_message(store_add_dropbox());
  145. //include_once('dropbox_submit.php');
  146. }
  147. // *** display the form for adding a category ***
  148. if ($_GET['action']=="addreceivedcategory" or $_GET['action']=="addsentcategory")
  149. {
  150. display_addcategory_form($_POST['category_name']);
  151. }
  152. // *** editing a category: displaying the form ***
  153. if ($_GET['action']=='editcategory' and isset($_GET['id']))
  154. {
  155. if (!$_POST)
  156. {
  157. display_addcategory_form('',$_GET['id']);
  158. }
  159. }
  160. // *** storing a new or edited category ***
  161. if ($_POST['StoreCategory'])
  162. {
  163. Display :: display_normal_message(store_addcategory());
  164. }
  165. // *** Move a File ***
  166. if (($_GET['action']=='movesent' OR $_GET['action']=='movereceived') AND isset($_GET['move_id']))
  167. {
  168. display_move_form(str_replace('move','',$_GET['action']), $_GET['move_id'], get_dropbox_categories(str_replace('move','',$_GET['action'])));
  169. }
  170. if ($_POST['do_move'])
  171. {
  172. Display :: display_normal_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part']));
  173. }
  174. // *** Delete a file ***
  175. if (($_GET['action']=='deletereceivedfile' OR $_GET['action']=='deletesentfile') AND isset($_GET['id']) AND is_numeric($_GET['id']))
  176. {
  177. $dropboxfile=new Dropbox_Person( $_user['user_id'], $is_courseAdmin, $is_courseTutor);
  178. if ($_GET['action']=='deletereceivedfile')
  179. {
  180. $dropboxfile->deleteReceivedWork($_GET['id']);
  181. $message=get_lang('ReceivedFileDeleted');
  182. }
  183. if ($_GET['action']=='deletesentfile')
  184. {
  185. $dropboxfile->deleteSentWork($_GET['id']);
  186. $message=get_lang('SentFileDeleted');
  187. }
  188. Display :: display_normal_message($message);
  189. }
  190. // *** Delete a category ***
  191. if (($_GET['action']=='deletereceivedcategory' OR $_GET['action']=='deletesentcategory') AND isset($_GET['id']) AND is_numeric($_GET['id']))
  192. {
  193. $message=delete_category($_GET['action'], $_GET['id']);
  194. }
  195. // *** Do an action on multiple files ***
  196. // only the download has is handled separately in dropbox_init_inc.php because this has to be done before the headers are sent
  197. // (which also happens in dropbox_init.inc.php
  198. if ($_POST['do_actions_received'] OR $_POST['do_actions_sent'])
  199. {
  200. $display_message=handle_multiple_actions();
  201. Display :: display_normal_message($display_message);
  202. }
  203. // *** Store Feedback ***
  204. if ($_POST['store_feedback'])
  205. {
  206. $display_message = store_feedback();
  207. Display :: display_normal_message($display_message);
  208. }
  209. // *** Error Message ***
  210. if (isset($_GET['error']) AND !empty($_GET['error']))
  211. {
  212. Display :: display_normal_message(get_lang($_GET['error']));
  213. }
  214. // getting all the categories in the dropbox for the given user
  215. $dropbox_categories=get_dropbox_categories();
  216. // creating the arrays with the categories for the received files and for the sent files
  217. foreach ($dropbox_categories as $category)
  218. {
  219. if ($category['received']=='1')
  220. {
  221. $dropbox_received_category[]=$category;
  222. }
  223. if ($category['sent']=='1')
  224. {
  225. $dropbox_sent_category[]=$category;
  226. }
  227. }
  228. /*
  229. -----------------------------------------------------------
  230. THE MENU TABS
  231. -----------------------------------------------------------
  232. */
  233. if ($dropbox_cnf['sent_received_tabs'])
  234. {
  235. ?>
  236. <div id="tabbed_menu">
  237. <ul id="tabbed_menu_tabs">
  238. <li><a href="index.php?view=received" <?php if (!$_GET['view'] OR $_GET['view']=='received'){echo 'class="active"';}?> ><?php echo get_lang('ReceivedFiles'); ?></a></li>
  239. <li><a href="index.php?view=sent" <?php if ($_GET['view']=='sent'){echo 'class="active"';}?>><?php echo get_lang('SentFiles'); ?></a></li>
  240. </ul>
  241. </div>
  242. <?php
  243. }
  244. /*
  245. -----------------------------------------------------------
  246. RECEIVED FILES
  247. -----------------------------------------------------------
  248. */
  249. if (!$_GET['view'] OR $_GET['view']=='received' OR $dropbox_cnf['sent_received_tabs']==false)
  250. {
  251. //echo '<h3>'.get_lang('ReceivedFiles').'</h3>';
  252. // This is for the categories
  253. if (isset($_GET['view_received_category']) AND $_GET['view_received_category']<>'')
  254. {
  255. $view_dropbox_category_received=$_GET['view_received_category'];
  256. }
  257. else
  258. {
  259. $view_dropbox_category_received=0;
  260. }
  261. /* *** Menu Received *** */
  262. if ($view_dropbox_category_received<>0)
  263. {
  264. echo get_lang('CurrentlySeeing').': <strong>'.$dropbox_categories[$view_dropbox_category_received]['cat_name'].'</strong><br />';
  265. echo '<img src="../img/folder_up.gif" alt="'.get_lang('up').'" align="absmiddle" /><a href="'.$_SERVER['PHP_SELF'].'?view_received_category=0&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'">'.get_lang('Root')."</a>\n";
  266. }
  267. echo "<a href=\"".$_SERVER['PHP_SELF']."?action=addreceivedcategory\"><img src=\"../img/folder_new.gif\" alt=\"".get_lang('NewFolder')."\" align=\"absmiddle\"/> ".get_lang('AddNewCategory')."</a>\n";
  268. echo '<form name="recieved_files" method="post" action="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action='.$_GET['action'].'&amp;id='.$_GET['id'].'">';
  269. // object initialisation
  270. $dropbox_person = new Dropbox_Person( $_user['user_id'], $is_courseAdmin, $is_courseTutor); // note: are the $is_courseAdmin and $is_courseTutor parameters needed????
  271. // constructing the array that contains the total number of feedback messages per document.
  272. $number_feedback=get_total_number_feedback();
  273. // sorting and paging options
  274. $sorting_options = array();
  275. $paging_options = array();
  276. // the headers of the sortable tables
  277. $column_header=array();
  278. $column_header[] = array('',false,'');
  279. $column_header[] = array(get_lang('Type'),true,'style="width:40px"');
  280. $column_header[] = array(get_lang('ReceivedTitle'), TRUE, '');
  281. $column_header[] = array(get_lang('Authors'), TRUE, '');
  282. $column_header[] = array(get_lang('Description'), TRUE, '');
  283. $column_header[] = array(get_lang('Size'), TRUE, '');
  284. $column_header[] = array(get_lang('LastResent'), TRUE, '');
  285. $column_header[] = array(get_lang('Modify'), FALSE, '', 'nowrap style="text-align: right"');
  286. // the content of the sortable table = the received files
  287. foreach ( $dropbox_person -> receivedWork as $dropbox_file)
  288. {
  289. //echo '<pre>';
  290. //print_r($dropbox_file);
  291. //echo '</pre>';
  292. $dropbox_file_data=array();
  293. if ($view_dropbox_category_received==$dropbox_file->category) // we only display the files that are in the category that we are in.
  294. {
  295. $dropbox_file_data[]=display_file_checkbox($dropbox_file->id, 'received');
  296. // new icon
  297. if ($dropbox_file->last_upload_date > $last_access AND !in_array($dropbox_file->id,$_SESSION['_seen'][$_course['id']][TOOL_DROPBOX]))
  298. {
  299. $new_icon='<img src="../img/new.gif" align="absmiddle alt="'.get_lang('New').'" />';
  300. }
  301. else
  302. {
  303. $new_icon='';
  304. }
  305. $dropbox_file_data[]=build_document_icon_tag('file',$dropbox_file->title).$new_icon;
  306. $dropbox_file_data[]='<a href="dropbox_download.php?id='.$dropbox_file->id.'&amp;action=download"><img src="../img/filesave.gif" style="float:right;" alt="'.get_lang('Save').'"/></a><a href="dropbox_download.php?id='.$dropbox_file->id.'">'.$dropbox_file->title.'</a>';
  307. $dropbox_file_data[]=$dropbox_file->author;
  308. $dropbox_file_data[]=$dropbox_file->description;
  309. $dropbox_file_data[]=ceil(($dropbox_file->filesize)/1024).' '.get_lang('kB');
  310. $dropbox_file_data[]=$dropbox_file->last_upload_date;
  311. $action_icons=check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
  312. <a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=viewfeedback&amp;id='.$dropbox_file->id.'"><img src="../img/comment_bubble.gif" alt="'.get_lang('Comment').'" align="absmiddle" /></a>
  313. <a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=movereceived&amp;move_id='.$dropbox_file->id.'"><img src="../img/deplacer_fichier.gif" alt="'.get_lang('Move').'" align="absmiddle"/></a>
  314. <a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletereceivedfile&amp;id='.$dropbox_file->id.'" onclick="return confirmation(\''.$dropbox_file->title.'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" align="absmiddle" /></a>';
  315. //$action_icons=' <a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;action=movereceived&amp;move_id='.$dropbox_file->id.'"><img src="../img/deplacer.gif" alt="'.get_lang('Move').'"/></a>
  316. // <a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;action=deletereceivedfile&amp;id='.$dropbox_file->id.'" onclick="return confirmation(\''.$dropbox_file->title.'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'"/></a>';
  317. // this is a hack to have an additional row in a sortable table
  318. if($_GET['action']=='viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id==$_GET['id'])
  319. {
  320. $action_icons.="</td></tr>\n"; // ending the normal row of the sortable table
  321. $action_icons.="<tr>\n\t<td colspan=\"2\"><a href=\"index.php?view_received_category=".$_GET['view_received_category']."&amp;view_sent_category=".$_GET['view_sent_category']."&amp;view=".$_GET['view']."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td>\n</tr>\n";
  322. }
  323. $dropbox_file_data[]=$action_icons;
  324. $action_icons='';
  325. $dropbox_data_recieved[]=$dropbox_file_data;
  326. }
  327. }
  328. // the content of the sortable table = the categories (if we are not in the root)
  329. if ($view_dropbox_category_received==0)
  330. {
  331. foreach ($dropbox_categories as $category) // note: this can probably be shortened since the categories for the received files are already in the $dropbox_received_category array;
  332. {
  333. $dropbox_category_data=array();
  334. if ($category['received']=='1')
  335. {
  336. $dropbox_category_data[]=''; // this is where the checkbox icon for the files appear
  337. // the icon of the category
  338. $dropbox_category_data[]=build_document_icon_tag('folder',$category['cat_name']);
  339. $dropbox_category_data[]='<a href="dropbox_download.php?cat_id='.$category['cat_id'].'&amp;action=downloadcategory&amp;sent_received=received"><img width="16" height="16" src="../img/folder_zip.gif" style="float:right;" alt="'.get_lang('Save').'"/></a><a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$category['cat_id'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'">'.$category['cat_name'].'</a>';
  340. $dropbox_category_data[]='';
  341. $dropbox_category_data[]='';
  342. $dropbox_category_data[]='';
  343. $dropbox_category_data[]='';
  344. $dropbox_category_data[]='<a href="'.$_SERVER['PHP_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>
  345. <a href="'.$_SERVER['PHP_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>';
  346. }
  347. if (is_array($dropbox_category_data))
  348. {
  349. $dropbox_data_recieved[]=$dropbox_category_data;
  350. }
  351. }
  352. }
  353. // Displaying the table
  354. $additional_get_parameters=array('view'=>$_GET['view'], 'view_received_category'=>$_GET['view_received_category'],'view_sent_category'=>$_GET['view_sent_category']);
  355. Display::display_sortable_table($column_header, $dropbox_data_recieved, $sorting_options, $paging_options, $additional_get_parameters);
  356. if (empty($dropbox_data_recieved))
  357. {
  358. //echo get_lang('NoFilesHere');
  359. }
  360. else
  361. {
  362. echo '<a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;selectall">'.get_lang('SelectAll').'</a> - ';
  363. echo '<a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'">'.get_lang('UnSelectAll').'</a> ';
  364. echo get_lang('WithSelected').': ';
  365. display_action_options('received',$dropbox_received_category, $view_dropbox_category_received);
  366. }
  367. echo '</form>';
  368. }
  369. /*
  370. -----------------------------------------------------------
  371. SENT FILES
  372. -----------------------------------------------------------
  373. */
  374. if ($_GET['view']=='sent' OR $dropbox_cnf['sent_received_tabs']==false)
  375. {
  376. //echo '<h3>'.get_lang('SentFiles').'</h3>';
  377. // This is for the categories
  378. if (isset($_GET['view_sent_category']) AND $_GET['view_sent_category']<>'')
  379. {
  380. $view_dropbox_category_sent=$_GET['view_sent_category'];
  381. }
  382. else
  383. {
  384. $view_dropbox_category_sent=0;
  385. }
  386. /* *** Menu Sent *** */
  387. if ($view_dropbox_category_sent<>0)
  388. {
  389. echo get_lang('CurrentlySeeing').': <strong>'.$dropbox_categories[$view_dropbox_category_sent]['cat_name'].'</strong><br />';
  390. echo '<img src="../img/folder_up.gif" alt="'.get_lang('Up').'" align="absmiddle" /><a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category=0&amp;view='.$_GET['view'].'">'.get_lang('Root')."</a>\n";
  391. }
  392. echo "<a href=\"".$_SERVER['PHP_SELF']."?view=".$_GET['view']."&amp;action=add\"><img src=\"../img/submit_file.gif\" alt=\"".get_lang('Upload')."\" align=\"absmiddle\"/> ".get_lang('UploadNewFile')."</a>&nbsp;\n";
  393. echo "<a href=\"".$_SERVER['PHP_SELF']."?view=".$_GET['view']."&amp;action=addsentcategory\"><img src=\"../img/folder_new.gif\" alt=\"".get_lang('NewFolder')."\" align=\"absmiddle\" /> ".get_lang('AddNewCategory')."</a>\n";
  394. //echo '<form name="sent_files" method="post" action="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'">';
  395. echo '<form name="recieved_files" method="post" action="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action='.$_GET['action'].'&amp;id='.$_GET['id'].'">';
  396. // object initialisation
  397. $dropbox_person = new Dropbox_Person( $_user['user_id'], $is_courseAdmin, $is_courseTutor);
  398. // constructing the array that contains the total number of feedback messages per document.
  399. $number_feedback=get_total_number_feedback();
  400. // sorting and paging options
  401. $sorting_options = array();
  402. $paging_options = array();
  403. // the headers of the sortable tables
  404. $column_header=array();
  405. $column_header[] = array('',false,'');
  406. $column_header[] = array(get_lang('Type'),true,'style="width:40px"','style="text-align:center"');
  407. $column_header[] = array(get_lang('SentTitle'), TRUE, '');
  408. $column_header[] = array(get_lang('Authors'), TRUE, '');
  409. $column_header[] = array(get_lang('Description'), TRUE, '');
  410. $column_header[] = array(get_lang('Size'), TRUE, '');
  411. $column_header[] = array(get_lang('LastResent'), TRUE, '');
  412. $column_header[] = array(get_lang('SentTo'), TRUE, '');
  413. $column_header[] = array(get_lang('Modify'), FALSE, '', 'nowrap style="text-align: right"');
  414. // the content of the sortable table = the received files
  415. foreach ( $dropbox_person -> sentWork as $dropbox_file)
  416. {
  417. /*echo '<pre>';
  418. print_r($dropbox_file);
  419. echo '</pre>'; */
  420. $dropbox_file_data=array();
  421. if ($view_dropbox_category_sent==$dropbox_file->category)
  422. {
  423. $dropbox_file_data[]=display_file_checkbox($dropbox_file->id, 'sent'); ;
  424. $dropbox_file_data[]=build_document_icon_tag('file',$dropbox_file->title);
  425. $dropbox_file_data[]='<a href="dropbox_download.php?id='.$dropbox_file->id.'&amp;action=download"><img src="../img/filesave.gif" style="float:right;" alt="'.get_lang('Save').'" /></a><a href="dropbox_download.php?id='.$dropbox_file->id.'">'.$dropbox_file->title.'</a>';
  426. $dropbox_file_data[]=$dropbox_file->author;
  427. $dropbox_file_data[]=$dropbox_file->description;
  428. $dropbox_file_data[]=ceil(($dropbox_file->filesize)/1024).' '.get_lang('kB');
  429. $dropbox_file_data[]=$dropbox_file->last_upload_date;
  430. foreach ($dropbox_file->recipients as $recipient)
  431. {
  432. $receivers_celldata=display_user_link($recipient['user_id'], $recipient['name']).', '.$receivers_celldata;
  433. }
  434. $dropbox_file_data[]=$receivers_celldata;
  435. $receivers_celldata='';
  436. $action_icons=check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
  437. <a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=viewfeedback&amp;id='.$dropbox_file->id.'"><img src="../img/comment_bubble.gif" alt="'.get_lang('Comment').'" align="absmiddle" /></a>
  438. <a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=movesent&amp;move_id='.$dropbox_file->id.'"><img src="../img/deplacer_fichier.gif" alt="'.get_lang('Move').'" align="absmiddle"/></a>
  439. <a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletesentfile&amp;id='.$dropbox_file->id.'" onclick="return confirmation(\''.$dropbox_file->title.'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" align="absmiddle" /></a>';
  440. // this is a hack to have an additional row in a sortable table
  441. if($_GET['action']=='viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id==$_GET['id'])
  442. {
  443. $action_icons.="</td></tr>\n"; // ending the normal row of the sortable table
  444. $action_icons.="<tr>\n\t<td colspan=\"2\"><a href=\"index.php?view_received_category=".$_GET['view_received_category']."&amp;view_sent_category=".$_GET['view_sent_category']."&amp;view=".$_GET['view']."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td>\n</tr>\n";
  445. }
  446. $dropbox_file_data[]=$action_icons;
  447. $action_icons='';
  448. $dropbox_data_sent[]=$dropbox_file_data;
  449. //echo '<pre>';
  450. //print_r($dropbox_data_sent);
  451. //echo '</pre>';
  452. }
  453. }
  454. // the content of the sortable table = the categories (if we are not in the root)
  455. if ($view_dropbox_category_sent==0)
  456. {
  457. foreach ($dropbox_categories as $category)
  458. {
  459. $dropbox_category_data=array();
  460. if ($category['sent']=='1')
  461. {
  462. $dropbox_category_data[]=''; // this is where the checkbox icon for the files appear
  463. $dropbox_category_data[]=build_document_icon_tag('folder',$category['cat_name']);
  464. $dropbox_category_data[]='<a href="dropbox_download.php?cat_id='.$category['cat_id'].'&amp;action=downloadcategory&amp;sent_received=sent"><img width="16" height="16" src="../img/folder_zip.gif" style="float:right;" alt="'.get_lang('Save').'" /></a><a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$category['cat_id'].'&amp;view='.$_GET['view'].'">'.$category['cat_name'].'</a>';
  465. $dropbox_category_data[]='';
  466. $dropbox_category_data[]='';
  467. $dropbox_category_data[]='';
  468. $dropbox_category_data[]='';
  469. $dropbox_category_data[]='';
  470. $dropbox_category_data[]='<a href="'.$_SERVER['PHP_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>
  471. <a href="'.$_SERVER['PHP_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>';
  472. }
  473. if (is_array($dropbox_category_data))
  474. {
  475. $dropbox_data_sent[]=$dropbox_category_data;
  476. }
  477. }
  478. }
  479. // Displaying the table
  480. $additional_get_parameters=array('view'=>$_GET['view'], 'view_received_category'=>$_GET['view_received_category'],'view_sent_category'=>$_GET['view_sent_category']);
  481. Display::display_sortable_table($column_header, $dropbox_data_sent, $sorting_options, $paging_options, $additional_get_parameters);
  482. if (empty($dropbox_data_sent))
  483. {
  484. //echo get_lang('NoFilesHere');
  485. }
  486. else
  487. {
  488. echo '<a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;selectall">'.get_lang('SelectAll').'</a> - ';
  489. echo '<a href="'.$_SERVER['PHP_SELF'].'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'">'.get_lang('UnSelectAll').'</a> ';
  490. echo get_lang('WithSelected').': ';
  491. display_action_options('sent',$dropbox_sent_category, $view_dropbox_category_sent);
  492. }
  493. echo '</form>';
  494. }
  495. Display::display_footer();
  496. exit;
  497. if ( $_GET['mailing']) // RH: Mailing detail window passes parameter
  498. {
  499. getUserOwningThisMailing($_GET['mailing'], $_user['user_id'], '304'); // RH or die
  500. $dropbox_person = new Dropbox_Person( $_GET['mailing'], $is_courseAdmin, $is_courseTutor);
  501. $mailingInUrl = "&mailing=" . urlencode( $_GET['mailing']);
  502. }
  503. else
  504. {
  505. $mailingInUrl = "";
  506. }
  507. $dropbox_person->orderReceivedWork ($receivedOrder);
  508. if( isset($_GET['dropbox_user_filter']) && $_GET['dropbox_user_filter'] != -1)
  509. {
  510. $dropbox_person->filter_received_work('uploader_id',$_GET['dropbox_user_filter']);
  511. }
  512. $dropbox_person->orderSentWork ($sentOrder);
  513. if (isset($_POST["feedbackid"]) && isset($_POST["feedbacktext"])) // RH: Feedback
  514. {
  515. $dropbox_person->updateFeedback ($_POST["feedbackid"], get_magic_quotes_gpc() ?
  516. stripslashes($_POST["feedbacktext"]) : $_POST["feedbacktext"]);
  517. }
  518. /*
  519. ==============================================================================
  520. FORM UPLOAD FILE
  521. ==============================================================================
  522. */
  523. if ( $_GET['mailing']) // RH: Mailing detail: no form upload
  524. {
  525. echo "<h3>", htmlspecialchars( getUserNameFromId ( $_GET['mailing'])), "</h3>";
  526. echo "<a href='index.php?".api_get_cidreq()."&origin=$origin'>".dropbox_lang("mailingBackToDropbox").'</a><br><br>';
  527. }
  528. else
  529. {
  530. } // RH: Mailing: end of 'Mailing detail: no form upload'
  531. /*
  532. ==============================================================================
  533. FILES LIST
  534. ==============================================================================
  535. */
  536. echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">",
  537. "<tr>",
  538. "<td valign=\"top\" align=\"center\">";
  539. /*
  540. -----------------------------------------------------------
  541. RECEIVED FILES LIST: TABLE HEADER
  542. -----------------------------------------------------------
  543. */
  544. if ( !$_GET['mailing']) // RH: Mailing detail: no received files
  545. {
  546. ?>
  547. <table cellpadding="5" cellspacing="1" border="0" width="100%">
  548. <!--This is no longer neede because of sortable table -->
  549. <tr class="cell_header">
  550. <td colspan="2">
  551. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  552. <tr>
  553. <td>
  554. <form name="formReceived" method="get" action="index.php?<?php echo "origin=$origin"; ?>">
  555. <span class="dropbox_listTitle"><?php echo dropbox_lang("orderBy")?></span>
  556. <?php if ($origin=='learnpath') { echo "<input type='hidden' name='origin' value='learnpath'>"; } ?>
  557. <select name="receivedOrder" onchange="javascript: this.form.submit()">
  558. <option value="lastDate" <?php if ($receivedOrder=="lastDate") {
  559. echo "selected";
  560. }?>><?php echo dropbox_lang("lastDate")?></option>
  561. <?php if (dropbox_cnf("allowOverwrite")) { ?>
  562. <option value="firstDate" <?php if ($receivedOrder=="firstDate") {
  563. echo "selected";
  564. }?>><?php echo dropbox_lang("firstDate")?></option>
  565. <?php } ?>
  566. <option value="title" <?php if ($receivedOrder=="title") {
  567. echo "selected";
  568. }?>><?php echo dropbox_lang("title")?></option>
  569. <option value="size" <?php if ($receivedOrder=="size") {
  570. echo "selected";
  571. }?>><?php echo dropbox_lang("size")?></option>
  572. <option value="author" <?php if ($receivedOrder=="author") {
  573. echo "selected";
  574. }?>><?php echo dropbox_lang("author")?></option>
  575. <option value="sender" <?php if ($receivedOrder=="sender") {
  576. echo "selected";
  577. }?>><?php echo dropbox_lang("sender")?></option>
  578. </select>
  579. <span class="dropbox_listTitle"><?php echo dropbox_lang('sentBy'); ?></span>
  580. <select name="dropbox_user_filter" onchange="javascript: this.form.submit()">
  581. <option value="-1"><?php echo get_lang('All'); ?></option>
  582. <?php
  583. foreach ($complete_user_list_for_dropbox as $current_user)
  584. {
  585. $full_name = $current_user['lastcommafirst'];
  586. echo '<option value="' . $current_user['user_id'] . '"'.($_GET['dropbox_user_filter'] == $current_user['user_id'] ? 'selected="selected"' : '').'>' . $full_name . '</option>';
  587. }
  588. ?>
  589. </select>
  590. <noscript><input type="submit" value="OK"/></noscript>
  591. </form>
  592. </td>
  593. <td align="right"><div class="dropbox_listTitle"><?php echo strtoupper( dropbox_lang("receivedTitle"))?></div></td>
  594. <td align="right" width="30px">
  595. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteReceived=all&dropbox_unid=<?php echo urlencode( $dropbox_unid)?>"
  596. onClick="return confirmation('<?php echo addslashes( dropbox_lang("all", "noDLTT"))?>');">
  597. <img src="../img/delete.gif" border="0" title="<?php echo get_lang("Delete"); ?>" alt="" /></a>
  598. <?php if ($origin=='learnpath') { echo "<input type='hidden' name='origin' value='learnpath' />"; } ?>
  599. </td>
  600. </tr>
  601. </table>
  602. </td>
  603. </tr>
  604. <?php
  605. /*
  606. -----------------------------------------------------------
  607. RECEIVED FILES LIST
  608. -----------------------------------------------------------
  609. */
  610. $numberDisplayed = count($dropbox_person -> receivedWork); // RH
  611. $i = 0;
  612. // RH: Feedback: pencil for Give/Edit Feedback, UI rearranged, feedback added
  613. foreach ( $dropbox_person -> receivedWork as $w)
  614. {
  615. if ( $w -> uploader_id == $_user['user_id']) // RH: justUpload
  616. {
  617. $numberDisplayed -= 1; continue;
  618. }
  619. ?>
  620. <tr>
  621. <td valign="top" algin="left" width="25">
  622. <a href="dropbox_download.php?<?php echo api_get_cidreq()."&origin=$origin"; ?>&id=<?php echo urlencode($w->id)?>">
  623. <img src="../img/travaux.gif" border="0" alt="" /></a>
  624. </td>
  625. <td valign="top" align="left">
  626. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  627. <tr>
  628. <td valign="top">
  629. <a href="dropbox_download.php?<?php echo api_get_cidreq()."&origin=$origin"; ?>&id=<?php echo urlencode($w->id)?>">
  630. <?php echo $w -> title?></a> <span class="dropbox_detail">(<?php echo ceil(($w->filesize)/1024)?> kB)</span>
  631. </td>
  632. <td align="right" valign="top">
  633. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&editFeedback=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid)?>">
  634. <img src="../img/comment.gif" border="0" title="<?php echo dropbox_lang("giveFeedback", "noDLTT"); ?>" alt="" /></a>
  635. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteReceived=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid)?>"
  636. onClick='return confirmation("<?php echo htmlentities($w->title, ENT_COMPAT)?>");'>
  637. <img src="../img/delete.gif" border="0" title="<?php echo $langDelete; ?>" alt="" /></a>
  638. </td>
  639. </tr>
  640. <tr><td>
  641. <?php
  642. if ( $w -> author != '') //only show if filled in in DB
  643. {
  644. ?> <span class="dropbox_detail"><?php echo dropbox_lang("authors").': '.$w -> author?></span><br>
  645. <?php
  646. }
  647. if ( $w -> description != '')
  648. {
  649. ?> <span class="dropbox_detail"><?php echo dropbox_lang("description").': '.$w -> description?></span><br>
  650. <?php
  651. }
  652. ?> <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>
  653. <?php
  654. if ($w -> upload_date != $w->last_upload_date)
  655. {
  656. ?> <br>
  657. <span class="dropbox_detail"><?php echo dropbox_lang("lastUpdated")?> <span class="dropbox_date"><?php echo $w->last_upload_date?></span></span>
  658. <?php
  659. }
  660. ?>
  661. </td>
  662. <td align="right">
  663. <?php
  664. if (($fbtext = $w -> feedback))
  665. {
  666. ?> <div class="dropbox_feedback"><?php echo dropbox_lang("sentOn")?> <span class="dropbox_date">
  667. <?php echo htmlspecialchars($w->feedback_date), ':</span><br>',
  668. nl2br(htmlspecialchars($fbtext)); ?>
  669. </div>
  670. <?php
  671. }
  672. ?>
  673. </td></tr>
  674. </table>
  675. </td>
  676. </tr>
  677. <?php
  678. $i++;
  679. } //end of foreach
  680. if ( $numberDisplayed == 0)
  681. { // RH
  682. ?>
  683. <tr>
  684. <td align="center"><?php echo get_lang('TheListIsEmpty'); ?>
  685. </td>
  686. </tr>
  687. <?php
  688. }
  689. ?>
  690. </table>
  691. <br>
  692. <?php
  693. } // RH: Mailing: end of 'Mailing detail: no received files'
  694. /**
  695. * --------------------------------------
  696. *       SENT FILES LIST: TABLE HEADER
  697. * --------------------------------------
  698. */
  699. ?>
  700. <table cellpadding="5" cellspacing="1" border="0" width="100%">
  701. <tr class="cell_header">
  702. <td colspan="2">
  703. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  704. <tr>
  705. <td>
  706. <form name="formSent" method="get" action="index.php?<?php echo "origin=$origin"; ?>">
  707. <?php if ($origin=='learnpath') { echo "<input type='hidden' name='origin' value='learnpath' />"; } ?>
  708. <span class="dropbox_listTitle"><?php echo dropbox_lang("orderBy")?></span>
  709. <select name="sentOrder" onchange="javascript: this.form.submit()">
  710. <option value="lastDate" <?php if ($sentOrder=="lastDate") {
  711. echo "selected";
  712. }?>><?php echo dropbox_lang("lastDate")?></option>
  713. <?php if (dropbox_cnf("allowOverwrite")) { ?>
  714. <option value="firstDate" <?php if ($sentOrder=="firstDate") {
  715. echo "selected";
  716. }?>><?php echo dropbox_lang("firstDate")?></option>
  717. <?php } ?>
  718. <option value="title" <?php if ($sentOrder=="title") {
  719. echo "selected";
  720. }?>><?php echo dropbox_lang("title")?></option>
  721. <option value="size" <?php if ($sentOrder=="size") {
  722. echo "selected";
  723. }?>><?php echo dropbox_lang("size")?></option>
  724. <option value="author" <?php if ($sentOrder=="author") {
  725. echo "selected";
  726. }?>><?php echo dropbox_lang("author")?></option>
  727. <option value="recipient" <?php if ($sentOrder=="recipient") {
  728. echo "selected";
  729. }?>><?php echo dropbox_lang("recipient")?></option>
  730. </select>
  731. <noscript><input type="submit" value="OK"/></noscript>
  732. </form>
  733. </td>
  734. <td align="right"><div class="dropbox_listTitle"><?php echo strtoupper( dropbox_lang("sentTitle"))?></div></td>
  735. <td align="right" width="30px">
  736. <!-- Users cannot delete their own sent files
  737. <img src="shim.gif" width="20" height="20" border="0">
  738. -->
  739. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteSent=all&dropbox_unid=<?php echo urlencode( $dropbox_unid).$mailingInUrl?>"
  740. onClick="return confirmation('<?php echo addslashes( dropbox_lang("all", "noDLTT"))?>');">
  741. <img src="../img/delete.gif" border="0" title="<?php echo $langDelete; ?>" alt="" /></a>
  742. <!-- -->
  743. </td>
  744. </tr>
  745. </table>
  746. </td>
  747. </tr>
  748. <?php
  749. /**
  750. * --------------------------------------
  751. *       SENT FILES LIST
  752. * --------------------------------------
  753. */
  754. $i = 0;
  755. // RH: Feedback: UI rearranged, feedback added
  756. foreach ( $dropbox_person -> sentWork as $w)
  757. {
  758. $langSentTo = dropbox_lang("sentTo", "noDLTT") . '&nbsp;'; // RH: Mailing: not for unsent
  759. // RH: Mailing: clickable folder image for detail
  760. if ( $w->recipients[0]['id'] > dropbox_cnf("mailingIdBase"))
  761. {
  762. $ahref = "index.php?".api_get_cidreq()."&origin=$origin&mailing=" . urlencode($w->recipients[0]['id']);
  763. $imgsrc = '../img/folder.gif';
  764. }
  765. else
  766. {
  767. $ahref = "dropbox_download.php?".api_get_cidreq()."&origin=$origin&id=" . urlencode($w->id) . $mailingInUrl;
  768. $imgsrc = '../img/travaux.gif';
  769. }
  770. ?>
  771. <tr>
  772. <td valign="top" algin="left" width="25">
  773. <a href="<?php echo $ahref?>">
  774. <img src="<?php echo $imgsrc?>" border="0" alt="" /></a>
  775. </td>
  776. <td valign="top" align="left">
  777. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  778. <tr>
  779. <td valign="top">
  780. <a href="<?php echo $ahref?>">
  781. <?php echo $w -> title?></a> <span class="dropbox_detail">(<?php echo ceil(($w->filesize)/1024)?> kB)</span>
  782. </td>
  783. <td align="right" valign="top">
  784. <?php // RH: Mailing: clickable images for examine and send
  785. if ( $w->recipients[0]['id'] == $_user['user_id'])
  786. {
  787. $langSentTo = dropbox_lang("justUploadInList", "noDLTT") . '&nbsp;'; // RH: justUpload
  788. }
  789. elseif ( $w->recipients[0]['id'] > dropbox_cnf("mailingIdBase"))
  790. {
  791. ?>
  792. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&mailingIndex=<?php echo urlencode( $i)?>&dropbox_unid=<?php echo urlencode( $dropbox_unid).$mailingInUrl?>">
  793. <img src="../img/checkzip.gif" border="0" title="<?php echo dropbox_lang("mailingExamine", "noDLTT")?>" alt="" /></a>
  794. <?php // RH: Mailing: filesize is set to zero on send, allow no 2nd send!
  795. if ( $w->filesize != 0)
  796. {
  797. $langSentTo = ''; // unsent: do not write 'Sent to'
  798. ?>
  799. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&mailingIndex=<?php echo urlencode( $i)?>&mailingSend=yes&dropbox_unid=<?php echo urlencode( $dropbox_unid).$mailingInUrl?>"
  800. onClick='return confirmsend();'>
  801. <img src="../img/sendzip.gif" border="0" title="<?php echo dropbox_lang("mailingSend", "noDLTT")?>" alt="" /></a>
  802. <?php // RH: Mailing: end of 'clickable images for examine and send'
  803. }
  804. }
  805. // RH: Feedback
  806. $lastfeedbackdate = ''; $lastfeedbackfrom = '';
  807. foreach ($w -> recipients as $r) if (($fb = $r["feedback"]))
  808. if ($r["feedback_date"] > $lastfeedbackdate)
  809. {
  810. $lastfeedbackdate = $r["feedback_date"]; $lastfeedbackfrom = $r["name"];
  811. }
  812. if ($lastfeedbackdate)
  813. {
  814. ?>
  815. <span class="dropbox_feedback" title="<?php echo $lastfeedbackfrom; ?>"><?php echo $lastfeedbackdate; ?></span>
  816. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&showFeedback=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid)?>">
  817. <img src="../img/comment.gif" border="0" alt="" title="<?php echo dropbox_lang("showFeedback", "noDLTT"); ?>"/></a>
  818. <?php
  819. }
  820. ?>
  821. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteSent=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid) . $mailingInUrl?>"
  822. onClick='return confirmation("<?php echo htmlentities($w->title, ENT_COMPAT)?>");'>
  823. <img src="../img/delete.gif" border="0" title="<?php echo $langDelete; ?>" alt="" /></a>
  824. </td>
  825. </tr>
  826. <tr><td>
  827. <?php
  828. if ( $w -> author != '') //only show if filled in in DB
  829. {
  830. ?> <span class="dropbox_detail"><?php echo dropbox_lang("authors").': '.$w -> author?></span><br>
  831. <?php
  832. }
  833. if ( $w -> description != '')
  834. {
  835. ?> <span class="dropbox_detail"><?php echo dropbox_lang("description").': '.$w -> description?></span><br>
  836. <?php
  837. }
  838. echo '<span class="dropbox_detail">', $langSentTo, '<span class="dropbox_person">';
  839. foreach( $w -> recipients as $r){ echo $r["name"], ', '; }
  840. echo '</span>', dropbox_lang("sentOn"), ' <span class="dropbox_date">', $w -> upload_date, '</span></span>';
  841. if ($w -> upload_date != $w->last_upload_date)
  842. {
  843. ?> <br>
  844. <span class="dropbox_detail"><?php echo dropbox_lang("lastResent")?> <span class="dropbox_date"><?php echo $w->last_upload_date?></span></span>
  845. <?php
  846. }
  847. ?>
  848. </td>
  849. <td align="right">
  850. <div class="dropbox_feedback">&nbsp;</div>
  851. </td>
  852. </tr>
  853. </table>
  854. </td>
  855. </tr>
  856. <?php
  857. $i++;
  858. } //end of foreach
  859. if (count($dropbox_person -> sentWork)==0)
  860. {
  861. echo "<tr>",
  862. "<td align=\"center\">",get_lang('TheListIsEmpty'),
  863. "</td>",
  864. "</tr>";
  865. }
  866. echo "</table>",
  867. "</td>",
  868. "</tr>",
  869. "</table>";
  870. if ($origin != 'learnpath')
  871. {
  872. //we are not in the learning path tool
  873. Display::display_footer();
  874. }
  875. ?>