Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
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
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
aad97adf
Commit
aad97adf
authored
1 month ago
by
Marcus Eibrink-Lunzenauer
Browse files
Options
Downloads
Patches
Plain Diff
Apply Ron's changes.
parent
df1bc6e0
No related branches found
No related tags found
No related merge requests found
Pipeline
#33197
failed
1 month ago
Stage: build
Stage: checks
Stage: analyse
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/admin/courseware.php
+27
-83
27 additions, 83 deletions
app/controllers/admin/courseware.php
resources/assets/stylesheets/scss/courseware/admin.scss
+0
-56
0 additions, 56 deletions
resources/assets/stylesheets/scss/courseware/admin.scss
with
27 additions
and
139 deletions
app/controllers/admin/courseware.php
+
27
−
83
View file @
aad97adf
...
@@ -17,60 +17,37 @@ class Admin_CoursewareController extends AuthenticatedController
...
@@ -17,60 +17,37 @@ class Admin_CoursewareController extends AuthenticatedController
{
{
parent
::
before_filter
(
$action
,
$args
);
parent
::
before_filter
(
$action
,
$args
);
$GLOBALS
[
'perm'
]
->
check
(
'root'
);
$GLOBALS
[
'perm'
]
->
check
(
'root'
);
PageLayout
::
setTitle
(
_
(
'Coursewareverwaltung'
));
Navigation
::
activateItem
(
'/admin/locations/courseware'
);
}
}
public
function
index_action
()
public
function
index_action
()
{
{
$this
->
setSidebar
();
PageLayout
::
setTitle
(
_
(
'Courseware Vorlagen'
));
Navigation
::
activateItem
(
'/admin/locations/courseware_templates'
);
$this
->
setIndexSidebar
();
}
}
public
function
block_type
s_action
()
public
function
element
s_action
()
:
void
{
{
PageLayout
::
addStyleSheet
(
'courseware.css'
);
PageLayout
::
setTitle
(
_
(
'Courseware Inhaltselemente'
));
Navigation
::
activateItem
(
'/admin/locations/courseware_elements'
);
$views
=
Sidebar
::
get
()
->
addWidget
(
new
ViewsWidget
());
$views
->
addLink
(
_
(
'Templates'
),
$this
->
indexURL
());
$views
->
addLink
(
_
(
'Block-Typen'
),
$this
->
block_typesURL
())
->
setActive
(
true
);
$views
->
addLink
(
_
(
'Container-Typen'
),
$this
->
container_typesURL
());
$this
->
blockTypes
=
BlockType
::
getBlockTypes
();
$this
->
blockTypes
=
BlockType
::
getBlockTypes
();
usort
(
$this
->
blockTypes
,
fn
(
$blockTypeA
,
$blockTypeB
)
=>
$blockTypeA
::
getTitle
()
<=>
$blockTypeB
::
getTitle
());
$this
->
containerTypes
=
ContainerType
::
getContainerTypes
();
usort
(
usort
(
$this
->
block
Types
,
$this
->
container
Types
,
fn
(
$
blockTypeA
,
$block
TypeB
)
=>
$
block
TypeA
::
getTitle
()
<=>
$
block
TypeB
::
getTitle
()
fn
(
$
containerTypeA
,
$container
TypeB
)
=>
$
container
TypeA
::
getTitle
()
<=>
$
container
TypeB
::
getTitle
()
);
);
}
}
public
function
bulk_block_types_action
()
{
CSRFProtection
::
verifyUnsafeRequest
();
switch
(
Request
::
option
(
'bulk_action'
))
{
case
'activate'
:
return
$this
->
activate_block_types_action
();
case
'deactivate'
:
return
$this
->
deactivate_block_types_action
();
}
PageLayout
::
postInfo
(
_
(
'Keine Aktion ausgewählt.'
));
$this
->
redirect
(
$this
->
action_url
(
'block_types'
));
}
/**
*/
public
function
activate_block_types_action
()
public
function
activate_block_types_action
()
{
{
CSRFProtection
::
verifyUnsafeRequest
();
CSRFProtection
::
verifyUnsafeRequest
();
$requestedBlockTypes
=
$this
->
validateBlockTypes
();
$requestedBlockTypes
=
$this
->
validateBlockTypes
();
$changed
=
array_sum
(
$changed
=
array_sum
(
array_map
(
fn
(
$blockType
)
=>
$blockType
::
activate
()
?
1
:
0
,
$requestedBlockTypes
));
array_map
(
fn
(
$blockType
)
=>
$blockType
::
activate
()
?
1
:
0
,
$requestedBlockTypes
)
);
PageLayout
::
postSuccess
(
PageLayout
::
postSuccess
(
sprintf
(
sprintf
(
...
@@ -78,22 +55,15 @@ class Admin_CoursewareController extends AuthenticatedController
...
@@ -78,22 +55,15 @@ class Admin_CoursewareController extends AuthenticatedController
$changed
$changed
)
)
);
);
$this
->
redirect
(
$this
->
action_url
(
'
block_type
s'
));
$this
->
redirect
(
$this
->
action_url
(
'
element
s'
));
}
}
/**
*/
public
function
deactivate_block_types_action
()
public
function
deactivate_block_types_action
()
{
{
CSRFProtection
::
verifyUnsafeRequest
();
CSRFProtection
::
verifyUnsafeRequest
();
$requestedBlockTypes
=
$this
->
validateBlockTypes
();
$requestedBlockTypes
=
$this
->
validateBlockTypes
();
$changed
=
array_sum
(
$changed
=
array_sum
(
array_map
(
fn
(
$blockType
)
=>
$blockType
::
deactivate
()
?
1
:
0
,
$requestedBlockTypes
));
array_map
(
fn
(
$blockType
)
=>
$blockType
::
deactivate
()
?
1
:
0
,
$requestedBlockTypes
)
);
PageLayout
::
postSuccess
(
PageLayout
::
postSuccess
(
sprintf
(
sprintf
(
...
@@ -101,42 +71,25 @@ class Admin_CoursewareController extends AuthenticatedController
...
@@ -101,42 +71,25 @@ class Admin_CoursewareController extends AuthenticatedController
$changed
$changed
)
)
);
);
$this
->
redirect
(
$this
->
action_url
(
'
block_type
s'
));
$this
->
redirect
(
$this
->
action_url
(
'
element
s'
));
}
}
private
function
validateBlockTypes
():
iterable
private
function
validateBlockTypes
():
iterable
{
{
$requestedBlockTypes
=
Request
::
getArray
(
'block_types'
);
$requestedBlockTypes
=
Request
::
getArray
(
'block_types'
);
$diff
=
array_diff
(
$requestedBlockTypes
,
BlockType
::
getBlockTypes
());
$diff
=
array_diff
(
$requestedBlockTypes
,
BlockType
::
getBlockTypes
());
if
(
count
(
$diff
)
>
0
)
{
if
(
count
(
$diff
))
{
throw
new
Trails
\
Exception
(
400
);
throw
new
Trails
_
Exception
(
400
);
}
}
return
$requestedBlockTypes
;
return
$requestedBlockTypes
;
}
}
public
function
container_types_action
()
{
PageLayout
::
addStyleSheet
(
'courseware.css'
);
$views
=
Sidebar
::
get
()
->
addWidget
(
new
ViewsWidget
());
$views
->
addLink
(
_
(
'Templates'
),
$this
->
indexURL
());
$views
->
addLink
(
_
(
'Block-Typen'
),
$this
->
block_typesURL
());
$views
->
addLink
(
_
(
'Container-Typen'
),
$this
->
container_typesURL
())
->
setActive
(
true
);
$this
->
containerTypes
=
ContainerType
::
getContainerTypes
();
usort
(
$this
->
containerTypes
,
fn
(
$containerTypeA
,
$containerTypeB
)
=>
$containerTypeA
::
getTitle
()
<=>
$containerTypeB
::
getTitle
(),
);
}
public
function
bulk_container_types_action
()
public
function
bulk_container_types_action
()
{
{
CSRFProtection
::
verifyUnsafeRequest
();
CSRFProtection
::
verifyUnsafeRequest
();
switch
(
Request
::
get
(
'bulk_action'
))
{
switch
(
Request
::
quoted
(
'bulk_action'
))
{
case
'activate'
:
case
'activate'
:
return
$this
->
activate_container_types_action
();
return
$this
->
activate_container_types_action
();
case
'deactivate'
:
case
'deactivate'
:
...
@@ -147,18 +100,13 @@ class Admin_CoursewareController extends AuthenticatedController
...
@@ -147,18 +100,13 @@ class Admin_CoursewareController extends AuthenticatedController
$this
->
redirect
(
$this
->
action_url
(
'container_types'
));
$this
->
redirect
(
$this
->
action_url
(
'container_types'
));
}
}
/**
*/
public
function
activate_container_types_action
()
public
function
activate_container_types_action
()
{
{
CSRFProtection
::
verifyUnsafeRequest
();
CSRFProtection
::
verifyUnsafeRequest
();
$requestedContainerTypes
=
$this
->
validateContainerTypes
();
$requestedContainerTypes
=
$this
->
validateContainerTypes
();
$changed
=
array_sum
(
$changed
=
array_sum
(
array_map
(
array_map
(
fn
(
$containerType
)
=>
$containerType
::
activate
()
?
1
:
0
,
$requestedContainerTypes
)
fn
(
$containerType
)
=>
$containerType
::
activate
()
?
1
:
0
,
$requestedContainerTypes
)
);
);
PageLayout
::
postSuccess
(
PageLayout
::
postSuccess
(
...
@@ -178,15 +126,16 @@ class Admin_CoursewareController extends AuthenticatedController
...
@@ -178,15 +126,16 @@ class Admin_CoursewareController extends AuthenticatedController
$requestedContainerTypes
=
$this
->
validateContainerTypes
();
$requestedContainerTypes
=
$this
->
validateContainerTypes
();
$changed
=
array_sum
(
$changed
=
array_sum
(
array_map
(
array_map
(
fn
(
$containerType
)
=>
$containerType
::
deactivate
()
?
1
:
0
,
$requestedContainerTypes
)
fn
(
$containerType
)
=>
$containerType
::
deactivate
()
?
1
:
0
,
$requestedContainerTypes
)
);
);
PageLayout
::
postSuccess
(
PageLayout
::
postSuccess
(
sprintf
(
sprintf
(
ngettext
(
'Container-Typ erfolgreich deaktiviert.'
,
'%d Container-Typen erfolgreich deaktiviert.'
,
$changed
),
ngettext
(
'Container-Typ erfolgreich deaktiviert.'
,
'%d Container-Typen erfolgreich deaktiviert.'
,
$changed
),
$changed
$changed
)
)
);
);
...
@@ -198,20 +147,15 @@ class Admin_CoursewareController extends AuthenticatedController
...
@@ -198,20 +147,15 @@ class Admin_CoursewareController extends AuthenticatedController
$requestedContainerTypes
=
Request
::
getArray
(
'container_types'
);
$requestedContainerTypes
=
Request
::
getArray
(
'container_types'
);
$diff
=
array_diff
(
$requestedContainerTypes
,
ContainerType
::
getContainerTypes
());
$diff
=
array_diff
(
$requestedContainerTypes
,
ContainerType
::
getContainerTypes
());
if
(
count
(
$diff
))
{
if
(
count
(
$diff
))
{
throw
new
Trails
\
Exception
(
400
);
throw
new
Trails
_
Exception
(
400
);
}
}
return
$requestedContainerTypes
;
return
$requestedContainerTypes
;
}
}
private
function
setSidebar
()
private
function
set
Index
Sidebar
()
{
{
$sidebar
=
Sidebar
::
Get
();
$sidebar
=
Sidebar
::
Get
();
$views
=
new
TemplateWidget
(
_
(
'Ansichten'
),
$this
->
get_template_factory
()
->
open
(
'admin/courseware/admin_view_widget'
)
);
$sidebar
->
addWidget
(
$views
)
->
addLayoutCSSClass
(
'courseware-admin-view-widget'
);
$views
=
new
TemplateWidget
(
$views
=
new
TemplateWidget
(
_
(
'Aktionen'
),
_
(
'Aktionen'
),
...
...
This diff is collapsed.
Click to expand it.
resources/assets/stylesheets/scss/courseware/admin.scss
deleted
100644 → 0
+
0
−
56
View file @
df1bc6e0
.cw-admin-block-types
,
.cw-admin-container-types
{
tbody
{
td
{
padding-block-end
:
0
.625rem
;
}
tr
.activated
td
{
background-color
:
var
(
--
content-color-10
);
}
tr
.activated
td
:first-child
{
border-inline-start
:
0
.25rem
solid
var
(
--
content-color
);
}
td
:nth-child
(
2
)
{
vertical-align
:
middle
;
width
:
20px
;
}
td
:nth-child
(
2
)
span
{
display
:
inline-block
;
height
:
20px
;
width
:
20px
;
}
td
:nth-child
(
3
)
span
:last-of-type
{
opacity
:
0
.5
;
}
td
:nth-child
(
4
)
p
{
display
:
-
webkit-box
;
min-height
:
3em
;
overflow
:
hidden
;
-webkit-box-orient
:
vertical
;
-webkit-line-clamp
:
2
;
}
}
thead
tr
th
:first-child
,
tbody
tr
:not
(
.activated
)
td
:first-child
{
border-inline-start
:
1px
solid
var
(
--
content-color-20
);
}
}
@each
$item
,
$icon
in
$blockadder-items
{
.cw-admin-block-types
.cw-block-type-
#{
$item
}
{
@include
background-icon
(
$icon
,
info
,
20
);
}
}
@each
$item
,
$icon
in
$containeradder-items
{
.cw-admin-container-types
.cw-container-type-
#{
$item
}
{
@include
background-icon
(
$icon
,
info
,
20
);
}
}
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