[svn r17922] Updated shared folder to put it in course documents root

skala
Yannick Warnier 16 years ago
parent 6e971b6132
commit 5489bc9c25
  1. 4
      main/inc/lib/add_course.lib.inc.php
  2. 23
      main/install/update-db-1.8.5-1.8.6.inc.php
  3. 55
      main/install/update-files-1.8.5-1.8.6.inc.php

@ -202,7 +202,7 @@ function prepare_course_repository($courseRepository, $courseId)
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document/images", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document/images/gallery/", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document/images/gallery/shared/", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document/shared_folder/", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document/audio", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document/flash", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/document/video", $perm);
@ -2060,7 +2060,7 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
$example_doc_id = Database :: get_last_insert_id();
api_sql_query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('document',1,NOW(),NOW(),$example_doc_id,'DocumentAdded',1,0,NULL,0)", __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLETOOLDOCUMENT . "`(path,title,filetype,size) VALUES ('/images/gallery/shared','".get_lang('SharedImagesDirectory')."','folder','0')", __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLETOOLDOCUMENT . "`(path,title,filetype,size) VALUES ('/shared_folder','".get_lang('SharedDocumentsDirectory')."','folder','0')", __FILE__, __LINE__);
$example_doc_id = Database :: get_last_insert_id();
api_sql_query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('document',1,NOW(),NOW(),$example_doc_id,'DocumentAdded',1,0,NULL,0)", __FILE__, __LINE__);

@ -1,4 +1,4 @@
<?php // $Id: update-db-1.8.5-1.8.6.inc.php 17777 2009-01-16 16:25:39Z juliomontoya $
<?php // $Id: update-db-1.8.5-1.8.6.inc.php 17922 2009-01-22 04:28:37Z yannoo $
/* See license terms in /dokeos_license.txt */
/**
==============================================================================
@ -212,7 +212,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
error_log('Database '.$dbUserForm.' was not found, skipping',0);
}else{
mysql_select_db($dbUserForm);
foreach($$u_q_listu_q_list as $query){
foreach($u_q_list as $query){
if($only_test){
error_log("mysql_query($dbUserForm,$query)",0);
error_log("In $dbUserForm, executed: $query",0);
@ -306,7 +306,24 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
error_log("In ".$row_course['db_name'].", executed: $query",0);
}
}
}
}
$t_d = $row_course['db_name'].".document";
$t_ip = $row_course['db_name'].".item_property";
if($singleDbForm)
{
$t_d = "$prefix{$row_course['db_name']}_document";
$t_ip = "$prefix{$row_course['db_name']}_item_property";
}
// shared documents folder
$mysql = "INSERT INTO $t_d (path,title,filetype,size) VALUES ('/shared_folder','".get_lang('SharedDocumentsDirectory')."','folder','0')";
$myres = mysql_query($query);
if ($myres !== false) {
$doc_id = mysql_insert_id();
$mysql = "INSERT INTO $t_ip (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('document',1,NOW(),NOW(),$doc_id,'DocumentAdded',1,0,NULL,0)";
$myres = mysql_query($query);
}
}
}
}

@ -19,20 +19,6 @@ require_once("../inc/lib/main_api.lib.php");
require_once("../inc/lib/fileUpload.lib.php");
require_once('../inc/lib/database.lib.php');
/*
==============================================================================
FUNCTIONS
==============================================================================
*/
function insert_db($db_name, $folder_name, $text){
$_course['dbName'] = $db_name;
$doc_id = add_document_180($_course, '/'.$folder_name, 'folder', 0, ucfirst($text));
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', 1);
}
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
{
// Edit the Dokeos config file
@ -106,45 +92,14 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
rename($origCRS,$sys_course_path.$courses_directories['directory']);
error_log('Creating dirs in '.$currentCourseRepositorySys,0);
//FOLDER DOCUMENT
//DOCUMENT FOLDER
//document > audio
if(!is_dir($currentCourseRepositorySys."document/audio")){
mkdir($currentCourseRepositorySys."document/audio",$perm);
insert_db($db_name,"audio",get_lang('Audio'));
}
//document > flash
if(!is_dir($currentCourseRepositorySys."document/flash")){
mkdir($currentCourseRepositorySys."document/flash",$perm);
insert_db($db_name,"flash",get_lang('Flash'));
}
//document > images
if(!is_dir($currentCourseRepositorySys."document/images")){
mkdir($currentCourseRepositorySys."document/images",$perm);
insert_db($db_name,"images",get_lang('Images'));
}
//document > images
if(!is_dir($currentCourseRepositorySys."document/images/gallery")){
mkdir($currentCourseRepositorySys."document/images/gallery",$perm);
insert_db($db_name,"gallery",get_lang('DefaultCourseImages'));
//document > shared_folder
if(!is_dir($currentCourseRepositorySys."document/shared_folder")){
mkdir($currentCourseRepositorySys."document/shared_folder",$perm);
}
//document > images
if(!is_dir($currentCourseRepositorySys."document/images/gallery/shared")){
mkdir($currentCourseRepositorySys."document/images/gallery/shared",$perm);
insert_db($db_name,"shared",get_lang('SharedImagesDirectory'));
}
//document > video
if(!is_dir($currentCourseRepositorySys."document/video")){
mkdir($currentCourseRepositorySys."document/video",$perm);
insert_db($db_name,"video",get_lang('Video'));
}
//document > video > flv
if(!is_dir($currentCourseRepositorySys."document/video/flv")){
mkdir($currentCourseRepositorySys."document/video/flv",$perm);
insert_db($db_name,"video",get_lang('Video')." (flv)");
}
//FOLDER UPLOAD
//UPLOAD FOLDER
//upload > forum > images
if(!is_dir($currentCourseRepositorySys."upload/forum/images")){

Loading…
Cancel
Save