Exemplo n.º 1
0
def move(url):
    page = current_wiki.get_or_404(url)
    form = URLForm(obj=page)
    if form.validate_on_submit():
        newurl = form.url.data
        current_wiki.move(url, newurl)
        return redirect(url_for('wiki.display', url=newurl))
    return render_template('move.html', form=form, page=page)
Exemplo n.º 2
0
def move(url):
    page = current_wiki.get_or_404(url)
    form = URLForm(obj=page)
    if form.validate_on_submit():
        newurl = form.url.data
        current_wiki.move(url, newurl)
        return redirect(url_for('wiki.display', url=newurl))
    return render_template('move.html', form=form, page=page)
Exemplo n.º 3
0
def saveas(url):
    old_page = current_wiki.get_or_404(url)
    form = URLForm(obj=old_page)
    if form.validate_on_submit():
        return redirect(url_for(
            'wiki.copy', oldurl=form.clean_url(url), newurl=form.clean_url(form.url.data)
        ))
    return render_template('saveas.html', form=form)
Exemplo n.º 4
0
def move(url):
    page = current_wiki.get_or_404(url)
    form = URLForm(obj=page)
    if form.validate_on_submit():
        newurl = form.url.data
        current_wiki.move(url, newurl)
        move_history(url, newurl)
        add_history(newurl, 'WikiBot', 'Moved page to URL: ' + newurl, page.html, page.content, 'move')
        return redirect(url_for('wiki.display', url=newurl))
    return render_template('move.html', form=form, page=page)
Exemplo n.º 5
0
def create():
    form = URLForm()
    if form.validate_on_submit():
        url=form.clean_url(form.url.data)
	
        #get current user's name and current date when page is created
        #then append it to the creators.json file
        ########################################
        creator_module.add_to_json(url)
		########################################
        
        return redirect(url_for('wiki.edit', url=form.clean_url(form.url.data)))
    return render_template('create.html', form=form)
Exemplo n.º 6
0
def move(url):
    page = current_wiki.get_or_404(url)
    form = URLForm(obj=page)
    if form.validate_on_submit():
        newurl = form.url.data
        current_wiki.move(url, newurl)

        # Delete non-moved pages
        all_pages = current_wiki.index()
        pages = Page.get_versions(page.path, all_pages)

        for p in pages:
            current_wiki.delete(p.url)

        flash('Page "%s" was deleted.' % page.title, 'success')

        return redirect(url_for('wiki.display', url=newurl))
    return render_template('move.html', form=form, page=page)
Exemplo n.º 7
0
def export(url):
    page = current_wiki.get_or_404(url)

    form = URLForm(obj=page)
    if request.method == 'POST':
        if request.form['submit_button'] == 'PDF':
            html = page.html
            base_url = flask.request.host_url
            rendered = render_template('pdf_page_template.html',
                                       page=page,
                                       base_url=base_url)
            pdf = pdfkit.from_string(rendered, False)

            response = make_response(pdf)
            response.headers['Content-Type'] = 'application/pdf'
            response.headers[
                'Content-Disposition'] = 'inline; filename={}.pdf'.format(
                    'Test')

            return response
        else:
            pass

    return render_template('export.html', form=form, page=page)
Exemplo n.º 8
0
def move(url):
    page = current_wiki.get_or_404(url)
    if page.owner:
        if current_user.get_id() == page.owner:
            form = URLForm(obj=page)
            if form.validate_on_submit():
                newurl = form.url.data
                current_wiki.move(url, newurl)
                return redirect(url_for('wiki.display', url=newurl))
        else:
            if page.owner == "admin":
                flash('This page is locked to editing by the site administrators.')
            else:
                flash('You must own this page to move it', 'success')
            return redirect(url_for('wiki.display', url=url))
    form = URLForm(obj=page)
    if form.validate_on_submit():
        newurl = form.url.data
        current_wiki.move(url, newurl)
        return redirect(url_for('wiki.display', url=newurl))
    return render_template('move.html', form=form, page=page)
Exemplo n.º 9
0
def create():
    form = URLForm()
    if form.validate_on_submit():
        return redirect(url_for('wiki.edit',
                                url=form.clean_url(form.url.data)))
    return render_template('create.html', form=form)
Exemplo n.º 10
0
def create():
    form = URLForm()
    if form.validate_on_submit():
        return redirect(url_for(
            'wiki.edit', url=form.clean_url(form.url.data)))
    return render_template('create.html', form=form)