Commit f6fbe2e1 authored by Ozzieisaacs's avatar Ozzieisaacs

Fix #766

Update pdf upload
Translation of uploadprogress dialog
parent 17b73339
......@@ -101,7 +101,7 @@ def default_meta(tmp_file_path, original_file_name, original_file_extension):
def pdf_meta(tmp_file_path, original_file_name, original_file_extension):
if use_pdf_meta:
pdf = PdfFileReader(open(tmp_file_path, 'rb'))
pdf = PdfFileReader(open(tmp_file_path, 'rb'), strict=False)
doc_info = pdf.getDocumentInfo()
else:
doc_info = None
......
......@@ -230,7 +230,10 @@ def get_valid_filename(value, replace_whitespace=True):
value = value[:128]
if not value:
raise ValueError("Filename cannot be empty")
return value
if sys.version_info.major == 3:
return value
else:
return value.decode('utf-8')
def get_sorted_author(value):
......
......@@ -490,19 +490,19 @@ if ( $( 'body.shelf' ).length > 0 ) {
.addClass( 'order-shelf-btn' );
$( '.delete-shelf-btn' ).attr({
'data-toggle-two': 'tooltip',
'title': 'Delete Shelf',
'title': $( '.delete-shelf-btn' ).text(), // 'Delete Shelf'
'data-placement': 'bottom' })
.addClass('delete-btn-tooltip');
$( '.edit-shelf-btn' ).attr({
'data-toggle-two': 'tooltip',
'title': 'Edit Shelf',
'title': $( '.edit-shelf-btn' ).text(), // 'Edit Shelf'
'data-placement': 'bottom' })
.addClass('edit-btn-tooltip');
$( '.order-shelf-btn' ).attr({
'data-toggle-two': 'tooltip',
'title': 'Reorder Shelf',
'title': $( '.order-shelf-btn' ).text(), //'Reorder Shelf'
'data-placement': 'bottom' })
.addClass('order-btn-tooltip');
}
......@@ -510,32 +510,32 @@ if ( $( 'body.shelf' ).length > 0 ) {
// Rest of Tooltips
$( '.home-btn > a' ).attr({
'data-toggle': 'tooltip',
'title': 'Home',
'title': $(document.body).attr('data-text'), // Home
'data-placement': 'bottom' })
.addClass('home-btn-tooltip');
$( '.plexBack > a' ).attr({
'data-toggle': 'tooltip',
'title': 'Back',
'title': $(document.body).attr('data-textback'), // Back
'data-placement': 'bottom' })
.addClass('back-btn-tooltip');
$( '#top_tasks' ).attr({
'data-toggle': 'tooltip',
'title': $( '#top_tasks' ).text(), //'Tasks',
'title': $( '#top_tasks' ).text(), // 'Tasks'
'data-placement': 'bottom',
'data-viewport': '#main-nav' })
.addClass('tasks-btn-tooltip');
$( '#top_admin' ).attr({
'data-toggle': 'tooltip',
'title': 'Settings',
'title': $( '#top_admin' ).attr('data-text'), // Settings
'data-placement': 'bottom',
'data-viewport': '#main-nav' })
.addClass('admin-btn-tooltip');
$( '.profileDrop' ).attr({
'title': 'Account',
'title': $( '#top_user' ).attr('data-text'), //Account
'data-placement': 'bottom',
'data-toggle-two': 'tooltip',
'data-viewport': '#main-nav' })
......@@ -543,78 +543,78 @@ $( '.profileDrop' ).attr({
$( '#btn-upload' ).attr({
'data-toggle': 'tooltip',
'title': $( '#btn-upload' ).parent().text() , // 'Upload',
'title': $( '#btn-upload' ).parent().text() , // 'Upload'
'data-placement': 'bottom',
'data-viewport': '#main-nav' })
.addClass('upload-btn-tooltip');
$( '#add-to-shelf' ).attr({
'data-toggle-two': 'tooltip',
'title': $( '#add-to-shelf' ).text() , // 'Add to Shelf',
'title': $( '#add-to-shelf' ).text() , // 'Add to Shelf'
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('addtoshelf-btn-tooltip');
$( '#have_read_cb' ).attr({
'data-toggle': 'tooltip',
'title': 'Mark As Read',
'title': $( '#have_read_cb').attr('data-unchecked'),
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('readunread-btn-tooltip');
$( '#have_read_cb:checked' ).attr({
'data-toggle': 'tooltip',
'title': 'Mark As Unread',
'title': $( '#have_read_cb').attr('data-checked'),
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('readunread-btn-tooltip');
$( 'button#delete' ).attr({
'data-toggle-two': 'tooltip',
'title': $( 'button#delete' ).text(), //'Delete',
'title': $( 'button#delete' ).text(), //'Delete'
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('delete-book-btn-tooltip');
$( '#have_read_cb' ).click(function() {
if ( $( '#have_read_cb:checked' ).length > 0 ) {
$( this ).attr('data-original-title', 'Mark as Unread');
$( this ).attr('data-original-title', $('#have_read_cb').attr('data-checked'));
} else {
$( this).attr('data-original-title', 'Mark as Read');
$( this).attr('data-original-title', $('#have_read_cb').attr('data-unchecked'));
}
});
$( '.btn-group[aria-label="Edit/Delete book"] a' ).attr({
'data-toggle': 'tooltip',
'title': $( '#edit_book' ).text(), // 'Edit',
'title': $( '#edit_book' ).text(), // 'Edit'
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('edit-btn-tooltip');
$( '#sendbtn' ).attr({
'data-toggle': 'tooltip',
'title': 'Send to Kindle',
'title': $( '#sendbtn' ).attr('data-text'),
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('send-btn-tooltip');
$( '#sendbtn2' ).attr({
'data-toggle-two': 'tooltip',
'title': 'Send to Kindle',
'title': $( '#sendbtn2' ).text(), // 'Send to Kindle',
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' })
.addClass('send-btn-tooltip');
$( '#read-in-browser' ).attr({
'data-toggle-two': 'tooltip',
'title': 'Read',
'title': $( '#read-in-browser' ).text(),
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar'})
.addClass('send-btn-tooltip');
$( '#btnGroupDrop1' ).attr({
'data-toggle-two': 'tooltip',
'title': 'Download',
'title': $( '#btnGroupDrop1' ).text(),
'data-placement': 'bottom',
'data-viewport': '.btn-toolbar' });
......
This diff is collapsed.
......@@ -18,7 +18,7 @@
{% if entry.data|length %}
<div class="btn-group" role="group">
{% if entry.data|length < 2 %}
<button type="button" class="btn btn-primary">
<button id="Download" type="button" class="btn btn-primary">
{{_('Download')}} :
</button>
{% for format in entry.data %}
......@@ -42,7 +42,7 @@
{% endif %}
{% if g.user.kindle_mail and g.user.is_authenticated and kindle_list %}
{% if kindle_list.__len__() == 1 %}
<a href="{{url_for('send_to_kindle', book_id=entry.id, book_format=kindle_list[0]['format'], convert=kindle_list[0]['convert'])}}" id="sendbtn" class="btn btn-primary" role="button"><span class="glyphicon glyphicon-send"></span> {{kindle_list[0]['text']}}</a>
<a href="{{url_for('send_to_kindle', book_id=entry.id, book_format=kindle_list[0]['format'], convert=kindle_list[0]['convert'])}}" id="sendbtn" data-text="{{_('Send to Kindle')}}" class="btn btn-primary" role="button"><span class="glyphicon glyphicon-send"></span> {{kindle_list[0]['text']}}</a>
{% else %}
<div class="btn-group" role="group">
<button id="sendbtn2" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
......@@ -182,7 +182,7 @@
<p>
<form id="have_read_form" action="{{ url_for('toggle_read', book_id=entry.id)}}" method="POST">
<label class="block-label">
<input id="have_read_cb" type="checkbox" {% if have_read %}checked{% endif %} >
<input id="have_read_cb" data-checked="{{_('Mark As Unread')}}" data-unchecked="{{_('Mark As Read')}}" type="checkbox" {% if have_read %}checked{% endif %} >
<span>{{_('Read')}}</span>
</label>
</form>
......
......@@ -25,7 +25,7 @@
{% block header %}{% endblock %}
</head>
<body class="{{ page }}">
<body class="{{ page }}" data-text="{{_('Home')}}" data-textback="{{_('Back')}}">
<!-- Static navbar -->
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container-fluid">
......@@ -69,14 +69,14 @@
{% endif %}
{% endif %}
{% if not g.user.is_anonymous %}
<li><a id="top_tasks" href="{{url_for('get_tasks_status')}}"><span class="glyphicon glyphicon-tasks"></span><span class="hidden-sm"> {{_('Tasks')}}</span></a></li>
<li><a id="top_tasks" href="{{url_for('get_tasks_status')}}"><span class="glyphicon glyphicon-tasks"></span><span class="hidden-sm">{{_('Tasks')}}</span></a></li>
{% endif %}
{% if g.user.role_admin() %}
<li><a id="top_admin" href="{{url_for('admin')}}"><span class="glyphicon glyphicon-dashboard"></span><span class="hidden-sm"> {{_('Admin')}}</span></a></li>
<li><a id="top_admin" data-text="{{_('Settings')}}" href="{{url_for('admin')}}"><span class="glyphicon glyphicon-dashboard"></span><span class="hidden-sm">{{_('Admin')}}</span></a></li>
{% endif %}
<li><a id="top_user" href="{{url_for('profile')}}"><span class="glyphicon glyphicon-user"></span><span class="hidden-sm"> {{g.user.nickname}}</span></a></li>
<li><a id="top_user" data-text="{{_('Account')}}" href="{{url_for('profile')}}"><span class="glyphicon glyphicon-user"></span><span class="hidden-sm">{{g.user.nickname}}</span></a></li>
{% if not g.user.is_anonymous %}
<li><a id="logout" href="{{url_for('logout')}}"><span class="glyphicon glyphicon-log-out"></span><span class="hidden-sm"> {{_('Logout')}}</span></a></li>
<li><a id="logout" href="{{url_for('logout')}}"><span class="glyphicon glyphicon-log-out"></span><span class="hidden-sm">{{_('Logout')}}</span></a></li>
{% endif %}
{% endif %}
{% if g.allow_registration and not g.user.is_authenticated %}
......@@ -250,7 +250,13 @@
{% endif %}
<script type="text/javascript">
$(function() {
$("#form-upload").uploadprogress({redirect_url: '{{ url_for('index')}}'});
$("#form-upload").uploadprogress({
redirect_url: "{{ url_for('index')}}",
uploadedMsg: "{{_('Upload done, processing, please wait...')}}",
modalTitle: "{{_('Uploading...')}}",
modalFooter: "{{_('Close')}}",
modalTitleFailed: "{{_('Error')}}"
});
$("#btn-upload").change(function() {
$("#form-upload").submit();
});
......
This diff is collapsed.
......@@ -2027,7 +2027,7 @@ def advanced_search():
series=series, title=_(u"search"), cc=cc, page="advsearch")
@app.route("/cover/<book_id>")
@app.route("/cover/<int:book_id>")
@login_required_if_no_ano
def get_cover(book_id):
book = db.session.query(db.Books).filter(db.Books.id == book_id).first()
......@@ -3851,7 +3851,7 @@ def upload():
gdriveutils.updateGdriveCalibreFromLocal()
if error:
flash(error, category="error")
uploadText=(u"File %s" % book.title)
uploadText=_(u"File %(title)s", title=book.title)
helper.global_WorkerThread.add_upload(current_user.nickname,
"<a href=\"" + url_for('show_book', book_id=book.id) + "\">" + uploadText + "</a>")
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment