Browse Source

[svn r17576] hide some folders in Search Look in:

Juan Carlos Raña 16 years ago
parent
commit
83d578622e

+ 12 - 7
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php

@@ -444,14 +444,19 @@ $(document).ready(
 		            <select class="input inputSearch" name="search_folder" id="search_folder">
 		            	<?php 
 		            		
-										foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
-										{
-											?>
-		                  <option value="<?php echo $v; ?>" <?php echo (removeTrailingSlash(backslashToSlash(($folderInfo['path']))) == removeTrailingSlash(backslashToSlash(($v)))?' selected="selected"':''); ?>><?php echo shortenFileName($k, 30); ?></option>
-		                  <?php 
-										}
+					foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
+					{
+                              	if(hideFilename($k))
+						{
+						//shows only those permitted by Dokeos
+						?>
+		                  		<option value="<?php echo $v; ?>" <?php echo (removeTrailingSlash(backslashToSlash(($folderInfo['path']))) == removeTrailingSlash(backslashToSlash(($v)))?' selected="selected"':''); ?>><?php echo hideFileName(shortenFileName($k, 30)); // shows only those permitted by Dokeos
+?></option>
+		                  	<?php
+						} 
+					}
 		            		
-									?>            	
+					?>            	
 		            </select>
 		      <?php
 	          		}

+ 36 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/function.base.php

@@ -832,8 +832,43 @@ function getRootPath() {
 		   {
 		       return trim ( @exec ('file -bi ' . escapeshellarg ( $f ) ) ) ;
 		   }
-		}		
+		}
+
+
+		/**
+		* check if a folder is allowed to shown on the search 'look in' list
+		* @param string $fileName
+		* @return string
+		* @author Juan Carlos Raña Trabado
+		*/
+		function hideFileName($fileName)
+		{
+			//hidden files and folders deleted by Dokeos. Hidde folders css
+			$deleted_by_dokeos='_DELETED_';
+			$css_folder_dokeos='css';
+			
+			//hidden directory of the group if the user is not a member of the group					
+			$group_folder='_groupdocs';
+			
+			//show group's directory only if I'm member
+			$show_doc_group=true;								
+			if(ereg($group_folder, $fileName))
+			{
+				$show_doc_group=false;
+				if($is_user_in_group)
+				{
+					$show_doc_group=true;					
+				}
+			}		
+			
+			if(!ereg($deleted_by_dokeos, $fileName) && !ereg($css_folder_dokeos, $fileName)&& $show_doc_group==true)
+			{			
+				return substr($fileName,strpos($fileName, '-'),strlen($fileName)); //hide the firsts numbers
+			}
 		
+		}
+
+
          /**
           * check if such document is allowed to shown on the list
           *