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
Iterations
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
Video AG Infrastruktur
website
Commits
686a9bae
Commit
686a9bae
authored
8 years ago
by
Andreas Valder
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git.fsmpi.rwth-aachen.de:julianundandyfrickelnkram/videoagwebsite
parents
0515eea9
b111adc0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
db_schema.sql
+23
-0
23 additions, 0 deletions
db_schema.sql
server.py
+27
-3
27 additions, 3 deletions
server.py
templates/base.html
+20
-1
20 additions, 1 deletion
templates/base.html
templates/index.html
+12
-0
12 additions, 0 deletions
templates/index.html
with
82 additions
and
4 deletions
db_schema.sql
+
23
−
0
View file @
686a9bae
...
...
@@ -183,6 +183,29 @@ CREATE TABLE IF NOT EXISTS `videos_data` (
`video_format`
INTEGER
NOT
NULL
,
`hash`
varchar
(
32
)
NOT
NULL
);
CREATE
TABLE
IF
NOT
EXISTS
`announcements`
(
`id`
INTEGER
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
,
`text`
text
NOT
NULL
,
`internal`
text
NOT
NULL
,
`level`
INTEGER
NOT
NULL
DEFAULT
0
,
`visible`
INTEGER
NOT
NULL
DEFAULT
0
,
`deleted`
INTEGER
NOT
NULL
DEFAULT
0
,
`time_created`
datetime
NOT
NULL
,
`time_updated`
datetime
NOT
NULL
,
`created_by`
INTEGER
NOT
NULL
);
CREATE
TABLE
IF
NOT
EXISTS
`featured`
(
`id`
INTEGER
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
,
`title`
text
NOT
NULL
DEFAULT
"Neuer Artikel"
,
`text`
text
NOT
NULL
DEFAULT
""
,
`internal`
text
NOT
NULL
DEFAULT
""
,
`visible`
INTEGER
NOT
NULL
DEFAULT
0
,
`deleted`
INTEGER
NOT
NULL
DEFAULT
0
,
`time_created`
datetime
NOT
NULL
,
`time_updated`
datetime
NOT
NULL
,
`created_by`
INTEGER
NOT
NULL
);
CREATE
VIEW
IF
NOT
EXISTS
`courses`
AS
select
*
from
`courses_data`
where
(
not
(
`courses_data`
.
`deleted`
));
CREATE
VIEW
IF
NOT
EXISTS
`lectures`
AS
select
*
from
`lectures_data`
where
(
not
(
`lectures_data`
.
`deleted`
));
CREATE
VIEW
IF
NOT
EXISTS
`videos`
AS
select
*
from
`videos_data`
where
(
not
(
`videos_data`
.
`deleted`
));
...
...
This diff is collapsed.
Click to expand it.
server.py
+
27
−
3
View file @
686a9bae
...
...
@@ -119,6 +119,10 @@ def human_date(d):
def
rfc3339
(
d
):
return
d
.
strftime
(
'
%Y-%m-%dT%H:%M:%S+02:00
'
)
@app.template_global
()
def
get_announcements
(
minlevel
=
0
):
return
query
(
'
SELECT * FROM announcements WHERE NOT deleted AND (? OR visible) AND level >= ? ORDER BY level DESC
'
,
ismod
(),
minlevel
)
@app.route
(
'
/
'
)
@register_navbar
(
'
Home
'
,
icon
=
'
home
'
)
def
index
():
...
...
@@ -130,7 +134,6 @@ def index():
ORDER BY time ASC LIMIT 7
'''
,
datetime
.
today
())
for
i
in
upcomming
:
i
[
'
date
'
]
=
i
[
'
time
'
].
date
()
i
[
'
time
'
]
=
i
[
'
time
'
].
time
()
latestvideos
=
query
(
'''
SELECT lectures.*, max(videos.time_updated) AS lastvidtime, courses.short, courses.downloadable, courses.title AS coursetitle
FROM lectures
...
...
@@ -140,7 +143,8 @@ def index():
GROUP BY videos.lecture_id
ORDER BY lastvidtime DESC
LIMIT 6
'''
,
ismod
())
return
render_template
(
'
index.html
'
,
latestvideos
=
latestvideos
,
upcomming
=
upcomming
)
featured
=
query
(
'
SELECT * FROM featured WHERE NOT deleted AND (? OR visible)
'
,
ismod
())
return
render_template
(
'
index.html
'
,
latestvideos
=
latestvideos
,
upcomming
=
upcomming
,
featured
=
featured
)
@app.route
(
'
/course
'
)
@register_navbar
(
'
Videos
'
,
icon
=
'
film
'
)
...
...
@@ -247,7 +251,8 @@ def edit(prefix="", ignore=[]):
'
lectures
'
:
(
'
lectures_data
'
,
'
id
'
,
[
'
visible
'
,
'
title
'
,
'
comment
'
,
'
internal
'
,
'
speaker
'
,
'
place
'
,
'
time
'
,
'
duration
'
,
'
jumplist
'
,
'
deleted
'
]),
'
videos
'
:
(
'
videos_data
'
,
'
id
'
,
[
'
visible
'
,
'
deleted
'
]),
'
chapters
'
:
(
'
chapters
'
,
'
id
'
,
[
'
time
'
,
'
text
'
,
'
visible
'
,
'
deleted
'
])
'
chapters
'
:
(
'
chapters
'
,
'
id
'
,
[
'
time
'
,
'
text
'
,
'
visible
'
,
'
deleted
'
]),
'
announcements
'
:
(
'
announcements
'
,
'
id
'
,
[
'
text
'
,
'
internal
'
,
'
level
'
,
'
visible
'
,
'
deleted
'
])
}
query
(
'
BEGIN
'
)
if
request
.
is_json
:
...
...
@@ -257,6 +262,7 @@ def edit(prefix="", ignore=[]):
for
key
,
val
in
changes
:
if
key
in
ignore
:
continue
print
(
'
edit:
'
,
key
,
val
)
key
=
prefix
+
key
print
(
key
,
val
)
table
,
id
,
column
=
key
.
split
(
'
.
'
,
2
)
...
...
@@ -370,6 +376,24 @@ def suggest_chapter(lectureid):
return
redirect
(
request
.
values
[
'
ref
'
])
return
'
OK
'
,
200
@app.route
(
'
/newpsa
'
,
methods
=
[
'
POST
'
,
'
GET
'
])
@mod_required
def
new_announcement
():
id
=
query
(
'
INSERT INTO announcements (text, internal, time_created, time_updated, created_by) VALUES (
"
Neue Ankündigung
"
,
""
, ?, ?, ?)
'
,
datetime
.
now
(),
datetime
.
now
(),
session
.
get
(
'
user
'
,
{
'
dbid
'
:
None
})[
'
dbid
'
])
if
'
ref
'
in
request
.
values
:
return
redirect
(
request
.
values
[
'
ref
'
])
return
id
,
200
@app.route
(
'
/newfeatured
'
,
methods
=
[
'
POST
'
,
'
GET
'
])
@mod_required
def
new_featured
():
id
=
query
(
'
INSERT INTO featured (time_created, time_updated, created_by) VALUES (?, ?, ?)
'
,
datetime
.
now
(),
datetime
.
now
(),
session
.
get
(
'
user
'
,
{
'
dbid
'
:
None
})[
'
dbid
'
])
if
'
ref
'
in
request
.
values
:
return
redirect
(
request
.
values
[
'
ref
'
])
return
id
,
200
import
feeds
import
importer
import
schedule
This diff is collapsed.
Click to expand it.
templates/base.html
+
20
−
1
View file @
686a9bae
{% set page_border = page_border|default(1) -%}
{% set page_border = page_border|default(1) %}
{% set min_announcement_level = min_announcement_level|default(1) %}
{% set announcement_levels = {0: 'info', 1: 'info', 2: 'warning', 3: 'danger'} %}
{% from 'macros.html' import valueeditor, valuecheckbox, valuedeletebtn %}
<!DOCTYPE html>
<html>
...
...
@@ -102,6 +105,22 @@
{% for msg in get_flashed_messages() %}
<div
class=
"alert alert-danger"
role=
"alert"
>
{{ msg }}
</div>
{% endfor %}
{% for msg in get_announcements(min_announcement_level) %}
<div
class=
"alert alert-{{announcement_levels.get(msg.level, 'info')}}"
role=
"alert"
>
{{ valueeditor(('announcements',msg.id,'text'), msg.text|safe) }}
{% if ismod() %}
<div
class=
"pull-right"
>
{{ valuecheckbox(('announcements',msg.id,'visible'),msg.visible) }}
{{ valuedeletebtn(('announcements',msg.id,'deleted')) }}
</div>
<br>
{{ valueeditor(('announcements',msg.id,'internal'), msg.internal) }}
<div
class=
"pull-right"
>
Level: {{ valueeditor(('announcements',msg.id,'level'), msg.level) }}
</div>
{% endif %}
</div>
{% endfor %}
{% block content %}
<h1>
This is a Heading
</h1>
<p>
This is a paragraph.
</p>
...
...
This diff is collapsed.
Click to expand it.
templates/index.html
+
12
−
0
View file @
686a9bae
{% from 'macros.html' import preview %}
{% extends "base.html" %}
{% set page_border = 0 %}
{% set min_announcement_level = 0 %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<ul
class=
"list-inline pull-right"
>
{% if ismod() %}
<li
style=
"padding-right: 0px;"
>
<a
class=
"btn btn-default"
href=
"{{ url_for('new_announcement', ref=request.url) }}"
>
Neue Ankündigung
</a>
</li>
{% endif %}
</ul>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-6 panel-group"
>
<div
class=
"panel panel-default"
>
...
...
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