Juan Carlos Raña 14 年 前
コミット
0a66cc193b

+ 26 - 17
main/admin/add_users_to_group.php

@@ -1,4 +1,4 @@
-<?php //$id: $
+<?php
 /* For licensing terms, see /license.txt */
 /**
 *	@package chamilo.admin
@@ -19,6 +19,7 @@ require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
 
+global $_configuration;
 // Access restrictions
 api_protect_admin_script(true);
 
@@ -30,6 +31,7 @@ $interbreadcrumb[]=array('url' => 'group_list.php','name' => get_lang('GroupList
 $tbl_group			= Database::get_main_table(TABLE_MAIN_GROUP);
 $tbl_user			= Database::get_main_table(TABLE_MAIN_USER);
 $tbl_group_rel_user	= Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
+$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
 
 // setting the name of the tool
 $tool_name = get_lang('SubscribeUsersToGroup');
@@ -43,8 +45,8 @@ if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
 //checking for extra field with filter on
 $xajax = new xajax();
 $xajax->registerFunction('search_users');
-function search_users($needle,$type,$relation_type) {
-	global $tbl_user,$tbl_group_rel_user,$group_id,$_configuration;
+function search_users($needle,$type,$relation_type) {    
+	global $tbl_user,$tbl_user_rel_access_url, $tbl_group_rel_user,$group_id,$_configuration;
 	$xajax_response = new XajaxResponse();
 	$return = $return_origin = $return_destination = '';
 	$without_user_id = $without_user_id = $condition_relation = '';
@@ -53,7 +55,7 @@ function search_users($needle,$type,$relation_type) {
 		$group_id = intval($group_id);
 		$relation_type = intval($relation_type);
 		// get user_id from relation type and group id
-		$sql = "SELECT user_id FROM $tbl_group_rel_user
+	    $sql = "SELECT user_id FROM $tbl_group_rel_user
 				WHERE group_id = '$group_id'
 				AND relation_type IN (".GROUP_USER_PERMISSION_ADMIN.",".GROUP_USER_PERMISSION_READER.",".GROUP_USER_PERMISSION_PENDING_INVITATION.",".GROUP_USER_PERMISSION_MODERATOR.") ";
 		$res = Database::query($sql);
@@ -62,10 +64,10 @@ function search_users($needle,$type,$relation_type) {
 			while ($row = Database::fetch_row($res)) {
 				$user_ids[] = $row[0];
 			}
-			$without_user_id = " AND user_id NOT IN(".implode(',',$user_ids).") ";
+			$without_user_id = " AND user.user_id NOT IN(".implode(',',$user_ids).") ";
 		}
 
-		if ($relation_type==GROUP_USER_PERMISSION_PENDING_INVITATION) {
+		if ($relation_type == GROUP_USER_PERMISSION_PENDING_INVITATION) {
 			$condition_relation = " AND groups.relation_type IN (".GROUP_USER_PERMISSION_PENDING_INVITATION.",".GROUP_USER_PERMISSION_READER.") ";
 		} else {
 			$condition_relation = " AND groups.relation_type = '$relation_type' ";
@@ -88,6 +90,7 @@ function search_users($needle,$type,$relation_type) {
 		} else {
 			$return_destination .= '<select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" style="width:360px;"></select>';
 		}
+		
 		$xajax_response -> addAssign('ajax_destination_list','innerHTML',api_utf8_encode($return_destination));
 
 	} else {
@@ -110,7 +113,7 @@ function search_users($needle,$type,$relation_type) {
 		$needle = Database::escape_string($needle);
 		$needle = api_convert_encoding($needle, $charset, 'utf-8');
 		$user_anonymous=api_get_anonymous_id();
-		$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+		
 
 		$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
 		if ($type == 'single') {
@@ -148,8 +151,8 @@ function search_users($needle,$type,$relation_type) {
 		} else {
 			// multiple
 			if (!empty($group_id) && !empty($relation_type)) {
-				$sql = "SELECT user_id, username, lastname, firstname FROM $tbl_user user
-					WHERE ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND user_id<>'$user_anonymous' $without_user_id $order_clause ";
+				$sql = "SELECT user_id, username, lastname, firstname FROM $tbl_user user 
+				        WHERE ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND user_id<>'$user_anonymous' $without_user_id $order_clause ";
 				if ($_configuration['multiple_access_urls']) {
 					$access_url_id = api_get_current_access_url_id();
 					if ($access_url_id != -1) {
@@ -160,6 +163,7 @@ function search_users($needle,$type,$relation_type) {
 								AND user.user_id<>'$user_anonymous' $without_user_id $order_clause ";
 					}
 				}
+				
 				$rs_multiple = Database::query($sql);
 				$return_origin .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
 				while ($user = Database :: fetch_array($rs_multiple)) {
@@ -225,7 +229,7 @@ $group_name = $group_info['name'];
 
 Display::display_header($group_name);
 
-if($_POST['form_sent']) {
+if ($_POST['form_sent']) {
 
 	$form_sent			= $_POST['form_sent'];
 	$firstLetterUser	= $_POST['firstLetterUser'];
@@ -290,6 +294,7 @@ if ($ajax_search) {
 	$many_users = false;
 	$sql = "SELECT count(user_id) FROM $tbl_user user
 			WHERE ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND user_id<>'$user_anonymous' $without_user_id ";
+
 	if ($_configuration['multiple_access_urls']) {
 		$access_url_id = api_get_current_access_url_id();
 		if ($access_url_id != -1) {
@@ -301,18 +306,22 @@ if ($ajax_search) {
 		}
 	}
 	$rs_count  = Database::query($sql);
-	$row_count = Database::fetch_row($rs_count);
+	$row_count = 0;
+	if (Database::num_rows($rs_count)) {
+	   $row_count = Database::fetch_row($rs_count);
+	   $row_count = $row_count[0];
+	}	
 	if ($row_count > 2) $many_users = true;
 
 	// data for origin list
-	if (isset($_POST['id']) && isset($_POST['firstLetterUser'])) {
-		$id = intval($_POST['id']);
+	if (isset($_GET['id'])) {
+		$id = intval($_GET['id']);
 		$needle = Database::escape_string($_POST['firstLetterUser']);
 		$needle = api_convert_encoding($needle, $charset, 'utf-8');
 		$user_anonymous=api_get_anonymous_id();
 		// get user_id from relation type and group id
 		$sql = "SELECT user_id FROM $tbl_group_rel_user
-				WHERE group_id = '$id'
+				WHERE group_id = $id
 				AND relation_type IN (".GROUP_USER_PERMISSION_ADMIN.",".GROUP_USER_PERMISSION_READER.",".GROUP_USER_PERMISSION_PENDING_INVITATION.",".GROUP_USER_PERMISSION_MODERATOR.") ";
 		$res = Database::query($sql);
 		$user_ids = array();
@@ -320,7 +329,7 @@ if ($ajax_search) {
 			while ($row = Database::fetch_row($res)) {
 				$user_ids[] = $row[0];
 			}
-			$without_user_id = " AND user_id NOT IN(".implode(',',$user_ids).") ";
+			$without_user_id = " AND user.user_id NOT IN(".implode(',',$user_ids).") ";
 		}
 
 		$sql = "SELECT user_id, username, lastname, firstname FROM $tbl_user user
@@ -388,7 +397,7 @@ if ($add_type == 'multiple') {
 <?php } else { ?>
 <select name="relation" id="relation" onchange="xajax_search_users(document.getElementById('user_to_add').value,'single',this.value);">
 <?php } ?>
-<option value=""><?php echo get_lang('ChooseRelationType')?></option>
+<option value=""><?php echo get_lang('SelectARelationType')?></option>
 <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($_POST['relation']) && $_POST['relation']==GROUP_USER_PERMISSION_ADMIN)?'selected=selected':'') ?> > <?php echo get_lang('Admin') ?></option>
 <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($_POST['relation']) && $_POST['relation']==GROUP_USER_PERMISSION_PENDING_INVITATION)?'selected=selected':'') ?> > <?php echo get_lang('Reader') ?></option>
 <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($_POST['relation']) && $_POST['relation']==GROUP_USER_PERMISSION_MODERATOR)?'selected=selected':'') ?> > <?php echo get_lang('Moderator') ?></option>
@@ -439,7 +448,7 @@ if(!empty($errorMsg)) {
   <td align="center"><b><?php echo get_lang('UserListInPlatform') ?> :</b>
   </td>
   <td>&nbsp;</td>
-  <td align="center"><b><?php echo get_lang('UserListInGroup') ?> :</b></td>
+  <td align="center"><b><?php echo get_lang('UsersInGroup') ?> :</b></td>
 </tr>
 
 <?php if ($add_type=='multiple') { ?>

+ 13 - 27
main/admin/group_list.php

@@ -1,21 +1,19 @@
-<?php // $Id: user_list.php 22292 2009-07-22 18:32:32Z herodoto $
+<?php
 /* For licensing terms, see /dokeos_license.txt */
 /**
-==============================================================================
 	@author Bart Mollet
-*	@package dokeos.admin
-==============================================================================
+*	@package chamilo.admin
+
 */
 
 // name of the language file that needs to be included
 $language_file = array ('registration','admin','userInfo');
 $cidReset = true;
-require ('../inc/global.inc.php');
-require_once (api_get_path(LIBRARY_PATH).'sortabletable.class.php');
-require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
-require_once (api_get_path(LIBRARY_PATH).'security.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php');
-require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
+require_once '../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
+require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
+require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php';
+require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
 
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -185,8 +183,8 @@ function modify_filter($group_id,$url_params,$row)
 	global $_admins_list;
 	if (api_is_platform_admin()) {
 		$result .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_users_to_group.php?id='.$group_id.'">'.Display::return_icon('subscribe_users_social_network.png',get_lang('AddUsersToGroup'),'','22').'</a>';
-		$result .= '<a href="group_edit.php?id='.$group_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>&nbsp;&nbsp;';
-		$result .= '<a href="group_list.php?action=delete_group&amp;group_id='.$group_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
+		$result .= '<a href="group_edit.php?id='.$group_id.'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), 22).'</a>&nbsp;&nbsp;';
+		$result .= '<a href="group_list.php?action=delete_group&amp;group_id='.$group_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), array(), 22).'</a>';
 	}
 	return $result;
 }
@@ -265,18 +263,12 @@ function lock_unlock_user($status,$user_id)
  * @version march 2008
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  */
-function status_filter($status)
-{
+function status_filter($status) {
 	$statusname = api_get_status_langvars();
 	return $statusname[$status];
 }
 
-
-/**
-==============================================================================
-		INIT SECTION
-==============================================================================
-*/
+// INIT SECTION
 $action = $_GET["action"];
 
 if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
@@ -422,10 +414,4 @@ else
 		$table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform')));
 	$table->display();
 }
-/*
-==============================================================================
-		FOOTER
-==============================================================================
-*/
-Display :: display_footer();
-?>
+Display :: display_footer();

+ 27 - 51
main/calendar/agenda.inc.php

@@ -753,13 +753,15 @@ function selectAll(cbList,bSelect,showwarning)
 			msg_err4.innerHTML=\"".get_lang('FieldRequired')."\";
 			msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\";
 		} else {
-			if (cbList.length <	1) {
-				if (!confirm(\"".get_lang('Send2All')."\")) {
-					return false;
-				}
+            if (cbList) { 
+    			if (cbList.length <	1) {
+    				if (!confirm(\"".get_lang('Send2All')."\")) {
+    					return false;
+    				}
+    			}
+    			for	(var i=0; i<cbList.length; i++)
+    			cbList[i].selected = cbList[i].checked = bSelect;
 			}
-			for	(var i=0; i<cbList.length; i++)
-			cbList[i].selected = cbList[i].checked = bSelect;
 			document.new_calendar_item.submit();
 		}
 
@@ -1238,32 +1240,27 @@ function separate_users_groups($to) {
 */
 function sent_to($tool, $id) {
 	$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
-	$tool=Database::escape_string($tool);
-	$id=Database::escape_string($id);
+	$tool  = Database::escape_string($tool);
+	$id    = Database::escape_string($id);
 
-	$sql="SELECT * FROM $TABLE_ITEM_PROPERTY WHERE tool='".$tool."' AND ref='".$id."'";
+	$sql   = "SELECT * FROM $TABLE_ITEM_PROPERTY WHERE tool='".$tool."' AND ref='".$id."'";
 	$result=Database::query($sql);
-	while ($row=Database::fetch_array($result))
-	{
+	while ($row=Database::fetch_array($result)) {
 		// if to_group_id is null then it is sent to a specific user
 		// if to_group_id = 0 then it is sent to everybody
-		if (!is_null($row['to_group_id']) )
-		{
+		if (!is_null($row['to_group_id']) ) {
 			$sent_to_group[]=$row['to_group_id'];
 			//echo $row['to_group_id'];
 		}
 		// if to_user_id <> 0 then it is sent to a specific user
-		if ($row['to_user_id']<>0)
-		{
+		if ($row['to_user_id']<>0) {
 			$sent_to_user[]=$row['to_user_id'];
 		}
 	}
-	if (isset($sent_to_group))
-	{
+	if (isset($sent_to_group)) {
 		$sent_to['groups']=$sent_to_group;
 	}
-	if (isset($sent_to_user))
-	{
+	if (isset($sent_to_user)) {
 		$sent_to['users']=$sent_to_user;
 	}
 	return $sent_to;
@@ -2009,7 +2006,7 @@ function display_one_agenda_item($agenda_id) {
 	$group_names = get_course_groups();
 	
 	$agenda_id = intval($agenda_id);
-    if (! (api_is_allowed_to_edit(false,true) || (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))) {        
+    if (!(api_is_allowed_to_edit(false,true) || (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))) {        
         $visibility_condition = " AND ip.visibility='1' ";                
     }
         
@@ -2048,7 +2045,7 @@ function display_one_agenda_item($agenda_id) {
 
 	// highlight: if a date in the small calendar is clicked we highlight the relevant items
 	$db_date = (int)api_format_date($myrow["start_date"], "%d").intval(api_format_date($myrow["start_date"], "%m")).api_format_date($myrow["start_date"], "%Y");
-    if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date) {
+    if ($_GET["day"].$_GET["month"].$_GET["year"] <> $db_date) {
 		if ($myrow['visibility']=='0') {
 			$style="data_hidden";
 			$stylenotbold="datanotbold_hidden";
@@ -2063,20 +2060,7 @@ function display_one_agenda_item($agenda_id) {
 		$stylenotbold="datanotboldnow";
 		$text_style="textnow";
 	}
-	echo "<h2>";
-
-	// adding an internal anchor
-	//echo "<a name=\"".(int)api_format_date($myrow["start_date"], "%d")."\"></a>";
-
-	// the icons. If the message is sent to one or more specific users/groups
-	// we add the groups icon
-	// 2do: if it is sent to groups we display the group icon, if it is sent to a user we show the user icon
-	echo Display::return_icon('agenda.png','&nbsp;','',22);
-	if ($myrow['to_group_id']!=='0') {
-		echo Display::return_icon('group.png','&nbsp;','',22);
-	}
-	echo ' '.$myrow['title'];
-	echo "</h2>";	
+	echo Display::tag('h2', $myrow['title']);	
 	echo "<tr>";
 		
 	if (api_is_allowed_to_edit(false,true)) {
@@ -2121,7 +2105,7 @@ function display_one_agenda_item($agenda_id) {
         }
 	}
 	
-	/*-DISPLAY: the title */
+	// title
 	echo "<tr class='row_odd'>";
 	echo '<td colspan="2">'.get_lang("StartTime").": ";
 	echo api_format_date($myrow['start_date']);
@@ -2134,22 +2118,17 @@ function display_one_agenda_item($agenda_id) {
 
 
     
-	/*--------------------------------------------------
-	 			DISPLAY: the content
-	  --------------------------------------------------*/
-
+	// Content
 	$content = $myrow['content'];
 	$content = make_clickable($content);
 	$content = text_filter($content);
-	//echo "<tr><td class=\"".$text_style."\" colspan='2'>";
-	//echo $content;
-	//echo "</td></tr>";
-    echo "<tr class='row_even'>";
+
+    echo '<tr class="row_even">';
     echo '<td '.(api_is_allowed_to_edit()?'colspan="3"':'colspan="2"'). '>';
     echo $content;
     echo '</td></tr>';
     
-    
+    //Attachments
     $attachment_list = get_attachment($agenda_id);
     
     if (!empty($attachment_list)) {
@@ -2165,9 +2144,7 @@ function display_one_agenda_item($agenda_id) {
         echo '<br /><span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>';
         echo '</td></tr>';           
     }
-    
-    
-    
+            
     // the message has been sent to
     echo '<tr>';
     echo "<td class='announcements_datum'>".get_lang("SentTo").": ";
@@ -2185,12 +2162,11 @@ function display_one_agenda_item($agenda_id) {
     }   
     
 
-	/* DISPLAY: the added resources */
+	/* Added resources */
 	if (check_added_resources("Agenda", $myrow["id"])) {
 		echo "<tr><td colspan='3'>";
 		echo "<i>".get_lang("AddedResources")."</i><br/>";
-		if ($myrow['visibility']==0)
-		{
+		if ($myrow['visibility'] == 0 ) {
 			$addedresource_style="invisible";
 		}
 		display_added_resources("Agenda", $myrow["id"], $addedresource_style);

+ 1 - 1
main/calendar/agenda.php

@@ -356,7 +356,7 @@ if (!$_GET['action'] || $_GET['action']=="view") {
             }
 		}
 	} else {
-		display_one_agenda_item((int)$_GET['agenda_id']);
+		display_one_agenda_item($_GET['agenda_id']);
 	}
 }
 echo '&nbsp;</td></tr></table>';

+ 7 - 0
main/document/create_audio.php

@@ -30,6 +30,13 @@ if (api_get_setting('enabled_text2audio') == 'false'){
 }
 
 $document_data = DocumentManager::get_document_data_by_id($_GET['id'], api_get_course_id());
+if (empty($document_data)) {
+    if (api_is_in_group()) {
+        $group_properties   = GroupManager::get_group_properties(api_get_group_id());        
+        $document_id        = DocumentManager::get_document_id(api_get_course_info(), $group_properties['directory']);
+        $document_data      = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
+    }
+}
 $document_id = $document_data['id'];
 $dir = $document_data['path'];
 

+ 40 - 33
main/document/create_document.php

@@ -167,26 +167,27 @@ $nameTools = get_lang('CreateDocument');
 
 /*	Constants and variables */
 
-//$dir = isset($_GET['dir']) ? Security::remove_XSS($_GET['dir']) : Security::remove_XSS($_POST['dir']);
 $document_data = DocumentManager::get_document_data_by_id($_REQUEST['id'], api_get_course_id());    
 if (empty($document_data)) {
-    $dir = '/';
-    $folder_id = 0;
+    if (api_is_in_group()) {
+        $group_properties   = GroupManager::get_group_properties(api_get_group_id());        
+        $document_id        = DocumentManager::get_document_id(api_get_course_info(), $group_properties['directory']);
+        $document_data      = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
+        
+        $dir                = $document_data['path'];
+        $folder_id          = $document_data['id'];
+    } else {
+        $dir = '/';
+        $folder_id = 0;
+    }
 } else {
     $folder_id = $document_data['id'];
-    $dir = $document_data['path'];
+    $dir       = $document_data['path'];
 }
 
-//$dir = isset($_GET['dir']) ? Security::remove_XSS($_GET['dir']) : Security::remove_XSS($_POST['dir']);
-
 /*	MAIN CODE */
 
-if (api_is_in_group()) {
-	$group_properties = GroupManager::get_group_properties($_SESSION['_gid']);
-}
-
 // Please, do not modify this dirname formatting
-
 if (strstr($dir, '..')) {
 	$dir = '/';
 }
@@ -204,16 +205,22 @@ if ($dir[strlen($dir) - 1] != '/') {
 }
 
 // Configuration for the FCKEDITOR
-$doc_tree= explode('/', $dir);
+$doc_tree  = explode('/', $dir);
 $count_dir = count($doc_tree) -2; // "2" because at the begin and end there are 2 "/"
-// Level correction for group documents.
-if (!empty($group_properties['directory'])) {
-	$count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
+
+if (api_is_in_group()) {
+    $group_properties = GroupManager::get_group_properties(api_get_group_id()); 
+        
+    // Level correction for group documents.
+    if (!empty($group_properties['directory'])) {
+    	$count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
+    }
 }
 $relative_url = '';
 for ($i = 0; $i < ($count_dir); $i++) {
 	$relative_url .= '../';
 }
+
 // We do this in order to avoid the condition in html_editor.php ==> if ($this -> fck_editor->Config['CreateDocumentWebDir']=='' || $this -> fck_editor->Config['CreateDocumentDir']== '')
 if ($relative_url== '') {
 	$relative_url = '/';
@@ -222,25 +229,26 @@ if ($relative_url== '') {
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 
 $html_editor_config = array(
-	'ToolbarSet' => ($is_allowed_to_edit ? 'Documents' :'DocumentsStudent'),
-	'Width' => '100%',
-	'Height' => '600',
-	'FullPage' => true,
-	'InDocument' => true,
-	'CreateDocumentDir' => $relative_url,
+	'ToolbarSet'           => ($is_allowed_to_edit ? 'Documents' :'DocumentsStudent'),
+	'Width'                => '100%',
+	'Height'               => '600',
+	'FullPage'             => true,
+	'InDocument'           => true,
+	'CreateDocumentDir'    => $relative_url,
 	'CreateDocumentWebDir' => (empty($group_properties['directory']))
-		? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
-		: api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
-	'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
+                        		? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
+                        		: api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
+	'BaseHref'             => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
 );
 
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
-
+        
 if (!is_dir($filepath)) {
 	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
 	$dir = '/';
 }
 
+
 //I'm in the certification module?
 $is_certificate_mode = false;
 $is_certificate_array = explode('/',$dir);
@@ -251,14 +259,13 @@ if ($is_certificate_array[0]=='certificates') {
 $to_group_id = 0;
 
 if (!$is_certificate_mode) {
-	if (isset ($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
-		$req_gid = '&amp;gidReq='.$_SESSION['_gid'];
-		$interbreadcrumb[] = array ("url" => "../group/group_space.php?gidReq=".$_SESSION['_gid'], "name" => get_lang('GroupSpace'));
+	if (api_is_in_group()) {
+		$req_gid = '&amp;gidReq='.api_get_group_id();
+		$interbreadcrumb[] = array ("url" => "../group/group_space.php?gidReq=".api_get_group_id(), "name" => get_lang('GroupSpace'));
 		$noPHP_SELF = true;
-		$to_group_id = $_SESSION['_gid'];
-		$group = GroupManager :: get_group_properties($to_group_id);
-		$path = explode('/', $dir);
-		if ('/'.$path[1] != $group['directory']) {
+		$to_group_id = api_get_group_id();		
+		$path = explode('/', $dir);				
+		if ('/'.$path[1] != $group_properties['directory']) {
 			api_not_allowed(true);
 		}
 	}
@@ -278,7 +285,7 @@ if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] || is_
 
 event_access_tool(TOOL_DOCUMENT);
 $display_dir = $dir;
-if (isset ($group)) {
+if (isset ($group_properties)) {
 	$display_dir = explode('/', $dir);
 	unset ($display_dir[0]);
 	unset ($display_dir[1]);

+ 8 - 0
main/document/create_draw.php

@@ -29,6 +29,14 @@ api_protect_course_script();
 api_block_anonymous_users();
 
 $document_data = DocumentManager::get_document_data_by_id($_GET['id'], api_get_course_id());
+if (empty($document_data)) {
+    if (api_is_in_group()) {
+        $group_properties   = GroupManager::get_group_properties(api_get_group_id());        
+        $document_id        = DocumentManager::get_document_id(api_get_course_info(), $group_properties['directory']);
+        $document_data      = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
+    }
+}
+
 $document_id   = $document_data['id'];
 $dir           = $document_data['path'];
 

+ 9 - 1
main/document/create_paint.php

@@ -30,8 +30,16 @@ if (api_get_setting('enabled_support_paint') == 'false') {
 }
 
 $document_data = DocumentManager::get_document_data_by_id($_GET['id'], api_get_course_id());
+if (empty($document_data)) {
+    if (api_is_in_group()) {
+        $group_properties   = GroupManager::get_group_properties(api_get_group_id());        
+        $document_id        = DocumentManager::get_document_id(api_get_course_info(), $group_properties['directory']);
+        $document_data      = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
+    }
+}
+
 $document_id = $document_data['id'];
-$dir = $document_data['path'];
+$dir         = $document_data['path'];
 
 //$dir = isset($_GET['dir']) ? Security::remove_XSS($_GET['dir']) : Security::remove_XSS($_POST['dir']);
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);

+ 8 - 0
main/document/record_audio.php

@@ -29,6 +29,14 @@ api_protect_course_script();
 api_block_anonymous_users();
 
 $document_data = DocumentManager::get_document_data_by_id($_GET['id'], api_get_course_id());
+if (empty($document_data)) {
+    if (api_is_in_group()) {
+        $group_properties   = GroupManager::get_group_properties(api_get_group_id());        
+        $document_id        = DocumentManager::get_document_id(api_get_course_info(), $group_properties['directory']);
+        $document_data      = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
+    }
+}
+
 $document_id = $document_data['id'];
 $dir = $document_data['path'];
 

+ 110 - 127
main/exercice/exercice.php

@@ -509,8 +509,11 @@ if ($show == 'test') {
     } else { 
         // Only for students
         $total_sql = "SELECT count(id) as count FROM $TBL_EXERCICES WHERE active = '1' $condition_session ";
-        $sql = "SELECT id, title, type, description, results_disabled, session_id, start_time, end_time, max_attempt FROM $TBL_EXERCICES WHERE active='1' $condition_session ORDER BY title LIMIT ".$from."," .$limit;
+        $sql = "SELECT id, title, type, description, results_disabled, session_id, start_time, end_time, max_attempt FROM $TBL_EXERCICES 
+                WHERE active='1' $condition_session 
+                ORDER BY title LIMIT ".$from."," .$limit;
     }
+    
     $result = Database::query($sql);        
 	$exercises_count = Database :: num_rows($result);
 	
@@ -524,20 +527,17 @@ if ($show == 'test') {
     
 	//get HotPotatoes files (active and inactive)
 	if ($is_allowedToEdit) {
-	   $res = Database::query("SELECT * FROM $TBL_DOCUMENT WHERE path LIKE '" . Database :: escape_string($uploadPath) . "/%/%'");
-	   $hp_count = Database :: num_rows($res);
+        $sql = "SELECT * FROM $TBL_DOCUMENT WHERE path LIKE '" . Database :: escape_string($uploadPath) . "/%/%'";
+        $res = Database::query($sql);
+        $hp_count = Database :: num_rows($res);
 	} else {
-    	$res = Database::query("SELECT * FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
+        $res = Database::query("SELECT * FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
                                 WHERE d.id = ip.ref  AND ip.tool = '" . TOOL_DOCUMENT . "'
                                 AND d.path LIKE '" . Database :: escape_string($uploadPath) . "/%/%'
                                 AND ip.visibility='1'");
-       $hp_count = Database :: num_rows($res);    
-	}  
-	
-	$total = $total_exercises + $hp_count;
-	//echo $total.' ' .$total_exercises.' '.$hp_count.' '.$from.' '.$limit.' '.$total/$limit.' '.ceil($total/$limit);
-	
-	
+        $hp_count = Database :: num_rows($res);    
+	}
+	$total = $total_exercises + $hp_count;		
 }
 
 if ($is_allowedToEdit && $origin != 'learnpath') {
@@ -547,7 +547,7 @@ if ($is_allowedToEdit && $origin != 'learnpath') {
 		echo '<a href="hotpotatoes.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_hotpotatoes.png', get_lang('ImportHotPotatoesQuiz'),'','32').'</a>';
 		// link to import qti2 ...
 		echo '<a href="qti2.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_qti2.png', get_lang('ImportQtiQuiz'),'','32') .'</a>';
-                echo '<a href="upload_exercise.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_excel.png', get_lang('ImportExcelQuiz'),'','32') .'</a>';
+        echo '<a href="upload_exercise.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_excel.png', get_lang('ImportExcelQuiz'),'','32') .'</a>';
 	}
 
 	// the actions for the statistics
@@ -590,8 +590,6 @@ if ($is_allowedToEdit && $origin != 'learnpath') {
 	//Student view
 	if ($show == 'result') {
 		echo '<a href="' . api_add_url_param($_SERVER['REQUEST_URI'], 'show=test') . '">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'','32').'</a>';
-	} else {
-		//echo '<a href="' . api_get_self() .'?'.api_get_cidreq().'&show=result'.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22) . get_lang('Results') . '</a>';
 	}
 }
 
@@ -651,17 +649,14 @@ if ($show == 'test') {
         echo '</div>';
     }
 }
-
 if ($show == 'test') {
     ?>    
     <script type="text/javascript">
     $(function() {
-        /*
-                
+        /*               
         $( "a", ".operations" ).button();        
         $(".tabs-left").tabs().addClass('ui-tabs-vertical ui-helper-clearfix');
-        $(".tabs-left li").removeClass('ui-corner-top').addClass('ui-corner-left');
-        
+        $(".tabs-left li").removeClass('ui-corner-top').addClass('ui-corner-left');        
         */
     });
     </script>
@@ -677,8 +672,7 @@ if ($show == 'test') {
         .ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: left; width: 40em;}     
         
         */       
-    </style>      
-  
+    </style>
   <?php    
     $i =1;
     $lis = '';
@@ -697,13 +691,13 @@ if ($show == 'test') {
         $lis.= Display::tag('li','<a href="#tabs-'.$i.'">'.$status.' '.$row['title'].'</a>');
         $i++;*/
         $exercise_list[] = $row;
-    }    
-    if (!empty($exercise_list)) {
-        
-        //echo '<div id="exercise_tabs" class="tabs-left">';
-        echo '<div style="float:left;width:100%">';
-        //echo Display::tag('ul', $lis);
+    } 
     
+    echo '<table class="data_table">';    
+    if (!empty($exercise_list)) {     
+        //echo '<div id="exercise_tabs" class="tabs-left">';
+        //echo '<div style="float:left;width:100%">';
+        //echo Display::tag('ul', $lis);    
         /*  Listing exercises  */
         
         if ($origin != 'learnpath') {
@@ -714,7 +708,7 @@ if ($show == 'test') {
     
             $token = Security::get_token();
             $i=1;
-            echo '<table class="data_table">';
+            
             if ($is_allowedToEdit) {
                 $headers = array(get_lang('ExerciseName'), get_lang('QuantityQuestions'), get_lang('Actions'));
             } else {
@@ -729,9 +723,7 @@ if ($show == 'test') {
             $count = 0;
             if (!empty($exercise_list))
             foreach ($exercise_list as $row) {
-                
-                //echo '<div  id="tabs-'.$i.'">';                
-                           
+                //echo '<div  id="tabs-'.$i.'">';
                 $i++;                    
                 //validacion when belongs to a session
                 $session_img = api_get_session_image($row['session_id'], $_user['status']);
@@ -774,12 +766,8 @@ if ($show == 'test') {
                 }                
                       
                 // Teacher only
-                if ($is_allowedToEdit) {
-                    
-                
-                    
-                    $show_quiz_edition = true;
-                
+                if ($is_allowedToEdit) {                   
+                    $show_quiz_edition = true;                
                     $table_lp_item    = Database::get_course_table(TABLE_LP_ITEM);
                     $sql="SELECT max_score FROM $table_lp_item
                           WHERE item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($row['id'])."'";
@@ -800,8 +788,7 @@ if ($show == 'test') {
                     if ($session_id == $row['session_id']) {
                         //Settings                                                                
                         //echo Display::url(Display::return_icon('settings.png',get_lang('Edit'), array('width'=>'22px'))." ".get_lang('Edit'), 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$row['id']);
-                    }       
-                                               
+                    }                                                      
                     //echo '<p>';
                     //echo $session_img;
                     if ($row['active'] == 0) {
@@ -820,12 +807,9 @@ if ($show == 'test') {
                                         
                     if ($session_id == $row['session_id']) {
                         //Settings                                                                
-                        //$actions  = Display::url(Display::return_icon('edit.png',get_lang('Edit'),'',22), 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$row['id']);
-                        
-                        $actions =  Display::url(Display::return_icon('edit.png',get_lang('Edit'),'',22), 'admin.php?'.api_get_cidreq().'&exerciseId='.$row['id']);
-                        
-                        $actions .='<a href="exercice.php?' . api_get_cidreq() . '&show=result&exerciseId='.$row['id'].'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
-                        
+                        //$actions  = Display::url(Display::return_icon('edit.png',get_lang('Edit'),'',22), 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$row['id']);                        
+                        $actions =  Display::url(Display::return_icon('edit.png',get_lang('Edit'),'',22), 'admin.php?'.api_get_cidreq().'&exerciseId='.$row['id']);                        
+                        $actions .='<a href="exercice.php?' . api_get_cidreq() . '&show=result&exerciseId='.$row['id'].'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';                        
                         //Export
                         $actions .= Display::url(Display::return_icon('cd.gif',          get_lang('CopyExercise')),       '', array('onclick'=>"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset))." ".addslashes($row['title'])."?"."')) return false;",'href'=>'exercice.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
                         //Clean exercise                    
@@ -958,8 +942,7 @@ if ($show == 'test') {
                         } else {                            
                             $attempt_text = get_lang('CantShowResults');
                         }
-                    }
-                    
+                    }                    
                     //User Attempts
                     /*    
                     if (empty($row['max_attempt'])) {
@@ -989,92 +972,93 @@ if ($show == 'test') {
                        
                 $count++;
             } // end foreach()
-            
-            
-            //Hotpotatoes results        
-            
-            if ($is_allowedToEdit) {
-                $sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
-                        FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
-                        WHERE   d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "' AND (d.path LIKE '%htm%')
-                        AND   d.path  LIKE '" . Database :: escape_string($uploadPath) . "/%/%' LIMIT " .$from . "," .$limit; // only .htm or .html files listed
+        } 
+    }
+    // end exercise list
+        
+    //Hotpotatoes results        
+    
+    if ($is_allowedToEdit) {
+        $sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
+                FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
+                WHERE   d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "' AND (d.path LIKE '%htm%')
+                AND   d.path  LIKE '" . Database :: escape_string($uploadPath) . "/%/%' LIMIT " .$from . "," .$limit; // only .htm or .html files listed
+    } else {
+        $sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
+                FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
+                WHERE d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "' AND (d.path LIKE '%htm%')
+                AND   d.path  LIKE '" . Database :: escape_string($uploadPath) . "/%/%' AND ip.visibility='1' LIMIT " .$from . "," .$limit;
+    }
+    
+    $result = Database::query($sql);
+
+    while ($row = Database :: fetch_array($result, 'ASSOC')) {
+        $attribute['path'][]        = $row['path'];
+        $attribute['visibility'][]  = $row['visibility'];
+        $attribute['comment'][]     = $row['comment'];
+    }
+    
+    $nbrActiveTests = 0;
+    if (is_array($attribute['path'])) {
+        while (list ($key, $path) = each($attribute['path'])) {
+            $item = '';
+            list ($a, $vis) = each($attribute['visibility']);
+            if (strcmp($vis, "1") == 0) {
+                $active = 1;
             } else {
-                $sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
-                        FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
-                        WHERE d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "' AND (d.path LIKE '%htm%')
-                        AND   d.path  LIKE '" . Database :: escape_string($uploadPath) . "/%/%' AND ip.visibility='1' LIMIT " .$from . "," .$limit;
+                $active = 0;
             }
-            
-            $result = Database::query($sql);
-    
-            while ($row = Database :: fetch_array($result, 'ASSOC')) {
-                $attribute['path'][]        = $row['path'];
-                $attribute['visibility'][]  = $row['visibility'];
-                $attribute['comment'][]     = $row['comment'];
+            $title = GetQuizName($path, $documentPath);
+            if ($title == '') {
+                $title = basename($path);
             }
             
-            $nbrActiveTests = 0;
-            if (is_array($attribute['path'])) {
-                while (list ($key, $path) = each($attribute['path'])) {
-                    $item = '';
-                    list ($a, $vis) = each($attribute['visibility']);
-                    if (strcmp($vis, "1") == 0) {
-                        $active = 1;
-                    } else {
-                        $active = 0;
-                    }
-                    $title = GetQuizName($path, $documentPath);
-                    if ($title == '') {
-                        $title = basename($path);
-                    }
-                    
-                    $class = 'row_even';
-                    if ($count % 2) {
-                        $class = 'row_odd';
-                    }
-                        
-                    // prof only
-                    if ($is_allowedToEdit) {
-                        $item  = Display::tag('td','<img src="../img/hotpotatoes_s.png" alt="HotPotatoes" /> <a href="showinframes.php?file='.$path.'&cid='.api_get_course_id().'&uid='.api_get_user_id().'"'.(!$active?'class="invisible"':'').'>'.$title.'</a> ');
-                        $item .= Display::tag('td','-');
-                                         
-                        $actions =  Display::url(Display::return_icon('edit.png',get_lang('Edit'),'',22), 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path);
-                        $actions .='<a href="exercice.php?' . api_get_cidreq() . '&show=result&path='.$path.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
-                                                
-                        // if active
-                        if ($active) {
-                            $nbrActiveTests = $nbrActiveTests +1;
-                            $actions .= '      <a href="'.$exercicePath.'?'.api_get_cidreq().'&hpchoice=disable&amp;page='.$page.'&amp;file='.$path.'">'.Display::return_icon('visible.png', get_lang('Deactivate'),'',22).'</a>';
-                        } else { // else if not active
-                            $actions .='    <a href="'.$exercicePath.'?'.api_get_cidreq().'&hpchoice=enable&amp;page='.$page.'&amp;file='.$path.'">'.Display::return_icon('invisible.png', get_lang('Activate'),'',22).'</a>';
-                        }
-                        $actions .= '<a href="'.$exercicePath.'?'.api_get_cidreq().'&amp;hpchoice=delete&amp;file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDelete'),ENT_QUOTES,$charset).' '.$title."?").'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',22).'</a>';
-                                                
-                        //$actions .='<img src="../img/lp_quiz_na.gif" border="0" title="'.get_lang('NotMarkActivity').'" alt="" />';
-                        $item .= Display::tag('td', $actions);
-                        echo Display::tag('tr',$item, array('class'=>$class));                     
-                    } else { // student only
-                        if ($active == 1) {
-                            $nbrActiveTests = $nbrActiveTests +1;
-                            $item .= Display::tag('td', '<a href="showinframes.php?'.api_get_cidreq().'&file='.$path.'&cid='.api_get_course_id().'&uid='.api_get_user_id().'"'.(!$active?'class="invisible"':'').'">'.$title.'</a>');
-                            $item .= Display::tag('td', '');                            
-                            //$item .= Display::tag('td', '');
-                            $actions ='<a href="exercice.php?' . api_get_cidreq() . '&show=result&path='.$path.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
-                            $item .= Display::tag('td', $actions);                            
-                            echo Display::tag('tr',$item, array('class'=>$class));
-                        }                        
-                    }
-                    $count ++;
+            $class = 'row_even';
+            if ($count % 2) {
+                $class = 'row_odd';
+            }
+                
+            // prof only
+            if ($is_allowedToEdit) {
+                $item  = Display::tag('td','<img src="../img/hotpotatoes_s.png" alt="HotPotatoes" /> <a href="showinframes.php?file='.$path.'&cid='.api_get_course_id().'&uid='.api_get_user_id().'"'.(!$active?'class="invisible"':'').'>'.$title.'</a> ');
+                $item .= Display::tag('td','-');
+                                 
+                $actions =  Display::url(Display::return_icon('edit.png',get_lang('Edit'),'',22), 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path);
+                $actions .='<a href="exercice.php?' . api_get_cidreq() . '&show=result&path='.$path.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
+                                        
+                // if active
+                if ($active) {
+                    $nbrActiveTests = $nbrActiveTests +1;
+                    $actions .= '      <a href="'.$exercicePath.'?'.api_get_cidreq().'&hpchoice=disable&amp;page='.$page.'&amp;file='.$path.'">'.Display::return_icon('visible.png', get_lang('Deactivate'),'',22).'</a>';
+                } else { // else if not active
+                    $actions .='    <a href="'.$exercicePath.'?'.api_get_cidreq().'&hpchoice=enable&amp;page='.$page.'&amp;file='.$path.'">'.Display::return_icon('invisible.png', get_lang('Activate'),'',22).'</a>';
                 }
+                $actions .= '<a href="'.$exercicePath.'?'.api_get_cidreq().'&amp;hpchoice=delete&amp;file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDelete'),ENT_QUOTES,$charset).' '.$title."?").'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',22).'</a>';
+                                        
+                //$actions .='<img src="../img/lp_quiz_na.gif" border="0" title="'.get_lang('NotMarkActivity').'" alt="" />';
+                $item .= Display::tag('td', $actions);
+                echo Display::tag('tr',$item, array('class'=>$class));                     
+            } else { // student only
+                if ($active == 1) {
+                    $nbrActiveTests = $nbrActiveTests +1;
+                    $item .= Display::tag('td', '<a href="showinframes.php?'.api_get_cidreq().'&file='.$path.'&cid='.api_get_course_id().'&uid='.api_get_user_id().'"'.(!$active?'class="invisible"':'').'">'.$title.'</a>');
+                    $item .= Display::tag('td', '');                            
+                    //$item .= Display::tag('td', '');
+                    $actions ='<a href="exercice.php?' . api_get_cidreq() . '&show=result&path='.$path.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',22).'</a>';
+                    $item .= Display::tag('td', $actions);                            
+                    echo Display::tag('tr',$item, array('class'=>$class));
+                }                        
             }
-            echo '</table>';
-            echo '</div>';
-        }         
-    } else {
+            $count ++;
+        }
+        //echo '</div>';
+    }    
+    echo '</table>';     
+    /*} else {
         echo '<div style="float:left;width:100%">';
         echo Display::display_warning_message(get_lang('NoExercises'));
         echo '</div>';
-    }
+    }*/
     Display :: display_footer();    
     exit;
 }
@@ -1114,11 +1098,10 @@ if ($show == 'result') {
     	$table->set_header(2, get_lang('Date'));
     	$table->set_header(3, get_lang('Score'),false);
     	$table->set_header(4, get_lang('Result'), false);   
-    }
-	 
+    }	 
 	$table->display();	
 }
 
 if ($origin != 'learnpath') { //so we are not in learnpath tool
 	Display :: display_footer();
-}
+}

+ 1 - 1
main/exercice/exercise.lib.php

@@ -1141,7 +1141,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
                 }
             }
         }
-    }    
+    }
     return $list_info;
 }
 

+ 1 - 1
main/gradebook/gradebook_flatview.php

@@ -94,7 +94,7 @@ if (isset ($_GET['exportpdf']))	{
 		'name' => get_lang('FlatView')
 	);
 
-	$export_pdf_form = new DataForm(DataForm :: TYPE_EXPORT_PDF, 'export_pdf_form', null, api_get_self().'?exportpdf=&offset='.$_GET['offset'].'&selectcat='.$_GET['selectcat'], '_blank');
+	$export_pdf_form = new DataForm(DataForm::TYPE_EXPORT_PDF, 'export_pdf_form', null, api_get_self().'?exportpdf=&offset='.intval($_GET['offset']).'&selectcat='.intval($_GET['selectcat']), '_blank', '');
 
 	if ($export_pdf_form->validate()) {
 

+ 4 - 7
main/gradebook/gradebook_view_result.php

@@ -84,11 +84,8 @@ if (isset ($_GET['editres'])) {
 	}
 }
 if (isset ($_GET['import'])) {
-	$interbreadcrumb[]= array (
-		'url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']),
-		'name' => get_lang('ViewResult'
-	));
-	$import_result_form = new DataForm(DataForm :: TYPE_IMPORT, 'import_result_form', null, api_get_self() . '?import=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
+	$interbreadcrumb[]= array ('url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']), 'name' => get_lang('ViewResult'));
+	$import_result_form = new DataForm(DataForm :: TYPE_IMPORT, 'import_result_form', null, api_get_self() . '?import=&selecteval=' . Security::remove_XSS($_GET['selecteval']), '_blank', '');
 	if (!$import_result_form->validate()) {
 		Display :: display_header(get_lang('Import'));
 	}
@@ -177,8 +174,8 @@ if (isset ($_GET['import'])) {
 }
 if (isset ($_GET['export'])) {
     $interbreadcrumb[]= array ('url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']),'name' => get_lang('ViewResult'));
-    
-    $export_result_form= new DataForm(DataForm :: TYPE_EXPORT, 'export_result_form', null, api_get_self() . '?export=&selecteval=' . $_GET['selecteval'], '_blank');
+    $locked_status = $eval[0]->get_locked();
+    $export_result_form= new DataForm(DataForm :: TYPE_EXPORT, 'export_result_form', null, api_get_self() . '?export=&selecteval=' . $_GET['selecteval'], '_blank', $locked_status);
     if (!$export_result_form->validate()) {
     	Display :: display_header(get_lang('Export'));
     }

+ 1 - 1
main/gradebook/lib/fe/dataform.class.php

@@ -27,7 +27,7 @@ class DataForm extends FormValidator {
 	 * @param method
 	 * @param action
 	 */
-	function DataForm($form_type, $form_name, $method = 'post', $action = null,$target='', $locked_status) {
+	function DataForm($form_type, $form_name, $method = 'post', $action = null, $target='', $locked_status) {
 		parent :: __construct($form_name, $method, $action,$target);
 		$this->form_type = $form_type;
 		if ($this->form_type == self :: TYPE_IMPORT) {

+ 3 - 3
main/inc/ajax/model.ajax.php

@@ -3,9 +3,9 @@
 
 //@todo this could be integrated in the inc/lib/model.lib.php + try to clean this file, is not very well tested yet!
 require_once '../global.inc.php';
-if (api_is_anonymous()) {
-    exit;
-}
+
+api_protect_admin_script(true);
+
 $libpath = api_get_path(LIBRARY_PATH);
 require_once $libpath.'array.lib.php';
 

+ 202 - 199
main/inc/lib/document.lib.php

@@ -1360,7 +1360,7 @@ class DocumentManager {
     function get_resources_from_source_html($source_html, $is_file = false, $type = null, $recursivity = 1) {
         $max = 5;
         $attributes = array();
-        $wanted_attributes = array('src', 'url', '@import', 'href', 'value');
+        $wanted_attributes = array('src', 'url', '@import', 'href', 'value', 'flashvars');
         $abs_path = '';
 
         if ($recursivity > $max) {
@@ -1373,6 +1373,7 @@ class DocumentManager {
 
         if (!$is_file) {
             $attributes = DocumentManager::parse_HTML_attributes($source_html, $wanted_attributes);
+            
         } else {
             if (is_file($source_html)) {
                 $abs_path = $source_html;
@@ -1383,11 +1384,13 @@ class DocumentManager {
                     case 'html'	:
                     case 'htm'	:
                     case 'shtml':
-                    case 'css'	:	$file_content = file_get_contents($abs_path);
-                                    //get an array of attributes from the HTML source
-                                    $attributes = DocumentManager::parse_HTML_attributes($file_content, $wanted_attributes);
-                                    break;
-                    default		:	break;
+                    case 'css'	:	
+                        $file_content = file_get_contents($abs_path);
+                        //get an array of attributes from the HTML source
+                        $attributes = DocumentManager::parse_HTML_attributes($file_content, $wanted_attributes);
+                        break;
+                    default		:	
+                        break;
                 }
             } else {
                 return false;
@@ -1398,209 +1401,209 @@ class DocumentManager {
             case TOOL_DOCUMENT :
             case TOOL_QUIZ:
             case 'sco':
-                            foreach ($wanted_attributes as $attr) {
-                                if (isset($attributes[$attr])) {
-                                    //find which kind of path these are (local or remote)
-                                    $sources = $attributes[$attr];
-                                    foreach ($sources as $source) {
-                                        //skip what is obviously not a resource
-                                        if (strpos($source, '+this.')) continue; //javascript code - will still work unaltered
-                                        if (strpos($source, '.') === false) continue; //no dot, should not be an external file anyway
-                                        if (strpos($source, 'mailto:')) continue; //mailto link
-                                        if (strpos($source, ';') && !strpos($source, '&amp;')) continue; //avoid code - that should help
-
-                                        if ($attr == 'value') {
-                                            if (strpos($source , 'mp3file')) {
-                                                $files_list[] = array(substr($source, 0, strpos($source, '.swf') + 4), 'local', 'abs');
-                                                $mp3file = substr($source , strpos($source, 'mp3file=') + 8);
-                                                if (substr($mp3file, 0, 1) == '/') {
-                                                    $files_list[] = array($mp3file, 'local', 'abs');
-                                                } else {
-                                                    $files_list[] = array($mp3file, 'local', 'rel');
-                                                }
-                                            } elseif (strpos($source, 'flv=') === 0) {
-                                                $source = substr($source, 4);
-                                                if (strpos($source, '&') > 0) {
-                                                    $source = substr($source, 0, strpos($source, '&'));
-                                                }
-                                                if (strpos($source,'://') > 0) {
-                                                    if (strpos($source, api_get_path(WEB_PATH)) !== false) {
-                                                        //we found the current portal url
-                                                        $files_list[] = array($source, 'local', 'url');
-                                                    } else {
-                                                        //we didn't find any trace of current portal
-                                                        $files_list[] = array($source, 'remote', 'url');
-                                                    }
-                                                } else {
-                                                    $files_list[] = array($source, 'local', 'abs');
-                                                }
-                                                continue; //skipping anything else to avoid two entries (while the others can have sub-files in their url, flv's can't)
+                foreach ($wanted_attributes as $attr) {
+                    if (isset($attributes[$attr])) {
+                        //find which kind of path these are (local or remote)
+                        $sources = $attributes[$attr];
+                        foreach ($sources as $source) {
+                            //skip what is obviously not a resource
+                            if (strpos($source, '+this.')) continue; //javascript code - will still work unaltered
+                            if (strpos($source, '.') === false) continue; //no dot, should not be an external file anyway
+                            if (strpos($source, 'mailto:')) continue; //mailto link
+                            if (strpos($source, ';') && !strpos($source, '&amp;')) continue; //avoid code - that should help
+        
+                            if ($attr == 'value') {
+                                if (strpos($source , 'mp3file')) {
+                                    $files_list[] = array(substr($source, 0, strpos($source, '.swf') + 4), 'local', 'abs');
+                                    $mp3file = substr($source , strpos($source, 'mp3file=') + 8);
+                                    if (substr($mp3file, 0, 1) == '/') {
+                                        $files_list[] = array($mp3file, 'local', 'abs');
+                                    } else {
+                                        $files_list[] = array($mp3file, 'local', 'rel');
+                                    }
+                                } elseif (strpos($source, 'flv=') === 0) {
+                                    $source = substr($source, 4);
+                                    if (strpos($source, '&') > 0) {
+                                        $source = substr($source, 0, strpos($source, '&'));
+                                    }
+                                    if (strpos($source,'://') > 0) {
+                                        if (strpos($source, api_get_path(WEB_PATH)) !== false) {
+                                            //we found the current portal url
+                                            $files_list[] = array($source, 'local', 'url');
+                                        } else {
+                                            //we didn't find any trace of current portal
+                                            $files_list[] = array($source, 'remote', 'url');
+                                        }
+                                    } else {
+                                        $files_list[] = array($source, 'local', 'abs');
+                                    }
+                                    continue; //skipping anything else to avoid two entries (while the others can have sub-files in their url, flv's can't)
+                                }
+                            }
+                            if (strpos($source, '://') > 0) {
+                                //cut at '?' in a URL with params
+                                if (strpos($source, '?') > 0) {
+                                    $second_part = substr($source,strpos($source, '?'));
+                                    if(strpos($second_part, '://') > 0) {
+                                        //if the second part of the url contains a url too, treat the second one before cutting
+                                        $pos1 = strpos($second_part, '=');
+                                        $pos2 = strpos($second_part, '&');
+                                        $second_part = substr($second_part, $pos1 + 1, $pos2 - ($pos1 + 1));
+                                        if (strpos($second_part, api_get_path(WEB_PATH)) !== false) {
+                                            //we found the current portal url
+                                            $files_list[] = array($second_part, 'local', 'url');
+                                            $in_files_list[] = DocumentManager::get_resources_from_source_html($second_part, true, TOOL_DOCUMENT, $recursivity + 1);
+                                            if (count($in_files_list) > 0) {
+                                                $files_list = array_merge($files_list, $in_files_list);
                                             }
+                                        } else {
+                                            //we didn't find any trace of current portal
+                                            $files_list[] = array($second_part, 'remote', 'url');
                                         }
-                                        if (strpos($source, '://') > 0) {
-                                            //cut at '?' in a URL with params
-                                            if (strpos($source, '?') > 0) {
-                                                $second_part = substr($source,strpos($source, '?'));
-                                                if(strpos($second_part, '://') > 0) {
-                                                    //if the second part of the url contains a url too, treat the second one before cutting
-                                                    $pos1 = strpos($second_part, '=');
-                                                    $pos2 = strpos($second_part, '&');
-                                                    $second_part = substr($second_part, $pos1 + 1, $pos2 - ($pos1 + 1));
-                                                    if (strpos($second_part, api_get_path(WEB_PATH)) !== false) {
-                                                        //we found the current portal url
-                                                        $files_list[] = array($second_part, 'local', 'url');
-                                                        $in_files_list[] = DocumentManager::get_resources_from_source_html($second_part, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                        if (count($in_files_list) > 0) {
-                                                            $files_list = array_merge($files_list, $in_files_list);
-                                                        }
-                                                    } else {
-                                                        //we didn't find any trace of current portal
-                                                        $files_list[] = array($second_part, 'remote', 'url');
-                                                    }
-                                                } elseif (strpos($second_part, '=') > 0) {
-                                                    if (substr($second_part, 0, 1) === '/') {
-                                                        //link starts with a /, making it absolute (relative to DocumentRoot)
-                                                        $files_list[] = array($second_part, 'local', 'abs');
-                                                        $in_files_list[] = DocumentManager::get_resources_from_source_html($second_part, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                        if (count($in_files_list) > 0) {
-                                                            $files_list = array_merge($files_list, $in_files_list);
-                                                        }
-                                                    } elseif(strstr($second_part, '..') === 0) {
-                                                        //link is relative but going back in the hierarchy
-                                                        $files_list[] = array($second_part, 'local', 'rel');
-                                                        //$dir = api_get_path(SYS_CODE_PATH);//dirname($abs_path);
-                                                        //$new_abs_path = realpath($dir.'/'.$second_part);
-                                                        $dir = '';
-                                                        if (!empty($abs_path)) {
-                                                            $dir = dirname($abs_path).'/';
-                                                        }
-                                                        $new_abs_path = realpath($dir.$second_part);
-                                                        $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                        if (count($in_files_list) > 0) {
-                                                            $files_list = array_merge($files_list, $in_files_list);
-                                                        }
-                                                    } else {
-                                                        //no starting '/', making it relative to current document's path
-                                                        if (substr($second_part, 0, 2) == './') {
-                                                            $second_part = substr($second_part, 2);
-                                                        }
-                                                        $files_list[] = array($second_part, 'local', 'rel');
-                                                        $dir = '';
-                                                        if (!empty($abs_path)) {
-                                                            $dir = dirname($abs_path).'/';
-                                                        }
-                                                        $new_abs_path = realpath($dir.$second_part);
-                                                        $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                        if (count($in_files_list) > 0) {
-                                                            $files_list = array_merge($files_list, $in_files_list);
-                                                        }
-                                                    }
-                                                }
-                                                //leave that second part behind now
-                                                $source = substr($source, 0, strpos($source, '?'));
-                                                if (strpos($source, '://') > 0) {
-                                                    if (strpos($source, api_get_path(WEB_PATH)) !== false) {
-                                                        //we found the current portal url
-                                                        $files_list[] = array($source, 'local', 'url');
-                                                        $in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity+1);
-                                                        if (count($in_files_list) > 0) {
-                                                            $files_list = array_merge($files_list, $in_files_list);
-                                                        }
-                                                    } else {
-                                                        //we didn't find any trace of current portal
-                                                        $files_list[] = array($source, 'remote', 'url');
-                                                    }
-                                                } else {
-                                                    //no protocol found, make link local
-                                                    if (substr($source, 0, 1) === '/') {
-                                                        //link starts with a /, making it absolute (relative to DocumentRoot)
-                                                        $files_list[] = array($source, 'local', 'abs');
-                                                        $in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                        if (count($in_files_list) > 0) {
-                                                            $files_list = array_merge($files_list, $in_files_list);
-                                                        }
-                                                    } elseif (strstr($source, '..') === 0) {	//link is relative but going back in the hierarchy
-                                                        $files_list[] = array($source, 'local', 'rel');
-                                                        $dir = '';
-                                                        if (!empty($abs_path)) {
-                                                            $dir = dirname($abs_path).'/';
-                                                        }
-                                                        $new_abs_path = realpath($dir.$source);
-                                                        $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                        if (count($in_files_list) > 0) {
-                                                            $files_list = array_merge($files_list, $in_files_list);
-                                                        }
-                                                    } else {
-                                                        //no starting '/', making it relative to current document's path
-                                                        if (substr($source, 0, 2) == './') {
-                                                            $source = substr($source, 2);
-                                                        }
-                                                        $files_list[] = array($source, 'local', 'rel');
-                                                        $dir = '';
-                                                        if (!empty($abs_path)) {
-                                                            $dir = dirname($abs_path).'/';
-                                                        }
-                                                        $new_abs_path = realpath($dir.$source);
-                                                        $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                        if (count($in_files_list) > 0) {
-                                                            $files_list = array_merge($files_list, $in_files_list);
-                                                        }
-                                                    }
-                                                }
+                                    } elseif (strpos($second_part, '=') > 0) {
+                                        if (substr($second_part, 0, 1) === '/') {
+                                            //link starts with a /, making it absolute (relative to DocumentRoot)
+                                            $files_list[] = array($second_part, 'local', 'abs');
+                                            $in_files_list[] = DocumentManager::get_resources_from_source_html($second_part, true, TOOL_DOCUMENT, $recursivity + 1);
+                                            if (count($in_files_list) > 0) {
+                                                $files_list = array_merge($files_list, $in_files_list);
                                             }
-                                            //found some protocol there
-                                            if (strpos($source, api_get_path(WEB_PATH)) !== false) {
-                                                //we found the current portal url
-                                                $files_list[] = array($source, 'local', 'url');
-                                                $in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                if (count($in_files_list) > 0) {
-                                                    $files_list = array_merge($files_list, $in_files_list);
-                                                }
-                                            } else {
-                                                //we didn't find any trace of current portal
-                                                $files_list[] = array($source, 'remote', 'url');
+                                        } elseif(strstr($second_part, '..') === 0) {
+                                            //link is relative but going back in the hierarchy
+                                            $files_list[] = array($second_part, 'local', 'rel');
+                                            //$dir = api_get_path(SYS_CODE_PATH);//dirname($abs_path);
+                                            //$new_abs_path = realpath($dir.'/'.$second_part);
+                                            $dir = '';
+                                            if (!empty($abs_path)) {
+                                                $dir = dirname($abs_path).'/';
+                                            }
+                                            $new_abs_path = realpath($dir.$second_part);
+                                            $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
+                                            if (count($in_files_list) > 0) {
+                                                $files_list = array_merge($files_list, $in_files_list);
                                             }
                                         } else {
-                                            //no protocol found, make link local
-                                            if (substr($source, 0, 1) === '/') {
-                                                //link starts with a /, making it absolute (relative to DocumentRoot)
-                                                $files_list[] = array($source, 'local', 'abs');
-                                                $in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                if (count($in_files_list) > 0) {
-                                                    $files_list = array_merge($files_list, $in_files_list);
-                                                }
-                                            } elseif (strpos($source, '..') === 0) {
-                                                //link is relative but going back in the hierarchy
-                                                $files_list[] = array($source, 'local', 'rel');
-                                                $dir = '';
-                                                if (!empty($abs_path)) {
-                                                    $dir = dirname($abs_path).'/';
-                                                }
-                                                $new_abs_path = realpath($dir.$source);
-                                                $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                if (count($in_files_list) > 0) {
-                                                    $files_list = array_merge($files_list, $in_files_list);
-                                                }
-                                            } else {
-                                                //no starting '/', making it relative to current document's path
-                                                if (substr($source, 0, 2) == './') {
-                                                    $source = substr($source, 2);
-                                                }
-                                                $files_list[] = array($source, 'local', 'rel');
-                                                $dir = '';
-                                                if (!empty($abs_path)) {
-                                                    $dir = dirname($abs_path).'/';
-                                                }
-                                                $new_abs_path = realpath($dir.$source);
-                                                $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
-                                                if (count($in_files_list) > 0) {
-                                                    $files_list = array_merge($files_list, $in_files_list);
-                                                }
+                                            //no starting '/', making it relative to current document's path
+                                            if (substr($second_part, 0, 2) == './') {
+                                                $second_part = substr($second_part, 2);
+                                            }
+                                            $files_list[] = array($second_part, 'local', 'rel');
+                                            $dir = '';
+                                            if (!empty($abs_path)) {
+                                                $dir = dirname($abs_path).'/';
+                                            }
+                                            $new_abs_path = realpath($dir.$second_part);
+                                            $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
+                                            if (count($in_files_list) > 0) {
+                                                $files_list = array_merge($files_list, $in_files_list);
                                             }
                                         }
                                     }
+                                    //leave that second part behind now
+                                    $source = substr($source, 0, strpos($source, '?'));
+                                    if (strpos($source, '://') > 0) {
+                                        if (strpos($source, api_get_path(WEB_PATH)) !== false) {
+                                            //we found the current portal url
+                                            $files_list[] = array($source, 'local', 'url');
+                                            $in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity+1);
+                                            if (count($in_files_list) > 0) {
+                                                $files_list = array_merge($files_list, $in_files_list);
+                                            }
+                                        } else {
+                                            //we didn't find any trace of current portal
+                                            $files_list[] = array($source, 'remote', 'url');
+                                        }
+                                    } else {
+                                        //no protocol found, make link local
+                                        if (substr($source, 0, 1) === '/') {
+                                            //link starts with a /, making it absolute (relative to DocumentRoot)
+                                            $files_list[] = array($source, 'local', 'abs');
+                                            $in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1);
+                                            if (count($in_files_list) > 0) {
+                                                $files_list = array_merge($files_list, $in_files_list);
+                                            }
+                                        } elseif (strstr($source, '..') === 0) {	//link is relative but going back in the hierarchy
+                                            $files_list[] = array($source, 'local', 'rel');
+                                            $dir = '';
+                                            if (!empty($abs_path)) {
+                                                $dir = dirname($abs_path).'/';
+                                            }
+                                            $new_abs_path = realpath($dir.$source);
+                                            $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
+                                            if (count($in_files_list) > 0) {
+                                                $files_list = array_merge($files_list, $in_files_list);
+                                            }
+                                        } else {
+                                            //no starting '/', making it relative to current document's path
+                                            if (substr($source, 0, 2) == './') {
+                                                $source = substr($source, 2);
+                                            }
+                                            $files_list[] = array($source, 'local', 'rel');
+                                            $dir = '';
+                                            if (!empty($abs_path)) {
+                                                $dir = dirname($abs_path).'/';
+                                            }
+                                            $new_abs_path = realpath($dir.$source);
+                                            $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
+                                            if (count($in_files_list) > 0) {
+                                                $files_list = array_merge($files_list, $in_files_list);
+                                            }
+                                        }
+                                    }
+                                }
+                                //found some protocol there
+                                if (strpos($source, api_get_path(WEB_PATH)) !== false) {
+                                    //we found the current portal url
+                                    $files_list[] = array($source, 'local', 'url');
+                                    $in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1);
+                                    if (count($in_files_list) > 0) {
+                                        $files_list = array_merge($files_list, $in_files_list);
+                                    }
+                                } else {
+                                    //we didn't find any trace of current portal
+                                    $files_list[] = array($source, 'remote', 'url');
+                                }
+                            } else {
+                                //no protocol found, make link local
+                                if (substr($source, 0, 1) === '/') {
+                                    //link starts with a /, making it absolute (relative to DocumentRoot)
+                                    $files_list[] = array($source, 'local', 'abs');
+                                    $in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1);
+                                    if (count($in_files_list) > 0) {
+                                        $files_list = array_merge($files_list, $in_files_list);
+                                    }
+                                } elseif (strpos($source, '..') === 0) {
+                                    //link is relative but going back in the hierarchy
+                                    $files_list[] = array($source, 'local', 'rel');
+                                    $dir = '';
+                                    if (!empty($abs_path)) {
+                                        $dir = dirname($abs_path).'/';
+                                    }
+                                    $new_abs_path = realpath($dir.$source);
+                                    $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
+                                    if (count($in_files_list) > 0) {
+                                        $files_list = array_merge($files_list, $in_files_list);
+                                    }
+                                } else {
+                                    //no starting '/', making it relative to current document's path
+                                    if (substr($source, 0, 2) == './') {
+                                        $source = substr($source, 2);
+                                    }
+                                    $files_list[] = array($source, 'local', 'rel');
+                                    $dir = '';
+                                    if (!empty($abs_path)) {
+                                        $dir = dirname($abs_path).'/';
+                                    }
+                                    $new_abs_path = realpath($dir.$source);
+                                    $in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
+                                    if (count($in_files_list) > 0) {
+                                        $files_list = array_merge($files_list, $in_files_list);
+                                    }
                                 }
                             }
+                        }
+                    }
+                }
                 break;
             default: //ignore
                 break;

+ 6 - 2
main/inc/lib/sortabletable.class.php

@@ -204,8 +204,10 @@ class SortableTable extends HTML_Table {
 	 * Displays the table, complete with navigation buttons to browse through
 	 * the data-pages.
 	 */
-	public function display () {
+	public function display() {
 		$empty_table = false;
+		$content = $this->get_table_html();
+		
 		if ($this->get_total_number_of_items() == 0) {
 			$cols = $this->getColCount();
 			$this->setCellAttributes(1, 0, 'style="font-style: italic;text-align:center;" colspan='.$cols);
@@ -253,7 +255,9 @@ class SortableTable extends HTML_Table {
 				$html .= '<form method="post" action="'.api_get_self().'?'.$params.'" name="form_'.$this->table_name.'">';
 			}
 		}
-		$html .= $this->get_table_html();
+		
+		$html .= $content;
+		
 		if (!$empty_table) {
 			$html .= '<table style="width:100%;">';
 			$html .= '<tr>';

BIN
main/plugin/hotspot/hotspot_admin.swf


BIN
main/plugin/hotspot/hotspot_delineation_admin.swf


BIN
main/plugin/hotspot/hotspot_solution.swf


BIN
main/plugin/hotspot/hotspot_user.swf