Source for file dropbox_init.inc.php
Documentation is available at dropbox_init.inc.php
<?php // $Id: dropbox_init1.inc.php,v 1.29 2005/09/12 08:16:16 renehaentjens Exp $
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2006 Dokeos S.A.
Copyright (c) 2006 Ghent University (UGent)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
==============================================================================
==============================================================================
* First initialisation file with initialisation of variables and
* without outputting anything to browser.
* 1. Calls global.inc.php and lang file
* 2. Initialises $dropbox_cnf array with all relevant vars
* 3. Often used functions
* @author Jan Bols <jan@ivpv.UGent.be>, main programmer
* @author Rene Haentjens, severalcontributions <rene.haentjens@UGent.be> (see RH)
* @author Roan Embrechts, virtual course support
* @author Patrick Cool <patrick.cool@UGent.be>
Dokeos Config Settings (AWACS)
download file / folder (download icon)
same action on multiple documents
* @package dokeos.dropbox
==============================================================================
==============================================================================
==============================================================================
// name of the language file that needs to be included
$language_file = "dropbox";
//this var disables the link in the breadcrumbs on top of the page
// including the basic Dokeos initialisation file
require ("../inc/global.inc.php");
require_once(api_get_path(LIBRARY_PATH) . "security.lib.php");
// the dropbox configuration parameters
require_once('dropbox_config.inc.php');
// the dropbox sanity files (adds a new table and some new fields)
//require_once('dropbox_sanity.inc.php');
// the dropbox file that contains additional functions
require_once('dropbox_functions.inc.php');
require (api_get_path(INCLUDE_PATH). '/conf/mail.conf.php');
include_once(api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php');
include_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
-----------------------------------------------------------
-----------------------------------------------------------
require_once(api_get_path(LIBRARY_PATH). "/debug.lib.inc.php");
require_once(api_get_path(LIBRARY_PATH) . "/course.lib.php");
require_once(api_get_path(LIBRARY_PATH) . "/groupmanager.lib.php");
// including the library for the sortable table
require_once(api_get_path(LIBRARY_PATH). '/tablesort.lib.php');
// including the library for the dropbox
require_once( "dropbox_class.inc.php");
// including the library to do the tracking
require_once(api_get_path(LIBRARY_PATH). '/events.lib.inc.php');
// including some libraries that are also used in the documents tool
require_once('../document/document.inc.php'); // we use a function build_document_icon_tag
require_once(api_get_path(LIBRARY_PATH). '/fileDisplay.lib.php'); // the function choose_image is used
require_once(api_get_path(LIBRARY_PATH). '/document.lib.php');
-----------------------------------------------------------
-----------------------------------------------------------
$course_code = $_course['sysCode'];
-----------------------------------------------------------
-----------------------------------------------------------
// we need this here because the javascript to re-upload the file needs an array
// off all the documents that have already been sent.
// @todo consider moving the javascripts in a function that displays the javascripts
// only when it is needed.
if ($_GET['action']== 'add')
$dropbox_person = new Dropbox_Person( $_user['user_id'], $is_courseAdmin, $is_courseTutor);
-----------------------------------------------------------
create javascript and htmlHeaders
// RH: Mailing: new function confirmsend
-----------------------------------------------------------
if (confirm(\"". dropbox_lang("mailingConfirmSend", "noDLTT"). "\")){
function confirmation (name)
if (confirm(\"". dropbox_lang("confirmDelete", "noDLTT"). " : \"+ name )){
if (frm.elements['recipients[]'].selectedIndex < 0){
} else if (frm.file.value == '') {
var sentArray = new Array("; //sentArray keeps list of all files still available in the sent files list
//This is used to show or hide the overwrite file-radio button of the upload form
for($i= 0; $i< count($dropbox_person->sentWork); $i++ )
$javascript .= "'". $dropbox_person->sentWork[$i]->title. "'";
//echo '***'.$dropbox_person->sentWork[$i]->title;
ind = str.lastIndexOf('/'); //unix separator
if (ind == -1) ind = str.lastIndexOf('\\\'); //windows separator
filename = str.substring(ind+1, str.length);
for (i=0; i<sentArray.length; i++) {
if (sentArray[i] == filename) found=1;
//always start with unchecked box
el = getElement('cb_overwrite');
undisplayEl('overwrite');
return document.getElementById ? document.getElementById(id) :
document.all ? document.all(id) : null;
if (el && el.style) el.style.display = '';
if (el && el.style) el.style.display = 'none';
$htmlHeadXtra[] = $javascript;
function confirmation (name)
if (confirm(\" ". get_lang("AreYouSureToDelete") . " \"+ name + \" ?\"))
$htmlHeadXtra[] = '<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">';
if (!$_GET['view'] OR $_GET['view']== 'received')
elseif ($_GET['view']= 'sent')
header ('location: index.php?view='. $_GET['view']. '&error=Error');
if (($_POST['action']== 'download_received' || $_POST['action']== 'download_sent') and !$_POST['store_feedback'])
$checked_file_ids = $_POST['id'];
header ('location: index.php?view='. $_GET['view']. '&error=CheckAtLeastOneFile');
* ========================================
* ========================================
* Prevents access of all users that are not course members
if ($origin != 'learnpath')
==============================================================================
==============================================================================
if ($origin != 'learnpath')
else // if we come from the learning path we have to include the stylesheet and the required javascripts manually.
|