Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jannik Hellenkamp
website
Commits
8cbe0793
Commit
8cbe0793
authored
Apr 09, 2017
by
Julian Rother
Browse files
Added new panel button
parent
4370c3dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
db_schema.sql
View file @
8cbe0793
...
...
@@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS `featured` (
`internal`
text
NOT
NULL
DEFAULT
''
,
`type`
varchar
(
32
)
NOT
NULL
DEFAULT
''
,
`param`
text
NOT
NULL
DEFAULT
''
,
`order`
INTEGER
NOT
NULL
DEFAULT
0
,
`order`
INTEGER
UNIQUE
,
`visible`
INTEGER
NOT
NULL
DEFAULT
0
,
`deleted`
INTEGER
NOT
NULL
DEFAULT
0
,
`time_created`
datetime
NOT
NULL
,
...
...
server.py
View file @
8cbe0793
...
...
@@ -326,8 +326,12 @@ def index():
JOIN courses ON courses.id = lectures.course_id
WHERE streams.active AND (? OR (streams.visible AND courses.visible AND courses.listed AND lectures.visible))
'''
,
ismod
())
featured
=
query
(
'SELECT * FROM featured WHERE NOT deleted AND (? OR visible) ORDER BY `order`'
,
ismod
())
return
render_template
(
'index.html'
,
latestvideos
=
livestreams
+
latestvideos
,
upcomming
=
upcomming
,
featured
=
featured
)
featured
=
query
(
'SELECT * FROM featured WHERE (? OR visible) ORDER BY `order`'
,
ismod
())
newfeatured
=
0
if
featured
:
newfeatured
=
featured
[
-
1
][
'order'
]
+
1
featured
=
filter
(
lambda
x
:
not
x
[
'deleted'
],
featured
)
return
render_template
(
'index.html'
,
latestvideos
=
livestreams
+
latestvideos
,
upcomming
=
upcomming
,
featured
=
featured
,
newfeatured
=
newfeatured
)
@
app
.
route
(
'/course'
)
@
register_navbar
(
'Videos'
,
icon
=
'film'
)
...
...
@@ -523,7 +527,7 @@ def edit(prefix='', ignore=[]):
assert
column
in
tabs
[
table
][
2
]
modify
(
'INSERT INTO changelog (`table`,id_value, id_key, field, value_new, value_old, `when`, who, executed) VALUES (?,?,?,?,?,(SELECT %s FROM %s WHERE %s = ?),?,?,1)'
%
(
column
,
tabs
[
table
][
0
],
tabs
[
table
][
1
]),
table
,
id
,
tabs
[
table
][
1
],
column
,
val
,
id
,
datetime
.
now
(),
session
[
'user'
][
'dbid'
])
modify
(
'UPDATE %s SET %s = ?, time_updated = ? WHERE %s = ?'
%
(
tabs
[
table
][
0
],
column
,
tabs
[
table
][
1
]),
val
,
datetime
.
now
(),
id
)
modify
(
'UPDATE %s SET %s = ?, time_updated = ? WHERE
`
%s
`
= ?'
%
(
tabs
[
table
][
0
],
column
,
tabs
[
table
][
1
]),
val
,
datetime
.
now
(),
id
)
modify
(
'COMMIT'
)
if
'ref'
in
request
.
values
:
return
redirect
(
request
.
values
[
'ref'
])
...
...
@@ -549,7 +553,7 @@ def create(table):
continue
assert
column
in
tabs
[
table
][
2
]
+
tabs
[
table
][
3
]
assert
column
not
in
defaults
columns
.
append
(
column
)
columns
.
append
(
'`'
+
column
+
'`'
)
values
.
append
(
val
)
id
=
modify
(
'INSERT INTO %s (%s) VALUES (%s)'
%
(
tabs
[
table
][
0
],
','
.
join
(
columns
),
','
.
join
([
'?'
]
*
len
(
values
))),
*
values
)
...
...
templates/index.html
View file @
8cbe0793
...
...
@@ -53,6 +53,15 @@
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<ul
class=
"list-inline pull-right"
>
<li
style=
"padding-right: 0px;"
>
<div
class=
"btn-group"
>
<button
type=
"button"
class=
"btn btn-default dropdown-toggle"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
Neues Panel
<span
class=
"caret"
></span></button>
<ul
class=
"dropdown-menu"
>
<li><a
href=
"{{ url_for('create', table='featured', title='Neues Panel', type='plain', ref=request.url, order=newfeatured) }}"
>
Nur Text
</a></li>
<li><a
href=
"{{ url_for('create', table='featured', title='Neues Panel', type='image', ref=request.url, order=newfeatured) }}"
>
Text mit Bild
</a></li>
</ul>
</div>
</li>
<li
style=
"padding-right: 0px;"
>
<a
class=
"btn btn-default"
href=
"{{ url_for('create', table='announcements', text='Neue Ankündigung', time_publish=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0), time_expire=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)+timedelta(days=7), ref=request.url) }}"
>
Neue Ankündigung
</a>
</li>
...
...
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