From 119f7ee63e54776d105939343fd3179477f3908a Mon Sep 17 00:00:00 2001 From: Julian Prud'homme Date: Fri, 16 Mar 2007 14:18:47 +0100 Subject: [PATCH] [svn r11607] Change the way to add recipients to announce and calendar items --- main/announcements/announcements.inc.php | 20 +++++-- main/announcements/announcements.php | 52 +++++++---------- main/calendar/agenda.inc.php | 74 +++++++++++++----------- main/calendar/agenda.php | 11 +--- 4 files changed, 78 insertions(+), 79 deletions(-) diff --git a/main/announcements/announcements.inc.php b/main/announcements/announcements.inc.php index 79b7b06621..17c9893b21 100644 --- a/main/announcements/announcements.inc.php +++ b/main/announcements/announcements.inc.php @@ -1,4 +1,4 @@ -\n"; + echo "\n\n"; echo "\t\n"; // the form containing all the groups and all the users of the course @@ -105,13 +105,13 @@ function show_to_form($to_already_selected) // the buttons for adding or removing groups/users echo "\n\t\t\n"; echo "\n\t\t
\n"; echo "\t\t> \">", "\n\t\t

 

", "\n\t\t"; echo "\t\t
\n"; @@ -196,7 +196,15 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al } else { - echo "\t\t"; + + foreach($ref_array_users as $key=>$value){ + + if($value['user_id']==$id){ + echo "\t\t"; + break; + } + + } } } echo "\n"; @@ -649,7 +657,7 @@ function edit_advalvas_item($id,$emailTitle,$newContent,$to) global $tbl_announcement; global $tbl_item_property; - + // store the modifications in the table announcement $sql = "UPDATE $tbl_announcement SET content='$newContent', title = '$emailTitle' WHERE id='$id'"; diff --git a/main/announcements/announcements.php b/main/announcements/announcements.php index 05adfd0554..dc249ecf48 100644 --- a/main/announcements/announcements.php +++ b/main/announcements/announcements.php @@ -1,4 +1,4 @@ - year is set to 2009 on submit due to the javascript selectAll - $htmlHeadXtra[] = to_javascript(); -} + +$htmlHeadXtra[] = to_javascript(); /* ----------------------------------------------------------- @@ -518,7 +512,7 @@ if (api_is_allowed_to_edit() OR api_get_course_setting('allow_user_edit_announce if(isset($id)&&$id) // there is an Id => the announcement already exists => update mode { - $edit_id = edit_advalvas_item($id,$emailTitle,$newContent,$selectedform); + $edit_id = edit_advalvas_item($id,$emailTitle,$newContent,$_POST['selectedform']); if(!$delete) { update_added_resources("Ad_Valvas", $id); @@ -532,7 +526,6 @@ if (api_is_allowed_to_edit() OR api_get_course_setting('allow_user_edit_announce list($orderMax) = mysql_fetch_row($result); $order = $orderMax + 1; - if(!empty($_SESSION['toolgroup'])){ $insert_id=store_advalvas_item($_POST['emailTitle'],$_POST['newContent'],$order,array('GROUP:'.$_SESSION['toolgroup'])); }else{ @@ -1001,28 +994,20 @@ if ($message == true) // or not //echo "sessiewaarde: ".$_SESSION['select_groupusers']; if(empty($_SESSION['toolgroup'])){ - if ($_SESSION['select_groupusers']=="hide") - { - echo "
"; - echo get_lang("SentTo").": "; - echo ""; - echo get_lang("Everybody"); - echo ""; - echo "" ; - echo "
"; + + echo "
"; + echo get_lang("SentTo").": "; + echo ""; + if(isset($_GET['id']) && is_array($to)){ + echo ' '; } - - if ($_SESSION['select_groupusers']=="show") - { - echo "
"; - echo get_lang("SentTo").": "; - echo ""; - echo get_lang('SelectedUsersGroups'); - echo ''; - echo "" ; - echo "
"; - show_to_form($to); + else{ + echo get_lang("Everybody"); } + echo "
"; + echo ''.get_lang('ModifyRecipientList').''; + echo "
"; + show_to_form($to); echo "

"; @@ -1111,11 +1096,14 @@ if ($message == true) echo "
";*/ ?> -


+



\n"; + if(isset($_GET['action']) && isset($_GET['id']) && is_array($to)){ + echo ''; + } } // displayform diff --git a/main/calendar/agenda.inc.php b/main/calendar/agenda.inc.php index 5aea922bc8..0b2d2c87e3 100644 --- a/main/calendar/agenda.inc.php +++ b/main/calendar/agenda.inc.php @@ -1,4 +1,4 @@ -\n"; +echo "\n\n"; echo "\t\n"; // the form containing all the groups and all the users of the course echo "\t\t
\n"; @@ -498,13 +502,13 @@ echo "\n\n"; // the buttons for adding or removing groups/users echo "\n\t\t\n"; echo "\n\t\t - '; @@ -1912,23 +1918,25 @@ function show_add_form($id = '') echo ''; echo ''; - }else{ + }else{ + ?>
\n"; echo "\t\t", "\n\t\t

 

", "\n\t\t"; echo "\t\t
\n"; @@ -624,7 +628,8 @@ $last_id=mysql_insert_id(); // store in last_tooledit (first the groups, then the users $to=$_POST['selectedform']; -if (($_SESSION['allow_individual_calendar']=="show" and !is_null($to))or (!empty($_SESSION['toolgroup']))) // !is_null($to): when no user is selected we send it to everyone + +if ((!is_null($to))or (!empty($_SESSION['toolgroup']))) // !is_null($to): when no user is selected we send it to everyone { $send_to=separate_users_groups($to); // storing the selected groups @@ -1132,7 +1137,7 @@ function store_edited_agenda_item() $result = api_sql_query($sql_delete,__FILE__,__LINE__) or die (mysql_error()); // 2.b. storing the new users/groups - if ($_SESSION['allow_individual_calendar']=="show" and !is_null($to)) // !is_null($to): when no user is selected we send it to everyone + if (!is_null($to)) // !is_null($to): when no user is selected we send it to everyone { $send_to=separate_users_groups($to); // storing the selected groups @@ -1789,11 +1794,12 @@ function display_one_agenda_item($agenda_id) * agenda item. When the id parameter is empty (default behaviour), then we show an empty form, else we are editing and * we have to retrieve the information that is in the database and use this information in the forms. * @author Patrick Cool , Ghent University -* @param integer id, the id of the agenda itme we are editing. By default this is empty which means that we are adding an +* @param integer id, the id of the agenda item we are editing. By default this is empty which means that we are adding an * agenda item. */ function show_add_form($id = '') { + global $MonthsLong; // the default values for the forms @@ -1902,7 +1908,7 @@ function show_add_form($id = '')
" ; + //echo "" ; //echo "sessiewaarde: ".$_SESSION['allow_individual_calendar']; - if ($_SESSION['allow_individual_calendar']=="hide") - { - echo ''; + echo get_lang("SentTo").": "; + if ((isset($_GET['id']) && $to=='everyone') || !isset($_GET['id'])){ + echo get_lang("Everybody").' '; } - if ($_SESSION['allow_individual_calendar']=="show") - { - show_to_form($to); + echo ''.get_lang('ModifyRecipientList').''; + show_to_form($to); + if (isset($_GET['id']) && $to!='everyone'){ + echo ''; } ?>
@@ -2221,7 +2229,7 @@ function show_add_form($id = '')
- +
diff --git a/main/calendar/agenda.php b/main/calendar/agenda.php index 27026b7b84..31d3474179 100644 --- a/main/calendar/agenda.php +++ b/main/calendar/agenda.php @@ -1,4 +1,4 @@ - year is set to 2009 on submit due to the javascript selectAll - $htmlHeadXtra[] = to_javascript(); -} +$htmlHeadXtra[] = to_javascript(); + $htmlHeadXtra[] = user_group_filter_javascript(); // this loads the javascript that is needed for the date popup selection $htmlHeadXtra[] = "";