<commit_before>{% include '_header.twig' %}


<div class="row-fluid">
    <div class="span9">

    <form method="post" id="editcontent">
        
    {%for key, fields in contenttype.fields %}
    
        {% if fields.type == "text" %}
        <label><b>{{ key|ucfirst}}</b></label>
        <input type="text" name="{{key}}" id="{{key}}"
            value='{{ content[key] }}'
            class='{% if fields.class is defined %}{{ fields.class }}{% endif %}'>
        {% endif %}
        
        {% if fields.type == "slug" %}
        <label class='permalink'>
        Permalink: <tt>/{{contenttype.singular_slug}}/<input type="text" name="{{key}}"  id="{{key}}"
            value='{{ content[key] }}'
            class='editslug'></tt>
        </label>
            
<script type="text/javascript"> 
    $("#title").slug({ slug:'editslug', hide: true });
</script>
        {% endif %}
    
    
        {% if fields.type == "image" %}
        <div class="image-right">
            <div class='imageholder' id="thumbnail-{{key}}">
                {% if content[key]!="" %}
                <img src="/thumbs/120x120c/{{ content[key] }}" width="120" height="120">
                {% endif %}
            </div>
        </div>
        <div class="image-container" id="container-{{key}}">

            <label><b>{{ key|ucfirst}}</b></label>
            
            <input type="text" name="{{key}}" id="field-{{key}}"
                value='{{ content[key] }}'
                class='{% if fields.class is defined %}{{ fields.class }}{% endif %} imageinput'>

<!-- The fileinput-button span is used to style the file input field as button -->
                <span class="btn btn-info fileinput-button">
                    <i class="icon-upload icon-white"></i>
                    <span>Upload Image</span>
                    <input id="fileupload-{{key}}" type="file" name="files[]" data-url="/app/classes/upload/" multiple>
                </span>
                <div class="progress progress-striped active" id="progress-{{key}}" style="width: 50%; display: none;">
                    <div class="bar" style="width: 0%;"></div>
                </div>
                
<link rel="stylesheet" href="/app/view/lib/upload/jquery.fileupload-ui.css">
<script src="/app/view/lib/upload/jquery.ui.widget.js"></script>
<script src="/app/view/lib/upload/jquery.iframe-transport.js"></script>
<script src="/app/view/lib/upload/jquery.fileupload.js"></script>
<script>
$(function () {
    $('#fileupload-{{key}}').fileupload({
        dataType: 'json',
        dropZone: $("#container-{{key}}"),
        done: function (e, data) {
            $.each(data.result, function (index, file) {
                $('#field-{{key}}').val(file.name);
                $('#thumbnail-{{key}}').html("<img src='/thumbs/120x120c/"+encodeURI(file.name)+"' width='120' height='120'>");
            });
        }
    });
    
    $('#fileupload-{{key}}').bind('fileuploadprogress', function (e, data) {
        // Log the current bitrate for this upload:
        /*
        var progress = data.progressInterval
        
        console.log(data.progressInterval);
        $('#progress-{{key}}').show();
        $('#progress-{{key}} div.bar').css('width', progress+"%");
        if (progress == 100) {
            window.setTimeout(function(){ $('#progress-{{key}}').fadeOut('slow'); }, 1000);
            window.setTimeout(function(){ $('#progress-{{key}} div.bar').css('width', "0%"); }, 3000);
        }*/ 
        
    });    
  
      $('#fileupload-{{key}}').bind('fileuploadsend', function (e, data) {
        // This feature is only useful for browsers which rely on the iframe transport:
        if (data.dataType.substr(0, 6) === 'iframe') {
            // Set PHP's session.upload_progress.name value:
            var progressObj = {
                name: 'PHP_SESSION_UPLOAD_PROGRESS',
                value: (new Date()).getTime()  // pseudo unique ID
            };
            data.formData.push(progressObj);
            // Start the progress polling:
            data.context.data('interval', setInterval(function () {
                $.get('/app/classes/upload/progress.php', $.param([progressObj]), function (result) {
                    // Trigger a fileupload progress event,
                    // using the result as progress data:
                    e = document.createEvent('Event');
                    e.initEvent('progress', false, true);
                    $.extend(e, result);
                    $('#fileupload-{{key}}').data('fileupload')._onProgress(e, data);
                }, 'json');
            }, 1000)); // poll every second
        }
    }).bind('fileuploadalways', function (e, data) {
        clearInterval(data.context.data('interval'));
    });
      
    
});
</script>
<style>



</style>


        </div>
        {% endif %}
                
    
        {% if fields.type == "html" %}
        <label><b>{{ key|ucfirst}}</b></label>
        <textarea name="{{key}}" class='{% if fields.class is defined %}{{ fields.class }}{% endif %} redactor'
            style='{% if fields.height is defined %}height: {{ fields.height }} !important;{% endif %}'>
            {% if content[key] is defined %}{{ content[key] }}{% endif %}
        </textarea>
        {% endif %}
                
    
    {% endfor %}
        
        <label><span class='left'>Id:</span>
        <input type='text' readonly=readonly name='id' value='{{ content.id }}' class="narrow">
        </label>
        <commit_msg>Working on progress bar..<commit_after>{% include '_header.twig' %}


<div class="row-fluid">
    <div class="span9">

    <form method="post" id="editcontent">
        
    {%for key, fields in contenttype.fields %}
    
        {% if fields.type == "text" %}
        <label><b>{{ key|ucfirst}}</b></label>
        <input type="text" name="{{key}}" id="{{key}}"
            value='{{ content[key] }}'
            class='{% if fields.class is defined %}{{ fields.class }}{% endif %}'>
        {% endif %}
        
        {% if fields.type == "slug" %}
        <label class='permalink'>
        Permalink: <tt>/{{contenttype.singular_slug}}/<input type="text" name="{{key}}"  id="{{key}}"
            value='{{ content[key] }}'
            class='editslug'></tt>
        </label>
            
<script type="text/javascript"> 
    $("#title").slug({ slug:'editslug', hide: true });
</script>
        {% endif %}
    
    
        {% if fields.type == "image" %}
        <div class="image-right">
            <div class='imageholder' id="thumbnail-{{key}}">
                {% if content[key]!="" %}
                <img src="/thumbs/120x120c/{{ content[key] }}" width="120" height="120">
                {% endif %}
            </div>
        </div>
        <div class="image-container" id="container-{{key}}">

            <label><b>{{ key|ucfirst}}</b></label>
            
            <input type="text" name="{{key}}" id="field-{{key}}"
                value='{{ content[key] }}'
                class='{% if fields.class is defined %}{{ fields.class }}{% endif %} imageinput'>

<!-- The fileinput-button span is used to style the file input field as button -->
                <span class="btn btn-info fileinput-button">
                    <i class="icon-upload icon-white"></i>
                    <span>Upload Image</span>
                    <input id="fileupload-{{key}}" type="file" name="files[]" data-url="/app/classes/upload/" multiple>
                </span>
                <div class="progress progress-striped active" id="progress-{{key}}" style="width: 50%; display: none;">
                    <div class="bar" style="width: 0%;"></div>
                </div>
                
<link rel="stylesheet" href="/app/view/lib/upload/jquery.fileupload-ui.css">
<script src="/app/view/lib/upload/jquery.ui.widget.js"></script>
<script src="/app/view/lib/upload/jquery.iframe-transport.js"></script>
<script src="/app/view/lib/upload/jquery.fileupload.js"></script>
<script>
$(function () {
    $('#fileupload-{{key}}').fileupload({
        dataType: 'json',
        dropZone: $("#container-{{key}}"),
        done: function (e, data) {
            $.each(data.result, function (index, file) {
                $('#field-{{key}}').val(file.name);
                $('#thumbnail-{{key}}').html("<img src='/thumbs/120x120c/"+encodeURI(file.name)+"' width='120' height='120'>");
                $('#progress-{{key}} div.bar').css('width', "100%");
                window.setTimeout(function(){ $('#progress-{{key}}').fadeOut('slow'); }, 1000);
            });
        }
    });
    

    $('#fileupload-{{key}}').bind('fileuploadprogress', function (e, data) {
        // Log the current bitrate for this upload:
        
        var progress = Math.round(100 * data._bitrateTimer.loaded / data.files[0].size)
        
        $('#progress-{{key}}').show();
        $('#progress-{{key}} div.bar').css('width', progress+"%");
    });
      
    
});
</script>
<style>



</style>


        </div>
        {% endif %}
                
    
        {% if fields.type == "html" %}
        <label><b>{{ key|ucfirst}}</b></label>
        <textarea name="{{key}}" class='{% if fields.class is defined %}{{ fields.class }}{% endif %} redactor'
            style='{% if fields.height is defined %}height: {{ fields.height }} !important;{% endif %}'>
            {% if content[key] is defined %}{{ content[key] }}{% endif %}
        </textarea>
        {% endif %}
                
    
    {% endfor %}
        
        <label><span class='left'>Id:</span>
        <input type='text' readonly=readonly name='id' value='{{ content.id }}' class="narrow">
        </label>
        
{'fraction_non_alphanumeric': 0.20410690331235168, 'fraction_numerical': 0.00877102466205758, 'mean_word_length': 2.0420590081607033, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 127, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5292080', 'n_tokens_mistral': 3008, 'n_tokens_neox': 2778, 'n_words': 561}