add support for using configured date format

This commit is contained in:
Uwe Steinmann 2020-12-17 11:44:19 +01:00
parent 88f3205be7
commit efe6fe085d
3 changed files with 10 additions and 4 deletions

View File

@ -49,8 +49,9 @@ if (!isset($_POST["presetexpdate"]) || $_POST["presetexpdate"] == "") {
switch($_POST["presetexpdate"]) { switch($_POST["presetexpdate"]) {
case "date": case "date":
$tmp = explode('-', $_POST["expdate"]); $expires = strtotime($_POST["expdate"]);
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]); // $tmp = explode('-', $_POST["expdate"]);
// $expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
break; break;
case "1w": case "1w":
$tmp = explode('-', date('Y-m-d')); $tmp = explode('-', date('Y-m-d'));
@ -88,6 +89,11 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['setExpires'])) {
if (!$document->setExpires($expires)){ if (!$document->setExpires($expires)){
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
} else {
if($expires)
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_expiration_date_set', array('date'=>getReadableDate($expires)))));
else
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_expiration_date_cleared')));
} }
$document->verifyLastestContentExpriry(); $document->verifyLastestContentExpriry();

View File

@ -63,7 +63,7 @@ $(document).ready( function() {
$('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); }); $('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
$('.datepicker, #expirationdate, #fromdate, #todate, #createstartdate, #createenddate, #expirationstartdate, #expirationenddate') $('.datepicker, #expirationdate, #createstartdate, #createenddate, #expirationstartdate, #expirationenddate')
.datepicker({todayHighlight: true, toggleActive: true}) .datepicker({todayHighlight: true, toggleActive: true})
.on('changeDate', function(ev){ .on('changeDate', function(ev){
if(ev.date && $(ev.target).data('selectmenu')) { if(ev.date && $(ev.target).data('selectmenu')) {

View File

@ -59,7 +59,7 @@ $(document).ready( function() {
$this->contentContainerStart(); $this->contentContainerStart();
if($document->expires()) if($document->expires())
$expdate = date('Y-m-d', $document->getExpires()); $expdate = getReadableDate($document->getExpires());
else else
$expdate = ''; $expdate = '';
?> ?>