date can be passed to AddEvent

This commit is contained in:
Uwe Steinmann 2022-03-28 19:11:00 +02:00
parent fe03d58100
commit 78e701d585
4 changed files with 33 additions and 2 deletions

View File

@ -35,9 +35,19 @@ if ($user->isGuest()) {
UI::exitError(getMLText("edit_event"),getMLText("access_denied"));
}
if (isset($_GET["day"])) $day=(int) $_GET["day"];
else $day = '';
if (isset($_GET["year"])) $year=(int) $_GET["year"];
else $year = '';
if (isset($_GET["month"])) $month=(int) $_GET["month"];
else $month = '';
$accessop = new SeedDMS_AccessOperation($dms, null, $user, $settings);
if($view) {
$view->setParam('day', $day);
$view->setParam('year', $year);
$view->setParam('month', $month);
$view->setParam('accessobject', $accessop);
$view->setParam('strictformcheck', $settings->_strictFormCheck);
$view($_GET);

View File

@ -37,6 +37,12 @@ if (isset($_GET["start"])) $start=$_GET["start"];
else $start = '';
if (isset($_GET["end"])) $end=$_GET["end"];
else $end = '';
if (isset($_GET["day"])) $day=$_GET["day"];
else $day = '';
if (isset($_GET["year"])) $year=$_GET["year"];
else $year = '';
if (isset($_GET["month"])) $month=$_GET["month"];
else $month = '';
if(isset($_GET['documentid']) && $_GET['documentid'] && is_numeric($_GET['documentid'])) {
$document = $dms->getDocument($_GET["documentid"]);
@ -69,6 +75,9 @@ if($view) {
$view->setParam('calendar', $calendar);
$view->setParam('start', $start);
$view->setParam('end', $end);
$view->setParam('day', $day);
$view->setParam('year', $year);
$view->setParam('month', $month);
$view->setParam('document', $document);
$view->setParam('version', $content);
$view->setParam('event', $event);

View File

@ -55,6 +55,9 @@ $(document).ready(function() {
} /* }}} */
function show() { /* {{{ */
$day = $this->params['day'];
$year = $this->params['year'];
$month = $this->params['month'];
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
@ -66,7 +69,10 @@ $(document).ready(function() {
$this->contentHeading(getMLText("add_event"));
$expdate = getReadableDate();
if($day && $year && $month)
$expdate = sprintf('%04d-%02d-%02d', $year, $month, $day);
else
$expdate = getReadableDate();
?>
<form class="form-horizontal" action="../op/op.AddEvent.php" id="form1" name="form1" method="post">

View File

@ -232,8 +232,14 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style {
$dms = $this->params['dms'];
$user = $this->params['user'];
$strictformcheck = $this->params['strictformcheck'];
$day = $this->params['day'];
$year = $this->params['year'];
$month = $this->params['month'];
header('Content-Type: application/javascript; charset=UTF-8');
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
$query = '';
if($day && $year && $month)
$query = http_build_query(['day'=>$day, 'year'=>$year, 'month'=>$month]);
?>
$(document).ready(function() {
@ -246,7 +252,7 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style {
text: '<?php printMLText('add_event'); ?>',
click: function() {
// alert('clicked the custom button!');
document.location.href = '../out/out.AddEvent.php';
document.location.href = '../out/out.AddEvent.php<?= $query ? '?'.$query : ''?>';
}
}
},