Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
website
Commits
51ddd517
Commit
51ddd517
authored
Sep 10, 2016
by
Julian Rother
Browse files
Replace new_course with create
parent
f04b45fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
db_schema.sql
View file @
51ddd517
...
...
@@ -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
,
...
...
server.py
View file @
51ddd517
...
...
@@ -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
):
...
...
templates/courses.html
View file @
51ddd517
...
...
@@ -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"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment