index.php 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  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'],$_uid);
  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('',$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( $_uid, $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/parent.gif" alt="'.get_lang('up').'" /><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/new_folder.gif\" alt=\"".get_lang('NewFolder')."\" align=\"middle\"/> ".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( $_uid, $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="middle" 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/save.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.gif" alt="'.get_lang('Comment').'"/></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.gif" alt="'.get_lang('Move').'"/></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').'" /></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 src="../img/save_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/parent.gif" alt="'.get_lang('Up').'" /><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/upload.gif\" alt=\"".get_lang('Upload')."\" align=\"middle\"/> ".get_lang('UploadNewFile')."</a>\n";
  393. echo "<a href=\"".$_SERVER['PHP_SELF']."?view=".$_GET['view']."&amp;action=addsentcategory\"><img src=\"../img/new_folder.gif\" alt=\"".get_lang('NewFolder')."\" align=\"middle\" /> ".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( $_uid, $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/save.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. //print_r($recipient);
  433. //echo '<br />';
  434. $receivers_celldata=display_user_link($recipient['user_id'], $recipient['name']).', '.$receivers_celldata;
  435. }
  436. $dropbox_file_data[]=$receivers_celldata;
  437. $receivers_celldata='';
  438. $action_icons=check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
  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=viewfeedback&amp;id='.$dropbox_file->id.'"><img src="../img/comment.gif" alt="'.get_lang('Comment').'"/></a>
  440. <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.gif" alt="'.get_lang('Move').'"/></a>
  441. <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').'" /></a>';
  442. // this is a hack to have an additional row in a sortable table
  443. if($_GET['action']=='viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id==$_GET['id'])
  444. {
  445. $action_icons.="</td></tr>\n"; // ending the normal row of the sortable table
  446. $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";
  447. }
  448. $dropbox_file_data[]=$action_icons;
  449. $action_icons='';
  450. $dropbox_data_sent[]=$dropbox_file_data;
  451. //echo '<pre>';
  452. //print_r($dropbox_data_sent);
  453. //echo '</pre>';
  454. }
  455. }
  456. // the content of the sortable table = the categories (if we are not in the root)
  457. if ($view_dropbox_category_sent==0)
  458. {
  459. foreach ($dropbox_categories as $category)
  460. {
  461. $dropbox_category_data=array();
  462. if ($category['sent']=='1')
  463. {
  464. $dropbox_category_data[]=''; // this is where the checkbox icon for the files appear
  465. $dropbox_category_data[]=build_document_icon_tag('folder',$category['cat_name']);
  466. $dropbox_category_data[]='<a href="dropbox_download.php?cat_id='.$category['cat_id'].'&amp;action=downloadcategory&amp;sent_received=sent"><img src="../img/save_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>';
  467. $dropbox_category_data[]='';
  468. $dropbox_category_data[]='';
  469. $dropbox_category_data[]='';
  470. $dropbox_category_data[]='';
  471. $dropbox_category_data[]='';
  472. $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>
  473. <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>';
  474. }
  475. if (is_array($dropbox_category_data))
  476. {
  477. $dropbox_data_sent[]=$dropbox_category_data;
  478. }
  479. }
  480. }
  481. // Displaying the table
  482. $additional_get_parameters=array('view'=>$_GET['view'], 'view_received_category'=>$_GET['view_received_category'],'view_sent_category'=>$_GET['view_sent_category']);
  483. Display::display_sortable_table($column_header, $dropbox_data_sent, $sorting_options, $paging_options, $additional_get_parameters);
  484. if (empty($dropbox_data_sent))
  485. {
  486. echo get_lang('NoFilesHere');
  487. }
  488. else
  489. {
  490. 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> - ';
  491. 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> ';
  492. echo get_lang('WithSelected').': ';
  493. display_action_options('sent',$dropbox_sent_category, $view_dropbox_category_sent);
  494. }
  495. echo '</form>';
  496. }
  497. Display::display_footer();
  498. exit;
  499. if ( $_GET['mailing']) // RH: Mailing detail window passes parameter
  500. {
  501. getUserOwningThisMailing($_GET['mailing'], $_uid, '304'); // RH or die
  502. $dropbox_person = new Dropbox_Person( $_GET['mailing'], $is_courseAdmin, $is_courseTutor);
  503. $mailingInUrl = "&mailing=" . urlencode( $_GET['mailing']);
  504. }
  505. else
  506. {
  507. $mailingInUrl = "";
  508. }
  509. $dropbox_person->orderReceivedWork ($receivedOrder);
  510. if( isset($_GET['dropbox_user_filter']) && $_GET['dropbox_user_filter'] != -1)
  511. {
  512. $dropbox_person->filter_received_work('uploader_id',$_GET['dropbox_user_filter']);
  513. }
  514. $dropbox_person->orderSentWork ($sentOrder);
  515. if (isset($_POST["feedbackid"]) && isset($_POST["feedbacktext"])) // RH: Feedback
  516. {
  517. $dropbox_person->updateFeedback ($_POST["feedbackid"], get_magic_quotes_gpc() ?
  518. stripslashes($_POST["feedbacktext"]) : $_POST["feedbacktext"]);
  519. }
  520. /*
  521. ==============================================================================
  522. FORM UPLOAD FILE
  523. ==============================================================================
  524. */
  525. if ( $_GET['mailing']) // RH: Mailing detail: no form upload
  526. {
  527. echo "<h3>", htmlspecialchars( getUserNameFromId ( $_GET['mailing'])), "</h3>";
  528. echo "<a href='index.php?".api_get_cidreq()."&origin=$origin'>".dropbox_lang("mailingBackToDropbox").'</a><br><br>';
  529. }
  530. else
  531. {
  532. } // RH: Mailing: end of 'Mailing detail: no form upload'
  533. /*
  534. ==============================================================================
  535. FILES LIST
  536. ==============================================================================
  537. */
  538. echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">",
  539. "<tr>",
  540. "<td valign=\"top\" align=\"center\">";
  541. /*
  542. -----------------------------------------------------------
  543. RECEIVED FILES LIST: TABLE HEADER
  544. -----------------------------------------------------------
  545. */
  546. if ( !$_GET['mailing']) // RH: Mailing detail: no received files
  547. {
  548. ?>
  549. <table cellpadding="5" cellspacing="1" border="0" width="100%">
  550. <!--This is no longer neede because of sortable table -->
  551. <tr class="cell_header">
  552. <td colspan="2">
  553. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  554. <tr>
  555. <td>
  556. <form name="formReceived" method="get" action="index.php?<?php echo "origin=$origin"; ?>">
  557. <span class="dropbox_listTitle"><?php echo dropbox_lang("orderBy")?></span>
  558. <?php if ($origin=='learnpath') { echo "<input type='hidden' name='origin' value='learnpath'>"; } ?>
  559. <select name="receivedOrder" onchange="javascript: this.form.submit()">
  560. <option value="lastDate" <?php if ($receivedOrder=="lastDate") {
  561. echo "selected";
  562. }?>><?php echo dropbox_lang("lastDate")?></option>
  563. <?php if (dropbox_cnf("allowOverwrite")) { ?>
  564. <option value="firstDate" <?php if ($receivedOrder=="firstDate") {
  565. echo "selected";
  566. }?>><?php echo dropbox_lang("firstDate")?></option>
  567. <?php } ?>
  568. <option value="title" <?php if ($receivedOrder=="title") {
  569. echo "selected";
  570. }?>><?php echo dropbox_lang("title")?></option>
  571. <option value="size" <?php if ($receivedOrder=="size") {
  572. echo "selected";
  573. }?>><?php echo dropbox_lang("size")?></option>
  574. <option value="author" <?php if ($receivedOrder=="author") {
  575. echo "selected";
  576. }?>><?php echo dropbox_lang("author")?></option>
  577. <option value="sender" <?php if ($receivedOrder=="sender") {
  578. echo "selected";
  579. }?>><?php echo dropbox_lang("sender")?></option>
  580. </select>
  581. <span class="dropbox_listTitle"><?php echo dropbox_lang('sentBy'); ?></span>
  582. <select name="dropbox_user_filter" onchange="javascript: this.form.submit()">
  583. <option value="-1"><?php echo get_lang('All'); ?></option>
  584. <?php
  585. foreach ($complete_user_list_for_dropbox as $current_user)
  586. {
  587. $full_name = $current_user['lastcommafirst'];
  588. echo '<option value="' . $current_user['user_id'] . '"'.($_GET['dropbox_user_filter'] == $current_user['user_id'] ? 'selected="selected"' : '').'>' . $full_name . '</option>';
  589. }
  590. ?>
  591. </select>
  592. <noscript><input type="submit" value="OK"/></noscript>
  593. </form>
  594. </td>
  595. <td align="right"><div class="dropbox_listTitle"><?php echo strtoupper( dropbox_lang("receivedTitle"))?></div></td>
  596. <td align="right" width="30px">
  597. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteReceived=all&dropbox_unid=<?php echo urlencode( $dropbox_unid)?>"
  598. onClick="return confirmation('<?php echo addslashes( dropbox_lang("all", "noDLTT"))?>');">
  599. <img src="../img/delete.gif" border="0" title="<?php echo get_lang("Delete"); ?>" alt="" /></a>
  600. <?php if ($origin=='learnpath') { echo "<input type='hidden' name='origin' value='learnpath' />"; } ?>
  601. </td>
  602. </tr>
  603. </table>
  604. </td>
  605. </tr>
  606. <?php
  607. /*
  608. -----------------------------------------------------------
  609. RECEIVED FILES LIST
  610. -----------------------------------------------------------
  611. */
  612. $numberDisplayed = count($dropbox_person -> receivedWork); // RH
  613. $i = 0;
  614. // RH: Feedback: pencil for Give/Edit Feedback, UI rearranged, feedback added
  615. foreach ( $dropbox_person -> receivedWork as $w)
  616. {
  617. if ( $w -> uploader_id == $_uid) // RH: justUpload
  618. {
  619. $numberDisplayed -= 1; continue;
  620. }
  621. ?>
  622. <tr>
  623. <td valign="top" algin="left" width="25">
  624. <a href="dropbox_download.php?<?php echo api_get_cidreq()."&origin=$origin"; ?>&id=<?php echo urlencode($w->id)?>">
  625. <img src="../img/travaux.gif" border="0" alt="" /></a>
  626. </td>
  627. <td valign="top" align="left">
  628. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  629. <tr>
  630. <td valign="top">
  631. <a href="dropbox_download.php?<?php echo api_get_cidreq()."&origin=$origin"; ?>&id=<?php echo urlencode($w->id)?>">
  632. <?php echo $w -> title?></a> <span class="dropbox_detail">(<?php echo ceil(($w->filesize)/1024)?> kB)</span>
  633. </td>
  634. <td align="right" valign="top">
  635. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&editFeedback=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid)?>">
  636. <img src="../img/comment.gif" border="0" title="<?php echo dropbox_lang("giveFeedback", "noDLTT"); ?>" alt="" /></a>
  637. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteReceived=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid)?>"
  638. onClick='return confirmation("<?php echo htmlentities($w->title, ENT_COMPAT)?>");'>
  639. <img src="../img/delete.gif" border="0" title="<?php echo $langDelete; ?>" alt="" /></a>
  640. </td>
  641. </tr>
  642. <tr><td>
  643. <?php
  644. if ( $w -> author != '') //only show if filled in in DB
  645. {
  646. ?> <span class="dropbox_detail"><?php echo dropbox_lang("authors").': '.$w -> author?></span><br>
  647. <?php
  648. }
  649. if ( $w -> description != '')
  650. {
  651. ?> <span class="dropbox_detail"><?php echo dropbox_lang("description").': '.$w -> description?></span><br>
  652. <?php
  653. }
  654. ?> <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>
  655. <?php
  656. if ($w -> upload_date != $w->last_upload_date)
  657. {
  658. ?> <br>
  659. <span class="dropbox_detail"><?php echo dropbox_lang("lastUpdated")?> <span class="dropbox_date"><?php echo $w->last_upload_date?></span></span>
  660. <?php
  661. }
  662. ?>
  663. </td>
  664. <td align="right">
  665. <?php
  666. if (($fbtext = $w -> feedback))
  667. {
  668. ?> <div class="dropbox_feedback"><?php echo dropbox_lang("sentOn")?> <span class="dropbox_date">
  669. <?php echo htmlspecialchars($w->feedback_date), ':</span><br>',
  670. nl2br(htmlspecialchars($fbtext)); ?>
  671. </div>
  672. <?php
  673. }
  674. ?>
  675. </td></tr>
  676. </table>
  677. </td>
  678. </tr>
  679. <?php
  680. $i++;
  681. } //end of foreach
  682. if ( $numberDisplayed == 0)
  683. { // RH
  684. ?>
  685. <tr>
  686. <td align="center"><?php echo get_lang('TheListIsEmpty'); ?>
  687. </td>
  688. </tr>
  689. <?php
  690. }
  691. ?>
  692. </table>
  693. <br>
  694. <?php
  695. } // RH: Mailing: end of 'Mailing detail: no received files'
  696. /**
  697. * --------------------------------------
  698. *       SENT FILES LIST: TABLE HEADER
  699. * --------------------------------------
  700. */
  701. ?>
  702. <table cellpadding="5" cellspacing="1" border="0" width="100%">
  703. <tr class="cell_header">
  704. <td colspan="2">
  705. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  706. <tr>
  707. <td>
  708. <form name="formSent" method="get" action="index.php?<?php echo "origin=$origin"; ?>">
  709. <?php if ($origin=='learnpath') { echo "<input type='hidden' name='origin' value='learnpath' />"; } ?>
  710. <span class="dropbox_listTitle"><?php echo dropbox_lang("orderBy")?></span>
  711. <select name="sentOrder" onchange="javascript: this.form.submit()">
  712. <option value="lastDate" <?php if ($sentOrder=="lastDate") {
  713. echo "selected";
  714. }?>><?php echo dropbox_lang("lastDate")?></option>
  715. <?php if (dropbox_cnf("allowOverwrite")) { ?>
  716. <option value="firstDate" <?php if ($sentOrder=="firstDate") {
  717. echo "selected";
  718. }?>><?php echo dropbox_lang("firstDate")?></option>
  719. <?php } ?>
  720. <option value="title" <?php if ($sentOrder=="title") {
  721. echo "selected";
  722. }?>><?php echo dropbox_lang("title")?></option>
  723. <option value="size" <?php if ($sentOrder=="size") {
  724. echo "selected";
  725. }?>><?php echo dropbox_lang("size")?></option>
  726. <option value="author" <?php if ($sentOrder=="author") {
  727. echo "selected";
  728. }?>><?php echo dropbox_lang("author")?></option>
  729. <option value="recipient" <?php if ($sentOrder=="recipient") {
  730. echo "selected";
  731. }?>><?php echo dropbox_lang("recipient")?></option>
  732. </select>
  733. <noscript><input type="submit" value="OK"/></noscript>
  734. </form>
  735. </td>
  736. <td align="right"><div class="dropbox_listTitle"><?php echo strtoupper( dropbox_lang("sentTitle"))?></div></td>
  737. <td align="right" width="30px">
  738. <!-- Users cannot delete their own sent files
  739. <img src="shim.gif" width="20" height="20" border="0">
  740. -->
  741. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteSent=all&dropbox_unid=<?php echo urlencode( $dropbox_unid).$mailingInUrl?>"
  742. onClick="return confirmation('<?php echo addslashes( dropbox_lang("all", "noDLTT"))?>');">
  743. <img src="../img/delete.gif" border="0" title="<?php echo $langDelete; ?>" alt="" /></a>
  744. <!-- -->
  745. </td>
  746. </tr>
  747. </table>
  748. </td>
  749. </tr>
  750. <?php
  751. /**
  752. * --------------------------------------
  753. *       SENT FILES LIST
  754. * --------------------------------------
  755. */
  756. $i = 0;
  757. // RH: Feedback: UI rearranged, feedback added
  758. foreach ( $dropbox_person -> sentWork as $w)
  759. {
  760. $langSentTo = dropbox_lang("sentTo", "noDLTT") . '&nbsp;'; // RH: Mailing: not for unsent
  761. // RH: Mailing: clickable folder image for detail
  762. if ( $w->recipients[0]['id'] > dropbox_cnf("mailingIdBase"))
  763. {
  764. $ahref = "index.php?".api_get_cidreq()."&origin=$origin&mailing=" . urlencode($w->recipients[0]['id']);
  765. $imgsrc = '../img/folder.gif';
  766. }
  767. else
  768. {
  769. $ahref = "dropbox_download.php?".api_get_cidreq()."&origin=$origin&id=" . urlencode($w->id) . $mailingInUrl;
  770. $imgsrc = '../img/travaux.gif';
  771. }
  772. ?>
  773. <tr>
  774. <td valign="top" algin="left" width="25">
  775. <a href="<?php echo $ahref?>">
  776. <img src="<?php echo $imgsrc?>" border="0" alt="" /></a>
  777. </td>
  778. <td valign="top" align="left">
  779. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  780. <tr>
  781. <td valign="top">
  782. <a href="<?php echo $ahref?>">
  783. <?php echo $w -> title?></a> <span class="dropbox_detail">(<?php echo ceil(($w->filesize)/1024)?> kB)</span>
  784. </td>
  785. <td align="right" valign="top">
  786. <?php // RH: Mailing: clickable images for examine and send
  787. if ( $w->recipients[0]['id'] == $_uid)
  788. {
  789. $langSentTo = dropbox_lang("justUploadInList", "noDLTT") . '&nbsp;'; // RH: justUpload
  790. }
  791. elseif ( $w->recipients[0]['id'] > dropbox_cnf("mailingIdBase"))
  792. {
  793. ?>
  794. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&mailingIndex=<?php echo urlencode( $i)?>&dropbox_unid=<?php echo urlencode( $dropbox_unid).$mailingInUrl?>">
  795. <img src="../img/checkzip.gif" border="0" title="<?php echo dropbox_lang("mailingExamine", "noDLTT")?>" alt="" /></a>
  796. <?php // RH: Mailing: filesize is set to zero on send, allow no 2nd send!
  797. if ( $w->filesize != 0)
  798. {
  799. $langSentTo = ''; // unsent: do not write 'Sent to'
  800. ?>
  801. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&mailingIndex=<?php echo urlencode( $i)?>&mailingSend=yes&dropbox_unid=<?php echo urlencode( $dropbox_unid).$mailingInUrl?>"
  802. onClick='return confirmsend();'>
  803. <img src="../img/sendzip.gif" border="0" title="<?php echo dropbox_lang("mailingSend", "noDLTT")?>" alt="" /></a>
  804. <?php // RH: Mailing: end of 'clickable images for examine and send'
  805. }
  806. }
  807. // RH: Feedback
  808. $lastfeedbackdate = ''; $lastfeedbackfrom = '';
  809. foreach ($w -> recipients as $r) if (($fb = $r["feedback"]))
  810. if ($r["feedback_date"] > $lastfeedbackdate)
  811. {
  812. $lastfeedbackdate = $r["feedback_date"]; $lastfeedbackfrom = $r["name"];
  813. }
  814. if ($lastfeedbackdate)
  815. {
  816. ?>
  817. <span class="dropbox_feedback" title="<?php echo $lastfeedbackfrom; ?>"><?php echo $lastfeedbackdate; ?></span>
  818. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&showFeedback=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid)?>">
  819. <img src="../img/comment.gif" border="0" alt="" title="<?php echo dropbox_lang("showFeedback", "noDLTT"); ?>"/></a>
  820. <?php
  821. }
  822. ?>
  823. <a href="dropbox_submit.php?<?php echo "origin=$origin"; ?>&deleteSent=<?php echo urlencode($w->id)?>&dropbox_unid=<?php echo urlencode($dropbox_unid) . $mailingInUrl?>"
  824. onClick='return confirmation("<?php echo htmlentities($w->title, ENT_COMPAT)?>");'>
  825. <img src="../img/delete.gif" border="0" title="<?php echo $langDelete; ?>" alt="" /></a>
  826. </td>
  827. </tr>
  828. <tr><td>
  829. <?php
  830. if ( $w -> author != '') //only show if filled in in DB
  831. {
  832. ?> <span class="dropbox_detail"><?php echo dropbox_lang("authors").': '.$w -> author?></span><br>
  833. <?php
  834. }
  835. if ( $w -> description != '')
  836. {
  837. ?> <span class="dropbox_detail"><?php echo dropbox_lang("description").': '.$w -> description?></span><br>
  838. <?php
  839. }
  840. echo '<span class="dropbox_detail">', $langSentTo, '<span class="dropbox_person">';
  841. foreach( $w -> recipients as $r){ echo $r["name"], ', '; }
  842. echo '</span>', dropbox_lang("sentOn"), ' <span class="dropbox_date">', $w -> upload_date, '</span></span>';
  843. if ($w -> upload_date != $w->last_upload_date)
  844. {
  845. ?> <br>
  846. <span class="dropbox_detail"><?php echo dropbox_lang("lastResent")?> <span class="dropbox_date"><?php echo $w->last_upload_date?></span></span>
  847. <?php
  848. }
  849. ?>
  850. </td>
  851. <td align="right">
  852. <div class="dropbox_feedback">&nbsp;</div>
  853. </td>
  854. </tr>
  855. </table>
  856. </td>
  857. </tr>
  858. <?php
  859. $i++;
  860. } //end of foreach
  861. if (count($dropbox_person -> sentWork)==0)
  862. {
  863. echo "<tr>",
  864. "<td align=\"center\">",get_lang('TheListIsEmpty'),
  865. "</td>",
  866. "</tr>";
  867. }
  868. echo "</table>",
  869. "</td>",
  870. "</tr>",
  871. "</table>";
  872. if ($origin != 'learnpath')
  873. {
  874. //we are not in the learning path tool
  875. Display::display_footer();
  876. }
  877. ?>