Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F119640124
websubmit_add.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
Sat, Jun 28, 05:02
Size
14 KB
Mime Type
text/html
Expires
Mon, Jun 30, 05:02 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27052174
Attached To
R3600 invenio-infoscience
websubmit_add.html
View Options
{% extends "page.html" %}
{% block header %}
{% js 'js/jquery-ui.min.js' %}
{% css 'img/jquery-ui.css' %}
{{ super() }}
{% 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:550px;
/* 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>
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', {
name: this.name,
attribute: $('input[name="'+this.name+'"]').val()
}, function(data) {
if (data.error == 1) {
errorMsg = data.errorMessage;
$('#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');
}
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', {
name: this.name,
attribute: $('textarea[name="'+this.name+'"]').val()
}, function(data) {
if (data.error == "1"){
errorMsg = data.errorMessage;
$('#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() {
$("#date").datepicker();
});
$(function() {
$('select').change( function() {
name = this.name;
$.getJSON($SCRIPT_ROOT + '_errorCheck', {
name: this.name,
attribute: $('select[name="'+this.name+'"]').val()[0]
}, function(data) {
if (data.error == "1"){
errorMsg = data.errorMessage;
$('#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() {
$("#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?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', {
name: 'journal',
attribute: selected
}, function(data) {});
$.getJSON($SCRIPT_ROOT + '_ISSN', {
title: selected
}, function(data) {
$("input#issn").val(data.issn);
cond = "<strong>Policies</strong>";
if (jQuery.isEmptyObject(data.conditions))
cond += "<strong> not found</strong>";
else {
cond = "";
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?type=publisher",
minLength: 5,
select: function(event, ui) {
var selected = ui.item.value;
$.getJSON($SCRIPT_ROOT + '_errorCheck', {
name: 'publisher',
attribute: selected
}, function(data) {});
}
});
});
$(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>Submit an Article</h3>
<div style="width 550px;">
<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="{{ draft.id }}">
{% if draft.doctitle is none %}
Untitled
{% else %}
{{ draft.doctitle }}
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
<a href="/submit/websubmit_add/0"><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="/submit/websubmit_delete/{{ draftid }}"><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>
<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__() %}
{% if "journal" in field.__html__() %}
<i class="icon-book" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "publisher" in field.__html__() %}
<i class="icon-certificate" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "issn" in field.__html__() %}
<i class="icon-barcode" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "author" in field.__html__() %}
<i class="icon-user" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "abstract" in field.__html__() %}
<i class="icon-pencil" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "mail" in field.__html__() %}
<i class="icon-envelope" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "pages" in field.__html__() %}
<i class="icon-th" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "date" in field.__html__() %}
<i class="icon-calendar" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "title" in field.__html__() %}
<i class="icon-book" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "keywords" in field.__html__() %}
<i class="icon-tags" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "notes" in field.__html__() %}
<i class="icon-list" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "file" in field.__html__() %}
<i class="icon-file" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% elif "language" in field.__html__() %}
<i class="icon-flag" style="float:left; margin-right:5px; margin-top:2px;"></i>
{% endif %}
{{ field.label }}</td>
<td>
{{ field }}
<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>
{% else %}
<td style="float:right;" ></br><input id="submitButton" class="btn btn-primary btn-large"
name="submitButton" type="submitButton" value="Submit Article"></td>
{% endif %}
<td style="height:20px; width:20px;"><div id="wait-{{ field.name }}" style="height:20px; width:20px; margin-bottom:20px; display:none;"><img src="{{ url_for('static', filename='img/loading.gif') }}"/></div></td>
</tr>
<tr><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 %}
{% endfor %}
<tr style="display:none;">
<td width="50%">
<input id="keywords2" name="keywords2" type="text" value=""></td>
</tr>
</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