Skip to content

Commit e59fe36

Browse files
author
Florian Schaal
committed
2 parents ee405d8 + 43e5b66 commit e59fe36

File tree

12 files changed

+59
-132
lines changed

12 files changed

+59
-132
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,13 @@ function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
255255
if ($display_seconds === true) {
256256
$dselect[] = 'second';
257257
}
258+
259+
$tmp_dt = strtr($this->datetimeformat,array('d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy', 'y' => 'yy', 'H' => 'hh', 'h' => 'HH', 'i' => 'ii')) . ($display_seconds ? ':ss' : '');
258260

259261
$out = '';
260-
262+
263+
return '<input type="text" class="form-control" name="' . $form_element . '" value="' . ($_showdate ? date($this->datetimeformat . ($display_seconds ? ':s' : ''), $_datetime) : '') . '" data-input-element="datetime" data-date-format="' . $tmp_dt . '" />';
264+
/*
261265
foreach ($dselect as $dt_element)
262266
{
263267
$dt_options = array();
@@ -318,7 +322,7 @@ function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
318322
$selected_value = (int)floor(date('s', $_datetime));
319323
break;
320324
}
321-
325+
322326
$out .= "<select name=\"".$form_element."[$dt_element]\" id=\"".$form_element."_$dt_element\" class=\"selectInput\" style=\"width: auto; float: none;\">";
323327
if (!$_showdate) {
324328
$out .= "<option value=\"-\" selected=\"selected\">--</option>" . PHP_EOL;
@@ -337,7 +341,7 @@ function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
337341
$out .= '</select>' . str_repeat('&nbsp;', $dt_space);
338342
}
339343
340-
return $out;
344+
return $out;*/
341345
}
342346

343347
}

interface/lib/classes/tform_base.inc.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class tform_base {
9898
var $errorMessage = '';
9999

100100
var $dateformat = "d.m.Y";
101+
var $datetimeformat = 'd.m.Y H:i';
101102
var $formDef = array();
102103
var $wordbook;
103104
var $module;
@@ -153,6 +154,7 @@ function loadFormDef($file, $module = '') {
153154
$this->wordbook = $wb;
154155

155156
$this->dateformat = $app->lng('conf_format_dateshort');
157+
$this->datetimeformat = $app->lng('conf_format_datetime');
156158

157159
return true;
158160
}
@@ -708,13 +710,8 @@ protected function _encode($record, $tab, $dbencode = true, $api = false) {
708710
if($record[$key] != '' && $record[$key] != '0000-00-00') {
709711
if(function_exists('date_parse_from_format')) {
710712
$date_parts = date_parse_from_format($this->dateformat, $record[$key]);
711-
//list($tag,$monat,$jahr) = explode('.',$record[$key]);
712713
$new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
713-
//$tmp = strptime($record[$key],$this->dateformat);
714-
//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
715714
} else {
716-
//$tmp = strptime($record[$key],$this->dateformat);
717-
//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
718715
$tmp = strtotime($record[$key]);
719716
$new_record[$key] = date('Y-m-d', $tmp);
720717
}
@@ -724,8 +721,6 @@ protected function _encode($record, $tab, $dbencode = true, $api = false) {
724721
break;
725722
case 'INTEGER':
726723
$new_record[$key] = (isset($record[$key]))?$app->functions->intval($record[$key]):0;
727-
//if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
728-
//if($key == 'refresh') die($record[$key]);
729724
break;
730725
case 'DOUBLE':
731726
$new_record[$key] = $record[$key];
@@ -735,15 +730,22 @@ protected function _encode($record, $tab, $dbencode = true, $api = false) {
735730
break;
736731

737732
case 'DATETIME':
738-
if (is_array($record[$key]))
733+
/*if (is_array($record[$key]))
739734
{
740735
$filtered_values = array_map(create_function('$item', 'return (int)$item;'), $record[$key]);
741736
extract($filtered_values, EXTR_PREFIX_ALL, '_dt');
742737
743738
if ($_dt_day != 0 && $_dt_month != 0 && $_dt_year != 0) {
744739
$new_record[$key] = date( 'Y-m-d H:i:s', mktime($_dt_hour, $_dt_minute, $_dt_second, $_dt_month, $_dt_day, $_dt_year) );
745740
}
746-
}
741+
} else {*/
742+
if($record[$key] != '' && $record[$key] != '0000-00-00 00:00:00') {
743+
$tmp = strtotime($record[$key]);
744+
$new_record[$key] = date($this->datetimeformat, $tmp);
745+
} else {
746+
$new_record[$key] = '0000-00-00 00:00:00';
747+
}
748+
/*}*/
747749
break;
748750
}
749751

interface/web/js/uni-form/uni-form.jquery.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

interface/web/sites/templates/ftp_user_advanced.htm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ <h1><tmpl_var name="list_head_txt"></h1>
1616
<div class="col-sm-9"><input type="text" name="dir" id="dir" value="{tmpl_var name='dir'}" class="form-control" /></div></div>
1717
<div class="form-group">
1818
<label for="quota_files" class="col-sm-3 control-label">{tmpl_var name='quota_files_txt'}</label>
19-
<div class="col-sm-9"><input type="text" name="quota_files" id="quota_files" value="{tmpl_var name='quota_files'}" class="form-control" /></div><label class="col-sm-3 control-label">{tmpl_var name='quota_files_unity_txt'}</label>
19+
<div class="col-sm-8"><input type="text" name="quota_files" id="quota_files" value="{tmpl_var name='quota_files'}" class="form-control" /></div><div class="col-sm-1">{tmpl_var name='quota_files_unity_txt'}</div>
2020
</div>
2121
<div class="form-group">
2222
<label for="ul_ratio" class="col-sm-3 control-label">{tmpl_var name='ul_ratio_txt'}</label>
23-
<div class="col-sm-9"><input type="text" name="ul_ratio" id="ul_ratio" value="{tmpl_var name='ul_ratio'}" class="form-control" /></div><label class="col-sm-3 control-label"></label>
23+
<div class="col-sm-8"><input type="text" name="ul_ratio" id="ul_ratio" value="{tmpl_var name='ul_ratio'}" class="form-control" /></div><div class="col-sm-1"></div>
2424
</div>
2525
<div class="form-group">
2626
<label for="dl_ratio" class="col-sm-3 control-label">{tmpl_var name='dl_ratio_txt'}</label>
27-
<div class="col-sm-9"><input type="text" name="dl_ratio" id="dl_ratio" value="{tmpl_var name='dl_ratio'}" class="form-control" /></div><label class="col-sm-3 control-label"></label>
27+
<div class="col-sm-8"><input type="text" name="dl_ratio" id="dl_ratio" value="{tmpl_var name='dl_ratio'}" class="form-control" /></div><div class="col-sm-1"></div>
2828
</div>
2929
<div class="form-group">
3030
<label for="ul_bandwidth" class="col-sm-3 control-label">{tmpl_var name='ul_bandwidth_txt'}</label>
31-
<div class="col-sm-9"><input type="text" name="ul_bandwidth" id="ul_bandwidth" value="{tmpl_var name='ul_bandwidth'}" class="form-control" /></div><label class="col-sm-3 control-label">kb/s</label>
31+
<div class="col-sm-8"><input type="text" name="ul_bandwidth" id="ul_bandwidth" value="{tmpl_var name='ul_bandwidth'}" class="form-control" /></div><div class="col-sm-1">kb/s</div>
3232
</div>
3333
<div class="form-group">
3434
<label for="dl_bandwidth" class="col-sm-3 control-label">{tmpl_var name='dl_bandwidth_txt'}</label>
35-
<div class="col-sm-9"><input type="text" name="dl_bandwidth" id="dl_bandwidth" value="{tmpl_var name='dl_bandwidth'}" class="form-control" /></div><label class="col-sm-3 control-label">kb/s</label>
35+
<div class="col-sm-8"><input type="text" name="dl_bandwidth" id="dl_bandwidth" value="{tmpl_var name='dl_bandwidth'}" class="form-control" /></div><div class="col-sm-1">kb/s</div>
3636
</div>
3737
<div class="form-group">
3838
<label for="expires" class="col-sm-3 control-label">{tmpl_var name='expires_txt'}</label>
39-
{tmpl_var name='expires'}
39+
<div class="col-sm-9">{tmpl_var name='expires'}</div>
4040
</div>
4141

4242

interface/web/sites/templates/ftp_user_advanced_client.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h1><tmpl_var name="list_head_txt"></h1>
1010
<div class="col-sm-9"><input type="text" name="dir" id="dir" value="{tmpl_var name='dir'}" class="form-control" /></div></div>
1111
<div class="form-group">
1212
<label for="expires" class="col-sm-3 control-label">{tmpl_var name='expires_txt'}</label>
13-
{tmpl_var name='expires'}
13+
<div class="col-sm-9">{tmpl_var name='expires'}</div>
1414
</div>
1515

1616

interface/web/themes/default/assets/javascripts/bootstrap-datetimepicker.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

interface/web/themes/default/assets/javascripts/ispconfig.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,24 @@ var ISPConfig = {
121121
});
122122
}
123123

124+
$('input[data-input-element="date"]').datetimepicker({
125+
'language': 'en', // TODO
126+
'todayHighlight': true,
127+
'todayBtn': 'linked',
128+
'bootcssVer': 3,
129+
'fontAwesome': true,
130+
'autoclose': true,
131+
'minView': 'month'
132+
});
133+
$('input[data-input-element="datetime"]').datetimepicker({
134+
'language': 'en', // TODO
135+
'todayHighlight': true,
136+
'todayBtn': 'linked',
137+
'bootcssVer': 3,
138+
'fontAwesome': true,
139+
'autoclose': true
140+
});
141+
124142
ISPConfig.callHook('onAfterContentLoad', {'url': url, 'data': data });
125143
},
126144

0 commit comments

Comments
 (0)