<commit_before>{% extends "ndf/base.html" %}
{% load i18n %}
{% load ndf_tags %}
{% block title %} Upload Document {% endblock %}

{% block head %}
<!-- Dropzonejs : Enable dropping of files with thumbnails and progress bar http://www.dropzonejs.com/ MIT LICENSE-->

<!--
<script src="/static/ndf/dropzonejs/dropzone.js"></script>
<link rel="stylesheet" href="/static/ndf/dropzonejs/css/dropzone.css">
-->
{% endblock %}

{% block meta_content %} 
<h3>{% trans "Uploading" %}</h3>
<p class="text-justify">{% trans "You can upload <b>files</b> of any format to your group library." %}</p>
{% endblock %} 


{% block related_content %}
  {% if user.is_authenticated %}
  {% user_access_policy groupid request.user as user_access %}
  {% if user_access == "allow" %}
  <br/>
  <div class="create card">
    <div class="file">
      <br/>
      <a class="button medium" href="{% url 'uploadDoc' group_name_tag %}?next={{request.path}}">
      	<span class="fi-upload">&nbsp;&nbsp;{% trans "New File" %}</span>
      </a>
    </div>
  </div>
  {% endif %}
  {% endif %}
{% endblock %}


{% block body_content %} 
{% get_group_name groupid as group_name_tag %}
{% if user.is_authenticated %}

<!--
<form class="dropzone" id ="docPost" enctype="multipart/form-data" method="post" action="{% url 'submitDoc' group_id %}">{% csrf_token %}
  <div class="fallback">
    <input type="file" name="doc[]"  id="docFile" multiple/>
    <input type="hidden" name="user" value="{{user.id}}">
    <input type="hidden" name="page_url" value="{{page_url}}">
  </div>
</form>
-->
<form class="dropzone" id ="docPost" enctype="multipart/form-data" method="post" action="{% url 'submitDoc' group_name_tag %}">{% csrf_token %}
	<div class ="row">
		<fieldset small-6 large-12 columns>
			<legend>{% trans "Upload File" %}</legend>
			<div class="fallback">
				<label>{% trans "Choose File" %}</label>
				<input type="file" name="doc[]"  id="docFile" multiple/>
				<label>{% trans "Title of File" %}</label>
				<input type="text" name="docTitle" id ="docTitle"  placeholder="Enter Title of File">
			</div>
		</fieldset>
		<fieldset>
			<legend>{% trans "Select Language" %}</legend>
			<div class="large-4 columns">
			  <select name="lan">
					      {% get_language_info_list for LANGUAGES as languages %}
					      {% for language in languages %}
					      <option value="{{ language.code }}">{{ language.name_local }} ({{ language.code }})
					      </option>
					      {% endfor %}
					    </select></div>
		</fieldset>

		<fieldset>
			<legend>{% trans "Add Description" %}</legend>
			{% include "ndf/add_editor.html" with var_name="content_org" var_placeholder="Please enter question" %}
		</fieldset>
		<fieldset>
			<legend>{% trans "Add Tag" %}</legend>
			<input id="tags_id" name="tags" type="text" value="{{node.tags|join:', '|default_if_none:""}}" placeholder="Example: abc, XYZ" \
			/>
		</fieldset>
		<fieldset class="medium-4 columns">
			<legend>Privacy</legend>
			<div class="row">
					<div class="medium-6 columns">
						{% if node.created_by == request.user.pk %}	
			<span data-tooltip class="has-tip" title="Public pages can be viewed and edited by any group member, while private pages are only for you"></span>
						<div class="privacy-mode switch round">
						
							<input id="PUBLIC" name="login-mode" value="PUBLIC" type="radio" checked>
							<label for="PUBLIC" onclick="">{% trans "Public" %} <i class="fi-torsos-all"></i></label>

							<input id="PRIVATE" name="login-mode" value="PRIVATE" type="radio">
							<label for="PRIVATE" onclick="">{% trans "Private" %} <i class="fi-lock"></i></label>
						
							<span></span>
						</div>
						{% else %}
						{% if not node %}
							<span data-tooltip class="has-tip" title="Public pages can be viewed and edited by any group member, while private pages are only for you"></span>
						<div class="privacy-mode switch round">
						
							<input id="PUBLIC" name="login-mode" value="PUBLIC" type="radio" checked>
							<label for="PUBLIC" onclick="">{% trans "Public" %} <i class="fi-torsos-all"></i></label>

							<input id="PRIVATE" name="login-mode" value="PRIVATE" type="radio">
							<label for="PRIVATE" onclick="">{% trans "Private" %} <i class="fi-lock"></i></label>
						
							<span></span>
						</div>
						{% endif %}
						{% endif %}
					</div>
				</div>
		</fieldset>
		<input type="hidden" name="user" value="{{user.id}}">
		<input type="hidden" name="page_url" value="{{page_url}}">
		<input type="submit" id="submitpostid" value="Submit" class="button small-10  small-push-1 column">
		<p id="message" style="display:none"> {% trans "Depending on the size of file/s and your Internet speed, upload process may take time. Please do not close this window." %}
			<br/>
			{% trans "Please upload videos in webm format. If you upload videos of other formats, it will take longer to publish them." %} </p>
		</form>



		{% else %}
		<p><em>{% trans "You are not an authorised user. Please login to upload files." %} </em></p>
		{% endif %}
		{% endblock %}


		{% block script %}

		$("#docFile").change(function() {
        var max_size =100000
        var fsize=this.files[0].size
        fsize=fsize/1024
        if(fsize> max_size){
          {% if user_access%}
          	$('#docFile').val(this.value);
          {% else %}
          	alert("Sorry. Max File Size Limit Exceeded");
          	$(this).val("")
          	$('#docFile').val(this.value);
          {% endif %}
          }
        else{
		$('#docFile').val(this.value);}        
      	});
		
		$(document).on('submit',"form",function(){
		if($("#docFile").val() != "")
		{	

		$("#message").show();
		$("#submitpostid").hide();
		$("#submitpostid").submit();

		}
		else
		{
		alert("select a file");
		return false;
		}


});
{% endblock %}

<commit_msg>Upload file size limit<commit_after>{% extends "ndf/base.html" %}
{% load i18n %}
{% load ndf_tags %}
{% block title %} Upload Document {% endblock %}

{% block head %}
<!-- Dropzonejs : Enable dropping of files with thumbnails and progress bar http://www.dropzonejs.com/ MIT LICENSE-->

<!--
<script src="/static/ndf/dropzonejs/dropzone.js"></script>
<link rel="stylesheet" href="/static/ndf/dropzonejs/css/dropzone.css">
-->
{% endblock %}

{% block meta_content %} 
<h3>{% trans "Uploading" %}</h3>
<p class="text-justify">{% trans "You can upload <b>files</b> of any format to your group library." %}</p>
{% endblock %} 


{% block related_content %}
  {% if user.is_authenticated %}
  {% user_access_policy groupid request.user as user_access %}
  {% if user_access == "allow" %}
  <br/>
  <div class="create card">
    <div class="file">
      <br/>
      <a class="button medium" href="{% url 'uploadDoc' group_name_tag %}?next={{request.path}}">
      	<span class="fi-upload">&nbsp;&nbsp;{% trans "New File" %}</span>
      </a>
    </div>
  </div>
  {% endif %}
  {% endif %}
{% endblock %}


{% block body_content %} 
{% get_group_name groupid as group_name_tag %}
{% if user.is_authenticated %}

<!--
<form class="dropzone" id ="docPost" enctype="multipart/form-data" method="post" action="{% url 'submitDoc' group_id %}">{% csrf_token %}
  <div class="fallback">
    <input type="file" name="doc[]"  id="docFile" multiple/>
    <input type="hidden" name="user" value="{{user.id}}">
    <input type="hidden" name="page_url" value="{{page_url}}">
  </div>
</form>
-->
<form class="dropzone" id ="docPost" enctype="multipart/form-data" method="post" action="{% url 'submitDoc' group_name_tag %}">{% csrf_token %}
	<div class ="row">
		<fieldset small-6 large-12 columns>
			<legend>{% trans "Upload File" %}</legend>
			<div class="fallback">
				<label>{% trans "Choose File" %}</label>
				<input type="file" name="doc[]"  id="docFile" multiple/>
				<label>{% trans "Title of File" %}</label>
				<input type="text" name="docTitle" id ="docTitle"  placeholder="Enter Title of File">
			</div>
		</fieldset>
		<fieldset>
			<legend>{% trans "Select Language" %}</legend>
			<div class="large-4 columns">
			  <select name="lan">
					      {% get_language_info_list for LANGUAGES as languages %}
					      {% for language in languages %}
					      <option value="{{ language.code }}">{{ language.name_local }} ({{ language.code }})
					      </option>
					      {% endfor %}
					    </select></div>
		</fieldset>

		<fieldset>
			<legend>{% trans "Add Description" %}</legend>
			{% include "ndf/add_editor.html" with var_name="content_org" var_placeholder="Please enter question" %}
		</fieldset>
		<fieldset>
			<legend>{% trans "Add Tag" %}</legend>
			<input id="tags_id" name="tags" type="text" value="{{node.tags|join:', '|default_if_none:""}}" placeholder="Example: abc, XYZ" \
			/>
		</fieldset>
		<fieldset class="medium-4 columns">
			<legend>Privacy</legend>
			<div class="row">
					<div class="medium-6 columns">
						{% if node.created_by == request.user.pk %}	
			<span data-tooltip class="has-tip" title="Public pages can be viewed and edited by any group member, while private pages are only for you"></span>
						<div class="privacy-mode switch round">
						
							<input id="PUBLIC" name="login-mode" value="PUBLIC" type="radio" checked>
							<label for="PUBLIC" onclick="">{% trans "Public" %} <i class="fi-torsos-all"></i></label>

							<input id="PRIVATE" name="login-mode" value="PRIVATE" type="radio">
							<label for="PRIVATE" onclick="">{% trans "Private" %} <i class="fi-lock"></i></label>
						
							<span></span>
						</div>
						{% else %}
						{% if not node %}
							<span data-tooltip class="has-tip" title="Public pages can be viewed and edited by any group member, while private pages are only for you"></span>
						<div class="privacy-mode switch round">
						
							<input id="PUBLIC" name="login-mode" value="PUBLIC" type="radio" checked>
							<label for="PUBLIC" onclick="">{% trans "Public" %} <i class="fi-torsos-all"></i></label>

							<input id="PRIVATE" name="login-mode" value="PRIVATE" type="radio">
							<label for="PRIVATE" onclick="">{% trans "Private" %} <i class="fi-lock"></i></label>
						
							<span></span>
						</div>
						{% endif %}
						{% endif %}
					</div>
				</div>
		</fieldset>
		<input type="hidden" name="user" value="{{user.id}}">
		<input type="hidden" name="page_url" value="{{page_url}}">
		<input type="submit" id="submitpostid" value="Submit" class="button small-10  small-push-1 column">
		<p id="message" style="display:none"> {% trans "Depending on the size of file/s and your Internet speed, upload process may take time. Please do not close this window." %}
			<br/>
			{% trans "Please upload videos in webm format. If you upload videos of other formats, it will take longer to publish them." %} </p>
		</form>



		{% else %}
		<p><em>{% trans "You are not an authorised user. Please login to upload files." %} </em></p>
		{% endif %}
		{% endblock %}


		{% block script %}

		$("#docFile").change(function() {
        var max_size =100000
        var fsize=this.files[0].size
        fsize=fsize/1024
        {% check_is_gstaff groupid request.user as gstaff_access %}
        if(fsize> max_size){
          {% if gstaff_access%}
          	$('#docFile').val(this.value);
          {% else %}
          	alert("Sorry. Max File Size Limit Exceeded");
          	$(this).val("")
          	$('#docFile').val(this.value);
          {% endif %}
          }
        else{
		$('#docFile').val(this.value);}        
      	});
		
		$(document).on('submit',"form",function(){
		if($("#docFile").val() != "")
		{	

		$("#message").show();
		$("#submitpostid").hide();
		$("#submitpostid").submit();

		}
		else
		{
		alert("select a file");
		return false;
		}


});
{% endblock %}


{'fraction_non_alphanumeric': 0.19618366129994036, 'fraction_numerical': 0.004088934321492461, 'mean_word_length': 3.2972181551976574, 'pattern_counts': {'":': 0, '<': 229, '<?xml version=': 0, '>': 231, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7656732', 'n_tokens_mistral': 4581, 'n_tokens_neox': 3779, 'n_words': 980}