Skip to content
Snippets Groups Projects
Commit 2b635df3 authored by DFNVC's avatar DFNVC
Browse files

Existierende URL-Pfade müssen systemweit erkannt werden,

damit in Moodle keine leeren Adobe-Connect-Aktivitäten
erstellt werden können.
parent 8df6df72
Branches
Tags v2.2.20
No related merge requests found
...@@ -435,6 +435,23 @@ function aconnect_get_content_folder($aconnect) { ...@@ -435,6 +435,23 @@ function aconnect_get_content_folder($aconnect) {
$folderscoid = aconnect_get_user_folder($aconnect, $folderscoid, $username); $folderscoid = aconnect_get_user_folder($aconnect, $folderscoid, $username);
return $folderscoid; return $folderscoid;
} }
//
// DFNVC
//
function aconnect_urlpath_exists($aconnect, $urlpath) {
$folderscoid = false;
$params = array('action' => 'sco-by-url',
'url-path' => $urlpath,
);
$aconnect->create_request($params);
if ($aconnect->call_success()) {
return true;
}
else {
return false;
}
}
/** /**
* Log in as the admin user. This should only be used to conduct API calls. * Log in as the admin user. This should only be used to conduct API calls.
......
...@@ -20,7 +20,6 @@ class mod_adobeconnect_mod_form extends moodleform_mod { ...@@ -20,7 +20,6 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
global $COURSE, $CFG; global $COURSE, $CFG;
$mform =& $this->_form; $mform =& $this->_form;
//-------------------------------------------------------------------------------
/// Adding the "general" fieldset, where all the common settings are showed /// Adding the "general" fieldset, where all the common settings are showed
$mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('header', 'general', get_string('general', 'form'));
...@@ -45,7 +44,6 @@ class mod_adobeconnect_mod_form extends moodleform_mod { ...@@ -45,7 +44,6 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
/// Adding "introformat" field /// Adding "introformat" field
// $mform->addElement('format', 'introformat', get_string('format')); // $mform->addElement('format', 'introformat', get_string('format'));
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
/// Adding the rest of adobeconnect settings, spreeading all them into this fieldset /// Adding the rest of adobeconnect settings, spreeading all them into this fieldset
/// or adding more fieldsets ('header' elements) if needed for better logic /// or adding more fieldsets ('header' elements) if needed for better logic
...@@ -124,9 +122,9 @@ class mod_adobeconnect_mod_form extends moodleform_mod { ...@@ -124,9 +122,9 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
// Search for a Meeting with the same starting name. It will cause a duplicate // Search for a Meeting with the same starting name. It will cause a duplicate
// meeting name (and error) when the user begins to add participants to the meeting // meeting name (and error) when the user begins to add participants to the meeting
//
// DFNVC // DFNVC
// //
// $meetfldscoid = aconnect_get_folder($aconnect, 'meetings');
$meetfldscoid = aconnect_get_meeting_folder($aconnect); $meetfldscoid = aconnect_get_meeting_folder($aconnect);
// //
// //
...@@ -137,8 +135,6 @@ class mod_adobeconnect_mod_form extends moodleform_mod { ...@@ -137,8 +135,6 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
$namematches = array(); $namematches = array();
} }
// Now search for existing meeting room URLs // Now search for existing meeting room URLs
$url = $data['meeturl']; $url = $data['meeturl'];
$url = $data['meeturl'] = adobeconnect_clean_meet_url($data['meeturl']); $url = $data['meeturl'] = adobeconnect_clean_meet_url($data['meeturl']);
...@@ -149,23 +145,14 @@ class mod_adobeconnect_mod_form extends moodleform_mod { ...@@ -149,23 +145,14 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
$errors['meeturl'] = get_string('invalidadobemeeturl', 'adobeconnect'); $errors['meeturl'] = get_string('invalidadobemeeturl', 'adobeconnect');
} }
# $filter = array('filter-like-url-path' => $url);
# DFNVC ERROR !!
#
$filter = array('filter-url-path' => "/$url/");
$urlmatches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter);
#$errors['meeturl'] = 'urlmatches:';
if (empty($urlmatches)) { if (empty($urlmatches)) {
$urlmatches = array(); $urlmatches = array();
} else { }
else {
// format url for comparison // format url for comparison
if ((false === strpos($url, '/')) or (0 != strpos($url, '/'))) { if ((false === strpos($url, '/')) or (0 != strpos($url, '/'))) {
$url = '/' . $url; $url = '/' . $url;
} }
} }
// Check URL for correct length and format // Check URL for correct length and format
...@@ -177,9 +164,11 @@ class mod_adobeconnect_mod_form extends moodleform_mod { ...@@ -177,9 +164,11 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
$errors['meeturl'] = get_string('invalidurl', 'adobeconnect'); $errors['meeturl'] = get_string('invalidurl', 'adobeconnect');
} }
// Adding activity
if (empty($data['update'])) {
if (empty($data['update'])) {
//
// Adding activity
//
if ($data['starttime'] == $data['endtime']) { if ($data['starttime'] == $data['endtime']) {
$errors['starttime'] = get_string('samemeettime', 'adobeconnect'); $errors['starttime'] = get_string('samemeettime', 'adobeconnect');
$errors['endtime'] = get_string('samemeettime', 'adobeconnect'); $errors['endtime'] = get_string('samemeettime', 'adobeconnect');
...@@ -201,12 +190,9 @@ class mod_adobeconnect_mod_form extends moodleform_mod { ...@@ -201,12 +190,9 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
} }
} }
foreach($urlmatches as $matchkey => $match) { if (aconnect_urlpath_exists($aconnect, $url)) {
$matchurl = rtrim($match->url, '/');
if ($matchurl == $url) {
$errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect');
} }
}
} else { } else {
// Updating activity // Updating activity
...@@ -229,13 +215,9 @@ class mod_adobeconnect_mod_form extends moodleform_mod { ...@@ -229,13 +215,9 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
} }
} }
foreach($urlmatches as $matchkey => $match) { if (aconnect_urlpath_exists($aconnect, $url)) {
if (!array_key_exists($match->scoid, $grpmeetings)) {
if (0 == substr_compare($match->url, $url . '_', 0, strlen($url . '_'), false)) {
$errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect');
} }
}
}
// Validate start and end times // Validate start and end times
if ($data['starttime'] == $data['endtime']) { if ($data['starttime'] == $data['endtime']) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment