Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112704324
webdeposit.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, May 12, 10:38
Size
15 KB
Mime Type
text/html
Expires
Wed, May 14, 10:38 (2 d)
Engine
blob
Format
Raw Data
Handle
26109057
Attached To
R3600 invenio-infoscience
webdeposit.html
View Options
{% extends "page.html" %}
{% block header %}
{{ super() }}
{% js 'js/jquery-ui.min.js' %}
{% js 'js/plupload.full.js' %}
{% js 'js/jquery.plupload.queue.js' %}
{% css 'css/jquery.plupload.queue.css' %}
{% css 'img/jquery-ui.css' %}
{% endblock %}
{% block body %}
<style>
#link{
float: left;
position:absolute;
font-size: 15px;
/*color:#272727;*/
color:rgb(59, 89, 152);
font-weight:bold;
}
#link:hover {
text-decoration:underline;
}
.l{
size: 10px;
}
div#editable{
border: none;
z-index:-1;
display:none;
}
div#conditions{
border: none;
z-index:-1;
display:none;
}
#container {
width:600px;
/* height: 690px;
padding-left: 30px;
margin-left: auto ;
margin-right: auto ;
padding: 20px;*/
clear:both;
margin-top:50px;
}
</style>
<script type=text/javascript>
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
</script>
<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
<!-- Plupload js -->
<script type="text/javascript">
// Convert divs to queue widgets when the DOM is ready
$(function() {
// Setup html5 version
$(".pluploader").pluploadQueue({
// General settings
runtimes : 'html5',
url : $SCRIPT_ROOT + '_upload',
max_file_size : '460mb',
chunk_size : '1mb',
unique_names : true,
// Resize images on clientside if we can
resize : {width : 320, height : 240, quality : 90},
// Specify what files to browse for
filters : [
{title : "Image files", extensions : "jpg,gif,png,tif"},
{title : "Compressed files", extensions : "zip,tar,gz"},
{title : "PDF files", extensions : "pdf"},
]
});
});
var ajaxRequest = $.ajax({});
$(function() {
/*$('#submitButton').attr('disabled', 'disabled');
$('#submitButton').removeAttr('disabled');
*/
});
/* Error checking */
var errors = 0
var oldJournal;
$(function() {
$('input').change( function() {
name = this.name;
$.getJSON($SCRIPT_ROOT + '_errorCheck/{{ draft_id }}', {
name: this.name,
attribute: $('input[name="'+this.name+'"]').val()
}, function(data) {
if (data.error == 1) {
errorMsg = data.error_message;
$('#submitButton').attr('disabled', 'disabled');
$('#error-'+name).html(errorMsg);
$('#error-'+name).show('slow');
errors++;
}
else {
$('#error-'+name).hide('slow');
if (errors > 0)
errors--;
emptyForm = checkEmptyFields();
if (emptyForm[0] == 0){
$('#empty-fields-error').hide('slow');
$('#submitButton').removeAttr('disabled');
}
else {
$('#empty-fields-error').html(emptyForm[1]);
}
if ( (errors == 0) && ($('#empty-fields-error').css('display') == "none") )
$('#submitButton').removeAttr('disabled');
}
});
return false;
});
});
$(function() {
$('textarea').change( function() {
name = this.name;
$.getJSON($SCRIPT_ROOT + '_errorCheck/{{ draft_id }}', {
name: this.name,
attribute: $('textarea[name="'+this.name+'"]').val()
}, function(data) {
if (data.error == "1"){
errorMsg = data.error_message;
$('#submitButton').attr('disabled', 'disabled');
$('#error-'+name).html(errorMsg);
$('#error-'+name).show('slow');
}
else {
$('#error-'+name).hide('slow');
if (errors > 0)
errors--;
emptyForm = checkEmptyFields();
if (emptyForm[0] == 0){
$('#empty-fields-error').hide('slow');
}
else {
$('#empty-fields-error').html(emptyForm[1]);
/*$('#empty-fields-error').show('slow');*/
}
if ( (errors == 0) && ($('#empty-fields-error').css('display') == "none") )
$('#submitButton').removeAttr('disabled');
}
});
return false;
});
});
$(function() {
$('select').change( function() {
name = this.name;
$.getJSON($SCRIPT_ROOT + '_errorCheck/{{ draft_id }}', {
name: this.name,
attribute: $('select[name="'+this.name+'"]').val()[0]
}, function(data) {
if (data.error == "1"){
errorMsg = data.error_message;
$('#submitButton').attr('disabled', 'disabled');
$('#error-'+name).html(errorMsg);
$('#error-'+name).show('slow');
}
else {
$('#error-'+name).hide('slow');
if (errors > 0)
errors--;
emptyForm = checkEmptyFields();
if (emptyForm[0] == 0){
$('#empty-fields-error').hide('slow');
}
else {
$('#empty-fields-error').html(emptyForm[1]);
/*$('#empty-fields-error').show('slow');*/
}
if ( (errors == 0) && ($('#empty-fields-error').css('display') == "none") )
$('#submitButton').removeAttr('disabled');
}
});
return false;
});
});
$(document).ready(function() {
$(function() {
$(".datepicker").datepicker();
$("#submitButton").click(function(e ) {
e.preventDefault();
emptyForm = checkEmptyFields();
if (emptyForm[0] == 0){
$('#submitButton').removeAttr('disabled');
$('#empty-fields-error').hide('slow');
/*$('#submitForm').trigger('action');*/
document.getElementById("submitForm").submit();
}
else {
$('#submitButton').attr('disabled', 'disabled');
$('#empty-fields-error').html("<a class='close' data-dismiss='alert' href='#'>×</a>" + emptyForm[1]);
$('#empty-fields-error').show('slow');
}
});
});
});
function checkEmptyFields(){
var emptyFields = "These fields are empty!</br>";
var empty = 0;
$(":text, :file, :checkbox, select, textarea").each(function() {
if( (($(this).val() === "") || ($(this).val() === null)) && (this.name != "keywords") ) {
if (this.name == "keywords2")
emptyFields += "- Keywords</br>";
else
emptyFields += "- "+$("label[for='"+this.name+"']").html() + "</br>";
empty = 1;
}
});
return [empty, emptyFields];
}
/* Sherpa Romeo auto completion "_autocomplete?type=journal" */
function type(o){
return !!o && Object.prototype.toString.call(o).match(/(\w+)\]/)[1];
}
$(function() {
$("input#journal").autocomplete({
source: "_autocomplete/{{ draft_id }}?type=journal",
open: function(event, ui) {
$('div#wait-journal').hide('slow');
},
minLength: 5,
select: function(event, ui) {
$('div#wait-journal').hide();
$('#conditions').hide();
var selected = ui.item.value;
$('#conditions').html('<img src="{{ url_for('static', filename='img/loading.gif') }}"/>');
$('#conditions').show('slow');
$.getJSON($SCRIPT_ROOT + '_errorCheck/{{ draft_id }}', {
name: 'journal',
attribute: selected
}, function(data) {});
$.getJSON($SCRIPT_ROOT + '_ISSN/{{ draft_id }}', {
title: selected
}, function(data) {
$("input#issn").val(data.issn);
cond = "<strong>Policies</strong>";
if (jQuery.isEmptyObject(data.conditions))
cond += "<strong> not found</strong>";
else {
if( type(data.conditions) === 'String' ) {
cond += data.conditions;
}
else {
cond += "<br><ul>";
$.each(data.conditions, function(index, value) {
cond += "<li>"+value+"</li>";
});
cond += "</ul>";
}
}
$('#conditions').html(cond);
$('#conditions').show('slow');
});
},
});
$("input#journal").keyup( function() {
if ($("input#journal").val().length >= 5){
var val = $("input#journal").val();
if (val !== oldJournal) {
oldJournal = val;
if ($("input#journal").val().length >= 5)
$('div#wait-journal').show();
}
else
$('div#wait-journal').hide();
}
});
/*
(function () {
var oldVal;
$('input#journal').bind('DOMAttrModified textInput input change keypress paste focus', function () {
var val = this.value;
if (val !== oldVal) {
oldVal = val;
if ($("input#journal").val().length >= 5)
$('div#wait-journal').show();
}
else
$('div#wait-journal').hide();
});
}());
*/
$("input#journal").change( function() {
$('#issn').val('');
$('#conditions').hide('slow');
});
$("input#issn").change( function() {
$('#conditions').hide('slow');
});
$("input#publisher").autocomplete({
source: "_autocomplete/{{ draft_id }}?type=publisher",
minLength: 5,
select: function(event, ui) {
var selected = ui.item.value;
$.getJSON($SCRIPT_ROOT + '_errorCheck/{{ draft_id }}', {
name: 'publisher',
attribute: selected
}, function(data) {});
}
});
{% for field in form %}
{% if field.autocomplete %}
$("input#{{ field.name }}").autocomplete({
source: "_autocomplete/{{ draft_id }}?type={{ field.name }}",
minLength: 5,
select: function(event, ui) {
var selected = ui.item.value;
$.getJSON($SCRIPT_ROOT + '_errorCheck/{{ draft_id }}', {
name: '{{ field.name }}',
attribute: selected
}, function(data) {});
}
});
{% endif %}
{% endfor %}
});
$(function() {
$("input#publisher").change(function(){
});
});
$(function() {
$('#keywords').keyup( function() {
keywords = $('#keywords').val();
if (keywords.indexOf(" ") == -1)
return;
keywordsArr = keywords.split(" ");
txt = "";
$.each(keywordsArr, function(index, value) {
if (value != "")
txt += "<div class='label label-info' id='"+value+"' style='margin-right:5px;margin-bottom:5px; display:inline-block;padding-right:2px;'><i class='icon-tag icon-white'></i><span style='margin-left:1px;margin-right:1px;'>"+ value +"</span><span id='delete_tag'><i class='icon-remove-sign icon-white' style='margin-left:5px;cursor:pointer;'></i></span></div>"
});
newtags = $('#editable').html() + txt;
$('#editable').html(newtags);
$('#keywords').val('');
$('#editable').show();
tempkeywords = $('#keywords2').val();
$('#keywords2').val(tempkeywords+" "+keywords);
});
});
$('#editable').on("click", "#delete_tag", function(event) {
alert(this);
alert("click!!!!");
});
</script>
<h3>{{ form._title }}</h3>
<div style="width 600px;">
{% if form._drafting %}
<div class="btn-group" style="float:left;">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
Saved Drafts
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% for draft in drafts %}
<li> <a href="/webdeposit/{{ draft.dep_type }}/{{ draft.draft_id }}">
{% if draft_id == draft.draft_id %}
<strong>
{% endif %}
{% if draft.title is none %}
Untitled
{% else %}
{{ draft.title }}
{% endif %}
<small><span class="muted">{{ draft.timestamp }}</small>
{% if draft_id == draft.draft_id %}
</strong>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
<a href="/webdeposit/{{ dep_type }}/new/">
<button class="btn btn-small btn-primary" type="button" style="float:left; margin-left:220px;">
<i class="icon-edit"></i> New Draft
</button>
</a>
<a href="/webdeposit/{{ dep_type }}/webdeposit_delete/{{ draft_id }}">
<button class="btn btn-small btn-danger" type="button" style="float:left; margin-left:10px;">
<i class="icon-remove"></i> Delete Draft
</button>
</a>
</div>
{% endif %}
<div id="container">
<form enctype="multipart/form-data" name="submitForm" id="submitForm" action="submit" method="post">
<table>
{% for field in form %}
<tr>
<td width="50%">
{% if "submit" not in field.__html__() %}
<div style="float:left; margin-right:5px; margin-top:2px;" >
{{ field._icon_html|safe }}
</div>
{{ field.label }}
{% endif %}
</td>
<td>
{{ field(class_=field.short_name) }}
<div class="livesearch" id="{{ field.name }}-search">
</div>
{% if ("keywords" in field.__html__()) %}
</td>
<tr>
<td></td>
<td colspan="2">
<div id="editable"></div>
{% endif %}
</td>
<td style="height:20px; width:20px;">
<div id="wait-{{ field.name }}"
style="position: absolute; height: 20px; width: 20px; margin-top: -17px; display:none;">
<img src="{{ url_for('static', filename='img/loading.gif') }}"/>
</div>
</td>
</tr>
<tr style="display:none;">
<td colspan="2">
<div class="alert alert-error" id="error-{{ field.name }}" style="font-size:12px; display:none;">error message</div>
</td>
</tr>
{% if ("issn" in field.__html__()) %}
<tr>
<td colspan="3">
{% if conditions is defined %}
<div class="alert alert-info" id="conditions" style="display:block;">
<strong>Policies</strong>
<ul>
{% for condition in conditions %}
<li>{{ condition }}</li>
{% endfor %}
</ul>
{% else %}
<div class="alert alert-info" id="conditions">
{% endif %}
</div>
</td>
</tr>
{% endif %}
{% if ("keywords" in field.__html__()) %}
<tr style="display:none;">
<td width="50%">
<input id="keywords2" name="keywords2" type="text" value="">
</td>
</tr>
{% endif %}
{% endfor %}
</table>
</form>
<div class="alert alert-error" id="empty-fields-error" style="font-size:12px; display:none;"></div>
</div>
{% endblock %}
Event Timeline
Log In to Comment