Commit 51ddd517 authored by Julian Rother's avatar Julian Rother

Replace new_course with create

parent f04b45fc
......@@ -42,26 +42,26 @@ CREATE TABLE IF NOT EXISTS `chapters` (
);
CREATE TABLE IF NOT EXISTS `courses_data` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`visible` INTEGER NOT NULL,
`visible` INTEGER NOT NULL DEFAULT '0',
`listed` INTEGER NOT NULL DEFAULT '1',
`deleted` INTEGER NOT NULL DEFAULT '0',
`title` text NOT NULL,
`short` varchar(32) NOT NULL,
`handle` varchar(32) NOT NULL,
`organizer` text NOT NULL,
`subject` varchar(32) NOT NULL,
`title` text NOT NULL DEFAULT 'Neue Veranstaltung',
`short` varchar(32) NOT NULL DEFAULT '',
`handle` varchar(32) NOT NULL DEFAULT '',
`organizer` text NOT NULL DEFAULT '',
`subject` varchar(32) NOT NULL DEFAULT '',
`credits` INTEGER NOT NULL DEFAULT '0',
`created_by` INTEGER DEFAULT NULL,
`time_created` datetime NOT NULL,
`time_updated` datetime NOT NULL,
`semester` char(6) NOT NULL,
`settings` text NOT NULL,
`semester` char(6) NOT NULL DEFAULT '',
`settings` text NOT NULL DEFAULT '',
`downloadable` INTEGER NOT NULL DEFAULT '1',
`embedinvisible` INTEGER NOT NULL DEFAULT '0',
`description` text NOT NULL,
`internal` text NOT NULL,
`responsible` text NOT NULL,
`feed_url` text NOT NULL
`description` text NOT NULL DEFAULT '',
`internal` text NOT NULL DEFAULT '',
`responsible` text NOT NULL DEFAULT '',
`feed_url` text NOT NULL DEFAULT ''
);
CREATE TABLE IF NOT EXISTS `filesizes` (
`path` varchar(255) NOT NULL PRIMARY KEY,
......
......@@ -12,6 +12,7 @@ app = Flask(__name__)
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
app.add_template_global(random.randint, name='randint')
def timer_func():
with app.test_request_context():
......@@ -295,21 +296,6 @@ def create(table):
return redirect(request.values['ref'])
return str(id), 200
@app.route('/newcourse', methods=['GET', 'POST'])
@mod_required
def new_course():
id = modify('''
INSERT INTO courses_data
(visible, title, short, handle, organizer, subject, created_by, time_created,
time_updated, semester, settings, description, internal, responsible, feed_url)
VALUES (0, "Neue Veranstaltung", "Neu", ?, "", "", ?, ?, ?, "", "", "", "", ?, "")
''', 'new'+str(random.randint(0,1000)), session['user']['dbid'], datetime.now(), datetime.now(),
session['user']['givenName'])
edit(prefix='courses.'+str(id)+'.', ignore=['ref'])
if 'ref' in request.values:
return redirect(request.values['ref'])
return str(id), 200
@app.route('/newlecture/<courseid>', methods=['GET', 'POST'])
@mod_required
def new_lecture(courseid):
......
......@@ -9,7 +9,7 @@
</li>
{% if ismod() %}
<li>
<a class="btn btn-default" href="{{ url_for('new_course', ref=request.url) }}">Neue Veranstaltung</a>
<a class="btn btn-default" href="{{ url_for('create', table='courses', handle='new'+(randint(0,1000)|string), responsible=session.user.givenName, ref=request.url) }}">Neue Veranstaltung</a>
</li>
{% endif %}
<li class="dropdown" style="padding-right: 0px">
......
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