aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/lib
diff options
context:
space:
mode:
authorThomas Hackl <hackl@data-quest.de>2025-01-27 15:52:02 +0000
committerThomas Hackl <hackl@data-quest.de>2025-01-27 15:52:02 +0000
commit9b2411a078a279cb4e24c0cc2ca78c032ad55e94 (patch)
tree58a7cb651133c20280d1d7253276feb8a92e2e01 /resources/assets/javascripts/lib
parente4bf27a6e37efa3d7fd5decabacfd2dc94823aa6 (diff)
Resolve "Fehler bei der Anmeldeset-Verwaltung"
Closes #5086 Merge request studip/studip!3823
Diffstat (limited to 'resources/assets/javascripts/lib')
-rw-r--r--resources/assets/javascripts/lib/admission.js172
1 files changed, 0 insertions, 172 deletions
diff --git a/resources/assets/javascripts/lib/admission.js b/resources/assets/javascripts/lib/admission.js
index 8c0413a..c735cb2 100644
--- a/resources/assets/javascripts/lib/admission.js
+++ b/resources/assets/javascripts/lib/admission.js
@@ -2,7 +2,6 @@
* Anmeldeverfahren und -sets
* ------------------------------------------------------------------------ */
import { $gettext } from './gettext';
-import Dialog from './dialog.js';
const Admission = {
@@ -46,143 +45,6 @@ const Admission = {
return false;
},
- configureRule: function(ruleType, targetUrl, ruleId) {
- var urlparts = targetUrl.split('?');
- targetUrl = urlparts[0] + '/' + ruleType;
- if (urlparts[1]) {
- targetUrl += '?' + urlparts[1];
- }
-
- Dialog.fromURL(targetUrl, {
- method: 'post',
- size: 'auto',
- title: $gettext('Anmelderegel konfigurieren'),
- id: 'configurerule',
- data: { ruleId: ruleId, rules: _.map($('#rules input[name="rules[]"]'), 'value') }
- });
-
- return false;
- },
-
- selectRuleType: function(source) {
- Dialog.fromURL(source, {
- title: $gettext('Anmelderegel konfigurieren'),
- size: 'auto',
- data: { rules: _.map($('#rules input[name="rules[]"]'), 'value') },
- method: 'post',
- id: 'configurerule'
- });
- return false;
- },
-
- saveRule: function(ruleId, targetId, targetUrl) {
- if ($('#action').val() !== 'cancel') {
- $.ajax({
- type: 'post',
- url: targetUrl,
- data: $('#ruleform').serialize(),
- dataType: 'html',
- success: function(data) {
- if (data !== '') {
- var result = '';
- if ($('#norules').length > 0) {
- $('#norules').remove();
- $('#' + targetId).prepend('<div id="rulelist"></div>');
- }
- result += data;
- if ($('#rule_' + ruleId).length !== 0) {
- $('#rule_' + ruleId).replaceWith(result);
- } else {
- $('#rulelist').append(result);
- }
- }
- },
- error: function(jqXHR, textStatus, errorThrown) {
- alert('Status: ' + textStatus + '\nError: ' + errorThrown);
- }
- });
- }
- Admission.closeDialog('configurerule');
- Admission.toggleNotSavedAlert();
- return false;
- },
-
- removeRule: function(targetId, containerId) {
- var parent = $('#' + targetId).parent();
- $('#' + targetId).remove();
- if (parent.children('div').length === 0) {
- parent.remove();
- var norules = $gettext('Sie haben noch keine Anmelderegeln festgelegt.');
- $('#' + containerId).prepend('<span id="norules">' + '<i>' + norules + '</i></span>');
- }
- Admission.toggleNotSavedAlert();
- },
-
- toggleRuleDescription: function(targetId) {
- $('#' + targetId).toggle();
- return false;
- },
-
- toggleDetails: function(arrowId, detailId) {
- var oldSrc = $('#' + arrowId).attr('src');
- var newSrc = $('#' + arrowId).attr('rel');
- $('#' + arrowId).attr('src', newSrc);
- $('#' + arrowId).attr('rel', oldSrc);
- $('#' + detailId).slideToggle();
- return false;
- },
-
- /**
- *
- * @param String ruleId The rule to save.
- * @param String errorTarget Target element ID where error messages will be
- * shown.
- * @param String validateUrl URL to call for validation.
- * @param String savedTarget Target element ID where the saved rule will be
- * displayed.
- * @param String saveUrl URL to save the rule.
- */
- checkAndSaveRule: function(ruleId, errorTarget, validateUrl, savedTarget, saveUrl) {
- if (Admission.validateRuleConfig(errorTarget, validateUrl)) {
- Admission.saveRule(ruleId, savedTarget, saveUrl);
- Dialog.close({ id: 'configurerule' });
- }
- return false;
- },
-
- validateRuleConfig: function(containerId, targetUrl) {
- var valid = true;
- var error = $.ajax({
- type: 'post',
- async: false,
- url: targetUrl,
- data: $('#ruleform').serialize(),
- dataType: 'html',
-
- error: function(jqXHR, textStatus, errorThrown) {
- alert('Status: ' + textStatus + '\nError: ' + errorThrown);
- }
- }).responseText;
- error = error.replace(/(\r\n|\n|\r)/gm, '');
- if ($.trim(error) != '') {
- $('#' + containerId).html(error);
- valid = false;
- }
- return valid;
- },
-
- removeUserFromUserlist: function(userId) {
- var parent = $('#user_' + userId).parent();
- $('#user_' + userId).remove();
- if (parent.children('li').length === 0) {
- var nousers = $gettext('Sie haben noch niemanden hinzugefügt.');
- $(parent)
- .parent()
- .append('<span id="nousers">' + '<i>' + nousers + '</i></span>');
- }
- return false;
- },
-
updateInstitutes: function(elementId, instURL, courseURL, mode) {
if (elementId !== '') {
var query = '';
@@ -208,26 +70,6 @@ const Admission = {
}
},
- checkRuleActivation: function(target) {
- var form = $('#' + target);
- var globalActivation = form.find('input[name=enabled]');
- if (globalActivation.prop('checked')) {
- $('#activation').show();
- if (form.find('input[name=activated]:checked').val() === 'studip') {
- $('#institutes_activation').hide();
- } else {
- $('#institutes_activation').show();
- }
- } else {
- $('#activation').hide();
- $('#institutes_activation').hide();
- }
- },
-
- closeDialog: function(elementId) {
- $('#' + elementId).remove();
- },
-
checkUncheckAll: function(inputName, mode) {
switch (mode) {
case 'check':
@@ -251,20 +93,6 @@ const Admission = {
toggleNotSavedAlert: function() {
$('.hidden-alert').show();
- },
-
- autosaveCourseset: function() {
- $.post({
- url: $('#courseset-form').attr('action'),
- data: $('#courseset-form').serialize() + '&submit=1',
- dataType: 'html',
- success: function() {
- $('.hidden-alert').hide();
- },
- error: function(jqXHR, textStatus, errorThrown) {
- alert('Status: ' + textStatus + '\nError: ' + errorThrown);
- }
- });
}
};