Skip to content
Snippets Groups Projects
Select Git revision
  • 5248566335cd124c95b8218551acf5a9a21c2371
  • main default protected
  • step-3263
  • feature/plugins-cli
  • feature/vite
  • step-2484-peerreview
  • biest/issue-5051
  • tests/simplify-jsonapi-tests
  • fix/typo-in-1a70031
  • feature/broadcasting
  • database-seeders-and-factories
  • feature/peer-review-2
  • feature-feedback-jsonapi
  • feature/peerreview
  • feature/balloon-plus
  • feature/stock-images-unsplash
  • tic-2588
  • 5.0
  • 5.2
  • biest/unlock-blocks
  • biest-1514
21 results

Course.class.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    messages.js 11.57 KiB
    import { $gettext } from './gettext.js';
    import Markup from './markup.js';
    
    const Messages = {
        init() {
            STUDIP.JSUpdater.register('messages', Messages.newMessages, Messages.getParamsForPolling, 60000);
        },
    
        /*********** AJAX-reload function for overview ***********/
    
        getParamsForPolling() {
            if (jQuery('#messages').length && jQuery('#since').val()) {
                return {
                    since: jQuery('#since').val(),
                    received: jQuery('#received').val(),
                    tag: jQuery('#tag').val()
                };
            }
        },
        newMessages: function(response) {
            jQuery.each(response.messages, function(message_id, message) {
                if (jQuery('#message_' + message_id).length === 0) {
                    jQuery('#messages > tbody').prepend(message);
                }
            });
            jQuery('#since').val(Math.floor(new Date().getTime() / 1000));
        },
    
        /*********** helper for the overview site ***********/
    
        whenMessageIsShown: function(lightbox) {
            jQuery(lightbox)
                .closest('tr')
                .removeClass('unread');
        },
    
        /*********** helper for the composer-site ***********/
    
        add_adressee: function(user_id, name) {
            var new_adressee = jQuery('#template_adressee').clone();
            new_adressee.find('input').val(user_id);
            new_adressee
                .find('.visual')
                .text(name)
                .find('b')
                .replaceWith(function() {
                    return jQuery(this).contents();
                });
            new_adressee.find('img.avatar-medium').remove();
            new_adressee.find('br').replaceWith(' ');
            new_adressee
                .removeAttr('id')
                .appendTo('#adressees')
                .fadeIn();
            return false;
        },
    
        add_adressees: function(form) {
            jQuery(form)
                .find('#add_adressees_selectbox option:selected')
                .each(function() {
                    var user_id = jQuery(this).val(),
                        name = jQuery(this).text();
    
                    var new_adressee = jQuery('#template_adressee').clone();
                    new_adressee.find('input').val(user_id);
                    new_adressee.find('.visual').text(name);
                    new_adressee
                        .removeAttr('id')
                        .appendTo('#adressees')