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
No related branches found
No related tags found
No related merge requests found
......@@ -435,6 +435,23 @@ function aconnect_get_content_folder($aconnect) {
$folderscoid = aconnect_get_user_folder($aconnect, $folderscoid, $username);
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.
......
......@@ -20,7 +20,6 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
global $COURSE, $CFG;
$mform =& $this->_form;
//-------------------------------------------------------------------------------
/// Adding the "general" fieldset, where all the common settings are showed
$mform->addElement('header', 'general', get_string('general', 'form'));
......@@ -45,7 +44,6 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
/// Adding "introformat" field
// $mform->addElement('format', 'introformat', get_string('format'));
//-------------------------------------------------------------------------------
/// Adding the rest of adobeconnect settings, spreeading all them into this fieldset
/// or adding more fieldsets ('header' elements) if needed for better logic
......@@ -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
// meeting name (and error) when the user begins to add participants to the meeting
//
// DFNVC
//
// $meetfldscoid = aconnect_get_folder($aconnect, 'meetings');
$meetfldscoid = aconnect_get_meeting_folder($aconnect);
//
//
......@@ -137,8 +135,6 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
$namematches = array();
}
// Now search for existing meeting room URLs
$url = $data['meeturl'];
$url = $data['meeturl'] = adobeconnect_clean_meet_url($data['meeturl']);
......@@ -149,23 +145,14 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
$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)) {
$urlmatches = array();
} else {
}
else {
// format url for comparison
if ((false === strpos($url, '/')) or (0 != strpos($url, '/'))) {
$url = '/' . $url;
}
}
// Check URL for correct length and format
......@@ -177,9 +164,11 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
$errors['meeturl'] = get_string('invalidurl', 'adobeconnect');
}
// Adding activity
if (empty($data['update'])) {
if (empty($data['update'])) {
//
// Adding activity
//
if ($data['starttime'] == $data['endtime']) {
$errors['starttime'] = get_string('samemeettime', 'adobeconnect');
$errors['endtime'] = get_string('samemeettime', 'adobeconnect');
......@@ -201,12 +190,9 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
}
}
foreach($urlmatches as $matchkey => $match) {
$matchurl = rtrim($match->url, '/');
if ($matchurl == $url) {
if (aconnect_urlpath_exists($aconnect, $url)) {
$errors['meeturl'] = get_string('duplicateurl', 'adobeconnect');
}
}
} else {
// Updating activity
......@@ -229,13 +215,9 @@ class mod_adobeconnect_mod_form extends moodleform_mod {
}
}
foreach($urlmatches as $matchkey => $match) {
if (!array_key_exists($match->scoid, $grpmeetings)) {
if (0 == substr_compare($match->url, $url . '_', 0, strlen($url . '_'), false)) {
if (aconnect_urlpath_exists($aconnect, $url)) {
$errors['meeturl'] = get_string('duplicateurl', 'adobeconnect');
}
}
}
// Validate start and end times
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