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
51ddd517
Commit
51ddd517
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Replace new_course with create
parent
f04b45fc
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
db_schema.sql
+12
-12
12 additions, 12 deletions
db_schema.sql
server.py
+1
-15
1 addition, 15 deletions
server.py
templates/courses.html
+1
-1
1 addition, 1 deletion
templates/courses.html
with
14 additions
and
28 deletions
db_schema.sql
+
12
−
12
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
,
...
...
This diff is collapsed.
Click to expand it.
server.py
+
1
−
15
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
):
...
...
This diff is collapsed.
Click to expand it.
templates/courses.html
+
1
−
1
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"
>
...
...
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