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
a0dd66e7
Commit
a0dd66e7
authored
10 months ago
by
Moritz Strohm
Browse files
Options
Downloads
Patches
Plain Diff
set defaultDate on changed calendar dates in sidebar widgets, fixes #3924
Closes #3924 Merge request
studip/studip!3046
parent
0efc3059
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/calendar/calendar.php
+5
-1
5 additions, 1 deletion
app/controllers/calendar/calendar.php
resources/assets/javascripts/lib/fullcalendar.js
+19
-0
19 additions, 0 deletions
resources/assets/javascripts/lib/fullcalendar.js
with
24 additions
and
1 deletion
app/controllers/calendar/calendar.php
+
5
−
1
View file @
a0dd66e7
...
@@ -111,6 +111,8 @@ class Calendar_CalendarController extends AuthenticatedController
...
@@ -111,6 +111,8 @@ class Calendar_CalendarController extends AuthenticatedController
{
{
PageLayout
::
setTitle
(
_
(
'Kalender'
));
PageLayout
::
setTitle
(
_
(
'Kalender'
));
$default_date
=
\Studip\Calendar\Helper
::
getDefaultCalendarDate
();
if
(
Request
::
isPost
())
{
if
(
Request
::
isPost
())
{
//In case the checkbox of the options widget is clicked, the resulting
//In case the checkbox of the options widget is clicked, the resulting
//POST request must be catched here and result in a redirect.
//POST request must be catched here and result in a redirect.
...
@@ -203,6 +205,7 @@ class Calendar_CalendarController extends AuthenticatedController
...
@@ -203,6 +205,7 @@ class Calendar_CalendarController extends AuthenticatedController
if
(
$calendar_owner
&&
$calendar_owner
->
id
===
User
::
findCurrent
()
->
id
)
{
if
(
$calendar_owner
&&
$calendar_owner
->
id
===
User
::
findCurrent
()
->
id
)
{
//The user is viewing their own calendar.
//The user is viewing their own calendar.
$options
=
new
OptionsWidget
();
$options
=
new
OptionsWidget
();
$options
->
addLayoutCSSClass
(
'calendar-action'
);
$options
->
addCheckbox
(
$options
->
addCheckbox
(
_
(
'Abgelehnte Termine anzeigen'
),
_
(
'Abgelehnte Termine anzeigen'
),
Request
::
bool
(
'show_declined'
),
Request
::
bool
(
'show_declined'
),
...
@@ -237,6 +240,7 @@ class Calendar_CalendarController extends AuthenticatedController
...
@@ -237,6 +240,7 @@ class Calendar_CalendarController extends AuthenticatedController
$this
->
url_for
(
'calendar/calendar/index'
,
[
'view'
=>
'group'
]),
$this
->
url_for
(
'calendar/calendar/index'
,
[
'view'
=>
'group'
]),
'group_id'
'group_id'
);
);
$group_select
->
addLayoutCSSClass
(
'calendar-action'
);
$options
=
[
$options
=
[
''
=>
_
(
'(bitte wählen)'
)
''
=>
_
(
'(bitte wählen)'
)
];
];
...
@@ -263,6 +267,7 @@ class Calendar_CalendarController extends AuthenticatedController
...
@@ -263,6 +267,7 @@ class Calendar_CalendarController extends AuthenticatedController
$this
->
url_for
(
'calendar/calendar'
),
$this
->
url_for
(
'calendar/calendar'
),
'user_id'
'user_id'
);
);
$calendar_select
->
addLayoutCSSClass
(
'calendar-action'
);
$select_options
=
[
$select_options
=
[
''
=>
_
(
'(bitte wählen)'
),
''
=>
_
(
'(bitte wählen)'
),
User
::
findCurrent
()
->
id
=>
_
(
'Eigener Kalender'
)
User
::
findCurrent
()
->
id
=>
_
(
'Eigener Kalender'
)
...
@@ -335,7 +340,6 @@ class Calendar_CalendarController extends AuthenticatedController
...
@@ -335,7 +340,6 @@ class Calendar_CalendarController extends AuthenticatedController
$slot_durations
=
$this
->
getUserCalendarSlotSettings
();
$slot_durations
=
$this
->
getUserCalendarSlotSettings
();
//Create the fullcalendar object:
//Create the fullcalendar object:
$default_date
=
\Studip\Calendar\Helper
::
getDefaultCalendarDate
();
$data_url_params
=
[];
$data_url_params
=
[];
if
(
Request
::
bool
(
'show_declined'
))
{
if
(
Request
::
bool
(
'show_declined'
))
{
...
...
This diff is collapsed.
Click to expand it.
resources/assets/javascripts/lib/fullcalendar.js
+
19
−
0
View file @
a0dd66e7
...
@@ -737,6 +737,25 @@ class Fullcalendar
...
@@ -737,6 +737,25 @@ class Fullcalendar
url
.
searchParams
.
set
(
'
defaultDate
'
,
changed_date
)
url
.
searchParams
.
set
(
'
defaultDate
'
,
changed_date
)
this
.
href
=
url
.
toString
();
this
.
href
=
url
.
toString
();
});
});
jQuery
(
'
.sidebar-widget.calendar-action
'
).
each
(
function
()
{
//Each sidebar widget is different. The placement of the defaultDate URL parameter
//has to reflect that.
jQuery
(
this
).
find
(
'
button[formaction]
'
).
each
(
function
()
{
//Modify the formaction attribute:
let
url
=
new
URL
(
jQuery
(
this
).
attr
(
'
formaction
'
));
url
.
searchParams
.
set
(
'
defaultDate
'
,
changed_date
);
jQuery
(
this
).
attr
(
'
formaction
'
,
url
.
toString
());
});
jQuery
(
this
).
find
(
'
form[action]
'
).
each
(
function
()
{
//Add a hidden input with the defaultDate:
let
hidden_input
=
jQuery
(
this
).
find
(
'
input[name="defaultDate"]
'
)[
0
];
if
(
!
hidden_input
)
{
hidden_input
=
jQuery
(
'
<input type="hidden" name="defaultDate">
'
);
jQuery
(
this
).
append
(
hidden_input
);
}
jQuery
(
hidden_input
).
val
(
changed_date
);
});
});
// Now change the URL of the window.
// Now change the URL of the window.
const
url
=
new
URL
(
window
.
location
.
href
);
const
url
=
new
URL
(
window
.
location
.
href
);
...
...
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