Add new group announcement option (private message) BT#13541

pull/2926/head
Julio Montoya 7 years ago
parent 436571f43d
commit f1e92f99b9
  1. 32
      main/announcements/announcements.php
  2. 1
      main/group/group_category.php
  3. 2
      main/group/settings.php
  4. 4
      main/inc/ajax/announcement.ajax.php
  5. 63
      main/inc/lib/AnnouncementManager.php
  6. 8
      tests/behat/features/course_user_registration.feature
  7. 591
      tests/behat/features/toolGroup.feature

@ -37,6 +37,7 @@ $allowToEdit = (
api_is_allowed_to_edit(false, true) ||
(api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())
);
$allowStudentInGroupToSend = false;
$sessionId = api_get_session_id();
$drhHasAccessToSessionContent = api_drh_can_access_all_session_content();
@ -60,15 +61,16 @@ $tbl_courses = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_sessions = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$isTutor = false;
if (!empty($group_id)) {
$groupProperties = GroupManager:: get_group_properties($group_id);
$groupProperties = GroupManager::get_group_properties($group_id);
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH)."group/group.php?".api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
'name' => get_lang('Groups'),
];
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH)."group/group_space.php?".api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace').' '.$groupProperties['name'],
];
@ -78,10 +80,14 @@ if (!empty($group_id)) {
if ($isTutor) {
$allowToEdit = true;
}
// Last chance ... students can send announcements
if ($groupProperties['announcements_state'] == GroupManager::TOOL_PRIVATE_BETWEEN_USERS) {
$allowStudentInGroupToSend = true;
}
}
}
/* Tracking */
Event::event_access_tool(TOOL_ANNOUNCEMENT);
$announcement_id = isset($_GET['id']) ? (int) $_GET['id'] : null;
@ -166,9 +172,11 @@ switch ($action) {
'url' => api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(),
'name' => $nameTools,
];
$nameTools = get_lang('View');
$content = AnnouncementManager::displayAnnouncement($announcement_id);
if (empty($content)) {
api_not_allowed(true);
}
break;
case 'list':
$htmlHeadXtra[] = api_get_jqgrid_js();
@ -291,7 +299,9 @@ switch ($action) {
if (empty($count)) {
$html = '';
if ($allowToEdit && (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath')) {
if (($allowToEdit || $allowStudentInGroupToSend) &&
(empty($_GET['origin']) || $_GET['origin'] !== 'learnpath')
) {
$html .= '<div id="no-data-view">';
$html .= '<h3>'.get_lang('Announcements').'</h3>';
$html .= Display::return_icon('valves.png', '', [], 64);
@ -389,8 +399,10 @@ switch ($action) {
api_not_allowed(true);
}
if (!$allowToEdit) {
api_not_allowed(true);
if ($allowStudentInGroupToSend === false) {
if (!$allowToEdit) {
api_not_allowed(true);
}
}
// DISPLAY ADD ANNOUNCEMENT COMMAND
@ -768,7 +780,7 @@ if (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath') {
// Actions
$show_actions = false;
$actionsLeft = '';
if ($allowToEdit && (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath')) {
if (($allowToEdit || $allowStudentInGroupToSend) && (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath')) {
if (in_array($action, ['add', 'modify', 'view'])) {
$actionsLeft .= "<a href='".api_get_self()."?".api_get_cidreq()."'>".
Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).
@ -788,7 +800,7 @@ if ($allowToEdit && (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath'))
if ($allowToEdit && api_get_group_id() == 0) {
$allow = api_get_configuration_value('disable_delete_all_announcements');
if ($allow === false) {
if ($allow === false && api_is_allowed_to_edit()) {
if (!isset($_GET['action']) ||
isset($_GET['action']) && $_GET['action'] == 'list'
) {

@ -127,6 +127,7 @@ for ($i = 1; $i <= 10; $i++) {
$possible_values[$i] = $i;
}
$possible_values[GroupManager::GROUP_PER_MEMBER_NO_LIMIT] = get_lang('All');
$group = [
$form->createElement('select', 'groups_per_user', null, $possible_values, ['id' => 'groups_per_user']),
$form->createElement('static', null, null, get_lang('QtyOfUserCanSubscribe_PartAfterNumber')),

@ -247,7 +247,7 @@ $group = [
$form->createElement('radio', 'announcements_state', get_lang('GroupAnnouncements'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE),
$form->createElement('radio', 'announcements_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC),
$form->createElement('radio', 'announcements_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE),
//$form->createElement('radio', 'announcements_state', null, get_lang('PrivateBetweenUsers'), GroupManager::TOOL_PRIVATE_BETWEEN_USERS),
$form->createElement('radio', 'announcements_state', null, get_lang('PrivateBetweenUsers'), GroupManager::TOOL_PRIVATE_BETWEEN_USERS),
];
$form->addGroup(

@ -44,9 +44,9 @@ switch ($action) {
}
// Last chance ... students can send announcements.
/*if ($groupProperties['announcements_state'] == GroupManager::TOOL_PRIVATE_BETWEEN_USERS) {
if ($groupProperties['announcements_state'] == GroupManager::TOOL_PRIVATE_BETWEEN_USERS) {
$allowToEdit = true;
}*/
}
}
if ($allowToEdit === false) {

@ -1,6 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\ExtraField as ExtraFieldEntity;
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
use Chamilo\CourseBundle\Entity\CAnnouncement;
use Chamilo\CourseBundle\Entity\CItemProperty;
@ -125,7 +126,7 @@ class AnnouncementManager
$value = $extra['value'];
if ($value instanceof ExtraFieldValues) {
$field = $value->getField();
if ($field) {
if ($field instanceof ExtraFieldEntity) {
$data['extra_'.$field->getVariable()] = $value->getValue();
}
}
@ -134,7 +135,7 @@ class AnnouncementManager
}
}
if (!empty(api_get_session_id())) {
if (!empty($sessionId)) {
$data['coaches'] = $coaches;
$data['general_coach'] = $generalCoachName;
$data['general_coach_email'] = $generalCoachEmail;
@ -160,7 +161,7 @@ class AnnouncementManager
*/
public static function get_all_annoucement_by_course($course_info, $session_id = 0)
{
$session_id = intval($session_id);
$session_id = (int) $session_id;
$courseId = $course_info['real_id'];
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
@ -316,13 +317,15 @@ class AnnouncementManager
* @param int $announcementId
* @param int $courseId
* @param int $userId
* @param int $groupId
*
* @return array
*/
public static function getAnnouncementInfoById(
$announcementId,
$courseId,
$userId
$userId,
$groupId = 0
) {
if (api_is_allowed_to_edit(false, true) ||
(api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())
@ -337,13 +340,22 @@ class AnnouncementManager
a.cId = :course
ORDER BY a.displayOrder DESC";
} else {
$group_list = GroupManager::get_group_ids($courseId, api_get_user_id());
if (empty($group_list)) {
$group_list[] = 0;
}
$groupId = (int) $groupId;
$groupList[] = $groupId;
if (api_get_user_id() != 0) {
$extraGroupCondition = '';
if (!empty($groupId)) {
$groupProperties = GroupManager::get_group_properties($groupId);
if ($groupProperties['announcements_state'] == GroupManager::TOOL_PRIVATE_BETWEEN_USERS) {
$extraGroupCondition = " AND (
ip.toUser = $userId AND ip.group = $groupId OR
(ip.group IN ('0') OR ip.group IS NULL) OR
(ip.group = $groupId AND (ip.toUser IS NULL OR ip.toUser = 0))
)";
}
}
$dql = "SELECT a, ip
FROM ChamiloCourseBundle:CAnnouncement a
JOIN ChamiloCourseBundle:CItemProperty ip
@ -353,11 +365,12 @@ class AnnouncementManager
ip.tool='announcement' AND
(
ip.toUser = $userId OR
ip.group IN ('0', '".implode("', '", $group_list)."') OR
ip.group IN ('0', '".$groupId."') OR
ip.group IS NULL
) AND
ip.visibility = '1' AND
ip.course = :course
$extraGroupCondition
ORDER BY a.displayOrder DESC";
} else {
$dql = "SELECT a, ip
@ -381,10 +394,14 @@ class AnnouncementManager
]
);
return [
'announcement' => $result[0],
'item_property' => $result[1],
];
if (!empty($result)) {
return [
'announcement' => $result[0],
'item_property' => $result[1],
];
}
return [];
}
/**
@ -396,8 +413,10 @@ class AnnouncementManager
*/
public static function displayAnnouncement($id)
{
if ($id != strval(intval($id))) {
return null;
$id = (int) $id;
if (empty($id)) {
return '';
}
global $charset;
@ -406,8 +425,14 @@ class AnnouncementManager
$result = self::getAnnouncementInfoById(
$id,
api_get_course_int_id(),
api_get_user_id()
api_get_user_id(),
api_get_group_id()
);
if (empty($result)) {
return '';
}
/** @var CAnnouncement $announcement */
$announcement = $result['announcement'];
/** @var CItemProperty $itemProperty */
@ -464,7 +489,7 @@ class AnnouncementManager
$html .= "</td></tr>";
$allow = !api_get_configuration_value('hide_announcement_sent_to_users_info');
if (api_is_allowed_to_edit(false, true) && $allow) {
if ($allow && api_is_allowed_to_edit(false, true)) {
$sent_to = self::sent_to('announcement', $id);
$sentToForm = self::sent_to_form($sent_to);
$html .= Display::tag(
@ -499,7 +524,7 @@ class AnnouncementManager
}
$html .= '</td></tr>';
}
$html .= "</table>";
$html .= '</table>';
return $html;
}

@ -26,4 +26,10 @@ Feature: Subscribe users to the course
Given I am on "/main/user/subscribe_user.php?keyword=fapple&type=5&cidReq=TEMP"
Then I should see "Fiona"
Then I follow "Register"
Then I should see "User Fiona Apple Maggart (fapple) has been registered to course TEMP"
Then I should see "User Fiona Apple Maggart (fapple) has been registered to course TEMP"
Scenario: Subscribe "amann" again as student to the course "TEMP" (leave it subscribed for further tests)
Given I am on "/main/user/subscribe_user.php?keyword=amann&type=5&cidReq=TEMP"
Then I should see "Aimee"
Then I follow "Register"
Then I should see "User Aimee Mann (amann) has been registered to course TEMP"

@ -6,260 +6,310 @@ Feature: Group tool
Given I am a platform administrator
And I am on course "TEMP" homepage
Scenario: Create a group directory
Given I am on "/main/group/group_category.php?cidReq=TEMP&id_session=0&action=add_category"
When I fill in the following:
| title | Group category 1 |
And I press "group_category_submit"
Then I should see "Category created"
# Scenario: Create a group directory
# Given I am on "/main/group/group_category.php?cidReq=TEMP&id_session=0&action=add_category"
# When I fill in the following:
# | title | Group category 1 |
# And I press "group_category_submit"
# Then I should see "Category created"
#
# Scenario: Create 4 groups
# Given I am on "/main/group/group_creation.php?cidReq=TEMP&id_session=0"
# When I fill in the following:
# | number_of_groups | 5 |
# And I press "submit"
# Then I should see "New groups creation"
# When I fill in the following:
# | group_0_places | 1 |
# | group_1_places | 1 |
# | group_2_places | 1 |
# | group_3_places | 1 |
# | group_4_places | 2 |
# And I press "submit"
# Then I should see "group(s) has (have) been added"
#
# Scenario: Change Group 0003 settings to make announcements private
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0003"
# Then I should see "Group 0003"
# Then I follow "Edit this group"
# Then I check the "announcements_state" radio button with "2" value
# Then I press "Save settings"
# Then I should see "Group settings modified"
#
# Scenario: Change Group 0004 settings to make it private
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0004"
# Then I should see "Group 0004"
# Then I follow "Edit this group"
# Then I check the "announcements_state" radio button with "2" value
# Then I press "Save settings"
# Then I should see "Group settings modified"
#
# Scenario: Change Group 0005 settings to make announcements private between users
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0005"
# Then I should see "Group 0005"
# Then I follow "Edit this group"
# Then I check the "announcements_state" radio button with "3" value
# Then I press "Save settings"
# Then I should see "Group settings modified"
#
# Scenario: Create document folder in group
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0001"
# Then I should see "Group 0001"
# And I follow "Documents"
# Then I should see "There are no documents to be displayed"
# Then I follow "Create folder"
# Then I should see "Create folder"
# Then I fill in the following:
# | dirname | My folder in group |
# And I press "create_dir_form_submit"
# Then I should see "Folder created"
#
# Scenario: Create document inside folder in group
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0001"
# Then I should see "Group 0001"
# And I follow "Documents"
# Then I should see "My folder in group"
# Then I follow "My folder in group"
# Then I follow "Create a rich media page / activity"
# Then I should see "Create a rich media page"
# Then I fill in the following:
# | title | html test |
# And I fill in ckeditor field "content" with "My first HTML!!"
# Then I press "create_document_submit"
# Then I should see "Item added"
#
# Scenario: Upload a document inside folder in group
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0001"
# Then I should see "Group 0001"
# And I follow "Documents"
# Then I should see "My folder in group"
# Then I follow "My folder in group"
# Then I follow "Upload documents"
# Then I follow "Upload (Simple)"
# Then I attach the file "web/css/base.css" to "file"
# Then wait for the page to be loaded
# Then I press "upload_submitDocument"
# Then wait for the page to be loaded
# Then I should see "File upload succeeded"
#
# Scenario: Delete 2 uploaded files
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0001"
# Then I should see "Group 0001"
# And I follow "Documents"
# Then I should see "My folder in group"
# Then I follow "My folder in group"
# Then I follow "Delete"
# Then wait for the page to be loaded
# Then I should see "Are you sure to delete"
# Then I follow "delete_item"
#
# Scenario: Delete directory
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0001"
# Then I should see "Group 0001"
# And I follow "Documents"
# Then I should see "My folder in group"
# Then I follow "Delete"
# Then wait for the page to be loaded
# Then I should see "Are you sure to delete"
# Then I follow "delete_item"
#
# Scenario: Add fapple to the Group 0001
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0001"
# Then I should see "Group 0001"
# Then I follow "Edit this group"
# Then I should see "Group members"
# Then wait for the page to be loaded
# Then I follow "group_members_tab"
# Then I select "Fiona Apple Maggart (fapple)" from "group_members"
# Then I press "group_members_rightSelected"
# Then I press "Save settings"
# And wait for the page to be loaded
# Then I should see "Group settings modified"
# Then I follow "Group 0001"
# Then I should see "Fiona"
#
# Scenario: Add fapple to the Group 0003 not allowed because group category allows 1 user per group
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0003"
# Then I should see "Group 0003"
# Then I follow "Edit this group"
# Then I should see "Group members"
# Then wait for the page to be loaded
# Then I follow "group_members_tab"
# Then I select "Fiona Apple Maggart (fapple)" from "group_members"
# Then I press "group_members_rightSelected"
# Then I press "Save settings"
# And wait for the page to be loaded
# Then I should see "Group settings modified"
# Then I follow "Group 0003"
# Then I should not see "Fiona"
#
# Scenario: Change Group category to allow multiple inscription of the user
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Edit this category"
# Then I should see "Edit group category: Group category 1"
# Then I fill in select bootstrap static by text "#groups_per_user" select "10"
# Then I press "Edit"
# Then I should see "Group settings have been modified"
#
# Scenario: Add fapple and acostea to Group 0005
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0005"
# Then I should see "Group 0005"
# Then I follow "Edit this group"
# Then I should see "Group members"
# Then wait for the page to be loaded
# Then I follow "group_members_tab"
# Then I select "Fiona Apple Maggart (fapple)" from "group_members"
# Then I select "Andrea Costea (acostea)" from "group_members"
# Then I press "group_members_rightSelected"
# Then I press "Save settings"
# And wait for the page to be loaded
# Then I should see "Group settings modified"
# Then I follow "Group 0005"
# Then I should see "Fiona"
# Then I should see "Andrea"
#
# Scenario: Add fapple to the Group 0003
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0003"
# Then I should see "Group 0003"
# Then I follow "Edit this group"
# Then I should see "Group members"
# Then wait for the page to be loaded
# Then I follow "group_members_tab"
# Then I select "Fiona Apple Maggart (fapple)" from "group_members"
# Then I press "group_members_rightSelected"
# Then I press "Save settings"
# And wait for the page to be loaded
# Then I should see "Group settings modified"
# Then I follow "Group 0003"
# Then I should see "Fiona"
#
# Scenario: Add acostea to the Group 0002
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0002"
# Then I should see "Group 0002"
# Then I follow "Edit this group"
# Then I should see "Group members"
# Then wait for the page to be loaded
# Then I follow "group_members_tab"
# Then I select "Andrea Costea (acostea)" from "group_members"
# Then I press "group_members_rightSelected"
# Then I press "Save settings"
# And wait for the page to be loaded
# Then I should see "Group settings modified"
# Then I follow "Group 0002"
# Then I should see "Andrea"
#
# Scenario: Create an announcement for everybody inside Group 0001
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0001"
# Then I should see "Group 0001"
# And I follow "Announcements"
# Then I should see "Announcements"
# Then I follow "Add an announcement"
# Then I should see "Add an announcement"
# Then wait for the page to be loaded
# Then I fill in the following:
# | title | Announcement for all users inside Group 0001 |
# And I fill in ckeditor field "content" with "Announcement description in Group 0001"
# Then I follow "announcement_preview"
# And wait for the page to be loaded
# Then I should see "Announcement will be sent to"
# Then I press "submit"
# Then I should see "Announcement has been added"
#
# Scenario: Create an announcement for fapple inside Group 0001
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0001"
# Then I should see "Group 0001"
# And I follow "Announcements"
# Then I should see "Announcements"
# Then I follow "Add an announcement"
# Then I should see "Add an announcement"
# Then wait for the page to be loaded
# Then I press "choose_recipients"
# Then I select "Fiona Apple" from "users"
# Then I press "users_rightSelected"
# Then I fill in the following:
# | title | Announcement for user fapple inside Group 0001 |
# And I fill in ckeditor field "content" with "Announcement description for user fapple inside Group 0001"
# Then I follow "announcement_preview"
# And wait for the page to be loaded
# Then I should see "Announcement will be sent to"
# Then I press "submit"
# Then I should see "Announcement has been added"
#
# Scenario: Create an announcement for everybody inside Group 0003 (private)
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0003"
# Then I should see "Group 0003"
# And I follow "Announcements"
# Then I should see "Announcements"
# Then I follow "Add an announcement"
# Then I should see "Add an announcement"
# Then wait for the page to be loaded
# Then I fill in the following:
# | title | Announcement for all users inside Group 0003 |
# And I fill in ckeditor field "content" with "Announcement description in Group 0003"
# Then I follow "announcement_preview"
# And wait for the page to be loaded
# Then I should see "Announcement will be sent to"
# Then I press "submit"
# Then I should see "Announcement has been added"
#
# Scenario: Create an announcement for fapple inside Group 0003
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0003"
# Then I should see "Group 0003"
# And I follow "Announcements"
# Then I should see "Announcements"
# Then I follow "Add an announcement"
# Then I should see "Add an announcement"
# Then wait for the page to be loaded
# Then I press "choose_recipients"
# Then I select "Fiona Apple" from "users"
# Then I press "users_rightSelected"
# Then I fill in the following:
# | title | Announcement for user fapple inside Group 0003 |
# And I fill in ckeditor field "content" with "Announcement description for user fapple inside Group 0003"
# Then I follow "announcement_preview"
# And wait for the page to be loaded
# Then I should see "Announcement will be sent to"
# Then I press "submit"
# Then I should see "Announcement has been added"
Scenario: Create 4 groups
Given I am on "/main/group/group_creation.php?cidReq=TEMP&id_session=0"
When I fill in the following:
| number_of_groups | 4 |
And I press "submit"
Then I should see "New groups creation"
When I fill in the following:
| group_0_places | 1 |
| group_1_places | 1 |
| group_2_places | 1 |
| group_3_places | 1 |
And I press "submit"
Then I should see "group(s) has (have) been added"
Scenario: Change Group 0003 settings to make announcements private
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
Then I follow "Edit this group"
Then I check the "announcements_state" radio button with "2" value
Then I press "Save settings"
Then I should see "Group settings modified"
Scenario: Change Group 0004 settings to make it private
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0004"
Then I should see "Group 0004"
Then I follow "Edit this group"
Then I check the "announcements_state" radio button with "2" value
Then I press "Save settings"
Then I should see "Group settings modified"
Scenario: Create document folder in group
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
And I follow "Documents"
Then I should see "There are no documents to be displayed"
Then I follow "Create folder"
Then I should see "Create folder"
Then I fill in the following:
| dirname | My folder in group |
And I press "create_dir_form_submit"
Then I should see "Folder created"
Scenario: Create document inside folder in group
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
And I follow "Documents"
Then I should see "My folder in group"
Then I follow "My folder in group"
Then I follow "Create a rich media page / activity"
Then I should see "Create a rich media page"
Then I fill in the following:
| title | html test |
And I fill in ckeditor field "content" with "My first HTML!!"
Then I press "create_document_submit"
Then I should see "Item added"
Scenario: Upload a document inside folder in group
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
And I follow "Documents"
Then I should see "My folder in group"
Then I follow "My folder in group"
Then I follow "Upload documents"
Then I follow "Upload (Simple)"
Then I attach the file "web/css/base.css" to "file"
Then wait for the page to be loaded
Then I press "upload_submitDocument"
Then wait for the page to be loaded
Then I should see "File upload succeeded"
Scenario: Delete 2 uploaded files
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
And I follow "Documents"
Then I should see "My folder in group"
Then I follow "My folder in group"
Then I follow "Delete"
Then wait for the page to be loaded
Then I should see "Are you sure to delete"
Then I follow "delete_item"
Scenario: Delete directory
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
And I follow "Documents"
Then I should see "My folder in group"
Then I follow "Delete"
Then wait for the page to be loaded
Then I should see "Are you sure to delete"
Then I follow "delete_item"
Scenario: Add fapple to the Group 0001
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
Then I follow "Edit this group"
Then I should see "Group members"
Then wait for the page to be loaded
Then I follow "group_members_tab"
Then I select "Fiona Apple Maggart (fapple)" from "group_members"
Then I press "group_members_rightSelected"
Then I press "Save settings"
And wait for the page to be loaded
Then I should see "Group settings modified"
Then I follow "Group 0001"
Then I should see "Fiona"
Scenario: Add fapple to the Group 0003 not allowed because group category allows 1 user per group
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
Then I follow "Edit this group"
Then I should see "Group members"
Then wait for the page to be loaded
Then I follow "group_members_tab"
Then I select "Fiona Apple Maggart (fapple)" from "group_members"
Then I press "group_members_rightSelected"
Then I press "Save settings"
And wait for the page to be loaded
Then I should see "Group settings modified"
Then I follow "Group 0003"
Then I should not see "Fiona"
Scenario: Change Group category to allow multiple inscription of the user
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Edit this category"
Then I should see "Edit group category: Group category 1"
Then I fill in select bootstrap static by text "#groups_per_user" select "10"
Then I press "Edit"
Then I should see "Group settings have been modified"
Scenario: Add fapple to the Group 0003
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
Then I follow "Edit this group"
Then I should see "Group members"
Then wait for the page to be loaded
Then I follow "group_members_tab"
Then I select "Fiona Apple Maggart (fapple)" from "group_members"
Then I press "group_members_rightSelected"
Then I press "Save settings"
And wait for the page to be loaded
Then I should see "Group settings modified"
Then I follow "Group 0003"
Then I should see "Fiona"
Scenario: Add acostea to the Group 0002
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0002"
Then I should see "Group 0002"
Then I follow "Edit this group"
Then I should see "Group members"
Then wait for the page to be loaded
Then I follow "group_members_tab"
Then I select "Andrea Costea (acostea)" from "group_members"
Then I press "group_members_rightSelected"
Then I press "Save settings"
And wait for the page to be loaded
Then I should see "Group settings modified"
Then I follow "Group 0002"
Then I should see "Andrea"
Scenario: Create an announcement for everybody inside Group 0001
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
And I follow "Announcements"
Then I should see "Announcements"
Then I follow "Add an announcement"
Then I should see "Add an announcement"
Then wait for the page to be loaded
Then I fill in the following:
| title | Announcement for all users inside Group 0001 |
And I fill in ckeditor field "content" with "Announcement description in Group 0001"
Then I follow "announcement_preview"
And wait for the page to be loaded
Then I should see "Announcement will be sent to"
Then I press "submit"
Then I should see "Announcement has been added"
Scenario: Create an announcement for fapple inside Group 0001
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0001"
Then I should see "Group 0001"
And I follow "Announcements"
Then I should see "Announcements"
Then I follow "Add an announcement"
Then I should see "Add an announcement"
Then wait for the page to be loaded
Then I press "choose_recipients"
Then I select "Fiona Apple" from "users"
Then I press "users_rightSelected"
Then I fill in the following:
| title | Announcement for user fapple inside Group 0001 |
And I fill in ckeditor field "content" with "Announcement description for user fapple inside Group 0001"
Then I follow "announcement_preview"
And wait for the page to be loaded
Then I should see "Announcement will be sent to"
Then I press "submit"
Then I should see "Announcement has been added"
Scenario: Create an announcement for everybody inside Group 0003 (private)
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
And I follow "Announcements"
Then I should see "Announcements"
Then I follow "Add an announcement"
Then I should see "Add an announcement"
Then wait for the page to be loaded
Then I fill in the following:
| title | Announcement for all users inside Group 0003 |
And I fill in ckeditor field "content" with "Announcement description in Group 0003"
Then I follow "announcement_preview"
And wait for the page to be loaded
Then I should see "Announcement will be sent to"
Then I press "submit"
Then I should see "Announcement has been added"
Scenario: Create an announcement for fapple inside Group 0003
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0003"
Then I should see "Group 0003"
And I follow "Announcements"
Then I should see "Announcements"
Then I follow "Add an announcement"
Then I should see "Add an announcement"
Then wait for the page to be loaded
Then I press "choose_recipients"
Then I select "Fiona Apple" from "users"
Then I press "users_rightSelected"
Then I fill in the following:
| title | Announcement for user fapple inside Group 0003 |
And I fill in ckeditor field "content" with "Announcement description for user fapple inside Group 0003"
Then I follow "announcement_preview"
And wait for the page to be loaded
Then I should see "Announcement will be sent to"
Then I press "submit"
Then I should see "Announcement has been added"
# Scenario: Create an announcement as acostea and send only to fapple
# Given I am logged as "acostea"
# Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
# And I follow "Group 0005"
# Then I should see "Group 0005"
# And I follow "Announcements"
# Then I should see "Announcements"
# Then I follow "Add an announcement"
# Then I should see "Add an announcement"
# Then wait for the page to be loaded
# Then I press "choose_recipients"
# Then I select "Fiona Apple Maggart" from "users"
# Then I press "users_rightSelected"
# Then I fill in the following:
# | title | Announcement only for fapple Group 0005 |
# And I fill in ckeditor field "content" with "Announcement description only for fapple Group 0005"
# Then I follow "announcement_preview"
# And wait for the page to be loaded
# Then I should see "Announcement will be sent to"
# Then I press "submit"
# Then I should see "Announcement has been added"
Scenario: Check fapple/acostea access of announcements
Given I am logged as "fapple"
@ -296,6 +346,15 @@ Feature: Group tool
Then I follow "Announcement for all users inside Group 0003"
Then I should see "Announcement description in Group 0003"
Then I save current URL with name "announcement_for_all_users_group_0003_private"
And I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
And I follow "Group 0005"
Then I should see "Group 0005"
Then I follow "Announcements"
And wait for the page to be loaded
Then I should see "Announcement only for fapple Group 0005"
Then I follow "Announcement only for fapple Group 0005"
Then I save current URL with name "announcement_only_for_fapple_private"
## Finish tests with fapple now check access with acostea ##
Given I am logged as "acostea"
And I am on course "TEMP" homepage
@ -304,13 +363,31 @@ Feature: Group tool
And I should see "Group 0002"
And I should see "Group 0003"
And I should see "Group 0004"
Then I visit URL saved with name "announcement_for_user_fapple_group_0001_public"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_for_all_users_group_0001_public"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_only_for_fapple_private"
Then I should see "Sorry, you are not allowed to access this page"
And I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
Given I am logged as "acostea"
And I am on course "TEMP" homepage
Given I am on "/main/group/group.php?cidReq=TEMP&id_session=0"
Then I should see "Group 0001"
And I should see "Group 0002"
And I follow "Group 0002"
Then I follow "Announcements"
And I should see "Group 0003"
And I should see "Group 0004"
And I should see "Group 0005"
Then I visit URL saved with name "announcement_for_user_fapple_group_0001_public"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_for_all_users_group_0001_public"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_for_user_fapple_group_0003_private"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_for_all_users_group_0003_private"
Then I should see "Sorry, you are not allowed to access this page"
Then I visit URL saved with name "announcement_only_for_fapple_private"
Then I should see "Sorry, you are not allowed to access this page"

Loading…
Cancel
Save