Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jannik Hellenkamp
website
Commits
7b01c4e7
Commit
7b01c4e7
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Implemented newcourse and newlecture
parent
a3a201fc
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
server.py
+34
-1
34 additions, 1 deletion
server.py
templates/course.html
+1
-1
1 addition, 1 deletion
templates/course.html
templates/course_id.html
+1
-1
1 addition, 1 deletion
templates/course_id.html
with
36 additions
and
3 deletions
server.py
+
34
−
1
View file @
7b01c4e7
...
...
@@ -6,6 +6,7 @@ import threading
import
os
import
hashlib
import
locale
import
random
locale
.
setlocale
(
locale
.
LC_ALL
,
'
de_DE.UTF-8
'
)
...
...
@@ -219,7 +220,7 @@ def logout():
@app.route
(
'
/edit
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@mod_required
def
edit
():
def
edit
(
prefix
=
""
,
ignore
=
[]
):
tabs
=
{
'
courses
'
:
(
'
courses_data
'
,
'
id
'
,
[
'
visible
'
,
'
listed
'
,
'
title
'
,
'
short
'
,
'
handle
'
,
'
organizer
'
,
'
subject
'
,
'
semester
'
,
'
downloadable
'
,
...
...
@@ -235,6 +236,9 @@ def edit():
else
:
changes
=
request
.
args
.
items
()
for
key
,
val
in
changes
:
if
key
in
ignore
:
continue
key
=
prefix
+
key
table
,
id
,
column
=
key
.
split
(
'
.
'
,
2
)
assert
table
in
tabs
assert
column
in
tabs
[
table
][
2
]
...
...
@@ -243,6 +247,35 @@ def edit():
query
(
'
COMMIT
'
)
return
"
OK
"
,
200
@app.route
(
'
/newcourse
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@mod_required
def
newcourse
():
id
=
query
(
'''
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
newlecture
(
courseid
):
id
=
query
(
'''
INSERT INTO lectures_data
(course_id, visible, drehplan, title, comment, internal, speaker, place,
time, time_created, time_updated, jumplist, titlefile)
VALUES (?, 0,
""
,
"
Noch kein Titel
"
,
""
,
""
,
""
,
""
, ?, ?, ?,
""
,
""
)
'''
,
courseid
,
datetime
.
now
(),
datetime
.
now
(),
datetime
.
now
())
edit
(
prefix
=
'
lectures.
'
+
str
(
id
)
+
'
.
'
,
ignore
=
[
'
ref
'
])
if
'
ref
'
in
request
.
values
:
return
redirect
(
request
.
values
[
'
ref
'
])
return
str
(
id
),
200
@app.route
(
'
/auth
'
)
def
auth
():
# For use with nginx auth_request
if
'
X-Original-Uri
'
not
in
request
.
headers
:
...
...
This diff is collapsed.
Click to expand it.
templates/course.html
+
1
−
1
View file @
7b01c4e7
...
...
@@ -4,7 +4,7 @@
<div
class=
"row"
>
<div
class=
"col-xs-12 dropdown"
style=
"margin-bottom: 10px;"
>
<span
class=
"pull-right"
>
{% if ismod() %}
<a
class=
"btn btn-default"
style=
"margin-right: 5px;"
href=
"
todo
"
>
Neue Veranstaltung
</a>
{% endif %}
{% if ismod() %}
<a
class=
"btn btn-default"
style=
"margin-right: 5px;"
href=
"
{{ url_for('newcourse', ref=request.url) }}
"
>
Neue Veranstaltung
</a>
{% endif %}
<button
class=
"btn btn-primary dropdown-toggle pull-right"
type=
"button"
data-toggle=
"dropdown"
>
Gruppierung
<span
class=
"caret"
></span></button>
...
...
This diff is collapsed.
Click to expand it.
templates/course_id.html
+
1
−
1
View file @
7b01c4e7
...
...
@@ -31,7 +31,7 @@
</div>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h1
class=
"panel-title"
>
Videos{% if ismod() %}
<a
class=
"btn btn-default"
style=
"margin-right: 5px;"
href=
"
todo
"
>
Neuer Termin
</a><a
class=
"btn btn-default"
style=
"margin-right: 5px;"
href=
"{{url_for('import_from', id=course['id'])}}"
>
Campus Import
</a>
{% endif %}
</h1>
<h1
class=
"panel-title"
>
Videos{% if ismod() %}
<a
class=
"btn btn-default"
style=
"margin-right: 5px;"
href=
"
{{ url_for('newlecture', courseid=course.id, ref=request.url) }}
"
>
Neuer Termin
</a><a
class=
"btn btn-default"
style=
"margin-right: 5px;"
href=
"{{url_for('import_from', id=course['id'])}}"
>
Campus Import
</a>
{% endif %}
</h1>
</div>
<ul
class=
"list-group lectureslist"
>
{% for l in lectures %}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment