Merge branch 'Develop' into thumbnails
This commit is contained in:
		
						commit
						d53daaa387
					
				
							
								
								
									
										71
									
								
								cps/admin.py
									
									
									
									
									
								
							
							
						
						
									
										71
									
								
								cps/admin.py
									
									
									
									
									
								
							| 
						 | 
					@ -347,10 +347,11 @@ def list_domain(allow):
 | 
				
			||||||
    response.headers["Content-Type"] = "application/json; charset=utf-8"
 | 
					    response.headers["Content-Type"] = "application/json; charset=utf-8"
 | 
				
			||||||
    return response
 | 
					    return response
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@admi.route("/ajax/editrestriction/<int:res_type>", methods=['POST'])
 | 
					@admi.route("/ajax/editrestriction/<int:res_type>", defaults={"user_id":0}, methods=['POST'])
 | 
				
			||||||
 | 
					@admi.route("/ajax/editrestriction/<int:res_type>/<int:user_id>", methods=['POST'])
 | 
				
			||||||
@login_required
 | 
					@login_required
 | 
				
			||||||
@admin_required
 | 
					@admin_required
 | 
				
			||||||
def edit_restriction(res_type):
 | 
					def edit_restriction(res_type, user_id):
 | 
				
			||||||
    element = request.form.to_dict()
 | 
					    element = request.form.to_dict()
 | 
				
			||||||
    if element['id'].startswith('a'):
 | 
					    if element['id'].startswith('a'):
 | 
				
			||||||
        if res_type == 0:  # Tags as template
 | 
					        if res_type == 0:  # Tags as template
 | 
				
			||||||
| 
						 | 
					@ -364,9 +365,8 @@ def edit_restriction(res_type):
 | 
				
			||||||
            config.config_allowed_column_value = ','.join(elementlist)
 | 
					            config.config_allowed_column_value = ','.join(elementlist)
 | 
				
			||||||
            config.save()
 | 
					            config.save()
 | 
				
			||||||
        if res_type == 2:  # Tags per user
 | 
					        if res_type == 2:  # Tags per user
 | 
				
			||||||
            usr_id = os.path.split(request.referrer)[-1]
 | 
					            if isinstance(user_id, int):
 | 
				
			||||||
            if usr_id.isdigit() == True:
 | 
					                usr = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
 | 
				
			||||||
                usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first()
 | 
					 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                usr = current_user
 | 
					                usr = current_user
 | 
				
			||||||
            elementlist = usr.list_allowed_tags()
 | 
					            elementlist = usr.list_allowed_tags()
 | 
				
			||||||
| 
						 | 
					@ -377,9 +377,8 @@ def edit_restriction(res_type):
 | 
				
			||||||
            except OperationalError:
 | 
					            except OperationalError:
 | 
				
			||||||
                ub.session.rollback()
 | 
					                ub.session.rollback()
 | 
				
			||||||
        if res_type == 3:  # CColumn per user
 | 
					        if res_type == 3:  # CColumn per user
 | 
				
			||||||
            usr_id = os.path.split(request.referrer)[-1]
 | 
					            if isinstance(user_id, int):
 | 
				
			||||||
            if usr_id.isdigit() == True:
 | 
					                usr = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
 | 
				
			||||||
                usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first()
 | 
					 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                usr = current_user
 | 
					                usr = current_user
 | 
				
			||||||
            elementlist = usr.list_allowed_column_values()
 | 
					            elementlist = usr.list_allowed_column_values()
 | 
				
			||||||
| 
						 | 
					@ -401,9 +400,8 @@ def edit_restriction(res_type):
 | 
				
			||||||
            config.config_denied_column_value = ','.join(elementlist)
 | 
					            config.config_denied_column_value = ','.join(elementlist)
 | 
				
			||||||
            config.save()
 | 
					            config.save()
 | 
				
			||||||
        if res_type == 2:  # Tags per user
 | 
					        if res_type == 2:  # Tags per user
 | 
				
			||||||
            usr_id = os.path.split(request.referrer)[-1]
 | 
					            if isinstance(user_id, int):
 | 
				
			||||||
            if usr_id.isdigit() == True:
 | 
					                usr = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
 | 
				
			||||||
                usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first()
 | 
					 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                usr = current_user
 | 
					                usr = current_user
 | 
				
			||||||
            elementlist = usr.list_denied_tags()
 | 
					            elementlist = usr.list_denied_tags()
 | 
				
			||||||
| 
						 | 
					@ -414,9 +412,8 @@ def edit_restriction(res_type):
 | 
				
			||||||
            except OperationalError:
 | 
					            except OperationalError:
 | 
				
			||||||
                ub.session.rollback()
 | 
					                ub.session.rollback()
 | 
				
			||||||
        if res_type == 3:  # CColumn per user
 | 
					        if res_type == 3:  # CColumn per user
 | 
				
			||||||
            usr_id = os.path.split(request.referrer)[-1]
 | 
					            if isinstance(user_id, int):
 | 
				
			||||||
            if usr_id.isdigit() == True:
 | 
					                usr = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
 | 
				
			||||||
                usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first()
 | 
					 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                usr = current_user
 | 
					                usr = current_user
 | 
				
			||||||
            elementlist = usr.list_denied_column_values()
 | 
					            elementlist = usr.list_denied_column_values()
 | 
				
			||||||
| 
						 | 
					@ -444,10 +441,11 @@ def restriction_deletion(element, list_func):
 | 
				
			||||||
    return ','.join(elementlist)
 | 
					    return ','.join(elementlist)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@admi.route("/ajax/addrestriction/<int:res_type>", methods=['POST'])
 | 
					@admi.route("/ajax/addrestriction/<int:res_type>", defaults={"user_id":0}, methods=['POST'])
 | 
				
			||||||
 | 
					@admi.route("/ajax/addrestriction/<int:res_type>/<int:user_id>", methods=['POST'])
 | 
				
			||||||
@login_required
 | 
					@login_required
 | 
				
			||||||
@admin_required
 | 
					@admin_required
 | 
				
			||||||
def add_restriction(res_type):
 | 
					def add_restriction(res_type, user_id):
 | 
				
			||||||
    element = request.form.to_dict()
 | 
					    element = request.form.to_dict()
 | 
				
			||||||
    if res_type == 0:  # Tags as template
 | 
					    if res_type == 0:  # Tags as template
 | 
				
			||||||
        if 'submit_allow' in element:
 | 
					        if 'submit_allow' in element:
 | 
				
			||||||
| 
						 | 
					@ -464,9 +462,8 @@ def add_restriction(res_type):
 | 
				
			||||||
            config.config_denied_column_value = restriction_addition(element, config.list_allowed_column_values)
 | 
					            config.config_denied_column_value = restriction_addition(element, config.list_allowed_column_values)
 | 
				
			||||||
            config.save()
 | 
					            config.save()
 | 
				
			||||||
    if res_type == 2:  # Tags per user
 | 
					    if res_type == 2:  # Tags per user
 | 
				
			||||||
        usr_id = os.path.split(request.referrer)[-1]
 | 
					        if isinstance(user_id, int):
 | 
				
			||||||
        if usr_id.isdigit() == True:
 | 
					            usr = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
 | 
				
			||||||
            usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first()
 | 
					 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            usr = current_user
 | 
					            usr = current_user
 | 
				
			||||||
        if 'submit_allow' in element:
 | 
					        if 'submit_allow' in element:
 | 
				
			||||||
| 
						 | 
					@ -482,9 +479,8 @@ def add_restriction(res_type):
 | 
				
			||||||
            except OperationalError:
 | 
					            except OperationalError:
 | 
				
			||||||
                ub.session.rollback()
 | 
					                ub.session.rollback()
 | 
				
			||||||
    if res_type == 3:  # CustomC per user
 | 
					    if res_type == 3:  # CustomC per user
 | 
				
			||||||
        usr_id = os.path.split(request.referrer)[-1]
 | 
					        if isinstance(user_id, int):
 | 
				
			||||||
        if usr_id.isdigit() == True:
 | 
					            usr = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
 | 
				
			||||||
            usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first()
 | 
					 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            usr = current_user
 | 
					            usr = current_user
 | 
				
			||||||
        if 'submit_allow' in element:
 | 
					        if 'submit_allow' in element:
 | 
				
			||||||
| 
						 | 
					@ -501,10 +497,11 @@ def add_restriction(res_type):
 | 
				
			||||||
                ub.session.rollback()
 | 
					                ub.session.rollback()
 | 
				
			||||||
    return ""
 | 
					    return ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@admi.route("/ajax/deleterestriction/<int:res_type>", methods=['POST'])
 | 
					@admi.route("/ajax/deleterestriction/<int:res_type>", defaults={"user_id":0}, methods=['POST'])
 | 
				
			||||||
 | 
					@admi.route("/ajax/deleterestriction/<int:res_type>/<int:user_id>", methods=['POST'])
 | 
				
			||||||
@login_required
 | 
					@login_required
 | 
				
			||||||
@admin_required
 | 
					@admin_required
 | 
				
			||||||
def delete_restriction(res_type):
 | 
					def delete_restriction(res_type, user_id):
 | 
				
			||||||
    element = request.form.to_dict()
 | 
					    element = request.form.to_dict()
 | 
				
			||||||
    if res_type == 0:  # Tags as template
 | 
					    if res_type == 0:  # Tags as template
 | 
				
			||||||
        if element['id'].startswith('a'):
 | 
					        if element['id'].startswith('a'):
 | 
				
			||||||
| 
						 | 
					@ -521,9 +518,8 @@ def delete_restriction(res_type):
 | 
				
			||||||
            config.config_denied_column_value = restriction_deletion(element, config.list_denied_column_values)
 | 
					            config.config_denied_column_value = restriction_deletion(element, config.list_denied_column_values)
 | 
				
			||||||
            config.save()
 | 
					            config.save()
 | 
				
			||||||
    elif res_type == 2:  # Tags per user
 | 
					    elif res_type == 2:  # Tags per user
 | 
				
			||||||
        usr_id = os.path.split(request.referrer)[-1]
 | 
					        if isinstance(user_id, int):
 | 
				
			||||||
        if usr_id.isdigit() == True:
 | 
					            usr = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
 | 
				
			||||||
            usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first()
 | 
					 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            usr = current_user
 | 
					            usr = current_user
 | 
				
			||||||
        if element['id'].startswith('a'):
 | 
					        if element['id'].startswith('a'):
 | 
				
			||||||
| 
						 | 
					@ -539,9 +535,8 @@ def delete_restriction(res_type):
 | 
				
			||||||
            except OperationalError:
 | 
					            except OperationalError:
 | 
				
			||||||
                ub.session.rollback()
 | 
					                ub.session.rollback()
 | 
				
			||||||
    elif res_type == 3:  # Columns per user
 | 
					    elif res_type == 3:  # Columns per user
 | 
				
			||||||
        usr_id = os.path.split(request.referrer)[-1]
 | 
					        if isinstance(user_id, int):
 | 
				
			||||||
        if usr_id.isdigit() == True:    # select current user if admins are editing their own rights
 | 
					            usr = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()
 | 
				
			||||||
            usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first()
 | 
					 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            usr = current_user
 | 
					            usr = current_user
 | 
				
			||||||
        if element['id'].startswith('a'):
 | 
					        if element['id'].startswith('a'):
 | 
				
			||||||
| 
						 | 
					@ -558,11 +553,11 @@ def delete_restriction(res_type):
 | 
				
			||||||
                ub.session.rollback()
 | 
					                ub.session.rollback()
 | 
				
			||||||
    return ""
 | 
					    return ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@admi.route("/ajax/listrestriction/<int:res_type>", defaults={"user_id":0})
 | 
				
			||||||
@admi.route("/ajax/listrestriction/<int:res_type>")
 | 
					@admi.route("/ajax/listrestriction/<int:res_type>/<int:user_id>")
 | 
				
			||||||
@login_required
 | 
					@login_required
 | 
				
			||||||
@admin_required
 | 
					@admin_required
 | 
				
			||||||
def list_restriction(res_type):
 | 
					def list_restriction(res_type, user_id):
 | 
				
			||||||
    if res_type == 0:   # Tags as template
 | 
					    if res_type == 0:   # Tags as template
 | 
				
			||||||
        restrict = [{'Element': x, 'type':_('Deny'), 'id': 'd'+str(i) }
 | 
					        restrict = [{'Element': x, 'type':_('Deny'), 'id': 'd'+str(i) }
 | 
				
			||||||
                    for i,x in enumerate(config.list_denied_tags()) if x != '' ]
 | 
					                    for i,x in enumerate(config.list_denied_tags()) if x != '' ]
 | 
				
			||||||
| 
						 | 
					@ -576,9 +571,8 @@ def list_restriction(res_type):
 | 
				
			||||||
                 for i,x in enumerate(config.list_allowed_column_values()) if x != '']
 | 
					                 for i,x in enumerate(config.list_allowed_column_values()) if x != '']
 | 
				
			||||||
        json_dumps = restrict + allow
 | 
					        json_dumps = restrict + allow
 | 
				
			||||||
    elif res_type == 2:  # Tags per user
 | 
					    elif res_type == 2:  # Tags per user
 | 
				
			||||||
        usr_id = os.path.split(request.referrer)[-1]
 | 
					        if isinstance(user_id, int):
 | 
				
			||||||
        if usr_id.isdigit() == True:
 | 
					            usr = ub.session.query(ub.User).filter(ub.User.id == user_id).first()
 | 
				
			||||||
            usr = ub.session.query(ub.User).filter(ub.User.id == usr_id).first()
 | 
					 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            usr = current_user
 | 
					            usr = current_user
 | 
				
			||||||
        restrict = [{'Element': x, 'type':_('Deny'), 'id': 'd'+str(i) }
 | 
					        restrict = [{'Element': x, 'type':_('Deny'), 'id': 'd'+str(i) }
 | 
				
			||||||
| 
						 | 
					@ -587,9 +581,8 @@ def list_restriction(res_type):
 | 
				
			||||||
                 for i,x in enumerate(usr.list_allowed_tags()) if x != '']
 | 
					                 for i,x in enumerate(usr.list_allowed_tags()) if x != '']
 | 
				
			||||||
        json_dumps = restrict + allow
 | 
					        json_dumps = restrict + allow
 | 
				
			||||||
    elif res_type == 3:  # CustomC per user
 | 
					    elif res_type == 3:  # CustomC per user
 | 
				
			||||||
        usr_id = os.path.split(request.referrer)[-1]
 | 
					        if isinstance(user_id, int):
 | 
				
			||||||
        if usr_id.isdigit() == True:
 | 
					            usr = ub.session.query(ub.User).filter(ub.User.id==user_id).first()
 | 
				
			||||||
            usr = ub.session.query(ub.User).filter(ub.User.id==usr_id).first()
 | 
					 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            usr = current_user
 | 
					            usr = current_user
 | 
				
			||||||
        restrict = [{'Element': x, 'type':_('Deny'), 'id': 'd'+str(i) }
 | 
					        restrict = [{'Element': x, 'type':_('Deny'), 'id': 'd'+str(i) }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ def get_readbooks_ids():
 | 
				
			||||||
            readBooks = calibre_db.session.query(db.cc_classes[config.config_read_column])\
 | 
					            readBooks = calibre_db.session.query(db.cc_classes[config.config_read_column])\
 | 
				
			||||||
                .filter(db.cc_classes[config.config_read_column].value == True).all()
 | 
					                .filter(db.cc_classes[config.config_read_column].value == True).all()
 | 
				
			||||||
            return frozenset([x.book for x in readBooks])
 | 
					            return frozenset([x.book for x in readBooks])
 | 
				
			||||||
        except KeyError:
 | 
					        except (KeyError, AttributeError):
 | 
				
			||||||
            log.error("Custom Column No.%d is not existing in calibre database", config.config_read_column)
 | 
					            log.error("Custom Column No.%d is not existing in calibre database", config.config_read_column)
 | 
				
			||||||
            return []
 | 
					            return []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -144,6 +144,8 @@ class SyncToken:
 | 
				
			||||||
        except TypeError:
 | 
					        except TypeError:
 | 
				
			||||||
            log.error("SyncToken timestamps don't parse to a datetime.")
 | 
					            log.error("SyncToken timestamps don't parse to a datetime.")
 | 
				
			||||||
            return SyncToken(raw_kobo_store_token=raw_kobo_store_token)
 | 
					            return SyncToken(raw_kobo_store_token=raw_kobo_store_token)
 | 
				
			||||||
 | 
					        except KeyError:
 | 
				
			||||||
 | 
					            books_last_id = -1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return SyncToken(
 | 
					        return SyncToken(
 | 
				
			||||||
            raw_kobo_store_token=raw_kobo_store_token,
 | 
					            raw_kobo_store_token=raw_kobo_store_token,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -255,14 +255,14 @@ $(function() {
 | 
				
			||||||
        $("#h3").addClass("hidden");
 | 
					        $("#h3").addClass("hidden");
 | 
				
			||||||
        $("#h4").addClass("hidden");
 | 
					        $("#h4").addClass("hidden");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    function startTable(type) {
 | 
					    function startTable(type, user_id) {
 | 
				
			||||||
        var pathname = document.getElementsByTagName("script"), src = pathname[pathname.length - 1].src;
 | 
					        var pathname = document.getElementsByTagName("script"), src = pathname[pathname.length - 1].src;
 | 
				
			||||||
        var path = src.substring(0, src.lastIndexOf("/"));
 | 
					        var path = src.substring(0, src.lastIndexOf("/"));
 | 
				
			||||||
        $("#restrict-elements-table").bootstrapTable({
 | 
					        $("#restrict-elements-table").bootstrapTable({
 | 
				
			||||||
            formatNoMatches: function () {
 | 
					            formatNoMatches: function () {
 | 
				
			||||||
                return "";
 | 
					                return "";
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            url: path + "/../../ajax/listrestriction/" + type,
 | 
					            url: path + "/../../ajax/listrestriction/" + type + "/" + user_id,
 | 
				
			||||||
            rowStyle: function(row) {
 | 
					            rowStyle: function(row) {
 | 
				
			||||||
                // console.log('Reihe :' + row + " Index :" + index);
 | 
					                // console.log('Reihe :' + row + " Index :" + index);
 | 
				
			||||||
                if (row.id.charAt(0) === "a") {
 | 
					                if (row.id.charAt(0) === "a") {
 | 
				
			||||||
| 
						 | 
					@ -276,13 +276,13 @@ $(function() {
 | 
				
			||||||
                    $.ajax ({
 | 
					                    $.ajax ({
 | 
				
			||||||
                        type: "Post",
 | 
					                        type: "Post",
 | 
				
			||||||
                        data: "id=" + row.id + "&type=" + row.type + "&Element=" + encodeURIComponent(row.Element),
 | 
					                        data: "id=" + row.id + "&type=" + row.type + "&Element=" + encodeURIComponent(row.Element),
 | 
				
			||||||
                        url: path + "/../../ajax/deleterestriction/" + type,
 | 
					                        url: path + "/../../ajax/deleterestriction/" + type + "/" + user_id,
 | 
				
			||||||
                        async: true,
 | 
					                        async: true,
 | 
				
			||||||
                        timeout: 900,
 | 
					                        timeout: 900,
 | 
				
			||||||
                        success:function() {
 | 
					                        success:function() {
 | 
				
			||||||
                            $.ajax({
 | 
					                            $.ajax({
 | 
				
			||||||
                                method:"get",
 | 
					                                method:"get",
 | 
				
			||||||
                                url: path + "/../../ajax/listrestriction/" + type,
 | 
					                                url: path + "/../../ajax/listrestriction/" + type + "/" + user_id,
 | 
				
			||||||
                                async: true,
 | 
					                                async: true,
 | 
				
			||||||
                                timeout: 900,
 | 
					                                timeout: 900,
 | 
				
			||||||
                                success:function(data) {
 | 
					                                success:function(data) {
 | 
				
			||||||
| 
						 | 
					@ -298,7 +298,7 @@ $(function() {
 | 
				
			||||||
        $("#restrict-elements-table").removeClass("table-hover");
 | 
					        $("#restrict-elements-table").removeClass("table-hover");
 | 
				
			||||||
        $("#restrict-elements-table").on("editable-save.bs.table", function (e, field, row) {
 | 
					        $("#restrict-elements-table").on("editable-save.bs.table", function (e, field, row) {
 | 
				
			||||||
            $.ajax({
 | 
					            $.ajax({
 | 
				
			||||||
                url: path + "/../../ajax/editrestriction/" + type,
 | 
					                url: path + "/../../ajax/editrestriction/" + type + "/" + user_id,
 | 
				
			||||||
                type: "Post",
 | 
					                type: "Post",
 | 
				
			||||||
                data: row
 | 
					                data: row
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
| 
						 | 
					@ -306,13 +306,13 @@ $(function() {
 | 
				
			||||||
        $("[id^=submit_]").click(function() {
 | 
					        $("[id^=submit_]").click(function() {
 | 
				
			||||||
            $(this)[0].blur();
 | 
					            $(this)[0].blur();
 | 
				
			||||||
            $.ajax({
 | 
					            $.ajax({
 | 
				
			||||||
                url: path + "/../../ajax/addrestriction/" + type,
 | 
					                url: path + "/../../ajax/addrestriction/" + type + "/" + user_id,
 | 
				
			||||||
                type: "Post",
 | 
					                type: "Post",
 | 
				
			||||||
                data: $(this).closest("form").serialize() + "&" + $(this)[0].name + "=",
 | 
					                data: $(this).closest("form").serialize() + "&" + $(this)[0].name + "=",
 | 
				
			||||||
                success: function () {
 | 
					                success: function () {
 | 
				
			||||||
                    $.ajax ({
 | 
					                    $.ajax ({
 | 
				
			||||||
                        method:"get",
 | 
					                        method:"get",
 | 
				
			||||||
                        url: path + "/../../ajax/listrestriction/" + type,
 | 
					                        url: path + "/../../ajax/listrestriction/" + type + "/" + user_id,
 | 
				
			||||||
                        async: true,
 | 
					                        async: true,
 | 
				
			||||||
                        timeout: 900,
 | 
					                        timeout: 900,
 | 
				
			||||||
                        success:function(data) {
 | 
					                        success:function(data) {
 | 
				
			||||||
| 
						 | 
					@ -325,21 +325,21 @@ $(function() {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $("#get_column_values").on("click", function() {
 | 
					    $("#get_column_values").on("click", function() {
 | 
				
			||||||
        startTable(1);
 | 
					        startTable(1, 0);
 | 
				
			||||||
        $("#h2").removeClass("hidden");
 | 
					        $("#h2").removeClass("hidden");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#get_tags").on("click", function() {
 | 
					    $("#get_tags").on("click", function() {
 | 
				
			||||||
        startTable(0);
 | 
					        startTable(0, 0);
 | 
				
			||||||
        $("#h1").removeClass("hidden");
 | 
					        $("#h1").removeClass("hidden");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    $("#get_user_column_values").on("click", function() {
 | 
					    $("#get_user_column_values").on("click", function() {
 | 
				
			||||||
        startTable(3);
 | 
					        startTable(3, $(this).data('id'));
 | 
				
			||||||
        $("#h4").removeClass("hidden");
 | 
					        $("#h4").removeClass("hidden");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#get_user_tags").on("click", function() {
 | 
					    $("#get_user_tags").on("click", function() {
 | 
				
			||||||
        startTable(2);
 | 
					        startTable(2,  $(this).data('id'));
 | 
				
			||||||
        $(this)[0].blur();
 | 
					        $(this)[0].blur();
 | 
				
			||||||
        $("#h3").removeClass("hidden");
 | 
					        $("#h3").removeClass("hidden");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@
 | 
				
			||||||
        <input type="text" class="form-control" id="config_calibre_dir" name="config_calibre_dir" value="{% if config.config_calibre_dir != None %}{{ config.config_calibre_dir }}{% endif %}" autocomplete="off">
 | 
					        <input type="text" class="form-control" id="config_calibre_dir" name="config_calibre_dir" value="{% if config.config_calibre_dir != None %}{{ config.config_calibre_dir }}{% endif %}" autocomplete="off">
 | 
				
			||||||
       {% if filepicker %}
 | 
					       {% if filepicker %}
 | 
				
			||||||
        <span class="input-group-btn">
 | 
					        <span class="input-group-btn">
 | 
				
			||||||
          <button type="button" data-toggle="modal" id="converter_modal_path" data-link="config_calibre_dir" data-filefilter="metadata.db" data-target="#fileModal" id="library_path" class="btn btn-default"><span class="glyphicon glyphicon-folder-open"></span></button>
 | 
					          <button type="button" data-toggle="modal" id="calibre_modal_path" data-link="config_calibre_dir" data-filefilter="metadata.db" data-target="#fileModal" id="library_path" class="btn btn-default"><span class="glyphicon glyphicon-folder-open"></span></button>
 | 
				
			||||||
        </span>
 | 
					        </span>
 | 
				
			||||||
       {% endif %}
 | 
					       {% endif %}
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@
 | 
				
			||||||
      <div class="modal-footer">
 | 
					      <div class="modal-footer">
 | 
				
			||||||
        <div class="text-left" id="element_selected"></div>
 | 
					        <div class="text-left" id="element_selected"></div>
 | 
				
			||||||
        <input type="button" class="btn btn-primary" data-path="" data-link=""  data-folderonly="" data-filefilter="" data-newfile="" value="{{_('Select')}}" name="file_confirm" id="file_confirm" data-dismiss="modal">
 | 
					        <input type="button" class="btn btn-primary" data-path="" data-link=""  data-folderonly="" data-filefilter="" data-newfile="" value="{{_('Select')}}" name="file_confirm" id="file_confirm" data-dismiss="modal">
 | 
				
			||||||
        <button type="button" class="btn btn-default" data-dismiss="modal">{{_('Cancel')}}</button>
 | 
					        <button type="button" id="file_abort" class="btn btn-default" data-dismiss="modal">{{_('Cancel')}}</button>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,8 +82,8 @@
 | 
				
			||||||
          <label for="Show_detail_random">{{_('Show Random Books in Detail View')}}</label>
 | 
					          <label for="Show_detail_random">{{_('Show Random Books in Detail View')}}</label>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      {% if ( g.user and g.user.role_admin() and not new_user ) %}
 | 
					      {% if ( g.user and g.user.role_admin() and not new_user ) %}
 | 
				
			||||||
      <a href="#" id="get_user_tags" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add Allowed/Denied Tags')}}</a>
 | 
					      <a href="#" id="get_user_tags" class="btn btn-default" data-id="{{content.id}}" data-toggle="modal" data-target="#restrictModal">{{_('Add Allowed/Denied Tags')}}</a>
 | 
				
			||||||
      <a href="#" id="get_user_column_values" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/Denied Custom Column Values')}}</a>
 | 
					      <a href="#" id="get_user_column_values" data-id="{{content.id}}" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/Denied Custom Column Values')}}</a>
 | 
				
			||||||
      {% endif %}
 | 
					      {% endif %}
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
      <div class="col-sm-6">
 | 
					      <div class="col-sm-6">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -635,13 +635,12 @@ def render_read_books(page, are_read, as_xml=False, order=None):
 | 
				
			||||||
            db_filter = and_(ub.ReadBook.user_id == int(current_user.id),
 | 
					            db_filter = and_(ub.ReadBook.user_id == int(current_user.id),
 | 
				
			||||||
                             ub.ReadBook.read_status == ub.ReadBook.STATUS_FINISHED)
 | 
					                             ub.ReadBook.read_status == ub.ReadBook.STATUS_FINISHED)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            db_filter = and_(ub.ReadBook.user_id == int(current_user.id),
 | 
					            db_filter = coalesce(ub.ReadBook.read_status, 0) != ub.ReadBook.STATUS_FINISHED
 | 
				
			||||||
                             coalesce(ub.ReadBook.read_status, 0) != ub.ReadBook.STATUS_FINISHED)
 | 
					 | 
				
			||||||
        entries, random, pagination = calibre_db.fill_indexpage(page, 0,
 | 
					        entries, random, pagination = calibre_db.fill_indexpage(page, 0,
 | 
				
			||||||
                                                                db.Books,
 | 
					                                                                db.Books,
 | 
				
			||||||
                                                                db_filter,
 | 
					                                                                db_filter,
 | 
				
			||||||
                                                                order,
 | 
					                                                                order,
 | 
				
			||||||
                                                                ub.ReadBook, db.Books.id==ub.ReadBook.book_id)
 | 
					                                                                ub.ReadBook, db.Books.id == ub.ReadBook.book_id)
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            if are_read:
 | 
					            if are_read:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user