Jelajahi Sumber

[svn r19114] enable create folder with the advanced filemanager editor in the tool documents and fix several bug

Juan Carlos Raña 16 tahun lalu
induk
melakukan
dd48f4187b

+ 3 - 2
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_details_listing.php

@@ -27,7 +27,8 @@
 								//Juan Carlos Raña
 								
 									//hidden files and folders deleted by Dokeos. Hidde folders css, hotpotatoes, chat_files
-									$deleted_by_dokeos=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php	
+									$deleted_by_dokeos_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php	
+									$deleted_by_dokeos_folder='_DELETED_';
 									$css_folder_dokeos='css';
 									$hotpotatoes_folder_dokeos='HotPotatoes_files';
 									$chat_files_dokeos='chat_files';
@@ -54,7 +55,7 @@
 								///Second step: hiding as the case
 								//Juan Carlos Raña
 								
-								if((!ereg($deleted_by_dokeos, $file['name']) || !ereg($deleted_by_dokeos, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.')
+								if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.')
 								{
 									if($file['type'] == 'file')
 									{		

+ 4 - 2
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php

@@ -10,7 +10,9 @@
 			//Juan Carlos Raña
 			
 				//hidden files and folders deleted by Dokeos. Hidde folders css, hotpotatoes, chat
-				$deleted_by_dokeos=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php	
+				
+				$deleted_by_dokeos_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php	
+				$deleted_by_dokeos_folder='_DELETED_';
 				$css_folder_dokeos='css';
 				$hotpotatoes_folder_dokeos='HotPotatoes_files';
 				$chat_files_dokeos='chat_files';
@@ -35,7 +37,7 @@
 		
 			///Second step: hiding as the case
 			//Juan Carlos Raña
-			if((!ereg($deleted_by_dokeos, $file['name']) || !ereg($deleted_by_dokeos, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.')
+			if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.')
 			{
 						
 				?>

+ 23 - 0
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_create_folder.php

@@ -18,6 +18,7 @@
 /*	$_POST['new_folder'] = substr(md5(time()), 1, 5);
 	$_POST['currentFolderPath'] = "../../uploaded/";*/
 	$_POST['new_folder']=htmlentities($_POST['new_folder'],ENT_QUOTES);//Dokeos improve security 
+	$_POST['new_folder']=str_replace(' ','_',$_POST['new_folder']);//Interaction with Dokeos. Because fix long names. See: ajaxfilemanager/inc/class.manager.php
 	$_POST['currentFolderPath']=htmlentities($_POST['currentFolderPath'],ENT_QUOTES);//Dokeos improve security 
 	
 	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_NEWFOLDER)
@@ -41,11 +42,33 @@
 	{
 	include_once(CLASS_FILE);
 		$file = new file();
+		
 		if($file->mkdir(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], 0775))
 		{
 					include_once(CLASS_MANAGER);
 					$manager = new manager(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], false);
 					$pathInfo = $manager->getFolderInfo(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']);
+					
+					/////////////bridge to Dokeos by Juan Carlos Raña Trabado
+					if(!empty($_course['path']))
+					{
+					//only inside courses				
+						$mainPath='../../../../../../../courses/'.$_course['path'].'/document/';//get Dokeos
+						$fullPath = $_POST['currentFolderPath'].$_POST['new_folder']; //get Ajaxfilemanager						
+						$dokeosFolder = substr($fullPath, strlen($mainPath)-strlen($fullPath)-1);
+						$_POST['new_folder']=str_replace('_',' ',$_POST['new_folder']);//Restore for interaction with Dokeos. Because fix long names. See: ajaxfilemanager/inc/class.manager.php
+						$dokeosFile = $_POST['new_folder']; //get Ajaxfilemanager
+						
+						if(!empty($group_properties['directory'])) //get Dokeos
+						{
+							$dokeosFolder=$group_properties['directory'].$dokeosFolder;//get Dokeos
+						}
+						
+						$doc_id = add_document($_course, $dokeosFolder,'folder', 0, $dokeosFile); //get Dokeos	
+						api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id(),$to_group_id);//get Dokeos
+						api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id(),$to_group_id);//get Dokeos
+					}
+					// end bridge to Dokeos
 					foreach($pathInfo as $k=>$v)
 					{				
 						switch ($k)

+ 1 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_upload.php

@@ -85,7 +85,7 @@
 									{
 										if(!api_is_allowed_to_edit())
 										{
-											$dokeosFolder='/shared_folder/'.$dokeosFolder;
+											$dokeosFolder='/shared_folder/sf_user_'.api_get_user_id().$dokeosFolder;
 										}						
 									}
 									

+ 2 - 2
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.base.php

@@ -57,7 +57,7 @@
 			define('CONFIG_OPTIONS_DELETE', false);
 			define('CONFIG_OPTIONS_CUT', false);
 			define('CONFIG_OPTIONS_COPY', false);
-			define('CONFIG_OPTIONS_NEWFOLDER', false);
+			define('CONFIG_OPTIONS_NEWFOLDER', true);
 			define('CONFIG_OPTIONS_RENAME', false);
 			define('CONFIG_OPTIONS_UPLOAD', true); //
 			define('CONFIG_OPTIONS_EDITABLE', false); //disable image editor and text editor
@@ -68,7 +68,7 @@
 			define('CONFIG_OPTIONS_DELETE', false);
 			define('CONFIG_OPTIONS_CUT', false);
 			define('CONFIG_OPTIONS_COPY', false);
-			define('CONFIG_OPTIONS_NEWFOLDER', false);
+			define('CONFIG_OPTIONS_NEWFOLDER', true);
 			define('CONFIG_OPTIONS_RENAME', false);
 			define('CONFIG_OPTIONS_UPLOAD', true); //
 			define('CONFIG_OPTIONS_EDITABLE', false); //disable image editor and text editor