Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
8420c622
Commit
8420c622
authored
Jun 20, 2019
by
Robert Lyon
Committed by
Gerrit Code Review
Jun 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Bug 1831689: Adjusting how we update dates on the the view access page"
parents
101db75b
afd9e7a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
32 deletions
+33
-32
htdocs/lib/pieforms/pieform/elements/calendar.php
htdocs/lib/pieforms/pieform/elements/calendar.php
+6
-1
htdocs/theme/raw/templates/form/viewacl.tpl
htdocs/theme/raw/templates/form/viewacl.tpl
+27
-31
No files found.
htdocs/lib/pieforms/pieform/elements/calendar.php
View file @
8420c622
...
...
@@ -333,7 +333,12 @@ function pieform_element_calendar_convert_to_epoch($date) {
// (See http://php.net/manual/en/function.strtotime.php#refsect1-function.strtotime-notes)
$dateformat
=
get_string
(
'pieform_calendar_dateformat'
,
'langconfig'
);
if
(
preg_match
(
'/%[ed].*%[m].*%[yY]/'
,
$dateformat
))
{
$value
=
strtotime
(
preg_replace
(
'/[^0-9]/'
,
'.'
,
$date
));
$timesuffix
=
preg_match
(
'/(am|pm)$/i'
,
$date
,
$match
);
$fixdate
=
preg_replace
(
'/[^0-9]/'
,
'.'
,
$date
);
if
(
$timesuffix
)
{
$fixdate
=
preg_replace
(
'/[^\d](\.+)$/'
,
$match
[
1
],
$fixdate
);
}
$value
=
strtotime
(
$fixdate
);
}
// If that didn't work, then just try doing strtotime on the plain value
...
...
htdocs/theme/raw/templates/form/viewacl.tpl
View file @
8420c622
...
...
@@ -159,43 +159,39 @@ jQuery(function($) {
function
setDatePicker
(
target
)
{
var
loc
=
'
{
{
strstr
(
current_language
(),
'.'
,
true
)
}
}
'
;
// Get current langauge to use for locale
target
.
datetimepicker
({
useCurrent
:
false
,
format
:
"
{
{
str
(
tag
=
'pieform_calendar_dateformat'
section
=
'langconfig'
)|
pieform_element_calendar_convert_dateformat
}
} {
{
str
(
tag
=
'pieform_calendar_timeformat'
section
=
'langconfig'
)|
pieform_element_calendar_convert_timeformat
}
}
"
,
locale
:
loc
,
buttons
:
{
showClear
:
true
,
showToday
:
true
,
},
tooltips
:
{
{
$datepickertooltips
|
safe
}
},
icons
:
{
time
:
"
icon icon-clock-o
"
,
date
:
"
icon icon-calendar
"
,
up
:
"
icon icon-arrow-up
"
,
down
:
"
icon icon-arrow-down
"
,
previous
:
"
icon icon-chevron-left
"
,
next
:
"
icon icon-chevron-right
"
,
close
:
"
icon icon-times
"
,
clear
:
"
icon icon-trash
"
,
today
:
"
icon icon-crosshairs
"
,
},
});
target
.
on
(
'
hide.datetimepicker
'
,
function
(
selectedDate
)
{
if
(
selectedDate
!==
""
)
{
formchangemanager
.
setFormStateById
(
'
{
{
$formname
}
}
'
,
FORM_CHANGED
);
}
});
// ugly fix for open issue in tempusdominus bootstrap lib not getting the value from html tag
// https://github.com/tempusdominus/bootstrap-4/issues/126
target
.
each
(
function
()
{
// ugly fix for open issue in tempusdominus bootstrap lib not getting the value from html tag
// https://github.com/tempusdominus/bootstrap-4/issues/126
var
value
=
$
(
this
).
attr
(
'
value
'
);
value
=
value
==
''
?
null
:
value
;
$
(
this
).
datetimepicker
({
format
:
"
{
{
str
(
tag
=
'pieform_calendar_dateformat'
section
=
'langconfig'
)|
pieform_element_calendar_convert_dateformat
}
} {
{
str
(
tag
=
'pieform_calendar_timeformat'
section
=
'langconfig'
)|
pieform_element_calendar_convert_timeformat
}
}
"
,
date
:
value
date
:
value
,
useCurrent
:
false
,
locale
:
loc
,
buttons
:
{
showClear
:
true
,
showToday
:
true
,
},
tooltips
:
{
{
$datepickertooltips
|
safe
}
},
icons
:
{
time
:
"
icon icon-clock-o
"
,
date
:
"
icon icon-calendar
"
,
up
:
"
icon icon-arrow-up
"
,
down
:
"
icon icon-arrow-down
"
,
previous
:
"
icon icon-chevron-left
"
,
next
:
"
icon icon-chevron-right
"
,
close
:
"
icon icon-times
"
,
clear
:
"
icon icon-trash
"
,
today
:
"
icon icon-crosshairs
"
,
},
});
$
(
this
).
val
(
value
);
$
(
this
).
on
(
'
hide.datetimepicker
'
,
function
(
selectedDate
)
{
if
(
selectedDate
!==
""
)
{
formchangemanager
.
setFormStateById
(
'
{
{
$formname
}
}
'
,
FORM_CHANGED
);
}
});
});
}
...
...
Write
Preview
Markdown
is supported
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