Beispiel #1
0
def search():
    if not request.vars.item_per_load:
        item_per_load = 5
    else:
        item_per_load = int(request.vars.item_per_load)

    desk = db.desk(session.desk_id)

    search_keys = request.vars.search_keys
    results = Whoosh().search(search_keys, 1, pagelen=item_per_load+1)

    # remove from result the item not accesible for the user
    # TODO: e more elegant way of doing this
    results = [x for x in results if application.canReadItem(x)]
    # --
    query = db.item.unique_id.belongs(results)

    if request.vars.opt == 'desk':
        # search only in desk
        query &= db.item.id.belongs(desk.item_list)

    item_list = db(
        query
    ).select(
        orderby=[~db.item.created_on],
        limitby=(0, item_per_load+1)
    )


    response.view = 'desk/item_list.load'
    return locals()
Beispiel #2
0
def search():
    if not request.vars.item_per_load:
        item_per_load = 5
    else:
        item_per_load = int(request.vars.item_per_load)

    desk = db.desk(session.desk_id)

    search_keys = request.vars.search_keys
    results = Whoosh().search(search_keys, 1, pagelen=item_per_load + 1)

    # remove from result the item not accesible for the user
    # TODO: e more elegant way of doing this
    results = [x for x in results if application.canReadItem(x)]
    # --
    query = db.item.unique_id.belongs(results)

    if request.vars.opt == 'desk':
        # search only in desk
        query &= db.item.id.belongs(desk.item_list)

    item_list = db(query).select(orderby=[~db.item.created_on],
                                 limitby=(0, item_per_load + 1))

    response.view = 'desk/item_list.load'
    return locals()
Beispiel #3
0
    """
    Edit/Show package content
    """
    pkg_item = application.getItemByUUID(request.args(0))
    content = db.plugin_package_content(item_id=pkg_item.unique_id)

    form = SQLFORM(db.plugin_package_content, record=content, showid=False)

    if form.process().accepted:
        application.indexItem(pkg_item.unique_id)
        redirect(URL('default', 'index'))

    return locals()


@auth.requires(lambda: application.canReadItem(request.args(0)))
def diff():
    item = application.getItemByUUID(request.args(0))
    content = db.plugin_package_content(item_id=item.unique_id)
    archive = db.plugin_package_content_archive(request.args(1))
    return locals()


@auth.requires(lambda: application.canReadItem(request.args(0)))
def changelog():
    item = application.getItemByUUID(request.args(0))
    pkg_content = db.plugin_package_content(item_id=item.unique_id)
    query = (
        db.plugin_package_content_archive.current_record == pkg_content.id)
    db.plugin_package_content_archive.modified_on.label = T('Date & Time')
    db.plugin_package_content_archive.modified_on.readable = True
Beispiel #4
0
    pkg_item = application.getItemByUUID(request.args(0))
    content = db.plugin_package_content(item_id=pkg_item.unique_id)

    form = SQLFORM(
        db.plugin_package_content,
        record=content,
        showid=False)

    if form.process().accepted:
        application.indexItem(pkg_item.unique_id)
        redirect(URL('default', 'index'))

    return locals()


@auth.requires(lambda: application.canReadItem(request.args(0)))
def diff():
    item = application.getItemByUUID(request.args(0))
    content = db.plugin_package_content(item_id=item.unique_id)
    archive = db.plugin_package_content_archive(request.args(1))
    return locals()


@auth.requires(lambda: application.canReadItem(request.args(0)))
def changelog():
    item = application.getItemByUUID(request.args(0))
    pkg_content = db.plugin_package_content(item_id=item.unique_id)
    query = (
        db.plugin_package_content_archive.current_record == pkg_content.id)
    db.plugin_package_content_archive.modified_on.label = T('Date & Time')
    db.plugin_package_content_archive.modified_on.readable = True