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
45651018
Commit
45651018
authored
Sep 07, 2016
by
Julian Rother
Browse files
Added backend support for featured articles
parent
e0f75739
Changes
2
Hide whitespace changes
Inline
Side-by-side
db_schema.sql
View file @
45651018
...
...
@@ -194,6 +194,17 @@ CREATE TABLE IF NOT EXISTS `announcements` (
`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`
));
...
...
server.py
View file @
45651018
...
...
@@ -144,7 +144,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'
)
...
...
@@ -384,6 +385,15 @@ def new_announcement():
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
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