コード例 #1
0
ファイル: highlights.py プロジェクト: auvipy/flowgram.com
def clear_highlights(request, page, keep_zero_time_hightlights):
    highlights = models.Highlight.objects.filter(page=page)
    if keep_zero_time_hightlights:
        highlights = highlights.exclude(time__lte=1000)
    highlights.delete()

    log.action('clear_highlights on page %s for %s' % (page.id, request.user.username))
コード例 #2
0
ファイル: views.py プロジェクト: auvipy/flowgram.com
def post_queue_add_page(request, addpagerequest_id, html, url):
    """Called by the server-side renderer to finish adding a page."""

    addPageRequest = models.AddPageRequest.objects.get(id=addpagerequest_id)

    # If this page was already completed, don't add it again -- there's a possibility that multiple
    # threads are working on the same page at once.
    if addPageRequest.status_code == models.StatusCode.DONE:
        log.error("Multiple threads processed APR %s" % addPageRequest.id)
        return

    flowgram = addPageRequest.flowgram
    user = flowgram.owner
    title = helpers.get_title(request)

    # Modify the HTML to add base tag etc.
    (html, url) = fix.process_page(html, url)
        
    # Create and save the page:
    page = addPageRequest.page
    page.title = title
    page.save()
    html = helpers.cache_css_files(page, html)
    page = controller.create_page_to_flowgram(flowgram, page, html, do_make_thumbnail=False,
                                                  set_position=False)
    
    # Updating the status code and page
    addPageRequest.status_code = models.StatusCode.DONE
    
    controller.set_page_hl_contents(page, html)
    
    addPageRequest.save()
        
    log.action('post_queue_add_page %s to %s for %s' % (page.id, flowgram.id, user.username))
コード例 #3
0
ファイル: client.py プロジェクト: auvipy/flowgram.com
def send_editbar_done_email(request, enc, flowgram):
    from flowgram.core.mail import toolbar_done

    toolbar_done(flowgram, request.user)
    log.action('flowgram %s done by %s ' % (flowgram.id, request.user.username))
    return data_response.create(
        enc,
        'ok',
        {
            'user': request.user.username,
            'flowgram': flowgram.title,
        })
コード例 #4
0
ファイル: pages.py プロジェクト: auvipy/flowgram.com
def add_page(request, url, html):
    if not url.startswith('http://') and not url.startswith('https://'):
        return helpers.redirect(url, 'This type of page cannot be added to a flowgram.')

    user = request.user
    title = helpers.get_title(request)

    (flowgram, page) = pages.add_page(user, url, html, title)

    log.action('add_page created page with ID %s for Flowgram with ID %s by user %s' % \
                   (page.id, flowgram.id, user.username))
    return helpers.redirect(url, 'Page added to your Flowgram "%s"' % flowgram.title)
コード例 #5
0
ファイル: pages.py プロジェクト: MahaKoala/flowgram.com
def add_page(user, url, html, title):
    # Modifying the HTML to add a base tag, etc.
    (html, url) = fix.process_page(html, url)
    
    # Creating and saving the page.
    page = models.Page.objects.create(title=title, source_url=url)
    html = helpers.cache_css_files(page, html)

    (flowgram, is_new) = controller.get_working_flowgram(user)
    if is_new:
        log.action('Created new working Flowgram with ID %s as a result of calling get_working_flowgram in add_page.' % \
                       flowgram.id)
    page = controller.create_page_to_flowgram(flowgram, page, html)
        
    # Removing the user's 'just_published' attribute.
    profile = user.get_profile()
    profile.just_published = False
    profile.save()

    return (flowgram, page)
コード例 #6
0
ファイル: flowgrams.py プロジェクト: auvipy/flowgram.com
def delete_flowgram(request, flowgram):
    log.action('delete_flowgram %s' % flowgram.id)
    flowgram.delete()
コード例 #7
0
ファイル: highlights.py プロジェクト: auvipy/flowgram.com
def set_page(request, page, html):
    """Sets the highlighted HTML version of a Page."""
    controller.set_page_hl_contents(page, html)
    log.action('set_page on %s for %s' % (page.id, request.user.username)) 
コード例 #8
0
ファイル: views.py プロジェクト: auvipy/flowgram.com
def admin_display_in_newest(request, flowgram, display_in_newest):
    flowgram.display_in_newest = display_in_newest
    flowgram.save()
    log.action('admin_display_in_newest changed to %s on flowgram.id=%s' % (flowgram.id, display_in_newest))
コード例 #9
0
ファイル: views.py プロジェクト: auvipy/flowgram.com
def set_fg_title(request, enc, flowgram, title):
    log.action('set_fg_title from %s to %s on %s for %s' % (flowgram.title, title, flowgram.id, request.user.username))
    flowgram.title = title
    flowgram.save()
コード例 #10
0
ファイル: views.py プロジェクト: auvipy/flowgram.com
def set_fg_desc(request, flowgram, desc):
    log.action('set_fg_desc from %s to %s on %s for %s' % (flowgram.description, desc, flowgram.id, request.user.username))
    flowgram.description = desc
    flowgram.save()