Juan Carlos Raña 14 years ago
parent
commit
63c52c2a2a

+ 17 - 19
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_details_listing.php

@@ -6,7 +6,7 @@
 							<th width="10" class="fileColumns">&nbsp;</th>
 							<th class="docName"><?php echo LBL_NAME; ?></th>
 							<th  width="70" class="fileColumns"><?php echo LBL_SIZE; ?></th>
-                            <!-- hide while implementing this Dokeos -->
+                            <!-- hide while implementing this Chamilo -->
 							<!--<th class="fileColumns"><?php // echo LBL_MODIFIED; ?></th> -->						
 						</tr>
 					</thead>
@@ -21,15 +21,15 @@
 								$css = ($css == "" || $css == "even"?"odd":"even");
 								$strDisabled = ($file['is_writable']?"":" disabled");
 								$strClass = ($file['is_writable']?"left":" leftDisabled");
-								///First step for hidden some type of Dokeos files and folders
+								///First step for hidden some type of Chamilo files and folders
 								//Juan Carlos Raña
 
-									//hidden files and folders deleted by Dokeos. Hidde folders css, hotpotatoes, chat_files
-									$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';
+									//hidden files and folders deleted by Chamilo. Hidde folders css, hotpotatoes, chat_files
+									$deleted_by_Chamilo_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
+									$deleted_by_Chamilo_folder='_DELETED_';
+									$css_folder_Chamilo='css';
+									$hotpotatoes_folder_Chamilo='HotPotatoes_files';
+									$chat_files_Chamilo='chat_files';
 
 									//show group's directory only if I'm member. Or if I'm a teacher. TODO: check groups not necessary because the student dont have access to main folder documents (only to document/group or document/shared_folder). Teachers can access to all groups ?
 									$group_folder='_groupdocs';
@@ -45,13 +45,10 @@
 
 									}
 
-									//show icon sharedfolder
-									$shared_folder='shared folder';	 //'shared folder' not 'shared_folder' because  in $file['name'] _ is replaced with blank see class.manager.php
-
 								///Second step: hiding as the case
 								//Juan Carlos Raña
 
-								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 && $file['name'][0]!='.')
+								if((!ereg($deleted_by_Chamilo_file, $file['name']) && !ereg($deleted_by_Chamilo_folder, $file['path'])) && !ereg($css_folder_Chamilo, $file['path']) && !ereg($hotpotatoes_folder_Chamilo, $file['path']) && !ereg($chat_files_Chamilo, $file['path']) && $show_doc_group && $file['name'][0]!='.')
 								{							
 								
 									if($file['type'] == 'file')
@@ -60,11 +57,11 @@
 									?>
 									<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>"  >
 										<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>">&nbsp;</span><input type="checkbox"  name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?> /></td>
-                                        <td align="center" class="fileColumns" id="tdst<?php echo $count; ?>">&nbsp;<a id="a<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><span class="<?php echo $file['cssClass']; ?>">&nbsp;</span></a></td><!-- Juan Carlos Raña Fix for Dokeos: On the path I put a directory up echo "../".$ file [ 'path'], what makes good show when pressed next on window preview, don't only one image -->
+                                        <td align="center" class="fileColumns" id="tdst<?php echo $count; ?>">&nbsp;<a id="a<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><span class="<?php echo $file['cssClass']; ?>">&nbsp;</span></a></td><!-- Juan Carlos Raña Fix for Chamilo: On the path I put a directory up echo "../".$ file [ 'path'], what makes good show when pressed next on window preview, don't only one image -->
 										<td class="<?php echo $strClass; ?> docName"  id="tdnd<?php echo $count; ?>"><a id="aa<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><?php echo $file['name']; ?></a></td>
                                         
 										<td class="docInfo" id="tdrd<?php echo $count; ?>"><?php echo transformFileSize($file['size']); ?></td>
-										<!-- hide while implementing this Dokeos -->
+										<!-- hide while implementing this Chamilo -->
 										<!--<td class="docInfo" id="tdth<?php //echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> -->
 
 									</tr>
@@ -78,13 +75,14 @@
                                             
                                             
                                           <?php
-                                            if(ereg($shared_folder, $file['name']))
+                                            
+											if(preg_match('/shared_folder/', basename($file['path'])))
                                             {
-											//add icon in ajaxfilemanager if sharedfolder is in Dokeos
+											//add icon into ajaxfilemanager if sharedfolder is into Chamilo
 											?>
                                             	<td  lign="center" class="fileColumns" id="tdst<?php echo $count; ?>">&nbsp;<a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" <?php echo $file['cssClass'] == 'filePicture'?'rel="ajaxPhotos"':''; ?>  ><span class="<?php echo ($file['file']&&$file['subdir']?$file['cssClass']:"folderShared"); ?>">&nbsp;</span></a></td>
                                             <?php
-                                            }
+                                            }											
                                             else
 											{
 											?>
@@ -94,13 +92,13 @@
                                             ?>                                            
                                             <td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><a id="aa<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><?php echo $file['name']; ?></a></td>
 											<td class="docInfo" id="tdrd<?php echo $count; ?>">&nbsp;</td>
-                                             <!-- hide while implementing this Dokeos -->
+                                             <!-- hide while implementing this Chamilo -->
 											<!--<td class="docInfo" id="tdth<?php// echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> -->
 										</tr>
 										<?php
 									}
 
-								}//end if hidden files and folders deleted by Dokeos
+								}//end if hidden files and folders deleted by Chamilo
 
 								$count++;
 							}

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

@@ -6,16 +6,16 @@
 		foreach($fileList as $file)
 		{
 			
-			///First step for hidden some type of Dokeos files and folders
+			///First step for hidden some type of Chamilo files and folders
 			//Juan Carlos Ra�a
 
-			//hidden files and folders deleted by Dokeos. Hidde folders css, hotpotatoes, chat
+			//hidden files and folders deleted by Chamilo. Hidde folders css, hotpotatoes, chat
 
-			$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';
+			$deleted_by_Chamilo_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
+			$deleted_by_Chamilo_folder='_DELETED_';
+			$css_folder_Chamilo='css';
+			$hotpotatoes_folder_Chamilo='HotPotatoes_files';
+			$chat_files_Chamilo='chat_files';
 
 			//hidden directory of the group if the user is not a member of the group
 			$group_folder='_groupdocs';
@@ -37,14 +37,14 @@
 			
 			///Second step: hiding as the case
 			//Juan Carlos Ra�a
-			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 && $file['name'][0]!='.')
+			if((!ereg($deleted_by_Chamilo_file, $file['name']) && !ereg($deleted_by_Chamilo_folder, $file['path'])) && !ereg($css_folder_Chamilo, $file['path']) && !ereg($hotpotatoes_folder_Chamilo, $file['path']) && !ereg($chat_files_Chamilo, $file['path']) && $show_doc_group && $file['name'][0]!='.')
 			{			
 			
 			?>
 				<dl class="thumbnailListing" id="dl<?php echo $count; ?>">
                  <?php
-                 if(ereg($shared_folder, $file['name']))
-                 { //add icon in ajaxfilemanager if sharedfolder is in Dokeos
+                 if(preg_match('/shared_folder/', basename($file['path'])))
+                 { //add icon into ajaxfilemanager if sharedfolder is in Chamilo
                 ?>
 
                 	<dt id="dt<?php echo $count; ?>" class="<?php echo ($file['type'] == 'folder' && empty($file['file']) || empty($file['subdir'])?'folderShared':$file['cssClass']); ?>" class="<?php echo $file['cssClass']; ?>">
@@ -78,10 +78,10 @@
 				
 				</dt>
 				<dd id="dd<?php echo $count; ?>" class="thumbnailListing_info"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>">&nbsp;</span><input id="cb<?php echo $count; ?>" type="checkbox" name="check[]" <?php echo ($file['is_writable']?'':'disabled'); ?> class="radio" value="<?php echo $file['path']; ?>" />
-				<a <?php echo ($file['cssClass']== 'filePicture'?'rel="orgImg"':''); ?> href="<?php echo "../".$file['path']; ?>" title="<?php echo $file['name']; ?>" id="a<?php echo $count; ?>"><?php echo shortenFileName($file['name']); ?></a></dd><!-- Juan Carlos Ra�a Fix for Dokeos: On the path I put a directory up echo "../".$ file [ 'path'], what makes good show when pressed next on window preview, don't only one image -->			
+				<a <?php echo ($file['cssClass']== 'filePicture'?'rel="orgImg"':''); ?> href="<?php echo "../".$file['path']; ?>" title="<?php echo $file['name']; ?>" id="a<?php echo $count; ?>"><?php echo shortenFileName($file['name']); ?></a></dd><!-- Juan Carlos Ra�a Fix for Chamilo: On the path I put a directory up echo "../".$ file [ 'path'], what makes good show when pressed next on window preview, don't only one image -->			
                 </dl>
                 <?php
-			}//end if hidden files and folders deleted by Dokeos
+			}//end if hidden files and folders deleted by Chamilo
 			$count++;
 		}
 ?>

+ 13 - 13
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_file_listing.php

@@ -6,12 +6,12 @@
 	 * @link www.phpletter.com
 	 * @since 22/May/2007
 	 *
-	 * Modify for Dokeos
-	 * @author Juan Carlos Ra�a
+	 * Modify for Chamilo
+	 * @author Juan Carlos Raña Trabado
 	 * @since 31/December/2008	 
 	 */
 	 
-	include ('../../../../../../inc/global.inc.php'); // Integrating with Dokeos
+	include ('../../../../../../inc/global.inc.php'); // Integrating with Chamilo
 
 	if(!isset($manager))
 	{
@@ -22,7 +22,7 @@
 		include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
 		include_once(CLASS_PAGINATION);
 		$pagination = new pagination(false);
-		//$search_folder = str_replace("'","",$_GET['search_folder']); //TODO:check if this line is necessary juan carlos raña 
+		//$search_folder = str_replace("'","",$_GET['search_folder']); //TODO:check if this line is necessary Juan Carlos Raña
 		if(!empty($_GET['search']))
 		{
 			include_once(CLASS_SEARCH);
@@ -69,14 +69,14 @@
 		$pagination->setLastText(PAGINATION_LAST);
 		$pagination->setLimit(!empty($_GET['limit'])?intval($_GET['limit']):CONFIG_DEFAULT_PAGINATION_LIMIT);
 		echo $pagination->getPaginationHTML();
-		///////Dokeos fix for count hidden folders
+		///////Chamilo fix for count hidden folders
 			$count_hideItem =0;
 
-			$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';
+			$deleted_by_Chamilo_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
+			$deleted_by_Chamilo_folder='_DELETED_';
+			$css_folder_Chamilo='css';
+			$hotpotatoes_folder_Chamilo='HotPotatoes_files';
+			$chat_files_Chamilo='chat_files';
 
 		//end previous fix for count hidden folders
 
@@ -91,7 +91,7 @@
 
 		}
 		echo "};\n";
-		// moved below for Dokeos integration $fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());
+		// moved below for Chamilo integration $fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());
 		echo 'numRows = ' . sizeof($fileList) . ";\n";
 		echo "files = {\n";
 		$count = 1;
@@ -112,7 +112,7 @@
 
 			}
 
-			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']) || $hide_doc_group || $file['name'][0]=='.')//Dokeos fix for hidden items.
+			if((!ereg($deleted_by_Chamilo_file, $file['name']) || !ereg($deleted_by_Chamilo_folder, $file['path'])) || ereg($css_folder_Chamilo, $file['path']) || ereg($hotpotatoes_folder_Chamilo, $file['path']) || ereg($chat_files_Chamilo, $file['path']) || $hide_doc_group || $file['name'][0]=='.')//Chamilo fix for hidden items.
 			{
 
 				$count_hideItem=$count_hideItem+1;
@@ -136,7 +136,7 @@
 			echo (($j++ > 1)?",":'') . "'url':'" . getFileUrl($file['path']) . "'";
 			echo "}\n";				
 		}
-		$fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());//Dokeos fix for hidden files added +$count_hideItem
+		$fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());//Chamilo fix for hidden files added +$count_hideItem
 
 		echo  "};</script>\n";
 	if(!empty($_GET['view']))

+ 46 - 30
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php

@@ -5,13 +5,13 @@
 	 * @link www.phpletter.com
 	 * @since 22/May/2007
 	 *
-	 * Modify system config setting for Dokeos
-	 * @author Juan Carlos Raña
+	 * Modify system config setting for Chamilo
+	 * @author Juan Carlos Raña Trabado
 	 * @since 31/December/2008
 	 */
 
-	include ('../../../../../../inc/global.inc.php'); // Integrating with Dokeos
-	api_block_anonymous_users();// from Dokeos
+	include ('../../../../../../inc/global.inc.php'); // Integrating with Chamilo
+	api_block_anonymous_users();// from Chamilo
 
 	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
 	//$session->gc(); // Disabled for integration with Chamilo
@@ -88,6 +88,24 @@
 	var globalSettings = {'upload_init':false};
 	var queryString = '<?php echo makeQueryString(array('path')); ?>';
 	var paths = {'root':'<?php echo addTrailingSlash(backslashToSlash(CONFIG_SYS_ROOT_PATH)); ?>', 'root_title':'<?php echo LBL_FOLDER_ROOT; ?>'};
+	
+	<!-- Chamilo hack for breadcrumb into shared folders -->
+	var shared_folder = '<?php echo get_lang('SharedDocumentsDirectory');?>';
+	
+	<?php 
+	$course_session = explode('_', basename($currentPath));
+	$course_session = strtolower($course_session[sizeof($course_session) - 1]);
+	?>
+	var shared_folder_session = '<?php echo get_lang('SharedDocumentsDirectory').' ('.api_get_session_name($course_session).')';?>';
+
+	<?php 
+	
+	//$userinfo=Database::get_user_info_from_id(substr(basename($folderInfo['path']), 8));	// problem with $folderInfo['path'] does not refresh?>
+	//var shared_user_folder = '<?php //echo api_get_person_name($userinfo['firstname'], $userinfo['lastname']);?>';
+	var shared_user_folder = '<?php echo get_lang('User');?>';
+
+	<!--end hack -->
+	
 	var parentFolder = {};
 	var urls = {
 			'upload':'<?php echo CONFIG_URL_UPLOAD; ?>',
@@ -209,16 +227,16 @@ $(document).ready(
 <body style="background-color:#E8E8E8;" dir="<?php echo CONFIG_LANG_TEXT_DIRECTION_DEFAULT; ?>"><!-- hack for lang default Chamilo -->
 	<div id="wrapper">
   	<div id="header">
-  		<dl id="currentFolderInfo">
+  		<dl id="currentFolderInfo">        
   			<dt><?php echo LBL_CURRENT_FOLDER_PATH; ?></dt>
-  			<dt id="currentFolderPath"><?php echo $folderInfo['path']; ?></dt><!-- hack for breadcrumb for Dokeos change <dd> by <dt> -->
-
+  			<dt id="currentFolderPath"><?php echo $folderInfo['path']; ?></dt><!-- hack for breadcrumb for Chamilo change <dd> by <dt> -->
   		</dl>
     	<div id="viewList">
-    		
+    	
     	
     			<label><?php echo LBL_BTN_VIEW_OPTIONS; ?></label>
-					<?php 
+                
+					<?php
 						foreach($views as $k=>$v)
 						{
 							?>
@@ -295,14 +313,14 @@ $(document).ready(
     </div>
     
     <div id="body">
-         
-         
+        
       <div id="rightCol">
 	      	<?php
 			if(CONFIG_LOAD_DOC_LATTER )
 			{
 				$currentPath = getCurrentFolderPath();
 				?>
+                
 				<script type="text/javascript">
 				parentFolder = {path:'<?php echo getParentFolderPath($currentPath); ?>'}; 
 				currentFolder = {'friendly_path':'<?php echo transformFilePath($currentPath); ?>'};
@@ -333,7 +351,7 @@ $(document).ready(
       
       <div id="leftCol">
       
-
+ 
 
 				<fieldset id="folderFieldSet" >
 					
@@ -343,7 +361,7 @@ $(document).ready(
 						<tr>
 							<th><?php echo LBL_FOLDER_PATH; ?></th>
 							<td colspan="3" id="folderPath"><?php echo transformFilePath($folderInfo['path']); ?></td>
-						</tr>
+  						</tr>
 						<tr>
 							<th><?php echo LBL_FOLDER_CREATED; ?></th>
 							<td colspan="3" id="folderCtime"><?php echo (!empty($folderInfo['ctime'])?date(DATE_TIME_FORMAT,$folderInfo['ctime']):'&nbsp;') ; ?></td>
@@ -351,7 +369,7 @@ $(document).ready(
 						</tr>
 						<tr>
 							<th><?php echo LBL_FOLDER_MODIFIED; ?></th>
-							 <!-- comment these lines while integrating into dokeos -->
+							 <!-- comment these lines while integrating into Chamilo -->
 							<th><?php //echo LBL_FOLDER_MODIFIED; ?></th>
 						<!--	<td colspan="3" id="folderMtime"><?php //echo (!empty($folderInfo['mtime'])?date(DATE_TIME_FORMAT,$folderInfo['mtime']):'&nbsp;'); ?></td> -->
 						</tr>
@@ -366,7 +384,7 @@ $(document).ready(
 						</tr>
 						
 						<tr>
-							 <!-- comment these lines while integrating into dokeos -->
+							 <!-- comment these lines while integrating into Chamilo -->
 							<th><?php // echo LBL_FOLDER_WRITABLE; ?></th>
 						<!--	<td id="folderWritable"><span class="<?php //echo (isset($folderInfo['is_readable'])?($folderInfo['is_readable']?'flagYes':'flagNo'):'&nbsp;'); ?>">&nbsp;</span></td> -->
 							<th><?php // echo LBL_FOLDER_READABLE; ?></th>
@@ -389,7 +407,7 @@ $(document).ready(
 
 						</tr>
 						<tr>
-							 <!-- comment these lines while integrating into dokeos -->
+							 <!-- comment these lines while integrating into Chamilo -->
 							<th><?php //echo LBL_FILE_MODIFIED; ?></th>
 							<!--<td colspan="3" id="fileMtime"></td> -->
 						</tr>
@@ -404,7 +422,7 @@ $(document).ready(
 							<td  colspan="3" id="fileType"></td>						
 						</tr>
 						<tr>
-							 <!-- comment these lines while integrating into dokeos -->
+							 <!-- comment these lines while integrating into Chamilo -->
 							<th><?php //echo LBL_FILE_WRITABLE; ?></th>
 							<!--<td id="fileWritable"><span class="flagYes">&nbsp;</span></td> -->
 							<th><?php //echo LBL_FILE_READABLE; ?></th>
@@ -434,7 +452,7 @@ $(document).ready(
           	<tbody>
 	          <tr>
 	          	<td>
-	          		<!-- comment these lines while integrating into dokeos -->
+	          		<!-- comment these lines while integrating into Chamilo -->
 	          		<b><?php //echo LBL_SEARCH_NAME; ?></b> <br />
 	            	<input type="text" class="input inputSearch" name="search_name" id="search_name" />
 	          	</td>
@@ -442,7 +460,7 @@ $(document).ready(
 	         </tr>
 	          <tr>
 	          	<td >
-	          	 <!-- comment these lines while integrating into dokeos -->
+	          	 <!-- comment these lines while integrating into Chamilo -->
 	          	<b><?php // echo LBL_SEARCH_FOLDER; ?></b><br />
 	          	<span id="searchFolderContainer">
 	          	<?php
@@ -462,17 +480,17 @@ $(document).ready(
 	          		}else 
 	          		{
 	          	?>
-		            <select class="input inputSearch" name="search_folder" id="search_folder">
+             
+		            <select class="input inputSearchSelect" name="search_folder" id="search_folder"><!-- Chamilo integrating, modify name class for disable by css -->
 		            	<?php 
 		            		
 										foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
 										{
-											//////////////
 											if(hideFolderName($k))
 											{
-												//shows only those permitted by Dokeos
+												//show only those permitted by Chamilo
 												?>
-		                  						<option value="<?php echo $v; ?>" <?php echo (removeTrailingSlash(backslashToSlash(($folderInfo['path']))) == removeTrailingSlash(backslashToSlash(($v)))?' selected="selected"':''); ?>><?php echo hideFolderName(shortenFileName($k, 30)); // shows only those permitted by Dokeos
+		                  						<option value="<?php echo $v; ?>" <?php echo (removeTrailingSlash(backslashToSlash(($folderInfo['path']))) == removeTrailingSlash(backslashToSlash(($v)))?' selected="selected"':''); ?>><?php echo hideFolderName(shortenFileName($k, 30));
 												?></option>
 
 		                  <?php 
@@ -492,16 +510,16 @@ $(document).ready(
         		<!--<input type="text" class="input inputMtime" name="search_mtime_from" id="search_mtime_from" value="<?php //echo (!empty($_GET['search_mtime_from'])?$_GET['search_mtime_from']:''); ?>" />  -->
         		<!--<span class="leftToRightArrow">&nbsp;</span> -->
         		<!--<input type="text" class="input inputMtime" name="search_mtime_to" id="search_mtime_to" value="<?php //echo (!empty($_GET['search_mtime_to'])?$_GET['search_mtime_to']:''); ?>" /> -->
-                 <!--This lines replace above lines while integrating into dokeos -->
+                 <!--This lines replace above lines while integrating into Chamilo -->
                 <input type="hidden" name="search_mtime_from" id="search_mtime_from" value="<?php //echo (!empty($_GET['search_mtime_from'])?$_GET['search_mtime_from']:''); ?>" />
         		<input type="hidden" name="search_mtime_to" id="search_mtime_to" value="<?php //echo (!empty($_GET['search_mtime_to'])?$_GET['search_mtime_to']:''); ?>" />        
         	<!--</td></tr>
 
 			<tr>
-				<td>  <!-- comment these lines while integrating into dokeos -->
+				<td>  <!-- comment these lines while integrating into Chamilo -->
                 </td><td><!--add a col while integrating -->
           	<b><?php  // echo LBL_SEARCH_RECURSIVELY; ?></b>&nbsp;&nbsp;
-		<!--change for Dokeos recursively by default  -->
+		<!--change for Chamilo recursively by default  -->
      <!--     	<input type="radio" name="search_recursively" value="1" id="search_recursively_1" class="radio" <?php //echo (empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php //echo LBL_RECURSIVELY_YES; ?> -->       
         <!--  	<input type="radio" name="search_recursively" value="0" id="search_recursively_0" class="radio" <?php //echo (!empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php //echo LBL_RECURSIVELY_NO; ?> -->
           	</td>
@@ -515,7 +533,7 @@ $(document).ready(
        	
         <p class="searchButtons">
         	<span class="left" id="linkClose" style="display:none">
-                  <!-- comment these lines while integrating into Dokeos -->
+                  <!-- comment these lines while integrating into Chamilo -->
         		<!--<input  type="button" value="<?php // echo LBL_ACTION_CLOSE; ?>" onclick="return cancelSelectFile();"  class="button"> -->
         	</span>
         	<span class="right" id="linkSearch">
@@ -533,8 +551,6 @@ $(document).ready(
   
   </div>
   <div class="clear"></div>
-
-
   
   <div id="ajaxLoading" style="display:none"><img class="ajaxLoadingImg" src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/ajaxLoading.gif" /></div>
   <div id="winUpload" style="display:none">
@@ -728,7 +744,7 @@ $(document).ready(
   	<ul>
   		<li><a href="#" class="contentMenuItem" id="menuSelect"><?php echo MENU_SELECT; ?></a></li>
   		<li><a href="#" class="contentMenuItem"  id="menuPreview"><?php echo MENU_PREVIEW; ?></a></li>
-  		<!--	<li><a href="#" class="contentMenuItem"  id="menuDownload"><?php echo MENU_DOWNLOAD; ?></a></li> Dokeos temporarily disable contextual menu download -->
+  		<!--	<li><a href="#" class="contentMenuItem"  id="menuDownload"><?php echo MENU_DOWNLOAD; ?></a></li> Chamilo temporarily disable contextual menu download -->
   		<li><a href="#" class="contentMenuItem"  id="menuRename"><?php echo MENU_RENAME; ?></a></li>
   		<li><a href="#" class="contentMenuItem"  id="menuEdit"><?php echo MENU_EDIT; ?></a></li>
   		<li><a href="#" class="contentMenuItem"  id="menuCut"><?php echo MENU_CUT; ?></a></li>

+ 29 - 17
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.manager.php

@@ -5,10 +5,11 @@
 	 * @link www.phpletter.com
 	 * @since 22/April/2007
 	 * 
-	 * Modify for Dokeos
+	 * Modify for Chamilo
 	 * @author Juan Carlos Raña
 	 * @since 31/December/2008
 	 */
+	 
 require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.file.php");
 class manager
 {
@@ -89,22 +90,33 @@ class manager
 		}
 		if(is_dir($this->currentFolderPath))
 		{
+						  
 			$file = new file($this->currentFolderPath);
 			$folderInfo = $file->getFileInfo();
 			if(sizeof($folderInfo))
 			{
-				//for Dokeos in a name folder, replace num user by user names
-				if(ereg('sf_user_', basename($this->currentFolderPath)))
+				//for Chamilo in a name folder, replace num user by user names
+				if(preg_match('/sf_user_/',basename($this->currentFolderPath)))
 				{
 					$userinfo=Database::get_user_info_from_id(substr(basename($this->currentFolderPath), 8));
 					$this->currentFolderInfo['name']=api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
 				}
 				else
 				{
-					$this->currentFolderInfo['name']=str_replace('_',' ',basename($this->currentFolderPath));//for Dokeos. Prevent long directory name
+					$this->currentFolderInfo['name']=str_replace('_',' ',basename($this->currentFolderPath));//for Chamilo. Prevent long directory name
+				}				
+				if(preg_match('/shared_folder/', basename($this->currentFolderPath)))
+				{
+					$this->currentFolderInfo['name']=get_lang('SharedDocumentsDirectory');
 				}
-				//end Chamilo		
-				
+				if(preg_match('/shared_folder_session_/',basename($this->currentFolderPath)))
+				{
+					$session = explode('_', basename($this->currentFolderPath));
+					$session = strtolower($session[sizeof($session) - 1]);
+					$this->currentFolderInfo['name']=get_lang('SharedDocumentsDirectory').' ('.api_get_session_name($session).')*';
+				}
+			
+				//end Chamilo
 				$this->currentFolderInfo['subdir']=0;
 				$this->currentFolderInfo['file']=0;
 				$this->currentFolderInfo['ctime']=$folderInfo['ctime'];
@@ -184,11 +196,11 @@ class manager
 					if(is_dir($path) && isListingDocument($path) )
 					{
 						$this->currentFolderInfo['subdir']++;
-						//fix count left folders for Dokeos
-						$deleted_by_dokeos_folder='_DELETED_';
-						$css_folder_dokeos='css';
-						$hotpotatoes_folder_dokeos='HotPotatoes_files';
-						$chat_files_dokeos='chat_files';
+						//fix count left folders for Chamilo
+						$deleted_by_Chamilo_folder='_DELETED_';
+						$css_folder_Chamilo='css';
+						$hotpotatoes_folder_Chamilo='HotPotatoes_files';
+						$chat_files_Chamilo='chat_files';
 						//show group's directory only if I'm member. Or if I'm a teacher. TODO: check groups not necessary because the student dont have access to main folder documents (only to document/group or document/shared_folder). Teachers can access to all groups ?
 						$group_folder='_groupdocs';
 						$hide_doc_group=false;
@@ -202,11 +214,11 @@ class manager
 
 						}
 
-						if(ereg($deleted_by_dokeos_folder, $path)|| ereg($css_folder_dokeos, $path) || ereg($hotpotatoes_folder_dokeos, $path) || ereg($chat_files_dokeos, $path) || $hide_doc_group || $file[0]=='.')
+						if(ereg($deleted_by_Chamilo_folder, $path)|| ereg($css_folder_Chamilo, $path) || ereg($hotpotatoes_folder_Chamilo, $path) || ereg($chat_files_Chamilo, $path) || $hide_doc_group || $file[0]=='.')
 						{
 							$this->currentFolderInfo['subdir']=$this->currentFolderInfo['subdir']-1;
 						}
-						//end fix for Dokeos						
+						//end fix for Chamilo						
 
 						if(!$this->calculateSubdir)
 						{			
@@ -234,13 +246,13 @@ class manager
 								}
 								$this->currentFolderInfo['size'] += $tem['size'];
 								$this->currentFolderInfo['file']++;
-								//fix count left files for Dokeos
-								$deleted_by_dokeos_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
-								if(ereg($deleted_by_dokeos_file, $tem['name']) || $tem['name'][0]=='.')
+								//fix count left files for Chamilo
+								$deleted_by_Chamilo_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
+								if(ereg($deleted_by_Chamilo_file, $tem['name']) || $tem['name'][0]=='.')
 								{
 									$this->currentFolderInfo['file']=$this->currentFolderInfo['file']-1;
 								}
-								///end fix for Dokeos
+								///end fix for Chamilo
 								$tem['path'] = backslashToSlash($path);		
 								$tem['type'] = "file";
 								$tem['flag'] = $flag;

+ 589 - 583
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.pagination.php

@@ -1,584 +1,590 @@
-<?php
-/**
- * Pagination Class
- * @author Logan Cai  (cailongqun [at] yahoo [dot] com [dot] cn)
- * @since 27/Nov/20006
- *
- */
-class pagination
-{
-	var $totalItems = 0;
-	var $itemsPerPage = 30;
-	var $currentPage = 1;
-	var $friendlyUrl = false;
-	var $baseUrl = "";
-	var $pageIndex = "page";
-	var $groupLimit = 5;
-	var $excludedQueryStrings = array();
-	var $totalPages = 0;
-	var $url = "";
-	var $previousText = "Previous";
-	var $nextText = "Next";
-	var $lastText = "Last";
-	var $firstText = "First";
-	var $limitIndex ='limit';
-	var $limits = array(5, 10, 20, 30, 50, 80, 150, 999);
-
-
-	/**
-	 * Contructor
-	 *
-	 * @param boolean $friendlyUrl set the returned url
-	 * as search engine friendly or Normal Url
-	 */
-	function pagination($friendlyUrl=false)
-	{
-		$this->friendlyUrl = $friendlyUrl;
-		$this->__resetCurrentPage();
-	}
-
-	/**
-	 * set maximum number of items per page
-	 *
-	 * @param integer $value maximum number of items per page
-	 */
-	function setLimit($value)
-	{
-		$this->itemsPerPage = intval($value);
-	}
-	/**
-	 * get maximum number of items per page
-	 *
-	 * @return integer
-	 */
-	function getLimit()
-	{
-		return $this->itemsPerPage;
-	}
-
-	/**
-	 * set the total number of items
-	 *
-	 * @param integer $value the total number of items
-	 */
-	function setTotal($value)
-	{
-		$this->totalItems = intval($value);
-	}
-	/**
-	 * get the total number of items
-	 *
-	 * @return integer total number of items
-	 */
-	function getTotal()
-	{
-		return $this->totalItems;
-	}
-	/**
-	 * get total pages will be used to display all records
-	 *
-	 */
-	function getTotalPages()
-	{
-
-		$output = floor(($this->totalItems / $this->itemsPerPage ));
-		if($this->totalItems % $this->itemsPerPage)
-		{
-			$output++;
-		}
-		return $output;
-	}
-
-	/**
-	 * Set the index of URL Query String
-	 *
-	 * @param string $value e.g. page
-	 */
-	function setPageIndex($value)
-	{
-		$this->pageIndex = $value;
-		$this->__resetCurrentPage();
-	}
-
-
-	function getPageIndex()
-	{
-		return $this->pageIndex;
-	}
-	/**
-	 * initiate or reset the current page number
-	 *
-	 */
-	function __resetCurrentPage()
-	{
-		$this->currentPage = ((isset($_GET[$this->pageIndex]) && intval($_GET[$this->pageIndex]) > 0)?intval($_GET[$this->pageIndex]):1);
-	}
-
-	/**
-	 * set the base url used in the links, default is $PHP_SELF
-	 *
-	 * @param string $value the base url
-	 */
-	function setUrl($value="")
-	{
-		if(empty($value))
-		{
-			if($this->friendlyUrl)
-			{
-				$this->url = "http://" . $_SERVER['HTTP_HOST'] . "/";
-			}else
-			{
-				$this->url = $_SERVER['PHP_SELF'];
-			}
-		}else
-		{
-			$this->url = $value;
-		}
-
-	}
-
-	/**
-	 * get the base url variable
-	 *
-	 * @return string the base url
-	 */
-	function getUrl()
-	{
-
-		if(empty($this->url))
-		{
-			$this->setUrl();
-
-		}
-		return $this->url;
-	}
-
-	/**
-	 * set base url for pagination links after exculed those keys
-	 * identified on excluded query strings
-	 */
-	function __setBaseUrl()
-	{
-
-		if(empty($this->url))
-		{
-			$this->getUrl();
-		}
-
-		if($this->friendlyUrl)
-		{
-			$this->baseUrl = $this->getUrl();
-		}else
-		{
-
-			$appendingQueryStrings = array();
-			$this->excludedQueryStrings[$this->pageIndex] =$this->pageIndex;
-			foreach($_GET as $k=>$v)
-			{
-				if((array_search($k, $this->excludedQueryStrings) === false ))
-				{
-					$appendingQueryStrings[$k] = $k . "=" . $v;
-				}
-			}
-			if(sizeof($appendingQueryStrings))
-			{
-				$this->baseUrl = $this->__appendQueryString($this->url, implode("&", $appendingQueryStrings));
-			}else
-			{
-				$this->baseUrl = $this->getUrl();
-			}
-
-		}
-
-
-	}
-	/**
-	 * get base url for pagination links aftr excluded those key
-	 * identified on excluded query strings
-	 *
-	 */
-	function __getBaseUrl()
-	{
-
-		if(empty($this->baseUrl))
-		{
-
-			$this->__setBaseUrl();
-		}
-		return $this->baseUrl;
-	}
-
-
-	/**
-	 * get the first item number
-	 *
-	 * @return interger the first item number displayed within current page
-	 */
-	function getFirstItem()
-	{
-		$output = 0;
-		$temStartItemNumber = (($this->currentPage - 1) * $this->itemsPerPage + 1);
-		if($this->totalItems && $temStartItemNumber <= $this->totalItems )
-		{
-
-			$output = $temStartItemNumber;
-		}
-		return $output;
-	}
-	/**
-	 * get the last item number displayed within current page
-	 *
-	 * @return interger the last item number
-	 */
-	function getLastItem()
-	{
-		$output = 0;
-		$temEndItemNumber = (($this->currentPage) * $this->itemsPerPage);
-		if($this->totalItems)
-		{
-			if($temEndItemNumber <= $this->totalItems)
-			{
-				$output = $temEndItemNumber;
-			}else
-			{
-				$output = $this->totalItems;
-			}
-
-		}
-		return $output;
-	}
-	/**
-	 * set  page groupings limit
-	 * used for previous 1 2 3 4 5 next
-	 *
-	 * @param unknown_type $value
-	 */
-	function setGroupLimit($value)
-	{
-		$this->groupLimit = intval($value);
-	}
-	/**
-	 * get page grouping limit
-	 *
-	 * @return integer the page grouping limit
-	 */
-	function getGroupLimit()
-	{
-		return $this->groupLimit;
-	}
-	/**
-	 * get the page offset number
-	 * used for Query . e.g SELECT SQL_CALC_FOUND_ROWS *
-	 * 						FROM mytable LIMIT getPageOffset(), getItemsPerPage()
-	 *
-	 * @return iner
-	 */
-	function getPageOffset()
-	{
-		return (($this->currentPage - 1)  * $this->itemsPerPage);
-	}
-	/**
-	 * get the last url if any
-	 * @return  string the last url
-	 */
-	function getLastUrl()
-	{
-
-		$url = "";
-		$totalPages = $this->getTotalPages();
-		if($this->currentPage < $totalPages)
-		{
-			$url = $this->__getBaseUrl();
-
-			if($this->friendlyUrl)
-			{
-				$url .= $this->pageIndex . $totalPages . "/";
-			}else
-			{
-				$url = $this->__appendQueryString($url, $this->pageIndex . "=" . $totalPages);
-			}
-			$url = sprintf('<a href="%s" class="pagination_last"><span>%s</span></a>',
-			$url,
-			$this->lastText);
-		}
-		return $url;
-	}
-
-
-
-
-	/**
-	 * get the first url if any
-	 * @return string the first url
-	 */
-
-	function getFirstUrl()
-	{
-		$url = "";
-		if($this->currentPage > 1)
-		{
-			$url = $this->__getBaseUrl();
-			if($this->friendlyUrl)
-			{
-				$url .= $this->pageIndex .  "1/";
-			}else
-			{
-				$url = $this->__appendQueryString($url, $this->pageIndex . "=1");
-			}
-			$url = sprintf('<a href="%s" class="pagination_first"><span>%s</span></a>',
-			$url,
-			$this->firstText);
-
-		}
-		return $url;
-	}
-
-	/**
-	 * get the previous page url if anywhere
-	 *
-	 * @param array $excludedQueryStrings excluded the value from $_GET
-	 * @return string the previous page url
-	 */
-	function getPreviousUrl()
-	{
-		$url = "";
-		if($this->currentPage > 1 && $this->totalItems > 0 )
-		{
-			$url = $this->__getBaseUrl();
-			if($this->friendlyUrl)
-			{
-				$url .= $this->pageIndex . ($this->currentPage - 1) . "/";
-			}else
-			{
-				$url = $this->__appendQueryString($url, $this->pageIndex . "=" . ($this->currentPage -1));
-			}
-			$url = sprintf('<a href="%s" class="pagination_previous"><span>%s</span></a>',
-			$url,
-			$this->previousText);
-
-		}
-
-		return $url;
-	}
-	/**
-	 * get the next page url if anywhere
-	 *
-	 * @param array $excludedQueryStrings excluded the value from $_GET
-	 * @return string the next page url
-	 */
-	function getNextUrl()
-	{
-		$url = "";
-		if($this->totalItems > ($this->currentPage * $this->itemsPerPage))
-		{
-			$url = $this->__getBaseUrl();
-			if($this->friendlyUrl)
-			{
-				$url .= $this->pageIndex . ($this->currentPage + 1) . "/";
-			}else
-			{
-				$url = $this->__appendQueryString($url, $this->pageIndex . "=" . ($this->currentPage + 1));
-			}
-			$url = sprintf('<a href="%s" class="pagination_next"><span>%s</span></a>',
-			$url,
-			$this->nextText);
-		}
-		return $url;
-
-	}
-
-	/**
-	 * get the group page links  e.g. 1,2,3,4,5
-	 * return format
-	 * <a class="pagination_group" href='yoururl'>1</a>
-	 * <a class="pagination_group active" href='#'>2</a>
-	 * <a class="pagination_group" href='yoururl'>3</a>
-	 */
-	function getGroupUrls()
-	{
-		$output = "";
-		if($this->totalItems > 0)
-		{
-			$displayedPages = 0;
-			$url = $this->__getBaseUrl();
-			$totalPages = $this->getTotalPages();
-			// find halfway point
-			$groupLimitHalf = floor($this->groupLimit / 2);
-			// determine what item/page we start with
-			$itemStart = $this->currentPage - $groupLimitHalf;
-			$itemStart = ($itemStart > 0 && $itemStart <= $totalPages)?$itemStart:1;
-			$itemEnd = $itemStart;
-
-			while($itemEnd < ($itemStart + $this->groupLimit - 1) && $itemEnd < $totalPages)
-			{
-				$itemEnd++;
-			}
-
-
-			if($totalPages > ($itemEnd - $itemStart))
-			{
-				for($i = $itemStart; $i > 1 && ($itemEnd - $itemStart + 1) < $this->groupLimit; $i--)
-				{
-					$itemStart--;
-				}
-			}
-
-			for($item = $itemStart; $item <= $itemEnd; $item++)
-			{
-				if($item != $this->currentPage)
-				{//it is not the active link
-					if($this->friendlyUrl)
-					{
-						$temUrl = $url . $this->pageIndex . $item .   "/";
-					}else
-					{
-						$temUrl  = $this->__appendQueryString($url, $this->pageIndex . "=" . $item);
-					}
-					$output .= sprintf(' <a class="pagination_group" href="%s"><span>%d</span></a> ', $temUrl, $item);
-				}else
-				{//active link
-					$output .= sprintf(' <a class="pagination_group pagination_active" href="#"><span>%d</span></a> ', $item);
-				}
-			}
-		}
-		return $output;
-	}
-	/**
-	 * set the text of previous page link
-	 *
-	 * @param string $value
-	 */
-	function setPreviousText($value)
-	{
-		$this->previousText = $value;
-	}
-	/**
-	 * set the text of first page link
-	 *
-	 * @param string $value
-	 */
-	function setFirstText($value)
-	{
-		$this->firstText = $value;
-	}
-	/**
-	 * set the text of next page link
-	 *
-	 * @param string $value
-	 */
-
-	function setNextText($value)
-	{
-		$this->nextText = $value;
-	}
-	/**
-	 * set the text of last page link
-	 *
-	 * @param string $value
-	 */
-	function setLastText($value)
-	{
-		$this->lastText = $value;
-	}
-
-	/**
-	 * set the excluded query string from $_GET;
-	 *
-	 * @param array the lists of the query string keys
-	 */
-
-	function setExcludedQueryString($values = array())
-	{
-		$this->excludedQueryStrings = $values;
-	}
-
-	function getExcludedQueryString()
-	{
-		return $this->excludedQueryStrings;
-	}
-
-
-	/**
-	 * add extra query stiring to a url
-	 * @param string $baseUrl
-	 * @param string $extra the query string added to the base url
-	 */
-	function __appendQueryString($baseUrl, $extra)
-	{
-		$output = trim($baseUrl);
-		if(strpos($baseUrl, "?") !== false)
-		{
-			$output .= "&" . $extra;
-		}else
-		{
-			$output .= "?" . $extra;
-		}
-		return $output;
-	}
-	/**
-	 * return the html
-	 *
-	 * @param integer $type
-	 */
-	function getPaginationHTML($type=1, $cssClass="pagination")
-	{
-		$output = '';
-		$output .= "<div class=\"pagination_content\"><p class=\"$cssClass\">\n";
-		switch($type)
-		{
-			case "2":
-				$output .= "<span class=\"pagination_summany\">" . $this->getFirstItem() . " to " . $this->getLastItem() . " of " . $this->getTotal() . " results.</span> ";	
-			if($previousUrl = $this->getPreviousUrl())
-			{
-				$output .= " " . $previousUrl;
-			}
-
-			if($nextUrl = $this->getNextUrl())
-			{
-				$output .= " " . $nextUrl;
-			}							
-				break;
-			case 1:
-				//get full summary pagination
-			default:
-				$output .= "<span class=\"pagination_summany\">" . $this->getFirstItem() . "/" . $this->getLastItem() . " (" . $this->getTotal() . ")</span> ";
-			if($firstUrl = $this->getFirstUrl())
-			{
-				$output .= " " . $firstUrl;
-			}
-			if($previousUrl = $this->getPreviousUrl())
-			{
-				$output .= " " . $previousUrl;
-			}
-
-			if($groupUrls = $this->getGroupUrls())
-			{
-				$output .= " " . $groupUrls;
-			}
-			if($nextUrl = $this->getNextUrl())
-			{
-				$output .= " " . $nextUrl;
-			}
-			if($lastUrl = $this->getLastUrl())
-			{
-				$output .= " " . $lastUrl;
-			}
-			$itemPerPage = '';
-			$itemPerPage .= "<select name=\"" . $this->limitIndex . "\" id=\"limit\" class=\"input inputLimit\" onchange=\"changePaginationLimit();\">\n";
-			foreach ($this->limits as $v)
-			{
-				$itemPerPage .= "<option value=\"" . $v . "\" " . ($v==$this->itemsPerPage?'selected="selected"':'') . ">" . $v . "</option>\n";
-			}
-			$itemPerPage .= "</select>\n"; 
-			$output .= "<span class=\"pagination_items_per_page\">";
-			$output .= sprintf(PAGINATION_ITEMS_PER_PAGE, $itemPerPage);
-			$output .= "</span>";
-			$output .= "<span class=\"pagination_parent\"><a href=\"#\" onclick=\"goParentFolder();\" id=\"pagination_parent_link\" title=\"" . PAGINATION_GO_PARENT . "\">&nbsp;</a></span>";
-		}
-
-		$output .= "</p></div>";
-		return $output;
-	}
-
-}
+<?php
+/**
+ * Pagination Class
+ * @author Logan Cai  (cailongqun [at] yahoo [dot] com [dot] cn)
+ * @since 27/Nov/20006
+ *
+ */
+class pagination
+{
+	var $totalItems = 0;
+	var $itemsPerPage = 30;
+	var $currentPage = 1;
+	var $friendlyUrl = false;
+	var $baseUrl = "";
+	var $pageIndex = "page";
+	var $groupLimit = 5;
+	var $excludedQueryStrings = array();
+	var $totalPages = 0;
+	var $url = "";
+	var $previousText = "Previous";
+	var $nextText = "Next";
+	var $lastText = "Last";
+	var $firstText = "First";
+	var $limitIndex ='limit';
+	var $limits = array(5, 10, 20, 30, 50, 80, 150, 999);
+
+
+	/**
+	 * Contructor
+	 *
+	 * @param boolean $friendlyUrl set the returned url
+	 * as search engine friendly or Normal Url
+	 */
+	function pagination($friendlyUrl=false)
+	{
+		$this->friendlyUrl = $friendlyUrl;
+		$this->__resetCurrentPage();
+	}
+
+	/**
+	 * set maximum number of items per page
+	 *
+	 * @param integer $value maximum number of items per page
+	 */
+	function setLimit($value)
+	{
+		$this->itemsPerPage = intval($value);
+	}
+	/**
+	 * get maximum number of items per page
+	 *
+	 * @return integer
+	 */
+	function getLimit()
+	{
+		return $this->itemsPerPage;
+	}
+
+	/**
+	 * set the total number of items
+	 *
+	 * @param integer $value the total number of items
+	 */
+	function setTotal($value)
+	{
+		$this->totalItems = intval($value);
+	}
+	/**
+	 * get the total number of items
+	 *
+	 * @return integer total number of items
+	 */
+	function getTotal()
+	{
+		return $this->totalItems;
+	}
+	/**
+	 * get total pages will be used to display all records
+	 *
+	 */
+	function getTotalPages()
+	{
+
+		$output = floor(($this->totalItems / $this->itemsPerPage ));
+		if($this->totalItems % $this->itemsPerPage)
+		{
+			$output++;
+		}
+		return $output;
+	}
+
+	/**
+	 * Set the index of URL Query String
+	 *
+	 * @param string $value e.g. page
+	 */
+	function setPageIndex($value)
+	{
+		$this->pageIndex = $value;
+		$this->__resetCurrentPage();
+	}
+
+
+	function getPageIndex()
+	{
+		return $this->pageIndex;
+	}
+	/**
+	 * initiate or reset the current page number
+	 *
+	 */
+	function __resetCurrentPage()
+	{
+		$this->currentPage = ((isset($_GET[$this->pageIndex]) && intval($_GET[$this->pageIndex]) > 0)?intval($_GET[$this->pageIndex]):1);
+	}
+
+	/**
+	 * set the base url used in the links, default is $PHP_SELF
+	 *
+	 * @param string $value the base url
+	 */
+	function setUrl($value="")
+	{
+		if(empty($value))
+		{
+			if($this->friendlyUrl)
+			{
+				$this->url = "http://" . $_SERVER['HTTP_HOST'] . "/";
+			}else
+			{
+				$this->url = $_SERVER['PHP_SELF'];
+			}
+		}else
+		{
+			$this->url = $value;
+		}
+
+	}
+
+	/**
+	 * get the base url variable
+	 *
+	 * @return string the base url
+	 */
+	function getUrl()
+	{
+
+		if(empty($this->url))
+		{
+			$this->setUrl();
+
+		}
+		return $this->url;
+	}
+
+	/**
+	 * set base url for pagination links after exculed those keys
+	 * identified on excluded query strings
+	 */
+	function __setBaseUrl()
+	{
+
+		if(empty($this->url))
+		{
+			$this->getUrl();
+		}
+
+		if($this->friendlyUrl)
+		{
+			$this->baseUrl = $this->getUrl();
+		}else
+		{
+
+			$appendingQueryStrings = array();
+			$this->excludedQueryStrings[$this->pageIndex] =$this->pageIndex;
+			foreach($_GET as $k=>$v)
+			{
+				if((array_search($k, $this->excludedQueryStrings) === false ))
+				{
+					$appendingQueryStrings[$k] = $k . "=" . $v;
+				}
+			}
+			if(sizeof($appendingQueryStrings))
+			{
+				$this->baseUrl = $this->__appendQueryString($this->url, implode("&", $appendingQueryStrings));
+			}else
+			{
+				$this->baseUrl = $this->getUrl();
+			}
+
+		}
+
+
+	}
+	/**
+	 * get base url for pagination links aftr excluded those key
+	 * identified on excluded query strings
+	 *
+	 */
+	function __getBaseUrl()
+	{
+
+		if(empty($this->baseUrl))
+		{
+
+			$this->__setBaseUrl();
+		}
+		return $this->baseUrl;
+	}
+
+
+	/**
+	 * get the first item number
+	 *
+	 * @return interger the first item number displayed within current page
+	 */
+	function getFirstItem()
+	{
+		$output = 0;
+		$temStartItemNumber = (($this->currentPage - 1) * $this->itemsPerPage + 1);
+		if($this->totalItems && $temStartItemNumber <= $this->totalItems )
+		{
+
+			$output = $temStartItemNumber;
+		}
+		return $output;
+	}
+	/**
+	 * get the last item number displayed within current page
+	 *
+	 * @return interger the last item number
+	 */
+	function getLastItem()
+	{
+		$output = 0;
+		$temEndItemNumber = (($this->currentPage) * $this->itemsPerPage);
+		if($this->totalItems)
+		{
+			if($temEndItemNumber <= $this->totalItems)
+			{
+				$output = $temEndItemNumber;
+			}else
+			{
+				$output = $this->totalItems;
+			}
+
+		}
+		return $output;
+	}
+	/**
+	 * set  page groupings limit
+	 * used for previous 1 2 3 4 5 next
+	 *
+	 * @param unknown_type $value
+	 */
+	function setGroupLimit($value)
+	{
+		$this->groupLimit = intval($value);
+	}
+	/**
+	 * get page grouping limit
+	 *
+	 * @return integer the page grouping limit
+	 */
+	function getGroupLimit()
+	{
+		return $this->groupLimit;
+	}
+	/**
+	 * get the page offset number
+	 * used for Query . e.g SELECT SQL_CALC_FOUND_ROWS *
+	 * 						FROM mytable LIMIT getPageOffset(), getItemsPerPage()
+	 *
+	 * @return iner
+	 */
+	function getPageOffset()
+	{
+		return (($this->currentPage - 1)  * $this->itemsPerPage);
+	}
+	/**
+	 * get the last url if any
+	 * @return  string the last url
+	 */
+	function getLastUrl()
+	{
+
+		$url = "";
+		$totalPages = $this->getTotalPages();
+		if($this->currentPage < $totalPages)
+		{
+			$url = $this->__getBaseUrl();
+
+			if($this->friendlyUrl)
+			{
+				$url .= $this->pageIndex . $totalPages . "/";
+			}else
+			{
+				$url = $this->__appendQueryString($url, $this->pageIndex . "=" . $totalPages);
+			}
+			$url = sprintf('<a href="%s" class="pagination_last"><span>%s</span></a>',
+			$url,
+			$this->lastText);
+		}
+		return $url;
+	}
+
+
+
+
+	/**
+	 * get the first url if any
+	 * @return string the first url
+	 */
+
+	function getFirstUrl()
+	{
+		$url = "";
+		if($this->currentPage > 1)
+		{
+			$url = $this->__getBaseUrl();
+			if($this->friendlyUrl)
+			{
+				$url .= $this->pageIndex .  "1/";
+			}else
+			{
+				$url = $this->__appendQueryString($url, $this->pageIndex . "=1");
+			}
+			$url = sprintf('<a href="%s" class="pagination_first"><span>%s</span></a>',
+			$url,
+			$this->firstText);
+
+		}
+		return $url;
+	}
+
+	/**
+	 * get the previous page url if anywhere
+	 *
+	 * @param array $excludedQueryStrings excluded the value from $_GET
+	 * @return string the previous page url
+	 */
+	function getPreviousUrl()
+	{
+		$url = "";
+		if($this->currentPage > 1 && $this->totalItems > 0 )
+		{
+			$url = $this->__getBaseUrl();
+			if($this->friendlyUrl)
+			{
+				$url .= $this->pageIndex . ($this->currentPage - 1) . "/";
+			}else
+			{
+				$url = $this->__appendQueryString($url, $this->pageIndex . "=" . ($this->currentPage -1));
+			}
+			$url = sprintf('<a href="%s" class="pagination_previous"><span>%s</span></a>',
+			$url,
+			$this->previousText);
+
+		}
+
+		return $url;
+	}
+	/**
+	 * get the next page url if anywhere
+	 *
+	 * @param array $excludedQueryStrings excluded the value from $_GET
+	 * @return string the next page url
+	 */
+	function getNextUrl()
+	{
+		$url = "";
+		if($this->totalItems > ($this->currentPage * $this->itemsPerPage))
+		{
+			$url = $this->__getBaseUrl();
+			if($this->friendlyUrl)
+			{
+				$url .= $this->pageIndex . ($this->currentPage + 1) . "/";
+			}else
+			{
+				$url = $this->__appendQueryString($url, $this->pageIndex . "=" . ($this->currentPage + 1));
+			}
+			$url = sprintf('<a href="%s" class="pagination_next"><span>%s</span></a>',
+			$url,
+			$this->nextText);
+		}
+		return $url;
+
+	}
+
+	/**
+	 * get the group page links  e.g. 1,2,3,4,5
+	 * return format
+	 * <a class="pagination_group" href='yoururl'>1</a>
+	 * <a class="pagination_group active" href='#'>2</a>
+	 * <a class="pagination_group" href='yoururl'>3</a>
+	 */
+	function getGroupUrls()
+	{
+		$output = "";
+		if($this->totalItems > 0)
+		{
+			$displayedPages = 0;
+			$url = $this->__getBaseUrl();
+			$totalPages = $this->getTotalPages();
+			// find halfway point
+			$groupLimitHalf = floor($this->groupLimit / 2);
+			// determine what item/page we start with
+			$itemStart = $this->currentPage - $groupLimitHalf;
+			$itemStart = ($itemStart > 0 && $itemStart <= $totalPages)?$itemStart:1;
+			$itemEnd = $itemStart;
+
+			while($itemEnd < ($itemStart + $this->groupLimit - 1) && $itemEnd < $totalPages)
+			{
+				$itemEnd++;
+			}
+
+
+			if($totalPages > ($itemEnd - $itemStart))
+			{
+				for($i = $itemStart; $i > 1 && ($itemEnd - $itemStart + 1) < $this->groupLimit; $i--)
+				{
+					$itemStart--;
+				}
+			}
+
+			for($item = $itemStart; $item <= $itemEnd; $item++)
+			{
+				if($item != $this->currentPage)
+				{//it is not the active link
+					if($this->friendlyUrl)
+					{
+						$temUrl = $url . $this->pageIndex . $item .   "/";
+					}else
+					{
+						$temUrl  = $this->__appendQueryString($url, $this->pageIndex . "=" . $item);
+					}
+					$output .= sprintf(' <a class="pagination_group" href="%s"><span>%d</span></a> ', $temUrl, $item);
+				}else
+				{//active link
+					$output .= sprintf(' <a class="pagination_group pagination_active" href="#"><span>%d</span></a> ', $item);
+				}
+			}
+		}
+		return $output;
+	}
+	/**
+	 * set the text of previous page link
+	 *
+	 * @param string $value
+	 */
+	function setPreviousText($value)
+	{
+		$this->previousText = $value;
+	}
+	/**
+	 * set the text of first page link
+	 *
+	 * @param string $value
+	 */
+	function setFirstText($value)
+	{
+		$this->firstText = $value;
+	}
+	/**
+	 * set the text of next page link
+	 *
+	 * @param string $value
+	 */
+
+	function setNextText($value)
+	{
+		$this->nextText = $value;
+	}
+	/**
+	 * set the text of last page link
+	 *
+	 * @param string $value
+	 */
+	function setLastText($value)
+	{
+		$this->lastText = $value;
+	}
+
+	/**
+	 * set the excluded query string from $_GET;
+	 *
+	 * @param array the lists of the query string keys
+	 */
+
+	function setExcludedQueryString($values = array())
+	{
+		$this->excludedQueryStrings = $values;
+	}
+
+	function getExcludedQueryString()
+	{
+		return $this->excludedQueryStrings;
+	}
+
+
+	/**
+	 * add extra query stiring to a url
+	 * @param string $baseUrl
+	 * @param string $extra the query string added to the base url
+	 */
+	function __appendQueryString($baseUrl, $extra)
+	{
+		$output = trim($baseUrl);
+		if(strpos($baseUrl, "?") !== false)
+		{
+			$output .= "&" . $extra;
+		}else
+		{
+			$output .= "?" . $extra;
+		}
+		return $output;
+	}
+	/**
+	 * return the html
+	 *
+	 * @param integer $type
+	 */
+	function getPaginationHTML($type=1, $cssClass="pagination")
+	{
+		$output = '';
+		$output .= "<div class=\"pagination_content\"><p class=\"$cssClass\">\n";
+		switch($type)
+		{
+			case "2":
+				//comment while integrating with Chamilo
+			
+				//$output .= "<span class=\"pagination_summany\">" . $this->getFirstItem() . " to " . $this->getLastItem() . " of " . $this->getTotal() . " results.</span> ";	
+			//if($previousUrl = $this->getPreviousUrl())
+			//{
+			//	$output .= " " . $previousUrl;
+			//}
+
+			//if($nextUrl = $this->getNextUrl())
+			{
+			//	$output .= " " . $nextUrl;
+			}							
+				break;
+			case 1:
+				//get full summary pagination
+			default:
+				//$output .= "<span class=\"pagination_summany\">" . $this->getFirstItem() . "/" . $this->getLastItem() . " (" . $this->getTotal() . ")</span> ";
+			//if($firstUrl = $this->getFirstUrl())
+			//{
+			//	$output .= " " . $firstUrl;
+			//}
+			//if($previousUrl = $this->getPreviousUrl())
+			//{
+			//	$output .= " " . $previousUrl;
+			//}
+
+			//if($groupUrls = $this->getGroupUrls())
+			//{
+			//	$output .= " " . $groupUrls;
+			//}
+			//if($nextUrl = $this->getNextUrl())
+			//{
+			//	$output .= " " . $nextUrl;
+			//}
+			//if($lastUrl = $this->getLastUrl())
+			//{
+			//	$output .= " " . $lastUrl;
+			//}
+			//$itemPerPage = '';
+			//$itemPerPage .= "<select name=\"" . $this->limitIndex . "\" id=\"limit\" class=\"input inputLimit\" onchange=\"changePaginationLimit();\">\n";
+			//foreach ($this->limits as $v)
+			//{
+			//	$itemPerPage .= "<option value=\"" . $v . "\" " . ($v==$this->itemsPerPage?'selected="selected"':'') . ">" . $v . "</option>\n";
+			//}
+			//$itemPerPage .= "</select>\n"; 
+		
+		    $itemPerPage ="100000";//hack for Chamilo
+			//$output .= "<span class=\"pagination_items_per_page\">";
+			//$output .= sprintf(PAGINATION_ITEMS_PER_PAGE, $itemPerPage);
+			//$output .= "</span>";
+			
+			//end comment while integrating with Chamilo
+			$output .= "<span class=\"pagination_parent\"><a href=\"#\" onclick=\"goParentFolder();\" id=\"pagination_parent_link\" title=\"" . PAGINATION_GO_PARENT . "\">&nbsp;".PAGINATION_GO_PARENT."</a></span>";
+		}
+
+		$output .= "</p></div>";
+		return $output;
+	}
+
+}
 ?>

+ 18 - 1
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/jscripts/ajaxfilemanager_c.js

@@ -196,7 +196,24 @@ return'';};function parseCurrentFolder()
 {if(i==0)
 {parentPath+=paths.root;str+='/<a href="'+appendQueryString(url,'path='+parentPath,['path'])+'"><span class="folderRoot">'+paths.root_title+'</span></a>'}else
 {if(folders[i]!='')
-{parentPath+=folders[i]+'/';str+='/<a href="'+appendQueryString(url,'path='+parentPath,['path'])+'"><span class="folderSub">'+folders[i]+'</span></a>';}}}
+{
+//hack for Chamilo: rename breadcrumbs into shared folders
+if(folders[i]=='shared_folder')
+{
+	parentPath+=folders[i]+'/';str+='/<a href="'+appendQueryString(url,'path='+parentPath,['path'])+'"><span class="folderSub">'+shared_folder+'</span></a>';
+	
+}
+else if (folders[i].indexOf('shared_folder_session_')!=-1) {
+	parentPath+=folders[i]+'/';str+='/<a href="'+appendQueryString(url,'path='+parentPath,['path'])+'"><span class="folderSub">'+shared_folder_session+'</span></a>';
+}
+else if (folders[i].indexOf('sf_user_')!=-1) {
+	parentPath+=folders[i]+'/';str+='/<a href="'+appendQueryString(url,'path='+parentPath,['path'])+'"><span class="folderSub">'+shared_user_folder+'</span></a>';
+}
+else{
+	parentPath+=folders[i]+'/';str+='/<a href="'+appendQueryString(url,'path='+parentPath,['path'])+'"><span class="folderSub">'+folders[i]+'</span></a>';
+}
+//end hack
+}}}
 $('#currentFolderPath').empty().append(str);$('#currentFolderPath a').each(function()
 {doEnableFolderBrowsable(this,$(this).attr('href'));});};function parsePagination()
 {$('p.pagination a[@id!=pagination_parent_link]').each(function()

+ 9 - 3
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/theme/default/css/fckeditor.css

@@ -1,4 +1,4 @@
-/*~~~~~~ Hack for Dokeos ~~~~~~~~*/
+/*~~~~~~ Hack for Chamilo ~~~~~~~~*/
 /*~~~~~~Global Setting ~~~~~~~~*/
 html, body{
     margin: 0px;
@@ -103,6 +103,9 @@ overflow-x: hidden;
 .radio{
 	background-color:none;
 }
+.inputSearchSelect{
+	visibility:hidden;
+}
 .calendar_trigger{
 	background:none;
 	border:none;
@@ -300,7 +303,6 @@ span.fileZip{background-image:url(../images/small_icon/fileZip.png);}
 
 span.folderShared{background-image:url(../images/small_icon/folderShared.png);}
 
-
 /* big icon */
 dt.folderEmpty, dt.folder, dt.folderParent,
 dt.fileUnknown, dt.fileText, dt.fileWord,
@@ -419,10 +421,11 @@ p.pagination{
 	border-bottom-style: solid;
 	border-bottom-color: #FFFFFF;
 }
+
 #pagination_parent_link
 {
     background: url(../images/go_parent.png) no-repeat 100% 50%;
-    padding: 2px 6px 2px 10px;
+    padding: 2px 30px 2px 370px;	
 }
 a.pagination_first,
 a.pagination_previous,
@@ -508,6 +511,9 @@ a.pagination_active{font-weight: bold; color: #CC0000;}
 
 }
 
+.search_folder{ 
+visibility:hidden;	
+}
 /**  Detail View */
 #tableList{
 font-size:100%;

+ 0 - 0
main/lang/bulgarian/admin.inc.php