<commit_before><html>
    <head>
        {% block head %}
            <link rel="stylesheet" type="text/css" href="{{ asset('bundles/kni/css/meeting.css') }}" />
        {% endblock %}
        {% block title '<title>Workshops</title>' %}
            <link rel="stylesheet" href="{{ asset('js/jquery-ui/themes/base/jquery-ui.css')}}" />
            <meta charset="utf-8" />
            <script src="{{ asset('js/jquery-ui/jquery-1.9.1.js')}}"></script>
            <script src="{{ asset('js/jquery-ui/ui/jquery-ui.js')}}"></script>
            <script language="javascript">
                
                var workshopPosition = 0;
                $(document).ready(function(){
                    loadStep();
                    
                    {% if adminMode %}
                        loadUsers();
                    {% endif %}
                    
                    $("#left").delegate("button#nextStep", "click", function(){
                        
                        var position = $(this).attr("nextStep");
                        
                        var nextStepUrl = '{{ path('go_to_step', {'workshopId': workshop.id, 'position': 'position' }) }}';
                        nextStepUrl = nextStepUrl.replace('position', position);
                            
                            
                        $.ajax({
                            url: nextStepUrl
                        }).done(function(data){
                            loadStep();
                        });
                        
                    });
                    
                    $("#left").delegate("button#saveAnswer", "click", function(){
                        //uzytkownik odpowiada na pytanie
                        var questionId = $("input[name=questionId]").val();
                        
                        $("ul#answers li").each(function(){
                            if(!$(this).find("input[type=checkbox]").is(":checked")){
                                $(this).find("input[type=hidden]").remove();
                            }
                        });
                        
                        var answers = $("ul#answers input").serialize();
                        
                        var saveAnswerUrl = '{{ path('save_answer', {'questionId': 'qID', 'answers': 'ANS'}) }}';
                        saveAnswerUrl = saveAnswerUrl.replace('qID', questionId);
                        saveAnswerUrl = saveAnswerUrl.replace('ANS', answers);
                        
                        $.ajax({
                            url: saveAnswerUrl
                        }).done(function(){
                        });
                        
                        $("#left").html('<p class="title">Odpowiedź została zapisana</p>');
                    });
                });
                
                {% if adminMode %}
                    function loadUsers(){
                        $.ajax({
                            url: '{{ path('meeting_load_users', {'workshopId': workshop.id}) }}'
                        }).done(function(usersList){
                            $("#usersList").html(usersList);

                            updateUsersListStyle();
                        });

                    }
                {% endif %}
                
                function updateUsersListStyle(){
                    $("#usersList ul li").each(function(){
                        //alert($(this).attr("position")+"-"+workshopPosition);
                        if($(this).attr("progress")>=workshopPosition){
                            $(this).addClass("green");
                        }
                    });
                }
                
                function loadStep(){
                    $.ajax({
                        url: '{{ path('meeting_load_step_number', {'workshopId': workshop.id}) }}'
                    }).done(function(position){
                        if(position==0){
                            $("#left").html("<p class='title'>Warsztaty nierozpoczęte</p><p>Poczekaj na rozpoczęcie warsztatów przez prowadzącego</p>");
                            
                            if({{adminMode}}){
                                $("#left").append("<button id='nextStep' nextStep='1'>Rozpocznij warsztaty</button>");
                            }
                        }else{
                            //ładujemy odpowiedni step badz question
                            
                            var loadStepUrl = '{{ path('meeting_load_step', {'workshopId': workshop.id, 'position': 'position'}) }}';
                            loadStepUrl = loadStepUrl.replace('position', position);
                            
                            $.ajax({
                                url: loadStepUrl
                            }).done(function(stepData){
                                $("#left").html(stepData);
                                
                                if({{adminMode}}){
                                    nextStep= position*1+1;
                                    $("#left").append("<button id='nextStep' nextStep='"+nextStep+"'>Przejdź dalej</button>");
                                }
                            });
                            
                        }
                        workshopPosition = position;
                        
                        updateUsersListStyle();
                    });
                }
            </script>
        {% block additionalHeaders '' %}
    </head>
    <body>
        <div id="header">
            <p class="right">
                {{workshop.startDate|date('Y-m-d H:i')}}<br />
                {{ workshop.user.name }}<commit_msg>Automatyczne odświeżanie danych podczas prowadzenia warsztatów<commit_after><html>
    <head>
        {% block head %}
            <link rel="stylesheet" type="text/css" href="{{ asset('bundles/kni/css/meeting.css') }}" />
        {% endblock %}
        {% block title '<title>Workshops</title>' %}
            <link rel="stylesheet" href="{{ asset('js/jquery-ui/themes/base/jquery-ui.css')}}" />
            <meta charset="utf-8" />
            <script src="{{ asset('js/jquery-ui/jquery-1.9.1.js')}}"></script>
            <script src="{{ asset('js/jquery-ui/ui/jquery-ui.js')}}"></script>
            <script language="javascript">
                
                var workshopPosition = 0;
                var autoRefresh;
                $(document).ready(function(){
                    refresh();
                    
                    autoRefresh = setInterval(function(){refresh()},10000);
                    
                    $("#left").delegate("button#nextStep", "click", function(){
                        
                        window.clearTimeout(autoRefresh);
                        
                        var position = $(this).attr("nextStep");
                        
                        var nextStepUrl = '{{ path('go_to_step', {'workshopId': workshop.id, 'position': 'position' }) }}';
                        nextStepUrl = nextStepUrl.replace('position', position);
                            
                            
                        $.ajax({
                            url: nextStepUrl
                        }).done(function(data){
                            loadStep();
                        });
                        
                    });
                    
                    $("#left").delegate("button#saveAnswer", "click", function(){
                        window.clearTimeout(autoRefresh);
                    
                        //uzytkownik odpowiada na pytanie
                        var questionId = $("input[name=questionId]").val();
                        
                        $("ul#answers li").each(function(){
                            if(!$(this).find("input[type=checkbox]").is(":checked")){
                                $(this).find("input[type=hidden]").remove();
                            }
                        });
                        
                        var answers = $("ul#answers input").serialize();
                        
                        var saveAnswerUrl = '{{ path('save_answer', {'questionId': 'qID', 'answers': 'ANS'}) }}';
                        saveAnswerUrl = saveAnswerUrl.replace('qID', questionId);
                        saveAnswerUrl = saveAnswerUrl.replace('ANS', answers);
                        
                        $.ajax({
                            url: saveAnswerUrl
                        }).done(function(){
                        });
                        
                        $("#left").html('<p class="title">Odpowiedź została zapisana</p>');
                    });
                });
                
                function refresh(){
                    loadStep();
                    
                    {% if adminMode %}
                        loadUsers();
                    {% endif %}
                }
                
                {% if adminMode %}
                    function loadUsers(){
                        $.ajax({
                            url: '{{ path('meeting_load_users', {'workshopId': workshop.id}) }}'
                        }).done(function(usersList){
                            $("#usersList").html(usersList);

                            updateUsersListStyle();
                        });

                    }
                {% endif %}
                
                function updateUsersListStyle(){
                    $("#usersList ul li").each(function(){
                        if($(this).attr("progress")>=workshopPosition){
                            $(this).addClass("green");
                        }
                    });
                }
                
                function loadStep(){
                    $.ajax({
                        url: '{{ path('meeting_load_step_number', {'workshopId': workshop.id}) }}'
                    }).done(function(position){
                        if(position==0){
                            $("#left").html("<p class='title'>Warsztaty nierozpoczęte</p><p>Poczekaj na rozpoczęcie warsztatów przez prowadzącego</p>");
                            
                            if({{adminMode}}){
                                $("#left").append("<button id='nextStep' nextStep='1'>Rozpocznij warsztaty</button>");
                            }
                        }else{
                            //ładujemy odpowiedni step badz question
                            
                            var loadStepUrl = '{{ path('meeting_load_step', {'workshopId': workshop.id, 'position': 'position'}) }}';
                            loadStepUrl = loadStepUrl.replace('position', position);
                            
                            $.ajax({
                                url: loadStepUrl
                            }).done(function(stepData){
                                $("#left").html(stepData);
                                
                                if({{adminMode}}){
                                    nextStep= position*1+1;
                                    $("#left").append("<button id='nextStep' nextStep='"+nextStep+"'>Przejdź dalej</button>");
                                }
                            });
                            
                        }
                        workshopPosition = position;
                        updateUsersListStyle();
                    });
                }
            </script>
        {% block additionalHeaders '' %}
    </head>
    <body>
        <div id="header">
            <p class="right">
                {{workshop.startDate|date('Y-m-d H:i')}}<br />
                {{ workshop.user.name }}
{'fraction_non_alphanumeric': 0.1327650236326806, 'fraction_numerical': 0.0019412559081701552, 'mean_word_length': 0.9046777045491079, 'pattern_counts': {'":': 2, '<': 59, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2274287', 'n_tokens_mistral': 2731, 'n_tokens_neox': 2534, 'n_words': 377}