[svn r20093] Logic change - Fixed order of groups and users list when you choose them as recipient in calendar - FS#3788

skala
Cristian Fasanando 17 years ago
parent 3c3e1df05f
commit 9613ea6908
  1. 66
      main/calendar/agenda.inc.php

@ -1,4 +1,4 @@
<?php //$Id: agenda.inc.php 20031 2009-04-23 21:04:02Z cfasanando $ <?php //$Id: agenda.inc.php 20093 2009-04-24 22:08:45Z cfasanando $
/* /*
============================================================================== ==============================================================================
@ -525,8 +525,43 @@ function move(fbox, tbox)
} }
} }
arrFbox.sort(); //arrFbox.sort();
arrTbox.sort(); //arrTbox.sort()
var arrFboxGroup = new Array();
var arrFboxUser = new Array();
var prefix_x;
for (x = 0; x < arrFbox.length; x++) {
prefix_x = arrFbox[x].substring(0,2);
if (prefix_x == 'G:') {
arrFboxGroup.push(arrFbox[x]);
} else {
arrFboxUser.push(arrFbox[x]);
}
}
arrFboxGroup.sort();
arrFboxUser.sort();
arrFbox = arrFboxGroup.concat(arrFboxUser);
var arrTboxGroup = new Array();
var arrTboxUser = new Array();
var prefix_y;
for (y = 0; y < arrTbox.length; y++) {
prefix_y = arrTbox[y].substring(0,2);
if (prefix_y == 'G:') {
arrTboxGroup.push(arrTbox[y]);
} else {
arrTboxUser.push(arrTbox[y]);
}
}
arrTboxGroup.sort();
arrTboxUser.sort();
arrTbox = arrTboxGroup.concat(arrTboxUser);
fbox.length = 0; fbox.length = 0;
tbox.length = 0; tbox.length = 0;
@ -823,7 +858,7 @@ function construct_not_selected_select_form($group_list=null, $user_list=null,$t
// adding the groups to the select form // adding the groups to the select form
if (isset($to_already_selected) && $to_already_selected==='everyone') { if (isset($to_already_selected) && $to_already_selected==='everyone') {
echo "\t\t<option value=\"\">&nbsp;</option>\n"; echo "\t\t<option value=\"\">--------------------------------------------</option>\n";
} else { } else {
if (is_array($group_list)) if (is_array($group_list))
{ {
@ -840,7 +875,7 @@ function construct_not_selected_select_form($group_list=null, $user_list=null,$t
// a divider // a divider
} }
echo "<option value=\"\">----------------------------------</option>"; echo "<option value=\"\">--------------------------------------------</option>";
// adding the individual users to the select form // adding the individual users to the select form
foreach($user_list as $this_user) foreach($user_list as $this_user)
{ {
@ -879,18 +914,29 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al
echo "\t\t<select id=\"selected_form\" name=\"selectedform[]\" size=\"5\" multiple=\"multiple\" style=\"width:200px\">"; echo "\t\t<select id=\"selected_form\" name=\"selectedform[]\" size=\"5\" multiple=\"multiple\" style=\"width:200px\">";
if(is_array($to_already_selected)) if(is_array($to_already_selected))
{ {
$select_options_group = array();
$select_options_user = array();
$select_options_groupuser = array();
foreach($to_already_selected as $groupuser) foreach($to_already_selected as $groupuser)
{ {
list($type,$id)=explode(":",$groupuser); list($type,$id)=explode(":",$groupuser);
if ($type=="GROUP") if ($type=="GROUP")
{ {
echo "\t\t<option value=\"".$groupuser."\">G: ".$ref_array_groups[$id]['name']."</option>"; $select_options_group[] = "\t\t<option value=\"".$groupuser."\">G: ".$ref_array_groups[$id]['name']."</option>";
//echo "\t\t<option value=\"".$groupuser."\">G: ".$ref_array_groups[$id]['name']."</option>";
} }
else else
{ {
echo "\t\t<option value=\"".$groupuser."\">".$ref_array_users[$id]['lastName']." ".$ref_array_users[$id]['firstName']."</option>"; $select_options_user[] = "\t\t<option value=\"".$groupuser."\">".$ref_array_users[$id]['lastName']." ".$ref_array_users[$id]['firstName']."</option>";
//echo "\t\t<option value=\"".$groupuser."\">".$ref_array_users[$id]['lastName']." ".$ref_array_users[$id]['firstName']."</option>";
} }
} }
$select_options_group[] = "<option value=\"\">--------------------------------------------</option>";
$select_options_groupuser = array_merge($select_options_group,$select_options_user);
foreach($select_options_groupuser as $select_options) {
echo $select_options;
}
} else { } else {
if($to_already_selected=='everyone'){ if($to_already_selected=='everyone'){
// adding the groups to the select form // adding the groups to the select form
@ -907,7 +953,7 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al
} }
} }
} }
echo "<option value=\"\">--------------------------------------------</option>";
// adding the individual users to the select form // adding the individual users to the select form
foreach($user_list as $this_user) foreach($user_list as $this_user)
{ {
@ -1582,7 +1628,6 @@ function store_edited_agenda_item($id_attach,$file_comment)
update_added_resources("Agenda", $id); update_added_resources("Agenda", $id);
// return the message; // return the message;
echo '<br />';
Display::display_confirmation_message(get_lang("EditSuccess")); Display::display_confirmation_message(get_lang("EditSuccess"));
} }
@ -1661,7 +1706,6 @@ function delete_agenda_item($id)
$id=null; $id=null;
// displaying the result message in the yellow box // displaying the result message in the yellow box
echo '<br />';
Display::display_confirmation_message(get_lang("AgendaDeleteSuccess")); Display::display_confirmation_message(get_lang("AgendaDeleteSuccess"));
} // if (isset($id)&&$id&&isset($action)&&$action=="delete") } // if (isset($id)&&$id&&isset($action)&&$action=="delete")
} // if ($is_allowed_to_edit) } // if ($is_allowed_to_edit)
@ -1686,7 +1730,6 @@ function showhide_agenda_item($id)
{ {
$id=(int)addslashes($_GET['id']); $id=(int)addslashes($_GET['id']);
change_visibility($nameTools,$id); change_visibility($nameTools,$id);
echo '<br />';
Display::display_confirmation_message(get_lang("VisibilityChanged")); Display::display_confirmation_message(get_lang("VisibilityChanged"));
} }
} }
@ -4378,7 +4421,6 @@ function delete_attachment_file($id_attach) {
// update item_property // update item_property
api_item_property_update($_course, 'calendar_event_attachment', $id_attach ,'AgendaAttachmentDeleted', api_get_user_id()); api_item_property_update($_course, 'calendar_event_attachment', $id_attach ,'AgendaAttachmentDeleted', api_get_user_id());
if (!empty($result)) { if (!empty($result)) {
echo '<br />';
Display::display_confirmation_message(get_lang("AttachmentFileDeleteSuccess")); Display::display_confirmation_message(get_lang("AttachmentFileDeleteSuccess"));
} }
} }

Loading…
Cancel
Save