Initial stab at better general datetime picker
This commit is contained in:
parent
e425def2a2
commit
7e091c05a1
@ -18,18 +18,6 @@ function events_post(&$a) {
|
|||||||
$start_text = escape_tags($_REQUEST['start_text']);
|
$start_text = escape_tags($_REQUEST['start_text']);
|
||||||
$finish_text = escape_tags($_REQUEST['finish_text']);
|
$finish_text = escape_tags($_REQUEST['finish_text']);
|
||||||
|
|
||||||
$startyear = intval($_POST['startyear']);
|
|
||||||
$startmonth = intval($_POST['startmonth']);
|
|
||||||
$startday = intval($_POST['startday']);
|
|
||||||
$starthour = intval($_POST['starthour']);
|
|
||||||
$startminute = intval($_POST['startminute']);
|
|
||||||
|
|
||||||
$finishyear = intval($_POST['finishyear']);
|
|
||||||
$finishmonth = intval($_POST['finishmonth']);
|
|
||||||
$finishday = intval($_POST['finishday']);
|
|
||||||
$finishhour = intval($_POST['finishhour']);
|
|
||||||
$finishminute = intval($_POST['finishminute']);
|
|
||||||
|
|
||||||
$adjust = intval($_POST['adjust']);
|
$adjust = intval($_POST['adjust']);
|
||||||
$nofinish = intval($_POST['nofinish']);
|
$nofinish = intval($_POST['nofinish']);
|
||||||
|
|
||||||
@ -560,18 +548,15 @@ function events_content(&$a) {
|
|||||||
'$placeholdercategory' => t('Categories (comma-separated list)'),
|
'$placeholdercategory' => t('Categories (comma-separated list)'),
|
||||||
'$category' => $category,
|
'$category' => $category,
|
||||||
'$s_text' => t('Event Starts:') . ' <span class="required" title="' . t('Required') . '">*</span>',
|
'$s_text' => t('Event Starts:') . ' <span class="required" title="' . t('Required') . '">*</span>',
|
||||||
'$bootstrap' => 1,
|
|
||||||
'$stext' => $stext,
|
'$stext' => $stext,
|
||||||
'$ftext' => $ftext,
|
'$ftext' => $ftext,
|
||||||
'$ModalCANCEL' => t('Cancel'),
|
'$ModalCANCEL' => t('Cancel'),
|
||||||
'$ModalOK' => t('OK'),
|
'$ModalOK' => t('OK'),
|
||||||
'$s_dsel' => datesel($f,'start',$syear+5,$syear,false,$syear,$smonth,$sday),
|
'$s_dsel' => datetimesel($f,'start_text',$syear+5,$syear,false,$syear,$smonth,$sday,$shour,$sminute),
|
||||||
'$s_tsel' => timesel('start',$shour,$sminute),
|
|
||||||
'$n_text' => t('Finish date/time is not known or not relevant'),
|
'$n_text' => t('Finish date/time is not known or not relevant'),
|
||||||
'$n_checked' => $n_checked,
|
'$n_checked' => $n_checked,
|
||||||
'$f_text' => t('Event Finishes:'),
|
'$f_text' => t('Event Finishes:'),
|
||||||
'$f_dsel' => datesel($f,'finish',$fyear+5,$fyear,false,$fyear,$fmonth,$fday),
|
'$f_dsel' => datetimesel($f,'finish_text',$fyear+5,$fyear,false,$fyear,$fmonth,$fday,$fhour,$fminute),
|
||||||
'$f_tsel' => timesel('finish',$fhour,$fminute),
|
|
||||||
'$a_text' => t('Adjust for viewer timezone'),
|
'$a_text' => t('Adjust for viewer timezone'),
|
||||||
'$a_checked' => $a_checked,
|
'$a_checked' => $a_checked,
|
||||||
'$d_text' => t('Description:'),
|
'$d_text' => t('Description:'),
|
||||||
|
@ -233,41 +233,13 @@ function profiles_post(&$a) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_POST['dob']) {
|
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
|
||||||
$year = substr($_POST['dob'],0,4);
|
|
||||||
$month = substr($_POST['dob'],5,2);
|
|
||||||
$day = substr($_POST['dob'],8,2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$year = intval($_POST['year']);
|
|
||||||
if($year < 1900 || $year > 2100 || $year < 0)
|
|
||||||
$year = 0;
|
|
||||||
$month = intval($_POST['month']);
|
|
||||||
if(($month > 12) || ($month < 0))
|
|
||||||
$month = 0;
|
|
||||||
$mtab = array(0,31,29,31,30,31,30,31,31,30,31,30,31);
|
|
||||||
$day = intval($_POST['day']);
|
|
||||||
if(($day > $mtab[$month]) || ($day < 0))
|
|
||||||
$day = 0;
|
|
||||||
|
|
||||||
// if($year && (! ($month && $day))) {
|
|
||||||
// $month = 1; $day = 1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
$dob = '0000-00-00';
|
|
||||||
$dob = sprintf('%04d-%02d-%02d',$year,$month,$day);
|
|
||||||
|
|
||||||
|
|
||||||
$name = escape_tags(trim($_POST['name']));
|
$name = escape_tags(trim($_POST['name']));
|
||||||
|
|
||||||
if($orig[0]['name'] != $name)
|
if($orig[0]['name'] != $name)
|
||||||
$namechanged = true;
|
$namechanged = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$pdesc = escape_tags(trim($_POST['pdesc']));
|
$pdesc = escape_tags(trim($_POST['pdesc']));
|
||||||
$gender = escape_tags(trim($_POST['gender']));
|
$gender = escape_tags(trim($_POST['gender']));
|
||||||
$address = escape_tags(trim($_POST['address']));
|
$address = escape_tags(trim($_POST['address']));
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
<h3>{{$title}}</h3>
|
<h3>{{$title}}</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{{if ! $bootstrap}}
|
{{$desc}}
|
||||||
{{$format_desc}} {{/if}}{{$desc}}
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form action="{{$post}}" method="post" >
|
<form action="{{$post}}" method="post" >
|
||||||
@ -17,11 +16,7 @@
|
|||||||
<input type="text" id="event-summary" name="summary" value="{{$t_orig}}" />
|
<input type="text" id="event-summary" name="summary" value="{{$t_orig}}" />
|
||||||
|
|
||||||
<div id="event-start-text">{{$s_text}}</div>
|
<div id="event-start-text">{{$s_text}}</div>
|
||||||
{{if $bootstrap}}
|
{{$s_dsel}}
|
||||||
<i class="icon-calendar btn btn-default" onclick="eventGetStart(); return false;" /></i> <input type="text" name="start_text" id="start-text" value="{{$stext}}" />
|
|
||||||
{{else}}
|
|
||||||
{{$s_dsel}} {{$s_tsel}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<div class="clear"></div><br />
|
<div class="clear"></div><br />
|
||||||
|
|
||||||
@ -31,11 +26,7 @@
|
|||||||
|
|
||||||
<div id="event-finish-wrapper">
|
<div id="event-finish-wrapper">
|
||||||
<div id="event-finish-text">{{$f_text}}</div>
|
<div id="event-finish-text">{{$f_text}}</div>
|
||||||
{{if $bootstrap}}
|
{{$f_dsel}}
|
||||||
<i class="icon-calendar btn btn-default" onclick="eventGetFinish(); return false;" /></i> <input type="text" name="finish_text" id="finish-text" value="{{$ftext}}" />
|
|
||||||
{{else}}
|
|
||||||
{{$f_dsel}} {{$f_tsel}}
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="event-datetime-break"></div>
|
<div id="event-datetime-break"></div>
|
||||||
@ -73,81 +64,4 @@
|
|||||||
<input id="event-submit" type="submit" name="submit" value="{{$submit}}" />
|
<input id="event-submit" type="submit" name="submit" value="{{$submit}}" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- Modal for item expiry-->
|
|
||||||
<div class="modal" id="startModal" tabindex="-1" role="dialog" aria-labelledby="expiryModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h4 class="modal-title" id="startModalLabel">{{$s_text}}</h4>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="modal-body"> -->
|
|
||||||
<div class="modal-body form-group" style="width:90%">
|
|
||||||
<div class="input-group input-group-sm date" id="datetimepickerstart">
|
|
||||||
<span class="input-group-addon"><!-- <span class="glyphicon glyphicon-calendar"></span> -->
|
|
||||||
<span class="icon-calendar"></span>
|
|
||||||
</span>
|
|
||||||
<input id="start-date" value='{{$stext}}' type='text' class="form-control" data-date-format="YYYY-MM-DD HH:mm" size="20"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- </div> -->
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{$ModalCANCEL}}</button>
|
|
||||||
<button id="start-modal-OKButton" type="button" class="btn btn-primary">{{$ModalOK}}</button>
|
|
||||||
</div>
|
|
||||||
</div><!-- /.modal-content -->
|
|
||||||
</div><!-- /.modal-dialog -->
|
|
||||||
</div><!-- /.modal -->
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function() {
|
|
||||||
$('#datetimepickerstart').datetimepicker({
|
|
||||||
language: 'us',
|
|
||||||
icons: {
|
|
||||||
time: "icon-time",
|
|
||||||
date: "icon-calendar",
|
|
||||||
up: "icon-arrow-up",
|
|
||||||
down: "icon-arrow-down"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- Modal for item expiry-->
|
|
||||||
<div class="modal" id="finishModal" tabindex="-1" role="dialog" aria-labelledby="expiryModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h4 class="modal-title" id="finishModalLabel">{{$s_text}}</h4>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="modal-body"> -->
|
|
||||||
<div class="modal-body form-group" style="width:90%">
|
|
||||||
<div class="input-group input-group-sm date" id="datetimepickerfinish">
|
|
||||||
<span class="input-group-addon"><!-- <span class="glyphicon glyphicon-calendar"></span> -->
|
|
||||||
<span class="icon-calendar"></span>
|
|
||||||
</span>
|
|
||||||
<input id="finish-date" value='{{$ftext}}' type='text' class="form-control" data-date-format="YYYY-MM-DD HH:mm" size="20"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- </div> -->
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{$ModalCANCEL}}</button>
|
|
||||||
<button id="finish-modal-OKButton" type="button" class="btn btn-primary">{{$ModalOK}}</button>
|
|
||||||
</div>
|
|
||||||
</div><!-- /.modal-content -->
|
|
||||||
</div><!-- /.modal-dialog -->
|
|
||||||
</div><!-- /.modal -->
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function() {
|
|
||||||
$('#datetimepickerfinish').datetimepicker({
|
|
||||||
language: 'us',
|
|
||||||
icons: {
|
|
||||||
time: "icon-time",
|
|
||||||
date: "icon-calendar",
|
|
||||||
up: "icon-arrow-up",
|
|
||||||
down: "icon-arrow-down"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user